Path: utzoo!utgpu!cunews!bnrgate!brtph3!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-request From: paul@altar.ee.byu.edu (Paul Rawlins) Newsgroups: comp.sys.sun Subject: Sun 4/1xx vs Sun 4/2xx using mmap() Keywords: Miscellaneous Message-ID: <788@brchh104.bnr.ca> Date: 12 Dec 90 00:58:04 GMT Sender: news@brchh104.bnr.ca Organization: Sun-Spots Lines: 81 Approved: Sun-Spots@rice.edu X-Sun-Spots-Digest: Volume 9, Issue 404, message 10 X-Note: Submissions: sun-spots@rice.edu, Admin: sun-spots-request@rice.edu 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@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); }