1. cominit(portno, baud, db, parity, sb)
int cominit
unsigned int baud
int portno, db, parity, sb
The cominit is used to setup several communication
parameters.
portno (int)
port number that defined in configuration file.
baud
(unsigned int)
baud rate. Either B38400, B19200, B9600, B4800,
B2400, B1200, B600, B300.
B38400
(38400)
|
38400 baud.
|
B19200
(19200)
|
19200 baud.
|
B9600 (9600)
|
9600 baud.
|
B4800 (4800)
|
4800 baud.
|
B2400 (2400)
|
2400 baud.
|
B1200 (1200)
|
1200 baud.
|
B600 (600)
|
600 baud.
|
B300 (300)
|
300 baud.
|
db (int)
data bits. Either CS8, CS7, CS6, CS5.
CS8 (8)
|
8
bits
|
CS7 (7)
|
7
bits
|
CS6 (6)
|
6
bits
|
CS5 (5)
|
5
bits
|
parity (int)
parity bit. Either
PNONE, PEVEN, PODD.
PNONE (0
|
none parity check.
|
PODD (1
|
odd parity.
|
PEVEN (2)
|
even parity.
|
sb (int)
stop bits. Either
ST1 or ST2.
ST1 (1)
|
one stop bit.
|
ST2 (2)
|
two stop bits.
|
return
value (int)
0 : success.
1 : fail.
2.
comtxch(portno, ch)
int comtxch
int portno
char ch
The comtxch is used to send a character to serial port.
ch (char)
transmitted character
return
value (int)
3. comrxch(portno, ch)
int comrxch
int portno
char *ch
The comrxch is
used to get a character.
ch (char*)
received character.
return
value (int)
0
|
success.
|
1
|
fail (receive no character).
|
4.
comstat(portno)
int comstat
int portno
The comstat is used
to get serial port
status, the status
indicator is shown in the following.
return value (int)
bit 15
|
time out
error.
|
bit
14
|
transmitter
shift register empty.
|
bit
13
|
transmitter
holding register empty.
|
bit
8
|
data ready
(data available in input buffer).
|
bit
7
|
received
line signal detect (RLSD).
|
bit
5
|
data set
ready (DSR).
|
bit
4
|
clear to
send (CTS).
|
You may check the
parameters to detect which bit is set.
definition
|
position
|
value
|
S_CTS
|
4
|
0X0010
|
S_DSR
|
5
|
0X0020
|
S_DCD
|
7
|
0X0080
|
S_RDA
|
8
|
0X0100
|
S_THRE
|
13
|
0X2000
|
S_TSRE
|
14
|
0X4000
|
S_TIMEOUT
|
15
|
0X8000
|
5.
comactive(portno)
int comactive
int portno
Check if the port
is active.
return value (int)
6.
comsetDTR(portno,n)
void comsetDTR
int portno,n
Set DTR signal
ON or OFF.
n (int)
ACTIVE (1)
|
set DTR ON
|
INACTIVE (0)
|
set DTR OFF
|
7. compeek(portno)
int compeek
int portno
The compeek is used to perform nondestructively read a character. The
read character remains in the receive buffer.
return
value (int)
0XFFFF
|
no character
|
?
|
received character
|
8.
comsetflow(portno,n)
void comsetflow
int portno, n
To set communication
protocol.
n (int)
F_XONXOF
(0X09)
|
set XON/XOFF protocol.
|
F_RTSCTS
(0X01)
|
set CTS/RTS protocol.
|
F_DTRDSR
(0X04)
|
set DSR/DTR protocol.
|
9.
comtxblk(portno, pointer, n)
int comtxblk
int portno,n
void *pointer
To transmit a block of data, it uses one
BIOS call to transmit a block of data.
pointer (pointer)
pointer to start
of block.
n (int)
block length.
return value (int)
number of characters
be sent.
10.
comrxblk(portno, pointer, n)
int comrxblk
int portno, n
void *pointer
To receive
a block of data, it uses one BIOS
call to receive a block of data.
pointer (pointer)
pointer to start
of block.
n (int)
number of characters
should be received.
return value (int)
number of characters
actually received.
11.
combreak(portno,brk)
void combreak
int portno, brk
Send the break signal to driver.
brk (int)
ACTIVE (1)
|
break the communication.
|
INACTIVE
(0)
|
unbreak the communication
|
12.
cominstalled(portno)
int cominstalled
int portno
Check if the driver
is installed ?
return value (int)
0
|
is installed
|
1
|
not installed
|
13.
comsetport(portno, addr)
void comsetport
int portno, addr
The comsetport is used to set serial port address.
addr (int)
serial port address.
14.
comsetvector(portno, addr)
void comsetvector
int portno, addr
The comsetvector is used
to set interrupt vector address. After interrupt
vector is set, when interrupt is emerged then the
device driver
will detect
interrupt vector to check which port emerges the interrupt.
addr (int)
interrupt vector
address. The address is designed at hardware adapter.
15.
comsetactive(portno, active)
void comsetactive
int portno
char active
The comsetactive is used
to set interrupt
vector is active low or high.
active (char)
0
|
active low.
|
1
|
active high
|
16.
comsetMCR(portno, mcr)
void comsetMCR
int portno, mcr
The comsetMCR is used to control the contents of
modem control register.
Please see APPENDIX B for more details.
mcr (int)
bit 7
|
0
|
bit 6
|
0
|
bit 5
|
0
|
bit 4
|
loopback.
|
bit 3
|
OUT2 signal
|
bit 2
|
OUT1 signal
|
bit 1
|
RTS signal
|
bit 0
|
DTR signal
|
17.
compurgerxbuf(portno)
void compurgerxbuf
int portno
Remove any received buffer data from specify port.
18.
comtxs(portno, s)
int comtxs, portno
char *s
The comtxs is used to send one string to
serial port by calling BIOS for each
character.
s (char*)
one character
string to be sent.
return
value (int)
19. comrxs(portno, s)
int comrxs, portno
char *s
The comrxs is used to get one string from ring buffer by calling BIOS
for each character.
This routine gets characters from ring buffer
until it find <CR> or ring buffer is empty.
s (char*)
received string.
return value (int)
20.
comsettimeout(portno,timeout)
void comsettimeout
int portno
unsigned int timeout
Set time out value about tx; when transmitter buffer
in the specified port is
full, the driver will wait until buffer empty or the timeout value
is expired.
timeout (unsigned int)
time out
value, the unit is 1/18 sec.
21.
comgettimeout(portno)
unsigned int comgettimeout
int portno
Get the tx timeout
value.
return value (unsigned
int)
The time out value,
unit is 1/18 sec.
22.
combufstat(portno)
int combufstat
int portno
The combufstat is used to count the received
characters in buffer.
return value (int)
0xFFFF
|
Buffer overflow
|
otherwise
|
Number of characters in received
buffer
|
23.
comgetMCR(portno)
char comgetMCR
int portno
Get the value
of MCR.
return value (char)
modem control value
(see comsetMCR).
24.
comgetFC(portno)
char comgetFC
int portno
Get flow control
value.
return value (int)
Flow control value
(see comsetflow).
25.
comgetsets()
int comgetsets
Get number of PCCOM set which are controlled by device driver.
return value (int)
Number of PCCOM
set.
26.
comgetsetinfo(portno)
BiosComSet_t *comgetsetinfo
int portno
To get PCCOM set information about specified port, which belongs to
this set.
return value (BiosComSet_t*)
The set information, which is defined as
typedef struct {
unsigned char
irq;
unsigned int
portno;
unsigned int
groupno;
unsigned int
whichgroup;
struct {
unsigned int
base;
unsigned int
vector;
unsigned char
active;
unsigned char
portno;
} group[8];
} BiosComSet_t;
Where
irq
|
irq number of this set.
|
portno
|
number of serial ports in this set.
|
groupno
|
number of groups in this set.
|
whichgroup
|
the specified belongs to which group
|
base
|
base I/O port address.
|
vector
|
interrupt vector address.
|
active
|
active status.
|
port
|
number of ports in this group.
|
27.
comgetinfo(portno, baud, db, parity, sb)
void comgetinfo
unsigned int *baud
int portno, *db,
*parity, *sb
The comgetinfo is used
to get communication
parameters of specified port.
baud (unsigned int*)
baud rate.
db (int*)
data bits. Either
5, 6, 7 or 8 data bits.
parity (int*)
parity bit. Either
NONE, EVEN, ODD.
NONE
(0)
|
none parity check.
|
ODD (1)
|
odd parity.
|
EVEN
(2)
|
even parity.
|
sb (int*)
stop bits. Either 1 or 2 stop bits.
28.
comgetports()
int comgetports
Get the
number of PCCOM ports controlled by the PCCOM driver.
return value (int)
The number of
PCCOM ports.
29.
comdetectport(portno)
int comdetectport
int portno
The comdetectport is used to detect the serial port is exist or not.
return value (int)
0
|
the port is bad.
|
1
|
the port is ok.
|
30.
comgetportinfo(portno)
BiosComport_t *comgetportinfo
int portno
Retrieve all information about one
specified PCCOM port.
return value (BiosComport_t*)
The port information
which is defined as
typedef struct
{
unsigned int
addr;
unsigned int
baud;
unsigned char
lcr;
unsigned char
mcr;
unsigned char
fc;
unsigned char
rx_qsz;
unsigned char
rx_qfree;
unsigned char
rx_enable;
unsigned char
tx_enable;
} BiosComport_t;
Where
addr
|
port address.
|
baud
|
baud rate.
|
lcr
|
line control register
value.
|
mcr
|
modem control register value.
|
fc
|
flow control protocol.
|
rx_qsz
|
received ring buffer size.
|
rx_qfree
|
free space in rx ring buffer.
|
rx_enable
|
flag to notify the port receivable.
|
tx_enable
|
flag to notify the port transmission.
|
31.
comrxoff(portno)
void comrxoff
int portno
Notify the peer
to stop sending data.
32.
comrxon(portno)
void comrxon
int portno
Notify the peer
to restart sending data.
|