[En-Nut-Discussion] NutNetIfConfig() blocks other threads

Tim DeBaillie debaillie at ciholas.com
Tue May 26 15:13:46 CEST 2009


urbi wrote:
> Hello,
>
> I have a Problem with initializing the ethernet without a physical
> connection. In this case the function NutNetIfConfig() is blocking all other
> threads. I have tryed to give different priority to the other threads, but
> the function NutNetIfConfig() is still blocking.
>
> The reason I found in the function EmacReset(uint32_t tmo) in the module
> at91_emac.c. I am using a AT91SAM7x256 microcontroller. If no physical
> connection is detected the function is waiting in a while loop. To give the
> other threads CPU-time I add a NutSleep(0) statement in this while loop:
>
>         while (--tmo) {
>             if (phy_inw(NIC_PHY_BMSR) & NIC_PHY_BMSR_ANCOMPL) {
>                 break;
>             }
>             NutSleep(0);
>         }
>
> In this way all other threads are not blocked when no physical connation is
> detected.
> Has anyone else the same problem?
>   

Yes. That's always the first modification I make to the OS. It would be 
nice if there were some define to turn this option on or off. I would 
use a NutThreadYield though, it's more explicit.

Tim



More information about the En-Nut-Discussion mailing list