* Problems when accessing to registers in GPIO
@ 2008-03-01 22:10 A. Nolson
0 siblings, 0 replies; only message in thread
From: A. Nolson @ 2008-03-01 22:10 UTC (permalink / raw)
To: linuxppc-embedded
Hi,
I am getting some problems when trying to access to the GPIO registers
from the userland of my secretlab's linux 2.6.24-rc3 ( Xilinx ML403 ). I
am using io_remap() functions ( from
http://www.denx.de/wiki/bin/view/PPCEmbedded/DeviceDrivers ) and I was
successfully able to test them with some own-made IP cores. However, I
am having problems when trying to do it in the same way with the GPIO IP
core from Xilinx ( the ones I am using to interface to the LEDs ,
buttons and LCD ).
If I try to access to the buttons in the board I don't really have any
problem since the tri-state control register is automatically set to
"all inputs" when the IP is turned on. But when I try to use the LEDs
and I need to configure the tris-state as outputs, they don't work . I
am doing the following:
//memory mapping
if( (led_base = (volatile int*) ioremap(BASE_GPIO,8)) == NULL ||
(but_base = (volatile int*) ioremap(BASE_GPIO_B, 8)) == NULL )
{
perror( "Cannot allocate memory for GPIO/n");
return 1;
}
led_tri = (char*)led_base + 0x4;
but_tri = (char*)but_base + 0x4;
//configure as inputs and outputs
printf("configuring IOs...");
*led_tri = 0x00;//configure them as outputs
*but_tri = 0xFF;//configure them as inputs
while(1)
{
data = *but_base;
// printf("data:%x\n",data);
*led_base = data;
usleep(50000);
}
If I try to allocate the tri-state registers as integer I get "Bus
Error" when accessing to them. I don't know really what is the problem.
If I try to the same without operating system, this is, directly using
XPS, I manage to make the buttons and leds work perfectly. Anybody can
help me with this?
/A
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-03-01 22:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-01 22:10 Problems when accessing to registers in GPIO A. Nolson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.