2008-10-31 11:46:34 Simple GPIO driver
ian davidson (UNITED KINGDOM)
Trying to port code from 2006 RC2 to 2008 RC3
The user interface to the GPIOs has changed.
Thanks to M Hennerich for pointing me to the documentation and examples.
I've built the kernel with DeviceDriver/Char driver/Simple GPIO enabled and all files
gpio0 ... gpio47 have appeared in the /dev directory.
The following program is intended to set PF7 for a short period, it runs without errors
but the IO line does not alter state.
Is there anything else I need to configure in the kernel?
Do I need also to set the Pheripheral select registers to ensure that this line is indeed a GPIO and not a pheripheral line,
in this case for PF7 timer 2 output or PPIFS3?
I've compared the following code with bfin-test/simple-gpio-game.c and can't see any significant differences.
int gpiofd = open("/dev/gpio23", O_RDWR);
if (gpiofd < 0)
fprintf (stderr, "%s %d Can't open file\n", __FILE__, __LINE__);
if ( (ret = write (gpiofd, "O1",2)) != 2) // Output, set to 1
fprintf (stderr,"wr 1:%d\n", ret);
if ( (ret = write (gpiofd, "O0",2)) != 2) // Output, set to 0
fprintf (stderr, "wr 3:%d\n", ret);