Subject: A24 access with 32MB onboard?
To: None <port-mvme68k@netbsd.org>
From: Henning Kiel <kiel@physik.uni-dortmund.de>
List: port-mvme68k
Date: 11/26/2003 12:13:17
Hi!

I'm having problems with my 167.
On my old 147, I had netbsd running (with only 4MB!). And my software to
access an ADC VME card worked fine.
Now that I upgraded to a 167 with 32MB onboard the software does not work
anymore.

Now the first question is more principle: can I access A24 cards with 32MB
onboard mem? (as 32MB already fills the first 24bits address space)

The second would be: there are address modifiers. How can I use them?
(as I hope that I then can again access A24)

I use the following code fragment, which worked on the 147.
BTW I have the kernel "option INSECURE" compiled in. (is there a way to
check this for the running kernel?)
Does it look ok?

Cheers,
Henning

#include <time.h>
#include <stdio.h>
#include <fcntl.h>
#include <inttypes.h>
#include <unistd.h>
#include <sys/mman.h>

volatile uint8_t *pADC;
#define ADC 0xe00000
#define ADC_SIZE 0xffff

#define GetD16(VME,RAM) ( RAM = *((unsigned short *)(VME)) )
#define PutD16(VME,RAM) ( *((unsigned short *)(VME)) = RAM )
#define GetD32(VME,RAM) ( RAM = *((unsigned long *)(VME)) )
#define PutD32(VME,RAM) ( *((unsigned long *)(VME)) = RAM )

main()
{
  int fd = open("/dev/mem", O_RDWR);
  if(fd==-1) exit(-1);
  pADC = mmap(NULL, ADC_SIZE, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, ADC);
  if(pADC==(void *)-1) exit(-1);

  /* Access VME here with the above Get/Put D16/D32 macros */

  munmap( (void *)pADC, ADC_SIZE);
  close(fd);
}