AM275 FreeRTOS SDK  11.00.00
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages

Introduction

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...
 

Macro Definition Documentation

◆ OSCILLATOR_FREQ_HZ

#define OSCILLATOR_FREQ_HZ   ((uint32_t) 32768U)

32.768 kHz Crystal Oscillator Frequency

◆ RTC_FREEZE_MODE

#define RTC_FREEZE_MODE   ((uint32_t) 0x02000000U)

Enable Freeze Mode.

◆ O32K_OSC_DEP_EN_MASK

#define O32K_OSC_DEP_EN_MASK   (CSL_RTC_GENRAL_CTL_O32K_OSC_DEP_EN_MASK)

O32K_OSC_DEP_EN_MASK.

◆ RD_PEND_MASK

#define RD_PEND_MASK   (CSL_RTC_SYNCPEND_RD_PEND_MASK)

Read Pend Status.

◆ WR_PEND_MASK

#define WR_PEND_MASK   (CSL_RTC_SYNCPEND_WR_PEND_MASK)

Write Pend Status.

◆ O32K_CLK_OBS_BIT_MASK

#define O32K_CLK_OBS_BIT_MASK   (CSL_RTC_SYNCPEND_O32K_CLK_OBS_MASK)

O32K_CLK_OBS_BIT_MASK.

◆ RTC_SW_OFF_MASK

#define RTC_SW_OFF_MASK   (CSL_RTC_GENRAL_CTL_SW_OFF_MASK)

RTC_SW_OFF_MASK.

◆ RTC_UNLOCK_MASK

#define RTC_UNLOCK_MASK   (CSL_RTC_GENRAL_CTL_UNLOCK_MASK)

Unlock State Status.

◆ OSC_LOCK_WAIT

#define OSC_LOCK_WAIT   (3U)

Wait time for stabalizing OSC.

◆ KICK0_UNLOCK_VALUE

#define KICK0_UNLOCK_VALUE   (uint32_t)0x83E70B13U

RTC Kick unlock values.

◆ KICK1_UNLOCK_VALUE

#define KICK1_UNLOCK_VALUE   (uint32_t)0x95A4F1E0U

◆ KICK0_LOCK_VALUE

#define KICK0_LOCK_VALUE   (CSL_RTC_KICK0_RESETVAL)

RTC Kick lock values.

◆ KICK1_LOCK_VALUE

#define KICK1_LOCK_VALUE   (CSL_RTC_KICK1_RESETVAL)

◆ RTC_BASEADDR

#define RTC_BASEADDR   (uint32_t)0x2B1F0000U

RTC Base Address.

◆ RTC_TMR_INT_INT0_STATUS_FLAG

#define RTC_TMR_INT_INT0_STATUS_FLAG   (CSL_RTC_IRQSTATUS_SYS_EVENT_ON_OFF_MASK)

ON_OFF status interrupt.

◆ RTC_TMR_INT_INT1_STATUS_FLAG

#define RTC_TMR_INT_INT1_STATUS_FLAG   (CSL_RTC_IRQSTATUS_SYS_EVENT_OFF_ON_MASK)

OFF_ON status interrupt.

◆ RTC_TMR_INT_INT0_CLEAR_FLAG

#define RTC_TMR_INT_INT0_CLEAR_FLAG   (CSL_RTC_IRQENABLE_CLR_SYS_EN_EVENT_ON_OFF_MASK)

ON_OFF clear interrupt.

◆ RTC_TMR_INT_INT1_CLEAR_FLAG

#define RTC_TMR_INT_INT1_CLEAR_FLAG   (CSL_RTC_IRQENABLE_CLR_SYS_EN_EVENT_OFF_ON_MASK)

OFF_ON clear interrupt.

◆ RTC_TMR_INT_INT0_SET_FLAG

#define RTC_TMR_INT_INT0_SET_FLAG   (CSL_RTC_IRQENABLE_SET_SYS_EN_EVENT_ON_OFF_MASK)

ON_OFF set interrupt.

◆ RTC_TMR_INT_INT1_SET_FLAG

#define RTC_TMR_INT_INT1_SET_FLAG   (CSL_RTC_IRQENABLE_SET_SYS_EN_EVENT_OFF_ON_MASK)

OFF_ON set interrupt.

◆ RTC_TMR_INT_INT0_RAW_STATUS_FLAG

#define RTC_TMR_INT_INT0_RAW_STATUS_FLAG   (CSL_RTC_IRQSTATUS_RAW_SYS_EVENT_ON_OFF_MASK)

ON_OFF raw status interrupt.

◆ RTC_TMR_INT_INT1_RAW_STATUS_FLAG

#define RTC_TMR_INT_INT1_RAW_STATUS_FLAG   (CSL_RTC_IRQSTATUS_RAW_SYS_EVENT_OFF_ON_MASK)

OFF_ON raw status interrupt.

◆ RTC_TMR_INT_STATUS_ALL

#define RTC_TMR_INT_STATUS_ALL
Value:
RTC_TMR_INT_INT1_STATUS_FLAG)

All interrupt status mask.

◆ RTC_TMR_INT_CLEAR_ALL

#define RTC_TMR_INT_CLEAR_ALL
Value:
RTC_TMR_INT_INT1_CLEAR_FLAG)

All interrupt clear mask.

◆ RTC_TMR_INT_REQ_ALL

#define RTC_TMR_INT_REQ_ALL
Value:
RTC_TMR_INT_INT1_SET_FLAG)

All interrupt set mask.

◆ RTC_TMR_INT_RAW_STATUS_ALL

#define RTC_TMR_INT_RAW_STATUS_ALL
Value:
RTC_TMR_INT_INT1_RAW_STATUS_FLAG)

All interrupt raw status mask.

Typedef Documentation

◆ RTC_Handle

typedef struct RTC_Config_s* RTC_Handle

A handle that is returned from a RTC_open() call.

◆ RTC_OnOffCallbackFxn

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.

Parameters
handleRTC_Handle

◆ RTC_OffOnCallbackFxn

typedef void(* RTC_OffOnCallbackFxn) (RTC_Handle handle)

The definition of a OFF_ON callback function used by the RTC driver.

  • The callback will be called if the OFF_ON interrupt is enabled.
Parameters
handleRTC_Handle

Function Documentation

◆ RTC_init()

void RTC_init ( void  )

Initialize the RTC module.

◆ RTC_deinit()

void RTC_deinit ( void  )

De-initialize the RTC module.

◆ RTC_paramsInit()

void RTC_paramsInit ( RTC_Params params)

Function to set default values of RTC_Params in params.

Parameters
params[IN] pointer to the structure to be initialized

◆ RTC_open()

RTC_Handle RTC_open ( uint32_t  idx,
const RTC_Params params 
)

Open the RTC at index idx with parameters params.

Parameters
idx[IN] Index of RTC to open in global config
params[IN] RTC_Params values to use for opening
Returns
RTC_Handle

◆ RTC_close()

void RTC_close ( RTC_Handle  handle)

Function to close the RTC Peripheral specified by the handle.

Precondition
RTC_open() has to be called first
Parameters
handle[IN] RTC_Handle returned from RTC_open()
See also
RTC_open()

◆ RTC_setTime()

int32_t RTC_setTime ( RTC_Handle  handle,
const RTC_Time rtc_time 
)

Set the RTC time.

Parameters
handle[IN] RTC_Handle returned from RTC_open()
rtc_time[IN] Pointer to RTC_Time structure
Returns
RTC_StatusCode

◆ RTC_getTime()

int32_t RTC_getTime ( RTC_Handle  handle,
RTC_Time rtc_time 
)

Get the current RTC time.

Parameters
handle[IN] RTC_Handle returned from RTC_open()
rtc_time[OUT] Pointer to RTC_Time structure
Returns
RTC_StatusCode

◆ RTC_setOff_OnTimerEvent()

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.

Parameters
handle[IN] RTC_Handle returned from RTC_open()
rtc_time[IN] Pointer to RTC_Time structure
Returns
RTC_StatusCode

◆ RTC_setOn_OffTimerEvent()

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.

Parameters
handle[IN] RTC_Handle returned from RTC_open()
rtc_time[IN] Pointer to RTC_Time structure
Returns
RTC_StatusCode

◆ RTC_readScratchRegister()

uint32_t RTC_readScratchRegister ( RTC_Handle  handle,
uint32_t  scratchIndex 
)

Read a value from a specific RTC scratch register.

Parameters
handle[IN] RTC_Handle returned from RTC_open()
scratchIndex[IN] Index of scratch register to read
Returns
Value from the specified scratch register

◆ RTC_writeScratchRegister()

int32_t RTC_writeScratchRegister ( RTC_Handle  handle,
uint32_t  scratchIndex,
uint32_t  value 
)

Write a value to a specific RTC scratch register.

Parameters
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
Returns
RTC_StatusCode

◆ RTC_calculateElapsedTime()

RTC_Time RTC_calculateElapsedTime ( const RTC_Time startTime,
const RTC_Time endTime 
)

Calculate Elapsed Time.

Parameters
startTime[IN] RTC_Time structure having start time
endTime[IN] RTC_Time structure having end time

◆ RTC_adjustForDrift()

int32_t RTC_adjustForDrift ( RTC_Handle  handle,
Float32  measuredDriftInSeconds 
)

Calculate Elapsed Time.

Parameters
handle[IN] RTC_Handle returned from RTC_open()
measuredDriftInSeconds[IN] Drift Value to be adjusted in Seconds
Returns
RTC_StatusCode

◆ RTC_stop()

int32_t RTC_stop ( RTC_Handle  handle)

Stop the RTC.

Parameters
handle[IN] RTC_Handle returned from RTC_open()
Returns
RTC_StatusCode

◆ RTC_start()

int32_t RTC_start ( RTC_Handle  handle)

Start the RTC after it's stopped.

Parameters
handle[IN] RTC_Handle returned from RTC_open()
Returns
RTC_StatusCode

◆ RTC_erratumi2327Init()

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.

RTC_TMR_INT_INT0_RAW_STATUS_FLAG
#define RTC_TMR_INT_INT0_RAW_STATUS_FLAG
ON_OFF raw status interrupt.
Definition: rtc/v0/rtc.h:128
RTC_TMR_INT_INT0_SET_FLAG
#define RTC_TMR_INT_INT0_SET_FLAG
ON_OFF set interrupt.
Definition: rtc/v0/rtc.h:123
RTC_TMR_INT_INT0_STATUS_FLAG
#define RTC_TMR_INT_INT0_STATUS_FLAG
ON_OFF status interrupt.
Definition: rtc/v0/rtc.h:113
RTC_TMR_INT_INT0_CLEAR_FLAG
#define RTC_TMR_INT_INT0_CLEAR_FLAG
ON_OFF clear interrupt.
Definition: rtc/v0/rtc.h:118