Devtab entry, Arguments, Serial channel structure – Comtrol eCos User Manual
Page 381

Chapter 17. How to Write a Driver
Note: In the sections below we use the notation
<<
xx
>>
to mean a module specific value, referred to as “xx”
below.
DevTab Entry
The interface module contains the devtab entry (or entries if a single module supports more than one interface).
This entry should have the form:
DEVTAB_ENTRY(
<<
module_name
>>
,
<<
device_name
>>
,
0,
&serial_devio,
<<
module_init
>>
,
<<
module_lookup
>>
,
&
<<
serial_channel
>>
);
Arguments
module_name
The "C" label for this devtab entry
device_name
The "C" string for the device. E.g.
/dev/serial0
.
serial_devio
The table of I/O functions. This set is defined in the hardware independent serial driver and should be used.
module_init
The module initialization function.
module_lookup
The device lookup function. This function typically sets up the device for actual use, turning on interrupts,
configuring the port, etc.
serial_channel
This table (defined below) contains the interface between the interface module and the serial driver proper.
Serial Channel Structure
Each serial device must have a “serial channel”. This is a set of data which describes all operations on the device.
It also contains buffers, etc., if the device is to be buffered. The serial channel is created by the macro:
SERIAL_CHANNEL_USING_INTERRUPTS(l, funs, dev_priv, baud,stop, parity, word_length,
flags, out_buf, out_buflen, in_buf, in_buflen)
277