a puzzle for VME GURUS: multiple mmaps to /dev/vme32d?? devices

Roger Gonzalez rg at msel.unh.edu
Mon Apr 1 07:48:49 AEST 1991


This is a rather wierd scenario.  I hope that there are a few VME gurus
out there who can help me on this.

I'm using a BIT3 boardset to connect two VME buses - from my Sun 3/160
to a standalone.  The BIT3 boards let you map a local "window" of memory
(up to 1Mb) to any location in the other bus.

To do this mapping, I valloc a chunk, and mmap on whichever /dev/vme
device gives me the proper width transfer.  The remote address modifier
code is set via a register on the BIT3 board.  Note that the BIT3 board's
local address on the sun is in A32-land, so I use /dev/vme32d?? devices.

This has worked fine for a while, but now I have some Datacube imaging
boards that have memory areas in remote A24-land that need different width
transfers:

   0x80000 bytes as A24 (amc 0x39) width 32  (i.e. /dev/vme32d32)
   0x00200 bytes as A24 (amc 0x39) width 16  (i.e. /dev/vme32d16)
   0x00010 bytes as A24 (amc 0x39) width 8   (i.e. /dev/vme32d8)

All of these are contiguous and start at address 0 (zero) in remote A24-land.

THE QUESTIONS:
Since a 1 Mb BIT3 window located at remote A24 address zero will pick up
all three of the pertinant address areas, can I do something like this:

  p = valloc one meg of memory
  open all 3 devices (/dev/vme32d8, vme32d16, vme32d32)
and
  mmap p to whatever width /dev/vme32d??? device I need for current xfer
  munmap when done xfer

and keep using the same p without freeing it and revallocing?

Is there a better way?

How fast are mmap/munmap calls?

How hard is it to write a memory device driver?  Perhaps if I could
have something like /dev/bit3d8, /dev/bit3d16, /dev/bit3d24 etc. I could
move all the bit3 code into a driver where it belongs.  Unfortunately,
I know nothing about how to write Unix device drivers :-(

Thanks!
-Roger
-- 
"The question of whether a computer can think is no more interesting
 than the question of whether a submarine can swim" - Edsgar W. Dijkstra 
rg@[msel|unhd].unh.edu        |  UNH Marine Systems Engineering Laboratory
r_gonzalez at unhh.bitnet        |  Durham, NH  03824-3525



More information about the Comp.unix.questions mailing list