2019-11-26 09:48:38 +00:00
|
|
|
// Copyright 2019 Espressif Systems (Shanghai) PTE LTD
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
#pragma once
|
|
|
|
|
2020-09-08 09:39:56 +00:00
|
|
|
#include "esp_eth.h"
|
|
|
|
|
2019-11-26 09:48:38 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2021-08-03 11:34:52 +00:00
|
|
|
/**
|
|
|
|
* @brief Handle of netif glue - an intermediate layer between netif and Ethernet driver
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
typedef struct esp_eth_netif_glue_t* esp_eth_netif_glue_handle_t;
|
|
|
|
|
2019-11-26 09:48:38 +00:00
|
|
|
/**
|
|
|
|
* @brief Create a netif glue for Ethernet driver
|
|
|
|
* @note netif glue is used to attach io driver to TCP/IP netif
|
|
|
|
*
|
|
|
|
* @param eth_hdl Ethernet driver handle
|
|
|
|
* @return glue object, which inherits esp_netif_driver_base_t
|
|
|
|
*/
|
2021-08-03 11:34:52 +00:00
|
|
|
esp_eth_netif_glue_handle_t esp_eth_new_netif_glue(esp_eth_handle_t eth_hdl);
|
2019-11-26 09:48:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Delete netif glue of Ethernet driver
|
|
|
|
*
|
2021-08-03 11:34:52 +00:00
|
|
|
* @param eth_netif_glue netif glue
|
2019-11-26 09:48:38 +00:00
|
|
|
* @return -ESP_OK: delete netif glue successfully
|
|
|
|
*/
|
2021-08-03 11:34:52 +00:00
|
|
|
esp_err_t esp_eth_del_netif_glue(esp_eth_netif_glue_handle_t eth_netif_glue);
|
2019-11-26 09:48:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Register default IP layer handlers for Ethernet
|
|
|
|
*
|
|
|
|
* @note: Ethernet handle might not yet properly initialized when setting up these default handlers
|
2021-08-03 11:34:52 +00:00
|
|
|
* @warning: This function is deprecated and is kept here only for compatibility reasons. Registration
|
|
|
|
* of default IP layer handlers for Ethernet is now handled automatically. Do not call this
|
|
|
|
* function if you want to use multiple Ethernet instances at a time.
|
2019-11-26 09:48:38 +00:00
|
|
|
*
|
|
|
|
* @param[in] esp_netif esp network interface handle created for Ethernet driver
|
|
|
|
* @return
|
|
|
|
* - ESP_ERR_INVALID_ARG: invalid parameter (esp_netif is NULL)
|
|
|
|
* - ESP_OK: set default IP layer handlers successfully
|
|
|
|
* - others: other failure occurred during register esp_event handler
|
|
|
|
*/
|
2021-08-03 11:34:52 +00:00
|
|
|
esp_err_t esp_eth_set_default_handlers(void *esp_netif) __attribute__ ((deprecated));
|
2019-11-26 09:48:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Unregister default IP layer handlers for Ethernet
|
|
|
|
*
|
2021-08-03 11:34:52 +00:00
|
|
|
* @warning: This function is deprecated and is kept here only for compatibility reasons. Unregistration
|
|
|
|
* of default IP layer handlers for Ethernet is now handled automatically if not registered
|
|
|
|
* by calling esp_eth_set_default_handlers.
|
|
|
|
*
|
2019-11-26 09:48:38 +00:00
|
|
|
* @param[in] esp_netif esp network interface handle created for Ethernet driver
|
|
|
|
* @return
|
|
|
|
* - ESP_ERR_INVALID_ARG: invalid parameter (esp_netif is NULL)
|
|
|
|
* - ESP_OK: clear default IP layer handlers successfully
|
|
|
|
* - others: other failure occurred during unregister esp_event handler
|
|
|
|
*/
|
|
|
|
esp_err_t esp_eth_clear_default_handlers(void *esp_netif);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|