* Xilinx GPIO API and kernel GPIO API differences
@ 2008-09-03 13:50 Guillaume Dargaud
0 siblings, 0 replies; only message in thread
From: Guillaume Dargaud @ 2008-09-03 13:50 UTC (permalink / raw)
To: linuxppc-dev
Hello all,
I can't fully understand the differences in what should be simple I/O
read/writes.
If I write a standalone program using the Xilinx API calls, I have access to
the following functions to control the direction of GPIO bits. For instance:
XGpio Input, Output;
XGpio_Initialize(&Input, InputDev);
XGpio_Initialize(&Output, OutputDev));
XGpio_SetDataDirection(&Input, 1, 0xFFFFFFFF);
XGpio_SetDataDirection(&Output, 1, 0);
Data = XGpio_DiscreteRead(&Input, 1);
XGpio_DiscreteWrite(&Output, 1, 0x12345678);
Now the equivalent using usermode linux calls _seems_ to be the following:
struct xgpio_ioctl_data Input, Output;
Input = open(GPIO_IN, O_RDWR);
Output = open(GPIO_OUT, O_RDWR);
gpio_info.chan = 1;
gpio_info.mask = 0xFFFFFFFF;
ioctl(Input, XGPIO_IN, &gpio_info);
Data=gpio_info.data;
gpio_info.data=0x12345678;
ioctl(Output, XGPIO_OUT, &gpio_info);
But where it all breaks down is if I have input and output bits mixed on the
same GPIO, particularly if reading the outputs makes no sense like in my
case (always return 0).
Using those ioctl calls, how do I specify which bits are input and which
ones are output ?
In other words, the equivalent to this:
XGpio IO;
XGpio_Initialize(&IO, Dev);
XGpio_SetDataDirection(&Input, 1, 0x00FFFF00);
Data = XGpio_DiscreteRead(&Input, 1);
XGpio_DiscreteWrite(&Output, 1, 0x12000078);
Is there anything available from usermode besides those ioctl calls ?
This makes me regret assembly...
--
Guillaume Dargaud
http://www.gdargaud.net/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-09-03 13:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-03 13:50 Xilinx GPIO API and kernel GPIO API differences Guillaume Dargaud
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).