Seventh Chapter Experience

Source: Internet
Author: User

---restore content starts---

This part of the content we are studying in the laboratory. We saw the flashing of the LED light. The LED driver provides two ways of interacting: command and read-write device files. The LED driver creates a/dev/s3c6410_leds device file that can control 4 LEDs in the Linux driver. 1 means open, 0 is off. If the string length is less than four, it is equivalent to 0 of the following.

The Misc_register function can only establish a device file with a main device number of 10. If you want to build a device file for another master device number, you need to use functions such as cdev_init.register_chrdev_region.cdev_add.class_create.device_creat.

Second, you must understand how to set the register before controlling the led to go out. The ARM processor has multiple registers that can set the status of the LED pins by setting the values of different registers, opening or prohibiting the pull-up circuitry, and controlling the light and off of the LEDs. LEDs have two pins: GPB0 and GPB1. These three registers are Gpmcon,gpmdat and gpmpud. There are two ways of controlling LEDs. Control LEDs with strings. The LEDs are controlled by the I/O command. To control it in either of these ways, the LED driver must receive the corresponding data. If you control LEDs through strings, you need to use the FILE_OPERATIONS.IOCTL function. This function can receive commands and parameters sent to a character device.

LED driver is a real Linux driver that deals with hardware in this book. A complete Linux driver consists of two parts: internal processing and hardware interaction. The internal processor mainly refers to the Linux driver load, uninstall the device file-related action processing, as well as business logic. Interaction with hardware mainly refers to the data interaction with the registers in the hardware through functions such as ioread32,iowrite32. One important thing about porting Linux drivers is that you should try not to modify the Linux-powered interfaces when modifying the source code for Linux drivers.

Through the experiment, we have learned a lot more deeply practical knowledge. Understand the difficulties in the book. More interested in the knowledge of this area.

---restore content ends---

Seventh Chapter Experience

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.