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:
Thu Nov 08 11:45:42 2018 +0000
Revision:
171:3a7713b1edbc
Parent:
TARGET_USENSE/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL82Z/drivers/fsl_rcm.h@145:64910690c574
mbed library. Release version 164

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_RCM_H_
AnnaBridge 145:64910690c574 31 #define _FSL_RCM_H_
AnnaBridge 145:64910690c574 32
AnnaBridge 145:64910690c574 33 #include "fsl_common.h"
AnnaBridge 145:64910690c574 34
AnnaBridge 145:64910690c574 35 /*! @addtogroup rcm */
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 RCM driver version 2.0.1. */
AnnaBridge 145:64910690c574 46 #define FSL_RCM_DRIVER_VERSION (MAKE_VERSION(2, 0, 1))
AnnaBridge 145:64910690c574 47 /*@}*/
AnnaBridge 145:64910690c574 48
AnnaBridge 145:64910690c574 49 /*!
AnnaBridge 145:64910690c574 50 * @brief System Reset Source Name definitions
AnnaBridge 145:64910690c574 51 */
AnnaBridge 145:64910690c574 52 typedef enum _rcm_reset_source
AnnaBridge 145:64910690c574 53 {
AnnaBridge 145:64910690c574 54 #if (defined(FSL_FEATURE_RCM_REG_WIDTH) && (FSL_FEATURE_RCM_REG_WIDTH == 32))
AnnaBridge 145:64910690c574 55 /* RCM register bit width is 32. */
AnnaBridge 145:64910690c574 56 #if (defined(FSL_FEATURE_RCM_HAS_WAKEUP) && FSL_FEATURE_RCM_HAS_WAKEUP)
AnnaBridge 145:64910690c574 57 kRCM_SourceWakeup = RCM_SRS_WAKEUP_MASK, /*!< Low-leakage wakeup reset */
AnnaBridge 145:64910690c574 58 #endif
AnnaBridge 145:64910690c574 59 kRCM_SourceLvd = RCM_SRS_LVD_MASK, /*!< Low-voltage detect reset */
AnnaBridge 145:64910690c574 60 #if (defined(FSL_FEATURE_RCM_HAS_LOC) && FSL_FEATURE_RCM_HAS_LOC)
AnnaBridge 145:64910690c574 61 kRCM_SourceLoc = RCM_SRS_LOC_MASK, /*!< Loss of clock reset */
AnnaBridge 145:64910690c574 62 #endif /* FSL_FEATURE_RCM_HAS_LOC */
AnnaBridge 145:64910690c574 63 #if (defined(FSL_FEATURE_RCM_HAS_LOL) && FSL_FEATURE_RCM_HAS_LOL)
AnnaBridge 145:64910690c574 64 kRCM_SourceLol = RCM_SRS_LOL_MASK, /*!< Loss of lock reset */
AnnaBridge 145:64910690c574 65 #endif /* FSL_FEATURE_RCM_HAS_LOL */
AnnaBridge 145:64910690c574 66 kRCM_SourceWdog = RCM_SRS_WDOG_MASK, /*!< Watchdog reset */
AnnaBridge 145:64910690c574 67 kRCM_SourcePin = RCM_SRS_PIN_MASK, /*!< External pin reset */
AnnaBridge 145:64910690c574 68 kRCM_SourcePor = RCM_SRS_POR_MASK, /*!< Power on reset */
AnnaBridge 145:64910690c574 69 #if (defined(FSL_FEATURE_RCM_HAS_JTAG) && FSL_FEATURE_RCM_HAS_JTAG)
AnnaBridge 145:64910690c574 70 kRCM_SourceJtag = RCM_SRS_JTAG_MASK, /*!< JTAG generated reset */
AnnaBridge 145:64910690c574 71 #endif /* FSL_FEATURE_RCM_HAS_JTAG */
AnnaBridge 145:64910690c574 72 kRCM_SourceLockup = RCM_SRS_LOCKUP_MASK, /*!< Core lock up reset */
AnnaBridge 145:64910690c574 73 kRCM_SourceSw = RCM_SRS_SW_MASK, /*!< Software reset */
AnnaBridge 145:64910690c574 74 #if (defined(FSL_FEATURE_RCM_HAS_MDM_AP) && FSL_FEATURE_RCM_HAS_MDM_AP)
AnnaBridge 145:64910690c574 75 kRCM_SourceMdmap = RCM_SRS_MDM_AP_MASK, /*!< MDM-AP system reset */
AnnaBridge 145:64910690c574 76 #endif /* FSL_FEATURE_RCM_HAS_MDM_AP */
AnnaBridge 145:64910690c574 77 #if (defined(FSL_FEATURE_RCM_HAS_EZPORT) && FSL_FEATURE_RCM_HAS_EZPORT)
AnnaBridge 145:64910690c574 78 kRCM_SourceEzpt = RCM_SRS_EZPT_MASK, /*!< EzPort reset */
AnnaBridge 145:64910690c574 79 #endif /* FSL_FEATURE_RCM_HAS_EZPORT */
AnnaBridge 145:64910690c574 80 kRCM_SourceSackerr = RCM_SRS_SACKERR_MASK, /*!< Parameter could get all reset flags */
AnnaBridge 145:64910690c574 81
AnnaBridge 145:64910690c574 82 #else /* (FSL_FEATURE_RCM_REG_WIDTH == 32) */
AnnaBridge 145:64910690c574 83 /* RCM register bit width is 8. */
AnnaBridge 145:64910690c574 84 #if (defined(FSL_FEATURE_RCM_HAS_WAKEUP) && FSL_FEATURE_RCM_HAS_WAKEUP)
AnnaBridge 145:64910690c574 85 kRCM_SourceWakeup = RCM_SRS0_WAKEUP_MASK, /*!< Low-leakage wakeup reset */
AnnaBridge 145:64910690c574 86 #endif
AnnaBridge 145:64910690c574 87 kRCM_SourceLvd = RCM_SRS0_LVD_MASK, /*!< Low-voltage detect reset */
AnnaBridge 145:64910690c574 88 #if (defined(FSL_FEATURE_RCM_HAS_LOC) && FSL_FEATURE_RCM_HAS_LOC)
AnnaBridge 145:64910690c574 89 kRCM_SourceLoc = RCM_SRS0_LOC_MASK, /*!< Loss of clock reset */
AnnaBridge 145:64910690c574 90 #endif /* FSL_FEATURE_RCM_HAS_LOC */
AnnaBridge 145:64910690c574 91 #if (defined(FSL_FEATURE_RCM_HAS_LOL) && FSL_FEATURE_RCM_HAS_LOL)
AnnaBridge 145:64910690c574 92 kRCM_SourceLol = RCM_SRS0_LOL_MASK, /*!< Loss of lock reset */
AnnaBridge 145:64910690c574 93 #endif /* FSL_FEATURE_RCM_HAS_LOL */
AnnaBridge 145:64910690c574 94 kRCM_SourceWdog = RCM_SRS0_WDOG_MASK, /*!< Watchdog reset */
AnnaBridge 145:64910690c574 95 kRCM_SourcePin = RCM_SRS0_PIN_MASK, /*!< External pin reset */
AnnaBridge 145:64910690c574 96 kRCM_SourcePor = RCM_SRS0_POR_MASK, /*!< Power on reset */
AnnaBridge 145:64910690c574 97 #if (defined(FSL_FEATURE_RCM_HAS_JTAG) && FSL_FEATURE_RCM_HAS_JTAG)
AnnaBridge 145:64910690c574 98 kRCM_SourceJtag = RCM_SRS1_JTAG_MASK << 8U, /*!< JTAG generated reset */
AnnaBridge 145:64910690c574 99 #endif /* FSL_FEATURE_RCM_HAS_JTAG */
AnnaBridge 145:64910690c574 100 kRCM_SourceLockup = RCM_SRS1_LOCKUP_MASK << 8U, /*!< Core lock up reset */
AnnaBridge 145:64910690c574 101 kRCM_SourceSw = RCM_SRS1_SW_MASK << 8U, /*!< Software reset */
AnnaBridge 145:64910690c574 102 #if (defined(FSL_FEATURE_RCM_HAS_MDM_AP) && FSL_FEATURE_RCM_HAS_MDM_AP)
AnnaBridge 145:64910690c574 103 kRCM_SourceMdmap = RCM_SRS1_MDM_AP_MASK << 8U, /*!< MDM-AP system reset */
AnnaBridge 145:64910690c574 104 #endif /* FSL_FEATURE_RCM_HAS_MDM_AP */
AnnaBridge 145:64910690c574 105 #if (defined(FSL_FEATURE_RCM_HAS_EZPORT) && FSL_FEATURE_RCM_HAS_EZPORT)
AnnaBridge 145:64910690c574 106 kRCM_SourceEzpt = RCM_SRS1_EZPT_MASK << 8U, /*!< EzPort reset */
AnnaBridge 145:64910690c574 107 #endif /* FSL_FEATURE_RCM_HAS_EZPORT */
AnnaBridge 145:64910690c574 108 kRCM_SourceSackerr = RCM_SRS1_SACKERR_MASK << 8U, /*!< Parameter could get all reset flags */
AnnaBridge 145:64910690c574 109 #endif /* (FSL_FEATURE_RCM_REG_WIDTH == 32) */
AnnaBridge 145:64910690c574 110 kRCM_SourceAll = 0xffffffffU,
AnnaBridge 145:64910690c574 111 } rcm_reset_source_t;
AnnaBridge 145:64910690c574 112
AnnaBridge 145:64910690c574 113 /*!
AnnaBridge 145:64910690c574 114 * @brief Reset pin filter select in Run and Wait modes
AnnaBridge 145:64910690c574 115 */
AnnaBridge 145:64910690c574 116 typedef enum _rcm_run_wait_filter_mode
AnnaBridge 145:64910690c574 117 {
AnnaBridge 145:64910690c574 118 kRCM_FilterDisable = 0U, /*!< All filtering disabled */
AnnaBridge 145:64910690c574 119 kRCM_FilterBusClock = 1U, /*!< Bus clock filter enabled */
AnnaBridge 145:64910690c574 120 kRCM_FilterLpoClock = 2U /*!< LPO clock filter enabled */
AnnaBridge 145:64910690c574 121 } rcm_run_wait_filter_mode_t;
AnnaBridge 145:64910690c574 122
AnnaBridge 145:64910690c574 123 #if (defined(FSL_FEATURE_RCM_HAS_BOOTROM) && FSL_FEATURE_RCM_HAS_BOOTROM)
AnnaBridge 145:64910690c574 124 /*!
AnnaBridge 145:64910690c574 125 * @brief Boot from ROM configuration.
AnnaBridge 145:64910690c574 126 */
AnnaBridge 145:64910690c574 127 typedef enum _rcm_boot_rom_config
AnnaBridge 145:64910690c574 128 {
AnnaBridge 145:64910690c574 129 kRCM_BootFlash = 0U, /*!< Boot from flash */
AnnaBridge 145:64910690c574 130 kRCM_BootRomCfg0 = 1U, /*!< Boot from boot ROM due to BOOTCFG0 */
AnnaBridge 145:64910690c574 131 kRCM_BootRomFopt = 2U, /*!< Boot from boot ROM due to FOPT[7] */
AnnaBridge 145:64910690c574 132 kRCM_BootRomBoth = 3U /*!< Boot from boot ROM due to both BOOTCFG0 and FOPT[7] */
AnnaBridge 145:64910690c574 133 } rcm_boot_rom_config_t;
AnnaBridge 145:64910690c574 134 #endif /* FSL_FEATURE_RCM_HAS_BOOTROM */
AnnaBridge 145:64910690c574 135
AnnaBridge 145:64910690c574 136 #if (defined(FSL_FEATURE_RCM_HAS_SRIE) && FSL_FEATURE_RCM_HAS_SRIE)
AnnaBridge 145:64910690c574 137 /*!
AnnaBridge 145:64910690c574 138 * @brief Max delay time from interrupt asserts to system reset.
AnnaBridge 145:64910690c574 139 */
AnnaBridge 145:64910690c574 140 typedef enum _rcm_reset_delay
AnnaBridge 145:64910690c574 141 {
AnnaBridge 145:64910690c574 142 kRCM_ResetDelay8Lpo = 0U, /*!< Delay 8 LPO cycles. */
AnnaBridge 145:64910690c574 143 kRCM_ResetDelay32Lpo = 1U, /*!< Delay 32 LPO cycles. */
AnnaBridge 145:64910690c574 144 kRCM_ResetDelay128Lpo = 2U, /*!< Delay 128 LPO cycles. */
AnnaBridge 145:64910690c574 145 kRCM_ResetDelay512Lpo = 3U /*!< Delay 512 LPO cycles. */
AnnaBridge 145:64910690c574 146 } rcm_reset_delay_t;
AnnaBridge 145:64910690c574 147
AnnaBridge 145:64910690c574 148 /*!
AnnaBridge 145:64910690c574 149 * @brief System reset interrupt enable bit definitions.
AnnaBridge 145:64910690c574 150 */
AnnaBridge 145:64910690c574 151 typedef enum _rcm_interrupt_enable
AnnaBridge 145:64910690c574 152 {
AnnaBridge 145:64910690c574 153 kRCM_IntNone = 0U, /*!< No interrupt enabled. */
AnnaBridge 145:64910690c574 154 kRCM_IntLossOfClk = RCM_SRIE_LOC_MASK, /*!< Loss of clock interrupt. */
AnnaBridge 145:64910690c574 155 kRCM_IntLossOfLock = RCM_SRIE_LOL_MASK, /*!< Loss of lock interrupt. */
AnnaBridge 145:64910690c574 156 kRCM_IntWatchDog = RCM_SRIE_WDOG_MASK, /*!< Watch dog interrupt. */
AnnaBridge 145:64910690c574 157 kRCM_IntExternalPin = RCM_SRIE_PIN_MASK, /*!< External pin interrupt. */
AnnaBridge 145:64910690c574 158 kRCM_IntGlobal = RCM_SRIE_GIE_MASK, /*!< Global interrupts. */
AnnaBridge 145:64910690c574 159 kRCM_IntCoreLockup = RCM_SRIE_LOCKUP_MASK, /*!< Core lock up interrupt */
AnnaBridge 145:64910690c574 160 kRCM_IntSoftware = RCM_SRIE_SW_MASK, /*!< software interrupt */
AnnaBridge 145:64910690c574 161 kRCM_IntStopModeAckErr = RCM_SRIE_SACKERR_MASK, /*!< Stop mode ACK error interrupt. */
AnnaBridge 145:64910690c574 162 #if (defined(FSL_FEATURE_RCM_HAS_CORE1) && FSL_FEATURE_RCM_HAS_CORE1)
AnnaBridge 145:64910690c574 163 kRCM_IntCore1 = RCM_SRIE_CORE1_MASK, /*!< Core 1 interrupt. */
AnnaBridge 145:64910690c574 164 #endif
AnnaBridge 145:64910690c574 165 kRCM_IntAll = RCM_SRIE_LOC_MASK /*!< Enable all interrupts. */
AnnaBridge 145:64910690c574 166 |
AnnaBridge 145:64910690c574 167 RCM_SRIE_LOL_MASK | RCM_SRIE_WDOG_MASK | RCM_SRIE_PIN_MASK | RCM_SRIE_GIE_MASK |
AnnaBridge 145:64910690c574 168 RCM_SRIE_LOCKUP_MASK | RCM_SRIE_SW_MASK | RCM_SRIE_SACKERR_MASK
AnnaBridge 145:64910690c574 169 #if (defined(FSL_FEATURE_RCM_HAS_CORE1) && FSL_FEATURE_RCM_HAS_CORE1)
AnnaBridge 145:64910690c574 170 |
AnnaBridge 145:64910690c574 171 RCM_SRIE_CORE1_MASK
AnnaBridge 145:64910690c574 172 #endif
AnnaBridge 145:64910690c574 173 } rcm_interrupt_enable_t;
AnnaBridge 145:64910690c574 174 #endif /* FSL_FEATURE_RCM_HAS_SRIE */
AnnaBridge 145:64910690c574 175
AnnaBridge 145:64910690c574 176 #if (defined(FSL_FEATURE_RCM_HAS_VERID) && FSL_FEATURE_RCM_HAS_VERID)
AnnaBridge 145:64910690c574 177 /*!
AnnaBridge 145:64910690c574 178 * @brief IP version ID definition.
AnnaBridge 145:64910690c574 179 */
AnnaBridge 145:64910690c574 180 typedef struct _rcm_version_id
AnnaBridge 145:64910690c574 181 {
AnnaBridge 145:64910690c574 182 uint16_t feature; /*!< Feature Specification Number. */
AnnaBridge 145:64910690c574 183 uint8_t minor; /*!< Minor version number. */
AnnaBridge 145:64910690c574 184 uint8_t major; /*!< Major version number. */
AnnaBridge 145:64910690c574 185 } rcm_version_id_t;
AnnaBridge 145:64910690c574 186 #endif
AnnaBridge 145:64910690c574 187
AnnaBridge 145:64910690c574 188 /*!
AnnaBridge 145:64910690c574 189 * @brief Reset pin filter configuration
AnnaBridge 145:64910690c574 190 */
AnnaBridge 145:64910690c574 191 typedef struct _rcm_reset_pin_filter_config
AnnaBridge 145:64910690c574 192 {
AnnaBridge 145:64910690c574 193 bool enableFilterInStop; /*!< Reset pin filter select in stop mode. */
AnnaBridge 145:64910690c574 194 rcm_run_wait_filter_mode_t filterInRunWait; /*!< Reset pin filter in run/wait mode. */
AnnaBridge 145:64910690c574 195 uint8_t busClockFilterCount; /*!< Reset pin bus clock filter width. */
AnnaBridge 145:64910690c574 196 } rcm_reset_pin_filter_config_t;
AnnaBridge 145:64910690c574 197
AnnaBridge 145:64910690c574 198 /*******************************************************************************
AnnaBridge 145:64910690c574 199 * API
AnnaBridge 145:64910690c574 200 ******************************************************************************/
AnnaBridge 145:64910690c574 201 #if defined(__cplusplus)
AnnaBridge 145:64910690c574 202 extern "C" {
AnnaBridge 145:64910690c574 203 #endif /* __cplusplus*/
AnnaBridge 145:64910690c574 204
AnnaBridge 145:64910690c574 205 /*! @name Reset Control Module APIs*/
AnnaBridge 145:64910690c574 206 /*@{*/
AnnaBridge 145:64910690c574 207
AnnaBridge 145:64910690c574 208 #if (defined(FSL_FEATURE_RCM_HAS_VERID) && FSL_FEATURE_RCM_HAS_VERID)
AnnaBridge 145:64910690c574 209 /*!
AnnaBridge 145:64910690c574 210 * @brief Gets the RCM version ID.
AnnaBridge 145:64910690c574 211 *
AnnaBridge 145:64910690c574 212 * This function gets the RCM version ID including the major version number,
AnnaBridge 145:64910690c574 213 * the minor version number, and the feature specification number.
AnnaBridge 145:64910690c574 214 *
AnnaBridge 145:64910690c574 215 * @param base RCM peripheral base address.
AnnaBridge 145:64910690c574 216 * @param versionId Pointer to version ID structure.
AnnaBridge 145:64910690c574 217 */
AnnaBridge 145:64910690c574 218 static inline void RCM_GetVersionId(RCM_Type *base, rcm_version_id_t *versionId)
AnnaBridge 145:64910690c574 219 {
AnnaBridge 145:64910690c574 220 *((uint32_t *)versionId) = base->VERID;
AnnaBridge 145:64910690c574 221 }
AnnaBridge 145:64910690c574 222 #endif
AnnaBridge 145:64910690c574 223
AnnaBridge 145:64910690c574 224 #if (defined(FSL_FEATURE_RCM_HAS_PARAM) && FSL_FEATURE_RCM_HAS_PARAM)
AnnaBridge 145:64910690c574 225 /*!
AnnaBridge 145:64910690c574 226 * @brief Gets the reset source implemented status.
AnnaBridge 145:64910690c574 227 *
AnnaBridge 145:64910690c574 228 * This function gets the RCM parameter that indicates whether the corresponding reset source is implemented.
AnnaBridge 145:64910690c574 229 * Use source masks defined in the rcm_reset_source_t to get the desired source status.
AnnaBridge 145:64910690c574 230 *
AnnaBridge 145:64910690c574 231 * Example:
AnnaBridge 145:64910690c574 232 @code
AnnaBridge 145:64910690c574 233 uint32_t status;
AnnaBridge 145:64910690c574 234
AnnaBridge 145:64910690c574 235 // To test whether the MCU is reset using Watchdog.
AnnaBridge 145:64910690c574 236 status = RCM_GetResetSourceImplementedStatus(RCM) & (kRCM_SourceWdog | kRCM_SourcePin);
AnnaBridge 145:64910690c574 237 @endcode
AnnaBridge 145:64910690c574 238 *
AnnaBridge 145:64910690c574 239 * @param base RCM peripheral base address.
AnnaBridge 145:64910690c574 240 * @return All reset source implemented status bit map.
AnnaBridge 145:64910690c574 241 */
AnnaBridge 145:64910690c574 242 static inline uint32_t RCM_GetResetSourceImplementedStatus(RCM_Type *base)
AnnaBridge 145:64910690c574 243 {
AnnaBridge 145:64910690c574 244 return base->PARAM;
AnnaBridge 145:64910690c574 245 }
AnnaBridge 145:64910690c574 246 #endif /* FSL_FEATURE_RCM_HAS_PARAM */
AnnaBridge 145:64910690c574 247
AnnaBridge 145:64910690c574 248 /*!
AnnaBridge 145:64910690c574 249 * @brief Gets the reset source status which caused a previous reset.
AnnaBridge 145:64910690c574 250 *
AnnaBridge 145:64910690c574 251 * This function gets the current reset source status. Use source masks
AnnaBridge 145:64910690c574 252 * defined in the rcm_reset_source_t to get the desired source status.
AnnaBridge 145:64910690c574 253 *
AnnaBridge 145:64910690c574 254 * Example:
AnnaBridge 145:64910690c574 255 @code
AnnaBridge 145:64910690c574 256 uint32_t resetStatus;
AnnaBridge 145:64910690c574 257
AnnaBridge 145:64910690c574 258 // To get all reset source statuses.
AnnaBridge 145:64910690c574 259 resetStatus = RCM_GetPreviousResetSources(RCM) & kRCM_SourceAll;
AnnaBridge 145:64910690c574 260
AnnaBridge 145:64910690c574 261 // To test whether the MCU is reset using Watchdog.
AnnaBridge 145:64910690c574 262 resetStatus = RCM_GetPreviousResetSources(RCM) & kRCM_SourceWdog;
AnnaBridge 145:64910690c574 263
AnnaBridge 145:64910690c574 264 // To test multiple reset sources.
AnnaBridge 145:64910690c574 265 resetStatus = RCM_GetPreviousResetSources(RCM) & (kRCM_SourceWdog | kRCM_SourcePin);
AnnaBridge 145:64910690c574 266 @endcode
AnnaBridge 145:64910690c574 267 *
AnnaBridge 145:64910690c574 268 * @param base RCM peripheral base address.
AnnaBridge 145:64910690c574 269 * @return All reset source status bit map.
AnnaBridge 145:64910690c574 270 */
AnnaBridge 145:64910690c574 271 static inline uint32_t RCM_GetPreviousResetSources(RCM_Type *base)
AnnaBridge 145:64910690c574 272 {
AnnaBridge 145:64910690c574 273 #if (defined(FSL_FEATURE_RCM_REG_WIDTH) && (FSL_FEATURE_RCM_REG_WIDTH == 32))
AnnaBridge 145:64910690c574 274 return base->SRS;
AnnaBridge 145:64910690c574 275 #else
AnnaBridge 145:64910690c574 276 return (uint32_t)((uint32_t)base->SRS0 | ((uint32_t)base->SRS1 << 8U));
AnnaBridge 145:64910690c574 277 #endif /* (FSL_FEATURE_RCM_REG_WIDTH == 32) */
AnnaBridge 145:64910690c574 278 }
AnnaBridge 145:64910690c574 279
AnnaBridge 145:64910690c574 280 #if (defined(FSL_FEATURE_RCM_HAS_SSRS) && FSL_FEATURE_RCM_HAS_SSRS)
AnnaBridge 145:64910690c574 281 /*!
AnnaBridge 145:64910690c574 282 * @brief Gets the sticky reset source status.
AnnaBridge 145:64910690c574 283 *
AnnaBridge 145:64910690c574 284 * This function gets the current reset source status that has not been cleared
AnnaBridge 145:64910690c574 285 * by software for some specific source.
AnnaBridge 145:64910690c574 286 *
AnnaBridge 145:64910690c574 287 * Example:
AnnaBridge 145:64910690c574 288 @code
AnnaBridge 145:64910690c574 289 uint32_t resetStatus;
AnnaBridge 145:64910690c574 290
AnnaBridge 145:64910690c574 291 // To get all reset source statuses.
AnnaBridge 145:64910690c574 292 resetStatus = RCM_GetStickyResetSources(RCM) & kRCM_SourceAll;
AnnaBridge 145:64910690c574 293
AnnaBridge 145:64910690c574 294 // To test whether the MCU is reset using Watchdog.
AnnaBridge 145:64910690c574 295 resetStatus = RCM_GetStickyResetSources(RCM) & kRCM_SourceWdog;
AnnaBridge 145:64910690c574 296
AnnaBridge 145:64910690c574 297 // To test multiple reset sources.
AnnaBridge 145:64910690c574 298 resetStatus = RCM_GetStickyResetSources(RCM) & (kRCM_SourceWdog | kRCM_SourcePin);
AnnaBridge 145:64910690c574 299 @endcode
AnnaBridge 145:64910690c574 300 *
AnnaBridge 145:64910690c574 301 * @param base RCM peripheral base address.
AnnaBridge 145:64910690c574 302 * @return All reset source status bit map.
AnnaBridge 145:64910690c574 303 */
AnnaBridge 145:64910690c574 304 static inline uint32_t RCM_GetStickyResetSources(RCM_Type *base)
AnnaBridge 145:64910690c574 305 {
AnnaBridge 145:64910690c574 306 #if (defined(FSL_FEATURE_RCM_REG_WIDTH) && (FSL_FEATURE_RCM_REG_WIDTH == 32))
AnnaBridge 145:64910690c574 307 return base->SSRS;
AnnaBridge 145:64910690c574 308 #else
AnnaBridge 145:64910690c574 309 return (base->SSRS0 | ((uint32_t)base->SSRS1 << 8U));
AnnaBridge 145:64910690c574 310 #endif /* (FSL_FEATURE_RCM_REG_WIDTH == 32) */
AnnaBridge 145:64910690c574 311 }
AnnaBridge 145:64910690c574 312
AnnaBridge 145:64910690c574 313 /*!
AnnaBridge 145:64910690c574 314 * @brief Clears the sticky reset source status.
AnnaBridge 145:64910690c574 315 *
AnnaBridge 145:64910690c574 316 * This function clears the sticky system reset flags indicated by source masks.
AnnaBridge 145:64910690c574 317 *
AnnaBridge 145:64910690c574 318 * Example:
AnnaBridge 145:64910690c574 319 @code
AnnaBridge 145:64910690c574 320 // Clears multiple reset sources.
AnnaBridge 145:64910690c574 321 RCM_ClearStickyResetSources(kRCM_SourceWdog | kRCM_SourcePin);
AnnaBridge 145:64910690c574 322 @endcode
AnnaBridge 145:64910690c574 323 *
AnnaBridge 145:64910690c574 324 * @param base RCM peripheral base address.
AnnaBridge 145:64910690c574 325 * @param sourceMasks reset source status bit map
AnnaBridge 145:64910690c574 326 */
AnnaBridge 145:64910690c574 327 static inline void RCM_ClearStickyResetSources(RCM_Type *base, uint32_t sourceMasks)
AnnaBridge 145:64910690c574 328 {
AnnaBridge 145:64910690c574 329 #if (defined(FSL_FEATURE_RCM_REG_WIDTH) && (FSL_FEATURE_RCM_REG_WIDTH == 32))
AnnaBridge 145:64910690c574 330 base->SSRS = sourceMasks;
AnnaBridge 145:64910690c574 331 #else
AnnaBridge 145:64910690c574 332 base->SSRS0 = (sourceMasks & 0xffU);
AnnaBridge 145:64910690c574 333 base->SSRS1 = ((sourceMasks >> 8U) & 0xffU);
AnnaBridge 145:64910690c574 334 #endif /* (FSL_FEATURE_RCM_REG_WIDTH == 32) */
AnnaBridge 145:64910690c574 335 }
AnnaBridge 145:64910690c574 336 #endif /* FSL_FEATURE_RCM_HAS_SSRS */
AnnaBridge 145:64910690c574 337
AnnaBridge 145:64910690c574 338 /*!
AnnaBridge 145:64910690c574 339 * @brief Configures the reset pin filter.
AnnaBridge 145:64910690c574 340 *
AnnaBridge 145:64910690c574 341 * This function sets the reset pin filter including the filter source, filter
AnnaBridge 145:64910690c574 342 * width, and so on.
AnnaBridge 145:64910690c574 343 *
AnnaBridge 145:64910690c574 344 * @param base RCM peripheral base address.
AnnaBridge 145:64910690c574 345 * @param config Pointer to the configuration structure.
AnnaBridge 145:64910690c574 346 */
AnnaBridge 145:64910690c574 347 void RCM_ConfigureResetPinFilter(RCM_Type *base, const rcm_reset_pin_filter_config_t *config);
AnnaBridge 145:64910690c574 348
AnnaBridge 145:64910690c574 349 #if (defined(FSL_FEATURE_RCM_HAS_EZPMS) && FSL_FEATURE_RCM_HAS_EZPMS)
AnnaBridge 145:64910690c574 350 /*!
AnnaBridge 145:64910690c574 351 * @brief Gets the EZP_MS_B pin assert status.
AnnaBridge 145:64910690c574 352 *
AnnaBridge 145:64910690c574 353 * This function gets the easy port mode status (EZP_MS_B) pin assert status.
AnnaBridge 145:64910690c574 354 *
AnnaBridge 145:64910690c574 355 * @param base RCM peripheral base address.
AnnaBridge 145:64910690c574 356 * @return status true - asserted, false - reasserted
AnnaBridge 145:64910690c574 357 */
AnnaBridge 145:64910690c574 358 static inline bool RCM_GetEasyPortModePinStatus(RCM_Type *base)
AnnaBridge 145:64910690c574 359 {
AnnaBridge 145:64910690c574 360 return (bool)(base->MR & RCM_MR_EZP_MS_MASK);
AnnaBridge 145:64910690c574 361 }
AnnaBridge 145:64910690c574 362 #endif /* FSL_FEATURE_RCM_HAS_EZPMS */
AnnaBridge 145:64910690c574 363
AnnaBridge 145:64910690c574 364 #if (defined(FSL_FEATURE_RCM_HAS_BOOTROM) && FSL_FEATURE_RCM_HAS_BOOTROM)
AnnaBridge 145:64910690c574 365 /*!
AnnaBridge 145:64910690c574 366 * @brief Gets the ROM boot source.
AnnaBridge 145:64910690c574 367 *
AnnaBridge 145:64910690c574 368 * This function gets the ROM boot source during the last chip reset.
AnnaBridge 145:64910690c574 369 *
AnnaBridge 145:64910690c574 370 * @param base RCM peripheral base address.
AnnaBridge 145:64910690c574 371 * @return The ROM boot source.
AnnaBridge 145:64910690c574 372 */
AnnaBridge 145:64910690c574 373 static inline rcm_boot_rom_config_t RCM_GetBootRomSource(RCM_Type *base)
AnnaBridge 145:64910690c574 374 {
AnnaBridge 145:64910690c574 375 return (rcm_boot_rom_config_t)((base->MR & RCM_MR_BOOTROM_MASK) >> RCM_MR_BOOTROM_SHIFT);
AnnaBridge 145:64910690c574 376 }
AnnaBridge 145:64910690c574 377
AnnaBridge 145:64910690c574 378 /*!
AnnaBridge 145:64910690c574 379 * @brief Clears the ROM boot source flag.
AnnaBridge 145:64910690c574 380 *
AnnaBridge 145:64910690c574 381 * This function clears the ROM boot source flag.
AnnaBridge 145:64910690c574 382 *
AnnaBridge 145:64910690c574 383 * @param base Register base address of RCM
AnnaBridge 145:64910690c574 384 */
AnnaBridge 145:64910690c574 385 static inline void RCM_ClearBootRomSource(RCM_Type *base)
AnnaBridge 145:64910690c574 386 {
AnnaBridge 145:64910690c574 387 base->MR |= RCM_MR_BOOTROM_MASK;
AnnaBridge 145:64910690c574 388 }
AnnaBridge 145:64910690c574 389
AnnaBridge 145:64910690c574 390 /*!
AnnaBridge 145:64910690c574 391 * @brief Forces the boot from ROM.
AnnaBridge 145:64910690c574 392 *
AnnaBridge 145:64910690c574 393 * This function forces booting from ROM during all subsequent system resets.
AnnaBridge 145:64910690c574 394 *
AnnaBridge 145:64910690c574 395 * @param base RCM peripheral base address.
AnnaBridge 145:64910690c574 396 * @param config Boot configuration.
AnnaBridge 145:64910690c574 397 */
AnnaBridge 145:64910690c574 398 void RCM_SetForceBootRomSource(RCM_Type *base, rcm_boot_rom_config_t config);
AnnaBridge 145:64910690c574 399 #endif /* FSL_FEATURE_RCM_HAS_BOOTROM */
AnnaBridge 145:64910690c574 400
AnnaBridge 145:64910690c574 401 #if (defined(FSL_FEATURE_RCM_HAS_SRIE) && FSL_FEATURE_RCM_HAS_SRIE)
AnnaBridge 145:64910690c574 402 /*!
AnnaBridge 145:64910690c574 403 * @brief Sets the system reset interrupt configuration.
AnnaBridge 145:64910690c574 404 *
AnnaBridge 145:64910690c574 405 * For a graceful shut down, the RCM supports delaying the assertion of the system
AnnaBridge 145:64910690c574 406 * reset for a period of time when the reset interrupt is generated. This function
AnnaBridge 145:64910690c574 407 * can be used to enable the interrupt and the delay period. The interrupts
AnnaBridge 145:64910690c574 408 * are passed in as bit mask. See rcm_int_t for details. For example, to
AnnaBridge 145:64910690c574 409 * delay a reset for 512 LPO cycles after the WDOG timeout or loss-of-clock occurs,
AnnaBridge 145:64910690c574 410 * configure as follows:
AnnaBridge 145:64910690c574 411 * RCM_SetSystemResetInterruptConfig(kRCM_IntWatchDog | kRCM_IntLossOfClk, kRCM_ResetDelay512Lpo);
AnnaBridge 145:64910690c574 412 *
AnnaBridge 145:64910690c574 413 * @param base RCM peripheral base address.
AnnaBridge 145:64910690c574 414 * @param intMask Bit mask of the system reset interrupts to enable. See
AnnaBridge 145:64910690c574 415 * rcm_interrupt_enable_t for details.
AnnaBridge 145:64910690c574 416 * @param Delay Bit mask of the system reset interrupts to enable.
AnnaBridge 145:64910690c574 417 */
AnnaBridge 145:64910690c574 418 static inline void RCM_SetSystemResetInterruptConfig(RCM_Type *base, uint32_t intMask, rcm_reset_delay_t delay)
AnnaBridge 145:64910690c574 419 {
AnnaBridge 145:64910690c574 420 base->SRIE = (intMask | delay);
AnnaBridge 145:64910690c574 421 }
AnnaBridge 145:64910690c574 422 #endif /* FSL_FEATURE_RCM_HAS_SRIE */
AnnaBridge 145:64910690c574 423 /*@}*/
AnnaBridge 145:64910690c574 424
AnnaBridge 145:64910690c574 425 #if defined(__cplusplus)
AnnaBridge 145:64910690c574 426 }
AnnaBridge 145:64910690c574 427 #endif /* __cplusplus*/
AnnaBridge 145:64910690c574 428
AnnaBridge 145:64910690c574 429 /*! @}*/
AnnaBridge 145:64910690c574 430
AnnaBridge 145:64910690c574 431 #endif /* _FSL_RCM_H_ */