53
int SMBus::SMBus_Wait()
{
int
timeout = SMBUS_TIMEOUT;
DWORD dwValue;
while (timeout--)
{
Sleep(10);
// I/O Delay
dwValue = IO_Read(SMBHSTSTS) & 0x00FF; // Read Host Status Register
if( dwValue & SMBHSTSTS_INTR )
// if status value equal
SMBHSTSTS_INTR, return SMBus_OK
{
return SMBUS_OK;
}
// if status value equal SMBHSTSTS_FAILED, return SMBHSTSTS_FAILED
if( dwValue & SMBHSTSTS_FAILED )
{
printf("SMBus Action FAILED! %x\n",dwValue);
return SMBHSTSTS_FAILED;
}
// if status value equal SMBHSTSTS_COLLISION, return SMBHSTSTS_COLLISION
if(dwValue & SMBHSTSTS_COLLISION)
{
printf("SMBus Action COLLISION! %x\n",dwValue);
return SMBHSTSTS_COLLISION;
}
// if status value equal SMBHSTSTS_ERROR, return SMBHSTSTS_ERROR
if(dwValue & SMBHSTSTS_ERROR)
{
printf("SMBus Action ERROR! %x\n",dwValue);
return SMBHSTSTS_ERROR;
}
}
return SMBUS_BUSY;
}
5. SMBus_Wait
Summary of Contents for MI945A
Page 5: ...DEC 08 2008 2008...