cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Explorer
Explorer
7,156 Views
Registered: ‎02-27-2014

how to access led on microzed board through kernel space

I am using microzed board to boot linux from it and i am using petalinux tool to build my images. I want to glow an LED through kernel space. I am not sure where and in which file should i make a change so that i can glow LED through kernel space.

Please suggest me , what should i do for this problem?

thanks

0 Kudos
Reply
6 Replies
Highlighted
Scholar
Scholar
7,133 Views
Registered: ‎09-05-2011

The Linux GPIO driver can be accessed by user space through sysfs file system. You should be able to see the controllers at /sys/class/gpio

For more information, check:
http://www.wiki.xilinx.com/Linux+GPIO+Driver
http://www.wiki.xilinx.com/GPIO+User+Space+App
0 Kudos
Reply
Highlighted
Explorer
Explorer
7,022 Views
Registered: ‎02-27-2014

@sampatd Thanks for your reply.

I want to access LED from kernel space and not from user's space.

can u tell me how and where to include the following function:

http://www.zilogic.com/releases/bsp-1.5.1/doc/zdev-user-manual/API-gpio-direction-output.html

 

you can find function gpio_direction_output() in this link .

Can i access and glow LED using this function?

If possible, please help me where to include this function and modification needed to be done

Thanks

 

0 Kudos
Reply
Highlighted
Explorer
Explorer
6,983 Views
Registered: ‎02-27-2014

Can anyone help me regarding this query ?

0 Kudos
Reply
Highlighted
Scholar
Scholar
6,966 Views
Registered: ‎05-28-2013

This is part of the Linux kernel GPIO framework.
See https://www.kernel.org/doc/Documentation/gpio/
in particular the files consumer.txt and gpio-legacy.txt
I do not know if the Zynq GPIOs work with this framework.

You could also consult the source code of the Xilinx GPIO driver module: https://github.com/Xilinx/linux-xlnx/blob/master/drivers/gpio/gpio-xilinx.c

-R
0 Kudos
Reply
Highlighted
Explorer
Explorer
6,805 Views
Registered: ‎02-27-2014

I have to access gpio pin 47 to glow LED on microzed board.

can i access this pin using the function: gpio_direction_output(unsigned gpio, int value)

 

                                                  gpio_direction_output(47,1);

 If possible, In which file can i include above function?

What other functions are required other than gpio_direction_output?

I want my LED glow after kernel boots and i want it from kernel space and not from users space

 

Please help me.

0 Kudos
Reply
Highlighted
Scholar
Scholar
6,796 Views
Registered: ‎09-05-2011

I have not tried the above kernel API; however, if you use PetaLinux 2014.4, you can create the application and integrate it into the rootfs.

Once you have the application, you can auto run it on start up.

Please refer to ug1144 for more information:

http://www.xilinx.com/support/documentation/sw_manuals/petalinux2014_4/ug1144-petalinux-tools-reference-guide.pdf
0 Kudos
Reply