#include <stdlib.h>
#include "../inc/hw_types.h"
#include "../inc/hw_ccfg.h"
#include "../inc/hw_fcfg1.h"
#include "aon_batmon.h"
#include "aon_rtc.h"
#include "osc.h"
#include "sys_ctrl.h"
#include "setup_rom.h"
Data Structures | |
struct | OscHfGlobals_t |
struct | hposc_insertions_t |
struct | hposc_param_t |
Macros | |
#define | RTC_CV_TO_MS(x) (( 1000 * ( x )) >> 16 ) |
#define | RTC_CV_TO_US(x) (( 1000000 * ( x )) >> 16 ) |
#define | D1OFFSET_25C (-16) |
#define | D2OFFSET_85C (-23) |
#define | D3OFFSET_n40C (5) |
#define | HPOSC_COEFF_BITS (20) |
#define | HPOSC_COEFF0_BITS (16) |
#define | HPOSC_D_BITS (30) |
#define | HPOSC_COEFF0_SHIFT (HPOSC_COEFF_BITS - HPOSC_COEFF0_BITS) |
#define | HPOSC_SHIFT1 (2*HPOSC_COEFF_BITS - HPOSC_D_BITS) |
#define | HPOSC_DC_BIAS (100000) |
Functions | |
XoscLf_Params_t _lfXoscParams | __attribute__ ((weak)) |
void | OSCClockSourceSet (uint32_t ui32SrcClk, uint32_t ui32Osc) |
Configure the oscillator input to the a source clock. More... | |
uint32_t | OSCClockSourceGet (uint32_t ui32SrcClk) |
Get the source clock settings. More... | |
uint32_t | OSCHF_GetStartupTime (uint32_t timeUntilWakeupInMs) |
Returns maximum startup time (in microseconds) of XOSC_HF. More... | |
void | OSCHF_TurnOnXosc (void) |
Turns on XOSC_HF (but without switching to XOSC_HF). More... | |
bool | OSCHF_AttemptToSwitchToXosc (void) |
Switch to XOSC_HF if XOSC_HF is ready. More... | |
void | OSCHF_SwitchToRcOscTurnOffXosc (void) |
Switch to RCOSC_HF and turn off XOSC_HF. More... | |
static void | InternCapArrayAdjustWithBaseline7001F (int32_t capArrayDelta) |
static uint32_t | SpecialCapArrayWorkaroundEnabledAndNeeded (void) |
void | OSC_CapArrayAdjustWorkaround_Boot (void) |
Special XOSC_HF workaround adjustment for CC13x2 / CC26x2 XOSC_CAPARRAY_DELTA setting in CCFG (Customer configuration) More... | |
void | OSC_AdjustXoscHfCapArray (int32_t capArrDelta) |
Adjust the XOSC HF cap array relative to the factory setting. More... | |
static void | multiplyColumns (int64_t *v1, int64_t *v2, int64_t *pBuf, uint8_t shift) |
static int64_t | findDenominator (int64_t *col0, int64_t *col1, int64_t *col2) |
static int64_t | findNumerator (int32_t *pInput, int64_t *pBuf) |
static void | findHposcCoefficients (int32_t *pInput, int64_t *col0, int64_t *col1, int64_t *col2, hposc_param_t *pParam) |
static void | findHposcPc (int64_t *pCoeff, uint8_t *pBits, int32_t *pTemp, uint8_t nTemp, int64_t *pOutput) |
static void | readTempAndFreq (uint32_t regAddr, int32_t *pTemp, int32_t *pdFreq, int32_t deltaFreq) |
void | OSC_HPOSCInitializeFrequencyOffsetParameters (void) |
HPOSC initialization function. Must always be called before using HPOSC. More... | |
void | OSC_HPOSC_Debug_InitFreqOffsetParams (HposcDebugData_t *pDebugData) |
Debug function to calculate the HPOSC polynomials for experimental data sets. More... | |
void | OSC_HPOSCInitializeSingleInsertionFreqOffsParams (uint32_t measFieldAddress) |
Special HPOSC initialization function for single temperature compensation. More... | |
void | OSC_LFXOSCInitStaticOffset (void) |
Initialize device specific coefficient for XOSC LF RTC compensation. More... | |
int32_t | OSC_LFXOSCRelativeFrequencyOffsetGet (int32_t temperature) |
Calculates the ppm offset of XOSC LF for a given temperature. More... | |
int32_t | OSC_HPOSCRelativeFrequencyOffsetGet (int32_t tempDegC) |
Calculate the temperature dependent relative frequency offset of HPOSC. More... | |
int16_t | OSC_HPOSCRelativeFrequencyOffsetToRFCoreFormatConvert (int32_t HPOSC_RelFreqOffset) |
Converts the relative frequency offset of HPOSC to the RF Core parameter format. More... | |
void | OSC_HPOSCRtcCompensate (int32_t relFreqOffset) |
Compensate the RTC increment based on the relative frequency offset of HPOSC. More... | |
uint32_t | OSCHF_DebugGetCrystalAmplitude (void) |
Get crystal amplitude (assuming crystal is running). More... | |
uint32_t | OSCHF_DebugGetExpectedAverageCrystalAmplitude (void) |
Get the expected average crystal amplitude. More... | |
uint32_t | OSCHF_DebugGetCrystalStartupTime (void) |
Measure the crystal startup time. More... | |
Variables | |
static OscHfGlobals_t | oscHfGlobals |
int32_t | _hposcCoeffs [4] = {0} |
#define D1OFFSET_25C (-16) |
Referenced by OSC_HPOSCInitializeFrequencyOffsetParameters().
#define D2OFFSET_85C (-23) |
Referenced by OSC_HPOSCInitializeFrequencyOffsetParameters().
#define D3OFFSET_n40C (5) |
Referenced by OSC_HPOSCInitializeFrequencyOffsetParameters().
#define HPOSC_COEFF0_BITS (16) |
Referenced by findHposcCoefficients(), and OSC_HPOSCRelativeFrequencyOffsetGet().
#define HPOSC_COEFF0_SHIFT (HPOSC_COEFF_BITS - HPOSC_COEFF0_BITS) |
Referenced by findHposcCoefficients(), and OSC_HPOSCRelativeFrequencyOffsetGet().
#define HPOSC_COEFF_BITS (20) |
Referenced by findDenominator(), findHposcCoefficients(), and findHposcPc().
#define HPOSC_D_BITS (30) |
Referenced by findHposcCoefficients().
#define HPOSC_DC_BIAS (100000) |
Referenced by findHposcCoefficients().
#define HPOSC_SHIFT1 (2*HPOSC_COEFF_BITS - HPOSC_D_BITS) |
Referenced by findDenominator(), and findHposcCoefficients().
#define RTC_CV_TO_MS | ( | x | ) | (( 1000 * ( x )) >> 16 ) |
Referenced by OSCHF_GetStartupTime().
#define RTC_CV_TO_US | ( | x | ) | (( 1000000 * ( x )) >> 16 ) |
Referenced by OSCHF_AttemptToSwitchToXosc(), and OSCHF_GetStartupTime().
XoscLf_Params_t _lfXoscParams __attribute__ | ( | (weak) | ) |
Referenced by CPUbasepriGet(), CPUbasepriSet(), CPUcpsid(), CPUcpsie(), CPUdelay(), CPUprimask(), CPUsev(), CPUwfe(), and CPUwfi().
|
static |
Referenced by findHposcCoefficients().
|
static |
Referenced by OSC_HPOSC_Debug_InitFreqOffsetParams(), OSC_HPOSCInitializeFrequencyOffsetParameters(), and OSC_HPOSCInitializeSingleInsertionFreqOffsParams().
|
static |
Referenced by OSC_HPOSC_Debug_InitFreqOffsetParams(), OSC_HPOSCInitializeFrequencyOffsetParameters(), and OSC_HPOSCInitializeSingleInsertionFreqOffsParams().
|
static |
Referenced by findHposcCoefficients().
|
static |
Referenced by OSC_AdjustXoscHfCapArray(), and OSC_CapArrayAdjustWorkaround_Boot().
|
static |
Referenced by findDenominator(), and findHposcCoefficients().
|
static |
Referenced by OSC_HPOSC_Debug_InitFreqOffsetParams(), OSC_HPOSCInitializeFrequencyOffsetParameters(), and OSC_HPOSCInitializeSingleInsertionFreqOffsParams().
|
static |
Referenced by OSC_AdjustXoscHfCapArray(), and OSC_CapArrayAdjustWorkaround_Boot().
int32_t _hposcCoeffs[4] = {0} |
|
static |