This module contains APIs to program and use the RTC module.
Files | |
file | rtc/v0/rtc.h |
RTC Driver API/interface file. | |
Data Structures | |
struct | RTC_HwAttrs |
RTC Hardware attributes. More... | |
struct | RTC_Params |
RTC Parameters. More... | |
struct | RTC_Object |
RTC driver object. More... | |
struct | RTC_Config |
RTC Global Configuration. More... | |
struct | RTC_Time |
RTC Time Structure. More... | |
Functions | |
void | RTC_init (void) |
Initialize the RTC module. More... | |
void | RTC_deinit (void) |
De-initialize the RTC module. More... | |
void | RTC_paramsInit (RTC_Params *params) |
Function to set default values of RTC_Params in params. More... | |
RTC_Handle | RTC_open (uint32_t idx, const RTC_Params *params) |
Open the RTC at index idx with parameters params. More... | |
void | RTC_close (RTC_Handle handle) |
Function to close the RTC Peripheral specified by the handle. More... | |
int32_t | RTC_setTime (RTC_Handle handle, const RTC_Time *rtc_time) |
Set the RTC time. More... | |
int32_t | RTC_getTime (RTC_Handle handle, RTC_Time *rtc_time) |
Get the current RTC time. More... | |
int32_t | RTC_setOff_OnTimerEvent (RTC_Handle handle, const RTC_Time *rtc_time) |
Set the off-on timer event / Use as timer 1 for RTC. More... | |
int32_t | RTC_setOn_OffTimerEvent (RTC_Handle handle, const RTC_Time *rtc_time) |
Set the on-off timer event / Use as timer 2 for RTC. More... | |
uint32_t | RTC_readScratchRegister (RTC_Handle handle, uint32_t scratchIndex) |
Read a value from a specific RTC scratch register. More... | |
int32_t | RTC_writeScratchRegister (RTC_Handle handle, uint32_t scratchIndex, uint32_t value) |
Write a value to a specific RTC scratch register. More... | |
RTC_Time | RTC_calculateElapsedTime (const RTC_Time *startTime, const RTC_Time *endTime) |
Calculate Elapsed Time. More... | |
int32_t | RTC_adjustForDrift (RTC_Handle handle, Float32 measuredDriftInSeconds) |
Calculate Elapsed Time. More... | |
int32_t | RTC_stop (RTC_Handle handle) |
Stop the RTC. More... | |
int32_t | RTC_start (RTC_Handle handle) |
Start the RTC after it's stopped. More... | |
void | RTC_erratumi2327Init (void) |
RTC Erratum i2327 Workaround. More... | |
Typedefs | |
typedef struct RTC_Config_s * | RTC_Handle |
A handle that is returned from a RTC_open() call. More... | |
typedef void(* | RTC_OnOffCallbackFxn) (RTC_Handle handle) |
The definition of a ON_OFF callback function used by the RTC driver. More... | |
typedef void(* | RTC_OffOnCallbackFxn) (RTC_Handle handle) |
The definition of a OFF_ON callback function used by the RTC driver. More... | |
Macros | |
#define | OSCILLATOR_FREQ_HZ ((uint32_t) 32768U) |
32.768 kHz Crystal Oscillator Frequency More... | |
#define | RTC_FREEZE_MODE ((uint32_t) 0x02000000U) |
Enable Freeze Mode. More... | |
#define | O32K_OSC_DEP_EN_MASK (CSL_RTC_GENRAL_CTL_O32K_OSC_DEP_EN_MASK) |
O32K_OSC_DEP_EN_MASK. More... | |
#define | RD_PEND_MASK (CSL_RTC_SYNCPEND_RD_PEND_MASK) |
Read Pend Status. More... | |
#define | WR_PEND_MASK (CSL_RTC_SYNCPEND_WR_PEND_MASK) |
Write Pend Status. More... | |
#define | O32K_CLK_OBS_BIT_MASK (CSL_RTC_SYNCPEND_O32K_CLK_OBS_MASK) |
O32K_CLK_OBS_BIT_MASK. More... | |
#define | RTC_SW_OFF_MASK (CSL_RTC_GENRAL_CTL_SW_OFF_MASK) |
RTC_SW_OFF_MASK. More... | |
#define | RTC_UNLOCK_MASK (CSL_RTC_GENRAL_CTL_UNLOCK_MASK) |
Unlock State Status. More... | |
#define | OSC_LOCK_WAIT (3U) |
Wait time for stabalizing OSC. More... | |
#define | KICK0_UNLOCK_VALUE (uint32_t)0x83E70B13U |
RTC Kick unlock values. More... | |
#define | KICK1_UNLOCK_VALUE (uint32_t)0x95A4F1E0U |
#define | KICK0_LOCK_VALUE (CSL_RTC_KICK0_RESETVAL) |
RTC Kick lock values. More... | |
#define | KICK1_LOCK_VALUE (CSL_RTC_KICK1_RESETVAL) |
#define | RTC_BASEADDR (uint32_t)0x2B1F0000U |
RTC Base Address. More... | |
RTC Timer Interrupt Set/Indication Flags | |
#define | RTC_TMR_INT_INT0_STATUS_FLAG (CSL_RTC_IRQSTATUS_SYS_EVENT_ON_OFF_MASK) |
ON_OFF status interrupt. More... | |
#define | RTC_TMR_INT_INT1_STATUS_FLAG (CSL_RTC_IRQSTATUS_SYS_EVENT_OFF_ON_MASK) |
OFF_ON status interrupt. More... | |
#define | RTC_TMR_INT_INT0_CLEAR_FLAG (CSL_RTC_IRQENABLE_CLR_SYS_EN_EVENT_ON_OFF_MASK) |
ON_OFF clear interrupt. More... | |
#define | RTC_TMR_INT_INT1_CLEAR_FLAG (CSL_RTC_IRQENABLE_CLR_SYS_EN_EVENT_OFF_ON_MASK) |
OFF_ON clear interrupt. More... | |
#define | RTC_TMR_INT_INT0_SET_FLAG (CSL_RTC_IRQENABLE_SET_SYS_EN_EVENT_ON_OFF_MASK) |
ON_OFF set interrupt. More... | |
#define | RTC_TMR_INT_INT1_SET_FLAG (CSL_RTC_IRQENABLE_SET_SYS_EN_EVENT_OFF_ON_MASK) |
OFF_ON set interrupt. More... | |
#define | RTC_TMR_INT_INT0_RAW_STATUS_FLAG (CSL_RTC_IRQSTATUS_RAW_SYS_EVENT_ON_OFF_MASK) |
ON_OFF raw status interrupt. More... | |
#define | RTC_TMR_INT_INT1_RAW_STATUS_FLAG (CSL_RTC_IRQSTATUS_RAW_SYS_EVENT_OFF_ON_MASK) |
OFF_ON raw status interrupt. More... | |
#define | RTC_TMR_INT_STATUS_ALL |
All interrupt status mask. More... | |
#define | RTC_TMR_INT_CLEAR_ALL |
All interrupt clear mask. More... | |
#define | RTC_TMR_INT_REQ_ALL |
All interrupt set mask. More... | |
#define | RTC_TMR_INT_RAW_STATUS_ALL |
All interrupt raw status mask. More... | |
#define OSCILLATOR_FREQ_HZ ((uint32_t) 32768U) |
32.768 kHz Crystal Oscillator Frequency
#define RTC_FREEZE_MODE ((uint32_t) 0x02000000U) |
Enable Freeze Mode.
#define O32K_OSC_DEP_EN_MASK (CSL_RTC_GENRAL_CTL_O32K_OSC_DEP_EN_MASK) |
O32K_OSC_DEP_EN_MASK.
#define RD_PEND_MASK (CSL_RTC_SYNCPEND_RD_PEND_MASK) |
Read Pend Status.
#define WR_PEND_MASK (CSL_RTC_SYNCPEND_WR_PEND_MASK) |
Write Pend Status.
#define O32K_CLK_OBS_BIT_MASK (CSL_RTC_SYNCPEND_O32K_CLK_OBS_MASK) |
O32K_CLK_OBS_BIT_MASK.
#define RTC_SW_OFF_MASK (CSL_RTC_GENRAL_CTL_SW_OFF_MASK) |
RTC_SW_OFF_MASK.
#define RTC_UNLOCK_MASK (CSL_RTC_GENRAL_CTL_UNLOCK_MASK) |
Unlock State Status.
#define OSC_LOCK_WAIT (3U) |
Wait time for stabalizing OSC.
#define KICK0_UNLOCK_VALUE (uint32_t)0x83E70B13U |
RTC Kick unlock values.
#define KICK1_UNLOCK_VALUE (uint32_t)0x95A4F1E0U |
#define KICK0_LOCK_VALUE (CSL_RTC_KICK0_RESETVAL) |
RTC Kick lock values.
#define KICK1_LOCK_VALUE (CSL_RTC_KICK1_RESETVAL) |
#define RTC_BASEADDR (uint32_t)0x2B1F0000U |
RTC Base Address.
#define RTC_TMR_INT_INT0_STATUS_FLAG (CSL_RTC_IRQSTATUS_SYS_EVENT_ON_OFF_MASK) |
ON_OFF status interrupt.
#define RTC_TMR_INT_INT1_STATUS_FLAG (CSL_RTC_IRQSTATUS_SYS_EVENT_OFF_ON_MASK) |
OFF_ON status interrupt.
#define RTC_TMR_INT_INT0_CLEAR_FLAG (CSL_RTC_IRQENABLE_CLR_SYS_EN_EVENT_ON_OFF_MASK) |
ON_OFF clear interrupt.
#define RTC_TMR_INT_INT1_CLEAR_FLAG (CSL_RTC_IRQENABLE_CLR_SYS_EN_EVENT_OFF_ON_MASK) |
OFF_ON clear interrupt.
#define RTC_TMR_INT_INT0_SET_FLAG (CSL_RTC_IRQENABLE_SET_SYS_EN_EVENT_ON_OFF_MASK) |
ON_OFF set interrupt.
#define RTC_TMR_INT_INT1_SET_FLAG (CSL_RTC_IRQENABLE_SET_SYS_EN_EVENT_OFF_ON_MASK) |
OFF_ON set interrupt.
#define RTC_TMR_INT_INT0_RAW_STATUS_FLAG (CSL_RTC_IRQSTATUS_RAW_SYS_EVENT_ON_OFF_MASK) |
ON_OFF raw status interrupt.
#define RTC_TMR_INT_INT1_RAW_STATUS_FLAG (CSL_RTC_IRQSTATUS_RAW_SYS_EVENT_OFF_ON_MASK) |
OFF_ON raw status interrupt.
#define RTC_TMR_INT_STATUS_ALL |
All interrupt status mask.
#define RTC_TMR_INT_CLEAR_ALL |
All interrupt clear mask.
#define RTC_TMR_INT_REQ_ALL |
All interrupt set mask.
#define RTC_TMR_INT_RAW_STATUS_ALL |
All interrupt raw status mask.
typedef struct RTC_Config_s* RTC_Handle |
A handle that is returned from a RTC_open() call.
typedef void(* RTC_OnOffCallbackFxn) (RTC_Handle handle) |
The definition of a ON_OFF callback function used by the RTC driver.
The callback will be called if the ON_OFF interrupt is enabled.
handle | RTC_Handle |
typedef void(* RTC_OffOnCallbackFxn) (RTC_Handle handle) |
The definition of a OFF_ON callback function used by the RTC driver.
handle | RTC_Handle |
void RTC_init | ( | void | ) |
Initialize the RTC module.
void RTC_deinit | ( | void | ) |
De-initialize the RTC module.
void RTC_paramsInit | ( | RTC_Params * | params | ) |
Function to set default values of RTC_Params in params.
params | [IN] pointer to the structure to be initialized |
RTC_Handle RTC_open | ( | uint32_t | idx, |
const RTC_Params * | params | ||
) |
Open the RTC at index idx with parameters params.
idx | [IN] Index of RTC to open in global config |
params | [IN] RTC_Params values to use for opening |
void RTC_close | ( | RTC_Handle | handle | ) |
Function to close the RTC Peripheral specified by the handle.
handle | [IN] RTC_Handle returned from RTC_open() |
int32_t RTC_setTime | ( | RTC_Handle | handle, |
const RTC_Time * | rtc_time | ||
) |
Set the RTC time.
handle | [IN] RTC_Handle returned from RTC_open() |
rtc_time | [IN] Pointer to RTC_Time structure |
int32_t RTC_getTime | ( | RTC_Handle | handle, |
RTC_Time * | rtc_time | ||
) |
Get the current RTC time.
handle | [IN] RTC_Handle returned from RTC_open() |
rtc_time | [OUT] Pointer to RTC_Time structure |
int32_t RTC_setOff_OnTimerEvent | ( | RTC_Handle | handle, |
const RTC_Time * | rtc_time | ||
) |
Set the off-on timer event / Use as timer 1 for RTC.
handle | [IN] RTC_Handle returned from RTC_open() |
rtc_time | [IN] Pointer to RTC_Time structure |
int32_t RTC_setOn_OffTimerEvent | ( | RTC_Handle | handle, |
const RTC_Time * | rtc_time | ||
) |
Set the on-off timer event / Use as timer 2 for RTC.
handle | [IN] RTC_Handle returned from RTC_open() |
rtc_time | [IN] Pointer to RTC_Time structure |
uint32_t RTC_readScratchRegister | ( | RTC_Handle | handle, |
uint32_t | scratchIndex | ||
) |
Read a value from a specific RTC scratch register.
handle | [IN] RTC_Handle returned from RTC_open() |
scratchIndex | [IN] Index of scratch register to read |
int32_t RTC_writeScratchRegister | ( | RTC_Handle | handle, |
uint32_t | scratchIndex, | ||
uint32_t | value | ||
) |
Write a value to a specific RTC scratch register.
handle | [IN] RTC_Handle returned from RTC_open() |
scratchIndex | [IN] Index of scratch register to write |
value | [IN] Value to write to the scratch register |
int32_t RTC_adjustForDrift | ( | RTC_Handle | handle, |
Float32 | measuredDriftInSeconds | ||
) |
Calculate Elapsed Time.
handle | [IN] RTC_Handle returned from RTC_open() |
measuredDriftInSeconds | [IN] Drift Value to be adjusted in Seconds |
int32_t RTC_stop | ( | RTC_Handle | handle | ) |
int32_t RTC_start | ( | RTC_Handle | handle | ) |
Start the RTC after it's stopped.
handle | [IN] RTC_Handle returned from RTC_open() |
void RTC_erratumi2327Init | ( | void | ) |
RTC Erratum i2327 Workaround.
Due to a bug in initial synchronization out of cold power on, IRQ status can get locked infinitely if we do not: a) unlock RTC
This workaround must be applied within 1 second of power on, So, this is closest point to be able to guarantee the max timing.