feature/ethernet_driver: update ethernet driver

1. The transmitting mode of the packets from LWIP to MAC is changed from synchronous to asynchronous.
2. The receive buf mode : support pointer mode and copy mode.
3. Add get phy status func used to config mac register.
This commit is contained in:
shangke
2016-12-18 21:18:37 +08:00
parent 05fcdcfedb
commit 5ddf6daa98
12 changed files with 501 additions and 203 deletions

View File

@@ -80,6 +80,7 @@
#if ESP_LWIP
#include "esp_wifi_internal.h"
#include "esp_eth.h"
#endif
#define SIZEOF_STRUCT_PBUF LWIP_MEM_ALIGN_SIZE(sizeof(struct pbuf))
@@ -351,7 +352,8 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
p->flags = 0;
#if ESP_LWIP
p->eb = NULL;
p->user_buf = NULL;
p->user_flag = PBUF_USER_FLAG_OWNER_NULL;
#endif
LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_alloc(length=%"U16_F") == %p\n", length, (void *)p));
@@ -720,9 +722,13 @@ pbuf_free(struct pbuf *p)
} else if (type == PBUF_ROM || type == PBUF_REF) {
#if ESP_LWIP
if (type == PBUF_REF && p->eb != NULL ) esp_wifi_internal_free_rx_buffer(p->eb);
if (type == PBUF_REF && p->user_flag == PBUF_USER_FLAG_OWNER_WIFI ) {
esp_wifi_internal_free_rx_buffer(p->user_buf);
}
if (type == PBUF_REF && p->user_flag == PBUF_USER_FLAG_OWNER_ETH ) {
esp_eth_free_rx_buf(p->user_buf);
}
#endif
memp_free(MEMP_PBUF, p);
/* type == PBUF_RAM */
} else {