stm32f4xx_eth.h 95 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874
  1. /**
  2. ******************************************************************************
  3. * @file stm32f2xx_eth.h
  4. * @author MCD Application Team
  5. * @version V0.0.1
  6. * @date 10/21/2010
  7. * @brief This file contains all the functions prototypes for the Ethernet
  8. * firmware library.
  9. ******************************************************************************
  10. * @copy
  11. *
  12. * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  13. * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  14. * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  15. * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  16. * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  17. * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  18. *
  19. * <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>
  20. */
  21. /* Define to prevent recursive inclusion -------------------------------------*/
  22. #ifndef __STM32F2XX_ETH_H
  23. #define __STM32F2XX_ETH_H
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. /* Includes ------------------------------------------------------------------*/
  28. #include "stm32f4xx.h"
  29. /* Uncomment this line when using time stamping and/or IPv4 checksum offload */
  30. #define USE_ENHANCED_DMA_DESCRIPTORS
  31. /**
  32. * @brief Uncomment the line below if you want to use user defined Delay function
  33. * (for precise timing), otherwise default _eth_delay_ function defined within
  34. * this driver is used (less precise timing).
  35. */
  36. /* #define USE_Delay */
  37. #ifdef USE_Delay
  38. #include "main.h"
  39. #define _eth_delay_ Delay /*!< User can provide more timing precise _eth_delay_ function */
  40. #else
  41. #define _eth_delay_ ETH_Delay /*!< Default _eth_delay_ function with less precise timing */
  42. #endif
  43. /** @addtogroup STM32F2XX_ETH_Driver
  44. * @{
  45. */
  46. /** @defgroup ETH_Exported_Types
  47. * @{
  48. */
  49. /**
  50. * @brief ETH MAC Init structure definition
  51. * @note The user should not configure all the ETH_InitTypeDef structure's fields.
  52. * By calling the ETH_StructInit function the structure’s fields are set to their default values.
  53. * Only the parameters that will be set to a non-default value should be configured.
  54. */
  55. typedef struct {
  56. /**
  57. * @brief / * MAC
  58. */
  59. uint32_t ETH_AutoNegotiation; /*!< Selects or not the AutoNegotiation mode for the external PHY
  60. The AutoNegotiation allows an automatic setting of the Speed (10/100Mbps)
  61. and the mode (half/full-duplex).
  62. This parameter can be a value of @ref ETH_AutoNegotiation */
  63. uint32_t ETH_Watchdog; /*!< Selects or not the Watchdog timer
  64. When enabled, the MAC allows no more then 2048 bytes to be received.
  65. When disabled, the MAC can receive up to 16384 bytes.
  66. This parameter can be a value of @ref ETH_watchdog */
  67. uint32_t ETH_Jabber; /*!< Selects or not Jabber timer
  68. When enabled, the MAC allows no more then 2048 bytes to be sent.
  69. When disabled, the MAC can send up to 16384 bytes.
  70. This parameter can be a value of @ref ETH_Jabber */
  71. uint32_t ETH_InterFrameGap; /*!< Selects the minimum IFG between frames during transmission
  72. This parameter can be a value of @ref ETH_Inter_Frame_Gap */
  73. uint32_t ETH_CarrierSense; /*!< Selects or not the Carrier Sense
  74. This parameter can be a value of @ref ETH_Carrier_Sense */
  75. uint32_t ETH_Speed; /*!< Sets the Ethernet speed: 10/100 Mbps
  76. This parameter can be a value of @ref ETH_Speed */
  77. uint32_t ETH_ReceiveOwn; /*!< Selects or not the ReceiveOwn
  78. ReceiveOwn allows the reception of frames when the TX_EN signal is asserted
  79. in Half-Duplex mode
  80. This parameter can be a value of @ref ETH_Receive_Own */
  81. uint32_t ETH_LoopbackMode; /*!< Selects or not the internal MAC MII Loopback mode
  82. This parameter can be a value of @ref ETH_Loop_Back_Mode */
  83. uint32_t ETH_Mode; /*!< Selects the MAC duplex mode: Half-Duplex or Full-Duplex mode
  84. This parameter can be a value of @ref ETH_Duplex_Mode */
  85. uint32_t ETH_ChecksumOffload; /*!< Selects or not the IPv4 checksum checking for received frame payloads' TCP/UDP/ICMP headers.
  86. This parameter can be a value of @ref ETH_Checksum_Offload */
  87. uint32_t ETH_RetryTransmission; /*!< Selects or not the MAC attempt retries transmission, based on the settings of BL,
  88. when a colision occurs (Half-Duplex mode)
  89. This parameter can be a value of @ref ETH_Retry_Transmission */
  90. uint32_t ETH_AutomaticPadCRCStrip; /*!< Selects or not the Automatic MAC Pad/CRC Stripping
  91. This parameter can be a value of @ref ETH_Automatic_Pad_CRC_Strip */
  92. uint32_t ETH_BackOffLimit; /*!< Selects the BackOff limit value
  93. This parameter can be a value of @ref ETH_Back_Off_Limit */
  94. uint32_t ETH_DeferralCheck; /*!< Selects or not the deferral check function (Half-Duplex mode)
  95. This parameter can be a value of @ref ETH_Deferral_Check */
  96. uint32_t ETH_ReceiveAll; /*!< Selects or not all frames reception by the MAC (No fitering)
  97. This parameter can be a value of @ref ETH_Receive_All */
  98. uint32_t ETH_SourceAddrFilter; /*!< Selects the Source Address Filter mode
  99. This parameter can be a value of @ref ETH_Source_Addr_Filter */
  100. uint32_t ETH_PassControlFrames; /*!< Sets the forwarding mode of the control frames (including unicast and multicast PAUSE frames)
  101. This parameter can be a value of @ref ETH_Pass_Control_Frames */
  102. uint32_t ETH_BroadcastFramesReception; /*!< Selects or not the reception of Broadcast Frames
  103. This parameter can be a value of @ref ETH_Broadcast_Frames_Reception */
  104. uint32_t ETH_DestinationAddrFilter; /*!< Sets the destination filter mode for both unicast and multicast frames
  105. This parameter can be a value of @ref ETH_Destination_Addr_Filter */
  106. uint32_t ETH_PromiscuousMode; /*!< Selects or not the Promiscuous Mode
  107. This parameter can be a value of @ref ETH_Promiscuous_Mode */
  108. uint32_t ETH_MulticastFramesFilter; /*!< Selects the Multicast Frames filter mode: None/HashTableFilter/PerfectFilter/PerfectHashTableFilter
  109. This parameter can be a value of @ref ETH_Multicast_Frames_Filter */
  110. uint32_t ETH_UnicastFramesFilter; /*!< Selects the Unicast Frames filter mode: HashTableFilter/PerfectFilter/PerfectHashTableFilter
  111. This parameter can be a value of @ref ETH_Unicast_Frames_Filter */
  112. uint32_t ETH_HashTableHigh; /*!< This field holds the higher 32 bits of Hash table. */
  113. uint32_t ETH_HashTableLow; /*!< This field holds the lower 32 bits of Hash table. */
  114. uint32_t ETH_PauseTime; /*!< This field holds the value to be used in the Pause Time field in the
  115. transmit control frame */
  116. uint32_t ETH_ZeroQuantaPause; /*!< Selects or not the automatic generation of Zero-Quanta Pause Control frames
  117. This parameter can be a value of @ref ETH_Zero_Quanta_Pause */
  118. uint32_t ETH_PauseLowThreshold; /*!< This field configures the threshold of the PAUSE to be checked for
  119. automatic retransmission of PAUSE Frame
  120. This parameter can be a value of @ref ETH_Pause_Low_Threshold */
  121. uint32_t ETH_UnicastPauseFrameDetect; /*!< Selects or not the MAC detection of the Pause frames (with MAC Address0
  122. unicast address and unique multicast address)
  123. This parameter can be a value of @ref ETH_Unicast_Pause_Frame_Detect */
  124. uint32_t ETH_ReceiveFlowControl; /*!< Enables or disables the MAC to decode the received Pause frame and
  125. disable its transmitter for a specified time (Pause Time)
  126. This parameter can be a value of @ref ETH_Receive_Flow_Control */
  127. uint32_t ETH_TransmitFlowControl; /*!< Enables or disables the MAC to transmit Pause frames (Full-Duplex mode)
  128. or the MAC back-pressure operation (Half-Duplex mode)
  129. This parameter can be a value of @ref ETH_Transmit_Flow_Control */
  130. uint32_t ETH_VLANTagComparison; /*!< Selects the 12-bit VLAN identifier or the complete 16-bit VLAN tag for
  131. comparison and filtering
  132. This parameter can be a value of @ref ETH_VLAN_Tag_Comparison */
  133. uint32_t ETH_VLANTagIdentifier; /*!< Holds the VLAN tag identifier for receive frames */
  134. /**
  135. * @brief / * DMA
  136. */
  137. uint32_t ETH_DropTCPIPChecksumErrorFrame; /*!< Selects or not the Dropping of TCP/IP Checksum Error Frames
  138. This parameter can be a value of @ref ETH_Drop_TCP_IP_Checksum_Error_Frame */
  139. uint32_t ETH_ReceiveStoreForward; /*!< Enables or disables the Receive store and forward mode
  140. This parameter can be a value of @ref ETH_Receive_Store_Forward */
  141. uint32_t ETH_FlushReceivedFrame; /*!< Enables or disables the flushing of received frames
  142. This parameter can be a value of @ref ETH_Flush_Received_Frame */
  143. uint32_t ETH_TransmitStoreForward; /*!< Enables or disables Transmit store and forward mode
  144. This parameter can be a value of @ref ETH_Transmit_Store_Forward */
  145. uint32_t ETH_TransmitThresholdControl; /*!< Selects or not the Transmit Threshold Control
  146. This parameter can be a value of @ref ETH_Transmit_Threshold_Control */
  147. uint32_t ETH_ForwardErrorFrames; /*!< Selects or not the forward to the DMA of erroneous frames
  148. This parameter can be a value of @ref ETH_Forward_Error_Frames */
  149. uint32_t ETH_ForwardUndersizedGoodFrames; /*!< Enables or disables the Rx FIFO to forward Undersized frames (frames with no Error
  150. and length less than 64 bytes) including pad-bytes and CRC)
  151. This parameter can be a value of @ref ETH_Forward_Undersized_Good_Frames */
  152. uint32_t ETH_ReceiveThresholdControl; /*!< Selects the threshold level of the Receive FIFO
  153. This parameter can be a value of @ref ETH_Receive_Threshold_Control */
  154. uint32_t ETH_SecondFrameOperate; /*!< Selects or not the Operate on second frame mode, which allows the DMA to process a second
  155. frame of Transmit data even before obtaining the status for the first frame.
  156. This parameter can be a value of @ref ETH_Second_Frame_Operate */
  157. uint32_t ETH_AddressAlignedBeats; /*!< Enables or disables the Address Aligned Beats
  158. This parameter can be a value of @ref ETH_Address_Aligned_Beats */
  159. uint32_t ETH_FixedBurst; /*!< Enables or disables the AHB Master interface fixed burst transfers
  160. This parameter can be a value of @ref ETH_Fixed_Burst */
  161. uint32_t ETH_RxDMABurstLength; /*!< Indicates the maximum number of beats to be transferred in one Rx DMA transaction
  162. This parameter can be a value of @ref ETH_Rx_DMA_Burst_Length */
  163. uint32_t ETH_TxDMABurstLength; /*!< Indicates sthe maximum number of beats to be transferred in one Tx DMA transaction
  164. This parameter can be a value of @ref ETH_Tx_DMA_Burst_Length */
  165. uint32_t ETH_DescriptorSkipLength; /*!< Specifies the number of word to skip between two unchained descriptors (Ring mode) */
  166. uint32_t ETH_DMAArbitration; /*!< Selects the DMA Tx/Rx arbitration
  167. This parameter can be a value of @ref ETH_DMA_Arbitration */
  168. }ETH_InitTypeDef;
  169. /**--------------------------------------------------------------------------**/
  170. /**
  171. * @brief DMA descriptors types
  172. */
  173. /**--------------------------------------------------------------------------**/
  174. /**
  175. * @brief ETH DMA Desciptors data structure definition
  176. */
  177. typedef struct {
  178. uint32_t Status; /*!< Status */
  179. uint32_t ControlBufferSize; /*!< Control and Buffer1, Buffer2 lengths */
  180. uint32_t Buffer1Addr; /*!< Buffer1 address pointer */
  181. uint32_t Buffer2NextDescAddr; /*!< Buffer2 or next descriptor address pointer */
  182. /* Enhanced ETHERNET DMA PTP Desciptors */
  183. #ifdef USE_ENHANCED_DMA_DESCRIPTORS
  184. uint32_t ExtendedStatus; /* Extended status for PTP receive descriptor */
  185. uint32_t Reserved1; /* Reserved */
  186. uint32_t TimeStampLow; /* Time Stamp Low value for transmit and receive */
  187. uint32_t TimeStampHigh; /* Time Stamp High value for transmit and receive */
  188. #endif /* USE_ENHANCED_DMA_DESCRIPTORS */
  189. } ETH_DMADESCTypeDef;
  190. /**
  191. * @}
  192. */
  193. /** @defgroup ETH_Exported_Constants
  194. * @{
  195. */
  196. /**--------------------------------------------------------------------------**/
  197. /**
  198. * @brief ETH Frames defines
  199. */
  200. /**--------------------------------------------------------------------------**/
  201. /** @defgroup ENET_Buffers_setting
  202. * @{
  203. */
  204. #define ETH_MAX_PACKET_SIZE 1520 /*!< ETH_HEADER + ETH_EXTRA + MAX_ETH_PAYLOAD + ETH_CRC */
  205. #define ETH_HEADER 14 /*!< 6 byte Dest addr, 6 byte Src addr, 2 byte length/type */
  206. #define ETH_CRC 4 /*!< Ethernet CRC */
  207. #define ETH_EXTRA 2 /*!< Extra bytes in some cases */
  208. #define VLAN_TAG 4 /*!< optional 802.1q VLAN Tag */
  209. #define MIN_ETH_PAYLOAD 46 /*!< Minimum Ethernet payload size */
  210. #define MAX_ETH_PAYLOAD 1500 /*!< Maximum Ethernet payload size */
  211. #define JUMBO_FRAME_PAYLOAD 9000 /*!< Jumbo frame payload size */
  212. /**--------------------------------------------------------------------------**/
  213. /**
  214. * @brief Ethernet DMA descriptors registers bits definition
  215. */
  216. /**--------------------------------------------------------------------------**/
  217. /**
  218. @code
  219. DMA Tx Desciptor
  220. -----------------------------------------------------------------------------------------------
  221. TDES0 | OWN(31) | CTRL[30:26] | Reserved[25:24] | CTRL[23:20] | Reserved[19:17] | Status[16:0] |
  222. -----------------------------------------------------------------------------------------------
  223. TDES1 | Reserved[31:29] | Buffer2 ByteCount[28:16] | Reserved[15:13] | Buffer1 ByteCount[12:0] |
  224. -----------------------------------------------------------------------------------------------
  225. TDES2 | Buffer1 Address [31:0] |
  226. -----------------------------------------------------------------------------------------------
  227. TDES3 | Buffer2 Address [31:0] / Next Desciptor Address [31:0] |
  228. -----------------------------------------------------------------------------------------------
  229. @endcode
  230. */
  231. /**
  232. * @brief Bit definition of TDES0 register: DMA Tx descriptor status register
  233. */
  234. #define ETH_DMATxDesc_OWN ((uint32_t)0x80000000) /*!< OWN bit: descriptor is owned by DMA engine */
  235. #define ETH_DMATxDesc_IC ((uint32_t)0x40000000) /*!< Interrupt on Completion */
  236. #define ETH_DMATxDesc_LS ((uint32_t)0x20000000) /*!< Last Segment */
  237. #define ETH_DMATxDesc_FS ((uint32_t)0x10000000) /*!< First Segment */
  238. #define ETH_DMATxDesc_DC ((uint32_t)0x08000000) /*!< Disable CRC */
  239. #define ETH_DMATxDesc_DP ((uint32_t)0x04000000) /*!< Disable Padding */
  240. #define ETH_DMATxDesc_TTSE ((uint32_t)0x02000000) /*!< Transmit Time Stamp Enable */
  241. #define ETH_DMATxDesc_CIC ((uint32_t)0x00C00000) /*!< Checksum Insertion Control: 4 cases */
  242. #define ETH_DMATxDesc_CIC_ByPass ((uint32_t)0x00000000) /*!< Do Nothing: Checksum Engine is bypassed */
  243. #define ETH_DMATxDesc_CIC_IPV4Header ((uint32_t)0x00400000) /*!< IPV4 header Checksum Insertion */
  244. #define ETH_DMATxDesc_CIC_TCPUDPICMP_Segment ((uint32_t)0x00800000) /*!< TCP/UDP/ICMP Checksum Insertion calculated over segment only */
  245. #define ETH_DMATxDesc_CIC_TCPUDPICMP_Full ((uint32_t)0x00C00000) /*!< TCP/UDP/ICMP Checksum Insertion fully calculated */
  246. #define ETH_DMATxDesc_TER ((uint32_t)0x00200000) /*!< Transmit End of Ring */
  247. #define ETH_DMATxDesc_TCH ((uint32_t)0x00100000) /*!< Second Address Chained */
  248. #define ETH_DMATxDesc_TTSS ((uint32_t)0x00020000) /*!< Tx Time Stamp Status */
  249. #define ETH_DMATxDesc_IHE ((uint32_t)0x00010000) /*!< IP Header Error */
  250. #define ETH_DMATxDesc_ES ((uint32_t)0x00008000) /*!< Error summary: OR of the following bits: UE || ED || EC || LCO || NC || LCA || FF || JT */
  251. #define ETH_DMATxDesc_JT ((uint32_t)0x00004000) /*!< Jabber Timeout */
  252. #define ETH_DMATxDesc_FF ((uint32_t)0x00002000) /*!< Frame Flushed: DMA/MTL flushed the frame due to SW flush */
  253. #define ETH_DMATxDesc_PCE ((uint32_t)0x00001000) /*!< Payload Checksum Error */
  254. #define ETH_DMATxDesc_LCA ((uint32_t)0x00000800) /*!< Loss of Carrier: carrier lost during tramsmission */
  255. #define ETH_DMATxDesc_NC ((uint32_t)0x00000400) /*!< No Carrier: no carrier signal from the tranceiver */
  256. #define ETH_DMATxDesc_LCO ((uint32_t)0x00000200) /*!< Late Collision: transmission aborted due to collision */
  257. #define ETH_DMATxDesc_EC ((uint32_t)0x00000100) /*!< Excessive Collision: transmission aborted after 16 collisions */
  258. #define ETH_DMATxDesc_VF ((uint32_t)0x00000080) /*!< VLAN Frame */
  259. #define ETH_DMATxDesc_CC ((uint32_t)0x00000078) /*!< Collision Count */
  260. #define ETH_DMATxDesc_ED ((uint32_t)0x00000004) /*!< Excessive Deferral */
  261. #define ETH_DMATxDesc_UF ((uint32_t)0x00000002) /*!< Underflow Error: late data arrival from the memory */
  262. #define ETH_DMATxDesc_DB ((uint32_t)0x00000001) /*!< Deferred Bit */
  263. /**
  264. * @brief Bit definition of TDES1 register
  265. */
  266. #define ETH_DMATxDesc_TBS2 ((uint32_t)0x1FFF0000) /*!< Transmit Buffer2 Size */
  267. #define ETH_DMATxDesc_TBS1 ((uint32_t)0x00001FFF) /*!< Transmit Buffer1 Size */
  268. /**
  269. * @brief Bit definition of TDES2 register
  270. */
  271. #define ETH_DMATxDesc_B1AP ((uint32_t)0xFFFFFFFF) /*!< Buffer1 Address Pointer */
  272. /**
  273. * @brief Bit definition of TDES3 register
  274. */
  275. #define ETH_DMATxDesc_B2AP ((uint32_t)0xFFFFFFFF) /*!< Buffer2 Address Pointer */
  276. /*---------------------------------------------------------------------------------------------
  277. TDES6 | Transmit Time Stmap Low [31:0] |
  278. -----------------------------------------------------------------------------------------------
  279. TDES7 | Transmit Time Stmap High [31:0] |
  280. ----------------------------------------------------------------------------------------------*/
  281. /* Bit definition of TDES6 register */
  282. #define ETH_DMAPTPTxDesc_TTSL ((uint32_t)0xFFFFFFFF) /* Transmit Time Stmap Low */
  283. /* Bit definition of TDES7 register */
  284. #define ETH_DMAPTPTxDesc_TTSH ((uint32_t)0xFFFFFFFF) /* Transmit Time Stmap High */
  285. /**
  286. * @}
  287. */
  288. /** @defgroup DMA_Rx_descriptor
  289. * @{
  290. */
  291. /**
  292. @code
  293. DMA Rx Desciptor
  294. --------------------------------------------------------------------------------------------------------------------
  295. RDES0 | OWN(31) | Status [30:0] |
  296. ---------------------------------------------------------------------------------------------------------------------
  297. RDES1 | CTRL(31) | Reserved[30:29] | Buffer2 ByteCount[28:16] | CTRL[15:14] | Reserved(13) | Buffer1 ByteCount[12:0] |
  298. ---------------------------------------------------------------------------------------------------------------------
  299. RDES2 | Buffer1 Address [31:0] |
  300. ---------------------------------------------------------------------------------------------------------------------
  301. RDES3 | Buffer2 Address [31:0] / Next Desciptor Address [31:0] |
  302. ---------------------------------------------------------------------------------------------------------------------
  303. @endcode
  304. */
  305. /**
  306. * @brief Bit definition of RDES0 register: DMA Rx descriptor status register
  307. */
  308. #define ETH_DMARxDesc_OWN ((uint32_t)0x80000000) /*!< OWN bit: descriptor is owned by DMA engine */
  309. #define ETH_DMARxDesc_AFM ((uint32_t)0x40000000) /*!< DA Filter Fail for the rx frame */
  310. #define ETH_DMARxDesc_FL ((uint32_t)0x3FFF0000) /*!< Receive descriptor frame length */
  311. #define ETH_DMARxDesc_ES ((uint32_t)0x00008000) /*!< Error summary: OR of the following bits: DE || OE || IPC || LC || RWT || RE || CE */
  312. #define ETH_DMARxDesc_DE ((uint32_t)0x00004000) /*!< Desciptor error: no more descriptors for receive frame */
  313. #define ETH_DMARxDesc_SAF ((uint32_t)0x00002000) /*!< SA Filter Fail for the received frame */
  314. #define ETH_DMARxDesc_LE ((uint32_t)0x00001000) /*!< Frame size not matching with length field */
  315. #define ETH_DMARxDesc_OE ((uint32_t)0x00000800) /*!< Overflow Error: Frame was damaged due to buffer overflow */
  316. #define ETH_DMARxDesc_VLAN ((uint32_t)0x00000400) /*!< VLAN Tag: received frame is a VLAN frame */
  317. #define ETH_DMARxDesc_FS ((uint32_t)0x00000200) /*!< First descriptor of the frame */
  318. #define ETH_DMARxDesc_LS ((uint32_t)0x00000100) /*!< Last descriptor of the frame */
  319. #define ETH_DMARxDesc_IPV4HCE ((uint32_t)0x00000080) /*!< IPC Checksum Error: Rx Ipv4 header checksum error */
  320. #define ETH_DMARxDesc_LC ((uint32_t)0x00000040) /*!< Late collision occurred during reception */
  321. #define ETH_DMARxDesc_FT ((uint32_t)0x00000020) /*!< Frame type - Ethernet, otherwise 802.3 */
  322. #define ETH_DMARxDesc_RWT ((uint32_t)0x00000010) /*!< Receive Watchdog Timeout: watchdog timer expired during reception */
  323. #define ETH_DMARxDesc_RE ((uint32_t)0x00000008) /*!< Receive error: error reported by MII interface */
  324. #define ETH_DMARxDesc_DBE ((uint32_t)0x00000004) /*!< Dribble bit error: frame contains non int multiple of 8 bits */
  325. #define ETH_DMARxDesc_CE ((uint32_t)0x00000002) /*!< CRC error */
  326. #define ETH_DMARxDesc_MAMPCE ((uint32_t)0x00000001) /*!< Rx MAC Address/Payload Checksum Error: Rx MAC address matched/ Rx Payload Checksum Error */
  327. /**
  328. * @brief Bit definition of RDES1 register
  329. */
  330. #define ETH_DMARxDesc_DIC ((uint32_t)0x80000000) /*!< Disable Interrupt on Completion */
  331. #define ETH_DMARxDesc_RBS2 ((uint32_t)0x1FFF0000) /*!< Receive Buffer2 Size */
  332. #define ETH_DMARxDesc_RER ((uint32_t)0x00008000) /*!< Receive End of Ring */
  333. #define ETH_DMARxDesc_RCH ((uint32_t)0x00004000) /*!< Second Address Chained */
  334. #define ETH_DMARxDesc_RBS1 ((uint32_t)0x00001FFF) /*!< Receive Buffer1 Size */
  335. /**
  336. * @brief Bit definition of RDES2 register
  337. */
  338. #define ETH_DMARxDesc_B1AP ((uint32_t)0xFFFFFFFF) /*!< Buffer1 Address Pointer */
  339. /**
  340. * @brief Bit definition of RDES3 register
  341. */
  342. #define ETH_DMARxDesc_B2AP ((uint32_t)0xFFFFFFFF) /*!< Buffer2 Address Pointer */
  343. /*---------------------------------------------------------------------------------------------------------------------
  344. RDES4 | Reserved[31:15] | Extended Status [14:0] |
  345. ---------------------------------------------------------------------------------------------------------------------
  346. RDES5 | Reserved[31:0] |
  347. ---------------------------------------------------------------------------------------------------------------------
  348. RDES6 | Receive Time Stmap Low [31:0] |
  349. ---------------------------------------------------------------------------------------------------------------------
  350. RDES7 | Receive Time Stmap High [31:0] |
  351. --------------------------------------------------------------------------------------------------------------------*/
  352. /* Bit definition of RDES4 register */
  353. #define ETH_DMAPTPRxDesc_PTPV ((uint32_t)0x00002000) /* PTP Version */
  354. #define ETH_DMAPTPRxDesc_PTPFT ((uint32_t)0x00001000) /* PTP Frame Type */
  355. #define ETH_DMAPTPRxDesc_PTPMT ((uint32_t)0x00000F00) /* PTP Message Type */
  356. #define ETH_DMAPTPRxDesc_PTPMT_Sync ((uint32_t)0x00000100) /* SYNC message (all clock types) */
  357. #define ETH_DMAPTPRxDesc_PTPMT_FollowUp ((uint32_t)0x00000200) /* FollowUp message (all clock types) */
  358. #define ETH_DMAPTPRxDesc_PTPMT_DelayReq ((uint32_t)0x00000300) /* DelayReq message (all clock types) */
  359. #define ETH_DMAPTPRxDesc_PTPMT_DelayResp ((uint32_t)0x00000400) /* DelayResp message (all clock types) */
  360. #define ETH_DMAPTPRxDesc_PTPMT_PdelayReq_Announce ((uint32_t)0x00000500) /* PdelayReq message (peer-to-peer transparent clock) or Announce message (Ordinary or Boundary clock) */
  361. #define ETH_DMAPTPRxDesc_PTPMT_PdelayResp_Manag ((uint32_t)0x00000600) /* PdelayResp message (peer-to-peer transparent clock) or Management message (Ordinary or Boundary clock) */
  362. #define ETH_DMAPTPRxDesc_PTPMT_PdelayRespFollowUp_Signal ((uint32_t)0x00000700) /* PdelayRespFollowUp message (peer-to-peer transparent clock) or Signaling message (Ordinary or Boundary clock) */
  363. #define ETH_DMAPTPRxDesc_IPV6PR ((uint32_t)0x00000080) /* IPv6 Packet Received */
  364. #define ETH_DMAPTPRxDesc_IPV4PR ((uint32_t)0x00000040) /* IPv4 Packet Received */
  365. #define ETH_DMAPTPRxDesc_IPCB ((uint32_t)0x00000020) /* IP Checksum Bypassed */
  366. #define ETH_DMAPTPRxDesc_IPPE ((uint32_t)0x00000010) /* IP Payload Error */
  367. #define ETH_DMAPTPRxDesc_IPHE ((uint32_t)0x00000008) /* IP Header Error */
  368. #define ETH_DMAPTPRxDesc_IPPT ((uint32_t)0x00000007) /* IP Payload Type */
  369. #define ETH_DMAPTPRxDesc_IPPT_UDP ((uint32_t)0x00000001) /* UDP payload encapsulated in the IP datagram */
  370. #define ETH_DMAPTPRxDesc_IPPT_TCP ((uint32_t)0x00000002) /* TCP payload encapsulated in the IP datagram */
  371. #define ETH_DMAPTPRxDesc_IPPT_ICMP ((uint32_t)0x00000003) /* ICMP payload encapsulated in the IP datagram */
  372. /* Bit definition of RDES6 register */
  373. #define ETH_DMAPTPRxDesc_RTSL ((uint32_t)0xFFFFFFFF) /* Receive Time Stmap Low */
  374. /* Bit definition of RDES7 register */
  375. #define ETH_DMAPTPRxDesc_RTSH ((uint32_t)0xFFFFFFFF) /* Receive Time Stmap High */
  376. /**--------------------------------------------------------------------------**/
  377. /**
  378. * @brief Desciption of common PHY registers
  379. */
  380. /**--------------------------------------------------------------------------**/
  381. /**
  382. * @}
  383. */
  384. /** @defgroup PHY_Read_write_Timeouts
  385. * @{
  386. */
  387. #define PHY_READ_TO ((uint32_t)0x0004FFFF)
  388. #define PHY_WRITE_TO ((uint32_t)0x0004FFFF)
  389. /**
  390. * @}
  391. */
  392. /** @defgroup PHY_Reset_Delay
  393. * @{
  394. */
  395. #define PHY_ResetDelay ((uint32_t)0x000FFFFF)
  396. /**
  397. * @}
  398. */
  399. /** @defgroup PHY_Config_Delay
  400. * @{
  401. */
  402. #define PHY_ConfigDelay ((uint32_t)0x00FFFFFF)
  403. /**
  404. * @}
  405. */
  406. /** @defgroup PHY_Register_address
  407. * @{
  408. */
  409. #define PHY_BCR 0 /*!< Tranceiver Basic Control Register */
  410. #define PHY_BSR 1 /*!< Tranceiver Basic Status Register */
  411. /**
  412. * @}
  413. */
  414. /** @defgroup PHY_basic_Control_register
  415. * @{
  416. */
  417. #define PHY_Reset ((uint16_t)0x8000) /*!< PHY Reset */
  418. #define PHY_Loopback ((uint16_t)0x4000) /*!< Select loop-back mode */
  419. #define PHY_FULLDUPLEX_100M ((uint16_t)0x2100) /*!< Set the full-duplex mode at 100 Mb/s */
  420. #define PHY_HALFDUPLEX_100M ((uint16_t)0x2000) /*!< Set the half-duplex mode at 100 Mb/s */
  421. #define PHY_FULLDUPLEX_10M ((uint16_t)0x0100) /*!< Set the full-duplex mode at 10 Mb/s */
  422. #define PHY_HALFDUPLEX_10M ((uint16_t)0x0000) /*!< Set the half-duplex mode at 10 Mb/s */
  423. #define PHY_AutoNegotiation ((uint16_t)0x1000) /*!< Enable auto-negotiation function */
  424. #define PHY_Restart_AutoNegotiation ((uint16_t)0x0200) /*!< Restart auto-negotiation function */
  425. #define PHY_Powerdown ((uint16_t)0x0800) /*!< Select the power down mode */
  426. #define PHY_Isolate ((uint16_t)0x0400) /*!< Isolate PHY from MII */
  427. /**
  428. * @}
  429. */
  430. /** @defgroup PHY_basic_status_register
  431. * @{
  432. */
  433. #define PHY_AutoNego_Complete ((uint16_t)0x0020) /*!< Auto-Negotioation process completed */
  434. #define PHY_Linked_Status ((uint16_t)0x0004) /*!< Valid link established */
  435. #define PHY_Jabber_detection ((uint16_t)0x0002) /*!< Jabber condition detected */
  436. /**
  437. * @}
  438. */
  439. /** @defgroup PHY_status_register
  440. * @{
  441. */
  442. /* The PHY status register value change from a PHY to another so the user have
  443. to update this value depending on the used external PHY */
  444. /**
  445. * @brief For LAN8700
  446. */
  447. /*#define PHY_SR 31 */ /*!< Tranceiver Status Register */
  448. /**
  449. * @brief For DP83848
  450. */
  451. #define PHY_SR 16 /*!< Tranceiver Status Register */
  452. /* The Speed and Duplex mask values change from a PHY to another so the user have to update
  453. this value depending on the used external PHY */
  454. /**
  455. * @brief For LAN8700
  456. */
  457. /*#define PHY_Speed_Status ((uint16_t)0x0004)*/ /*!< Configured information of Speed: 10Mbps */
  458. /*#define PHY_Duplex_Status ((uint16_t)0x0010)*/ /*!< Configured information of Duplex: Full-duplex */
  459. /**
  460. * @brief For DP83848
  461. */
  462. #define PHY_Speed_Status ((uint16_t)0x0002) /*!< Configured information of Speed: 10Mbps */
  463. #define PHY_Duplex_Status ((uint16_t)0x0004) /*!< Configured information of Duplex: Full-duplex */
  464. #define IS_ETH_PHY_ADDRESS(ADDRESS) ((ADDRESS) <= 0x20)
  465. #define IS_ETH_PHY_REG(REG) ((REG) <= 0x1F)
  466. /**--------------------------------------------------------------------------**/
  467. /**
  468. * @brief MAC defines
  469. */
  470. /**--------------------------------------------------------------------------**/
  471. /**
  472. * @}
  473. */
  474. /** @defgroup ETH_AutoNegotiation
  475. * @{
  476. */
  477. #define ETH_AutoNegotiation_Enable ((uint32_t)0x00000001)
  478. #define ETH_AutoNegotiation_Disable ((uint32_t)0x00000000)
  479. #define IS_ETH_AUTONEGOTIATION(CMD) (((CMD) == ETH_AutoNegotiation_Enable) || \
  480. ((CMD) == ETH_AutoNegotiation_Disable))
  481. /**
  482. * @}
  483. */
  484. /** @defgroup ETH_watchdog
  485. * @{
  486. */
  487. #define ETH_Watchdog_Enable ((uint32_t)0x00000000)
  488. #define ETH_Watchdog_Disable ((uint32_t)0x00800000)
  489. #define IS_ETH_WATCHDOG(CMD) (((CMD) == ETH_Watchdog_Enable) || \
  490. ((CMD) == ETH_Watchdog_Disable))
  491. /**
  492. * @}
  493. */
  494. /** @defgroup ETH_Jabber
  495. * @{
  496. */
  497. #define ETH_Jabber_Enable ((uint32_t)0x00000000)
  498. #define ETH_Jabber_Disable ((uint32_t)0x00400000)
  499. #define IS_ETH_JABBER(CMD) (((CMD) == ETH_Jabber_Enable) || \
  500. ((CMD) == ETH_Jabber_Disable))
  501. /**
  502. * @}
  503. */
  504. /** @defgroup ETH_Inter_Frame_Gap
  505. * @{
  506. */
  507. #define ETH_InterFrameGap_96Bit ((uint32_t)0x00000000) /*!< minimum IFG between frames during transmission is 96Bit */
  508. #define ETH_InterFrameGap_88Bit ((uint32_t)0x00020000) /*!< minimum IFG between frames during transmission is 88Bit */
  509. #define ETH_InterFrameGap_80Bit ((uint32_t)0x00040000) /*!< minimum IFG between frames during transmission is 80Bit */
  510. #define ETH_InterFrameGap_72Bit ((uint32_t)0x00060000) /*!< minimum IFG between frames during transmission is 72Bit */
  511. #define ETH_InterFrameGap_64Bit ((uint32_t)0x00080000) /*!< minimum IFG between frames during transmission is 64Bit */
  512. #define ETH_InterFrameGap_56Bit ((uint32_t)0x000A0000) /*!< minimum IFG between frames during transmission is 56Bit */
  513. #define ETH_InterFrameGap_48Bit ((uint32_t)0x000C0000) /*!< minimum IFG between frames during transmission is 48Bit */
  514. #define ETH_InterFrameGap_40Bit ((uint32_t)0x000E0000) /*!< minimum IFG between frames during transmission is 40Bit */
  515. #define IS_ETH_INTER_FRAME_GAP(GAP) (((GAP) == ETH_InterFrameGap_96Bit) || \
  516. ((GAP) == ETH_InterFrameGap_88Bit) || \
  517. ((GAP) == ETH_InterFrameGap_80Bit) || \
  518. ((GAP) == ETH_InterFrameGap_72Bit) || \
  519. ((GAP) == ETH_InterFrameGap_64Bit) || \
  520. ((GAP) == ETH_InterFrameGap_56Bit) || \
  521. ((GAP) == ETH_InterFrameGap_48Bit) || \
  522. ((GAP) == ETH_InterFrameGap_40Bit))
  523. /**
  524. * @}
  525. */
  526. /** @defgroup ETH_Carrier_Sense
  527. * @{
  528. */
  529. #define ETH_CarrierSense_Enable ((uint32_t)0x00000000)
  530. #define ETH_CarrierSense_Disable ((uint32_t)0x00010000)
  531. #define IS_ETH_CARRIER_SENSE(CMD) (((CMD) == ETH_CarrierSense_Enable) || \
  532. ((CMD) == ETH_CarrierSense_Disable))
  533. /**
  534. * @}
  535. */
  536. /** @defgroup ETH_Speed
  537. * @{
  538. */
  539. #define ETH_Speed_10M ((uint32_t)0x00000000)
  540. #define ETH_Speed_100M ((uint32_t)0x00004000)
  541. #define IS_ETH_SPEED(SPEED) (((SPEED) == ETH_Speed_10M) || \
  542. ((SPEED) == ETH_Speed_100M))
  543. /**
  544. * @}
  545. */
  546. /** @defgroup ETH_Receive_Own
  547. * @{
  548. */
  549. #define ETH_ReceiveOwn_Enable ((uint32_t)0x00000000)
  550. #define ETH_ReceiveOwn_Disable ((uint32_t)0x00002000)
  551. #define IS_ETH_RECEIVE_OWN(CMD) (((CMD) == ETH_ReceiveOwn_Enable) || \
  552. ((CMD) == ETH_ReceiveOwn_Disable))
  553. /**
  554. * @}
  555. */
  556. /** @defgroup ETH_Loop_Back_Mode
  557. * @{
  558. */
  559. #define ETH_LoopbackMode_Enable ((uint32_t)0x00001000)
  560. #define ETH_LoopbackMode_Disable ((uint32_t)0x00000000)
  561. #define IS_ETH_LOOPBACK_MODE(CMD) (((CMD) == ETH_LoopbackMode_Enable) || \
  562. ((CMD) == ETH_LoopbackMode_Disable))
  563. /**
  564. * @}
  565. */
  566. /** @defgroup ETH_Duplex_Mode
  567. * @{
  568. */
  569. #define ETH_Mode_FullDuplex ((uint32_t)0x00000800)
  570. #define ETH_Mode_HalfDuplex ((uint32_t)0x00000000)
  571. #define IS_ETH_DUPLEX_MODE(MODE) (((MODE) == ETH_Mode_FullDuplex) || \
  572. ((MODE) == ETH_Mode_HalfDuplex))
  573. /**
  574. * @}
  575. */
  576. /** @defgroup ETH_Checksum_Offload
  577. * @{
  578. */
  579. #define ETH_ChecksumOffload_Enable ((uint32_t)0x00000400)
  580. #define ETH_ChecksumOffload_Disable ((uint32_t)0x00000000)
  581. #define IS_ETH_CHECKSUM_OFFLOAD(CMD) (((CMD) == ETH_ChecksumOffload_Enable) || \
  582. ((CMD) == ETH_ChecksumOffload_Disable))
  583. /**
  584. * @}
  585. */
  586. /** @defgroup ETH_Retry_Transmission
  587. * @{
  588. */
  589. #define ETH_RetryTransmission_Enable ((uint32_t)0x00000000)
  590. #define ETH_RetryTransmission_Disable ((uint32_t)0x00000200)
  591. #define IS_ETH_RETRY_TRANSMISSION(CMD) (((CMD) == ETH_RetryTransmission_Enable) || \
  592. ((CMD) == ETH_RetryTransmission_Disable))
  593. /**
  594. * @}
  595. */
  596. /** @defgroup ETH_Automatic_Pad_CRC_Strip
  597. * @{
  598. */
  599. #define ETH_AutomaticPadCRCStrip_Enable ((uint32_t)0x00000080)
  600. #define ETH_AutomaticPadCRCStrip_Disable ((uint32_t)0x00000000)
  601. #define IS_ETH_AUTOMATIC_PADCRC_STRIP(CMD) (((CMD) == ETH_AutomaticPadCRCStrip_Enable) || \
  602. ((CMD) == ETH_AutomaticPadCRCStrip_Disable))
  603. /**
  604. * @}
  605. */
  606. /** @defgroup ETH_Back_Off_Limit
  607. * @{
  608. */
  609. #define ETH_BackOffLimit_10 ((uint32_t)0x00000000)
  610. #define ETH_BackOffLimit_8 ((uint32_t)0x00000020)
  611. #define ETH_BackOffLimit_4 ((uint32_t)0x00000040)
  612. #define ETH_BackOffLimit_1 ((uint32_t)0x00000060)
  613. #define IS_ETH_BACKOFF_LIMIT(LIMIT) (((LIMIT) == ETH_BackOffLimit_10) || \
  614. ((LIMIT) == ETH_BackOffLimit_8) || \
  615. ((LIMIT) == ETH_BackOffLimit_4) || \
  616. ((LIMIT) == ETH_BackOffLimit_1))
  617. /**
  618. * @}
  619. */
  620. /** @defgroup ETH_Deferral_Check
  621. * @{
  622. */
  623. #define ETH_DeferralCheck_Enable ((uint32_t)0x00000010)
  624. #define ETH_DeferralCheck_Disable ((uint32_t)0x00000000)
  625. #define IS_ETH_DEFERRAL_CHECK(CMD) (((CMD) == ETH_DeferralCheck_Enable) || \
  626. ((CMD) == ETH_DeferralCheck_Disable))
  627. /**
  628. * @}
  629. */
  630. /** @defgroup ETH_Receive_All
  631. * @{
  632. */
  633. #define ETH_ReceiveAll_Enable ((uint32_t)0x80000000)
  634. #define ETH_ReceiveAll_Disable ((uint32_t)0x00000000)
  635. #define IS_ETH_RECEIVE_ALL(CMD) (((CMD) == ETH_ReceiveAll_Enable) || \
  636. ((CMD) == ETH_ReceiveAll_Disable))
  637. /**
  638. * @}
  639. */
  640. /** @defgroup ETH_Source_Addr_Filter
  641. * @{
  642. */
  643. #define ETH_SourceAddrFilter_Normal_Enable ((uint32_t)0x00000200)
  644. #define ETH_SourceAddrFilter_Inverse_Enable ((uint32_t)0x00000300)
  645. #define ETH_SourceAddrFilter_Disable ((uint32_t)0x00000000)
  646. #define IS_ETH_SOURCE_ADDR_FILTER(CMD) (((CMD) == ETH_SourceAddrFilter_Normal_Enable) || \
  647. ((CMD) == ETH_SourceAddrFilter_Inverse_Enable) || \
  648. ((CMD) == ETH_SourceAddrFilter_Disable))
  649. /**
  650. * @}
  651. */
  652. /** @defgroup ETH_Pass_Control_Frames
  653. * @{
  654. */
  655. #define ETH_PassControlFrames_BlockAll ((uint32_t)0x00000040) /*!< MAC filters all control frames from reaching the application */
  656. #define ETH_PassControlFrames_ForwardAll ((uint32_t)0x00000080) /*!< MAC forwards all control frames to application even if they fail the Address Filter */
  657. #define ETH_PassControlFrames_ForwardPassedAddrFilter ((uint32_t)0x000000C0) /*!< MAC forwards control frames that pass the Address Filter. */
  658. #define IS_ETH_CONTROL_FRAMES(PASS) (((PASS) == ETH_PassControlFrames_BlockAll) || \
  659. ((PASS) == ETH_PassControlFrames_ForwardAll) || \
  660. ((PASS) == ETH_PassControlFrames_ForwardPassedAddrFilter))
  661. /**
  662. * @}
  663. */
  664. /** @defgroup ETH_Broadcast_Frames_Reception
  665. * @{
  666. */
  667. #define ETH_BroadcastFramesReception_Enable ((uint32_t)0x00000000)
  668. #define ETH_BroadcastFramesReception_Disable ((uint32_t)0x00000020)
  669. #define IS_ETH_BROADCAST_FRAMES_RECEPTION(CMD) (((CMD) == ETH_BroadcastFramesReception_Enable) || \
  670. ((CMD) == ETH_BroadcastFramesReception_Disable))
  671. /**
  672. * @}
  673. */
  674. /** @defgroup ETH_Destination_Addr_Filter
  675. * @{
  676. */
  677. #define ETH_DestinationAddrFilter_Normal ((uint32_t)0x00000000)
  678. #define ETH_DestinationAddrFilter_Inverse ((uint32_t)0x00000008)
  679. #define IS_ETH_DESTINATION_ADDR_FILTER(FILTER) (((FILTER) == ETH_DestinationAddrFilter_Normal) || \
  680. ((FILTER) == ETH_DestinationAddrFilter_Inverse))
  681. /**
  682. * @}
  683. */
  684. /** @defgroup ETH_Promiscuous_Mode
  685. * @{
  686. */
  687. #define ETH_PromiscuousMode_Enable ((uint32_t)0x00000001)
  688. #define ETH_PromiscuousMode_Disable ((uint32_t)0x00000000)
  689. #define IS_ETH_PROMISCUOUS_MODE(CMD) (((CMD) == ETH_PromiscuousMode_Enable) || \
  690. ((CMD) == ETH_PromiscuousMode_Disable))
  691. /**
  692. * @}
  693. */
  694. /** @defgroup ETH_Multicast_Frames_Filter
  695. * @{
  696. */
  697. #define ETH_MulticastFramesFilter_PerfectHashTable ((uint32_t)0x00000404)
  698. #define ETH_MulticastFramesFilter_HashTable ((uint32_t)0x00000004)
  699. #define ETH_MulticastFramesFilter_Perfect ((uint32_t)0x00000000)
  700. #define ETH_MulticastFramesFilter_None ((uint32_t)0x00000010)
  701. #define IS_ETH_MULTICAST_FRAMES_FILTER(FILTER) (((FILTER) == ETH_MulticastFramesFilter_PerfectHashTable) || \
  702. ((FILTER) == ETH_MulticastFramesFilter_HashTable) || \
  703. ((FILTER) == ETH_MulticastFramesFilter_Perfect) || \
  704. ((FILTER) == ETH_MulticastFramesFilter_None))
  705. /**
  706. * @}
  707. */
  708. /** @defgroup ETH_Unicast_Frames_Filter
  709. * @{
  710. */
  711. #define ETH_UnicastFramesFilter_PerfectHashTable ((uint32_t)0x00000402)
  712. #define ETH_UnicastFramesFilter_HashTable ((uint32_t)0x00000002)
  713. #define ETH_UnicastFramesFilter_Perfect ((uint32_t)0x00000000)
  714. #define IS_ETH_UNICAST_FRAMES_FILTER(FILTER) (((FILTER) == ETH_UnicastFramesFilter_PerfectHashTable) || \
  715. ((FILTER) == ETH_UnicastFramesFilter_HashTable) || \
  716. ((FILTER) == ETH_UnicastFramesFilter_Perfect))
  717. /**
  718. * @}
  719. */
  720. /** @defgroup ETH_Pause_Time
  721. * @{
  722. */
  723. #define IS_ETH_PAUSE_TIME(TIME) ((TIME) <= 0xFFFF)
  724. /**
  725. * @}
  726. */
  727. /** @defgroup ETH_Zero_Quanta_Pause
  728. * @{
  729. */
  730. #define ETH_ZeroQuantaPause_Enable ((uint32_t)0x00000000)
  731. #define ETH_ZeroQuantaPause_Disable ((uint32_t)0x00000080)
  732. #define IS_ETH_ZEROQUANTA_PAUSE(CMD) (((CMD) == ETH_ZeroQuantaPause_Enable) || \
  733. ((CMD) == ETH_ZeroQuantaPause_Disable))
  734. /**
  735. * @}
  736. */
  737. /** @defgroup ETH_Pause_Low_Threshold
  738. * @{
  739. */
  740. #define ETH_PauseLowThreshold_Minus4 ((uint32_t)0x00000000) /*!< Pause time minus 4 slot times */
  741. #define ETH_PauseLowThreshold_Minus28 ((uint32_t)0x00000010) /*!< Pause time minus 28 slot times */
  742. #define ETH_PauseLowThreshold_Minus144 ((uint32_t)0x00000020) /*!< Pause time minus 144 slot times */
  743. #define ETH_PauseLowThreshold_Minus256 ((uint32_t)0x00000030) /*!< Pause time minus 256 slot times */
  744. #define IS_ETH_PAUSE_LOW_THRESHOLD(THRESHOLD) (((THRESHOLD) == ETH_PauseLowThreshold_Minus4) || \
  745. ((THRESHOLD) == ETH_PauseLowThreshold_Minus28) || \
  746. ((THRESHOLD) == ETH_PauseLowThreshold_Minus144) || \
  747. ((THRESHOLD) == ETH_PauseLowThreshold_Minus256))
  748. /**
  749. * @}
  750. */
  751. /** @defgroup ETH_Unicast_Pause_Frame_Detect
  752. * @{
  753. */
  754. #define ETH_UnicastPauseFrameDetect_Enable ((uint32_t)0x00000008)
  755. #define ETH_UnicastPauseFrameDetect_Disable ((uint32_t)0x00000000)
  756. #define IS_ETH_UNICAST_PAUSE_FRAME_DETECT(CMD) (((CMD) == ETH_UnicastPauseFrameDetect_Enable) || \
  757. ((CMD) == ETH_UnicastPauseFrameDetect_Disable))
  758. /**
  759. * @}
  760. */
  761. /** @defgroup ETH_Receive_Flow_Control
  762. * @{
  763. */
  764. #define ETH_ReceiveFlowControl_Enable ((uint32_t)0x00000004)
  765. #define ETH_ReceiveFlowControl_Disable ((uint32_t)0x00000000)
  766. #define IS_ETH_RECEIVE_FLOWCONTROL(CMD) (((CMD) == ETH_ReceiveFlowControl_Enable) || \
  767. ((CMD) == ETH_ReceiveFlowControl_Disable))
  768. /**
  769. * @}
  770. */
  771. /** @defgroup ETH_Transmit_Flow_Control
  772. * @{
  773. */
  774. #define ETH_TransmitFlowControl_Enable ((uint32_t)0x00000002)
  775. #define ETH_TransmitFlowControl_Disable ((uint32_t)0x00000000)
  776. #define IS_ETH_TRANSMIT_FLOWCONTROL(CMD) (((CMD) == ETH_TransmitFlowControl_Enable) || \
  777. ((CMD) == ETH_TransmitFlowControl_Disable))
  778. /**
  779. * @}
  780. */
  781. /** @defgroup ETH_VLAN_Tag_Comparison
  782. * @{
  783. */
  784. #define ETH_VLANTagComparison_12Bit ((uint32_t)0x00010000)
  785. #define ETH_VLANTagComparison_16Bit ((uint32_t)0x00000000)
  786. #define IS_ETH_VLAN_TAG_COMPARISON(COMPARISON) (((COMPARISON) == ETH_VLANTagComparison_12Bit) || \
  787. ((COMPARISON) == ETH_VLANTagComparison_16Bit))
  788. #define IS_ETH_VLAN_TAG_IDENTIFIER(IDENTIFIER) ((IDENTIFIER) <= 0xFFFF)
  789. /**
  790. * @}
  791. */
  792. /** @defgroup ETH_MAC_Flags
  793. * @{
  794. */
  795. #define ETH_MAC_FLAG_TST ((uint32_t)0x00000200) /*!< Time stamp trigger flag (on MAC) */
  796. #define ETH_MAC_FLAG_MMCT ((uint32_t)0x00000040) /*!< MMC transmit flag */
  797. #define ETH_MAC_FLAG_MMCR ((uint32_t)0x00000020) /*!< MMC receive flag */
  798. #define ETH_MAC_FLAG_MMC ((uint32_t)0x00000010) /*!< MMC flag (on MAC) */
  799. #define ETH_MAC_FLAG_PMT ((uint32_t)0x00000008) /*!< PMT flag (on MAC) */
  800. #define IS_ETH_MAC_GET_FLAG(FLAG) (((FLAG) == ETH_MAC_FLAG_TST) || ((FLAG) == ETH_MAC_FLAG_MMCT) || \
  801. ((FLAG) == ETH_MAC_FLAG_MMCR) || ((FLAG) == ETH_MAC_FLAG_MMC) || \
  802. ((FLAG) == ETH_MAC_FLAG_PMT))
  803. /**
  804. * @}
  805. */
  806. /** @defgroup ETH_MAC_Interrupts
  807. * @{
  808. */
  809. #define ETH_MAC_IT_TST ((uint32_t)0x00000200) /*!< Time stamp trigger interrupt (on MAC) */
  810. #define ETH_MAC_IT_MMCT ((uint32_t)0x00000040) /*!< MMC transmit interrupt */
  811. #define ETH_MAC_IT_MMCR ((uint32_t)0x00000020) /*!< MMC receive interrupt */
  812. #define ETH_MAC_IT_MMC ((uint32_t)0x00000010) /*!< MMC interrupt (on MAC) */
  813. #define ETH_MAC_IT_PMT ((uint32_t)0x00000008) /*!< PMT interrupt (on MAC) */
  814. #define IS_ETH_MAC_IT(IT) ((((IT) & (uint32_t)0xFFFFFDF7) == 0x00) && ((IT) != 0x00))
  815. #define IS_ETH_MAC_GET_IT(IT) (((IT) == ETH_MAC_IT_TST) || ((IT) == ETH_MAC_IT_MMCT) || \
  816. ((IT) == ETH_MAC_IT_MMCR) || ((IT) == ETH_MAC_IT_MMC) || \
  817. ((IT) == ETH_MAC_IT_PMT))
  818. /**
  819. * @}
  820. */
  821. /** @defgroup ETH_MAC_addresses
  822. * @{
  823. */
  824. #define ETH_MAC_Address0 ((uint32_t)0x00000000)
  825. #define ETH_MAC_Address1 ((uint32_t)0x00000008)
  826. #define ETH_MAC_Address2 ((uint32_t)0x00000010)
  827. #define ETH_MAC_Address3 ((uint32_t)0x00000018)
  828. #define IS_ETH_MAC_ADDRESS0123(ADDRESS) (((ADDRESS) == ETH_MAC_Address0) || \
  829. ((ADDRESS) == ETH_MAC_Address1) || \
  830. ((ADDRESS) == ETH_MAC_Address2) || \
  831. ((ADDRESS) == ETH_MAC_Address3))
  832. #define IS_ETH_MAC_ADDRESS123(ADDRESS) (((ADDRESS) == ETH_MAC_Address1) || \
  833. ((ADDRESS) == ETH_MAC_Address2) || \
  834. ((ADDRESS) == ETH_MAC_Address3))
  835. /**
  836. * @}
  837. */
  838. /** @defgroup ETH_MAC_addresses_filter_SA_DA_filed_of_received_frames
  839. * @{
  840. */
  841. #define ETH_MAC_AddressFilter_SA ((uint32_t)0x00000000)
  842. #define ETH_MAC_AddressFilter_DA ((uint32_t)0x00000008)
  843. #define IS_ETH_MAC_ADDRESS_FILTER(FILTER) (((FILTER) == ETH_MAC_AddressFilter_SA) || \
  844. ((FILTER) == ETH_MAC_AddressFilter_DA))
  845. /**
  846. * @}
  847. */
  848. /** @defgroup ETH_MAC_addresses_filter_Mask_bytes
  849. * @{
  850. */
  851. #define ETH_MAC_AddressMask_Byte6 ((uint32_t)0x20000000) /*!< Mask MAC Address high reg bits [15:8] */
  852. #define ETH_MAC_AddressMask_Byte5 ((uint32_t)0x10000000) /*!< Mask MAC Address high reg bits [7:0] */
  853. #define ETH_MAC_AddressMask_Byte4 ((uint32_t)0x08000000) /*!< Mask MAC Address low reg bits [31:24] */
  854. #define ETH_MAC_AddressMask_Byte3 ((uint32_t)0x04000000) /*!< Mask MAC Address low reg bits [23:16] */
  855. #define ETH_MAC_AddressMask_Byte2 ((uint32_t)0x02000000) /*!< Mask MAC Address low reg bits [15:8] */
  856. #define ETH_MAC_AddressMask_Byte1 ((uint32_t)0x01000000) /*!< Mask MAC Address low reg bits [70] */
  857. #define IS_ETH_MAC_ADDRESS_MASK(MASK) (((MASK) == ETH_MAC_AddressMask_Byte6) || \
  858. ((MASK) == ETH_MAC_AddressMask_Byte5) || \
  859. ((MASK) == ETH_MAC_AddressMask_Byte4) || \
  860. ((MASK) == ETH_MAC_AddressMask_Byte3) || \
  861. ((MASK) == ETH_MAC_AddressMask_Byte2) || \
  862. ((MASK) == ETH_MAC_AddressMask_Byte1))
  863. /**--------------------------------------------------------------------------**/
  864. /**
  865. * @brief Ethernet DMA Desciptors defines
  866. */
  867. /**--------------------------------------------------------------------------**/
  868. /**
  869. * @}
  870. */
  871. /** @defgroup ETH_DMA_Tx_descriptor_flags
  872. * @{
  873. */
  874. #define IS_ETH_DMATxDESC_GET_FLAG(FLAG) (((FLAG) == ETH_DMATxDesc_OWN) || \
  875. ((FLAG) == ETH_DMATxDesc_IC) || \
  876. ((FLAG) == ETH_DMATxDesc_LS) || \
  877. ((FLAG) == ETH_DMATxDesc_FS) || \
  878. ((FLAG) == ETH_DMATxDesc_DC) || \
  879. ((FLAG) == ETH_DMATxDesc_DP) || \
  880. ((FLAG) == ETH_DMATxDesc_TTSE) || \
  881. ((FLAG) == ETH_DMATxDesc_TER) || \
  882. ((FLAG) == ETH_DMATxDesc_TCH) || \
  883. ((FLAG) == ETH_DMATxDesc_TTSS) || \
  884. ((FLAG) == ETH_DMATxDesc_IHE) || \
  885. ((FLAG) == ETH_DMATxDesc_ES) || \
  886. ((FLAG) == ETH_DMATxDesc_JT) || \
  887. ((FLAG) == ETH_DMATxDesc_FF) || \
  888. ((FLAG) == ETH_DMATxDesc_PCE) || \
  889. ((FLAG) == ETH_DMATxDesc_LCA) || \
  890. ((FLAG) == ETH_DMATxDesc_NC) || \
  891. ((FLAG) == ETH_DMATxDesc_LCO) || \
  892. ((FLAG) == ETH_DMATxDesc_EC) || \
  893. ((FLAG) == ETH_DMATxDesc_VF) || \
  894. ((FLAG) == ETH_DMATxDesc_CC) || \
  895. ((FLAG) == ETH_DMATxDesc_ED) || \
  896. ((FLAG) == ETH_DMATxDesc_UF) || \
  897. ((FLAG) == ETH_DMATxDesc_DB))
  898. /**
  899. * @}
  900. */
  901. /** @defgroup ETH_DMA_Tx_descriptor_segment
  902. * @{
  903. */
  904. #define ETH_DMATxDesc_LastSegment ((uint32_t)0x40000000) /*!< Last Segment */
  905. #define ETH_DMATxDesc_FirstSegment ((uint32_t)0x20000000) /*!< First Segment */
  906. #define IS_ETH_DMA_TXDESC_SEGMENT(SEGMENT) (((SEGMENT) == ETH_DMATxDesc_LastSegment) || \
  907. ((SEGMENT) == ETH_DMATxDesc_FirstSegment))
  908. /**
  909. * @}
  910. */
  911. /** @defgroup ETH_DMA_Tx_descriptor_Checksum_Insertion_Control
  912. * @{
  913. */
  914. #define ETH_DMATxDesc_ChecksumByPass ((uint32_t)0x00000000) /*!< Checksum engine bypass */
  915. #define ETH_DMATxDesc_ChecksumIPV4Header ((uint32_t)0x00400000) /*!< IPv4 header checksum insertion */
  916. #define ETH_DMATxDesc_ChecksumTCPUDPICMPSegment ((uint32_t)0x00800000) /*!< TCP/UDP/ICMP checksum insertion. Pseudo header checksum is assumed to be present */
  917. #define ETH_DMATxDesc_ChecksumTCPUDPICMPFull ((uint32_t)0x00C00000) /*!< TCP/UDP/ICMP checksum fully in hardware including pseudo header */
  918. #define IS_ETH_DMA_TXDESC_CHECKSUM(CHECKSUM) (((CHECKSUM) == ETH_DMATxDesc_ChecksumByPass) || \
  919. ((CHECKSUM) == ETH_DMATxDesc_ChecksumIPV4Header) || \
  920. ((CHECKSUM) == ETH_DMATxDesc_ChecksumTCPUDPICMPSegment) || \
  921. ((CHECKSUM) == ETH_DMATxDesc_ChecksumTCPUDPICMPFull))
  922. /**
  923. * @brief ETH DMA Tx Desciptor buffer size
  924. */
  925. #define IS_ETH_DMATxDESC_BUFFER_SIZE(SIZE) ((SIZE) <= 0x1FFF)
  926. /**
  927. * @}
  928. */
  929. /** @defgroup ETH_DMA_Rx_descriptor_flags
  930. * @{
  931. */
  932. #define IS_ETH_DMARxDESC_GET_FLAG(FLAG) (((FLAG) == ETH_DMARxDesc_OWN) || \
  933. ((FLAG) == ETH_DMARxDesc_AFM) || \
  934. ((FLAG) == ETH_DMARxDesc_ES) || \
  935. ((FLAG) == ETH_DMARxDesc_DE) || \
  936. ((FLAG) == ETH_DMARxDesc_SAF) || \
  937. ((FLAG) == ETH_DMARxDesc_LE) || \
  938. ((FLAG) == ETH_DMARxDesc_OE) || \
  939. ((FLAG) == ETH_DMARxDesc_VLAN) || \
  940. ((FLAG) == ETH_DMARxDesc_FS) || \
  941. ((FLAG) == ETH_DMARxDesc_LS) || \
  942. ((FLAG) == ETH_DMARxDesc_IPV4HCE) || \
  943. ((FLAG) == ETH_DMARxDesc_LC) || \
  944. ((FLAG) == ETH_DMARxDesc_FT) || \
  945. ((FLAG) == ETH_DMARxDesc_RWT) || \
  946. ((FLAG) == ETH_DMARxDesc_RE) || \
  947. ((FLAG) == ETH_DMARxDesc_DBE) || \
  948. ((FLAG) == ETH_DMARxDesc_CE) || \
  949. ((FLAG) == ETH_DMARxDesc_MAMPCE))
  950. /* ETHERNET DMA PTP Rx descriptor extended flags --------------------------------*/
  951. #define IS_ETH_DMAPTPRxDESC_GET_EXTENDED_FLAG(FLAG) (((FLAG) == ETH_DMAPTPRxDesc_PTPV) || \
  952. ((FLAG) == ETH_DMAPTPRxDesc_PTPFT) || \
  953. ((FLAG) == ETH_DMAPTPRxDesc_PTPMT) || \
  954. ((FLAG) == ETH_DMAPTPRxDesc_IPV6PR) || \
  955. ((FLAG) == ETH_DMAPTPRxDesc_IPV4PR) || \
  956. ((FLAG) == ETH_DMAPTPRxDesc_IPCB) || \
  957. ((FLAG) == ETH_DMAPTPRxDesc_IPPE) || \
  958. ((FLAG) == ETH_DMAPTPRxDesc_IPHE) || \
  959. ((FLAG) == ETH_DMAPTPRxDesc_IPPT))
  960. /**
  961. * @}
  962. */
  963. /** @defgroup ETH_DMA_Rx_descriptor_buffers_
  964. * @{
  965. */
  966. #define ETH_DMARxDesc_Buffer1 ((uint32_t)0x00000000) /*!< DMA Rx Desc Buffer1 */
  967. #define ETH_DMARxDesc_Buffer2 ((uint32_t)0x00000001) /*!< DMA Rx Desc Buffer2 */
  968. #define IS_ETH_DMA_RXDESC_BUFFER(BUFFER) (((BUFFER) == ETH_DMARxDesc_Buffer1) || \
  969. ((BUFFER) == ETH_DMARxDesc_Buffer2))
  970. /**--------------------------------------------------------------------------**/
  971. /**
  972. * @brief Ethernet DMA defines
  973. */
  974. /**--------------------------------------------------------------------------**/
  975. /**
  976. * @}
  977. */
  978. /** @defgroup ETH_Drop_TCP_IP_Checksum_Error_Frame
  979. * @{
  980. */
  981. #define ETH_DropTCPIPChecksumErrorFrame_Enable ((uint32_t)0x00000000)
  982. #define ETH_DropTCPIPChecksumErrorFrame_Disable ((uint32_t)0x04000000)
  983. #define IS_ETH_DROP_TCPIP_CHECKSUM_FRAME(CMD) (((CMD) == ETH_DropTCPIPChecksumErrorFrame_Enable) || \
  984. ((CMD) == ETH_DropTCPIPChecksumErrorFrame_Disable))
  985. /**
  986. * @}
  987. */
  988. /** @defgroup ETH_Receive_Store_Forward
  989. * @{
  990. */
  991. #define ETH_ReceiveStoreForward_Enable ((uint32_t)0x02000000)
  992. #define ETH_ReceiveStoreForward_Disable ((uint32_t)0x00000000)
  993. #define IS_ETH_RECEIVE_STORE_FORWARD(CMD) (((CMD) == ETH_ReceiveStoreForward_Enable) || \
  994. ((CMD) == ETH_ReceiveStoreForward_Disable))
  995. /**
  996. * @}
  997. */
  998. /** @defgroup ETH_Flush_Received_Frame
  999. * @{
  1000. */
  1001. #define ETH_FlushReceivedFrame_Enable ((uint32_t)0x00000000)
  1002. #define ETH_FlushReceivedFrame_Disable ((uint32_t)0x01000000)
  1003. #define IS_ETH_FLUSH_RECEIVE_FRAME(CMD) (((CMD) == ETH_FlushReceivedFrame_Enable) || \
  1004. ((CMD) == ETH_FlushReceivedFrame_Disable))
  1005. /**
  1006. * @}
  1007. */
  1008. /** @defgroup ETH_Transmit_Store_Forward
  1009. * @{
  1010. */
  1011. #define ETH_TransmitStoreForward_Enable ((uint32_t)0x00200000)
  1012. #define ETH_TransmitStoreForward_Disable ((uint32_t)0x00000000)
  1013. #define IS_ETH_TRANSMIT_STORE_FORWARD(CMD) (((CMD) == ETH_TransmitStoreForward_Enable) || \
  1014. ((CMD) == ETH_TransmitStoreForward_Disable))
  1015. /**
  1016. * @}
  1017. */
  1018. /** @defgroup ETH_Transmit_Threshold_Control
  1019. * @{
  1020. */
  1021. #define ETH_TransmitThresholdControl_64Bytes ((uint32_t)0x00000000) /*!< threshold level of the MTL Transmit FIFO is 64 Bytes */
  1022. #define ETH_TransmitThresholdControl_128Bytes ((uint32_t)0x00004000) /*!< threshold level of the MTL Transmit FIFO is 128 Bytes */
  1023. #define ETH_TransmitThresholdControl_192Bytes ((uint32_t)0x00008000) /*!< threshold level of the MTL Transmit FIFO is 192 Bytes */
  1024. #define ETH_TransmitThresholdControl_256Bytes ((uint32_t)0x0000C000) /*!< threshold level of the MTL Transmit FIFO is 256 Bytes */
  1025. #define ETH_TransmitThresholdControl_40Bytes ((uint32_t)0x00010000) /*!< threshold level of the MTL Transmit FIFO is 40 Bytes */
  1026. #define ETH_TransmitThresholdControl_32Bytes ((uint32_t)0x00014000) /*!< threshold level of the MTL Transmit FIFO is 32 Bytes */
  1027. #define ETH_TransmitThresholdControl_24Bytes ((uint32_t)0x00018000) /*!< threshold level of the MTL Transmit FIFO is 24 Bytes */
  1028. #define ETH_TransmitThresholdControl_16Bytes ((uint32_t)0x0001C000) /*!< threshold level of the MTL Transmit FIFO is 16 Bytes */
  1029. #define IS_ETH_TRANSMIT_THRESHOLD_CONTROL(THRESHOLD) (((THRESHOLD) == ETH_TransmitThresholdControl_64Bytes) || \
  1030. ((THRESHOLD) == ETH_TransmitThresholdControl_128Bytes) || \
  1031. ((THRESHOLD) == ETH_TransmitThresholdControl_192Bytes) || \
  1032. ((THRESHOLD) == ETH_TransmitThresholdControl_256Bytes) || \
  1033. ((THRESHOLD) == ETH_TransmitThresholdControl_40Bytes) || \
  1034. ((THRESHOLD) == ETH_TransmitThresholdControl_32Bytes) || \
  1035. ((THRESHOLD) == ETH_TransmitThresholdControl_24Bytes) || \
  1036. ((THRESHOLD) == ETH_TransmitThresholdControl_16Bytes))
  1037. /**
  1038. * @}
  1039. */
  1040. /** @defgroup ETH_Forward_Error_Frames
  1041. * @{
  1042. */
  1043. #define ETH_ForwardErrorFrames_Enable ((uint32_t)0x00000080)
  1044. #define ETH_ForwardErrorFrames_Disable ((uint32_t)0x00000000)
  1045. #define IS_ETH_FORWARD_ERROR_FRAMES(CMD) (((CMD) == ETH_ForwardErrorFrames_Enable) || \
  1046. ((CMD) == ETH_ForwardErrorFrames_Disable))
  1047. /**
  1048. * @}
  1049. */
  1050. /** @defgroup ETH_Forward_Undersized_Good_Frames
  1051. * @{
  1052. */
  1053. #define ETH_ForwardUndersizedGoodFrames_Enable ((uint32_t)0x00000040)
  1054. #define ETH_ForwardUndersizedGoodFrames_Disable ((uint32_t)0x00000000)
  1055. #define IS_ETH_FORWARD_UNDERSIZED_GOOD_FRAMES(CMD) (((CMD) == ETH_ForwardUndersizedGoodFrames_Enable) || \
  1056. ((CMD) == ETH_ForwardUndersizedGoodFrames_Disable))
  1057. /**
  1058. * @}
  1059. */
  1060. /** @defgroup ETH_Receive_Threshold_Control
  1061. * @{
  1062. */
  1063. #define ETH_ReceiveThresholdControl_64Bytes ((uint32_t)0x00000000) /*!< threshold level of the MTL Receive FIFO is 64 Bytes */
  1064. #define ETH_ReceiveThresholdControl_32Bytes ((uint32_t)0x00000008) /*!< threshold level of the MTL Receive FIFO is 32 Bytes */
  1065. #define ETH_ReceiveThresholdControl_96Bytes ((uint32_t)0x00000010) /*!< threshold level of the MTL Receive FIFO is 96 Bytes */
  1066. #define ETH_ReceiveThresholdControl_128Bytes ((uint32_t)0x00000018) /*!< threshold level of the MTL Receive FIFO is 128 Bytes */
  1067. #define IS_ETH_RECEIVE_THRESHOLD_CONTROL(THRESHOLD) (((THRESHOLD) == ETH_ReceiveThresholdControl_64Bytes) || \
  1068. ((THRESHOLD) == ETH_ReceiveThresholdControl_32Bytes) || \
  1069. ((THRESHOLD) == ETH_ReceiveThresholdControl_96Bytes) || \
  1070. ((THRESHOLD) == ETH_ReceiveThresholdControl_128Bytes))
  1071. /**
  1072. * @}
  1073. */
  1074. /** @defgroup ETH_Second_Frame_Operate
  1075. * @{
  1076. */
  1077. #define ETH_SecondFrameOperate_Enable ((uint32_t)0x00000004)
  1078. #define ETH_SecondFrameOperate_Disable ((uint32_t)0x00000000)
  1079. #define IS_ETH_SECOND_FRAME_OPERATE(CMD) (((CMD) == ETH_SecondFrameOperate_Enable) || \
  1080. ((CMD) == ETH_SecondFrameOperate_Disable))
  1081. /**
  1082. * @}
  1083. */
  1084. /** @defgroup ETH_Address_Aligned_Beats
  1085. * @{
  1086. */
  1087. #define ETH_AddressAlignedBeats_Enable ((uint32_t)0x02000000)
  1088. #define ETH_AddressAlignedBeats_Disable ((uint32_t)0x00000000)
  1089. #define IS_ETH_ADDRESS_ALIGNED_BEATS(CMD) (((CMD) == ETH_AddressAlignedBeats_Enable) || \
  1090. ((CMD) == ETH_AddressAlignedBeats_Disable))
  1091. /**
  1092. * @}
  1093. */
  1094. /** @defgroup ETH_Fixed_Burst
  1095. * @{
  1096. */
  1097. #define ETH_FixedBurst_Enable ((uint32_t)0x00010000)
  1098. #define ETH_FixedBurst_Disable ((uint32_t)0x00000000)
  1099. #define IS_ETH_FIXED_BURST(CMD) (((CMD) == ETH_FixedBurst_Enable) || \
  1100. ((CMD) == ETH_FixedBurst_Disable))
  1101. /**
  1102. * @}
  1103. */
  1104. /** @defgroup ETH_Rx_DMA_Burst_Length
  1105. * @{
  1106. */
  1107. #define ETH_RxDMABurstLength_1Beat ((uint32_t)0x00020000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 1 */
  1108. #define ETH_RxDMABurstLength_2Beat ((uint32_t)0x00040000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 2 */
  1109. #define ETH_RxDMABurstLength_4Beat ((uint32_t)0x00080000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 4 */
  1110. #define ETH_RxDMABurstLength_8Beat ((uint32_t)0x00100000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 8 */
  1111. #define ETH_RxDMABurstLength_16Beat ((uint32_t)0x00200000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 16 */
  1112. #define ETH_RxDMABurstLength_32Beat ((uint32_t)0x00400000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 32 */
  1113. #define ETH_RxDMABurstLength_4xPBL_4Beat ((uint32_t)0x01020000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 4 */
  1114. #define ETH_RxDMABurstLength_4xPBL_8Beat ((uint32_t)0x01040000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 8 */
  1115. #define ETH_RxDMABurstLength_4xPBL_16Beat ((uint32_t)0x01080000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 16 */
  1116. #define ETH_RxDMABurstLength_4xPBL_32Beat ((uint32_t)0x01100000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 32 */
  1117. #define ETH_RxDMABurstLength_4xPBL_64Beat ((uint32_t)0x01200000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 64 */
  1118. #define ETH_RxDMABurstLength_4xPBL_128Beat ((uint32_t)0x01400000) /*!< maximum number of beats to be transferred in one RxDMA transaction is 128 */
  1119. #define IS_ETH_RXDMA_BURST_LENGTH(LENGTH) (((LENGTH) == ETH_RxDMABurstLength_1Beat) || \
  1120. ((LENGTH) == ETH_RxDMABurstLength_2Beat) || \
  1121. ((LENGTH) == ETH_RxDMABurstLength_4Beat) || \
  1122. ((LENGTH) == ETH_RxDMABurstLength_8Beat) || \
  1123. ((LENGTH) == ETH_RxDMABurstLength_16Beat) || \
  1124. ((LENGTH) == ETH_RxDMABurstLength_32Beat) || \
  1125. ((LENGTH) == ETH_RxDMABurstLength_4xPBL_4Beat) || \
  1126. ((LENGTH) == ETH_RxDMABurstLength_4xPBL_8Beat) || \
  1127. ((LENGTH) == ETH_RxDMABurstLength_4xPBL_16Beat) || \
  1128. ((LENGTH) == ETH_RxDMABurstLength_4xPBL_32Beat) || \
  1129. ((LENGTH) == ETH_RxDMABurstLength_4xPBL_64Beat) || \
  1130. ((LENGTH) == ETH_RxDMABurstLength_4xPBL_128Beat))
  1131. /**
  1132. * @}
  1133. */
  1134. /** @defgroup ETH_Tx_DMA_Burst_Length
  1135. * @{
  1136. */
  1137. #define ETH_TxDMABurstLength_1Beat ((uint32_t)0x00000100) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 1 */
  1138. #define ETH_TxDMABurstLength_2Beat ((uint32_t)0x00000200) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 2 */
  1139. #define ETH_TxDMABurstLength_4Beat ((uint32_t)0x00000400) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 4 */
  1140. #define ETH_TxDMABurstLength_8Beat ((uint32_t)0x00000800) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 8 */
  1141. #define ETH_TxDMABurstLength_16Beat ((uint32_t)0x00001000) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 16 */
  1142. #define ETH_TxDMABurstLength_32Beat ((uint32_t)0x00002000) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 32 */
  1143. #define ETH_TxDMABurstLength_4xPBL_4Beat ((uint32_t)0x01000100) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 4 */
  1144. #define ETH_TxDMABurstLength_4xPBL_8Beat ((uint32_t)0x01000200) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 8 */
  1145. #define ETH_TxDMABurstLength_4xPBL_16Beat ((uint32_t)0x01000400) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 16 */
  1146. #define ETH_TxDMABurstLength_4xPBL_32Beat ((uint32_t)0x01000800) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 32 */
  1147. #define ETH_TxDMABurstLength_4xPBL_64Beat ((uint32_t)0x01001000) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 64 */
  1148. #define ETH_TxDMABurstLength_4xPBL_128Beat ((uint32_t)0x01002000) /*!< maximum number of beats to be transferred in one TxDMA (or both) transaction is 128 */
  1149. #define IS_ETH_TXDMA_BURST_LENGTH(LENGTH) (((LENGTH) == ETH_TxDMABurstLength_1Beat) || \
  1150. ((LENGTH) == ETH_TxDMABurstLength_2Beat) || \
  1151. ((LENGTH) == ETH_TxDMABurstLength_4Beat) || \
  1152. ((LENGTH) == ETH_TxDMABurstLength_8Beat) || \
  1153. ((LENGTH) == ETH_TxDMABurstLength_16Beat) || \
  1154. ((LENGTH) == ETH_TxDMABurstLength_32Beat) || \
  1155. ((LENGTH) == ETH_TxDMABurstLength_4xPBL_4Beat) || \
  1156. ((LENGTH) == ETH_TxDMABurstLength_4xPBL_8Beat) || \
  1157. ((LENGTH) == ETH_TxDMABurstLength_4xPBL_16Beat) || \
  1158. ((LENGTH) == ETH_TxDMABurstLength_4xPBL_32Beat) || \
  1159. ((LENGTH) == ETH_TxDMABurstLength_4xPBL_64Beat) || \
  1160. ((LENGTH) == ETH_TxDMABurstLength_4xPBL_128Beat))
  1161. /**
  1162. * @brief ETH DMA Desciptor SkipLength
  1163. */
  1164. #define IS_ETH_DMA_DESC_SKIP_LENGTH(LENGTH) ((LENGTH) <= 0x1F)
  1165. /**
  1166. * @}
  1167. */
  1168. /** @defgroup ETH_DMA_Arbitration
  1169. * @{
  1170. */
  1171. #define ETH_DMAArbitration_RoundRobin_RxTx_1_1 ((uint32_t)0x00000000)
  1172. #define ETH_DMAArbitration_RoundRobin_RxTx_2_1 ((uint32_t)0x00004000)
  1173. #define ETH_DMAArbitration_RoundRobin_RxTx_3_1 ((uint32_t)0x00008000)
  1174. #define ETH_DMAArbitration_RoundRobin_RxTx_4_1 ((uint32_t)0x0000C000)
  1175. #define ETH_DMAArbitration_RxPriorTx ((uint32_t)0x00000002)
  1176. #define IS_ETH_DMA_ARBITRATION_ROUNDROBIN_RXTX(RATIO) (((RATIO) == ETH_DMAArbitration_RoundRobin_RxTx_1_1) || \
  1177. ((RATIO) == ETH_DMAArbitration_RoundRobin_RxTx_2_1) || \
  1178. ((RATIO) == ETH_DMAArbitration_RoundRobin_RxTx_3_1) || \
  1179. ((RATIO) == ETH_DMAArbitration_RoundRobin_RxTx_4_1) || \
  1180. ((RATIO) == ETH_DMAArbitration_RxPriorTx))
  1181. /**
  1182. * @}
  1183. */
  1184. /** @defgroup ETH_DMA_Flags
  1185. * @{
  1186. */
  1187. #define ETH_DMA_FLAG_TST ((uint32_t)0x20000000) /*!< Time-stamp trigger interrupt (on DMA) */
  1188. #define ETH_DMA_FLAG_PMT ((uint32_t)0x10000000) /*!< PMT interrupt (on DMA) */
  1189. #define ETH_DMA_FLAG_MMC ((uint32_t)0x08000000) /*!< MMC interrupt (on DMA) */
  1190. #define ETH_DMA_FLAG_DataTransferError ((uint32_t)0x00800000) /*!< Error bits 0-Rx DMA, 1-Tx DMA */
  1191. #define ETH_DMA_FLAG_ReadWriteError ((uint32_t)0x01000000) /*!< Error bits 0-write trnsf, 1-read transfr */
  1192. #define ETH_DMA_FLAG_AccessError ((uint32_t)0x02000000) /*!< Error bits 0-data buffer, 1-desc. access */
  1193. #define ETH_DMA_FLAG_NIS ((uint32_t)0x00010000) /*!< Normal interrupt summary flag */
  1194. #define ETH_DMA_FLAG_AIS ((uint32_t)0x00008000) /*!< Abnormal interrupt summary flag */
  1195. #define ETH_DMA_FLAG_ER ((uint32_t)0x00004000) /*!< Early receive flag */
  1196. #define ETH_DMA_FLAG_FBE ((uint32_t)0x00002000) /*!< Fatal bus error flag */
  1197. #define ETH_DMA_FLAG_ET ((uint32_t)0x00000400) /*!< Early transmit flag */
  1198. #define ETH_DMA_FLAG_RWT ((uint32_t)0x00000200) /*!< Receive watchdog timeout flag */
  1199. #define ETH_DMA_FLAG_RPS ((uint32_t)0x00000100) /*!< Receive process stopped flag */
  1200. #define ETH_DMA_FLAG_RBU ((uint32_t)0x00000080) /*!< Receive buffer unavailable flag */
  1201. #define ETH_DMA_FLAG_R ((uint32_t)0x00000040) /*!< Receive flag */
  1202. #define ETH_DMA_FLAG_TU ((uint32_t)0x00000020) /*!< Underflow flag */
  1203. #define ETH_DMA_FLAG_RO ((uint32_t)0x00000010) /*!< Overflow flag */
  1204. #define ETH_DMA_FLAG_TJT ((uint32_t)0x00000008) /*!< Transmit jabber timeout flag */
  1205. #define ETH_DMA_FLAG_TBU ((uint32_t)0x00000004) /*!< Transmit buffer unavailable flag */
  1206. #define ETH_DMA_FLAG_TPS ((uint32_t)0x00000002) /*!< Transmit process stopped flag */
  1207. #define ETH_DMA_FLAG_T ((uint32_t)0x00000001) /*!< Transmit flag */
  1208. #define IS_ETH_DMA_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFE1800) == 0x00) && ((FLAG) != 0x00))
  1209. #define IS_ETH_DMA_GET_FLAG(FLAG) (((FLAG) == ETH_DMA_FLAG_TST) || ((FLAG) == ETH_DMA_FLAG_PMT) || \
  1210. ((FLAG) == ETH_DMA_FLAG_MMC) || ((FLAG) == ETH_DMA_FLAG_DataTransferError) || \
  1211. ((FLAG) == ETH_DMA_FLAG_ReadWriteError) || ((FLAG) == ETH_DMA_FLAG_AccessError) || \
  1212. ((FLAG) == ETH_DMA_FLAG_NIS) || ((FLAG) == ETH_DMA_FLAG_AIS) || \
  1213. ((FLAG) == ETH_DMA_FLAG_ER) || ((FLAG) == ETH_DMA_FLAG_FBE) || \
  1214. ((FLAG) == ETH_DMA_FLAG_ET) || ((FLAG) == ETH_DMA_FLAG_RWT) || \
  1215. ((FLAG) == ETH_DMA_FLAG_RPS) || ((FLAG) == ETH_DMA_FLAG_RBU) || \
  1216. ((FLAG) == ETH_DMA_FLAG_R) || ((FLAG) == ETH_DMA_FLAG_TU) || \
  1217. ((FLAG) == ETH_DMA_FLAG_RO) || ((FLAG) == ETH_DMA_FLAG_TJT) || \
  1218. ((FLAG) == ETH_DMA_FLAG_TBU) || ((FLAG) == ETH_DMA_FLAG_TPS) || \
  1219. ((FLAG) == ETH_DMA_FLAG_T))
  1220. /**
  1221. * @}
  1222. */
  1223. /** @defgroup ETH_DMA_Interrupts
  1224. * @{
  1225. */
  1226. #define ETH_DMA_IT_TST ((uint32_t)0x20000000) /*!< Time-stamp trigger interrupt (on DMA) */
  1227. #define ETH_DMA_IT_PMT ((uint32_t)0x10000000) /*!< PMT interrupt (on DMA) */
  1228. #define ETH_DMA_IT_MMC ((uint32_t)0x08000000) /*!< MMC interrupt (on DMA) */
  1229. #define ETH_DMA_IT_NIS ((uint32_t)0x00010000) /*!< Normal interrupt summary */
  1230. #define ETH_DMA_IT_AIS ((uint32_t)0x00008000) /*!< Abnormal interrupt summary */
  1231. #define ETH_DMA_IT_ER ((uint32_t)0x00004000) /*!< Early receive interrupt */
  1232. #define ETH_DMA_IT_FBE ((uint32_t)0x00002000) /*!< Fatal bus error interrupt */
  1233. #define ETH_DMA_IT_ET ((uint32_t)0x00000400) /*!< Early transmit interrupt */
  1234. #define ETH_DMA_IT_RWT ((uint32_t)0x00000200) /*!< Receive watchdog timeout interrupt */
  1235. #define ETH_DMA_IT_RPS ((uint32_t)0x00000100) /*!< Receive process stopped interrupt */
  1236. #define ETH_DMA_IT_RBU ((uint32_t)0x00000080) /*!< Receive buffer unavailable interrupt */
  1237. #define ETH_DMA_IT_R ((uint32_t)0x00000040) /*!< Receive interrupt */
  1238. #define ETH_DMA_IT_TU ((uint32_t)0x00000020) /*!< Underflow interrupt */
  1239. #define ETH_DMA_IT_RO ((uint32_t)0x00000010) /*!< Overflow interrupt */
  1240. #define ETH_DMA_IT_TJT ((uint32_t)0x00000008) /*!< Transmit jabber timeout interrupt */
  1241. #define ETH_DMA_IT_TBU ((uint32_t)0x00000004) /*!< Transmit buffer unavailable interrupt */
  1242. #define ETH_DMA_IT_TPS ((uint32_t)0x00000002) /*!< Transmit process stopped interrupt */
  1243. #define ETH_DMA_IT_T ((uint32_t)0x00000001) /*!< Transmit interrupt */
  1244. #define IS_ETH_DMA_IT(IT) ((((IT) & (uint32_t)0xFFFE1800) == 0x00) && ((IT) != 0x00))
  1245. #define IS_ETH_DMA_GET_IT(IT) (((IT) == ETH_DMA_IT_TST) || ((IT) == ETH_DMA_IT_PMT) || \
  1246. ((IT) == ETH_DMA_IT_MMC) || ((IT) == ETH_DMA_IT_NIS) || \
  1247. ((IT) == ETH_DMA_IT_AIS) || ((IT) == ETH_DMA_IT_ER) || \
  1248. ((IT) == ETH_DMA_IT_FBE) || ((IT) == ETH_DMA_IT_ET) || \
  1249. ((IT) == ETH_DMA_IT_RWT) || ((IT) == ETH_DMA_IT_RPS) || \
  1250. ((IT) == ETH_DMA_IT_RBU) || ((IT) == ETH_DMA_IT_R) || \
  1251. ((IT) == ETH_DMA_IT_TU) || ((IT) == ETH_DMA_IT_RO) || \
  1252. ((IT) == ETH_DMA_IT_TJT) || ((IT) == ETH_DMA_IT_TBU) || \
  1253. ((IT) == ETH_DMA_IT_TPS) || ((IT) == ETH_DMA_IT_T))
  1254. /**
  1255. * @}
  1256. */
  1257. /** @defgroup ETH_DMA_transmit_process_state_
  1258. * @{
  1259. */
  1260. #define ETH_DMA_TransmitProcess_Stopped ((uint32_t)0x00000000) /*!< Stopped - Reset or Stop Tx Command issued */
  1261. #define ETH_DMA_TransmitProcess_Fetching ((uint32_t)0x00100000) /*!< Running - fetching the Tx descriptor */
  1262. #define ETH_DMA_TransmitProcess_Waiting ((uint32_t)0x00200000) /*!< Running - waiting for status */
  1263. #define ETH_DMA_TransmitProcess_Reading ((uint32_t)0x00300000) /*!< Running - reading the data from host memory */
  1264. #define ETH_DMA_TransmitProcess_Suspended ((uint32_t)0x00600000) /*!< Suspended - Tx Desciptor unavailabe */
  1265. #define ETH_DMA_TransmitProcess_Closing ((uint32_t)0x00700000) /*!< Running - closing Rx descriptor */
  1266. /**
  1267. * @}
  1268. */
  1269. /** @defgroup ETH_DMA_receive_process_state_
  1270. * @{
  1271. */
  1272. #define ETH_DMA_ReceiveProcess_Stopped ((uint32_t)0x00000000) /*!< Stopped - Reset or Stop Rx Command issued */
  1273. #define ETH_DMA_ReceiveProcess_Fetching ((uint32_t)0x00020000) /*!< Running - fetching the Rx descriptor */
  1274. #define ETH_DMA_ReceiveProcess_Waiting ((uint32_t)0x00060000) /*!< Running - waiting for packet */
  1275. #define ETH_DMA_ReceiveProcess_Suspended ((uint32_t)0x00080000) /*!< Suspended - Rx Desciptor unavailable */
  1276. #define ETH_DMA_ReceiveProcess_Closing ((uint32_t)0x000A0000) /*!< Running - closing descriptor */
  1277. #define ETH_DMA_ReceiveProcess_Queuing ((uint32_t)0x000E0000) /*!< Running - queuing the recieve frame into host memory */
  1278. /**
  1279. * @}
  1280. */
  1281. /** @defgroup ETH_DMA_overflow_
  1282. * @{
  1283. */
  1284. #define ETH_DMA_Overflow_RxFIFOCounter ((uint32_t)0x10000000) /*!< Overflow bit for FIFO overflow counter */
  1285. #define ETH_DMA_Overflow_MissedFrameCounter ((uint32_t)0x00010000) /*!< Overflow bit for missed frame counter */
  1286. #define IS_ETH_DMA_GET_OVERFLOW(OVERFLOW) (((OVERFLOW) == ETH_DMA_Overflow_RxFIFOCounter) || \
  1287. ((OVERFLOW) == ETH_DMA_Overflow_MissedFrameCounter))
  1288. /**--------------------------------------------------------------------------**/
  1289. /**
  1290. * @brief Ethernet PMT defines
  1291. */
  1292. /**--------------------------------------------------------------------------**/
  1293. /**
  1294. * @}
  1295. */
  1296. /** @defgroup ETH_PMT_Flags
  1297. * @{
  1298. */
  1299. #define ETH_PMT_FLAG_WUFFRPR ((uint32_t)0x80000000) /*!< Wake-Up Frame Filter Register Poniter Reset */
  1300. #define ETH_PMT_FLAG_WUFR ((uint32_t)0x00000040) /*!< Wake-Up Frame Received */
  1301. #define ETH_PMT_FLAG_MPR ((uint32_t)0x00000020) /*!< Magic Packet Received */
  1302. #define IS_ETH_PMT_GET_FLAG(FLAG) (((FLAG) == ETH_PMT_FLAG_WUFR) || \
  1303. ((FLAG) == ETH_PMT_FLAG_MPR))
  1304. /**--------------------------------------------------------------------------**/
  1305. /**
  1306. * @brief Ethernet MMC defines
  1307. */
  1308. /**--------------------------------------------------------------------------**/
  1309. /**
  1310. * @}
  1311. */
  1312. /** @defgroup ETH_MMC_Tx_Interrupts
  1313. * @{
  1314. */
  1315. #define ETH_MMC_IT_TGF ((uint32_t)0x00200000) /*!< When Tx good frame counter reaches half the maximum value */
  1316. #define ETH_MMC_IT_TGFMSC ((uint32_t)0x00008000) /*!< When Tx good multi col counter reaches half the maximum value */
  1317. #define ETH_MMC_IT_TGFSC ((uint32_t)0x00004000) /*!< When Tx good single col counter reaches half the maximum value */
  1318. /**
  1319. * @}
  1320. */
  1321. /** @defgroup ETH_MMC_Rx_Interrupts
  1322. * @{
  1323. */
  1324. #define ETH_MMC_IT_RGUF ((uint32_t)0x10020000) /*!< When Rx good unicast frames counter reaches half the maximum value */
  1325. #define ETH_MMC_IT_RFAE ((uint32_t)0x10000040) /*!< When Rx alignment error counter reaches half the maximum value */
  1326. #define ETH_MMC_IT_RFCE ((uint32_t)0x10000020) /*!< When Rx crc error counter reaches half the maximum value */
  1327. #define IS_ETH_MMC_IT(IT) (((((IT) & (uint32_t)0xFFDF3FFF) == 0x00) || (((IT) & (uint32_t)0xEFFDFF9F) == 0x00)) && \
  1328. ((IT) != 0x00))
  1329. #define IS_ETH_MMC_GET_IT(IT) (((IT) == ETH_MMC_IT_TGF) || ((IT) == ETH_MMC_IT_TGFMSC) || \
  1330. ((IT) == ETH_MMC_IT_TGFSC) || ((IT) == ETH_MMC_IT_RGUF) || \
  1331. ((IT) == ETH_MMC_IT_RFAE) || ((IT) == ETH_MMC_IT_RFCE))
  1332. /**
  1333. * @}
  1334. */
  1335. /** @defgroup ETH_MMC_Registers
  1336. * @{
  1337. */
  1338. #define ETH_MMCCR ((uint32_t)0x00000100) /*!< MMC CR register */
  1339. #define ETH_MMCRIR ((uint32_t)0x00000104) /*!< MMC RIR register */
  1340. #define ETH_MMCTIR ((uint32_t)0x00000108) /*!< MMC TIR register */
  1341. #define ETH_MMCRIMR ((uint32_t)0x0000010C) /*!< MMC RIMR register */
  1342. #define ETH_MMCTIMR ((uint32_t)0x00000110) /*!< MMC TIMR register */
  1343. #define ETH_MMCTGFSCCR ((uint32_t)0x0000014C) /*!< MMC TGFSCCR register */
  1344. #define ETH_MMCTGFMSCCR ((uint32_t)0x00000150) /*!< MMC TGFMSCCR register */
  1345. #define ETH_MMCTGFCR ((uint32_t)0x00000168) /*!< MMC TGFCR register */
  1346. #define ETH_MMCRFCECR ((uint32_t)0x00000194) /*!< MMC RFCECR register */
  1347. #define ETH_MMCRFAECR ((uint32_t)0x00000198) /*!< MMC RFAECR register */
  1348. #define ETH_MMCRGUFCR ((uint32_t)0x000001C4) /*!< MMC RGUFCR register */
  1349. /**
  1350. * @brief ETH MMC registers
  1351. */
  1352. #define IS_ETH_MMC_REGISTER(REG) (((REG) == ETH_MMCCR) || ((REG) == ETH_MMCRIR) || \
  1353. ((REG) == ETH_MMCTIR) || ((REG) == ETH_MMCRIMR) || \
  1354. ((REG) == ETH_MMCTIMR) || ((REG) == ETH_MMCTGFSCCR) || \
  1355. ((REG) == ETH_MMCTGFMSCCR) || ((REG) == ETH_MMCTGFCR) || \
  1356. ((REG) == ETH_MMCRFCECR) || ((REG) == ETH_MMCRFAECR) || \
  1357. ((REG) == ETH_MMCRGUFCR))
  1358. /**--------------------------------------------------------------------------**/
  1359. /**
  1360. * @brief Ethernet PTP defines
  1361. */
  1362. /**--------------------------------------------------------------------------**/
  1363. /**
  1364. * @}
  1365. */
  1366. /** @defgroup ETH_PTP_time_update_method
  1367. * @{
  1368. */
  1369. #define ETH_PTP_FineUpdate ((uint32_t)0x00000001) /*!< Fine Update method */
  1370. #define ETH_PTP_CoarseUpdate ((uint32_t)0x00000000) /*!< Coarse Update method */
  1371. #define IS_ETH_PTP_UPDATE(UPDATE) (((UPDATE) == ETH_PTP_FineUpdate) || \
  1372. ((UPDATE) == ETH_PTP_CoarseUpdate))
  1373. /**
  1374. * @}
  1375. */
  1376. /** @defgroup ETH_PTP_Flags
  1377. * @{
  1378. */
  1379. #define ETH_PTP_FLAG_TSARU ((uint32_t)0x00000020) /*!< Addend Register Update */
  1380. #define ETH_PTP_FLAG_TSITE ((uint32_t)0x00000010) /*!< Time Stamp Interrupt Trigger */
  1381. #define ETH_PTP_FLAG_TSSTU ((uint32_t)0x00000008) /*!< Time Stamp Update */
  1382. #define ETH_PTP_FLAG_TSSTI ((uint32_t)0x00000004) /*!< Time Stamp Initialize */
  1383. #define ETH_PTP_FLAG_TSTTR ((uint32_t)0x10000002) /* Time stamp target time reached */
  1384. #define ETH_PTP_FLAG_TSSO ((uint32_t)0x10000001) /* Time stamp seconds overflow */
  1385. #define IS_ETH_PTP_GET_FLAG(FLAG) (((FLAG) == ETH_PTP_FLAG_TSARU) || \
  1386. ((FLAG) == ETH_PTP_FLAG_TSITE) || \
  1387. ((FLAG) == ETH_PTP_FLAG_TSSTU) || \
  1388. ((FLAG) == ETH_PTP_FLAG_TSSTI) || \
  1389. ((FLAG) == ETH_PTP_FLAG_TSTTR) || \
  1390. ((FLAG) == ETH_PTP_FLAG_TSSO))
  1391. /**
  1392. * @brief ETH PTP subsecond increment
  1393. */
  1394. #define IS_ETH_PTP_SUBSECOND_INCREMENT(SUBSECOND) ((SUBSECOND) <= 0xFF)
  1395. /**
  1396. * @}
  1397. */
  1398. /** @defgroup ETH_PTP_time_sign
  1399. * @{
  1400. */
  1401. #define ETH_PTP_PositiveTime ((uint32_t)0x00000000) /*!< Positive time value */
  1402. #define ETH_PTP_NegativeTime ((uint32_t)0x80000000) /*!< Negative time value */
  1403. #define IS_ETH_PTP_TIME_SIGN(SIGN) (((SIGN) == ETH_PTP_PositiveTime) || \
  1404. ((SIGN) == ETH_PTP_NegativeTime))
  1405. /**
  1406. * @brief ETH PTP time stamp low update
  1407. */
  1408. #define IS_ETH_PTP_TIME_STAMP_UPDATE_SUBSECOND(SUBSECOND) ((SUBSECOND) <= 0x7FFFFFFF)
  1409. /**
  1410. * @brief ETH PTP registers
  1411. */
  1412. #define ETH_PTPTSCR ((uint32_t)0x00000700) /*!< PTP TSCR register */
  1413. #define ETH_PTPSSIR ((uint32_t)0x00000704) /*!< PTP SSIR register */
  1414. #define ETH_PTPTSHR ((uint32_t)0x00000708) /*!< PTP TSHR register */
  1415. #define ETH_PTPTSLR ((uint32_t)0x0000070C) /*!< PTP TSLR register */
  1416. #define ETH_PTPTSHUR ((uint32_t)0x00000710) /*!< PTP TSHUR register */
  1417. #define ETH_PTPTSLUR ((uint32_t)0x00000714) /*!< PTP TSLUR register */
  1418. #define ETH_PTPTSAR ((uint32_t)0x00000718) /*!< PTP TSAR register */
  1419. #define ETH_PTPTTHR ((uint32_t)0x0000071C) /*!< PTP TTHR register */
  1420. #define ETH_PTPTTLR ((uint32_t)0x00000720) /* PTP TTLR register */
  1421. #define ETH_PTPTSSR ((uint32_t)0x00000728) /* PTP TSSR register */
  1422. #define IS_ETH_PTP_REGISTER(REG) (((REG) == ETH_PTPTSCR) || ((REG) == ETH_PTPSSIR) || \
  1423. ((REG) == ETH_PTPTSHR) || ((REG) == ETH_PTPTSLR) || \
  1424. ((REG) == ETH_PTPTSHUR) || ((REG) == ETH_PTPTSLUR) || \
  1425. ((REG) == ETH_PTPTSAR) || ((REG) == ETH_PTPTTHR) || \
  1426. ((REG) == ETH_PTPTTLR) || ((REG) == ETH_PTPTSSR))
  1427. /**
  1428. * @brief ETHERNET PTP clock
  1429. */
  1430. #define ETH_PTP_OrdinaryClock ((uint32_t)0x00000000) /* Ordinary Clock */
  1431. #define ETH_PTP_BoundaryClock ((uint32_t)0x00010000) /* Boundary Clock */
  1432. #define ETH_PTP_EndToEndTransparentClock ((uint32_t)0x00020000) /* End To End Transparent Clock */
  1433. #define ETH_PTP_PeerToPeerTransparentClock ((uint32_t)0x00030000) /* Peer To Peer Transparent Clock */
  1434. #define IS_ETH_PTP_TYPE_CLOCK(CLOCK) (((CLOCK) == ETH_PTP_OrdinaryClock) || \
  1435. ((CLOCK) == ETH_PTP_BoundaryClock) || \
  1436. ((CLOCK) == ETH_PTP_EndToEndTransparentClock) || \
  1437. ((CLOCK) == ETH_PTP_PeerToPeerTransparentClock))
  1438. /**
  1439. * @brief ETHERNET snapshot
  1440. */
  1441. #define ETH_PTP_SnapshotMasterMessage ((uint32_t)0x00008000) /* Time stamp snapshot for message relevant to master enable */
  1442. #define ETH_PTP_SnapshotEventMessage ((uint32_t)0x00004000) /* Time stamp snapshot for event message enable */
  1443. #define ETH_PTP_SnapshotIPV4Frames ((uint32_t)0x00002000) /* Time stamp snapshot for IPv4 frames enable */
  1444. #define ETH_PTP_SnapshotIPV6Frames ((uint32_t)0x00001000) /* Time stamp snapshot for IPv6 frames enable */
  1445. #define ETH_PTP_SnapshotPTPOverEthernetFrames ((uint32_t)0x00000800) /* Time stamp snapshot for PTP over ethernet frames enable */
  1446. #define ETH_PTP_SnapshotAllReceivedFrames ((uint32_t)0x00000100) /* Time stamp snapshot for all received frames enable */
  1447. #define IS_ETH_PTP_SNAPSHOT(SNAPSHOT) (((SNAPSHOT) == ETH_PTP_SnapshotMasterMessage) || \
  1448. ((SNAPSHOT) == ETH_PTP_SnapshotEventMessage) || \
  1449. ((SNAPSHOT) == ETH_PTP_SnapshotIPV4Frames) || \
  1450. ((SNAPSHOT) == ETH_PTP_SnapshotIPV6Frames) || \
  1451. ((SNAPSHOT) == ETH_PTP_SnapshotPTPOverEthernetFrames) || \
  1452. ((SNAPSHOT) == ETH_PTP_SnapshotAllReceivedFrames))
  1453. /**
  1454. * @}
  1455. */
  1456. /**
  1457. * @}
  1458. */
  1459. /** @defgroup ETH_Exported_Macros
  1460. * @{
  1461. */
  1462. /**
  1463. * @}
  1464. */
  1465. /** @defgroup ETH_Exported_Functions
  1466. * @{
  1467. */
  1468. void ETH_DeInit(void);
  1469. uint32_t ETH_Init(ETH_InitTypeDef* ETH_InitStruct);
  1470. void ETH_StructInit(ETH_InitTypeDef* ETH_InitStruct);
  1471. void ETH_SoftwareReset(void);
  1472. FlagStatus ETH_GetSoftwareResetStatus(void);
  1473. void ETH_Start(void);
  1474. uint32_t ETH_HandleTxPkt(uint8_t *ppkt, uint16_t FrameLength);
  1475. uint32_t ETH_HandleRxPkt(uint8_t *ppkt);
  1476. uint32_t ETH_GetRxPktSize(void);
  1477. void ETH_DropRxPkt(void);
  1478. #ifdef USE_ENHANCED_DMA_DESCRIPTORS
  1479. void ETH_EnhancedDescriptorCmd(FunctionalState NewState);
  1480. #endif /* USE_ENHANCED_DMA_DESCRIPTORS */
  1481. /**
  1482. * @brief PHY
  1483. */
  1484. uint16_t ETH_ReadPHYRegister(uint16_t PHYAddress, uint16_t PHYReg);
  1485. uint32_t ETH_WritePHYRegister(uint16_t PHYAddress, uint16_t PHYReg, uint16_t PHYValue);
  1486. uint32_t ETH_PHYLoopBackCmd(uint16_t PHYAddress, FunctionalState NewState);
  1487. /**
  1488. * @brief MAC
  1489. */
  1490. void ETH_MACTransmissionCmd(FunctionalState NewState);
  1491. void ETH_MACReceptionCmd(FunctionalState NewState);
  1492. FlagStatus ETH_GetFlowControlBusyStatus(void);
  1493. void ETH_InitiatePauseControlFrame(void);
  1494. void ETH_BackPressureActivationCmd(FunctionalState NewState);
  1495. FlagStatus ETH_GetMACFlagStatus(uint32_t ETH_MAC_FLAG);
  1496. ITStatus ETH_GetMACITStatus(uint32_t ETH_MAC_IT);
  1497. void ETH_MACITConfig(uint32_t ETH_MAC_IT, FunctionalState NewState);
  1498. void ETH_MACAddressConfig(uint32_t MacAddr, uint8_t *Addr);
  1499. void ETH_GetMACAddress(uint32_t MacAddr, uint8_t *Addr);
  1500. void ETH_MACAddressPerfectFilterCmd(uint32_t MacAddr, FunctionalState NewState);
  1501. void ETH_MACAddressFilterConfig(uint32_t MacAddr, uint32_t Filter);
  1502. void ETH_MACAddressMaskBytesFilterConfig(uint32_t MacAddr, uint32_t MaskByte);
  1503. /**
  1504. * @brief DMA Tx/Rx descriptors
  1505. */
  1506. void ETH_DMATxDescChainInit(ETH_DMADESCTypeDef *DMATxDescTab, uint8_t *TxBuff, uint32_t TxBuffCount);
  1507. void ETH_DMATxDescRingInit(ETH_DMADESCTypeDef *DMATxDescTab, uint8_t *TxBuff1, uint8_t *TxBuff2, uint32_t TxBuffCount);
  1508. FlagStatus ETH_GetDMATxDescFlagStatus(ETH_DMADESCTypeDef *DMATxDesc, uint32_t ETH_DMATxDescFlag);
  1509. uint32_t ETH_GetDMATxDescCollisionCount(ETH_DMADESCTypeDef *DMATxDesc);
  1510. void ETH_SetDMATxDescOwnBit(ETH_DMADESCTypeDef *DMATxDesc);
  1511. void ETH_DMATxDescTransmitITConfig(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState);
  1512. void ETH_DMATxDescFrameSegmentConfig(ETH_DMADESCTypeDef *DMATxDesc, uint32_t DMATxDesc_FrameSegment);
  1513. void ETH_DMATxDescChecksumInsertionConfig(ETH_DMADESCTypeDef *DMATxDesc, uint32_t DMATxDesc_Checksum);
  1514. void ETH_DMATxDescCRCCmd(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState);
  1515. void ETH_DMATxDescEndOfRingCmd(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState);
  1516. void ETH_DMATxDescSecondAddressChainedCmd(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState);
  1517. void ETH_DMATxDescShortFramePaddingCmd(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState);
  1518. void ETH_DMATxDescTimeStampCmd(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState);
  1519. void ETH_DMATxDescBufferSizeConfig(ETH_DMADESCTypeDef *DMATxDesc, uint32_t BufferSize1, uint32_t BufferSize2);
  1520. void ETH_DMARxDescChainInit(ETH_DMADESCTypeDef *DMARxDescTab, uint8_t *RxBuff, uint32_t RxBuffCount);
  1521. void ETH_DMARxDescRingInit(ETH_DMADESCTypeDef *DMARxDescTab, uint8_t *RxBuff1, uint8_t *RxBuff2, uint32_t RxBuffCount);
  1522. FlagStatus ETH_GetDMARxDescFlagStatus(ETH_DMADESCTypeDef *DMARxDesc, uint32_t ETH_DMARxDescFlag);
  1523. #ifdef USE_ENHANCED_DMA_DESCRIPTORS
  1524. FlagStatus ETH_GetDMAPTPRxDescExtendedFlagStatus(ETH_DMADESCTypeDef *DMAPTPRxDesc, uint32_t ETH_DMAPTPRxDescExtendedFlag);
  1525. #endif /* USE_ENHANCED_DMA_DESCRIPTORS */
  1526. void ETH_SetDMARxDescOwnBit(ETH_DMADESCTypeDef *DMARxDesc);
  1527. uint32_t ETH_GetDMARxDescFrameLength(ETH_DMADESCTypeDef *DMARxDesc);
  1528. void ETH_DMARxDescReceiveITConfig(ETH_DMADESCTypeDef *DMARxDesc, FunctionalState NewState);
  1529. void ETH_DMARxDescEndOfRingCmd(ETH_DMADESCTypeDef *DMARxDesc, FunctionalState NewState);
  1530. void ETH_DMARxDescSecondAddressChainedCmd(ETH_DMADESCTypeDef *DMARxDesc, FunctionalState NewState);
  1531. uint32_t ETH_GetDMARxDescBufferSize(ETH_DMADESCTypeDef *DMARxDesc, uint32_t DMARxDesc_Buffer);
  1532. /**
  1533. * @brief DMA
  1534. */
  1535. FlagStatus ETH_GetDMAFlagStatus(uint32_t ETH_DMA_FLAG);
  1536. void ETH_DMAClearFlag(uint32_t ETH_DMA_FLAG);
  1537. ITStatus ETH_GetDMAITStatus(uint32_t ETH_DMA_IT);
  1538. void ETH_DMAClearITPendingBit(uint32_t ETH_DMA_IT);
  1539. uint32_t ETH_GetTransmitProcessState(void);
  1540. uint32_t ETH_GetReceiveProcessState(void);
  1541. void ETH_FlushTransmitFIFO(void);
  1542. FlagStatus ETH_GetFlushTransmitFIFOStatus(void);
  1543. void ETH_DMATransmissionCmd(FunctionalState NewState);
  1544. void ETH_DMAReceptionCmd(FunctionalState NewState);
  1545. void ETH_DMAITConfig(uint32_t ETH_DMA_IT, FunctionalState NewState);
  1546. FlagStatus ETH_GetDMAOverflowStatus(uint32_t ETH_DMA_Overflow);
  1547. uint32_t ETH_GetRxOverflowMissedFrameCounter(void);
  1548. uint32_t ETH_GetBufferUnavailableMissedFrameCounter(void);
  1549. uint32_t ETH_GetCurrentTxDescStartAddress(void);
  1550. uint32_t ETH_GetCurrentRxDescStartAddress(void);
  1551. uint32_t ETH_GetCurrentTxBufferAddress(void);
  1552. uint32_t ETH_GetCurrentRxBufferAddress(void);
  1553. void ETH_ResumeDMATransmission(void);
  1554. void ETH_ResumeDMAReception(void);
  1555. void ETH_SetReceiveWatchdogTimer(uint8_t Value);
  1556. /**
  1557. * @brief PMT
  1558. */
  1559. void ETH_ResetWakeUpFrameFilterRegisterPointer(void);
  1560. void ETH_SetWakeUpFrameFilterRegister(uint32_t *Buffer);
  1561. void ETH_GlobalUnicastWakeUpCmd(FunctionalState NewState);
  1562. FlagStatus ETH_GetPMTFlagStatus(uint32_t ETH_PMT_FLAG);
  1563. void ETH_WakeUpFrameDetectionCmd(FunctionalState NewState);
  1564. void ETH_MagicPacketDetectionCmd(FunctionalState NewState);
  1565. void ETH_PowerDownCmd(FunctionalState NewState);
  1566. /**
  1567. * @brief MMC
  1568. */
  1569. void ETH_MMCCounterFullPreset(void);
  1570. void ETH_MMCCounterHalfPreset(void);
  1571. void ETH_MMCCounterFreezeCmd(FunctionalState NewState);
  1572. void ETH_MMCResetOnReadCmd(FunctionalState NewState);
  1573. void ETH_MMCCounterRolloverCmd(FunctionalState NewState);
  1574. void ETH_MMCCountersReset(void);
  1575. void ETH_MMCITConfig(uint32_t ETH_MMC_IT, FunctionalState NewState);
  1576. ITStatus ETH_GetMMCITStatus(uint32_t ETH_MMC_IT);
  1577. uint32_t ETH_GetMMCRegister(uint32_t ETH_MMCReg);
  1578. /**
  1579. * @brief PTP
  1580. */
  1581. void ETH_PTPNodeClockTypeConfig(uint32_t ClockType);
  1582. void ETH_PTPSnapshotCmd(uint32_t SnapshotMethod, FunctionalState NewState);
  1583. void ETH_PTPPacketSnoopingV2FormatCmd(FunctionalState NewState);
  1584. void ETH_PTPSubSecondRolloverCmd(FunctionalState NewState);
  1585. uint32_t ETH_HandlePTPTxPkt(uint8_t *ppkt, uint16_t FrameLength, uint32_t *PTPTxTab);
  1586. uint32_t ETH_HandlePTPRxPkt(uint8_t *ppkt, uint32_t *PTPRxTab);
  1587. #ifdef USE_ENHANCED_DMA_DESCRIPTORS
  1588. void ETH_DMAPTPTxDescChainInit(ETH_DMADESCTypeDef *DMAPTPTxDescTab, uint8_t *TxBuff, uint32_t TxBuffCount);
  1589. void ETH_DMAPTPRxDescChainInit(ETH_DMADESCTypeDef *DMAPTPRxDescTab, uint8_t *RxBuff, uint32_t RxBuffCount);
  1590. #endif /* USE_ENHANCED_DMA_DESCRIPTORS */
  1591. void ETH_EnablePTPTimeStampAddend(void);
  1592. void ETH_EnablePTPTimeStampInterruptTrigger(void);
  1593. void ETH_EnablePTPTimeStampUpdate(void);
  1594. void ETH_InitializePTPTimeStamp(void);
  1595. void ETH_PTPUpdateMethodConfig(uint32_t UpdateMethod);
  1596. void ETH_PTPTimeStampCmd(FunctionalState NewState);
  1597. FlagStatus ETH_GetPTPFlagStatus(uint32_t ETH_PTP_FLAG);
  1598. void ETH_SetPTPSubSecondIncrement(uint32_t SubSecondValue);
  1599. void ETH_SetPTPTimeStampUpdate(uint32_t Sign, uint32_t SecondValue, uint32_t SubSecondValue);
  1600. void ETH_SetPTPTimeStampAddend(uint32_t Value);
  1601. void ETH_SetPTPTargetTime(uint32_t HighValue, uint32_t LowValue);
  1602. uint32_t ETH_GetPTPRegister(uint32_t ETH_PTPReg);
  1603. /* STM32 ETH HW initialization */
  1604. void rt_hw_stm32_eth_init(void);
  1605. #ifdef __cplusplus
  1606. }
  1607. #endif
  1608. #endif /* __STM32F2XX_ETH_H */
  1609. /**
  1610. * @}
  1611. */
  1612. /**
  1613. * @}
  1614. */
  1615. /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/