Skip to content

Commit

Permalink
Upgraded LWIP to 1.4.0 released from Espressif.
Browse files Browse the repository at this point in the history
Plus directly provided patch for user_interface.h.
  • Loading branch information
jmattsson committed Oct 12, 2015
1 parent 711d464 commit 5d5be35
Show file tree
Hide file tree
Showing 27 changed files with 1,552 additions and 1,065 deletions.
5 changes: 4 additions & 1 deletion app/include/lwip/app/dhcpserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ typedef struct dhcps_msg {

#ifndef LWIP_OPEN_SRC
struct dhcps_lease {
bool enable;
struct ip_addr start_ip;
struct ip_addr end_ip;
};
Expand All @@ -46,7 +47,8 @@ typedef struct _list_node{
struct _list_node *pnext;
}list_node;

#define DHCPS_LEASE_TIMER 0x05A0
extern uint32 dhcps_lease_time;
#define DHCPS_LEASE_TIMER dhcps_lease_time //0x05A0
#define DHCPS_MAX_LEASE 0x64
#define BOOTP_BROADCAST 0x8000

Expand Down Expand Up @@ -89,6 +91,7 @@ typedef struct _list_node{
#define DHCPS_STATE_ACK 3
#define DHCPS_STATE_NAK 4
#define DHCPS_STATE_IDLE 5
#define DHCPS_STATE_RELEASE 6

#define dhcps_router_enabled(offer) ((offer & OFFER_ROUTER) != 0)

Expand Down
3 changes: 2 additions & 1 deletion app/include/lwip/app/espconn.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ typedef void (* espconn_reconnect_callback)(void *arg, sint8 err);
#define ESPCONN_CONN -11 /* Not connected. */

#define ESPCONN_ARG -12 /* Illegal argument. */
#define ESPCONN_IF -14 /* Low_level error */
#define ESPCONN_ISCONN -15 /* Already connected. */

#define ESPCONN_HANDSHAKE -28 /* ssl handshake failed */
Expand Down Expand Up @@ -168,7 +169,7 @@ typedef struct _espconn_msg{
struct espconn *pespconn;
comon_pkt pcommon;
uint8 count_opt;
sint16_t hs_status; //the status of the handshake
int16_t hs_status; //the status of the handshake
void *preverse;
void *pssl;
struct _espconn_msg *pnext;
Expand Down
13 changes: 13 additions & 0 deletions app/include/lwip/app/espconn_udp.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ extern sint8 espconn_udp_server(struct espconn *espconn);

extern err_t espconn_udp_sent(void *arg, uint8 *psent, uint16 length);

/******************************************************************************
* FunctionName : espconn_udp_sendto
* Description : sent data for UDP
* Parameters : void *arg -- UDP to send
* uint8* psent -- Data to send
* uint16 length -- Length of data to send
* Returns : return espconn error code.
* - ESPCONN_OK. Successful. No error occured.
* - ESPCONN_MEM. Out of memory.
* - ESPCONN_RTE. Could not find route to destination address.
* - More errors could be returned by lower protocol layers.
*******************************************************************************/
extern err_t espconn_udp_sendto(void *arg, uint8 *psent, uint16 length);

#endif /* __ESPCONN_UDP_H__ */

Expand Down
25 changes: 24 additions & 1 deletion app/include/lwip/mem.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#define __LWIP_MEM_H__

#include "lwip/opt.h"
#include "mem_manager.h"
//#include "mem_manager.h"

#ifdef __cplusplus
extern "C" {
Expand All @@ -50,6 +50,7 @@ typedef size_t mem_size_t;
/* in case C library malloc() needs extra protection,
* allow these defines to be overridden.
*/
#ifndef MEMLEAK_DEBUG
#ifndef mem_free
#define mem_free vPortFree
#endif
Expand All @@ -64,6 +65,28 @@ typedef size_t mem_size_t;
#endif
#ifndef mem_zalloc
#define mem_zalloc pvPortZalloc
#endif
#else
#ifndef mem_free
#define mem_free(s) \
do{\
const char *file = mem_debug_file;\
vPortFree(s, file, __LINE__);\
}while(0)
#endif
#ifndef mem_malloc
#define mem_malloc(s) ({const char *file = mem_debug_file; pvPortMalloc(s, file, __LINE__);})
#endif
#ifndef mem_calloc
#define mem_calloc(s) ({const char *file = mem_debug_file; pvPortCalloc(s, file, __LINE__);})
#endif
#ifndef mem_realloc
#define mem_realloc(p, s) ({const char *file = mem_debug_file; pvPortRealloc(p, s, file, __LINE__);})
#endif
#ifndef mem_zalloc
#define mem_zalloc(s) ({const char *file = mem_debug_file; pvPortZalloc(s, file, __LINE__);})
#endif

#endif

#ifndef os_malloc
Expand Down
5 changes: 4 additions & 1 deletion app/include/lwip/netif.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ typedef void (*netif_status_callback_fn)(struct netif *netif);
typedef err_t (*netif_igmp_mac_filter_fn)(struct netif *netif,
ip_addr_t *group, u8_t action);

/*add DHCP event processing by LiuHan*/
typedef void (*dhcp_event_fn)(void);

/** Generic data structure used for all lwIP network interfaces.
* The following fields should be filled in by the initialization
* function for the device driver: hwaddr_len, hwaddr[], mtu, flags */
Expand Down Expand Up @@ -170,7 +173,7 @@ struct netif {
/** the DHCP client state information for this netif */
struct dhcp *dhcp;
struct udp_pcb *dhcps_pcb; //dhcps
void *pad;
dhcp_event_fn dhcp_event;
#endif /* LWIP_DHCP */
#if LWIP_AUTOIP
/** the AutoIP client state information for this netif */
Expand Down
4 changes: 2 additions & 2 deletions app/include/lwip/sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@ void sys_arch_unprotect(sys_prot_t pval)ICACHE_FLASH_ATTR;
#else

#define SYS_ARCH_DECL_PROTECT(lev)
#define SYS_ARCH_PROTECT(lev) lev = ets_intr_lock() //fix by ives at 2014.3.24
#define SYS_ARCH_UNPROTECT(lev) lev = ets_intr_unlock()
#define SYS_ARCH_PROTECT(lev) lev = os_intr_lock() //fix by ives at 2014.3.24
#define SYS_ARCH_UNPROTECT(lev) lev = os_intr_unlock()

#endif /* SYS_LIGHTWEIGHT_PROT */

Expand Down
9 changes: 8 additions & 1 deletion app/include/lwipopts.h
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,13 @@
#define DHCP_DOES_ARP_CHECK ((LWIP_DHCP) && (LWIP_ARP))
#endif

/**
* DHCP_MAXRTX: Maximum number of retries of current request.
*/
#ifndef DHCP_MAXRTX
#define DHCP_MAXRTX (*(volatile uint32*)0x600011E0)
#endif

/*
------------------------------------
---------- AUTOIP options ----------
Expand Down Expand Up @@ -934,7 +941,7 @@
* Define to 0 if your device is low on memory.
*/
#ifndef TCP_QUEUE_OOSEQ
#define TCP_QUEUE_OOSEQ 0
#define TCP_QUEUE_OOSEQ 1
#endif

#if 1
Expand Down
Loading

0 comments on commit 5d5be35

Please sign in to comment.