2020-08-18 13:09:15 +02:00
|
|
|
#include "../../osal/FreeRTOS/TaskManagement.h"
|
|
|
|
|
2020-07-11 18:24:09 +02:00
|
|
|
void TaskManagement::vRequestContextSwitchFromTask() {
|
2020-02-26 16:55:35 +01:00
|
|
|
vTaskDelay(0);
|
|
|
|
}
|
2020-08-18 13:09:15 +02:00
|
|
|
|
2020-05-18 17:46:04 +02:00
|
|
|
void TaskManagement::requestContextSwitch(
|
2020-08-18 13:09:15 +02:00
|
|
|
CallContext callContext = CallContext::TASK) {
|
2020-05-29 13:02:13 +02:00
|
|
|
if(callContext == CallContext::ISR) {
|
2020-02-26 16:55:35 +01:00
|
|
|
// This function depends on the partmacro.h definition for the specific device
|
2020-07-11 18:24:09 +02:00
|
|
|
vRequestContextSwitchFromISR();
|
2020-02-26 16:55:35 +01:00
|
|
|
} else {
|
2020-07-11 18:24:09 +02:00
|
|
|
vRequestContextSwitchFromTask();
|
2020-02-26 16:55:35 +01:00
|
|
|
}
|
|
|
|
}
|
2020-08-18 13:09:15 +02:00
|
|
|
|
2020-05-01 16:47:53 +02:00
|
|
|
TaskHandle_t TaskManagement::getCurrentTaskHandle() {
|
|
|
|
return xTaskGetCurrentTaskHandle();
|
|
|
|
}
|
|
|
|
|
2020-07-11 13:38:14 +02:00
|
|
|
size_t TaskManagement::getTaskStackHighWatermark(
|
2020-07-10 19:34:18 +02:00
|
|
|
TaskHandle_t task) {
|
2020-07-11 13:38:14 +02:00
|
|
|
return uxTaskGetStackHighWaterMark(task) * sizeof(StackType_t);
|
2020-08-18 13:09:15 +02:00
|
|
|
}
|