|
@@ -1,20 +1,18 @@
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
|
#include "lwip/mem.h"
|
|
|
#include "lwip/memp.h"
|
|
|
-#include "lwip/tcp.h"
|
|
|
-#include "lwip/tcp_impl.h"
|
|
|
-#include "lwip/udp.h"
|
|
|
-#include "netif/etharp.h"
|
|
|
#include "lwip/dhcp.h"
|
|
|
-#include "lwip/ip_addr.h"
|
|
|
#include "ethernetif.h"
|
|
|
+#include "tcpip.h"
|
|
|
#include "main.h"
|
|
|
#include "netconf.h"
|
|
|
#include "common_config.h"
|
|
|
#include "settings_api.h"
|
|
|
+#include "netconf.h"
|
|
|
#include "tinystdio.h"
|
|
|
-#include "lwip/timers.h"
|
|
|
#include "lwip/init.h"
|
|
|
+#include "lwip/timeouts.h"
|
|
|
+#include "netif/etharp.h"
|
|
|
|
|
|
/* Private typedef -----------------------------------------------------------*/
|
|
|
#define MAX_DHCP_TRIES 4
|
|
@@ -52,9 +50,9 @@ void LwIP_DHCP_Process_Handle(void);
|
|
|
*/
|
|
|
void LwIP_Init(void)
|
|
|
{
|
|
|
- struct ip_addr ipaddr;
|
|
|
- struct ip_addr netmask;
|
|
|
- struct ip_addr gw;
|
|
|
+ struct ip4_addr ipaddr;
|
|
|
+ struct ip4_addr netmask;
|
|
|
+ struct ip4_addr gw;
|
|
|
char str[20];
|
|
|
|
|
|
lwip_init();
|
|
@@ -84,6 +82,7 @@ void LwIP_Init(void)
|
|
|
|
|
|
netif_add(&netif, &ipaddr, &netmask, &gw, NULL, ðernetif_init, ðernet_input);
|
|
|
netif_set_default(&netif);
|
|
|
+ netif_set_link_up(&netif);
|
|
|
netif_set_up(&netif);
|
|
|
}
|
|
|
|
|
@@ -167,9 +166,10 @@ void LwIP_Periodic_Handle(__IO uint32_t localtime)
|
|
|
*/
|
|
|
void LwIP_DHCP_Process_Handle()
|
|
|
{
|
|
|
- struct ip_addr ipaddr;
|
|
|
- struct ip_addr netmask;
|
|
|
- struct ip_addr gw;
|
|
|
+ struct ip4_addr ipaddr;
|
|
|
+ struct ip4_addr netmask;
|
|
|
+ struct ip4_addr gw;
|
|
|
+ static uint8_t dhcpTry = 0;
|
|
|
|
|
|
switch (DHCP_state)
|
|
|
{
|
|
@@ -208,7 +208,7 @@ void LwIP_DHCP_Process_Handle()
|
|
|
|
|
|
} else {
|
|
|
/* DHCP timeout */
|
|
|
- if (netif.dhcp->tries > MAX_DHCP_TRIES)
|
|
|
+ if (dhcpTry++ > MAX_DHCP_TRIES)
|
|
|
{
|
|
|
DHCP_state = DHCP_TIMEOUT;
|
|
|
|