/* * This function puts a delay between command */ static void swI2CWait(void) { /* find a bug: * peekIO method works well before suspend/resume * but after suspend, peekIO(0x3ce,0x61) & 0x10 * always be non-zero,which makes the while loop * never finish. * use non-ultimate for loop below is safe * */ #if 0 /* Change wait algorithm to use PCI bus clock, it's more reliable than counter loop .. write 0x61 to 0x3ce and read from 0x3cf */ while(peekIO(0x3ce,0x61) & 0x10); #else int i, Temp; for(i=0; i<600; i++) { Temp = i; Temp += i; } #endif }
uint32_t ioReadMMIOData() { uint32_t value = 0; unsigned char index; for (index = 0x87; index >= 0x84; index--) value = (value << 8) + peekIO(CRT_REGISTER, index); return value; }
/* Read/Write MMIO through IO Port helper */ uint32_t ioReadMMIOAddress() { uint32_t value = 0; unsigned char index; for (index = 0x82; index >= 0x80; index--) value = (value << 8) + peekIO(CRT_REGISTER, index); return value; }
uint8_t Memory::peekFrom(uint16_t addr, MemoryType source) { switch (source) { case MEM_RAM: return peekRam(addr); case MEM_ROM: return peekRom(addr); case MEM_IO: return peekIO(addr); default: assert(false); return 0; } }