mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
esp-netif: SLIP interface refactor to isolate interface from drivers
This commit is contained in:
@@ -16,12 +16,12 @@
|
||||
#ifndef _ESP_NETIF_SLIP_H_
|
||||
#define _ESP_NETIF_SLIP_H_
|
||||
|
||||
#include "esp_netif.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "driver/uart.h"
|
||||
|
||||
/** @brief SLIP event base */
|
||||
ESP_EVENT_DECLARE_BASE(SLIP_EVENT);
|
||||
|
||||
@@ -31,16 +31,11 @@ typedef enum esp_netif_slip_event {
|
||||
|
||||
} esp_netif_slip_event_e;
|
||||
|
||||
/** @brief Forward declaration of lwip_slip_ctx for external use */
|
||||
typedef struct lwip_slip_ctx lwip_slip_ctx_t;
|
||||
|
||||
/** @brief Configuration structure for SLIP network interface
|
||||
*
|
||||
*/
|
||||
typedef struct esp_netif_slip_config {
|
||||
ip6_addr_t addr; /* Local IP6 address */
|
||||
|
||||
uart_port_t uart_dev; /* UART device for reading and writing SLIP information, this must be initialised externally */
|
||||
esp_ip6_addr_t ip6_addr; /* Local IP6 address */
|
||||
|
||||
} esp_netif_slip_config_t;
|
||||
|
||||
@@ -54,21 +49,20 @@ typedef struct esp_netif_slip_config {
|
||||
*/
|
||||
esp_err_t esp_netif_slip_set_params(esp_netif_t *netif, const esp_netif_slip_config_t *config);
|
||||
|
||||
/**
|
||||
* @brief Data path API to input incoming packets to SLIP
|
||||
/** @brief Sets IPV6 address for the supplied esp-netif.
|
||||
*
|
||||
* @param[in] esp_netif handle to slip esp-netif instance
|
||||
* @param[in] buffer pointer to the incoming data
|
||||
* @param[in] len length of the data
|
||||
* @param[in] netif handle to slip esp-netif instance
|
||||
* @param[in] ipv6 IPv6 address of the SLIP interface
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* @return ESP_OK on success, ESP_ERR_ESP_NETIF_INVALID_PARAMS if netif null or not SLIP
|
||||
*/
|
||||
void esp_netif_lwip_slip_raw_input(esp_netif_t *netif, void *buffer, size_t len);
|
||||
esp_err_t esp_netif_slip_set_ipv6(esp_netif_t *netif, const esp_ip6_addr_t *ipv6);
|
||||
|
||||
/**
|
||||
* @brief Data path API to write raw packet ous the SLIP interface
|
||||
*
|
||||
* This API is typically used when implementing user defined methods
|
||||
*
|
||||
* @param[in] esp_netif handle to slip esp-netif instance
|
||||
* @param[in] buffer pointer to the outgoing data
|
||||
* @param[in] len length of the data
|
||||
@@ -87,37 +81,6 @@ void esp_netif_lwip_slip_raw_output(esp_netif_t *netif, void *buffer, size_t len
|
||||
* @return
|
||||
* - pointer to the internal ip6 address object
|
||||
*/
|
||||
const ip6_addr_t *esp_slip_get_ip6(esp_netif_t *slip_netif);
|
||||
|
||||
/**
|
||||
* @brief Fetch lwip_slip_ctx_t for esp_netif_t object
|
||||
*
|
||||
* This is required to support the wiring of esp_netif objects outside
|
||||
* of this component.
|
||||
*
|
||||
* @return
|
||||
* - lwip slip context
|
||||
*/
|
||||
lwip_slip_ctx_t *esp_netif_lwip_slip_get_ctx(esp_netif_t *slip_netif);
|
||||
|
||||
/**
|
||||
* @brief Start the esp slip netif
|
||||
*
|
||||
* @param[in] esp_netif handle to slip esp-netif instance
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
*/
|
||||
esp_err_t esp_netif_start_slip(lwip_slip_ctx_t *slip_ctx);
|
||||
|
||||
/**
|
||||
* @brief Stop the esp slip netif
|
||||
*
|
||||
* @param[in] esp_netif handle to slip esp-netif instance
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
*/
|
||||
esp_err_t esp_netif_stop_slip(lwip_slip_ctx_t *slip_ctx);
|
||||
const esp_ip6_addr_t *esp_slip_get_ip6(esp_netif_t *slip_netif);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user