Android Deep Exploration (Vol. 1) HAL and Driver Development Seventh Chapter summary

Source: Internet
Author: User

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

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.