lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] How to code a delay without effecting Timeouts


From: Arvind NR
Subject: [lwip-users] How to code a delay without effecting Timeouts
Date: Thu, 5 Apr 2012 15:40:14 +0200

Hey

I wanted to insert a delay function to allow sufficient time for my lwip DHCP configuration to bind so that i can print it successfully. I have a while loop as follows :

while (1) {
                            xemacif_input(netif);
                            if (netif->ip_addr.addr) {
                                xil_printf("DHCP IP stack added success\r\n");
                                *some delay function which does not effect timeouts*
                                 xil_printf("%d.%d.%d.%d\n\r", ip4_addr1(netif->ip_addr.addr),ip4_addr2(netif->ip_addr.addr),ip4_addr3(netif->ip_addr.addr), ip4_addr4(netif->ip_addr.addr));
                                 xil_printf("%d.%d.%d.%d\n\r", ip4_addr1(netif->netmask.addr),ip4_addr2(netif->netmask.addr),ip4_addr3(netif->netmask.addr), ip4_addr4(netif->netmask.addr));
                                 xil_printf("%d.%d.%d.%d\n\r", ip4_addr1(netif->gw.addr),ip4_addr2(netif->gw.addr),ip4_addr3(netif->gw.addr), ip4_addr4(netif->gw.addr));
                                break;
                            }
                            mscnt += DHCP_FINE_TIMER_MSECS;
                            if (mscnt >= DHCP_TIMEOUT_MS) {
                                xil_printf("ERROR: DHCP request timed out\r\n");
                                break;
                            }
                        }
When i try to run the program without the delay function the printf is still showing the initial values of the ip ( Which is 0.0.0.0  as it was initialised to this value at the start of my program )
But the DHCP is working perfectly. The DHCP is successfully configured and an IP address configuration is added to my netif . I even tested the echo server . But to find out the new dhcp address assigned i had to go to the network admin computer and check the dhcp server log manually to find out the assigned IP. I feel the printf is a bit premature so i want to insert a delay function to give it enough time to bind.

Can u suggest a suitable delay function which DOES NOT AFFECT THE TIME OUT PROCESS .

Thanks a lot

Regards

Arvind
--
We are what we repeatedly do. Excellence, then, is not an act, but a habit - Aristotle

reply via email to

[Prev in Thread] Current Thread [Next in Thread]