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