┌────────────────────────────────────────────────┐
│ZyXEL communication port driver layer 1 function│
└────────────────────────────────────────────────┘
─────────────────────────────────────────────────────────────────────────────
zyiopen
─────────────────────────────────────────────────────────────────────────────
Open a comm port for the FOSSIL driver
Synopsis: #include "zyl1.h"
int zyiopen(int nComId, int lSpeed, int nParity,
int nStopBits, int nWordLen)
parameters:
nComId
the comm port number : COM1, COM2, COM3, COM4 ...
lSpeed
indicates the communicate baud rate.
300L
600L
1200L
2400L
4800L
9600L
19200L
38400L
nParity
to determine the parity bit
───────────────────────────
value Meaning
───────────────────────────
'N' none parity
───────────────────────────
'O' odd parity
───────────────────────────
'E' even parity
───────────────────────────
nStopBits
Stop bit for communications - 1 bit or 2 bits.
nWordLen
Word length for communications - 5, 6, 7, 8 bits.
return code:
return code >= 0 - the communication port number
return code <0 - the error code
───────────────────────────────────────────────────────────────────────────────
zyiinit
───────────────────────────────────────────────────────────────────────────────
initialize the comm port
Synopsis: #include "zyl1.h"
int zyiinit(int nComId, long lSpeed, int nParity,
int nStopBits, int nWordLen)
parameters:
nComId
the comm port number : COM1, COM2, COM3, COM4 ...
lSpeed
indicates the communicate baud rate.
300L
600L
1200L
2400L
4800L
9600L
19200L
38400L
nParity
to determine the parity bit
───────────────────────────
value Meaning
───────────────────────────
'N' none parity
───────────────────────────
'O' odd parity
───────────────────────────
'E' even parity
───────────────────────────
nStopBits
Stop bit for communications - 1 bit or 2 bits.
nWordLen
Word length for communications - 5, 6, 7, 8 bits.
return code:
return code >= 0 - the communication port initialize success
return code <0 - the error code
───────────────────────────────────────────────────────────────────────────────
zyiquit
───────────────────────────────────────────────────────────────────────────────
function:
Close a communication port and initialize the comm port
Synopsis: #include "zyl1.h"
int zyiquit (int nComId)
parameters:
nComId
the comm port number : COM1, COM2, COM3, COM4 ...
return code:
return code >= 0 - the close communication port success
return code <0 - the error code
───────────────────────────────────────────────────────────────────────────────
zyiputc
───────────────────────────────────────────────────────────────────────────────
function:
send a character to the comm port without wait buffer empty.
Synopsis: #include "zyl1.h"
int zyiputc (int nComId, int nCh)
parameters:
nComId
the comm port number : COM1, COM2, COM3, COM4 ...
nCh
the data want to be sent out
return code:
return code >= 0 - success
return code <0 - the error code
───────────────────────────────────────────────────────────────────────────────
zyiputcabs
───────────────────────────────────────────────────────────────────────────────
function:
send a character to comm port with waiting buffer empty
Synopsis: #include "zyl1.h"
int zyiputcabs (int nComId, int nCh)
parameters:
nComId
the comm port number : COM1, COM2, COM3, COM4 ...
nCh
the data want to be sent out
return code:
return code = 0 - success
return code <0 - the error code
───────────────────────────────────────────────────────────────────────────────
zyigetc
───────────────────────────────────────────────────────────────────────────────
function:
receive a character from comm port with waiting
Synopsis: #include "zyl1.h"
int zyigetc (int nComId)
int nComId;
parameters:
nComId
the comm port number : COM1, COM2, COM3, COM4 ...
return code:
return code - the char read from receive buffer
───────────────────────────────────────────────────────────────────────────────
zydtr
───────────────────────────────────────────────────────────────────────────────
function:
receive a character from comm port with waiting
Synopsis: #include "zyl1.h"
int zydtr (int nComId, int nControl)
parameters:
nComId
the comm port number : COM1, COM2, COM3, COM4 ...
nControl
the set or reset control flag
ON - set dtr signal
OFF - reset dtr signal
return code:
return code = 0 success
───────────────────────────────────────────────────────────────────────────────
zyiclear
───────────────────────────────────────────────────────────────────────────────
function:
clear the buffer
Synopsis: #include "zyl1.h"
int zyiclear (int nComId, int nFlag)
parameters:
nComId
the comm port number : COM1, COM2, COM3, COM4 ...
nFlag
the set or reset control flag
ASOUT - clear the tx buffer
ASIN - clear the rx buffer
ASINOUT - clear the tx and rx buffer
return code:
return code = 0 success
───────────────────────────────────────────────────────────────────────────────
zyipeek
───────────────────────────────────────────────────────────────────────────────
function:
peek the rx buffer and detect the rx buffer has any data in it.
and the data is valid, the function will return the data.
if the rx buffer is empty the function will return IDR_BUFREMPTY
Synopsis: #include "zyl1.h"
int zyipeek (int nComId)
parameters:
nComId
the comm port number : COM1, COM2, COM3, COM4 ...
return code:
return code >= 0 - the rx buffer first byte data
return code < 0 - the rx buffer without any data
───────────────────────────────────────────────────────────────────────────────
zyiflow
───────────────────────────────────────────────────────────────────────────────
function:
set or reset the hardware flow control.
Synopsis: #include "zyl1.h"
int zyiflow (int nComId, int nFlag)
parameters:
nComId
the comm port number : COM1, COM2, COM3, COM4 ...
nFlag
to determine the the hardware flow control ON or OFF
ON: set hardware flow control
OFF: reset hardware flow control
return code:
return code = 0 success
───────────────────────────────────────────────────────────────────────────────
zyiusexonxoff
───────────────────────────────────────────────────────────────────────────────
function:
set or reset the XON XOFF flow control.
Synopsis: #include "zyl1.h"
int zyiusexonxoff (int nComId, int nMask)
parameters:
nComId
the comm port number : COM1, COM2, COM3, COM4 ...
nMask
to determine the the XON XOFF flow control
ASIN: set XON XOFF flow control in rx buffer
ASOUT: set XON XOFF flow control in tx buffer
ASINOUT: set XON XOFF flow control in rx and tx buffer
ASNOFL: reset the flow control in rx and tx buffer
return code:
return code = 0 success
───────────────────────────────────────────────────────────────────────────────
void breakISR (void)
───────────────────────────────────────────────────────────────────────────────
function:
the Ctrl-Break interrupt survice routine to detect the Ctrl-Break
is pressed
Synopsis: #include "zyl1.h"
void breakISR (void)
parameters:
NONE
return code:
no return code
───────────────────────────────────────────────────────────────────────────────
breakInstall
───────────────────────────────────────────────────────────────────────────────
function:
To install the breakISR
Synopsis: #include "zyl1.h"
void breakInstall (void)
parameters:
NONE
return code:
no return code
───────────────────────────────────────────────────────────────────────────────
breakInstall
───────────────────────────────────────────────────────────────────────────────
function:
To release the breakISR
Synopsis: #include "zyl1.h"
void breakInstall (void)
parameters:
NONE
return code:
no return code
───────────────────────────────────────────────────────────────────────────────
breakPressed
───────────────────────────────────────────────────────────────────────────────
function:
To determine the Ctrl-Break is pressed
Synopsis: #include "zyl1.h"
BOOL breakPressed (void)
parameters:
NONE
return code:
TRUE: Ctrl-Break was pressed
FALSE: Ctrl-Break was not pressed
───────────────────────────────────────────────────────────────────────────────
breakReset
───────────────────────────────────────────────────────────────────────────────
function:
reset the breakFlag
Synopsis: #include "zyl1.h"
void breakReset (void)
parameters:
NONE
return code:
NONE