VMEbus mapping and access

Joseph Yip ycy at walt.cc.utexas.edu
Sun Mar 18 09:15:07 AEST 1990


A while ago, I posted a question on how to do mapping for VMEbus.
We purchased a frame grabber board. The specs. are as follows:

Someone sent me a mapping program  to open /dev/vme16d16 and 
/dev/vme24d16 device drivers and do all sort of mapping.

For mmap(), MAP_SHARED and MAP_FIXED options are used.

	Register base address is set to 0x1000. All registers are I/O mapped
		relative to this base address. The registers occupy 
		16 words within this space.

An example of the mapping:

		regbase = map(IO, 0x1000, 32);

		/* if (regbase + 8) = status/control register, for frame
		   grabbing, snapping, ... 
		*/

		*(regbase +  8) |= (SNAP);	/* set bit to snap a frame */
	
	should work. Right?

First when I want to access the memory, I got "bus error" although the
VMEbus mapping is ok!

Second, I discovered that I am not able to set the registers to some
values!

map() returns a unsigned char (BYTE) pointer to the mapped space. Since the
frame grabber registers are 16-bit, I cast the pointer into "unsigned
short" (WORD). In this way, I can do 16-bit register access. (I
believed.)

However, life is never easy. 

So, when I do

	WORD *STATUSCTRL;

	STATISCTRL = (WORD *) (regbase + 0x04);
	*STATUSCTRL = 0xE8EF;

I got *(regbase + STATUSCTRL) = 0xEFEF when I read the register using

		printf("0x%1X\n", *(regbase + STATUS));

Interestly, some registers could be set! The manual said that ONLY WORD
ACCESS ARE SUPPORTED for the registers. When I cast the pointer to a
WORD pointer, am I doing WORD access? 



-----------------------------------------------------------------------
The frame grabber specs are as follows:

- VMEbus standard 16-bit data bus, 24-bit address bus
- 512 Kbytes of frame memory are memory mapped at one time
- frame memory and look-up tables are mapped into VMEbus standard
  (24-bit address) non-privileged and supervisory address space.
- Registers are mapped into short (16-bit address) non-privileged and
  supervisory address space. ONLY WORD access is supported.

Factory setting:
	Register base address is set to 0x1000. All registers are I/O mapped
		relative to this base address. The registers occupy 
		16 words within this space.

	Memory base address is set to 0xA00000

The frame memory and look-up tables (LUTs) are memory-mapped, occupying 512K
bytes within the host computer memory address space, giving the host direct
access to the 512K bytes of memory. The LUTs are mapped into the same memory
space as the frame memory. During LUT addressing only the lower 32K
bytes are used. 

The 16 registers that are I/O mapped occupying 16 words in the host computer
address space are used to program the frame grabber functions. So, to use the
frame grabber I need to handle the memory mapping. Once I can read and write to
registers and read and write to frame memory, I am home free!



More information about the Comp.unix.questions mailing list