Semaphore Initialization - Linux and FreeRTOS #89

Merged
gaisser merged 16 commits from KSat/fsfw:mueller_binSemaphoreInit into master 2020-08-28 13:25:07 +02:00
2 changed files with 24 additions and 22 deletions
Showing only changes of commit 073f168b95 - Show all commits

View File

@ -1,6 +1,6 @@
#include <framework/osal/FreeRTOS/TaskManagement.h>
#include "../../osal/FreeRTOS/TaskManagement.h"
void TaskManagement::requestContextSwitchFromTask() {
void TaskManagement::vRequestContextSwitchFromTask() {
vTaskDelay(0);
}
@ -8,9 +8,9 @@ void TaskManagement::requestContextSwitch(
CallContext callContext = CallContext::TASK) {
if(callContext == CallContext::ISR) {
// This function depends on the partmacro.h definition for the specific device
requestContextSwitchFromISR();
vRequestContextSwitchFromISR();
} else {
requestContextSwitchFromTask();
vRequestContextSwitchFromTask();
}
}
@ -18,6 +18,7 @@ TaskHandle_t TaskManagement::getCurrentTaskHandle() {
return xTaskGetCurrentTaskHandle();
}
configSTACK_DEPTH_TYPE TaskManagement::getTaskStackHighWatermark() {
return uxTaskGetStackHighWaterMark(TaskManagement::getCurrentTaskHandle());
size_t TaskManagement::getTaskStackHighWatermark(
TaskHandle_t task) {
return uxTaskGetStackHighWaterMark(task) * sizeof(StackType_t);
}

View File

@ -1,7 +1,7 @@
#ifndef FRAMEWORK_OSAL_FREERTOS_TASKMANAGEMENT_H_
#define FRAMEWORK_OSAL_FREERTOS_TASKMANAGEMENT_H_
#include <framework/returnvalues/HasReturnvaluesIF.h>
#include "../../returnvalues/HasReturnvaluesIF.h"
extern "C" {
#include <freertos/FreeRTOS.h>
@ -13,7 +13,7 @@ extern "C" {
* Architecture dependant portmacro.h function call.
* Should be implemented in bsp.
*/
extern "C" void requestContextSwitchFromISR();
extern void vRequestContextSwitchFromISR();
/*!
* Used by functions to tell if they are being called from
@ -41,7 +41,7 @@ public:
* If task preemption in FreeRTOS is disabled, a context switch
* can be requested manually by calling this function.
*/
static void requestContextSwitchFromTask(void);
static void vRequestContextSwitchFromTask(void);
/**
* @return The current task handle
@ -57,7 +57,8 @@ public:
* @return Smallest value of stack remaining since the task was started in
* words.
*/
static configSTACK_DEPTH_TYPE getTaskStackHighWatermark();
static size_t getTaskStackHighWatermark(
TaskHandle_t task = nullptr);
};
#endif /* FRAMEWORK_OSAL_FREERTOS_TASKMANAGEMENT_H_ */