action
container
contrib
controller
coordinates
datalinklayer
datapool
datapoollocal
defaultcfg
devicehandlers
doc
events
fdir
globalfunctions
health
housekeeping
internalError
ipc
logo
memory
modes
monitoring
objectmanager
osal
FreeRTOS
BinSemaphUsingTask.cpp
BinSemaphUsingTask.h
BinarySemaphore.cpp
BinarySemaphore.h
CMakeLists.txt
Clock.cpp
CountingSemaphUsingTask.cpp
CountingSemaphUsingTask.h
CountingSemaphore.cpp
CountingSemaphore.h
FixedTimeslotTask.cpp
FixedTimeslotTask.h
FreeRTOSTaskIF.h
MessageQueue.cpp
MessageQueue.h
Mutex.cpp
Mutex.h
MutexFactory.cpp
PeriodicTask.cpp
PeriodicTask.h
QueueFactory.cpp
README.md
SemaphoreFactory.cpp
TaskFactory.cpp
TaskManagement.cpp
TaskManagement.h
Timekeeper.cpp
Timekeeper.h
common
host
linux
rtems
windows
CMakeLists.txt
Endiness.h
InternalErrorCodes.h
parameters
power
pus
returnvalues
rmap
serialize
serviceinterface
storagemanager
subsystem
tasks
tcdistribution
thermal
timemanager
tmstorage
tmtcpacket
tmtcservices
unittest
.gitignore
.gitmodules
CHANGELOG
CMakeLists.txt
FSFWVersion.h
LICENSE
NOTICE
README.md
fsfw.mk
63 lines
1.8 KiB
C++
63 lines
1.8 KiB
C++
#ifndef FRAMEWORK_OSAL_FREERTOS_TASKMANAGEMENT_H_
|
|
#define FRAMEWORK_OSAL_FREERTOS_TASKMANAGEMENT_H_
|
|
|
|
#include "../../returnvalues/HasReturnvaluesIF.h"
|
|
|
|
#include <freertos/FreeRTOS.h>
|
|
#include <freertos/task.h>
|
|
|
|
#include <cstdint>
|
|
|
|
/**
|
|
* Architecture dependant portmacro.h function call.
|
|
* Should be implemented in bsp.
|
|
*/
|
|
extern "C" void vRequestContextSwitchFromISR();
|
|
|
|
/*!
|
|
* Used by functions to tell if they are being called from
|
|
* within an ISR or from a regular task. This is required because FreeRTOS
|
|
* has different functions for handling semaphores and messages from within
|
|
* an ISR and task.
|
|
*/
|
|
enum class CallContext {
|
|
TASK = 0x00,//!< task_context
|
|
ISR = 0xFF //!< isr_context
|
|
};
|
|
|
|
|
|
namespace TaskManagement {
|
|
/**
|
|
* @brief In this function, a function dependant on the portmacro.h header
|
|
* function calls to request a context switch can be specified.
|
|
* This can be used if sending to the queue from an ISR caused a task
|
|
* to unblock and a context switch is required.
|
|
*/
|
|
void requestContextSwitch(CallContext callContext);
|
|
|
|
/**
|
|
* If task preemption in FreeRTOS is disabled, a context switch
|
|
* can be requested manually by calling this function.
|
|
*/
|
|
void vRequestContextSwitchFromTask(void);
|
|
|
|
/**
|
|
* @return The current task handle
|
|
*/
|
|
TaskHandle_t getCurrentTaskHandle();
|
|
|
|
/**
|
|
* Get returns the minimum amount of remaining stack space in words
|
|
* that was a available to the task since the task started executing.
|
|
* Please note that the actual value in bytes depends
|
|
* on the stack depth type.
|
|
* E.g. on a 32 bit machine, a value of 200 means 800 bytes.
|
|
* @return Smallest value of stack remaining since the task was started in
|
|
* words.
|
|
*/
|
|
size_t getTaskStackHighWatermark(TaskHandle_t task = nullptr);
|
|
|
|
};
|
|
|
|
#endif /* FRAMEWORK_OSAL_FREERTOS_TASKMANAGEMENT_H_ */
|