没有合适的资源?快使用搜索试试~ 我知道了~
资源详情
资源评论
资源推荐
6/8/2015
Line Disciplines--Essential Linux Device Drivers--嵌入式linux中文站
http://www.embeddedlinux.org.cn/essentiallinuxdevicedrivers/final/ch06lev1sec4.html 1/6
嵌入式linux中文站在线图书
Line Disciplines
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. See Figure
7.3 in the next chapter, "Input Drivers," to learn how the keyboard subsystem is connected to N_TTY. 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).
Device Example: Touch Controller
Let's take a look at the internals of a line discipline by implementing a simple line discipline for a serial touch-
screen controller. Figure 6.6 shows how the touch controller is connected on an embedded laptop derivative.
The Finite State Machine (FSM) of the touch controller is a candidate for being implemented as a line discipline
because it can leverage the facilities and interfaces offered by the serial layer.
Figure 6.6. Connection diagram of a touch controller on a PC-derivative.
Open and Close
To create a line discipline, define a structtty_ldisc and register a prescribed set of entry points with the
kernel. Listing 6.2 contains a code snippet that performs both these operations for the example touch
controller.
Listing 6.2. Line Discipline Operations
Code View:
kdbshi
- 粉丝: 55
- 资源: 300
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 聊天系统(java+applet).zip
- 毕业设计:基于SSM的mysql-高校学生请假管理系统(源码 + 数据库 + 说明文档)
- 博客系统(struts+hibernate+spring).rar
- c语言学生成绩管理系统源码.zip
- 毕业设计:基于SSM的mysql-网约车用户服务平台(源码 + 数据库 + 说明文档)
- 内容管理系统(hibernate3+struts2+spring2)130224.rar
- 基于Java的班级管理系统课程设计源码
- 内容管理系统(hibernate3+struts2+spring2).rar
- 路由器刷breed Web控制台助手v5.8版本.rar
- Java 在 JEP 12 提供的特性预览
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0