First set of changes for from-source esp-lwip
This commit is contained in:
parent
2449914df1
commit
e4bc8fab7a
6 changed files with 91 additions and 7 deletions
|
@ -84,7 +84,7 @@
|
||||||
#define configTICK_RATE_HZ ( ( portTickType ) 100 )
|
#define configTICK_RATE_HZ ( ( portTickType ) 100 )
|
||||||
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 15 )
|
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 15 )
|
||||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short )156 )
|
#define configMINIMAL_STACK_SIZE ( ( unsigned short )156 )
|
||||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 24 * 1024 ) )
|
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 18 * 1024 ) )
|
||||||
#define configMAX_TASK_NAME_LEN ( 16 )
|
#define configMAX_TASK_NAME_LEN ( 16 )
|
||||||
#define configUSE_TRACE_FACILITY 0
|
#define configUSE_TRACE_FACILITY 0
|
||||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
|
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
|
||||||
|
|
|
@ -2,15 +2,89 @@
|
||||||
|
|
||||||
These two symbols are called from libnet80211.a
|
These two symbols are called from libnet80211.a
|
||||||
*/
|
*/
|
||||||
|
#include "lwip/opt.h"
|
||||||
|
|
||||||
/* called from hostap_input... less clear what this is for! */
|
#include "lwip/def.h"
|
||||||
void ethernetif_init(void)
|
#include "lwip/mem.h"
|
||||||
|
#include "lwip/pbuf.h"
|
||||||
|
#include <lwip/stats.h>
|
||||||
|
#include <lwip/snmp.h>
|
||||||
|
#include "netif/etharp.h"
|
||||||
|
#include "netif/ppp_oe.h"
|
||||||
|
|
||||||
|
/* declared in libnet80211.a */
|
||||||
|
int8_t ieee80211_output_pbuf(struct netif *ifp, struct pbuf* pb);
|
||||||
|
//sint8 ieee80211_output_pbuf(struct ieee80211_conn *conn, esf_buf *eb);
|
||||||
|
|
||||||
|
static err_t
|
||||||
|
low_level_output(struct netif *netif, struct pbuf *p)
|
||||||
{
|
{
|
||||||
|
struct pbuf *q;
|
||||||
|
|
||||||
|
for(q = p; q != NULL; q = q->next) {
|
||||||
|
ieee80211_output_pbuf(netif, q);
|
||||||
|
}
|
||||||
|
|
||||||
|
LINK_STATS_INC(link.xmit);
|
||||||
|
|
||||||
|
return ERR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
err_t ethernetif_init(struct netif *netif)
|
||||||
|
{
|
||||||
|
LWIP_ASSERT("netif != NULL", (netif != NULL));
|
||||||
|
|
||||||
|
#if LWIP_NETIF_HOSTNAME
|
||||||
|
/* Initialize interface hostname */
|
||||||
|
netif->hostname = "lwip";
|
||||||
|
#endif /* LWIP_NETIF_HOSTNAME */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize the snmp variables and counters inside the struct netif.
|
||||||
|
* The last argument should be replaced with your link speed, in units
|
||||||
|
* of bits per second.
|
||||||
|
*/
|
||||||
|
NETIF_INIT_SNMP(netif, snmp_ifType_ethernet_csmacd, LINK_SPEED_OF_YOUR_NETIF_IN_BPS);
|
||||||
|
|
||||||
|
//netif->state = (void *)0xDEADBEEF; /* this appears unused by esp layer */
|
||||||
|
netif->name[0] = 'e';
|
||||||
|
netif->name[1] = 'n';
|
||||||
|
netif->output = etharp_output;
|
||||||
|
/* NB: in the SDK there's a static wrapper function to this, not sure what it does!! */
|
||||||
|
netif->linkoutput = low_level_output;
|
||||||
|
|
||||||
|
/* low level init components */
|
||||||
|
netif->hwaddr_len = 6;
|
||||||
|
/* hwaddr seems to be set elsewhere, or (more likely) is per-packet by MAC layer */
|
||||||
|
netif->mtu = 1500;
|
||||||
|
netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP;
|
||||||
|
|
||||||
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* called from ieee80211_deliver_data with new IP frames */
|
/* called from ieee80211_deliver_data with new IP frames */
|
||||||
void ethernetif_input(void)
|
void ethernetif_input(struct netif *netif, struct pbuf *p)
|
||||||
{
|
{
|
||||||
|
struct eth_hdr *ethhdr = p->payload;
|
||||||
|
/* examine packet payloads ethernet header */
|
||||||
|
|
||||||
|
switch (htons(ethhdr->type)) {
|
||||||
|
/* IP or ARP packet? */
|
||||||
|
case ETHTYPE_IP:
|
||||||
|
case ETHTYPE_ARP:
|
||||||
|
// case ETHTYPE_IPV6:
|
||||||
|
/* full packet send to tcpip_thread to process */
|
||||||
|
if (netif->input(p, netif)!=ERR_OK)
|
||||||
|
{ LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_input: IP input error\n"));
|
||||||
|
pbuf_free(p);
|
||||||
|
p = NULL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
pbuf_free(p);
|
||||||
|
p = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
#pragma pack(push,1)
|
|
|
@ -59,7 +59,7 @@ typedef uint32_t u32_t;
|
||||||
typedef int32_t s32_t;
|
typedef int32_t s32_t;
|
||||||
|
|
||||||
typedef size_t mem_ptr_t;
|
typedef size_t mem_ptr_t;
|
||||||
typedef u32_t sys_prot_t;
|
typedef int sys_prot_t;
|
||||||
|
|
||||||
/* Define (sn)printf formatters for these lwIP types */
|
/* Define (sn)printf formatters for these lwIP types */
|
||||||
#define X8_F "02x"
|
#define X8_F "02x"
|
||||||
|
@ -84,4 +84,9 @@ typedef u32_t sys_prot_t;
|
||||||
printf("Assertion \"%s\" failed at line %d in %s\n", message, __LINE__, __FILE__); \
|
printf("Assertion \"%s\" failed at line %d in %s\n", message, __LINE__, __FILE__); \
|
||||||
handler;} } while(0)
|
handler;} } while(0)
|
||||||
|
|
||||||
|
#define LWIP_PLATFORM_BYTESWAP 1
|
||||||
|
|
||||||
|
#define LWIP_PLATFORM_HTONS(_n) ((u16_t)((((_n) & 0xff) << 8) | (((_n) >> 8) & 0xff)))
|
||||||
|
#define LWIP_PLATFORM_HTONL(_n) ((u32_t)( (((_n) & 0xff) << 24) | (((_n) & 0xff00) << 8) | (((_n) >> 8) & 0xff00) | (((_n) >> 24) & 0xff) ))
|
||||||
|
|
||||||
#endif /* __ARCH_CC_H__ */
|
#endif /* __ARCH_CC_H__ */
|
||||||
|
|
|
@ -32,6 +32,12 @@
|
||||||
#ifndef __LWIPOPTS_H__
|
#ifndef __LWIPOPTS_H__
|
||||||
#define __LWIPOPTS_H__
|
#define __LWIPOPTS_H__
|
||||||
|
|
||||||
|
#define LWIP_ESP 1
|
||||||
|
#define ESP_RTOS 1
|
||||||
|
#define PBUF_RSV_FOR_WLAN 1
|
||||||
|
#define EBUF_LWIP 1
|
||||||
|
#define ESP_TIMEWAIT_THRESHOLD 10000
|
||||||
|
|
||||||
/*
|
/*
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
---------- Platform specific locking ----------
|
---------- Platform specific locking ----------
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 5b8b5d459e7dd890724515bbfad86c705234f9ec
|
Subproject commit 808c24237c1e9a3862b2eb1e0a94fd34ede6ec79
|
Loading…
Reference in a new issue