mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

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

Committer:
mbed_official
Date:
Thu Sep 18 14:00:17 2014 +0100
Revision:
324:406fd2029f23
Parent:
149:1fb5f62b92bd
Synchronized with git revision a73f28e6fbca9559fbed2726410eeb4c0534a4a5

Full URL: https://github.com/mbedmicro/mbed/commit/a73f28e6fbca9559fbed2726410eeb4c0534a4a5/

Extended #476, which does not break ethernet for K64F

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 146:f64d43ff0c18 1 /*
mbed_official 146:f64d43ff0c18 2 * Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
mbed_official 146:f64d43ff0c18 3 * All rights reserved.
mbed_official 146:f64d43ff0c18 4 *
mbed_official 146:f64d43ff0c18 5 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 146:f64d43ff0c18 6 * are permitted provided that the following conditions are met:
mbed_official 146:f64d43ff0c18 7 *
mbed_official 146:f64d43ff0c18 8 * o Redistributions of source code must retain the above copyright notice, this list
mbed_official 146:f64d43ff0c18 9 * of conditions and the following disclaimer.
mbed_official 146:f64d43ff0c18 10 *
mbed_official 146:f64d43ff0c18 11 * o Redistributions in binary form must reproduce the above copyright notice, this
mbed_official 146:f64d43ff0c18 12 * list of conditions and the following disclaimer in the documentation and/or
mbed_official 146:f64d43ff0c18 13 * other materials provided with the distribution.
mbed_official 146:f64d43ff0c18 14 *
mbed_official 146:f64d43ff0c18 15 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
mbed_official 146:f64d43ff0c18 16 * contributors may be used to endorse or promote products derived from this
mbed_official 146:f64d43ff0c18 17 * software without specific prior written permission.
mbed_official 146:f64d43ff0c18 18 *
mbed_official 146:f64d43ff0c18 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
mbed_official 146:f64d43ff0c18 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
mbed_official 146:f64d43ff0c18 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 146:f64d43ff0c18 22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
mbed_official 146:f64d43ff0c18 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
mbed_official 146:f64d43ff0c18 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
mbed_official 146:f64d43ff0c18 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
mbed_official 146:f64d43ff0c18 26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
mbed_official 146:f64d43ff0c18 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
mbed_official 146:f64d43ff0c18 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 146:f64d43ff0c18 29 */
mbed_official 146:f64d43ff0c18 30
mbed_official 146:f64d43ff0c18 31 #if !defined(__FSL_SMC_HAL_H__)
mbed_official 146:f64d43ff0c18 32 #define __FSL_SMC_HAL_H__
mbed_official 146:f64d43ff0c18 33
mbed_official 146:f64d43ff0c18 34 #include <stdint.h>
mbed_official 146:f64d43ff0c18 35 #include <stdbool.h>
mbed_official 146:f64d43ff0c18 36 #include <assert.h>
mbed_official 146:f64d43ff0c18 37 #include "fsl_device_registers.h"
mbed_official 146:f64d43ff0c18 38 #include "fsl_smc_features.h"
mbed_official 146:f64d43ff0c18 39
mbed_official 146:f64d43ff0c18 40 /*! @addtogroup smc_hal*/
mbed_official 146:f64d43ff0c18 41 /*! @{*/
mbed_official 146:f64d43ff0c18 42
mbed_official 146:f64d43ff0c18 43 /*! @file fsl_smc_hal.h */
mbed_official 146:f64d43ff0c18 44
mbed_official 146:f64d43ff0c18 45 /*******************************************************************************
mbed_official 146:f64d43ff0c18 46 * Definitions
mbed_official 146:f64d43ff0c18 47 ******************************************************************************/
mbed_official 324:406fd2029f23 48 /*! @brief Power Modes */
mbed_official 324:406fd2029f23 49 typedef enum _power_modes {
mbed_official 324:406fd2029f23 50 kPowerModeRun,
mbed_official 324:406fd2029f23 51 kPowerModeWait,
mbed_official 324:406fd2029f23 52 kPowerModeStop,
mbed_official 324:406fd2029f23 53 kPowerModeVlpr,
mbed_official 324:406fd2029f23 54 kPowerModeVlpw,
mbed_official 324:406fd2029f23 55 kPowerModeVlps,
mbed_official 324:406fd2029f23 56 kPowerModeLls,
mbed_official 324:406fd2029f23 57 kPowerModeVlls,
mbed_official 324:406fd2029f23 58 kPowerModeHsrun,
mbed_official 324:406fd2029f23 59 kPowerModeMax
mbed_official 324:406fd2029f23 60 } power_modes_t;
mbed_official 146:f64d43ff0c18 61
mbed_official 324:406fd2029f23 62 /*!
mbed_official 324:406fd2029f23 63 * @brief Error code definition for the system mode controller manager APIs.
mbed_official 324:406fd2029f23 64 */
mbed_official 324:406fd2029f23 65 typedef enum _smc_hal_error_code {
mbed_official 324:406fd2029f23 66 kSmcHalSuccess, /*!< Success */
mbed_official 324:406fd2029f23 67 kSmcHalNoSuchModeName, /*!< Cannot find the mode name specified*/
mbed_official 324:406fd2029f23 68 kSmcHalAlreadyInTheState, /*!< Already in the required state*/
mbed_official 324:406fd2029f23 69 kSmcHalFailed /*!< Unknown error, operation failed*/
mbed_official 324:406fd2029f23 70 } smc_hal_error_code_t;
mbed_official 146:f64d43ff0c18 71
mbed_official 146:f64d43ff0c18 72 /*! @brief Power Modes in PMSTAT*/
mbed_official 146:f64d43ff0c18 73 typedef enum _power_mode_stat {
mbed_official 146:f64d43ff0c18 74 kStatRun = 0x01, /*!< 0000_0001 - Current power mode is RUN*/
mbed_official 146:f64d43ff0c18 75 kStatStop = 0x02, /*!< 0000_0010 - Current power mode is STOP*/
mbed_official 146:f64d43ff0c18 76 kStatVlpr = 0x04, /*!< 0000_0100 - Current power mode is VLPR*/
mbed_official 146:f64d43ff0c18 77 kStatVlpw = 0x08, /*!< 0000_1000 - Current power mode is VLPW*/
mbed_official 146:f64d43ff0c18 78 kStatVlps = 0x10, /*!< 0001_0000 - Current power mode is VLPS*/
mbed_official 146:f64d43ff0c18 79 kStatLls = 0x20, /*!< 0010_0000 - Current power mode is LLS*/
mbed_official 146:f64d43ff0c18 80 kStatVlls = 0x40, /*!< 0100_0000 - Current power mode is VLLS*/
mbed_official 146:f64d43ff0c18 81 kStatHsrun = 0x80 /*!< 1000_0000 - Current power mode is HSRUN*/
mbed_official 146:f64d43ff0c18 82 } power_mode_stat_t;
mbed_official 146:f64d43ff0c18 83
mbed_official 146:f64d43ff0c18 84 /*! @brief Power Modes Protection*/
mbed_official 146:f64d43ff0c18 85 typedef enum _power_modes_protect {
mbed_official 146:f64d43ff0c18 86 kAllowHsrun, /*!< Allow High Speed Run mode*/
mbed_official 146:f64d43ff0c18 87 kAllowVlp, /*!< Allow Very-Low-Power Modes*/
mbed_official 146:f64d43ff0c18 88 kAllowLls, /*!< Allow Low-Leakage Stop Mode*/
mbed_official 146:f64d43ff0c18 89 kAllowVlls, /*!< Allow Very-Low-Leakage Stop Mode*/
mbed_official 146:f64d43ff0c18 90 kAllowMax
mbed_official 146:f64d43ff0c18 91 } power_modes_protect_t;
mbed_official 146:f64d43ff0c18 92
mbed_official 146:f64d43ff0c18 93 /*!
mbed_official 146:f64d43ff0c18 94 * @brief Run mode definition
mbed_official 146:f64d43ff0c18 95 */
mbed_official 146:f64d43ff0c18 96 typedef enum _smc_run_mode {
mbed_official 146:f64d43ff0c18 97 kSmcRun, /*!< normal RUN mode*/
mbed_official 146:f64d43ff0c18 98 kSmcReservedRun,
mbed_official 146:f64d43ff0c18 99 kSmcVlpr, /*!< Very-Low-Power RUN mode*/
mbed_official 146:f64d43ff0c18 100 kSmcHsrun /*!< High Speed Run mode (HSRUN)*/
mbed_official 146:f64d43ff0c18 101 } smc_run_mode_t;
mbed_official 146:f64d43ff0c18 102
mbed_official 146:f64d43ff0c18 103 /*!
mbed_official 146:f64d43ff0c18 104 * @brief Stop mode definition
mbed_official 146:f64d43ff0c18 105 */
mbed_official 146:f64d43ff0c18 106 typedef enum _smc_stop_mode {
mbed_official 146:f64d43ff0c18 107 kSmcStop, /*!< Normal STOP mode*/
mbed_official 146:f64d43ff0c18 108 kSmcReservedStop1, /*!< Reserved*/
mbed_official 146:f64d43ff0c18 109 kSmcVlps, /*!< Very-Low-Power STOP mode*/
mbed_official 146:f64d43ff0c18 110 kSmcLls, /*!< Low-Leakage Stop mode*/
mbed_official 146:f64d43ff0c18 111 kSmcVlls /*!< Very-Low-Leakage Stop mode*/
mbed_official 146:f64d43ff0c18 112 } smc_stop_mode_t;
mbed_official 146:f64d43ff0c18 113
mbed_official 146:f64d43ff0c18 114 /*!
mbed_official 146:f64d43ff0c18 115 * @brief VLLS/LLS stop sub mode definition
mbed_official 146:f64d43ff0c18 116 */
mbed_official 146:f64d43ff0c18 117 typedef enum _smc_stop_submode {
mbed_official 146:f64d43ff0c18 118 kSmcStopSub0,
mbed_official 146:f64d43ff0c18 119 kSmcStopSub1,
mbed_official 146:f64d43ff0c18 120 kSmcStopSub2,
mbed_official 146:f64d43ff0c18 121 kSmcStopSub3
mbed_official 146:f64d43ff0c18 122 } smc_stop_submode_t;
mbed_official 146:f64d43ff0c18 123
mbed_official 146:f64d43ff0c18 124 /*! @brief Low Power Wake Up on Interrupt option*/
mbed_official 146:f64d43ff0c18 125 typedef enum _smc_lpwui_option {
mbed_official 146:f64d43ff0c18 126 kSmcLpwuiEnabled, /*!< Low Power Wake Up on Interrupt enabled*/
mbed_official 146:f64d43ff0c18 127 kSmcLpwuiDisabled /*!< Low Power Wake Up on Interrupt disabled*/
mbed_official 146:f64d43ff0c18 128 } smc_lpwui_option_t;
mbed_official 146:f64d43ff0c18 129
mbed_official 146:f64d43ff0c18 130 /*! @brief Partial STOP option*/
mbed_official 146:f64d43ff0c18 131 typedef enum _smc_pstop_option {
mbed_official 146:f64d43ff0c18 132 kSmcPstopStop, /*!< STOP - Normal Stop mode*/
mbed_official 146:f64d43ff0c18 133 kSmcPstopStop1, /*!< Partial Stop with both system and bus clocks disabled*/
mbed_official 146:f64d43ff0c18 134 kSmcPstopStop2, /*!< Partial Stop with system clock disabled and bus clock enabled*/
mbed_official 146:f64d43ff0c18 135 kSmcPstopReserved,
mbed_official 146:f64d43ff0c18 136 } smc_pstop_option_t;
mbed_official 146:f64d43ff0c18 137
mbed_official 146:f64d43ff0c18 138 /*! @brief POR option*/
mbed_official 146:f64d43ff0c18 139 typedef enum _smc_por_option {
mbed_official 146:f64d43ff0c18 140 kSmcPorEnabled, /*!< POR detect circuit is enabled in VLLS0*/
mbed_official 146:f64d43ff0c18 141 kSmcPorDisabled /*!< POR detect circuit is disabled in VLLS0*/
mbed_official 146:f64d43ff0c18 142 } smc_por_option_t;
mbed_official 146:f64d43ff0c18 143
mbed_official 146:f64d43ff0c18 144 /*! @brief LPO power option*/
mbed_official 146:f64d43ff0c18 145 typedef enum _smc_lpo_option {
mbed_official 146:f64d43ff0c18 146 kSmcLpoEnabled, /*!< LPO clock is enabled in LLS/VLLSx*/
mbed_official 146:f64d43ff0c18 147 kSmcLpoDisabled /*!< LPO clock is disabled in LLS/VLLSx*/
mbed_official 146:f64d43ff0c18 148 } smc_lpo_option_t;
mbed_official 146:f64d43ff0c18 149
mbed_official 146:f64d43ff0c18 150 /*! @brief Power mode control options*/
mbed_official 146:f64d43ff0c18 151 typedef enum _smc_power_options {
mbed_official 146:f64d43ff0c18 152 kSmcOptionLpwui, /*!< Low Power Wake Up on Interrupt*/
mbed_official 146:f64d43ff0c18 153 kSmcOptionPropo /*!< POR option*/
mbed_official 146:f64d43ff0c18 154 } smc_power_options_t;
mbed_official 146:f64d43ff0c18 155
mbed_official 146:f64d43ff0c18 156 /*! @brief Power mode protection configuration*/
mbed_official 146:f64d43ff0c18 157 typedef struct _smc_power_mode_protection_config {
mbed_official 146:f64d43ff0c18 158 bool vlpProt; /*!< VLP protect*/
mbed_official 146:f64d43ff0c18 159 bool llsProt; /*!< LLS protect */
mbed_official 146:f64d43ff0c18 160 bool vllsProt; /*!< VLLS protect*/
mbed_official 324:406fd2029f23 161 #if FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE
mbed_official 324:406fd2029f23 162 bool hsrunProt; /*!< HSRUN protect */
mbed_official 324:406fd2029f23 163 #endif
mbed_official 146:f64d43ff0c18 164 } smc_power_mode_protection_config_t;
mbed_official 146:f64d43ff0c18 165
mbed_official 324:406fd2029f23 166 /*! @brief Power mode control configuration used for calling the SMC_SYS_SetPowerMode API. */
mbed_official 324:406fd2029f23 167 typedef struct _smc_power_mode_config {
mbed_official 324:406fd2029f23 168 power_modes_t powerModeName; /*!< Power mode(enum), see power_modes_t */
mbed_official 324:406fd2029f23 169 smc_stop_submode_t stopSubMode; /*!< Stop submode(enum), see smc_stop_submode_t */
mbed_official 324:406fd2029f23 170 #if FSL_FEATURE_SMC_HAS_LPWUI
mbed_official 324:406fd2029f23 171 bool lpwuiOption; /*!< If LPWUI option is needed */
mbed_official 324:406fd2029f23 172 smc_lpwui_option_t lpwuiOptionValue; /*!< LPWUI option(enum), see smc_lpwui_option_t */
mbed_official 324:406fd2029f23 173 #endif
mbed_official 324:406fd2029f23 174 #if FSL_FEATURE_SMC_HAS_PORPO
mbed_official 324:406fd2029f23 175 bool porOption; /*!< If POR option is needed */
mbed_official 324:406fd2029f23 176 smc_por_option_t porOptionValue; /*!< POR option(enum), see smc_por_option_t */
mbed_official 324:406fd2029f23 177 #endif
mbed_official 324:406fd2029f23 178 #if FSL_FEATURE_SMC_HAS_PSTOPO
mbed_official 324:406fd2029f23 179 bool pstopOption; /*!< If PSTOPO option is needed */
mbed_official 324:406fd2029f23 180 smc_pstop_option_t pstopOptionValue; /*!< PSTOPO option(enum), see smc_por_option_t */
mbed_official 324:406fd2029f23 181 #endif
mbed_official 324:406fd2029f23 182 } smc_power_mode_config_t;
mbed_official 324:406fd2029f23 183
mbed_official 146:f64d43ff0c18 184 /*******************************************************************************
mbed_official 146:f64d43ff0c18 185 * API
mbed_official 146:f64d43ff0c18 186 ******************************************************************************/
mbed_official 146:f64d43ff0c18 187
mbed_official 146:f64d43ff0c18 188 #if defined(__cplusplus)
mbed_official 146:f64d43ff0c18 189 extern "C" {
mbed_official 146:f64d43ff0c18 190 #endif /* __cplusplus*/
mbed_official 146:f64d43ff0c18 191
mbed_official 146:f64d43ff0c18 192 /*! @name System mode controller APIs*/
mbed_official 146:f64d43ff0c18 193 /*@{*/
mbed_official 146:f64d43ff0c18 194
mbed_official 146:f64d43ff0c18 195 /*!
mbed_official 324:406fd2029f23 196 * @brief Configures the power mode.
mbed_official 324:406fd2029f23 197 *
mbed_official 324:406fd2029f23 198 * This function configures the power mode control for both run, stop, and
mbed_official 324:406fd2029f23 199 * stop sub mode if needed. Also it configures the power options for a specific
mbed_official 324:406fd2029f23 200 * power mode. An application should follow the proper procedure to configure and
mbed_official 324:406fd2029f23 201 * switch power modes between different run and stop modes. For proper procedures
mbed_official 324:406fd2029f23 202 * and supported power modes, see an appropriate chip reference
mbed_official 324:406fd2029f23 203 * manual. See the smc_power_mode_config_t for required
mbed_official 324:406fd2029f23 204 * parameters to configure the power mode and the supported options. Other options
mbed_official 324:406fd2029f23 205 * may need to be individually configured through the HAL driver. See the HAL driver
mbed_official 324:406fd2029f23 206 * header file for details.
mbed_official 324:406fd2029f23 207 *
mbed_official 324:406fd2029f23 208 * @param baseAddr Base address for current SMC instance.
mbed_official 324:406fd2029f23 209 * @param powerModeConfig Power mode configuration structure smc_power_mode_config_t
mbed_official 324:406fd2029f23 210 * @return errorCode SMC error code
mbed_official 324:406fd2029f23 211 */
mbed_official 324:406fd2029f23 212 smc_hal_error_code_t SMC_HAL_SetMode(uint32_t baseAddr,
mbed_official 324:406fd2029f23 213 const smc_power_mode_config_t *powerModeConfig);
mbed_official 324:406fd2029f23 214
mbed_official 324:406fd2029f23 215 /*!
mbed_official 146:f64d43ff0c18 216 * @brief Configures all power mode protection settings.
mbed_official 146:f64d43ff0c18 217 *
mbed_official 146:f64d43ff0c18 218 * This function configures the power mode protection settings for
mbed_official 146:f64d43ff0c18 219 * supported power modes in the specified chip family. The available power modes
mbed_official 146:f64d43ff0c18 220 * are defined in the smc_power_mode_protection_config_t. An application should provide
mbed_official 146:f64d43ff0c18 221 * the protect settings for all supported power modes on the chip. This
mbed_official 146:f64d43ff0c18 222 * should be done at an early system level initialization stage. See the reference manual
mbed_official 324:406fd2029f23 223 * for details. This register can only write once after the power reset. If the user has
mbed_official 324:406fd2029f23 224 * only a single option to set,
mbed_official 146:f64d43ff0c18 225 * either use this function or use the individual set function.
mbed_official 146:f64d43ff0c18 226 *
mbed_official 146:f64d43ff0c18 227 *
mbed_official 324:406fd2029f23 228 * @param baseAddr Base address for current SMC instance.
mbed_official 146:f64d43ff0c18 229 * @param protectConfig Configurations for the supported power mode protect settings
mbed_official 146:f64d43ff0c18 230 * - See smc_power_mode_protection_config_t for details.
mbed_official 146:f64d43ff0c18 231 */
mbed_official 324:406fd2029f23 232 void SMC_HAL_SetProtection(uint32_t baseAddr, smc_power_mode_protection_config_t *protectConfig);
mbed_official 146:f64d43ff0c18 233
mbed_official 146:f64d43ff0c18 234 /*!
mbed_official 146:f64d43ff0c18 235 * @brief Configures the individual power mode protection settings.
mbed_official 146:f64d43ff0c18 236 *
mbed_official 146:f64d43ff0c18 237 * This function only configures the power mode protection settings for
mbed_official 146:f64d43ff0c18 238 * a specified power mode on the specified chip family. The available power modes
mbed_official 146:f64d43ff0c18 239 * are defined in the smc_power_mode_protection_config_t. See the reference manual
mbed_official 146:f64d43ff0c18 240 * for details. This register can only write once after the power reset.
mbed_official 146:f64d43ff0c18 241 *
mbed_official 324:406fd2029f23 242 * @param baseAddr Base address for current SMC instance.
mbed_official 146:f64d43ff0c18 243 * @param protect Power mode to set for protection
mbed_official 146:f64d43ff0c18 244 * @param allow Allow or not allow the power mode protection
mbed_official 146:f64d43ff0c18 245 */
mbed_official 324:406fd2029f23 246 void SMC_HAL_SetProtectionMode(uint32_t baseAddr, power_modes_protect_t protect, bool allow);
mbed_official 146:f64d43ff0c18 247
mbed_official 146:f64d43ff0c18 248 /*!
mbed_official 146:f64d43ff0c18 249 * @brief Gets the the current power mode protection setting.
mbed_official 146:f64d43ff0c18 250 *
mbed_official 146:f64d43ff0c18 251 * This function gets the current power mode protection settings for
mbed_official 146:f64d43ff0c18 252 * a specified power mode.
mbed_official 146:f64d43ff0c18 253 *
mbed_official 324:406fd2029f23 254 * @param baseAddr Base address for current SMC instance.
mbed_official 146:f64d43ff0c18 255 * @param protect Power mode to set for protection
mbed_official 146:f64d43ff0c18 256 * @return state Status of the protection setting
mbed_official 146:f64d43ff0c18 257 * - true: Allowed
mbed_official 146:f64d43ff0c18 258 * - false: Not allowed
mbed_official 146:f64d43ff0c18 259 */
mbed_official 324:406fd2029f23 260 bool SMC_HAL_GetProtectionMode(uint32_t baseAddr, power_modes_protect_t protect);
mbed_official 146:f64d43ff0c18 261
mbed_official 146:f64d43ff0c18 262 /*!
mbed_official 146:f64d43ff0c18 263 * @brief Configures the the RUN mode control setting.
mbed_official 146:f64d43ff0c18 264 *
mbed_official 146:f64d43ff0c18 265 * This function sets the run mode settings, for example, normal run mode,
mbed_official 146:f64d43ff0c18 266 * very lower power run mode, etc. See the smc_run_mode_t for supported run
mbed_official 146:f64d43ff0c18 267 * mode on the chip family and the reference manual for details about the
mbed_official 146:f64d43ff0c18 268 * run mode.
mbed_official 146:f64d43ff0c18 269 *
mbed_official 324:406fd2029f23 270 * @param baseAddr Base address for current SMC instance.
mbed_official 146:f64d43ff0c18 271 * @param runMode Run mode setting defined in smc_run_mode_t
mbed_official 146:f64d43ff0c18 272 */
mbed_official 324:406fd2029f23 273 void SMC_HAL_SetRunMode(uint32_t baseAddr, smc_run_mode_t runMode);
mbed_official 146:f64d43ff0c18 274
mbed_official 146:f64d43ff0c18 275 /*!
mbed_official 146:f64d43ff0c18 276 * @brief Gets the current RUN mode configuration setting.
mbed_official 146:f64d43ff0c18 277 *
mbed_official 146:f64d43ff0c18 278 * This function gets the run mode settings. See the smc_run_mode_t
mbed_official 146:f64d43ff0c18 279 * for a supported run mode on the chip family and the reference manual for
mbed_official 146:f64d43ff0c18 280 * details about the run mode.
mbed_official 146:f64d43ff0c18 281 *
mbed_official 324:406fd2029f23 282 * @param baseAddr Base address for current SMC instance.
mbed_official 146:f64d43ff0c18 283 * @return setting Run mode configuration setting
mbed_official 324:406fd2029f23 284 */
mbed_official 324:406fd2029f23 285 smc_run_mode_t SMC_HAL_GetRunMode(uint32_t baseAddr);
mbed_official 146:f64d43ff0c18 286
mbed_official 146:f64d43ff0c18 287 /*!
mbed_official 146:f64d43ff0c18 288 * @brief Configures the STOP mode control setting.
mbed_official 146:f64d43ff0c18 289 *
mbed_official 146:f64d43ff0c18 290 * This function sets the stop mode settings, for example, normal stop mode,
mbed_official 146:f64d43ff0c18 291 * very lower power stop mode, etc. See the smc_stop_mode_t for supported stop
mbed_official 146:f64d43ff0c18 292 * mode on the chip family and the reference manual for details about the
mbed_official 146:f64d43ff0c18 293 * stop mode.
mbed_official 146:f64d43ff0c18 294 *
mbed_official 324:406fd2029f23 295 * @param baseAddr Base address for current SMC instance.
mbed_official 146:f64d43ff0c18 296 * @param stopMode Stop mode defined in smc_stop_mode_t
mbed_official 146:f64d43ff0c18 297 */
mbed_official 324:406fd2029f23 298 void SMC_HAL_SetStopMode(uint32_t baseAddr, smc_stop_mode_t stopMode);
mbed_official 146:f64d43ff0c18 299
mbed_official 146:f64d43ff0c18 300 /*!
mbed_official 146:f64d43ff0c18 301 * @brief Gets the current STOP mode control settings.
mbed_official 146:f64d43ff0c18 302 *
mbed_official 146:f64d43ff0c18 303 * This function gets the stop mode settings, for example, normal stop mode,
mbed_official 146:f64d43ff0c18 304 * very lower power stop mode, etc. See the smc_stop_mode_t for supported stop
mbed_official 146:f64d43ff0c18 305 * mode on the chip family and the reference manual for details about the
mbed_official 146:f64d43ff0c18 306 * stop mode.
mbed_official 146:f64d43ff0c18 307 *
mbed_official 324:406fd2029f23 308 * @param baseAddr Base address for current SMC instance.
mbed_official 146:f64d43ff0c18 309 * @return setting Current stop mode configuration setting
mbed_official 324:406fd2029f23 310 */
mbed_official 324:406fd2029f23 311 smc_stop_mode_t SMC_HAL_GetStopMode(uint32_t baseAddr);
mbed_official 146:f64d43ff0c18 312
mbed_official 146:f64d43ff0c18 313 /*!
mbed_official 146:f64d43ff0c18 314 * @brief Configures the stop sub mode control setting.
mbed_official 146:f64d43ff0c18 315 *
mbed_official 146:f64d43ff0c18 316 * This function sets the stop submode settings. Some of the stop mode
mbed_official 146:f64d43ff0c18 317 * further supports submodes. See the smc_stop_submode_t for supported
mbed_official 146:f64d43ff0c18 318 * stop submodes and the reference manual for details about the submodes
mbed_official 146:f64d43ff0c18 319 * for a specific stop mode.
mbed_official 146:f64d43ff0c18 320 *
mbed_official 324:406fd2029f23 321 * @param baseAddr Base address for current SMC instance.
mbed_official 146:f64d43ff0c18 322 * @param stopSubMode Stop submode setting defined in smc_stop_submode_t
mbed_official 146:f64d43ff0c18 323 */
mbed_official 324:406fd2029f23 324 void SMC_HAL_SetStopSubMode(uint32_t baseAddr, smc_stop_submode_t stopSubMode);
mbed_official 146:f64d43ff0c18 325
mbed_official 146:f64d43ff0c18 326 /*!
mbed_official 146:f64d43ff0c18 327 * @brief Gets the current stop submode configuration settings.
mbed_official 146:f64d43ff0c18 328 *
mbed_official 146:f64d43ff0c18 329 * This function gets the stop submode settings. Some of the stop mode
mbed_official 146:f64d43ff0c18 330 * further support submodes. See the smc_stop_submode_t for supported
mbed_official 146:f64d43ff0c18 331 * stop submodes and the reference manual for details about the submode
mbed_official 146:f64d43ff0c18 332 * for a specific stop mode.
mbed_official 146:f64d43ff0c18 333 *
mbed_official 324:406fd2029f23 334 * @param baseAddr Base address for current SMC instance.
mbed_official 146:f64d43ff0c18 335 * @return setting Current stop submode setting
mbed_official 146:f64d43ff0c18 336 */
mbed_official 324:406fd2029f23 337 smc_stop_submode_t SMC_HAL_GetStopSubMode(uint32_t baseAddr);
mbed_official 146:f64d43ff0c18 338
mbed_official 146:f64d43ff0c18 339 #if FSL_FEATURE_SMC_HAS_PORPO
mbed_official 146:f64d43ff0c18 340 /*!
mbed_official 146:f64d43ff0c18 341 * @brief Configures the POR (power-on-reset) option.
mbed_official 146:f64d43ff0c18 342 *
mbed_official 146:f64d43ff0c18 343 * This function sets the POR power option setting. It controls whether the
mbed_official 146:f64d43ff0c18 344 * POR detect circuit (for brown-out detection) is enabled in a certain stop mode.
mbed_official 146:f64d43ff0c18 345 * The setting either enables or disables the above feature when the POR
mbed_official 146:f64d43ff0c18 346 * occurs. See the reference manual for details.
mbed_official 146:f64d43ff0c18 347 *
mbed_official 324:406fd2029f23 348 * @param baseAddr Base address for current SMC instance.
mbed_official 146:f64d43ff0c18 349 * @param option POR option setting refer to smc_por_option_t
mbed_official 146:f64d43ff0c18 350 */
mbed_official 324:406fd2029f23 351 void SMC_HAL_SetPorMode(uint32_t baseAddr, smc_por_option_t option);
mbed_official 146:f64d43ff0c18 352
mbed_official 146:f64d43ff0c18 353 /*!
mbed_official 146:f64d43ff0c18 354 * @brief Gets the configuration settings for the POR option.
mbed_official 146:f64d43ff0c18 355 *
mbed_official 146:f64d43ff0c18 356 * This function sets the POR power option setting. See the configuration function
mbed_official 146:f64d43ff0c18 357 * header for details.
mbed_official 146:f64d43ff0c18 358 *
mbed_official 324:406fd2029f23 359 * @param baseAddr Base address for current SMC instance.
mbed_official 146:f64d43ff0c18 360 * @return option Current POR option setting
mbed_official 146:f64d43ff0c18 361 */
mbed_official 324:406fd2029f23 362 smc_por_option_t SMC_HAL_GetPorMode(uint32_t baseAddr);
mbed_official 146:f64d43ff0c18 363 #endif
mbed_official 146:f64d43ff0c18 364
mbed_official 146:f64d43ff0c18 365 #if FSL_FEATURE_SMC_HAS_PSTOPO
mbed_official 146:f64d43ff0c18 366 /*!
mbed_official 324:406fd2029f23 367 * @brief Configures the PSTOPO (Partial Stop Option).
mbed_official 146:f64d43ff0c18 368 *
mbed_official 324:406fd2029f23 369 * This function sets the PSTOPO option. It controls whether a Partial
mbed_official 146:f64d43ff0c18 370 * Stop mode is entered when the STOPM=STOP. When entering a Partial Stop mode from the
mbed_official 146:f64d43ff0c18 371 * RUN mode, the PMC, MCG and Flash remain fully powered allowing the device
mbed_official 146:f64d43ff0c18 372 * to wakeup almost instantaneously at the expense of a higher power consumption.
mbed_official 146:f64d43ff0c18 373 * In PSTOP2, only the system clocks are gated, which allows the peripherals running on bus
mbed_official 146:f64d43ff0c18 374 * clock to remain fully functional. In PSTOP1, both system and bus clocks are
mbed_official 146:f64d43ff0c18 375 * gated. Refer to the smc_pstop_option_t for supported options. See the reference
mbed_official 146:f64d43ff0c18 376 * manual for details.
mbed_official 146:f64d43ff0c18 377 *
mbed_official 324:406fd2029f23 378 * @param baseAddr Base address for current SMC instance.
mbed_official 324:406fd2029f23 379 * @param option PSTOPO option setting defined in smc_pstop_option_t
mbed_official 146:f64d43ff0c18 380 */
mbed_official 324:406fd2029f23 381 void SMC_HAL_SetPstopMode(uint32_t baseAddr, smc_pstop_option_t option);
mbed_official 146:f64d43ff0c18 382
mbed_official 146:f64d43ff0c18 383 /*!
mbed_official 146:f64d43ff0c18 384 * @brief Gets the configuration of the PSTOPO option.
mbed_official 146:f64d43ff0c18 385 *
mbed_official 324:406fd2029f23 386 * This function gets the current PSTOPO option setting. See the configuration
mbed_official 146:f64d43ff0c18 387 * function for more details.
mbed_official 146:f64d43ff0c18 388 *
mbed_official 324:406fd2029f23 389 * @param baseAddr Base address for current SMC instance.
mbed_official 324:406fd2029f23 390 * @return option Current PSTOPO option setting
mbed_official 324:406fd2029f23 391 */
mbed_official 324:406fd2029f23 392 smc_pstop_option_t SMC_HAL_GetPstopMode(uint32_t baseAddr);
mbed_official 146:f64d43ff0c18 393 #endif
mbed_official 146:f64d43ff0c18 394
mbed_official 146:f64d43ff0c18 395 #if FSL_FEATURE_SMC_HAS_LPOPO
mbed_official 146:f64d43ff0c18 396 /*!
mbed_official 146:f64d43ff0c18 397 * @brief Configures the LPO option setting.
mbed_official 146:f64d43ff0c18 398 *
mbed_official 146:f64d43ff0c18 399 * This function sets the LPO option setting. It controls whether the 1 kHZ
mbed_official 146:f64d43ff0c18 400 * LPO clock is enabled in a certain lower power stop modes. See the
mbed_official 146:f64d43ff0c18 401 * smc_lpo_option_t for supported options and the reference manual for
mbed_official 146:f64d43ff0c18 402 * details about this option.
mbed_official 146:f64d43ff0c18 403 *
mbed_official 324:406fd2029f23 404 * @param baseAddr Base address for current SMC instance.
mbed_official 146:f64d43ff0c18 405 * @param option LPO option setting defined in smc_lpo_option_t
mbed_official 146:f64d43ff0c18 406 */
mbed_official 324:406fd2029f23 407 void SMC_HAL_SetLpoMode(uint32_t baseAddr, smc_lpo_option_t option);
mbed_official 146:f64d43ff0c18 408
mbed_official 146:f64d43ff0c18 409 /*!
mbed_official 146:f64d43ff0c18 410 * @brief Gets the settings of the LPO option.
mbed_official 146:f64d43ff0c18 411 *
mbed_official 146:f64d43ff0c18 412 * This function gets the current LPO option setting. See the configuration
mbed_official 146:f64d43ff0c18 413 * function for details.
mbed_official 146:f64d43ff0c18 414 *
mbed_official 324:406fd2029f23 415 * @param baseAddr Base address for current SMC instance.
mbed_official 146:f64d43ff0c18 416 * @return option Current LPO option setting
mbed_official 324:406fd2029f23 417 */
mbed_official 324:406fd2029f23 418 smc_por_option_t SMC_HAL_GetLpoMode(uint32_t baseAddr);
mbed_official 146:f64d43ff0c18 419 #endif
mbed_official 146:f64d43ff0c18 420
mbed_official 146:f64d43ff0c18 421 #if FSL_FEATURE_SMC_HAS_LPWUI
mbed_official 146:f64d43ff0c18 422 /*!
mbed_official 146:f64d43ff0c18 423 * @brief Configures the LPWUI (Low Power Wake Up on interrupt) option.
mbed_official 146:f64d43ff0c18 424 *
mbed_official 146:f64d43ff0c18 425 * This function sets the LPWUI option and cause the system to exit
mbed_official 146:f64d43ff0c18 426 * to normal RUN mode when any active interrupt occurs while in a specific lower
mbed_official 146:f64d43ff0c18 427 * power mode. See the smc_lpwui_option_t for supported options and the
mbed_official 146:f64d43ff0c18 428 * reference manual for more details about this option.
mbed_official 146:f64d43ff0c18 429 *
mbed_official 324:406fd2029f23 430 * @param baseAddr Base address for current SMC instance.
mbed_official 146:f64d43ff0c18 431 * @param option LPWUI option setting defined in smc_lpwui_option_t
mbed_official 146:f64d43ff0c18 432 */
mbed_official 324:406fd2029f23 433 void SMC_HAL_SetLpwuiMode(uint32_t baseAddr, smc_lpwui_option_t option);
mbed_official 146:f64d43ff0c18 434
mbed_official 146:f64d43ff0c18 435 /*!
mbed_official 146:f64d43ff0c18 436 * @brief Gets the current LPWUI option.
mbed_official 146:f64d43ff0c18 437 *
mbed_official 146:f64d43ff0c18 438 * This function gets the LPWUI option. See the configuration function for more
mbed_official 146:f64d43ff0c18 439 * details.
mbed_official 146:f64d43ff0c18 440 *
mbed_official 324:406fd2029f23 441 * @param baseAddr Base address for current SMC instance.
mbed_official 146:f64d43ff0c18 442 * @return setting Current LPWAUI option setting
mbed_official 324:406fd2029f23 443 */
mbed_official 324:406fd2029f23 444 smc_lpwui_option_t SMC_HAL_GetLpwuiMode(uint32_t baseAddr);
mbed_official 146:f64d43ff0c18 445 #endif
mbed_official 146:f64d43ff0c18 446
mbed_official 146:f64d43ff0c18 447 /*!
mbed_official 146:f64d43ff0c18 448 * @brief Gets the current power mode stat.
mbed_official 146:f64d43ff0c18 449 *
mbed_official 146:f64d43ff0c18 450 * This function returns the current power mode stat. Once application
mbed_official 146:f64d43ff0c18 451 * switches the power mode, it should always check the stat to check whether it
mbed_official 146:f64d43ff0c18 452 * runs into the specified mode or not. An application should check
mbed_official 146:f64d43ff0c18 453 * this mode before switching to a different mode. The system requires that
mbed_official 146:f64d43ff0c18 454 * only certain modes can switch to other specific modes. See the
mbed_official 146:f64d43ff0c18 455 * reference manual for details and the _power_mode_stat for information about
mbed_official 146:f64d43ff0c18 456 * the power stat.
mbed_official 146:f64d43ff0c18 457 *
mbed_official 324:406fd2029f23 458 * @param baseAddr Base address for current SMC instance.
mbed_official 146:f64d43ff0c18 459 * @return stat Current power mode stat
mbed_official 324:406fd2029f23 460 */
mbed_official 324:406fd2029f23 461 uint8_t SMC_HAL_GetStat(uint32_t baseAddr);
mbed_official 146:f64d43ff0c18 462
mbed_official 146:f64d43ff0c18 463 /*@}*/
mbed_official 146:f64d43ff0c18 464
mbed_official 146:f64d43ff0c18 465 #if defined(__cplusplus)
mbed_official 146:f64d43ff0c18 466 }
mbed_official 146:f64d43ff0c18 467 #endif /* __cplusplus*/
mbed_official 146:f64d43ff0c18 468
mbed_official 146:f64d43ff0c18 469 /*! @}*/
mbed_official 146:f64d43ff0c18 470
mbed_official 146:f64d43ff0c18 471 #endif /* __FSL_SMC_HAL_H__*/
mbed_official 146:f64d43ff0c18 472 /*******************************************************************************
mbed_official 146:f64d43ff0c18 473 * EOF
mbed_official 146:f64d43ff0c18 474 ******************************************************************************/
mbed_official 146:f64d43ff0c18 475