Nicolas Luna wrote:
> Hi,
>
> I wonder what would be the easiest way to control GPIO in userspace.
> I read the documentation gpio.txt but I'm not sure what I should use
> (Control interfaces?, GPIO controllers?) and how to implement it.
>
> Is there more explication about int gpio_export_link(struct device
> *dev, const char *name, unsigned gpio) because I think it could be
> the key.
>
> Will I need to write my own module and communicate with it?.
You don't need to write a module. You can access GPIOs from a shell script:
echo $GPIO_NUMBER > /sys/class/gpio/export
creates a directory /sys/class/gpio/gpio$GPIO_NUMBER, e.g. 8.
(That will fail if something else like a driver has requested that gpio
already).
cat /sys/class/gpio/gpio8/value
gets the value 0/1
echo 1 > /sys/class/gpio/gpio8/direction
sets it to output (iirc)
echo 1 > /sys/class/gpio/gpio8/value
now sets the output value.
echo 8 > /sys/class/gpio/unexport
to release it when you are finished.
gpio_export_link() is for when you claim a gpio for use in the kernel but also
want to export one of the above kind of sysfs entries.
--
Jon Povey
[email protected]
Racelogic is a limited company registered in England. Registered number 2743719
.
Registered Office Unit 10, Swan Business Centre, Osier Way, Buckingham, Bucks,
MK18 1TB .
The information contained in this electronic mail transmission is intended by
Racelogic Ltd for the use of the named individual or entity to which it is
directed and may contain information that is confidential or privileged. If you
have received this electronic mail transmission in error, please delete it from
your system without copying or forwarding it, and notify the sender of the
error by reply email so that the sender's address records can be corrected. The
views expressed by the sender of this communication do not necessarily
represent those of Racelogic Ltd. Please note that Racelogic reserves the right
to monitor e-mail communications passing through its network
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source