Linux driver header file description

Source: Internet
Author: User

Http://hi.baidu.com/%BB%F0%D0%C7%C6%B0%B3%E6911/blog/item/3c01cb8c3c5bccab0f244491.html

Driver:
# Include <Linux/***. h> is to find the source file under the linux-2.6.29/include/Linux.
# Include <ASM/****. h> is to find the source file under the linux-2.6.29/ARCH/ARM/include/ASM.
# Include <Mach/***. h> is to find the source file under the linux-2.6.29/ARCH/ARM/mach-s3c2410/include/mach.

# Include <plat/regs-adc.h> In linux-2.6.31_TX2440A20100510 \ linux-2.6.31_TX2440A \ arch \ Arm \ plat-s3c \ include \ Plat
# Include <Linux/module. h> // The most basic file. It supports dynamic addition and uninstallation of modules. The Hello World Driver needs this file.
# Include <Linux/fs. h> // contains the definition of struct related to file operations, for example, struct file_operations

// Contains the definition of struct inode, the header file of minor and major.
# Include <Linux/errno. h> // contains the macro definition of the returned value, so that the user program can use perror to output error information.
# Include <Linux/types. h> // defines some special types, such as dev_t, off_t, and pid_t. in fact, most of these types are changed by the unsigned int type through a series of typedef, just to facilitate reading.
# Include <Linux/cdev. h> // defines the character device structure cdev and a series of operation functions. // Contains the cdev structure and related function definitions.
# Include <Linux/Wait. H> // header file related to the same generation queue // kernel waiting queue, which contains the header file of the spin lock

# Include <Linux/init. h>
# Include <Linux/kernel. h>

# Include <Linux/slab. h> // defines the kcalloc and kzarloc memory allocation functions.
# Include <Linux/uaccess. h> // function definition that contains the memory address of the user process accessed by the kernel such as copy_to_user and copy_from_user.
# Include <Linux/device. h> // contains definitions of structures such as device and class.
# Include <Linux/IO. h> // contains the definition of functions such as ioremap, iowrite, and other kernel access Io memory.
# Include <Linux/miscdevice. h> // contains the definition of the miscdevice structure and related operation functions.
# Include <Linux/interrupt. h> // use the header file required for interruption
# Include <Mach/irqs. h> // use the header file required for interruption
# Include <ASM/bitops. h> // contains the set_bit operation function, which is available for the input subsystem.
# Include <Linux/semaphore. h> // use the header file required by the semaphore.
# Include <Linux/spinlock. h> // spin lock

# Include <Linux/sched. h> // The task_normal and task_interruptible files to be used in the kernel wait queue are included in this header file.
# Include <Linux/kfifo. h> // FIFO annular queue
# Include <Linux/Timer. h> // kernel Timer
# Include <Linux/input. h> // interrupt handling

Main directory of the header file include

The header file directory contains a total of 32. h header files. There are 13 main directories, 4 sub-directories in ASM, 10 sub-directories in Linux, and 5 sub-Directories In sys. The respective functions of these header files are as follows. For specific functions and information, see Chapter 14th.

<A. Out. h>: the header file a. Out defines the format of the. out execution file and some macros.
<Const. h>: constant symbol header file. Currently, only the flag spaces of the I _mode field in the I node are defined.
<Ctype. h>: character type header file, which defines macros for character type judgment and conversion.
<Errno. h>: header file of the error code, which contains various error numbers in the system. (Linus introduced from minix ).
<Fcntl. h>: The file control header file, used to define the operation control constant symbol of the file and Its descriptor.
<Signal. h>: the signal header file, which defines the signal symbol constant, signal structure, and signal operation function prototype.
<Stdarg. h>: Standard parameter header file, which defines the variable parameter list in macro form. It mainly describes a type (va_list) and three macros (va_start, va_arg, and va_end) for vsprintf, vprintf, and vfprintf functions.
<Stddef. h>: standard definition header file, defining null, offsetof (type, member ).
<String. h>: the string header file mainly defines some embedding functions related to string operations.
<Termios. h>: the header file of the input and output functions of the terminal. It mainly defines the terminal interface for controlling the asynchronous communication port.
<Time. h>: The time header file mainly defines the TM structure and the prototype of some time-related functions.
<Unistd. h>: Linux Standard header file, which defines various symbol constants and types and declares various functions. For example, if _ Library __is defined, the system call number and Embedded Assembly _ syscall0 () are also included.
<Utime. h>: the user's time header file defines the access and modification time structure and the utime () prototype.

(1) System Structure-related header file subdirectory Include/ASM

These header files mainly define some data structures, macro functions, and variables closely related to the CPU architecture. 4 files in total.

<ASM/IO. h>: I/O header file, which defines the function for I/O port operations in the form of macro Embedded Assembler.
<ASM/memory. h>: the memory copy header file, which contains memcpy () Embedded Assembly macro functions.
<ASM/segment. h>: Segment operation header file, which defines Embedded Assembler functions related to segment register operations.
<ASM/system. h>: System header file, which defines Embedded Assembly macros for setting or modifying descriptors/interrupt doors.

(2) Linux kernel-specific header file subdirectory Include/Linux

<Linux/config. h>: The Kernel configuration header file that defines the keyboard language and hard disk type (hd_type) options.
<Linux/fdreg. h>: floppy disk header file, which contains some definitions of the floppy disk controller parameters.
<Linux/fs. h>: File System header file, which defines the file table structure (such as file, buffer_head, and m_inode ).
<Linux/hdreg. h>: the hard disk parameter header file that defines information such as the port used to access the hard disk register, status code, and partition table.
<Linux/head. h>: Head header file, which defines the simple structure of the segment descriptor and several selector constants.
<Linux/kernel. h>: kernel header file, which contains the original definition of common kernel functions.
<Linux/mm. h>: Memory Management header file, which contains page size definitions and some page release function prototypes.
<Linux/sched. h>: The scheduler header file defines the task structure task_struct and initial task 0 data,
And some macro statements related to descriptor parameter settings and obtaining of Embedded Assembler functions.
<Linux/sys. h>: System Call header file, which contains 72 system call C function handlers starting with "sys.
<Linux/tty. h>: the TTY header file defines parameters and constants related to tty_io and serial communication.

(3) system-specific data structure subdirectory Include/sys

<Sys/STAT. h>: The File status header file, which contains the file or file system status structure stat {} and constants.
<Sys/times. h>: defines the running time structure of the process. TMS and the prototype of the Times () function.
<Sys/types. h>: Type header file, which defines the basic system data type.
<Sys/utsname. h>: system name structure header file.
<Sys/Wait. H>: wait for the call header file to define the system call wait () and waitpid () and related constant symbols.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.