[Top][All Lists]

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

Re: [lwip-users] How to check send state?

From: Simon Goldschmidt
Subject: Re: [lwip-users] How to check send state?
Date: Wed, 17 Sep 2014 09:08:11 +0200

Karl Karpfen wrote:
> OK, so let me ask this in an different way:
> Currently I do have data to be sent available in main loop only.
> How can I enqueue these data into the lwIP-ISR-context correctly
> so that it can be transmitted without problems?

To do that you'd either need to lock interrupts and then call into lwIP (so 
that you are absolutely sure your ethernet interrupt does not call lwIP code 
while running it from the main loop) or put your data on a list and 
soft-trigger an interrupt on the same priority.

However, the "standard" way to handle this is to let the interrupt pull packets 
off the MAC, put them on a list and let lwIP run from the main loop, too. This 
way you only need to make the pbuf and mem(p) functions thread-safe, which can 
be achieved by setting SYS_LIGHTWEIGHT_PROT==1 (plus defining the 
SYS_ARCH_PROTECT macros correctly) and 
LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT==1 (to allow the TX-finished interrupt 
to free PBUF_RAM pbufs from ISR).

> Currently I'm doing it as described at http://lwip.wikia.com/wiki/Raw/TCPin 
> section
> "Sending TCP data" which seems to be wrong for my case...

I only get an empty page with this link: "This page needs content. You can help 
by adding a sentence or a photo."


reply via email to

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