如:
write
write —> fd
tty_write()
do_tty_write()
1
struct tty_struct *tty
struct tty_ldisc *ldisc;
struct tty_ldisc_ops *ops;
// n_tty_write()
write)(struct tty_struct *tty, struct file *file, const unsigned char *buf, size_t nr) -----------------------------------------ldisc层
|
|
|
|
struct tty_struct *tty |
const struct tty_operations *ops; |
//uart_write() |
int (*write)(struct tty_struct * tty,const unsigned char *buf, int count); -------------------------------------core层
//将数据存储到 |
struct uart_state |
struct circ_buf xmit; |
|
|
|
|
struct tty_struct |
struct uart_state |
struct uart_port *uart_port |
const struct uart_ops *ops; |
(*start_tx)(struct uart_port *); -------+ -------------------------------- uart层
写流程:
读流程