BYTE Read_SMBus_Byte(DWORD DevAddr, BYTE Index) { outp(wSMIOBase,0xDE); // clear status bits outp(wSMIOBase+4, (DevAddr<<1) | 1 ); //device address, bit 0 set 1 means read DELAY; outp(wSMIOBase+3, Index ); // index to read DELAY; outp(wSMIOBase+2, 0x48 ); // Host control: byte read & set start bit DELAY; while ( inp(wSMIOBase) & BIT0 ); // Check if is busy? DELAY; if ( (inp(wSMIOBase) & 0x1C) == 0 ) //BIT2, BIT3, BIT4 用來報錯 return inp(wSMIOBase+5); // get host byte data return FAIL; }