Serial functions structure, Arguments, Callbacks – Comtrol eCos User Manual
Page 383
Chapter 17. How to Write a Driver
Serial Functions Structure
SERIAL_FUNS(l, putc, getc, set_config, start_xmit, stop_xmit)
Arguments
l
The "C" label for this structure.
putc
bool (*putc)(serial_channel *priv, unsigned char c)
This function sends one character to the interface. It should return
true
if the character is actually consumed.
It should return
false
if there is no space in the interface
getc
unsigned char (*getc)(serial_channel *priv)
This function fetches one character from the interface. It will be only called in a non-interrupt driven mode,
thus it should wait for a character by polling the device until ready.
set_config
bool (*set_config)(serial_channel *priv,cyg_serial_info_t *config)
This function is used to configure the port. It should return
true
if the hardware is updated to match the
desired configuration. It should return
false
if the port cannot support some parameter specified by the given
configuration. E.g. selecting 1.5 stop bits and 8 data bits is invalid for most serial devices and should not be
allowed.
start_xmit
void (*start_xmit)(serial_channel *priv)
In interrupt mode, turn on the transmitter and allow for transmit interrupts.
stop_xmit
void (*stop_xmit)(serial_channel *priv)
In interrupt mode, turn off the transmitter.
279