= GIET-VM / TTY Driver = [[PageOutline]] The [source:soft/giet_vm/giet_drivers/tty_driver.c tty_driver.c] and [source:soft/giet_vm/giet_drivers/tty_driver.h 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 [source:soft/giet_vm/giet_drivers/tty_driver.h here]. == __Access functions__ == === 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_init'''( unsigned int channel ) === This low function initialises a TTY channel. == __Interrupt Service Routines__ == === 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...