Sun 4/1xx vs Sun 4/2xx using mmap()

Paul Rawlins paul at altar.ee.byu.edu
Wed Dec 12 11:58:04 AEST 1990


I have a VME board which is mapped in user space via mmap().  The board is
in vme24d32 space.  The location of the registers are shown below.  The
routine which calls mmap() is at the tail-end of this message.


              $FFFF    ----------------------------
	               |		       	  |
                       |     RESERVED             |
	               |	        	  |
	      $813F    ----------------------------
	               |	        	  |
                       |     UPPER REGISTERS      |
                       |                          |
              $8100    ----------------------------
                       |                          |
                       |                          |
                       |     LOWER REGISTERS      |
                       |                          |
                       |                          |
              $8000    ----------------------------
	               |                          |
	               |                          |
	               |     DATA                 |
                       |                          |
                       |                          |
              $0000    ----------------------------

I am able to access both the lower and upper registers when running on a
Sun 3/180 and Sun 4/110.  However, when running on a Sun 4/260 and Sun
4/280, I can access the lower registers, but I have difficulty accessing
the upper registers.  More specifically, I try to reset a chip through
$8119 and read its status through $810D.  On the Sun 4/2X0 either the chip
does not get properly reset, or the status register is read incorrectly.

Does anyone know of any peculularities between the different machines?  I
have combed through the documentation and contacted Sun support, but still
haven't come up with any explanation.  Any suggestions would be greatly
appreciated.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Paul Rawlins
paul at ee.byu.edu

int init_lkio(offset)
off_t offset;
{
	int fd, pgsize, len;
	caddr_t iova;
	int result;

	if ((fd = open("/dev/vme24d32",O_RDWR)) < 0) {
		if (errormsg)
			ErrorMsg("Cannot open /dev/vmeXX");
		return(FALSE);
		}

	len = 0xFFFF;
	pgsize = getpagesize();

	len = len + pgsize - (len % pgsize);	/* align to page boundary */

	if ((iova = (caddr_t)valloc(len)) == (caddr_t) 0) {
		if (errormsg) 
			ErrorMsg("Unable to allocate memory"); 
		return(FALSE);
		}

	result = mmap((caddr_t)iova, len, PROT_READ|PROT_WRITE,
		MAP_SHARED, fd, offset);

	if (result ==  -1) {
		if (errormsg) 
			ErrorMsg("mmap failed"); 
		return(FALSE);
		}

	lkb = (link_st *)result;

	return(TRUE);
}



More information about the Comp.sys.sun mailing list