Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


Share this Page URL
Help

I/O programming > Case study: device driver in Linux - Pg. 838

838 Chapter 23 Case study: device driver in Linux As discussed in section 2.3, device drivers play an important role in connecting the OS kernel and the peripheral devices. It is the most important layer in the I/O software. This section will analyze details of the device driver by taking Linux as an example (Figure 23.15). User Application C Library Interface of Linux System Call OS Process Scheduler Memory Management Linux File system Disk/Flash Filesystem Block Device Driver Protocol Stack TCP/IP Network Device Driver Character Device Driver Hardware Figure 23.15: Linux device driver in the whole OS. In Linux, the I/O devices are divided into three categories: · · · character device block device network device. There is much difference between the design of a character device driver and a block device driver. However, from a user's point of view, they all use the file system interface functions for operation such as open() , close() , read() and write(). In Linux, the network device driver is designed for data-package transmitting and receiving. The communication between the kernel and the network device and that between the kernel and a character device or a block device are totally different. The TTY driver, I2C driver, USB driver, PCIe driver and LCD driver can be generally classified into these three basic categories; however, Linux also defines specific driver architectures for these complicated devices. In the following part of this section, we will take the character device driver as an example to explain the structure of a Linux device driver and the programming of its main components.