diff --git a/lib/sw_apps/lwip_echo_server/src/main.c b/lib/sw_apps/lwip_echo_server/src/main.c index db1ad49a..7b0e8a39 100755 --- a/lib/sw_apps/lwip_echo_server/src/main.c +++ b/lib/sw_apps/lwip_echo_server/src/main.c @@ -42,6 +42,8 @@ #include "xil_printf.h" #endif +#include "lwip/tcp.h" + #if LWIP_DHCP==1 #include "lwip/dhcp.h" #endif @@ -59,6 +61,8 @@ extern volatile int dhcp_timoutcntr; err_t dhcp_start(struct netif *netif); #endif +extern volatile int TcpFastTmrFlag; +extern volatile int TcpSlowTmrFlag; static struct netif server_netif; struct netif *echo_netif; @@ -165,6 +169,14 @@ int main() /* receive and process packets */ while (1) { + if (TcpFastTmrFlag) { + tcp_fasttmr(); + TcpFastTmrFlag = 0; + } + if (TcpSlowTmrFlag) { + tcp_slowtmr(); + TcpSlowTmrFlag = 0; + } xemacif_input(echo_netif); transfer_data(); } diff --git a/lib/sw_apps/lwip_echo_server/src/platform.c b/lib/sw_apps/lwip_echo_server/src/platform.c index 1dbe49da..2026c535 100755 --- a/lib/sw_apps/lwip_echo_server/src/platform.c +++ b/lib/sw_apps/lwip_echo_server/src/platform.c @@ -37,6 +37,7 @@ #include "xparameters.h" #include "xintc.h" #include "xil_exception.h" +#include "lwip/tcp.h" #ifdef STDOUT_IS_16550 #include "xuartns550_l.h" #endif @@ -49,6 +50,9 @@ void dhcp_fine_tmr(); void dhcp_coarse_tmr(); #endif +volatile int TcpFastTmrFlag = 0; +volatile int TcpSlowTmrFlag = 0; + void timer_callback() { @@ -59,7 +63,7 @@ timer_callback() #if LWIP_DHCP==1 static int dhcp_timer = 0; #endif - tcp_fasttmr(); + TcpFastTmrFlag = 1; odd = !odd; if (odd) { @@ -68,8 +72,7 @@ timer_callback() dhcp_timer++; dhcp_timoutcntr--; #endif - tcp_slowtmr(); - + TcpSlowTmrFlag = 1; #if LWIP_DHCP==1 dhcp_fine_tmr(); if (dhcp_timer >= 120) { diff --git a/lib/sw_apps/lwip_echo_server/src/platform_zynq.c b/lib/sw_apps/lwip_echo_server/src/platform_zynq.c index 011a69e6..e4df659f 100755 --- a/lib/sw_apps/lwip_echo_server/src/platform_zynq.c +++ b/lib/sw_apps/lwip_echo_server/src/platform_zynq.c @@ -79,6 +79,9 @@ static int ResetRxCntr = 0; extern struct netif *echo_netif; #endif +volatile int TcpFastTmrFlag = 0; +volatile int TcpSlowTmrFlag = 0; + #if LWIP_DHCP==1 volatile int dhcp_timoutcntr = 24; void dhcp_fine_tmr(); @@ -95,18 +98,18 @@ timer_callback(XScuTimer * TimerInstance) #if LWIP_DHCP==1 static int dhcp_timer = 0; #endif + TcpFastTmrFlag = 1; odd = !odd; #ifndef USE_SOFTETH_ON_ZYNQ ResetRxCntr++; #endif - tcp_fasttmr(); if (odd) { #if LWIP_DHCP==1 dhcp_timer++; dhcp_timoutcntr--; #endif - tcp_slowtmr(); + TcpSlowTmrFlag = 1; #if LWIP_DHCP==1 dhcp_fine_tmr(); if (dhcp_timer >= 120) {