线路规程(line disciplines)

来源:互联网 发布:linux拷贝文件夹到u盘 编辑:程序博客网 时间:2024/06/10 02:50

  • 线路规程的作用就是将数据进行用户空间和内核空间之间的传输。
  • 而一些底层驱动和终端驱动主要负责数据到硬件的传输。
  • 往往不同的驱动对应着不同的线路规程,比如终端驱动对应着N_TTY ,点点通信对应着N_PPP等。


来源:http://www.itechtalk.com/thread290.html

Line disciplines provide an elegant mechanism that lets you use the same serial driver to run different technologies. The low-level physical driver and the tty driver handle the transfer of data to and from the hardware, while line disciplines are responsible for processing the data and transferring it between kernel space and user space.

The serial subsystem supports 17 standard line disciplines. The default line discipline that gets attached when you open a serial port is N_TTY, which implements terminal I/O processing. N_TTY is responsible for "cooking" characters received from the keyboard. Depending on user request, it maps the control character to newline, converts lowercase to uppercase, expands tabs, and echoes characters to the associated VT. N_TTY also supports a raw mode used by editors, which leaves all the preceding processing to user applications. The example tty drivers listed at the end of the previous section, "TTY Drivers," use N_TTY by default.

Line disciplines also implement network interfaces over serial transport protocols. For example, line disciplines that are part of the Point-to-Point Protocol (N_PPP) and the Serial Line Internet Protocol (N_SLIP) subsystems, frame packets, allocate and populate associated networking data structures, and pass the data on to the corresponding network protocol stack. Other line disciplines handle Infrared Data (N_IRDA) and the Bluetooth Host Control Interface (N_HCI).

原创粉丝点击