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:
Thu Nov 08 11:45:42 2018 +0000
Revision:
171:3a7713b1edbc
Parent:
TARGET_RO359B/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K24F/drivers/fsl_smc.h@143:86740a56073b
mbed library. Release version 164

Who changed what in which revision?

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