home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.sys.ibm.ps2.hardware      Discussing IBM PS/2 hardware      42,985 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 41,189 of 42,985   
   Christian Holzapfel to Christian Holzapfel   
   Re: Reading adapter POS registers under    
   12 Jan 23 07:13:19   
   
   From: google@holzapfel.biz   
      
   Christian Holzapfel schrieb am Sonntag, 8. Januar 2023 um 21:12:10 UTC+1:   
   > Anyone ever read from the adapter memory space through userspace ioctls?   
   MIOBUSMEM? Not a single code snippet out there...   
      
   MIOBUSGET ioctl:   
      
   #include    
      
   #define swap4bytes(val)  ( ((val >> 24) & 0xFF) | ((val >> 8) & 0xFF00) |   
   ((val << 8) & 0xFF0000) | ((val << 24) & 0xFF000000))   
      
   uint readIoWord(int slot, int address)   
   {   
   	MACH_DD_IO mddRecord;   
   	uint dat = 0;   
      
   	/* Decrement slot number found in database */   
   	slot == (slot--) & 0x0F;   
      
   	mddRecord.md_size = 1;   
   	mddRecord.md_incr = MV_WORD;   
   	mddRecord.md_data = (char *)&dat;   
   	mddRecord.md_addr = address;   
   	mddRecord.md_sla = slot;   
      
   	if (ioctl(fd, MIOBUSGET, &mddRecord) < 0)   
       	{   
           	fprintf(stderr, "Error in MIOBUSGET ioctl: %s\n", strerror(errno));   
   		return -1;   
       	}   
      
       	dat = swap4bytes(dat);   
      
       	/* printf("Slot %d memory 0x%4.4X data: 0x%8.8X\n", slot, address, dat);   
   */   
      
       	return dat;   
   }   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca