gr55xx_hal_aon_wdt.h
Go to the documentation of this file.
1 /**
2  ****************************************************************************************
3  *
4  * @file gr55xx_hal_aon_wdt.h
5  * @author BLE Driver Team
6  * @brief Header file containing functions prototypes of AON WDT HAL library.
7  *
8  ****************************************************************************************
9  * @attention
10  #####Copyright (c) 2019 GOODIX
11  All rights reserved.
12 
13  Redistribution and use in source and binary forms, with or without
14  modification, are permitted provided that the following conditions are met:
15  * Redistributions of source code must retain the above copyright
16  notice, this list of conditions and the following disclaimer.
17  * Redistributions in binary form must reproduce the above copyright
18  notice, this list of conditions and the following disclaimer in the
19  documentation and/or other materials provided with the distribution.
20  * Neither the name of GOODIX nor the names of its contributors may be used
21  to endorse or promote products derived from this software without
22  specific prior written permission.
23 
24  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  POSSIBILITY OF SUCH DAMAGE.
35  ****************************************************************************************
36  */
37 
38 /** @addtogroup PERIPHERAL Peripheral Driver
39  * @{
40  */
41 
42 /** @addtogroup HAL_DRIVER HAL Driver
43  * @{
44  */
45 
46 /** @defgroup HAL_AON_WDT AON_WDT
47  * @brief WDT HAL module driver.
48  * @{
49  */
50 
51 /* Define to prevent recursive inclusion -------------------------------------*/
52 #ifndef __GR55xx_HAL_AON_WDT_H__
53 #define __GR55xx_HAL_AON_WDT_H__
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
59 /* Includes ------------------------------------------------------------------*/
60 #include "gr55xx_ll_aon_wdt.h"
61 #include "gr55xx_hal_def.h"
62 
63 /* Exported types ------------------------------------------------------------*/
64 /** @addtogroup HAL_AON_WDT_STRUCTURES Structures
65  * @{
66  */
67 
68 /** @defgroup AON_WDT_Configuration AON_WDT Configuration
69  * @{
70  */
71 
72 /**
73  * @brief AON_WDT_Configuration init structure definition
74  */
75 typedef struct _aon_wdt_init
76 {
77  uint32_t counter; /**< Specifies the AON_WDT free-running downcounter value. Unit (ms)
78  This parameter can be a number ranging between 0x0U ~ 0xFFFFFFFFU / (SystemSlowClock / 1000). */
79 
80  uint32_t alarm_counter; /**< Specifies the AON_WDT downcounter alarm value before system reset.
81  When counter counts down to the alarm value, AON_WDT will generate
82  an interrupt. After counter counts down to 0, AON_WDT will then
83  request a SoC Reset. Unit (ms)
84 
85  This parameter can be a number ranging between 0x0U ~ 0xFFFFU / (SystemSlowClock / 1000). */
86 
88 
89 /** @} */
90 
91 /** @defgroup AON_WDT_handle AON_WDT handle
92  * @{
93  */
94 
95 /**
96  * @brief AON_WDT handle Structure definition
97  */
98 typedef struct _aon_wdt_handle
99 {
100  aon_wdt_init_t init; /**< AON_WDT required parameters */
101 
102  hal_lock_t lock; /**< AON_WDT locking object */
103 
104  uint32_t *SystemCoreLowClock; /**< AON_WDT Specifies the number of low-speed clocks. */
106 
107 /** @} */
108 
109 /** @} */
110 
111 /** @addtogroup HAL_AON_WDT_CALLBACK_STRUCTURES Callback Structures
112  * @{
113  */
114 
115 /** @defgroup HAL_AON_WDT_Callback Callback
116  * @{
117  */
118 
119 /**
120  * @brief HAL_AON_WDT Callback function definition
121  */
122 
123 typedef struct _hal_aon_wdt_callback
124 {
125  void (*aon_wdt_alarm_callback)(aon_wdt_handle_t *p_aon_wdt); /**< AON_WDT count complete callback */
127 
128 /** @} */
129 
130 /** @} */
131 
132 /* Exported functions --------------------------------------------------------*/
133 /** @addtogroup HAL_AON_WDT_DRIVER_FUNCTIONS Functions
134  * @{
135  */
136 
137 /** @addtogroup AON_WDT_Exported_Functions_Group1 Initialization and de-initialization functions
138  * @brief Initialization and Configuration functions.
139  *
140 @verbatim
141  ==============================================================================
142  ##### Initialization and Configuration functions #####
143  ==============================================================================
144  [..]
145  This section provides functions allowing to:
146  (+) Initialize and start the AON_WDT according to the specified parameters
147  in the wdt_init_t of associated handle.
148  (+) Initialize the AON_WDT MSP.
149 
150 @endverbatim
151  * @{
152  */
153 
154 /**
155  ****************************************************************************************
156  * @brief Initialize the AON_WDT according to the specified parameters in the wdt_init_t
157  * of associated handle.
158  *
159  * @param[in] p_aon_wdt: Pointer to a AON_WDT handle which contains the configuration
160  * information for the specified AON_WDT module.
161  *
162  * @retval ::HAL_OK: Operation is OK.
163  * @retval ::HAL_ERROR: Parameter error or operation not supported.
164  * @retval ::HAL_BUSY: Driver is busy.
165  * @retval ::HAL_TIMEOUT: Timeout occurred.
166  ****************************************************************************************
167  */
169 
170 /**
171  ****************************************************************************************
172  * @brief De-initialize the AON_WDT peripheral.
173  *
174  * @param[in] p_aon_wdt: AON_WDT handle.
175  *
176  * @retval ::HAL_OK: Operation is OK.
177  * @retval ::HAL_ERROR: Parameter error or operation not supported.
178  * @retval ::HAL_BUSY: Driver is busy.
179  * @retval ::HAL_TIMEOUT: Timeout occurred.
180  ****************************************************************************************
181  */
183 
184 /** @} */
185 
186 /** @addtogroup AON_WDT_Exported_Functions_Group2 IO operation functions
187  * @brief IO operation functions
188  *
189 @verbatim
190  ==============================================================================
191  ##### IO operation functions #####
192  ==============================================================================
193  [..]
194  This section provides functions allowing to:
195  (+) Refresh the AON_WDT.
196  (+) Handle AON_WDT interrupt request and associated function callback.
197 
198 @endverbatim
199  * @{
200  */
201 
202 /**
203  ****************************************************************************************
204  * @brief Refresh the AON_WDT.
205  *
206  * @param[in] p_aon_wdt: Pointer to a AON_WDT handle which contains the configuration
207  * information for the specified AON_WDT module.
208  *
209  * @retval ::HAL_OK: Operation is OK.
210  * @retval ::HAL_ERROR: Parameter error or operation not supported.
211  * @retval ::HAL_BUSY: Driver is busy.
212  * @retval ::HAL_TIMEOUT: Timeout occurred.
213  ****************************************************************************************
214  */
216 
217 /** @} */
218 
219 
220 /** @addtogroup AON_WDT_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks
221  * @brief IRQ Handler and Callbacks functions
222  * @{
223  */
224 
225 /**
226  ****************************************************************************************
227  * @brief Handle AON_WDT interrupt request.
228  *
229  * @note The count completed can be used if specific safety operations
230  * or data logging must be performed before the actual reset is generated.
231  * When RESET Mode is enabled, AON_WDT will generate an interrupt on first timeout.
232  * If interrupt has not been cleared before the second timeout, AON_WDT will then
233  * request a SoC Reset.
234  *
235  * @param[in] p_aon_wdt: Pointer to a AON_WDT handle which contains the configuration
236  * information for the specified AON_WDT module.
237  ****************************************************************************************
238  */
240 
241 /**
242  ****************************************************************************************
243  * @brief AON_WDT count complete (counter reaches to 0) callback.
244  *
245  * @note This function should not be modified. When the callback is needed,
246  * the hal_wdt_count_cplt_callback can be implemented in the user file.
247  *
248  * @param[in] p_aon_wdt: Pointer to a AON_WDT handle which contains the configuration
249  * information for the specified AON_WDT module.
250  ****************************************************************************************
251  */
253 
254 /** @} */
255 
256 /** @} */
257 
258 #ifdef __cplusplus
259 }
260 #endif
261 
262 #endif /* __GR55xx_HAL_AON_WDT_H__ */
263 
264 /** @} */
265 
266 /** @} */
267 
268 /** @} */
_aon_wdt_init::alarm_counter
uint32_t alarm_counter
Definition: gr55xx_hal_aon_wdt.h:80
hal_lock_t
hal_lock_t
HAL Lock structures definition.
Definition: gr55xx_hal_def.h:81
_hal_aon_wdt_callback
HAL_AON_WDT Callback function definition.
Definition: gr55xx_hal_aon_wdt.h:124
_aon_wdt_handle::init
aon_wdt_init_t init
Definition: gr55xx_hal_aon_wdt.h:100
hal_aon_wdt_deinit
hal_status_t hal_aon_wdt_deinit(aon_wdt_handle_t *p_aon_wdt)
De-initialize the AON_WDT peripheral.
hal_aon_wdt_alarm_callback
void hal_aon_wdt_alarm_callback(aon_wdt_handle_t *p_aon_wdt)
AON_WDT count complete (counter reaches to 0) callback.
hal_aon_wdt_irq_handler
void hal_aon_wdt_irq_handler(aon_wdt_handle_t *p_aon_wdt)
Handle AON_WDT interrupt request.
aon_wdt_init_t
struct _aon_wdt_init aon_wdt_init_t
AON_WDT_Configuration init structure definition.
_hal_aon_wdt_callback::aon_wdt_alarm_callback
void(* aon_wdt_alarm_callback)(aon_wdt_handle_t *p_aon_wdt)
Definition: gr55xx_hal_aon_wdt.h:125
aon_wdt_handle_t
struct _aon_wdt_handle aon_wdt_handle_t
AON_WDT handle Structure definition.
_aon_wdt_handle::lock
hal_lock_t lock
Definition: gr55xx_hal_aon_wdt.h:102
gr55xx_ll_aon_wdt.h
Header file containing functions prototypes of AON WDT LL library.
_aon_wdt_handle::SystemCoreLowClock
uint32_t * SystemCoreLowClock
Definition: gr55xx_hal_aon_wdt.h:104
hal_aon_wdt_refresh
hal_status_t hal_aon_wdt_refresh(aon_wdt_handle_t *p_aon_wdt)
Refresh the AON_WDT.
hal_status_t
hal_status_t
HAL Status structures definition.
Definition: gr55xx_hal_def.h:70
hal_aon_wdt_init
hal_status_t hal_aon_wdt_init(aon_wdt_handle_t *p_aon_wdt)
Initialize the AON_WDT according to the specified parameters in the wdt_init_t of associated handle.
_aon_wdt_init::counter
uint32_t counter
Definition: gr55xx_hal_aon_wdt.h:77
_aon_wdt_handle
AON_WDT handle Structure definition.
Definition: gr55xx_hal_aon_wdt.h:99
_aon_wdt_init
AON_WDT_Configuration init structure definition.
Definition: gr55xx_hal_aon_wdt.h:76
hal_aon_wdt_callback_t
struct _hal_aon_wdt_callback hal_aon_wdt_callback_t
HAL_AON_WDT Callback function definition.
gr55xx_hal_def.h
This file contains HAL common definitions, enumeration, macros and structures definitions.