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/pmc/fsl_pmc_hal.h@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 #if !defined(__FSL_PMC_HAL_H__)
mbed_official 146:f64d43ff0c18 31 #define __FSL_PMC_HAL_H__
mbed_official 146:f64d43ff0c18 32
mbed_official 146:f64d43ff0c18 33 #include <stdint.h>
mbed_official 146:f64d43ff0c18 34 #include <stdbool.h>
mbed_official 146:f64d43ff0c18 35 #include <assert.h>
mbed_official 146:f64d43ff0c18 36 #include "fsl_pmc_features.h"
mbed_official 146:f64d43ff0c18 37
mbed_official 146:f64d43ff0c18 38 /*! @addtogroup pmc_hal*/
mbed_official 146:f64d43ff0c18 39 /*! @{*/
mbed_official 146:f64d43ff0c18 40
mbed_official 146:f64d43ff0c18 41 /*! @file fsl_pmc_hal.h */
mbed_official 146:f64d43ff0c18 42
mbed_official 146:f64d43ff0c18 43 /*******************************************************************************
mbed_official 146:f64d43ff0c18 44 * Definitions
mbed_official 146:f64d43ff0c18 45 ******************************************************************************/
mbed_official 146:f64d43ff0c18 46
mbed_official 146:f64d43ff0c18 47 /*! @brief Low-Voltage Warning Voltage Select*/
mbed_official 146:f64d43ff0c18 48 typedef enum _pmc_lvwv_select {
mbed_official 146:f64d43ff0c18 49 kPmcLvwvLowTrip, /*!< Low trip point selected (VLVW = VLVW1)*/
mbed_official 146:f64d43ff0c18 50 kPmcLvwvMid1Trip, /*!< Mid 1 trip point selected (VLVW = VLVW2)*/
mbed_official 146:f64d43ff0c18 51 kPmcLvwvMid2Trip, /*!< Mid 2 trip point selected (VLVW = VLVW3)*/
mbed_official 146:f64d43ff0c18 52 kPmcLvwvHighTrip /*!< High trip point selected (VLVW = VLVW4)*/
mbed_official 146:f64d43ff0c18 53 } pmc_lvwv_select_t;
mbed_official 146:f64d43ff0c18 54
mbed_official 146:f64d43ff0c18 55 /*! @brief Low-Voltage Detect Voltage Select*/
mbed_official 146:f64d43ff0c18 56 typedef enum _pmc_lvdv_select {
mbed_official 146:f64d43ff0c18 57 kPmcLvdvLowTrip, /*!< Low trip point selected (V LVD = V LVDL )*/
mbed_official 146:f64d43ff0c18 58 kPmcLvdvHighTrip, /*!< High trip point selected (V LVD = V LVDH )*/
mbed_official 146:f64d43ff0c18 59 } pmc_lvdv_select_t;
mbed_official 146:f64d43ff0c18 60
mbed_official 146:f64d43ff0c18 61
mbed_official 146:f64d43ff0c18 62 /*******************************************************************************
mbed_official 146:f64d43ff0c18 63 * API
mbed_official 146:f64d43ff0c18 64 ******************************************************************************/
mbed_official 146:f64d43ff0c18 65
mbed_official 146:f64d43ff0c18 66 #if defined(__cplusplus)
mbed_official 146:f64d43ff0c18 67 extern "C" {
mbed_official 146:f64d43ff0c18 68 #endif /* __cplusplus*/
mbed_official 146:f64d43ff0c18 69
mbed_official 146:f64d43ff0c18 70 /*! @name Power Management Controller Control APIs*/
mbed_official 146:f64d43ff0c18 71 /*@{*/
mbed_official 146:f64d43ff0c18 72
mbed_official 146:f64d43ff0c18 73
mbed_official 146:f64d43ff0c18 74 /*!
mbed_official 146:f64d43ff0c18 75 * @brief Low-Voltage Detect Interrupt Enable
mbed_official 146:f64d43ff0c18 76 *
mbed_official 146:f64d43ff0c18 77 * This function enables the interrupt for the low voltage detection. When
mbed_official 146:f64d43ff0c18 78 * enabled, if the LVDF (Low Voltage Detect Flag) is set, a hardware interrupt
mbed_official 146:f64d43ff0c18 79 * occurs.
mbed_official 146:f64d43ff0c18 80 *
mbed_official 146:f64d43ff0c18 81 */
mbed_official 146:f64d43ff0c18 82 static inline void pmc_hal_enable_low_voltage_detect_interrupt(void)
mbed_official 146:f64d43ff0c18 83 {
mbed_official 146:f64d43ff0c18 84 BW_PMC_LVDSC1_LVDIE(1);
mbed_official 146:f64d43ff0c18 85 }
mbed_official 146:f64d43ff0c18 86
mbed_official 146:f64d43ff0c18 87 /*!
mbed_official 146:f64d43ff0c18 88 * @brief Low-Voltage Detect Interrupt Disable (use polling)
mbed_official 146:f64d43ff0c18 89 *
mbed_official 146:f64d43ff0c18 90 * This function disables the the interrupt for low voltage detection. When
mbed_official 146:f64d43ff0c18 91 * disabled, an application can only check the low voltage through polling the LVDF
mbed_official 146:f64d43ff0c18 92 * (Low Voltage Detect Flag).
mbed_official 146:f64d43ff0c18 93 *
mbed_official 146:f64d43ff0c18 94 */
mbed_official 146:f64d43ff0c18 95 static inline void pmc_hal_disable_low_voltage_detect_interrupt(void)
mbed_official 146:f64d43ff0c18 96 {
mbed_official 146:f64d43ff0c18 97 BW_PMC_LVDSC1_LVDIE(0);
mbed_official 146:f64d43ff0c18 98 }
mbed_official 146:f64d43ff0c18 99
mbed_official 146:f64d43ff0c18 100 /*!
mbed_official 146:f64d43ff0c18 101 * @brief Low-Voltage Detect Hardware Reset Enable (write once)
mbed_official 146:f64d43ff0c18 102 *
mbed_official 146:f64d43ff0c18 103 * This function enables the hardware reset for the low voltage detection.
mbed_official 146:f64d43ff0c18 104 * When enabled, if the LVDF (Low Voltage Detect Flag) is set, a hardware reset
mbed_official 146:f64d43ff0c18 105 * occurs. This setting is a write-once-only; Additional writes are
mbed_official 146:f64d43ff0c18 106 * ignored.
mbed_official 146:f64d43ff0c18 107 *
mbed_official 146:f64d43ff0c18 108 */
mbed_official 146:f64d43ff0c18 109 static inline void pmc_hal_enable_low_voltage_detect_reset(void)
mbed_official 146:f64d43ff0c18 110 {
mbed_official 146:f64d43ff0c18 111 BW_PMC_LVDSC1_LVDRE(1);
mbed_official 146:f64d43ff0c18 112 }
mbed_official 146:f64d43ff0c18 113
mbed_official 146:f64d43ff0c18 114 /*!
mbed_official 146:f64d43ff0c18 115 * @brief Low-Voltage Detect Hardware Reset Disable
mbed_official 146:f64d43ff0c18 116 *
mbed_official 146:f64d43ff0c18 117 * This function disables the the hardware reset for low voltage detection.
mbed_official 146:f64d43ff0c18 118 * When disabled, if the LVDF (Low Voltage Detect Flag) is set, a hardware reset
mbed_official 146:f64d43ff0c18 119 * does not occur. This setting is a write-once-only; Additional writes are
mbed_official 146:f64d43ff0c18 120 * ignored.
mbed_official 146:f64d43ff0c18 121 *
mbed_official 146:f64d43ff0c18 122 */
mbed_official 146:f64d43ff0c18 123 static inline void pmc_hal_disable_low_voltage_detect_reset(void)
mbed_official 146:f64d43ff0c18 124 {
mbed_official 146:f64d43ff0c18 125 BW_PMC_LVDSC1_LVDRE(0);
mbed_official 146:f64d43ff0c18 126 }
mbed_official 146:f64d43ff0c18 127
mbed_official 146:f64d43ff0c18 128 /*!
mbed_official 146:f64d43ff0c18 129 * @brief Low-Voltage Detect Acknowledge
mbed_official 146:f64d43ff0c18 130 *
mbed_official 146:f64d43ff0c18 131 * This function acknowledges the low voltage detection errors (write 1 to
mbed_official 146:f64d43ff0c18 132 * clear LVDF).
mbed_official 146:f64d43ff0c18 133 *
mbed_official 146:f64d43ff0c18 134 */
mbed_official 146:f64d43ff0c18 135 static inline void pmc_hal_low_voltage_detect_ack(void)
mbed_official 146:f64d43ff0c18 136 {
mbed_official 146:f64d43ff0c18 137 BW_PMC_LVDSC1_LVDACK(1);
mbed_official 146:f64d43ff0c18 138 }
mbed_official 146:f64d43ff0c18 139
mbed_official 146:f64d43ff0c18 140 /*!
mbed_official 146:f64d43ff0c18 141 * @brief Low-Voltage Detect Flag Read
mbed_official 146:f64d43ff0c18 142 *
mbed_official 146:f64d43ff0c18 143 * This function reads the current LVDF status. If it returns 1, low
mbed_official 146:f64d43ff0c18 144 * voltage event is detected.
mbed_official 146:f64d43ff0c18 145 *
mbed_official 146:f64d43ff0c18 146 * @return status Current low voltage detect flag
mbed_official 146:f64d43ff0c18 147 * - true: Low-Voltage detected
mbed_official 146:f64d43ff0c18 148 * - false: Low-Voltage not detected
mbed_official 146:f64d43ff0c18 149 */
mbed_official 146:f64d43ff0c18 150 static inline bool pmc_hal_get_low_voltage_detect_flag(void)
mbed_official 146:f64d43ff0c18 151 {
mbed_official 146:f64d43ff0c18 152 return BR_PMC_LVDSC1_LVDF;
mbed_official 146:f64d43ff0c18 153 }
mbed_official 146:f64d43ff0c18 154
mbed_official 146:f64d43ff0c18 155 /*!
mbed_official 146:f64d43ff0c18 156 * @brief Sets the Low-Voltage Detect Voltage Select
mbed_official 146:f64d43ff0c18 157 *
mbed_official 146:f64d43ff0c18 158 * This function sets the low voltage detect voltage select. It sets
mbed_official 146:f64d43ff0c18 159 * the low voltage detect trip point voltage (Vlvd). An application can select
mbed_official 146:f64d43ff0c18 160 * either a low-trip or a high-trip point. See a chip reference manual for details.
mbed_official 146:f64d43ff0c18 161 *
mbed_official 146:f64d43ff0c18 162 * @param select Voltage select setting defined in pmc_lvdv_select_t
mbed_official 146:f64d43ff0c18 163 */
mbed_official 146:f64d43ff0c18 164 static inline void pmc_hal_set_low_voltage_detect_voltage_select(pmc_lvdv_select_t select)
mbed_official 146:f64d43ff0c18 165 {
mbed_official 146:f64d43ff0c18 166 BW_PMC_LVDSC1_LVDV(select);
mbed_official 146:f64d43ff0c18 167 }
mbed_official 146:f64d43ff0c18 168
mbed_official 146:f64d43ff0c18 169 /*!
mbed_official 146:f64d43ff0c18 170 * @brief Gets the Low-Voltage Detect Voltage Select
mbed_official 146:f64d43ff0c18 171 *
mbed_official 146:f64d43ff0c18 172 * This function gets the low voltage detect voltage select. It gets
mbed_official 146:f64d43ff0c18 173 * the low voltage detect trip point voltage (Vlvd). An application can select
mbed_official 146:f64d43ff0c18 174 * either a low-trip or a high-trip point. See a chip reference manual for details.
mbed_official 146:f64d43ff0c18 175 *
mbed_official 146:f64d43ff0c18 176 * @return select Current voltage select setting
mbed_official 146:f64d43ff0c18 177 */
mbed_official 146:f64d43ff0c18 178 static inline pmc_lvdv_select_t pmc_hal_get_low_voltage_detect_voltage_select(void)
mbed_official 146:f64d43ff0c18 179 {
mbed_official 146:f64d43ff0c18 180 return (pmc_lvdv_select_t)BR_PMC_LVDSC1_LVDV;
mbed_official 146:f64d43ff0c18 181 }
mbed_official 146:f64d43ff0c18 182
mbed_official 146:f64d43ff0c18 183
mbed_official 146:f64d43ff0c18 184 /*!
mbed_official 146:f64d43ff0c18 185 * @brief Low-Voltage Warning Interrupt Enable
mbed_official 146:f64d43ff0c18 186 *
mbed_official 146:f64d43ff0c18 187 * This function enables the interrupt for the low voltage warning
mbed_official 146:f64d43ff0c18 188 * detection. When enabled, if the LVWF (Low Voltage Warning Flag) is set,
mbed_official 146:f64d43ff0c18 189 * a hardware interrupt occurs.
mbed_official 146:f64d43ff0c18 190 *
mbed_official 146:f64d43ff0c18 191 */
mbed_official 146:f64d43ff0c18 192 static inline void pmc_hal_enable_low_voltage_warning_interrupt(void)
mbed_official 146:f64d43ff0c18 193 {
mbed_official 146:f64d43ff0c18 194 BW_PMC_LVDSC2_LVWIE(1);
mbed_official 146:f64d43ff0c18 195 }
mbed_official 146:f64d43ff0c18 196
mbed_official 146:f64d43ff0c18 197 /*!
mbed_official 146:f64d43ff0c18 198 * @brief Low-Voltage Warning Interrupt Disable (use polling)
mbed_official 146:f64d43ff0c18 199 *
mbed_official 146:f64d43ff0c18 200 * This function disables the interrupt for the low voltage warning
mbed_official 146:f64d43ff0c18 201 * detection. When disabled, if the LVWF (Low Voltage Warning Flag) is set,
mbed_official 146:f64d43ff0c18 202 * a hardware interrupt does not occur.
mbed_official 146:f64d43ff0c18 203 *
mbed_official 146:f64d43ff0c18 204 */
mbed_official 146:f64d43ff0c18 205 static inline void pmc_hal_disable_low_voltage_warning_interrupt(void)
mbed_official 146:f64d43ff0c18 206 {
mbed_official 146:f64d43ff0c18 207 BW_PMC_LVDSC2_LVWIE(0);
mbed_official 146:f64d43ff0c18 208 }
mbed_official 146:f64d43ff0c18 209
mbed_official 146:f64d43ff0c18 210 /*!
mbed_official 146:f64d43ff0c18 211 * @brief Low-Voltage Warning Acknowledge
mbed_official 146:f64d43ff0c18 212 *
mbed_official 146:f64d43ff0c18 213 * This function acknowledges the low voltage warning errors (write 1 to
mbed_official 146:f64d43ff0c18 214 * clear LVWF).
mbed_official 146:f64d43ff0c18 215 *
mbed_official 146:f64d43ff0c18 216 */
mbed_official 146:f64d43ff0c18 217 static inline void pmc_hal_low_voltage_warning_ack(void)
mbed_official 146:f64d43ff0c18 218 {
mbed_official 146:f64d43ff0c18 219 BW_PMC_LVDSC2_LVWACK(1);
mbed_official 146:f64d43ff0c18 220 }
mbed_official 146:f64d43ff0c18 221
mbed_official 146:f64d43ff0c18 222 /*!
mbed_official 146:f64d43ff0c18 223 * @brief Low-Voltage Warning Flag Read
mbed_official 146:f64d43ff0c18 224 *
mbed_official 146:f64d43ff0c18 225 * This function polls the current LVWF status. When 1 is returned, it
mbed_official 146:f64d43ff0c18 226 * indicates a low-voltage warning event. LVWF is set when V Supply transitions
mbed_official 146:f64d43ff0c18 227 * below the trip point or after reset and V Supply is already below the V LVW.
mbed_official 146:f64d43ff0c18 228 *
mbed_official 146:f64d43ff0c18 229 * @return status Current LVWF status
mbed_official 146:f64d43ff0c18 230 - true: Low-Voltage Warning Flag is set.
mbed_official 146:f64d43ff0c18 231 - false: the Low-Voltage Warning does not happen.
mbed_official 146:f64d43ff0c18 232 */
mbed_official 146:f64d43ff0c18 233 static inline bool pmc_hal_get_low_voltage_warning_flag(void)
mbed_official 146:f64d43ff0c18 234 {
mbed_official 146:f64d43ff0c18 235 return BR_PMC_LVDSC2_LVWF;
mbed_official 146:f64d43ff0c18 236 }
mbed_official 146:f64d43ff0c18 237
mbed_official 146:f64d43ff0c18 238 /*!
mbed_official 146:f64d43ff0c18 239 * @brief Sets the Low-Voltage Warning Voltage Select.
mbed_official 146:f64d43ff0c18 240 *
mbed_official 146:f64d43ff0c18 241 * This function sets the low voltage warning voltage select. It sets
mbed_official 146:f64d43ff0c18 242 * the low voltage warning trip point voltage (Vlvw). An application can select
mbed_official 146:f64d43ff0c18 243 * either a low, mid1, mid2 and a high-trip point. See a chip reference manual for
mbed_official 146:f64d43ff0c18 244 * details and the pmc_lvwv_select_t for supported settings.
mbed_official 146:f64d43ff0c18 245 *
mbed_official 146:f64d43ff0c18 246 * @param select Low voltage warning select setting
mbed_official 146:f64d43ff0c18 247 */
mbed_official 146:f64d43ff0c18 248 static inline void pmc_hal_set_low_voltage_warning_voltage_select(pmc_lvwv_select_t select)
mbed_official 146:f64d43ff0c18 249 {
mbed_official 146:f64d43ff0c18 250 BW_PMC_LVDSC2_LVWV(select);
mbed_official 146:f64d43ff0c18 251 }
mbed_official 146:f64d43ff0c18 252
mbed_official 146:f64d43ff0c18 253 /*!
mbed_official 146:f64d43ff0c18 254 * @brief Gets the Low-Voltage Warning Voltage Select.
mbed_official 146:f64d43ff0c18 255 *
mbed_official 146:f64d43ff0c18 256 * This function gets the low voltage warning voltage select. It gets
mbed_official 146:f64d43ff0c18 257 * the low voltage warning trip point voltage (Vlvw). See the pmc_lvwv_select_t
mbed_official 146:f64d43ff0c18 258 * for supported settings.
mbed_official 146:f64d43ff0c18 259 *
mbed_official 146:f64d43ff0c18 260 * @return select Current low voltage warning select setting
mbed_official 146:f64d43ff0c18 261 */
mbed_official 146:f64d43ff0c18 262 static inline pmc_lvwv_select_t pmc_hal_get_low_voltage_warning_voltage_select(void)
mbed_official 146:f64d43ff0c18 263 {
mbed_official 146:f64d43ff0c18 264 return (pmc_lvwv_select_t)BR_PMC_LVDSC2_LVWV;
mbed_official 146:f64d43ff0c18 265 }
mbed_official 146:f64d43ff0c18 266
mbed_official 146:f64d43ff0c18 267 #if FSL_FEATURE_SMC_HAS_BGEN
mbed_official 146:f64d43ff0c18 268 /*!
mbed_official 146:f64d43ff0c18 269 * @brief Enables the Bandgap in VLPx Operation.
mbed_official 146:f64d43ff0c18 270 *
mbed_official 146:f64d43ff0c18 271 * This function enables the bandgap in lower power modes of operation (VLPx,
mbed_official 146:f64d43ff0c18 272 * LLS, and VLLSx). When on-chip peripherals require the bandgap voltage
mbed_official 146:f64d43ff0c18 273 * reference in low power modes of operation, set BGEN to continue to enable
mbed_official 146:f64d43ff0c18 274 * the bandgap operation.
mbed_official 146:f64d43ff0c18 275 *
mbed_official 146:f64d43ff0c18 276 */
mbed_official 146:f64d43ff0c18 277 static inline void pmc_hal_enable_bandgap_in_low_power_mode(void)
mbed_official 146:f64d43ff0c18 278 {
mbed_official 146:f64d43ff0c18 279 BW_PMC_REGSC_BGEN(1);
mbed_official 146:f64d43ff0c18 280 }
mbed_official 146:f64d43ff0c18 281
mbed_official 146:f64d43ff0c18 282 /*!
mbed_official 146:f64d43ff0c18 283 * @brief Disables the Bandgap in the VLPx Operation.
mbed_official 146:f64d43ff0c18 284 *
mbed_official 146:f64d43ff0c18 285 * This function disables the bandgap in lower power modes of operation (VLPx,
mbed_official 146:f64d43ff0c18 286 * LLS, and VLLSx). When the bandgap voltage reference is not needed in low
mbed_official 146:f64d43ff0c18 287 * power modes, disable BGEN to avoid excess power consumption.
mbed_official 146:f64d43ff0c18 288 *
mbed_official 146:f64d43ff0c18 289 */
mbed_official 146:f64d43ff0c18 290 static inline void pmc_hal_disable_bandgap_in_low_power_mode(void)
mbed_official 146:f64d43ff0c18 291 {
mbed_official 146:f64d43ff0c18 292 BW_PMC_REGSC_BGEN(0);
mbed_official 146:f64d43ff0c18 293 }
mbed_official 146:f64d43ff0c18 294 #endif
mbed_official 146:f64d43ff0c18 295
mbed_official 146:f64d43ff0c18 296 /*!
mbed_official 146:f64d43ff0c18 297 * @brief Enables the Bandgap Buffer.
mbed_official 146:f64d43ff0c18 298 *
mbed_official 146:f64d43ff0c18 299 * This function enables the Bandgap buffer.
mbed_official 146:f64d43ff0c18 300 *
mbed_official 146:f64d43ff0c18 301 */
mbed_official 146:f64d43ff0c18 302 static inline void pmc_hal_enable_bandgap_buffer(void)
mbed_official 146:f64d43ff0c18 303 {
mbed_official 146:f64d43ff0c18 304 BW_PMC_REGSC_BGBE(1);
mbed_official 146:f64d43ff0c18 305 }
mbed_official 146:f64d43ff0c18 306
mbed_official 146:f64d43ff0c18 307 /*!
mbed_official 146:f64d43ff0c18 308 * @brief Disables the Bandgap Buffer.
mbed_official 146:f64d43ff0c18 309 *
mbed_official 146:f64d43ff0c18 310 * This function disables the Bandgap buffer.
mbed_official 146:f64d43ff0c18 311 *
mbed_official 146:f64d43ff0c18 312 */
mbed_official 146:f64d43ff0c18 313 static inline void pmc_hal_disable_bandgap_buffer(void)
mbed_official 146:f64d43ff0c18 314 {
mbed_official 146:f64d43ff0c18 315 BW_PMC_REGSC_BGBE(0);
mbed_official 146:f64d43ff0c18 316 }
mbed_official 146:f64d43ff0c18 317
mbed_official 146:f64d43ff0c18 318 /*!
mbed_official 146:f64d43ff0c18 319 * @brief Gets the Acknowledge Isolation.
mbed_official 146:f64d43ff0c18 320 *
mbed_official 146:f64d43ff0c18 321 * This function reads the Acknowledge Isolation setting that indicates
mbed_official 146:f64d43ff0c18 322 * whether certain peripherals and the I/O pads are in a latched state as
mbed_official 146:f64d43ff0c18 323 * a result of having been in the VLLS mode.
mbed_official 146:f64d43ff0c18 324 *
mbed_official 146:f64d43ff0c18 325 * @return value ACK isolation
mbed_official 146:f64d43ff0c18 326 * 0 - Peripherals and I/O pads are in a normal run state.
mbed_official 146:f64d43ff0c18 327 * 1 - Certain peripherals and I/O pads are in an isolated and
mbed_official 146:f64d43ff0c18 328 * latched state.
mbed_official 146:f64d43ff0c18 329 */
mbed_official 146:f64d43ff0c18 330 static inline uint8_t pmc_hal_get_ack_isolation(void)
mbed_official 146:f64d43ff0c18 331 {
mbed_official 146:f64d43ff0c18 332 return BR_PMC_REGSC_ACKISO;
mbed_official 146:f64d43ff0c18 333 }
mbed_official 146:f64d43ff0c18 334
mbed_official 146:f64d43ff0c18 335 /*!
mbed_official 146:f64d43ff0c18 336 * @brief Clears an Acknowledge Isolation.
mbed_official 146:f64d43ff0c18 337 *
mbed_official 146:f64d43ff0c18 338 * This function clears the ACK Isolation flag. Writing one to this setting
mbed_official 146:f64d43ff0c18 339 * when it is set releases the I/O pads and certain peripherals to their normal
mbed_official 146:f64d43ff0c18 340 * run mode state.
mbed_official 146:f64d43ff0c18 341 *
mbed_official 146:f64d43ff0c18 342 */
mbed_official 146:f64d43ff0c18 343 static inline void pmc_hal_clear_ack_isolation(void)
mbed_official 146:f64d43ff0c18 344 {
mbed_official 146:f64d43ff0c18 345 BW_PMC_REGSC_ACKISO(1);
mbed_official 146:f64d43ff0c18 346 }
mbed_official 146:f64d43ff0c18 347
mbed_official 146:f64d43ff0c18 348 /*!
mbed_official 146:f64d43ff0c18 349 * @brief Gets the Regulator regulation status.
mbed_official 146:f64d43ff0c18 350 *
mbed_official 146:f64d43ff0c18 351 * This function returns the regulator to a run regulation status. It provides
mbed_official 146:f64d43ff0c18 352 * the current status of the internal voltage regulator.
mbed_official 146:f64d43ff0c18 353 *
mbed_official 146:f64d43ff0c18 354 * @return value Regulation status
mbed_official 146:f64d43ff0c18 355 * 0 - Regulator is in a stop regulation or in transition to/from it.
mbed_official 146:f64d43ff0c18 356 * 1 - Regulator is in a run regulation.
mbed_official 146:f64d43ff0c18 357 *
mbed_official 146:f64d43ff0c18 358 */
mbed_official 146:f64d43ff0c18 359 static inline uint8_t pmc_hal_get_regulator_status(void)
mbed_official 146:f64d43ff0c18 360 {
mbed_official 146:f64d43ff0c18 361 return BR_PMC_REGSC_REGONS;
mbed_official 146:f64d43ff0c18 362 }
mbed_official 146:f64d43ff0c18 363
mbed_official 146:f64d43ff0c18 364 /*@}*/
mbed_official 146:f64d43ff0c18 365
mbed_official 146:f64d43ff0c18 366 #if defined(__cplusplus)
mbed_official 146:f64d43ff0c18 367 }
mbed_official 146:f64d43ff0c18 368 #endif /* __cplusplus*/
mbed_official 146:f64d43ff0c18 369
mbed_official 146:f64d43ff0c18 370 /*! @}*/
mbed_official 146:f64d43ff0c18 371
mbed_official 146:f64d43ff0c18 372 #endif /* __FSL_PMC_HAL_H__*/
mbed_official 146:f64d43ff0c18 373 /*******************************************************************************
mbed_official 146:f64d43ff0c18 374 * EOF
mbed_official 146:f64d43ff0c18 375 ******************************************************************************/
mbed_official 146:f64d43ff0c18 376