4-12
unsigned char dtr;
unsigned char en485;
unsigned char err;
unsigned char node;
unsigned char cr; /* scc CR register */
unsigned char slave;
unsigned int in_segm; /* input buffer segment */
unsigned int in_offs; /* input buffer offset */
unsigned int out_segm; /* output buffer segment */
unsigned int out_offs; /* output buffer offset */
unsigned char byte_delay;
/* V25 macro service byte delay */
} COM;
sn_init
Arguments: unsigned char b, unsigned char* ibuf, int isiz, unsigned char* obuf, int osiz, COM* c
Return value: none
This function initializes either SER0 or SER1 with the specified parameters. mode is the serial control
register value. b is the baud rate value shown in Table 4.1. The arguments ibuf and isiz specify the input-
data buffer, and obuf and osiz specify the location and size of the transmit ring buffer.
If mode = 0xc9, the serial ports are initialized for 8-bit, 1 stop bit, no parity communication.
There are a couple different functions used for transmission of data. You can actually place data within the
output buffer manually, incrementing the head and tail buffer pointers appropriately. If you do not call one
of the following functions, however, the driver interrupt for the appropriate serial-port will be disabled,
which means that no values will be transmitted. This allows you to control when you wish the transmission
of data within the outbound buffer to begin. Once the interrupts are enabled, it is dangerous to manipulate
the values of the outbound buffer, as well as the values of the buffer pointer.
putsern
Arguments: unsigned char outch, COM *c
Return value: int return_value
This function places one byte outch into the transmit buffer for the appropriate serial port. The return value
returns one in case of success, and zero in any other case.
putsersn
Arguments: char* str, COM *c
Return value: int return_value
This function places a null-terminated character string into the transmit buffer. The return value returns one
in case of success, and zero in any other case.
DMA transfer automatically places incoming data into the inbound buffer. serhitn() should be called before
trying to retrieve data.
serhitn
Arguments: COM *c
Return value: int value
This function returns 1 as value if there is anything present in the in-bound buffer for this serial port.
getsern
Arguments: COM *c