Merge pull request #11189 from klutvott123/move-telemetry-displayport-init
[betaflight.git] / lib / main / STM32G4 / Drivers / STM32G4xx_HAL_Driver / Src / stm32g4xx_ll_rng.c
blob8016a79587c75bb6ff59618a0e802d79f4795281
1 /**
2 ******************************************************************************
3 * @file stm32g4xx_ll_rng.c
4 * @author MCD Application Team
5 * @brief RNG LL module driver.
6 ******************************************************************************
7 * @attention
9 * <h2><center>&copy; Copyright (c) 2018 STMicroelectronics.
10 * All rights reserved.</center></h2>
12 * This software component is licensed by ST under BSD 3-Clause license,
13 * the "License"; You may not use this file except in compliance with the
14 * License. You may obtain a copy of the License at:
15 * opensource.org/licenses/BSD-3-Clause
17 ******************************************************************************
19 #if defined(USE_FULL_LL_DRIVER)
21 /* Includes ------------------------------------------------------------------*/
22 #include "stm32g4xx_ll_rng.h"
23 #include "stm32g4xx_ll_bus.h"
25 #ifdef USE_FULL_ASSERT
26 #include "stm32_assert.h"
27 #else
28 #define assert_param(expr) ((void)0U)
29 #endif
31 /** @addtogroup STM32G4xx_LL_Driver
32 * @{
35 #if defined (RNG)
37 /** @addtogroup RNG_LL
38 * @{
41 /* Private types -------------------------------------------------------------*/
42 /* Private variables ---------------------------------------------------------*/
43 /* Private constants ---------------------------------------------------------*/
44 /* Private macros ------------------------------------------------------------*/
45 /** @addtogroup RNG_LL_Private_Macros
46 * @{
48 #define IS_LL_RNG_CED(__MODE__) (((__MODE__) == LL_RNG_CED_ENABLE) || \
49 ((__MODE__) == LL_RNG_CED_DISABLE))
51 /**
52 * @}
54 /* Private function prototypes -----------------------------------------------*/
56 /* Exported functions --------------------------------------------------------*/
57 /** @addtogroup RNG_LL_Exported_Functions
58 * @{
61 /** @addtogroup RNG_LL_EF_Init
62 * @{
65 /**
66 * @brief De-initialize RNG registers (Registers restored to their default values).
67 * @param RNGx RNG Instance
68 * @retval An ErrorStatus enumeration value:
69 * - SUCCESS: RNG registers are de-initialized
70 * - ERROR: not applicable
72 ErrorStatus LL_RNG_DeInit(RNG_TypeDef *RNGx)
74 /* Check the parameters */
75 assert_param(IS_RNG_ALL_INSTANCE(RNGx));
76 /* Enable RNG reset state */
77 LL_AHB2_GRP1_ForceReset(LL_AHB2_GRP1_PERIPH_RNG);
79 /* Release RNG from reset state */
80 LL_AHB2_GRP1_ReleaseReset(LL_AHB2_GRP1_PERIPH_RNG);
81 return (SUCCESS);
84 /**
85 * @brief Initialize RNG registers according to the specified parameters in RNG_InitStruct.
86 * @param RNGx RNG Instance
87 * @param RNG_InitStruct pointer to a LL_RNG_InitTypeDef structure
88 * that contains the configuration information for the specified RNG peripheral.
89 * @retval An ErrorStatus enumeration value:
90 * - SUCCESS: RNG registers are initialized according to RNG_InitStruct content
91 * - ERROR: not applicable
93 ErrorStatus LL_RNG_Init(RNG_TypeDef *RNGx, LL_RNG_InitTypeDef *RNG_InitStruct)
95 /* Check the parameters */
96 assert_param(IS_RNG_ALL_INSTANCE(RNGx));
97 assert_param(IS_LL_RNG_CED(RNG_InitStruct->ClockErrorDetection));
99 /* Clock Error Detection configuration */
100 MODIFY_REG(RNGx->CR, RNG_CR_CED, RNG_InitStruct->ClockErrorDetection);
102 return (SUCCESS);
106 * @brief Set each @ref LL_RNG_InitTypeDef field to default value.
107 * @param RNG_InitStruct pointer to a @ref LL_RNG_InitTypeDef structure
108 * whose fields will be set to default values.
109 * @retval None
111 void LL_RNG_StructInit(LL_RNG_InitTypeDef *RNG_InitStruct)
113 /* Set RNG_InitStruct fields to default values */
114 RNG_InitStruct->ClockErrorDetection = LL_RNG_CED_ENABLE;
118 * @}
122 * @}
126 * @}
129 #endif /* RNG */
132 * @}
135 #endif /* USE_FULL_LL_DRIVER */
137 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/