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