2021-01-28 11:28:28 +01:00
|
|
|
#ifndef FSFW_OSAL_RTEMS_FIXEDTIMESLOTTASK_H_
|
|
|
|
#define FSFW_OSAL_RTEMS_FIXEDTIMESLOTTASK_H_
|
|
|
|
|
2022-02-02 10:29:30 +01:00
|
|
|
#include "RTEMSTaskBase.h"
|
2022-05-29 20:52:52 +02:00
|
|
|
#include "fsfw/tasks/FixedSlotSequence.h"
|
|
|
|
#include "fsfw/tasks/FixedTimeslotTaskBase.h"
|
2022-02-02 10:29:30 +01:00
|
|
|
|
2022-05-29 20:52:52 +02:00
|
|
|
class FixedTimeslotTask : public FixedTimeslotTaskBase, public RTEMSTaskBase {
|
2022-02-02 10:29:30 +01:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* @brief The standard constructor of the class.
|
|
|
|
* @details
|
|
|
|
* This is the general constructor of the class. In addition to the TaskBase parameters,
|
|
|
|
* the following variables are passed:
|
|
|
|
* @param setDeadlineMissedFunc The function pointer to the deadline missed function
|
|
|
|
* that shall be assigned.
|
|
|
|
* @param getPst The object id of the completely initialized polling sequence.
|
|
|
|
*/
|
|
|
|
FixedTimeslotTask(const char *name, rtems_task_priority setPriority, size_t setStackSize,
|
2022-05-29 20:52:52 +02:00
|
|
|
TaskPeriod overallPeriod, TaskDeadlineMissedFunction dlmFunc);
|
2021-01-28 11:28:28 +01:00
|
|
|
|
2022-02-02 10:29:30 +01:00
|
|
|
/**
|
|
|
|
* @brief The destructor of the class.
|
|
|
|
* @details
|
|
|
|
* The destructor frees all heap memory that was allocated on thread initialization
|
|
|
|
* for the PST andthe device handlers. This is done by calling the PST's destructor.
|
|
|
|
*/
|
2022-05-29 20:52:52 +02:00
|
|
|
~FixedTimeslotTask() override;
|
2021-01-28 11:28:28 +01:00
|
|
|
|
2022-06-13 14:23:56 +02:00
|
|
|
ReturnValue_t startTask(void);
|
2021-01-28 11:28:28 +01:00
|
|
|
|
2022-05-29 20:52:52 +02:00
|
|
|
ReturnValue_t sleepFor(uint32_t ms) override;
|
2021-01-28 11:28:28 +01:00
|
|
|
|
2022-02-02 10:29:30 +01:00
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* @brief id of the associated OS period
|
|
|
|
*/
|
|
|
|
rtems_id periodId;
|
|
|
|
/**
|
|
|
|
* @brief This is the entry point in a new polling thread.
|
|
|
|
* @details This method is the entry point in the new thread
|
|
|
|
*/
|
|
|
|
static rtems_task taskEntryPoint(rtems_task_argument argument);
|
2021-01-28 11:28:28 +01:00
|
|
|
|
2022-02-02 10:29:30 +01:00
|
|
|
/**
|
|
|
|
* @brief This function holds the main functionality of the thread.
|
|
|
|
* @details
|
|
|
|
* Holding the main functionality of the task, this method is most important.
|
|
|
|
* It links the functionalities provided by FixedSlotSequence with the OS's system calls to
|
|
|
|
* keep the timing of the periods.
|
|
|
|
*/
|
2022-05-29 20:52:52 +02:00
|
|
|
[[noreturn]] void taskFunctionality();
|
2021-01-28 11:28:28 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* FSFW_OSAL_RTEMS_FIXEDTIMESLOTTASK_H_ */
|