STM32H735xx HAL User Manual
stm32h7xx_hal_eth_ex.h
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32h7xx_hal_eth_ex.h
00004   * @author  MCD Application Team
00005   * @brief   Header file of ETH HAL Extended module.
00006   ******************************************************************************
00007   * @attention
00008   *
00009   * Copyright (c) 2017 STMicroelectronics.
00010   * All rights reserved.
00011   *
00012   * This software is licensed under terms that can be found in the LICENSE file
00013   * in the root directory of this software component.
00014   * If no LICENSE file comes with this software, it is provided AS-IS.
00015   *
00016   ******************************************************************************
00017   */ 
00018 
00019 /* Define to prevent recursive inclusion -------------------------------------*/
00020 #ifndef STM32H7xx_HAL_ETH_EX_H
00021 #define STM32H7xx_HAL_ETH_EX_H
00022 
00023 #ifdef __cplusplus
00024  extern "C" {
00025 #endif
00026 
00027 #if defined(ETH)
00028 
00029 /* Includes ------------------------------------------------------------------*/
00030 #include "stm32h7xx_hal_def.h"
00031 
00032 /** @addtogroup STM32H7xx_HAL_Driver
00033   * @{
00034   */
00035 
00036 /** @addtogroup ETHEx
00037   * @{
00038   */
00039 
00040 /* Exported types ------------------------------------------------------------*/
00041 /** @defgroup ETHEx_Exported_Types ETHEx Exported Types
00042   * @{
00043   */
00044   
00045 /** 
00046   * @brief  ETH RX VLAN structure definition
00047   */
00048 typedef struct{
00049   FunctionalState InnerVLANTagInStatus;      /*!< Enables or disables Inner VLAN Tag in Rx Status  */
00050         
00051   uint32_t StripInnerVLANTag;                /*!< Sets the Inner VLAN Tag Stripping on Receive 
00052                                                   This parameter can be a value of @ref ETHEx_Rx_Inner_VLAN_Tag_Stripping */
00053         
00054   FunctionalState InnerVLANTag;              /*!< Enables or disables Inner VLAN Tag */
00055 
00056   FunctionalState DoubleVLANProcessing;      /*!< Enable or Disable double VLAN processing */
00057         
00058   FunctionalState VLANTagHashTableMatch;     /*!< Enable or Disable VLAN Tag Hash Table Match */
00059         
00060   FunctionalState VLANTagInStatus;           /*!< Enable or Disable VLAN Tag in Rx status */
00061         
00062   uint32_t StripVLANTag;                     /*!< Set the VLAN Tag Stripping on Receive 
00063                                                   This parameter can be a value of @ref ETHEx_Rx_VLAN_Tag_Stripping */
00064         
00065   uint32_t VLANTypeCheck;                    /*!< Enable or Disable VLAN Type Check
00066                                                   This parameter can be a value of @ref ETHEx_VLAN_Type_Check */
00067                                                                                                                                                                  
00068   FunctionalState VLANTagInverceMatch;       /*!< Enable or disable VLAN Tag Inverse Match */                                                                                                                                                    
00069 }ETH_RxVLANConfigTypeDef;
00070 /** 
00071   * 
00072   */
00073   
00074 /** 
00075   * @brief  ETH TX VLAN structure definition
00076   */
00077 typedef struct{
00078   FunctionalState SourceTxDesc;   /*!< Enable or Disable VLAN tag source from DMA tx descriptors */
00079   
00080   FunctionalState SVLANType;      /*!< Enable or Disable insertion of SVLAN type */
00081         
00082   uint32_t VLANTagControl;        /*!< Sets the VLAN tag control in tx packets
00083                                       This parameter can be a value of @ref ETHEx_VLAN_Tag_Control */
00084 }ETH_TxVLANConfigTypeDef;
00085 /** 
00086   * 
00087   */
00088 
00089 /** 
00090   * @brief  ETH L3 filter structure definition
00091   */
00092 typedef struct{
00093   uint32_t Protocol;                /*!< Sets the L3 filter protocol to IPv4 or IPv6
00094                                          This parameter can be a value of @ref ETHEx_L3_Protocol */
00095   
00096   uint32_t SrcAddrFilterMatch;      /*!< Sets the L3 filter source address match
00097                                          This parameter can be a value of @ref ETHEx_L3_Source_Match */
00098   
00099   uint32_t DestAddrFilterMatch;     /*!< Sets the L3 filter destination address match
00100                                          This parameter can be a value of @ref ETHEx_L3_Destination_Match */
00101   
00102   uint32_t SrcAddrHigherBitsMatch;  /*!< Sets the L3 filter source address higher bits match
00103                                          This parameter can be a value from 0 to 31 */
00104   
00105   uint32_t DestAddrHigherBitsMatch; /*!< Sets the L3 filter destination address higher bits match
00106                                          This parameter can be a value from 0 to 31 */
00107   
00108   uint32_t Ip4SrcAddr;              /*!< Sets the L3 filter IPv4 source address if IPv4 protocol is used
00109                                          This parameter can be a value from 0x0 to 0xFFFFFFFF */
00110   
00111   uint32_t Ip4DestAddr;             /*!< Sets the L3 filter IPv4 destination  address if IPv4 protocol is used
00112                                          This parameter can be a value from 0 to 0xFFFFFFFF  */
00113   
00114   uint32_t Ip6Addr[4];                 /*!< Sets the L3 filter IPv6 address if IPv6 protocol is used
00115                                           This parameter must be a table of 4 words (4* 32 bits) */
00116 }ETH_L3FilterConfigTypeDef;
00117 /** 
00118   * 
00119   */
00120 
00121 /** 
00122   * @brief  ETH L4 filter structure definition
00123   */
00124 typedef struct{
00125   uint32_t Protocol;               /*!< Sets the L4 filter protocol to TCP or UDP
00126                                         This parameter can be a value of @ref ETHEx_L4_Protocol */
00127   
00128   uint32_t SrcPortFilterMatch;     /*!< Sets the L4 filter source port match
00129                                         This parameter can be a value of @ref ETHEx_L4_Source_Match */
00130   
00131   uint32_t DestPortFilterMatch;    /*!< Sets the L4 filter destination port match
00132                                         This parameter can be a value of @ref ETHEx_L4_Destination_Match */
00133   
00134   uint32_t SourcePort;             /*!< Sets the L4 filter source port 
00135                                         This parameter must be a value from 0x0 to 0xFFFF */
00136   
00137   uint32_t DestinationPort;        /*!< Sets the L4 filter destination port 
00138                                         This parameter must be a value from 0x0 to 0xFFFF */    
00139 }ETH_L4FilterConfigTypeDef;
00140 /** 
00141   * 
00142   */
00143   
00144 /**
00145   * @}
00146   */
00147   
00148 /* Exported constants --------------------------------------------------------*/
00149 /** @defgroup ETHEx_Exported_Constants ETHEx Exported Constants
00150   * @{
00151   */
00152     
00153 /** @defgroup ETHEx_LPI_Event ETHEx LPI Event
00154   * @{
00155   */    
00156 #define ETH_TX_LPI_ENTRY    ETH_MACLCSR_TLPIEN 
00157 #define ETH_TX_LPI_EXIT     ETH_MACLCSR_TLPIEX 
00158 #define ETH_RX_LPI_ENTRY    ETH_MACLCSR_RLPIEN
00159 #define ETH_RX_LPI_EXIT     ETH_MACLCSR_RLPIEX
00160 /**
00161   * @}
00162   */
00163   
00164 /** @defgroup ETHEx_L3_Filter ETHEx L3 Filter
00165   * @{
00166   */
00167 #define ETH_L3_FILTER_0                 ((uint32_t)0x00000000)
00168 #define ETH_L3_FILTER_1                 ((uint32_t)0x0000000C)
00169 /**
00170   * @}
00171   */
00172 
00173 /** @defgroup ETHEx_L4_Filter ETHEx L4 Filter
00174   * @{
00175   */
00176 #define ETH_L4_FILTER_0                 ((uint32_t)0x00000000)
00177 #define ETH_L4_FILTER_1                 ((uint32_t)0x0000000C)
00178 /**
00179   * @}
00180   */
00181 
00182 /** @defgroup ETHEx_L3_Protocol ETHEx L3 Protocol
00183   * @{
00184   */
00185 #define ETH_L3_IPV6_MATCH                       ETH_MACL3L4CR_L3PEN
00186 #define ETH_L3_IPV4_MATCH                       ((uint32_t)0x00000000)
00187 /**
00188   * @}
00189   */
00190 
00191 /** @defgroup ETHEx_L3_Source_Match ETHEx L3 Source Match
00192   * @{
00193   */
00194 #define ETH_L3_SRC_ADDR_PERFECT_MATCH_ENABLE    ETH_MACL3L4CR_L3SAM
00195 #define ETH_L3_SRC_ADDR_INVERSE_MATCH_ENABLE    (ETH_MACL3L4CR_L3SAM | ETH_MACL3L4CR_L3SAIM)
00196 #define ETH_L3_SRC_ADDR_MATCH_DISABLE           ((uint32_t)0x00000000)
00197 /**
00198   * @}
00199   */
00200         
00201 /** @defgroup ETHEx_L3_Destination_Match ETHEx L3 Destination Match
00202   * @{
00203   */
00204 #define ETH_L3_DEST_ADDR_PERFECT_MATCH_ENABLE   ETH_MACL3L4CR_L3DAM
00205 #define ETH_L3_DEST_ADDR_INVERSE_MATCH_ENABLE   (ETH_MACL3L4CR_L3DAM | ETH_MACL3L4CR_L3DAIM)
00206 #define ETH_L3_DEST_ADDR_MATCH_DISABLE          ((uint32_t)0x00000000)
00207 /**
00208   * @}
00209   */
00210         
00211 /** @defgroup ETHEx_L4_Protocol ETHEx L4 Protocol
00212   * @{
00213   */
00214 #define ETH_L4_UDP_MATCH                        ETH_MACL3L4CR_L4PEN
00215 #define ETH_L4_TCP_MATCH                        ((uint32_t)0x00000000)
00216 /**
00217   * @}
00218   */
00219         
00220 /** @defgroup ETHEx_L4_Source_Match ETHEx L4 Source Match
00221   * @{
00222   */
00223 #define ETH_L4_SRC_PORT_PERFECT_MATCH_ENABLE    ETH_MACL3L4CR_L4SPM
00224 #define ETH_L4_SRC_PORT_INVERSE_MATCH_ENABLE    (ETH_MACL3L4CR_L4SPM |ETH_MACL3L4CR_L4SPIM) 
00225 #define ETH_L4_SRC_PORT_MATCH_DISABLE           ((uint32_t)0x00000000)
00226 /**
00227   * @}
00228   */
00229         
00230 /** @defgroup ETHEx_L4_Destination_Match ETHEx L4 Destination Match
00231   * @{
00232   */
00233 #define ETH_L4_DEST_PORT_PERFECT_MATCH_ENABLE   ETH_MACL3L4CR_L4DPM
00234 #define ETH_L4_DEST_PORT_INVERSE_MATCH_ENABLE   (ETH_MACL3L4CR_L4DPM | ETH_MACL3L4CR_L4DPIM)
00235 #define ETH_L4_DEST_PORT_MATCH_DISABLE          ((uint32_t)0x00000000)
00236 /**
00237   * @}
00238   */
00239   
00240 /** @defgroup ETHEx_Rx_Inner_VLAN_Tag_Stripping ETHEx Rx Inner VLAN Tag Stripping
00241   * @{
00242   */ 
00243 #define ETH_INNERVLANTAGRXSTRIPPING_NONE      ETH_MACVTR_EIVLS_DONOTSTRIP
00244 #define ETH_INNERVLANTAGRXSTRIPPING_IFPASS    ETH_MACVTR_EIVLS_STRIPIFPASS
00245 #define ETH_INNERVLANTAGRXSTRIPPING_IFFAILS   ETH_MACVTR_EIVLS_STRIPIFFAILS
00246 #define ETH_INNERVLANTAGRXSTRIPPING_ALWAYS    ETH_MACVTR_EIVLS_ALWAYSSTRIP
00247 /**
00248   * @}
00249   */
00250 
00251 /** @defgroup ETHEx_Rx_VLAN_Tag_Stripping ETHEx Rx VLAN Tag Stripping
00252   * @{
00253   */ 
00254 #define ETH_VLANTAGRXSTRIPPING_NONE      ETH_MACVTR_EVLS_DONOTSTRIP
00255 #define ETH_VLANTAGRXSTRIPPING_IFPASS    ETH_MACVTR_EVLS_STRIPIFPASS
00256 #define ETH_VLANTAGRXSTRIPPING_IFFAILS   ETH_MACVTR_EVLS_STRIPIFFAILS
00257 #define ETH_VLANTAGRXSTRIPPING_ALWAYS    ETH_MACVTR_EVLS_ALWAYSSTRIP
00258 /**
00259   * @}
00260   */
00261   
00262 /** @defgroup ETHEx_VLAN_Type_Check ETHEx VLAN Type Check
00263   * @{
00264   */ 
00265 #define ETH_VLANTYPECHECK_DISABLE    ETH_MACVTR_DOVLTC
00266 #define ETH_VLANTYPECHECK_SVLAN      (ETH_MACVTR_ERSVLM | ETH_MACVTR_ESVL)
00267 #define ETH_VLANTYPECHECK_CVLAN      ((uint32_t)0x00000000)
00268 /**
00269   * @}
00270   */
00271   
00272 /** @defgroup ETHEx_VLAN_Tag_Control ETHEx_VLAN_Tag_Control
00273   * @{
00274   */
00275 #define ETH_VLANTAGCONTROL_NONE       (ETH_MACVIR_VLP | ETH_MACVIR_VLC_NOVLANTAG)
00276 #define ETH_VLANTAGCONTROL_DELETE     (ETH_MACVIR_VLP | ETH_MACVIR_VLC_VLANTAGDELETE)
00277 #define ETH_VLANTAGCONTROL_INSERT     (ETH_MACVIR_VLP | ETH_MACVIR_VLC_VLANTAGINSERT)
00278 #define ETH_VLANTAGCONTROL_REPLACE    (ETH_MACVIR_VLP | ETH_MACVIR_VLC_VLANTAGREPLACE)
00279 /**
00280   * @}
00281   */    
00282  
00283 /** @defgroup ETHEx_Tx_VLAN_Tag ETHEx Tx VLAN Tag
00284   * @{
00285   */ 
00286 #define ETH_INNER_TX_VLANTAG    ((uint32_t)0x00000001U)
00287 #define ETH_OUTER_TX_VLANTAG    ((uint32_t)0x00000000U)
00288 /**
00289   * @}
00290   */ 
00291   
00292 /**
00293   * @}
00294   */
00295   
00296 /* Exported functions --------------------------------------------------------*/
00297 /** @addtogroup ETHEx_Exported_Functions
00298   * @{
00299   */
00300 
00301 /** @addtogroup ETHEx_Exported_Functions_Group1
00302   * @{
00303   */
00304 /* MAC ARP Offloading APIs  ***************************************************/
00305 void              HAL_ETHEx_EnableARPOffload(ETH_HandleTypeDef *heth);
00306 void              HAL_ETHEx_DisableARPOffload(ETH_HandleTypeDef *heth);
00307 void              HAL_ETHEx_SetARPAddressMatch(ETH_HandleTypeDef *heth, uint32_t IpAddress); 
00308 
00309 /* MAC L3 L4 Filtering APIs ***************************************************/
00310 void              HAL_ETHEx_EnableL3L4Filtering(ETH_HandleTypeDef *heth);
00311 void              HAL_ETHEx_DisableL3L4Filtering(ETH_HandleTypeDef *heth);
00312 HAL_StatusTypeDef HAL_ETHEx_GetL3FilterConfig(ETH_HandleTypeDef *heth, uint32_t Filter, ETH_L3FilterConfigTypeDef *pL3FilterConfig);
00313 HAL_StatusTypeDef HAL_ETHEx_GetL4FilterConfig(ETH_HandleTypeDef *heth, uint32_t Filter, ETH_L4FilterConfigTypeDef *pL4FilterConfig);
00314 HAL_StatusTypeDef HAL_ETHEx_SetL3FilterConfig(ETH_HandleTypeDef *heth, uint32_t Filter, ETH_L3FilterConfigTypeDef *pL3FilterConfig);
00315 HAL_StatusTypeDef HAL_ETHEx_SetL4FilterConfig(ETH_HandleTypeDef *heth, uint32_t Filter, ETH_L4FilterConfigTypeDef *pL4FilterConfig);
00316 
00317 /* MAC VLAN Processing APIs    ************************************************/
00318 void              HAL_ETHEx_EnableVLANProcessing(ETH_HandleTypeDef *heth);
00319 void              HAL_ETHEx_DisableVLANProcessing(ETH_HandleTypeDef *heth);
00320 HAL_StatusTypeDef HAL_ETHEx_GetRxVLANConfig(ETH_HandleTypeDef *heth, ETH_RxVLANConfigTypeDef *pVlanConfig);
00321 HAL_StatusTypeDef HAL_ETHEx_SetRxVLANConfig(ETH_HandleTypeDef *heth, ETH_RxVLANConfigTypeDef *pVlanConfig);
00322 void              HAL_ETHEx_SetVLANHashTable(ETH_HandleTypeDef *heth, uint32_t VLANHashTable);
00323 HAL_StatusTypeDef HAL_ETHEx_GetTxVLANConfig(ETH_HandleTypeDef *heth, uint32_t VLANTag ,ETH_TxVLANConfigTypeDef *pVlanConfig);
00324 HAL_StatusTypeDef HAL_ETHEx_SetTxVLANConfig(ETH_HandleTypeDef *heth, uint32_t VLANTag ,ETH_TxVLANConfigTypeDef *pVlanConfig);
00325 void              HAL_ETHEx_SetTxVLANIdentifier(ETH_HandleTypeDef *heth, uint32_t VLANTag ,uint32_t VLANIdentifier);
00326 
00327 /* Energy Efficient Ethernet APIs *********************************************/
00328 void              HAL_ETHEx_EnterLPIMode(ETH_HandleTypeDef *heth, FunctionalState TxAutomate, FunctionalState TxClockStop);
00329 void              HAL_ETHEx_ExitLPIMode(ETH_HandleTypeDef *heth);
00330 uint32_t          HAL_ETHEx_GetMACLPIEvent(ETH_HandleTypeDef *heth);
00331  
00332 /**
00333   * @}
00334   */ 
00335 
00336 /**
00337   * @}
00338   */
00339     
00340 /**
00341   * @}
00342   */ 
00343 
00344 /**
00345   * @}
00346   */
00347 
00348 #endif /* ETH */
00349 
00350 #ifdef __cplusplus
00351 }
00352 #endif
00353 
00354 #endif /* STM32H7xx_HAL_ETH_EX_H */
00355