Merge pull request #10592 from iNavFlight/MrD_Update-parameter-description
[inav.git] / lib / main / STM32F7 / Drivers / STM32F7xx_HAL_Driver / Inc / stm32f7xx_ll_iwdg.h
blob3bb44a148bdfd225d9cacb53786906b9ec8a1ea6
1 /**
2 ******************************************************************************
3 * @file stm32f7xx_ll_iwdg.h
4 * @author MCD Application Team
5 * @version V1.2.2
6 * @date 14-April-2017
7 * @brief Header file of IWDG LL module.
8 ******************************************************************************
9 * @attention
11 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
13 * Redistribution and use in source and binary forms, with or without modification,
14 * are permitted provided that the following conditions are met:
15 * 1. Redistributions of source code must retain the above copyright notice,
16 * this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
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 ARE
27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 ******************************************************************************
38 /* Define to prevent recursive inclusion -------------------------------------*/
39 #ifndef __STM32F7xx_LL_IWDG_H
40 #define __STM32F7xx_LL_IWDG_H
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
46 /* Includes ------------------------------------------------------------------*/
47 #include "stm32f7xx.h"
49 /** @addtogroup STM32F7xx_LL_Driver
50 * @{
53 #if defined(IWDG)
55 /** @defgroup IWDG_LL IWDG
56 * @{
59 /* Private types -------------------------------------------------------------*/
60 /* Private variables ---------------------------------------------------------*/
62 /* Private constants ---------------------------------------------------------*/
63 /** @defgroup IWDG_LL_Private_Constants IWDG Private Constants
64 * @{
67 #define LL_IWDG_KEY_RELOAD 0x0000AAAAU /*!< IWDG Reload Counter Enable */
68 #define LL_IWDG_KEY_ENABLE 0x0000CCCCU /*!< IWDG Peripheral Enable */
69 #define LL_IWDG_KEY_WR_ACCESS_ENABLE 0x00005555U /*!< IWDG KR Write Access Enable */
70 #define LL_IWDG_KEY_WR_ACCESS_DISABLE 0x00000000U /*!< IWDG KR Write Access Disable */
72 /**
73 * @}
76 /* Private macros ------------------------------------------------------------*/
78 /* Exported types ------------------------------------------------------------*/
79 /* Exported constants --------------------------------------------------------*/
80 /** @defgroup IWDG_LL_Exported_Constants IWDG Exported Constants
81 * @{
84 /** @defgroup IWDG_LL_EC_GET_FLAG Get Flags Defines
85 * @brief Flags defines which can be used with LL_IWDG_ReadReg function
86 * @{
88 #define LL_IWDG_SR_PVU IWDG_SR_PVU /*!< Watchdog prescaler value update */
89 #define LL_IWDG_SR_RVU IWDG_SR_RVU /*!< Watchdog counter reload value update */
90 #define LL_IWDG_SR_WVU IWDG_SR_WVU /*!< Watchdog counter window value update */
92 /**
93 * @}
96 /** @defgroup IWDG_LL_EC_PRESCALER Prescaler Divider
97 * @{
99 #define LL_IWDG_PRESCALER_4 0x00000000U /*!< Divider by 4 */
100 #define LL_IWDG_PRESCALER_8 (IWDG_PR_PR_0) /*!< Divider by 8 */
101 #define LL_IWDG_PRESCALER_16 (IWDG_PR_PR_1) /*!< Divider by 16 */
102 #define LL_IWDG_PRESCALER_32 (IWDG_PR_PR_1 | IWDG_PR_PR_0) /*!< Divider by 32 */
103 #define LL_IWDG_PRESCALER_64 (IWDG_PR_PR_2) /*!< Divider by 64 */
104 #define LL_IWDG_PRESCALER_128 (IWDG_PR_PR_2 | IWDG_PR_PR_0) /*!< Divider by 128 */
105 #define LL_IWDG_PRESCALER_256 (IWDG_PR_PR_2 | IWDG_PR_PR_1) /*!< Divider by 256 */
107 * @}
111 * @}
114 /* Exported macro ------------------------------------------------------------*/
115 /** @defgroup IWDG_LL_Exported_Macros IWDG Exported Macros
116 * @{
119 /** @defgroup IWDG_LL_EM_WRITE_READ Common Write and read registers Macros
120 * @{
124 * @brief Write a value in IWDG register
125 * @param __INSTANCE__ IWDG Instance
126 * @param __REG__ Register to be written
127 * @param __VALUE__ Value to be written in the register
128 * @retval None
130 #define LL_IWDG_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
133 * @brief Read a value in IWDG register
134 * @param __INSTANCE__ IWDG Instance
135 * @param __REG__ Register to be read
136 * @retval Register value
138 #define LL_IWDG_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
140 * @}
144 * @}
148 /* Exported functions --------------------------------------------------------*/
149 /** @defgroup IWDG_LL_Exported_Functions IWDG Exported Functions
150 * @{
152 /** @defgroup IWDG_LL_EF_Configuration Configuration
153 * @{
157 * @brief Start the Independent Watchdog
158 * @note Except if the hardware watchdog option is selected
159 * @rmtoll KR KEY LL_IWDG_Enable
160 * @param IWDGx IWDG Instance
161 * @retval None
163 __STATIC_INLINE void LL_IWDG_Enable(IWDG_TypeDef *IWDGx)
165 WRITE_REG(IWDG->KR, LL_IWDG_KEY_ENABLE);
169 * @brief Reloads IWDG counter with value defined in the reload register
170 * @rmtoll KR KEY LL_IWDG_ReloadCounter
171 * @param IWDGx IWDG Instance
172 * @retval None
174 __STATIC_INLINE void LL_IWDG_ReloadCounter(IWDG_TypeDef *IWDGx)
176 WRITE_REG(IWDG->KR, LL_IWDG_KEY_RELOAD);
180 * @brief Enable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers
181 * @rmtoll KR KEY LL_IWDG_EnableWriteAccess
182 * @param IWDGx IWDG Instance
183 * @retval None
185 __STATIC_INLINE void LL_IWDG_EnableWriteAccess(IWDG_TypeDef *IWDGx)
187 WRITE_REG(IWDG->KR, LL_IWDG_KEY_WR_ACCESS_ENABLE);
191 * @brief Disable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers
192 * @rmtoll KR KEY LL_IWDG_DisableWriteAccess
193 * @param IWDGx IWDG Instance
194 * @retval None
196 __STATIC_INLINE void LL_IWDG_DisableWriteAccess(IWDG_TypeDef *IWDGx)
198 WRITE_REG(IWDG->KR, LL_IWDG_KEY_WR_ACCESS_DISABLE);
202 * @brief Select the prescaler of the IWDG
203 * @rmtoll PR PR LL_IWDG_SetPrescaler
204 * @param IWDGx IWDG Instance
205 * @param Prescaler This parameter can be one of the following values:
206 * @arg @ref LL_IWDG_PRESCALER_4
207 * @arg @ref LL_IWDG_PRESCALER_8
208 * @arg @ref LL_IWDG_PRESCALER_16
209 * @arg @ref LL_IWDG_PRESCALER_32
210 * @arg @ref LL_IWDG_PRESCALER_64
211 * @arg @ref LL_IWDG_PRESCALER_128
212 * @arg @ref LL_IWDG_PRESCALER_256
213 * @retval None
215 __STATIC_INLINE void LL_IWDG_SetPrescaler(IWDG_TypeDef *IWDGx, uint32_t Prescaler)
217 WRITE_REG(IWDGx->PR, IWDG_PR_PR & Prescaler);
221 * @brief Get the selected prescaler of the IWDG
222 * @rmtoll PR PR LL_IWDG_GetPrescaler
223 * @param IWDGx IWDG Instance
224 * @retval Returned value can be one of the following values:
225 * @arg @ref LL_IWDG_PRESCALER_4
226 * @arg @ref LL_IWDG_PRESCALER_8
227 * @arg @ref LL_IWDG_PRESCALER_16
228 * @arg @ref LL_IWDG_PRESCALER_32
229 * @arg @ref LL_IWDG_PRESCALER_64
230 * @arg @ref LL_IWDG_PRESCALER_128
231 * @arg @ref LL_IWDG_PRESCALER_256
233 __STATIC_INLINE uint32_t LL_IWDG_GetPrescaler(IWDG_TypeDef *IWDGx)
235 return (uint32_t)(READ_REG(IWDGx->PR));
239 * @brief Specify the IWDG down-counter reload value
240 * @rmtoll RLR RL LL_IWDG_SetReloadCounter
241 * @param IWDGx IWDG Instance
242 * @param Counter Value between Min_Data=0 and Max_Data=0x0FFF
243 * @retval None
245 __STATIC_INLINE void LL_IWDG_SetReloadCounter(IWDG_TypeDef *IWDGx, uint32_t Counter)
247 WRITE_REG(IWDGx->RLR, IWDG_RLR_RL & Counter);
251 * @brief Get the specified IWDG down-counter reload value
252 * @rmtoll RLR RL LL_IWDG_GetReloadCounter
253 * @param IWDGx IWDG Instance
254 * @retval Value between Min_Data=0 and Max_Data=0x0FFF
256 __STATIC_INLINE uint32_t LL_IWDG_GetReloadCounter(IWDG_TypeDef *IWDGx)
258 return (uint32_t)(READ_REG(IWDGx->RLR));
262 * @brief Specify high limit of the window value to be compared to the down-counter.
263 * @rmtoll WINR WIN LL_IWDG_SetWindow
264 * @param IWDGx IWDG Instance
265 * @param Window Value between Min_Data=0 and Max_Data=0x0FFF
266 * @retval None
268 __STATIC_INLINE void LL_IWDG_SetWindow(IWDG_TypeDef *IWDGx, uint32_t Window)
270 WRITE_REG(IWDGx->WINR, IWDG_WINR_WIN & Window);
274 * @brief Get the high limit of the window value specified.
275 * @rmtoll WINR WIN LL_IWDG_GetWindow
276 * @param IWDGx IWDG Instance
277 * @retval Value between Min_Data=0 and Max_Data=0x0FFF
279 __STATIC_INLINE uint32_t LL_IWDG_GetWindow(IWDG_TypeDef *IWDGx)
281 return (uint32_t)(READ_REG(IWDGx->WINR));
285 * @}
288 /** @defgroup IWDG_LL_EF_FLAG_Management FLAG_Management
289 * @{
293 * @brief Check if flag Prescaler Value Update is set or not
294 * @rmtoll SR PVU LL_IWDG_IsActiveFlag_PVU
295 * @param IWDGx IWDG Instance
296 * @retval State of bit (1 or 0).
298 __STATIC_INLINE uint32_t LL_IWDG_IsActiveFlag_PVU(IWDG_TypeDef *IWDGx)
300 return (READ_BIT(IWDGx->SR, IWDG_SR_PVU) == (IWDG_SR_PVU));
304 * @brief Check if flag Reload Value Update is set or not
305 * @rmtoll SR RVU LL_IWDG_IsActiveFlag_RVU
306 * @param IWDGx IWDG Instance
307 * @retval State of bit (1 or 0).
309 __STATIC_INLINE uint32_t LL_IWDG_IsActiveFlag_RVU(IWDG_TypeDef *IWDGx)
311 return (READ_BIT(IWDGx->SR, IWDG_SR_RVU) == (IWDG_SR_RVU));
315 * @brief Check if flag Window Value Update is set or not
316 * @rmtoll SR WVU LL_IWDG_IsActiveFlag_WVU
317 * @param IWDGx IWDG Instance
318 * @retval State of bit (1 or 0).
320 __STATIC_INLINE uint32_t LL_IWDG_IsActiveFlag_WVU(IWDG_TypeDef *IWDGx)
322 return (READ_BIT(IWDGx->SR, IWDG_SR_WVU) == (IWDG_SR_WVU));
326 * @brief Check if all flags Prescaler, Reload & Window Value Update are reset or not
327 * @rmtoll SR PVU LL_IWDG_IsReady\n
328 * SR WVU LL_IWDG_IsReady\n
329 * SR RVU LL_IWDG_IsReady
330 * @param IWDGx IWDG Instance
331 * @retval State of bits (1 or 0).
333 __STATIC_INLINE uint32_t LL_IWDG_IsReady(IWDG_TypeDef *IWDGx)
335 return (READ_BIT(IWDGx->SR, IWDG_SR_PVU | IWDG_SR_RVU | IWDG_SR_WVU) == 0U);
339 * @}
344 * @}
348 * @}
351 #endif /* IWDG) */
354 * @}
357 #ifdef __cplusplus
359 #endif
361 #endif /* __STM32F7xx_LL_IWDG_H */
363 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/