Debug exynos4412-ARM embedded Linux-LEDS/GPIO driver 2, exynos4412leds

Source: Internet
Author: User

Debug exynos4412-ARM embedded Linux-LEDS/GPIO driver 2, exynos4412leds

/**

**************************************** ***************************************@ Author's brother * @ version V1.0.0 * @ date 2016-02-19 **************************** **************************************** * ********** <Beijing university of posts and telecommunications> ********************* **************************************** **************************************** **************************************** * *************** platform exynos4412 ********************* **************************************** ********************/ 1 tool1.1 hardware tools

1) iTOP4412 Development Board

2) USB flash drives or TF cards

3) PC

4) Serial Port

1.2 Software Tools

1) Virtual Machine Vmware

2) Ubuntu12.04.2

3) Super Terminal (Serial Assistant)

2. Write the MakeFile driver

Add code to the above devicenode_linux_module.c file. First, change the file name devicenode_linux_module.c to leds. c.

Process the Makefile of the compilation file, as shown in. Change devicenode_linux_module to leds.

3. Compile the driver to call the LED pins.

Then modify the leds. c file.

First, add the required header file, as shown in, which applies for GPIO, configuration function, configuration parameter, and GPIO macro definition. Then, change the device node name from hello_ctl123 to hello_ctl.

Then you need to modify the probe function. Generally, GPIO Initialization is in probe. Call the configuration function and configure the function, as shown in.

Next, modify the ioctl function. In Linux, ioctl is generally used to control GPIO. Although the write function can implement similar functions, ioctl functions are more efficient. As shown in, GPIO is assigned a value based on the parameters passed in by the application.

As shown in, first make a simple judgment on the parameter, and then assign a value to the led.

34 write application call LED pins

Next, let's take a look at the application, as shown in. The application is relatively simple. To call the latency function, first light the Led for three seconds, then destroy it for three seconds, and then light it up.

Create a new leds folder in Ubuntu, copy the written leds and compilation script to the leds folder, use the Makefile command to compile the driver, and use

Run the "arm-none-linux-gnueabi-gcc-o invoke_leds invoke_leds.c-static" command to compile the application. As shown in.

Copy the invoke_leds and leds. ko files in to the USB flash drive.

Start the Development Board, insert the USB flash drive into the Development Board, and run the "mount/dev/sda1/mnt/udisk/" command to load the USB flash drive,

Run the "insmod/mnt/udisk/leds. ko" command to load the driver leds. ko,

Run the "./mnt/udisk/invoke_leds" command to run the small application invoke_leds, as shown in.

After the above operation, we can see that the led light will be on and off, with an interval of about three seconds in the middle.

 

I have a limited level and it is not easy to grasp the difficulties. So I want to write and help you step by step!

This article only controls the system's default leds. If you want to call the reused leds, such as wifi and camera

Please refer to my blog: Debugging exynos4412-ARM embedded Linux-LEDS/GPIO driver 3

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.