1 /**
2   ******************************************************************************
3   * @file    stm32u5xx_ll_fmac.c
4   * @author  MCD Application Team
5   * @brief   Header for stm32u5xx_ll_fmac.c module
6   ******************************************************************************
7   * @attention
8   *
9   * Copyright (c) 2021 STMicroelectronics.
10   * All rights reserved.
11   *
12   * This software is licensed under terms that can be found in the LICENSE file
13   * in the root directory of this software component.
14   * If no LICENSE file comes with this software, it is provided AS-IS.
15   *
16   ******************************************************************************
17   */
18 #if defined(USE_FULL_LL_DRIVER)
19 
20 /* Includes ------------------------------------------------------------------*/
21 #include "stm32u5xx_ll_fmac.h"
22 #include "stm32u5xx_ll_bus.h"
23 #ifdef USE_FULL_ASSERT
24 #include "stm32_assert.h"
25 #else
26 #define assert_param(expr) ((void)0U)
27 #endif /* USE_FULL_ASSERT */
28 
29 /** @addtogroup STM32U5xx_LL_Driver
30   * @{
31   */
32 
33 #if defined(FMAC)
34 
35 /** @addtogroup FMAC_LL
36   * @{
37   */
38 
39 /* Private typedef -----------------------------------------------------------*/
40 /* Private defines -----------------------------------------------------------*/
41 /* Private macros ------------------------------------------------------------*/
42 /* Private variables ---------------------------------------------------------*/
43 /* Global variables ----------------------------------------------------------*/
44 /* Private function prototypes -----------------------------------------------*/
45 /* Functions Definition ------------------------------------------------------*/
46 /** @addtogroup FMAC_LL_Exported_Functions
47   * @{
48   */
49 
50 /** @addtogroup FMAC_LL_EF_Init
51   * @{
52   */
53 
54 /**
55   * @brief  Initialize FMAC peripheral registers to their default reset values.
56   * @param  FMACx FMAC Instance
57   * @retval ErrorStatus enumeration value:
58   *          - SUCCESS: FMAC registers are initialized
59   *          - ERROR: FMAC registers are not initialized
60   */
LL_FMAC_Init(FMAC_TypeDef * FMACx)61 ErrorStatus LL_FMAC_Init(FMAC_TypeDef *FMACx)
62 {
63   ErrorStatus status = SUCCESS;
64 
65   /* Check the parameters */
66   assert_param(IS_FMAC_ALL_INSTANCE(FMACx));
67 
68   if (FMACx == FMAC)
69   {
70     /* Perform the reset */
71     LL_FMAC_EnableReset(FMACx);
72 
73     /* Wait until flag is reset */
74     while (LL_FMAC_IsEnabledReset(FMACx) != 0UL)
75     {
76     }
77   }
78   else
79   {
80     status = ERROR;
81   }
82 
83   return (status);
84 }
85 
86 /**
87   * @brief  De-Initialize FMAC peripheral registers to their default reset values.
88   * @param  FMACx FMAC Instance
89   * @retval An ErrorStatus enumeration value:
90   *          - SUCCESS: FMAC registers are de-initialized
91   *          - ERROR: FMAC registers are not de-initialized
92   */
LL_FMAC_DeInit(const FMAC_TypeDef * FMACx)93 ErrorStatus LL_FMAC_DeInit(const FMAC_TypeDef *FMACx)
94 {
95   ErrorStatus status = SUCCESS;
96 
97   /* Check the parameters */
98   assert_param(IS_FMAC_ALL_INSTANCE(FMACx));
99 
100   if (FMACx == FMAC)
101   {
102     /* Force FMAC reset */
103     LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_FMAC);
104 
105     /* Release FMAC reset */
106     LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_FMAC);
107   }
108   else
109   {
110     status = ERROR;
111   }
112 
113   return (status);
114 }
115 
116 
117 
118 /**
119   * @}
120   */
121 
122 /**
123   * @}
124   */
125 
126 /**
127   * @}
128   */
129 
130 #endif /* defined(FMAC) */
131 
132 /**
133   * @}
134   */
135 
136 #endif /* USE_FULL_LL_DRIVER */
137