Linux device driver tutorial

  
 

Q1. Why divide the device into two categories: <;block device> and “character device”

A:

1) Linux treats devices as files and has three meanings: First, each device corresponds to a file name, and corresponds to an index node in the kernel. Second, system calls to file operations are mostly applicable to device files. Third, from the application point of view, the logical space of device files is a linear space; for the same specific device, file operations and device drivers It is a different level of the same thing. Conceptually, a system can be divided into three levels: application, file system and device driver.

2) Linux divides devices into two categories, one is like a disk. A device that performs input/output in blocks or sectors, in blocks, is called a block device; the other is a device that performs input/output on a character-by-character basis in characters (bytes) like a keyboard, called Character devices; file systems are usually built on block devices.


Q2. What is a device driver?

A: The software that processes and manages hardware controllers in Linux is the device driver.


Q3. Which registers does the I/O port generally include? What are their respective functions?

A:

1) I/O ports include control registers, status registers, and data registers;

2) Depending on how the peripheral registers are accessed, The CPU is divided into two categories: one is "memory-mapped" mode, and the other is "I/O mapping" (I/O-mapped).

Copyright © Windows knowledge All Rights Reserved