mbed(SerialHalfDuplex入り)
Fork of mbed by
TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/pmc/fsl_pmc_hal.h@82:6473597d706e, 2014-04-07 (annotated)
- Committer:
- bogdanm
- Date:
- Mon Apr 07 18:28:36 2014 +0100
- Revision:
- 82:6473597d706e
- Child:
- 90:cb3d968589d8
Release 82 of the mbed library
Main changes:
- support for K64F
- Revisited Nordic code structure
- Test infrastructure improvements
- various bug fixes
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 82:6473597d706e | 1 | /* |
bogdanm | 82:6473597d706e | 2 | * Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc. |
bogdanm | 82:6473597d706e | 3 | * All rights reserved. |
bogdanm | 82:6473597d706e | 4 | * |
bogdanm | 82:6473597d706e | 5 | * Redistribution and use in source and binary forms, with or without modification, |
bogdanm | 82:6473597d706e | 6 | * are permitted provided that the following conditions are met: |
bogdanm | 82:6473597d706e | 7 | * |
bogdanm | 82:6473597d706e | 8 | * o Redistributions of source code must retain the above copyright notice, this list |
bogdanm | 82:6473597d706e | 9 | * of conditions and the following disclaimer. |
bogdanm | 82:6473597d706e | 10 | * |
bogdanm | 82:6473597d706e | 11 | * o Redistributions in binary form must reproduce the above copyright notice, this |
bogdanm | 82:6473597d706e | 12 | * list of conditions and the following disclaimer in the documentation and/or |
bogdanm | 82:6473597d706e | 13 | * other materials provided with the distribution. |
bogdanm | 82:6473597d706e | 14 | * |
bogdanm | 82:6473597d706e | 15 | * o Neither the name of Freescale Semiconductor, Inc. nor the names of its |
bogdanm | 82:6473597d706e | 16 | * contributors may be used to endorse or promote products derived from this |
bogdanm | 82:6473597d706e | 17 | * software without specific prior written permission. |
bogdanm | 82:6473597d706e | 18 | * |
bogdanm | 82:6473597d706e | 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
bogdanm | 82:6473597d706e | 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
bogdanm | 82:6473597d706e | 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
bogdanm | 82:6473597d706e | 22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
bogdanm | 82:6473597d706e | 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
bogdanm | 82:6473597d706e | 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
bogdanm | 82:6473597d706e | 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
bogdanm | 82:6473597d706e | 26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
bogdanm | 82:6473597d706e | 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
bogdanm | 82:6473597d706e | 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
bogdanm | 82:6473597d706e | 29 | */ |
bogdanm | 82:6473597d706e | 30 | #if !defined(__FSL_PMC_HAL_H__) |
bogdanm | 82:6473597d706e | 31 | #define __FSL_PMC_HAL_H__ |
bogdanm | 82:6473597d706e | 32 | |
bogdanm | 82:6473597d706e | 33 | #include <stdint.h> |
bogdanm | 82:6473597d706e | 34 | #include <stdbool.h> |
bogdanm | 82:6473597d706e | 35 | #include <assert.h> |
bogdanm | 82:6473597d706e | 36 | #include "fsl_pmc_features.h" |
bogdanm | 82:6473597d706e | 37 | |
bogdanm | 82:6473597d706e | 38 | /*! @addtogroup pmc_hal*/ |
bogdanm | 82:6473597d706e | 39 | /*! @{*/ |
bogdanm | 82:6473597d706e | 40 | |
bogdanm | 82:6473597d706e | 41 | /*! @file fsl_pmc_hal.h */ |
bogdanm | 82:6473597d706e | 42 | |
bogdanm | 82:6473597d706e | 43 | /******************************************************************************* |
bogdanm | 82:6473597d706e | 44 | * Definitions |
bogdanm | 82:6473597d706e | 45 | ******************************************************************************/ |
bogdanm | 82:6473597d706e | 46 | |
bogdanm | 82:6473597d706e | 47 | /*! @brief Low-Voltage Warning Voltage Select*/ |
bogdanm | 82:6473597d706e | 48 | typedef enum _pmc_lvwv_select { |
bogdanm | 82:6473597d706e | 49 | kPmcLvwvLowTrip, /*!< Low trip point selected (VLVW = VLVW1)*/ |
bogdanm | 82:6473597d706e | 50 | kPmcLvwvMid1Trip, /*!< Mid 1 trip point selected (VLVW = VLVW2)*/ |
bogdanm | 82:6473597d706e | 51 | kPmcLvwvMid2Trip, /*!< Mid 2 trip point selected (VLVW = VLVW3)*/ |
bogdanm | 82:6473597d706e | 52 | kPmcLvwvHighTrip /*!< High trip point selected (VLVW = VLVW4)*/ |
bogdanm | 82:6473597d706e | 53 | } pmc_lvwv_select_t; |
bogdanm | 82:6473597d706e | 54 | |
bogdanm | 82:6473597d706e | 55 | /*! @brief Low-Voltage Detect Voltage Select*/ |
bogdanm | 82:6473597d706e | 56 | typedef enum _pmc_lvdv_select { |
bogdanm | 82:6473597d706e | 57 | kPmcLvdvLowTrip, /*!< Low trip point selected (V LVD = V LVDL )*/ |
bogdanm | 82:6473597d706e | 58 | kPmcLvdvHighTrip, /*!< High trip point selected (V LVD = V LVDH )*/ |
bogdanm | 82:6473597d706e | 59 | } pmc_lvdv_select_t; |
bogdanm | 82:6473597d706e | 60 | |
bogdanm | 82:6473597d706e | 61 | |
bogdanm | 82:6473597d706e | 62 | /******************************************************************************* |
bogdanm | 82:6473597d706e | 63 | * API |
bogdanm | 82:6473597d706e | 64 | ******************************************************************************/ |
bogdanm | 82:6473597d706e | 65 | |
bogdanm | 82:6473597d706e | 66 | #if defined(__cplusplus) |
bogdanm | 82:6473597d706e | 67 | extern "C" { |
bogdanm | 82:6473597d706e | 68 | #endif /* __cplusplus*/ |
bogdanm | 82:6473597d706e | 69 | |
bogdanm | 82:6473597d706e | 70 | /*! @name Power Management Controller Control APIs*/ |
bogdanm | 82:6473597d706e | 71 | /*@{*/ |
bogdanm | 82:6473597d706e | 72 | |
bogdanm | 82:6473597d706e | 73 | |
bogdanm | 82:6473597d706e | 74 | /*! |
bogdanm | 82:6473597d706e | 75 | * @brief Low-Voltage Detect Interrupt Enable |
bogdanm | 82:6473597d706e | 76 | * |
bogdanm | 82:6473597d706e | 77 | * This function enables the interrupt for the low voltage detection. When |
bogdanm | 82:6473597d706e | 78 | * enabled, if the LVDF (Low Voltage Detect Flag) is set, a hardware interrupt |
bogdanm | 82:6473597d706e | 79 | * occurs. |
bogdanm | 82:6473597d706e | 80 | * |
bogdanm | 82:6473597d706e | 81 | */ |
bogdanm | 82:6473597d706e | 82 | static inline void pmc_hal_enable_low_voltage_detect_interrupt(void) |
bogdanm | 82:6473597d706e | 83 | { |
bogdanm | 82:6473597d706e | 84 | BW_PMC_LVDSC1_LVDIE(1); |
bogdanm | 82:6473597d706e | 85 | } |
bogdanm | 82:6473597d706e | 86 | |
bogdanm | 82:6473597d706e | 87 | /*! |
bogdanm | 82:6473597d706e | 88 | * @brief Low-Voltage Detect Interrupt Disable (use polling) |
bogdanm | 82:6473597d706e | 89 | * |
bogdanm | 82:6473597d706e | 90 | * This function disables the the interrupt for low voltage detection. When |
bogdanm | 82:6473597d706e | 91 | * disabled, an application can only check the low voltage through polling the LVDF |
bogdanm | 82:6473597d706e | 92 | * (Low Voltage Detect Flag). |
bogdanm | 82:6473597d706e | 93 | * |
bogdanm | 82:6473597d706e | 94 | */ |
bogdanm | 82:6473597d706e | 95 | static inline void pmc_hal_disable_low_voltage_detect_interrupt(void) |
bogdanm | 82:6473597d706e | 96 | { |
bogdanm | 82:6473597d706e | 97 | BW_PMC_LVDSC1_LVDIE(0); |
bogdanm | 82:6473597d706e | 98 | } |
bogdanm | 82:6473597d706e | 99 | |
bogdanm | 82:6473597d706e | 100 | /*! |
bogdanm | 82:6473597d706e | 101 | * @brief Low-Voltage Detect Hardware Reset Enable (write once) |
bogdanm | 82:6473597d706e | 102 | * |
bogdanm | 82:6473597d706e | 103 | * This function enables the hardware reset for the low voltage detection. |
bogdanm | 82:6473597d706e | 104 | * When enabled, if the LVDF (Low Voltage Detect Flag) is set, a hardware reset |
bogdanm | 82:6473597d706e | 105 | * occurs. This setting is a write-once-only; Additional writes are |
bogdanm | 82:6473597d706e | 106 | * ignored. |
bogdanm | 82:6473597d706e | 107 | * |
bogdanm | 82:6473597d706e | 108 | */ |
bogdanm | 82:6473597d706e | 109 | static inline void pmc_hal_enable_low_voltage_detect_reset(void) |
bogdanm | 82:6473597d706e | 110 | { |
bogdanm | 82:6473597d706e | 111 | BW_PMC_LVDSC1_LVDRE(1); |
bogdanm | 82:6473597d706e | 112 | } |
bogdanm | 82:6473597d706e | 113 | |
bogdanm | 82:6473597d706e | 114 | /*! |
bogdanm | 82:6473597d706e | 115 | * @brief Low-Voltage Detect Hardware Reset Disable |
bogdanm | 82:6473597d706e | 116 | * |
bogdanm | 82:6473597d706e | 117 | * This function disables the the hardware reset for low voltage detection. |
bogdanm | 82:6473597d706e | 118 | * When disabled, if the LVDF (Low Voltage Detect Flag) is set, a hardware reset |
bogdanm | 82:6473597d706e | 119 | * does not occur. This setting is a write-once-only; Additional writes are |
bogdanm | 82:6473597d706e | 120 | * ignored. |
bogdanm | 82:6473597d706e | 121 | * |
bogdanm | 82:6473597d706e | 122 | */ |
bogdanm | 82:6473597d706e | 123 | static inline void pmc_hal_disable_low_voltage_detect_reset(void) |
bogdanm | 82:6473597d706e | 124 | { |
bogdanm | 82:6473597d706e | 125 | BW_PMC_LVDSC1_LVDRE(0); |
bogdanm | 82:6473597d706e | 126 | } |
bogdanm | 82:6473597d706e | 127 | |
bogdanm | 82:6473597d706e | 128 | /*! |
bogdanm | 82:6473597d706e | 129 | * @brief Low-Voltage Detect Acknowledge |
bogdanm | 82:6473597d706e | 130 | * |
bogdanm | 82:6473597d706e | 131 | * This function acknowledges the low voltage detection errors (write 1 to |
bogdanm | 82:6473597d706e | 132 | * clear LVDF). |
bogdanm | 82:6473597d706e | 133 | * |
bogdanm | 82:6473597d706e | 134 | */ |
bogdanm | 82:6473597d706e | 135 | static inline void pmc_hal_low_voltage_detect_ack(void) |
bogdanm | 82:6473597d706e | 136 | { |
bogdanm | 82:6473597d706e | 137 | BW_PMC_LVDSC1_LVDACK(1); |
bogdanm | 82:6473597d706e | 138 | } |
bogdanm | 82:6473597d706e | 139 | |
bogdanm | 82:6473597d706e | 140 | /*! |
bogdanm | 82:6473597d706e | 141 | * @brief Low-Voltage Detect Flag Read |
bogdanm | 82:6473597d706e | 142 | * |
bogdanm | 82:6473597d706e | 143 | * This function reads the current LVDF status. If it returns 1, low |
bogdanm | 82:6473597d706e | 144 | * voltage event is detected. |
bogdanm | 82:6473597d706e | 145 | * |
bogdanm | 82:6473597d706e | 146 | * @return status Current low voltage detect flag |
bogdanm | 82:6473597d706e | 147 | * - true: Low-Voltage detected |
bogdanm | 82:6473597d706e | 148 | * - false: Low-Voltage not detected |
bogdanm | 82:6473597d706e | 149 | */ |
bogdanm | 82:6473597d706e | 150 | static inline bool pmc_hal_get_low_voltage_detect_flag(void) |
bogdanm | 82:6473597d706e | 151 | { |
bogdanm | 82:6473597d706e | 152 | return BR_PMC_LVDSC1_LVDF; |
bogdanm | 82:6473597d706e | 153 | } |
bogdanm | 82:6473597d706e | 154 | |
bogdanm | 82:6473597d706e | 155 | /*! |
bogdanm | 82:6473597d706e | 156 | * @brief Sets the Low-Voltage Detect Voltage Select |
bogdanm | 82:6473597d706e | 157 | * |
bogdanm | 82:6473597d706e | 158 | * This function sets the low voltage detect voltage select. It sets |
bogdanm | 82:6473597d706e | 159 | * the low voltage detect trip point voltage (Vlvd). An application can select |
bogdanm | 82:6473597d706e | 160 | * either a low-trip or a high-trip point. See a chip reference manual for details. |
bogdanm | 82:6473597d706e | 161 | * |
bogdanm | 82:6473597d706e | 162 | * @param select Voltage select setting defined in pmc_lvdv_select_t |
bogdanm | 82:6473597d706e | 163 | */ |
bogdanm | 82:6473597d706e | 164 | static inline void pmc_hal_set_low_voltage_detect_voltage_select(pmc_lvdv_select_t select) |
bogdanm | 82:6473597d706e | 165 | { |
bogdanm | 82:6473597d706e | 166 | BW_PMC_LVDSC1_LVDV(select); |
bogdanm | 82:6473597d706e | 167 | } |
bogdanm | 82:6473597d706e | 168 | |
bogdanm | 82:6473597d706e | 169 | /*! |
bogdanm | 82:6473597d706e | 170 | * @brief Gets the Low-Voltage Detect Voltage Select |
bogdanm | 82:6473597d706e | 171 | * |
bogdanm | 82:6473597d706e | 172 | * This function gets the low voltage detect voltage select. It gets |
bogdanm | 82:6473597d706e | 173 | * the low voltage detect trip point voltage (Vlvd). An application can select |
bogdanm | 82:6473597d706e | 174 | * either a low-trip or a high-trip point. See a chip reference manual for details. |
bogdanm | 82:6473597d706e | 175 | * |
bogdanm | 82:6473597d706e | 176 | * @return select Current voltage select setting |
bogdanm | 82:6473597d706e | 177 | */ |
bogdanm | 82:6473597d706e | 178 | static inline pmc_lvdv_select_t pmc_hal_get_low_voltage_detect_voltage_select(void) |
bogdanm | 82:6473597d706e | 179 | { |
bogdanm | 82:6473597d706e | 180 | return (pmc_lvdv_select_t)BR_PMC_LVDSC1_LVDV; |
bogdanm | 82:6473597d706e | 181 | } |
bogdanm | 82:6473597d706e | 182 | |
bogdanm | 82:6473597d706e | 183 | |
bogdanm | 82:6473597d706e | 184 | /*! |
bogdanm | 82:6473597d706e | 185 | * @brief Low-Voltage Warning Interrupt Enable |
bogdanm | 82:6473597d706e | 186 | * |
bogdanm | 82:6473597d706e | 187 | * This function enables the interrupt for the low voltage warning |
bogdanm | 82:6473597d706e | 188 | * detection. When enabled, if the LVWF (Low Voltage Warning Flag) is set, |
bogdanm | 82:6473597d706e | 189 | * a hardware interrupt occurs. |
bogdanm | 82:6473597d706e | 190 | * |
bogdanm | 82:6473597d706e | 191 | */ |
bogdanm | 82:6473597d706e | 192 | static inline void pmc_hal_enable_low_voltage_warning_interrupt(void) |
bogdanm | 82:6473597d706e | 193 | { |
bogdanm | 82:6473597d706e | 194 | BW_PMC_LVDSC2_LVWIE(1); |
bogdanm | 82:6473597d706e | 195 | } |
bogdanm | 82:6473597d706e | 196 | |
bogdanm | 82:6473597d706e | 197 | /*! |
bogdanm | 82:6473597d706e | 198 | * @brief Low-Voltage Warning Interrupt Disable (use polling) |
bogdanm | 82:6473597d706e | 199 | * |
bogdanm | 82:6473597d706e | 200 | * This function disables the interrupt for the low voltage warning |
bogdanm | 82:6473597d706e | 201 | * detection. When disabled, if the LVWF (Low Voltage Warning Flag) is set, |
bogdanm | 82:6473597d706e | 202 | * a hardware interrupt does not occur. |
bogdanm | 82:6473597d706e | 203 | * |
bogdanm | 82:6473597d706e | 204 | */ |
bogdanm | 82:6473597d706e | 205 | static inline void pmc_hal_disable_low_voltage_warning_interrupt(void) |
bogdanm | 82:6473597d706e | 206 | { |
bogdanm | 82:6473597d706e | 207 | BW_PMC_LVDSC2_LVWIE(0); |
bogdanm | 82:6473597d706e | 208 | } |
bogdanm | 82:6473597d706e | 209 | |
bogdanm | 82:6473597d706e | 210 | /*! |
bogdanm | 82:6473597d706e | 211 | * @brief Low-Voltage Warning Acknowledge |
bogdanm | 82:6473597d706e | 212 | * |
bogdanm | 82:6473597d706e | 213 | * This function acknowledges the low voltage warning errors (write 1 to |
bogdanm | 82:6473597d706e | 214 | * clear LVWF). |
bogdanm | 82:6473597d706e | 215 | * |
bogdanm | 82:6473597d706e | 216 | */ |
bogdanm | 82:6473597d706e | 217 | static inline void pmc_hal_low_voltage_warning_ack(void) |
bogdanm | 82:6473597d706e | 218 | { |
bogdanm | 82:6473597d706e | 219 | BW_PMC_LVDSC2_LVWACK(1); |
bogdanm | 82:6473597d706e | 220 | } |
bogdanm | 82:6473597d706e | 221 | |
bogdanm | 82:6473597d706e | 222 | /*! |
bogdanm | 82:6473597d706e | 223 | * @brief Low-Voltage Warning Flag Read |
bogdanm | 82:6473597d706e | 224 | * |
bogdanm | 82:6473597d706e | 225 | * This function polls the current LVWF status. When 1 is returned, it |
bogdanm | 82:6473597d706e | 226 | * indicates a low-voltage warning event. LVWF is set when V Supply transitions |
bogdanm | 82:6473597d706e | 227 | * below the trip point or after reset and V Supply is already below the V LVW. |
bogdanm | 82:6473597d706e | 228 | * |
bogdanm | 82:6473597d706e | 229 | * @return status Current LVWF status |
bogdanm | 82:6473597d706e | 230 | - true: Low-Voltage Warning Flag is set. |
bogdanm | 82:6473597d706e | 231 | - false: the Low-Voltage Warning does not happen. |
bogdanm | 82:6473597d706e | 232 | */ |
bogdanm | 82:6473597d706e | 233 | static inline bool pmc_hal_get_low_voltage_warning_flag(void) |
bogdanm | 82:6473597d706e | 234 | { |
bogdanm | 82:6473597d706e | 235 | return BR_PMC_LVDSC2_LVWF; |
bogdanm | 82:6473597d706e | 236 | } |
bogdanm | 82:6473597d706e | 237 | |
bogdanm | 82:6473597d706e | 238 | /*! |
bogdanm | 82:6473597d706e | 239 | * @brief Sets the Low-Voltage Warning Voltage Select. |
bogdanm | 82:6473597d706e | 240 | * |
bogdanm | 82:6473597d706e | 241 | * This function sets the low voltage warning voltage select. It sets |
bogdanm | 82:6473597d706e | 242 | * the low voltage warning trip point voltage (Vlvw). An application can select |
bogdanm | 82:6473597d706e | 243 | * either a low, mid1, mid2 and a high-trip point. See a chip reference manual for |
bogdanm | 82:6473597d706e | 244 | * details and the pmc_lvwv_select_t for supported settings. |
bogdanm | 82:6473597d706e | 245 | * |
bogdanm | 82:6473597d706e | 246 | * @param select Low voltage warning select setting |
bogdanm | 82:6473597d706e | 247 | */ |
bogdanm | 82:6473597d706e | 248 | static inline void pmc_hal_set_low_voltage_warning_voltage_select(pmc_lvwv_select_t select) |
bogdanm | 82:6473597d706e | 249 | { |
bogdanm | 82:6473597d706e | 250 | BW_PMC_LVDSC2_LVWV(select); |
bogdanm | 82:6473597d706e | 251 | } |
bogdanm | 82:6473597d706e | 252 | |
bogdanm | 82:6473597d706e | 253 | /*! |
bogdanm | 82:6473597d706e | 254 | * @brief Gets the Low-Voltage Warning Voltage Select. |
bogdanm | 82:6473597d706e | 255 | * |
bogdanm | 82:6473597d706e | 256 | * This function gets the low voltage warning voltage select. It gets |
bogdanm | 82:6473597d706e | 257 | * the low voltage warning trip point voltage (Vlvw). See the pmc_lvwv_select_t |
bogdanm | 82:6473597d706e | 258 | * for supported settings. |
bogdanm | 82:6473597d706e | 259 | * |
bogdanm | 82:6473597d706e | 260 | * @return select Current low voltage warning select setting |
bogdanm | 82:6473597d706e | 261 | */ |
bogdanm | 82:6473597d706e | 262 | static inline pmc_lvwv_select_t pmc_hal_get_low_voltage_warning_voltage_select(void) |
bogdanm | 82:6473597d706e | 263 | { |
bogdanm | 82:6473597d706e | 264 | return (pmc_lvwv_select_t)BR_PMC_LVDSC2_LVWV; |
bogdanm | 82:6473597d706e | 265 | } |
bogdanm | 82:6473597d706e | 266 | |
bogdanm | 82:6473597d706e | 267 | #if FSL_FEATURE_SMC_HAS_BGEN |
bogdanm | 82:6473597d706e | 268 | /*! |
bogdanm | 82:6473597d706e | 269 | * @brief Enables the Bandgap in VLPx Operation. |
bogdanm | 82:6473597d706e | 270 | * |
bogdanm | 82:6473597d706e | 271 | * This function enables the bandgap in lower power modes of operation (VLPx, |
bogdanm | 82:6473597d706e | 272 | * LLS, and VLLSx). When on-chip peripherals require the bandgap voltage |
bogdanm | 82:6473597d706e | 273 | * reference in low power modes of operation, set BGEN to continue to enable |
bogdanm | 82:6473597d706e | 274 | * the bandgap operation. |
bogdanm | 82:6473597d706e | 275 | * |
bogdanm | 82:6473597d706e | 276 | */ |
bogdanm | 82:6473597d706e | 277 | static inline void pmc_hal_enable_bandgap_in_low_power_mode(void) |
bogdanm | 82:6473597d706e | 278 | { |
bogdanm | 82:6473597d706e | 279 | BW_PMC_REGSC_BGEN(1); |
bogdanm | 82:6473597d706e | 280 | } |
bogdanm | 82:6473597d706e | 281 | |
bogdanm | 82:6473597d706e | 282 | /*! |
bogdanm | 82:6473597d706e | 283 | * @brief Disables the Bandgap in the VLPx Operation. |
bogdanm | 82:6473597d706e | 284 | * |
bogdanm | 82:6473597d706e | 285 | * This function disables the bandgap in lower power modes of operation (VLPx, |
bogdanm | 82:6473597d706e | 286 | * LLS, and VLLSx). When the bandgap voltage reference is not needed in low |
bogdanm | 82:6473597d706e | 287 | * power modes, disable BGEN to avoid excess power consumption. |
bogdanm | 82:6473597d706e | 288 | * |
bogdanm | 82:6473597d706e | 289 | */ |
bogdanm | 82:6473597d706e | 290 | static inline void pmc_hal_disable_bandgap_in_low_power_mode(void) |
bogdanm | 82:6473597d706e | 291 | { |
bogdanm | 82:6473597d706e | 292 | BW_PMC_REGSC_BGEN(0); |
bogdanm | 82:6473597d706e | 293 | } |
bogdanm | 82:6473597d706e | 294 | #endif |
bogdanm | 82:6473597d706e | 295 | |
bogdanm | 82:6473597d706e | 296 | /*! |
bogdanm | 82:6473597d706e | 297 | * @brief Enables the Bandgap Buffer. |
bogdanm | 82:6473597d706e | 298 | * |
bogdanm | 82:6473597d706e | 299 | * This function enables the Bandgap buffer. |
bogdanm | 82:6473597d706e | 300 | * |
bogdanm | 82:6473597d706e | 301 | */ |
bogdanm | 82:6473597d706e | 302 | static inline void pmc_hal_enable_bandgap_buffer(void) |
bogdanm | 82:6473597d706e | 303 | { |
bogdanm | 82:6473597d706e | 304 | BW_PMC_REGSC_BGBE(1); |
bogdanm | 82:6473597d706e | 305 | } |
bogdanm | 82:6473597d706e | 306 | |
bogdanm | 82:6473597d706e | 307 | /*! |
bogdanm | 82:6473597d706e | 308 | * @brief Disables the Bandgap Buffer. |
bogdanm | 82:6473597d706e | 309 | * |
bogdanm | 82:6473597d706e | 310 | * This function disables the Bandgap buffer. |
bogdanm | 82:6473597d706e | 311 | * |
bogdanm | 82:6473597d706e | 312 | */ |
bogdanm | 82:6473597d706e | 313 | static inline void pmc_hal_disable_bandgap_buffer(void) |
bogdanm | 82:6473597d706e | 314 | { |
bogdanm | 82:6473597d706e | 315 | BW_PMC_REGSC_BGBE(0); |
bogdanm | 82:6473597d706e | 316 | } |
bogdanm | 82:6473597d706e | 317 | |
bogdanm | 82:6473597d706e | 318 | /*! |
bogdanm | 82:6473597d706e | 319 | * @brief Gets the Acknowledge Isolation. |
bogdanm | 82:6473597d706e | 320 | * |
bogdanm | 82:6473597d706e | 321 | * This function reads the Acknowledge Isolation setting that indicates |
bogdanm | 82:6473597d706e | 322 | * whether certain peripherals and the I/O pads are in a latched state as |
bogdanm | 82:6473597d706e | 323 | * a result of having been in the VLLS mode. |
bogdanm | 82:6473597d706e | 324 | * |
bogdanm | 82:6473597d706e | 325 | * @return value ACK isolation |
bogdanm | 82:6473597d706e | 326 | * 0 - Peripherals and I/O pads are in a normal run state. |
bogdanm | 82:6473597d706e | 327 | * 1 - Certain peripherals and I/O pads are in an isolated and |
bogdanm | 82:6473597d706e | 328 | * latched state. |
bogdanm | 82:6473597d706e | 329 | */ |
bogdanm | 82:6473597d706e | 330 | static inline uint8_t pmc_hal_get_ack_isolation(void) |
bogdanm | 82:6473597d706e | 331 | { |
bogdanm | 82:6473597d706e | 332 | return BR_PMC_REGSC_ACKISO; |
bogdanm | 82:6473597d706e | 333 | } |
bogdanm | 82:6473597d706e | 334 | |
bogdanm | 82:6473597d706e | 335 | /*! |
bogdanm | 82:6473597d706e | 336 | * @brief Clears an Acknowledge Isolation. |
bogdanm | 82:6473597d706e | 337 | * |
bogdanm | 82:6473597d706e | 338 | * This function clears the ACK Isolation flag. Writing one to this setting |
bogdanm | 82:6473597d706e | 339 | * when it is set releases the I/O pads and certain peripherals to their normal |
bogdanm | 82:6473597d706e | 340 | * run mode state. |
bogdanm | 82:6473597d706e | 341 | * |
bogdanm | 82:6473597d706e | 342 | */ |
bogdanm | 82:6473597d706e | 343 | static inline void pmc_hal_clear_ack_isolation(void) |
bogdanm | 82:6473597d706e | 344 | { |
bogdanm | 82:6473597d706e | 345 | BW_PMC_REGSC_ACKISO(1); |
bogdanm | 82:6473597d706e | 346 | } |
bogdanm | 82:6473597d706e | 347 | |
bogdanm | 82:6473597d706e | 348 | /*! |
bogdanm | 82:6473597d706e | 349 | * @brief Gets the Regulator regulation status. |
bogdanm | 82:6473597d706e | 350 | * |
bogdanm | 82:6473597d706e | 351 | * This function returns the regulator to a run regulation status. It provides |
bogdanm | 82:6473597d706e | 352 | * the current status of the internal voltage regulator. |
bogdanm | 82:6473597d706e | 353 | * |
bogdanm | 82:6473597d706e | 354 | * @return value Regulation status |
bogdanm | 82:6473597d706e | 355 | * 0 - Regulator is in a stop regulation or in transition to/from it. |
bogdanm | 82:6473597d706e | 356 | * 1 - Regulator is in a run regulation. |
bogdanm | 82:6473597d706e | 357 | * |
bogdanm | 82:6473597d706e | 358 | */ |
bogdanm | 82:6473597d706e | 359 | static inline uint8_t pmc_hal_get_regulator_status(void) |
bogdanm | 82:6473597d706e | 360 | { |
bogdanm | 82:6473597d706e | 361 | return BR_PMC_REGSC_REGONS; |
bogdanm | 82:6473597d706e | 362 | } |
bogdanm | 82:6473597d706e | 363 | |
bogdanm | 82:6473597d706e | 364 | /*@}*/ |
bogdanm | 82:6473597d706e | 365 | |
bogdanm | 82:6473597d706e | 366 | #if defined(__cplusplus) |
bogdanm | 82:6473597d706e | 367 | } |
bogdanm | 82:6473597d706e | 368 | #endif /* __cplusplus*/ |
bogdanm | 82:6473597d706e | 369 | |
bogdanm | 82:6473597d706e | 370 | /*! @}*/ |
bogdanm | 82:6473597d706e | 371 | |
bogdanm | 82:6473597d706e | 372 | #endif /* __FSL_PMC_HAL_H__*/ |
bogdanm | 82:6473597d706e | 373 | /******************************************************************************* |
bogdanm | 82:6473597d706e | 374 | * EOF |
bogdanm | 82:6473597d706e | 375 | ******************************************************************************/ |
bogdanm | 82:6473597d706e | 376 |