This chapter is the switch that sends data control LED lights through the Linux drive .
At the beginning of the led lights through the drive control we need to create the led Drive device files :
First step: Initialize the cdev with the cdev-init function
Step Two: Specify the device number
Step three: Use the cdev-add function to add a character device to the character device array in the kernel
Fourth step: Create a struct class using the class-create Macro
Fifth step: Create a device file using the devices creat function
While uninstalling the LED -driven device files, you need to call device-destory,class-destory, and Unregistor-chrder-region (dev__t from,.unsigned count)
We are controlling led led There are two pin lines, control led need to pass 3 Register to complete, each register can use the 4 gpmdat of the Register 4 bit to control the 4 a led light off.
The LED driver can control the driver using two methods:1. Control the led via a string
2. Control LED via I/o command
The LED driver test method can not only send strings to the led device files, but also send I/O control commands. These test methods include executable program testing,NDK testing, and Java testing.
LED driver is a real Linux driver that deals with hardware . We need a more comprehensive understanding of the advanced technologies of Linux drivers and learn more about Linux Drive technology so that you can skillfully write driver code.
http://home.cnblogs.com/u/zivjeli/
Android Deep Exploration (Vol. 1) HAL and Driver Development Seventh Chapter summary