esp_eth_mac.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  1. /*
  2. * SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #include <stdbool.h>
  8. #include "esp_eth_com.h"
  9. #include "sdkconfig.h"
  10. #if CONFIG_ETH_USE_SPI_ETHERNET
  11. #include "driver/spi_master.h"
  12. #endif
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. /**
  17. * @brief Ethernet MAC
  18. *
  19. */
  20. typedef struct esp_eth_mac_s esp_eth_mac_t;
  21. /**
  22. * @brief Ethernet MAC
  23. *
  24. */
  25. struct esp_eth_mac_s {
  26. /**
  27. * @brief Set mediator for Ethernet MAC
  28. *
  29. * @param[in] mac: Ethernet MAC instance
  30. * @param[in] eth: Ethernet mediator
  31. *
  32. * @return
  33. * - ESP_OK: set mediator for Ethernet MAC successfully
  34. * - ESP_ERR_INVALID_ARG: set mediator for Ethernet MAC failed because of invalid argument
  35. *
  36. */
  37. esp_err_t (*set_mediator)(esp_eth_mac_t *mac, esp_eth_mediator_t *eth);
  38. /**
  39. * @brief Initialize Ethernet MAC
  40. *
  41. * @param[in] mac: Ethernet MAC instance
  42. *
  43. * @return
  44. * - ESP_OK: initialize Ethernet MAC successfully
  45. * - ESP_ERR_TIMEOUT: initialize Ethernet MAC failed because of timeout
  46. * - ESP_FAIL: initialize Ethernet MAC failed because some other error occurred
  47. *
  48. */
  49. esp_err_t (*init)(esp_eth_mac_t *mac);
  50. /**
  51. * @brief Deinitialize Ethernet MAC
  52. *
  53. * @param[in] mac: Ethernet MAC instance
  54. *
  55. * @return
  56. * - ESP_OK: deinitialize Ethernet MAC successfully
  57. * - ESP_FAIL: deinitialize Ethernet MAC failed because some error occurred
  58. *
  59. */
  60. esp_err_t (*deinit)(esp_eth_mac_t *mac);
  61. /**
  62. * @brief Start Ethernet MAC
  63. *
  64. * @param[in] mac: Ethernet MAC instance
  65. *
  66. * @return
  67. * - ESP_OK: start Ethernet MAC successfully
  68. * - ESP_FAIL: start Ethernet MAC failed because some other error occurred
  69. *
  70. */
  71. esp_err_t (*start)(esp_eth_mac_t *mac);
  72. /**
  73. * @brief Stop Ethernet MAC
  74. *
  75. * @param[in] mac: Ethernet MAC instance
  76. *
  77. * @return
  78. * - ESP_OK: stop Ethernet MAC successfully
  79. * - ESP_FAIL: stop Ethernet MAC failed because some error occurred
  80. *
  81. */
  82. esp_err_t (*stop)(esp_eth_mac_t *mac);
  83. /**
  84. * @brief Transmit packet from Ethernet MAC
  85. *
  86. * @param[in] mac: Ethernet MAC instance
  87. * @param[in] buf: packet buffer to transmit
  88. * @param[in] length: length of packet
  89. *
  90. * @return
  91. * - ESP_OK: transmit packet successfully
  92. * - ESP_ERR_INVALID_SIZE: number of actually sent bytes differs to expected
  93. * - ESP_FAIL: transmit packet failed because some other error occurred
  94. *
  95. * @note Returned error codes may differ for each specific MAC chip.
  96. *
  97. */
  98. esp_err_t (*transmit)(esp_eth_mac_t *mac, uint8_t *buf, uint32_t length);
  99. /**
  100. * @brief Transmit packet from Ethernet MAC constructed with special parameters at Layer2.
  101. *
  102. * @param[in] mac: Ethernet MAC instance
  103. * @param[in] argc: number variable arguments
  104. * @param[in] args: variable arguments
  105. *
  106. * @note Typical intended use case is to make possible to construct a frame from multiple higher layer
  107. * buffers without a need of buffer reallocations. However, other use cases are not limited.
  108. *
  109. * @return
  110. * - ESP_OK: transmit packet successfully
  111. * - ESP_ERR_INVALID_SIZE: number of actually sent bytes differs to expected
  112. * - ESP_FAIL: transmit packet failed because some other error occurred
  113. *
  114. * @note Returned error codes may differ for each specific MAC chip.
  115. *
  116. */
  117. esp_err_t (*transmit_vargs)(esp_eth_mac_t *mac, uint32_t argc, va_list args);
  118. /**
  119. * @brief Receive packet from Ethernet MAC
  120. *
  121. * @param[in] mac: Ethernet MAC instance
  122. * @param[out] buf: packet buffer which will preserve the received frame
  123. * @param[out] length: length of the received packet
  124. *
  125. * @note Memory of buf is allocated in the Layer2, make sure it get free after process.
  126. * @note Before this function got invoked, the value of "length" should set by user, equals the size of buffer.
  127. * After the function returned, the value of "length" means the real length of received data.
  128. *
  129. * @return
  130. * - ESP_OK: receive packet successfully
  131. * - ESP_ERR_INVALID_ARG: receive packet failed because of invalid argument
  132. * - ESP_ERR_INVALID_SIZE: input buffer size is not enough to hold the incoming data.
  133. * in this case, value of returned "length" indicates the real size of incoming data.
  134. * - ESP_FAIL: receive packet failed because some other error occurred
  135. *
  136. */
  137. esp_err_t (*receive)(esp_eth_mac_t *mac, uint8_t *buf, uint32_t *length);
  138. /**
  139. * @brief Read PHY register
  140. *
  141. * @param[in] mac: Ethernet MAC instance
  142. * @param[in] phy_addr: PHY chip address (0~31)
  143. * @param[in] phy_reg: PHY register index code
  144. * @param[out] reg_value: PHY register value
  145. *
  146. * @return
  147. * - ESP_OK: read PHY register successfully
  148. * - ESP_ERR_INVALID_ARG: read PHY register failed because of invalid argument
  149. * - ESP_ERR_INVALID_STATE: read PHY register failed because of wrong state of MAC
  150. * - ESP_ERR_TIMEOUT: read PHY register failed because of timeout
  151. * - ESP_FAIL: read PHY register failed because some other error occurred
  152. *
  153. */
  154. esp_err_t (*read_phy_reg)(esp_eth_mac_t *mac, uint32_t phy_addr, uint32_t phy_reg, uint32_t *reg_value);
  155. /**
  156. * @brief Write PHY register
  157. *
  158. * @param[in] mac: Ethernet MAC instance
  159. * @param[in] phy_addr: PHY chip address (0~31)
  160. * @param[in] phy_reg: PHY register index code
  161. * @param[in] reg_value: PHY register value
  162. *
  163. * @return
  164. * - ESP_OK: write PHY register successfully
  165. * - ESP_ERR_INVALID_STATE: write PHY register failed because of wrong state of MAC
  166. * - ESP_ERR_TIMEOUT: write PHY register failed because of timeout
  167. * - ESP_FAIL: write PHY register failed because some other error occurred
  168. *
  169. */
  170. esp_err_t (*write_phy_reg)(esp_eth_mac_t *mac, uint32_t phy_addr, uint32_t phy_reg, uint32_t reg_value);
  171. /**
  172. * @brief Set MAC address
  173. *
  174. * @param[in] mac: Ethernet MAC instance
  175. * @param[in] addr: MAC address
  176. *
  177. * @return
  178. * - ESP_OK: set MAC address successfully
  179. * - ESP_ERR_INVALID_ARG: set MAC address failed because of invalid argument
  180. * - ESP_FAIL: set MAC address failed because some other error occurred
  181. *
  182. */
  183. esp_err_t (*set_addr)(esp_eth_mac_t *mac, uint8_t *addr);
  184. /**
  185. * @brief Get MAC address
  186. *
  187. * @param[in] mac: Ethernet MAC instance
  188. * @param[out] addr: MAC address
  189. *
  190. * @return
  191. * - ESP_OK: get MAC address successfully
  192. * - ESP_ERR_INVALID_ARG: get MAC address failed because of invalid argument
  193. * - ESP_FAIL: get MAC address failed because some other error occurred
  194. *
  195. */
  196. esp_err_t (*get_addr)(esp_eth_mac_t *mac, uint8_t *addr);
  197. /**
  198. * @brief Set speed of MAC
  199. *
  200. * @param[in] ma:c Ethernet MAC instance
  201. * @param[in] speed: MAC speed
  202. *
  203. * @return
  204. * - ESP_OK: set MAC speed successfully
  205. * - ESP_ERR_INVALID_ARG: set MAC speed failed because of invalid argument
  206. * - ESP_FAIL: set MAC speed failed because some other error occurred
  207. *
  208. */
  209. esp_err_t (*set_speed)(esp_eth_mac_t *mac, eth_speed_t speed);
  210. /**
  211. * @brief Set duplex mode of MAC
  212. *
  213. * @param[in] mac: Ethernet MAC instance
  214. * @param[in] duplex: MAC duplex
  215. *
  216. * @return
  217. * - ESP_OK: set MAC duplex mode successfully
  218. * - ESP_ERR_INVALID_ARG: set MAC duplex failed because of invalid argument
  219. * - ESP_FAIL: set MAC duplex failed because some other error occurred
  220. *
  221. */
  222. esp_err_t (*set_duplex)(esp_eth_mac_t *mac, eth_duplex_t duplex);
  223. /**
  224. * @brief Set link status of MAC
  225. *
  226. * @param[in] mac: Ethernet MAC instance
  227. * @param[in] link: Link status
  228. *
  229. * @return
  230. * - ESP_OK: set link status successfully
  231. * - ESP_ERR_INVALID_ARG: set link status failed because of invalid argument
  232. * - ESP_FAIL: set link status failed because some other error occurred
  233. *
  234. */
  235. esp_err_t (*set_link)(esp_eth_mac_t *mac, eth_link_t link);
  236. /**
  237. * @brief Set promiscuous of MAC
  238. *
  239. * @param[in] mac: Ethernet MAC instance
  240. * @param[in] enable: set true to enable promiscuous mode; set false to disable promiscuous mode
  241. *
  242. * @return
  243. * - ESP_OK: set promiscuous mode successfully
  244. * - ESP_FAIL: set promiscuous mode failed because some error occurred
  245. *
  246. */
  247. esp_err_t (*set_promiscuous)(esp_eth_mac_t *mac, bool enable);
  248. /**
  249. * @brief Enable flow control on MAC layer or not
  250. *
  251. * @param[in] mac: Ethernet MAC instance
  252. * @param[in] enable: set true to enable flow control; set false to disable flow control
  253. *
  254. * @return
  255. * - ESP_OK: set flow control successfully
  256. * - ESP_FAIL: set flow control failed because some error occurred
  257. *
  258. */
  259. esp_err_t (*enable_flow_ctrl)(esp_eth_mac_t *mac, bool enable);
  260. /**
  261. * @brief Set the PAUSE ability of peer node
  262. *
  263. * @param[in] mac: Ethernet MAC instance
  264. * @param[in] ability: zero indicates that pause function is supported by link partner; non-zero indicates that pause function is not supported by link partner
  265. *
  266. * @return
  267. * - ESP_OK: set peer pause ability successfully
  268. * - ESP_FAIL: set peer pause ability failed because some error occurred
  269. */
  270. esp_err_t (*set_peer_pause_ability)(esp_eth_mac_t *mac, uint32_t ability);
  271. /**
  272. * @brief Custom IO function of MAC driver. This function is intended to extend common options of esp_eth_ioctl to cover specifics of MAC chip.
  273. *
  274. * @note This function may not be assigned when the MAC chip supports only most common set of configuration options.
  275. *
  276. * @param[in] mac: Ethernet MAC instance
  277. * @param[in] cmd: IO control command
  278. * @param[in, out] data: address of data for `set` command or address where to store the data when used with `get` command
  279. *
  280. * @return
  281. * - ESP_OK: process io command successfully
  282. * - ESP_ERR_INVALID_ARG: process io command failed because of some invalid argument
  283. * - ESP_FAIL: process io command failed because some other error occurred
  284. * - ESP_ERR_NOT_SUPPORTED: requested feature is not supported
  285. */
  286. esp_err_t (*custom_ioctl)(esp_eth_mac_t *mac, uint32_t cmd, void *data);
  287. /**
  288. * @brief Free memory of Ethernet MAC
  289. *
  290. * @param[in] mac: Ethernet MAC instance
  291. *
  292. * @return
  293. * - ESP_OK: free Ethernet MAC instance successfully
  294. * - ESP_FAIL: free Ethernet MAC instance failed because some error occurred
  295. *
  296. */
  297. esp_err_t (*del)(esp_eth_mac_t *mac);
  298. };
  299. /**
  300. * @brief RMII Clock Mode Options
  301. *
  302. */
  303. typedef enum {
  304. /**
  305. * @brief Default values configured using Kconfig are going to be used when "Default" selected.
  306. *
  307. */
  308. EMAC_CLK_DEFAULT,
  309. /**
  310. * @brief Input RMII Clock from external. EMAC Clock GPIO number needs to be configured when this option is selected.
  311. *
  312. * @note MAC will get RMII clock from outside. Note that ESP32 only supports GPIO0 to input the RMII clock.
  313. *
  314. */
  315. EMAC_CLK_EXT_IN,
  316. /**
  317. * @brief Output RMII Clock from internal APLL Clock. EMAC Clock GPIO number needs to be configured when this option is selected.
  318. *
  319. */
  320. EMAC_CLK_OUT
  321. } emac_rmii_clock_mode_t;
  322. /**
  323. * @brief RMII Clock GPIO number Options
  324. *
  325. */
  326. typedef enum {
  327. /**
  328. * @brief MAC will get RMII clock from outside at this GPIO.
  329. *
  330. * @note ESP32 only supports GPIO0 to input the RMII clock.
  331. *
  332. */
  333. EMAC_CLK_IN_GPIO = 0,
  334. /**
  335. * @brief Output RMII Clock from internal APLL Clock available at GPIO0
  336. *
  337. * @note GPIO0 can be set to output a pre-divided PLL clock (test only!). Enabling this option will configure GPIO0 to output a 50MHz clock.
  338. * In fact this clock doesn’t have directly relationship with EMAC peripheral. Sometimes this clock won’t work well with your PHY chip.
  339. * You might need to add some extra devices after GPIO0 (e.g. inverter). Note that outputting RMII clock on GPIO0 is an experimental practice.
  340. * If you want the Ethernet to work with WiFi, don’t select GPIO0 output mode for stability.
  341. *
  342. */
  343. EMAC_APPL_CLK_OUT_GPIO = 0,
  344. /**
  345. * @brief Output RMII Clock from internal APLL Clock available at GPIO16
  346. *
  347. */
  348. EMAC_CLK_OUT_GPIO = 16,
  349. /**
  350. * @brief Inverted Output RMII Clock from internal APLL Clock available at GPIO17
  351. *
  352. */
  353. EMAC_CLK_OUT_180_GPIO = 17
  354. } emac_rmii_clock_gpio_t;
  355. /**
  356. * @brief Ethernet MAC Clock Configuration
  357. *
  358. */
  359. typedef union {
  360. struct {
  361. // MII interface is not fully implemented...
  362. // Reserved for GPIO number, clock source, etc. in MII mode
  363. } mii; /*!< EMAC MII Clock Configuration */
  364. struct {
  365. emac_rmii_clock_mode_t clock_mode; /*!< RMII Clock Mode Configuration */
  366. emac_rmii_clock_gpio_t clock_gpio; /*!< RMII Clock GPIO Configuration */
  367. } rmii; /*!< EMAC RMII Clock Configuration */
  368. } eth_mac_clock_config_t;
  369. /**
  370. * @brief Configuration of Ethernet MAC object
  371. *
  372. */
  373. typedef struct {
  374. uint32_t sw_reset_timeout_ms; /*!< Software reset timeout value (Unit: ms) */
  375. uint32_t rx_task_stack_size; /*!< Stack size of the receive task */
  376. uint32_t rx_task_prio; /*!< Priority of the receive task */
  377. uint32_t flags; /*!< Flags that specify extra capability for mac driver */
  378. } eth_mac_config_t;
  379. #define ETH_MAC_FLAG_WORK_WITH_CACHE_DISABLE (1 << 0) /*!< MAC driver can work when cache is disabled */
  380. #define ETH_MAC_FLAG_PIN_TO_CORE (1 << 1) /*!< Pin MAC task to the CPU core where driver installation happened */
  381. /**
  382. * @brief Default configuration for Ethernet MAC object
  383. *
  384. */
  385. #define ETH_MAC_DEFAULT_CONFIG() \
  386. { \
  387. .sw_reset_timeout_ms = 100, \
  388. .rx_task_stack_size = 2048, \
  389. .rx_task_prio = 15, \
  390. .flags = 0, \
  391. }
  392. #if CONFIG_ETH_USE_ESP32_EMAC
  393. /**
  394. * @brief EMAC specific configuration
  395. *
  396. */
  397. typedef struct {
  398. int smi_mdc_gpio_num; /*!< SMI MDC GPIO number, set to -1 could bypass the SMI GPIO configuration */
  399. int smi_mdio_gpio_num; /*!< SMI MDIO GPIO number, set to -1 could bypass the SMI GPIO configuration */
  400. eth_data_interface_t interface; /*!< EMAC Data interface to PHY (MII/RMII) */
  401. eth_mac_clock_config_t clock_config; /*!< EMAC Interface clock configuration */
  402. eth_mac_dma_burst_len_t dma_burst_len; /*!< EMAC DMA burst length for both Tx and Rx */
  403. } eth_esp32_emac_config_t;
  404. /**
  405. * @brief Default ESP32's EMAC specific configuration
  406. *
  407. */
  408. #define ETH_ESP32_EMAC_DEFAULT_CONFIG() \
  409. { \
  410. .smi_mdc_gpio_num = 23, \
  411. .smi_mdio_gpio_num = 18, \
  412. .interface = EMAC_DATA_INTERFACE_RMII, \
  413. .clock_config = \
  414. { \
  415. .rmii = \
  416. { \
  417. .clock_mode = EMAC_CLK_DEFAULT, \
  418. .clock_gpio = EMAC_CLK_IN_GPIO \
  419. } \
  420. }, \
  421. .dma_burst_len = ETH_DMA_BURST_LEN_32 \
  422. }
  423. /**
  424. * @brief Create ESP32 Ethernet MAC instance
  425. *
  426. * @param esp32_config: EMAC specific configuration
  427. * @param config: Ethernet MAC configuration
  428. *
  429. * @return
  430. * - instance: create MAC instance successfully
  431. * - NULL: create MAC instance failed because some error occurred
  432. */
  433. esp_eth_mac_t *esp_eth_mac_new_esp32(const eth_esp32_emac_config_t *esp32_config, const eth_mac_config_t *config);
  434. #endif // CONFIG_ETH_USE_ESP32_EMAC
  435. #if CONFIG_ETH_SPI_ETHERNET_DM9051
  436. /**
  437. * @brief DM9051 specific configuration
  438. *
  439. */
  440. typedef struct {
  441. spi_host_device_t spi_host_id; /*!< SPI peripheral */
  442. spi_device_interface_config_t *spi_devcfg; /*!< SPI device configuration */
  443. int int_gpio_num; /*!< Interrupt GPIO number */
  444. } eth_dm9051_config_t;
  445. /**
  446. * @brief Default DM9051 specific configuration
  447. *
  448. */
  449. #define ETH_DM9051_DEFAULT_CONFIG(spi_host, spi_devcfg_p) \
  450. { \
  451. .spi_host_id = spi_host, \
  452. .spi_devcfg = spi_devcfg_p, \
  453. .int_gpio_num = 4, \
  454. }
  455. /**
  456. * @brief Create DM9051 Ethernet MAC instance
  457. *
  458. * @param dm9051_config: DM9051 specific configuration
  459. * @param mac_config: Ethernet MAC configuration
  460. *
  461. * @return
  462. * - instance: create MAC instance successfully
  463. * - NULL: create MAC instance failed because some error occurred
  464. */
  465. esp_eth_mac_t *esp_eth_mac_new_dm9051(const eth_dm9051_config_t *dm9051_config, const eth_mac_config_t *mac_config);
  466. #endif // CONFIG_ETH_SPI_ETHERNET_DM9051
  467. #if CONFIG_ETH_SPI_ETHERNET_W5500
  468. /**
  469. * @brief W5500 specific configuration
  470. *
  471. */
  472. typedef struct {
  473. spi_host_device_t spi_host_id; /*!< SPI peripheral */
  474. spi_device_interface_config_t *spi_devcfg; /*!< SPI device configuration */
  475. int int_gpio_num; /*!< Interrupt GPIO number */
  476. } eth_w5500_config_t;
  477. /**
  478. * @brief Default W5500 specific configuration
  479. *
  480. */
  481. #define ETH_W5500_DEFAULT_CONFIG(spi_host, spi_devcfg_p) \
  482. { \
  483. .spi_host_id = spi_host, \
  484. .spi_devcfg = spi_devcfg_p, \
  485. .int_gpio_num = 4, \
  486. }
  487. /**
  488. * @brief Create W5500 Ethernet MAC instance
  489. *
  490. * @param w5500_config: W5500 specific configuration
  491. * @param mac_config: Ethernet MAC configuration
  492. *
  493. * @return
  494. * - instance: create MAC instance successfully
  495. * - NULL: create MAC instance failed because some error occurred
  496. */
  497. esp_eth_mac_t *esp_eth_mac_new_w5500(const eth_w5500_config_t *w5500_config, const eth_mac_config_t *mac_config);
  498. #endif // CONFIG_ETH_SPI_ETHERNET_W5500
  499. #if CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL
  500. /**
  501. * @brief KSZ8851SNL specific configuration
  502. *
  503. */
  504. typedef struct {
  505. spi_host_device_t spi_host_id; /*!< SPI peripheral */
  506. spi_device_interface_config_t *spi_devcfg; /*!< SPI device configuration */
  507. int int_gpio_num; /*!< Interrupt GPIO number */
  508. } eth_ksz8851snl_config_t;
  509. /**
  510. * @brief Default KSZ8851SNL specific configuration
  511. *
  512. */
  513. #define ETH_KSZ8851SNL_DEFAULT_CONFIG(spi_host, spi_devcfg_p) \
  514. { \
  515. .spi_host_id = spi_host, \
  516. .spi_devcfg = spi_devcfg_p, \
  517. .int_gpio_num = 14, \
  518. }
  519. /**
  520. * @brief Create KSZ8851SNL Ethernet MAC instance
  521. *
  522. * @param ksz8851snl_config: KSZ8851SNL specific configuration
  523. * @param mac_config: Ethernet MAC configuration
  524. *
  525. * @return
  526. * - instance: create MAC instance successfully
  527. * - NULL: create MAC instance failed because some error occurred
  528. */
  529. esp_eth_mac_t *esp_eth_mac_new_ksz8851snl(const eth_ksz8851snl_config_t *ksz8851snl_config, const eth_mac_config_t *mac_config);
  530. #endif // CONFIG_ETH_SPI_ETHERNET_KSZ8851
  531. #if CONFIG_ETH_USE_OPENETH
  532. /**
  533. * @brief Create OpenCores Ethernet MAC instance
  534. *
  535. * @param config: Ethernet MAC configuration
  536. *
  537. * @return
  538. * - instance: create MAC instance successfully
  539. * - NULL: create MAC instance failed because some error occurred
  540. */
  541. esp_eth_mac_t *esp_eth_mac_new_openeth(const eth_mac_config_t *config);
  542. #endif // CONFIG_ETH_USE_OPENETH
  543. #ifdef __cplusplus
  544. }
  545. #endif