VME device write

Till Straumann strauman at SLAC.Stanford.EDU
Thu Feb 20 21:29:19 UTC 2003


Kate.

The default VME configuration should already set up a suitable port
for you. Usually, only the A32 space needs to be customized (because
it's impossible to map the entire A32 on the 32-bit PCI address range.

At boot time, the BSP should print the default configuration.

Hmm - as I write this, I realize that you probably don't have the
latest patches to the MVME2306 BSP yet.

If you decide to configure a VME port yourself (as you tried to do),
you must make sure:

1) You use a PCI address range who is mapped to the PowerPC bus
    by the PCI host bridge.
2) The MMU has mapped the respective PowerPC bus address range.

Let's answer 2) first. Unless you use the latest BSP version
(who supports using the page tables on CPU >= 604), you must
use the MMU's BATs. There are four of them:
  BAT0: maps the system memory
  BAT1: maps the PCI IO and ISA buses
  BAT2: maps 256MB PCI memory space
  BAT3: maps the interrupt controller (a waste to use a BAT)

(These are all setup by the BSP - no need to do anything;
the file is c/src/lib/libbsp/powerpc/shared/startup/bspstart.c)

The MVME2306 uses the (a little confusing) PreP memory map,
according to which the PCI memory address 0 is mapped (by the
host bridge) to CPU address 0xc0000000.

Hence, the answer to 2) is that you see PCI memory address 0
at 0xc0000000 (!!! use libcpu/io.h: PCI_MEM_BASE, not a hardcoded
number when writing drivers !!!)

1) Be aware that other devices may be present in the PCI memory
area. You must pick a free piece in the 0..0x0fffffff _PCI_
address range. Note that you might want to increase the BAT2
memory range (look for

setdbat(2,PCI_MEM_BASE, PCI_MEM_BASE, xxx, IO_PAGE)

in the file c/src/lib/libbsp/powerpc/shared/startup/bspstart.c

and set the xxx parameter to 0x10000000 - this will map a
maximum of 256MB of PCI memory space.

Let's say you know that PCI address 0x100000 is unused
(a low PCI address is more likely to clash with other
devices, a larger value probably requires increasing the
xxx amount stated above)

you could then set the desired port:

vmeUniverseMasterPortCfg(3, VME_AM_SUP_SHORT_IO, 0, 0x100000, 0x10000)

and access the first VME16 address at PCI_MEM_BASE + 0x100000

HTH

-- Till

PS: as I mentioned. The latest patches I submitted for the MVME2306
BSP do all of this for you. The BSP also provides a header 'VME.h'
with macros and subroutines for address translation (the macros
assume the default configuration the subroutine also works if you
change the vmeUniverseMasterPort configuration - but is substantially
slower...). If you want VME interrupt support, you should definitely
upgrade your BSP...

Note that I also have a EPICS devLib port which should work with the
MVME2306.

Kate Feng wrote:
> I am trying to control a VME I/O on the  VME A16 address space  0x8000
> using the
> MVME2306 board. I   first configured the port 3 :
> 
> vmeUniverseMasterPortCfg(3, VME_AM_SUP_SHORT_IO, 0, 0xfbff0000,
> 0x10000);
> 
> vmeUniverseBusToLocalAdrs(VME_AM_SUP_SHORT_IO, (char *)(int)0x8000,
> (char **)&p);
> 
> Then I got the address  p= 0xfbff8000.   However, I could not write to
> the address
> with the out_8 command.  Am I missing some other steps ?
> 
> Thanks,
> Kate
> 
> 






More information about the users mailing list