20#ifndef STM32H7xx_HAL_RNG_H
21#define STM32H7xx_HAL_RNG_H
55 uint32_t ClockErrorDetection;
68 HAL_RNG_STATE_RESET = 0x00U,
69 HAL_RNG_STATE_READY = 0x01U,
70 HAL_RNG_STATE_BUSY = 0x02U,
71 HAL_RNG_STATE_TIMEOUT = 0x03U,
72 HAL_RNG_STATE_ERROR = 0x04U
74} HAL_RNG_StateTypeDef;
84#if (USE_HAL_RNG_REGISTER_CALLBACKS == 1)
85typedef struct __RNG_HandleTypeDef
96 __IO HAL_RNG_StateTypeDef State;
98 __IO uint32_t ErrorCode;
100 uint32_t RandomNumber;
102#if (USE_HAL_RNG_REGISTER_CALLBACKS == 1)
103 void (* ReadyDataCallback)(
struct __RNG_HandleTypeDef *hrng, uint32_t random32bit);
104 void (* ErrorCallback)(
struct __RNG_HandleTypeDef *hrng);
106 void (* MspInitCallback)(
struct __RNG_HandleTypeDef *hrng);
107 void (* MspDeInitCallback)(
struct __RNG_HandleTypeDef *hrng);
112#if (USE_HAL_RNG_REGISTER_CALLBACKS == 1)
118 HAL_RNG_ERROR_CB_ID = 0x00U,
120 HAL_RNG_MSPINIT_CB_ID = 0x01U,
121 HAL_RNG_MSPDEINIT_CB_ID = 0x02U
123} HAL_RNG_CallbackIDTypeDef;
128typedef void (*pRNG_CallbackTypeDef)(RNG_HandleTypeDef *hrng);
129typedef void (*pRNG_ReadyDataCallbackTypeDef)(RNG_HandleTypeDef *hrng, uint32_t random32bit);
151#define RNG_IT_DRDY RNG_SR_DRDY
152#define RNG_IT_CEI RNG_SR_CEIS
153#define RNG_IT_SEI RNG_SR_SEIS
162#define RNG_FLAG_DRDY RNG_SR_DRDY
163#define RNG_FLAG_CECS RNG_SR_CECS
164#define RNG_FLAG_SECS RNG_SR_SECS
173#define RNG_CED_ENABLE 0x00000000U
174#define RNG_CED_DISABLE RNG_CR_CED
183#define HAL_RNG_ERROR_NONE 0x00000000U
184#if (USE_HAL_RNG_REGISTER_CALLBACKS == 1)
185#define HAL_RNG_ERROR_INVALID_CALLBACK 0x00000001U
187#define HAL_RNG_ERROR_TIMEOUT 0x00000002U
188#define HAL_RNG_ERROR_BUSY 0x00000004U
189#define HAL_RNG_ERROR_SEED 0x00000008U
190#define HAL_RNG_ERROR_CLOCK 0x00000010U
209#if (USE_HAL_RNG_REGISTER_CALLBACKS == 1)
210#define __HAL_RNG_RESET_HANDLE_STATE(__HANDLE__) do{ \
211 (__HANDLE__)->State = HAL_RNG_STATE_RESET; \
212 (__HANDLE__)->MspInitCallback = NULL; \
213 (__HANDLE__)->MspDeInitCallback = NULL; \
216#define __HAL_RNG_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_RNG_STATE_RESET)
224#define __HAL_RNG_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= RNG_CR_RNGEN)
231#define __HAL_RNG_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~RNG_CR_RNGEN)
243#define __HAL_RNG_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__))
253#define __HAL_RNG_CLEAR_FLAG(__HANDLE__, __FLAG__)
260#define __HAL_RNG_ENABLE_IT(__HANDLE__) ((__HANDLE__)->Instance->CR |= RNG_CR_IE)
267#define __HAL_RNG_DISABLE_IT(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~RNG_CR_IE)
279#define __HAL_RNG_GET_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->SR & (__INTERRUPT__)) == (__INTERRUPT__))
291#define __HAL_RNG_CLEAR_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->SR) = ~(__INTERRUPT__))
297#if defined (RNG_CR_CONDRST)
313void HAL_RNG_MspInit(RNG_HandleTypeDef *hrng);
314void HAL_RNG_MspDeInit(RNG_HandleTypeDef *hrng);
317#if (USE_HAL_RNG_REGISTER_CALLBACKS == 1)
318HAL_StatusTypeDef HAL_RNG_RegisterCallback(RNG_HandleTypeDef *hrng, HAL_RNG_CallbackIDTypeDef CallbackID,
319 pRNG_CallbackTypeDef pCallback);
320HAL_StatusTypeDef HAL_RNG_UnRegisterCallback(RNG_HandleTypeDef *hrng, HAL_RNG_CallbackIDTypeDef CallbackID);
322HAL_StatusTypeDef HAL_RNG_RegisterReadyDataCallback(RNG_HandleTypeDef *hrng, pRNG_ReadyDataCallbackTypeDef pCallback);
334HAL_StatusTypeDef HAL_RNG_GenerateRandomNumber(RNG_HandleTypeDef *hrng, uint32_t *random32bit);
336uint32_t HAL_RNG_ReadLastRandomNumber(RNG_HandleTypeDef *hrng);
338void HAL_RNG_IRQHandler(RNG_HandleTypeDef *hrng);
339void HAL_RNG_ErrorCallback(RNG_HandleTypeDef *hrng);
340void HAL_RNG_ReadyDataCallback(RNG_HandleTypeDef *hrng, uint32_t random32bit);
350HAL_RNG_StateTypeDef HAL_RNG_GetState(RNG_HandleTypeDef *hrng);
351uint32_t HAL_RNG_GetError(RNG_HandleTypeDef *hrng);
365#define IS_RNG_IT(IT) (((IT) == RNG_IT_CEI) || \
366 ((IT) == RNG_IT_SEI))
368#define IS_RNG_FLAG(FLAG) (((FLAG) == RNG_FLAG_DRDY) || \
369 ((FLAG) == RNG_FLAG_CECS) || \
370 ((FLAG) == RNG_FLAG_SECS))
377#define IS_RNG_CED(__MODE__) (((__MODE__) == RNG_CED_ENABLE) || \
378 ((__MODE__) == RNG_CED_DISABLE))
383#if defined(RNG_CR_CONDRST)
#define __IO
Definition: core_cm4.h:239
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_StatusTypeDef
HAL Status structures definition.
Definition: stm32h7xx_hal_def.h:47
HAL_LockTypeDef
HAL Lock structures definition.
Definition: stm32h7xx_hal_def.h:58
Header file of RNG HAL Extension module.
RNG.
Definition: stm32h723xx.h:1668