2020-04-22 19:50:07 +02:00
|
|
|
/**
|
|
|
|
* @file TaskManagement.cpp
|
|
|
|
*
|
|
|
|
* @date 26.02.2020
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#include <framework/osal/FreeRTOS/TaskManagement.h>
|
2020-04-22 19:53:06 +02:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
#include "FreeRTOS.h"
|
2020-04-22 19:50:07 +02:00
|
|
|
#include "portmacro.h"
|
|
|
|
#include "task.h"
|
2020-04-22 19:53:06 +02:00
|
|
|
}
|
2020-04-22 19:50:07 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* TODO: This stuff is hardware and architecture and mission dependant...
|
2020-04-22 19:53:06 +02:00
|
|
|
* Maybe there is a better solution? The request ContextSwitch function
|
|
|
|
* could be declared external for example.
|
2020-04-22 19:50:07 +02:00
|
|
|
*/
|
|
|
|
void TaskManagement::requestContextSwitchFromTask() {
|
|
|
|
vTaskDelay(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TaskManagement::requestContextSwitch(CallContext callContext = CallContext::task) {
|
|
|
|
if(callContext == CallContext::isr) {
|
|
|
|
// This function depends on the partmacro.h definition for the specific device
|
|
|
|
portYIELD_FROM_ISR();
|
|
|
|
} else {
|
|
|
|
requestContextSwitchFromTask();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|