CC26xx Driver Library
setup.c File Reference
#include <inc/hw_memmap.h>
#include <inc/hw_types.h>
#include <inc/hw_adi.h>
#include <inc/hw_adi_0_rf.h>
#include <inc/hw_adi_1_synth.h>
#include <inc/hw_adi_2_refsys.h>
#include <inc/hw_adi_3_refsys.h>
#include <inc/hw_adi_4_aux.h>
#include <inc/hw_aon_ioc.h>
#include <inc/hw_aon_sysctl.h>
#include <inc/hw_aon_wuc.h>
#include <inc/hw_aux_wuc.h>
#include <inc/hw_ccfg.h>
#include <inc/hw_chip_def.h>
#include <inc/hw_ddi.h>
#include <inc/hw_flash.h>
#include <inc/hw_fcfg1.h>
#include <inc/hw_ddi_0_osc.h>
#include <inc/hw_prcm.h>
#include <inc/hw_vims.h>
#include <inc/hw_aon_batmon.h>
#include <inc/hw_aon_rtc.h>
#include <driverlib/adi.h>
#include <driverlib/aon_batmon.h>
#include <driverlib/cpu.h>
#include <driverlib/chipinfo.h>
#include <driverlib/ddi.h>
#include <driverlib/ioc.h>
#include <driverlib/prcm.h>
#include <driverlib/setup.h>
#include <driverlib/sys_ctrl.h>

Go to the source code of this file.

Macros

#define DELAY_20_USEC   0x140
 Defined time delay assuming 48 MHz clock and resolution of 3 cycles. More...
 
#define CPU_DELAY_MICRO_SECONDS(x)   CPUdelay(((uint32_t)((( x ) * 48.0 ) / 5.0 )) - 1 )
 
#define CCFG_MODE_CONF_VDDR_TRIM_SLEEP_DELTA_WIDTH   4
 

Functions

static uint32_t GetTrimForAdcShModeEn (uint32_t ui32Fcfg1Revision)
 Returns the trim value from FCFG1 to be used as ADC_SH_MODE_EN setting. More...
 
static uint32_t GetTrimForAdcShVbufEn (uint32_t ui32Fcfg1Revision)
 Returns the trim value from FCFG1 to be used as ADC_SH_VBUF_EN setting. More...
 
static uint32_t GetTrimForAmpcompCtrl (uint32_t ui32Fcfg1Revision)
 Returns the trim value to be used for the AMPCOMP_CTRL register in OSC_DIG. More...
 
static uint32_t GetTrimForAmpcompTh1 (void)
 Returns the trim value to be used for the AMPCOMP_TH1 register in OSC_DIG. More...
 
static uint32_t GetTrimForAmpcompTh2 (void)
 Returns the trim value to be used for the AMPCOMP_TH2 register in OSC_DIG. More...
 
static uint32_t GetTrimForAnabypassValue1 (uint32_t ccfg_ModeConfReg)
 Returns the trim value to be used for the ANABYPASS_VALUE1 register in OSC_DIG. More...
 
static uint32_t GetTrimForDblrLoopFilterResetVoltage (uint32_t ui32Fcfg1Revision)
 Returns the trim value from FCFG1 to be used as DBLR_LOOP_FILTER_RESET_VOLTAGE setting. More...
 
static uint32_t GetTrimForRadcExtCfg (uint32_t ui32Fcfg1Revision)
 Returns the trim value to be used for the RADCEXTCFG register in OSC_DIG. More...
 
static uint32_t GetTrimForRcOscLfIBiasTrim (uint32_t ui32Fcfg1Revision)
 Returns the FCFG1 OSC_CONF_ATESTLF_RCOSCLF_IBIAS_TRIM. More...
 
static uint32_t GetTrimForRcOscLfRtuneCtuneTrim (void)
 Returns the trim value to be used for the RCOSCLF_RTUNE_TRIM and the RCOSCLF_CTUNE_TRIM bit fields in the XOSCLF_RCOSCLF_CTRL register in OSC_DIG. More...
 
static uint32_t GetTrimForXoscHfCtl (uint32_t ui32Fcfg1Revision)
 Returns the trim value to be used for the XOSCHFCTL register in OSC_DIG. More...
 
static uint32_t GetTrimForXoscHfFastStart (void)
 Returns the trim value to be used as OSC_DIG:CTL1.XOSC_HF_FAST_START. More...
 
static uint32_t GetTrimForXoscHfIbiastherm (void)
 Returns the trim value to be used for the XOSC_HF_IBIASTHERM bit field in the ANABYPASS_VALUE2 register in OSC_DIG. More...
 
static uint32_t GetTrimForXoscLfRegulatorAndCmirrwrRatio (uint32_t ui32Fcfg1Revision)
 Returns XOSCLF_REGULATOR_TRIM and XOSCLF_CMIRRWR_RATIO as one packet spanning bits [5:0] in the returned value. More...
 
int32_t SignExtendVddrTrimValue (uint32_t ui32VddrTrimVal)
 Sign extend the VDDR_TRIM setting (special format ranging from -10 to +21) More...
 
static void HapiTrimDeviceColdReset (void)
 Trims to be applied when coming from PIN_RESET. More...
 
static void HapiTrimDeviceShutDown (uint32_t ui32Fcfg1Revision)
 Trims to be applied when coming from SHUTDOWN (also called when coming from PIN_RESET). More...
 
static void HapiTrimDevicePowerDown (void)
 Trims to be applied when coming from POWER_DOWN (also called when coming from SHUTDOWN and PIN_RESET). More...
 
static void SetupCacheModeAccordingToCcfgSetting (void)
 Set correct VIMS_MODE according to CCFG setting (CACHE or GPRAM) More...
 
void trimDevice (void)
 Performs the necessary trim of the device which is not done in boot code. More...
 
static void SetAonRtcSubSecInc (uint32_t subSecInc)
 Doing the tricky stuff needed to enter new RTCSUBSECINC value. More...
 

Macro Definition Documentation

#define CCFG_MODE_CONF_VDDR_TRIM_SLEEP_DELTA_WIDTH   4

Definition at line 130 of file setup.c.

Referenced by HapiTrimDeviceShutDown().

#define CPU_DELAY_MICRO_SECONDS (   x)    CPUdelay(((uint32_t)((( x ) * 48.0 ) / 5.0 )) - 1 )

Definition at line 121 of file setup.c.

#define DELAY_20_USEC   0x140

Defined time delay assuming 48 MHz clock and resolution of 3 cycles.

Definition at line 109 of file setup.c.

Function Documentation

static uint32_t GetTrimForAdcShModeEn ( uint32_t  ui32Fcfg1Revision)
static

Returns the trim value from FCFG1 to be used as ADC_SH_MODE_EN setting.

Definition at line 1028 of file setup.c.

Referenced by HapiTrimDeviceShutDown().

static uint32_t GetTrimForAdcShVbufEn ( uint32_t  ui32Fcfg1Revision)
static

Returns the trim value from FCFG1 to be used as ADC_SH_VBUF_EN setting.

Definition at line 1047 of file setup.c.

Referenced by HapiTrimDeviceShutDown().

static uint32_t GetTrimForAmpcompCtrl ( uint32_t  ui32Fcfg1Revision)
static

Returns the trim value to be used for the AMPCOMP_CTRL register in OSC_DIG.

Definition at line 931 of file setup.c.

Referenced by HapiTrimDeviceShutDown().

static uint32_t GetTrimForAmpcompTh1 ( void  )
static

Returns the trim value to be used for the AMPCOMP_TH1 register in OSC_DIG.

Definition at line 896 of file setup.c.

Referenced by HapiTrimDeviceShutDown().

static uint32_t GetTrimForAmpcompTh2 ( void  )
static

Returns the trim value to be used for the AMPCOMP_TH2 register in OSC_DIG.

Definition at line 861 of file setup.c.

Referenced by HapiTrimDeviceShutDown().

static uint32_t GetTrimForAnabypassValue1 ( uint32_t  ccfg_ModeConfReg)
static

Returns the trim value to be used for the ANABYPASS_VALUE1 register in OSC_DIG.

Definition at line 743 of file setup.c.

Referenced by HapiTrimDeviceShutDown().

static uint32_t GetTrimForDblrLoopFilterResetVoltage ( uint32_t  ui32Fcfg1Revision)
static

Returns the trim value from FCFG1 to be used as DBLR_LOOP_FILTER_RESET_VOLTAGE setting.

Definition at line 1009 of file setup.c.

Referenced by HapiTrimDeviceShutDown().

static uint32_t GetTrimForRadcExtCfg ( uint32_t  ui32Fcfg1Revision)
static

Returns the trim value to be used for the RADCEXTCFG register in OSC_DIG.

Definition at line 1116 of file setup.c.

Referenced by HapiTrimDeviceShutDown().

static uint32_t GetTrimForRcOscLfIBiasTrim ( uint32_t  ui32Fcfg1Revision)
static

Returns the FCFG1 OSC_CONF_ATESTLF_RCOSCLF_IBIAS_TRIM.

Definition at line 1148 of file setup.c.

Referenced by HapiTrimDeviceShutDown().

static uint32_t GetTrimForRcOscLfRtuneCtuneTrim ( void  )
static

Returns the trim value to be used for the RCOSCLF_RTUNE_TRIM and the RCOSCLF_CTUNE_TRIM bit fields in the XOSCLF_RCOSCLF_CTRL register in OSC_DIG.

Definition at line 813 of file setup.c.

Referenced by HapiTrimDeviceShutDown().

static uint32_t GetTrimForXoscHfCtl ( uint32_t  ui32Fcfg1Revision)
static

Returns the trim value to be used for the XOSCHFCTL register in OSC_DIG.

Definition at line 1066 of file setup.c.

Referenced by HapiTrimDeviceShutDown().

static uint32_t GetTrimForXoscHfFastStart ( void  )
static

Returns the trim value to be used as OSC_DIG:CTL1.XOSC_HF_FAST_START.

Definition at line 1098 of file setup.c.

Referenced by HapiTrimDeviceShutDown().

static uint32_t GetTrimForXoscHfIbiastherm ( void  )
static

Returns the trim value to be used for the XOSC_HF_IBIASTHERM bit field in the ANABYPASS_VALUE2 register in OSC_DIG.

Definition at line 841 of file setup.c.

Referenced by HapiTrimDeviceShutDown().

static uint32_t GetTrimForXoscLfRegulatorAndCmirrwrRatio ( uint32_t  ui32Fcfg1Revision)
static

Returns XOSCLF_REGULATOR_TRIM and XOSCLF_CMIRRWR_RATIO as one packet spanning bits [5:0] in the returned value.

Definition at line 1168 of file setup.c.

Referenced by HapiTrimDeviceShutDown().

static void HapiTrimDeviceColdReset ( void  )
static

Trims to be applied when coming from PIN_RESET.

Returns
None

Definition at line 730 of file setup.c.

Referenced by trimDevice().

static void HapiTrimDevicePowerDown ( void  )
static

Trims to be applied when coming from POWER_DOWN (also called when coming from SHUTDOWN and PIN_RESET).

Returns
None

Definition at line 339 of file setup.c.

Referenced by trimDevice().

static void HapiTrimDeviceShutDown ( uint32_t  ui32Fcfg1Revision)
static

Trims to be applied when coming from SHUTDOWN (also called when coming from PIN_RESET).

Returns
None

Definition at line 381 of file setup.c.

Referenced by trimDevice().

Here is the call graph for this function:

static void SetAonRtcSubSecInc ( uint32_t  subSecInc)
static

Doing the tricky stuff needed to enter new RTCSUBSECINC value.

Returns
None

Definition at line 354 of file setup.c.

Referenced by HapiTrimDeviceShutDown().

static void SetupCacheModeAccordingToCcfgSetting ( void  )
static

Set correct VIMS_MODE according to CCFG setting (CACHE or GPRAM)

Returns
None

Definition at line 141 of file setup.c.

Referenced by trimDevice().

int32_t SignExtendVddrTrimValue ( uint32_t  ui32VddrTrimVal)

Sign extend the VDDR_TRIM setting (special format ranging from -10 to +21)

Returns

Definition at line 709 of file setup.c.

Referenced by HapiTrimDeviceShutDown(), and SysCtrlSetRechargeBeforePowerDown().