1 /**
2   ******************************************************************************
3   * @file    stm32h7xx_hal_mdios.h
4   * @author  MCD Application Team
5   * @brief   Header file of MDIOS HAL module.
6   ******************************************************************************
7   * @attention
8   *
9   * Copyright (c) 2017 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 
19 /* Define to prevent recursive inclusion -------------------------------------*/
20 #ifndef STM32H7xx_HAL_MDIOS_H
21 #define STM32H7xx_HAL_MDIOS_H
22 
23 #ifdef __cplusplus
24  extern "C" {
25 #endif
26 
27 
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32h7xx_hal_def.h"
30 
31 #if defined (MDIOS)
32 
33 /** @addtogroup STM32H7xx_HAL_Driver
34   * @{
35   */
36 
37 /** @addtogroup MDIOS
38   * @{
39   */
40 
41 /* Exported types ------------------------------------------------------------*/
42 /** @defgroup MDIOS_Exported_Types MDIOS Exported Types
43   * @{
44   */
45 
46 /** @defgroup MDIOS_Exported_Types_Group1 MDIOS State structures definition
47   * @{
48   */
49 
50 typedef enum
51 {
52   HAL_MDIOS_STATE_RESET             = 0x00U,    /*!< Peripheral not yet Initialized or disabled         */
53   HAL_MDIOS_STATE_READY             = 0x01U,    /*!< Peripheral Initialized and ready for use           */
54   HAL_MDIOS_STATE_BUSY              = 0x02U,    /*!< an internal process is ongoing                     */
55   HAL_MDIOS_STATE_ERROR             = 0x04U     /*!< Reception process is ongoing                       */
56 }HAL_MDIOS_StateTypeDef;
57 
58 /**
59   * @}
60   */
61 
62 /** @defgroup MDIOS_Exported_Types_Group2 MDIOS Init Structure definition
63   * @{
64   */
65 
66 typedef struct
67 {
68   uint32_t PortAddress;           /*!< Specifies the MDIOS port address.
69                                        This parameter can be a value from 0 to 31 */
70   uint32_t PreambleCheck;         /*!< Specifies whether the preamble check is enabled or disabled.
71                                        This parameter can be a value of @ref MDIOS_Preamble_Check */
72 }MDIOS_InitTypeDef;
73 
74 /**
75   * @}
76   */
77 
78 /** @defgroup MDIOS_Exported_Types_Group4 MDIOS handle Structure definition
79   * @{
80   */
81 
82 #if (USE_HAL_MDIOS_REGISTER_CALLBACKS == 1)
83 typedef struct __MDIOS_HandleTypeDef
84 #else
85 typedef struct
86 #endif
87 {
88   MDIOS_TypeDef                *Instance;     /*!< Register base address       */
89 
90   MDIOS_InitTypeDef            Init;          /*!< MDIOS Init Structure        */
91 
92   __IO HAL_MDIOS_StateTypeDef  State;         /*!< MDIOS communication state
93                                                    This parameter can be a value of of @ref HAL_MDIOS_StateTypeDef */
94 
95   __IO uint32_t                ErrorCode;     /*!< Holds the global Error code of the MDIOS HAL status machine
96                                                    This parameter can be a value of of @ref MDIOS_Error_Code */
97 
98   HAL_LockTypeDef              Lock;          /*!< MDIOS Lock                  */
99 
100 #if (USE_HAL_MDIOS_REGISTER_CALLBACKS == 1)
101 
102   void    (* WriteCpltCallback)  ( struct __MDIOS_HandleTypeDef * hmdios);   /*!< MDIOS Write Complete Callback */
103   void    (* ReadCpltCallback)   ( struct __MDIOS_HandleTypeDef * hmdios);  /*!< MDIOS Read  Complete Callback     */
104   void    (* ErrorCallback)      ( struct __MDIOS_HandleTypeDef * hmdios);  /*!< MDIOS Error Callback   */
105   void    (* WakeUpCallback)     ( struct __MDIOS_HandleTypeDef * hmdios);  /*!< MDIOS Wake UP Callback   */
106 
107   void    (* MspInitCallback)    ( struct __MDIOS_HandleTypeDef * hmdios);    /*!< MDIOS Msp Init callback              */
108   void    (* MspDeInitCallback)  ( struct __MDIOS_HandleTypeDef * hmdios);    /*!< MDIOS Msp DeInit callback            */
109 
110 #endif  /* USE_HAL_MDIOS_REGISTER_CALLBACKS */
111 }MDIOS_HandleTypeDef;
112 
113 /**
114   * @}
115   */
116 
117 #if (USE_HAL_MDIOS_REGISTER_CALLBACKS == 1)
118 /**
119   * @brief  HAL MDIOS Callback ID enumeration definition
120   */
121 typedef enum
122 {
123   HAL_MDIOS_MSPINIT_CB_ID            = 0x00U,    /*!< MDIOS MspInit callback ID           */
124   HAL_MDIOS_MSPDEINIT_CB_ID          = 0x01U,    /*!< MDIOS MspDeInit callback ID         */
125 
126   HAL_MDIOS_WRITE_COMPLETE_CB_ID     = 0x02U,    /*!< MDIOS Write Complete Callback ID       */
127   HAL_MDIOS_READ_COMPLETE_CB_ID      = 0x03U,    /*!< MDIOS Read Complete Callback ID       */
128   HAL_MDIOS_ERROR_CB_ID              = 0x04U,    /*!< MDIOS Error Callback ID         */
129   HAL_MDIOS_WAKEUP_CB_ID             = 0x05U     /*!< MDIOS Wake UP Callback ID           */
130 }HAL_MDIOS_CallbackIDTypeDef;
131 
132 /**
133   * @brief  HAL MDIOS Callback pointer definition
134   */
135 typedef  void (*pMDIOS_CallbackTypeDef)(MDIOS_HandleTypeDef * hmdios); /*!< pointer to an MDIOS callback function */
136 
137 #endif /* USE_HAL_MDIOS_REGISTER_CALLBACKS */
138 
139 /**
140   * @}
141   */
142 
143 /* Exported constants --------------------------------------------------------*/
144 /** @defgroup MDIOS_Exported_Constants MDIOS Exported Constants
145   * @{
146   */
147 
148 /** @defgroup MDIOS_Preamble_Check  MDIOS Preamble Check
149   * @{
150   */
151 #define MDIOS_PREAMBLE_CHECK_ENABLE      ((uint32_t)0x00000000U)
152 #define MDIOS_PREAMBLE_CHECK_DISABLE     MDIOS_CR_DPC
153 /**
154   * @}
155   */
156 
157 /** @defgroup MDIOS_Input_Output_Registers_Definitions MDIOS Input Output Registers Definitions
158   * @{
159   */
160 #define MDIOS_REG0                      ((uint32_t)0x00000000U)
161 #define MDIOS_REG1                      ((uint32_t)0x00000001U)
162 #define MDIOS_REG2                      ((uint32_t)0x00000002U)
163 #define MDIOS_REG3                      ((uint32_t)0x00000003U)
164 #define MDIOS_REG4                      ((uint32_t)0x00000004U)
165 #define MDIOS_REG5                      ((uint32_t)0x00000005U)
166 #define MDIOS_REG6                      ((uint32_t)0x00000006U)
167 #define MDIOS_REG7                      ((uint32_t)0x00000007U)
168 #define MDIOS_REG8                      ((uint32_t)0x00000008U)
169 #define MDIOS_REG9                      ((uint32_t)0x00000009U)
170 #define MDIOS_REG10                     ((uint32_t)0x0000000AU)
171 #define MDIOS_REG11                     ((uint32_t)0x0000000BU)
172 #define MDIOS_REG12                     ((uint32_t)0x0000000CU)
173 #define MDIOS_REG13                     ((uint32_t)0x0000000DU)
174 #define MDIOS_REG14                     ((uint32_t)0x0000000EU)
175 #define MDIOS_REG15                     ((uint32_t)0x0000000FU)
176 #define MDIOS_REG16                     ((uint32_t)0x00000010U)
177 #define MDIOS_REG17                     ((uint32_t)0x00000011U)
178 #define MDIOS_REG18                     ((uint32_t)0x00000012U)
179 #define MDIOS_REG19                     ((uint32_t)0x00000013U)
180 #define MDIOS_REG20                     ((uint32_t)0x00000014U)
181 #define MDIOS_REG21                     ((uint32_t)0x00000015U)
182 #define MDIOS_REG22                     ((uint32_t)0x00000016U)
183 #define MDIOS_REG23                     ((uint32_t)0x00000017U)
184 #define MDIOS_REG24                     ((uint32_t)0x00000018U)
185 #define MDIOS_REG25                     ((uint32_t)0x00000019U)
186 #define MDIOS_REG26                     ((uint32_t)0x0000001AU)
187 #define MDIOS_REG27                     ((uint32_t)0x0000001BU)
188 #define MDIOS_REG28                     ((uint32_t)0x0000001CU)
189 #define MDIOS_REG29                     ((uint32_t)0x0000001DU)
190 #define MDIOS_REG30                     ((uint32_t)0x0000001EU)
191 #define MDIOS_REG31                     ((uint32_t)0x0000001FU)
192 /**
193   * @}
194   */
195 
196 /** @defgroup MDIOS_Registers_Flags  MDIOS Registers Flags
197   * @{
198   */
199 #define MDIOS_REG0_FLAG			((uint32_t)0x00000001U)
200 #define	MDIOS_REG1_FLAG			((uint32_t)0x00000002U)
201 #define	MDIOS_REG2_FLAG			((uint32_t)0x00000004U)
202 #define	MDIOS_REG3_FLAG			((uint32_t)0x00000008U)
203 #define	MDIOS_REG4_FLAG			((uint32_t)0x00000010U)
204 #define	MDIOS_REG5_FLAG			((uint32_t)0x00000020U)
205 #define	MDIOS_REG6_FLAG			((uint32_t)0x00000040U)
206 #define	MDIOS_REG7_FLAG			((uint32_t)0x00000080U)
207 #define	MDIOS_REG8_FLAG			((uint32_t)0x00000100U)
208 #define	MDIOS_REG9_FLAG			((uint32_t)0x00000200U)
209 #define	MDIOS_REG10_FLAG		((uint32_t)0x00000400U)
210 #define	MDIOS_REG11_FLAG		((uint32_t)0x00000800U)
211 #define	MDIOS_REG12_FLAG		((uint32_t)0x00001000U)
212 #define	MDIOS_REG13_FLAG		((uint32_t)0x00002000U)
213 #define	MDIOS_REG14_FLAG		((uint32_t)0x00004000U)
214 #define	MDIOS_REG15_FLAG		((uint32_t)0x00008000U)
215 #define	MDIOS_REG16_FLAG		((uint32_t)0x00010000U)
216 #define	MDIOS_REG17_FLAG		((uint32_t)0x00020000U)
217 #define	MDIOS_REG18_FLAG		((uint32_t)0x00040000U)
218 #define	MDIOS_REG19_FLAG		((uint32_t)0x00080000U)
219 #define	MDIOS_REG20_FLAG		((uint32_t)0x00100000U)
220 #define	MDIOS_REG21_FLAG		((uint32_t)0x00200000U)
221 #define	MDIOS_REG22_FLAG		((uint32_t)0x00400000U)
222 #define	MDIOS_REG23_FLAG		((uint32_t)0x00800000U)
223 #define	MDIOS_REG24_FLAG		((uint32_t)0x01000000U)
224 #define	MDIOS_REG25_FLAG		((uint32_t)0x02000000U)
225 #define	MDIOS_REG26_FLAG		((uint32_t)0x04000000U)
226 #define	MDIOS_REG27_FLAG		((uint32_t)0x08000000U)
227 #define	MDIOS_REG28_FLAG		((uint32_t)0x10000000U)
228 #define	MDIOS_REG29_FLAG		((uint32_t)0x20000000U)
229 #define	MDIOS_REG30_FLAG		((uint32_t)0x40000000U)
230 #define	MDIOS_REG31_FLAG		((uint32_t)0x80000000U)
231 #define	MDIOS_ALLREG_FLAG		((uint32_t)0xFFFFFFFFU)
232 /**
233   * @}
234   */
235 
236 /** @defgroup MDIOS_Interrupt_sources Interrupt Sources
237   * @{
238   */
239 #define MDIOS_IT_WRITE                   MDIOS_CR_WRIE
240 #define MDIOS_IT_READ                    MDIOS_CR_RDIE
241 #define MDIOS_IT_ERROR                   MDIOS_CR_EIE
242 /**
243   * @}
244   */
245 
246 /** @defgroup MDIOS_Interrupt_Flags  MDIOS Interrupt Flags
247   * @{
248   */
249 #define	MDIOS_TURNAROUND_ERROR_FLAG       MDIOS_SR_TERF
250 #define	MDIOS_START_ERROR_FLAG            MDIOS_SR_SERF
251 #define	MDIOS_PREAMBLE_ERROR_FLAG         MDIOS_SR_PERF
252 /**
253   * @}
254   */
255 
256 /** @defgroup MDIOS_Error_Code MDIOS Error Code
257   * @{
258   */
259 #define HAL_MDIOS_ERROR_NONE         ((uint32_t)0x00000000U)   /*!< No error            */
260 #define HAL_MDIOS_ERROR_PARAM        ((uint32_t)0x00000001U)   /*!< Busy error          */
261 #define HAL_MDIOS_ERROR_BUSY         ((uint32_t)0x00000002U)   /*!< Parameter error     */
262 #define HAL_MDIOS_ERROR_TIMEOUT      ((uint32_t)0x00000004U)   /*!< Timeout error       */
263 #define HAL_MDIOS_ERROR_DATA         ((uint32_t)0x00000010U)   /*!< Data transfer error       */
264 #if (USE_HAL_MDIOS_REGISTER_CALLBACKS == 1)
265 #define HAL_MDIOS_ERROR_INVALID_CALLBACK ((uint32_t)0x00000020U)    /*!< Invalid Callback error  */
266 #endif /* USE_HAL_MDIOS_REGISTER_CALLBACKS */
267 /**
268   * @}
269   */
270 
271  /** @defgroup MDIOS_Wakeup_Line  MDIOS Wakeup Line
272   * @{
273   */
274 #define MDIOS_WAKEUP_EXTI_LINE  ((uint32_t)0x00000400)  /* !<  42 - 32 = 10 */
275 /**
276   * @}
277   */
278 
279 /**
280   * @}
281   */
282 /* Exported macros -----------------------------------------------------------*/
283 /** @defgroup MDIOS_Exported_Macros MDIOS Exported Macros
284   * @{
285   */
286 
287 /** @brief Reset MDIOS handle state
288   * @param  __HANDLE__: MDIOS handle.
289   * @retval None
290   */
291 #if (USE_HAL_MDIOS_REGISTER_CALLBACKS == 1)
292 #define __HAL_MDIOS_RESET_HANDLE_STATE(__HANDLE__)  do{                                                   \
293                                                        (__HANDLE__)->State = HAL_MDIOS_STATE_RESET;      \
294                                                        (__HANDLE__)->MspInitCallback = NULL;             \
295                                                        (__HANDLE__)->MspDeInitCallback = NULL;           \
296                                                      } while(0)
297 #else
298 #define __HAL_MDIOS_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_MDIOS_STATE_RESET)
299 #endif /*USE_HAL_MDIOS_REGISTER_CALLBACKS */
300 
301 /**
302   * @brief  Enable/Disable the MDIOS peripheral.
303   * @param  __HANDLE__: specifies the MDIOS handle.
304   * @retval None
305   */
306 #define __HAL_MDIOS_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= MDIOS_CR_EN)
307 #define __HAL_MDIOS_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~MDIOS_CR_EN)
308 
309 
310 /**
311   * @brief  Enable the MDIOS device interrupt.
312   * @param  __HANDLE__: specifies the MDIOS handle.
313   * @param  __INTERRUPT__ : specifies the MDIOS interrupt sources to be enabled.
314   *         This parameter can be one or a combination of the following values:
315   *            @arg MDIOS_IT_WRITE: Register write interrupt
316   *            @arg MDIOS_IT_READ: Register read interrupt
317   *            @arg MDIOS_IT_ERROR: Error interrupt
318   * @retval None
319   */
320 #define __HAL_MDIOS_ENABLE_IT(__HANDLE__, __INTERRUPT__)  ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
321 
322 /**
323   * @brief  Disable the MDIOS device interrupt.
324   * @param  __HANDLE__: specifies the MDIOS handle.
325   * @param  __INTERRUPT__ : specifies the MDIOS interrupt sources to be disabled.
326   *         This parameter can be one or a combination of the following values:
327   *            @arg MDIOS_IT_WRITE: Register write interrupt
328   *            @arg MDIOS_IT_READ: Register read interrupt
329   *            @arg MDIOS_IT_ERROR: Error interrupt
330   * @retval None
331   */
332 #define __HAL_MDIOS_DISABLE_IT(__HANDLE__, __INTERRUPT__)  ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
333 
334 /** @brief Set MDIOS slave get write register flag
335   * @param  __HANDLE__: specifies the MDIOS handle.
336   * @param  __FLAG__: specifies the write register flag
337   * @retval The state of write flag
338   */
339 #define __HAL_MDIOS_GET_WRITE_FLAG(__HANDLE__, __FLAG__)      ((__HANDLE__)->Instance->WRFR &  (__FLAG__))
340 
341 /** @brief MDIOS slave get read register flag
342   * @param  __HANDLE__: specifies the MDIOS handle.
343   * @param  __FLAG__: specifies the read register flag
344   * @retval The state of read flag
345   */
346 #define __HAL_MDIOS_GET_READ_FLAG(__HANDLE__, __FLAG__)        ((__HANDLE__)->Instance->RDFR &  (__FLAG__))
347 
348 /** @brief MDIOS slave get interrupt
349   * @param  __HANDLE__: specifies the MDIOS handle.
350   * @param  __FLAG__ : specifies the Error flag.
351   *         This parameter can be one or a combination of the following values:
352   *            @arg MDIOS_TURNARROUND_ERROR_FLAG: Register write interrupt
353   *            @arg MDIOS_START_ERROR_FLAG: Register read interrupt
354   *            @arg MDIOS_PREAMBLE_ERROR_FLAG: Error interrupt
355   * @retval The state of the error flag
356   */
357 #define __HAL_MDIOS_GET_ERROR_FLAG(__HANDLE__, __FLAG__)       ((__HANDLE__)->Instance->SR &  (__FLAG__))
358 
359 /** @brief  MDIOS slave clear interrupt
360   * @param  __HANDLE__: specifies the MDIOS handle.
361   * @param  __FLAG__ : specifies the Error flag.
362   *         This parameter can be one or a combination of the following values:
363   *            @arg MDIOS_TURNARROUND_ERROR_FLAG: Register write interrupt
364   *            @arg MDIOS_START_ERROR_FLAG: Register read interrupt
365   *            @arg MDIOS_PREAMBLE_ERROR_FLAG: Error interrupt
366   * @retval none
367   */
368 #define __HAL_MDIOS_CLEAR_ERROR_FLAG(__HANDLE__, __FLAG__)       ((__HANDLE__)->Instance->CLRFR) |= (__FLAG__)
369 
370 /**
371   * @brief  Checks whether the specified MDIOS interrupt is set or not.
372   * @param  __HANDLE__: specifies the MDIOS handle.
373   * @param  __INTERRUPT__ : specifies the MDIOS interrupt sources
374   *            This parameter can be one or a combination of the following values:
375   *            @arg MDIOS_IT_WRITE: Register write interrupt
376   *            @arg MDIOS_IT_READ: Register read interrupt
377   *            @arg MDIOS_IT_ERROR: Error interrupt
378   * @retval The state of the interrupt source
379   */
380 #define __HAL_MDIOS_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR & (__INTERRUPT__))
381 
382 /**
383   * @brief Enable the MDIOS WAKEUP Exti Line.
384   * @param  __EXTI_LINE__: specifies the MDIOS WAKEUP Exti sources to be enabled.
385   * This parameter can be:
386   *   @arg MDIOS_WAKEUP_EXTI_LINE
387   * @retval None.
388   */
389 #define __HAL_MDIOS_WAKEUP_EXTI_ENABLE_IT(__EXTI_LINE__)   (EXTI->IMR2 |= (__EXTI_LINE__))
390 
391 #if defined(DUAL_CORE)
392 /**
393   * @brief Enable the MDIOS WAKEUP Exti Line by Domain2.
394   * @param  __EXTI_LINE__: specifies the MDIOS WAKEUP Exti sources to be enabled.
395   * This parameter can be:
396   *   @arg MDIOS_WAKEUP_EXTI_LINE
397   * @retval None.
398   */
399 #define __HAL_MDIOS_WAKEUP_EXTID2_ENABLE_IT(__EXTI_LINE__)   (EXTI->C2IMR2 |= (__EXTI_LINE__))
400 
401 #endif
402 /**
403   * @brief checks whether the specified MDIOS WAKEUP Exti interrupt flag is set or not.
404   * @param  __EXTI_LINE__: specifies the MDIOS WAKEUP Exti sources to be cleared.
405   * This parameter can be:
406   *   @arg MDIOS_WAKEUP_EXTI_LINE
407   * @retval EXTI MDIOS WAKEUP Line Status.
408   */
409 #define __HAL_MDIOS_WAKEUP_EXTI_GET_FLAG(__EXTI_LINE__)  (EXTI->PR2 & (__EXTI_LINE__))
410 
411 #if defined(DUAL_CORE)
412 /**
413   * @brief checks whether the specified MDIOS WAKEUP Exti interrupt flag is set or not.
414   * @param  __EXTI_LINE__: specifies the MDIOS WAKEUP Exti sources to be cleared.
415   * This parameter can be:
416   *   @arg MDIOS_WAKEUP_EXTI_LINE
417   * @retval EXTI MDIOS WAKEUP Line Status.
418   */
419 #define __HAL_MDIOS_WAKEUP_EXTID2_GET_FLAG(__EXTI_LINE__)  (EXTI->C2PR2 & (__EXTI_LINE__))
420 #endif
421 /**
422   * @brief Clear the MDIOS WAKEUP Exti flag.
423   * @param  __EXTI_LINE__: specifies the MDIOS WAKEUP Exti sources to be cleared.
424   * This parameter can be:
425   *   @arg MDIOS_WAKEUP_EXTI_LINE
426   * @retval None.
427   */
428 #define __HAL_MDIOS_WAKEUP_EXTI_CLEAR_FLAG(__EXTI_LINE__) (EXTI->PR2 = (__EXTI_LINE__))
429 
430 #if defined(DUAL_CORE)
431 /**
432   * @brief Clear the MDIOS WAKEUP Exti flag.
433   * @param  __EXTI_LINE__: specifies the MDIOS WAKEUP Exti sources to be cleared.
434   * This parameter can be:
435   *   @arg MDIOS_WAKEUP_EXTI_LINE
436   * @retval None.
437   */
438 #define __HAL_MDIOS_WAKEUP_EXTID2_CLEAR_FLAG(__EXTI_LINE__) (EXTI->C2PR2 = (__EXTI_LINE__))
439 
440 #endif
441 /**
442   * @brief  enable rising edge interrupt on selected EXTI line.
443   * @param  __EXTI_LINE__: specifies the MDIOS WAKEUP EXTI sources to be disabled.
444   * This parameter can be:
445   *  @arg MDIOS_WAKEUP_EXTI_LINE
446   * @retval None
447   */
448 #define __HAL_MDIOS_WAKEUP_EXTI_ENABLE_RISING_EDGE(__EXTI_LINE__) (EXTI->FTSR2 &= ~(__EXTI_LINE__)); \
449                                                                    (EXTI->RTSR2 |= (__EXTI_LINE__))
450 
451 /**
452   * @brief  enable falling edge interrupt on selected EXTI line.
453   * @param  __EXTI_LINE__: specifies the MDIOS WAKEUP EXTI sources to be disabled.
454   * This parameter can be:
455   *  @arg MDIOS_WAKEUP_EXTI_LINE
456   * @retval None
457   */
458 #define __HAL_MDIOS_WAKEUP_EXTI_ENABLE_FALLING_EDGE(__EXTI_LINE__) (EXTI->RTSR2 &= ~(__EXTI_LINE__));\
459                                                                  (EXTI->FTSR2 |= (__EXTI_LINE__))
460 
461 /**
462   * @brief  enable falling edge interrupt on selected EXTI line.
463   * @param  __EXTI_LINE__: specifies the MDIOS WAKEUP EXTI sources to be disabled.
464   * This parameter can be:
465   *  @arg MDIOS_WAKEUP_EXTI_LINE
466   * @retval None
467   */
468 #define __HAL_MDIOS_WAKEUP_EXTI_ENABLE_RISING_FALLING_EDGE(__EXTI_LINE__) (EXTI->RTSR2 |= (__EXTI_LINE__));\
469                                                                           (EXTI->FTSR2 |= (__EXTI_LINE__))
470 
471 /**
472   * @brief  Generates a Software interrupt on selected EXTI line.
473   * @param  __EXTI_LINE__: specifies the MDIOS WAKEUP EXTI sources to be disabled.
474   * This parameter can be:
475   *  @arg MDIOS_WAKEUP_EXTI_LINE
476   * @retval None
477   */
478 #define __HAL_MDIOS_WAKEUP_EXTI_GENERATE_SWIT(__EXTI_LINE__) (EXTI->SWIER2 |= (__EXTI_LINE__))
479 
480 /**
481   * @}
482   */
483 
484 /* Exported functions --------------------------------------------------------*/
485 /** @defgroup MDIOS_Exported_Functions MDIOS Exported Functions
486   * @{
487   */
488 
489 /** @addtogroup MDIOS_Exported_Functions_Group1
490   * @{
491   */
492 HAL_StatusTypeDef HAL_MDIOS_Init(MDIOS_HandleTypeDef *hmdios);
493 HAL_StatusTypeDef HAL_MDIOS_DeInit(MDIOS_HandleTypeDef *hmdios);
494 void HAL_MDIOS_MspInit(MDIOS_HandleTypeDef *hmdios);
495 void  HAL_MDIOS_MspDeInit(MDIOS_HandleTypeDef *hmdios);
496 
497 /* Callbacks Register/UnRegister functions  ***********************************/
498 #if (USE_HAL_MDIOS_REGISTER_CALLBACKS == 1)
499 HAL_StatusTypeDef HAL_MDIOS_RegisterCallback(MDIOS_HandleTypeDef *hmdios, HAL_MDIOS_CallbackIDTypeDef CallbackID, pMDIOS_CallbackTypeDef pCallback);
500 HAL_StatusTypeDef HAL_MDIOS_UnRegisterCallback(MDIOS_HandleTypeDef *hmdios, HAL_MDIOS_CallbackIDTypeDef CallbackID);
501 #endif /* USE_HAL_MDIOS_REGISTER_CALLBACKS */
502 /**
503   * @}
504   */
505 
506 /** @addtogroup MDIOS_Exported_Functions_Group2
507   * @{
508   */
509 HAL_StatusTypeDef HAL_MDIOS_WriteReg(MDIOS_HandleTypeDef *hmdios,  uint32_t RegNum, uint16_t Data);
510 HAL_StatusTypeDef HAL_MDIOS_ReadReg(MDIOS_HandleTypeDef *hmdios,  uint32_t RegNum, uint16_t *pData);
511 
512 uint32_t HAL_MDIOS_GetWrittenRegAddress(MDIOS_HandleTypeDef *hmdios);
513 uint32_t HAL_MDIOS_GetReadRegAddress(MDIOS_HandleTypeDef *hmdios);
514 HAL_StatusTypeDef HAL_MDIOS_ClearWriteRegAddress(MDIOS_HandleTypeDef *hmdios, uint32_t RegNum);
515 HAL_StatusTypeDef HAL_MDIOS_ClearReadRegAddress(MDIOS_HandleTypeDef *hmdios, uint32_t RegNum);
516 
517 HAL_StatusTypeDef HAL_MDIOS_EnableEvents(MDIOS_HandleTypeDef *hmdios);
518 void HAL_MDIOS_IRQHandler(MDIOS_HandleTypeDef *hmdios);
519 void HAL_MDIOS_WriteCpltCallback(MDIOS_HandleTypeDef *hmdios);
520 void HAL_MDIOS_ReadCpltCallback(MDIOS_HandleTypeDef *hmdios);
521 void HAL_MDIOS_ErrorCallback(MDIOS_HandleTypeDef *hmdios);
522 void HAL_MDIOS_WakeUpCallback(MDIOS_HandleTypeDef *hmdios);
523 /**
524   * @}
525   */
526 
527 /** @addtogroup MDIOS_Exported_Functions_Group3
528   * @{
529   */
530 uint32_t HAL_MDIOS_GetError(MDIOS_HandleTypeDef *hmdios);
531 HAL_MDIOS_StateTypeDef HAL_MDIOS_GetState(MDIOS_HandleTypeDef *hmdios);
532 /**
533   * @}
534   */
535 
536 /**
537   * @}
538   */
539 
540 /* Private types -------------------------------------------------------------*/
541 /** @defgroup MDIOS_Private_Types MDIOS Private Types
542   * @{
543   */
544 
545 /**
546   * @}
547   */
548 
549 /* Private variables ---------------------------------------------------------*/
550 /** @defgroup MDIOS_Private_Variables MDIOS Private Variables
551   * @{
552   */
553 
554 /**
555   * @}
556   */
557 
558 /* Private constants ---------------------------------------------------------*/
559 /** @defgroup MDIOS_Private_Constants MDIOS Private Constants
560   * @{
561   */
562 
563 /**
564   * @}
565   */
566 
567 /* Private macros ------------------------------------------------------------*/
568 /** @defgroup MDIOS_Private_Macros MDIOS Private Macros
569   * @{
570   */
571 
572 #define IS_MDIOS_PORTADDRESS(__ADDR__) ((__ADDR__) < 32U)
573 
574 #define IS_MDIOS_REGISTER(__REGISTER__) ((__REGISTER__) < 32U)
575 
576 #define IS_MDIOS_PREAMBLECHECK(__PREAMBLECHECK__) (((__PREAMBLECHECK__) == MDIOS_PREAMBLE_CHECK_ENABLE) || \
577                                                    ((__PREAMBLECHECK__) == MDIOS_PREAMBLE_CHECK_DISABLE))
578 
579  /**
580   * @}
581   */
582 
583 /* Private functions ---------------------------------------------------------*/
584 /** @defgroup MDIOS_Private_Functions MDIOS Private Functions
585   * @{
586   */
587 
588 /**
589   * @}
590   */
591 
592 
593 /**
594   * @}
595   */
596 
597 /**
598   * @}
599   */
600 
601 #endif /* MDIOS */
602 
603 #ifdef __cplusplus
604 }
605 #endif
606 
607 #endif /* STM32H7xx_HAL_MDIOS_H */
608 
609