TTY drivers are a generic implementation of a serial port interface with loose coupling of hardware access and data formatting.
It is a char device composed of
- tty core for user space char device interface
- line discipline for data formatting
- tty driver for hardware access
- can be called from interrupt context.
- must succeed for single byte write
- put_char, flush_chars - start sending them, return right away
- wait_until_sent - start sending, wait until done or timeout
- flush_buffer - discard write buffered chars.
tty_insert_flip_char() for each char
- whenever count reaches size
- at the end of sequence
- 38400,8n1 -style serial settings
- handshake mechanism selection
- access control lines
- tty driver first, except break
- fallback to inherit core functionality with -ENOICTLCMD
- Get Line Status Register LSR: data, overrun, parity, framing, break...
- Wait on MSR: change in CTS,DSR, ring, carrier..
- rx flow control
- tx enable/disable
tty open/close count example? what happens to tty filps on fork?