Design of Linux Character Device Driver Journal of Hangzhou Institute of Applied Engineering Vol. 12 No. 4 , Dec. 2000 Design of Linux Character Device Driver PAN Junqiang LIU Li (Department of Computer, Hangzhou Institute of Applied Engineering, Hangzhou 310012) Abstract This paper introduces the methods of establishing devices, initializing devices, allocating device resources, accessing devices and the implementation of related functions in Linux character device driver. Keywords Linux character device Device driver Chinese Library Classification Number TP316181 Device driver is essentially a collection of functions that complete different tasks. The functions provided by these functions can make it possible to receive input from the device and send output to the device just like reading and writing files. Therefore, every device in Linux has the external characteristics of a file and can use system calls such as open(), close(), read() and write(). The main functions of Linux device driver are: a Initialize device; b Provide various device services; c Responsible for data exchange between kernel and device; d Detect and handle errors that occur during device operation. 1 Naming conventions [1] Each device driver has a set of essentially identical functions, and all of them need to be added to the kernel source code to regenerate the kernel. Therefore, in order to prevent conflicts in function names between different drivers, the uniqueness of the name must be ensured. The best way is to add a prefix with the device name as a string before the function of each driver. This article stipulates that the device name for the driver to be developed is \"mydev\". 2 Creation of device files In order to process the read and write operations of the device like file access, all Linux devices have corresponding file names in the appropriate locations in the directory tree, so that they can be opened () and close () system calls; these files are called character device special files...
You Might Like
Recommended ContentMore
Open source project More
Popular Components
Searched by Users
Just Take a LookMore
Trending Downloads
Trending ArticlesMore