[Country EMBED strategy] [131] [Serial drive analysis-receive]

Source: Internet
Author: User

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]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.