Android Deep Explore (Volume 1) HAL with Driver development seventh chapter LED will blink for me: Control led reading notes

Source: Internet
Author: User

The experiment in this chapter will realize the real Linux driver, which will realize the direct interaction with the hardware. 4 LED lights need to be controlled .

the implementation principle of 7.1LED drive

In fact, it is not the Linux driver that writes data directly to the memory in the hardware, but interacts with the native I/O memory. I/o Memory is a mapping of hardware in host memory that is connected to the host through various interfaces.

7.2 Writing LED Drivers

1. Create LED -driven device files

(1). Use Cdev_init Initialization of functions Cdev

(2). Specify the device number

(3). Use Cdev_add function to add a character device to a character device array in the kernel.

(4) Use class_create Macro Creation struct class

(5) Use device_create function to create a device file

2. uninstalling the LED -driven device files

3. setting the register and initializing the LED driver

4. control LED

7.4LED -driven porting

Because the LED driver does not invoke too many Linux kernel APIs, these APIs are less likely to be lost, So porting to the kernel only needs to be recompiled. Porting Linux drivers is very important, is to modify the Linux driver source code, should try not to modify the Linux The driver interface.

In a complete Linux Drive, mainly consists of internal processing and hardware interaction two parts. If the inter-Linux porting between different versions , the main porting of the first part, on different hardware platforms, then the main second part.

Software 1308 class 31st Zhang Fan Blog Park address: http://home.cnblogs.com/u/sxauzzz/

Android Deep Explore (Volume 1) HAL with Driver development seventh chapter LED will blink for me: Control led reading notes

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.