1 /**
2   ******************************************************************************
3   * @file    stm32mp1xx_hal_mdios.c
4   * @author  MCD Application Team
5   * @version V0.0.1
6   * @date    01-July-2016
7   * @brief   MDIOS HAL module driver.
8   *
9   *          This file provides firmware functions to manage the following
10   *          functionalities of the MDIOS Peripheral.
11   *           + Initialization and de-initialization functions
12   *           + IO operation functions
13   *           + Peripheral Control functions
14   *
15   *
16   ******************************************************************************
17   * @attention
18   *
19   * Copyright (c) 2019 STMicroelectronics.
20   * All rights reserved.
21   *
22   * This software is licensed under terms that can be found in the LICENSE file
23   * in the root directory of this software component.
24   * If no LICENSE file comes with this software, it is provided AS-IS.
25   *
26   ******************************************************************************
27   @verbatim
28  ===============================================================================
29                         ##### How to use this driver #####
30  ===============================================================================
31     [..]
32     The MDIOS HAL driver can be used as follow:
33 
34     (#) Declare a MDIOS_HandleTypeDef handle structure.
35 
36     (#) Initialize the MDIOS low level resources by implementing the HAL_MDIOS_MspInit() API:
37         (##) Enable the MDIOS interface clock.
38         (##) MDIOS pins configuration:
39             (+++) Enable clocks for the MDIOS GPIOs.
40             (+++) Configure the MDIOS pins as alternate function.
41         (##) NVIC configuration if you need to use interrupt process:
42             (+++) Configure the MDIOS interrupt priority.
43             (+++) Enable the NVIC MDIOS IRQ handle.
44 
45     (#) Program the Port Address and the Preamble Check in the Init structure.
46 
47     (#) Initialize the MDIOS registers by calling the HAL_MDIOS_Init() API.
48 
49     (#) Perform direct slave read/write operations using the following APIs:
50         (##) Read the value of a DINn register: HAL_MDIOS_ReadReg()
51         (##) Write a value to a DOUTn register: HAL_MDIOS_WriteReg()
52 
53     (#) Get the Master read/write operations flags using the following APIs:
54         (##) Bit map of DOUTn registers read by Master: HAL_MDIOS_GetReadRegAddress()
55         (##) Bit map of DINn registers written by Master : HAL_MDIOS_GetWrittenRegAddress()
56 
57     (#) Clear the read/write flags using the following APIs:
58         (##) Clear read flags of a set of registers: HAL_MDIOS_ClearReadRegAddress()
59         (##) Clear write flags of a set of registers: HAL_MDIOS_ClearWriteRegAddress()
60 
61     (#) Enable interrupts on events using HAL_MDIOS_EnableEvents(), when called
62         the MDIOS will generate an interrupt in the following cases:
63         (##) a DINn register written by the Master
64         (##) a DOUTn register read by the Master
65         (##) an error occur
66 
67         (@) A callback is executed for each genereted interrupt, so the driver provide the following
68             HAL_MDIOS_WriteCpltCallback(), HAL_MDIOS_ReadCpltCallback() and HAL_MDIOS_ErrorCallback()
69         (@) HAL_MDIOS_IRQHandler() must be called from the MDIOS IRQ Handler, to handle the interrupt
70             and execute the previous callbacks
71 
72     (#) Reset the MDIOS peripheral and all related ressources by calling the HAL_MDIOS_DeInit() API.
73         (##) HAL_MDIOS_MspDeInit() must be implemented to reset low level ressources
74             (GPIO, Clocks, NVIC configuration ...)
75 
76 
77   @endverbatim
78   ******************************************************************************
79   */
80 
81 /* Includes ------------------------------------------------------------------*/
82 #include "stm32mp1xx_hal.h"
83 
84 /** @addtogroup STM32MP1xx_HAL_Driver
85   * @{
86   */
87 
88 /** @defgroup MDIOS  MDIOS
89   * @brief HAL MDIOS module driver
90   * @{
91   */
92 #ifdef HAL_MDIOS_MODULE_ENABLED
93 
94 #if defined (MDIOS)
95 
96 /* Private typedef -----------------------------------------------------------*/
97 /* Private define ------------------------------------------------------------*/
98 #define MDIOS_PORT_ADDRESS_SHIFT        ((uint32_t)8)
99 #define	MDIOS_ALL_REG_FLAG	        ((uint32_t)0xFFFFFFFFU)
100 #define	MDIOS_ALL_ERRORS_FLAG           ((uint32_t)(MDIOS_SR_PERF | MDIOS_SR_SERF | MDIOS_SR_TERF))
101 
102 #define MDIOS_DIN_BASE_ADDR             (MDIOS_BASE + 0x100)
103 #define MDIOS_DOUT_BASE_ADDR            (MDIOS_BASE + 0x180)
104 
105 /* Private macro -------------------------------------------------------------*/
106 /* Private variables ---------------------------------------------------------*/
107 /* Private function prototypes -----------------------------------------------*/
108 /* Private functions ---------------------------------------------------------*/
109 /* Exported functions --------------------------------------------------------*/
110 /** @defgroup MDIOS_Exported_Functions
111   * @{
112   */
113 
114 /** @defgroup MDIOS_Exported_Functions_Group1 Initialization/de-initialization functions
115   *  @brief    Initialization and Configuration functions
116   *
117 @verbatim
118 ===============================================================================
119             ##### Initialization and Configuration functions #####
120  ===============================================================================
121     [..]
122     This subsection provides a set of functions allowing to initialize the MDIOS
123       (+) The following parameters can be configured:
124         (++) Port Address
125         (++) Preamble Check
126 
127 @endverbatim
128   * @{
129   */
130 
131 /**
132   * @brief  Initializes the MDIOS according to the specified parameters in
133   *         the MDIOS_InitTypeDef and creates the associated handle .
134   * @param  hmdios: pointer to a MDIOS_HandleTypeDef structure that contains
135   *         the configuration information for MDIOS module
136   * @retval HAL status
137   */
HAL_MDIOS_Init(MDIOS_HandleTypeDef * hmdios)138 HAL_StatusTypeDef HAL_MDIOS_Init(MDIOS_HandleTypeDef *hmdios)
139 {
140   uint32_t tmpcr = 0;
141 
142   /* Check the MDIOS handle allocation */
143   if(hmdios == NULL)
144   {
145     return HAL_ERROR;
146   }
147 
148   /* Check the parameters */
149   assert_param(IS_MDIOS_ALL_INSTANCE(hmdios->Instance));
150   assert_param(IS_MDIOS_PORTADDRESS(hmdios->Init.PortAddress));
151   assert_param(IS_MDIOS_PREAMBLECHECK(hmdios->Init.PreambleCheck));
152 
153   /* Process Locked */
154   __HAL_LOCK(hmdios);
155 
156   if(hmdios->State == HAL_MDIOS_STATE_RESET)
157   {
158     /* Init the low level hardware */
159     HAL_MDIOS_MspInit(hmdios);
160   }
161 
162   /* Change the MDIOS state */
163   hmdios->State = HAL_MDIOS_STATE_BUSY;
164 
165   /* Get the MDIOS CR value */
166   tmpcr = hmdios->Instance->CR;
167 
168   /* Clear PORT_ADDRESS, DPC and EN bits */
169   tmpcr &= ((uint32_t)~(MDIOS_CR_EN | MDIOS_CR_DPC | MDIOS_CR_PORT_ADDRESS));
170 
171   /* Set MDIOS control parametrs and enable the peripheral */
172   tmpcr |=  (uint32_t)(((hmdios->Init.PortAddress) << MDIOS_PORT_ADDRESS_SHIFT)    |\
173                         (hmdios->Init.PreambleCheck) | \
174                         (MDIOS_CR_EN));
175 
176   /* Write the MDIOS CR */
177   hmdios->Instance->CR = tmpcr;
178 
179   /* Change the MDIOS state */
180   hmdios->State = HAL_MDIOS_STATE_READY;
181 
182   /* Release Lock */
183   __HAL_UNLOCK(hmdios);
184 
185   /* Return function status */
186   return HAL_OK;
187 
188 }
189 
190 /**
191   * @brief  DeInitializes the MDIOS peripheral.
192   * @param  hmdios: MDIOS handle
193   * @retval HAL status
194   */
HAL_MDIOS_DeInit(MDIOS_HandleTypeDef * hmdios)195 HAL_StatusTypeDef HAL_MDIOS_DeInit(MDIOS_HandleTypeDef *hmdios)
196 {
197   /* Check the MDIOS handle allocation */
198   if(hmdios == NULL)
199   {
200     return HAL_ERROR;
201   }
202 
203   /* Check the parameters */
204   assert_param(IS_MDIOS_ALL_INSTANCE(hmdios->Instance));
205 
206   /* Change the MDIOS state */
207   hmdios->State = HAL_MDIOS_STATE_BUSY;
208 
209   /* Disable the Peripheral */
210   __HAL_MDIOS_DISABLE(hmdios);
211 
212   /* DeInit the low level hardware */
213   HAL_MDIOS_MspDeInit(hmdios);
214 
215   /* Change the MDIOS state */
216   hmdios->State = HAL_MDIOS_STATE_RESET;
217 
218   /* Release Lock */
219   __HAL_UNLOCK(hmdios);
220 
221   /* Return function status */
222   return HAL_OK;
223 }
224 
225 /**
226   * @brief  MDIOS MSP Init
227   * @param  hmdios: mdios handle
228   * @retval None
229   */
HAL_MDIOS_MspInit(MDIOS_HandleTypeDef * hmdios)230  __weak void HAL_MDIOS_MspInit(MDIOS_HandleTypeDef *hmdios)
231 {
232   /* Prevent unused argument(s) compilation warning */
233   UNUSED(hmdios);
234 
235   /* NOTE : This function should not be modified, when the callback is needed,
236             the HAL_MDIOS_MspInit can be implemented in the user file
237    */
238 }
239 
240 /**
241   * @brief  MDIOS MSP DeInit
242   * @param  hmdios: mdios handle
243   * @retval None
244   */
HAL_MDIOS_MspDeInit(MDIOS_HandleTypeDef * hmdios)245  __weak void HAL_MDIOS_MspDeInit(MDIOS_HandleTypeDef *hmdios)
246 {
247   /* Prevent unused argument(s) compilation warning */
248   UNUSED(hmdios);
249 
250   /* NOTE : This function should not be modified, when the callback is needed,
251             the HAL_MDIOS_MspDeInit can be implemented in the user file
252    */
253 }
254 
255 /** @defgroup MDIOS_Exported_Functions_Group2 IO operation functions
256   *  @brief MDIOS Read/Write functions
257   *
258 @verbatim
259  ===============================================================================
260                       ##### IO operation functions #####
261  ===============================================================================
262     This subsection provides a set of functions allowing to manage the MDIOS
263     read and write operations.
264 
265     (#) APIs that allow to the MDIOS to read/write from/to the
266         values of one of the DINn/DOUTn registers:
267         (+) Read the value of a DINn register: HAL_MDIOS_ReadReg()
268         (+) Write a value to a DOUTn register: HAL_MDIOS_WriteReg()
269 
270     (#) APIs that provide if there are some Slave registres have been
271         read or written by the Master:
272         (+) DOUTn registers read by Master: HAL_MDIOS_GetReadRegAddress()
273         (+) DINn registers written by Master : HAL_MDIOS_GetWrittenRegAddress()
274 
275     (#) APIs that Clear the read/write flags:
276         (+) Clear read registers flags: HAL_MDIOS_ClearReadRegAddress()
277         (+) Clear write registers flags: HAL_MDIOS_ClearWriteRegAddress()
278 
279     (#) A set of Callbacks are provided:
280         (+) HAL_MDIOS_WriteCpltCallback()
281         (+) HAL_MDIOS_ReadCpltCallback()
282         (+) HAL_MDIOS_ErrorCallback()
283 
284 @endverbatim
285   * @{
286   */
287 
288 /**
289   * @brief  Writes to an MDIOS output register
290   * @param  hmdios: mdios handle
291   * @param  RegAddress: MDIOS output register address
292   * @param  Data: Data to write
293   * @retval HAL status
294   */
HAL_MDIOS_WriteReg(MDIOS_HandleTypeDef * hmdios,uint32_t RegNum,uint16_t Data)295 HAL_StatusTypeDef HAL_MDIOS_WriteReg(MDIOS_HandleTypeDef *hmdios, uint32_t RegNum, uint16_t Data)
296 {
297   uint32_t tmpreg;
298 
299   /* Check the parameters */
300   assert_param(IS_MDIOS_REGISTER(RegNum));
301 
302   /* Process Locked */
303   __HAL_LOCK(hmdios);
304 
305   /* Get the addr of output register to be written by the MDIOS */
306   tmpreg = MDIOS_DOUT_BASE_ADDR + (4 * RegNum);
307 
308   /* Write to DOUTn register */
309   *((uint32_t *)tmpreg) = Data;
310 
311     /* Process Unlocked */
312   __HAL_UNLOCK(hmdios);
313 
314   return HAL_OK;
315 }
316 
317 /**
318   * @brief  Reads an MDIOS input register
319   * @param  hmdios: mdios handle
320   * @param  RegAddress: MDIOS input register address
321   * @param  pData: pointer to Data
322   * @retval HAL status
323   */
HAL_MDIOS_ReadReg(MDIOS_HandleTypeDef * hmdios,uint32_t RegNum,uint16_t * pData)324 HAL_StatusTypeDef HAL_MDIOS_ReadReg(MDIOS_HandleTypeDef *hmdios, uint32_t RegNum, uint16_t *pData)
325 {
326   uint32_t tmpreg;
327 
328   /* Check the parameters */
329   assert_param(IS_MDIOS_REGISTER(RegNum));
330 
331   /* Process Locked */
332   __HAL_LOCK(hmdios);
333 
334   /* Get the addr of input register to be read by the MDIOS */
335   tmpreg = MDIOS_DIN_BASE_ADDR + (4 * RegNum);
336 
337   /* Read DINn register */
338   *pData = (uint16_t)(*((uint32_t *)tmpreg));
339 
340   /* Process Unlocked */
341   __HAL_UNLOCK(hmdios);
342 
343   return HAL_OK;
344 }
345 
346 /**
347   * @brief  Gets Written registers by MDIO master
348   * @param  hmdios: mdios handle
349   * @retval bit map of written registers addresses
350   */
HAL_MDIOS_GetWrittenRegAddress(MDIOS_HandleTypeDef * hmdios)351 uint32_t HAL_MDIOS_GetWrittenRegAddress(MDIOS_HandleTypeDef *hmdios)
352 {
353   return hmdios->Instance->WRFR;
354 }
355 
356 /**
357   * @brief  Gets Read registers by MDIO master
358   * @param  hmdios: mdios handle
359   * @retval bit map of read registers addresses
360   */
HAL_MDIOS_GetReadRegAddress(MDIOS_HandleTypeDef * hmdios)361 uint32_t HAL_MDIOS_GetReadRegAddress(MDIOS_HandleTypeDef *hmdios)
362 {
363   return hmdios->Instance->RDFR;
364 }
365 
366 /**
367   * @brief  Clears Write registers flag
368   * @param  hmdios: mdios handle
369   * @param  RegNum: registers addresses to be cleared
370   * @retval HAL status
371   */
HAL_MDIOS_ClearWriteRegAddress(MDIOS_HandleTypeDef * hmdios,uint32_t RegNum)372 HAL_StatusTypeDef HAL_MDIOS_ClearWriteRegAddress(MDIOS_HandleTypeDef *hmdios, uint32_t RegNum)
373 {
374   /* Check the parameters */
375   assert_param(IS_MDIOS_REGISTER(RegNum));
376 
377   /* Process Locked */
378   __HAL_LOCK(hmdios);
379 
380   /* Clear write registers flags */
381   hmdios->Instance->CWRFR |= (RegNum);
382 
383   /* Release Lock */
384   __HAL_UNLOCK(hmdios);
385 
386   return HAL_OK;
387 }
388 
389 /**
390   * @brief  Clears Read register flag
391   * @param  hmdios: mdios handle
392   * @param  RegNum: registers addresses to be cleared
393   * @retval HAL status
394   */
HAL_MDIOS_ClearReadRegAddress(MDIOS_HandleTypeDef * hmdios,uint32_t RegNum)395 HAL_StatusTypeDef HAL_MDIOS_ClearReadRegAddress(MDIOS_HandleTypeDef *hmdios, uint32_t RegNum)
396 {
397   /* Check the parameters */
398   assert_param(IS_MDIOS_REGISTER(RegNum));
399 
400   /* Process Locked */
401   __HAL_LOCK(hmdios);
402 
403   /* Clear read registers flags */
404   hmdios->Instance->CRDFR |= (RegNum);
405 
406   /* Release Lock */
407   __HAL_UNLOCK(hmdios);
408 
409   return HAL_OK;
410 }
411 
412 /**
413   * @brief  Enables Events for MDIOS peripheral
414   * @param  hmdios: mdios handle
415   * @retval HAL status
416   */
HAL_MDIOS_EnableEvents(MDIOS_HandleTypeDef * hmdios)417 HAL_StatusTypeDef HAL_MDIOS_EnableEvents(MDIOS_HandleTypeDef *hmdios)
418 {
419   /* Process Locked */
420   __HAL_LOCK(hmdios);
421 
422   /* Enable MDIOS interrupts: Register Write, Register Read and Error ITs */
423   __HAL_MDIOS_ENABLE_IT(hmdios, (MDIOS_IT_WRITE | MDIOS_IT_READ | MDIOS_IT_ERROR));
424 
425   /* Process Unlocked */
426   __HAL_UNLOCK(hmdios);
427 
428   return HAL_OK;
429 }
430 
431 /**
432   * @brief This function handles MDIOS interrupt request.
433   * @param hmdios: MDIOS handle
434   * @retval None
435   */
HAL_MDIOS_IRQHandler(MDIOS_HandleTypeDef * hmdios)436 void HAL_MDIOS_IRQHandler(MDIOS_HandleTypeDef *hmdios)
437 {
438   /* Write Register Interrupt enabled ? */
439   if(__HAL_MDIOS_GET_IT_SOURCE(hmdios, MDIOS_IT_WRITE) != RESET)
440   {
441     /* Write register flag */
442     if(HAL_MDIOS_GetWrittenRegAddress(hmdios) != RESET)
443     {
444       /* Write callback function */
445       HAL_MDIOS_WriteCpltCallback(hmdios);
446 
447       /* Clear write register flag */
448       HAL_MDIOS_ClearWriteRegAddress(hmdios, MDIOS_ALL_REG_FLAG);
449     }
450   }
451 
452   /* Read Register Interrupt enabled ? */
453   if(__HAL_MDIOS_GET_IT_SOURCE(hmdios, MDIOS_IT_READ) != RESET)
454   {
455     /* Read register flag */
456     if(HAL_MDIOS_GetReadRegAddress(hmdios) != RESET)
457     {
458       /* Read callback function  */
459       HAL_MDIOS_ReadCpltCallback(hmdios);
460 
461       /* Clear read register flag */
462       HAL_MDIOS_ClearReadRegAddress(hmdios, MDIOS_ALL_REG_FLAG);
463     }
464   }
465 
466   /* Error Interrupt enabled ? */
467   if(__HAL_MDIOS_GET_IT_SOURCE(hmdios, MDIOS_IT_ERROR) != RESET)
468   {
469     /* All Errors Flag */
470     if(__HAL_MDIOS_GET_ERROR_FLAG(hmdios, MDIOS_ALL_ERRORS_FLAG) !=RESET)
471     {
472       /* Error Callback */
473       HAL_MDIOS_ErrorCallback(hmdios);
474 
475       /* Clear errors flag */
476       __HAL_MDIOS_CLEAR_ERROR_FLAG(hmdios, MDIOS_ALL_ERRORS_FLAG);
477     }
478   }
479 #if defined(DUAL_CORE)
480 
481 	if (HAL_GetCurrentCPUID() == CM7_CPUID)
482 	{
483 		if(__HAL_MDIOS_WAKEUP_EXTI_GET_FLAG(MDIOS_WAKEUP_EXTI_LINE) != RESET)
484 		{
485       /* Clear MDIOS WAKEUP Exti pending bit */
486       __HAL_MDIOS_WAKEUP_EXTI_CLEAR_FLAG(MDIOS_WAKEUP_EXTI_LINE);
487 			/* MDIOS WAKEUP interrupt user callback */
488       HAL_MDIOS_WakeUpCallback(hmdios);
489 		}
490 	}
491 	else
492 	{
493 		if(__HAL_MDIOS_WAKEUP_EXTID2_GET_FLAG(MDIOS_WAKEUP_EXTI_LINE) != RESET)
494 	  {
495 			/* Clear MDIOS WAKEUP Exti D2 pending bit */
496       __HAL_MDIOS_WAKEUP_EXTID2_CLEAR_FLAG(MDIOS_WAKEUP_EXTI_LINE);
497 		  /* MDIOS WAKEUP interrupt user callback */
498       HAL_MDIOS_WakeUpCallback(hmdios);
499 		}
500 	}
501 #else
502   /* check MDIOS WAKEUP exti flag */
503   if(__HAL_MDIOS_WAKEUP_EXTI_GET_FLAG(MDIOS_WAKEUP_EXTI_LINE) != RESET)
504   {
505     /* Clear MDIOS WAKEUP Exti pending bit */
506     __HAL_MDIOS_WAKEUP_EXTI_CLEAR_FLAG(MDIOS_WAKEUP_EXTI_LINE);
507 		/* MDIOS WAKEUP interrupt user callback */
508     HAL_MDIOS_WakeUpCallback(hmdios);
509   }
510 #endif
511 }
512 
513 /**
514   * @brief  Write Complete Callback
515   * @param  hmdios: mdios handle
516   * @retval None
517   */
HAL_MDIOS_WriteCpltCallback(MDIOS_HandleTypeDef * hmdios)518  __weak void HAL_MDIOS_WriteCpltCallback(MDIOS_HandleTypeDef *hmdios)
519 {
520   /* Prevent unused argument(s) compilation warning */
521   UNUSED(hmdios);
522 
523   /* NOTE : This function should not be modified, when the callback is needed,
524             the HAL_MDIOS_WriteCpltCallback can be implemented in the user file
525    */
526 }
527 
528 /**
529   * @brief  Read Complete Callback
530   * @param  hmdios: mdios handle
531   * @retval None
532   */
HAL_MDIOS_ReadCpltCallback(MDIOS_HandleTypeDef * hmdios)533  __weak void HAL_MDIOS_ReadCpltCallback(MDIOS_HandleTypeDef *hmdios)
534 {
535   /* Prevent unused argument(s) compilation warning */
536   UNUSED(hmdios);
537 
538   /* NOTE : This function should not be modified, when the callback is needed,
539             the HAL_MDIOS_ReadCpltCallback can be implemented in the user file
540    */
541 }
542 
543 /**
544   * @brief Error Callback
545   * @param hmdios: mdios handle
546   * @retval None
547   */
HAL_MDIOS_ErrorCallback(MDIOS_HandleTypeDef * hmdios)548  __weak void HAL_MDIOS_ErrorCallback(MDIOS_HandleTypeDef *hmdios)
549 {
550   /* Prevent unused argument(s) compilation warning */
551   UNUSED(hmdios);
552 
553   /* NOTE : This function should not be modified, when the callback is needed,
554             the HAL_MDIOS_ErrorCallback can be implemented in the user file
555    */
556 }
557 
558 /**
559   * @brief  MDIOS WAKEUP interrupt callback
560   * @param hmdios: mdios handle
561   * @retval None
562   */
HAL_MDIOS_WakeUpCallback(MDIOS_HandleTypeDef * hmdios)563 __weak void HAL_MDIOS_WakeUpCallback(MDIOS_HandleTypeDef *hmdios)
564 {
565   /* Prevent unused argument(s) compilation warning */
566   UNUSED(hmdios);
567 
568   /* NOTE : This function Should not be modified, when the callback is needed,
569             the HAL_MDIOS_WakeUpCallback could be implemented in the user file
570    */
571 }
572 
573 /**
574   * @}
575   */
576 
577 /** @defgroup MDIOS_Exported_Functions_Group3 Peripheral Control functions
578   *  @brief   MDIOS control functions
579   *
580 @verbatim
581  ===============================================================================
582                       ##### Peripheral Control functions #####
583  ===============================================================================
584     [..]
585     This subsection provides a set of functions allowing to control the MDIOS.
586      (+) HAL_MDIOS_GetState() API, helpful to check in run-time the state.
587      (+) HAL_MDIOS_GetError() API, returns the errors occured during data transfer.
588 
589 @endverbatim
590   * @{
591   */
592 
593 /**
594   * @brief  Gets MDIOS error flags
595   * @param  hmdios: mdios handle
596   * @retval bit map of occured errors
597   */
HAL_MDIOS_GetError(MDIOS_HandleTypeDef * hmdios)598 uint32_t HAL_MDIOS_GetError(MDIOS_HandleTypeDef *hmdios)
599 {
600   /* return errors flags on status register */
601   return hmdios->Instance->SR;
602 }
603 
604 /**
605   * @brief  Return the MDIOS HAL state
606   * @param  hmdios: mdios handle
607   * @param  RegAddress:
608   * @retval HAL state
609   */
HAL_MDIOS_GetState(MDIOS_HandleTypeDef * hmdios)610 HAL_MDIOS_StateTypeDef HAL_MDIOS_GetState(MDIOS_HandleTypeDef *hmdios)
611 {
612   /* Return MDIOS state */
613   return hmdios->State;
614 }
615 
616 /**
617   * @}
618   */
619 
620 /**
621   * @}
622   */
623 #endif /* MDIOS */
624 #endif /* HAL_MDIOS_MODULE_ENABLED */
625 /**
626   * @}
627   */
628 
629 /**
630   * @}
631   */
632