117
RTC Timer (Apollolake) - User Guide
Appendix
IND100077-195
DOC207017- rev 01 – 2018-09-24 - Created by: 6644
Hatteland Display AS, Stokkastrandvegen 87B, N-5578 Nedre Vats, Norway
Tel: (+47) 4814 2200 - mail@hatteland-display.com - www.hatteland-display.com
User Guide RTC Timer - ApolloLake
All intellectual properties belongs to Hatteland Display AS
typedef short (__stdcall *lpInp32)(short);
lpOut32 gfpOut32;
lpInp32 gfpInp32;
//Base Address Read
unsigned char SlaveDeviceReadByte(unsigned char bSlaveDeviceAddr, unsigned char
bSlaveRegisterAddr)
{
unsigned char bValue = 0;
//1. Clear host status
gfpOut32(iBaseAddrSMBUS + bOffsetHostStatus, 0xFE);
//2. Wait for 2 sec
Sleep(1000);
//3. Read Host Status
bValue = (unsigned char)gfpInp32(iBaseAddrSMBUS + bOffsetHostStatus);
Sleep(1000);
bValue = (unsigned char)gfpInp32(iBaseAddrSMBUS + bOffsetHostStatus);
if(bValue != 0x40)
{
//Error
}
//4. Set Device address
gfpOut32(iBaseAddrSMBUS + bOffsetSlaveDeviceAddress, bSlaveDeviceAddr);
//5. Set Slave register address
gfpOut32(iBaseAddrSMBUS + bOffsetSlaveRegisterAddress, bSlaveRegisterAddr);
//6. Set Execute bit
gfpOut32(iBaseAddrSMBUS + bOffsetExecute, 0x48);
//7. Wait 1 sec
Sleep(1000);
//8. Read Execute bit
bValue = (unsigned char)gfpInp32(iBaseAddrSMBUS + bOffsetExecute);
if(bValue != 0x08)
{
//Error
}
//9. Read returned data
bValue = (unsigned char)gfpInp32(iBaseAddrSMBUS + bOffsetSlaveRegisterData);
return bValue;
}
void SlaveDeviceWriteByte(unsigned char bSlaveDeviceAddr, unsigned char
bSlaveRegisterAddr, unsigned char bSlaveRegisterData)
{