Merge pull request 'FreeRTOS update' (#305) from KSat/fsfw:mueller/FreeRTOS into development
Reviewed-on: fsfw/fsfw#305
This commit is contained in:
commit
d85686fd8d
@ -3,6 +3,7 @@
|
||||
|
||||
#include "MessageQueueIF.h"
|
||||
#include "MessageQueueMessage.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,10 @@
|
||||
#include "../../osal/FreeRTOS/BinSemaphUsingTask.h"
|
||||
#include "../../osal/FreeRTOS/TaskManagement.h"
|
||||
#include "BinSemaphUsingTask.h"
|
||||
#include "TaskManagement.h"
|
||||
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
||||
|
||||
#if (tskKERNEL_VERSION_MAJOR == 8 && tskKERNEL_VERSION_MINOR > 2) || \
|
||||
tskKERNEL_VERSION_MAJOR > 8
|
||||
|
||||
BinarySemaphoreUsingTask::BinarySemaphoreUsingTask() {
|
||||
handle = TaskManagement::getCurrentTaskHandle();
|
||||
if(handle == nullptr) {
|
||||
@ -16,6 +19,10 @@ BinarySemaphoreUsingTask::~BinarySemaphoreUsingTask() {
|
||||
xTaskNotifyAndQuery(handle, 0, eSetValueWithOverwrite, nullptr);
|
||||
}
|
||||
|
||||
void BinarySemaphoreUsingTask::refreshTaskHandle() {
|
||||
handle = TaskManagement::getCurrentTaskHandle();
|
||||
}
|
||||
|
||||
ReturnValue_t BinarySemaphoreUsingTask::acquire(TimeoutType timeoutType,
|
||||
uint32_t timeoutMs) {
|
||||
TickType_t timeout = 0;
|
||||
@ -93,3 +100,6 @@ uint8_t BinarySemaphoreUsingTask::getSemaphoreCounterFromISR(
|
||||
higherPriorityTaskWoken);
|
||||
return notificationValue;
|
||||
}
|
||||
|
||||
#endif /* (tskKERNEL_VERSION_MAJOR == 8 && tskKERNEL_VERSION_MINOR > 2) || \
|
||||
tskKERNEL_VERSION_MAJOR > 8 */
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef FRAMEWORK_OSAL_FREERTOS_BINSEMAPHUSINGTASK_H_
|
||||
#define FRAMEWORK_OSAL_FREERTOS_BINSEMAPHUSINGTASK_H_
|
||||
#ifndef FSFW_OSAL_FREERTOS_BINSEMAPHUSINGTASK_H_
|
||||
#define FSFW_OSAL_FREERTOS_BINSEMAPHUSINGTASK_H_
|
||||
|
||||
#include "../../returnvalues/HasReturnvaluesIF.h"
|
||||
#include "../../tasks/SemaphoreIF.h"
|
||||
@ -7,13 +7,20 @@
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/task.h>
|
||||
|
||||
#if (tskKERNEL_VERSION_MAJOR == 8 && tskKERNEL_VERSION_MINOR > 2) || \
|
||||
tskKERNEL_VERSION_MAJOR > 8
|
||||
|
||||
/**
|
||||
* @brief Binary Semaphore implementation using the task notification value.
|
||||
* The notification value should therefore not be used
|
||||
* for other purposes.
|
||||
* for other purposes!
|
||||
* @details
|
||||
* Additional information: https://www.freertos.org/RTOS-task-notifications.html
|
||||
* and general semaphore documentation.
|
||||
* This semaphore is bound to the task it is created in!
|
||||
* Take care of building this class with the correct executing task,
|
||||
* (for example in the initializeAfterTaskCreation() function) or
|
||||
* by calling refreshTaskHandle() with the correct executing task.
|
||||
*/
|
||||
class BinarySemaphoreUsingTask: public SemaphoreIF,
|
||||
public HasReturnvaluesIF {
|
||||
@ -25,6 +32,16 @@ public:
|
||||
//! @brief Default dtor
|
||||
virtual~ BinarySemaphoreUsingTask();
|
||||
|
||||
/**
|
||||
* This function can be used to get the correct task handle from the
|
||||
* currently executing task.
|
||||
*
|
||||
* This is required because the task notification value will be used
|
||||
* as a binary semaphore, and the semaphore might be created by another
|
||||
* task.
|
||||
*/
|
||||
void refreshTaskHandle();
|
||||
|
||||
ReturnValue_t acquire(TimeoutType timeoutType = TimeoutType::BLOCKING,
|
||||
uint32_t timeoutMs = portMAX_DELAY) override;
|
||||
ReturnValue_t release() override;
|
||||
@ -73,4 +90,7 @@ protected:
|
||||
TaskHandle_t handle;
|
||||
};
|
||||
|
||||
#endif /* FRAMEWORK_OSAL_FREERTOS_BINSEMAPHUSINGTASK_H_ */
|
||||
#endif /* (tskKERNEL_VERSION_MAJOR == 8 && tskKERNEL_VERSION_MINOR > 2) || \
|
||||
tskKERNEL_VERSION_MAJOR > 8 */
|
||||
|
||||
#endif /* FSFW_OSAL_FREERTOS_BINSEMAPHUSINGTASK_H_ */
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "../../osal/FreeRTOS/BinarySemaphore.h"
|
||||
#include "../../osal/FreeRTOS/TaskManagement.h"
|
||||
#include "BinarySemaphore.h"
|
||||
#include "TaskManagement.h"
|
||||
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
||||
|
||||
BinarySemaphore::BinarySemaphore() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef FRAMEWORK_OSAL_FREERTOS_BINARYSEMPAHORE_H_
|
||||
#define FRAMEWORK_OSAL_FREERTOS_BINARYSEMPAHORE_H_
|
||||
#ifndef FSFW_OSAL_FREERTOS_BINARYSEMPAHORE_H_
|
||||
#define FSFW_OSAL_FREERTOS_BINARYSEMPAHORE_H_
|
||||
|
||||
#include "../../returnvalues/HasReturnvaluesIF.h"
|
||||
#include "../../tasks/SemaphoreIF.h"
|
||||
@ -104,4 +104,4 @@ protected:
|
||||
SemaphoreHandle_t handle;
|
||||
};
|
||||
|
||||
#endif /* FRAMEWORK_OSAL_FREERTOS_BINARYSEMPAHORE_H_ */
|
||||
#endif /* FSFW_OSAL_FREERTOS_BINARYSEMPAHORE_H_ */
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "Timekeeper.h"
|
||||
|
||||
#include "../../timemanager/Clock.h"
|
||||
#include "../../globalfunctions/timevalOperations.h"
|
||||
#include "Timekeeper.h"
|
||||
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/task.h>
|
||||
@ -67,6 +68,13 @@ ReturnValue_t Clock::getUptime(uint32_t* uptimeMs) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
|
||||
//uint32_t Clock::getUptimeSeconds() {
|
||||
// timeval uptime = getUptime();
|
||||
// return uptime.tv_sec;
|
||||
//}
|
||||
|
||||
|
||||
ReturnValue_t Clock::getClock_usecs(uint64_t* time) {
|
||||
timeval time_timeval;
|
||||
ReturnValue_t result = getClock_timeval(&time_timeval);
|
||||
|
@ -1,7 +1,11 @@
|
||||
#include "../../osal/FreeRTOS/CountingSemaphUsingTask.h"
|
||||
#include "../../osal/FreeRTOS/TaskManagement.h"
|
||||
#include "CountingSemaphUsingTask.h"
|
||||
#include "TaskManagement.h"
|
||||
|
||||
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
||||
|
||||
#if (tskKERNEL_VERSION_MAJOR == 8 && tskKERNEL_VERSION_MINOR > 2) || \
|
||||
tskKERNEL_VERSION_MAJOR > 8
|
||||
|
||||
CountingSemaphoreUsingTask::CountingSemaphoreUsingTask(const uint8_t maxCount,
|
||||
uint8_t initCount): maxCount(maxCount) {
|
||||
if(initCount > maxCount) {
|
||||
@ -112,3 +116,5 @@ uint8_t CountingSemaphoreUsingTask::getSemaphoreCounterFromISR(
|
||||
uint8_t CountingSemaphoreUsingTask::getMaxCount() const {
|
||||
return maxCount;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,13 +1,14 @@
|
||||
#ifndef FRAMEWORK_OSAL_FREERTOS_COUNTINGSEMAPHUSINGTASK_H_
|
||||
#define FRAMEWORK_OSAL_FREERTOS_COUNTINGSEMAPHUSINGTASK_H_
|
||||
#ifndef FSFW_OSAL_FREERTOS_COUNTINGSEMAPHUSINGTASK_H_
|
||||
#define FSFW_OSAL_FREERTOS_COUNTINGSEMAPHUSINGTASK_H_
|
||||
|
||||
#include "../../osal/FreeRTOS/CountingSemaphUsingTask.h"
|
||||
#include "CountingSemaphUsingTask.h"
|
||||
#include "../../tasks/SemaphoreIF.h"
|
||||
|
||||
extern "C" {
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/task.h>
|
||||
}
|
||||
|
||||
#if (tskKERNEL_VERSION_MAJOR == 8 && tskKERNEL_VERSION_MINOR > 2) || \
|
||||
tskKERNEL_VERSION_MAJOR > 8
|
||||
|
||||
/**
|
||||
* @brief Couting Semaphore implementation which uses the notification value
|
||||
@ -16,6 +17,9 @@ extern "C" {
|
||||
* @details
|
||||
* Additional information: https://www.freertos.org/RTOS-task-notifications.html
|
||||
* and general semaphore documentation.
|
||||
* This semaphore is bound to the task it is created in!
|
||||
* Take care of calling this function with the correct executing task,
|
||||
* (for example in the initializeAfterTaskCreation() function).
|
||||
*/
|
||||
class CountingSemaphoreUsingTask: public SemaphoreIF {
|
||||
public:
|
||||
@ -99,4 +103,7 @@ private:
|
||||
const uint8_t maxCount;
|
||||
};
|
||||
|
||||
#endif /* FRAMEWORK_OSAL_FREERTOS_COUNTINGSEMAPHUSINGTASK_H_ */
|
||||
#endif /* (tskKERNEL_VERSION_MAJOR == 8 && tskKERNEL_VERSION_MINOR > 2) || \
|
||||
tskKERNEL_VERSION_MAJOR > 8 */
|
||||
|
||||
#endif /* FSFW_OSAL_FREERTOS_COUNTINGSEMAPHUSINGTASK_H_ */
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "../../osal/FreeRTOS/CountingSemaphore.h"
|
||||
#include "CountingSemaphore.h"
|
||||
#include "TaskManagement.h"
|
||||
|
||||
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
||||
#include "../../osal/FreeRTOS/TaskManagement.h"
|
||||
|
||||
#include <freertos/semphr.h>
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef FRAMEWORK_OSAL_FREERTOS_COUNTINGSEMAPHORE_H_
|
||||
#define FRAMEWORK_OSAL_FREERTOS_COUNTINGSEMAPHORE_H_
|
||||
#include "../../osal/FreeRTOS/BinarySemaphore.h"
|
||||
|
||||
#include "BinarySemaphore.h"
|
||||
|
||||
/**
|
||||
* @brief Counting semaphores, which can be acquire more than once.
|
||||
|
@ -114,38 +114,24 @@ void FixedTimeslotTask::taskFunctionality() {
|
||||
intervalMs = this->pst.getIntervalToPreviousSlotMs();
|
||||
interval = pdMS_TO_TICKS(intervalMs);
|
||||
|
||||
checkMissedDeadline(xLastWakeTime, interval);
|
||||
|
||||
#if (tskKERNEL_VERSION_MAJOR == 10 && tskKERNEL_VERSION_MINOR >= 4) || \
|
||||
tskKERNEL_VERSION_MAJOR > 10
|
||||
BaseType_t wasDelayed = xTaskDelayUntil(&xLastWakeTime, interval);
|
||||
if(wasDelayed == pdFALSE) {
|
||||
handleMissedDeadline();
|
||||
}
|
||||
#else
|
||||
if(checkMissedDeadline(xLastWakeTime, interval)) {
|
||||
handleMissedDeadline();
|
||||
}
|
||||
// Wait for the interval. This exits immediately if a deadline was
|
||||
// missed while also updating the last wake time.
|
||||
vTaskDelayUntil(&xLastWakeTime, interval);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FixedTimeslotTask::checkMissedDeadline(const TickType_t xLastWakeTime,
|
||||
const TickType_t interval) {
|
||||
/* Check whether deadline was missed while also taking overflows
|
||||
* into account. Drawing this on paper with a timeline helps to understand
|
||||
* it. */
|
||||
TickType_t currentTickCount = xTaskGetTickCount();
|
||||
TickType_t timeToWake = xLastWakeTime + interval;
|
||||
// Time to wake has not overflown.
|
||||
if(timeToWake > xLastWakeTime) {
|
||||
/* If the current time has overflown exclusively or the current
|
||||
* tick count is simply larger than the time to wake, a deadline was
|
||||
* missed */
|
||||
if((currentTickCount < xLastWakeTime) or (currentTickCount > timeToWake)) {
|
||||
handleMissedDeadline();
|
||||
}
|
||||
}
|
||||
/* Time to wake has overflown. A deadline was missed if the current time
|
||||
* is larger than the time to wake */
|
||||
else if((timeToWake < xLastWakeTime) and (currentTickCount > timeToWake)) {
|
||||
handleMissedDeadline();
|
||||
}
|
||||
}
|
||||
|
||||
void FixedTimeslotTask::handleMissedDeadline() {
|
||||
if(deadlineMissedFunc != nullptr) {
|
||||
this->deadlineMissedFunc();
|
||||
|
@ -93,8 +93,6 @@ protected:
|
||||
*/
|
||||
void taskFunctionality(void);
|
||||
|
||||
void checkMissedDeadline(const TickType_t xLastWakeTime,
|
||||
const TickType_t interval);
|
||||
void handleMissedDeadline();
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef FRAMEWORK_OSAL_FREERTOS_FREERTOSTASKIF_H_
|
||||
#define FRAMEWORK_OSAL_FREERTOS_FREERTOSTASKIF_H_
|
||||
#ifndef FSFW_OSAL_FREERTOS_FREERTOSTASKIF_H_
|
||||
#define FSFW_OSAL_FREERTOS_FREERTOSTASKIF_H_
|
||||
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/task.h>
|
||||
@ -8,6 +8,34 @@ class FreeRTOSTaskIF {
|
||||
public:
|
||||
virtual~ FreeRTOSTaskIF() {}
|
||||
virtual TaskHandle_t getTaskHandle() = 0;
|
||||
|
||||
protected:
|
||||
|
||||
bool checkMissedDeadline(const TickType_t xLastWakeTime,
|
||||
const TickType_t interval) {
|
||||
/* Check whether deadline was missed while also taking overflows
|
||||
* into account. Drawing this on paper with a timeline helps to understand
|
||||
* it. */
|
||||
TickType_t currentTickCount = xTaskGetTickCount();
|
||||
TickType_t timeToWake = xLastWakeTime + interval;
|
||||
// Time to wake has not overflown.
|
||||
if(timeToWake > xLastWakeTime) {
|
||||
/* If the current time has overflown exclusively or the current
|
||||
* tick count is simply larger than the time to wake, a deadline was
|
||||
* missed */
|
||||
if((currentTickCount < xLastWakeTime) or
|
||||
(currentTickCount > timeToWake)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/* Time to wake has overflown. A deadline was missed if the current time
|
||||
* is larger than the time to wake */
|
||||
else if((timeToWake < xLastWakeTime) and
|
||||
(currentTickCount > timeToWake)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* FRAMEWORK_OSAL_FREERTOS_FREERTOSTASKIF_H_ */
|
||||
#endif /* FSFW_OSAL_FREERTOS_FREERTOSTASKIF_H_ */
|
||||
|
@ -11,7 +11,12 @@ MessageQueue::MessageQueue(size_t messageDepth, size_t maxMessageSize):
|
||||
maxMessageSize(maxMessageSize) {
|
||||
handle = xQueueCreate(messageDepth, maxMessageSize);
|
||||
if (handle == nullptr) {
|
||||
sif::error << "MessageQueue::MessageQueue Creation failed" << std::endl;
|
||||
sif::error << "MessageQueue::MessageQueue:"
|
||||
<< " Creation failed." << std::endl;
|
||||
sif::error << "Specified Message Depth: " << messageDepth
|
||||
<< std::endl;
|
||||
sif::error << "Specified Maximum Message Size: "
|
||||
<< maxMessageSize << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
#ifndef FSFW_OSAL_FREERTOS_MESSAGEQUEUE_H_
|
||||
#define FSFW_OSAL_FREERTOS_MESSAGEQUEUE_H_
|
||||
|
||||
#include "TaskManagement.h"
|
||||
|
||||
#include "../../internalError/InternalErrorReporterIF.h"
|
||||
#include "../../ipc/MessageQueueIF.h"
|
||||
#include "../../ipc/MessageQueueMessageIF.h"
|
||||
#include "../../osal/FreeRTOS/TaskManagement.h"
|
||||
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/queue.h>
|
||||
|
@ -1,10 +1,12 @@
|
||||
#include "Mutex.h"
|
||||
|
||||
#include "../../ipc/MutexFactory.h"
|
||||
|
||||
#include "../FreeRTOS/Mutex.h"
|
||||
|
||||
//TODO: Different variant than the lazy loading in QueueFactory. What's better and why? -> one is on heap the other on bss/data
|
||||
//TODO: Different variant than the lazy loading in QueueFactory.
|
||||
//What's better and why? -> one is on heap the other on bss/data
|
||||
//MutexFactory* MutexFactory::factoryInstance = new MutexFactory();
|
||||
MutexFactory* MutexFactory::factoryInstance = NULL;
|
||||
MutexFactory* MutexFactory::factoryInstance = nullptr;
|
||||
|
||||
MutexFactory::MutexFactory() {
|
||||
}
|
||||
@ -13,7 +15,7 @@ MutexFactory::~MutexFactory() {
|
||||
}
|
||||
|
||||
MutexFactory* MutexFactory::instance() {
|
||||
if (factoryInstance == NULL){
|
||||
if (factoryInstance == nullptr){
|
||||
factoryInstance = new MutexFactory();
|
||||
}
|
||||
return MutexFactory::factoryInstance;
|
||||
|
@ -80,10 +80,18 @@ void PeriodicTask::taskFunctionality() {
|
||||
object->performOperation();
|
||||
}
|
||||
|
||||
checkMissedDeadline(xLastWakeTime, xPeriod);
|
||||
|
||||
#if (tskKERNEL_VERSION_MAJOR == 10 && tskKERNEL_VERSION_MINOR >= 4) || \
|
||||
tskKERNEL_VERSION_MAJOR > 10
|
||||
BaseType_t wasDelayed = xTaskDelayUntil(&xLastWakeTime, xPeriod);
|
||||
if(wasDelayed == pdFALSE) {
|
||||
handleMissedDeadline();
|
||||
}
|
||||
#else
|
||||
if(checkMissedDeadline(xLastWakeTime, xPeriod)) {
|
||||
handleMissedDeadline();
|
||||
}
|
||||
vTaskDelayUntil(&xLastWakeTime, xPeriod);
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,29 +113,6 @@ uint32_t PeriodicTask::getPeriodMs() const {
|
||||
return period * 1000;
|
||||
}
|
||||
|
||||
void PeriodicTask::checkMissedDeadline(const TickType_t xLastWakeTime,
|
||||
const TickType_t interval) {
|
||||
/* Check whether deadline was missed while also taking overflows
|
||||
* into account. Drawing this on paper with a timeline helps to understand
|
||||
* it. */
|
||||
TickType_t currentTickCount = xTaskGetTickCount();
|
||||
TickType_t timeToWake = xLastWakeTime + interval;
|
||||
// Time to wake has not overflown.
|
||||
if(timeToWake > xLastWakeTime) {
|
||||
/* If the current time has overflown exclusively or the current
|
||||
* tick count is simply larger than the time to wake, a deadline was
|
||||
* missed */
|
||||
if((currentTickCount < xLastWakeTime) or (currentTickCount > timeToWake)) {
|
||||
handleMissedDeadline();
|
||||
}
|
||||
}
|
||||
/* Time to wake has overflown. A deadline was missed if the current time
|
||||
* is larger than the time to wake */
|
||||
else if((timeToWake < xLastWakeTime) and (currentTickCount > timeToWake)) {
|
||||
handleMissedDeadline();
|
||||
}
|
||||
}
|
||||
|
||||
TaskHandle_t PeriodicTask::getTaskHandle() {
|
||||
return handle;
|
||||
}
|
||||
|
@ -71,6 +71,7 @@ public:
|
||||
|
||||
TaskHandle_t getTaskHandle() override;
|
||||
protected:
|
||||
|
||||
bool started;
|
||||
TaskHandle_t handle;
|
||||
|
||||
@ -118,8 +119,6 @@ protected:
|
||||
*/
|
||||
void taskFunctionality(void);
|
||||
|
||||
void checkMissedDeadline(const TickType_t xLastWakeTime,
|
||||
const TickType_t interval);
|
||||
void handleMissedDeadline();
|
||||
};
|
||||
|
||||
|
@ -13,32 +13,30 @@ TaskFactory::~TaskFactory() {
|
||||
TaskFactory* TaskFactory::instance() {
|
||||
return TaskFactory::factoryInstance;
|
||||
}
|
||||
/***
|
||||
* Keep in Mind that you need to call before this vTaskStartScheduler()!
|
||||
* High taskPriority_ number means high priority.
|
||||
*/
|
||||
|
||||
PeriodicTaskIF* TaskFactory::createPeriodicTask(TaskName name_,
|
||||
TaskPriority taskPriority_, TaskStackSize stackSize_,
|
||||
TaskPeriod period_,
|
||||
TaskDeadlineMissedFunction deadLineMissedFunction_) {
|
||||
return (PeriodicTaskIF*) (new PeriodicTask(name_, taskPriority_, stackSize_,
|
||||
period_, deadLineMissedFunction_));
|
||||
return dynamic_cast<PeriodicTaskIF*>(new PeriodicTask(name_, taskPriority_,
|
||||
stackSize_, period_, deadLineMissedFunction_));
|
||||
}
|
||||
/***
|
||||
|
||||
/**
|
||||
* Keep in Mind that you need to call before this vTaskStartScheduler()!
|
||||
*/
|
||||
FixedTimeslotTaskIF* TaskFactory::createFixedTimeslotTask(TaskName name_,
|
||||
TaskPriority taskPriority_, TaskStackSize stackSize_,
|
||||
TaskPeriod period_,
|
||||
TaskDeadlineMissedFunction deadLineMissedFunction_) {
|
||||
return (FixedTimeslotTaskIF*) (new FixedTimeslotTask(name_, taskPriority_,
|
||||
stackSize_, period_, deadLineMissedFunction_));
|
||||
return dynamic_cast<FixedTimeslotTaskIF*>(new FixedTimeslotTask(name_,
|
||||
taskPriority_,stackSize_, period_, deadLineMissedFunction_));
|
||||
}
|
||||
|
||||
ReturnValue_t TaskFactory::deleteTask(PeriodicTaskIF* task) {
|
||||
if (task == NULL) {
|
||||
if (task == nullptr) {
|
||||
//delete self
|
||||
vTaskDelete(NULL);
|
||||
vTaskDelete(nullptr);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
} else {
|
||||
//TODO not implemented
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "../../osal/FreeRTOS/TaskManagement.h"
|
||||
#include "TaskManagement.h"
|
||||
|
||||
void TaskManagement::vRequestContextSwitchFromTask() {
|
||||
vTaskDelay(0);
|
||||
@ -22,3 +22,4 @@ size_t TaskManagement::getTaskStackHighWatermark(
|
||||
TaskHandle_t task) {
|
||||
return uxTaskGetStackHighWaterMark(task) * sizeof(StackType_t);
|
||||
}
|
||||
|
||||
|
@ -3,10 +3,9 @@
|
||||
|
||||
#include "../../returnvalues/HasReturnvaluesIF.h"
|
||||
|
||||
extern "C" {
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/task.h>
|
||||
}
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
/**
|
||||
@ -27,26 +26,25 @@ enum class CallContext {
|
||||
};
|
||||
|
||||
|
||||
class TaskManagement {
|
||||
public:
|
||||
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.
|
||||
*/
|
||||
static void requestContextSwitch(CallContext callContext);
|
||||
void requestContextSwitch(CallContext callContext);
|
||||
|
||||
/**
|
||||
* If task preemption in FreeRTOS is disabled, a context switch
|
||||
* can be requested manually by calling this function.
|
||||
*/
|
||||
static void vRequestContextSwitchFromTask(void);
|
||||
void vRequestContextSwitchFromTask(void);
|
||||
|
||||
/**
|
||||
* @return The current task handle
|
||||
*/
|
||||
static TaskHandle_t getCurrentTaskHandle();
|
||||
TaskHandle_t getCurrentTaskHandle();
|
||||
|
||||
/**
|
||||
* Get returns the minimum amount of remaining stack space in words
|
||||
@ -57,8 +55,8 @@ public:
|
||||
* @return Smallest value of stack remaining since the task was started in
|
||||
* words.
|
||||
*/
|
||||
static size_t getTaskStackHighWatermark(
|
||||
TaskHandle_t task = nullptr);
|
||||
size_t getTaskStackHighWatermark(TaskHandle_t task = nullptr);
|
||||
|
||||
};
|
||||
|
||||
#endif /* FRAMEWORK_OSAL_FREERTOS_TASKMANAGEMENT_H_ */
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "Timekeeper.h"
|
||||
|
||||
#include "FreeRTOSConfig.h"
|
||||
#include <FreeRTOSConfig.h>
|
||||
|
||||
Timekeeper * Timekeeper::myinstance = nullptr;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef FRAMEWORK_TIMEMANAGER_CLOCK_H_
|
||||
#define FRAMEWORK_TIMEMANAGER_CLOCK_H_
|
||||
#ifndef FSFW_TIMEMANAGER_CLOCK_H_
|
||||
#define FSFW_TIMEMANAGER_CLOCK_H_
|
||||
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
#include "../ipc/MutexHelper.h"
|
||||
@ -151,4 +151,4 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#endif /* FRAMEWORK_TIMEMANAGER_CLOCK_H_ */
|
||||
#endif /* FSFW_TIMEMANAGER_CLOCK_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user