Move telemetry displayport init and cms device registering
[betaflight.git] / lib / main / STM32F4 / Drivers / STM32F4xx_HAL_Driver / Inc / stm32f4xx_hal_rng.h
blobbb5bfa34889fb20821ca47c5a6afd3db0502e3b6
1 /**
2 ******************************************************************************
3 * @file stm32f4xx_hal_rng.h
4 * @author MCD Application Team
5 * @version V1.7.1
6 * @date 14-April-2017
7 * @brief Header file of RNG HAL 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 __STM32F4xx_HAL_RNG_H
40 #define __STM32F4xx_HAL_RNG_H
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
46 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\
47 defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
48 defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F469xx) ||\
49 defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\
50 defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
52 /* Includes ------------------------------------------------------------------*/
53 #include "stm32f4xx_hal_def.h"
55 /** @addtogroup STM32F4xx_HAL_Driver
56 * @{
59 /** @defgroup RNG RNG
60 * @brief RNG HAL module driver
61 * @{
64 /* Exported types ------------------------------------------------------------*/
66 /** @defgroup RNG_Exported_Types RNG Exported Types
67 * @{
70 /** @defgroup RNG_Exported_Types_Group1 RNG State Structure definition
71 * @{
73 typedef enum
75 HAL_RNG_STATE_RESET = 0x00U, /*!< RNG not yet initialized or disabled */
76 HAL_RNG_STATE_READY = 0x01U, /*!< RNG initialized and ready for use */
77 HAL_RNG_STATE_BUSY = 0x02U, /*!< RNG internal process is ongoing */
78 HAL_RNG_STATE_TIMEOUT = 0x03U, /*!< RNG timeout state */
79 HAL_RNG_STATE_ERROR = 0x04U /*!< RNG error state */
81 }HAL_RNG_StateTypeDef;
83 /**
84 * @}
87 /** @defgroup RNG_Exported_Types_Group2 RNG Handle Structure definition
88 * @{
89 */
90 typedef struct
92 RNG_TypeDef *Instance; /*!< Register base address */
94 HAL_LockTypeDef Lock; /*!< RNG locking object */
96 __IO HAL_RNG_StateTypeDef State; /*!< RNG communication state */
98 uint32_t RandomNumber; /*!< Last Generated RNG Data */
100 }RNG_HandleTypeDef;
102 /**
103 * @}
107 * @}
110 /* Exported constants --------------------------------------------------------*/
112 /** @defgroup RNG_Exported_Constants RNG Exported Constants
113 * @{
116 /** @defgroup RNG_Exported_Constants_Group1 RNG Interrupt definition
117 * @{
119 #define RNG_IT_DRDY RNG_SR_DRDY /*!< Data Ready interrupt */
120 #define RNG_IT_CEI RNG_SR_CEIS /*!< Clock error interrupt */
121 #define RNG_IT_SEI RNG_SR_SEIS /*!< Seed error interrupt */
123 * @}
126 /** @defgroup RNG_Exported_Constants_Group2 RNG Flag definition
127 * @{
129 #define RNG_FLAG_DRDY RNG_SR_DRDY /*!< Data ready */
130 #define RNG_FLAG_CECS RNG_SR_CECS /*!< Clock error current status */
131 #define RNG_FLAG_SECS RNG_SR_SECS /*!< Seed error current status */
134 * @}
138 * @}
141 /* Exported macros -----------------------------------------------------------*/
143 /** @defgroup RNG_Exported_Macros RNG Exported Macros
144 * @{
147 /** @brief Reset RNG handle state
148 * @param __HANDLE__: RNG Handle
149 * @retval None
151 #define __HAL_RNG_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_RNG_STATE_RESET)
154 * @brief Enables the RNG peripheral.
155 * @param __HANDLE__: RNG Handle
156 * @retval None
158 #define __HAL_RNG_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= RNG_CR_RNGEN)
161 * @brief Disables the RNG peripheral.
162 * @param __HANDLE__: RNG Handle
163 * @retval None
165 #define __HAL_RNG_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~RNG_CR_RNGEN)
168 * @brief Check the selected RNG flag status.
169 * @param __HANDLE__: RNG Handle
170 * @param __FLAG__: RNG flag
171 * This parameter can be one of the following values:
172 * @arg RNG_FLAG_DRDY: Data ready
173 * @arg RNG_FLAG_CECS: Clock error current status
174 * @arg RNG_FLAG_SECS: Seed error current status
175 * @retval The new state of __FLAG__ (SET or RESET).
177 #define __HAL_RNG_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__))
180 * @brief Clears the selected RNG flag status.
181 * @param __HANDLE__: RNG handle
182 * @param __FLAG__: RNG flag to clear
183 * @note WARNING: This is a dummy macro for HAL code alignment,
184 * flags RNG_FLAG_DRDY, RNG_FLAG_CECS and RNG_FLAG_SECS are read-only.
185 * @retval None
187 #define __HAL_RNG_CLEAR_FLAG(__HANDLE__, __FLAG__) /* dummy macro */
192 * @brief Enables the RNG interrupts.
193 * @param __HANDLE__: RNG Handle
194 * @retval None
196 #define __HAL_RNG_ENABLE_IT(__HANDLE__) ((__HANDLE__)->Instance->CR |= RNG_CR_IE)
199 * @brief Disables the RNG interrupts.
200 * @param __HANDLE__: RNG Handle
201 * @retval None
203 #define __HAL_RNG_DISABLE_IT(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~RNG_CR_IE)
206 * @brief Checks whether the specified RNG interrupt has occurred or not.
207 * @param __HANDLE__: RNG Handle
208 * @param __INTERRUPT__: specifies the RNG interrupt status flag to check.
209 * This parameter can be one of the following values:
210 * @arg RNG_IT_DRDY: Data ready interrupt
211 * @arg RNG_IT_CEI: Clock error interrupt
212 * @arg RNG_IT_SEI: Seed error interrupt
213 * @retval The new state of __INTERRUPT__ (SET or RESET).
215 #define __HAL_RNG_GET_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->SR & (__INTERRUPT__)) == (__INTERRUPT__))
218 * @brief Clear the RNG interrupt status flags.
219 * @param __HANDLE__: RNG Handle
220 * @param __INTERRUPT__: specifies the RNG interrupt status flag to clear.
221 * This parameter can be one of the following values:
222 * @arg RNG_IT_CEI: Clock error interrupt
223 * @arg RNG_IT_SEI: Seed error interrupt
224 * @note RNG_IT_DRDY flag is read-only, reading RNG_DR register automatically clears RNG_IT_DRDY.
225 * @retval None
227 #define __HAL_RNG_CLEAR_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->SR) = ~(__INTERRUPT__))
230 * @}
233 /* Exported functions --------------------------------------------------------*/
234 /** @defgroup RNG_Exported_Functions RNG Exported Functions
235 * @{
238 /** @defgroup RNG_Exported_Functions_Group1 Initialization and de-initialization functions
239 * @{
241 HAL_StatusTypeDef HAL_RNG_Init(RNG_HandleTypeDef *hrng);
242 HAL_StatusTypeDef HAL_RNG_DeInit (RNG_HandleTypeDef *hrng);
243 void HAL_RNG_MspInit(RNG_HandleTypeDef *hrng);
244 void HAL_RNG_MspDeInit(RNG_HandleTypeDef *hrng);
247 * @}
250 /** @defgroup RNG_Exported_Functions_Group2 Peripheral Control functions
251 * @{
253 uint32_t HAL_RNG_GetRandomNumber(RNG_HandleTypeDef *hrng); /* Obsolete, use HAL_RNG_GenerateRandomNumber() instead */
254 uint32_t HAL_RNG_GetRandomNumber_IT(RNG_HandleTypeDef *hrng); /* Obsolete, use HAL_RNG_GenerateRandomNumber_IT() instead */
256 HAL_StatusTypeDef HAL_RNG_GenerateRandomNumber(RNG_HandleTypeDef *hrng, uint32_t *random32bit);
257 HAL_StatusTypeDef HAL_RNG_GenerateRandomNumber_IT(RNG_HandleTypeDef *hrng);
258 uint32_t HAL_RNG_ReadLastRandomNumber(RNG_HandleTypeDef *hrng);
260 void HAL_RNG_IRQHandler(RNG_HandleTypeDef *hrng);
261 void HAL_RNG_ErrorCallback(RNG_HandleTypeDef *hrng);
262 void HAL_RNG_ReadyDataCallback(RNG_HandleTypeDef* hrng, uint32_t random32bit);
265 * @}
268 /** @defgroup RNG_Exported_Functions_Group3 Peripheral State functions
269 * @{
271 HAL_RNG_StateTypeDef HAL_RNG_GetState(RNG_HandleTypeDef *hrng);
274 * @}
278 * @}
281 /* Private types -------------------------------------------------------------*/
282 /** @defgroup RNG_Private_Types RNG Private Types
283 * @{
287 * @}
290 /* Private defines -----------------------------------------------------------*/
291 /** @defgroup RNG_Private_Defines RNG Private Defines
292 * @{
296 * @}
299 /* Private variables ---------------------------------------------------------*/
300 /** @defgroup RNG_Private_Variables RNG Private Variables
301 * @{
305 * @}
308 /* Private constants ---------------------------------------------------------*/
309 /** @defgroup RNG_Private_Constants RNG Private Constants
310 * @{
314 * @}
317 /* Private macros ------------------------------------------------------------*/
318 /** @defgroup RNG_Private_Macros RNG Private Macros
319 * @{
321 #define IS_RNG_IT(IT) (((IT) == RNG_IT_CEI) || \
322 ((IT) == RNG_IT_SEI))
324 #define IS_RNG_FLAG(FLAG) (((FLAG) == RNG_FLAG_DRDY) || \
325 ((FLAG) == RNG_FLAG_CECS) || \
326 ((FLAG) == RNG_FLAG_SECS))
329 * @}
332 /* Private functions prototypes ----------------------------------------------*/
333 /** @defgroup RNG_Private_Functions_Prototypes RNG Private Functions Prototypes
334 * @{
338 * @}
341 /* Private functions ---------------------------------------------------------*/
342 /** @defgroup RNG_Private_Functions RNG Private Functions
343 * @{
347 * @}
351 * @}
355 * @}
358 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx ||\
359 STM32F429xx || STM32F439xx || STM32F410xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\
360 STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
362 #ifdef __cplusplus
364 #endif
367 #endif /* __STM32F4xx_HAL_RNG_H */
369 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/