Arguments, How to write a serial hardware interface driver – Comtrol eCos User Manual
Page 380
Chapter 17. How to Write a Driver
lookup
A function called when
cyg_io_lookup()
is called for this device.
priv
A placeholder for any device specific data required by the driver.
The interface to the driver is through the
handlers
field. This is a pointer to a set of functions which implement
the various
cyg_io_XXX()
routines. This table is defined by the macro:
DEVIO_TABLE(l, write, read, get_config, set_config)
Arguments
l
The "C" label for this table of handlers.
write
The function called as a result of
cyg_io_write()
.
read
The function called as a result of
cyg_io_read()
.
get_config
The function called as a result of
cyg_io_get_config()
.
set_config
The function called as a result of
cyg_io_set_config()
.
When eCos is initialized (sometimes called “boot” time), the
init()
function is called for all devices in the system.
The
init()
function is allowed to return an error in which case the device will be placed “off line” and all I/O
requests to that device will be considered in error.
The
lookup()
function is called whenever the
cyg_io_lookup()
function is called with this device name. The
lookup function may cause the device to come “on line” which would then allow I/O operations to proceed. Future
versions of the I/O system will allow for other states, including power saving modes, etc.
How to Write a Serial Hardware Interface Driver
The standard serial driver supplied with eCos is structured as a hardware independent portion and a hardware
dependent interface module. To add support for a new serial port, the user should be able to use the existing
hardware independent portion and just add their own interface driver which handles the details of the actual device.
The user should have no need to change the hardware independent portion.
The interfaces used by the serial driver and serial implementation modules are contained in the file
<
cyg/io/serial.h
>
276