RTEMS 6.1-rc7
Loading...
Searching...
No Matches
stm32h7xx_hal_rng_ex.h
Go to the documentation of this file.
1
19/* Define to prevent recursive inclusion -------------------------------------*/
20#ifndef STM32H7xx_HAL_RNG_EX_H
21#define STM32H7xx_HAL_RNG_EX_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/* Includes ------------------------------------------------------------------*/
28#include "stm32h7xx_hal_def.h"
29
34#if defined(RNG)
35#if defined(RNG_CR_CONDRST)
36
43/* Exported types ------------------------------------------------------------*/
54typedef struct
55{
56 uint32_t Config1;
57 uint32_t Config2;
58 uint32_t Config3;
59 uint32_t ClockDivider;
61 uint32_t NistCompliance;
63} RNG_ConfigTypeDef;
64
69/* Exported constants --------------------------------------------------------*/
80#define RNG_CLKDIV_BY_1 (0x00000000UL)
81#define RNG_CLKDIV_BY_2 (RNG_CR_CLKDIV_0)
83#define RNG_CLKDIV_BY_4 (RNG_CR_CLKDIV_1)
85#define RNG_CLKDIV_BY_8 (RNG_CR_CLKDIV_1 | RNG_CR_CLKDIV_0)
87#define RNG_CLKDIV_BY_16 (RNG_CR_CLKDIV_2)
89#define RNG_CLKDIV_BY_32 (RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_0)
91#define RNG_CLKDIV_BY_64 (RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_1)
93#define RNG_CLKDIV_BY_128 (RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_1 | RNG_CR_CLKDIV_0)
95#define RNG_CLKDIV_BY_256 (RNG_CR_CLKDIV_3)
97#define RNG_CLKDIV_BY_512 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_0)
99#define RNG_CLKDIV_BY_1024 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_1)
101#define RNG_CLKDIV_BY_2048 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_1 | RNG_CR_CLKDIV_0)
103#define RNG_CLKDIV_BY_4096 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_2)
105#define RNG_CLKDIV_BY_8192 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_0)
107#define RNG_CLKDIV_BY_16384 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_1)
109#define RNG_CLKDIV_BY_32768 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_1 | RNG_CR_CLKDIV_0)
119#define RNG_NIST_COMPLIANT (0x00000000UL)
120#define RNG_CUSTOM_NIST (RNG_CR_NISTC)
130/* Private types -------------------------------------------------------------*/
140/* Private variables ---------------------------------------------------------*/
150/* Private constants ---------------------------------------------------------*/
160/* Private macros ------------------------------------------------------------*/
166#define IS_RNG_CLOCK_DIVIDER(__CLOCK_DIV__) (((__CLOCK_DIV__) == RNG_CLKDIV_BY_1) || \
167 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_2) || \
168 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_4) || \
169 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_8) || \
170 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_16) || \
171 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_32) || \
172 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_64) || \
173 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_128) || \
174 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_256) || \
175 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_512) || \
176 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_1024) || \
177 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_2048) || \
178 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_4096) || \
179 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_8192) || \
180 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_16384) || \
181 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_32768))
182
183
184#define IS_RNG_NIST_COMPLIANCE(__NIST_COMPLIANCE__) (((__NIST_COMPLIANCE__) == RNG_NIST_COMPLIANT) || \
185 ((__NIST_COMPLIANCE__) == RNG_CUSTOM_NIST))
186
187#define IS_RNG_CONFIG1(__CONFIG1__) ((__CONFIG1__) <= 0x3FUL)
188
189#define IS_RNG_CONFIG2(__CONFIG2__) ((__CONFIG2__) <= 0x07UL)
190
191#define IS_RNG_CONFIG3(__CONFIG3__) ((__CONFIG3__) <= 0xFUL)
192
193
198/* Private functions ---------------------------------------------------------*/
208/* Exported functions --------------------------------------------------------*/
217HAL_StatusTypeDef HAL_RNGEx_SetConfig(RNG_HandleTypeDef *hrng, const RNG_ConfigTypeDef *pConf);
218HAL_StatusTypeDef HAL_RNGEx_GetConfig(RNG_HandleTypeDef *hrng, RNG_ConfigTypeDef *pConf);
219HAL_StatusTypeDef HAL_RNGEx_LockConfig(RNG_HandleTypeDef *hrng);
220
228HAL_StatusTypeDef HAL_RNGEx_RecoverSeedError(RNG_HandleTypeDef *hrng);
229
246#endif /* RNG_CR_CONDRST */
247#endif /* RNG */
248
253#ifdef __cplusplus
254}
255#endif
256
257
258#endif /* STM32H7xx_HAL_RNG_EX_H */
259
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_StatusTypeDef
HAL Status structures definition.
Definition: stm32h7xx_hal_def.h:47