TTY Data reception Process
TTY Subsystem
Tty_read Response system call in 1.tty_fops
2.tty_read calls the N_tty_read in Tty_ldisc_n_tty
N_tty_read
1. Set the app's status
2. If no data is readable, allow blocking to take effect
3. If there is data readable, read the data from the READ_BUF
When will the serial driver send the data to N_tty_read's read_buf?
When the serial port receives the data, it generates a receive interrupt, and then the interrupt handler sends the data to the READ_BUF.
Serial port driver how to receive data
Serial Interrupt processing program S3c24xx_serial_rx_chars
1. Read the Ufcon register
2. Read the Ufstat register
3. If the amount of data in the receive FIFO is 0, exit processing
4. Read the Uerstat register
5. Remove the received characters from the URXH register
6. Flow control Processing
7. Record the specific error type according to the value of the Uerstat register
8. If you receive a SYSRQ character, do special processing-uart_handle_sysrq_char
9. Send the received characters into the serial drive Buf,uart_insert_char
10. The data received by the serial port driver is sent to the Read_buf,tty_flip_buffer_push of the line code.
Serial control of Flow control
1. Hardware flow control
A B
RX TX
TX Rx
RTS CTS
CTS RTS
When a can receive data, the RTS is set to high, and indirectly, the CTS of B is set to a high level, indicating that B can send the feed. When B can receive data, the RTS is set to high, and the CTS of A is set to a high level, which indicates that a can send data.
The hardware process is divided into: non-automatic process, artificial software judgment FIFO to set RTS; automatic process, when FIFO is less than 32 bytes, ARM processor automatically set RTS. Linux systems mainly support automatic flow control.
[Country EMBED strategy] [131] [Serial drive analysis-receive]