diff options
author | root <root@lab.ourano.james.local> | 2021-02-26 12:12:38 +0000 |
---|---|---|
committer | root <root@lab.ourano.james.local> | 2021-02-26 12:12:38 +0000 |
commit | 3d48137c00511b3f2d35511482d1a76f8d06382d (patch) | |
tree | d75c88220cc847007869b0795a240c5077948262 /app/lwip_glue.c | |
parent | 6d3a824e1cdae6e28146b7de380724b49488f3c2 (diff) | |
download | clock-3d48137c00511b3f2d35511482d1a76f8d06382d.tar.gz clock-3d48137c00511b3f2d35511482d1a76f8d06382d.tar.bz2 clock-3d48137c00511b3f2d35511482d1a76f8d06382d.zip |
works
Diffstat (limited to 'app/lwip_glue.c')
-rw-r--r-- | app/lwip_glue.c | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/app/lwip_glue.c b/app/lwip_glue.c index 1e69fc0..9fed1e6 100644 --- a/app/lwip_glue.c +++ b/app/lwip_glue.c @@ -11,6 +11,11 @@ uint32_t sys_now (void) void dispatch_lwip (void) { #if 0 + static uint32_t fine_timer,coarse_timer; + uint32_t now=ticks; +#endif + +#if 0 if (link_lost()) netif_set_down (&if0); @@ -23,15 +28,14 @@ void dispatch_lwip (void) sys_check_timeouts(); #if 0 - /* Fine DHCP periodic process every 500ms */ - if (localtime - DHCPfineTimer >= DHCP_FINE_TIMER_MSECS) { - DHCPfineTimer = localtime; + if (now - fine_timer >= DHCP_FINE_TIMER_MSECS) { + fine_timer = now; dhcp_fine_tmr(); if ((DHCP_state != DHCP_ADDRESS_ASSIGNED) && (DHCP_state != DHCP_TIMEOUT)) { /* toggle LED1 to indicate DHCP on-going process */ - STM_EVAL_LEDToggle (LED1); + //STM_EVAL_LEDToggle (LED1); /* process DHCP state machine */ LwIP_DHCP_Process_Handle(); @@ -39,43 +43,31 @@ void dispatch_lwip (void) } /* DHCP Coarse periodic process every 60s */ - if (localtime - DHCPcoarseTimer >= DHCP_COARSE_TIMER_MSECS) { - DHCPcoarseTimer = localtime; + if (now - coarse_timer >= DHCP_COARSE_TIMER_MSECS) { + coarse_timer = now; dhcp_coarse_tmr(); } - #endif + } void start_lwip (void) { - struct ip_addr ipaddr; - struct ip_addr netmask; - struct ip_addr gw; - - // uint8_t macaddress[6]={0,0,0,0,0,1}; lwip_init(); -#if 0 - IP4_ADDR (&ipaddr, 10, 32, 99, 73); - IP4_ADDR (&netmask, 255, 255, 255, 0); - IP4_ADDR (&gw, 10, 32, 99, 1); -#else - IP4_ADDR (&ipaddr, 10, 32, 96, 47); - IP4_ADDR (&netmask, 255, 255, 255, 0); - IP4_ADDR (&gw, 10, 32, 96, 1); -#endif - netif_add (&if0, &ipaddr, &netmask, &gw, NULL, steth_lwip_init, ethernet_input); + netif_add (&if0, NULL,NULL,NULL, NULL, steth_lwip_init, ethernet_input); /* Registers the default network interface.*/ netif_set_default (&if0); netif_set_up (&if0); + dhcp_start(&if0); + } |