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

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
171:3a7713b1edbc
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 145:64910690c574 1 /*
AnnaBridge 145:64910690c574 2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
AnnaBridge 145:64910690c574 3 * All rights reserved.
AnnaBridge 145:64910690c574 4 *
AnnaBridge 145:64910690c574 5 * Redistribution and use in source and binary forms, with or without modification,
AnnaBridge 145:64910690c574 6 * are permitted provided that the following conditions are met:
AnnaBridge 145:64910690c574 7 *
AnnaBridge 145:64910690c574 8 * o Redistributions of source code must retain the above copyright notice, this list
AnnaBridge 145:64910690c574 9 * of conditions and the following disclaimer.
AnnaBridge 145:64910690c574 10 *
AnnaBridge 145:64910690c574 11 * o Redistributions in binary form must reproduce the above copyright notice, this
AnnaBridge 145:64910690c574 12 * list of conditions and the following disclaimer in the documentation and/or
AnnaBridge 145:64910690c574 13 * other materials provided with the distribution.
AnnaBridge 145:64910690c574 14 *
AnnaBridge 145:64910690c574 15 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
AnnaBridge 145:64910690c574 16 * contributors may be used to endorse or promote products derived from this
AnnaBridge 145:64910690c574 17 * software without specific prior written permission.
AnnaBridge 145:64910690c574 18 *
AnnaBridge 145:64910690c574 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
AnnaBridge 145:64910690c574 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
AnnaBridge 145:64910690c574 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
AnnaBridge 145:64910690c574 22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
AnnaBridge 145:64910690c574 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
AnnaBridge 145:64910690c574 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
AnnaBridge 145:64910690c574 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
AnnaBridge 145:64910690c574 26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
AnnaBridge 145:64910690c574 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
AnnaBridge 145:64910690c574 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AnnaBridge 145:64910690c574 29 */
AnnaBridge 145:64910690c574 30 #ifndef _FSL_PMC_H_
AnnaBridge 145:64910690c574 31 #define _FSL_PMC_H_
AnnaBridge 145:64910690c574 32
AnnaBridge 145:64910690c574 33 #include "fsl_common.h"
AnnaBridge 145:64910690c574 34
AnnaBridge 145:64910690c574 35 /*! @addtogroup pmc */
AnnaBridge 145:64910690c574 36 /*! @{ */
AnnaBridge 145:64910690c574 37
AnnaBridge 145:64910690c574 38
AnnaBridge 145:64910690c574 39 /*******************************************************************************
AnnaBridge 145:64910690c574 40 * Definitions
AnnaBridge 145:64910690c574 41 ******************************************************************************/
AnnaBridge 145:64910690c574 42
AnnaBridge 145:64910690c574 43 /*! @name Driver version */
AnnaBridge 145:64910690c574 44 /*@{*/
AnnaBridge 145:64910690c574 45 /*! @brief PMC driver version */
AnnaBridge 145:64910690c574 46 #define FSL_PMC_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) /*!< Version 2.0.0. */
AnnaBridge 145:64910690c574 47 /*@}*/
AnnaBridge 145:64910690c574 48
AnnaBridge 145:64910690c574 49 #if (defined(FSL_FEATURE_PMC_HAS_LVDV) && FSL_FEATURE_PMC_HAS_LVDV)
AnnaBridge 145:64910690c574 50 /*!
AnnaBridge 145:64910690c574 51 * @brief Low-voltage Detect Voltage Select
AnnaBridge 145:64910690c574 52 */
AnnaBridge 145:64910690c574 53 typedef enum _pmc_low_volt_detect_volt_select
AnnaBridge 145:64910690c574 54 {
AnnaBridge 145:64910690c574 55 kPMC_LowVoltDetectLowTrip = 0U, /*!< Low-trip point selected (VLVD = VLVDL )*/
AnnaBridge 145:64910690c574 56 kPMC_LowVoltDetectHighTrip = 1U /*!< High-trip point selected (VLVD = VLVDH )*/
AnnaBridge 145:64910690c574 57 } pmc_low_volt_detect_volt_select_t;
AnnaBridge 145:64910690c574 58 #endif
AnnaBridge 145:64910690c574 59
AnnaBridge 145:64910690c574 60 #if (defined(FSL_FEATURE_PMC_HAS_LVWV) && FSL_FEATURE_PMC_HAS_LVWV)
AnnaBridge 145:64910690c574 61 /*!
AnnaBridge 145:64910690c574 62 * @brief Low-voltage Warning Voltage Select
AnnaBridge 145:64910690c574 63 */
AnnaBridge 145:64910690c574 64 typedef enum _pmc_low_volt_warning_volt_select
AnnaBridge 145:64910690c574 65 {
AnnaBridge 145:64910690c574 66 kPMC_LowVoltWarningLowTrip = 0U, /*!< Low-trip point selected (VLVW = VLVW1)*/
AnnaBridge 145:64910690c574 67 kPMC_LowVoltWarningMid1Trip = 1U, /*!< Mid 1 trip point selected (VLVW = VLVW2)*/
AnnaBridge 145:64910690c574 68 kPMC_LowVoltWarningMid2Trip = 2U, /*!< Mid 2 trip point selected (VLVW = VLVW3)*/
AnnaBridge 145:64910690c574 69 kPMC_LowVoltWarningHighTrip = 3U /*!< High-trip point selected (VLVW = VLVW4)*/
AnnaBridge 145:64910690c574 70 } pmc_low_volt_warning_volt_select_t;
AnnaBridge 145:64910690c574 71 #endif
AnnaBridge 145:64910690c574 72
AnnaBridge 145:64910690c574 73 #if (defined(FSL_FEATURE_PMC_HAS_HVDSC1) && FSL_FEATURE_PMC_HAS_HVDSC1)
AnnaBridge 145:64910690c574 74 /*!
AnnaBridge 145:64910690c574 75 * @brief High-voltage Detect Voltage Select
AnnaBridge 145:64910690c574 76 */
AnnaBridge 145:64910690c574 77 typedef enum _pmc_high_volt_detect_volt_select
AnnaBridge 145:64910690c574 78 {
AnnaBridge 145:64910690c574 79 kPMC_HighVoltDetectLowTrip = 0U, /*!< Low-trip point selected (VHVD = VHVDL )*/
AnnaBridge 145:64910690c574 80 kPMC_HighVoltDetectHighTrip = 1U /*!< High-trip point selected (VHVD = VHVDH )*/
AnnaBridge 145:64910690c574 81 } pmc_high_volt_detect_volt_select_t;
AnnaBridge 145:64910690c574 82 #endif /* FSL_FEATURE_PMC_HAS_HVDSC1 */
AnnaBridge 145:64910690c574 83
AnnaBridge 145:64910690c574 84 #if (defined(FSL_FEATURE_PMC_HAS_BGBDS) && FSL_FEATURE_PMC_HAS_BGBDS)
AnnaBridge 145:64910690c574 85 /*!
AnnaBridge 145:64910690c574 86 * @brief Bandgap Buffer Drive Select.
AnnaBridge 145:64910690c574 87 */
AnnaBridge 145:64910690c574 88 typedef enum _pmc_bandgap_buffer_drive_select
AnnaBridge 145:64910690c574 89 {
AnnaBridge 145:64910690c574 90 kPMC_BandgapBufferDriveLow = 0U, /*!< Low-drive. */
AnnaBridge 145:64910690c574 91 kPMC_BandgapBufferDriveHigh = 1U /*!< High-drive. */
AnnaBridge 145:64910690c574 92 } pmc_bandgap_buffer_drive_select_t;
AnnaBridge 145:64910690c574 93 #endif /* FSL_FEATURE_PMC_HAS_BGBDS */
AnnaBridge 145:64910690c574 94
AnnaBridge 145:64910690c574 95 #if (defined(FSL_FEATURE_PMC_HAS_VLPO) && FSL_FEATURE_PMC_HAS_VLPO)
AnnaBridge 145:64910690c574 96 /*!
AnnaBridge 145:64910690c574 97 * @brief VLPx Option
AnnaBridge 145:64910690c574 98 */
AnnaBridge 145:64910690c574 99 typedef enum _pmc_vlp_freq_option
AnnaBridge 145:64910690c574 100 {
AnnaBridge 145:64910690c574 101 kPMC_FreqRestrict = 0U, /*!< Frequency is restricted in VLPx mode. */
AnnaBridge 145:64910690c574 102 kPMC_FreqUnrestrict = 1U /*!< Frequency is unrestricted in VLPx mode. */
AnnaBridge 145:64910690c574 103 } pmc_vlp_freq_mode_t;
AnnaBridge 145:64910690c574 104 #endif /* FSL_FEATURE_PMC_HAS_VLPO */
AnnaBridge 145:64910690c574 105
AnnaBridge 145:64910690c574 106 #if (defined(FSL_FEATURE_PMC_HAS_VERID) && FSL_FEATURE_PMC_HAS_VERID)
AnnaBridge 145:64910690c574 107 /*!
AnnaBridge 145:64910690c574 108 @brief IP version ID definition.
AnnaBridge 145:64910690c574 109 */
AnnaBridge 145:64910690c574 110 typedef struct _pmc_version_id
AnnaBridge 145:64910690c574 111 {
AnnaBridge 145:64910690c574 112 uint16_t feature; /*!< Feature Specification Number. */
AnnaBridge 145:64910690c574 113 uint8_t minor; /*!< Minor version number. */
AnnaBridge 145:64910690c574 114 uint8_t major; /*!< Major version number. */
AnnaBridge 145:64910690c574 115 } pmc_version_id_t;
AnnaBridge 145:64910690c574 116 #endif /* FSL_FEATURE_PMC_HAS_VERID */
AnnaBridge 145:64910690c574 117
AnnaBridge 145:64910690c574 118 #if (defined(FSL_FEATURE_PMC_HAS_PARAM) && FSL_FEATURE_PMC_HAS_PARAM)
AnnaBridge 145:64910690c574 119 /*! @brief IP parameter definition. */
AnnaBridge 145:64910690c574 120 typedef struct _pmc_param
AnnaBridge 145:64910690c574 121 {
AnnaBridge 145:64910690c574 122 bool vlpoEnable; /*!< VLPO enable. */
AnnaBridge 145:64910690c574 123 bool hvdEnable; /*!< HVD enable. */
AnnaBridge 145:64910690c574 124 } pmc_param_t;
AnnaBridge 145:64910690c574 125 #endif /* FSL_FEATURE_PMC_HAS_PARAM */
AnnaBridge 145:64910690c574 126
AnnaBridge 145:64910690c574 127 /*!
AnnaBridge 145:64910690c574 128 * @brief Low-voltage Detect Configuration Structure
AnnaBridge 145:64910690c574 129 */
AnnaBridge 145:64910690c574 130 typedef struct _pmc_low_volt_detect_config
AnnaBridge 145:64910690c574 131 {
AnnaBridge 145:64910690c574 132 bool enableInt; /*!< Enable interrupt when Low-voltage detect*/
AnnaBridge 145:64910690c574 133 bool enableReset; /*!< Enable system reset when Low-voltage detect*/
AnnaBridge 145:64910690c574 134 #if (defined(FSL_FEATURE_PMC_HAS_LVDV) && FSL_FEATURE_PMC_HAS_LVDV)
AnnaBridge 145:64910690c574 135 pmc_low_volt_detect_volt_select_t voltSelect; /*!< Low-voltage detect trip point voltage selection*/
AnnaBridge 145:64910690c574 136 #endif
AnnaBridge 145:64910690c574 137 } pmc_low_volt_detect_config_t;
AnnaBridge 145:64910690c574 138
AnnaBridge 145:64910690c574 139 /*!
AnnaBridge 145:64910690c574 140 * @brief Low-voltage Warning Configuration Structure
AnnaBridge 145:64910690c574 141 */
AnnaBridge 145:64910690c574 142 typedef struct _pmc_low_volt_warning_config
AnnaBridge 145:64910690c574 143 {
AnnaBridge 145:64910690c574 144 bool enableInt; /*!< Enable interrupt when low-voltage warning*/
AnnaBridge 145:64910690c574 145 #if (defined(FSL_FEATURE_PMC_HAS_LVWV) && FSL_FEATURE_PMC_HAS_LVWV)
AnnaBridge 145:64910690c574 146 pmc_low_volt_warning_volt_select_t voltSelect; /*!< Low-voltage warning trip point voltage selection*/
AnnaBridge 145:64910690c574 147 #endif
AnnaBridge 145:64910690c574 148 } pmc_low_volt_warning_config_t;
AnnaBridge 145:64910690c574 149
AnnaBridge 145:64910690c574 150 #if (defined(FSL_FEATURE_PMC_HAS_HVDSC1) && FSL_FEATURE_PMC_HAS_HVDSC1)
AnnaBridge 145:64910690c574 151 /*!
AnnaBridge 145:64910690c574 152 * @brief High-voltage Detect Configuration Structure
AnnaBridge 145:64910690c574 153 */
AnnaBridge 145:64910690c574 154 typedef struct _pmc_high_volt_detect_config
AnnaBridge 145:64910690c574 155 {
AnnaBridge 145:64910690c574 156 bool enableInt; /*!< Enable interrupt when high-voltage detect*/
AnnaBridge 145:64910690c574 157 bool enableReset; /*!< Enable system reset when high-voltage detect*/
AnnaBridge 145:64910690c574 158 pmc_high_volt_detect_volt_select_t voltSelect; /*!< High-voltage detect trip point voltage selection*/
AnnaBridge 145:64910690c574 159 } pmc_high_volt_detect_config_t;
AnnaBridge 145:64910690c574 160 #endif /* FSL_FEATURE_PMC_HAS_HVDSC1 */
AnnaBridge 145:64910690c574 161
AnnaBridge 145:64910690c574 162 #if ((defined(FSL_FEATURE_PMC_HAS_BGBE) && FSL_FEATURE_PMC_HAS_BGBE) || \
AnnaBridge 145:64910690c574 163 (defined(FSL_FEATURE_PMC_HAS_BGEN) && FSL_FEATURE_PMC_HAS_BGEN) || \
AnnaBridge 145:64910690c574 164 (defined(FSL_FEATURE_PMC_HAS_BGBDS) && FSL_FEATURE_PMC_HAS_BGBDS))
AnnaBridge 145:64910690c574 165 /*!
AnnaBridge 145:64910690c574 166 * @brief Bandgap Buffer configuration.
AnnaBridge 145:64910690c574 167 */
AnnaBridge 145:64910690c574 168 typedef struct _pmc_bandgap_buffer_config
AnnaBridge 145:64910690c574 169 {
AnnaBridge 145:64910690c574 170 #if (defined(FSL_FEATURE_PMC_HAS_BGBE) && FSL_FEATURE_PMC_HAS_BGBE)
AnnaBridge 145:64910690c574 171 bool enable; /*!< Enable bandgap buffer. */
AnnaBridge 145:64910690c574 172 #endif
AnnaBridge 145:64910690c574 173 #if (defined(FSL_FEATURE_PMC_HAS_BGEN) && FSL_FEATURE_PMC_HAS_BGEN)
AnnaBridge 145:64910690c574 174 bool enableInLowPowerMode; /*!< Enable bandgap buffer in low-power mode. */
AnnaBridge 145:64910690c574 175 #endif /* FSL_FEATURE_PMC_HAS_BGEN */
AnnaBridge 145:64910690c574 176 #if (defined(FSL_FEATURE_PMC_HAS_BGBDS) && FSL_FEATURE_PMC_HAS_BGBDS)
AnnaBridge 145:64910690c574 177 pmc_bandgap_buffer_drive_select_t drive; /*!< Bandgap buffer drive select. */
AnnaBridge 145:64910690c574 178 #endif /* FSL_FEATURE_PMC_HAS_BGBDS */
AnnaBridge 145:64910690c574 179 } pmc_bandgap_buffer_config_t;
AnnaBridge 145:64910690c574 180 #endif
AnnaBridge 145:64910690c574 181
AnnaBridge 145:64910690c574 182 /*******************************************************************************
AnnaBridge 145:64910690c574 183 * API
AnnaBridge 145:64910690c574 184 ******************************************************************************/
AnnaBridge 145:64910690c574 185
AnnaBridge 145:64910690c574 186 #if defined(__cplusplus)
AnnaBridge 145:64910690c574 187 extern "C" {
AnnaBridge 145:64910690c574 188 #endif /* __cplusplus*/
AnnaBridge 145:64910690c574 189
AnnaBridge 145:64910690c574 190 /*! @name Power Management Controller Control APIs*/
AnnaBridge 145:64910690c574 191 /*@{*/
AnnaBridge 145:64910690c574 192
AnnaBridge 145:64910690c574 193 #if (defined(FSL_FEATURE_PMC_HAS_VERID) && FSL_FEATURE_PMC_HAS_VERID)
AnnaBridge 145:64910690c574 194 /*!
AnnaBridge 145:64910690c574 195 * @brief Gets the PMC version ID.
AnnaBridge 145:64910690c574 196 *
AnnaBridge 145:64910690c574 197 * This function gets the PMC version ID, including major version number,
AnnaBridge 145:64910690c574 198 * minor version number, and a feature specification number.
AnnaBridge 145:64910690c574 199 *
AnnaBridge 145:64910690c574 200 * @param base PMC peripheral base address.
AnnaBridge 145:64910690c574 201 * @param versionId Pointer to version ID structure.
AnnaBridge 145:64910690c574 202 */
AnnaBridge 145:64910690c574 203 static inline void PMC_GetVersionId(PMC_Type *base, pmc_version_id_t *versionId)
AnnaBridge 145:64910690c574 204 {
AnnaBridge 145:64910690c574 205 *((uint32_t *)versionId) = base->VERID;
AnnaBridge 145:64910690c574 206 }
AnnaBridge 145:64910690c574 207 #endif /* FSL_FEATURE_PMC_HAS_VERID */
AnnaBridge 145:64910690c574 208
AnnaBridge 145:64910690c574 209 #if (defined(FSL_FEATURE_PMC_HAS_PARAM) && FSL_FEATURE_PMC_HAS_PARAM)
AnnaBridge 145:64910690c574 210 /*!
AnnaBridge 145:64910690c574 211 * @brief Gets the PMC parameter.
AnnaBridge 145:64910690c574 212 *
AnnaBridge 145:64910690c574 213 * This function gets the PMC parameter including the VLPO enable and the HVD enable.
AnnaBridge 145:64910690c574 214 *
AnnaBridge 145:64910690c574 215 * @param base PMC peripheral base address.
AnnaBridge 145:64910690c574 216 * @param param Pointer to PMC param structure.
AnnaBridge 145:64910690c574 217 */
AnnaBridge 145:64910690c574 218 void PMC_GetParam(PMC_Type *base, pmc_param_t *param);
AnnaBridge 145:64910690c574 219 #endif
AnnaBridge 145:64910690c574 220
AnnaBridge 145:64910690c574 221 /*!
AnnaBridge 145:64910690c574 222 * @brief Configures the low-voltage detect setting.
AnnaBridge 145:64910690c574 223 *
AnnaBridge 145:64910690c574 224 * This function configures the low-voltage detect setting, including the trip
AnnaBridge 145:64910690c574 225 * point voltage setting, enables or disables the interrupt, enables or disables the system reset.
AnnaBridge 145:64910690c574 226 *
AnnaBridge 145:64910690c574 227 * @param base PMC peripheral base address.
AnnaBridge 145:64910690c574 228 * @param config Low-voltage detect configuration structure.
AnnaBridge 145:64910690c574 229 */
AnnaBridge 145:64910690c574 230 void PMC_ConfigureLowVoltDetect(PMC_Type *base, const pmc_low_volt_detect_config_t *config);
AnnaBridge 145:64910690c574 231
AnnaBridge 145:64910690c574 232 /*!
AnnaBridge 145:64910690c574 233 * @brief Gets the Low-voltage Detect Flag status.
AnnaBridge 145:64910690c574 234 *
AnnaBridge 145:64910690c574 235 * This function reads the current LVDF status. If it returns 1, a low-voltage event is detected.
AnnaBridge 145:64910690c574 236 *
AnnaBridge 145:64910690c574 237 * @param base PMC peripheral base address.
AnnaBridge 145:64910690c574 238 * @return Current low-voltage detect flag
AnnaBridge 145:64910690c574 239 * - true: Low-voltage detected
AnnaBridge 145:64910690c574 240 * - false: Low-voltage not detected
AnnaBridge 145:64910690c574 241 */
AnnaBridge 145:64910690c574 242 static inline bool PMC_GetLowVoltDetectFlag(PMC_Type *base)
AnnaBridge 145:64910690c574 243 {
AnnaBridge 145:64910690c574 244 return (bool)(base->LVDSC1 & PMC_LVDSC1_LVDF_MASK);
AnnaBridge 145:64910690c574 245 }
AnnaBridge 145:64910690c574 246
AnnaBridge 145:64910690c574 247 /*!
AnnaBridge 145:64910690c574 248 * @brief Acknowledges clearing the Low-voltage Detect flag.
AnnaBridge 145:64910690c574 249 *
AnnaBridge 145:64910690c574 250 * This function acknowledges the low-voltage detection errors (write 1 to
AnnaBridge 145:64910690c574 251 * clear LVDF).
AnnaBridge 145:64910690c574 252 *
AnnaBridge 145:64910690c574 253 * @param base PMC peripheral base address.
AnnaBridge 145:64910690c574 254 */
AnnaBridge 145:64910690c574 255 static inline void PMC_ClearLowVoltDetectFlag(PMC_Type *base)
AnnaBridge 145:64910690c574 256 {
AnnaBridge 145:64910690c574 257 base->LVDSC1 |= PMC_LVDSC1_LVDACK_MASK;
AnnaBridge 145:64910690c574 258 }
AnnaBridge 145:64910690c574 259
AnnaBridge 145:64910690c574 260 /*!
AnnaBridge 145:64910690c574 261 * @brief Configures the low-voltage warning setting.
AnnaBridge 145:64910690c574 262 *
AnnaBridge 145:64910690c574 263 * This function configures the low-voltage warning setting, including the trip
AnnaBridge 145:64910690c574 264 * point voltage setting and enabling or disabling the interrupt.
AnnaBridge 145:64910690c574 265 *
AnnaBridge 145:64910690c574 266 * @param base PMC peripheral base address.
AnnaBridge 145:64910690c574 267 * @param config Low-voltage warning configuration structure.
AnnaBridge 145:64910690c574 268 */
AnnaBridge 145:64910690c574 269 void PMC_ConfigureLowVoltWarning(PMC_Type *base, const pmc_low_volt_warning_config_t *config);
AnnaBridge 145:64910690c574 270
AnnaBridge 145:64910690c574 271 /*!
AnnaBridge 145:64910690c574 272 * @brief Gets the Low-voltage Warning Flag status.
AnnaBridge 145:64910690c574 273 *
AnnaBridge 145:64910690c574 274 * This function polls the current LVWF status. When 1 is returned, it
AnnaBridge 145:64910690c574 275 * indicates a low-voltage warning event. LVWF is set when V Supply transitions
AnnaBridge 145:64910690c574 276 * below the trip point or after reset and V Supply is already below the V LVW.
AnnaBridge 145:64910690c574 277 *
AnnaBridge 145:64910690c574 278 * @param base PMC peripheral base address.
AnnaBridge 145:64910690c574 279 * @return Current LVWF status
AnnaBridge 145:64910690c574 280 * - true: Low-voltage Warning Flag is set.
AnnaBridge 145:64910690c574 281 * - false: the Low-voltage Warning does not happen.
AnnaBridge 145:64910690c574 282 */
AnnaBridge 145:64910690c574 283 static inline bool PMC_GetLowVoltWarningFlag(PMC_Type *base)
AnnaBridge 145:64910690c574 284 {
AnnaBridge 145:64910690c574 285 return (bool)(base->LVDSC2 & PMC_LVDSC2_LVWF_MASK);
AnnaBridge 145:64910690c574 286 }
AnnaBridge 145:64910690c574 287
AnnaBridge 145:64910690c574 288 /*!
AnnaBridge 145:64910690c574 289 * @brief Acknowledges the Low-voltage Warning flag.
AnnaBridge 145:64910690c574 290 *
AnnaBridge 145:64910690c574 291 * This function acknowledges the low voltage warning errors (write 1 to
AnnaBridge 145:64910690c574 292 * clear LVWF).
AnnaBridge 145:64910690c574 293 *
AnnaBridge 145:64910690c574 294 * @param base PMC peripheral base address.
AnnaBridge 145:64910690c574 295 */
AnnaBridge 145:64910690c574 296 static inline void PMC_ClearLowVoltWarningFlag(PMC_Type *base)
AnnaBridge 145:64910690c574 297 {
AnnaBridge 145:64910690c574 298 base->LVDSC2 |= PMC_LVDSC2_LVWACK_MASK;
AnnaBridge 145:64910690c574 299 }
AnnaBridge 145:64910690c574 300
AnnaBridge 145:64910690c574 301 #if (defined(FSL_FEATURE_PMC_HAS_HVDSC1) && FSL_FEATURE_PMC_HAS_HVDSC1)
AnnaBridge 145:64910690c574 302 /*!
AnnaBridge 145:64910690c574 303 * @brief Configures the high-voltage detect setting.
AnnaBridge 145:64910690c574 304 *
AnnaBridge 145:64910690c574 305 * This function configures the high-voltage detect setting, including the trip
AnnaBridge 145:64910690c574 306 * point voltage setting, enabling or disabling the interrupt, enabling or disabling the system reset.
AnnaBridge 145:64910690c574 307 *
AnnaBridge 145:64910690c574 308 * @param base PMC peripheral base address.
AnnaBridge 145:64910690c574 309 * @param config High-voltage detect configuration structure.
AnnaBridge 145:64910690c574 310 */
AnnaBridge 145:64910690c574 311 void PMC_ConfigureHighVoltDetect(PMC_Type *base, const pmc_high_volt_detect_config_t *config);
AnnaBridge 145:64910690c574 312
AnnaBridge 145:64910690c574 313 /*!
AnnaBridge 145:64910690c574 314 * @brief Gets the High-voltage Detect Flag status.
AnnaBridge 145:64910690c574 315 *
AnnaBridge 145:64910690c574 316 * This function reads the current HVDF status. If it returns 1, a low
AnnaBridge 145:64910690c574 317 * voltage event is detected.
AnnaBridge 145:64910690c574 318 *
AnnaBridge 145:64910690c574 319 * @param base PMC peripheral base address.
AnnaBridge 145:64910690c574 320 * @return Current high-voltage detect flag
AnnaBridge 145:64910690c574 321 * - true: High-voltage detected
AnnaBridge 145:64910690c574 322 * - false: High-voltage not detected
AnnaBridge 145:64910690c574 323 */
AnnaBridge 145:64910690c574 324 static inline bool PMC_GetHighVoltDetectFlag(PMC_Type *base)
AnnaBridge 145:64910690c574 325 {
AnnaBridge 145:64910690c574 326 return (bool)(base->HVDSC1 & PMC_HVDSC1_HVDF_MASK);
AnnaBridge 145:64910690c574 327 }
AnnaBridge 145:64910690c574 328
AnnaBridge 145:64910690c574 329 /*!
AnnaBridge 145:64910690c574 330 * @brief Acknowledges clearing the High-voltage Detect flag.
AnnaBridge 145:64910690c574 331 *
AnnaBridge 145:64910690c574 332 * This function acknowledges the high-voltage detection errors (write 1 to
AnnaBridge 145:64910690c574 333 * clear HVDF).
AnnaBridge 145:64910690c574 334 *
AnnaBridge 145:64910690c574 335 * @param base PMC peripheral base address.
AnnaBridge 145:64910690c574 336 */
AnnaBridge 145:64910690c574 337 static inline void PMC_ClearHighVoltDetectFlag(PMC_Type *base)
AnnaBridge 145:64910690c574 338 {
AnnaBridge 145:64910690c574 339 base->HVDSC1 |= PMC_HVDSC1_HVDACK_MASK;
AnnaBridge 145:64910690c574 340 }
AnnaBridge 145:64910690c574 341 #endif /* FSL_FEATURE_PMC_HAS_HVDSC1 */
AnnaBridge 145:64910690c574 342
AnnaBridge 145:64910690c574 343 #if ((defined(FSL_FEATURE_PMC_HAS_BGBE) && FSL_FEATURE_PMC_HAS_BGBE) || \
AnnaBridge 145:64910690c574 344 (defined(FSL_FEATURE_PMC_HAS_BGEN) && FSL_FEATURE_PMC_HAS_BGEN) || \
AnnaBridge 145:64910690c574 345 (defined(FSL_FEATURE_PMC_HAS_BGBDS) && FSL_FEATURE_PMC_HAS_BGBDS))
AnnaBridge 145:64910690c574 346 /*!
AnnaBridge 145:64910690c574 347 * @brief Configures the PMC bandgap.
AnnaBridge 145:64910690c574 348 *
AnnaBridge 145:64910690c574 349 * This function configures the PMC bandgap, including the drive select and
AnnaBridge 145:64910690c574 350 * behavior in low-power mode.
AnnaBridge 145:64910690c574 351 *
AnnaBridge 145:64910690c574 352 * @param base PMC peripheral base address.
AnnaBridge 145:64910690c574 353 * @param config Pointer to the configuration structure
AnnaBridge 145:64910690c574 354 */
AnnaBridge 145:64910690c574 355 void PMC_ConfigureBandgapBuffer(PMC_Type *base, const pmc_bandgap_buffer_config_t *config);
AnnaBridge 145:64910690c574 356 #endif
AnnaBridge 145:64910690c574 357
AnnaBridge 145:64910690c574 358 #if (defined(FSL_FEATURE_PMC_HAS_ACKISO) && FSL_FEATURE_PMC_HAS_ACKISO)
AnnaBridge 145:64910690c574 359 /*!
AnnaBridge 145:64910690c574 360 * @brief Gets the acknowledge Peripherals and I/O pads isolation flag.
AnnaBridge 145:64910690c574 361 *
AnnaBridge 145:64910690c574 362 * This function reads the Acknowledge Isolation setting that indicates
AnnaBridge 145:64910690c574 363 * whether certain peripherals and the I/O pads are in a latched state as
AnnaBridge 145:64910690c574 364 * a result of having been in the VLLS mode.
AnnaBridge 145:64910690c574 365 *
AnnaBridge 145:64910690c574 366 * @param base PMC peripheral base address.
AnnaBridge 145:64910690c574 367 * @param base Base address for current PMC instance.
AnnaBridge 145:64910690c574 368 * @return ACK isolation
AnnaBridge 145:64910690c574 369 * 0 - Peripherals and I/O pads are in a normal run state.
AnnaBridge 145:64910690c574 370 * 1 - Certain peripherals and I/O pads are in an isolated and
AnnaBridge 145:64910690c574 371 * latched state.
AnnaBridge 145:64910690c574 372 */
AnnaBridge 145:64910690c574 373 static inline bool PMC_GetPeriphIOIsolationFlag(PMC_Type *base)
AnnaBridge 145:64910690c574 374 {
AnnaBridge 145:64910690c574 375 return (bool)(base->REGSC & PMC_REGSC_ACKISO_MASK);
AnnaBridge 145:64910690c574 376 }
AnnaBridge 145:64910690c574 377
AnnaBridge 145:64910690c574 378 /*!
AnnaBridge 145:64910690c574 379 * @brief Acknowledges the isolation flag to Peripherals and I/O pads.
AnnaBridge 145:64910690c574 380 *
AnnaBridge 145:64910690c574 381 * This function clears the ACK Isolation flag. Writing one to this setting
AnnaBridge 145:64910690c574 382 * when it is set releases the I/O pads and certain peripherals to their normal
AnnaBridge 145:64910690c574 383 * run mode state.
AnnaBridge 145:64910690c574 384 *
AnnaBridge 145:64910690c574 385 * @param base PMC peripheral base address.
AnnaBridge 145:64910690c574 386 */
AnnaBridge 145:64910690c574 387 static inline void PMC_ClearPeriphIOIsolationFlag(PMC_Type *base)
AnnaBridge 145:64910690c574 388 {
AnnaBridge 145:64910690c574 389 base->REGSC |= PMC_REGSC_ACKISO_MASK;
AnnaBridge 145:64910690c574 390 }
AnnaBridge 145:64910690c574 391 #endif /* FSL_FEATURE_PMC_HAS_ACKISO */
AnnaBridge 145:64910690c574 392
AnnaBridge 145:64910690c574 393 #if (defined(FSL_FEATURE_PMC_HAS_REGONS) && FSL_FEATURE_PMC_HAS_REGONS)
AnnaBridge 145:64910690c574 394 /*!
AnnaBridge 145:64910690c574 395 * @brief Gets the regulator regulation status.
AnnaBridge 145:64910690c574 396 *
AnnaBridge 145:64910690c574 397 * This function returns the regulator to run a regulation status. It provides
AnnaBridge 145:64910690c574 398 * the current status of the internal voltage regulator.
AnnaBridge 145:64910690c574 399 *
AnnaBridge 145:64910690c574 400 * @param base PMC peripheral base address.
AnnaBridge 145:64910690c574 401 * @param base Base address for current PMC instance.
AnnaBridge 145:64910690c574 402 * @return Regulation status
AnnaBridge 145:64910690c574 403 * 0 - Regulator is in a stop regulation or in transition to/from the regulation.
AnnaBridge 145:64910690c574 404 * 1 - Regulator is in a run regulation.
AnnaBridge 145:64910690c574 405 *
AnnaBridge 145:64910690c574 406 */
AnnaBridge 145:64910690c574 407 static inline bool PMC_IsRegulatorInRunRegulation(PMC_Type *base)
AnnaBridge 145:64910690c574 408 {
AnnaBridge 145:64910690c574 409 return (bool)(base->REGSC & PMC_REGSC_REGONS_MASK);
AnnaBridge 145:64910690c574 410 }
AnnaBridge 145:64910690c574 411 #endif /* FSL_FEATURE_PMC_HAS_REGONS */
AnnaBridge 145:64910690c574 412
AnnaBridge 145:64910690c574 413 /*@}*/
AnnaBridge 145:64910690c574 414
AnnaBridge 145:64910690c574 415 #if defined(__cplusplus)
AnnaBridge 145:64910690c574 416 }
AnnaBridge 145:64910690c574 417 #endif /* __cplusplus*/
AnnaBridge 145:64910690c574 418
AnnaBridge 145:64910690c574 419 /*! @}*/
AnnaBridge 145:64910690c574 420
AnnaBridge 145:64910690c574 421 #endif /* _FSL_PMC_H_*/