CC26xx Driver Library
[prcm.h] Power Reset Clock Manager

Functions

void PRCMInfClockConfigureSet (uint32_t ui32ClkDiv, uint32_t ui32PowerMode)
 Configure the infrastructure clock. More...
 
uint32_t PRCMInfClockConfigureGet (uint32_t ui32PowerMode)
 Use this function to get the infrastructure clock configuration. More...
 
static void PRCMMcuUldoConfigure (uint32_t ui32Enable)
 Assert or de-assert a request for the uLDO. More...
 
static void PRCMGPTimerClockDivisionSet (uint32_t clkDiv)
 Setup the clock division factor for the GP-Timer domain. More...
 
static uint32_t PRCMGPTimerClockDivisionGet (void)
 Get the clock division factor for the GP-Timer domain. More...
 
static void PRCMAudioClockEnable (void)
 Enable the audio clock generation. More...
 
static void PRCMAudioClockDisable (void)
 Disable the audio clock generation. More...
 
void PRCMAudioClockConfigSet (uint32_t ui32ClkConfig, uint32_t ui32SampleRate)
 Configure the audio clock generation. More...
 
void PRCMAudioClockConfigSetOverride (uint32_t ui32ClkConfig, uint32_t ui32MstDiv, uint32_t ui32BitDiv, uint32_t ui32WordDiv)
 Configure the audio clock generation with manual setting of clock divider. More...
 
static void PRCMLoadSet (void)
 Use this function to synchronize the load settings. More...
 
static bool PRCMLoadGet (void)
 Check if any of the load sensitive register has been updated. More...
 
static void PRCMDomainEnable (uint32_t ui32Domains)
 Enable clock domains in the MCU voltage domain. More...
 
static void PRCMDomainDisable (uint32_t ui32Domains)
 Disable clock domains in the MCU voltage domain. More...
 
void PRCMPowerDomainOn (uint32_t ui32Domains)
 Turn power on in power domains in the MCU domain. More...
 
void PRCMPowerDomainOff (uint32_t ui32Domains)
 Turn off a specific power domain. More...
 
static void PRCMRfPowerDownWhenIdle (void)
 Configure RF core to power down when idle. More...
 
void PRCMPeripheralRunEnable (uint32_t ui32Peripheral)
 Enables a peripheral in Run mode. More...
 
void PRCMPeripheralRunDisable (uint32_t ui32Peripheral)
 Disables a peripheral in Run mode. More...
 
void PRCMPeripheralSleepEnable (uint32_t ui32Peripheral)
 Enables a peripheral in sleep mode. More...
 
void PRCMPeripheralSleepDisable (uint32_t ui32Peripheral)
 Disables a peripheral in sleep mode. More...
 
void PRCMPeripheralDeepSleepEnable (uint32_t ui32Peripheral)
 Enables a peripheral in deep-sleep mode. More...
 
void PRCMPeripheralDeepSleepDisable (uint32_t ui32Peripheral)
 Disables a peripheral in deep-sleep mode. More...
 
uint32_t PRCMPowerDomainStatus (uint32_t ui32Domains)
 Get the status for a specific power domain. More...
 
static bool PRCMRfReady (void)
 Return the access status of the RF Core. More...
 
static void PRCMSleep (void)
 Put the processor into sleep mode. More...
 
void PRCMDeepSleep (void)
 Put the processor into deep-sleep mode. More...
 
static void PRCMCacheRetentionEnable (void)
 Enable CACHE RAM retention. More...
 
static void PRCMCacheRetentionDisable (void)
 Disable CACHE RAM retention. More...
 

Detailed Description

Function Documentation

void PRCMAudioClockConfigSet ( uint32_t  ui32ClkConfig,
uint32_t  ui32SampleRate 
)

Configure the audio clock generation.

Use this function to set the sample rate when using internal audio clock generation for the I2S module.

Note
While other clocks are possible, the stability of the four sample rates defined here are only guaranteed if the clock input to the I2S module is 48MHz.
Parameters
ui32ClkConfigis the audio clock configuration. The parameter is a bitwise OR'ed value consisting of:
ui32SampleRateis the desired audio clock sample rate. The supported sample rate configurations are:
Returns
None
See also
PRCMAudioClockConfigSetOverride()
255 {
256  uint32_t ui32Reg;
257  uint32_t ui32MstDiv;
258  uint32_t ui32BitDiv;
259  uint32_t ui32WordDiv;
260 
261  // Check the arguments.
263  ASSERT((ui32SampleRate == I2S_SAMPLE_RATE_16K) ||
264  (ui32SampleRate == I2S_SAMPLE_RATE_24K) ||
265  (ui32SampleRate == I2S_SAMPLE_RATE_32K) ||
266  (ui32SampleRate == I2S_SAMPLE_RATE_48K));
267 
268  ui32MstDiv = 0;
269  ui32BitDiv = 0;
270  ui32WordDiv = 0;
271 
272  // Make sure the audio clock generation is disabled before reconfiguring.
274 
275  // Define the clock division factors for the audio interface.
276  switch(ui32SampleRate)
277  {
278  case I2S_SAMPLE_RATE_16K :
279  ui32MstDiv = 6;
280  ui32BitDiv = 60;
281  ui32WordDiv = 25;
282  break;
283  case I2S_SAMPLE_RATE_24K :
284  ui32MstDiv = 4;
285  ui32BitDiv = 40;
286  ui32WordDiv = 25;
287  break;
288  case I2S_SAMPLE_RATE_32K :
289  ui32MstDiv = 3;
290  ui32BitDiv = 30;
291  ui32WordDiv = 25;
292  break;
293  case I2S_SAMPLE_RATE_48K :
294  ui32MstDiv = 2;
295  ui32BitDiv = 20;
296  ui32WordDiv = 25;
297  break;
298  }
299 
300  // Make sure to compensate the Frame clock division factor if using single
301  // phase format.
302  if((ui32ClkConfig & PRCM_I2SCLKCTL_WCLK_PHASE_M) == PRCM_WCLK_SINGLE_PHASE)
303  {
304  ui32WordDiv -= 1;
305  }
306 
307  // Write the clock division factors.
308  HWREG(PRCM_BASE + PRCM_O_I2SMCLKDIV) = ui32MstDiv;
309  HWREG(PRCM_BASE + PRCM_O_I2SBCLKDIV) = ui32BitDiv;
310  HWREG(PRCM_BASE + PRCM_O_I2SWCLKDIV) = ui32WordDiv;
311 
312  // Configure the Word clock format and polarity.
315  HWREG(PRCM_BASE + PRCM_O_I2SCLKCTL) = ui32Reg | ui32ClkConfig;
316 }
#define I2S_SAMPLE_RATE_48K
Definition: prcm.h:176
#define I2S_SAMPLE_RATE_16K
Definition: prcm.h:173
#define I2S_SAMPLE_RATE_24K
Definition: prcm.h:174
#define PRCM_WCLK_SINGLE_PHASE
Definition: prcm.h:169
#define I2S_SAMPLE_RATE_32K
Definition: prcm.h:175
#define ASSERT(expr)
Definition: debug.h:73
static void PRCMAudioClockDisable(void)
Disable the audio clock generation.
Definition: prcm.h:421

Here is the call graph for this function:

void PRCMAudioClockConfigSetOverride ( uint32_t  ui32ClkConfig,
uint32_t  ui32MstDiv,
uint32_t  ui32BitDiv,
uint32_t  ui32WordDiv 
)

Configure the audio clock generation with manual setting of clock divider.

Use this function to set the audio clock divider values manually.

Note
See hardware documentation before setting audio clock dividers manually.
Parameters
ui32ClkConfigis the audio clock configuration. The parameter is a bitwise OR'ed value consisting of:
ui32MstDivis the desired master clock divider.
ui32WordDivis the desired word clock divider.
ui32BitDivis the desired bit clock divider.
Returns
None
See also
PRCMAudioClockConfigSet()
326 {
327  uint32_t ui32Reg;
328 
329  // Check the arguments.
331 
332  // Make sure the audio clock generation is disabled before reconfiguring.
334 
335  // Make sure to compensate the Frame clock division factor if using single
336  // phase format.
337  if((ui32ClkConfig & PRCM_I2SCLKCTL_WCLK_PHASE_M) == PRCM_WCLK_SINGLE_PHASE)
338  {
339  ui32WordDiv -= 1;
340  }
341 
342  // Write the clock division factors.
343  HWREG(PRCM_BASE + PRCM_O_I2SMCLKDIV) = ui32MstDiv;
344  HWREG(PRCM_BASE + PRCM_O_I2SBCLKDIV) = ui32BitDiv;
345  HWREG(PRCM_BASE + PRCM_O_I2SWCLKDIV) = ui32WordDiv;
346 
347  // Configure the Word clock format and polarity.
350  HWREG(PRCM_BASE + PRCM_O_I2SCLKCTL) = ui32Reg | ui32ClkConfig;
351 }
#define PRCM_WCLK_SINGLE_PHASE
Definition: prcm.h:169
#define ASSERT(expr)
Definition: debug.h:73
static void PRCMAudioClockDisable(void)
Disable the audio clock generation.
Definition: prcm.h:421

Here is the call graph for this function:

static void PRCMAudioClockDisable ( void  )
inlinestatic

Disable the audio clock generation.

Use this function to disable the audio clock generation.

Returns
None

Referenced by PRCMAudioClockConfigSet(), and PRCMAudioClockConfigSetOverride().

422 {
423  // Disable the audio clock generation
425 }
static void PRCMAudioClockEnable ( void  )
inlinestatic

Enable the audio clock generation.

Use this function to enable the audio clock generation.

Returns
None
406 {
407  // Enable the audio clock generation.
409 }
static void PRCMCacheRetentionDisable ( void  )
inlinestatic

Disable CACHE RAM retention.

Disables CACHE RAM retention on both VIMS_TRAM and VIMS_CRAM

Returns
None

Referenced by SysCtrlStandby().

1068 {
1070 }
static void PRCMCacheRetentionEnable ( void  )
inlinestatic

Enable CACHE RAM retention.

Enables CACHE RAM retention on both VIMS_TRAM and VIMS_CRAM

Returns
None

Referenced by SysCtrlIdle().

1053 {
1055 }
void PRCMDeepSleep ( void  )

Put the processor into deep-sleep mode.

This function places the processor into deep-sleep mode; it does not return until the processor returns to run mode. The peripherals that are enabled via PRCMPeripheralDeepSleepEnable() continue to operate and can wake up the processor.

Returns
None
See also
PRCMPeripheralDeepSleepEnable()

Referenced by SysCtrlIdle(), and SysCtrlStandby().

576 {
577  // Enable deep-sleep.
578  HWREG(NVIC_SYS_CTRL) |= NVIC_SYS_CTRL_SLEEPDEEP;
579 
580  // Wait for an interrupt.
581  CPUwfi();
582 
583  // Disable deep-sleep so that a future sleep will work correctly.
584  HWREG(NVIC_SYS_CTRL) &= ~(NVIC_SYS_CTRL_SLEEPDEEP);
585 }
static void CPUwfi(void)
Wait for interrupt.
Definition: cpu.h:193

Here is the call graph for this function:

static void PRCMDomainDisable ( uint32_t  ui32Domains)
inlinestatic

Disable clock domains in the MCU voltage domain.

Note
A call to this function will only setup the shadow registers in the MCU domain for the PRCM module. For the changes to propagate to the system controller in the AON domain a call to this function should always be followed by a call to PRCMLoadSet().
Clocks will only be running if the domain is powered.
Parameters
ui32Domainsis a bit mask containing the clock domains to disable. The independent clock domains inside the MCU voltage domain are:
Returns
None
See also
PRCMDomainEnable()
603 {
604  // Check the arguments.
605  ASSERT((ui32Domains & PRCM_DOMAIN_RFCORE) ||
606  (ui32Domains & PRCM_DOMAIN_VIMS));
607 
608  // Disable the power domains.
609  if(ui32Domains & PRCM_DOMAIN_RFCORE)
610  {
611  HWREG(PRCM_BASE + PRCM_O_RFCCLKG) = 0x0;
612  }
613  if(ui32Domains & PRCM_DOMAIN_VIMS)
614  {
615  HWREG(PRCM_BASE + PRCM_O_VIMSCLKG) = 0x0;
616  }
617 }
#define PRCM_DOMAIN_VIMS
Definition: prcm.h:142
#define ASSERT(expr)
Definition: debug.h:73
#define PRCM_DOMAIN_RFCORE
Definition: prcm.h:134
static void PRCMDomainEnable ( uint32_t  ui32Domains)
inlinestatic

Enable clock domains in the MCU voltage domain.

Note
A call to this function will only setup the shadow registers in the MCU domain for the PRCM module. For the changes to propagate to the system controller in the AON domain a call to this function should always be followed by a call to PRCMLoadSet().
Clocks will only be running if the domain is powered.
Parameters
ui32Domainsis a bit mask containing the clock domains to enable. The independent clock domains inside the MCU voltage domain which can be configured are:
Returns
None
564 {
565  // Check the arguments.
566  ASSERT((ui32Domains & PRCM_DOMAIN_RFCORE) ||
567  (ui32Domains & PRCM_DOMAIN_VIMS));
568 
569  // Enable the clock domain(s).
570  if(ui32Domains & PRCM_DOMAIN_RFCORE)
571  {
573  }
574  if(ui32Domains & PRCM_DOMAIN_VIMS)
575  {
577  }
578 }
#define PRCM_DOMAIN_VIMS
Definition: prcm.h:142
#define ASSERT(expr)
Definition: debug.h:73
#define PRCM_DOMAIN_RFCORE
Definition: prcm.h:134
static uint32_t PRCMGPTimerClockDivisionGet ( void  )
inlinestatic

Get the clock division factor for the GP-Timer domain.

Use this function to get the clock division factor set for the GP-Timer.

Returns
Returns one of the following values:
See also
PRCMGPTimerClockDivisionSet()
390 {
391  return ( HWREG( PRCM_BASE + PRCM_O_GPTCLKDIV ));
392 }
static void PRCMGPTimerClockDivisionSet ( uint32_t  clkDiv)
inlinestatic

Setup the clock division factor for the GP-Timer domain.

Use this function to set up the clock division factor on the GP-Timer.

The division rate will be constant and ungated for Run / Sleep / DeepSleep mode when it is slower than PRCM_GPTCLKDIV_RATIO setting. When set faster than PRCM_GPTCLKDIV_RATIO setting PRCM_GPTCLKDIV_RATIO will be used. Note that the register will contain the written content even though the setting is faster than PRCM_GPTCLKDIV_RATIO setting.

Note
For change to take effect, PRCMLoadSet() needs to be called
Parameters
clkDivis the division factor to set. The argument must be only one of the following values:
Returns
None
See also
PRCMGPTimerClockDivisionGet()
362 {
363  ASSERT( clkDiv <= PRCM_GPTCLKDIV_RATIO_DIV256 );
364 
365  HWREG( PRCM_BASE + PRCM_O_GPTCLKDIV ) = clkDiv;
366 }
#define ASSERT(expr)
Definition: debug.h:73
uint32_t PRCMInfClockConfigureGet ( uint32_t  ui32PowerMode)

Use this function to get the infrastructure clock configuration.

Parameters
ui32PowerModedetermines which System CPU power mode to return the infrastructure clock division ratio for. The three allowed power modes are:
Returns
Returns the infrastructure clock division factor for the specified power mode.
See also
PRCMInfClockConfigureSet().
199 {
200  uint32_t ui32ClkDiv;
201  uint32_t ui32Divisor;
202 
203  // Check the arguments.
204  ASSERT((ui32PowerMode == PRCM_RUN_MODE) ||
205  (ui32PowerMode == PRCM_SLEEP_MODE) ||
206  (ui32PowerMode == PRCM_DEEP_SLEEP_MODE));
207 
208  ui32ClkDiv = 0;
209  ui32Divisor = 0;
210 
211  // Determine the correct power mode.
212  if(ui32PowerMode == PRCM_RUN_MODE)
213  {
214  ui32ClkDiv = HWREG(PRCM_BASE + PRCM_O_INFRCLKDIVR);
215  }
216  else if(ui32PowerMode == PRCM_SLEEP_MODE)
217  {
218  ui32ClkDiv = HWREG(PRCM_BASE + PRCM_O_INFRCLKDIVS);
219  }
220  else if(ui32PowerMode == PRCM_DEEP_SLEEP_MODE)
221  {
222  ui32ClkDiv = HWREG(PRCM_BASE + PRCM_O_INFRCLKDIVDS);
223  }
224 
225  // Find the correct division factor.
226  if(ui32ClkDiv == 0x0)
227  {
228  ui32Divisor = PRCM_CLOCK_DIV_1;
229  }
230  else if(ui32ClkDiv == 0x1)
231  {
232  ui32Divisor = PRCM_CLOCK_DIV_2;
233  }
234  else if(ui32ClkDiv == 0x2)
235  {
236  ui32Divisor = PRCM_CLOCK_DIV_8;
237  }
238  else if(ui32ClkDiv == 0x3)
239  {
240  ui32Divisor = PRCM_CLOCK_DIV_32;
241  }
242 
243  // Return the clock division factor.
244  return ui32Divisor;
245 }
#define PRCM_DEEP_SLEEP_MODE
Definition: prcm.h:111
#define PRCM_CLOCK_DIV_8
Definition: prcm.h:121
#define PRCM_CLOCK_DIV_32
Definition: prcm.h:123
#define ASSERT(expr)
Definition: debug.h:73
#define PRCM_SLEEP_MODE
Definition: prcm.h:110
#define PRCM_CLOCK_DIV_1
Definition: prcm.h:118
#define PRCM_CLOCK_DIV_2
Definition: prcm.h:119
#define PRCM_RUN_MODE
Definition: prcm.h:109
void PRCMInfClockConfigureSet ( uint32_t  ui32ClkDiv,
uint32_t  ui32PowerMode 
)

Configure the infrastructure clock.

Each System CPU power mode has its own infrastructure clock division factor. This function can be used for setting up the division factor for the infrastructure clock in the available power modes for the System CPU. The infrastructure clock is used for all internal logic in the PRCM, and is always running as long as power is on in the MCU voltage domain. This can be enabled and disabled from the AON Wake Up Controller.

Note
If source clock is 48 MHz, minimum clock divider is PRCM_CLOCK_DIV_2.
Parameters
ui32ClkDivdetermines the division ratio for the infrastructure clock when the device is in the specified mode. Allowed division factors for all three System CPU power modes are:
ui32PowerModedetermines the System CPU operation mode for which to modify the clock division factor. The three allowed power modes are:
Returns
None
145 {
146  uint32_t ui32Divisor;
147 
148  // Check the arguments.
149  ASSERT((ui32ClkDiv == PRCM_CLOCK_DIV_1) ||
150  (ui32ClkDiv == PRCM_CLOCK_DIV_2) ||
151  (ui32ClkDiv == PRCM_CLOCK_DIV_8) ||
152  (ui32ClkDiv == PRCM_CLOCK_DIV_32));
153  ASSERT((ui32PowerMode == PRCM_RUN_MODE) ||
154  (ui32PowerMode == PRCM_SLEEP_MODE) ||
155  (ui32PowerMode == PRCM_DEEP_SLEEP_MODE));
156 
157  ui32Divisor = 0;
158 
159  // Find the correct division factor.
160  if(ui32ClkDiv == PRCM_CLOCK_DIV_1)
161  {
162  ui32Divisor = 0x0;
163  }
164  else if(ui32ClkDiv == PRCM_CLOCK_DIV_2)
165  {
166  ui32Divisor = 0x1;
167  }
168  else if(ui32ClkDiv == PRCM_CLOCK_DIV_8)
169  {
170  ui32Divisor = 0x2;
171  }
172  else if(ui32ClkDiv == PRCM_CLOCK_DIV_32)
173  {
174  ui32Divisor = 0x3;
175  }
176 
177  // Determine the correct power mode set the division factor accordingly.
178  if(ui32PowerMode == PRCM_RUN_MODE)
179  {
180  HWREG(PRCM_BASE + PRCM_O_INFRCLKDIVR) = ui32Divisor;
181  }
182  else if(ui32PowerMode == PRCM_SLEEP_MODE)
183  {
184  HWREG(PRCM_BASE + PRCM_O_INFRCLKDIVS) = ui32Divisor;
185  }
186  else if(ui32PowerMode == PRCM_DEEP_SLEEP_MODE)
187  {
188  HWREG(PRCM_BASE + PRCM_O_INFRCLKDIVDS) = ui32Divisor;
189  }
190 }
#define PRCM_DEEP_SLEEP_MODE
Definition: prcm.h:111
#define PRCM_CLOCK_DIV_8
Definition: prcm.h:121
#define PRCM_CLOCK_DIV_32
Definition: prcm.h:123
#define ASSERT(expr)
Definition: debug.h:73
#define PRCM_SLEEP_MODE
Definition: prcm.h:110
#define PRCM_CLOCK_DIV_1
Definition: prcm.h:118
#define PRCM_CLOCK_DIV_2
Definition: prcm.h:119
#define PRCM_RUN_MODE
Definition: prcm.h:109
static bool PRCMLoadGet ( void  )
inlinestatic

Check if any of the load sensitive register has been updated.

Returns
Returns status of the load sensitive register:
  • true : No registers have changed since the last load.
  • false : Any register has changed.
See also
PRCMLoadSet()

Referenced by SysCtrlStandby().

536 {
537  // Return the load status.
539  true : false);
540 }
static void PRCMLoadSet ( void  )
inlinestatic

Use this function to synchronize the load settings.

Most of the clock settings in the PRCM module should be updated synchronously. This is ensured by the implementation of a load registers that, when written to, will let the previous written update values for all the relevant registers propagate through to hardware.

The functions that require a synchronization of the clock settings are:

Returns
None
See also
PRCMLoadGet()

Referenced by SysCtrlStandby().

518 {
519  // Enable the update of all load related registers.
520  HWREG(PRCM_NONBUF_BASE + PRCM_O_CLKLOADCTL) = PRCM_CLKLOADCTL_LOAD;
521 }
static void PRCMMcuUldoConfigure ( uint32_t  ui32Enable)
inlinestatic

Assert or de-assert a request for the uLDO.

Use this function to request to switch to the micro Low Voltage Dropout regulator (uLDO). The uLDO has a much lower capacity for supplying power to the system. It is therefore imperative and solely the programmers responsibility to ensure that a sufficient amount of peripheral modules have been turned of before requesting a switch to the uLDO.

Note
Asserting this bit has no effect until:
  1. FLASH has accepted to be powered down
  2. Deepsleep must be asserted
Parameters
ui32Enable
  • 0 : Disable uLDO request
  • 1 : Enable uLDO request
Returns
None
See also
PRCMDeepSleep()

Referenced by PowerCtrlSourceSet(), and SysCtrlStandby().

324 {
325  // Enable or disable the uLDO request signal.
326  HWREGBITW(PRCM_BASE + PRCM_O_VDCTL, PRCM_VDCTL_ULDO_BITN) = ui32Enable;
327 }
void PRCMPeripheralDeepSleepDisable ( uint32_t  ui32Peripheral)

Disables a peripheral in deep-sleep mode.

This function causes a peripheral to stop operating when the processor goes into deep-sleep mode. Disabling peripherals while in deep-sleep mode helps to lower the current draw of the device, and can keep peripherals that require a particular clock frequency from operating when the clock changes as a result of entering deep-sleep mode. If enabled (via PRCMPeripheralRunEnable()), the peripheral will automatically resume operation when the processor leaves deep-sleep mode, maintaining its entire state from before deep-sleep mode was entered.

Note
A call to this function will only setup the shadow registers in the MCU domain for the PRCM module. For the changes to propagate to the system controller in the AON domain a call to this function should always be followed by a call to PRCMLoadSet().
Parameters
ui32Peripheralis the peripheral to disable in deep-sleep mode. The parameter must be one of the following:
Returns
None
See also
PRCMLoadSet()

Referenced by SysCtrlStandby().

519 {
520  // Check the arguments.
521  ASSERT(PRCMPeripheralValid(ui32Peripheral));
522 
523  // Disable this peripheral in Deep Sleep mode.
524  HWREG(PRCM_BASE + g_pui32DCGCRegs[PRCM_PERIPH_INDEX(ui32Peripheral)]) &=
525  ~PRCM_PERIPH_MASKBIT(ui32Peripheral);
526 }
static const uint32_t g_pui32DCGCRegs[]
Definition: prcm.c:112
#define PRCM_PERIPH_MASKBIT(a)
Definition: prcm.c:135
#define ASSERT(expr)
Definition: debug.h:73
#define PRCM_PERIPH_INDEX(a)
Definition: prcm.c:128
void PRCMPeripheralDeepSleepEnable ( uint32_t  ui32Peripheral)

Enables a peripheral in deep-sleep mode.

This function allows a peripheral to continue operating when the processor goes into deep-sleep mode. Since the clocking configuration of the device may change, not all peripherals can safely continue operating while the processor is in sleep mode. This in turn depends on the chosen power mode. It is the responsibility of the caller to make sensible choices.

Note
A call to this function will only setup the shadow registers in the MCU domain for the PRCM module. For the changes to propagate to the system controller in the AON domain a call to this function should always be followed by a call to PRCMLoadSet().
Parameters
ui32Peripheralis the peripheral to enable in deep-sleep mode. The parameter must be one of the following:
Returns
None
See also
PRCMLoadSet()
503 {
504  // Check the arguments.
505  ASSERT(PRCMPeripheralValid(ui32Peripheral));
506 
507  // Enable this peripheral in deep-sleep mode.
508  HWREG(PRCM_BASE + g_pui32DCGCRegs[PRCM_PERIPH_INDEX(ui32Peripheral)]) |=
509  PRCM_PERIPH_MASKBIT(ui32Peripheral);
510 }
static const uint32_t g_pui32DCGCRegs[]
Definition: prcm.c:112
#define PRCM_PERIPH_MASKBIT(a)
Definition: prcm.c:135
#define ASSERT(expr)
Definition: debug.h:73
#define PRCM_PERIPH_INDEX(a)
Definition: prcm.c:128
void PRCMPeripheralRunDisable ( uint32_t  ui32Peripheral)

Disables a peripheral in Run mode.

Peripherals are disabled with this function. Once disabled, they will not operate or respond to register reads/writes.

Note
A call to this function will only setup the shadow registers in the MCU domain for the PRCM module. For the changes to propagate to the system controller in the AON domain a call to this function should always be followed by a call to PRCMLoadSet().
The actual disabling of the peripheral may be delayed until some time after this function returns. Care should be taken by the user to ensure that the peripheral is not accessed in this interval as this might cause the system to hang.
Parameters
ui32Peripheralis the peripheral to disable. The parameter must be one of the following:
Returns
None
See also
PRCMLoadSet()
455 {
456  // Check the arguments.
457  ASSERT(PRCMPeripheralValid(ui32Peripheral));
458 
459  // Disable module in Run Mode.
460  HWREG(PRCM_BASE + g_pui32RCGCRegs[PRCM_PERIPH_INDEX(ui32Peripheral)]) &=
461  ~PRCM_PERIPH_MASKBIT(ui32Peripheral);
462 }
static const uint32_t g_pui32RCGCRegs[]
Definition: prcm.c:88
#define PRCM_PERIPH_MASKBIT(a)
Definition: prcm.c:135
#define ASSERT(expr)
Definition: debug.h:73
#define PRCM_PERIPH_INDEX(a)
Definition: prcm.c:128
void PRCMPeripheralRunEnable ( uint32_t  ui32Peripheral)

Enables a peripheral in Run mode.

Peripherals are enabled with this function. At power-up, some peripherals are disabled; they must be enabled in order to operate or respond to register reads/writes.

Note
The actual enabling of the peripheral may be delayed until some time after this function returns. Care should be taken to ensure that the peripheral is not accessed until it is enabled. When enabling Timers always make sure that the division factor for the PERBUSCPUCLK is set. This will guarantee that the timers run at a continuous rate even if the SYSBUSCLK is gated.
A call to this function will only setup the shadow registers in the MCU domain for the PRCM module. For the changes to propagate to the system controller in the AON domain a call to this function should always be followed by a call to PRCMLoadSet().
Parameters
ui32Peripheralis the peripheral to enable. The parameter must be one of the following:
Returns
None
See also
PRCMLoadSet()
439 {
440  // Check the arguments.
441  ASSERT(PRCMPeripheralValid(ui32Peripheral));
442 
443  // Enable module in Run Mode.
444  HWREG(PRCM_BASE + g_pui32RCGCRegs[PRCM_PERIPH_INDEX(ui32Peripheral)]) |=
445  PRCM_PERIPH_MASKBIT(ui32Peripheral);
446 }
static const uint32_t g_pui32RCGCRegs[]
Definition: prcm.c:88
#define PRCM_PERIPH_MASKBIT(a)
Definition: prcm.c:135
#define ASSERT(expr)
Definition: debug.h:73
#define PRCM_PERIPH_INDEX(a)
Definition: prcm.c:128
void PRCMPeripheralSleepDisable ( uint32_t  ui32Peripheral)

Disables a peripheral in sleep mode.

This function causes a peripheral to stop operating when the processor goes into sleep mode. Disabling peripherals while in sleep mode helps to lower the current draw of the device. If enabled (via PRCMPeripheralRunEnable()), the peripheral will automatically resume operation when the processor leaves sleep mode, maintaining its entire state from before sleep mode was entered.

Note
A call to this function will only setup the shadow registers in the MCU domain for the PRCM module. For the changes to propagate to the system controller in the AON domain a call to this function should always be followed by a call to PRCMLoadSet().
Parameters
ui32Peripheralis the peripheral to disable in sleep mode. The parameter must be one of the following:
Returns
None
See also
PRCMLoadSet()
487 {
488  // Check the arguments.
489  ASSERT(PRCMPeripheralValid(ui32Peripheral));
490 
491  // Disable this peripheral in sleep mode
492  HWREG(PRCM_BASE + g_pui32SCGCRegs[PRCM_PERIPH_INDEX(ui32Peripheral)]) &=
493  ~PRCM_PERIPH_MASKBIT(ui32Peripheral);
494 }
#define PRCM_PERIPH_MASKBIT(a)
Definition: prcm.c:135
static const uint32_t g_pui32SCGCRegs[]
Definition: prcm.c:100
#define ASSERT(expr)
Definition: debug.h:73
#define PRCM_PERIPH_INDEX(a)
Definition: prcm.c:128
void PRCMPeripheralSleepEnable ( uint32_t  ui32Peripheral)

Enables a peripheral in sleep mode.

This function allows a peripheral to continue operating when the processor goes into sleep mode. Since the clocking configuration of the device does not change, any peripheral can safely continue operating while the processor is in sleep mode, and can therefore wake the processor from sleep mode.

Note
A call to this function will only setup the shadow registers in the MCU domain for the PRCM module. For the changes to propagate to the system controller in the AON domain a call to this function should always be followed by a call to PRCMLoadSet().
Parameters
ui32Peripheralis the peripheral to enable in sleep mode. The parameter must be one of the following:
Returns
None
See also
PRCMLoadSet()
471 {
472  // Check the arguments.
473  ASSERT(PRCMPeripheralValid(ui32Peripheral));
474 
475  // Enable this peripheral in sleep mode.
476  HWREG(PRCM_BASE + g_pui32SCGCRegs[PRCM_PERIPH_INDEX(ui32Peripheral)]) |=
477  PRCM_PERIPH_MASKBIT(ui32Peripheral);
478 }
#define PRCM_PERIPH_MASKBIT(a)
Definition: prcm.c:135
static const uint32_t g_pui32SCGCRegs[]
Definition: prcm.c:100
#define ASSERT(expr)
Definition: debug.h:73
#define PRCM_PERIPH_INDEX(a)
Definition: prcm.c:128
void PRCMPowerDomainOff ( uint32_t  ui32Domains)

Turn off a specific power domain.

Use this function to power down domains inside the MCU voltage domain.

Note
For specifics regarding on/off configuration please see PRCMPowerDomainOn().
Parameters
ui32Domainsdetermines which domain to request a power down for. The domains that can be turned on/off are:
  • PRCM_DOMAIN_RFCORE : RF Core
  • PRCM_DOMAIN_SERIAL : SSI0, UART0, I2C0
  • PRCM_DOMAIN_PERIPH : GPT0, GPT1, GPT2, GPT3, GPIO, SSI1, I2S, DMA, UART1
  • PRCM_DOMAIN_VIMS : SRAM, FLASH, ROM
  • PRCM_DOMAIN_VIMS_OFF_NO_WAKEUP : SRAM, FLASH, ROM
  • PRCM_DOMAIN_SYSBUS
  • PRCM_DOMAIN_CPU
Returns
None

Referenced by SysCtrlIdle(), and SysCtrlStandby().

398 {
399  // Check the arguments.
400  ASSERT((ui32Domains & PRCM_DOMAIN_RFCORE) ||
401  (ui32Domains & PRCM_DOMAIN_SERIAL) ||
402  (ui32Domains & PRCM_DOMAIN_PERIPH) ||
403  (ui32Domains & PRCM_DOMAIN_CPU) ||
404  (ui32Domains & PRCM_DOMAIN_VIMS));
405 
406  // Assert the request to power off the right domains.
407  if(ui32Domains & PRCM_DOMAIN_RFCORE)
408  {
409  HWREG(PRCM_BASE + PRCM_O_PDCTL0RFC ) = 0;
410  }
411  if(ui32Domains & PRCM_DOMAIN_SERIAL)
412  {
413  HWREG(PRCM_BASE + PRCM_O_PDCTL0SERIAL) = 0;
414  }
415  if(ui32Domains & PRCM_DOMAIN_PERIPH)
416  {
417  HWREG(PRCM_BASE + PRCM_O_PDCTL0PERIPH) = 0;
418  }
419  if(ui32Domains & PRCM_DOMAIN_VIMS)
420  {
421  // Write bits ui32Domains[17:16] to the VIMS_MODE alias register.
422  // PRCM_DOMAIN_VIMS sets VIMS_MODE=0b00, PRCM_DOMAIN_VIMS_OFF_NO_WAKEUP sets VIMS_MODE=0b10.
423  ASSERT(!(ui32Domains & 0x00010000));
424  HWREG(PRCM_BASE + PRCM_O_PDCTL1VIMS ) = ( ui32Domains >> 16 ) & 3;
425  }
426  if(ui32Domains & PRCM_DOMAIN_CPU)
427  {
428  HWREG(PRCM_BASE + PRCM_O_PDCTL1CPU ) = 0;
429  }
430 }
#define PRCM_DOMAIN_VIMS
Definition: prcm.h:142
#define PRCM_DOMAIN_PERIPH
Definition: prcm.h:138
#define ASSERT(expr)
Definition: debug.h:73
#define PRCM_DOMAIN_SERIAL
Definition: prcm.h:136
#define PRCM_DOMAIN_RFCORE
Definition: prcm.h:134
#define PRCM_DOMAIN_CPU
Definition: prcm.h:148
void PRCMPowerDomainOn ( uint32_t  ui32Domains)

Turn power on in power domains in the MCU domain.

Use this function to turn on power domains inside the MCU voltage domain.

Power on and power off request has different implications for the different power domains.

  • RF Core power domain:
    • Power On : Domain is on or in the process of turning on.
    • Power Off : Domain is powered down when System CPU is in deep sleep. The third option for the RF Core is to power down when the it is idle. This can be set using PRCMRfPowerDownWhenIdle()
  • SERIAL power domain:
    • Power on : Domain is powered on.
    • Power off : Domain is powered off.
  • PERIPHERIAL power domain:
    • Power on : Domain is powered on.
    • Power off : Domain is powered off.
  • VIMS power domain:
    • Power On : Domain is powered if Bus domain is powered.
    • Power Off : Domain is only powered when CPU domain is on.
  • BUS power domain:
    • Power On : Domain is on.
    • Power Off : Domain is on if requested by RF Core or if CPU domain is on.
  • CPU power domain:
    • Power On : Domain is on.
    • Power Off : Domain is powering down if System CPU is idle. This will also initiate a power down of the SRAM and BUS power domains, unless RF Core is requesting them to be on.
Note
After a call to this function the status of the power domain should be checked using either PRCMPowerDomainStatus(). Any write operation to a power domain which is still not operational can result in unexpected behavior.
Parameters
ui32Domainsdetermines which power domains to turn on. The domains that can be turned on/off are:
  • PRCM_DOMAIN_RFCORE : RF Core
  • PRCM_DOMAIN_SERIAL : SSI0, UART0, I2C0
  • PRCM_DOMAIN_PERIPH : GPT0, GPT1, GPT2, GPT3, GPIO, SSI1, I2S, DMA, UART1
  • PRCM_DOMAIN_VIMS : SRAM, FLASH, ROM
  • PRCM_DOMAIN_SYSBUS
  • PRCM_DOMAIN_CPU
Returns
None
360 {
361  // Check the arguments.
362  ASSERT((ui32Domains & PRCM_DOMAIN_RFCORE) ||
363  (ui32Domains & PRCM_DOMAIN_SERIAL) ||
364  (ui32Domains & PRCM_DOMAIN_PERIPH) ||
365  (ui32Domains & PRCM_DOMAIN_CPU) ||
366  (ui32Domains & PRCM_DOMAIN_VIMS));
367 
368  // Assert the request to power on the right domains.
369  if(ui32Domains & PRCM_DOMAIN_RFCORE)
370  {
371  HWREG(PRCM_BASE + PRCM_O_PDCTL0RFC ) = 1;
372  }
373  if(ui32Domains & PRCM_DOMAIN_SERIAL)
374  {
375  HWREG(PRCM_BASE + PRCM_O_PDCTL0SERIAL) = 1;
376  }
377  if(ui32Domains & PRCM_DOMAIN_PERIPH)
378  {
379  HWREG(PRCM_BASE + PRCM_O_PDCTL0PERIPH) = 1;
380  }
381  if(ui32Domains & PRCM_DOMAIN_VIMS)
382  {
383  HWREG(PRCM_BASE + PRCM_O_PDCTL1VIMS ) = 1;
384  }
385  if(ui32Domains & PRCM_DOMAIN_CPU)
386  {
387  HWREG(PRCM_BASE + PRCM_O_PDCTL1CPU ) = 1;
388  }
389 }
#define PRCM_DOMAIN_VIMS
Definition: prcm.h:142
#define PRCM_DOMAIN_PERIPH
Definition: prcm.h:138
#define ASSERT(expr)
Definition: debug.h:73
#define PRCM_DOMAIN_SERIAL
Definition: prcm.h:136
#define PRCM_DOMAIN_RFCORE
Definition: prcm.h:134
#define PRCM_DOMAIN_CPU
Definition: prcm.h:148
uint32_t PRCMPowerDomainStatus ( uint32_t  ui32Domains)

Get the status for a specific power domain.

Use this function to retrieve the current power status of one or more power domains.

Parameters
ui32Domainsdetermines which domain to get the power status for. The parameter must be an OR'ed combination of one or several of:
Returns
Returns status of the requested domains:

Referenced by SysCtrlStandby().

535 {
536  bool bStatus;
537  uint32_t ui32StatusRegister0;
538  uint32_t ui32StatusRegister1;
539 
540  // Check the arguments.
541  ASSERT((ui32Domains & (PRCM_DOMAIN_RFCORE |
544 
545  bStatus = true;
546  ui32StatusRegister0 = HWREG(PRCM_BASE + PRCM_O_PDSTAT0);
547  ui32StatusRegister1 = HWREG(PRCM_BASE + PRCM_O_PDSTAT1);
548 
549  // Return the correct power status.
550  if(ui32Domains & PRCM_DOMAIN_RFCORE)
551  {
552  bStatus = bStatus &&
553  ((ui32StatusRegister0 & PRCM_PDSTAT0_RFC_ON) ||
554  (ui32StatusRegister1 & PRCM_PDSTAT1_RFC_ON));
555  }
556  if(ui32Domains & PRCM_DOMAIN_SERIAL)
557  {
558  bStatus = bStatus && (ui32StatusRegister0 & PRCM_PDSTAT0_SERIAL_ON);
559  }
560  if(ui32Domains & PRCM_DOMAIN_PERIPH)
561  {
562  bStatus = bStatus && (ui32StatusRegister0 & PRCM_PDSTAT0_PERIPH_ON);
563  }
564 
565  // Return the status.
566  return (bStatus ? PRCM_DOMAIN_POWER_ON : PRCM_DOMAIN_POWER_OFF);
567 }
#define PRCM_DOMAIN_PERIPH
Definition: prcm.h:138
#define ASSERT(expr)
Definition: debug.h:73
#define PRCM_DOMAIN_POWER_ON
Definition: prcm.h:157
#define PRCM_DOMAIN_SERIAL
Definition: prcm.h:136
#define PRCM_DOMAIN_RFCORE
Definition: prcm.h:134
#define PRCM_DOMAIN_POWER_OFF
Definition: prcm.h:156
static void PRCMRfPowerDownWhenIdle ( void  )
inlinestatic

Configure RF core to power down when idle.

Use this function to configure the RF core to power down when Idle. This is handled automatically in hardware if the RF Core reports that it is idle.

Returns
None
706 {
707  // Configure the RF power domain.
709 }
static bool PRCMRfReady ( void  )
inlinestatic

Return the access status of the RF Core.

Use this function to check if the RF Core is on and ready to be accessed. Accessing register or memories that are not powered and clocked will cause a bus fault.

Returns
Returns access status of the RF Core.
  • true : RF Core can be accessed.
  • false : RF Core domain is not ready for access.
998 {
999  // Return the ready status of the RF Core.
1000  return ((HWREG(PRCM_BASE + PRCM_O_PDSTAT1RFC) &
1001  PRCM_PDSTAT1RFC_ON) ? true : false);
1002 }
static void PRCMSleep ( void  )
inlinestatic

Put the processor into sleep mode.

This function places the processor into sleep mode; it does not return until the processor returns to run mode. The peripherals that are enabled via PRCMPeripheralSleepEnable() continue to operate and can wake up the processor.

Returns
None
See also
PRCMPeripheralSleepEnable()
1021 {
1022  // Wait for an interrupt.
1023  CPUwfi();
1024 }
static void CPUwfi(void)
Wait for interrupt.
Definition: cpu.h:193

Here is the call graph for this function:

Macro Definition Documentation

#define I2S_SAMPLE_RATE_16K   0x00000001

Referenced by PRCMAudioClockConfigSet().

#define I2S_SAMPLE_RATE_24K   0x00000002

Referenced by PRCMAudioClockConfigSet().

#define I2S_SAMPLE_RATE_32K   0x00000004

Referenced by PRCMAudioClockConfigSet().

#define I2S_SAMPLE_RATE_48K   0x00000008

Referenced by PRCMAudioClockConfigSet().

#define PRCM_CLOCK_DIV_1   PRCM_GPTCLKDIV_RATIO_DIV1
#define PRCM_CLOCK_DIV_128   PRCM_GPTCLKDIV_RATIO_DIV128
#define PRCM_CLOCK_DIV_16   PRCM_GPTCLKDIV_RATIO_DIV16
#define PRCM_CLOCK_DIV_2   PRCM_GPTCLKDIV_RATIO_DIV2
#define PRCM_CLOCK_DIV_256   PRCM_GPTCLKDIV_RATIO_DIV256
#define PRCM_CLOCK_DIV_32   PRCM_GPTCLKDIV_RATIO_DIV32
#define PRCM_CLOCK_DIV_4   PRCM_GPTCLKDIV_RATIO_DIV4
#define PRCM_CLOCK_DIV_64   PRCM_GPTCLKDIV_RATIO_DIV64
#define PRCM_CLOCK_DIV_8   PRCM_GPTCLKDIV_RATIO_DIV8
#define PRCM_DEEP_SLEEP_MODE   0x00000004
#define PRCM_DOMAIN_CLKCTRL   0x00000080
#define PRCM_DOMAIN_CPU   0x00000020
#define PRCM_DOMAIN_MCU   0x00000100
#define PRCM_DOMAIN_PERIPH   0x00000004
#define PRCM_DOMAIN_POWER_DOWN_READY   0x00000000
#define PRCM_DOMAIN_POWER_OFF   0x00000002
#define PRCM_DOMAIN_POWER_ON   0x00000001

Referenced by PRCMPowerDomainStatus().

#define PRCM_DOMAIN_SERIAL   0x00000002
#define PRCM_DOMAIN_SYSBUS   0x00000008
#define PRCM_DOMAIN_TIMER   0x00000040
#define PRCM_DOMAIN_VIMS   0x00000010
#define PRCM_DOMAIN_VIMS_OFF_NO_WAKEUP   0x00020010
#define PRCM_PERIPH_CRYPTO   ( 0x00000400 | ( PRCM_SECDMACLKGR_CRYPTO_CLK_EN_S ))

Referenced by SysCtrlStandby().

#define PRCM_PERIPH_GPIO   ( 0x00000500 | ( PRCM_GPIOCLKGR_CLK_EN_S ))
#define PRCM_PERIPH_I2C0   ( 0x00000300 | ( PRCM_I2CCLKGR_CLK_EN_S ))
#define PRCM_PERIPH_I2S   ( 0x00000600 | ( PRCM_I2SCLKGR_CLK_EN_S ))

Referenced by SysCtrlStandby().

#define PRCM_PERIPH_PKA   ( 0x00000400 | ( PRCM_SECDMACLKGR_PKA_CLK_EN_S ))
#define PRCM_PERIPH_SSI0   ( 0x00000100 | ( PRCM_SSICLKGR_CLK_EN_S ))
#define PRCM_PERIPH_SSI1   ( 0x00000100 | ( PRCM_SSICLKGR_CLK_EN_S + 1 ))
#define PRCM_PERIPH_TIMER0   ( 0x00000000 | ( PRCM_GPTCLKGR_CLK_EN_S ))
#define PRCM_PERIPH_TIMER1   ( 0x00000000 | ( PRCM_GPTCLKGR_CLK_EN_S + 1 ))
#define PRCM_PERIPH_TIMER2   ( 0x00000000 | ( PRCM_GPTCLKGR_CLK_EN_S + 2 ))
#define PRCM_PERIPH_TIMER3   ( 0x00000000 | ( PRCM_GPTCLKGR_CLK_EN_S + 3 ))
#define PRCM_PERIPH_TRNG   ( 0x00000400 | ( PRCM_SECDMACLKGR_TRNG_CLK_EN_S ))
#define PRCM_PERIPH_UART0   ( 0x00000200 | ( PRCM_UARTCLKGR_CLK_EN_S ))
#define PRCM_PERIPH_UART1   ( 0x00000200 | ( PRCM_UARTCLKGR_CLK_EN_S + 1 ))
#define PRCM_PERIPH_UDMA   ( 0x00000400 | ( PRCM_SECDMACLKGR_DMA_CLK_EN_S ))

Referenced by SysCtrlStandby().

#define PRCM_RUN_MODE   0x00000001
#define PRCM_SLEEP_MODE   0x00000002
#define PRCM_WCLK_DUAL_PHASE   0x00000002
#define PRCM_WCLK_NEG_EDGE   0x00000008
#define PRCM_WCLK_POS_EDGE   0x00000000
#define PRCM_WCLK_SINGLE_PHASE   0x00000000
#define PRCM_WCLK_USER_DEF   0x00000004