|
On Time RTOS-32 Documentation
Welcome
RTTarget-32
RTKernel-32
RTKernel-32 Programming Manual
Introduction
Multitasking, Real-Time, and RTKernel-32
Module RTKernel-32
Alternate APIs for RTKernel-32
Supplemental Modules
Module FineTime
Module Clock
Module Timer
Module RTCom
Protocols
Hardware Configuration
Module RTKeybrd
Module RTTextIO
Module CPUMoni
Module RTProf
RTKernel-32 Drivers
Demo Programs
Advanced Topics
Typical Error Sources
Error and Information Messages
RTKernel-32 Reference Manual
RTFiles-32
RTIP-32
RTPEG-32
RTUSB-32
|
Module RTCom
Module RTCom offers completely interrupt-driven communication through serial ports. Some of RTCom's features:
- transmission at any baud rate supported by the hardware
- simultaneous support of up to 38 ports
- support of DigiBoard and Hostess boards
- configurable I/O addresses and IRQs
- protocols XOn/XOff, RTS/CTS, and DSR/DTR
- receive and send buffers of arbitrary size
- full error detection for each received byte
- full support of the 16550 UART's FIFO buffer
The interface for RTCom is given in include file Rtcom.h and is documented in the RTKernel-32 Reference Manual.
RTCom supports both polled and interrupt-driven communication. In general, interrupt-driven communication should be used for better performance. In interrupt-driven mode, data is buffered up to a user-defined limit before data is lost. In polling mode, no data is buffered. If a 16550A UART chip is used by a serial port, its internal 16-byte buffer is used.
If interrupt-driven communication is desired on a "standard" port (i.e., a port not on a DigiBoard, Hostess card, or other interrupt-sharing card), the following steps should be taken:
- If the port does not use a standard I/O port address as defined for the IBM PC, call COMSetIOBase. If it does not use a standard IRQ as defined for the IBM PC, call COMSetIRQ also.
- Initialize the port using function COMPortInit.
- If you need a protocol, call COMSetProtocol.
- Call COMEnableInterrupt. All incoming data is put into mailbox COMReceiveBuffer[x], where x is the corresponding port. The mailboxes contain records of type COMData containing the actual data received in the low byte and an error status byte (as defined by the Line Status Register) in the high byte.
- Tasks that want to receive data should perform RTKGet, RTKGetCond, RTKGetTimed, or RTKGetUntil on the corresponding mailboxes. Tasks that want to send should use COMSendChar. COMSendChar writes the data to a send buffer which is emptied by an interrupt handler.
Function COMEnableInterrupt allocates both receive and send buffers with the same size. If you need different sizes, call COMAllocateBuffers first; COMEnableInterrupt will not allocate buffers again.
If polled communication is desired, the following steps should be taken:
Supplemental Modules
Module Timer
Protocols
Hardware Configuration
Module RTKeybrd
|