Device drivers on PPC...

bridged with qdn.public.qnxrtp.powerpc
Post Reply
Paul D. Smith

Device drivers on PPC...

Post by Paul D. Smith » Tue Feb 26, 2002 8:31 pm

So, I want to create a resource manager that gives me access to some
special hardware on our PPC-based box. We're just starting out, using
QNX 6.1.0. The code is being ported from VxWorks (5.3.1).

Looking through the manual this is (generally) how I implemented it;
since I don't actually have hardware yet :), I can't really test it but
I wanted to make sure I'm not totally off-base.

First, I used mmap_device_memory() to create a memory-mapped space for
the device. I used the physical address as the address (last)
argument. I used NULL as the pointer, and 0 for the flags, and
PROT_READ|PROT_WRITE|PROT_NOCACHE as the protection.

Then, when I want to access a specific bit of physical memory, I first
translate the physical address into a virtual address by calculating the
offset from the physical address start and adding that to the mmap()
return pointer, then I use the in8(), out8(), etc. macros defined in
ppc/inout.h to do the actual get/set of the values, passing them this
virtual address.

I see that for PPC, these macros already do EIEIO, etc.


Did I get it right?

Thanks!

--
-------------------------------------------------------------------------------
Paul D. Smith <pausmith@nortelnetworks.com> HASMAT--HA Software Mthds & Tools
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
These are my opinions---Nortel Networks takes no responsibility for them.

Adam Mallory

Re: Device drivers on PPC...

Post by Adam Mallory » Wed Feb 27, 2002 1:31 pm

"Paul D. Smith" <pausmith@nortelnetworks.com> wrote in
news:p5r8n856j8.fsf@lemming.engeast.baynetworks.com:
Then, when I want to access a specific bit of physical memory, I first
translate the physical address into a virtual address by calculating the
offset from the physical address start and adding that to the mmap()
return pointer, then I use the in8(), out8(), etc. macros defined in
ppc/inout.h to do the actual get/set of the values, passing them this
virtual address.

I see that for PPC, these macros already do EIEIO, etc.
Seems ok with the info provided. If you're hitting registers etc, that may
be mapped to an i/o bus (if the card is used on a different platform) you
may want to do a mmap_device_io().


--
Cheers,
Adam

QNX Software Systems Ltd.
[ amallory@qnx.com ]
---------------------------------------------------
With a PC, I always felt limited by the software available.
On Unix, I am limited only by my knowledge.
--Peter J. Schoenster <pschon@baste.magibox.net>

Post Reply

Return to “qdn.public.qnxrtp.powerpc”