Platform serial device support – Comtrol eCos User Manual
Page 338

Chapter 11. Porting Guide
Platform Serial Device Support
The first step is to set up the CDL definitions. The configuration options that need to be set are the following:
CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS
The number of channels, usually 0, 1 or 2.
CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL
The channel to use for GDB.
CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_BAUD
Initial baud rate for debug channel.
CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL
The channel to use for the console.
CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD
The initial baud rate for the console channel.
CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT
The default console channel.
The code in
hal_diag.c
need to be converted to support the new serial device. If this the same as a device already
supported, copy that.
The following functions and types need to be rewritten to support a new serial device.
struct channel_data_t;
Structure containing base address, timeout and ISR vector number for each serial device supported. Extra
fields my be added if necessary for the device. For example some devices have write-only control registers, so
keeping a shadow of the last value written here can be useful.
xxxx_ser_channels[];
Array of
channel_data_t
, initialized with parameters of each channel. The index into this array is the
channel number used in the CDL options above and is used by the virtual vector mechanism to refer to each
channel.
void cyg_hal_plf_serial_init_channel(void *__ch_data)
Initialize the serial device. The parameter is actually a pointer to a
channel_data_t
and should be cast back
to this type before use. This function should use the CDL definition for the baud rate for the channel it is
initializing.
void cyg_hal_plf_serial_putc(void * __ch_data, char *c)
Send a character to the serial device. This function should poll for the device being ready to send and then
write the character. Since this is intended to be a diagnostic/debug channel, it is often also a good idea to poll
for end of transmission too. This ensures that as much data gets out of the system as possible.
234