summaryrefslogtreecommitdiffstats
path: root/bsps/arm/stm32h7/include/stm32h7xx_ll_rng.h
diff options
context:
space:
mode:
Diffstat (limited to 'bsps/arm/stm32h7/include/stm32h7xx_ll_rng.h')
-rw-r--r--bsps/arm/stm32h7/include/stm32h7xx_ll_rng.h40
1 files changed, 27 insertions, 13 deletions
diff --git a/bsps/arm/stm32h7/include/stm32h7xx_ll_rng.h b/bsps/arm/stm32h7/include/stm32h7xx_ll_rng.h
index 2f29c8c117..56f030d5b4 100644
--- a/bsps/arm/stm32h7/include/stm32h7xx_ll_rng.h
+++ b/bsps/arm/stm32h7/include/stm32h7xx_ll_rng.h
@@ -6,13 +6,12 @@
******************************************************************************
* @attention
*
- * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
- * All rights reserved.</center></h2>
+ * Copyright (c) 2017 STMicroelectronics.
+ * All rights reserved.
*
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
+ * This software is licensed under terms that can be found in the LICENSE file
+ * in the root directory of this software component.
+ * If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
@@ -40,6 +39,16 @@ extern "C" {
*/
/* Private types -------------------------------------------------------------*/
+/* Private defines -----------------------------------------------------------*/
+/** @defgroup RNG_LL_Private_Defines RNG Private Defines
+ * @ingroup RTEMSBSPsARMSTM32H7
+ * @{
+ */
+/* Health test control register information to use in CCM algorithm */
+#define LL_RNG_HTCFG 0x17590ABCU /*!< Magic number */
+/**
+ * @}
+ */
/* Private variables ---------------------------------------------------------*/
/* Private constants ---------------------------------------------------------*/
/* Private macros ------------------------------------------------------------*/
@@ -59,8 +68,8 @@ typedef struct
{
uint32_t ClockErrorDetection; /*!< Clock error detection.
This parameter can be one value of @ref RNG_LL_CED.
-
- This parameter can be modified using unitary functions @ref LL_RNG_EnableClkErrorDetect(). */
+ This parameter can be modified using unitary
+ functions @ref LL_RNG_EnableClkErrorDetect(). */
} LL_RNG_InitTypeDef;
/**
@@ -86,7 +95,7 @@ typedef struct
#if defined(RNG_CR_CONDRST)
/** @defgroup RNG_LL_Clock_Divider_Factor Value used to configure an internal
* @ingroup RTEMSBSPsARMSTM32H7
- * programmable divider acting on the incoming RNG clock
+ * programmable divider acting on the incoming RNG clock
* @{
*/
#define LL_RNG_CLKDIV_BY_1 (0x00000000UL) /*!< No clock division */
@@ -120,7 +129,7 @@ typedef struct
* @}
*/
-#endif/*RNG_CR_CONDRST*/
+#endif /* RNG_CR_CONDRST */
/** @defgroup RNG_LL_EC_GET_FLAG Get Flags Defines
* @ingroup RTEMSBSPsARMSTM32H7
* @brief Flags defines which can be used with LL_RNG_ReadReg function
@@ -629,7 +638,7 @@ __STATIC_INLINE uint32_t LL_RNG_ReadRandData32(RNG_TypeDef *RNGx)
* @}
*/
-#if defined (RNG_VER_3_1)
+#if defined(RNG_VER_3_2) || defined(RNG_VER_3_1) || defined(RNG_VER_3_0)
/** @defgroup RNG_LL_EF_Health_Test_Control Health Test Control
* @ingroup RTEMSBSPsARMSTM32H7
* @{
@@ -644,6 +653,9 @@ __STATIC_INLINE uint32_t LL_RNG_ReadRandData32(RNG_TypeDef *RNGx)
*/
__STATIC_INLINE void LL_RNG_SetHealthConfig(RNG_TypeDef *RNGx, uint32_t HTCFG)
{
+ /*!< magic number must be written immediately before to RNG_HTCRG */
+ WRITE_REG(RNGx->HTCR, LL_RNG_HTCFG);
+
WRITE_REG(RNGx->HTCR, HTCFG);
}
@@ -655,13 +667,16 @@ __STATIC_INLINE void LL_RNG_SetHealthConfig(RNG_TypeDef *RNGx, uint32_t HTCFG)
*/
__STATIC_INLINE uint32_t LL_RNG_GetHealthConfig(RNG_TypeDef *RNGx)
{
+ /*!< magic number must be written immediately before reading RNG_HTCRG */
+ WRITE_REG(RNGx->HTCR, LL_RNG_HTCFG);
+
return (uint32_t)READ_REG(RNGx->HTCR);
}
/**
* @}
*/
-#endif /*RNG_VER_3_1*/
+#endif /* RNG_VER_3_2, RNG_VER_3_1 or RNG_VER_3_0 */
#if defined(USE_FULL_LL_DRIVER) || defined(__rtems__)
/** @defgroup RNG_LL_EF_Init Initialization and de-initialization functions
* @ingroup RTEMSBSPsARMSTM32H7
@@ -696,4 +711,3 @@ ErrorStatus LL_RNG_DeInit(RNG_TypeDef *RNGx);
#endif /* __STM32H7xx_LL_RNG_H */
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/