Matt Boothe <firstname.lastname@example.org> wrote:
My Power PC based custom hardware will have several memory mapped
peripherals. I have a few questions about this topic:
- The BSP I am using sets up the chip selects for all memory mapped
peripherals in the IPL. I plan to follow this example. Any reason to set
up the chip selects somewhere other than the IPL?
Setting up the chip selects in the IPL is fine, as long as the IPL will be
the only code booting the board. Some boards have the ability to remap the
reset vector (via a jumper or switch), enabling two different primary loaders,
such as a ROM Monitor, and a native QNX IPL. In this case, if the ROM Monitor
and the IPL are setting chip selects up differently, the startup module and
runtime applications may have difficulty accessing devices, in which case
it might be better to set up the chip selects later, in startup. But, if the IPL
will be the only code booting this board, then setting up chip selects there
is fine. Or, just have the IPL set them up exactly like the ROM Monitor does.
- Once I have the peripherals mapped into the memory map, can applications
directly access the peripheral? Doing so would require that the application
be able to address a physical memory location instead of a virtual one. I
don’t know if applications can do this or not. If they can’t do I need to
write a resource to sit between the application and the peripheral?
They can’t be accessed directly, but library calls (mmap_device_memory() and
mmap_device_io() ) exist to create a virtual pointer to a physical device.
I am RTFM’ing as fast as I can, but if anyone can help me get my head on
straight about this topic or point me at the documentation that will help me
understand this topic I’d be most appreciative.
David Green (email@example.com)
QNX Software Systems Ltd.