emac.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. // Copyright 2019 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #pragma once
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #include <stdint.h>
  19. #include <stdbool.h>
  20. #include "esp_err.h"
  21. #include "soc/emac_dma_struct.h"
  22. #include "soc/emac_mac_struct.h"
  23. #include "soc/emac_ext_struct.h"
  24. #define EMAC_MEDIA_INTERFACE_MII (0)
  25. #define EMAC_MEDIA_INTERFACE_RMII (1)
  26. #define EMAC_WATCHDOG_ENABLE (0)
  27. #define EMAC_WATCHDOG_DISABLE (1)
  28. #define EMAC_JABBER_ENABLE (0)
  29. #define EMAC_JABBER_DISABLE (1)
  30. #define EMAC_INTERFRAME_GAP_96BIT (0)
  31. #define EMAC_INTERFRAME_GAP_88BIT (1)
  32. #define EMAC_INTERFRAME_GAP_80BIT (2)
  33. #define EMAC_INTERFRAME_GAP_72BIT (3)
  34. #define EMAC_INTERFRAME_GAP_64BIT (4)
  35. #define EMAC_INTERFRAME_GAP_56BIT (5)
  36. #define EMAC_INTERFRAME_GAP_48BIT (6)
  37. #define EMAC_INTERFRAME_GAP_40BIT (7)
  38. #define EMAC_CARRIERSENSE_ENABLE (0)
  39. #define EMAC_CARRIERSENSE_DISABLE (1)
  40. #define EMAC_PORT_1000MBPS (0)
  41. #define EMAC_PORT_10_100MBPS (1)
  42. #define EMAC_SPEED_10M (0)
  43. #define EMAC_SPEED_100M (1)
  44. #define EMAC_RECEIVE_OWN_ENABLE (0)
  45. #define EMAC_RECEIVE_OWN_DISABLE (1)
  46. #define EMAC_LOOPBACK_DISABLE (0)
  47. #define EMAC_LOOPBACK_ENABLE (1)
  48. #define EMAC_DUPLEX_HALF (0)
  49. #define EMAC_DUPLEX_FULL (1)
  50. #define EMAC_CHECKSUM_SW (0)
  51. #define EMAC_CHECKSUM_HW (1)
  52. #define EMAC_RETRY_TRANSMISSION_ENABLE (0)
  53. #define EMAC_RETRY_TRANSMISSION_DISABLE (1)
  54. #define EMAC_AUTO_PAD_CRC_STRIP_DISABLE (0)
  55. #define EMAC_AUTO_PAD_CRC_STRIP_ENABLE (1)
  56. #define EMAC_BACKOFF_LIMIT_10 (0)
  57. #define EMAC_BACKOFF_LIMIT_8 (1)
  58. #define EMAC_BACKOFF_LIMIT_4 (2)
  59. #define EMAC_BACKOFF_LIMIT_1 (3)
  60. #define EMAC_DEFERRAL_CHECK_DISABLE (0)
  61. #define EMAC_DEFERRAL_CHECK_ENABLE (1)
  62. #define EMAC_PREAMBLE_LENGTH_7 (0)
  63. #define EMAC_PREAMBLE_LENGTH_5 (1)
  64. #define EMAC_PREAMBLE_LENGTH_3 (2)
  65. #define EMAC_RECEIVE_ALL_DISABLE (0)
  66. #define EMAC_RECEIVE_ALL_ENABLE (1)
  67. #define EMAC_SOURCE_ADDR_FILTER_DISABLE (0)
  68. #define EMAC_SOURCE_ADDR_FILTER_NORMAL (2)
  69. #define EMAC_SOURCE_ADDR_FILTER_INVERSE (3)
  70. #define EMAC_CONTROL_FRAME_BLOCKALL (0)
  71. #define EMAC_CONTROL_FRAME_FORWARDALL_PAUSE (1)
  72. #define EMAC_CONTROL_FRAME_FORWARDALL (2)
  73. #define EMAC_CONTROL_FRAME_FORWARDFILT (3)
  74. #define EMAC_RECEPT_BROADCAST_ENABLE (0)
  75. #define EMAC_RECEPT_BROADCAST_DISABLE (1)
  76. #define EMAC_DEST_ADDR_FILTER_NORMAL (0)
  77. #define EMAC_DEST_ADDR_FILTER_INVERSE (1)
  78. #define EMAC_PROMISCUOUS_DISABLE (0)
  79. #define EMAC_PROMISCUOUS_ENABLE (1)
  80. #define EMAC_PAUSE_TIME 0x1648
  81. #define EMAC_ZERO_QUANTA_PAUSE_ENABLE (0)
  82. #define EMAC_ZERO_QUANTA_PAUSE_DISABLE (1)
  83. #define EMAC_PAUSE_LOW_THRESHOLD_MINUS_4 (0)
  84. #define EMAC_PAUSE_LOW_THRESHOLD_MINUS_28 (1)
  85. #define EMAC_PAUSE_LOW_THRESHOLD_MINUS_144 (2)
  86. #define EMAC_PAUSE_LOW_THRESHOLD_MINUS_256
  87. #define EMAC_UNICAST_PAUSE_DETECT_DISABLE (0)
  88. #define EMAC_UNICAST_PAUSE_DETECT_ENABLE (1)
  89. #define EMAC_RECEIVE_FLOW_CONTROL_DISABLE (0)
  90. #define EMAC_RECEIVE_FLOW_CONTROL_ENABLE (1)
  91. #define EMAC_TRANSMIT_FLOW_CONTROL_DISABLE (0)
  92. #define EMAC_TRANSMIT_FLOW_CONTROL_ENABLE (1)
  93. #define EMAC_DROP_TCPIP_CHECKSUM_ERROR_ENABLE (0)
  94. #define EMAC_DROP_TCPIP_CHECKSUM_ERROR_DISABLE (1)
  95. #define EMAC_RECEIVE_STORE_FORWARD_DISABLE (0)
  96. #define EMAC_RECEIVE_STORE_FORWARD_ENABLE (1)
  97. #define EMAC_FLUSH_RECEIVED_FRAME_ENABLE (0)
  98. #define EMAC_FLUSH_RECEIVED_FRAME_DISABLE (1)
  99. #define EMAC_TRANSMIT_STORE_FORWARD_DISABLE (0)
  100. #define EMAC_TRANSMIT_STORE_FORWARD_ENABLE (1)
  101. #define EMAC_TRANSMIT_THRESHOLD_CONTROL_64 (0)
  102. #define EMAC_TRANSMIT_THRESHOLD_CONTROL_128 (1)
  103. #define EMAC_TRANSMIT_THRESHOLD_CONTROL_192 (2)
  104. #define EMAC_TRANSMIT_THRESHOLD_CONTROL_256 (3)
  105. #define EMAC_TRANSMIT_THRESHOLD_CONTROL_40 (4)
  106. #define EMAC_TRANSMIT_THRESHOLD_CONTROL_32 (5)
  107. #define EMAC_TRANSMIT_THRESHOLD_CONTROL_24 (6)
  108. #define EMAC_TRANSMIT_THRESHOLD_CONTROL_16 (7)
  109. #define EMAC_FORWARD_ERROR_FRAME_DISABLE (0)
  110. #define EMAC_FORWARD_ERROR_FRAME_ENABLE (1)
  111. #define EMAC_FORWARD_UNDERSIZED_GOOD_FRAME_DISABLE (0)
  112. #define EMAC_FORWARD_UNDERSIZED_GOOD_FRAME_ENABLE (1)
  113. #define EMAC_RECEIVE_THRESHOLD_CONTROL_64 (0)
  114. #define EMAC_RECEIVE_THRESHOLD_CONTROL_32 (1)
  115. #define EMAC_RECEIVE_THRESHOLD_CONTROL_96 (2)
  116. #define EMAC_RECEIVE_THRESHOLD_CONTROL_128 (3)
  117. #define EMAC_OPERATE_SECOND_FRAME_DISABLE (0)
  118. #define EMAC_OPERATE_SECOND_FRAME_ENABLE (1)
  119. #define EMAC_MIXED_BURST_DISABLE (0)
  120. #define EMAC_MIXED_BURST_ENABLE (1)
  121. #define EMAC_ADDR_ALIGN_BEATS_DISABLE (0)
  122. #define EMAC_ADDR_ALIGN_BEATS_ENABLE (1)
  123. #define EMAC_UNUSE_SEPARATE_PBL (0)
  124. #define EMAC_USE_SEPARATE_PBL (1)
  125. #define EMAC_DMA_BURST_LENGTH_1BEAT (1)
  126. #define EMAC_DMA_BURST_LENGTH_2BEAT (2)
  127. #define EMAC_DMA_BURST_LENGTH_4BEAT (4)
  128. #define EMAC_DMA_BURST_LENGTH_8BEAT (8)
  129. #define EMAC_DMA_BURST_LENGTH_16BEAT (16)
  130. #define EMAC_DMA_BURST_LENGTH_32BEAT (32)
  131. #define EMAC_ENHANCED_DESCRIPTOR_DISABLE (0)
  132. #define EMAC_ENHANCED_DESCRIPTOR_ENABLE (1)
  133. #define EMAC_DMA_ARBITRATION_SCHEME_ROUNDROBIN (0)
  134. #define EMAC_DMA_ARBITRATION_SCHEME_FIXEDPRIO (1)
  135. #define EMAC_DMA_ARBITRATION_ROUNDROBIN_RXTX_1_1 (0)
  136. #define EMAC_DMA_ARBITRATION_ROUNDROBIN_RXTX_2_1 (1)
  137. #define EMAC_DMA_ARBITRATION_ROUNDROBIN_RXTX_3_1 (2)
  138. #define EMAC_DMA_ARBITRATION_ROUNDROBIN_RXTX_4_1 (3)
  139. /**
  140. * @brief Ethernet DMA TX Descriptor
  141. *
  142. */
  143. typedef struct {
  144. volatile union {
  145. struct {
  146. uint32_t Deferred : 1; /*!< MAC defers before transmission */
  147. uint32_t UnderflowErr : 1; /*!< DMA encountered an empty transmit buffer */
  148. uint32_t ExcessiveDeferral : 1; /*!< Excessive deferral of over 24,288 bit times */
  149. uint32_t CollisionCount : 4; /*!< Number of collisions occurred before transmitted */
  150. uint32_t VLanFrame : 1; /*!< Transmitted frame is a VLAN-type frame */
  151. uint32_t ExcessiveCollision : 1; /*!< Transmission aborted after 16 successive collisions */
  152. uint32_t LateCollision : 1; /*!< Collision occurred after the collision window */
  153. uint32_t NoCarrier : 1; /*!< Carrier Sense signal from the PHY was not asserted */
  154. uint32_t LossCarrier : 1; /*!< Loss of carrier occurred during transmission */
  155. uint32_t PayloadChecksumErr : 1; /*!< Checksum error in TCP/UDP/ICMP datagram payload */
  156. uint32_t FrameFlushed : 1; /*!< DMA or MTL flushed the frame */
  157. uint32_t JabberTimeout : 1; /*!< MAC transmitter has experienced a jabber timeout */
  158. uint32_t ErrSummary : 1; /*!< Error Summary */
  159. uint32_t IPHeadErr : 1; /*!< IP Header Error */
  160. uint32_t TxTimestampStatus : 1; /*!< Timestamp captured for the transmit frame */
  161. uint32_t VLANInsertControl : 2; /*!< VLAN tagging or untagging before transmitting */
  162. uint32_t SecondAddressChained : 1; /*!< Second address in the descriptor is Next Descriptor address */
  163. uint32_t TransmitEndRing : 1; /*!< Descriptor list reached its final descriptor */
  164. uint32_t ChecksumInsertControl : 2; /*!< Control checksum calculation and insertion */
  165. uint32_t CRCReplacementControl : 1; /*!< Control CRC replace */
  166. uint32_t TransmitTimestampEnable : 1; /*!< Enable IEEE1588 harware timestamping */
  167. uint32_t DisablePad : 1; /*!< Control add padding when frame short than 64 bytes */
  168. uint32_t DisableCRC : 1; /*!< Control append CRC to the end of frame */
  169. uint32_t FirstSegment : 1; /*!< Buffer contains the first segment of a frame */
  170. uint32_t LastSegment : 1; /*!< Buffer contains the last segment of a frame */
  171. uint32_t InterruptOnComplete : 1; /*!< Interrupt after frame transmitted */
  172. uint32_t Own : 1; /*!< Owner of this descriptor: DMA controller or host */
  173. };
  174. uint32_t Value;
  175. } TDES0;
  176. union {
  177. struct {
  178. uint32_t TransmitBuffer1Size : 13; /*!< First data buffer byte size */
  179. uint32_t Reserved : 3; /*!< Reserved */
  180. uint32_t TransmitBuffer2Size : 13; /*!< Second data buffer byte size */
  181. uint32_t SAInsertControl : 3; /*!< Control MAC add or replace Source Address field */
  182. };
  183. uint32_t Value;
  184. } TDES1;
  185. uint32_t Buffer1Addr; /*!< Buffer1 address pointer */
  186. uint32_t Buffer2NextDescAddr; /*!< Buffer2 or next descriptor address pointer */
  187. uint32_t Reserved1; /*!< Reserved */
  188. uint32_t Reserved2; /*!< Reserved */
  189. uint32_t TimeStampLow; /*!< Transmit Frame Timestamp Low */
  190. uint32_t TimeStampHigh; /*!< Transmit Frame Timestamp High */
  191. } eth_dma_tx_descriptor_t;
  192. #define EMAC_DMATXDESC_CHECKSUM_BYPASS 0 /*!< Checksum engine bypass */
  193. #define EMAC_DMATXDESC_CHECKSUM_IPV4HEADER 1 /*!< IPv4 header checksum insertion */
  194. #define EMAC_DMATXDESC_CHECKSUM_TCPUDPICMPSEGMENT 2 /*!< TCP/UDP/ICMP Checksum Insertion calculated over segment only */
  195. #define EMAC_DMATXDESC_CHECKSUM_TCPUDPICMPFULL 3 /*!< TCP/UDP/ICMP Checksum Insertion fully calculated */
  196. _Static_assert(sizeof(eth_dma_tx_descriptor_t) == 32, "eth_dma_tx_descriptor_t should occupy 32 bytes in memory");
  197. /**
  198. * @brief Ethernet DMA RX Descriptor
  199. *
  200. */
  201. typedef struct {
  202. volatile union {
  203. struct {
  204. uint32_t ExtendStatusAvailable : 1; /*!< Extended statsu is available in RDES4 */
  205. uint32_t CRCErr : 1; /*!< CRC error occurred on frame */
  206. uint32_t DribbleBitErr : 1; /*!< frame contains non int multiple of 8 bits */
  207. uint32_t ReceiveErr : 1; /*!< Receive error */
  208. uint32_t ReceiveWatchdogTimeout : 1; /*!< Receive Watchdog timeout */
  209. uint32_t FrameType : 1; /*!< Ethernet type or IEEE802.3 */
  210. uint32_t LateCollision : 1; /*!< Late collision occurred during reception */
  211. uint32_t TSAvailIPChecksumErrGiantFrame : 1; /*!< Timestamp available or IP Checksum error or Giant frame */
  212. uint32_t LastDescriptor : 1; /*!< Last buffer of the frame */
  213. uint32_t FirstDescriptor : 1; /*!< First buffer of the frame */
  214. uint32_t VLANTag : 1; /*!< VLAN Tag: received frame is a VLAN frame */
  215. uint32_t OverflowErr : 1; /*!< Frame was damaged due to buffer overflow */
  216. uint32_t LengthErr : 1; /*!< Frame size not matching with length field */
  217. uint32_t SourceAddrFilterFail : 1; /*!< SA field of frame failed the SA filter */
  218. uint32_t DescriptorErr : 1; /*!< Frame truncated and DMA doesn't own next descriptor */
  219. uint32_t ErrSummary : 1; /*!< Error Summary, OR of all errors in RDES */
  220. uint32_t FrameLength : 14; /*!< Byte length of received frame */
  221. uint32_t DestinationAddrFilterFail : 1; /*!< Frame failed in the DA Filter in the MAC */
  222. uint32_t Own : 1; /*!< Owner of this descriptor: DMA controller or host */
  223. };
  224. uint32_t Value;
  225. } RDES0;
  226. union {
  227. struct {
  228. uint32_t ReceiveBuffer1Size : 13; /*!< First data buffer size in bytes */
  229. uint32_t Reserved1 : 1; /*!< Reserved */
  230. uint32_t SecondAddressChained : 1; /*!< Seconde address is the Next Descriptor address */
  231. uint32_t ReceiveEndOfRing : 1; /*!< Descriptor reached its final descriptor */
  232. uint32_t ReceiveBuffer2Size : 13; /*!< Second data buffer size in bytes */
  233. uint32_t Reserved : 2; /*!< Reserved */
  234. uint32_t DisableInterruptOnComplete : 1; /*!< Disable the assertion of interrupt to host */
  235. };
  236. uint32_t Value;
  237. } RDES1;
  238. uint32_t Buffer1Addr; /*!< Buffer1 address pointer */
  239. uint32_t Buffer2NextDescAddr; /*!< Buffer2 or next descriptor address pointer */
  240. volatile union {
  241. struct {
  242. uint32_t IPPayloadType : 3; /*!< Type of payload in the IP datagram */
  243. uint32_t IPHeadErr : 1; /*!< IP header error */
  244. uint32_t IPPayloadErr : 1; /*!< IP payload error */
  245. uint32_t IPChecksumBypass : 1; /*!< Checksum offload engine is bypassed */
  246. uint32_t IPv4PacketReceived : 1; /*!< Received packet is an IPv4 packet */
  247. uint32_t IPv6PacketReceived : 1; /*!< Received packet is an IPv6 packet */
  248. uint32_t MessageType : 4; /*!< PTP Message Type */
  249. uint32_t PTPFrameType : 1; /*!< PTP message is over Ethernet or IPv4/IPv6 */
  250. uint32_t PTPVersion : 1; /*!< Version of PTP protocol */
  251. uint32_t TimestampDropped : 1; /*!< Timestamp dropped because of overflow */
  252. uint32_t Reserved1 : 1; /*!< Reserved */
  253. uint32_t AVPacketReceived : 1; /*!< AV packet is received */
  254. uint32_t AVTaggedPacketReceived : 1; /*!< AV tagged packet is received */
  255. uint32_t VLANTagPrioVal : 3; /*!< VLAN tag's user value in the received packekt */
  256. uint32_t Reserved2 : 3; /*!< Reserved */
  257. uint32_t Layer3FilterMatch : 1; /*!< Received frame matches one of the enabled Layer3 IP */
  258. uint32_t Layer4FilterMatch : 1; /*!< Received frame matches one of the enabled Layer4 IP */
  259. uint32_t Layer3Layer4FilterNumberMatch : 2; /*!< Number of Layer3 and Layer4 Filter that matches the received frame */
  260. uint32_t Reserved3 : 4; /*!< Reserved */
  261. };
  262. uint32_t Value;
  263. } ExtendedStatus;
  264. uint32_t Reserved; /*!< Reserved */
  265. uint32_t TimeStampLow; /*!< Receive frame timestamp low */
  266. uint32_t TimeStampHigh; /*!< Receive frame timestamp high */
  267. } eth_dma_rx_descriptor_t;
  268. #define EMAC_DMAPTPRXDESC_PTPMT_SYNC 0x00000100U /* SYNC message (all clock types) */
  269. #define EMAC_DMAPTPRXDESC_PTPMT_FOLLOWUP 0x00000200U /* FollowUp message (all clock types) */
  270. #define EMAC_DMAPTPRXDESC_PTPMT_DELAYREQ 0x00000300U /* DelayReq message (all clock types) */
  271. #define EMAC_DMAPTPRXDESC_PTPMT_DELAYRESP 0x00000400U /* DelayResp message (all clock types) */
  272. #define EMAC_DMAPTPRXDESC_PTPMT_PDELAYREQ_ANNOUNCE 0x00000500U /* PdelayReq message (peer-to-peer transparent clock) or Announce message (Ordinary or Boundary clock) */
  273. #define EMAC_DMAPTPRXDESC_PTPMT_PDELAYRESP_MANAG 0x00000600U /* PdelayResp message (peer-to-peer transparent clock) or Management message (Ordinary or Boundary clock) */
  274. #define EMAC_DMAPTPRXDESC_PTPMT_PDELAYRESPFOLLOWUP_SIGNAL 0x00000700U /* PdelayRespFollowUp message (peer-to-peer transparent clock) or Signaling message (Ordinary or Boundary clock) */
  275. #define EMAC_DMAPTPRXDESC_IPPT_UDP 0x00000001U /* UDP payload encapsulated in the IP datagram */
  276. #define EMAC_DMAPTPRXDESC_IPPT_TCP 0x00000002U /* TCP payload encapsulated in the IP datagram */
  277. #define EMAC_DMAPTPRXDESC_IPPT_ICMP 0x00000003U /* ICMP payload encapsulated in the IP datagram */
  278. #define EMAC_DMADESC_OWNER_CPU (0)
  279. #define EMAC_DMADESC_OWNER_DMA (1)
  280. _Static_assert(sizeof(eth_dma_rx_descriptor_t) == 32, "eth_dma_rx_descriptor_t should occupy 32 bytes in memory");
  281. typedef struct {
  282. emac_mac_dev_t *mac_regs;
  283. emac_dma_dev_t *dma_regs;
  284. emac_ext_dev_t *ext_regs;
  285. uint8_t **rx_buf;
  286. uint8_t **tx_buf;
  287. void *descriptors;
  288. eth_dma_rx_descriptor_t *rx_desc;
  289. eth_dma_tx_descriptor_t *tx_desc;
  290. } emac_hal_context_t;
  291. void emac_hal_init(emac_hal_context_t *hal, void *descriptors,
  292. uint8_t **rx_buf, uint8_t **tx_buf);
  293. void emac_hal_reset_desc_chain(emac_hal_context_t *hal);
  294. void emac_hal_lowlevel_init(emac_hal_context_t *hal);
  295. void emac_hal_reset(emac_hal_context_t *hal);
  296. bool emac_hal_is_reset_done(emac_hal_context_t *hal);
  297. void emac_hal_set_csr_clock_range(emac_hal_context_t *hal);
  298. void emac_hal_init_mac_default(emac_hal_context_t *hal);
  299. void emac_hal_init_dma_default(emac_hal_context_t *hal);
  300. void emac_hal_set_speed(emac_hal_context_t *hal, uint32_t speed);
  301. void emac_hal_set_duplex(emac_hal_context_t *hal, uint32_t duplex);
  302. void emac_hal_set_promiscuous(emac_hal_context_t *hal, bool enable);
  303. bool emac_hal_is_mii_busy(emac_hal_context_t *hal);
  304. void emac_hal_set_phy_cmd(emac_hal_context_t *hal, uint32_t phy_addr, uint32_t phy_reg, bool write);
  305. void emac_hal_set_phy_data(emac_hal_context_t *hal, uint32_t reg_value);
  306. uint32_t emac_hal_get_phy_data(emac_hal_context_t *hal);
  307. void emac_hal_set_address(emac_hal_context_t *hal, uint8_t *mac_addr);
  308. void emac_hal_start(emac_hal_context_t *hal);
  309. void emac_hal_stop(emac_hal_context_t *hal);
  310. uint32_t emac_hal_get_tx_desc_owner(emac_hal_context_t *hal);
  311. uint32_t emac_hal_transmit_frame(emac_hal_context_t *hal, uint8_t *buf, uint32_t length);
  312. uint32_t emac_hal_receive_frame(emac_hal_context_t *hal, uint8_t *buf, uint32_t size, uint32_t *frames_remain);
  313. void emac_hal_isr(void *arg);
  314. void emac_hal_tx_complete_cb(void *arg);
  315. void emac_hal_tx_unavail_cb (void *arg);
  316. void emac_hal_rx_complete_cb (void *arg);
  317. void emac_hal_rx_early_cb(void *arg);
  318. void emac_hal_rx_unavail_cb(void *arg);
  319. #ifdef __cplusplus
  320. }
  321. #endif