Subject: Re: mvme 147S-1
To: None <port-mvme68k@netbsd.org>
From: Steve Woodford <scw@netbsd.org>
List: port-mvme68k
Date: 01/24/2002 14:45:32
Henning Kiel wrote:

> I really would like to see the Memory board working (if it is one). I
> have read that the 224 is a mem board, but access to it slows the
> overall performance down!? Is that fixed with 1.5.2?

The slow-down is still apparent, although the kernel will try to use
onboard memory in preference to VMEbus memory if it can.

See syssrc/sys/arch/mvme68k/docs/VMEbus-RAM for details on how to
configure VMEbus RAM on an mvme147. I recommend configuring the VMEbus RAM
card at A32:01000000. If you don't have docs, email me privately and I'll
talk you through it.

> 2nd) I would like to access the VME bus. I have an ADC card I must
> access, but I don't know how.

You have two choices: 1) write a device driver, or 2) open /dev/mem and
use mmap(2) to access the required VMEbus address. Option 2 is the best
bet for now, especially since you're using 1.5.2.

For example, if your ADC board is mapped at VMEbus address A32:10000000
and occupies 0x1000 bytes of address space, you could use the following
code fragment (I've omitted error checking for brevity):

	int fd = open("/dev/mem", O_RDWR);
	volatile uint32_t *pAdc;

	pAdc = mmap(NULL, 0x1000, PROT_READ | PROT_WRITE, MAP_PRIVATE,
	    fd, 0x10000000);

	*pAdc = 0x5555;

> I tried to directly write to that mem, but that caused a segfault:
> (int)*(0xf0000000) = 0x5555;

Nope, won't work. The VMEbus addresses printed at boot time show how
VMEbus address spaces are mapped to CPU physical addresses. The above
address is meaningless in the context of a user process (and the kernel
too, for that matter) since it is executing in its own virtual address
space.

Do you know what VMEbus address the ADC board is configured at?

Cheers, Steve