Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Virtual to physical memory addressing

317 views
Skip to first unread message

Stewart McLay

unread,
Apr 25, 2003, 8:44:14 AM4/25/03
to
Hello,

I need to perform DMA access from a PMC board to RAM on a MV2433 PowerPC
board. I have allocated a buffer but need to convert the virtual address
to a physical memory address for the PMC board to access. I only have the
basic MMU library and therefore do not have vmTranslate() which I believe
is what I ideally should be using. Is there an alternative method?

Best Regards,

Stewart
___________________________________________________
Stewart McLay
UK Astronomy Technology Centre, Royal Observatory
Blackford Hill, Edinburgh EH9 3HJ, Scotland, UK
Tel:+44-(0)131-668-8304 http://www.roe.ac.uk/atc
Fax:+44-(0)131-668-1130 mailto:s...@roe.ac.uk

John

unread,
Apr 25, 2003, 2:04:01 PM4/25/03
to
Hello Stewart,

> I need to perform DMA access from a PMC board to RAM on a MV2433 PowerPC
> board. I have allocated a buffer but need to convert the virtual address
> to a physical memory address for the PMC board to access. I only have the
> basic MMU library and therefore do not have vmTranslate() which I believe
> is what I ideally should be using. Is there an alternative method?

You don't need to worry about virtual to physical translation
(assuming you are using VxWorks 5.x and not AE) - the virtual and
physical addresses will be the same on your PPC target.

However, you do need to convert from a CPU local bus address to a PCI
address. There is an application note on Wind River's support site
that explains some of the issues with multi-bus PowerPC boards:

http://www.wrs.com/csdocs/product/t2/technote/WTN47.pdf

I no longer have access to that site, so I cannot check the link, but
you should be able to find it from the number.

For a really basic summary, what you need to track down is the PCI
address of the main memory. There should be a block of addresses in
config.h that describe these mappings for your board: be careful which
you choose though as there will be a set for the normal mode and a set
for the EXTENDED_VME mapping.

Often, the RAM is seen starting at 0x80000000 from the PCI bus, so
converting the address is simply a matter of setting the top bit.

There are a couple of routines in the BSP, sysBusToLocalAdrs() and
sysLocalToBusAdrs(), that handle conversion of CPU addresses to
addresses on another bus. That said, on VME-equipped boards that
alternate bus is normally the VME bus and not the intermediate PCI
bus.

I don't believe that there is a function in the BSP that converts from
local to PCI, but you could add a pair of routines to the sysLib.c
file in your BSP to do this, say sysPciToLocal() and sysLocalToPci().
There is a function that does this in the USB code though (can't
remember the name, but it is in the BSP stub for USB support), so if
you have a file called usbPciStub.c in your BSP, that will contain the
code for these two functions ;-)

HTH,
John...

=====
Contribute to the VxWorks Cookbook at:
http://www.bluedonkey.org/cgi-bin/twiki/bin/view/Books/WebHome

Andrew Johnson

unread,
Apr 25, 2003, 2:54:26 PM4/25/03
to
Stewart McLay wrote:
> I need to perform DMA access from a PMC board to RAM on a MV2433 PowerPC
> board. I have allocated a buffer but need to convert the virtual address
> to a physical memory address for the PMC board to access. I only have the
> basic MMU library and therefore do not have vmTranslate() which I believe
> is what I ideally should be using. Is there an alternative method?

Actually you almost certainly don't need vmTranslate(), because most BSPs
map virtual=physical addresses. What you actually need is to be able to
translate a CPU local address into a PCIbus address, for which there may
be some specific macros defined in the BSP, and if not the translation is
usually just an addition or subtraction, again of values defined in the
BSP headers. I can't help with your particular BSP though...

- Andrew
--
There are 10 types of people in the world:
Those who understand binary, and those who don't.

0 new messages