The relationship between Linux device driver and the whole hardware system
1, the classification and characteristics of equipment
The hardware of a computer system is mainly composed of CPU, memory and peripherals.
With the development of IC (Integrated circuit) production process, the chip integration is more and more high, often in the CPU internal integrated memory and peripheral adapter.
The driver targets the memory and peripherals (including internal CPU-integrated memory and peripherals) rather than CPU cores.
1.1 Equipment Classification and characteristics
Linux divides memory and peripherals into 3 basic classes:
Character devices: Refers to devices that must be accessed sequentially in serial order.
Does not go through the system's fast cache.
Block devices: can be accessed in any order, one unit for the operation.
The system's fast cache.
Network device: is designed for packet reception and delivery, and does not correspond to the node of the file system.
The communication between the kernel and the network device is completely different from the way the kernel and character devices and block devices communicate.
However, character devices and block devices do not have significant boundaries, such as for Flash devices, which conform to the features of block devices, but we can still use it as a character device to access.
2, Linux device driver and the whole hardware and software relationship
1, in addition to network devices, character devices and block devices are mapped to the Linux file system files and directories, through the file system's system call Interface open (), write (), read (), close () and so on to access character devices and block devices. All character devices and block devices are presented uniformly to the user.
A block device is more complex than a character device, where it first establishes a disk/flash file system (an organization that defines the files and directories on the storage media).
The application uses the Linux system call interface programming, but can also use C library functions, for the purpose of code portability, we recommend the use of C library functions.
Figure 1, as follows:
- This article is from: Linux Learning Tutorial Network
The relationship between Linux device driver and the whole hardware system