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_RO359B/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K24F/drivers/fsl_rcm.h@143:86740a56073b
mbed library. Release version 164

Who changed what in which revision?

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