wiki:tty_driver

Version 4 (modified by alain, 10 years ago) (diff)

--

GIET-VM / TTY Driver

The tty_driver.c and tty_driver.h files define the TTY driver.

This vci_multi_tty component is a multi-terminals controller. It is an external peripheral.

The total number of terminals available in the platform must be defined by the configuration parameter NB_TTY_CHANNELS in the hard_config.h file.

The kernel terminal is TTY[0]. Private TTY Terminal can be allocated to the task requesting it thanks to the giet_tty_alloc() system call. The corresponding TTY terminal index is stored in the context of the task.

The SEG_TTY_BASE address must be defined in the hard_config.h file.

The virtual base address of the associated segment is vbase = SEG_TTY_BASE + cluster_io << 32

The addressable registers map are defined here.

unsigned int _tty_get_register( unsigned int channel, unsigned int index )

This low level function returns the value of register (channel / index).

void _tty_set_register( unsigned int channel, unsigned int index, unsigned int value )

This low level function set a new value in register (channel / index).

void _tty_rx_isr( unsigned int irq_type, unsigned int irq_id, unsigned int channel )

This Interrupt Service Routine handles the IRQ signaling that the RX buffer is not empty. IT can be an HWI or an SWI. There is one communication buffer _tty_rx_buf[i] and one synchronisation variable _tty_rx_full[i] per channel. It does nothing if the TTY_RX buffer is empty, or if the kernel buffer is full when the ISR is called.

void _tty_tx_isr( unsigned int irq_type, unsigned int irq_id, unsigned int channel )

This Interrupt Service Routine handles the IRQ signaling that the TX buffer is empty. IT can be an HWI or an SWI. There is one communication buffer _tty_rx_buf[i] and one synchronisation variable _tty_rx_full[i] per channel. A character is lost if the buffer is full when the ISR is executed. It is not implemented yet...