I just want to toggle some GPIOs on the board. For that purpose I did
#include <stdio.h>
#define u8 unsigned char
#define u16 unsigned short
#define u32 unsigned int
//#include <asm/arch/gpio.h>
#include "/opt/src/2.6_kernel/include/asm/arch/gpio.h"
//#include <fcntl.h>
#include <unistd.h> //sleep
main()
{
int file;
int gpio_port = 4; // probably dynamically determined
int is_input = 0xf0; // define 4 pins as output
char* label = "Test";
sleep(1);
gpio_request(gpio_port,label);
__gpio_set_direction(gpio_port, is_input);
gpio_set_value(gpio_port, 0xf0);
sleep (1);
gpio_set_value(gpio_port, 0x00);
sleep(1);
gpio_set_value(gpio_port, 0xf0);
}
I use the Codesourcery as compiler (gcca is a link to that) and did
gcca -I /opt/src/2.6_kernel/include test.c
/home/star/tmp/ccMofySY.o: In function `gpio_request':
test2.c:(.text+0xb4): undefined reference to `omap_request_gpio'
/home/star/tmp/ccMofySY.o: In function `__gpio_set_direction':
test2.c:(.text+0x100): undefined reference to `omap_set_gpio_direction'
/home/star/tmp/ccMofySY.o: In function `gpio_set_value':
test2.c:(.text+0x13c): undefined reference to `omap_set_gpio_dataout'
collect2: ld returned 1 exit status
This functions (omap_request... ) are available in
/opt/src/2.6_kernel/arch/arm/plat-omap/gpio.c which was (I guess during comiling the kernel to gpio.o)
But how to get this together?
Second question? Which header file defines u8, u16, u32 ... ?
Best regards
Arno