The Linux OS device drivers have a fairly classical abstraction and layered thinking. Consistent with the ideas in the world of communication.
One, in the Linux OS, a device driver file is an abstraction of an actual device, whether the device is a computer peripheral, or a segment of virtual memory read-write device. In Linux, opening a device driver file means that the device is turned on.
This is also true in TTY devices (in understanding the line protocol this is, I am not sure of this principle). Here I take the contents of LDD3 (in bold):
TTY drive never sees TTY line procedures. This driver cannot communicate directly with the line code, and it does not even know it exists. The driver's job is to format the data sent to it in a way that the hardware can understand, and to receive data from the hardware. The work of the TTY line discipline is to format data received from a user or hardware in a special way. This format often takes the form of a protocol transformation, such as PPP and Bluetooth.
I want to repeat 2 points: 1, the role of the driver is to accept the hardware data alive to send hardware to understand the data to the hardware device (such as 8N1), and assume the task of configuring the hardware register.
2. The line procedure is used to format the data above the driving layer. The function of formatting is to give the entire device additional functionality. such as PPP as a line of practice, will have authentication, compression and other functions. Of course, here is a little bit of the most important thing: when I say the above sentence, the model is the PC through the serial port access network. Because PPP is used as a link layer protocol in the OSI model, the physical layer can be RS232. General serial communication (including at command send, single-chip microcomputer bare program) do not need PPP protocol control, seemingly need is z-mode and other similar flow control (I used).
Second, about PPP.
Today, under the guidance of the lab expert, I understand how PPP works under Linux.
PPP protocol has the functions of authentication, compression, error correction and so on. But these are the extension functions of PPP, the basic PPP function is only the simple function of error correcting, framing and so on. Linux creates a daemon in user space pppd is used to extend the compression, authentication and other extensions in PPP protocol, while the device driver file/dev/ppp in kernel module realizes the most basic functions of PPP protocol. The PPP protocol is still at the data link layer. You can say so. The socket is used to collect the data processing layer of the User space TCP/IP data sent to the link layer PPP protocol, and the total physical layer device, can be.
[TTY and Uart]ldisc