applied formatting
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@ -2,183 +2,167 @@
|
||||
#define BSP_Q7S_CORE_CORECONTROLLER_H_
|
||||
|
||||
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
||||
#include "fsfw/controller/ExtendedControllerBase.h"
|
||||
|
||||
#include "bsp_q7s/memory/SdCardManager.h"
|
||||
|
||||
#include "events/subsystemIdRanges.h"
|
||||
|
||||
#include "fsfw/controller/ExtendedControllerBase.h"
|
||||
|
||||
class Timer;
|
||||
class SdCardManager;
|
||||
|
||||
class CoreController: public ExtendedControllerBase {
|
||||
public:
|
||||
enum Chip: uint8_t {
|
||||
CHIP_0,
|
||||
CHIP_1,
|
||||
NO_CHIP,
|
||||
SELF_CHIP,
|
||||
ALL_CHIP
|
||||
};
|
||||
class CoreController : public ExtendedControllerBase {
|
||||
public:
|
||||
enum Chip : uint8_t { CHIP_0, CHIP_1, NO_CHIP, SELF_CHIP, ALL_CHIP };
|
||||
|
||||
enum Copy: uint8_t {
|
||||
COPY_0,
|
||||
COPY_1,
|
||||
NO_COPY,
|
||||
SELF_COPY,
|
||||
ALL_COPY
|
||||
};
|
||||
enum Copy : uint8_t { COPY_0, COPY_1, NO_COPY, SELF_COPY, ALL_COPY };
|
||||
|
||||
static constexpr char CHIP_PROT_SCRIPT[] = "/home/root/scripts/get-chip-prot-status.sh";
|
||||
static constexpr char CHIP_STATE_FILE[] = "/tmp/chip_prot_status.txt";
|
||||
static constexpr char CURR_COPY_FILE[] = "/tmp/curr_copy.txt";
|
||||
static constexpr char VERSION_FILE[] = "/conf/sd_status";
|
||||
static constexpr char CHIP_PROT_SCRIPT[] = "/home/root/scripts/get-chip-prot-status.sh";
|
||||
static constexpr char CHIP_STATE_FILE[] = "/tmp/chip_prot_status.txt";
|
||||
static constexpr char CURR_COPY_FILE[] = "/tmp/curr_copy.txt";
|
||||
static constexpr char VERSION_FILE[] = "/conf/sd_status";
|
||||
|
||||
static constexpr ActionId_t LIST_DIRECTORY_INTO_FILE = 0;
|
||||
static constexpr ActionId_t REBOOT_OBC = 32;
|
||||
static constexpr ActionId_t MOUNT_OTHER_COPY = 33;
|
||||
static constexpr ActionId_t LIST_DIRECTORY_INTO_FILE = 0;
|
||||
static constexpr ActionId_t REBOOT_OBC = 32;
|
||||
static constexpr ActionId_t MOUNT_OTHER_COPY = 33;
|
||||
|
||||
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CORE;
|
||||
|
||||
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CORE;
|
||||
static constexpr Event ALLOC_FAILURE = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
|
||||
|
||||
static constexpr Event ALLOC_FAILURE = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
|
||||
CoreController(object_id_t objectId);
|
||||
virtual ~CoreController();
|
||||
|
||||
ReturnValue_t initialize() override;
|
||||
|
||||
CoreController(object_id_t objectId);
|
||||
virtual~ CoreController();
|
||||
ReturnValue_t initializeAfterTaskCreation() override;
|
||||
|
||||
ReturnValue_t initialize() override;
|
||||
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||
const uint8_t* data, size_t size) override;
|
||||
|
||||
ReturnValue_t initializeAfterTaskCreation() override;
|
||||
ReturnValue_t handleCommandMessage(CommandMessage* message) override;
|
||||
void performControlOperation() override;
|
||||
|
||||
ReturnValue_t executeAction(ActionId_t actionId,
|
||||
MessageQueueId_t commandedBy, const uint8_t *data, size_t size) override;
|
||||
/**
|
||||
* Generate a file containing the chip lock/unlock states inside /tmp/chip_prot_status.txt
|
||||
* @return
|
||||
*/
|
||||
static ReturnValue_t generateChipStateFile();
|
||||
static ReturnValue_t incrementAllocationFailureCount();
|
||||
static void getCurrentBootCopy(Chip& chip, Copy& copy);
|
||||
|
||||
ReturnValue_t handleCommandMessage(CommandMessage *message) override;
|
||||
void performControlOperation() override;
|
||||
ReturnValue_t updateProtInfo(bool regenerateChipStateFile = true);
|
||||
|
||||
/**
|
||||
* Generate a file containing the chip lock/unlock states inside /tmp/chip_prot_status.txt
|
||||
* @return
|
||||
*/
|
||||
static ReturnValue_t generateChipStateFile();
|
||||
static ReturnValue_t incrementAllocationFailureCount();
|
||||
static void getCurrentBootCopy(Chip& chip, Copy& copy);
|
||||
/**
|
||||
* Checks whether the target chip and copy are write protected and protect set them to a target
|
||||
* state where applicable.
|
||||
* @param targetChip
|
||||
* @param targetCopy
|
||||
* @param protect Target state
|
||||
* @param protOperationPerformed [out] Can be used to determine whether any operation
|
||||
* was performed
|
||||
* @param updateProtFile Specify whether the protection info file is updated
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t setBootCopyProtection(Chip targetChip, Copy targetCopy, bool protect,
|
||||
bool& protOperationPerformed, bool updateProtFile = true);
|
||||
|
||||
ReturnValue_t updateProtInfo(bool regenerateChipStateFile = true);
|
||||
bool sdInitFinished() const;
|
||||
|
||||
/**
|
||||
* Checks whether the target chip and copy are write protected and protect set them to a target
|
||||
* state where applicable.
|
||||
* @param targetChip
|
||||
* @param targetCopy
|
||||
* @param protect Target state
|
||||
* @param protOperationPerformed [out] Can be used to determine whether any operation
|
||||
* was performed
|
||||
* @param updateProtFile Specify whether the protection info file is updated
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t setBootCopyProtection(Chip targetChip, Copy targetCopy,
|
||||
bool protect, bool& protOperationPerformed, bool updateProtFile = true);
|
||||
private:
|
||||
static Chip CURRENT_CHIP;
|
||||
static Copy CURRENT_COPY;
|
||||
|
||||
bool sdInitFinished() const;
|
||||
// Designated value for rechecking FIFO open
|
||||
static constexpr int RETRY_FIFO_OPEN = -2;
|
||||
int watchdogFifoFd = 0;
|
||||
|
||||
private:
|
||||
static Chip CURRENT_CHIP;
|
||||
static Copy CURRENT_COPY;
|
||||
// States for SD state machine, which is used in non-blocking mode
|
||||
enum class SdStates {
|
||||
NONE,
|
||||
START,
|
||||
GET_INFO,
|
||||
SET_STATE_SELF,
|
||||
MOUNT_SELF,
|
||||
// Determine operations for other SD card, depending on redundancy configuration
|
||||
DETERMINE_OTHER,
|
||||
SET_STATE_OTHER,
|
||||
// Mount or unmount other
|
||||
MOUNT_UNMOUNT_OTHER,
|
||||
// Skip period because the shell command used to generate the info file sometimes is
|
||||
// missing the last performed operation if executed too early
|
||||
SKIP_CYCLE_BEFORE_INFO_UPDATE,
|
||||
UPDATE_INFO,
|
||||
// SD initialization done
|
||||
IDLE,
|
||||
// Used if SD switches or mount commands are issued via telecommand
|
||||
SET_STATE_FROM_COMMAND,
|
||||
};
|
||||
static constexpr bool BLOCKING_SD_INIT = false;
|
||||
|
||||
// Designated value for rechecking FIFO open
|
||||
static constexpr int RETRY_FIFO_OPEN = -2;
|
||||
int watchdogFifoFd = 0;
|
||||
SdCardManager* sdcMan = nullptr;
|
||||
|
||||
// States for SD state machine, which is used in non-blocking mode
|
||||
enum class SdStates {
|
||||
NONE,
|
||||
START,
|
||||
GET_INFO,
|
||||
SET_STATE_SELF,
|
||||
MOUNT_SELF,
|
||||
// Determine operations for other SD card, depending on redundancy configuration
|
||||
DETERMINE_OTHER,
|
||||
SET_STATE_OTHER,
|
||||
// Mount or unmount other
|
||||
MOUNT_UNMOUNT_OTHER,
|
||||
// Skip period because the shell command used to generate the info file sometimes is
|
||||
// missing the last performed operation if executed too early
|
||||
SKIP_CYCLE_BEFORE_INFO_UPDATE,
|
||||
UPDATE_INFO,
|
||||
// SD initialization done
|
||||
IDLE,
|
||||
// Used if SD switches or mount commands are issued via telecommand
|
||||
SET_STATE_FROM_COMMAND,
|
||||
};
|
||||
static constexpr bool BLOCKING_SD_INIT = false;
|
||||
struct SdInfo {
|
||||
sd::SdCard pref = sd::SdCard::NONE;
|
||||
sd::SdState prefState = sd::SdState::OFF;
|
||||
sd::SdCard other = sd::SdCard::NONE;
|
||||
sd::SdState otherState = sd::SdState::OFF;
|
||||
std::string prefChar = "0";
|
||||
std::string otherChar = "1";
|
||||
SdStates state = SdStates::START;
|
||||
// Used to track whether a command was executed
|
||||
bool commandExecuted = true;
|
||||
bool initFinished = false;
|
||||
SdCardManager::SdStatePair currentState;
|
||||
uint16_t cycleCount = 0;
|
||||
// These two flags are related to external commanding
|
||||
bool commandIssued = false;
|
||||
bool commandFinished = false;
|
||||
sd::SdState currentlyCommandedState = sd::SdState::OFF;
|
||||
sd::SdCard commandedCard = sd::SdCard::NONE;
|
||||
sd::SdState commandedState = sd::SdState::OFF;
|
||||
};
|
||||
SdInfo sdInfo;
|
||||
|
||||
SdCardManager* sdcMan = nullptr;
|
||||
/**
|
||||
* Index 0: Chip 0 Copy 0
|
||||
* Index 1: Chip 0 Copy 1
|
||||
* Index 2: Chip 1 Copy 0
|
||||
* Index 3: Chip 1 Copy 1
|
||||
*/
|
||||
std::array<bool, 4> protArray;
|
||||
PeriodicOperationDivider opDivider;
|
||||
|
||||
struct SdInfo {
|
||||
sd::SdCard pref = sd::SdCard::NONE;
|
||||
sd::SdState prefState = sd::SdState::OFF;
|
||||
sd::SdCard other = sd::SdCard::NONE;
|
||||
sd::SdState otherState = sd::SdState::OFF;
|
||||
std::string prefChar = "0";
|
||||
std::string otherChar = "1";
|
||||
SdStates state = SdStates::START;
|
||||
// Used to track whether a command was executed
|
||||
bool commandExecuted = true;
|
||||
bool initFinished = false;
|
||||
SdCardManager::SdStatePair currentState;
|
||||
uint16_t cycleCount = 0;
|
||||
// These two flags are related to external commanding
|
||||
bool commandIssued = false;
|
||||
bool commandFinished = false;
|
||||
sd::SdState currentlyCommandedState = sd::SdState::OFF;
|
||||
sd::SdCard commandedCard = sd::SdCard::NONE;
|
||||
sd::SdState commandedState = sd::SdState::OFF;
|
||||
};
|
||||
SdInfo sdInfo;
|
||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) override;
|
||||
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
||||
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, uint32_t* msToReachTheMode);
|
||||
|
||||
/**
|
||||
* Index 0: Chip 0 Copy 0
|
||||
* Index 1: Chip 0 Copy 1
|
||||
* Index 2: Chip 1 Copy 0
|
||||
* Index 3: Chip 1 Copy 1
|
||||
*/
|
||||
std::array<bool, 4> protArray;
|
||||
PeriodicOperationDivider opDivider;
|
||||
ReturnValue_t initVersionFile();
|
||||
ReturnValue_t initBootCopy();
|
||||
ReturnValue_t initWatchdogFifo();
|
||||
ReturnValue_t initSdCardBlocking();
|
||||
void initPrint();
|
||||
|
||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) override;
|
||||
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
||||
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
||||
uint32_t *msToReachTheMode);
|
||||
ReturnValue_t sdStateMachine();
|
||||
void updateSdInfoOther();
|
||||
ReturnValue_t sdCardSetup(sd::SdCard sdCard, sd::SdState targetState, std::string sdChar,
|
||||
bool printOutput = true);
|
||||
ReturnValue_t sdColdRedundantBlockingInit();
|
||||
void currentStateSetter(sd::SdCard sdCard, sd::SdState newState);
|
||||
void determinePreferredSdCard();
|
||||
void executeNextExternalSdCommand();
|
||||
void checkExternalSdCommandStatus();
|
||||
|
||||
ReturnValue_t initVersionFile();
|
||||
ReturnValue_t initBootCopy();
|
||||
ReturnValue_t initWatchdogFifo();
|
||||
ReturnValue_t initSdCardBlocking();
|
||||
void initPrint();
|
||||
ReturnValue_t actionListDirectoryIntoFile(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||
const uint8_t* data, size_t size);
|
||||
ReturnValue_t actionPerformReboot(const uint8_t* data, size_t size);
|
||||
|
||||
ReturnValue_t sdStateMachine();
|
||||
void updateSdInfoOther();
|
||||
ReturnValue_t sdCardSetup(sd::SdCard sdCard, sd::SdState targetState, std::string sdChar,
|
||||
bool printOutput = true);
|
||||
ReturnValue_t sdColdRedundantBlockingInit();
|
||||
void currentStateSetter(sd::SdCard sdCard, sd::SdState newState);
|
||||
void determinePreferredSdCard();
|
||||
void executeNextExternalSdCommand();
|
||||
void checkExternalSdCommandStatus();
|
||||
void performWatchdogControlOperation();
|
||||
|
||||
ReturnValue_t actionListDirectoryIntoFile(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||
const uint8_t *data, size_t size);
|
||||
ReturnValue_t actionPerformReboot(const uint8_t *data, size_t size);
|
||||
|
||||
void performWatchdogControlOperation();
|
||||
|
||||
ReturnValue_t handleProtInfoUpdateLine(std::string nextLine);
|
||||
int handleBootCopyProtAtIndex(Chip targetChip, Copy targetCopy, bool protect,
|
||||
bool &protOperationPerformed, bool selfChip, bool selfCopy, bool allChips,
|
||||
bool allCopies, uint8_t arrIdx);
|
||||
ReturnValue_t handleProtInfoUpdateLine(std::string nextLine);
|
||||
int handleBootCopyProtAtIndex(Chip targetChip, Copy targetCopy, bool protect,
|
||||
bool& protOperationPerformed, bool selfChip, bool selfCopy,
|
||||
bool allChips, bool allCopies, uint8_t arrIdx);
|
||||
};
|
||||
|
||||
#endif /* BSP_Q7S_CORE_CORECONTROLLER_H_ */
|
||||
|
@ -1,22 +1,21 @@
|
||||
#include "InitMission.h"
|
||||
#include "ObjectFactory.h"
|
||||
#include "OBSWConfig.h"
|
||||
#include "pollingsequence/pollingSequenceFactory.h"
|
||||
|
||||
#include "mission/utility/InitMission.h"
|
||||
|
||||
#include "fsfw/platform.h"
|
||||
#include "fsfw/objectmanager/ObjectManagerIF.h"
|
||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
|
||||
#include "fsfw/objectmanager/ObjectManager.h"
|
||||
#include "fsfw/tasks/FixedTimeslotTaskIF.h"
|
||||
#include "fsfw/tasks/PeriodicTaskIF.h"
|
||||
#include "fsfw/tasks/TaskFactory.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#include "ObjectFactory.h"
|
||||
#include "fsfw/objectmanager/ObjectManager.h"
|
||||
#include "fsfw/objectmanager/ObjectManagerIF.h"
|
||||
#include "fsfw/platform.h"
|
||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
|
||||
#include "fsfw/tasks/FixedTimeslotTaskIF.h"
|
||||
#include "fsfw/tasks/PeriodicTaskIF.h"
|
||||
#include "fsfw/tasks/TaskFactory.h"
|
||||
#include "mission/utility/InitMission.h"
|
||||
#include "pollingsequence/pollingSequenceFactory.h"
|
||||
|
||||
/* This is configured for linux without CR */
|
||||
#ifdef PLATFORM_UNIX
|
||||
ServiceInterfaceStream sif::debug("DEBUG");
|
||||
@ -30,344 +29,343 @@ ServiceInterfaceStream sif::warning("WARNING", true);
|
||||
ServiceInterfaceStream sif::error("ERROR", true, false, true);
|
||||
#endif
|
||||
|
||||
ObjectManagerIF *objectManager = nullptr;
|
||||
ObjectManagerIF* objectManager = nullptr;
|
||||
|
||||
void initmission::initMission() {
|
||||
sif::info << "Building global objects.." << std::endl;
|
||||
/* Instantiate global object manager and also create all objects */
|
||||
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
|
||||
sif::info << "Initializing all objects.." << std::endl;
|
||||
ObjectManager::instance()->initialize();
|
||||
|
||||
sif::info << "Building global objects.." << std::endl;
|
||||
/* Instantiate global object manager and also create all objects */
|
||||
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
|
||||
sif::info << "Initializing all objects.." << std::endl;
|
||||
ObjectManager::instance()->initialize();
|
||||
|
||||
/* This function creates and starts all tasks */
|
||||
initTasks();
|
||||
/* This function creates and starts all tasks */
|
||||
initTasks();
|
||||
}
|
||||
|
||||
void initmission::initTasks() {
|
||||
TaskFactory* factory = TaskFactory::instance();
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
if(factory == nullptr) {
|
||||
/* Should never happen ! */
|
||||
return;
|
||||
}
|
||||
TaskFactory* factory = TaskFactory::instance();
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
if (factory == nullptr) {
|
||||
/* Should never happen ! */
|
||||
return;
|
||||
}
|
||||
#if OBSW_PRINT_MISSED_DEADLINES == 1
|
||||
void (*missedDeadlineFunc) (void) = TaskFactory::printMissedDeadline;
|
||||
void (*missedDeadlineFunc)(void) = TaskFactory::printMissedDeadline;
|
||||
#else
|
||||
void (*missedDeadlineFunc) (void) = nullptr;
|
||||
void (*missedDeadlineFunc)(void) = nullptr;
|
||||
#endif
|
||||
|
||||
#if BOARD_TE0720 == 0
|
||||
PeriodicTaskIF* coreController = factory->createPeriodicTask(
|
||||
"CORE_CTRL", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
|
||||
result = coreController->addComponent(objects::CORE_CONTROLLER);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER);
|
||||
}
|
||||
PeriodicTaskIF* coreController = factory->createPeriodicTask(
|
||||
"CORE_CTRL", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
|
||||
result = coreController->addComponent(objects::CORE_CONTROLLER);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* TMTC Distribution */
|
||||
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
||||
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||
result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("CCSDS_DISTRIB", objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||
}
|
||||
result = tmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS_PACKET_DISTRIB", objects::PUS_PACKET_DISTRIBUTOR);
|
||||
}
|
||||
result = tmTcDistributor->addComponent(objects::TM_FUNNEL);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("TM_FUNNEL", objects::TM_FUNNEL);
|
||||
}
|
||||
/* TMTC Distribution */
|
||||
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
||||
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||
result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("CCSDS_DISTRIB", objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||
}
|
||||
result = tmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS_PACKET_DISTRIB", objects::PUS_PACKET_DISTRIBUTOR);
|
||||
}
|
||||
result = tmTcDistributor->addComponent(objects::TM_FUNNEL);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("TM_FUNNEL", objects::TM_FUNNEL);
|
||||
}
|
||||
|
||||
#if OBSW_ADD_TCPIP_BRIDGE == 1
|
||||
// TMTC bridge
|
||||
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
||||
"TCPIP_TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("UDP_BRIDGE", objects::TMTC_BRIDGE);
|
||||
}
|
||||
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
||||
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("UDP_POLLING", objects::TMTC_POLLING_TASK);
|
||||
}
|
||||
// TMTC bridge
|
||||
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
||||
"TCPIP_TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("UDP_BRIDGE", objects::TMTC_BRIDGE);
|
||||
}
|
||||
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
||||
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("UDP_POLLING", objects::TMTC_POLLING_TASK);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if OBSW_USE_CCSDS_IP_CORE == 1
|
||||
PeriodicTaskIF* ccsdsHandlerTask = factory->createPeriodicTask(
|
||||
"CCSDS_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||
result = ccsdsHandlerTask->addComponent(objects::CCSDS_HANDLER);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("CCSDS Handler", objects::CCSDS_HANDLER);
|
||||
}
|
||||
PeriodicTaskIF* ccsdsHandlerTask = factory->createPeriodicTask(
|
||||
"CCSDS_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||
result = ccsdsHandlerTask->addComponent(objects::CCSDS_HANDLER);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("CCSDS Handler", objects::CCSDS_HANDLER);
|
||||
}
|
||||
|
||||
// Minimal distance between two received TCs amounts to 0.6 seconds
|
||||
// If a command has not been read before the next one arrives, the old command will be
|
||||
// overwritten by the PDEC.
|
||||
PeriodicTaskIF* pdecHandlerTask = factory->createPeriodicTask(
|
||||
"PDEC_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
|
||||
result = pdecHandlerTask->addComponent(objects::PDEC_HANDLER);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PDEC Handler", objects::PDEC_HANDLER);
|
||||
}
|
||||
// Minimal distance between two received TCs amounts to 0.6 seconds
|
||||
// If a command has not been read before the next one arrives, the old command will be
|
||||
// overwritten by the PDEC.
|
||||
PeriodicTaskIF* pdecHandlerTask = factory->createPeriodicTask(
|
||||
"PDEC_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
|
||||
result = pdecHandlerTask->addComponent(objects::PDEC_HANDLER);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PDEC Handler", objects::PDEC_HANDLER);
|
||||
}
|
||||
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
|
||||
|
||||
PeriodicTaskIF* acsCtrl = factory->createPeriodicTask(
|
||||
"ACS_CTRL", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
|
||||
result = acsCtrl->addComponent(objects::GPS_CONTROLLER);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("ACS_CTRL", objects::GPS_CONTROLLER);
|
||||
}
|
||||
PeriodicTaskIF* acsCtrl = factory->createPeriodicTask(
|
||||
"ACS_CTRL", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
|
||||
result = acsCtrl->addComponent(objects::GPS_CONTROLLER);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("ACS_CTRL", objects::GPS_CONTROLLER);
|
||||
}
|
||||
|
||||
# if BOARD_TE0720 == 0
|
||||
// FS task, task interval does not matter because it runs in permanent loop, priority low
|
||||
// because it is a non-essential background task
|
||||
PeriodicTaskIF* fsTask = factory->createPeriodicTask(
|
||||
"FILE_SYSTEM_TASK", 25, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
|
||||
result = fsTask->addComponent(objects::FILE_SYSTEM_HANDLER);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::FILE_SYSTEM_HANDLER);
|
||||
}
|
||||
#if BOARD_TE0720 == 0
|
||||
// FS task, task interval does not matter because it runs in permanent loop, priority low
|
||||
// because it is a non-essential background task
|
||||
PeriodicTaskIF* fsTask = factory->createPeriodicTask(
|
||||
"FILE_SYSTEM_TASK", 25, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
|
||||
result = fsTask->addComponent(objects::FILE_SYSTEM_HANDLER);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::FILE_SYSTEM_HANDLER);
|
||||
}
|
||||
|
||||
#if OBSW_ADD_STAR_TRACKER == 1
|
||||
PeriodicTaskIF* strImgLoaderTask = factory->createPeriodicTask(
|
||||
"FILE_SYSTEM_TASK", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||
result = strImgLoaderTask->addComponent(objects::STR_HELPER);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::STR_HELPER);
|
||||
}
|
||||
PeriodicTaskIF* strImgLoaderTask = factory->createPeriodicTask(
|
||||
"FILE_SYSTEM_TASK", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||
result = strImgLoaderTask->addComponent(objects::STR_HELPER);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::STR_HELPER);
|
||||
}
|
||||
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
||||
|
||||
#endif /* BOARD_TE0720 */
|
||||
|
||||
#if OBSW_TEST_CCSDS_BRIDGE == 1
|
||||
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
|
||||
"PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||
result = ptmeTestTask->addComponent(objects::CCSDS_IP_CORE_BRIDGE);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PTME_TEST", objects::CCSDS_IP_CORE_BRIDGE);
|
||||
}
|
||||
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
|
||||
"PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||
result = ptmeTestTask->addComponent(objects::CCSDS_IP_CORE_BRIDGE);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PTME_TEST", objects::CCSDS_IP_CORE_BRIDGE);
|
||||
}
|
||||
#endif
|
||||
|
||||
std::vector<PeriodicTaskIF*> pusTasks;
|
||||
createPusTasks(*factory, missedDeadlineFunc, pusTasks);
|
||||
std::vector<PeriodicTaskIF*> pstTasks;
|
||||
createPstTasks(*factory, missedDeadlineFunc, pstTasks);
|
||||
std::vector<PeriodicTaskIF*> pusTasks;
|
||||
createPusTasks(*factory, missedDeadlineFunc, pusTasks);
|
||||
std::vector<PeriodicTaskIF*> pstTasks;
|
||||
createPstTasks(*factory, missedDeadlineFunc, pstTasks);
|
||||
|
||||
#if OBSW_ADD_TEST_CODE == 1
|
||||
std::vector<PeriodicTaskIF*> testTasks;
|
||||
createTestTasks(*factory, missedDeadlineFunc, testTasks);
|
||||
std::vector<PeriodicTaskIF*> testTasks;
|
||||
createTestTasks(*factory, missedDeadlineFunc, testTasks);
|
||||
#endif
|
||||
|
||||
auto taskStarter = [](std::vector<PeriodicTaskIF*>& taskVector, std::string name) {
|
||||
for(const auto& task: taskVector) {
|
||||
if(task != nullptr) {
|
||||
task->startTask();
|
||||
}
|
||||
else {
|
||||
sif::error << "Task in vector " << name << " is invalid!" << std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
auto taskStarter = [](std::vector<PeriodicTaskIF*>& taskVector, std::string name) {
|
||||
for (const auto& task : taskVector) {
|
||||
if (task != nullptr) {
|
||||
task->startTask();
|
||||
} else {
|
||||
sif::error << "Task in vector " << name << " is invalid!" << std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
sif::info << "Starting tasks.." << std::endl;
|
||||
tmTcDistributor->startTask();
|
||||
sif::info << "Starting tasks.." << std::endl;
|
||||
tmTcDistributor->startTask();
|
||||
|
||||
#if OBSW_ADD_TCPIP_BRIDGE == 1
|
||||
tmtcBridgeTask->startTask();
|
||||
tmtcPollingTask->startTask();
|
||||
tmtcBridgeTask->startTask();
|
||||
tmtcPollingTask->startTask();
|
||||
#endif
|
||||
|
||||
#if OBSW_USE_CCSDS_IP_CORE == 1
|
||||
ccsdsHandlerTask->startTask();
|
||||
pdecHandlerTask->startTask();
|
||||
ccsdsHandlerTask->startTask();
|
||||
pdecHandlerTask->startTask();
|
||||
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
|
||||
|
||||
#if BOARD_TE0720 == 0
|
||||
coreController->startTask();
|
||||
coreController->startTask();
|
||||
#endif
|
||||
|
||||
taskStarter(pstTasks, "PST task vector");
|
||||
taskStarter(pusTasks, "PUS task vector");
|
||||
taskStarter(pstTasks, "PST task vector");
|
||||
taskStarter(pusTasks, "PUS task vector");
|
||||
#if OBSW_ADD_TEST_CODE == 1
|
||||
taskStarter(testTasks, "Test task vector");
|
||||
taskStarter(testTasks, "Test task vector");
|
||||
#endif
|
||||
|
||||
#if OBSW_TEST_CCSDS_BRIDGE == 1
|
||||
ptmeTestTask->startTask();
|
||||
ptmeTestTask->startTask();
|
||||
#endif
|
||||
|
||||
#if BOARD_TE0720 == 0
|
||||
fsTask->startTask();
|
||||
fsTask->startTask();
|
||||
#if OBSW_ADD_STAR_TRACKER == 1
|
||||
strImgLoaderTask->startTask();
|
||||
strImgLoaderTask->startTask();
|
||||
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
||||
#endif
|
||||
|
||||
acsCtrl->startTask();
|
||||
acsCtrl->startTask();
|
||||
|
||||
sif::info << "Tasks started.." << std::endl;
|
||||
sif::info << "Tasks started.." << std::endl;
|
||||
}
|
||||
|
||||
void initmission::createPstTasks(TaskFactory& factory,
|
||||
TaskDeadlineMissedFunction missedDeadlineFunc, std::vector<PeriodicTaskIF*> &taskVec) {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
#if BOARD_TE0720 == 0
|
||||
/* Polling Sequence Table Default */
|
||||
/* Polling Sequence Table Default */
|
||||
#if OBSW_ADD_SPI_TEST_CODE == 0
|
||||
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
|
||||
"PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5,
|
||||
missedDeadlineFunc);
|
||||
result = pst::pstSpi(spiPst);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
if(result != FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||
}
|
||||
}
|
||||
else {
|
||||
taskVec.push_back(spiPst);
|
||||
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
|
||||
"PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
|
||||
result = pst::pstSpi(spiPst);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
if (result != FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||
}
|
||||
} else {
|
||||
taskVec.push_back(spiPst);
|
||||
}
|
||||
#endif
|
||||
|
||||
FixedTimeslotTaskIF* uartPst = factory.createFixedTimeslotTask(
|
||||
"UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
||||
result = pst::pstUart(uartPst);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||
}
|
||||
taskVec.push_back(uartPst);
|
||||
FixedTimeslotTaskIF* gpioPst = factory.createFixedTimeslotTask(
|
||||
"GPIO_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
||||
result = pst::pstGpio(gpioPst);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||
}
|
||||
taskVec.push_back(gpioPst);
|
||||
FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask(
|
||||
"I2C_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
||||
result = pst::pstI2c(i2cPst);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||
}
|
||||
FixedTimeslotTaskIF* uartPst = factory.createFixedTimeslotTask(
|
||||
"UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
||||
result = pst::pstUart(uartPst);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||
}
|
||||
taskVec.push_back(uartPst);
|
||||
FixedTimeslotTaskIF* gpioPst = factory.createFixedTimeslotTask(
|
||||
"GPIO_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
||||
result = pst::pstGpio(gpioPst);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||
}
|
||||
taskVec.push_back(gpioPst);
|
||||
FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask(
|
||||
"I2C_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
||||
result = pst::pstI2c(i2cPst);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||
}
|
||||
|
||||
FixedTimeslotTaskIF* gomSpacePstTask = factory.createFixedTimeslotTask(
|
||||
"GS_PST_TASK", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
|
||||
result = pst::pstGompaceCan(gomSpacePstTask);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "InitMission::initTasks: GomSpace PST initialization failed!" << std::endl;
|
||||
}
|
||||
taskVec.push_back(gomSpacePstTask);
|
||||
#else /* BOARD_TE7020 == 0 */
|
||||
FixedTimeslotTaskIF * pollingSequenceTaskTE0720 = factory.createFixedTimeslotTask(
|
||||
"PST_TASK_TE0720", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE * 8, 3.0,
|
||||
missedDeadlineFunc);
|
||||
result = pst::pollingSequenceTE0720(pollingSequenceTaskTE0720);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "InitMission::initTasks: Creating TE0720 PST failed!" << std::endl;
|
||||
}
|
||||
taskVec.push_back(pollingSequenceTaskTE0720);
|
||||
FixedTimeslotTaskIF* gomSpacePstTask = factory.createFixedTimeslotTask(
|
||||
"GS_PST_TASK", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
|
||||
result = pst::pstGompaceCan(gomSpacePstTask);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "InitMission::initTasks: GomSpace PST initialization failed!" << std::endl;
|
||||
}
|
||||
taskVec.push_back(gomSpacePstTask);
|
||||
#else /* BOARD_TE7020 == 0 */
|
||||
FixedTimeslotTaskIF* pollingSequenceTaskTE0720 = factory.createFixedTimeslotTask(
|
||||
"PST_TASK_TE0720", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE * 8, 3.0, missedDeadlineFunc);
|
||||
result = pst::pollingSequenceTE0720(pollingSequenceTaskTE0720);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "InitMission::initTasks: Creating TE0720 PST failed!" << std::endl;
|
||||
}
|
||||
taskVec.push_back(pollingSequenceTaskTE0720);
|
||||
#endif /* BOARD_TE7020 == 1 */
|
||||
}
|
||||
|
||||
void initmission::createPusTasks(TaskFactory &factory,
|
||||
TaskDeadlineMissedFunction missedDeadlineFunc, std::vector<PeriodicTaskIF*> &taskVec) {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
/* PUS Services */
|
||||
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
||||
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS_VERIF", objects::PUS_SERVICE_1_VERIFICATION);
|
||||
}
|
||||
taskVec.push_back(pusVerification);
|
||||
void initmission::createPusTasks(TaskFactory& factory,
|
||||
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
/* PUS Services */
|
||||
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
||||
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS_VERIF", objects::PUS_SERVICE_1_VERIFICATION);
|
||||
}
|
||||
taskVec.push_back(pusVerification);
|
||||
|
||||
PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
|
||||
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||
}
|
||||
result = pusEvents->addComponent(objects::EVENT_MANAGER);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
|
||||
}
|
||||
taskVec.push_back(pusEvents);
|
||||
PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
|
||||
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||
}
|
||||
result = pusEvents->addComponent(objects::EVENT_MANAGER);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
|
||||
}
|
||||
taskVec.push_back(pusEvents);
|
||||
|
||||
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
|
||||
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS_2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||
}
|
||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS_9", objects::PUS_SERVICE_9_TIME_MGMT);
|
||||
}
|
||||
taskVec.push_back(pusHighPrio);
|
||||
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
|
||||
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS_2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||
}
|
||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS_9", objects::PUS_SERVICE_9_TIME_MGMT);
|
||||
}
|
||||
taskVec.push_back(pusHighPrio);
|
||||
|
||||
PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask(
|
||||
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
|
||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS_8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||
}
|
||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
|
||||
if(result!=HasReturnvaluesIF::RETURN_OK){
|
||||
sif::error << "Object add component failed" << std::endl;
|
||||
}
|
||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS_200", objects::PUS_SERVICE_200_MODE_MGMT);
|
||||
}
|
||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS_20", objects::PUS_SERVICE_20_PARAMETERS);
|
||||
}
|
||||
taskVec.push_back(pusMedPrio);
|
||||
PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask(
|
||||
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
|
||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS_8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||
}
|
||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "Object add component failed" << std::endl;
|
||||
}
|
||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS_200", objects::PUS_SERVICE_200_MODE_MGMT);
|
||||
}
|
||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS_20", objects::PUS_SERVICE_20_PARAMETERS);
|
||||
}
|
||||
taskVec.push_back(pusMedPrio);
|
||||
|
||||
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
|
||||
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
|
||||
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS_17", objects::PUS_SERVICE_17_TEST);
|
||||
}
|
||||
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("ERROR_REPORTER", objects::INTERNAL_ERROR_REPORTER);
|
||||
}
|
||||
taskVec.push_back(pusLowPrio);
|
||||
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
|
||||
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
|
||||
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS_17", objects::PUS_SERVICE_17_TEST);
|
||||
}
|
||||
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("ERROR_REPORTER", objects::INTERNAL_ERROR_REPORTER);
|
||||
}
|
||||
taskVec.push_back(pusLowPrio);
|
||||
}
|
||||
|
||||
void initmission::createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||
#if OBSW_ADD_TEST_TASK == 1 || OBSW_ADD_SPI_TEST_CODE == 1 || (BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1)
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
void initmission::createTestTasks(TaskFactory& factory,
|
||||
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||
#if OBSW_ADD_TEST_TASK == 1 || OBSW_ADD_SPI_TEST_CODE == 1 || \
|
||||
(BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1)
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
#endif
|
||||
PeriodicTaskIF* testTask = factory.createPeriodicTask(
|
||||
"TEST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc);
|
||||
PeriodicTaskIF* testTask = factory.createPeriodicTask(
|
||||
"TEST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc);
|
||||
#if OBSW_ADD_TEST_TASK == 1
|
||||
result = testTask->addComponent(objects::TEST_TASK);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
|
||||
}
|
||||
result = testTask->addComponent(objects::TEST_TASK);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
|
||||
}
|
||||
#endif /* OBSW_ADD_TEST_TASK == 1 */
|
||||
|
||||
#if OBSW_ADD_SPI_TEST_CODE == 1
|
||||
result = testTask->addComponent(objects::SPI_TEST);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
|
||||
}
|
||||
result = testTask->addComponent(objects::SPI_TEST);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
|
||||
}
|
||||
#endif
|
||||
#if BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1
|
||||
result = testTask->addComponent(objects::LIBGPIOD_TEST);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("GPIOD_TEST", objects::LIBGPIOD_TEST);
|
||||
}
|
||||
result = testTask->addComponent(objects::LIBGPIOD_TEST);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("GPIOD_TEST", objects::LIBGPIOD_TEST);
|
||||
}
|
||||
#endif /* BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1 */
|
||||
taskVec.push_back(testTask);
|
||||
taskVec.push_back(testTask);
|
||||
}
|
||||
|
@ -1,9 +1,10 @@
|
||||
#ifndef BSP_Q7S_INITMISSION_H_
|
||||
#define BSP_Q7S_INITMISSION_H_
|
||||
|
||||
#include "fsfw/tasks/Typedef.h"
|
||||
#include <vector>
|
||||
|
||||
#include "fsfw/tasks/Typedef.h"
|
||||
|
||||
class PeriodicTaskIF;
|
||||
class TaskFactory;
|
||||
|
||||
@ -12,11 +13,11 @@ void initMission();
|
||||
void initTasks();
|
||||
|
||||
void createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||
std::vector<PeriodicTaskIF*>& taskVec);
|
||||
std::vector<PeriodicTaskIF*>& taskVec);
|
||||
void createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||
std::vector<PeriodicTaskIF*>& taskVec);
|
||||
std::vector<PeriodicTaskIF*>& taskVec);
|
||||
void createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||
std::vector<PeriodicTaskIF*>& taskVec);
|
||||
};
|
||||
std::vector<PeriodicTaskIF*>& taskVec);
|
||||
}; // namespace initmission
|
||||
|
||||
#endif /* BSP_Q7S_INITMISSION_H_ */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -11,7 +11,7 @@ void setStatics();
|
||||
void produce(void* args);
|
||||
|
||||
void createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, UartComIF** uartComIF,
|
||||
SpiComIF** spiComIF);
|
||||
SpiComIF** spiComIF);
|
||||
void createTmpComponents();
|
||||
void createPcduComponents();
|
||||
void createRadSensorComponent(LinuxLibgpioIF* gpioComIF);
|
||||
@ -22,9 +22,9 @@ void createSolarArrayDeploymentComponents();
|
||||
void createSyrlinksComponents();
|
||||
void createRtdComponents(LinuxLibgpioIF* gpioComIF);
|
||||
void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF);
|
||||
void createCcsdsComponents(LinuxLibgpioIF *gpioComIF);
|
||||
void createCcsdsComponents(LinuxLibgpioIF* gpioComIF);
|
||||
void createTestComponents(LinuxLibgpioIF* gpioComIF);
|
||||
|
||||
};
|
||||
}; // namespace ObjectFactory
|
||||
|
||||
#endif /* BSP_Q7S_OBJECTFACTORY_H_ */
|
||||
|
@ -1,8 +1,5 @@
|
||||
#include "ParameterHandler.h"
|
||||
|
||||
ParameterHandler::ParameterHandler(std::string mountPrefix): mountPrefix(mountPrefix) {
|
||||
}
|
||||
ParameterHandler::ParameterHandler(std::string mountPrefix) : mountPrefix(mountPrefix) {}
|
||||
|
||||
void ParameterHandler::setMountPrefix(std::string prefix) {
|
||||
mountPrefix = prefix;
|
||||
}
|
||||
void ParameterHandler::setMountPrefix(std::string prefix) { mountPrefix = prefix; }
|
||||
|
@ -4,19 +4,17 @@
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <string>
|
||||
|
||||
|
||||
|
||||
class ParameterHandler {
|
||||
public:
|
||||
ParameterHandler(std::string mountPrefix);
|
||||
public:
|
||||
ParameterHandler(std::string mountPrefix);
|
||||
|
||||
void setMountPrefix(std::string prefix);
|
||||
void setMountPrefix(std::string prefix);
|
||||
|
||||
void setUpDummyParameter();
|
||||
private:
|
||||
std::string mountPrefix;
|
||||
DummyParameter dummyParam;
|
||||
void setUpDummyParameter();
|
||||
|
||||
private:
|
||||
std::string mountPrefix;
|
||||
DummyParameter dummyParam;
|
||||
};
|
||||
|
||||
|
||||
#endif /* BSP_Q7S_CORE_PARAMETERHANDLER_H_ */
|
||||
|
@ -1,43 +1,44 @@
|
||||
#include "obsw.h"
|
||||
#include "OBSWVersion.h"
|
||||
#include "OBSWConfig.h"
|
||||
#include "InitMission.h"
|
||||
#include "watchdogConf.h"
|
||||
|
||||
#include "fsfw/tasks/TaskFactory.h"
|
||||
#include "fsfw/FSFWVersion.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
|
||||
#include "InitMission.h"
|
||||
#include "OBSWConfig.h"
|
||||
#include "OBSWVersion.h"
|
||||
#include "fsfw/FSFWVersion.h"
|
||||
#include "fsfw/tasks/TaskFactory.h"
|
||||
#include "watchdogConf.h"
|
||||
|
||||
static int OBSW_ALREADY_RUNNING = -2;
|
||||
|
||||
int obsw::obsw() {
|
||||
std::cout << "-- EIVE OBSW --" << std::endl;
|
||||
std::cout << "-- EIVE OBSW --" << std::endl;
|
||||
#if BOARD_TE0720 == 0
|
||||
std::cout << "-- Compiled for Linux (Xiphos Q7S) --" << std::endl;
|
||||
std::cout << "-- Compiled for Linux (Xiphos Q7S) --" << std::endl;
|
||||
#else
|
||||
std::cout << "-- Compiled for Linux (TE0720) --" << std::endl;
|
||||
std::cout << "-- Compiled for Linux (TE0720) --" << std::endl;
|
||||
#endif
|
||||
std::cout << "-- OBSW v" << SW_VERSION << "." << SW_SUBVERSION <<
|
||||
"." << SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION << "." <<
|
||||
FSFW_REVISION << "--" << std::endl;
|
||||
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
||||
std::cout << "-- OBSW v" << SW_VERSION << "." << SW_SUBVERSION << "." << SW_REVISION << ", FSFW v"
|
||||
<< FSFW_VERSION << "." << FSFW_SUBVERSION << "." << FSFW_REVISION << "--" << std::endl;
|
||||
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
||||
|
||||
#if Q7S_CHECK_FOR_ALREADY_RUNNING_IMG == 1
|
||||
// Check special file here. This file is created or deleted by the eive-watchdog application
|
||||
// or systemd service!
|
||||
if(std::filesystem::exists(watchdog::RUNNING_FILE_NAME)) {
|
||||
sif::warning << "File " << watchdog::RUNNING_FILE_NAME << " exists so the software might "
|
||||
"already be running. Aborting.." << std::endl;
|
||||
return OBSW_ALREADY_RUNNING;
|
||||
}
|
||||
// Check special file here. This file is created or deleted by the eive-watchdog application
|
||||
// or systemd service!
|
||||
if (std::filesystem::exists(watchdog::RUNNING_FILE_NAME)) {
|
||||
sif::warning << "File " << watchdog::RUNNING_FILE_NAME
|
||||
<< " exists so the software might "
|
||||
"already be running. Aborting.."
|
||||
<< std::endl;
|
||||
return OBSW_ALREADY_RUNNING;
|
||||
}
|
||||
#endif
|
||||
initmission::initMission();
|
||||
initmission::initMission();
|
||||
|
||||
for(;;) {
|
||||
/* Suspend main thread by sleeping it. */
|
||||
TaskFactory::delayTask(5000);
|
||||
}
|
||||
return 0;
|
||||
for (;;) {
|
||||
/* Suspend main thread by sleeping it. */
|
||||
TaskFactory::delayTask(5000);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user