[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] best approach to lwip using FreeRTOS
From: |
Sergio Sider |
Subject: |
Re: [lwip-users] best approach to lwip using FreeRTOS |
Date: |
Sat, 14 Mar 2009 10:52:04 -0300 |
Hi Richard & All,
Thank you all for your help!
> I have just sent you some files. They might be the same as you already
> have.
> Regards,
> Richard.
Yes, it´s the same I already have. Thanks anyway!
Well, I made some tests using the lwip 1.3.0 implementation from
Luminary. It´s NO_SYS=1 and SYS_LIGHTWEIGHT_PROT=1.
The timeout counters were implemented in a timer ISR each 10ms, and
the Ethernet ISR just sets a flag to be polled by the main
application, that called lwip to process the packets and re-enables
the ethernet interrupt.
So, I did the following to adapt to FreeRTOS
1) Created a task to mimic the timer interrupt for processing the lwip
timeout counters
void vLWIPTimerTask (void* pvParameters)
{
portTickType xLastWakeTime = xTaskGetTickCount();
for (;;)
{
lwIPServiceTimers(10); //luminary´s procs the lwip counters
vTaskDelayUntil (&xLastWakeTime, (10 / portTICK_RATE_MS));
//each 10ms
}
}
2) created a thread for lwip, that initializes the stack and then
stays in a loop
...
while (1) {
....other processing...
if (HWREGBITW(&System_Flags,FLAG_RXPKT) ||
HWREGBITW(&System_Flags,FLAG_TXPKT)) {
stellarisif_interrupt(&lwip_netif);
HWREGBITW(&System_Flags,FLAG_RXPKT) = 0;
HWREGBITW(&System_Flags,FLAG_TXPKT) = 0;
EthernetIntEnable(ETH_BASE,ETH_INT_RX);
EthernetIntEnable(ETH_BASE,ETH_INT_RX);
//
// Service any packets on the receive queue.
//
stellarisif_input(&lwip_netif);
}
}
3) changed sys_arch_protect() and sys_arch_unprotect to call
VPortEnterCritical() and vPortExitCritical() instead of the original
disable & enable interrupts.
Well, it´s apparently working ok, although I did not have time to test
it in a 'real' application.
I have 2 questions:
1) Is it ok what I did ? Am I forgetting something ?
2) I was planing to do all ethernet stuff in the lwip thread. But, is
it possible & safe to use it from another thread?
Thanks again for all your help!
Sergio P. SIder
- [lwip-users] best approach to lwip using FreeRTOS, Sergio Sider, 2009/03/13
- Re: [lwip-users] best approach to lwip using FreeRTOS, Francois Bouchard, 2009/03/13
- Re: [lwip-users] best approach to lwip using FreeRTOS, Sergio Sider, 2009/03/13
- Re: [lwip-users] best approach to lwip using FreeRTOS, Francois Bouchard, 2009/03/13
- Re: [lwip-users] best approach to lwip using FreeRTOS, Sergio Sider, 2009/03/13
- Re: [lwip-users] best approach to lwip using FreeRTOS, Kieran Mansley, 2009/03/13
- RE: [lwip-users] best approach to lwip using FreeRTOS, Bill Auerbach, 2009/03/13
- Re: [lwip-users] best approach to lwip using FreeRTOS, Alain M., 2009/03/13
- RE: [lwip-users] best approach to lwip using FreeRTOS, FreeRTOS info, 2009/03/13
- Re: [lwip-users] best approach to lwip using FreeRTOS,
Sergio Sider <=