rt_com -- serial port driver for RTLinux
void rt_com_write(unsigned int com, char *pointer, int cnt);
int rt_com_read(unsigned int com, char *pointer, int cnt);
int rt_com_setup(unsigned int com, unsigned int baud,
unsigned int parity, unsigned int stopbits,
unsigned int wordlength);
rt_com_write - writes cnt characters from buffer ptr to serial port com.
rt_com_read - attempts to read cnt characters to buffer ptr from serial port com.
rt_com_setup - for setting of serial port parameters.
rt_com is a linux module. The user must specify, via entries in the rt_com_table (in rt_com.h):
Serial ports, relevant parameters for each, and an interrupt service routine (ISR) to be executed
when the port irq fires. When rt_com is installed with insmod or modprobe, its init_module function
(in rt_com.c) requests the port device memory, registers the ISR, and sets various default values,
for each port entry in rt_com_table.
The user-specified ISR is merely a wrapper to call rt_com_isr() (in rt_com.c); the latter is the real
ISR that does the work of reading from a port to a buffer, or writing from a buffer to a port (it takes
as input the number of the port). The user must edit rt_com.c to insert a wrapper for each desired
port (beyond the first), called rt_com_isrN(), where N is the port's rt_com_table entry number,
following the example of the wrapper given for a first port: rt_com_isr0().
rt_com creates buffers for its own use in reading and writing to the serial ports. The user can specify
the size of these buffers by giving a value to RT_COM_BUF_SIZ in rt_com.h.
After this, RTLinux realtime user modules can use the three rt_com functions listed above to setup,
read from and write to, the serial ports. (rt_com_read and rt_com_write actually read from and write
to the buffers.)
rt_com uses RTLinux facilities for irq's and mutual exclusion. This is what makes the rt_com functions
"realtime": They proceed with all the privileges of the real kernel: RTLinux.
When the module is removed by rmmod, the cleanup_module function in rt_com.c frees all resources.