User`s guide

3 Porting a BSP to Custom Hardware
3.3 Finalizing Your BSP
103
3
Multi-Mode Serial (SIO) Drivers
The generic multi-mode serial drivers reside in the directory target/src/drv/sio.
These drivers are called SIO drivers to distinguish them from the older serial
drivers, which have only a single interrupt mode of operation. For more
information on the older serial driver design, see Serial Drivers, p.106.
SIO drivers provide an interface for setting hardware options, such as the number
of stop bits, data bits, parity, line speed, and so on. In addition, these drivers
provide an interface for polled communication that can provide external mode
debugging over a serial line (such as that used by a ROM-monitor debugger).
Currently, only asynchronous-mode SIO drivers are supported.
The following serial device macros must be defined for all BSPs:
NUM_TTY
Defines the number of serial channels supported. In configAll.h, the default is
defined as 2. To override the default, first undefine, then define,
NUM_TTY in
config.h. If there are no serial channels, define
NUM_TTY as NONE.
CONSOLE_TTY
This macro defines the channel number of the console. In configAll.h, the
default is defined as 0. To override the default, first undefine, then define,
CONSOLE_TTY in config.h.
Every SIO device is controlled by an
SIO_CHAN structure. This structure contains
a single member, a pointer to an
SIO_DRV_FUNCS structure. These structures are
defined in target/h/sioLib.h as:
typedef struct sio_chan /* a serial channel */
{
SIO_DRV_FUNCS * pDrvFuncs;
/* device data */
} SIO_CHAN;
typedef struct sio_drv_funcs SIO_DRV_FUNCS;
struct sio_drv_funcs /* driver functions */
{
int (*ioctl)
(
SIO_CHAN * pSioChan,
int cmd,
void * arg
);
int (*txStartup)
(
SIO_CHAN * pSioChan
);