CC26xx Driver Library
[aon_rtc] AON Real Time Clock

Functions

static void AONRTCEnable (void)
 Enable the RTC. More...
 
static void AONRTCDisable (void)
 Disable the RTC. More...
 
static void AONRTCReset (void)
 Reset the RTC. More...
 
static bool AONRTCActive (void)
 Check if the RTC is active (enabled). More...
 
static bool AONRTCChannelActive (uint32_t ui32Channel)
 Check if an RTC channel is active (enabled). More...
 
static void AONRTCDelayConfig (uint32_t ui32Delay)
 Configure Event Delay for the RTC. More...
 
static void AONRTCCombinedEventConfig (uint32_t ui32Channels)
 Configure the source of the combined event. More...
 
static void AONRTCEventClear (uint32_t ui32Channel)
 Clear event from a specified channel. More...
 
static bool AONRTCEventGet (uint32_t ui32Channel)
 Get event status for a specified channel. More...
 
static uint32_t AONRTCSecGet (void)
 Get integer part (seconds) of RTC free-running timer. More...
 
static uint32_t AONRTCFractionGet (void)
 Get fractional part (sub-seconds) of RTC free-running timer. More...
 
static uint32_t AONRTCSubSecIncrGet (void)
 Get the sub second increment of the RTC. More...
 
static void AONRTCModeCh1Set (uint32_t ui32Mode)
 Set operational mode of channel 1. More...
 
static uint32_t AONRTCModeCh1Get (void)
 Get operational mode of channel 1. More...
 
static void AONRTCModeCh2Set (uint32_t ui32Mode)
 Set operational mode of channel 2. More...
 
static uint32_t AONRTCModeCh2Get (void)
 Get operational mode of channel 2. More...
 
static void AONRTCChannelEnable (uint32_t ui32Channel)
 Enable event operation for the specified channel. More...
 
static void AONRTCChannelDisable (uint32_t ui32Channel)
 Disable event operation for the specified channel. More...
 
static void AONRTCCompareValueSet (uint32_t ui32Channel, uint32_t ui32CompValue)
 Set the compare value for the given channel. More...
 
static uint32_t AONRTCCompareValueGet (uint32_t ui32Channel)
 Get the compare value for the given channel. More...
 
uint32_t AONRTCCurrentCompareValueGet (void)
 Get the current value of the RTC counter in a format that matches RTC compare values. More...
 
uint64_t AONRTCCurrent64BitValueGet (void)
 Get the current 64-bit value of the RTC counter. More...
 
static void AONRTCIncValueCh2Set (uint32_t ui32IncValue)
 Set the channel 2 increment value when operating in continuous mode. More...
 
static uint32_t AONRTCIncValueCh2Get (void)
 Get the channel2 increment value when operating in continuous mode. More...
 
static uint32_t AONRTCCaptureValueCh1Get (void)
 Get the channel 1 capture value. More...
 

Detailed Description

Introduction

Note
If using TI-RTOS then only TI-RTOS is allowed to configure the RTC timer!

Function Documentation

static bool AONRTCActive ( void  )
inlinestatic

Check if the RTC is active (enabled).

Returns
Returns the status of the RTC.
  • false : RTC is disabled
  • true : RTC is enabled

Definition at line 233 of file aon_rtc.h.

static uint32_t AONRTCCaptureValueCh1Get ( void  )
inlinestatic

Get the channel 1 capture value.

Get the channel 1 capture value. The upper 16 bits of the returned value is the lower 16 bits of the integer part of the RTC timer. The lower 16 bits of the returned part is the upper 16 bits of the fractional part.

Returns
Returns the channel 1 capture value.

Definition at line 910 of file aon_rtc.h.

static bool AONRTCChannelActive ( uint32_t  ui32Channel)
inlinestatic

Check if an RTC channel is active (enabled).

Parameters
ui32Channelspecifies the RTC channel to check status of. Parameter must be one (and only one) of the following:
Returns
Returns the status of the requested channel:
  • false : Channel is disabled
  • true : Channel is enabled

Definition at line 255 of file aon_rtc.h.

static void AONRTCChannelDisable ( uint32_t  ui32Channel)
inlinestatic

Disable event operation for the specified channel.

Disable the event generation for the specified channel.

Note
The RTC free running clock can also be disabled globally using the AONRTCDisable() call.
Parameters
ui32Channelspecifies one or more channels to disable:
Returns
None
See also
AONRTCDisable()

Definition at line 705 of file aon_rtc.h.

static void AONRTCChannelEnable ( uint32_t  ui32Channel)
inlinestatic

Enable event operation for the specified channel.

Enable the event generation for the specified channel.

Note
The RTC free running clock must also be enabled globally using the AONRTCEnable() call.
Parameters
ui32Channelspecifies one or more channels to enable:
Returns
None
See also
AONRTCEnable()

Definition at line 662 of file aon_rtc.h.

static void AONRTCCombinedEventConfig ( uint32_t  ui32Channels)
inlinestatic

Configure the source of the combined event.

A combined delayed event can be generated from a combination of the three delayed events. Delayed events form the specified channels are OR'ed together to generate the combined event.

Parameters
ui32Channelsspecifies the channels that are to be used for generating the combined event. The parameter must be the bitwise OR of any of the following:
Returns
None

Definition at line 345 of file aon_rtc.h.

static uint32_t AONRTCCompareValueGet ( uint32_t  ui32Channel)
inlinestatic

Get the compare value for the given channel.

Get compare value for the specified channel.

Parameters
ui32Channelspecifies a channel. The parameter must be one (and only one) of the following:
Returns
Returns the stored compare value for the given channel.

Definition at line 791 of file aon_rtc.h.

static void AONRTCCompareValueSet ( uint32_t  ui32Channel,
uint32_t  ui32CompValue 
)
inlinestatic

Set the compare value for the given channel.

Set compare value for the specified channel.

The format of the compare value is a 16 bit integer and 16 bit fractional format <16 sec.16 subsec>. The current value of the RTC counter can be retrieved in a format compatible to the compare register using AONRTCCurrentCompareValueGet()

Parameters
ui32Channelspecifies one or more channels to set compare value for:
ui32CompValueis the compare value to set for the specified channel.
  • Format: <16 sec.16 subsec>
Returns
None
See also
AONRTCCurrentCompareValueGet()

Definition at line 752 of file aon_rtc.h.

uint64_t AONRTCCurrent64BitValueGet ( void  )

Get the current 64-bit value of the RTC counter.

Note
Reading SEC both before and after SUBSEC in order to detect if SEC incremented while reading SUBSEC. If SEC incremented, we can't be sure which SEC the SUBSEC belongs to, so repeating the sequence then.
Returns
Returns the current value of the RTC counter in a 64-bits format (SEC[31:0].SUBSEC[31:0]).

Definition at line 87 of file aon_rtc.c.

uint32_t AONRTCCurrentCompareValueGet ( void  )

Get the current value of the RTC counter in a format that matches RTC compare values.

The compare value registers contains 16 integer and 16 fractional bits. This function will return the current value of the RTC counter in an identical format.

Note
Reading SEC both before and after SUBSEC in order to detect if SEC incremented while reading SUBSEC. If SEC incremented, we can't be sure which SEC the SUBSEC belongs to, so repeating the sequence then.
Returns
Returns the current value of the RTC counter in a <16.16> format (SEC[15:0].SUBSEC[31:16]).
See also
AONRTCCompareValueSet()

Definition at line 62 of file aon_rtc.c.

Referenced by OSCHF_AttemptToSwitchToXosc(), OSCHF_DebugGetCrystalAmplitude(), OSCHF_GetStartupTime(), OSCHF_SwitchToRcOscTurnOffXosc(), and OSCHF_TurnOnXosc().

static void AONRTCDelayConfig ( uint32_t  ui32Delay)
inlinestatic

Configure Event Delay for the RTC.

Each event from the three individual channels can generate a delayed event. The delay time for these events is set using this function. The delay is measured in clock cycles.

Note
There is only one delay setting shared for all three channels.
Parameters
ui32Delayspecifies the delay time for delayed events. Parameter must be one of the following:
Returns
None.

Definition at line 308 of file aon_rtc.h.

static void AONRTCDisable ( void  )
inlinestatic

Disable the RTC.

Disable the AON Real Time Clock.

Note
Event generation for each of the three channels can also be disabled using the function AONRTCChannelDisable().
Returns
None
See also
AONRTCChannelDisable()

Definition at line 197 of file aon_rtc.h.

static void AONRTCEnable ( void  )
inlinestatic

Enable the RTC.

Enable the AON Real Time Clock.

Note
Event generation for each of the three channels must also be enabled using the function AONRTCChannelEnable().
Returns
None
See also
AONRTCChannelEnable()

Definition at line 174 of file aon_rtc.h.

static void AONRTCEventClear ( uint32_t  ui32Channel)
inlinestatic

Clear event from a specified channel.

In case of an active event from the specified channel, the event will be cleared (de-asserted).

Parameters
ui32Channelclears the event from one or more RTC channels:
Returns
None

Definition at line 378 of file aon_rtc.h.

static bool AONRTCEventGet ( uint32_t  ui32Channel)
inlinestatic

Get event status for a specified channel.

In case of an active event from the specified channel, this call will return true otherwise false.

Parameters
ui32Channelspecifies the channel from which to query the event state. The parameter must be one (and only one) of the following:
Returns
Returns true if an event has occurred for the given channel, otherwise false.

Definition at line 419 of file aon_rtc.h.

static uint32_t AONRTCFractionGet ( void  )
inlinestatic

Get fractional part (sub-seconds) of RTC free-running timer.

Get the value of the fractional part of RTC free-running timer, i.e. the sub-second part.

Note
It is recommended to use AONRTCCurrentCompareValueGet() instead of this function if the <16.16> format is sufficient.
To read a consistent pair of integer and fractional parts, AONRTCSecGet() must be called first to trigger latching of the fractional part, which is then read by AONRTCFractionGet(). Interrupts must be disabled to ensure that these operations are performed atomically.
Returns
Returns the fractional part of RTC free running timer.
See also
AONRTCSecGet() AONRTCCurrentCompareValueGet()

Definition at line 497 of file aon_rtc.h.

static uint32_t AONRTCIncValueCh2Get ( void  )
inlinestatic

Get the channel2 increment value when operating in continuous mode.

Get the channel 2 increment value, when channel 2 is operating in continuous mode. This value is automatically incremented to the channel 2 compare register, upon a channel 2 compare event. This allows channel 2 to generate a series of completely equidistant events.

Returns
Returns the channel 2 increment value when operating in continuous mode.
See also
AONRTCIncValueCh2Set()

Definition at line 892 of file aon_rtc.h.

static void AONRTCIncValueCh2Set ( uint32_t  ui32IncValue)
inlinestatic

Set the channel 2 increment value when operating in continuous mode.

Set the channel 2 increment value when operating in continuous mode. The specified value is automatically incremented to the channel 2 compare register, upon a channel 2 compare event. This allows channel 2 to generate a series of completely equidistant events.

Parameters
ui32IncValueis the increment value when operating in continuous mode.
Returns
None
See also
AONRTCIncValueCh2Get()

Definition at line 870 of file aon_rtc.h.

static uint32_t AONRTCModeCh1Get ( void  )
inlinestatic

Get operational mode of channel 1.

Get the operational mode of channel 1. It can be capture or compare mode. In capture mode, an external event causes the value of the free running counter to be stored, to remember the time of the event.

Returns
Returns the operational mode of channel 1, one of:
See also
AONRTCModeCh1Set()

Definition at line 580 of file aon_rtc.h.

static void AONRTCModeCh1Set ( uint32_t  ui32Mode)
inlinestatic

Set operational mode of channel 1.

Set the operational mode of channel 1. It can be capture or compare mode. In capture mode, an external event causes the value of the free running counter to be stored, to remember the time of the event.

Note
The default mode is compare.
Parameters
ui32Modespecifies the mode for channel 1. The parameter must be one of the following:
Returns
None
See also
AONRTCModeCh1Get()

Definition at line 555 of file aon_rtc.h.

static uint32_t AONRTCModeCh2Get ( void  )
inlinestatic

Get operational mode of channel 2.

Get the operational mode of channel 2. It can be in continuous compare mode or normal compare mode. In continuous mode, a value is automatically incremented to the channel 2 compare register, upon a channel 2 compare event. This allows channel 2 to generate a series of completely equidistant events. The increment value is set by the AONRTCIncValueCh2Set() call.

Returns
Returns the operational mode of channel 2, i.e. one of:
See also
AONRTCIncValueCh2Set(), AONRTCIncValueCh2Get()

Definition at line 637 of file aon_rtc.h.

static void AONRTCModeCh2Set ( uint32_t  ui32Mode)
inlinestatic

Set operational mode of channel 2.

Set the operational mode of channel 2. It can be in continuous compare mode or normal compare mode. In continuous mode, a value is automatically incremented to the channel 2 compare register, upon a channel 2 compare event. This allows channel 2 to generate a series of completely equidistant events. The increment value is set by the AONRTCIncValueCh2Set() call.

Note
The default mode is normal compare.
Parameters
ui32Modespecifies the mode for channel 2. The parameter must be one of the following:
Returns
None
See also
AONRTCIncValueCh2Set(), AONRTCIncValueCh2Get()

Definition at line 609 of file aon_rtc.h.

static void AONRTCReset ( void  )
inlinestatic

Reset the RTC.

Reset the AON Real Time Clock.

Returns
None

Definition at line 215 of file aon_rtc.h.

static uint32_t AONRTCSecGet ( void  )
inlinestatic

Get integer part (seconds) of RTC free-running timer.

Get the value in seconds of RTC free-running timer, i.e. the integer part. The fractional part is returned from a call to AONRTCFractionGet().

Note
It is recommended to use AONRTCCurrentCompareValueGet() instead of this function if the <16.16> format is sufficient.
To read a consistent pair of integer and fractional parts, AONRTCSecGet() must be called first to trigger latching of the fractional part, which is then read by AONRTCFractionGet(). Interrupts must be disabled to ensure that these operations are performed atomically.
Returns
Returns the integer part of RTC free running timer.
See also
AONRTCFractionGet() AONRTCCurrentCompareValueGet()

Definition at line 467 of file aon_rtc.h.

static uint32_t AONRTCSubSecIncrGet ( void  )
inlinestatic

Get the sub second increment of the RTC.

Get the value of the sub-second increment which is added to the RTC absolute time on every clock tick.

Note
For a precise and temperature independent LF clock (e.g. an LF XTAL) this value would stay the same across temperature. For temperatue dependent clock sources like an RC oscillator, this value will change over time if the application includes functionality for doing temperature compensation of the RTC clock source. The default value corresponds to a LF clock frequency of exactly 32.768 kHz.
Returns
Returns the sub-second increment of the RTC added to the overall value on every RTC clock tick.

Definition at line 529 of file aon_rtc.h.

Macro Definition Documentation

#define AON_RTC_ACTIVE   0x8

Definition at line 97 of file aon_rtc.h.

#define AON_RTC_CH_NONE   0x0

Definition at line 93 of file aon_rtc.h.

Referenced by AONRTCCombinedEventConfig().

#define AON_RTC_CONFIG_DELAY_1   1

Definition at line 105 of file aon_rtc.h.

#define AON_RTC_CONFIG_DELAY_112   11

Definition at line 115 of file aon_rtc.h.

#define AON_RTC_CONFIG_DELAY_128   12

Definition at line 116 of file aon_rtc.h.

#define AON_RTC_CONFIG_DELAY_144   13

Definition at line 117 of file aon_rtc.h.

Referenced by AONRTCDelayConfig().

#define AON_RTC_CONFIG_DELAY_16   5

Definition at line 109 of file aon_rtc.h.

#define AON_RTC_CONFIG_DELAY_2   2

Definition at line 106 of file aon_rtc.h.

#define AON_RTC_CONFIG_DELAY_32   6

Definition at line 110 of file aon_rtc.h.

#define AON_RTC_CONFIG_DELAY_4   3

Definition at line 107 of file aon_rtc.h.

#define AON_RTC_CONFIG_DELAY_48   7

Definition at line 111 of file aon_rtc.h.

#define AON_RTC_CONFIG_DELAY_64   8

Definition at line 112 of file aon_rtc.h.

#define AON_RTC_CONFIG_DELAY_8   4

Definition at line 108 of file aon_rtc.h.

#define AON_RTC_CONFIG_DELAY_80   9

Definition at line 113 of file aon_rtc.h.

#define AON_RTC_CONFIG_DELAY_96   10

Definition at line 114 of file aon_rtc.h.

#define AON_RTC_CONFIG_DELAY_NODELAY   0

Definition at line 104 of file aon_rtc.h.

#define AON_RTC_MODE_CH1_CAPTURE   1

Definition at line 125 of file aon_rtc.h.

Referenced by AONRTCModeCh1Set().

#define AON_RTC_MODE_CH1_COMPARE   0

Definition at line 126 of file aon_rtc.h.

Referenced by AONRTCModeCh1Set().

#define AON_RTC_MODE_CH2_CONTINUOUS   1

Definition at line 134 of file aon_rtc.h.

Referenced by AONRTCModeCh2Set().

#define AON_RTC_MODE_CH2_NORMALCOMPARE   0

Definition at line 135 of file aon_rtc.h.

Referenced by AONRTCModeCh2Set().

#define FACTOR_SEC_TO_COMP_VAL_FORMAT   0x00010000

Definition at line 151 of file aon_rtc.h.

Referenced by OSCHF_DebugGetCrystalAmplitude().