The MCUXpresso SDK provides a peripheral driver for the Core Mode Controller (CMC) module of MCUXpresso SDK devices. The CMC module sequences the CPU and associated logic through the different operating modes.
API function are provided to config the system for working in a dedicated power mode. For entering different power modes of different power domains, CMC_EnterLowPowerMode() function accepts different parameters. For entering the same power modes of different power domains, invoke CMC_GlobalEnterLowPowerMode() function.
|
enum | _cmc_power_mode_protection {
kCMC_AllowSleepMode = 0x1UL,
kCMC_AllowDeepSleepMode = 0x2UL,
kCMC_AllowPowerDownMode = 0x4UL,
kCMC_AllowDeepPowerDownMode = 0x8UL,
kCMC_AllowAllLowPowerModes = 0xFUL
} |
| CMC power mode Protection enumeration. More...
|
|
enum | _cmc_wakeup_sources {
kCMC_WakeupFromResetInterruptOrPowerDown,
kCMC_WakeupFromDebugReuqest = CMC_CKSTAT_WAKEUP(1U << 1U),
kCMC_WakeupFromInterrupt = CMC_CKSTAT_WAKEUP(1U << 2U),
kCMC_WakeupFromDMAWakeup = CMC_CKSTAT_WAKEUP(1U << 3U),
kCMC_WakeupFromWUURequest = CMC_CKSTAT_WAKEUP(1U << 4U),
kCMC_WakeupFromBusMaster = CMC_CKSTAT_WAKEUP(1U << 5U)
} |
| Wake up sources from the previous low power mode entry. More...
|
|
enum | _cmc_system_reset_interrupt_enable {
kCMC_PinResetInterruptEnable = CMC_SRIE_PIN_MASK,
kCMC_DAPResetInterruptEnable = CMC_SRIE_DAP_MASK,
kCMC_LowPowerAcknowledgeTimeoutResetInterruptEnable,
kCMC_Watchdog0ResetInterruptEnable = CMC_SRIE_WDOG0_MASK,
kCMC_SoftwareResetInterruptEnable = CMC_SRIE_SW_MASK,
kCMC_LockupResetInterruptEnable = CMC_SRIE_LOCKUP_MASK,
kCMC_Watchdog1ResetInterruptEnable = CMC_SRIE_WDOG1_MASK
} |
| System Reset Interrupt enable enumeration. More...
|
|
enum | _cmc_system_reset_interrupt_flag {
kCMC_PinResetInterruptFlag = CMC_SRIF_PIN_MASK,
kCMC_DAPResetInterruptFlag = CMC_SRIF_DAP_MASK,
kCMC_LowPowerAcknowledgeTimeoutResetFlag,
kCMC_Watchdog0ResetInterruptFlag = CMC_SRIF_WDOG0_MASK,
kCMC_SoftwareResetInterruptFlag = CMC_SRIF_SW_MASK,
kCMC_LockupResetInterruptFlag = CMC_SRIF_LOCKUP_MASK,
kCMC_Watchdog1ResetInterruptFlag = CMC_SRIF_WDOG1_MASK
} |
| CMC System Reset Interrupt Status flag. More...
|
|
enum | _cmc_system_sram_arrays {
kCMC_SRAMBank0 = 1U << 0U,
kCMC_SRAMBank1 = 1U << 1U,
kCMC_SRAMBank2 = 1U << 2U,
kCMC_SRAMBank3 = 1U << 3U,
kCMC_SRAMBank4 = 1U << 4U,
kCMC_SRAMBank5 = 1U << 5U,
kCMC_SRAMBank6 = 1U << 6U,
kCMC_SRAMBank7 = 1U << 7U
} |
| CMC System SRAM arrays low power mode enable enumeration. More...
|
|
enum | _cmc_system_reset_sources {
kCMC_WakeUpReset,
kCMC_PORReset = CMC_SRS_POR_MASK,
kCMC_LVDReset = CMC_SRS_LVD_MASK,
kCMC_HVDReset = CMC_SRS_HVD_MASK,
kCMC_WarmReset = CMC_SRS_WARM_MASK,
kCMC_FatalReset = CMC_SRS_FATAL_MASK,
kCMC_PinReset = CMC_SRS_PIN_MASK,
kCMC_DAPReset = CMC_SRS_DAP_MASK,
kCMC_ResetTimeout = CMC_SRS_RSTACK_MASK,
kCMC_LowPowerAcknowledgeTimeoutReset,
kCMC_SCGReset = CMC_SRS_SCG_MASK,
kCMC_Watchdog0Reset = CMC_SRS_WDOG0_MASK,
kCMC_SoftwareReset = CMC_SRS_SW_MASK,
kCMC_LockUoReset = CMC_SRS_LOCKUP_MASK,
kCMC_Watchdog1Reset = CMC_SRS_WDOG1_MASK,
kCMC_SecurityViolationReset = CMC_SRS_SECVIO_MASK
} |
| System reset sources enumeration. More...
|
|
enum | cmc_core_clock_gate_status_t {
kCMC_CoreClockNotGated = 0U,
kCMC_CoreClockGated = 1U
} |
| Indicate the core clock was gated. More...
|
|
enum | cmc_clock_mode_t {
kCMC_GateNoneClock = 0x00U,
kCMC_GateCoreClock = 0x01U,
kCMC_GateCorePlatformClock = 0x03U,
kCMC_GateAllSystemClocks = 0x07U,
kCMC_GateAllSystemClocksEnterLowPowerMode
} |
| CMC clock mode enumeration. More...
|
|
enum | cmc_low_power_mode_t {
kCMC_ActiveMode = 0x0U,
kCMC_SleepMode = 0x1U,
kCMC_DeepSleepMode = 0x3U,
kCMC_PowerDownMode = 0x7U,
kCMC_DeepPowerDown = 0xFU
} |
| CMC power mode enumeration. More...
|
|
|
void | CMC_ConfigFlashMode (CMC_Type *base, bool wake, bool doze, bool disable) |
| Configs the low power mode of the on-chip flash memory. More...
|
|
struct cmc_reset_pin_config_t |
bool cmc_reset_pin_config_t::lowpowerFilterEnable |
bool cmc_reset_pin_config_t::resetFilterEnable |
uint8_t cmc_reset_pin_config_t::resetFilterWidth |
struct cmc_power_domain_config_t |
Enumerator |
---|
kCMC_AllowSleepMode |
Allow Sleep mode.
|
kCMC_AllowDeepSleepMode |
Allow Deep Sleep mode.
|
kCMC_AllowPowerDownMode |
Allow Power Down mode.
|
kCMC_AllowDeepPowerDownMode |
Allow Deep Power Down mode.
|
kCMC_AllowAllLowPowerModes |
Allow all low power modes.
|
Enumerator |
---|
kCMC_WakeupFromResetInterruptOrPowerDown |
Wakeup source is reset interrupt, or wake up from [Deep] Power Down.
|
kCMC_WakeupFromDebugReuqest |
Wakeup source is debug request.
|
kCMC_WakeupFromInterrupt |
Wakeup source is interrupt.
|
kCMC_WakeupFromDMAWakeup |
Wakeup source is DMA Wakeup.
|
kCMC_WakeupFromWUURequest |
Wakeup source is WUU request.
|
kCMC_WakeupFromBusMaster |
Wakeup source is Bus master.
|
Enumerator |
---|
kCMC_PinResetInterruptEnable |
Pin Reset interrupt enable.
|
kCMC_DAPResetInterruptEnable |
DAP Reset interrupt enable.
|
kCMC_LowPowerAcknowledgeTimeoutResetInterruptEnable |
Low Power Acknowledge Timeout Reset interrupt enable.
|
kCMC_Watchdog0ResetInterruptEnable |
Watchdog 0 Reset interrupt enable.
|
kCMC_SoftwareResetInterruptEnable |
Software Reset interrupt enable.
|
kCMC_LockupResetInterruptEnable |
Lockup Reset interrupt enable.
|
kCMC_Watchdog1ResetInterruptEnable |
Watchdog 1 Reset interrupt enable.
|
Enumerator |
---|
kCMC_PinResetInterruptFlag |
Pin Reset interrupt flag.
|
kCMC_DAPResetInterruptFlag |
DAP Reset interrupt flag.
|
kCMC_LowPowerAcknowledgeTimeoutResetFlag |
Low Power Acknowledge Timeout Reset interrupt flag.
|
kCMC_Watchdog0ResetInterruptFlag |
Watchdog 0 Reset interrupt flag.
|
kCMC_SoftwareResetInterruptFlag |
Software Reset interrupt flag.
|
kCMC_LockupResetInterruptFlag |
Lock up Reset interrupt flag.
|
kCMC_Watchdog1ResetInterruptFlag |
Watchdog 1 Reset interrupt flag.
|
Enumerator |
---|
kCMC_SRAMBank0 |
Power off SRAM Bank0, please refer to chip's RM for the corresponding SRAM array.
|
kCMC_SRAMBank1 |
Power off SRAM Bank1, please refer to chip's RM for the corresponding SRAM array.
|
kCMC_SRAMBank2 |
Power off SRAM Bank2, please refer to chip's RM for the corresponding SRAM array.
|
kCMC_SRAMBank3 |
Power off SRAM Bank3, please refer to chip's RM for the corresponding SRAM array.
|
kCMC_SRAMBank4 |
Power off SRAM Bank4, please refer to chip's RM for the corresponding SRAM array.
|
kCMC_SRAMBank5 |
Power off SRAM Bank5, please refer to chip's RM for the corresponding SRAM array.
|
kCMC_SRAMBank6 |
Power off SRAM Bank6, please refer to chip's RM for the corresponding SRAM array.
|
kCMC_SRAMBank7 |
Power off SRAM Bank7, please refer to chip's RM for the corresponding SRAM array.
|
Enumerator |
---|
kCMC_WakeUpReset |
The reset caused by a wakeup from Power Down or Deep Power Down mode.
|
kCMC_PORReset |
The reset caused by power on reset detection logic.
|
kCMC_LVDReset |
The reset caused by a Low Voltage Detect.
|
kCMC_HVDReset |
The reset caused by a High voltage Detect.
|
kCMC_WarmReset |
The last reset source is a warm reset source.
|
kCMC_FatalReset |
The last reset source is a fatal reset source.
|
kCMC_PinReset |
The reset caused by the RESET_b pin.
|
kCMC_DAPReset |
The reset caused by a reset request from the Debug Access port.
|
kCMC_ResetTimeout |
The reset caused by a timeout or other error condition in the system reset generation.
|
kCMC_LowPowerAcknowledgeTimeoutReset |
The reset caused by a timeout in low power mode entry logic.
|
kCMC_SCGReset |
The reset caused by a loss of clock or loss of lock event in the SCG.
|
kCMC_Watchdog0Reset |
The reset caused by a WatchDog 0 timeout.
|
kCMC_SoftwareReset |
The reset caused by a software reset request.
|
kCMC_LockUoReset |
The reset caused by the ARM core indication of a LOCKUP event.
|
kCMC_Watchdog1Reset |
The reset caused by a WatchDog 1 timeout.
|
kCMC_SecurityViolationReset |
The reset caused by a Security Violation logic.
|
Enumerator |
---|
kCMC_CoreClockNotGated |
Core clock not gated.
|
kCMC_CoreClockGated |
Core clock was gated due to low power mode entry.
|
Enumerator |
---|
kCMC_GateNoneClock |
No clock gating.
|
kCMC_GateCoreClock |
Gate Core clock.
|
kCMC_GateCorePlatformClock |
Gate Core clock and platform clock.
|
kCMC_GateAllSystemClocks |
Gate all System clocks, without getting core entering into low power mode.
|
kCMC_GateAllSystemClocksEnterLowPowerMode |
Gate all System clocks, with core entering into low power mode.
|
Enumerator |
---|
kCMC_ActiveMode |
Select Active mode.
|
kCMC_SleepMode |
Select Sleep mode when a core executes WFI or WFE instruction.
|
kCMC_DeepSleepMode |
Select Deep Sleep mode when a core executes WFI or WFE instruction.
|
kCMC_PowerDownMode |
Select Power Down mode when a core executes WFI or WFE instruction.
|
kCMC_DeepPowerDown |
Select Deep Power Down mode when a core executes WFI or WFE instruction.
|
This function configs the amount of clock gating when the core asserts Sleeping due to WFI, WFE or SLEEPONEXIT.
- Parameters
-
base | CMC peripheral base address. |
mode | System clock mode. |
static void CMC_LockClockModeSetting |
( |
CMC_Type * |
base | ) |
|
|
inlinestatic |
After invoking this function, any clock mode setting will be blocked.
- Parameters
-
base | CMC peripheral base address. |
This function get the status to indicate whether the core clock is gated. The core clock gated status can be cleared by software.
- Parameters
-
base | CMC peripheral base address. |
- Returns
- The status to indicate whether the core clock is gated.
static void CMC_ClearCoreClockGatedStatus |
( |
CMC_Type * |
base | ) |
|
|
inlinestatic |
This function clear clock status flag by software.
- Parameters
-
base | CMC peripheral base address. |
static uint8_t CMC_GetWakeupSource |
( |
CMC_Type * |
base | ) |
|
|
inlinestatic |
This function gets the Wakeup sources from the previous low power mode entry.
- Parameters
-
base | CMC peripheral base address. |
- Returns
- The Wakeup sources from the previous low power mode entry. See _cmc_wakeup_sources for details.
This function gets the clock mode of the previous low power mode entry.
- Parameters
-
base | CMC peripheral base address. |
- Returns
- The Low Power status.
static uint32_t CMC_GetSystemResetStatus |
( |
CMC_Type * |
base | ) |
|
|
inlinestatic |
This function returns the system reset status. Those status updates on every MAIN Warm Reset to indicate the type/source of the most recent reset.
- Parameters
-
base | CMC peripheral base address. |
- Returns
- The most recent system reset status. See _cmc_system_reset_sources for details.
static uint32_t CMC_GetStickySystemResetStatus |
( |
CMC_Type * |
base | ) |
|
|
inlinestatic |
This function gets all source of system reset that have generated a system reset since the last WAKE Cold Reset, and that have not been cleared by software.
- Parameters
-
base | CMC peripheral base address. |
- Returns
- System reset status that have not been cleared by software. See _cmc_system_reset_sources for details.
static void CMC_ClearStickySystemResetStatus |
( |
CMC_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | CMC peripheral base address. |
mask | Bitmap of the sticky system reset status to be cleared. |
static uint8_t CMC_GetResetCount |
( |
CMC_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | CMC peripheral base address. |
- Returns
- The number of reset sequences.
void CMC_SetPowerModeProtection |
( |
CMC_Type * |
base, |
|
|
uint32_t |
allowedModes |
|
) |
| |
This function configures the power mode protection settings for supported power modes. This should be done before set the lowPower mode for each power doamin.
The allowed lowpower modes are passed as bit map. For example, to allow Sleep and DeepSleep, use CMC_SetPowerModeProtection(CMC_base, kCMC_AllowSleepMode|kCMC_AllowDeepSleepMode). To allow all low power modes, use CMC_SetPowerModeProtection(CMC_base, kCMC_AllowAllLowPowerModes).
- Parameters
-
static void CMC_LockPowerModeProtectionSetting |
( |
CMC_Type * |
base | ) |
|
|
inlinestatic |
This function locks the power mode protection. After invoking this function, any power mode protection setting will be ignored.
- Parameters
-
base | CMC peripheral base address. |
This function configures the same low power mode for MAIN power domian and WAKE power domain.
- Parameters
-
base | CMC peripheral base address. |
lowPowerMode | The desired lowPower mode. See cmc_low_power_mode_t for details. |
This function configures the low power mode for the MAIN power domian, when the core executes WFI/WFE instruction. The available lowPower modes are defined in the cmc_low_power_mode_t.
- Parameters
-
base | CMC peripheral base address. |
lowPowerMode | The desired lowPower mode. See cmc_low_power_mode_t for details. |
- Parameters
-
base | CMC peripheral base address. |
- Returns
- The power mode of MAIN Power domain. See cmc_low_power_mode_t for details.
This function configures the low power mode for the WAKE power domian, when the core executes WFI/WFE instruction. The available lowPower mode are defined in the cmc_low_power_mode_t.
- Note
- The lowPower Mode for the WAKE domain must not be configured to a lower power mode than any other power domain.
- Parameters
-
base | CMC peripheral base address. |
lowPowerMode | The desired lowPower mode. See cmc_low_power_mode_t for details. |
- Parameters
-
base | CMC peripheral base address. |
- Returns
- The power mode of WAKE Power domain. See cmc_low_power_mode_t for details.
This function configures reset pin. When enabled, the low power filter is enabled in both Active and Low power modes, the reset filter is only enabled in Active mode. When both filers are enabled, they operate in series.
- Parameters
-
base | CMC peripheral base address. |
config | Pointer to the reset pin config structure. |
static void CMC_EnableSystemResetInterrupt |
( |
CMC_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
This function enables the system reset interrupts. The assertion of non-fatal warm reset can be delayed for 258 cycles of the 32K_CLK clock while an enabled interrupt is generated. Then Software can perform a graceful shutdown or abort the non-fatal warm reset provided the pending reset source is cleared by resetting the reset source and then clearing the pending flag.
- Parameters
-
static void CMC_DisableSystemResetInterrupt |
( |
CMC_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
This function disables the system reset interrupts.
- Parameters
-
static uint32_t CMC_GetSystemResetInterruptFlags |
( |
CMC_Type * |
base | ) |
|
|
inlinestatic |
This function returns the System reset interrupt flags.
- Parameters
-
base | CMC peripheral base address. |
- Returns
- System reset interrupt flags. See _cmc_system_reset_interrupt_flag for details.
static void CMC_ClearSystemResetInterruptFlags |
( |
CMC_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
This function clears system reset interrupt flags. The pending reset source can be cleared by resetting the source of the reset and then clearing the pending flags.
- Parameters
-
static void CMC_EnableNonMaskablePinInterrupt |
( |
CMC_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | CMC peripheral base address. |
enable | Enable or disable Non maskable pin interrupt. true - enable Non-maskable pin interrupt. false - disable Non-maskable pin interupt. |
static uint8_t CMC_GetISPMODEPinLogic |
( |
CMC_Type * |
base | ) |
|
|
inlinestatic |
This function returns the logic state of the ISPMODE_n pin on the last negation of RESET_b pin.
- Parameters
-
base | CMC peripheral base address. |
- Returns
- The logic state of the ISPMODE_n pin on the last negation of RESET_b pin.
static void CMC_ClearISPMODEPinLogic |
( |
CMC_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | CMC peripheral base address. |
static void CMC_ForceBootConfiguration |
( |
CMC_Type * |
base, |
|
|
bool |
assert |
|
) |
| |
|
inlinestatic |
This function force the logic state of the Boot_Confign pin to assert on next system reset.
- Parameters
-
base | CMC peripheral base address. |
assert | Assert the corresponding pin or not. true - Assert corresponding pin on next system reset. false - No effect. |
static uint32_t CMC_GetBootRomStatus |
( |
CMC_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | CMC peripheral base address. |
- Returns
- The status information written by the BootROM.
void CMC_PowerOffSRAMAllMode |
( |
CMC_Type * |
base, |
|
|
uint8_t |
mask |
|
) |
| |
This function power off the selected system SRAM always. The SRAM arrays should not be accessed while they are shut down. SRAM array contents are not retained if they are powered off.
- Parameters
-
base | CMC peripheral base address. |
mask | Bitmap of the SRAM arrays to be powered off all modes. See _cmc_system_sram_arrays for details. Check Reference Manual for the SRAM region and mask bit relationship. |
static void CMC_PowerOnSRAMAllMode |
( |
CMC_Type * |
base, |
|
|
uint8_t |
mask |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | CMC peripheral base address. |
mask | Bitmap of the SRAM arrays to be powered on all modes. See _cmc_system_sram_arrays for details. Check Reference Manual for the SRAM region and mask bit relationship. |
void CMC_PowerOffSRAMLowPowerOnly |
( |
CMC_Type * |
base, |
|
|
uint8_t |
mask |
|
) |
| |
This function power off the selected system SRAM only during low power mode. SRAM array contents are not retained if they are power off.
- Parameters
-
base | CMC peripheral base address. |
mask | Bitmap of the SRAM arrays to be power off during low power mode only. See _cmc_system_sram_arrays for details. Check Reference Manual for the SRAM region and mask bit relationship. |
static void CMC_PowerOnSRAMLowPowerOnly |
( |
CMC_Type * |
base, |
|
|
uint8_t |
mask |
|
) |
| |
|
inlinestatic |
This function power on the selected system SRAM. The SRAM arrray contents are retained in low power modes.
- Parameters
-
base | CMC peripheral base address. |
mask | Bitmap of the SRAM arrays to be power on during low power mode only. See _cmc_system_sram_arrays for details. Check Reference Manual for the SRAM region and mask bit relationship. |
void CMC_ConfigFlashMode |
( |
CMC_Type * |
base, |
|
|
bool |
wake, |
|
|
bool |
doze, |
|
|
bool |
disable |
|
) |
| |
This function configs the low power mode of the on-chip flash memory.
- Parameters
-
base | CMC peripheral base address. |
wake | true: Flash will exit low power state during the flash memory accesses. false: No effect. |
doze | true: Flash is disabled while core is sleeping false: No effect. |
disable | true: Flash memory is placed in low power state. false: No effect. |
static void CMC_EnableDebugOperation |
( |
CMC_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
This function configs what happens to debug when core sleeps.
- Parameters
-
base | CMC peripheral base address. |
enable | Enable or disable Debug when Core is sleeping. true - Debug remains enabled when the core is sleeping. false - Debug is disabled when the core is sleeping. |
void CMC_PreEnterLowPowerMode |
( |
void |
| ) |
|
This function should be called before entering low power modes.
void CMC_PostExitLowPowerMode |
( |
void |
| ) |
|
This function provides the feature to entry into the same low power mode for each power domains. Before invoking this function, please ensure the selected power mode have been allowed.
- Parameters
-
base | CMC peripheral base address. |
lowPowerMode | The low power mode to be entered. See cmc_low_power_mode_t for the details. |
This function provides the feature to entry into different low power modes for each power domains. Before invoking this function please ensure the selected modes are allowed.
- Parameters
-