CC26xx Driver Library
[setup.h] Setup

Functions

void SetupTrimDevice (void)
 Performs the necessary trim of the device which is not done in boot code. More...
 

Detailed Description

This module contains functions for device setup which is not done in boot code.

Function Documentation

void SetupTrimDevice ( void  )

Performs the necessary trim of the device which is not done in boot code.

This function should only execute coming from ROM boot. The current implementation does not take soft reset into account. However, it does no damage to execute it again. It only consumes time.

Returns
None
113 {
114  uint32_t ui32Fcfg1Revision;
115  uint32_t ui32AonSysResetctl;
116 
117  // Get layout revision of the factory configuration area
118  // (Handle undefined revision as revision = 0)
119  ui32Fcfg1Revision = HWREG(FCFG1_BASE + FCFG1_O_FCFG1_REVISION);
120  if ( ui32Fcfg1Revision == 0xFFFFFFFF ) {
121  ui32Fcfg1Revision = 0;
122  }
123 
124  // This driverlib version and setup file is for the CC13x2, CC26x2 chips.
125  // Halt if violated
127 
128  // Enable standby in flash bank
130 
131  // Select correct CACHE mode and set correct CACHE configuration
132 #if ( CCFG_BASE == CCFG_BASE_DEFAULT )
134 #else
135  NOROM_SetupSetCacheModeAccordingToCcfgSetting();
136 #endif
137 
138  // 1. Check for powerdown
139  // 2. Check for shutdown
140  // 3. Assume cold reset if none of the above.
141  //
142  // It is always assumed that the application will freeze the latches in
143  // AON_IOC when going to powerdown in order to retain the values on the IOs.
144  //
145  // NB. If this bit is not cleared before proceeding to powerdown, the IOs
146  // will all default to the reset configuration when restarting.
147  if( ! ( HWREGBITW( AON_IOC_BASE + AON_IOC_O_IOCLATCH, AON_IOC_IOCLATCH_EN_BITN )))
148  {
149  // NB. This should be calling a ROM implementation of required trim and
150  // compensation
151  // e.g. TrimAfterColdResetWakeupFromShutDownWakeupFromPowerDown()
153  }
154  // Check for shutdown
155  //
156  // When device is going to shutdown the hardware will automatically clear
157  // the SLEEPDIS bit in the SLEEP register in the AON_PMCTL module.
158  // It is left for the application to assert this bit when waking back up,
159  // but not before the desired IO configuration has been re-established.
161  {
162  // NB. This should be calling a ROM implementation of required trim and
163  // compensation
164  // e.g. TrimAfterColdResetWakeupFromShutDown() -->
165  // TrimAfterColdResetWakeupFromShutDownWakeupFromPowerDown();
166  TrimAfterColdResetWakeupFromShutDown(ui32Fcfg1Revision);
168  }
169  else
170  {
171  // Consider adding a check for soft reset to allow debugging to skip
172  // this section!!!
173  //
174  // NB. This should be calling a ROM implementation of required trim and
175  // compensation
176  // e.g. TrimAfterColdReset() -->
177  // TrimAfterColdResetWakeupFromShutDown() -->
178  // TrimAfterColdResetWakeupFromShutDownWakeupFromPowerDown()
180  TrimAfterColdResetWakeupFromShutDown(ui32Fcfg1Revision);
182 
183  }
184 
185  // Set VIMS power domain control.
186  // PDCTL1VIMS = 0 ==> VIMS power domain is only powered when CPU power domain is powered
187  HWREG( PRCM_BASE + PRCM_O_PDCTL1VIMS ) = 0;
188 
189  // Configure optimal wait time for flash FSM in cases where flash pump
190  // wakes up from sleep
191  HWREG(FLASH_BASE + FLASH_O_FPAC1) = (HWREG(FLASH_BASE + FLASH_O_FPAC1) &
193  (0x139<<FLASH_FPAC1_PSLEEPTDIS_S);
194 
195  // And finally at the end of the flash boot process:
196  // SET BOOT_DET bits in AON_PMCTL to 3 if already found to be 1
197  // Note: The BOOT_DET_x_CLR/SET bits must be manually cleared
198  if ((( HWREG( AON_PMCTL_BASE + AON_PMCTL_O_RESETCTL ) &
201  {
202  ui32AonSysResetctl = ( HWREG( AON_PMCTL_BASE + AON_PMCTL_O_RESETCTL ) &
206  HWREG( AON_PMCTL_BASE + AON_PMCTL_O_RESETCTL ) = ui32AonSysResetctl;
207  }
208 
209  // Make sure there are no ongoing VIMS mode change when leaving SetupTrimDevice()
210  // (There should typically be no wait time here, but need to be sure)
211  while ( HWREGBITW( VIMS_BASE + VIMS_O_STAT, VIMS_STAT_MODE_CHANGING_BITN )) {
212  // Do nothing - wait for an eventual ongoing mode change to complete.
213  }
214 }
static void TrimAfterColdResetWakeupFromShutDownWakeupFromPowerDown(void)
Trims to be applied when coming from POWER_DOWN (also called when coming from SHUTDOWN and PIN_RESET)...
Definition: setup.c:225
void ThisLibraryIsFor_CC13x2_CC26x2_HaltIfViolated(void)
Verifies that current chip is CC13x2 or CC26x2 and never returns if violated.
Definition: chipinfo.c:196
static void TrimAfterColdResetWakeupFromShutDown(uint32_t ui32Fcfg1Revision)
Trims to be applied when coming from SHUTDOWN (also called when coming from PIN_RESET).
Definition: setup.c:293
void SetupSetCacheModeAccordingToCcfgSetting(void)
Set correct VIMS_MODE according to CCFG setting (CACHE or GPRAM)
Definition: setup_rom.c:884
static void TrimAfterColdReset(void)
Trims to be applied when coming from PIN_RESET.
Definition: setup.c:467

Here is the call graph for this function: