![]() |
Kinetis SDK v.1.2 API Reference Manual
Rev. 0
Freescale Semiconductor, Inc.
|
The section describes the programming interface of the SMC HAL driver. The System Mode Controller (SMC) sequences the system in and out of all low-power stop and run modes. Specifically, it monitors events to trigger transitions between the power modes while controlling the power, clocks, and memories of the system to achieve the power consumption and functionality of that mode. It also provides a set of functions to configure the power mode protection, the power mode, and other configuration settings.
The function SMC_HAL_SetMode() configures the power mode base on configuration. If could not switch to the target mdoe directly, this function could check internally and choose the right path.
If an interrupt or a reset occurs during a stop entry sequence, the SMC can abort the transition early without completely entering the stop mode. The function SMC_HAL_IsStopAbort() checks whether the previous stop mode entry was aborted.
To get current power mode, please use the function SMC_HAL_GetStat().
This is an example of the SMC manager APIs.
To configure the allowed power mode, please use the function SMC_HAL_SetProtection() and pass the allowed power modes. This function should only be called once after system reset.
There is an example shows how to use this function:
At the same time, the function SMC_HAL_GetProtection() could check whether the specified modes are allowed.
Files | |
file | fsl_smc_hal.h |
Data Structures | |
struct | smc_power_mode_config_t |
Power mode control configuration used for calling the SMC_SYS_SetPowerMode API. More... | |
Enumerations | |
enum | power_modes_t { kPowerModeRun = 0x01U << 0U, kPowerModeWait = 0x01U << 1U, kPowerModeStop = 0x01U << 2U, kPowerModeVlpr = 0x01U << 3U, kPowerModeVlpw = 0x01U << 4U, kPowerModeVlps = 0x01U << 5U, kPowerModeLls = 0x01U << 6U, kPowerModeVlls = 0x01U << 7U, kPowerModeHsrun = 0x01U << 8U, kPowerModeMax = 0x01U << 9U } |
Power Modes. | |
enum | smc_hal_error_code_t { kSmcHalSuccess, kSmcHalNoSuchModeName, kSmcHalAlreadyInTheState, kSmcHalFailed } |
Error code definition for the system mode controller manager APIs. More... | |
enum | power_mode_stat_t { kStatRun = 0x01U, kStatStop = 0x02U, kStatVlpr = 0x04U, kStatVlpw = 0x08U, kStatVlps = 0x10U, kStatVlls = 0x40U } |
Power Modes in PMSTAT. More... | |
enum | power_modes_protect_t { kAllowPowerModeVlls = SMC_PMPROT_AVLLS_MASK, kAllowPowerModeVlp = SMC_PMPROT_AVLP_MASK, kAllowPowerModeAll } |
Power Modes Protection. More... | |
enum | smc_run_mode_t { kSmcRun, kSmcReservedRun, kSmcVlpr } |
Run mode definition. More... | |
enum | smc_stop_mode_t { kSmcStop = 0U, kSmcReservedStop1 = 1U, kSmcVlps = 2U, kSmcVlls = 4U } |
Stop mode definition. More... | |
enum | smc_stop_submode_t { kSmcStopSub0, kSmcStopSub1, kSmcStopSub2, kSmcStopSub3 } |
VLLS/LLS stop sub mode definition. More... | |
enum | smc_lpwui_option_t { kSmcLpwuiEnabled, kSmcLpwuiDisabled } |
Low Power Wake Up on Interrupt option. More... | |
enum | smc_pstop_option_t { kSmcPstopStop, kSmcPstopStop1, kSmcPstopStop2, kSmcPstopReserved } |
Partial STOP option. More... | |
enum | smc_por_option_t { kSmcPorEnabled, kSmcPorDisabled } |
POR option. More... | |
enum | smc_ram2_option_t { kSmcRam2DisPowered, kSmcRam2Powered } |
RAM2 power option. More... | |
enum | smc_lpo_option_t { kSmcLpoEnabled, kSmcLpoDisabled } |
LPO power option. More... | |
System mode controller APIs | |
smc_hal_error_code_t | SMC_HAL_SetMode (SMC_Type *base, const smc_power_mode_config_t *powerModeConfig) |
Configures the power mode. More... | |
static void | SMC_HAL_SetProtection (SMC_Type *base, uint8_t allowedModes) |
Configures all power mode protection settings. More... | |
static uint8_t | SMC_HAL_GetProtection (SMC_Type *base, uint8_t modes) |
Get the power mode protection setting. More... | |
static bool | SMC_HAL_IsStopAbort (SMC_Type *base) |
Check whether previous stop mode entry was successsful. More... | |
power_mode_stat_t | SMC_HAL_GetStat (SMC_Type *base) |
Gets the current power mode status. More... | |
struct smc_power_mode_config_t |
Data Fields | |
power_modes_t | powerModeName |
Power mode(enum), see power_modes_t. | |
smc_stop_submode_t | stopSubMode |
Stop submode(enum), see smc_stop_submode_t. | |
enum smc_hal_error_code_t |
enum power_mode_stat_t |
enum smc_run_mode_t |
enum smc_stop_mode_t |
enum smc_stop_submode_t |
enum smc_lpwui_option_t |
enum smc_pstop_option_t |
enum smc_por_option_t |
enum smc_ram2_option_t |
enum smc_lpo_option_t |
smc_hal_error_code_t SMC_HAL_SetMode | ( | SMC_Type * | base, |
const smc_power_mode_config_t * | powerModeConfig | ||
) |
This function configures the power mode base on configuration structure, if could not switch to the target mode directly, this function could check internally and choose the right path.
base | Base address for current SMC instance. |
powerModeConfig | Power mode configuration structure smc_power_mode_config_t |
|
inlinestatic |
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 power_modes_protect_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, plase use SMC_HAL_SetProtection(SMC, kAllowPowerModeLls | kAllowPowerModeVlls). To allow all modes, please use SMC_HAL_SetProtection(SMC, kAllowPowerModeAll).
base | Base address for current SMC instance. |
allowedModes | Bitmap of the allowed power modes. |
|
inlinestatic |
This function checks whether the power modes are allowed. The modes to check are passed as bit map, for example, to check LLS and VLLS, plase use SMC_HAL_GetProtection(SMC, kAllowPowerModeLls | kAllowPowerModeVlls). To test all modes, please use SMC_HAL_GetProtection(SMC, kAllowPowerModeAll).
base | Base address for current SMC instance. |
modes | Bitmap of the power modes to check. |
|
inlinestatic |
base | Base address for current SMC instance. |
true | The previous stop mode entry was aborted. |
false | The previous stop mode entry was successsful. |
power_mode_stat_t SMC_HAL_GetStat | ( | SMC_Type * | base | ) |
This function returns the current power mode stat. Once application switches the power mode, it should always check the stat to check whether it runs into the specified mode or not. An 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 _power_mode_stat for information about the power stat.
base | Base address for current SMC instance. |