Handle GPIOs in User space for Embedded Linux ARM9

随声附和 提交于 2019-12-11 15:13:50

问题


I have to interface my GSM module with the AM1808 based on ARM9.

I have assigned all the GPIO pins to the Da850.c as well as mux.h files. I successfully created a uImage and inserted that image in my flash.

I need to handle some of that GPIO from User application.

I know that we can handle the GPIO from the Kerel space but i need to handle from the user space.

As for example I have assigned a GPIO for power key to GSM module. I need to change the pin means (HIGH or LOW) through application.

How I can handle it ?

I am using UBUNTU 10.04 for development.

Thank You in advance.


回答1:


Most Linux kernels have GPIO mechanisms built in. It's usually easiest to use those. Overview in Documentation/gpio.txt. This is common newbie topic, there are lots of nice tutorials out there like gpio_sysfs. If you get hung, you could post comment with more info such as which SBC and kernel version you're using (e.g. LogicPD Zoom and 2.6.33), and which GPIO pin(s) you will try first.




回答2:


You can handle this by using mmap to map the physical memory (via /dev/mem/) into user memory.

There's some example code here:

http://naveengopala-embeddedlinux.blogspot.co.uk/2012/01/reading-physical-mapped-memory-using.html



来源:https://stackoverflow.com/questions/15634450/handle-gpios-in-user-space-for-embedded-linux-arm9

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!