This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Accessing GPIO Ports (Linux)

Hello,

I'm trying to gain access to the GPIO-Pins on my OMAP3EVM. I'm working with Kernel 2.6.28.

GPIO support should already be activated in the kernel, am i right? I'm using the OMAP35x-PSP-SDK 02.01.03.11, since i couldn't get the more recent builts running.

This code-snippet i made can be built and executed correctly on my target-machine, but unfortunatley there don't seem to be any valid ports.

I also tried to use <asm/arch/gpio.h>, although the documentaion says it is obsolete. However, i gave this up because of many missing includes.

How can i access some GPIO-Pins? Or this this generally not possible in user-space?

 

#include <unistd.h>
#include <stdio.h>
#include <linux/gpio.h>

int main(){
    int iPin=0, j=0;

    for(j=0; j<15000000; j++){
        iPin = gpio_is_valid(j);
        if (iPin != 0 ) printf ("pin %d is valid \n", j);
    }
    return 0;
}