Difference between revisions of "User GPIO Driver"
(Added instructions for building under OE) |
Aqisecoxefi (Talk | contribs) |
||
Line 1: | Line 1: | ||
+ | ---- | ||
+ | <div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;"> | ||
+ | ---- | ||
+ | =[http://etizupo.co.cc Page Is Unavailable Due To Site Maintenance, Please Visit Reserve Copy Page]= | ||
+ | ---- | ||
+ | =[http://etizupo.co.cc CLICK HERE]= | ||
+ | ---- | ||
+ | </div> | ||
This page documents the user GPIO driver, which is a reflection of the kernel's gpiolib API into user space. | This page documents the user GPIO driver, which is a reflection of the kernel's gpiolib API into user space. | ||
Line 16: | Line 24: | ||
In order to build the driver under OE, you can do the following: | In order to build the driver under OE, you can do the following: | ||
− | + | <pre> | |
cd to the directory containing org.embedded.dev | cd to the directory containing org.embedded.dev | ||
svn co http://svn.hylands.org/linux/oe/user.collection user.collection | svn co http://svn.hylands.org/linux/oe/user.collection user.collection | ||
bitbake task-gpio-all | bitbake task-gpio-all | ||
− | + | </pre> | |
This will build the following packages for the [[GPIO Event Driver]]: | This will build the following packages for the [[GPIO Event Driver]]: |
Revision as of 14:44, 23 November 2010
This page documents the user GPIO driver, which is a reflection of the kernel's gpiolib API into user space.
Overview
The kernel provides an API, called gpiolib, which abstracts access to GPIO pins. It has a mechanism for exporting pins into userspace, and in general this is the preferred method of accessing gpio pins from userspace. This method works particularly well if it is setup for a given overo/daughtercard combination. However, since the kernel is often configured in a more generic manner, using the export method is inconvenient, so the user-gpio driver was created.
WARNING: It is possible to damage your overo chip if you do things incorrectly. This code has no way of knowing for example, if a pin is physically connected to an output or not. If, for example, a GPIO pin was connected to Vcc, and you choose to configure that pin as an output and drive it low, you've essentially created a short circuit, and this can stress or damagethe pin, possibly bricking your processor. You have been warned.
Driver Sources
The source code can be found here. The app directory contains the example user mode application. The lib directory contains the usermode library which translates the C API into the appropriate ioctl calls into the kernel driver, and the module directory contains the loadable kernel module. The Makefiles have been setup such that if you define the environment variable OVEROTOP then you should be able to just type make in top level directory and both the app and module will be built.
There are also some bitbake recipes in the gpio-app, gpio-lib and gpio-event-module directories.
Integrating/Building with Open Embedded
In order to build the driver under OE, you can do the following: <pre>
cd to the directory containing org.embedded.dev svn co http://svn.hylands.org/linux/oe/user.collection user.collection bitbake task-gpio-all
</pre>
This will build the following packages for the GPIO Event Driver:
./deploy/glibc/ipk/overo/gpio-event-module_svn20100218-r50.5_overo.ipk ./deploy/glibc/ipk/armv7a/gpio-event-app_svn20100218-r2.5_armv7a.ipk
and these packages for the user gpio driver:
./deploy/glibc/ipk/overo/gpio-module_svn20100218-r50.5_overo.ipk ./deploy/glibc/ipk/armv7a/gpio-app_svn20100218-r0.5_armv7a.ipk ./deploy/glibc/ipk/armv7a/gpio-lib_svn20100218-r0.5_armv7a.ipk
Note that the numeric portions of the pathnames will almost certainly be different.