[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [task #16181] Priority desynchronization between LwIP and F
From: |
Jonathan D |
Subject: |
[lwip-devel] [task #16181] Priority desynchronization between LwIP and FreeRTOS |
Date: |
Thu, 5 May 2022 11:08:12 -0400 (EDT) |
URL:
<https://savannah.nongnu.org/task/?16181>
Summary: Priority desynchronization between LwIP and FreeRTOS
Project: lwIP - A Lightweight TCP/IP stack
Submitted by: jona
Submitted on: Thu 05 May 2022 03:08:10 PM UTC
Category: Contrib
Should Start On: Thu 05 May 2022 12:00:00 AM UTC
Should be Finished on: Thu 05 May 2022 12:00:00 AM UTC
Priority: 4
Status: None
Privacy: Public
Percent Complete: 0%
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Planned Release: None
Effort: 0.00
_______________________________________________________
Details:
In LwIP, priorities for tasks span from -3 to +3.
In FreeRTOS, priorities span from 0 to 6.
Here is a patch to resynchronize both scales:
---
diff --git a/ports/freertos/sys_arch.c b/ports/freertos/sys_arch.c
index 84bd463..7d40f83 100644
--- a/ports/freertos/sys_arch.c
+++ b/ports/freertos/sys_arch.c
@@ -477,7 +477,7 @@ sys_thread_new(const char *name, lwip_thread_fn thread,
void *arg, int stacksize
/* lwIP's lwip_thread_fn matches FreeRTOS' TaskFunction_t, so we can pass
the
thread function without adaption here. */
- ret = xTaskCreate(thread, name, (configSTACK_DEPTH_TYPE)rtos_stacksize,
arg, prio, &rtos_task);
+ ret = xTaskCreate(thread, name, (configSTACK_DEPTH_TYPE)rtos_stacksize,
arg, makeFreeRtosPriority(prio), &rtos_task);
LWIP_ASSERT("task creation failed", ret == pdTRUE);
lwip_thread.thread_handle = rtos_task;
---
With:
---
/* Convert from CMSIS type osPriority to FreeRTOS priority number */
unsigned portBASE_TYPE makeFreeRtosPriority (osPriority priority)
{
unsigned portBASE_TYPE fpriority = tskIDLE_PRIORITY;
if (priority != osPriorityError) {
fpriority += (priority - osPriorityIdle);
}
return fpriority;
}
---
_______________________________________________________
Reply to this item at:
<https://savannah.nongnu.org/task/?16181>
_______________________________________________
Message sent via Savannah
https://savannah.nongnu.org/
- [lwip-devel] [task #16181] Priority desynchronization between LwIP and FreeRTOS,
Jonathan D <=