REG_SET_BIT(EMAC_DMAOPERATION_MODE_REG, EMAC_FWD_UNDER_GF);
REG_SET_BIT(EMAC_DMAOPERATION_MODE_REG, EMAC_OPT_SECOND_FRAME);
REG_SET_FIELD(EMAC_DMABUSMODE_REG, EMAC_PROG_BURST_LEN, 4);
- REG_SET_BIT(EMAC_DMAOPERATION_MODE_REG, EMAC_DMAOPERATION_MODE_REG);
}
void emac_mac_enable_txrx(void)
-menu "tcpip adapter"
+menu "TCP/IP Adapter"
config IP_LOST_TIMER_INTERVAL
int "IP Address lost timer interval (seconds)"
the timer expires. The IP lost timer is stopped if the station get the IP again before
the timer expires.
+choice USE_TCPIP_STACK_LIB
+ prompt "TCP/IP Stack Library"
+ default TCPIP_LWIP
+ help
+ Choose the TCP/IP Stack to work, for example, LwIP, uIP, etc.
+config TCPIP_LWIP
+ bool "LwIP"
+ help
+ lwIP is a small independent implementation of the TCP/IP protocol suite.
+endchoice
+
endmenu
* get free station list APIs in application side. Other APIs are used in esp-idf internal,
* otherwise the state maybe wrong.
*
- * TODO: ipv6 support will be added, use menuconfig to disable CONFIG_TCPIP_LWIP
+ * TODO: ipv6 support will be added
*/
#include <stdint.h>
#include "rom/queue.h"
#include "esp_wifi_types.h"
-
-#define CONFIG_TCPIP_LWIP 1
-#define CONFIG_DHCP_STA_LIST 1
+#include "sdkconfig.h"
#if CONFIG_TCPIP_LWIP
#include "lwip/ip_addr.h"
typedef dhcps_lease_t tcpip_adapter_dhcps_lease_t;
-#if CONFIG_DHCP_STA_LIST
typedef struct {
uint8_t mac[6];
ip4_addr_t ip;
tcpip_adapter_sta_info_t sta[ESP_WIFI_MAX_CONN_NUM];
int num;
} tcpip_adapter_sta_list_t;
-#endif
#endif
-#define ESP_ERR_TCPIP_ADAPTER_BASE 0x5000 // TODO: move base address to esp_err.h
-
+#define ESP_ERR_TCPIP_ADAPTER_BASE 0x5000
#define ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS ESP_ERR_TCPIP_ADAPTER_BASE + 0x01
#define ESP_ERR_TCPIP_ADAPTER_IF_NOT_READY ESP_ERR_TCPIP_ADAPTER_BASE + 0x02
#define ESP_ERR_TCPIP_ADAPTER_DHCPC_START_FAILED ESP_ERR_TCPIP_ADAPTER_BASE + 0x03
#define ESP_ERR_TCPIP_ADAPTER_NO_MEM ESP_ERR_TCPIP_ADAPTER_BASE + 0x06
#define ESP_ERR_TCPIP_ADAPTER_DHCP_NOT_STOPPED ESP_ERR_TCPIP_ADAPTER_BASE + 0x07
-/* TODO: add Ethernet interface */
typedef enum {
TCPIP_ADAPTER_IF_STA = 0, /**< ESP32 station interface */
TCPIP_ADAPTER_IF_AP, /**< ESP32 soft-AP interface */
*/
esp_err_t tcpip_adapter_dhcpc_stop(tcpip_adapter_if_t tcpip_if);
-
-
+/**
+ * @brief Get data from ethernet interface
+ *
+ * This function should be installed by esp_eth_init, so Ethernet packets will be forward to TCPIP stack.
+ *
+ * @param[in] void *buffer: the received data point
+ * @param[in] uint16_t len: the received data length
+ * @param[in] void *eb: parameter
+ *
+ * @return ESP_OK
+ */
esp_err_t tcpip_adapter_eth_input(void *buffer, uint16_t len, void *eb);
/**
*
* @return ESP_IF_WIFI_STA
* ESP_IF_WIFI_AP
- ESP_IF_ETH
+ * ESP_IF_ETH
* ESP_IF_MAX
*/
esp_interface_t tcpip_adapter_get_esp_if(void *dev);