![]() |
S32 SDK
|
Real Time Clock Hardware Abstraction Layer.
Enumerations | |
enum | rtc_second_int_cfg_t { RTC_INT_1HZ = 0x00U, RTC_INT_2HZ = 0x01U, RTC_INT_4HZ = 0x02U, RTC_INT_8HZ = 0x03U, RTC_INT_16HZ = 0x04U, RTC_INT_32HZ = 0x05U, RTC_INT_64HZ = 0x06U, RTC_INT_128HZ = 0x07U } |
RTC Seconds interrupt configuration Implements : rtc_second_int_cfg_t_Class. More... | |
enum | rtc_clk_out_config_t { RTC_CLKOUT_DISABLED = 0x00U, RTC_CLKOUT_SRC_TSIC = 0x01U, RTC_CLKOUT_SRC_32KHZ = 0x02U } |
RTC CLKOUT pin configuration Implements : rtc_clk_out_config_t_Class. More... | |
enum | rtc_clk_select_t { RTC_CLK_SRC_OSC_32KHZ = 0x00U, RTC_CLK_SRC_LPO_1KHZ = 0x01U } |
RTC clock select Implements : rtc_clk_select_t_Class. More... | |
enum | rtc_lock_register_select_t { RTC_LOCK_REG_LOCK = 0x00U, RTC_STATUS_REG_LOCK = 0x01U, RTC_CTRL_REG_LOCK = 0x02U, RTC_TCL_REG_LOCK = 0x03U } |
RTC register lock Implements : rtc_lock_register_select_t_Class. More... | |
Configuration | |
status_t | RTC_HAL_Init (RTC_Type *const base) |
Initialize RTC instance. More... | |
status_t | RTC_HAL_Enable (RTC_Type *const base) |
Enable RTC instance counter. More... | |
status_t | RTC_HAL_Disable (RTC_Type *const base) |
Disable RTC instance counter. More... | |
status_t | RTC_HAL_ConfigureRegisterLock (RTC_Type *const base, rtc_lock_register_select_t registerToConfig) |
This function configures register lock status. More... | |
bool | RTC_HAL_IsRegisterLocked (const RTC_Type *const base, rtc_lock_register_select_t reg) |
This function gets register lock status. More... | |
status_t | RTC_HAL_ConfigureClockOut (RTC_Type *const base, rtc_clk_out_config_t config) |
This function configures the Clock Out pin source. More... | |
static uint32_t | RTC_HAL_GetTimeSecondsRegister (const RTC_Type *const base) |
Get Time Seconds Register Value. More... | |
status_t | RTC_HAL_SetTimeSecondsRegister (RTC_Type *const base, uint32_t seconds) |
Set Time Seconds Register. More... | |
static uint16_t | RTC_HAL_GetTimePrescalerRegister (const RTC_Type *const base) |
Get Time Prescaler Register. More... | |
status_t | RTC_HAL_SetTimePrescalerRegister (RTC_Type *const base, uint16_t value) |
Set Time Prescaler Register. More... | |
static uint32_t | RTC_HAL_GetTimeAlarmRegister (const RTC_Type *const base) |
Get Time Alarm Register. More... | |
static void | RTC_HAL_SetTimeAlarmRegister (RTC_Type *const base, uint32_t seconds) |
Set Time Alarm Register. More... | |
static void | RTC_HAL_GetTimeCompensation (const RTC_Type *const base, int8_t *compensationValue, uint8_t *compensationInterval) |
Get Time Compensation Value and Interval. More... | |
static void | RTC_HAL_SetTimeCompensation (RTC_Type *const base, int8_t compensationValue, uint8_t compensationInterval) |
Set Time Compensation. More... | |
static void | RTC_HAL_GetCurrentTimeCompensation (const RTC_Type *const base, int8_t *compensationValue, uint8_t *compensationInterval) |
Get TimeCompensation Value and Interval. More... | |
static void | RTC_HAL_SetLPOSelect (RTC_Type *const base, rtc_clk_select_t clk_select) |
Select clock source for RTC prescaler. More... | |
static rtc_clk_select_t | RTC_HAL_GetLPOSelect (const RTC_Type *const base) |
Get the selected clock source for RTC prescaler. More... | |
static void | RTC_HAL_SetUpdateMode (RTC_Type *const base, bool updateEnable) |
Set Update Mode of the registers when locked. More... | |
static bool | RTC_HAL_GetUpdateMode (const RTC_Type *const base) |
Get the Update Mode of the registers when locked. More... | |
static void | RTC_HAL_SetNonSupervisorAccess (RTC_Type *const base, bool enable) |
Set Non-Supervisor access mode. More... | |
static bool | RTC_HAL_GetNonSupervisorAccess (const RTC_Type *const base) |
Get Non-Supervisor access mode. More... | |
static void | RTC_HAL_SetSoftwareReset (RTC_Type *const base) |
Trigger a software reset. More... | |
static void | RTC_HAL_ClearSoftwareReset (RTC_Type *const base) |
Clear Software reset flag. More... | |
static void | RTC_HAL_SetTimeCounterEnable (RTC_Type *const base, bool enable) |
Enable or disable the Time counter. More... | |
static bool | RTC_HAL_GetTimeCounterEnable (const RTC_Type *const base) |
Get the Time Counter Enable value. More... | |
static bool | RTC_HAL_GetTimeAlarmFlag (const RTC_Type *const base) |
Get the Time alarm flag. More... | |
static bool | RTC_HAL_GetTimeOverflowFlag (const RTC_Type *const base) |
Get Time Overflow Flag. More... | |
static bool | RTC_HAL_GetTimeInvalidFlag (const RTC_Type *const base) |
Get Time Invalid flag. More... | |
static void | RTC_HAL_LockRegisterLock (RTC_Type *const base) |
Lock the Lock Register. More... | |
static bool | RTC_HAL_GetLockRegisterLock (const RTC_Type *const base) |
Get the Lock Register Lock state. More... | |
static void | RTC_HAL_StatusRegisterLock (RTC_Type *const base) |
Lock the Status Register. More... | |
static bool | RTC_HAL_GetStatusRegisterLock (const RTC_Type *const base) |
Get the Status Register Lock state. More... | |
static bool | RTC_HAL_GetControlRegisterLock (const RTC_Type *const base) |
Get the Control Register Lock state. More... | |
static void | RTC_HAL_ControlRegisterLock (RTC_Type *const base) |
Lock the Control Register. More... | |
static bool | RTC_HAL_GetTimeCompensationLock (const RTC_Type *const base) |
Get the TimeCompensation Register Lock state. More... | |
static void | RTC_HAL_TimeCompensationLock (RTC_Type *const base) |
Lock the TimeCompensation Register. More... | |
static void | RTC_HAL_SetTimeSecondsIntConf (RTC_Type *const base, rtc_second_int_cfg_t intCfg) |
Configure Time Seconds interrupt. More... | |
static rtc_second_int_cfg_t | RTC_HAL_GetTimeSecondsIntConf (const RTC_Type *const base) |
Get Time Seconds interrupt configuration. More... | |
static void | RTC_HAL_SetTimeSecondsIntEnable (RTC_Type *const base, bool enable) |
Enable TimeSeconds interrupt. More... | |
static bool | RTC_HAL_GetTimeSecondsIntEnable (const RTC_Type *const base) |
Get the TimeSeconds interrupt enable status. More... | |
static void | RTC_HAL_SetTimeAlarmIntEnable (RTC_Type *const base, bool enable) |
Enable TimeAlarm interrupt. More... | |
static bool | RTC_HAL_GetTimeAlarmIntEnable (const RTC_Type *const base) |
Get the TimeAlarm interrupt enable status. More... | |
static void | RTC_HAL_SetTimeOverflowIntEnable (RTC_Type *const base, bool enable) |
Enable TimeOverflow interrupt. More... | |
static bool | RTC_HAL_GetTimeOverflowIntEnable (const RTC_Type *const base) |
Get the TimeAlarm interrupt enable status. More... | |
static void | RTC_HAL_SetTimeInvalidIntEnable (RTC_Type *const base, bool enable) |
Enable TimeInvalid interrupt. More... | |
static bool | RTC_HAL_GetTimeInvalidIntEnable (const RTC_Type *const base) |
Get the TimeInvalid interrupt enable status. More... | |
enum rtc_clk_out_config_t |
enum rtc_clk_select_t |
enum rtc_second_int_cfg_t |
RTC Seconds interrupt configuration Implements : rtc_second_int_cfg_t_Class.
|
inlinestatic |
status_t RTC_HAL_ConfigureClockOut | ( | RTC_Type *const | base, |
rtc_clk_out_config_t | config | ||
) |
This function configures the Clock Out pin source.
[in] | base | RTC base pointer |
[in] | config | Source for the Clock Out pin |
status_t RTC_HAL_ConfigureRegisterLock | ( | RTC_Type *const | base, |
rtc_lock_register_select_t | registerToConfig | ||
) |
This function configures register lock status.
[in] | base | RTC base pointer |
[in] | registerToConfig | Register to configure |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Get TimeCompensation Value and Interval.
Returns current value used by the compensation logic for the present second interval. Updated once a second if the CIC equals 0 with the contents of the TCR field. If the CIC does not equal zero then it is loaded with zero.
[in] | base | RTC base pointer |
[out] | compensationValue | - Current value which is subtracted from the counter valid range -128, +127 |
[out] | compensationInterval | Current Compensation interval at which the compensation value is added to the prescaler register |
|
inlinestatic |
|
inlinestatic |
Get the selected clock source for RTC prescaler.
When set, the RTC prescaler increments using the LPO 1kHz clock and not the RTC 32kHz crystal clock. The LPO increments the prescaler from bit TPR[5] (TPR[4:0] are ignored), supporting close to 1 second increment of the seconds register.
[in] | base | RTC base pointer |
|
inlinestatic |
Get Non-Supervisor access mode.
[in] | base | RTC base pointer |
|
inlinestatic |
|
inlinestatic |
Get the Time alarm flag.
The alarm flag is cleared after a write in Time Alarm Register
[in] | base | RTC base pointer |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Get Time Compensation Value and Interval.
The Time Prescaler register overflows at every 32768 - (compRegister) cycles. For example if the compRegister is -128 TPR overflows at 32768 - (-128) = 32896 cycles. Else if compRegister is 127 TPR overflows at 32641 cycles. This correction is made at the interval configured by Compensation Interval
[in] | base | RTC base pointer |
[out] | compensationValue | Compensation value |
[out] | compensationInterval | Compensation Interval |
Implements : RTC_HAL_GetTimeCompensation_Activity
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Get Time Invalid flag.
The time invalid flag is set on POR or software reset. The TSR and TPR do not increment and read as zero when this bit is set. This bit is cleared by writing the TSR register when the time counter is disabled.
[in] | base | RTC base pointer |
|
inlinestatic |
|
inlinestatic |
Get Time Overflow Flag.
The TOF is set when Time Seconds Register overflows. Disable the counter and write TSR to clear this bit
[in] | base | RTC base pointer |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Get the Update Mode of the registers when locked.
[in] | base | RTC base pointer |
bool RTC_HAL_IsRegisterLocked | ( | const RTC_Type *const | base, |
rtc_lock_register_select_t | reg | ||
) |
|
inlinestatic |
|
inlinestatic |
Select clock source for RTC prescaler.
When set, the RTC prescaler increments using the LPO 1kHz clock and not the RTC 32kHz crystal clock. The LPO increments the prescaler from bit TPR[5] (TPR[4:0] are ignored), supporting close to 1 second increment of the seconds register.
[in] | base | RTC base pointer |
[in] | clk_select | clock source Implements : RTC_HAL_SetLPOSelect_Activity |
|
inlinestatic |
Set Non-Supervisor access mode.
[in] | base | RTC base pointer |
[in] | enable | supervisor access
|
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Set Time Alarm Register.
[in] | base | RTC base pointer |
[in] | seconds | Number of seconds at which the alarm is triggered. The TAR value is correct only if the value is greater than current time (Time seconds register) Implements : RTC_HAL_SetTimeAlarmRegister_Activity |
|
inlinestatic |
Set Time Compensation.
Configure the frequency of the Time Seconds counter together with Compensation Interval register.
The Time Prescaler register overflows at every 32768 - (compValue) cycles. For example if the compValue is -128 TPR overflows at 32768 - (-128) = 32896 cycles
Else if compValue is 127 TPR overflows at 32641 cycles
The compensation interval in seconds from 1 to 256 is used to control how frequently the TCR should adjust the number of 32.768 kHz cycles in each second. The value written should be one less than the number of seconds. For example, write zero to configure for a compensation interval of one second. This register is double buffered and writes do not take affect until the end of the current compensation interval.
[in] | base | RTC base pointer |
[in] | compensationValue | - the value which is subtracted from the counter valid range -128, +127 |
[in] | compensationInterval | Compensation interval at which the compensation value is added to the prescaler register |
|
inlinestatic |
Enable or disable the Time counter.
When time counter is disabled the TSR register and TPR register are writable, but do not increment. When time counter is enabled the TSR register and TPR register are not writable, but increment.
[in] | base | RTC base pointer |
[in] | enable | :
|
|
inlinestatic |
|
inlinestatic |
Set Time Prescaler Register.
This function along with SetTimeSecondsRegister will help you set the starting time at a specified value. The write will fail if the Time Counter is enabled and will return STATUS_ERROR, otherwise the return will be STATUS_SUCCESS
[in] | base | RTC base pointer |
[in] | value | Number of RTC CLK IN periods |
|
inlinestatic |
|
inlinestatic |
Set Time Seconds Register.
This function along with SetTimePrescalerRegister will help you set the starting time at a specified value. The write will fail if the Time Counter is enabled and will return STATUS_ERROR, otherwise the return will be STATUS_SUCCESS
[in] | base | RTC base pointer |
[in] | seconds | number of seconds passed |
|
inlinestatic |
Set Update Mode of the registers when locked.
[in] | base | RTC base pointer |
[in] | updateEnable | value to be written in the register field
|
|
inlinestatic |
|
inlinestatic |
Lock the TimeCompensation Register.
This method locks the TimeCompensation Register. If the register is locked, it can be unlocked only with power-on reset(POR) or a software reset.
[in] | base | RTC base pointer Implements : RTC_HAL_TimeCompensationLock_Activity |