Hello !
I have an A10 with a LCD screen and i have a particulary problem.
In fact , i want managing a particulary PIN on the GPIO3 port with a C program : the PIN number 6, PB3.
I want to send "1" , to the PIN and check with a voltmeter. its simply >:(
My code here :
#include <stdio.h>
#include <sys/io.h>
#include <unistd.h>
#undef extern
int main(int argc,char* argv[])
{
printf("Debut du programme test du PIN");
ioperm(0xB14,1,1);
outb(1,0xB14);
printf("fin du programme");
return 0;
}
After compiling the program and execute the ".exe" called gpio , the terminal tell me "Segmentation Fault".
Im not sure about the adress of the GPIO3. On the manual , its write B14 for the PIN num 6 for GPIO3
If you have a solution , i would be happy to hear ;D
PS : sorry for my english .
B14 is not an io port number, so it can't be used in ioperm().
Yes, it's just a name and it's usefull when accessing GPIO via sysfs interface. The direct I/O is necessary only when speed is critical, normal programs will be happy with the file-based sysfs interface in /sys.
BTW, the out() is for port-mapped IO, but most of ARM SoC I/O is memory-mapped, so you will probably need mmap() instead.
For more info on the sysfs interface MBR mentioned, see https://www.olimex.com/wiki/A10-OLinuXino-LIME#GPIO_under_Linux. The B14 is just the pin number (or ball number, since this is a Ball Grid Array part) on the A10 package.