stm32f4x7_eth.h 96 KB

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