RTEMS 6.1-rc2
Loading...
Searching...
No Matches
stm32h7xx_hal_mdios.c File Reference

MDIOS HAL module driver. This file provides firmware functions to manage the following functionalities of the MDIOS Peripheral. More...

#include "stm32h7xx_hal.h"

Detailed Description

MDIOS HAL module driver. This file provides firmware functions to manage the following functionalities of the MDIOS Peripheral.

Author
MCD Application Team
  • Initialization and de-initialization functions
  • IO operation functions
  • Peripheral Control functions
Attention

Copyright (c) 2017 STMicroelectronics. All rights reserved.

This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is provided AS-IS.

===============================================================================
                       ##### How to use this driver #####
===============================================================================
   [..]
   The MDIOS HAL driver can be used as follow:

   (#) Declare a MDIOS_HandleTypeDef handle structure.

   (#) Initialize the MDIOS low level resources by implementing the HAL_MDIOS_MspInit() API:
       (##) Enable the MDIOS interface clock.
       (##) MDIOS pins configuration:
           (+++) Enable clocks for the MDIOS GPIOs.
           (+++) Configure the MDIOS pins as alternate function.
       (##) NVIC configuration if you need to use interrupt process:
           (+++) Configure the MDIOS interrupt priority.
           (+++) Enable the NVIC MDIOS IRQ handle.

   (#) Program the Port Address and the Preamble Check in the Init structure.

   (#) Initialize the MDIOS registers by calling the HAL_MDIOS_Init() API.

   (#) Perform direct slave read/write operations using the following APIs:
       (##) Read the value of a DINn register: HAL_MDIOS_ReadReg()
       (##) Write a value to a DOUTn register: HAL_MDIOS_WriteReg()

   (#) Get the Master read/write operations flags using the following APIs:
       (##) Bit map of DOUTn registers read by Master: HAL_MDIOS_GetReadRegAddress()
       (##) Bit map of DINn registers written by Master : HAL_MDIOS_GetWrittenRegAddress()

   (#) Clear the read/write flags using the following APIs:
       (##) Clear read flags of a set of registers: HAL_MDIOS_ClearReadRegAddress()
       (##) Clear write flags of a set of registers: HAL_MDIOS_ClearWriteRegAddress()

   (#) Enable interrupts on events using HAL_MDIOS_EnableEvents(), when called
       the MDIOS will generate an interrupt in the following cases:
       (##) a DINn register written by the Master
       (##) a DOUTn register read by the Master
       (##) an error occur

       (@) A callback is executed for each genereted interrupt, so the driver provide the following
           HAL_MDIOS_WriteCpltCallback(), HAL_MDIOS_ReadCpltCallback() and HAL_MDIOS_ErrorCallback()
       (@) HAL_MDIOS_IRQHandler() must be called from the MDIOS IRQ Handler, to handle the interrupt
           and execute the previous callbacks

   (#) Reset the MDIOS peripheral and all related resources by calling the HAL_MDIOS_DeInit() API.
       (##) HAL_MDIOS_MspDeInit() must be implemented to reset low level resources
           (GPIO, Clocks, NVIC configuration ...)

 *** Callback registration ***
 =============================================

 The compilation define  USE_HAL_MDIOS_REGISTER_CALLBACKS when set to 1
 allows the user to configure dynamically the driver callbacks.
 Use Function @ref HAL_MDIOS_RegisterCallback() to register an interrupt callback.

 Function @ref HAL_MDIOS_RegisterCallback() allows to register following callbacks:
   (+) WriteCpltCallback  : Write Complete Callback.
   (+) ReadCpltCallback   : Read Complete Callback.
   (+) ErrorCallback      : Error Callback.
   (+) WakeUpCallback     : Wake UP Callback
   (+) MspInitCallback    : MspInit Callback.
   (+) MspDeInitCallback  : MspDeInit Callback.

 This function takes as parameters the HAL peripheral handle, the Callback ID
 and a pointer to the user callback function.

 Use function @ref HAL_MDIOS_UnRegisterCallback() to reset a callback to the default
 weak function.
 @ref HAL_MDIOS_UnRegisterCallback takes as parameters the HAL peripheral handle,
 and the Callback ID.
 This function allows to reset following callbacks:
   (+) WriteCpltCallback  : Write Complete Callback.
   (+) ReadCpltCallback   : Read Complete Callback.
   (+) ErrorCallback      : Error Callback.
   (+) WakeUpCallback     : Wake UP Callback
   (+) MspInitCallback    : MspInit Callback.
   (+) MspDeInitCallback  : MspDeInit Callback.

 By default, after the HAL_MDIOS_Init and when the state is HAL_MDIOS_STATE_RESET
 all callbacks are set to the corresponding weak functions:
 examples @ref HAL_MDIOS_WriteCpltCallback(), @ref HAL_MDIOS_ReadCpltCallback().
 Exception done for MspInit and MspDeInit functions that are
 reset to the legacy weak function in the HAL_MDIOS_Init/ @ref HAL_MDIOS_DeInit only when
 these callbacks are null (not registered beforehand).
 if not, MspInit or MspDeInit are not null, the HAL_MDIOS_Init/ @ref HAL_MDIOS_DeInit
 keep and use the user MspInit/MspDeInit callbacks (registered beforehand)

 Callbacks can be registered/unregistered in HAL_MDIOS_STATE_READY state only.
 Exception done MspInit/MspDeInit that can be registered/unregistered
 in HAL_MDIOS_STATE_READY or HAL_MDIOS_STATE_RESET state,
 thus registered (user) MspInit/DeInit callbacks can be used during the Init/DeInit.
 In that case first register the MspInit/MspDeInit user callbacks
 using @ref HAL_MDIOS_RegisterCallback() before calling @ref HAL_MDIOS_DeInit
 or HAL_MDIOS_Init function.

 When The compilation define USE_HAL_MDIOS_REGISTER_CALLBACKS is set to 0 or
 not defined, the callback registration feature is not available and all callbacks
 are set to the corresponding weak functions.