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 Apr 03 11:45:06 2014 +0100
Revision:
149:1fb5f62b92bd
Parent:
targets/hal/TARGET_Freescale/TARGET_KSDK_MCUS/TARGET_KSDK_CODE/hal/smc/fsl_smc_hal.c@146:f64d43ff0c18
Child:
324:406fd2029f23
Synchronized with git revision 220c0bb39ceee40016e1e86350c058963d01ed42

Full URL: https://github.com/mbedmicro/mbed/commit/220c0bb39ceee40016e1e86350c058963d01ed42/

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 #include "fsl_smc_hal.h"
mbed_official 146:f64d43ff0c18 32
mbed_official 146:f64d43ff0c18 33 /*******************************************************************************
mbed_official 146:f64d43ff0c18 34 * Definitions
mbed_official 146:f64d43ff0c18 35 ******************************************************************************/
mbed_official 146:f64d43ff0c18 36
mbed_official 146:f64d43ff0c18 37 /*******************************************************************************
mbed_official 146:f64d43ff0c18 38 * Code
mbed_official 146:f64d43ff0c18 39 ******************************************************************************/
mbed_official 146:f64d43ff0c18 40
mbed_official 146:f64d43ff0c18 41 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 42 *
mbed_official 146:f64d43ff0c18 43 * Function Name : smc_hal_config_power_mode_protection
mbed_official 146:f64d43ff0c18 44 * Description : Config all power mode protection settings
mbed_official 146:f64d43ff0c18 45 * This function will configure the power mode protection settings for
mbed_official 146:f64d43ff0c18 46 * supported power mode on the specified chip family. The availabe power modes
mbed_official 146:f64d43ff0c18 47 * are defined in smc_power_mode_protection_config_t. Application should provide
mbed_official 146:f64d43ff0c18 48 * the protect settings for all supported power mode on the chip and aslo this
mbed_official 146:f64d43ff0c18 49 * should be done at early system level init stage. Refer to reference manual
mbed_official 146:f64d43ff0c18 50 * for details. This register can only write once after power reset. So either
mbed_official 146:f64d43ff0c18 51 * use this function or use the individual set function if you only have single
mbed_official 146:f64d43ff0c18 52 * option to set.
mbed_official 146:f64d43ff0c18 53 *
mbed_official 146:f64d43ff0c18 54 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 55 void smc_hal_config_power_mode_protection(smc_power_mode_protection_config_t *protectConfig)
mbed_official 146:f64d43ff0c18 56 {
mbed_official 146:f64d43ff0c18 57 /* initialize the setting */
mbed_official 146:f64d43ff0c18 58 uint8_t regValue = 0;
mbed_official 146:f64d43ff0c18 59
mbed_official 146:f64d43ff0c18 60 /* check configurations for each mode and combine the seting together */
mbed_official 146:f64d43ff0c18 61 if (protectConfig->vlpProt)
mbed_official 146:f64d43ff0c18 62 {
mbed_official 146:f64d43ff0c18 63 regValue |= BF_SMC_PMPROT_AVLP(1);
mbed_official 146:f64d43ff0c18 64 }
mbed_official 146:f64d43ff0c18 65
mbed_official 146:f64d43ff0c18 66 if (protectConfig->llsProt)
mbed_official 146:f64d43ff0c18 67 {
mbed_official 146:f64d43ff0c18 68 regValue |= BF_SMC_PMPROT_ALLS(1);
mbed_official 146:f64d43ff0c18 69 }
mbed_official 146:f64d43ff0c18 70
mbed_official 146:f64d43ff0c18 71 if (protectConfig->vllsProt)
mbed_official 146:f64d43ff0c18 72 {
mbed_official 146:f64d43ff0c18 73 regValue |= BF_SMC_PMPROT_AVLLS(1);
mbed_official 146:f64d43ff0c18 74 }
mbed_official 146:f64d43ff0c18 75
mbed_official 146:f64d43ff0c18 76 /* write once into pmprot register*/
mbed_official 146:f64d43ff0c18 77 HW_SMC_PMPROT_SET(regValue);
mbed_official 146:f64d43ff0c18 78 }
mbed_official 146:f64d43ff0c18 79
mbed_official 146:f64d43ff0c18 80 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 81 *
mbed_official 146:f64d43ff0c18 82 * Function Name : smc_hal_set_power_mode_protection
mbed_official 146:f64d43ff0c18 83 * Description : Config the individual power mode protection setting
mbed_official 146:f64d43ff0c18 84 * This function will only configure the power mode protection settings for
mbed_official 146:f64d43ff0c18 85 * a specified power mode on the specified chip family. The availabe power modes
mbed_official 146:f64d43ff0c18 86 * are defined in smc_power_mode_protection_config_t. Refer to reference manual
mbed_official 146:f64d43ff0c18 87 * for details. This register can only write once after power reset.
mbed_official 146:f64d43ff0c18 88 *
mbed_official 146:f64d43ff0c18 89 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 90 void smc_hal_set_power_mode_protection(power_modes_protect_t protect, bool allow)
mbed_official 146:f64d43ff0c18 91 {
mbed_official 146:f64d43ff0c18 92 /* check the setting range */
mbed_official 146:f64d43ff0c18 93 assert(protect < kAllowMax);
mbed_official 146:f64d43ff0c18 94
mbed_official 146:f64d43ff0c18 95 /* branch according to mode and write the setting */
mbed_official 146:f64d43ff0c18 96 switch (protect)
mbed_official 146:f64d43ff0c18 97 {
mbed_official 146:f64d43ff0c18 98 case kAllowVlp:
mbed_official 146:f64d43ff0c18 99 if (allow)
mbed_official 146:f64d43ff0c18 100 {
mbed_official 146:f64d43ff0c18 101 BW_SMC_PMPROT_AVLP(1);
mbed_official 146:f64d43ff0c18 102 }
mbed_official 146:f64d43ff0c18 103 else
mbed_official 146:f64d43ff0c18 104 {
mbed_official 146:f64d43ff0c18 105 BW_SMC_PMPROT_AVLP(0);
mbed_official 146:f64d43ff0c18 106 }
mbed_official 146:f64d43ff0c18 107 break;
mbed_official 146:f64d43ff0c18 108 case kAllowLls:
mbed_official 146:f64d43ff0c18 109 if (allow)
mbed_official 146:f64d43ff0c18 110 {
mbed_official 146:f64d43ff0c18 111 BW_SMC_PMPROT_ALLS(1);
mbed_official 146:f64d43ff0c18 112 }
mbed_official 146:f64d43ff0c18 113 else
mbed_official 146:f64d43ff0c18 114 {
mbed_official 146:f64d43ff0c18 115 BW_SMC_PMPROT_ALLS(0);
mbed_official 146:f64d43ff0c18 116 }
mbed_official 146:f64d43ff0c18 117 break;
mbed_official 146:f64d43ff0c18 118 case kAllowVlls:
mbed_official 146:f64d43ff0c18 119 if (allow)
mbed_official 146:f64d43ff0c18 120 {
mbed_official 146:f64d43ff0c18 121 BW_SMC_PMPROT_AVLLS(1);
mbed_official 146:f64d43ff0c18 122 }
mbed_official 146:f64d43ff0c18 123 else
mbed_official 146:f64d43ff0c18 124 {
mbed_official 146:f64d43ff0c18 125 BW_SMC_PMPROT_AVLLS(0);
mbed_official 146:f64d43ff0c18 126 }
mbed_official 146:f64d43ff0c18 127 break;
mbed_official 146:f64d43ff0c18 128 default:
mbed_official 146:f64d43ff0c18 129 break;
mbed_official 146:f64d43ff0c18 130 }
mbed_official 146:f64d43ff0c18 131 }
mbed_official 146:f64d43ff0c18 132
mbed_official 146:f64d43ff0c18 133 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 134 *
mbed_official 146:f64d43ff0c18 135 * Function Name : smc_hal_get_power_mode_protection
mbed_official 146:f64d43ff0c18 136 * Description : Get the current power mode protection setting
mbed_official 146:f64d43ff0c18 137 * This function will get the current power mode protection settings for
mbed_official 146:f64d43ff0c18 138 * a specified power mode.
mbed_official 146:f64d43ff0c18 139 *
mbed_official 146:f64d43ff0c18 140 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 141 bool smc_hal_get_power_mode_protection(power_modes_protect_t protect)
mbed_official 146:f64d43ff0c18 142 {
mbed_official 146:f64d43ff0c18 143 /* check the mode range */
mbed_official 146:f64d43ff0c18 144 assert(protect < kAllowMax);
mbed_official 146:f64d43ff0c18 145
mbed_official 146:f64d43ff0c18 146 /* branch according to the mode and read the setting */
mbed_official 146:f64d43ff0c18 147 switch (protect)
mbed_official 146:f64d43ff0c18 148 {
mbed_official 146:f64d43ff0c18 149 case kAllowVlp:
mbed_official 146:f64d43ff0c18 150 return BR_SMC_PMPROT_AVLP;
mbed_official 146:f64d43ff0c18 151 case kAllowLls:
mbed_official 146:f64d43ff0c18 152 return BR_SMC_PMPROT_ALLS;
mbed_official 146:f64d43ff0c18 153 case kAllowVlls:
mbed_official 146:f64d43ff0c18 154 return BR_SMC_PMPROT_AVLLS;
mbed_official 146:f64d43ff0c18 155 default:
mbed_official 146:f64d43ff0c18 156 break;
mbed_official 146:f64d43ff0c18 157 }
mbed_official 146:f64d43ff0c18 158 return (false);
mbed_official 146:f64d43ff0c18 159 }
mbed_official 146:f64d43ff0c18 160
mbed_official 146:f64d43ff0c18 161 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 162 *
mbed_official 146:f64d43ff0c18 163 * Function Name : smc_hal_power_mode_config_run
mbed_official 146:f64d43ff0c18 164 * Description : Config the RUN mode control setting
mbed_official 146:f64d43ff0c18 165 * This function will set the run mode settings. For example, normal run mode,
mbed_official 146:f64d43ff0c18 166 * very lower power run mode, etc. Refer to smc_run_mode_t for supported run
mbed_official 146:f64d43ff0c18 167 * mode on the chip family. Refer to reference manual for details about the
mbed_official 146:f64d43ff0c18 168 * run mode.
mbed_official 146:f64d43ff0c18 169 *
mbed_official 146:f64d43ff0c18 170 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 171 void smc_hal_power_mode_config_run(smc_run_mode_t runMode)
mbed_official 146:f64d43ff0c18 172 {
mbed_official 146:f64d43ff0c18 173 BW_SMC_PMCTRL_RUNM(runMode);
mbed_official 146:f64d43ff0c18 174 }
mbed_official 146:f64d43ff0c18 175
mbed_official 146:f64d43ff0c18 176 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 177 *
mbed_official 146:f64d43ff0c18 178 * Function Name : smc_hal_power_mode_get_run_config
mbed_official 146:f64d43ff0c18 179 * Description : Get the current RUN mode config
mbed_official 146:f64d43ff0c18 180 * This function will get the run mode settings. Refer to smc_run_mode_t
mbed_official 146:f64d43ff0c18 181 * for supported run mode on the chip family. Refer to reference manual for
mbed_official 146:f64d43ff0c18 182 * details about the run mode.
mbed_official 146:f64d43ff0c18 183 *
mbed_official 146:f64d43ff0c18 184 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 185 smc_run_mode_t smc_hal_power_mode_get_run_config(void)
mbed_official 146:f64d43ff0c18 186 {
mbed_official 146:f64d43ff0c18 187 return (smc_run_mode_t)BR_SMC_PMCTRL_RUNM;
mbed_official 146:f64d43ff0c18 188 }
mbed_official 146:f64d43ff0c18 189
mbed_official 146:f64d43ff0c18 190 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 191 *
mbed_official 146:f64d43ff0c18 192 * Function Name : smc_hal_power_mode_config_stop
mbed_official 146:f64d43ff0c18 193 * Description : Config the STOP mode control setting
mbed_official 146:f64d43ff0c18 194 * This function will set the stop mode settings. For example, normal stop mode,
mbed_official 146:f64d43ff0c18 195 * very lower power stop mode, etc. Refer to smc_stop_mode_t for supported stop
mbed_official 146:f64d43ff0c18 196 * mode on the chip family. Refer to reference manual for details about the
mbed_official 146:f64d43ff0c18 197 * stop mode.
mbed_official 146:f64d43ff0c18 198 *
mbed_official 146:f64d43ff0c18 199 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 200 void smc_hal_power_mode_config_stop(smc_stop_mode_t stopMode)
mbed_official 146:f64d43ff0c18 201 {
mbed_official 146:f64d43ff0c18 202 BW_SMC_PMCTRL_STOPM(stopMode);
mbed_official 146:f64d43ff0c18 203 }
mbed_official 146:f64d43ff0c18 204
mbed_official 146:f64d43ff0c18 205 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 206 *
mbed_official 146:f64d43ff0c18 207 * Function Name : smc_hal_power_mode_get_stop_config
mbed_official 146:f64d43ff0c18 208 * Description : Get the current STOP mode control setting
mbed_official 146:f64d43ff0c18 209 * This function will get the stop mode settings. For example, normal stop mode,
mbed_official 146:f64d43ff0c18 210 * very lower power stop mode, etc. Refer to smc_stop_mode_t for supported stop
mbed_official 146:f64d43ff0c18 211 * mode on the chip family. Refer to reference manual for details about the
mbed_official 146:f64d43ff0c18 212 * stop mode.
mbed_official 146:f64d43ff0c18 213 *
mbed_official 146:f64d43ff0c18 214 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 215 smc_stop_mode_t smc_hal_power_mode_get_stop_config(void)
mbed_official 146:f64d43ff0c18 216 {
mbed_official 146:f64d43ff0c18 217 return (smc_stop_mode_t)BR_SMC_PMCTRL_STOPM;
mbed_official 146:f64d43ff0c18 218 }
mbed_official 146:f64d43ff0c18 219
mbed_official 146:f64d43ff0c18 220 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 221 *
mbed_official 146:f64d43ff0c18 222 * Function Name : smc_hal_power_mode_config_stop_submode
mbed_official 146:f64d43ff0c18 223 * Description : Config the stop sub mode control setting
mbed_official 146:f64d43ff0c18 224 * This function will set the stop submode settings. Some of the stop mode will
mbed_official 146:f64d43ff0c18 225 * further have submode supported. Refer to smc_stop_submode_t for supported
mbed_official 146:f64d43ff0c18 226 * stop submode and Refer to reference manual for details about the submode
mbed_official 146:f64d43ff0c18 227 * for specific stop mode.
mbed_official 146:f64d43ff0c18 228 *
mbed_official 146:f64d43ff0c18 229 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 230 void smc_hal_power_mode_config_stop_submode(smc_stop_submode_t stopSubMode)
mbed_official 146:f64d43ff0c18 231 {
mbed_official 146:f64d43ff0c18 232 #if FSL_FEATURE_SMC_USE_VLLSCTRL_REG
mbed_official 146:f64d43ff0c18 233 BW_SMC_VLLSCTRL_VLLSM(stopSubMode);
mbed_official 146:f64d43ff0c18 234 #else
mbed_official 146:f64d43ff0c18 235 #if FSL_FEATURE_SMC_USE_STOPCTRL_VLLSM
mbed_official 146:f64d43ff0c18 236 BW_SMC_STOPCTRL_VLLSM(stopSubMode);
mbed_official 146:f64d43ff0c18 237 #else
mbed_official 146:f64d43ff0c18 238 BW_SMC_STOPCTRL_LLSM(stopSubMode);
mbed_official 146:f64d43ff0c18 239 #endif
mbed_official 146:f64d43ff0c18 240 #endif
mbed_official 146:f64d43ff0c18 241 }
mbed_official 146:f64d43ff0c18 242
mbed_official 146:f64d43ff0c18 243 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 244 *
mbed_official 146:f64d43ff0c18 245 * Function Name : smc_hal_power_mode_get_stop_submode_config
mbed_official 146:f64d43ff0c18 246 * Description : Get the current stop submode config
mbed_official 146:f64d43ff0c18 247 * This function will get the stop submode settings. Some of the stop mode will
mbed_official 146:f64d43ff0c18 248 * further have submode supported. Refer to smc_stop_submode_t for supported
mbed_official 146:f64d43ff0c18 249 * stop submode and Refer to reference manual for details about the submode
mbed_official 146:f64d43ff0c18 250 * for specific stop mode.
mbed_official 146:f64d43ff0c18 251 *
mbed_official 146:f64d43ff0c18 252 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 253 smc_stop_submode_t smc_hal_power_mode_get_stop_submode_config(void)
mbed_official 146:f64d43ff0c18 254 {
mbed_official 146:f64d43ff0c18 255 #if FSL_FEATURE_SMC_USE_VLLSCTRL_REG
mbed_official 146:f64d43ff0c18 256 return (smc_stop_submode_t)BR_SMC_VLLSCTRL_VLLSM;
mbed_official 146:f64d43ff0c18 257 #else
mbed_official 146:f64d43ff0c18 258 #if FSL_FEATURE_SMC_USE_STOPCTRL_VLLSM
mbed_official 146:f64d43ff0c18 259 return (smc_stop_submode_t)BR_SMC_STOPCTRL_VLLSM;
mbed_official 146:f64d43ff0c18 260 #else
mbed_official 146:f64d43ff0c18 261 return (smc_stop_submode_t)BR_SMC_STOPCTRL_LLSM;
mbed_official 146:f64d43ff0c18 262 #endif
mbed_official 146:f64d43ff0c18 263 #endif
mbed_official 146:f64d43ff0c18 264 }
mbed_official 146:f64d43ff0c18 265
mbed_official 146:f64d43ff0c18 266 #if FSL_FEATURE_SMC_HAS_PORPO
mbed_official 146:f64d43ff0c18 267 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 268 *
mbed_official 146:f64d43ff0c18 269 * Function Name : smc_hal_config_por_power_option
mbed_official 146:f64d43ff0c18 270 * Description : Config the POR (power-on-reset) option
mbed_official 146:f64d43ff0c18 271 * This function will set the POR power option setting. It controls whether the
mbed_official 146:f64d43ff0c18 272 * POR detect circuit (for brown-out detection) is enabled in certain stop mode.
mbed_official 146:f64d43ff0c18 273 * The setting will be either enable or disable the above feature when POR
mbed_official 146:f64d43ff0c18 274 * happened. Refer to reference manual for details.
mbed_official 146:f64d43ff0c18 275 *
mbed_official 146:f64d43ff0c18 276 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 277 void smc_hal_config_por_power_option(smc_por_option_t option)
mbed_official 146:f64d43ff0c18 278 {
mbed_official 146:f64d43ff0c18 279 #if FSL_FEATURE_SMC_USE_VLLSCTRL_REG
mbed_official 146:f64d43ff0c18 280 BW_SMC_VLLSCTRL_PORPO(option);
mbed_official 146:f64d43ff0c18 281 #else
mbed_official 146:f64d43ff0c18 282 BW_SMC_STOPCTRL_PORPO(option);
mbed_official 146:f64d43ff0c18 283 #endif
mbed_official 146:f64d43ff0c18 284 }
mbed_official 146:f64d43ff0c18 285
mbed_official 146:f64d43ff0c18 286 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 287 *
mbed_official 146:f64d43ff0c18 288 * Function Name : smc_hal_get_por_power_config
mbed_official 146:f64d43ff0c18 289 * Description : Get the config of POR option
mbed_official 146:f64d43ff0c18 290 * This function will set the POR power option setting. See config function
mbed_official 146:f64d43ff0c18 291 * header for details.
mbed_official 146:f64d43ff0c18 292 *
mbed_official 146:f64d43ff0c18 293 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 294 smc_por_option_t smc_hal_get_por_power_config(void)
mbed_official 146:f64d43ff0c18 295 {
mbed_official 146:f64d43ff0c18 296 #if FSL_FEATURE_SMC_USE_VLLSCTRL_REG
mbed_official 146:f64d43ff0c18 297 return (smc_por_option_t)BR_SMC_VLLSCTRL_PORPO;
mbed_official 146:f64d43ff0c18 298 #else
mbed_official 146:f64d43ff0c18 299 return (smc_por_option_t)BR_SMC_STOPCTRL_PORPO;
mbed_official 146:f64d43ff0c18 300 #endif
mbed_official 146:f64d43ff0c18 301 }
mbed_official 146:f64d43ff0c18 302 #endif
mbed_official 146:f64d43ff0c18 303
mbed_official 146:f64d43ff0c18 304 #if FSL_FEATURE_SMC_HAS_PSTOPO
mbed_official 146:f64d43ff0c18 305 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 306 *
mbed_official 146:f64d43ff0c18 307 * Function Name : smc_hal_get_por_power_config
mbed_official 146:f64d43ff0c18 308 * Description : Config the PSTOPOR (Partial Stop Option)
mbed_official 146:f64d43ff0c18 309 * This function will set the PSTOPOR option. It controls whether a Partial
mbed_official 146:f64d43ff0c18 310 * Stop mode is entered when STOPM=STOP. When entering a Partial Stop mode from
mbed_official 146:f64d43ff0c18 311 * RUN mode, the PMC, MCG and flash remain fully powered, allowing the device
mbed_official 146:f64d43ff0c18 312 * to wakeup almost instantaneously at the expense of higher power consumption.
mbed_official 146:f64d43ff0c18 313 * In PSTOP2, only system clocks are gated allowing peripherals running on bus
mbed_official 146:f64d43ff0c18 314 * clock to remain fully functional. In PSTOP1, both system and bus clocks are
mbed_official 146:f64d43ff0c18 315 * gated. Refer to smc_pstop_option_t for supported options. Refer to reference
mbed_official 146:f64d43ff0c18 316 * manual for details.
mbed_official 146:f64d43ff0c18 317 *
mbed_official 146:f64d43ff0c18 318 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 319 void smc_hal_config_pstop_power_option(smc_pstop_option_t option)
mbed_official 146:f64d43ff0c18 320 {
mbed_official 146:f64d43ff0c18 321 BW_SMC_PMCTRL_STOPM(option);
mbed_official 146:f64d43ff0c18 322 }
mbed_official 146:f64d43ff0c18 323
mbed_official 146:f64d43ff0c18 324 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 325 *
mbed_official 146:f64d43ff0c18 326 * Function Name : smc_hal_get_por_power_config
mbed_official 146:f64d43ff0c18 327 * Description : Get the config of PSTOPO option
mbed_official 146:f64d43ff0c18 328 * This function will get the current PSTOPOR option setting. Refer to config
mbed_official 146:f64d43ff0c18 329 * function for more details.
mbed_official 146:f64d43ff0c18 330 *
mbed_official 146:f64d43ff0c18 331 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 332 smc_por_option_t smc_hal_get_pstop_power_config(void)
mbed_official 146:f64d43ff0c18 333 {
mbed_official 146:f64d43ff0c18 334 return (smc_por_option_t)BR_SMC_PMCTRL_STOPM;
mbed_official 146:f64d43ff0c18 335 }
mbed_official 146:f64d43ff0c18 336 #endif
mbed_official 146:f64d43ff0c18 337
mbed_official 146:f64d43ff0c18 338 #if FSL_FEATURE_SMC_HAS_LPOPO
mbed_official 146:f64d43ff0c18 339 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 340 *
mbed_official 146:f64d43ff0c18 341 * Function Name : smc_hal_get_por_power_config
mbed_official 146:f64d43ff0c18 342 * Description : Config the LPO option setting
mbed_official 146:f64d43ff0c18 343 * This function will set the LPO option setting. It controls whether the 1kHZ
mbed_official 146:f64d43ff0c18 344 * LPO clock is enabled in certain lower power stop modes. Refer to
mbed_official 146:f64d43ff0c18 345 * smc_lpo_option_t for supported options and refer to reference manual for
mbed_official 146:f64d43ff0c18 346 * details about this option.
mbed_official 146:f64d43ff0c18 347 *
mbed_official 146:f64d43ff0c18 348 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 349 void smc_hal_config_lpo_power_option(smc_lpo_option_t option)
mbed_official 146:f64d43ff0c18 350 {
mbed_official 146:f64d43ff0c18 351 BW_SMC_STOPCTRL_LPOPO(option);
mbed_official 146:f64d43ff0c18 352 }
mbed_official 146:f64d43ff0c18 353
mbed_official 146:f64d43ff0c18 354 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 355 *
mbed_official 146:f64d43ff0c18 356 * Function Name : smc_hal_get_por_power_config
mbed_official 146:f64d43ff0c18 357 * Description : Get the config of LPO option
mbed_official 146:f64d43ff0c18 358 * This function will get the current LPO option setting. Refer to config
mbed_official 146:f64d43ff0c18 359 * function for details.
mbed_official 146:f64d43ff0c18 360 *
mbed_official 146:f64d43ff0c18 361 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 362 smc_por_option_t smc_hal_get_lpo_power_config(void)
mbed_official 146:f64d43ff0c18 363 {
mbed_official 146:f64d43ff0c18 364 return (smc_por_option_t)BR_SMC_STOPCTRL_LPOPO;
mbed_official 146:f64d43ff0c18 365 }
mbed_official 146:f64d43ff0c18 366 #endif
mbed_official 146:f64d43ff0c18 367
mbed_official 146:f64d43ff0c18 368 #if FSL_FEATURE_SMC_HAS_LPWUI
mbed_official 146:f64d43ff0c18 369 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 370 *
mbed_official 146:f64d43ff0c18 371 * Function Name : smc_hal_config_lpwui_option
mbed_official 146:f64d43ff0c18 372 * Description : Config the LPWUI (Low Power Wake Up on interrup) option
mbed_official 146:f64d43ff0c18 373 * This function will set the LPWUI option. It will cause the system to exit
mbed_official 146:f64d43ff0c18 374 * to normal RUN mode when any active interrupt occurs while in a certain lower
mbed_official 146:f64d43ff0c18 375 * power mode. Refer to smc_lpwui_option_t for supported options and refer to
mbed_official 146:f64d43ff0c18 376 * reference manual for more details about this option.
mbed_official 146:f64d43ff0c18 377 *
mbed_official 146:f64d43ff0c18 378 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 379 void smc_hal_config_lpwui_option(smc_lpwui_option_t option)
mbed_official 146:f64d43ff0c18 380 {
mbed_official 146:f64d43ff0c18 381 BW_SMC_PMCTRL_LPWUI(option);
mbed_official 146:f64d43ff0c18 382 }
mbed_official 146:f64d43ff0c18 383
mbed_official 146:f64d43ff0c18 384 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 385 *
mbed_official 146:f64d43ff0c18 386 * Function Name : smc_hal_config_lpwui_option
mbed_official 146:f64d43ff0c18 387 * Description : Get the current LPWUI option
mbed_official 146:f64d43ff0c18 388 * This function will get the LPWUI option. Refer to config function for more
mbed_official 146:f64d43ff0c18 389 * details.
mbed_official 146:f64d43ff0c18 390 *
mbed_official 146:f64d43ff0c18 391 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 392 smc_lpwui_option_t smc_hal_get_lpwui_config(void)
mbed_official 146:f64d43ff0c18 393 {
mbed_official 146:f64d43ff0c18 394 return (smc_lpwui_option_t)BR_SMC_PMCTRL_LPWUI;
mbed_official 146:f64d43ff0c18 395 }
mbed_official 146:f64d43ff0c18 396 #endif
mbed_official 146:f64d43ff0c18 397
mbed_official 146:f64d43ff0c18 398 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 399 *
mbed_official 146:f64d43ff0c18 400 * Function Name : smc_hal_get_power_mode_stat
mbed_official 146:f64d43ff0c18 401 * Description : Get the current power mode stat
mbed_official 146:f64d43ff0c18 402 * This function will return the current power mode stat. Once application is
mbed_official 146:f64d43ff0c18 403 * switching the power mode, it should always check the stat to make sure it
mbed_official 146:f64d43ff0c18 404 * runs into the specified mode or not. Also application will need to check
mbed_official 146:f64d43ff0c18 405 * this mode before switching to certain mode. The system will require that
mbed_official 146:f64d43ff0c18 406 * only certain mode could switch to other specific mode. Refer to the
mbed_official 146:f64d43ff0c18 407 * reference manual for details. Refer to _power_mode_stat for the meaning
mbed_official 146:f64d43ff0c18 408 * of the power stat
mbed_official 146:f64d43ff0c18 409 *
mbed_official 146:f64d43ff0c18 410 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 411 uint8_t smc_hal_get_power_mode_stat(void)
mbed_official 146:f64d43ff0c18 412 {
mbed_official 146:f64d43ff0c18 413 return BR_SMC_PMSTAT_PMSTAT;
mbed_official 146:f64d43ff0c18 414 }
mbed_official 146:f64d43ff0c18 415
mbed_official 146:f64d43ff0c18 416 /*******************************************************************************
mbed_official 146:f64d43ff0c18 417 * EOF
mbed_official 146:f64d43ff0c18 418 ******************************************************************************/
mbed_official 146:f64d43ff0c18 419