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_LLWU_HAL_H__)
31 #define __FSL_LLWU_HAL_H__
36 #include "fsl_device_registers.h"
37 #include "fsl_llwu_features.h"
39 /*! @addtogroup llwu_hal*/
42 /*! @file fsl_llwu_hal.h */
44 /*******************************************************************************
46 ******************************************************************************/
48 /*! @brief External input pin control modes */
49 typedef enum _llwu_external_pin_modes
{
50 kLlwuExternalPinDisabled
, /* pin disabled as wakeup input */
51 kLlwuExternalPinRisingEdge
, /* pin enabled with rising edge detection */
52 kLlwuExternalPinFallingEdge
, /* pin enabled with falling edge detection */
53 kLlwuExternalPinChangeDetect
/* pin enabled with any change detection */
54 } llwu_external_pin_modes_t
;
56 /*! @brief Digital filter control modes */
57 typedef enum _llwu_filter_modes
{
58 kLlwuFilterDisabled
, /* filter disabled */
59 kLlwuFilterPosEdgeDetect
, /* filter positive edge detection */
60 kLlwuFilterNegEdgeDetect
, /* filter negative edge detection */
61 kLlwuFilterAnyEdgeDetect
/* filter any edge detection */
62 } llwu_filter_modes_t
;
64 /*! @brief External input pin filter control structure */
65 typedef struct _llwu_external_pin_filter_mode
{
66 llwu_filter_modes_t filterMode
; /* filter mode */
67 uint32_t pinNumber
; /* pin number */
68 } llwu_external_pin_filter_mode_t
;
70 /*! @brief Reset enable control structure */
71 typedef struct _llwu_reset_enable_mode
{
72 bool lowLeakageMode
; /* reset for Low-leakage mode */
73 bool digitalFilterMode
; /* reset for digital filter mode */
74 } llwu_reset_enable_mode_t
;
76 /*******************************************************************************
78 ******************************************************************************/
80 * @brief Sets the external input pin source mode.
82 * This function sets the external input pin source mode that is used
83 * as a wake up source.
85 * @param baseAddr Register base address of LLWU
86 * @param pinMode pin configuration mode defined in llwu_external_pin_modes_t
87 * @param pinNumber pin number specified
89 void LLWU_HAL_SetExternalInputPinMode(uint32_t baseAddr
,
90 llwu_external_pin_modes_t pinMode
,
94 * @brief Gets the external input pin source mode.
96 * This function gets the external input pin source mode that is used
99 * @param baseAddr Register base address of LLWU
100 * @param pinNumber pin number specified
101 * @return pinMode pin mode defined in llwu_external_pin_modes_t
103 llwu_external_pin_modes_t
LLWU_HAL_GetExternalInputPinMode(uint32_t baseAddr
,
107 * @brief Enables/disables the internal module source.
109 * This function enables/disables the internal module source mode that is used
110 * as a wake up source.
112 * @param baseAddr Register base address of LLWU
113 * @param moduleNumber module number specified
114 * @param enable enable or disable setting
116 void LLWU_HAL_SetInternalModuleCmd(uint32_t baseAddr
, uint32_t moduleNumber
, bool enable
);
119 * @brief Gets the internal module source enable setting.
121 * This function gets the internal module source enable setting that is used
122 * as a wake up source.
124 * @param baseAddr Register base address of LLWU
125 * @param moduleNumber module number specified
126 * @return enable enable or disable setting
128 bool LLWU_HAL_GetInternalModuleCmd(uint32_t baseAddr
, uint32_t moduleNumber
);
131 * @brief Gets the external wakeup source flag.
133 * This function gets the external wakeup source flag for a specific pin.
135 * @param baseAddr Register base address of LLWU
136 * @param pinNumber pin number specified
137 * @return flag true if wakeup source flag set
139 bool LLWU_HAL_GetExternalPinWakeupFlag(uint32_t baseAddr
, uint32_t pinNumber
);
142 * @brief Clears the external wakeup source flag.
144 * This function clears the external wakeup source flag for a specific pin.
146 * @param baseAddr Register base address of LLWU
147 * @param pinNumber pin number specified
149 void LLWU_HAL_ClearExternalPinWakeupFlag(uint32_t baseAddr
, uint32_t pinNumber
);
152 * @brief Gets the internal module wakeup source flag.
154 * This function gets the internal module wakeup source flag for a specific module.
156 * @param baseAddr Register base address of LLWU
157 * @param moduleNumber module number specified
158 * @return flag true if wakeup flag set
160 bool LLWU_HAL_GetInternalModuleWakeupFlag(uint32_t baseAddr
, uint32_t moduleNumber
);
163 * @brief Sets the pin filter configuration.
165 * This function sets the pin filter configuration.
167 * @param baseAddr Register base address of LLWU
168 * @param filterNumber filter number specified
169 * @param pinFilterMode filter mode configuration
171 void LLWU_HAL_SetPinFilterMode(uint32_t baseAddr
, uint32_t filterNumber
,
172 llwu_external_pin_filter_mode_t pinFilterMode
);
174 * @brief Gets the pin filter configuration.
176 * This function gets the pin filter configuration.
178 * @param baseAddr Register base address of LLWU
179 * @param filterNumber filter number specified
180 * @param pinFilterMode filter mode configuration
182 void LLWU_HAL_GetPinFilterMode(uint32_t baseAddr
, uint32_t filterNumber
,
183 llwu_external_pin_filter_mode_t
*pinFilterMode
);
186 * @brief Gets the filter detect flag.
188 * This function will get the filter detect flag.
190 * @param baseAddr Register base address of LLWU
191 * @param filterNumber filter number specified
192 * @return flag true if the filter was a wakeup source
194 bool LLWU_HAL_GetFilterDetectFlag(uint32_t baseAddr
, uint32_t filterNumber
);
197 * @brief Clears the filter detect flag.
199 * This function will clear the filter detect flag.
201 * @param baseAddr Register base address of LLWU
202 * @param filterNumber filter number specified
204 void LLWU_HAL_ClearFilterDetectFlag(uint32_t baseAddr
, uint32_t filterNumber
);
206 #if FSL_FEATURE_LLWU_HAS_RESET_ENABLE
208 * @brief Sets the reset enable mode.
210 * This function will set the reset enable mode.
212 * @param baseAddr Register base address of LLWU
213 * @param resetEnableMode reset enable mode defined in llwu_reset_enable_mode_t
215 void LLWU_HAL_SetResetEnableMode(uint32_t baseAddr
, llwu_reset_enable_mode_t resetEnableMode
);
218 * @brief Gets the reset enable mode.
220 * This function gets the reset enable mode.
222 * @param baseAddr Register base address of LLWU
223 * @param resetEnableMode reset enable mode defined in llwu_reset_enable_mode_t
225 void LLWU_HAL_GetResetEnableMode(uint32_t baseAddr
, llwu_reset_enable_mode_t
*resetEnableMode
);
228 #if defined(__cplusplus)
230 #endif /* __cplusplus*/
232 /*! @name Low-Leakage Wakeup Unit Control APIs*/
238 #if defined(__cplusplus)
240 #endif /* __cplusplus*/
244 #endif /* __FSL_LLWU_HAL_H__*/
245 /*******************************************************************************
247 ******************************************************************************/