Linux Device Drivers
来源:互联网 发布:汽车门户网站源码 编辑:程序博客网 时间:2024/05/01 21:16
第一章:驱动程序介绍
Although the distinction between the different kernel tasks isn’t always clearly marked, the kernel’s role can be split (as shown in Figure 1-1) into the following parts:
Loadable Modules
... Each module is made up of object code (not linked into a complete executable) that can be dynamically linked to the running kernel by the insmod program and can be unlinked by the rmmod program.
Classes of Devices and Modules
The Linux way of looking at devices distinguishes between three fundamental device types. Each module usually implements one of these types, and thus is classifiable as a char module, a block module, or a network module.
Character devices
The only relevant difference between a char device and a regular file is that you can always move back and forth in the regular file, whereas most char devices are just data channels, which you can only access sequentially. There exist, nonetheless, char devices that look like data areas, and you can move back and forth in them; for instance, this usually applies to frame grabbers, where the applications can access the whole acquired image using mmap or lseek.
Block devices
...
Network interfaces
...
The filesystem module must implement the lowest level of the system calls that access directories and files, by mapping filenames and paths (as well as other information, such as access modes) to data structures stored in data blocks. Such an interface is completely independent of the actual data transfer to and from the disk (or other medium), which is accomplished by a block device driver.
The ability to decode filesystem information stays at the lowest level of the kernel hierarchy and is
of utmost importance; even if you write a block driver for your new CD-ROM, it is useless if you are not able to run ls or cp on the data it hosts.
第二章 Building and running Modules
Kernel Modules Versus Applications
This kind of approach to programming is similar to eventdriven programming, but while not all applications are event-driven, each and every kernel module is. Another major difference between event-driven applications and kernel code is in the exit function: whereas an application that terminates can be lazy in releasing resources or avoids clean up altogether, the exit function of a module must carefully undo everything the init function built up, or the pieces remain
around until the system is rebooted.
User Space and Kernel Space
A module runs in kernel space, whereas applications run in user space. This concept is at the base of operating systems theory.
Kernel code executing a system call is working in the context of a process—it operates on behalf of the calling process and is able to access data in the process’s address space. Code that handles interrupts, on the other hand, is asynchronous with respect to processes and is not related to any particular process.
The role of a module is to extend kernel functionality; modularized code runs in kernel space. Usually a driver performs both the tasks outlined previously: some functions in the module are executed as part of system calls, and some are in charge of interrupt handling.
- Essential Linux Device Drivers
- Linux Device Drivers
- Linux Device Drivers
- linux Device Drivers platform
- Linux Device Drivers阅读笔记
- Linux Device Drivers, Third Edition
- linux device drivers 读书笔记(第一章)
- Linux Device Drivers 3rd Edition Char Drivers
- Linux Device Drivers 3rd Edition PCI Drivers
- Linux Device Drivers 3rd Edition USB Drivers
- Linux Device Drivers 3rd Edition Block Drivers
- Linux Device Drivers 3rd Edition Network Drivers
- Linux Device Drivers 3rd Edition TTY Drivers
- 《Essential Linux Device Drivers》 第6章 Serial Drivers
- 《Essential Linux Device Drivers》 第7章 Input Drivers
- 《Essential Linux Device Drivers》 第6章 Serial Drivers
- Linux Device Drivers 2nd Edition Notes
- Linux Kernel Threads in Device Drivers
- 传址调用
- 11/4.24 准备考网络管理员
- 合并排序
- CONGRATULATIONS
- 梁实秋 时间即生命
- Linux Device Drivers
- extjs中grid中checkbox的用法,ext中grid获取checkbox的值
- c++实现堆类以及堆排序
- internet信息服务(iis)无法删除的解决方法
- 超级基础A*寻路教程
- Gary CSDN博客落成仪式
- myEclipse7.5中安装 javascript,extjs的代码自动提示spket插件和extjs desiner可视化代码生成工具,extjs的一个很好的学习视频资源地址
- java枚举类型enum的使用
- ediff──emacs中比较文件异同