2 * Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
8 * o Redistributions of source code must retain the above copyright notice, this list
9 * of conditions and the following disclaimer.
11 * o Redistributions in binary form must reproduce the above copyright notice, this
12 * list of conditions and the following disclaimer in the documentation and/or
13 * other materials provided with the distribution.
15 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
16 * contributors may be used to endorse or promote products derived from this
17 * software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #if !defined(__FSL_RCM_HAL_H__)
31 #define __FSL_RCM_HAL_H__
36 #include "fsl_device_registers.h"
37 #include "fsl_rcm_features.h"
39 /*! @addtogroup rcm_hal*/
42 /*! @file fsl_rcm_hal.h */
44 /*******************************************************************************
46 ******************************************************************************/
48 /*! @brief System Reset Source Name definitions */
49 typedef enum _rcm_source_names {
50 kRcmWakeup, /* low-leakage wakeup reset */
51 kRcmLowVoltDetect, /* low voltage detect reset */
52 kRcmLossOfClk, /* loss of clock reset */
53 kRcmLossOfLock, /* loss of lock reset */
54 kRcmWatchDog, /* watch dog reset */
55 kRcmExternalPin, /* external pin reset */
56 kRcmPowerOn, /* power on reset */
57 kRcmJtag, /* JTAG generated reset */
58 kRcmCoreLockup, /* core lockup reset */
59 kRcmSoftware, /* software reset */
60 kRcmSystem, /* system reset request bit set reset */
61 kRcmEzport, /* EzPort reset */
62 kRcmStopModeAckErr, /* stop mode ack error reset */
66 /*! @brief Reset pin filter select in Run and Wait modes */
67 typedef enum _rcm_filter_run_wait_modes {
68 kRcmFilterDisabled, /* all filtering disabled */
69 kRcmFilterBusClk, /* Bus clock filter enabled */
70 kRcmFilterLpoClk, /* LPO clock filter enabled */
71 kRcmFilterReserverd /* reserved setting */
72 } rcm_filter_run_wait_modes_t;
74 /*******************************************************************************
76 ******************************************************************************/
79 * @brief Gets the reset source status.
81 * This function gets the current reset source status for a specified source.
83 * @param baseAddr Register base address of RCM
84 * @param srcName reset source name
85 * @return status true or false for specified reset source
87 bool RCM_HAL_GetSrcStatusCmd(uint32_t baseAddr, rcm_source_names_t srcName);
90 * @brief Sets the reset pin filter in stop mode.
92 * This function sets the reset pin filter enable setting in stop mode.
94 * @param baseAddr Register base address of RCM
95 * @param enable enable or disable the filter in stop mode
97 static inline void RCM_HAL_SetFilterStopModeCmd(uint32_t baseAddr, bool enable)
99 BW_RCM_RPFC_RSTFLTSS(baseAddr, enable);
103 * @brief Gets the reset pin filter in stop mode.
105 * This function gets the reset pin filter enable setting in stop mode.
107 * @param baseAddr Register base address of RCM
108 * @return enable true/false to enable or disable the filter in stop mode
110 static inline bool RCM_HAL_GetFilterStopModeCmd(uint32_t baseAddr)
112 return (bool)BR_RCM_RPFC_RSTFLTSS(baseAddr);
116 * @brief Sets the reset pin filter in run and wait mode.
118 * This function sets the reset pin filter enable setting in run/wait mode.
120 * @param baseAddr Register base address of RCM
121 * @param mode to be set for reset filter in run/wait mode
123 static inline void RCM_HAL_SetFilterRunWaitMode(uint32_t baseAddr, rcm_filter_run_wait_modes_t mode)
125 BW_RCM_RPFC_RSTFLTSRW(baseAddr, mode);
129 * @brief Gets the reset pin filter for stop mode.
131 * This function gets the reset pin filter enable setting for stop mode.
133 * @param baseAddr Register base address of RCM
134 * @return mode for reset filter in run/wait mode
136 static inline rcm_filter_run_wait_modes_t RCM_HAL_GetFilterRunWaitMode(uint32_t baseAddr)
138 return (rcm_filter_run_wait_modes_t)BR_RCM_RPFC_RSTFLTSRW(baseAddr);
142 * @brief Sets the reset pin filter width.
144 * This function sets the reset pin filter width.
146 * @param baseAddr Register base address of RCM
147 * @param width to be set for reset filter width
149 static inline void RCM_HAL_SetFilterWidth(uint32_t baseAddr, uint32_t width)
151 BW_RCM_RPFW_RSTFLTSEL(baseAddr, width);
155 * @brief Gets the reset pin filter for stop mode.
157 * This function gets the reset pin filter width.
159 * @param baseAddr Register base address of RCM
160 * @return width reset filter width
162 static inline uint32_t RCM_HAL_GetFilterWidth(uint32_t baseAddr)
164 return (uint32_t)BR_RCM_RPFW_RSTFLTSEL(baseAddr);
168 * @brief Gets the EZP_MS_B pin assert status.
170 * This function gets the easy port mode status (EZP_MS_B) pin assert status.
172 * @param baseAddr Register base address of RCM
173 * @return status true - asserted, false - reasserted
175 static inline bool RCM_HAL_GetEasyPortModeStatusCmd(uint32_t baseAddr)
177 return (bool)BR_RCM_MR_EZP_MS(baseAddr);
180 #if defined(__cplusplus)
182 #endif /* __cplusplus*/
184 /*! @name Reset Control Module APIs*/
189 #if defined(__cplusplus)
191 #endif /* __cplusplus*/
195 #endif /* __FSL_RCM_HAL_H__*/
196 /*******************************************************************************
198 ******************************************************************************/