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.
78  This parameter can be a number ranging between 0x0U ~ 0xFFFFFFFFU. */
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.
84 
85  This parameter can be a number ranging between 0x0U ~ 0x1FU, and the default value is 20U. */
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 
105 
106 /** @} */
107 
108 /** @} */
109 
110 /** @addtogroup HAL_AON_WDT_CALLBACK_STRUCTURES Callback Structures
111  * @{
112  */
113 
114 /** @defgroup HAL_AON_WDT_Callback Callback
115  * @{
116  */
117 
118 /**
119  * @brief HAL_AON_WDT Callback function definition
120  */
121 
122 typedef struct _aon_wdt_callback
123 {
124  void (*aon_wdt_alarm_callback)(aon_wdt_handle_t *p_aon_wdt); /**< AON_WDT count complete callback */
126 
127 /** @} */
128 
129 /** @} */
130 
131 /* Exported functions --------------------------------------------------------*/
132 /** @addtogroup HAL_AON_WDT_DRIVER_FUNCTIONS Functions
133  * @{
134  */
135 
136 /** @addtogroup AON_WDT_Exported_Functions_Group1 Initialization and de-initialization functions
137  * @brief Initialization and Configuration functions.
138  *
139 @verbatim
140  ==============================================================================
141  ##### Initialization and Configuration functions #####
142  ==============================================================================
143  [..]
144  This section provides functions allowing to:
145  (+) Initialize and start the AON_WDT according to the specified parameters
146  in the wdt_init_t of associated handle.
147  (+) Initialize the AON_WDT MSP.
148 
149 @endverbatim
150  * @{
151  */
152 
153 /**
154  ****************************************************************************************
155  * @brief Initialize the AON_WDT according to the specified parameters in the wdt_init_t
156  * of associated handle.
157  *
158  * @param[in] p_aon_wdt: Pointer to a AON_WDT handle which contains the configuration
159  * information for the specified AON_WDT module.
160  *
161  * @retval ::HAL_OK: Operation is OK.
162  * @retval ::HAL_ERROR: Parameter error or operation not supported.
163  * @retval ::HAL_BUSY: Driver is busy.
164  * @retval ::HAL_TIMEOUT: Timeout occurred.
165  ****************************************************************************************
166  */
168 
169 /**
170  ****************************************************************************************
171  * @brief De-initialize the AON_WDT peripheral.
172  *
173  * @param[in] p_aon_wdt: AON_WDT handle.
174  *
175  * @retval ::HAL_OK: Operation is OK.
176  * @retval ::HAL_ERROR: Parameter error or operation not supported.
177  * @retval ::HAL_BUSY: Driver is busy.
178  * @retval ::HAL_TIMEOUT: Timeout occurred.
179  ****************************************************************************************
180  */
182 
183 /** @} */
184 
185 /** @addtogroup AON_WDT_Exported_Functions_Group2 IO operation functions
186  * @brief IO operation functions
187  *
188 @verbatim
189  ==============================================================================
190  ##### IO operation functions #####
191  ==============================================================================
192  [..]
193  This section provides functions allowing to:
194  (+) Refresh the AON_WDT.
195  (+) Handle AON_WDT interrupt request and associated function callback.
196 
197 @endverbatim
198  * @{
199  */
200 
201 /**
202  ****************************************************************************************
203  * @brief Refresh the AON_WDT.
204  *
205  * @param[in] p_aon_wdt: Pointer to a AON_WDT handle which contains the configuration
206  * information for the specified AON_WDT module.
207  *
208  * @retval ::HAL_OK: Operation is OK.
209  * @retval ::HAL_ERROR: Parameter error or operation not supported.
210  * @retval ::HAL_BUSY: Driver is busy.
211  * @retval ::HAL_TIMEOUT: Timeout occurred.
212  ****************************************************************************************
213  */
215 
216 /** @} */
217 
218 
219 /** @addtogroup AON_WDT_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks
220  * @brief IRQ Handler and Callbacks functions
221  * @{
222  */
223 
224 /**
225  ****************************************************************************************
226  * @brief Handle AON_WDT interrupt request.
227  *
228  * @note The count completed can be used if specific safety operations
229  * or data logging must be performed before the actual reset is generated.
230  * When RESET Mode is enabled, AON_WDT will generate an interrupt on first timeout.
231  * If interrupt has not been cleared before the second timeout, AON_WDT will then
232  * request a SoC Reset.
233  *
234  * @param[in] p_aon_wdt: Pointer to a AON_WDT handle which contains the configuration
235  * information for the specified AON_WDT module.
236  ****************************************************************************************
237  */
239 
240 /**
241  ****************************************************************************************
242  * @brief AON_WDT count complete (counter reaches to 0) callback.
243  *
244  * @note This function should not be modified. When the callback is needed,
245  * the hal_wdt_count_cplt_callback can be implemented in the user file.
246  *
247  * @param[in] p_aon_wdt: Pointer to a AON_WDT handle which contains the configuration
248  * information for the specified AON_WDT module.
249  ****************************************************************************************
250  */
252 
253 /** @} */
254 
255 /** @} */
256 
257 #ifdef __cplusplus
258 }
259 #endif
260 
261 #endif /* __GR55xx_HAL_AON_WDT_H__ */
262 
263 /** @} */
264 
265 /** @} */
266 
267 /** @} */
_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
_aon_wdt_handle::init
aon_wdt_init_t init
Definition: gr55xx_hal_aon_wdt.h:100
_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:124
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.
_aon_wdt_callback
HAL_AON_WDT Callback function definition.
Definition: gr55xx_hal_aon_wdt.h:123
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.
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_callback_t
struct _aon_wdt_callback hal_aon_wdt_callback_t
HAL_AON_WDT Callback function definition.
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
gr55xx_hal_def.h
This file contains HAL common definitions, enumeration, macros and structures definitions.