STM32H735xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32h7xx_hal_rng_ex.h 00004 * @author MCD Application Team 00005 * @brief Header file of RNG HAL Extension module. 00006 ****************************************************************************** 00007 * @attention 00008 * 00009 * Copyright (c) 2017 STMicroelectronics. 00010 * All rights reserved. 00011 * 00012 * This software is licensed under terms that can be found in the LICENSE file 00013 * in the root directory of this software component. 00014 * If no LICENSE file comes with this software, it is provided AS-IS. 00015 * 00016 ****************************************************************************** 00017 */ 00018 00019 /* Define to prevent recursive inclusion -------------------------------------*/ 00020 #ifndef STM32H7xx_HAL_RNG_EX_H 00021 #define STM32H7xx_HAL_RNG_EX_H 00022 00023 #ifdef __cplusplus 00024 extern "C" { 00025 #endif 00026 00027 /* Includes ------------------------------------------------------------------*/ 00028 #include "stm32h7xx_hal_def.h" 00029 00030 /** @addtogroup STM32H7xx_HAL_Driver 00031 * @{ 00032 */ 00033 00034 #if defined(RNG) 00035 #if defined(RNG_CR_CONDRST) 00036 00037 /** @defgroup RNG_Ex RNG_Ex 00038 * @brief RNG Extension HAL module driver 00039 * @{ 00040 */ 00041 00042 /* Exported types ------------------------------------------------------------*/ 00043 /** @defgroup RNG_Ex_Exported_Types RNG_Ex Exported Types 00044 * @brief RNG_Ex Exported types 00045 * @{ 00046 */ 00047 00048 /** 00049 * @brief RNG_Ex Configuration Structure definition 00050 */ 00051 00052 typedef struct 00053 { 00054 uint32_t Config1; /*!< Config1 must be a value between 0 and 0x3F */ 00055 uint32_t Config2; /*!< Config2 must be a value between 0 and 0x7 */ 00056 uint32_t Config3; /*!< Config3 must be a value between 0 and 0xF */ 00057 uint32_t ClockDivider; /*!< Clock Divider factor.This parameter can 00058 be a value of @ref RNG_Ex_Clock_Divider_Factor */ 00059 uint32_t NistCompliance; /*!< NIST compliance.This parameter can be a 00060 value of @ref RNG_Ex_NIST_Compliance */ 00061 } RNG_ConfigTypeDef; 00062 00063 /** 00064 * @} 00065 */ 00066 00067 /* Exported constants --------------------------------------------------------*/ 00068 /** @defgroup RNG_Ex_Exported_Constants RNG_Ex Exported Constants 00069 * @{ 00070 */ 00071 00072 /** @defgroup RNG_Ex_Clock_Divider_Factor Value used to configure an internal 00073 * programmable divider acting on the incoming RNG clock 00074 * @{ 00075 */ 00076 #define RNG_CLKDIV_BY_1 (0x00000000UL) /*!< No clock division */ 00077 #define RNG_CLKDIV_BY_2 (RNG_CR_CLKDIV_0) 00078 /*!< 2 RNG clock cycles per internal RNG clock */ 00079 #define RNG_CLKDIV_BY_4 (RNG_CR_CLKDIV_1) 00080 /*!< 4 RNG clock cycles per internal RNG clock */ 00081 #define RNG_CLKDIV_BY_8 (RNG_CR_CLKDIV_1 | RNG_CR_CLKDIV_0) 00082 /*!< 8 RNG clock cycles per internal RNG clock */ 00083 #define RNG_CLKDIV_BY_16 (RNG_CR_CLKDIV_2) 00084 /*!< 16 RNG clock cycles per internal RNG clock */ 00085 #define RNG_CLKDIV_BY_32 (RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_0) 00086 /*!< 32 RNG clock cycles per internal RNG clock */ 00087 #define RNG_CLKDIV_BY_64 (RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_1) 00088 /*!< 64 RNG clock cycles per internal RNG clock */ 00089 #define RNG_CLKDIV_BY_128 (RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_1 | RNG_CR_CLKDIV_0) 00090 /*!< 128 RNG clock cycles per internal RNG clock */ 00091 #define RNG_CLKDIV_BY_256 (RNG_CR_CLKDIV_3) 00092 /*!< 256 RNG clock cycles per internal RNG clock */ 00093 #define RNG_CLKDIV_BY_512 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_0) 00094 /*!< 512 RNG clock cycles per internal RNG clock */ 00095 #define RNG_CLKDIV_BY_1024 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_1) 00096 /*!< 1024 RNG clock cycles per internal RNG clock */ 00097 #define RNG_CLKDIV_BY_2048 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_1 | RNG_CR_CLKDIV_0) 00098 /*!< 2048 RNG clock cycles per internal RNG clock */ 00099 #define RNG_CLKDIV_BY_4096 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_2) 00100 /*!< 4096 RNG clock cycles per internal RNG clock */ 00101 #define RNG_CLKDIV_BY_8192 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_0) 00102 /*!< 8192 RNG clock cycles per internal RNG clock */ 00103 #define RNG_CLKDIV_BY_16384 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_1) 00104 /*!< 16384 RNG clock cycles per internal RNG clock */ 00105 #define RNG_CLKDIV_BY_32768 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_1 | RNG_CR_CLKDIV_0) 00106 /*!< 32768 RNG clock cycles per internal RNG clock */ 00107 /** 00108 * @} 00109 */ 00110 00111 /** @defgroup RNG_Ex_NIST_Compliance NIST Compliance configuration 00112 * @{ 00113 */ 00114 #define RNG_NIST_COMPLIANT (0x00000000UL) /*!< NIST compliant configuration*/ 00115 #define RNG_CUSTOM_NIST (RNG_CR_NISTC) /*!< Custom NIST configuration */ 00116 00117 /** 00118 * @} 00119 */ 00120 00121 /** 00122 * @} 00123 */ 00124 00125 /* Private types -------------------------------------------------------------*/ 00126 /** @defgroup RNG_Ex_Private_Types RNG_Ex Private Types 00127 * @{ 00128 */ 00129 00130 /** 00131 * @} 00132 */ 00133 00134 /* Private variables ---------------------------------------------------------*/ 00135 /** @defgroup RNG_Ex_Private_Variables RNG_Ex Private Variables 00136 * @{ 00137 */ 00138 00139 /** 00140 * @} 00141 */ 00142 00143 /* Private constants ---------------------------------------------------------*/ 00144 /** @defgroup RNG_Ex_Private_Constants RNG_Ex Private Constants 00145 * @{ 00146 */ 00147 00148 /** 00149 * @} 00150 */ 00151 00152 /* Private macros ------------------------------------------------------------*/ 00153 /** @defgroup RNG_Ex_Private_Macros RNG_Ex Private Macros 00154 * @{ 00155 */ 00156 00157 #define IS_RNG_CLOCK_DIVIDER(__CLOCK_DIV__) (((__CLOCK_DIV__) == RNG_CLKDIV_BY_1) || \ 00158 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_2) || \ 00159 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_4) || \ 00160 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_8) || \ 00161 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_16) || \ 00162 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_32) || \ 00163 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_64) || \ 00164 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_128) || \ 00165 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_256) || \ 00166 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_512) || \ 00167 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_1024) || \ 00168 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_2048) || \ 00169 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_4096) || \ 00170 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_8192) || \ 00171 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_16384) || \ 00172 ((__CLOCK_DIV__) == RNG_CLKDIV_BY_32768)) 00173 00174 00175 #define IS_RNG_NIST_COMPLIANCE(__NIST_COMPLIANCE__) (((__NIST_COMPLIANCE__) == RNG_NIST_COMPLIANT) || \ 00176 ((__NIST_COMPLIANCE__) == RNG_CUSTOM_NIST)) 00177 00178 #define IS_RNG_CONFIG1(__CONFIG1__) ((__CONFIG1__) <= 0x3FUL) 00179 00180 #define IS_RNG_CONFIG2(__CONFIG2__) ((__CONFIG2__) <= 0x07UL) 00181 00182 #define IS_RNG_CONFIG3(__CONFIG3__) ((__CONFIG3__) <= 0xFUL) 00183 00184 00185 /** 00186 * @} 00187 */ 00188 00189 /* Private functions ---------------------------------------------------------*/ 00190 /** @defgroup RNG_Ex_Private_Functions RNG_Ex Private Functions 00191 * @{ 00192 */ 00193 00194 /** 00195 * @} 00196 */ 00197 00198 /* Exported functions --------------------------------------------------------*/ 00199 /** @defgroup RNG_Ex_Exported_Functions RNG_Ex Exported Functions 00200 * @{ 00201 */ 00202 00203 /** @addtogroup RNG_Ex_Exported_Functions_Group1 00204 * @{ 00205 */ 00206 HAL_StatusTypeDef HAL_RNGEx_SetConfig(RNG_HandleTypeDef *hrng, RNG_ConfigTypeDef *pConf); 00207 HAL_StatusTypeDef HAL_RNGEx_GetConfig(RNG_HandleTypeDef *hrng, RNG_ConfigTypeDef *pConf); 00208 HAL_StatusTypeDef HAL_RNGEx_LockConfig(RNG_HandleTypeDef *hrng); 00209 00210 /** 00211 * @} 00212 */ 00213 00214 /** @addtogroup RNG_Ex_Exported_Functions_Group2 00215 * @{ 00216 */ 00217 HAL_StatusTypeDef HAL_RNGEx_RecoverSeedError(RNG_HandleTypeDef *hrng); 00218 00219 /** 00220 * @} 00221 */ 00222 00223 /** 00224 * @} 00225 */ 00226 00227 /** 00228 * @} 00229 */ 00230 00231 /** 00232 * @} 00233 */ 00234 00235 #endif /* RNG_CR_CONDRST */ 00236 #endif /* RNG */ 00237 00238 /** 00239 * @} 00240 */ 00241 00242 #ifdef __cplusplus 00243 } 00244 #endif 00245 00246 00247 #endif /* STM32H7xx_HAL_RNG_EX_H */ 00248