RTC Overview
Introduction
The real-time clock (RTC) driver provides precise real time for the operating system (OS). If the OS is powered off, the RTC driver continues to keep track of the system time using an external battery.
Available APIs
Table 1 APIs provided by the RTC driver
Capability
|
Function
|
Description
|
RTC handle
|
RtcOpen
|
Opens the RTC device to obtain its handle.
|
RtcClose
|
Releases a specified handle of the RTC device.
|
RTC time
|
RtcReadTime
|
Reads time information from the RTC driver, including the year, month, the day of the week, day, hour, minute, second, and millisecond.
|
RtcWriteTime
|
Writes time information from the RTC driver, including the year, month, the day of the week, day, hour, minute, second, and millisecond.
|
RTC alarm
|
RtcReadAlarm
|
Reads the RTC alarm time that was set last time.
|
RtcWriteAlarm
|
Writes the RTC alarm time based on the alarm index.
|
RtcRegisterAlarmCallback
|
Registers RtcAlarmCallback that will be invoked when an alarm is generated at the specified time.
|
RtcAlarmInterruptEnable
|
Enables or disables RTC alarm interrupts.
|
RTC configuration
|
RtcGetFreq
|
Reads the frequency of the external crystal oscillator connected to the RTC driver.
|
RtcSetFreq
|
Sets the frequency of the external crystal oscillator connected to the RTC driver.
|
RtcReset
|
Resets the RTC.
|
Custom register
|
RtcReadReg
|
Reads the configuration of a custom RTC register based on the register index.
|
RtcWriteReg
|
Writes the configuration of a custom RTC register based on the register index.
|
NOTE:
All functions provided in this document can be called only in kernel mode.