In the BSP, there is a text file (doc/testing/gpio.txt) that explains it: https://github.com/renesas-rz/rskrza1_bsp/blob/master/doc/testing/gpio.txt Here is how to control GPIO pins from userspace. More information can be found here: https://www.kernel.org/doc/Documentation/gpio/sysfs.txt On the RSK board, LED0 is on P7_1. ---------------------------------------------- linux-3.14/arch/arm/mach-shmobile/pfc-rza1.c Look at "gpio_names" to figure out 'port number' is equal to what pin. For example, port number '98' is pin P7_1 # enable the use of that pin echo 98 /sys/class/gpio/export # set that pin as a GPIO-OUT echo out /sys/class/gpio/P7_1/direction # turn LED0 on, then off echo 0 /sys/class/gpio/P7_1/value sleep 1 echo 1 /sys/class/gpio/P7_1/value # if you are done with the pin, you can do this to remove the interface echo 98 /sys/class/gpio/unexport # Read buttons on RZ RSK board SW1 = P1_9 echo 15 /sys/class/gpio/export echo in /sys/class/gpio/P1_9/direction cat /sys/class/gpio/P1_9/value SW2 = P1_8 echo 14 /sys/class/gpio/export echo in /sys/class/gpio/P1_8/direction cat /sys/class/gpio/P1_8/value SW3 = P1_11 echo 17 /sys/class/gpio/export echo in /sys/class/gpio/P1_11/direction cat /sys/class/gpio/P1_11/value
↧