LDD3 notes: TTY
My notes while reading Linux Device Drivers 3rd edition, TTY drivers.
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
write
read
tty_insert_flip_char() for each char
tty_flip_buffer_push()
set_termios()
tiocm{g|s}et()
[un]throttle()
start/stop()
tty open/close count example? what happens to tty filps on fork?
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
write
- 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.
read
tty_insert_flip_char() for each char
tty_flip_buffer_push()
- whenever count reaches size
- at the end of sequence
set_termios()
- 38400,8n1 -style serial settings
- handshake mechanism selection
tiocm{g|s}et()
- 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..
[un]throttle()
- rx flow control
start/stop()
- tx enable/disable
tty open/close count example? what happens to tty filps on fork?
Comments
Post a Comment