Hi everyone,
i am very beginner about the linux kernel and all that stuff.
I am using an Olimex lpc-h3131 board and i would like to develop a "gpio driver". For support, i have the linux device driver book chapter 9 "Commucating with hardware". Of course, gpiolib is not available.
For my first step, i have a led on the GPIO17 (adress 0x130031CB), i try to read the value on this pin. But it seems i don't do it correctly because the value read is always 0, even if the led is turned on ...
Any advices ?
you can find below a part of my driver :
Code:
#define GPIO_BASE 0x130031CB
void *map;
if(request_region(GPIO_BASE, 1, "parr_driver") != NULL)
{
printk(KERN_ALERT "parr_driver : the adress GPIO16 is now reserved \n");
if(request_mem_region(GPIO_BASE, 1, "parr_driver") != NULL)
{
printk(KERN_ALERT "parr_driver : the memory GPIO16 is now reserved \n");
map = ioremap(GPIO_BASE, 1);
if(map != NULL)
{
int byte = 0;
printk(KERN_ALERT "parr_driver : ioremap worked : %p \n", map);
byte = readb(map);
printk(KERN_ALERT "parr_driver : byte : %i \n", byte);
}
else
{
printk(KERN_ALERT "parr_driver : ioremap failed \n");
}
}
else
{
printk(KERN_ALERT "parr_driver : the memory GPIO16 can't be reserved \n");
}
}
else
{
printk(KERN_ALERT "parr_driver : the adress GPIO16 can't be reserved \n");
}
My output is the folowing :
Quote:
parr_driver : the adress GPIO16 is now reserved
parr_driver : the memory GPIO16 is now reserved
parr_driver : ioremap worked : c286a1cb
parr_driver : byte : 0
|
Documentation of the board :
http://www.olimex.com/dev/pdf/ARM/LPC/LPC-H3131.pdf
Documentation of the µC
http://ics.nxp.com/support/documents...30.lpc3131.pdf
My board is running under linux 2.6.33
Thanks for any helps, Livegen.
--------
second thread
Hi everyone,
i am very beginner in linux kernel and all that stuff.
I am developping a gpio driver for my Olimex lpc-h3131. the goal of this driver is to show the pin status. For support, i have the linux device driver book (chapter 9) "Communicating with the hardware".
I have done my driver and try to read the status on Pin 0x130031CB, a led is put on this pin. But it seems it don't work, because the value read is always 0 even if the led is turned on....
Any can help me ?
I am running under linux 2.6.33 patched for my board.
Documentation of the µC
http://ics.nxp.com/support/documents...30.lpc3131.pdf
Documentation of the board
http://www.olimex.com/dev/pdf/ARM/LPC/LPC-H3131.pdf
Livegen