1, define inlet and outlet and function declarations protocol driver:
2, the registration process of the specific function definitions and the inlet and outlet of a character device driver:
Description: There are two functions and register_chrdev_region alloc_chrdev_region, and look at its prototype the following effects:
If we already know the device number to be assigned to use this function is:
if we do not know the device number, the system automatically assigns want, then call this function:
3, but there is a structure file_operations (see my explanation structure another article: embedded linux of --LED drive (miscellaneous equipment)):
4, ioctl direct control chip pin lighting, and no technical content, computing chip pin attention to:
led_open and led_release the time being it did not dry, keep adding it later;
5, loading skin LED driver: insmod led_test.ko
6, view the newly loaded device number: CAT / proc / Devices
. 7, establish a device file: mknod / dev / led_test c 255 0, then you can see it in the drive led_test dev directory:
8 point lights:
the OK , we're done, wash sleep