]> git.gir.st - tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/llwu/fsl_llwu_hal.h
Merge commit '1fe4406f374291ab2e86e95a97341fd9c475fcb8'
[tmk_keyboard.git] / tmk_core / tool / mbed / mbed-sdk / libraries / mbed / targets / hal / TARGET_Freescale / TARGET_KPSDK_MCUS / TARGET_KPSDK_CODE / hal / llwu / fsl_llwu_hal.h
1 /*
2 * Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * o Redistributions of source code must retain the above copyright notice, this list
9 * of conditions and the following disclaimer.
10 *
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.
14 *
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.
18 *
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.
29 */
30 #if !defined(__FSL_LLWU_HAL_H__)
31 #define __FSL_LLWU_HAL_H__
32
33 #include <stdint.h>
34 #include <stdbool.h>
35 #include <assert.h>
36 #include "fsl_device_registers.h"
37 #include "fsl_llwu_features.h"
38
39 /*! @addtogroup llwu_hal*/
40 /*! @{*/
41
42 /*! @file fsl_llwu_hal.h */
43
44 /*******************************************************************************
45 * Definitions
46 ******************************************************************************/
47
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;
55
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;
63
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;
69
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;
75
76 /*******************************************************************************
77 * API
78 ******************************************************************************/
79 /*!
80 * @brief Sets the external input pin source mode.
81 *
82 * This function sets the external input pin source mode that is used
83 * as a wake up source.
84 *
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
88 */
89 void LLWU_HAL_SetExternalInputPinMode(uint32_t baseAddr,
90 llwu_external_pin_modes_t pinMode,
91 uint32_t pinNumber);
92
93 /*!
94 * @brief Gets the external input pin source mode.
95 *
96 * This function gets the external input pin source mode that is used
97 * as wake up source.
98 *
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
102 */
103 llwu_external_pin_modes_t LLWU_HAL_GetExternalInputPinMode(uint32_t baseAddr,
104 uint32_t pinNumber);
105
106 /*!
107 * @brief Enables/disables the internal module source.
108 *
109 * This function enables/disables the internal module source mode that is used
110 * as a wake up source.
111 *
112 * @param baseAddr Register base address of LLWU
113 * @param moduleNumber module number specified
114 * @param enable enable or disable setting
115 */
116 void LLWU_HAL_SetInternalModuleCmd(uint32_t baseAddr, uint32_t moduleNumber, bool enable);
117
118 /*!
119 * @brief Gets the internal module source enable setting.
120 *
121 * This function gets the internal module source enable setting that is used
122 * as a wake up source.
123 *
124 * @param baseAddr Register base address of LLWU
125 * @param moduleNumber module number specified
126 * @return enable enable or disable setting
127 */
128 bool LLWU_HAL_GetInternalModuleCmd(uint32_t baseAddr, uint32_t moduleNumber);
129
130 /*!
131 * @brief Gets the external wakeup source flag.
132 *
133 * This function gets the external wakeup source flag for a specific pin.
134 *
135 * @param baseAddr Register base address of LLWU
136 * @param pinNumber pin number specified
137 * @return flag true if wakeup source flag set
138 */
139 bool LLWU_HAL_GetExternalPinWakeupFlag(uint32_t baseAddr, uint32_t pinNumber);
140
141 /*!
142 * @brief Clears the external wakeup source flag.
143 *
144 * This function clears the external wakeup source flag for a specific pin.
145 *
146 * @param baseAddr Register base address of LLWU
147 * @param pinNumber pin number specified
148 */
149 void LLWU_HAL_ClearExternalPinWakeupFlag(uint32_t baseAddr, uint32_t pinNumber);
150
151 /*!
152 * @brief Gets the internal module wakeup source flag.
153 *
154 * This function gets the internal module wakeup source flag for a specific module.
155 *
156 * @param baseAddr Register base address of LLWU
157 * @param moduleNumber module number specified
158 * @return flag true if wakeup flag set
159 */
160 bool LLWU_HAL_GetInternalModuleWakeupFlag(uint32_t baseAddr, uint32_t moduleNumber);
161
162 /*!
163 * @brief Sets the pin filter configuration.
164 *
165 * This function sets the pin filter configuration.
166 *
167 * @param baseAddr Register base address of LLWU
168 * @param filterNumber filter number specified
169 * @param pinFilterMode filter mode configuration
170 */
171 void LLWU_HAL_SetPinFilterMode(uint32_t baseAddr, uint32_t filterNumber,
172 llwu_external_pin_filter_mode_t pinFilterMode);
173 /*!
174 * @brief Gets the pin filter configuration.
175 *
176 * This function gets the pin filter configuration.
177 *
178 * @param baseAddr Register base address of LLWU
179 * @param filterNumber filter number specified
180 * @param pinFilterMode filter mode configuration
181 */
182 void LLWU_HAL_GetPinFilterMode(uint32_t baseAddr, uint32_t filterNumber,
183 llwu_external_pin_filter_mode_t *pinFilterMode);
184
185 /*!
186 * @brief Gets the filter detect flag.
187 *
188 * This function will get the filter detect flag.
189 *
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
193 */
194 bool LLWU_HAL_GetFilterDetectFlag(uint32_t baseAddr, uint32_t filterNumber);
195
196 /*!
197 * @brief Clears the filter detect flag.
198 *
199 * This function will clear the filter detect flag.
200 *
201 * @param baseAddr Register base address of LLWU
202 * @param filterNumber filter number specified
203 */
204 void LLWU_HAL_ClearFilterDetectFlag(uint32_t baseAddr, uint32_t filterNumber);
205
206 #if FSL_FEATURE_LLWU_HAS_RESET_ENABLE
207 /*!
208 * @brief Sets the reset enable mode.
209 *
210 * This function will set the reset enable mode.
211 *
212 * @param baseAddr Register base address of LLWU
213 * @param resetEnableMode reset enable mode defined in llwu_reset_enable_mode_t
214 */
215 void LLWU_HAL_SetResetEnableMode(uint32_t baseAddr, llwu_reset_enable_mode_t resetEnableMode);
216
217 /*!
218 * @brief Gets the reset enable mode.
219 *
220 * This function gets the reset enable mode.
221 *
222 * @param baseAddr Register base address of LLWU
223 * @param resetEnableMode reset enable mode defined in llwu_reset_enable_mode_t
224 */
225 void LLWU_HAL_GetResetEnableMode(uint32_t baseAddr, llwu_reset_enable_mode_t *resetEnableMode);
226 #endif
227
228 #if defined(__cplusplus)
229 extern "C" {
230 #endif /* __cplusplus*/
231
232 /*! @name Low-Leakage Wakeup Unit Control APIs*/
233 /*@{*/
234
235
236 /*@}*/
237
238 #if defined(__cplusplus)
239 }
240 #endif /* __cplusplus*/
241
242 /*! @}*/
243
244 #endif /* __FSL_LLWU_HAL_H__*/
245 /*******************************************************************************
246 * EOF
247 ******************************************************************************/
248
Imprint / Impressum