Seventh: LED will blink for me: Control Light Emitting diode

Source: Internet
Author: User

Although the Linux driver deals 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/0 memory, which is located in the kernel space. The so-called 1/0 memory is through a variety of interfaces (PCI, USB, Bluetooth, Ethernet port, etc.) connected to the host (PC, mobile phone) hardware (network card, sound card, camera, etc.) in the host memory mapping. For example, a driver running on Ubuntu Linux only needs to access I/O memory in a host running Ubuntu Linux, and then the Linux kernel interacts with the data hardware in I/O memory. The Linux kernel provides several functions that interact with 1/0 of memory, such as Ioread16 ioread32 Iowrite16 iowrite32, and so on. The memory management module of the Linux kernel is responsible for synchronizing the data in i/0 storage and hardware. Every hardware that connects to Linux has a map header address in I/O memory. You need to specify these first addresses when reading I/O memory using functions such as IOREAD32. The LEDs on the Development Board also have their mapping first address. The steps to write the LED driver are as follows: First, create the LED-driven device files: Step one: Initialize the Cdev with the Cdev_init function

Step Two: Specify the device number, and step three: Use the Cdev_add function to add the character device to the character device array in the kernel; the fifth: Create a struct class using the Clascreate macro; Then uninstall the LED driver's device files. Set the register with the initialize LED driver. The LED driver can be controlled in the following two ways: The LED is controlled by a string, and the LED is controlled by a command. After the LED lamp code is written, then the LED light test. You can also use the Java Test LED light driver. After the test is complete, the LED light can be transplanted.

Seventh: LED will blink for me: Control Light Emitting diode

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.