119
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
bRTCFormatValue = 1 << bTimeValue;
}
}
return bRTCFormatValue;
}
void Main(void)
{
…
//Write to RTC timer
cout << "Writing Year to RTC...";
SlaveDeviceWriteByte(bRTCSlaveAddressWrite, bRTCRegisterYear,
bYear);
cout << "Done" << endl;
cout << "Writing Month to RTC...";
SlaveDeviceWriteByte(bRTCSlaveAddressWrite, bRTCRegisterMonth,
bMonth);
cout << "Done" << endl;
cout << "Writing Day to RTC...";
SlaveDeviceWriteByte(bRTCSlaveAddressWrite, bRTCRegisterDay,
bDay);
cout << "Done" << endl;
cout << "Writing Hour to RTC...";
SlaveDeviceWriteByte(bRTCSlaveAddressWrite, bRTCRegisterHours,
bHours);
cout << "Done" << endl;
cout << "Writing Minute to RTC...";
SlaveDeviceWriteByte(bRTCSlaveAddressWrite, bRTCRegisterMinutes,
bMinutes);
cout << "Done" << endl;
cout << "Writing Second to RTC...";
SlaveDeviceWriteByte(bRTCSlaveAddressWrite, bRTCRegisterSeconds,
bSeconds);
cout << "Done" << endl;
}
3.2
Linux
Under Linux, there are two methods to access RTC timer:
- Direct IO Access
- RTC Driver
3.2.1 Direct IO Access
Linux provides the generic IO port access method. The user application can call the IO Read/Write
functions from user space. The two commonly used function is inb and outb.
1. Read input from Port address
unsigned char inb(unsigned short int port);
2. Set Output in Port Address
void outb(unsigned char value, unsigned short int port);
Before the IO port address can be accessed in user space. The application should use another
function ioperm to ask for the permission of usage.