38
int ret = this->SMBus_Wait(); // Check SMBus Status
if (ret == SMBUS_OK) // If SMBus Stand by
{
*pByte = (BYTE)this->IO_Read(SMBHSTDAT0) &0xFF; // Get SMBus host data value
}
return ret; // reture SMBus status
}
BOOL SMBus::CheckDevice(WORD wDeviceAddress)
{
int ret;
this->SMBus_Clear();
// Clear SMBus data first
if (this->SMBus_Busy())
// Check SMBus busy or not, return busy if busy
return SMBUS_BUSY;
this->IO_Write(SMBHSTADD , wDeviceAddress & ~1 ); // write address in first variable
this->IO_Write(SMBHSTCNT , SMBHSTCNT_START | SMBHSTCNT_SENDRECV);
// Sent start command to SMBus control register
ret = this->SMBus_Wait(); // Check SMBus Status
if (ret == SMBUS_OK) // Check device exist or not, if exist return ture else false
return TRUE;
else
return FALSE;
}
3. Check Device (F75111)
void SMBus::SMBus_Clear()
{
this->IO_Write(SMBHSTSTS ,0xFF); // Clear SMBus status
this->IO_Write(SMBHSTDAT0,0x0 ); // Clear SMBus data
}
4. SMBus_Clear