MCUXpresso SDK API Reference Manual  Rev 2.15.000
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
MSMC: Multicore System Mode Controller

Overview

The MCUXpresso SDK provides a peripheral driver for the Multicore System Mode Controller (MSMC) module of MCUXpresso SDK devices.

Typical use case

Set Core 0 from RUN to VLPR mode

Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/msmc

Set Core 0 from VLPR/HSRUN to RUN mode

Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/msmc

Typical use case

Set Core 0 from RUN to HSRUN mode

Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/msmc

Enter wait or stop modes

SMC driver provides APIs to set MCU to different wait modes and stop modes. At the same time, there are pre-function and post-function for the modes setting. The pre-function and post-function are used for:

  1. Disable/enable the interrupt through PRIMASK. In practise, there is such scenario: the application sets the wakeup interrupt and calls SMC function SMC_SetPowerModeStop to set MCU to STOP mode, but the wakeup interrupt happens so quickly that the ISR completed before the function SMC_SetPowerModeStop, as a result, the MCU enters STOP mode and never be wakeup by the interrupt. In this case, application could first disable interrupt through PRIMASK, then set the wakeup interrupt and enter STOP mode. After wakeup, the first thing is enable the interrupt through PRIMASK. The MCU could still be wakeup when disable interrupt through PRIMASK. The pre- and post- functions handle the PRIMASK inside.
/* Enable the wakeup interrupt here. */

For other use cases, please refer to the comments of the MSMC driver header file. Some example codes are also provided.

Files

file  fsl_msmc.h
 

Data Structures

struct  _smc_reset_pin_filter_config
 Reset pin filter configuration. More...
 

Typedefs

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_power_stop_entry_status 
smc_power_stop_entry_status_t
 Power Stop Entry Status 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_partial_stop_mode smc_partial_stop_option_t
 Partial STOP option.
 
typedef enum _smc_reset_source smc_reset_source_t
 System Reset Source Name definitions.
 
typedef enum _smc_interrupt_enable smc_interrupt_enable_t
 System reset interrupt enable bit definitions.
 
typedef struct
_smc_reset_pin_filter_config 
smc_reset_pin_filter_config_t
 Reset pin filter configuration.
 

Enumerations

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 = 1U,
  kSMC_PowerStateStop = 1U << 1U,
  kSMC_PowerStateVlpr = 1U << 2U,
  kSMC_PowerStateHsrun = 1U << 7U
}
 Power Modes in PMSTAT. More...
 
enum  _smc_power_stop_entry_status {
  kSMC_PowerStopEntryAlt0 = 1U,
  kSMC_PowerStopEntryAlt1 = 1U << 1,
  kSMC_PowerStopEntryAlt2 = 1U << 2,
  kSMC_PowerStopEntryAlt3 = 1U << 3,
  kSMC_PowerStopEntryAlt4 = 1U << 4,
  kSMC_PowerStopEntryAlt5 = 1U << 5
}
 Power Stop Entry Status in PMSTAT. More...
 
enum  _smc_run_mode {
  kSMC_RunNormal = 0U,
  kSMC_RunVlpr = 2U,
  kSMC_Hsrun = 3U
}
 Run mode definition. More...
 
enum  _smc_stop_mode {
  kSMC_StopNormal = 0U,
  kSMC_StopVlps = 2U,
  kSMC_StopLls = 3U,
  kSMC_StopVlls2 = 4U,
  kSMC_StopVlls0 = 6U
}
 Stop mode definition. More...
 
enum  _smc_partial_stop_mode {
  kSMC_PartialStop = 0U,
  kSMC_PartialStop1 = 1U,
  kSMC_PartialStop2 = 2U,
  kSMC_PartialStop3 = 3U
}
 Partial STOP option. More...
 
enum  { kStatus_SMC_StopAbort = MAKE_STATUS(kStatusGroup_POWER, 0) }
 SMC configuration status. More...
 
enum  _smc_reset_source {
  kSMC_SourceWakeup = SMC_SRS_WAKEUP_MASK,
  kSMC_SourcePor = SMC_SRS_POR_MASK,
  kSMC_SourceLvd = SMC_SRS_LVD_MASK,
  kSMC_SourceHvd = SMC_SRS_HVD_MASK,
  kSMC_SourceWarm = SMC_SRS_WARM_MASK,
  kSMC_SourceFatal = SMC_SRS_FATAL_MASK,
  kSMC_SourceCore,
  kSMC_SourcePin = SMC_SRS_PIN_MASK,
  kSMC_SourceMdm = SMC_SRS_MDM_MASK,
  kSMC_SourceRstAck = SMC_SRS_RSTACK_MASK,
  kSMC_SourceStopAck = SMC_SRS_STOPACK_MASK,
  kSMC_SourceScg = SMC_SRS_SCG_MASK,
  kSMC_SourceWdog = SMC_SRS_WDOG_MASK,
  kSMC_SourceSoftware = SMC_SRS_SW_MASK,
  kSMC_SourceLockup = SMC_SRS_LOCKUP_MASK,
  kSMC_SourceJtag = SMC_SRS_JTAG_MASK,
  kSMC_SourceCore0 = SMC_SRS_CORE0_MASK,
  kSMC_SourceCore1 = SMC_SRS_CORE1_MASK
}
 System Reset Source Name definitions. More...
 
enum  _smc_interrupt_enable {
  kSMC_IntNone = 0U,
  kSMC_IntPin = SMC_SRIE_PIN_MASK,
  kSMC_IntMdm = SMC_SRIE_MDM_MASK,
  kSMC_IntStopAck = SMC_SRIE_STOPACK_MASK,
  kSMC_IntWdog = SMC_SRIE_WDOG_MASK,
  kSMC_IntSoftware = SMC_SRIE_SW_MASK,
  kSMC_IntLockup = SMC_SRIE_LOCKUP_MASK ,
  kSMC_IntCore1 = SMC_SRIE_CORE1_MASK,
  kSMC_IntAll
}
 System reset interrupt enable bit definitions. More...
 

Driver version

#define FSL_MSMC_DRIVER_VERSION   (MAKE_VERSION(2, 1, 2))
 MSMC driver version. More...
 

System mode controller APIs

static void SMC_SetPowerModeProtection (SMC_Type *base, uint8_t allowedModes)
 Configures all power mode protection settings. More...
 
static smc_power_state_t SMC_GetPowerModeState (SMC_Type *base)
 Gets the current power mode status. More...
 
static void SMC_PreEnterStopModes (void)
 Prepare to enter stop modes. More...
 
static void SMC_PostExitStopModes (void)
 Recovering after wake up from stop modes. More...
 
static void SMC_PreEnterWaitModes (void)
 Prepare to enter wait modes. More...
 
static void SMC_PostExitWaitModes (void)
 Recovering after wake up from stop modes. More...
 
status_t SMC_SetPowerModeRun (SMC_Type *base)
 Configure the system to RUN power mode. More...
 
status_t SMC_SetPowerModeHsrun (SMC_Type *base)
 Configure the system to HSRUN power mode. More...
 
status_t SMC_SetPowerModeWait (SMC_Type *base)
 Configure the system to WAIT power mode. More...
 
status_t SMC_SetPowerModeStop (SMC_Type *base, smc_partial_stop_option_t option)
 Configure the system to Stop power mode. More...
 
status_t SMC_SetPowerModeVlpr (SMC_Type *base)
 Configure the system to VLPR power mode. More...
 
status_t SMC_SetPowerModeVlpw (SMC_Type *base)
 Configure the system to VLPW power mode. More...
 
status_t SMC_SetPowerModeVlps (SMC_Type *base)
 Configure the system to VLPS power mode. More...
 
status_t SMC_SetPowerModeLls (SMC_Type *base)
 Configure the system to LLS power mode. More...
 
status_t SMC_SetPowerModeVlls0 (SMC_Type *base)
 Configure the system to VLLS0 power mode. More...
 
status_t SMC_SetPowerModeVlls2 (SMC_Type *base)
 Configure the system to VLLS2 power mode. More...
 
static uint32_t SMC_GetPreviousResetSources (SMC_Type *base)
 Gets the reset source status which caused a previous reset. More...
 
static uint32_t SMC_GetStickyResetSources (SMC_Type *base)
 Gets the sticky reset source status. More...
 
static void SMC_ClearStickyResetSources (SMC_Type *base, uint32_t sourceMasks)
 Clears the sticky reset source status. More...
 
void SMC_ConfigureResetPinFilter (SMC_Type *base, const smc_reset_pin_filter_config_t *config)
 Configures the reset pin filter. More...
 
static void SMC_SetSystemResetInterruptConfig (SMC_Type *base, uint32_t intMask)
 Sets the system reset interrupt configuration. More...
 
static uint32_t SMC_GetResetInterruptSourcesStatus (SMC_Type *base)
 Gets the source status of the system reset interrupt. More...
 
static void SMC_ClearResetInterruptSourcesStatus (SMC_Type *base, uint32_t intMask)
 Clears the source status of the system reset interrupt. More...
 
static uint32_t SMC_GetBootOptionConfig (SMC_Type *base)
 Gets the boot option configuration. More...
 

Data Structure Documentation

struct _smc_reset_pin_filter_config

Data Fields

uint8_t slowClockFilterCount
 Reset pin bus clock filter width from 1 to 32 slow clock cycles. More...
 
bool enableFilter
 Reset pin filter enable/disable. More...
 

Field Documentation

uint8_t _smc_reset_pin_filter_config::slowClockFilterCount
bool _smc_reset_pin_filter_config::enableFilter

Macro Definition Documentation

#define FSL_MSMC_DRIVER_VERSION   (MAKE_VERSION(2, 1, 2))

Enumeration Type Documentation

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.

Enumerator
kSMC_PowerStateRun 

0000_0001 - Current power mode is RUN

kSMC_PowerStateStop 

0000_0010 - Current power mode is any STOP mode

kSMC_PowerStateVlpr 

0000_0100 - Current power mode is VLPR

kSMC_PowerStateHsrun 

1000_0000 - Current power mode is HSRUN

Enumerator
kSMC_PowerStopEntryAlt0 

Indicates a Stop mode entry since this field was last cleared.

kSMC_PowerStopEntryAlt1 

Indicates the system bus masters acknowledged the Stop mode entry.

kSMC_PowerStopEntryAlt2 

Indicates the system clock peripherals acknowledged the Stop mode entry.

kSMC_PowerStopEntryAlt3 

Indicates the bus clock peripherals acknowledged the Stop mode entry.

kSMC_PowerStopEntryAlt4 

Indicates the slow clock peripherals acknowledged the Stop mode entry.

kSMC_PowerStopEntryAlt5 

Indicates Stop mode entry completed.

Enumerator
kSMC_RunNormal 

normal RUN mode.

kSMC_RunVlpr 

Very-Low-Power RUN mode.

kSMC_Hsrun 

High Speed Run mode (HSRUN).

Enumerator
kSMC_StopNormal 

Normal STOP mode.

kSMC_StopVlps 

Very-Low-Power STOP mode.

kSMC_StopLls 

Low-Leakage Stop mode.

kSMC_StopVlls2 

Very-Low-Leakage Stop mode, VLPS2/3.

kSMC_StopVlls0 

Very-Low-Leakage Stop mode, VLPS0/1.

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.

kSMC_PartialStop3 

Partial Stop with system clock enabled and bus clock disabled.

anonymous enum
Enumerator
kStatus_SMC_StopAbort 

Entering Stop mode is abort.

Enumerator
kSMC_SourceWakeup 

Very low-leakage wakeup reset.

kSMC_SourcePor 

Power on reset.

kSMC_SourceLvd 

Low-voltage detect reset.

kSMC_SourceHvd 

High-voltage detect reset.

kSMC_SourceWarm 

Warm reset.

Warm Reset flag will assert if any of the system reset sources in this register assert (SRS[31:8])

kSMC_SourceFatal 

Fatal reset.

kSMC_SourceCore 

Software reset that only reset the core, NOT a sticky system reset source.

kSMC_SourcePin 

RESET_B pin reset.

kSMC_SourceMdm 

MDM reset.

kSMC_SourceRstAck 

Reset Controller timeout reset.

kSMC_SourceStopAck 

Stop timeout reset.

kSMC_SourceScg 

SCG loss of lock or loss of clock.

kSMC_SourceWdog 

Watchdog reset.

kSMC_SourceSoftware 

Software reset.

kSMC_SourceLockup 

Lockup reset.

Core lockup or exception.

kSMC_SourceJtag 

JTAG system reset.

kSMC_SourceCore0 

Core0 System Reset.

kSMC_SourceCore1 

Core1 System Reset.

Enumerator
kSMC_IntNone 

No interrupt enabled.

kSMC_IntPin 

Pin reset interrupt.

kSMC_IntMdm 

MDM reset interrupt.

kSMC_IntStopAck 

Stop timeout reset interrupt.

kSMC_IntWdog 

Watchdog interrupt.

kSMC_IntSoftware 

Software reset interrupts.

kSMC_IntLockup 

Lock up interrupt.

kSMC_IntCore1 

Core 0 interrupts.

kSMC_IntAll 

Core 1 interrupts.

All system reset interrupts.

Function Documentation

static void SMC_SetPowerModeProtection ( SMC_Type *  base,
uint8_t  allowedModes 
)
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 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_AllowPowerModeLls | kSMC_AllowPowerModeVlls). To allow all modes, use SMC_SetPowerModeProtection(kSMC_AllowPowerModeAll).

Parameters
baseSMC peripheral base address.
allowedModesBitmap of the allowed power modes.
static smc_power_state_t SMC_GetPowerModeState ( SMC_Type *  base)
inlinestatic

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 smc_power_state_t for information about the power stat.

Parameters
baseSMC peripheral base address.
Returns
Current power mode status.
static void SMC_PreEnterStopModes ( void  )
inlinestatic

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

static void SMC_PostExitStopModes ( void  )
inlinestatic

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

static void SMC_PreEnterWaitModes ( void  )
inlinestatic

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

static void SMC_PostExitWaitModes ( void  )
inlinestatic

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

status_t SMC_SetPowerModeRun ( SMC_Type *  base)
Parameters
baseSMC peripheral base address.
Returns
SMC configuration error code.
status_t SMC_SetPowerModeHsrun ( SMC_Type *  base)
Parameters
baseSMC peripheral base address.
Returns
SMC configuration error code.
status_t SMC_SetPowerModeWait ( SMC_Type *  base)
Parameters
baseSMC peripheral base address.
Returns
SMC configuration error code.
status_t SMC_SetPowerModeStop ( SMC_Type *  base,
smc_partial_stop_option_t  option 
)
Parameters
baseSMC peripheral base address.
optionPartial Stop mode option.
Returns
SMC configuration error code.
status_t SMC_SetPowerModeVlpr ( SMC_Type *  base)
Parameters
baseSMC peripheral base address.
Returns
SMC configuration error code.
status_t SMC_SetPowerModeVlpw ( SMC_Type *  base)
Parameters
baseSMC peripheral base address.
Returns
SMC configuration error code.
status_t SMC_SetPowerModeVlps ( SMC_Type *  base)
Parameters
baseSMC peripheral base address.
Returns
SMC configuration error code.
status_t SMC_SetPowerModeLls ( SMC_Type *  base)
Parameters
baseSMC peripheral base address.
Returns
SMC configuration error code.
status_t SMC_SetPowerModeVlls0 ( SMC_Type *  base)
Parameters
baseSMC peripheral base address.
Returns
SMC configuration error code.
status_t SMC_SetPowerModeVlls2 ( SMC_Type *  base)
Parameters
baseSMC peripheral base address.
Returns
SMC configuration error code.
static uint32_t SMC_GetPreviousResetSources ( SMC_Type *  base)
inlinestatic

This function gets the current reset source status. Use source masks defined in the smc_reset_source_t to get the desired source status.

Example: To get all reset source statuses.

resetStatus = SMC_GetPreviousResetSources(SMC0) & kSMC_SourceAll;

Example: To test whether the MCU is reset using Watchdog.

uint32_t resetStatus;

Example: To test multiple reset sources.

uint32_t resetStatus;
Parameters
baseSMC peripheral base address.
Returns
All reset source status bit map.
static uint32_t SMC_GetStickyResetSources ( SMC_Type *  base)
inlinestatic

This function gets the current reset source status that has not been cleared by software for some specific source.

Example: To get all reset source statuses.

uint32_t resetStatus;
resetStatus = SMC_GetStickyResetSources(SMC0) & kSMC_SourceAll;

Example, To test whether the MCU is reset using Watchdog.

uint32_t resetStatus;

Example To test multiple reset sources.

uint32_t resetStatus;
Parameters
baseSMC peripheral base address.
Returns
All reset source status bit map.
static void SMC_ClearStickyResetSources ( SMC_Type *  base,
uint32_t  sourceMasks 
)
inlinestatic

This function clears the sticky system reset flags indicated by source masks.

Example: Clears multiple reset sources.

Parameters
baseSMC peripheral base address.
sourceMasksreset source status bit map
void SMC_ConfigureResetPinFilter ( SMC_Type *  base,
const smc_reset_pin_filter_config_t config 
)

This function sets the reset pin filter including the enablement/disablement and filter width.

Parameters
baseSMC peripheral base address.
configPointer to the configuration structure.
static void SMC_SetSystemResetInterruptConfig ( SMC_Type *  base,
uint32_t  intMask 
)
inlinestatic

For a graceful shut down, the MSMC supports delaying the assertion of the system reset for a period of time when the reset interrupt is generated. This function can be used to enable the interrupt. The interrupts are passed in as bit mask. See smc_interrupt_enable_t for details. For example, to delay a reset after the WDOG timeout or PIN reset occurs, configure as follows: SMC_SetSystemResetInterruptConfig(SMC0, (kSMC_IntWdog | kSMC_IntPin));

Parameters
baseSMC peripheral base address.
intMaskBit mask of the system reset interrupts to enable. See smc_interrupt_enable_t for details.
static uint32_t SMC_GetResetInterruptSourcesStatus ( SMC_Type *  base)
inlinestatic

This function gets the source status of the reset interrupt. Use source masks defined in the smc_interrupt_enable_t to get the desired source status.

Example: To get all reset interrupt source statuses.

uint32_t interruptStatus;

Example: To test whether the reset interrupt of Watchdog is pending.

uint32_t interruptStatus;

Example: To test multiple reset interrupt sources.

uint32_t interruptStatus;
Parameters
baseSMC peripheral base address.
Returns
All reset interrupt source status bit map.
static void SMC_ClearResetInterruptSourcesStatus ( SMC_Type *  base,
uint32_t  intMask 
)
inlinestatic

This function clears the source status of the reset interrupt. Use source masks defined in the smc_interrupt_enable_t to get the desired source status.

Example: To clear all reset interrupt source statuses.

uint32_t interruptStatus;
MMC_ClearResetInterruptSourcesStatus(SMC0, kSMC_IntAll);

Example, To clear the reset interrupt of Watchdog.

uint32_t interruptStatus;

Example, To clear multiple reset interrupt sources status.

uint32_t interruptStatus;
Parameters
baseSMC peripheral base address.
intMaskAll reset interrupt source status bit map to clear.
static uint32_t SMC_GetBootOptionConfig ( SMC_Type *  base)
inlinestatic

This function gets the boot option configuration of MSMC.

Parameters
baseSMC peripheral base address.
Returns
The boot option configuration. 1 means boot option enabled. 0 means not.