2022-11-15 17:03:46 +01:00
|
|
|
#include "scheduling.h"
|
2022-09-27 17:36:19 +02:00
|
|
|
|
|
|
|
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
|
|
|
#include <fsfw/tasks/PeriodicTaskIF.h>
|
|
|
|
#include <mission/utility/InitMission.h>
|
|
|
|
|
|
|
|
#include "OBSWConfig.h"
|
|
|
|
#include "ObjectFactory.h"
|
2022-11-10 17:32:11 +01:00
|
|
|
#include "eive/objects.h"
|
2022-09-27 17:36:19 +02:00
|
|
|
|
2023-02-14 11:32:03 +01:00
|
|
|
void scheduling::scheduleScexReader(TaskFactory& factory, PeriodicTaskIF*& scexReaderTask) {
|
2022-11-15 17:03:46 +01:00
|
|
|
using namespace scheduling;
|
2022-09-27 17:36:19 +02:00
|
|
|
ReturnValue_t result = returnvalue::OK;
|
|
|
|
#if OBSW_PRINT_MISSED_DEADLINES == 1
|
|
|
|
void (*missedDeadlineFunc)(void) = TaskFactory::printMissedDeadline;
|
|
|
|
#else
|
|
|
|
void (*missedDeadlineFunc)(void) = nullptr;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
result = returnvalue::OK;
|
2023-03-24 11:58:45 +01:00
|
|
|
scexReaderTask =
|
|
|
|
factory.createPeriodicTask("SCEX_UART_READER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0,
|
|
|
|
missedDeadlineFunc, &NORMAL_SCHEDULING);
|
2022-09-27 17:36:19 +02:00
|
|
|
result = scexReaderTask->addComponent(objects::SCEX_UART_READER);
|
|
|
|
if (result != returnvalue::OK) {
|
|
|
|
printAddObjectError("SCEX_UART_READER", objects::SCEX_UART_READER);
|
|
|
|
}
|
|
|
|
}
|
2022-11-10 14:08:44 +01:00
|
|
|
|
|
|
|
void scheduling::addMpsocSupvHandlers(PeriodicTaskIF* plTask) {
|
|
|
|
plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::PERFORM_OPERATION);
|
|
|
|
plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::SEND_WRITE);
|
|
|
|
plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::GET_WRITE);
|
2022-11-17 16:20:13 +01:00
|
|
|
plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::SEND_READ);
|
|
|
|
plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::GET_READ);
|
2022-11-18 17:25:52 +01:00
|
|
|
plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::SEND_READ);
|
|
|
|
plTask->addComponent(objects::PLOC_SUPERVISOR_HANDLER, DeviceHandlerIF::GET_READ);
|
2022-11-10 14:12:09 +01:00
|
|
|
|
2022-11-10 14:08:44 +01:00
|
|
|
plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::PERFORM_OPERATION);
|
|
|
|
plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::SEND_WRITE);
|
|
|
|
plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::GET_WRITE);
|
2022-11-17 16:20:13 +01:00
|
|
|
plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::SEND_READ);
|
|
|
|
plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::GET_READ);
|
2022-11-18 17:25:52 +01:00
|
|
|
plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::SEND_READ);
|
|
|
|
plTask->addComponent(objects::PLOC_MPSOC_HANDLER, DeviceHandlerIF::GET_READ);
|
2022-11-10 14:08:44 +01:00
|
|
|
}
|
2023-02-14 11:32:03 +01:00
|
|
|
|
|
|
|
void scheduling::scheduleScexDev(PeriodicTaskIF*& scexDevHandler) {
|
|
|
|
ReturnValue_t result =
|
|
|
|
scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::PERFORM_OPERATION);
|
|
|
|
if (result != returnvalue::OK) {
|
|
|
|
printAddObjectError("SCEX_DEV", objects::SCEX);
|
|
|
|
}
|
|
|
|
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::SEND_WRITE);
|
|
|
|
if (result != returnvalue::OK) {
|
|
|
|
printAddObjectError("SCEX_DEV", objects::SCEX);
|
|
|
|
}
|
|
|
|
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::GET_WRITE);
|
|
|
|
if (result != returnvalue::OK) {
|
|
|
|
printAddObjectError("SCEX_DEV", objects::SCEX);
|
|
|
|
}
|
|
|
|
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::SEND_READ);
|
|
|
|
if (result != returnvalue::OK) {
|
|
|
|
printAddObjectError("SCEX_DEV", objects::SCEX);
|
|
|
|
}
|
|
|
|
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::GET_READ);
|
|
|
|
if (result != returnvalue::OK) {
|
|
|
|
printAddObjectError("SCEX_DEV", objects::SCEX);
|
|
|
|
}
|
|
|
|
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::SEND_READ);
|
|
|
|
if (result != returnvalue::OK) {
|
|
|
|
printAddObjectError("SCEX_DEV", objects::SCEX);
|
|
|
|
}
|
|
|
|
result = scexDevHandler->addComponent(objects::SCEX, DeviceHandlerIF::GET_READ);
|
|
|
|
if (result != returnvalue::OK) {
|
|
|
|
printAddObjectError("SCEX_DEV", objects::SCEX);
|
|
|
|
}
|
|
|
|
}
|