power_manager_S32K1xx.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2016, Freescale Semiconductor, Inc.
3  * Copyright 2016-2017 NXP
4  * All rights reserved.
5  *
6  * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR
7  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
8  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
9  * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
10  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
11  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
12  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
13  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
14  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
15  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
16  * THE POSSIBILITY OF SUCH DAMAGE.
17  */
45 #include <stddef.h>
46 #include "power_manager.h"
47 #include "power_smc_hw_access.h"
48 #include "power_rcm_hw_access.h"
49 #include "clock_manager.h"
50 
52 #define POWER_SET_MODE_TIMEOUT 1000U
53 
56 
57 /*******************************************************************************
58  * INTERNAL FUNCTIONS
59  ******************************************************************************/
61 
63 
65 
66 static status_t POWER_DRV_SwitchVlprClk(const sys_clk_config_t * const sysClock);
67 
68 static status_t POWER_DRV_UpdateInitClk(const sys_clk_config_t * const sysClk, bool allowUpdate);
69 
70 /*******************************************************************************
71  * Code
72  ******************************************************************************/
73 
74 /*******************************************************************************
75  *
76  * It is expected that prior to the POWER_SYS_Init() call the write-once protection
77  * register was configured appropriately allowing entry to all required low power
78  * modes.
79  * The following is an example of how to set up two power modes and one
80  * callback, and initialize the Power manager with structures containing their settings.
81  * The example shows two possible ways the configuration structures can be stored
82  * (ROM or RAM), although it is expected that they will be placed in the read-only
83  * memory to save the RAM space. (Note: In the example it is assumed that the programmed chip
84  * doesn't support any optional power options described in the power_manager_user_config_t)
85  * :
86  * @code
87  *
88  * power_manager_user_config_t vlprConfig = { vlprConfig power mode configuration
89  * .powerMode = POWER_MANAGER_VLPR,
90  * .sleepOnExitValue = false,
91  * };
92  *
93  * power_manager_user_config_t stopConfig = { stopConfig power mode configuration
94  * .powerMode = POWER_MANAGER_STOP,
95  * .sleepOnExitValue = false,
96  * };
97  *
98  * power_manager_user_config_t const * powerConfigsArr[] = { Power mode configurations array
99  * &vlprConfig,
100  * &stopConfig
101  * };
102  *
103  * power_manager_callback_user_config_t callbackCfg0 = { Callback configuration structure callbackCfg0
104  * .callbackFunction = &callback0,
105  * .callbackType = POWER_MANAGER_CALLBACK_BEFORE_AFTER,
106  * .callbackData = (void *)0,
107  * };
108  *
109  * power_manager_callback_user_config_t const * callbacksConfigsArr[] = { Callback configuration structures array
110  * &callbackCfg0
111  * };
112  *
113  * status_t callback0(power_manager_notify_struct_t * notify, Definition of power manager callback
114  * power_manager_callback_data_t * dataPtr)
115  * {
116  * status_t ret = STATUS_SUCCESS;
117  * ...
118  * return ret;
119  * }
120  *
121  * int main(void) Main function
122  * {
123  * status_t ret = STATUS_SUCCESS;
124  *
125  * Calling of init method
126  * POWER_SYS_Init(&powerConfigsArr, 2U, &powerStaticCallbacksConfigsArr, 1U);
127  *
128  * Switch to VLPR mode
129  * ret = POWER_SYS_SetMode(MODE_VLPR,POWER_MANAGER_POLICY_AGREEMENT);
130  *
131  * if (ret != STATUS_SUCCESS)
132  * {
133  * return -1;
134  * }
135  * return 0;
136  * }
137  *
138  * @endcode
139  *
140  *END**************************************************************************/
142 {
143  uint8_t k = 0U;
144 
145  smc_power_mode_protection_config_t powerModeProtConfig;
146 #if FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE
147  powerModeProtConfig.hsrunProt = false;
148 #endif /* #if FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE */
149  powerModeProtConfig.vlpProt = false;
150 
151  for (k = 0;k < gPowerManagerState.configsNumber;k++)
152  {
153  const power_manager_user_config_t * const config = (*gPowerManagerState.configs)[k];
154 #if FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE
155  if (config->powerMode == POWER_MANAGER_HSRUN)
156  {
157  powerModeProtConfig.hsrunProt = true; /* High speed mode is allowed. */
158  }
159 #endif /* #if FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE */
160  if ((config->powerMode == POWER_MANAGER_VLPR) || (config->powerMode == POWER_MANAGER_VLPS))
161  {
162  powerModeProtConfig.vlpProt = true; /* Very low power mode is allowed. */
163  }
164  }
165  /* Very low power modes and high speed mode are not protected. */
166  SMC_SetProtectionMode(SMC, &powerModeProtConfig);
167 
168  return STATUS_SUCCESS;
169 }
170 
171 /*FUNCTION**********************************************************************
172  *
173  * Function Name : POWER_SYS_DoDeinit
174  * Description : This function performs the actual implementation-specific de-initialization.
175  *
176  *
177  *END**************************************************************************/
179 {
180  return STATUS_SUCCESS;
181 }
182 
183 /*FUNCTION**********************************************************************
184  *
185  * Function Name : POWER_SYS_DoSetMode
186  * Description : This function performs the actual implementation-specific logic to switch
187  * to one of the defined power modes.
188  *
189  *
190  *END**************************************************************************/
192 {
193  status_t returnCode; /* Function return */
194 
195  /* Check whether the power mode is a sleeping or a running power mode */
196  if (configPtr->powerMode <= POWER_MANAGER_VLPR)
197  {
198  /* Switch to a running power mode */
199  returnCode = POWER_SYS_SwitchToRunningPowerMode(configPtr);
200  }
201  else
202  {
203  /* Switch to a sleeping power mode */
204  returnCode = POWER_SYS_SwitchToSleepingPowerMode(configPtr);
205  }
206 
207  return returnCode;
208 }
209 
210 /*FUNCTION**********************************************************************
211  *
212  * Function Name : POWER_SYS_GetCurrentMode
213  * Description : Returns currently running power mode.
214  *
215  * Implements POWER_SYS_GetCurrentMode_Activity
216  *
217  *END**************************************************************************/
219 {
220  power_manager_modes_t retVal;
221 
222  switch (SMC_GetPowerModeStatus(SMC))
223  {
224 #if FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE
225  /* High speed run mode */
226  case STAT_HSRUN:
227  retVal = POWER_MANAGER_HSRUN;
228  break;
229 #endif
230  /* Run mode */
231  case STAT_RUN:
232  retVal = POWER_MANAGER_RUN;
233  break;
234  /* Very low power run mode */
235  case STAT_VLPR:
236  retVal = POWER_MANAGER_VLPR;
237  break;
238  /* This should never happen - core has to be in some run mode to execute code */
239  default:
240  retVal = POWER_MANAGER_MAX;
241  break;
242  }
243 
244  return retVal;
245 }
246 
247 /*FUNCTION**********************************************************************
248  *
249  * Function Name : POWER_SYS_WaitForModeStatus
250  * Description : Internal function used by POWER_SYS_SwitchToSleepingPowerMode and
251  * POWER_SYS_SwitchToRunningPowerMode functions
252  *
253  *END**************************************************************************/
255 {
256  status_t retCode;
257  power_mode_stat_t modeStat;
258  uint32_t i = 0U;
259 
260  switch (mode)
261  {
262  case SMC_RUN:
263  modeStat = STAT_RUN;
264  retCode = STATUS_SUCCESS;
265  break;
266  case SMC_VLPR:
267  modeStat = STAT_VLPR;
268  retCode = STATUS_SUCCESS;
269  break;
270 #if FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE
271  case SMC_HSRUN:
272  modeStat = STAT_HSRUN;
273  retCode = STATUS_SUCCESS;
274  break;
275 #endif /* #if FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE */
276  default:
277  /* invalid parameter */
278  modeStat = STAT_INVALID;
279  retCode = STATUS_UNSUPPORTED;
280  break;
281  }
282 
283  if (STATUS_SUCCESS == retCode)
284  {
285  for ( ; i < POWER_SET_MODE_TIMEOUT; i++)
286  {
287  if (SMC_GetPowerModeStatus(SMC) == modeStat)
288  {
289  break;
290  }
291  }
292  }
293 
294  if (i >= POWER_SET_MODE_TIMEOUT)
295  {
297  }
298 
299  return retCode;
300 }
301 
302 /*FUNCTION**********************************************************************
303  *
304  * Function Name : POWER_SYS_SwitchToRunningPowerMode
305  * Description :Internal function used by POWER_SYS_SetMode function to switch to a running power mode
306  * configPtr pointer to the requested user-defined power mode configuration.
307  * System clock source must be SIRC or SOSC in Run mode before transition very low power run mode.
308  * Update initialization or default clock source in run mode when came back from very low power run mode.
309  *
310  *END**************************************************************************/
312 {
313  /* Save system clock configure */
314  static sys_clk_config_t sysClkConfig;
315  /* Confirm change clock when switch very low power run mode */
316  static bool changeClkVlpr = false;
317  smc_power_mode_config_t modeConfig; /* SMC hardware layer configuration structure */
318  power_mode_stat_t currentMode = SMC_GetPowerModeStatus(SMC);
319  status_t returnCode = STATUS_SUCCESS;
320 
321  /* Configure the running mode */
322  switch (configPtr->powerMode)
323  {
324 #if FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE
325  /* High speed run mode */
326  case POWER_MANAGER_HSRUN:
327  /* High speed run mode can be entered only from Run mode */
328  if (currentMode != STAT_HSRUN)
329  {
330  if (currentMode != STAT_RUN)
331  {
332  SMC_SetRunModeControl(SMC, SMC_RUN);
333  returnCode = POWER_SYS_WaitForModeStatus(SMC_RUN);
334  }
335  if (returnCode == STATUS_SUCCESS)
336  {
337  /* Update init clock configuration */
338  returnCode = POWER_DRV_UpdateInitClk(&sysClkConfig, changeClkVlpr);
339  if (returnCode == STATUS_SUCCESS)
340  {
341  changeClkVlpr = false;
342  modeConfig.powerModeName = POWER_MANAGER_HSRUN;
343  /* Switch the mode */
344  returnCode = SMC_SetPowerMode(SMC, &modeConfig);
345  }
346  }
347  }
348  else
349  {
350  returnCode = STATUS_SUCCESS;
351  }
352  break;
353 #endif /* if FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE */
354  /* Run mode */
355  case POWER_MANAGER_RUN:
356  if (currentMode != STAT_RUN)
357  {
358  modeConfig.powerModeName = POWER_MANAGER_RUN;
359  /* Switch the mode */
360  returnCode = SMC_SetPowerMode(SMC, &modeConfig);
361  }
362  if (returnCode == STATUS_SUCCESS)
363  {
364  /* Update init clock configuration */
365  returnCode = POWER_DRV_UpdateInitClk(&sysClkConfig, changeClkVlpr);
366  /* Clear value of changeClkVlpr after switch clock configure successfully. */
367  if (returnCode == STATUS_SUCCESS)
368  {
369  changeClkVlpr = false;
370  }
371  }
372 
373  break;
374  /* Very low power run mode */
375  case POWER_MANAGER_VLPR:
376  if (currentMode != STAT_VLPR)
377  {
378  /* Very low power run mode can be entered only from Run mode */
379  if (SMC_GetPowerModeStatus(SMC) != STAT_RUN)
380  {
381  SMC_SetRunModeControl(SMC, SMC_RUN);
382  returnCode = POWER_SYS_WaitForModeStatus(SMC_RUN);
383  }
384  if (STATUS_SUCCESS == returnCode)
385  {
386  CLOCK_DRV_GetSystemClockSource(&sysClkConfig);
387  returnCode = POWER_DRV_SwitchVlprClk(&sysClkConfig);
388  if (STATUS_SUCCESS == returnCode)
389  {
390  changeClkVlpr = true;
391  modeConfig.powerModeName = POWER_MANAGER_VLPR;
392  /* Switch the mode */
393  returnCode = SMC_SetPowerMode(SMC, &modeConfig);
394  }
395  }
396  }
397  else
398  {
399  returnCode = STATUS_SUCCESS;
400  }
401 
402  break;
403  /* Wait mode */
404  default:
405  /* invalid power mode */
406  returnCode = STATUS_UNSUPPORTED;
407  modeConfig.powerModeName = POWER_MANAGER_MAX;
408  break;
409  }
410 
411  return returnCode;
412 }
413 
414 /*FUNCTION**********************************************************************
415  *
416  * Function Name : POWER_SYS_SwitchToSleepingPowerMode
417  * Description :Internal function used by POWER_SYS_SetMode function to switch to a sleeping power mode
418  * configPtr pointer to the requested user-defined power mode configuration
419  *
420  *END**************************************************************************/
422 {
423  smc_power_mode_config_t modeConfig; /* SMC hardware layer configuration structure */
424  status_t returnCode = STATUS_SUCCESS; /* return value */
425  power_mode_stat_t pwrModeStat = SMC_GetPowerModeStatus(SMC); /* power mode stat */
426  sys_clk_config_t sysclk;
427  uint32_t predivSysFre;
428  uint32_t busFre;
429 
430  /* Configure the hardware layer */
431  switch (configPtr->powerMode)
432  {
433 #if FEATURE_SMC_HAS_WAIT_VLPW
434  /* Wait mode */
435  case POWER_MANAGER_WAIT:
436  /* Wait mode can be entered only from Run mode */
437  if (pwrModeStat != STAT_RUN)
438  {
439  SMC_SetRunModeControl(SMC, SMC_RUN);
440  returnCode = POWER_SYS_WaitForModeStatus(SMC_RUN);
441  }
442 
443  modeConfig.powerModeName = POWER_MANAGER_WAIT;
444  break;
445  /* Very low power wait mode */
446  case POWER_MANAGER_VLPW:
447  /* Very low power wait mode can be entered only from Very low power run mode */
448  if (pwrModeStat != STAT_VLPR)
449  {
450  SMC_SetRunModeControl(SMC, SMC_VLPR);
452  }
453 
454  modeConfig.powerModeName = POWER_MANAGER_VLPW;
455  break;
456 #endif /* if FEATURE_SMC_HAS_WAIT_VLPW */
457 #if FEATURE_SMC_HAS_PSTOPO
458  /* Partial stop modes */
459  case POWER_MANAGER_PSTOP1:
460  /* fall-through */
461  case POWER_MANAGER_PSTOP2:
462  /* fall-through */
463 #endif
464 #if FEATURE_SMC_HAS_STOPO
465  /* Stop modes */
466  case POWER_MANAGER_STOP1:
467  /* fall-through */
468  case POWER_MANAGER_STOP2:
469  /* Stop1 and Stop2 mode can be entered only from Run mode */
470  if (pwrModeStat != STAT_RUN)
471  {
472  SMC_SetRunModeControl(SMC, SMC_RUN);
473  returnCode = POWER_SYS_WaitForModeStatus(SMC_RUN);
474  }
475 
476  modeConfig.powerModeName = configPtr->powerMode;
477 #endif /* #if FEATURE_SMC_HAS_STOPO */
478 #if FEATURE_SMC_HAS_PSTOPO
479  modeConfig.pstopOption = true;
480  /* Set the partial stop option value */
481  if (POWER_MANAGER_PSTOP1 == configPtr->powerMode)
482  {
483  modeConfig.pstopOptionValue = SMC_PSTOP_STOP1;
484  }
485  else if (POWER_MANAGER_PSTOP2 == configPtr->powerMode)
486  {
487  modeConfig.pstopOptionValue = SMC_PSTOP_STOP2;
488  }
489  else
490  {
491  modeConfig.pstopOptionValue = SMC_PSTOP_STOP;
492  }
493 
494 #endif /* if FEATURE_SMC_HAS_PSTOPO */
495 #if FEATURE_SMC_HAS_STOPO
496  /* Set the stop option value */
497  if (POWER_MANAGER_STOP1 == configPtr->powerMode)
498  {
499  modeConfig.stopOptionValue = SMC_STOP1;
500  }
501  else
502  {
503  modeConfig.stopOptionValue = SMC_STOP2;
504  }
505 #endif /* if FEATURE_SMC_HAS_STOPO */
506  break;
507  /* Very low power stop mode */
508  case POWER_MANAGER_VLPS:
509  /* Very low power stop mode can be entered only from Run mode or Very low power run mode*/
510  if ((pwrModeStat != STAT_RUN) && (pwrModeStat != STAT_VLPR))
511  {
512  modeConfig.powerModeName = POWER_MANAGER_RUN;
513  returnCode = SMC_SetPowerMode(SMC, &modeConfig);
514  }
515  /* Get current source clock */
517  (void)CLOCK_DRV_GetFreq(sysclk.src,&predivSysFre);
518  (void)CLOCK_DRV_GetFreq(BUS_CLK,&busFre);
519  /* Check PREDIV_SYS_CLK frequency / BUS_CLK frequency before executing the transition to VLPS mode. */
520  /* It must be greater than or equal to 2. */
521  DEV_ASSERT((predivSysFre / busFre) >= 2U);
522  modeConfig.powerModeName = POWER_MANAGER_VLPS;
523  break;
524  default:
525  /* invalid power mode */
526  returnCode = STATUS_UNSUPPORTED;
527  modeConfig.powerModeName = POWER_MANAGER_MAX;
528  break;
529  }
530 
531  if (STATUS_SUCCESS == returnCode)
532  {
533  /* Configure ARM core what to do after interrupt invoked in (deep) sleep state */
534  if (configPtr->sleepOnExitValue)
535  {
536  /* Go back to (deep) sleep state on ISR exit */
538  }
539  else
540  {
541  /* Do not re-enter (deep) sleep state on ISR exit */
543  }
544 
545  /* Switch the mode */
546  if (SMC_SetPowerMode(SMC, &modeConfig) != STATUS_SUCCESS)
547  {
548  returnCode = STATUS_MCU_TRANSITION_FAILED;
549  }
550  }
551 
552  return returnCode;
553 }
554 
555 /*FUNCTION**********************************************************************
556  *
557  * Function Name : POWER_DRV_SwitchVlprClk
558  * Description : This function will change system clock in run mode before MCU enter very low power run mode.
559  *
560  *
561  *END**************************************************************************/
562 static status_t POWER_DRV_SwitchVlprClk(const sys_clk_config_t * const sysClock)
563 {
564  status_t retCode = STATUS_SUCCESS;
565  sys_clk_config_t sysClkVlprConfig;
566  clock_names_t currentSystemClockSource = sysClock->src;
567 
568  if ((currentSystemClockSource != SIRC_CLK) && (currentSystemClockSource != SOSC_CLK))
569  {
570  /* Set SIRC the system clock source */
571  sysClkVlprConfig.src = SIRC_CLK;
572  sysClkVlprConfig.dividers[0U] = 1U; /* Core clock divider, do not divide */
573  sysClkVlprConfig.dividers[1U] = 2U; /* Bus clock divider, do not divide */
574  sysClkVlprConfig.dividers[2U] = 2U; /* Slow clock divider, do not divide */
575  retCode = CLOCK_DRV_SetSystemClock(NULL,&sysClkVlprConfig);
576  if (STATUS_SUCCESS != retCode)
577  {
578  /* Set SOSC the system clock source */
579  sysClkVlprConfig.src = SOSC_CLK;
580  sysClkVlprConfig.dividers[0U] = 1U; /* Core clock divider, do not divide */
581  sysClkVlprConfig.dividers[1U] = 2U; /* Bus clock divider, divide by two */
582  sysClkVlprConfig.dividers[2U] = 2U; /* Slow clock divider, divide by two */
583 
584  retCode = CLOCK_DRV_SetSystemClock(NULL,&sysClkVlprConfig);
585  if (STATUS_SUCCESS != retCode)
586  {
587  /* Can't switch clock before enter VLPR */
588  retCode = STATUS_ERROR;
589  }
590  }
591  }
592 
593  return retCode;
594 }
595 
596 /*FUNCTION**********************************************************************
597  *
598  * Function Name : POWER_DRV_UpdateInitClk
599  * Description : This function will update initialization or default clock source of run mode when MCU come back run mode.
600  *
601  *
602  *END**************************************************************************/
603 static status_t POWER_DRV_UpdateInitClk(const sys_clk_config_t * const sysClk, bool allowUpdate)
604 {
605  status_t retCode = STATUS_SUCCESS;
606  sys_clk_config_t sysClkDefault;
607 
608  /* Update if it 's allowed */
609  if (allowUpdate)
610  {
611  retCode = CLOCK_DRV_SetSystemClock(NULL,sysClk);
612  if (retCode != STATUS_SUCCESS)
613  {
614  sysClkDefault.src = FIRC_CLK;
615  sysClkDefault.dividers[0U] = 1U; /* Core clock divider, do not divide */
616  sysClkDefault.dividers[1U] = 2U; /* Bus clock divider, divide by two */
617  sysClkDefault.dividers[2U] = 2U; /* Slow clock divider, divide by two */
618 
619  retCode = CLOCK_DRV_SetSystemClock(NULL,&sysClkDefault);
620  if (STATUS_SUCCESS != retCode)
621  {
622  /* Can't transition clock in Run mode */
623  retCode = STATUS_ERROR;
624  }
625  }
626  }
627 
628  return retCode;
629 }
630 
631 /*FUNCTION**********************************************************************
632  *
633  * Function Name : POWER_SYS_GetResetSrcStatusCmd
634  * Description : This function will get the current reset source status for specified source
635  *
636  * Implements POWER_SYS_GetResetSrcStatusCmd_Activity
637  *
638  *END**************************************************************************/
639 bool POWER_SYS_GetResetSrcStatusCmd(const RCM_Type * const baseAddr , const rcm_source_names_t srcName)
640 {
641  return RCM_GetSrcStatusCmd(baseAddr , srcName);
642 }
643 
644 
645 /*******************************************************************************
646  * EOF
647  ******************************************************************************/
#define SMC
Definition: S32K118.h:9956
static status_t POWER_SYS_SwitchToRunningPowerMode(const power_manager_user_config_t *const configPtr)
power_manager_state_t gPowerManagerState
Power manager internal structure.
Definition: power_manager.c:51
power_mode_stat_t
Power Modes in PMSTAT.
bool POWER_SYS_GetResetSrcStatusCmd(const RCM_Type *const baseAddr, const rcm_source_names_t srcName)
Gets the reset source status.
Power mode protection configuration.
power_manager_modes_t powerModeName
#define DEV_ASSERT(x)
Definition: devassert.h:77
status_t POWER_SYS_DoDeinit(void)
This function implementation-specific de-initialization of power manager.
status_t CLOCK_DRV_SetSystemClock(const pwr_modes_t *mode, const sys_clk_config_t *sysClkConfig)
Configures the system clocks.
static status_t POWER_DRV_SwitchVlprClk(const sys_clk_config_t *const sysClock)
status_t POWER_SYS_DoInit(void)
This function implementation-specific configuration of power modes.
#define S32_SCB
Definition: S32K118.h:9048
smc_run_mode_t
Run mode definition.
void CLOCK_DRV_GetSystemClockSource(sys_clk_config_t *sysClkConfig)
Gets the system clock source.
status_t
Status return codes. Common error codes will be a unified enumeration (C enum) that will contain all ...
Definition: status.h:44
#define S32_SCB_SCR_SLEEPONEXIT_MASK
Definition: S32K118.h:9136
power_manager_modes_t POWER_SYS_GetCurrentMode(void)
This function returns currently running power mode.
rcm_source_names_t
System Reset Source Name definitions Implements rcm_source_names_t_Class.
power_manager_user_config_t *(* configs)[]
Power mode control configuration used for calling the SMC_SYS_SetPowerMode API.
Power mode user configuration structure.
static status_t POWER_SYS_WaitForModeStatus(smc_run_mode_t mode)
static status_t POWER_SYS_SwitchToSleepingPowerMode(const power_manager_user_config_t *const configPtr)
Power manager internal state structure.
static status_t POWER_DRV_UpdateInitClk(const sys_clk_config_t *const sysClk, bool allowUpdate)
clock_names_t src
clock_names_t
Clock names.
status_t CLOCK_DRV_GetFreq(clock_names_t clockName, uint32_t *frequency)
Return frequency.
#define POWER_SET_MODE_TIMEOUT
power_manager_modes_t
Power modes enumeration.
status_t POWER_SYS_DoSetMode(const power_manager_user_config_t *const configPtr)
This function configures the power mode.
uint16_t dividers[3U]
smc_stop_option_t stopOptionValue
System clock configuration. Implements sys_clk_config_t_Class.