| Kinetis SDK v.2.0 API Reference Manual Rev. 0 Freescale Semiconductor, Inc.

- Main Page
- Related Pages
- API Reference

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Files | Enumerations
SMC: System Mode Controller Driver

## Overview

The KSDK provides a Peripheral driver for the System Mode Controller (SMC) module of Kinetis devices. The SMC module is responsible for sequencing the system into and out of all low-power Stop and Run modes

API functions are provided for configuring the system working in a dedicated power mode. For different power modes, function `SMC_SetPowerModexxx` accepts different parameters. System power mode state transitions are not available for between power modes. For details about available transitions, see the Power mode transitions section in the SoC reference manual.

## Files
file | fsl_smc.h

## Enumerations
enum | smc_power_mode_protection_t { kSMC_AllowPowerModeVlp = SMC_PMPROT_AVLP_MASK, kSMC_AllowPowerModeAll }
| Power Modes Protection. More...
enum | smc_power_state_t { kSMC_PowerStateRun = 0x01U << 0U, kSMC_PowerStateStop = 0x01U << 1U, kSMC_PowerStateVlpr = 0x01U << 2U, kSMC_PowerStateVlpw = 0x01U << 3U, kSMC_PowerStateVlps = 0x01U << 4U }
| Power Modes in PMSTAT. More...
enum | smc_run_mode_t { kSMC_RunNormal = 0U, kSMC_RunVlpr = 2U }
| Run mode definition. More...
enum | smc_stop_mode_t { kSMC_StopNormal = 0U, kSMC_StopVlps = 2U }
| Stop mode definition. More...
enum | smc_partial_stop_option_t { 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...

## Driver version
#define | FSL_SMC_DRIVER_VERSION (MAKE_VERSION(2, 0, 1))
| SMC driver version 2.0.1. 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...
status_t | SMC_SetPowerModeRun (SMC_Type *base)
| Configure the system to RUN 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...

## Macro Definition Documentation

#define FSL_SMC_DRIVER_VERSION (MAKE_VERSION(2, 0, 1))

## Enumeration Type Documentation

enum smc_power_mode_protection_t

Enumerator
kSMC_AllowPowerModeVlp | Allow Very-Low-Power Mode.
kSMC_AllowPowerModeAll | Allow all power mode.

enum smc_power_state_t

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

enum smc_run_mode_t

Enumerator
kSMC_RunNormal | normal RUN mode.
kSMC_RunVlpr | Very-Low-Power RUN mode.

enum smc_stop_mode_t

Enumerator
kSMC_StopNormal | Normal STOP mode.
kSMC_StopVlps | Very-Low-Power STOP mode.

enum smc_partial_stop_option_t

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.

enum _smc_status

Enumerator
kStatus_SMC_StopAbort | Entering Stop mode is abort.

## Function Documentation

static void SMC_SetPowerModeProtection | ( | SMC_Type * | base,
|  | uint8_t | allowedModes
| ) |  |
| inline static

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

  base | SMC peripheral base address.
  allowedModes | Bitmap of the allowed power modes.

static smc_power_state_t SMC_GetPowerModeState | ( | SMC_Type * | base | ) |
| inline static

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

  base | SMC peripheral base address.

Returns
  Current power mode status.

status_t SMC_SetPowerModeRun | ( | SMC_Type * | base | ) |

Parameters

  base | SMC peripheral base address.

Returns
  SMC configuration error code.

status_t SMC_SetPowerModeWait | ( | SMC_Type * | base | ) |

Parameters

  base | SMC peripheral base address.

Returns
  SMC configuration error code.

status_t SMC_SetPowerModeStop | ( | SMC_Type * | base,
|  | smc_partial_stop_option_t | option
| ) |  |

Parameters

  base | SMC peripheral base address.
  option | Partial Stop mode option.

Returns
  SMC configuration error code.

status_t SMC_SetPowerModeVlpr | ( | SMC_Type * | base | ) |

Parameters

  base | SMC peripheral base address.

Returns
  SMC configuration error code.

status_t SMC_SetPowerModeVlpw | ( | SMC_Type * | base | ) |

Parameters

  base | SMC peripheral base address.

Returns
  SMC configuration error code.

status_t SMC_SetPowerModeVlps | ( | SMC_Type * | base | ) |

Parameters

  base | SMC peripheral base address.

Returns
  SMC configuration error code.