lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] tcpip_init(...) behavior when no Ethernet cable connected


From: Dany Thiffeault
Subject: [lwip-users] tcpip_init(...) behavior when no Ethernet cable connected
Date: Mon, 21 Jun 2010 10:26:32 -0400

Hi,

I'm using Atmel (AVR32) suggestion on how to configure the lwip stack. Here is a code sample:


[thread]
...
sys_sem_t sem;
sem = sys_sem_new(0);

// Initialize the lwIP stack.
tcpip_init(TcpIpInitDone, &sem);

// Block until the lwIP stack is initialized.
sys_sem_wait(sem);
...



// Callback executed when the TCP/IP init is done.
static void TcpIpInitDone(void *arg)
{
    sys_sem_t *sem;
    sem = (sys_sem_t *)arg;

    // Signal the waiting thread that the TCP/IP init is done.
    sys_sem_signal(*sem);
}




This is to be sure that the initialization is done when the function returns, because it's a multithread project using RTOS. So, when my network cable is connected, everything is fine. When it is not connected. I never unblock from the semaphore until I connect one. This is a little problematic for me since at that moment, my watchdog is active (and must be), so I get constant resets.

I know I can probably change my code to make this work, but I was curious to know if  there was a way to start the stack without a cable, successfully and be in a state like if I had a cable and I disconnected it after startup. At flag maybe, or another method?

Thanks a lot,
Dany

reply via email to

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