The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
171:3a7713b1edbc
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 171:3a7713b1edbc 1 /*
AnnaBridge 171:3a7713b1edbc 2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
AnnaBridge 171:3a7713b1edbc 3 * All rights reserved.
AnnaBridge 171:3a7713b1edbc 4 *
AnnaBridge 171:3a7713b1edbc 5 * Redistribution and use in source and binary forms, with or without modification,
AnnaBridge 171:3a7713b1edbc 6 * are permitted provided that the following conditions are met:
AnnaBridge 171:3a7713b1edbc 7 *
AnnaBridge 171:3a7713b1edbc 8 * o Redistributions of source code must retain the above copyright notice, this list
AnnaBridge 171:3a7713b1edbc 9 * of conditions and the following disclaimer.
AnnaBridge 171:3a7713b1edbc 10 *
AnnaBridge 171:3a7713b1edbc 11 * o Redistributions in binary form must reproduce the above copyright notice, this
AnnaBridge 171:3a7713b1edbc 12 * list of conditions and the following disclaimer in the documentation and/or
AnnaBridge 171:3a7713b1edbc 13 * other materials provided with the distribution.
AnnaBridge 171:3a7713b1edbc 14 *
AnnaBridge 171:3a7713b1edbc 15 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
AnnaBridge 171:3a7713b1edbc 16 * contributors may be used to endorse or promote products derived from this
AnnaBridge 171:3a7713b1edbc 17 * software without specific prior written permission.
AnnaBridge 171:3a7713b1edbc 18 *
AnnaBridge 171:3a7713b1edbc 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
AnnaBridge 171:3a7713b1edbc 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
AnnaBridge 171:3a7713b1edbc 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
AnnaBridge 171:3a7713b1edbc 22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
AnnaBridge 171:3a7713b1edbc 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
AnnaBridge 171:3a7713b1edbc 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
AnnaBridge 171:3a7713b1edbc 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
AnnaBridge 171:3a7713b1edbc 26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
AnnaBridge 171:3a7713b1edbc 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
AnnaBridge 171:3a7713b1edbc 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AnnaBridge 171:3a7713b1edbc 29 */
AnnaBridge 171:3a7713b1edbc 30
AnnaBridge 171:3a7713b1edbc 31 #ifndef _FSL_SMC_H_
AnnaBridge 171:3a7713b1edbc 32 #define _FSL_SMC_H_
AnnaBridge 171:3a7713b1edbc 33
AnnaBridge 171:3a7713b1edbc 34 #include "fsl_common.h"
AnnaBridge 171:3a7713b1edbc 35
AnnaBridge 171:3a7713b1edbc 36 /*! @addtogroup smc */
AnnaBridge 171:3a7713b1edbc 37 /*! @{ */
AnnaBridge 171:3a7713b1edbc 38
AnnaBridge 171:3a7713b1edbc 39 /*! @file */
AnnaBridge 171:3a7713b1edbc 40
AnnaBridge 171:3a7713b1edbc 41 /*******************************************************************************
AnnaBridge 171:3a7713b1edbc 42 * Definitions
AnnaBridge 171:3a7713b1edbc 43 ******************************************************************************/
AnnaBridge 171:3a7713b1edbc 44
AnnaBridge 171:3a7713b1edbc 45 /*! @name Driver version */
AnnaBridge 171:3a7713b1edbc 46 /*@{*/
AnnaBridge 171:3a7713b1edbc 47 /*! @brief SMC driver version 2.0.1. */
AnnaBridge 171:3a7713b1edbc 48 #define FSL_SMC_DRIVER_VERSION (MAKE_VERSION(2, 0, 1))
AnnaBridge 171:3a7713b1edbc 49 /*@}*/
AnnaBridge 171:3a7713b1edbc 50
AnnaBridge 171:3a7713b1edbc 51 /*!
AnnaBridge 171:3a7713b1edbc 52 * @brief Power Modes Protection
AnnaBridge 171:3a7713b1edbc 53 */
AnnaBridge 171:3a7713b1edbc 54 typedef enum _smc_power_mode_protection
AnnaBridge 171:3a7713b1edbc 55 {
AnnaBridge 171:3a7713b1edbc 56 #if (defined(FSL_FEATURE_SMC_HAS_VERY_LOW_LEAKAGE_STOP_MODE) && FSL_FEATURE_SMC_HAS_VERY_LOW_LEAKAGE_STOP_MODE)
AnnaBridge 171:3a7713b1edbc 57 kSMC_AllowPowerModeVlls = SMC_PMPROT_AVLLS_MASK, /*!< Allow Very-Low-Leakage Stop Mode. */
AnnaBridge 171:3a7713b1edbc 58 #endif
AnnaBridge 171:3a7713b1edbc 59 #if (defined(FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE) && FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE)
AnnaBridge 171:3a7713b1edbc 60 kSMC_AllowPowerModeLls = SMC_PMPROT_ALLS_MASK, /*!< Allow Low-Leakage Stop Mode. */
AnnaBridge 171:3a7713b1edbc 61 #endif /* FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE */
AnnaBridge 171:3a7713b1edbc 62 kSMC_AllowPowerModeVlp = SMC_PMPROT_AVLP_MASK, /*!< Allow Very-Low-Power Mode. */
AnnaBridge 171:3a7713b1edbc 63 #if (defined(FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE) && FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE)
AnnaBridge 171:3a7713b1edbc 64 kSMC_AllowPowerModeHsrun = SMC_PMPROT_AHSRUN_MASK, /*!< Allow High Speed Run mode. */
AnnaBridge 171:3a7713b1edbc 65 #endif /* FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE */
AnnaBridge 171:3a7713b1edbc 66 kSMC_AllowPowerModeAll = (0U
AnnaBridge 171:3a7713b1edbc 67 #if (defined(FSL_FEATURE_SMC_HAS_VERY_LOW_LEAKAGE_STOP_MODE) && FSL_FEATURE_SMC_HAS_VERY_LOW_LEAKAGE_STOP_MODE)
AnnaBridge 171:3a7713b1edbc 68 |
AnnaBridge 171:3a7713b1edbc 69 SMC_PMPROT_AVLLS_MASK
AnnaBridge 171:3a7713b1edbc 70 #endif
AnnaBridge 171:3a7713b1edbc 71 #if (defined(FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE) && FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE)
AnnaBridge 171:3a7713b1edbc 72 |
AnnaBridge 171:3a7713b1edbc 73 SMC_PMPROT_ALLS_MASK
AnnaBridge 171:3a7713b1edbc 74 #endif /* FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE */
AnnaBridge 171:3a7713b1edbc 75 |
AnnaBridge 171:3a7713b1edbc 76 SMC_PMPROT_AVLP_MASK
AnnaBridge 171:3a7713b1edbc 77 #if (defined(FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE) && FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE)
AnnaBridge 171:3a7713b1edbc 78 |
AnnaBridge 171:3a7713b1edbc 79 kSMC_AllowPowerModeHsrun
AnnaBridge 171:3a7713b1edbc 80 #endif /* FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE */
AnnaBridge 171:3a7713b1edbc 81 ) /*!< Allow all power mode. */
AnnaBridge 171:3a7713b1edbc 82 } smc_power_mode_protection_t;
AnnaBridge 171:3a7713b1edbc 83
AnnaBridge 171:3a7713b1edbc 84 /*!
AnnaBridge 171:3a7713b1edbc 85 * @brief Power Modes in PMSTAT
AnnaBridge 171:3a7713b1edbc 86 */
AnnaBridge 171:3a7713b1edbc 87 typedef enum _smc_power_state
AnnaBridge 171:3a7713b1edbc 88 {
AnnaBridge 171:3a7713b1edbc 89 kSMC_PowerStateRun = 0x01U << 0U, /*!< 0000_0001 - Current power mode is RUN */
AnnaBridge 171:3a7713b1edbc 90 kSMC_PowerStateStop = 0x01U << 1U, /*!< 0000_0010 - Current power mode is STOP */
AnnaBridge 171:3a7713b1edbc 91 kSMC_PowerStateVlpr = 0x01U << 2U, /*!< 0000_0100 - Current power mode is VLPR */
AnnaBridge 171:3a7713b1edbc 92 kSMC_PowerStateVlpw = 0x01U << 3U, /*!< 0000_1000 - Current power mode is VLPW */
AnnaBridge 171:3a7713b1edbc 93 kSMC_PowerStateVlps = 0x01U << 4U, /*!< 0001_0000 - Current power mode is VLPS */
AnnaBridge 171:3a7713b1edbc 94 #if (defined(FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE) && FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE)
AnnaBridge 171:3a7713b1edbc 95 kSMC_PowerStateLls = 0x01U << 5U, /*!< 0010_0000 - Current power mode is LLS */
AnnaBridge 171:3a7713b1edbc 96 #endif /* FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE */
AnnaBridge 171:3a7713b1edbc 97 #if (defined(FSL_FEATURE_SMC_HAS_VERY_LOW_LEAKAGE_STOP_MODE) && FSL_FEATURE_SMC_HAS_VERY_LOW_LEAKAGE_STOP_MODE)
AnnaBridge 171:3a7713b1edbc 98 kSMC_PowerStateVlls = 0x01U << 6U, /*!< 0100_0000 - Current power mode is VLLS */
AnnaBridge 171:3a7713b1edbc 99 #endif
AnnaBridge 171:3a7713b1edbc 100 #if (defined(FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE) && FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE)
AnnaBridge 171:3a7713b1edbc 101 kSMC_PowerStateHsrun = 0x01U << 7U /*!< 1000_0000 - Current power mode is HSRUN */
AnnaBridge 171:3a7713b1edbc 102 #endif /* FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE */
AnnaBridge 171:3a7713b1edbc 103 } smc_power_state_t;
AnnaBridge 171:3a7713b1edbc 104
AnnaBridge 171:3a7713b1edbc 105 /*!
AnnaBridge 171:3a7713b1edbc 106 * @brief Run mode definition
AnnaBridge 171:3a7713b1edbc 107 */
AnnaBridge 171:3a7713b1edbc 108 typedef enum _smc_run_mode
AnnaBridge 171:3a7713b1edbc 109 {
AnnaBridge 171:3a7713b1edbc 110 kSMC_RunNormal = 0U, /*!< normal RUN mode. */
AnnaBridge 171:3a7713b1edbc 111 kSMC_RunVlpr = 2U, /*!< Very-Low-Power RUN mode. */
AnnaBridge 171:3a7713b1edbc 112 #if (defined(FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE) && FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE)
AnnaBridge 171:3a7713b1edbc 113 kSMC_Hsrun = 3U /*!< High Speed Run mode (HSRUN). */
AnnaBridge 171:3a7713b1edbc 114 #endif /* FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE */
AnnaBridge 171:3a7713b1edbc 115 } smc_run_mode_t;
AnnaBridge 171:3a7713b1edbc 116
AnnaBridge 171:3a7713b1edbc 117 /*!
AnnaBridge 171:3a7713b1edbc 118 * @brief Stop mode definition
AnnaBridge 171:3a7713b1edbc 119 */
AnnaBridge 171:3a7713b1edbc 120 typedef enum _smc_stop_mode
AnnaBridge 171:3a7713b1edbc 121 {
AnnaBridge 171:3a7713b1edbc 122 kSMC_StopNormal = 0U, /*!< Normal STOP mode. */
AnnaBridge 171:3a7713b1edbc 123 kSMC_StopVlps = 2U, /*!< Very-Low-Power STOP mode. */
AnnaBridge 171:3a7713b1edbc 124 #if (defined(FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE) && FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE)
AnnaBridge 171:3a7713b1edbc 125 kSMC_StopLls = 3U, /*!< Low-Leakage Stop mode. */
AnnaBridge 171:3a7713b1edbc 126 #endif /* FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE */
AnnaBridge 171:3a7713b1edbc 127 #if (defined(FSL_FEATURE_SMC_HAS_VERY_LOW_LEAKAGE_STOP_MODE) && FSL_FEATURE_SMC_HAS_VERY_LOW_LEAKAGE_STOP_MODE)
AnnaBridge 171:3a7713b1edbc 128 kSMC_StopVlls = 4U /*!< Very-Low-Leakage Stop mode. */
AnnaBridge 171:3a7713b1edbc 129 #endif
AnnaBridge 171:3a7713b1edbc 130 } smc_stop_mode_t;
AnnaBridge 171:3a7713b1edbc 131
AnnaBridge 171:3a7713b1edbc 132 #if (defined(FSL_FEATURE_SMC_USE_VLLSCTRL_REG) && FSL_FEATURE_SMC_USE_VLLSCTRL_REG) || \
AnnaBridge 171:3a7713b1edbc 133 (defined(FSL_FEATURE_SMC_USE_STOPCTRL_VLLSM) && FSL_FEATURE_SMC_USE_STOPCTRL_VLLSM) || \
AnnaBridge 171:3a7713b1edbc 134 (defined(FSL_FEATURE_SMC_HAS_LLS_SUBMODE) && FSL_FEATURE_SMC_HAS_LLS_SUBMODE)
AnnaBridge 171:3a7713b1edbc 135 /*!
AnnaBridge 171:3a7713b1edbc 136 * @brief VLLS/LLS stop sub mode definition
AnnaBridge 171:3a7713b1edbc 137 */
AnnaBridge 171:3a7713b1edbc 138 typedef enum _smc_stop_submode
AnnaBridge 171:3a7713b1edbc 139 {
AnnaBridge 171:3a7713b1edbc 140 kSMC_StopSub0 = 0U, /*!< Stop submode 0, for VLLS0/LLS0. */
AnnaBridge 171:3a7713b1edbc 141 kSMC_StopSub1 = 1U, /*!< Stop submode 1, for VLLS1/LLS1. */
AnnaBridge 171:3a7713b1edbc 142 kSMC_StopSub2 = 2U, /*!< Stop submode 2, for VLLS2/LLS2. */
AnnaBridge 171:3a7713b1edbc 143 kSMC_StopSub3 = 3U /*!< Stop submode 3, for VLLS3/LLS3. */
AnnaBridge 171:3a7713b1edbc 144 } smc_stop_submode_t;
AnnaBridge 171:3a7713b1edbc 145 #endif
AnnaBridge 171:3a7713b1edbc 146
AnnaBridge 171:3a7713b1edbc 147 /*!
AnnaBridge 171:3a7713b1edbc 148 * @brief Partial STOP option
AnnaBridge 171:3a7713b1edbc 149 */
AnnaBridge 171:3a7713b1edbc 150 typedef enum _smc_partial_stop_mode
AnnaBridge 171:3a7713b1edbc 151 {
AnnaBridge 171:3a7713b1edbc 152 kSMC_PartialStop = 0U, /*!< STOP - Normal Stop mode*/
AnnaBridge 171:3a7713b1edbc 153 kSMC_PartialStop1 = 1U, /*!< Partial Stop with both system and bus clocks disabled*/
AnnaBridge 171:3a7713b1edbc 154 kSMC_PartialStop2 = 2U, /*!< Partial Stop with system clock disabled and bus clock enabled*/
AnnaBridge 171:3a7713b1edbc 155 } smc_partial_stop_option_t;
AnnaBridge 171:3a7713b1edbc 156
AnnaBridge 171:3a7713b1edbc 157 /*!
AnnaBridge 171:3a7713b1edbc 158 * @brief SMC configuration status
AnnaBridge 171:3a7713b1edbc 159 */
AnnaBridge 171:3a7713b1edbc 160 enum _smc_status
AnnaBridge 171:3a7713b1edbc 161 {
AnnaBridge 171:3a7713b1edbc 162 kStatus_SMC_StopAbort = MAKE_STATUS(kStatusGroup_POWER, 0) /*!< Entering Stop mode is abort*/
AnnaBridge 171:3a7713b1edbc 163 };
AnnaBridge 171:3a7713b1edbc 164
AnnaBridge 171:3a7713b1edbc 165 #if (defined(FSL_FEATURE_SMC_HAS_VERID) && FSL_FEATURE_SMC_HAS_VERID)
AnnaBridge 171:3a7713b1edbc 166 /*!
AnnaBridge 171:3a7713b1edbc 167 * @brief IP version ID definition.
AnnaBridge 171:3a7713b1edbc 168 */
AnnaBridge 171:3a7713b1edbc 169 typedef struct _smc_version_id
AnnaBridge 171:3a7713b1edbc 170 {
AnnaBridge 171:3a7713b1edbc 171 uint16_t feature; /*!< Feature Specification Number. */
AnnaBridge 171:3a7713b1edbc 172 uint8_t minor; /*!< Minor version number. */
AnnaBridge 171:3a7713b1edbc 173 uint8_t major; /*!< Major version number. */
AnnaBridge 171:3a7713b1edbc 174 } smc_version_id_t;
AnnaBridge 171:3a7713b1edbc 175 #endif /* FSL_FEATURE_SMC_HAS_VERID */
AnnaBridge 171:3a7713b1edbc 176
AnnaBridge 171:3a7713b1edbc 177 #if (defined(FSL_FEATURE_SMC_HAS_PARAM) && FSL_FEATURE_SMC_HAS_PARAM)
AnnaBridge 171:3a7713b1edbc 178 /*!
AnnaBridge 171:3a7713b1edbc 179 * @brief IP parameter definition.
AnnaBridge 171:3a7713b1edbc 180 */
AnnaBridge 171:3a7713b1edbc 181 typedef struct _smc_param
AnnaBridge 171:3a7713b1edbc 182 {
AnnaBridge 171:3a7713b1edbc 183 bool hsrunEnable; /*!< HSRUN mode enable. */
AnnaBridge 171:3a7713b1edbc 184 bool llsEnable; /*!< LLS mode enable. */
AnnaBridge 171:3a7713b1edbc 185 bool lls2Enable; /*!< LLS2 mode enable. */
AnnaBridge 171:3a7713b1edbc 186 bool vlls0Enable; /*!< VLLS0 mode enable. */
AnnaBridge 171:3a7713b1edbc 187 } smc_param_t;
AnnaBridge 171:3a7713b1edbc 188 #endif /* FSL_FEATURE_SMC_HAS_PARAM */
AnnaBridge 171:3a7713b1edbc 189
AnnaBridge 171:3a7713b1edbc 190 #if (defined(FSL_FEATURE_SMC_HAS_LLS_SUBMODE) && FSL_FEATURE_SMC_HAS_LLS_SUBMODE) || \
AnnaBridge 171:3a7713b1edbc 191 (defined(FSL_FEATURE_SMC_HAS_LPOPO) && FSL_FEATURE_SMC_HAS_LPOPO)
AnnaBridge 171:3a7713b1edbc 192 /*!
AnnaBridge 171:3a7713b1edbc 193 * @brief SMC Low-Leakage Stop power mode config
AnnaBridge 171:3a7713b1edbc 194 */
AnnaBridge 171:3a7713b1edbc 195 typedef struct _smc_power_mode_lls_config
AnnaBridge 171:3a7713b1edbc 196 {
AnnaBridge 171:3a7713b1edbc 197 #if (defined(FSL_FEATURE_SMC_HAS_LLS_SUBMODE) && FSL_FEATURE_SMC_HAS_LLS_SUBMODE)
AnnaBridge 171:3a7713b1edbc 198 smc_stop_submode_t subMode; /*!< Low-leakage Stop sub-mode */
AnnaBridge 171:3a7713b1edbc 199 #endif
AnnaBridge 171:3a7713b1edbc 200 #if (defined(FSL_FEATURE_SMC_HAS_LPOPO) && FSL_FEATURE_SMC_HAS_LPOPO)
AnnaBridge 171:3a7713b1edbc 201 bool enableLpoClock; /*!< Enable LPO clock in LLS mode */
AnnaBridge 171:3a7713b1edbc 202 #endif
AnnaBridge 171:3a7713b1edbc 203 } smc_power_mode_lls_config_t;
AnnaBridge 171:3a7713b1edbc 204 #endif /* (FSL_FEATURE_SMC_HAS_LLS_SUBMODE || FSL_FEATURE_SMC_HAS_LPOPO) */
AnnaBridge 171:3a7713b1edbc 205
AnnaBridge 171:3a7713b1edbc 206 #if (defined(FSL_FEATURE_SMC_HAS_VERY_LOW_LEAKAGE_STOP_MODE) && FSL_FEATURE_SMC_HAS_VERY_LOW_LEAKAGE_STOP_MODE)
AnnaBridge 171:3a7713b1edbc 207 /*!
AnnaBridge 171:3a7713b1edbc 208 * @brief SMC Very Low-Leakage Stop power mode config
AnnaBridge 171:3a7713b1edbc 209 */
AnnaBridge 171:3a7713b1edbc 210 typedef struct _smc_power_mode_vlls_config
AnnaBridge 171:3a7713b1edbc 211 {
AnnaBridge 171:3a7713b1edbc 212 #if (defined(FSL_FEATURE_SMC_USE_VLLSCTRL_REG) && FSL_FEATURE_SMC_USE_VLLSCTRL_REG) || \
AnnaBridge 171:3a7713b1edbc 213 (defined(FSL_FEATURE_SMC_USE_STOPCTRL_VLLSM) && FSL_FEATURE_SMC_USE_STOPCTRL_VLLSM) || \
AnnaBridge 171:3a7713b1edbc 214 (defined(FSL_FEATURE_SMC_HAS_LLS_SUBMODE) && FSL_FEATURE_SMC_HAS_LLS_SUBMODE)
AnnaBridge 171:3a7713b1edbc 215 smc_stop_submode_t subMode; /*!< Very Low-leakage Stop sub-mode */
AnnaBridge 171:3a7713b1edbc 216 #endif
AnnaBridge 171:3a7713b1edbc 217 #if (defined(FSL_FEATURE_SMC_HAS_PORPO) && FSL_FEATURE_SMC_HAS_PORPO)
AnnaBridge 171:3a7713b1edbc 218 bool enablePorDetectInVlls0; /*!< Enable Power on reset detect in VLLS mode */
AnnaBridge 171:3a7713b1edbc 219 #endif
AnnaBridge 171:3a7713b1edbc 220 #if (defined(FSL_FEATURE_SMC_HAS_RAM2_POWER_OPTION) && FSL_FEATURE_SMC_HAS_RAM2_POWER_OPTION)
AnnaBridge 171:3a7713b1edbc 221 bool enableRam2InVlls2; /*!< Enable RAM2 power in VLLS2 */
AnnaBridge 171:3a7713b1edbc 222 #endif
AnnaBridge 171:3a7713b1edbc 223 #if (defined(FSL_FEATURE_SMC_HAS_LPOPO) && FSL_FEATURE_SMC_HAS_LPOPO)
AnnaBridge 171:3a7713b1edbc 224 bool enableLpoClock; /*!< Enable LPO clock in VLLS mode */
AnnaBridge 171:3a7713b1edbc 225 #endif
AnnaBridge 171:3a7713b1edbc 226 } smc_power_mode_vlls_config_t;
AnnaBridge 171:3a7713b1edbc 227 #endif
AnnaBridge 171:3a7713b1edbc 228
AnnaBridge 171:3a7713b1edbc 229 /*******************************************************************************
AnnaBridge 171:3a7713b1edbc 230 * API
AnnaBridge 171:3a7713b1edbc 231 ******************************************************************************/
AnnaBridge 171:3a7713b1edbc 232
AnnaBridge 171:3a7713b1edbc 233 #if defined(__cplusplus)
AnnaBridge 171:3a7713b1edbc 234 extern "C" {
AnnaBridge 171:3a7713b1edbc 235 #endif /* __cplusplus */
AnnaBridge 171:3a7713b1edbc 236
AnnaBridge 171:3a7713b1edbc 237 /*! @name System mode controller APIs*/
AnnaBridge 171:3a7713b1edbc 238 /*@{*/
AnnaBridge 171:3a7713b1edbc 239
AnnaBridge 171:3a7713b1edbc 240 #if (defined(FSL_FEATURE_SMC_HAS_VERID) && FSL_FEATURE_SMC_HAS_VERID)
AnnaBridge 171:3a7713b1edbc 241 /*!
AnnaBridge 171:3a7713b1edbc 242 * @brief Gets the SMC version ID.
AnnaBridge 171:3a7713b1edbc 243 *
AnnaBridge 171:3a7713b1edbc 244 * This function gets the SMC version ID, including major version number,
AnnaBridge 171:3a7713b1edbc 245 * minor version number and feature specification number.
AnnaBridge 171:3a7713b1edbc 246 *
AnnaBridge 171:3a7713b1edbc 247 * @param base SMC peripheral base address.
AnnaBridge 171:3a7713b1edbc 248 * @param versionId Pointer to version ID structure.
AnnaBridge 171:3a7713b1edbc 249 */
AnnaBridge 171:3a7713b1edbc 250 static inline void SMC_GetVersionId(SMC_Type *base, smc_version_id_t *versionId)
AnnaBridge 171:3a7713b1edbc 251 {
AnnaBridge 171:3a7713b1edbc 252 *((uint32_t *)versionId) = base->VERID;
AnnaBridge 171:3a7713b1edbc 253 }
AnnaBridge 171:3a7713b1edbc 254 #endif /* FSL_FEATURE_SMC_HAS_VERID */
AnnaBridge 171:3a7713b1edbc 255
AnnaBridge 171:3a7713b1edbc 256 #if (defined(FSL_FEATURE_SMC_HAS_PARAM) && FSL_FEATURE_SMC_HAS_PARAM)
AnnaBridge 171:3a7713b1edbc 257 /*!
AnnaBridge 171:3a7713b1edbc 258 * @brief Gets the SMC parameter.
AnnaBridge 171:3a7713b1edbc 259 *
AnnaBridge 171:3a7713b1edbc 260 * This function gets the SMC parameter, including the enabled power mdoes.
AnnaBridge 171:3a7713b1edbc 261 *
AnnaBridge 171:3a7713b1edbc 262 * @param base SMC peripheral base address.
AnnaBridge 171:3a7713b1edbc 263 * @param param Pointer to SMC param structure.
AnnaBridge 171:3a7713b1edbc 264 */
AnnaBridge 171:3a7713b1edbc 265 void SMC_GetParam(SMC_Type *base, smc_param_t *param);
AnnaBridge 171:3a7713b1edbc 266 #endif
AnnaBridge 171:3a7713b1edbc 267
AnnaBridge 171:3a7713b1edbc 268 /*!
AnnaBridge 171:3a7713b1edbc 269 * @brief Configures all power mode protection settings.
AnnaBridge 171:3a7713b1edbc 270 *
AnnaBridge 171:3a7713b1edbc 271 * This function configures the power mode protection settings for
AnnaBridge 171:3a7713b1edbc 272 * supported power modes in the specified chip family. The available power modes
AnnaBridge 171:3a7713b1edbc 273 * are defined in the smc_power_mode_protection_t. This should be done at an early
AnnaBridge 171:3a7713b1edbc 274 * system level initialization stage. See the reference manual for details.
AnnaBridge 171:3a7713b1edbc 275 * This register can only write once after the power reset.
AnnaBridge 171:3a7713b1edbc 276 *
AnnaBridge 171:3a7713b1edbc 277 * The allowed modes are passed as bit map, for example, to allow LLS and VLLS,
AnnaBridge 171:3a7713b1edbc 278 * use SMC_SetPowerModeProtection(kSMC_AllowPowerModeVlls | kSMC_AllowPowerModeVlps).
AnnaBridge 171:3a7713b1edbc 279 * To allow all modes, use SMC_SetPowerModeProtection(kSMC_AllowPowerModeAll).
AnnaBridge 171:3a7713b1edbc 280 *
AnnaBridge 171:3a7713b1edbc 281 * @param base SMC peripheral base address.
AnnaBridge 171:3a7713b1edbc 282 * @param allowedModes Bitmap of the allowed power modes.
AnnaBridge 171:3a7713b1edbc 283 */
AnnaBridge 171:3a7713b1edbc 284 static inline void SMC_SetPowerModeProtection(SMC_Type *base, uint8_t allowedModes)
AnnaBridge 171:3a7713b1edbc 285 {
AnnaBridge 171:3a7713b1edbc 286 base->PMPROT = allowedModes;
AnnaBridge 171:3a7713b1edbc 287 }
AnnaBridge 171:3a7713b1edbc 288
AnnaBridge 171:3a7713b1edbc 289 /*!
AnnaBridge 171:3a7713b1edbc 290 * @brief Gets the current power mode status.
AnnaBridge 171:3a7713b1edbc 291 *
AnnaBridge 171:3a7713b1edbc 292 * This function returns the current power mode stat. Once application
AnnaBridge 171:3a7713b1edbc 293 * switches the power mode, it should always check the stat to check whether it
AnnaBridge 171:3a7713b1edbc 294 * runs into the specified mode or not. An application should check
AnnaBridge 171:3a7713b1edbc 295 * this mode before switching to a different mode. The system requires that
AnnaBridge 171:3a7713b1edbc 296 * only certain modes can switch to other specific modes. See the
AnnaBridge 171:3a7713b1edbc 297 * reference manual for details and the smc_power_state_t for information about
AnnaBridge 171:3a7713b1edbc 298 * the power stat.
AnnaBridge 171:3a7713b1edbc 299 *
AnnaBridge 171:3a7713b1edbc 300 * @param base SMC peripheral base address.
AnnaBridge 171:3a7713b1edbc 301 * @return Current power mode status.
AnnaBridge 171:3a7713b1edbc 302 */
AnnaBridge 171:3a7713b1edbc 303 static inline smc_power_state_t SMC_GetPowerModeState(SMC_Type *base)
AnnaBridge 171:3a7713b1edbc 304 {
AnnaBridge 171:3a7713b1edbc 305 return (smc_power_state_t)base->PMSTAT;
AnnaBridge 171:3a7713b1edbc 306 }
AnnaBridge 171:3a7713b1edbc 307
AnnaBridge 171:3a7713b1edbc 308 /*!
AnnaBridge 171:3a7713b1edbc 309 * @brief Configure the system to RUN power mode.
AnnaBridge 171:3a7713b1edbc 310 *
AnnaBridge 171:3a7713b1edbc 311 * @param base SMC peripheral base address.
AnnaBridge 171:3a7713b1edbc 312 * @return SMC configuration error code.
AnnaBridge 171:3a7713b1edbc 313 */
AnnaBridge 171:3a7713b1edbc 314 status_t SMC_SetPowerModeRun(SMC_Type *base);
AnnaBridge 171:3a7713b1edbc 315
AnnaBridge 171:3a7713b1edbc 316 #if (defined(FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE) && FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE)
AnnaBridge 171:3a7713b1edbc 317 /*!
AnnaBridge 171:3a7713b1edbc 318 * @brief Configure the system to HSRUN power mode.
AnnaBridge 171:3a7713b1edbc 319 *
AnnaBridge 171:3a7713b1edbc 320 * @param base SMC peripheral base address.
AnnaBridge 171:3a7713b1edbc 321 * @return SMC configuration error code.
AnnaBridge 171:3a7713b1edbc 322 */
AnnaBridge 171:3a7713b1edbc 323 status_t SMC_SetPowerModeHsrun(SMC_Type *base);
AnnaBridge 171:3a7713b1edbc 324 #endif /* FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE */
AnnaBridge 171:3a7713b1edbc 325
AnnaBridge 171:3a7713b1edbc 326 /*!
AnnaBridge 171:3a7713b1edbc 327 * @brief Configure the system to WAIT power mode.
AnnaBridge 171:3a7713b1edbc 328 *
AnnaBridge 171:3a7713b1edbc 329 * @param base SMC peripheral base address.
AnnaBridge 171:3a7713b1edbc 330 * @return SMC configuration error code.
AnnaBridge 171:3a7713b1edbc 331 */
AnnaBridge 171:3a7713b1edbc 332 status_t SMC_SetPowerModeWait(SMC_Type *base);
AnnaBridge 171:3a7713b1edbc 333
AnnaBridge 171:3a7713b1edbc 334 /*!
AnnaBridge 171:3a7713b1edbc 335 * @brief Configure the system to Stop power mode.
AnnaBridge 171:3a7713b1edbc 336 *
AnnaBridge 171:3a7713b1edbc 337 * @param base SMC peripheral base address.
AnnaBridge 171:3a7713b1edbc 338 * @param option Partial Stop mode option.
AnnaBridge 171:3a7713b1edbc 339 * @return SMC configuration error code.
AnnaBridge 171:3a7713b1edbc 340 */
AnnaBridge 171:3a7713b1edbc 341 status_t SMC_SetPowerModeStop(SMC_Type *base, smc_partial_stop_option_t option);
AnnaBridge 171:3a7713b1edbc 342
AnnaBridge 171:3a7713b1edbc 343 #if (defined(FSL_FEATURE_SMC_HAS_LPWUI) && FSL_FEATURE_SMC_HAS_LPWUI)
AnnaBridge 171:3a7713b1edbc 344 /*!
AnnaBridge 171:3a7713b1edbc 345 * @brief Configure the system to VLPR power mode.
AnnaBridge 171:3a7713b1edbc 346 *
AnnaBridge 171:3a7713b1edbc 347 * @param base SMC peripheral base address.
AnnaBridge 171:3a7713b1edbc 348 * @param wakeupMode Enter Normal Run mode if true, else stay in VLPR mode.
AnnaBridge 171:3a7713b1edbc 349 * @return SMC configuration error code.
AnnaBridge 171:3a7713b1edbc 350 */
AnnaBridge 171:3a7713b1edbc 351 status_t SMC_SetPowerModeVlpr(SMC_Type *base, bool wakeupMode);
AnnaBridge 171:3a7713b1edbc 352 #else
AnnaBridge 171:3a7713b1edbc 353 /*!
AnnaBridge 171:3a7713b1edbc 354 * @brief Configure the system to VLPR power mode.
AnnaBridge 171:3a7713b1edbc 355 *
AnnaBridge 171:3a7713b1edbc 356 * @param base SMC peripheral base address.
AnnaBridge 171:3a7713b1edbc 357 * @return SMC configuration error code.
AnnaBridge 171:3a7713b1edbc 358 */
AnnaBridge 171:3a7713b1edbc 359 status_t SMC_SetPowerModeVlpr(SMC_Type *base);
AnnaBridge 171:3a7713b1edbc 360 #endif /* FSL_FEATURE_SMC_HAS_LPWUI */
AnnaBridge 171:3a7713b1edbc 361
AnnaBridge 171:3a7713b1edbc 362 /*!
AnnaBridge 171:3a7713b1edbc 363 * @brief Configure the system to VLPW power mode.
AnnaBridge 171:3a7713b1edbc 364 *
AnnaBridge 171:3a7713b1edbc 365 * @param base SMC peripheral base address.
AnnaBridge 171:3a7713b1edbc 366 * @return SMC configuration error code.
AnnaBridge 171:3a7713b1edbc 367 */
AnnaBridge 171:3a7713b1edbc 368 status_t SMC_SetPowerModeVlpw(SMC_Type *base);
AnnaBridge 171:3a7713b1edbc 369
AnnaBridge 171:3a7713b1edbc 370 /*!
AnnaBridge 171:3a7713b1edbc 371 * @brief Configure the system to VLPS power mode.
AnnaBridge 171:3a7713b1edbc 372 *
AnnaBridge 171:3a7713b1edbc 373 * @param base SMC peripheral base address.
AnnaBridge 171:3a7713b1edbc 374 * @return SMC configuration error code.
AnnaBridge 171:3a7713b1edbc 375 */
AnnaBridge 171:3a7713b1edbc 376 status_t SMC_SetPowerModeVlps(SMC_Type *base);
AnnaBridge 171:3a7713b1edbc 377
AnnaBridge 171:3a7713b1edbc 378 #if (defined(FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE) && FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE)
AnnaBridge 171:3a7713b1edbc 379 #if ((defined(FSL_FEATURE_SMC_HAS_LLS_SUBMODE) && FSL_FEATURE_SMC_HAS_LLS_SUBMODE) || \
AnnaBridge 171:3a7713b1edbc 380 (defined(FSL_FEATURE_SMC_HAS_LPOPO) && FSL_FEATURE_SMC_HAS_LPOPO))
AnnaBridge 171:3a7713b1edbc 381 /*!
AnnaBridge 171:3a7713b1edbc 382 * @brief Configure the system to LLS power mode.
AnnaBridge 171:3a7713b1edbc 383 *
AnnaBridge 171:3a7713b1edbc 384 * @param base SMC peripheral base address.
AnnaBridge 171:3a7713b1edbc 385 * @param config The LLS power mode configuration structure
AnnaBridge 171:3a7713b1edbc 386 * @return SMC configuration error code.
AnnaBridge 171:3a7713b1edbc 387 */
AnnaBridge 171:3a7713b1edbc 388 status_t SMC_SetPowerModeLls(SMC_Type *base, const smc_power_mode_lls_config_t *config);
AnnaBridge 171:3a7713b1edbc 389 #else
AnnaBridge 171:3a7713b1edbc 390 /*!
AnnaBridge 171:3a7713b1edbc 391 * @brief Configure the system to LLS power mode.
AnnaBridge 171:3a7713b1edbc 392 *
AnnaBridge 171:3a7713b1edbc 393 * @param base SMC peripheral base address.
AnnaBridge 171:3a7713b1edbc 394 * @return SMC configuration error code.
AnnaBridge 171:3a7713b1edbc 395 */
AnnaBridge 171:3a7713b1edbc 396 status_t SMC_SetPowerModeLls(SMC_Type *base);
AnnaBridge 171:3a7713b1edbc 397 #endif
AnnaBridge 171:3a7713b1edbc 398 #endif /* FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE */
AnnaBridge 171:3a7713b1edbc 399
AnnaBridge 171:3a7713b1edbc 400 #if (defined(FSL_FEATURE_SMC_HAS_VERY_LOW_LEAKAGE_STOP_MODE) && FSL_FEATURE_SMC_HAS_VERY_LOW_LEAKAGE_STOP_MODE)
AnnaBridge 171:3a7713b1edbc 401 /*!
AnnaBridge 171:3a7713b1edbc 402 * @brief Configure the system to VLLS power mode.
AnnaBridge 171:3a7713b1edbc 403 *
AnnaBridge 171:3a7713b1edbc 404 * @param base SMC peripheral base address.
AnnaBridge 171:3a7713b1edbc 405 * @param config The VLLS power mode configuration structure.
AnnaBridge 171:3a7713b1edbc 406 * @return SMC configuration error code.
AnnaBridge 171:3a7713b1edbc 407 */
AnnaBridge 171:3a7713b1edbc 408 status_t SMC_SetPowerModeVlls(SMC_Type *base, const smc_power_mode_vlls_config_t *config);
AnnaBridge 171:3a7713b1edbc 409 #endif /* FSL_FEATURE_SMC_HAS_VERY_LOW_LEAKAGE_STOP_MODE */
AnnaBridge 171:3a7713b1edbc 410
AnnaBridge 171:3a7713b1edbc 411 /*@}*/
AnnaBridge 171:3a7713b1edbc 412
AnnaBridge 171:3a7713b1edbc 413 #if defined(__cplusplus)
AnnaBridge 171:3a7713b1edbc 414 }
AnnaBridge 171:3a7713b1edbc 415 #endif /* __cplusplus */
AnnaBridge 171:3a7713b1edbc 416
AnnaBridge 171:3a7713b1edbc 417 /*! @}*/
AnnaBridge 171:3a7713b1edbc 418
AnnaBridge 171:3a7713b1edbc 419 #endif /* _FSL_SMC_H_ */