Quote:
Is setting the GPIO Enables register at offset 0x0b04 necessary, because it seems I can't enable GPIO for all pins?
Yes, remember there are two major types of GPIO - simple and wakeup - so two blocks to enable the GPIO pins. You need to look at 0xc00 as well as 0xb04. If you don't enable them, they stay low.
(edit, 14th June) there's also the GPT GPIO which I think are on another block..
Quote:
Then I would need to set the GPIO Data Direction at 0x0b0c to set my pins as input.
.. and 0xc08 too.
Quote:
At the GPIO Data Input values register at 0x0b14, the appropriate bits of the register would indicate whether i received 1 or 0 on this pin. Or is there a buffer where i can collect whole bytes or do I have to put the bits to bytes and so on?
If you are receiving bytes (using 8 pins) then you should use a wakeup pin on one of the bits, then using masking and or'ing them together, combine your own byte from it.
Quote:
Never really worked with Linux extensively before and my experience with Kernels and modules is limited at best, so I thought I could do it from my application.
Writing a kernel module is pretty simple. The very start is that forum post on Power Developer you mentioned in your post. Handling interrupts (because you do not want your kernel driver to constantly poll the GPIO port 8 times for every byte even when there is no new data).
Quote:
I suppose I don't need an interrupt and could just keep polling the pins for the streamed data.
You could work out some way of configuring your data input so that when data is not being sent, another GPIO input pin is set low. When it is set high, you know you need to be sampling data constantly and buffering it for userspace (or dropping it). Having that input pin as a wakeup pin means you can receive an interrupt as and when it changes, and save polling.
After all, polling is dead slow and will cripple your system if you're not careful.
Quote:
I will try to take a look at GPIOLIB on how i could implement this but any (really any) help would be greatly appreciated.
It's just a simpler way of accessing the GPIO registers without having to know the gory details, although someone needs to have written a chip driver for it, I am sure someone
already did for the MPC5200B. Just take a look at the link there and read the code, it's ridiculously simple, and kind of makes this discussion redundant :)
You even get to abstract the masking off, and just get an int back (1 or 0) so you can just shift it back into a byte. That may be a little more inefficient, I was thinking about adding some kind of switch so you could get a raw bit back (just the masked off relevant bit, not the shift) so people can collate known GPIO inputs and offsets into a integers more efficiently. However with function call overhead and MMIO overhead, saving that amount of time probably just isn't worth it at all.
Even with GPIOLIB, you still need to deal with how you would move that data to your application, and the kernel module.