Hi,
This is my first experience using embedded Linux but I have done lots of development using Real-Time kernels on embedded platforms. In the world I come from I can manipulate registers directly. I understand that user space among other things will have its own virtual memory space so that I cannot readily read or write directly to the devices peripheral registers. But can I write a driver and access these directly from kernel space?
The simplest example--and something I need to do--is to manipulate a GPIO. From my low-level experience I understand that there will exist many registers to set things like whether it is an input or an output or whether or not it is open-drain or whether to enable pull-ups or which functionality is muxed to the pin etc. The examples I've seen folks post (and thanks for posting) is within their driver they will call these gpio routines that I have seen described as being for use inside drivers rather than by the user.
Are these gpio calls simply added to abstract access to the GPIO registers? Or is there some other purpose?
Why not simply manipulate these registers directly from driver? In my opinion the code would be cleaner and a bit more efficient.
Being very comfortable writing to these registers I'd like to cut out the middle man but I suspect there are reasons he exists.
Regarding writing kernel drivers is this generally pretty simple, i.e. not much different than writing user space code? If not, will someone recommend a useful resource for learning how to do this correctly?
Thanks,
Ken