Android Driver Development Seventh chapter notes

Source: Internet
Author: User

This chapter mainly deals with the control of light emitting diodes.

The main learning content is, write driver, create the LED drive device file: Use the Cdev_init function to initialize the Cdev; specify the device number; Use the Cdev_add function to add the character device to the character device array in the kernel; Create a struct with a Class_creat macro class; Use the Device_creat function to create a device file.

There is also learning content, when uninstalling the LED driver device files: Call Device_destroy,class_destroy and Unregister_chrdev_region method; Set register and initialize led driver Control LEDs by string: Using command line or via write function, controlling LEDs via the I/O command: via the IOCTL function, module parameters of the LED driver.

What we need to know in this chapter is that the data of the pointer type is required to specify the array length by the third parameter of the Module_param_array macro; The Linux driver contains multiple module parameters, and the parameters are enclosed in single or double quotation marks; When specifying the parameter values for an array type, the comma must not have spaces before or after it.

Although the LED driver is not complicated, just control the 4 LEDs "but the LED driver has included all the necessary parts of the Linux drive a complete Linux drive consists mainly of internal processing and a reduced component with hardware interaction. The internal processing mainly refers to the Linux driver loading, unloading, and device file-related action processing (reading and writing device files, sending Νo commands to device files) and business logic. Interaction with hardware is mainly referred to through IOWRITE32,. The IOREAD32 function interacts with the registers in the hardware. -linux drive porting on different platforms is also handled in these two parts. If the transplant between different Lin muscle nuclei, mainly the 1th part of the transplant (Linux-driven internal processing, the general Linux kernel version of a large difference, the Linu fork ' core of the APl will be very different), if the migration on various hardware platforms, mainly transplant 2nd part.

The driver of a complete Linux is mainly composed of internal processing and interaction with hardware. Its internal processing is mainly Linux driver loading, unloading and so on. Interaction with hardware refers primarily to the interaction of data with registers in the hardware through some functions. Linux drives are also handled in different platforms. So I also need to learn more about these Linux-powered technologies so that you can write Linux drivers at your own skill.

Android Driver Development Seventh chapter notes

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.