Character I/O Library

The libio-char.a library defines these functions and data types:

iochar_regdrv_power()
Register as a power-managed device driver.
iochar_send_event()
Send a pulse event into io-char's event handler.
kick()
Kick the output driver into life.
timer_queue()
Add a timer entry to the io-char timer queue.
timer_remove()
Remove a timer entry from the io-char timer queue.
ttc()
Configure the terminal's settings.
tti()
Pass rx data or error and control information to io-char.
tti2()
Pass rx data buffer or error and control information to io-char.
tto()
Write tx data to hardware, handle settings, line control, and line status.
tto_checkclients()
Check client lists for notify conditions.
tto_getchar()
Get the first character from the output buffer to process.
TTYCTRL
Contains the settings that are shared by all devices, e.g. the resource manager configuration.
TTYDEV
Contains the settings specific to one serial device.
TTYINIT
Structure used to initialize a tty driver.
tx_inject()
Inject a character at the front of the output buffer.
wait_add()
Add a new wait entry to the client's message buffer.
wait_remove_rcvid()
Remove the rcvid matching the wait entry.

The io-char library calls the tto() function, and the driver implements it. The TTYCTRL and TTYDEV structures provide the interface between io-char and the driver. The tto() function writes tx data, line status, device settings, and line-control information to the hardware.

The driver calls the ttc(), tti() and tti2() functions. The ttc() function initializes the device and the resource manager. The tti() and tti2() functions pass receive data and control information to the io-char library.

The tte() function is generated by an event that causes io-char's event handler to be called.

The relationship between the io-char library and the driver is seen here:


Char interactions


Relationship between io-char and the driver.

The TTYDEV structure contains two buffers: an obuf (output buffer) and an ibuf (input buffer).

The tto() function call provides the interface between the Tx FIFO register and the obuf. It's called to send the contents of the output buffer to the Tx FIFO register.

The tti() and tti2() functions call provide the interface between the Rx FIFO register and the ibuf. They're called to place the data from the Rx FIFO register into the input buffer.

The relationship between the output and input buffers and the tto() and tti() and tti2() function calls can be seen here:


Buffers


Buffer and function call interaction.

The following table indicates the relationship between the driver and these APIs:

The driver implements:
tto() — to transmit data, and perform line status, line control, and device settings, e.g. baud, parity, etc.)
The driver calls:
iochar_regdrv_power() — to register as a power-managed device driver
iochar_send_event() — to send a pulse event into io-char's event handler.
kick() — to kick the output driver into life
timer_queue() — to add a timer entry to io-char timer queue.
timer_remove() — to remove a timer entry from io-char timer queue.
ttc() — to initialize the device and resource manager
tti() — to pass rx data and control info to io-char
tti2() — to pass rx data buffer and control information to io-char
tto_getchar() — to get the first character from the output buf to process.
tto_checkclients() — to check client lists for notify conditions.
tx_inject() — to inject a character at the front of the output buffer
wait_add() — to add a new wait entry to the client message buffer.
wait_remove_rcvid() — to remove the rcvid matching wait entry.
The driver generates an event:
tte() — the io-char event handler.