Merge pull request #11189 from klutvott123/move-telemetry-displayport-init
[betaflight.git] / lib / main / STM32G4 / Drivers / STM32G4xx_HAL_Driver / Src / stm32g4xx_ll_fmac.c
blob455e9bdcb2ce233ea2187730a39dc7a35dbe668e
1 /**
2 ******************************************************************************
3 * @file stm32g4xx_ll_fmac.c
4 * @author MCD Application Team
5 * @brief FMAC LL module driver.
6 ******************************************************************************
7 * @attention
9 * <h2><center>&copy; Copyright (c) 2017 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_fmac.h"
23 #include "stm32g4xx_ll_bus.h"
24 #ifdef USE_FULL_ASSERT
25 #include "stm32_assert.h"
26 #else
27 #define assert_param(expr) ((void)0)
28 #endif /* USE_FULL_ASSERT */
30 /** @addtogroup STM32G4xx_LL_Driver
31 * @{
34 #if defined(FMAC)
36 /** @addtogroup FMAC_LL
37 * @{
40 /* Private types -------------------------------------------------------------*/
41 /* Private variables ---------------------------------------------------------*/
42 /* Private constants ---------------------------------------------------------*/
43 /* Private macros ------------------------------------------------------------*/
44 /** @addtogroup FMAC_LL_Private_Macros
45 * @{
48 /** @brief Check if the watermark value is a valid one.
49 * @param __VALUE__ Watermak value.
50 * @retval SET (__VALUE__ is a valid value) or RESET (__VALUE__ is invalid)
52 #define IS_LL_FMAC_WM(__VALUE__) (((__VALUE__) == LL_FMAC_WM_0_THRESHOLD_1) \
53 || ((__VALUE__) == LL_FMAC_WM_1_THRESHOLD_2) \
54 || ((__VALUE__) == LL_FMAC_WM_2_THRESHOLD_4) \
55 || ((__VALUE__) == LL_FMAC_WM_3_THRESHOLD_8))
57 /** @brief Check if the function ID is a valid one.
58 * @param __VALUE__ Function ID.
59 * @retval SET (__VALUE__ is a valid value) or RESET (__VALUE__ is invalid)
61 #define IS_LL_FMAC_FUNC(__VALUE__) (((__VALUE__) == LL_FMAC_FUNC_LOAD_X1) \
62 || ((__VALUE__) == LL_FMAC_FUNC_LOAD_X2) \
63 || ((__VALUE__) == LL_FMAC_FUNC_LOAD_Y) \
64 || ((__VALUE__) == LL_FMAC_FUNC_CONVO_FIR) \
65 || ((__VALUE__) == LL_FMAC_FUNC_IIR_DIRECT_FORM_1))
68 /**
69 * @}
72 /* Private function prototypes -----------------------------------------------*/
74 /* Exported functions --------------------------------------------------------*/
75 /** @addtogroup FMAC_LL_Exported_Functions
76 * @{
79 /** @addtogroup FMAC_LL_EF_Init
80 * @{
83 /**
84 * @brief Initialize FMAC peripheral registers to their default reset values.
85 * @param FMACx FMAC Instance
86 * @retval An ErrorStatus enumeration value:
87 * - SUCCESS: FMAC registers are initialized
88 * - ERROR: FMAC registers are not initialized
90 ErrorStatus LL_FMAC_Init(FMAC_TypeDef *FMACx)
92 ErrorStatus status = SUCCESS;
94 /* Check the parameters */
95 assert_param(IS_FMAC_ALL_INSTANCE(FMACx));
97 if (FMACx == FMAC)
99 /* Perform the reset */
100 LL_FMAC_EnableReset(FMACx);
102 /* Wait until flag is reset */
103 while (LL_FMAC_IsEnabledReset(FMACx) != 0UL)
107 else
109 status = ERROR;
112 return (status);
116 * @brief De-Initialize FMAC peripheral registers to their default reset values.
117 * @param FMACx FMAC Instance
118 * @retval An ErrorStatus enumeration value:
119 * - SUCCESS: FMAC registers are de-initialized
120 * - ERROR: FMAC registers are not de-initialized
122 ErrorStatus LL_FMAC_DeInit(FMAC_TypeDef *FMACx)
124 ErrorStatus status = SUCCESS;
126 /* Check the parameters */
127 assert_param(IS_FMAC_ALL_INSTANCE(FMACx));
129 if (FMACx == FMAC)
131 /* Force FMAC reset */
132 LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_FMAC);
134 /* Release FMAC reset */
135 LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_FMAC);
137 else
139 status = ERROR;
142 return (status);
148 * @}
152 * @}
156 * @}
159 #endif /* defined(FMAC) */
162 * @}
165 #endif /* USE_FULL_LL_DRIVER */
167 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/