rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Data Structures | Enumerator | Variables
Smc

Data Structures

struct  _smc_version_id
 IP version ID definition. More...
 
struct  _smc_param
 IP parameter definition. More...
 
struct  _smc_power_mode_lls_config
 SMC Low-Leakage Stop power mode configuration. More...
 
struct  _smc_power_mode_vlls_config
 SMC Very Low-Leakage Stop power mode configuration. More...
 

Variables

uint16_t _smc_version_id::feature
 
uint8_t _smc_version_id::minor
 
uint8_t _smc_version_id::major
 
bool _smc_param::hsrunEnable
 
bool _smc_param::llsEnable
 
bool _smc_param::lls2Enable
 
bool _smc_param::vlls0Enable
 
smc_stop_submode_t _smc_power_mode_lls_config::subMode
 
bool _smc_power_mode_lls_config::enableLpoClock
 
smc_stop_submode_t _smc_power_mode_vlls_config::subMode
 
bool _smc_power_mode_vlls_config::enablePorDetectInVlls0
 
bool _smc_power_mode_vlls_config::enableRam2InVlls2
 
bool _smc_power_mode_vlls_config::enableLpoClock
 

Driver version

enum  _smc_power_mode_protection {
  kSMC_AllowPowerModeVlls = SMC_PMPROT_AVLLS_MASK , kSMC_AllowPowerModeLls = SMC_PMPROT_ALLS_MASK , kSMC_AllowPowerModeVlp = SMC_PMPROT_AVLP_MASK , kSMC_AllowPowerModeHsrun = SMC_PMPROT_AHSRUN_MASK ,
  kSMC_AllowPowerModeAll
}
 Power Modes Protection. More...
 
enum  _smc_power_state {
  kSMC_PowerStateRun = 0x01U << 0U , kSMC_PowerStateStop = 0x01U << 1U , kSMC_PowerStateVlpr = 0x01U << 2U , kSMC_PowerStateVlpw = 0x01U << 3U ,
  kSMC_PowerStateVlps = 0x01U << 4U , kSMC_PowerStateLls = 0x01U << 5U , kSMC_PowerStateVlls = 0x01U << 6U , kSMC_PowerStateHsrun
}
 Power Modes in PMSTAT. More...
 
enum  _smc_run_mode { kSMC_RunNormal = 0U , kSMC_RunVlpr = 2U , kSMC_Hsrun }
 Run mode definition. More...
 
enum  _smc_stop_mode { kSMC_StopNormal = 0U , kSMC_StopVlps = 2U , kSMC_StopLls = 3U , kSMC_StopVlls }
 Stop mode definition. More...
 
enum  _smc_stop_submode { kSMC_StopSub0 = 0U , kSMC_StopSub1 = 1U , kSMC_StopSub2 = 2U , kSMC_StopSub3 = 3U }
 VLLS/LLS stop sub mode definition. More...
 
enum  _smc_partial_stop_mode { kSMC_PartialStop = 0U , kSMC_PartialStop1 = 1U , kSMC_PartialStop2 = 2U }
 Partial STOP option. More...
 
enum  _smc_status { kStatus_SMC_StopAbort = MAKE_STATUS(kStatusGroup_POWER, 0) }
 SMC configuration status. More...
 
typedef enum _smc_power_mode_protection smc_power_mode_protection_t
 Power Modes Protection.
 
typedef enum _smc_power_state smc_power_state_t
 Power Modes in PMSTAT.
 
typedef enum _smc_run_mode smc_run_mode_t
 Run mode definition.
 
typedef enum _smc_stop_mode smc_stop_mode_t
 Stop mode definition.
 
typedef enum _smc_stop_submode smc_stop_submode_t
 VLLS/LLS stop sub mode definition.
 
typedef enum _smc_partial_stop_mode smc_partial_stop_option_t
 Partial STOP option.
 
typedef struct _smc_version_id smc_version_id_t
 IP version ID definition.
 
typedef struct _smc_param smc_param_t
 IP parameter definition.
 
typedef struct _smc_power_mode_lls_config smc_power_mode_lls_config_t
 SMC Low-Leakage Stop power mode configuration.
 
typedef struct _smc_power_mode_vlls_config smc_power_mode_vlls_config_t
 SMC Very Low-Leakage Stop power mode configuration.
 

System mode controller APIs

static void SMC_GetVersionId (SMC_Type *base, smc_version_id_t *versionId)
 Gets the SMC version ID.
 
void SMC_GetParam (SMC_Type *base, smc_param_t *param)
 Gets the SMC parameter.
 
static void SMC_SetPowerModeProtection (SMC_Type *base, uint8_t allowedModes)
 Configures all power mode protection settings.
 
static smc_power_state_t SMC_GetPowerModeState (SMC_Type *base)
 Gets the current power mode status.
 
void SMC_PreEnterStopModes (void)
 Prepares to enter stop modes.
 
void SMC_PostExitStopModes (void)
 Recovers after wake up from stop modes.
 
void SMC_PreEnterWaitModes (void)
 Prepares to enter wait modes.
 
void SMC_PostExitWaitModes (void)
 Recovers after wake up from stop modes.
 
status_t SMC_SetPowerModeRun (SMC_Type *base)
 Configures the system to RUN power mode.
 
status_t SMC_SetPowerModeHsrun (SMC_Type *base)
 Configures the system to HSRUN power mode.
 
status_t SMC_SetPowerModeWait (SMC_Type *base)
 Configures the system to WAIT power mode.
 
status_t SMC_SetPowerModeStop (SMC_Type *base, smc_partial_stop_option_t option)
 Configures the system to Stop power mode.
 
status_t SMC_SetPowerModeVlpr (SMC_Type *base, bool wakeupMode)
 Configures the system to VLPR power mode.
 
status_t SMC_SetPowerModeVlpr (SMC_Type *base)
 Configures the system to VLPR power mode.
 
status_t SMC_SetPowerModeVlpw (SMC_Type *base)
 Configures the system to VLPW power mode.
 
status_t SMC_SetPowerModeVlps (SMC_Type *base)
 Configures the system to VLPS power mode.
 
status_t SMC_SetPowerModeLls (SMC_Type *base, const smc_power_mode_lls_config_t *config)
 Configures the system to LLS power mode.
 
status_t SMC_SetPowerModeLls (SMC_Type *base)
 Configures the system to LLS power mode.
 
status_t SMC_SetPowerModeVlls (SMC_Type *base, const smc_power_mode_vlls_config_t *config)
 Configures the system to VLLS power mode.
 

Detailed Description

Typedef Documentation

◆ smc_param_t

typedef struct _smc_param smc_param_t

IP parameter definition.

◆ smc_partial_stop_option_t

Partial STOP option.

◆ smc_power_mode_lls_config_t

SMC Low-Leakage Stop power mode configuration.

◆ smc_power_mode_protection_t

Power Modes Protection.

◆ smc_power_mode_vlls_config_t

SMC Very Low-Leakage Stop power mode configuration.

◆ smc_power_state_t

Power Modes in PMSTAT.

◆ smc_run_mode_t

Run mode definition.

◆ smc_stop_mode_t

Stop mode definition.

◆ smc_stop_submode_t

VLLS/LLS stop sub mode definition.

◆ smc_version_id_t

IP version ID definition.

Enumeration Type Documentation

◆ _smc_partial_stop_mode

Partial STOP option.

Enumerator
kSMC_PartialStop 

STOP - Normal Stop mode

kSMC_PartialStop1 

Partial Stop with both system and bus clocks disabled

kSMC_PartialStop2 

Partial Stop with system clock disabled and bus clock enabled

Definition at line 126 of file fsl_smc.h.

127{
128 kSMC_PartialStop = 0U, /*!< STOP - Normal Stop mode*/
129 kSMC_PartialStop1 = 1U, /*!< Partial Stop with both system and bus clocks disabled*/
130 kSMC_PartialStop2 = 2U, /*!< Partial Stop with system clock disabled and bus clock enabled*/
enum _smc_partial_stop_mode smc_partial_stop_option_t
Partial STOP option.
@ kSMC_PartialStop
Definition fsl_smc.h:128
@ kSMC_PartialStop1
Definition fsl_smc.h:129
@ kSMC_PartialStop2
Definition fsl_smc.h:130

◆ _smc_power_mode_protection

Power Modes Protection.

Enumerator
kSMC_AllowPowerModeVlls 

Allow Very-low-leakage Stop Mode.

kSMC_AllowPowerModeLls 

Allow Low-leakage Stop Mode.

kSMC_AllowPowerModeVlp 

Allow Very-Low-power Mode.

kSMC_AllowPowerModeHsrun 

Allow High-speed Run mode.

kSMC_AllowPowerModeAll 

Allow all power mode.

Definition at line 30 of file fsl_smc.h.

31{
32#if (defined(FSL_FEATURE_SMC_HAS_VERY_LOW_LEAKAGE_STOP_MODE) && FSL_FEATURE_SMC_HAS_VERY_LOW_LEAKAGE_STOP_MODE)
33 kSMC_AllowPowerModeVlls = SMC_PMPROT_AVLLS_MASK, /*!< Allow Very-low-leakage Stop Mode. */
34#endif
35#if (defined(FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE) && FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE)
36 kSMC_AllowPowerModeLls = SMC_PMPROT_ALLS_MASK, /*!< Allow Low-leakage Stop Mode. */
37#endif /* FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE */
38 kSMC_AllowPowerModeVlp = SMC_PMPROT_AVLP_MASK, /*!< Allow Very-Low-power Mode. */
39#if (defined(FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE) && FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE)
40 kSMC_AllowPowerModeHsrun = SMC_PMPROT_AHSRUN_MASK, /*!< Allow High-speed Run mode. */
41#endif /* FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE */
43#if (defined(FSL_FEATURE_SMC_HAS_VERY_LOW_LEAKAGE_STOP_MODE) && FSL_FEATURE_SMC_HAS_VERY_LOW_LEAKAGE_STOP_MODE)
44 |
45 SMC_PMPROT_AVLLS_MASK
46#endif
47#if (defined(FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE) && FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE)
48 |
49 SMC_PMPROT_ALLS_MASK
50#endif /* FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE */
51 |
52 SMC_PMPROT_AVLP_MASK
53#if (defined(FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE) && FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE)
54 |
56#endif /* FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE */
57 ) /*!< Allow all power mode. */
enum _smc_power_mode_protection smc_power_mode_protection_t
Power Modes Protection.
@ kSMC_AllowPowerModeAll
Definition fsl_smc.h:42
@ kSMC_AllowPowerModeVlls
Definition fsl_smc.h:33
@ kSMC_AllowPowerModeVlp
Definition fsl_smc.h:38
@ kSMC_AllowPowerModeHsrun
Definition fsl_smc.h:40
@ kSMC_AllowPowerModeLls
Definition fsl_smc.h:36

◆ _smc_power_state

Power Modes in PMSTAT.

Enumerator
kSMC_PowerStateRun 

0000_0001 - Current power mode is RUN

kSMC_PowerStateStop 

0000_0010 - Current power mode is STOP

kSMC_PowerStateVlpr 

0000_0100 - Current power mode is VLPR

kSMC_PowerStateVlpw 

0000_1000 - Current power mode is VLPW

kSMC_PowerStateVlps 

0001_0000 - Current power mode is VLPS

kSMC_PowerStateLls 

0010_0000 - Current power mode is LLS

kSMC_PowerStateVlls 

0100_0000 - Current power mode is VLLS

kSMC_PowerStateHsrun 

1000_0000 - Current power mode is HSRUN

Definition at line 63 of file fsl_smc.h.

64{
65 kSMC_PowerStateRun = 0x01U << 0U, /*!< 0000_0001 - Current power mode is RUN */
66 kSMC_PowerStateStop = 0x01U << 1U, /*!< 0000_0010 - Current power mode is STOP */
67 kSMC_PowerStateVlpr = 0x01U << 2U, /*!< 0000_0100 - Current power mode is VLPR */
68 kSMC_PowerStateVlpw = 0x01U << 3U, /*!< 0000_1000 - Current power mode is VLPW */
69 kSMC_PowerStateVlps = 0x01U << 4U, /*!< 0001_0000 - Current power mode is VLPS */
70#if (defined(FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE) && FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE)
71 kSMC_PowerStateLls = 0x01U << 5U, /*!< 0010_0000 - Current power mode is LLS */
72#endif /* FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE */
73#if (defined(FSL_FEATURE_SMC_HAS_VERY_LOW_LEAKAGE_STOP_MODE) && FSL_FEATURE_SMC_HAS_VERY_LOW_LEAKAGE_STOP_MODE)
74 kSMC_PowerStateVlls = 0x01U << 6U, /*!< 0100_0000 - Current power mode is VLLS */
75#endif
76#if (defined(FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE) && FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE)
77 kSMC_PowerStateHsrun = 0x01U << 7U /*!< 1000_0000 - Current power mode is HSRUN */
78#endif /* FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE */
enum _smc_power_state smc_power_state_t
Power Modes in PMSTAT.
@ kSMC_PowerStateVlls
Definition fsl_smc.h:74
@ kSMC_PowerStateVlpr
Definition fsl_smc.h:67
@ kSMC_PowerStateStop
Definition fsl_smc.h:66
@ kSMC_PowerStateRun
Definition fsl_smc.h:65
@ kSMC_PowerStateVlpw
Definition fsl_smc.h:68
@ kSMC_PowerStateVlps
Definition fsl_smc.h:69
@ kSMC_PowerStateLls
Definition fsl_smc.h:71
@ kSMC_PowerStateHsrun
Definition fsl_smc.h:77

◆ _smc_run_mode

Run mode definition.

Enumerator
kSMC_RunNormal 

Normal RUN mode.

kSMC_RunVlpr 

Very-low-power RUN mode.

kSMC_Hsrun 

High-speed Run mode (HSRUN).

Definition at line 84 of file fsl_smc.h.

85{
86 kSMC_RunNormal = 0U, /*!< Normal RUN mode. */
87 kSMC_RunVlpr = 2U, /*!< Very-low-power RUN mode. */
88#if (defined(FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE) && FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE)
89 kSMC_Hsrun = 3U /*!< High-speed Run mode (HSRUN). */
90#endif /* FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE */
enum _smc_run_mode smc_run_mode_t
Run mode definition.
@ kSMC_RunNormal
Definition fsl_smc.h:86
@ kSMC_RunVlpr
Definition fsl_smc.h:87
@ kSMC_Hsrun
Definition fsl_smc.h:89

◆ _smc_status

SMC configuration status.

Enumerator
kStatus_SMC_StopAbort 

Entering Stop mode is abort

Definition at line 136 of file fsl_smc.h.

137{
138 kStatus_SMC_StopAbort = MAKE_STATUS(kStatusGroup_POWER, 0) /*!< Entering Stop mode is abort*/
139};
@ kStatusGroup_POWER
Definition fsl_common.h:92
@ kStatus_SMC_StopAbort
Definition fsl_smc.h:138

◆ _smc_stop_mode

Stop mode definition.

Enumerator
kSMC_StopNormal 

Normal STOP mode.

kSMC_StopVlps 

Very-low-power STOP mode.

kSMC_StopLls 

Low-leakage Stop mode.

kSMC_StopVlls 

Very-low-leakage Stop mode.

Definition at line 96 of file fsl_smc.h.

97{
98 kSMC_StopNormal = 0U, /*!< Normal STOP mode. */
99 kSMC_StopVlps = 2U, /*!< Very-low-power STOP mode. */
100#if (defined(FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE) && FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE)
101 kSMC_StopLls = 3U, /*!< Low-leakage Stop mode. */
102#endif /* FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE */
103#if (defined(FSL_FEATURE_SMC_HAS_VERY_LOW_LEAKAGE_STOP_MODE) && FSL_FEATURE_SMC_HAS_VERY_LOW_LEAKAGE_STOP_MODE)
104 kSMC_StopVlls = 4U /*!< Very-low-leakage Stop mode. */
105#endif
enum _smc_stop_mode smc_stop_mode_t
Stop mode definition.
@ kSMC_StopVlps
Definition fsl_smc.h:99
@ kSMC_StopLls
Definition fsl_smc.h:101
@ kSMC_StopNormal
Definition fsl_smc.h:98
@ kSMC_StopVlls
Definition fsl_smc.h:104

◆ _smc_stop_submode

VLLS/LLS stop sub mode definition.

Enumerator
kSMC_StopSub0 

Stop submode 0, for VLLS0/LLS0.

kSMC_StopSub1 

Stop submode 1, for VLLS1/LLS1.

kSMC_StopSub2 

Stop submode 2, for VLLS2/LLS2.

kSMC_StopSub3 

Stop submode 3, for VLLS3/LLS3.

Definition at line 114 of file fsl_smc.h.

115{
116 kSMC_StopSub0 = 0U, /*!< Stop submode 0, for VLLS0/LLS0. */
117 kSMC_StopSub1 = 1U, /*!< Stop submode 1, for VLLS1/LLS1. */
118 kSMC_StopSub2 = 2U, /*!< Stop submode 2, for VLLS2/LLS2. */
119 kSMC_StopSub3 = 3U /*!< Stop submode 3, for VLLS3/LLS3. */
enum _smc_stop_submode smc_stop_submode_t
VLLS/LLS stop sub mode definition.
@ kSMC_StopSub3
Definition fsl_smc.h:119
@ kSMC_StopSub2
Definition fsl_smc.h:118
@ kSMC_StopSub1
Definition fsl_smc.h:117
@ kSMC_StopSub0
Definition fsl_smc.h:116

Function Documentation

◆ SMC_GetParam()

void SMC_GetParam ( SMC_Type *  base,
smc_param_t param 
)

Gets the SMC parameter.

This function gets the SMC parameter including the enabled power mdoes.

Parameters
baseSMC peripheral base address.
paramPointer to the SMC param structure.

brief Gets the SMC parameter.

This function gets the SMC parameter including the enabled power mdoes.

param base SMC peripheral base address. param param Pointer to the SMC param structure.

Definition at line 85 of file fsl_smc.c.

86{
87 uint32_t reg = base->PARAM;
88 param->hsrunEnable = (bool)(reg & SMC_PARAM_EHSRUN_MASK);
89 param->llsEnable = (bool)(reg & SMC_PARAM_ELLS_MASK);
90 param->lls2Enable = (bool)(reg & SMC_PARAM_ELLS2_MASK);
91 param->vlls0Enable = (bool)(reg & SMC_PARAM_EVLLS0_MASK);
92}
static tstrWifiInitParam param

◆ SMC_GetPowerModeState()

static smc_power_state_t SMC_GetPowerModeState ( SMC_Type *  base)
inlinestatic

Gets the current power mode status.

This function returns the current power mode status. After the application switches the power mode, it should always check the status to check whether it runs into the specified mode or not. The application should check this mode before switching to a different mode. The system requires that only certain modes can switch to other specific modes. See the reference manual for details and the smc_power_state_t for information about the power status.

Parameters
baseSMC peripheral base address.
Returns
Current power mode status.

Definition at line 279 of file fsl_smc.h.

280{
281 return (smc_power_state_t)base->PMSTAT;
282}

Referenced by ke1xf_clock_init().

Here is the caller graph for this function:

◆ SMC_GetVersionId()

static void SMC_GetVersionId ( SMC_Type *  base,
smc_version_id_t versionId 
)
inlinestatic

Gets the SMC version ID.

This function gets the SMC version ID, including major version number, minor version number, and feature specification number.

Parameters
baseSMC peripheral base address.
versionIdPointer to the version ID structure.

Definition at line 226 of file fsl_smc.h.

227{
228 *((uint32_t *)versionId) = base->VERID;
229}

◆ SMC_PostExitStopModes()

void SMC_PostExitStopModes ( void  )

Recovers after wake up from stop modes.

This function should be called after wake up from STOP/VLPS/LLS/VLLS modes. It is used with SMC_PreEnterStopModes.

brief Recovers after wake up from stop modes.

This function should be called after wake up from STOP/VLPS/LLS/VLLS modes. It is used with ref SMC_PreEnterStopModes.

Definition at line 112 of file fsl_smc.c.

113{
114 EnableGlobalIRQ(g_savedPrimask);
115 __ISB();
116}
static uint32_t g_savedPrimask
Definition fsl_smc.c:31

◆ SMC_PostExitWaitModes()

void SMC_PostExitWaitModes ( void  )

Recovers after wake up from stop modes.

This function should be called after wake up from WAIT/VLPW modes. It is used with SMC_PreEnterWaitModes.

brief Recovers after wake up from stop modes.

This function should be called after wake up from WAIT/VLPW modes. It is used with ref SMC_PreEnterWaitModes.

Definition at line 135 of file fsl_smc.c.

136{
137 EnableGlobalIRQ(g_savedPrimask);
138 __ISB();
139}

◆ SMC_PreEnterStopModes()

void SMC_PreEnterStopModes ( void  )

Prepares to enter stop modes.

This function should be called before entering STOP/VLPS/LLS/VLLS modes.

brief Prepares to enter stop modes.

This function should be called before entering STOP/VLPS/LLS/VLLS modes.

Definition at line 100 of file fsl_smc.c.

101{
102 g_savedPrimask = DisableGlobalIRQ();
103 __ISB();
104}

◆ SMC_PreEnterWaitModes()

void SMC_PreEnterWaitModes ( void  )

Prepares to enter wait modes.

This function should be called before entering WAIT/VLPW modes.

brief Prepares to enter wait modes.

This function should be called before entering WAIT/VLPW modes.

Definition at line 123 of file fsl_smc.c.

124{
125 g_savedPrimask = DisableGlobalIRQ();
126 __ISB();
127}

◆ SMC_SetPowerModeHsrun()

status_t SMC_SetPowerModeHsrun ( SMC_Type *  base)

Configures the system to HSRUN power mode.

Parameters
baseSMC peripheral base address.
Returns
SMC configuration error code.

brief Configures the system to HSRUN power mode.

param base SMC peripheral base address. return SMC configuration error code.

Definition at line 167 of file fsl_smc.c.

168{
169 uint8_t reg;
170
171 reg = base->PMCTRL;
172 /* configure High Speed RUN mode */
173 reg &= ~SMC_PMCTRL_RUNM_MASK;
174 reg |= (kSMC_Hsrun << SMC_PMCTRL_RUNM_SHIFT);
175 base->PMCTRL = reg;
176
177 return kStatus_Success;
178}
@ kStatus_Success
Definition fsl_common.h:159

Referenced by ke1xf_clock_init().

Here is the caller graph for this function:

◆ SMC_SetPowerModeLls() [1/2]

status_t SMC_SetPowerModeLls ( SMC_Type *  base)

Configures the system to LLS power mode.

Parameters
baseSMC peripheral base address.
Returns
SMC configuration error code.

◆ SMC_SetPowerModeLls() [2/2]

status_t SMC_SetPowerModeLls ( SMC_Type *  base,
const smc_power_mode_lls_config_t config 
)

Configures the system to LLS power mode.

Parameters
baseSMC peripheral base address.
configThe LLS power mode configuration structure
Returns
SMC configuration error code.

◆ SMC_SetPowerModeProtection()

static void SMC_SetPowerModeProtection ( SMC_Type *  base,
uint8_t  allowedModes 
)
inlinestatic

Configures all power mode protection settings.

This function configures the power mode protection settings for supported power modes in the specified chip family. The available power modes are defined in the smc_power_mode_protection_t. This should be done at an early system level initialization stage. See the reference manual for details. This register can only write once after the power reset.

The allowed modes are passed as bit map. For example, to allow LLS and VLLS, use SMC_SetPowerModeProtection(kSMC_AllowPowerModeVlls | kSMC_AllowPowerModeVlps). To allow all modes, use SMC_SetPowerModeProtection(kSMC_AllowPowerModeAll).

Parameters
baseSMC peripheral base address.
allowedModesBitmap of the allowed power modes.

Definition at line 260 of file fsl_smc.h.

261{
262 base->PMPROT = allowedModes;
263}

Referenced by ke1xf_clock_init().

Here is the caller graph for this function:

◆ SMC_SetPowerModeRun()

status_t SMC_SetPowerModeRun ( SMC_Type *  base)

Configures the system to RUN power mode.

Parameters
baseSMC peripheral base address.
Returns
SMC configuration error code.

brief Configures the system to RUN power mode.

param base SMC peripheral base address. return SMC configuration error code.

Definition at line 147 of file fsl_smc.c.

148{
149 uint8_t reg;
150
151 reg = base->PMCTRL;
152 /* configure Normal RUN mode */
153 reg &= ~SMC_PMCTRL_RUNM_MASK;
154 reg |= (kSMC_RunNormal << SMC_PMCTRL_RUNM_SHIFT);
155 base->PMCTRL = reg;
156
157 return kStatus_Success;
158}

Referenced by ke1xf_clock_init().

Here is the caller graph for this function:

◆ SMC_SetPowerModeStop()

status_t SMC_SetPowerModeStop ( SMC_Type *  base,
smc_partial_stop_option_t  option 
)

Configures the system to Stop power mode.

Parameters
baseSMC peripheral base address.
optionPartial Stop mode option.
Returns
SMC configuration error code.

brief Configures the system to Stop power mode.

param base SMC peripheral base address. param option Partial Stop mode option. return SMC configuration error code.

Definition at line 205 of file fsl_smc.c.

206{
207 uint8_t reg;
208
209#if (defined(FSL_FEATURE_SMC_HAS_PSTOPO) && FSL_FEATURE_SMC_HAS_PSTOPO)
210 /* configure the Partial Stop mode in Normal Stop mode */
211 reg = base->STOPCTRL;
212 reg &= ~SMC_STOPCTRL_PSTOPO_MASK;
213 reg |= ((uint32_t)option << SMC_STOPCTRL_PSTOPO_SHIFT);
214 base->STOPCTRL = reg;
215#endif
216
217 /* configure Normal Stop mode */
218 reg = base->PMCTRL;
219 reg &= ~SMC_PMCTRL_STOPM_MASK;
220 reg |= (kSMC_StopNormal << SMC_PMCTRL_STOPM_SHIFT);
221 base->PMCTRL = reg;
222
223 /* Set the SLEEPDEEP bit to enable deep sleep mode (stop mode) */
224 SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
225
226 /* read back to make sure the configuration valid before enter stop mode */
227 (void)base->PMCTRL;
229
230 /* check whether the power mode enter Stop mode succeed */
231 if (base->PMCTRL & SMC_PMCTRL_STOPA_MASK)
232 {
234 }
235 else
236 {
237 return kStatus_Success;
238 }
239}
static void SMC_EnterStopRamFunc(void)
Definition fsl_smc.c:69
Here is the call graph for this function:

◆ SMC_SetPowerModeVlls()

status_t SMC_SetPowerModeVlls ( SMC_Type *  base,
const smc_power_mode_vlls_config_t config 
)

Configures the system to VLLS power mode.

Parameters
baseSMC peripheral base address.
configThe VLLS power mode configuration structure.
Returns
SMC configuration error code.

brief Configures the system to VLLS power mode.

param base SMC peripheral base address. param config The VLLS power mode configuration structure. return SMC configuration error code.

Definition at line 400 of file fsl_smc.c.

401{
402 uint8_t reg;
403
404#if (defined(FSL_FEATURE_SMC_HAS_PORPO) && FSL_FEATURE_SMC_HAS_PORPO)
405#if (defined(FSL_FEATURE_SMC_USE_VLLSCTRL_REG) && FSL_FEATURE_SMC_USE_VLLSCTRL_REG) || \
406 (defined(FSL_FEATURE_SMC_USE_STOPCTRL_VLLSM) && FSL_FEATURE_SMC_USE_STOPCTRL_VLLSM) || \
407 (defined(FSL_FEATURE_SMC_HAS_LLS_SUBMODE) && FSL_FEATURE_SMC_HAS_LLS_SUBMODE)
408 if (config->subMode == kSMC_StopSub0)
409#endif
410 {
411 /* configure whether the Por Detect work in Vlls0 mode */
412 if (config->enablePorDetectInVlls0)
413 {
414#if (defined(FSL_FEATURE_SMC_USE_VLLSCTRL_REG) && FSL_FEATURE_SMC_USE_VLLSCTRL_REG)
415 base->VLLSCTRL &= ~SMC_VLLSCTRL_PORPO_MASK;
416#else
417 base->STOPCTRL &= ~SMC_STOPCTRL_PORPO_MASK;
418#endif
419 }
420 else
421 {
422#if (defined(FSL_FEATURE_SMC_USE_VLLSCTRL_REG) && FSL_FEATURE_SMC_USE_VLLSCTRL_REG)
423 base->VLLSCTRL |= SMC_VLLSCTRL_PORPO_MASK;
424#else
425 base->STOPCTRL |= SMC_STOPCTRL_PORPO_MASK;
426#endif
427 }
428 }
429#endif /* FSL_FEATURE_SMC_HAS_PORPO */
430
431#if (defined(FSL_FEATURE_SMC_HAS_RAM2_POWER_OPTION) && FSL_FEATURE_SMC_HAS_RAM2_POWER_OPTION)
432 else if (config->subMode == kSMC_StopSub2)
433 {
434 /* configure whether the Por Detect work in Vlls0 mode */
435 if (config->enableRam2InVlls2)
436 {
437#if (defined(FSL_FEATURE_SMC_USE_VLLSCTRL_REG) && FSL_FEATURE_SMC_USE_VLLSCTRL_REG)
438 base->VLLSCTRL |= SMC_VLLSCTRL_RAM2PO_MASK;
439#else
440 base->STOPCTRL |= SMC_STOPCTRL_RAM2PO_MASK;
441#endif
442 }
443 else
444 {
445#if (defined(FSL_FEATURE_SMC_USE_VLLSCTRL_REG) && FSL_FEATURE_SMC_USE_VLLSCTRL_REG)
446 base->VLLSCTRL &= ~SMC_VLLSCTRL_RAM2PO_MASK;
447#else
448 base->STOPCTRL &= ~SMC_STOPCTRL_RAM2PO_MASK;
449#endif
450 }
451 }
452 else
453 {
454 }
455#endif /* FSL_FEATURE_SMC_HAS_RAM2_POWER_OPTION */
456
457 /* configure to VLLS mode */
458 reg = base->PMCTRL;
459 reg &= ~SMC_PMCTRL_STOPM_MASK;
460 reg |= (kSMC_StopVlls << SMC_PMCTRL_STOPM_SHIFT);
461 base->PMCTRL = reg;
462
463/* configure the VLLS sub-mode */
464#if (defined(FSL_FEATURE_SMC_USE_VLLSCTRL_REG) && FSL_FEATURE_SMC_USE_VLLSCTRL_REG)
465 reg = base->VLLSCTRL;
466 reg &= ~SMC_VLLSCTRL_VLLSM_MASK;
467 reg |= ((uint32_t)config->subMode << SMC_VLLSCTRL_VLLSM_SHIFT);
468 base->VLLSCTRL = reg;
469#else
470#if (defined(FSL_FEATURE_SMC_HAS_LLS_SUBMODE) && FSL_FEATURE_SMC_HAS_LLS_SUBMODE)
471 reg = base->STOPCTRL;
472 reg &= ~SMC_STOPCTRL_LLSM_MASK;
473 reg |= ((uint32_t)config->subMode << SMC_STOPCTRL_LLSM_SHIFT);
474 base->STOPCTRL = reg;
475#else
476 reg = base->STOPCTRL;
477 reg &= ~SMC_STOPCTRL_VLLSM_MASK;
478 reg |= ((uint32_t)config->subMode << SMC_STOPCTRL_VLLSM_SHIFT);
479 base->STOPCTRL = reg;
480#endif /* FSL_FEATURE_SMC_HAS_LLS_SUBMODE */
481#endif
482
483#if (defined(FSL_FEATURE_SMC_HAS_LPOPO) && FSL_FEATURE_SMC_HAS_LPOPO)
484 if (config->enableLpoClock)
485 {
486 base->STOPCTRL &= ~SMC_STOPCTRL_LPOPO_MASK;
487 }
488 else
489 {
490 base->STOPCTRL |= SMC_STOPCTRL_LPOPO_MASK;
491 }
492#endif /* FSL_FEATURE_SMC_HAS_LPOPO */
493
494 /* Set the SLEEPDEEP bit to enable deep sleep mode */
495 SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
496
497 /* read back to make sure the configuration valid before enter stop mode */
498 (void)base->PMCTRL;
500
501 /* check whether the power mode enter LLS mode succeed */
502 if (base->PMCTRL & SMC_PMCTRL_STOPA_MASK)
503 {
505 }
506 else
507 {
508 return kStatus_Success;
509 }
510}
static constexpr persistent_config_s * config
Here is the call graph for this function:

◆ SMC_SetPowerModeVlpr() [1/2]

status_t SMC_SetPowerModeVlpr ( SMC_Type *  base)

Configures the system to VLPR power mode.

Parameters
baseSMC peripheral base address.
Returns
SMC configuration error code.

◆ SMC_SetPowerModeVlpr() [2/2]

status_t SMC_SetPowerModeVlpr ( SMC_Type *  base,
bool  wakeupMode 
)

Configures the system to VLPR power mode.

Parameters
baseSMC peripheral base address.
wakeupModeEnter Normal Run mode if true, else stay in VLPR mode.
Returns
SMC configuration error code.

◆ SMC_SetPowerModeVlps()

status_t SMC_SetPowerModeVlps ( SMC_Type *  base)

Configures the system to VLPS power mode.

Parameters
baseSMC peripheral base address.
Returns
SMC configuration error code.

brief Configures the system to VLPS power mode.

param base SMC peripheral base address. return SMC configuration error code.

Definition at line 303 of file fsl_smc.c.

304{
305 uint8_t reg;
306
307 /* configure VLPS mode */
308 reg = base->PMCTRL;
309 reg &= ~SMC_PMCTRL_STOPM_MASK;
310 reg |= (kSMC_StopVlps << SMC_PMCTRL_STOPM_SHIFT);
311 base->PMCTRL = reg;
312
313 /* Set the SLEEPDEEP bit to enable deep sleep mode */
314 SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
315
316 /* read back to make sure the configuration valid before enter stop mode */
317 (void)base->PMCTRL;
319
320 /* check whether the power mode enter VLPS mode succeed */
321 if (base->PMCTRL & SMC_PMCTRL_STOPA_MASK)
322 {
324 }
325 else
326 {
327 return kStatus_Success;
328 }
329}
Here is the call graph for this function:

◆ SMC_SetPowerModeVlpw()

status_t SMC_SetPowerModeVlpw ( SMC_Type *  base)

Configures the system to VLPW power mode.

Parameters
baseSMC peripheral base address.
Returns
SMC configuration error code.

brief Configures the system to VLPW power mode.

param base SMC peripheral base address. return SMC configuration error code.

Definition at line 285 of file fsl_smc.c.

286{
287 /* configure VLPW mode */
288 /* Set the SLEEPDEEP bit to enable deep sleep mode */
289 SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk;
290 __DSB();
291 __WFI();
292 __ISB();
293
294 return kStatus_Success;
295}

◆ SMC_SetPowerModeWait()

status_t SMC_SetPowerModeWait ( SMC_Type *  base)

Configures the system to WAIT power mode.

Parameters
baseSMC peripheral base address.
Returns
SMC configuration error code.

brief Configures the system to WAIT power mode.

param base SMC peripheral base address. return SMC configuration error code.

Definition at line 187 of file fsl_smc.c.

188{
189 /* configure Normal Wait mode */
190 SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk;
191 __DSB();
192 __WFI();
193 __ISB();
194
195 return kStatus_Success;
196}

Variable Documentation

◆ enableLpoClock [1/2]

bool _smc_power_mode_lls_config::enableLpoClock

Enable LPO clock in LLS mode

Definition at line 177 of file fsl_smc.h.

◆ enableLpoClock [2/2]

bool _smc_power_mode_vlls_config::enableLpoClock

Enable LPO clock in VLLS mode

Definition at line 200 of file fsl_smc.h.

◆ enablePorDetectInVlls0

bool _smc_power_mode_vlls_config::enablePorDetectInVlls0

Enable Power on reset detect in VLLS mode

Definition at line 194 of file fsl_smc.h.

◆ enableRam2InVlls2

bool _smc_power_mode_vlls_config::enableRam2InVlls2

Enable RAM2 power in VLLS2

Definition at line 197 of file fsl_smc.h.

◆ feature

uint16_t _smc_version_id::feature

Feature Specification Number.

Definition at line 147 of file fsl_smc.h.

◆ hsrunEnable

bool _smc_param::hsrunEnable

HSRUN mode enable.

Definition at line 159 of file fsl_smc.h.

◆ lls2Enable

bool _smc_param::lls2Enable

LLS2 mode enable.

Definition at line 161 of file fsl_smc.h.

◆ llsEnable

bool _smc_param::llsEnable

LLS mode enable.

Definition at line 160 of file fsl_smc.h.

◆ major

uint8_t _smc_version_id::major

Major version number.

Definition at line 149 of file fsl_smc.h.

◆ minor

uint8_t _smc_version_id::minor

Minor version number.

Definition at line 148 of file fsl_smc.h.

◆ subMode [1/2]

smc_stop_submode_t _smc_power_mode_lls_config::subMode

Low-leakage Stop sub-mode

Definition at line 174 of file fsl_smc.h.

◆ subMode [2/2]

smc_stop_submode_t _smc_power_mode_vlls_config::subMode

Very Low-leakage Stop sub-mode

Definition at line 191 of file fsl_smc.h.

◆ vlls0Enable

bool _smc_param::vlls0Enable

VLLS0 mode enable.

Definition at line 162 of file fsl_smc.h.