Seventh chapter LED will blink for me: Control the Light emitting diode
I. The realization principle of LED driver. Although Linux drives deal directly with hardware, it is not the Linux driver that writes data directly to the memory in the hardware, but interacts with the native I/O memory.
Two. Write led drivers. The Linux driver provides two ways of interacting: command and read-write device files. LED drivers are provided in the form of dynamic drive modules, which require a USB cable to connect the S3C Development Board before the test led driver, and then open the power switch on the S3C Development Board, and after successful startup, execute the build.sh script file to compile and install the LED driver. Create LED-driven device files: ① initializes cdev with the Cdev_init function. ② Specifies the device number, either directly in the code or dynamically assigned. ③ uses the Cdev_add function to add a character device to the character device array in the kernel. ④ creates a struct class using the Class_create macro. ⑤ uses that device_create function to create the device file.
Three. Test the LED driver. A generic program that writes test I/O control commands. LED drivers have two ways of interacting with device files, writing directly to string data and I/O control commands. Writing data directly to a device file can be done either using the command side or through the write function, but the I/O control command can only be emitted by the IOCTL function.
Four. LED-driven porting. One of the important thing about porting Linux drivers is that you should try not to modify the Linux-powered interfaces when modifying the Linux-powered source code. If a statement is modified, it means that the entire driver interface has changed, causing unnecessary trouble.
http://www.cnblogs.com/yangsasa/
Seventh Reading notes