esp_eth_netif_glue.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. #include "esp_eth.h"
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. /**
  20. * @brief Handle of netif glue - an intermediate layer between netif and Ethernet driver
  21. *
  22. */
  23. typedef struct esp_eth_netif_glue_t* esp_eth_netif_glue_handle_t;
  24. /**
  25. * @brief Create a netif glue for Ethernet driver
  26. * @note netif glue is used to attach io driver to TCP/IP netif
  27. *
  28. * @param eth_hdl Ethernet driver handle
  29. * @return glue object, which inherits esp_netif_driver_base_t
  30. */
  31. esp_eth_netif_glue_handle_t esp_eth_new_netif_glue(esp_eth_handle_t eth_hdl);
  32. /**
  33. * @brief Delete netif glue of Ethernet driver
  34. *
  35. * @param eth_netif_glue netif glue
  36. * @return -ESP_OK: delete netif glue successfully
  37. */
  38. esp_err_t esp_eth_del_netif_glue(esp_eth_netif_glue_handle_t eth_netif_glue);
  39. /**
  40. * @brief Register default IP layer handlers for Ethernet
  41. *
  42. * @note: Ethernet handle might not yet properly initialized when setting up these default handlers
  43. * @warning: This function is deprecated and is kept here only for compatibility reasons. Registration
  44. * of default IP layer handlers for Ethernet is now handled automatically. Do not call this
  45. * function if you want to use multiple Ethernet instances at a time.
  46. *
  47. * @param[in] esp_netif esp network interface handle created for Ethernet driver
  48. * @return
  49. * - ESP_ERR_INVALID_ARG: invalid parameter (esp_netif is NULL)
  50. * - ESP_OK: set default IP layer handlers successfully
  51. * - others: other failure occurred during register esp_event handler
  52. */
  53. esp_err_t esp_eth_set_default_handlers(void *esp_netif) __attribute__ ((deprecated));
  54. /**
  55. * @brief Unregister default IP layer handlers for Ethernet
  56. *
  57. * @warning: This function is deprecated and is kept here only for compatibility reasons. Unregistration
  58. * of default IP layer handlers for Ethernet is now handled automatically if not registered
  59. * by calling esp_eth_set_default_handlers.
  60. *
  61. * @param[in] esp_netif esp network interface handle created for Ethernet driver
  62. * @return
  63. * - ESP_ERR_INVALID_ARG: invalid parameter (esp_netif is NULL)
  64. * - ESP_OK: clear default IP layer handlers successfully
  65. * - others: other failure occurred during unregister esp_event handler
  66. */
  67. esp_err_t esp_eth_clear_default_handlers(void *esp_netif);
  68. #ifdef __cplusplus
  69. }
  70. #endif