LED gpio access from user-space

Gobliins
Hi FriendlyARM community,

i got an AT91SAM9RL-EK with a 2.6.30 Linux buildroot running.
The device-drivers (i guess the sources are /arch/arm/mach-at91/leds.c and
drivers/input/keyboard/gpio_keys.c) for the boards LEDs and
Keys(Interrupts)are installed with the Kernel.

I want to write now a C programm to access the LEDS (later to read the
keys) while i am in user-space.

the leds can be found in /sys/class/leds 
the keys are located in /dev/input/event0 

So far i´ve heard about two options:
1. using open , read , mmap but i could maybe use some help on there.
2. using the device drivers API i really could need help here.

Has anyone some sample code for a similar board or can help me to access
the keys and leds?

thx

davef
http://www.avrfreaks.net/wiki/index.php/Documentation:Linux/GPIO

Gobliins
thx that helped.

rajase
Hi,

Where can i find the LED blinking source file for the micro2440 board?

I need to access GPIO from the user space. 

thanks in advance,
rajase

davef
There are some example programs on the mini2440 CD.  I recall a LED program
but I don't think it was a "blinking LED" program.  I believe you will find
that some of those FriendlyArm examples are closed-source.

Search <closed source>

rajase
Hi

thanks for the response,

Yeah, i have seen those example programs but, i need the application
program and its procedure, which represents binary numbers on all 4 led's
while switching the micro2440 board.

I mean to say, is i need to work with some GPIO pins in that board, it
should run while switch on the board, without waiting for any program to
execute as like example programs.

thanks
rajase

davef
If you just want to control LEDs using user-space calls in a C program
looks at this:

http://www.avrfreaks.net/wiki/index.php/Documentation:Linux/GPIO

Akash Saxena
Hello davef,

The link that were provided by you is not available now. If you have that
content on any other link please give me the link.

Thanks
Akash

Gautam
Attachment: testgg.zip (11.69 KB)
Hi Akash,

I assume you know how to write Linux drivers.

Here is a sample code to help you with the mini2440 board. I have tested it
on my board.

Let me know if you need any help.

Gautam

davef
I'll send you a copy when I get home from work.

Dave Festing
Here it is.

Dave Festing
Attachment: GPIO.zip (27.2 KB)
No ... here it is.