Merge branch 'main' into persistent-tle-store
All checks were successful
EIVE/eive-obsw/pipeline/pr-dev-7.5.0 This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-dev-7.5.0 This commit looks good
This commit is contained in:
@ -54,7 +54,7 @@ ReturnValue_t StrComHandler::performOperation(uint8_t operationCode) {
|
||||
switch (state) {
|
||||
case InternalState::POLL_ONE_REPLY: {
|
||||
// Stopwatch watch;
|
||||
replyTimeout.setTimeout(200);
|
||||
replyTimeout.setTimeout(400);
|
||||
readOneReply(static_cast<uint32_t>(state));
|
||||
{
|
||||
MutexGuard mg(lock);
|
||||
@ -720,7 +720,7 @@ ReturnValue_t StrComHandler::readReceivedMessage(CookieIF* cookie, uint8_t** buf
|
||||
{
|
||||
MutexGuard mg(lock);
|
||||
if (state != InternalState::SLEEPING) {
|
||||
return returnvalue::OK;
|
||||
return BUSY;
|
||||
}
|
||||
replyWasReceived = this->replyWasReceived;
|
||||
}
|
||||
@ -733,7 +733,7 @@ ReturnValue_t StrComHandler::readReceivedMessage(CookieIF* cookie, uint8_t** buf
|
||||
*size = replyLen;
|
||||
}
|
||||
replyLen = 0;
|
||||
return returnvalue::OK;
|
||||
return replyResult;
|
||||
}
|
||||
|
||||
ReturnValue_t StrComHandler::unlockAndEraseRegions(uint32_t from, uint32_t to) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @brief Auto-generated event translation file. Contains 315 translations.
|
||||
* @brief Auto-generated event translation file. Contains 317 translations.
|
||||
* @details
|
||||
* Generated on: 2023-10-27 14:24:05
|
||||
* Generated on: 2023-11-29 15:14:46
|
||||
*/
|
||||
#include "translateEvents.h"
|
||||
|
||||
@ -157,6 +157,8 @@ const char *SUPV_EXE_FAILURE_STRING = "SUPV_EXE_FAILURE";
|
||||
const char *SUPV_CRC_FAILURE_EVENT_STRING = "SUPV_CRC_FAILURE_EVENT";
|
||||
const char *SUPV_HELPER_EXECUTING_STRING = "SUPV_HELPER_EXECUTING";
|
||||
const char *SUPV_MPSOC_SHUTDOWN_BUILD_FAILED_STRING = "SUPV_MPSOC_SHUTDOWN_BUILD_FAILED";
|
||||
const char *SUPV_ACK_UNKNOWN_COMMAND_STRING = "SUPV_ACK_UNKNOWN_COMMAND";
|
||||
const char *SUPV_EXE_ACK_UNKNOWN_COMMAND_STRING = "SUPV_EXE_ACK_UNKNOWN_COMMAND";
|
||||
const char *SANITIZATION_FAILED_STRING = "SANITIZATION_FAILED";
|
||||
const char *MOUNTED_SD_CARD_STRING = "MOUNTED_SD_CARD";
|
||||
const char *SEND_MRAM_DUMP_FAILED_STRING = "SEND_MRAM_DUMP_FAILED";
|
||||
@ -627,6 +629,10 @@ const char *translateEvents(Event event) {
|
||||
return SUPV_HELPER_EXECUTING_STRING;
|
||||
case (12008):
|
||||
return SUPV_MPSOC_SHUTDOWN_BUILD_FAILED_STRING;
|
||||
case (12009):
|
||||
return SUPV_ACK_UNKNOWN_COMMAND_STRING;
|
||||
case (12010):
|
||||
return SUPV_EXE_ACK_UNKNOWN_COMMAND_STRING;
|
||||
case (12100):
|
||||
return SANITIZATION_FAILED_STRING;
|
||||
case (12101):
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @brief Auto-generated object translation file.
|
||||
* @details
|
||||
* Contains 179 translations.
|
||||
* Generated on: 2023-10-27 14:24:05
|
||||
* Generated on: 2023-11-29 15:14:46
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
|
@ -30,6 +30,7 @@ ReturnValue_t PapbVcInterface::initialize() {
|
||||
ReturnValue_t PapbVcInterface::write(const uint8_t* data, size_t size, size_t& writtenSize) {
|
||||
// There are no packets smaller than 4, this is considered a configuration error.
|
||||
if (size < 4) {
|
||||
sif::warning << "PapbVcInterface::write: Passed packet smaller than 4 bytes" << std::endl;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
// The user must call advance until completion before starting a new packet transfer.
|
||||
@ -83,6 +84,9 @@ ReturnValue_t PapbVcInterface::advanceWrite(size_t& writtenSize) {
|
||||
writtenSize++;
|
||||
}
|
||||
if (not pollReadyForOctet(MAX_BUSY_POLLS)) {
|
||||
if (not pollReadyForPacket()) {
|
||||
return PARTIALLY_WRITTEN;
|
||||
}
|
||||
abortPacketTransfer();
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
|
@ -2,9 +2,9 @@ target_sources(
|
||||
${OBSW_NAME}
|
||||
PUBLIC PlocMemoryDumper.cpp
|
||||
PlocMpsocHandler.cpp
|
||||
FreshSupvHandler.cpp
|
||||
PlocMpsocSpecialComHelper.cpp
|
||||
plocMpsocHelpers.cpp
|
||||
PlocSupervisorHandler.cpp
|
||||
PlocSupvUartMan.cpp
|
||||
ScexDleParser.cpp
|
||||
ScexHelper.cpp
|
||||
|
1584
linux/payload/FreshSupvHandler.cpp
Normal file
1584
linux/payload/FreshSupvHandler.cpp
Normal file
File diff suppressed because it is too large
Load Diff
188
linux/payload/FreshSupvHandler.h
Normal file
188
linux/payload/FreshSupvHandler.h
Normal file
@ -0,0 +1,188 @@
|
||||
#ifndef LINUX_PAYLOAD_FRESHSUPVHANDLER_H_
|
||||
#define LINUX_PAYLOAD_FRESHSUPVHANDLER_H_
|
||||
|
||||
#include <fsfw/power/PowerSwitchIF.h>
|
||||
#include <mission/controller/controllerdefinitions/PowerCtrlDefinitions.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "PlocSupvUartMan.h"
|
||||
#include "fsfw/devicehandlers/FreshDeviceHandlerBase.h"
|
||||
#include "fsfw/power/definitions.h"
|
||||
#include "fsfw_hal/linux/gpio/Gpio.h"
|
||||
#include "plocSupvDefs.h"
|
||||
|
||||
using supv::TcBase;
|
||||
|
||||
class FreshSupvHandler : public FreshDeviceHandlerBase {
|
||||
public:
|
||||
enum OpCode { DEFAULT_OPERATION = 0, PARSE_TM = 1 };
|
||||
|
||||
FreshSupvHandler(DhbConfig cfg, CookieIF* comCookie, Gpio uartIsolatorSwitch,
|
||||
PowerSwitchIF& switchIF, power::Switch_t powerSwitch);
|
||||
/**
|
||||
* Periodic helper executed function, implemented by child class.
|
||||
*/
|
||||
void performDeviceOperation(uint8_t opCode) override;
|
||||
|
||||
/**
|
||||
* Implemented by child class. Handle all command messages which are
|
||||
* not health, mode, action or housekeeping messages.
|
||||
* @param message
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t handleCommandMessage(CommandMessage* message) override;
|
||||
|
||||
ReturnValue_t initialize() override;
|
||||
|
||||
private:
|
||||
// HK manager abstract functions.
|
||||
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) override;
|
||||
|
||||
// Mode abstract functions
|
||||
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
||||
uint32_t* msToReachTheMode) override;
|
||||
// Action override. Forward to user.
|
||||
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||
const uint8_t* data, size_t size) override;
|
||||
|
||||
/**
|
||||
* @overload
|
||||
* @param submode
|
||||
*/
|
||||
void startTransition(Mode_t newMode, Submode_t submode) override;
|
||||
|
||||
ReturnValue_t performDeviceOperationPreQueueHandling(uint8_t opCode) override;
|
||||
void handleTransitionToOn();
|
||||
void handleTransitionToOff();
|
||||
|
||||
private:
|
||||
static constexpr bool SET_TIME_DURING_BOOT = true;
|
||||
static const uint8_t SIZE_NULL_TERMINATOR = 1;
|
||||
|
||||
enum class StartupState : uint8_t {
|
||||
IDLE,
|
||||
POWER_SWITCHING,
|
||||
BOOTING,
|
||||
SET_TIME,
|
||||
WAIT_FOR_TIME_REPLY,
|
||||
TIME_WAS_SET,
|
||||
ON
|
||||
};
|
||||
|
||||
StartupState startupState = StartupState::IDLE;
|
||||
MessageQueueIF* eventQueue = nullptr;
|
||||
supv::TmBase tmReader;
|
||||
|
||||
enum class ShutdownState : uint8_t { IDLE, POWER_SWITCHING };
|
||||
ShutdownState shutdownState = ShutdownState::IDLE;
|
||||
|
||||
PlocSupvUartManager* uartManager;
|
||||
CookieIF* comCookie;
|
||||
PowerSwitchIF& switchIF;
|
||||
power::Switch_t switchId;
|
||||
Gpio uartIsolatorSwitch;
|
||||
|
||||
supv::HkSet hkSet;
|
||||
supv::BootStatusReport bootStatusReport;
|
||||
supv::LatchupStatusReport latchupStatusReport;
|
||||
supv::CountersReport countersReport;
|
||||
supv::AdcReport adcReport;
|
||||
|
||||
bool transitionActive = false;
|
||||
|
||||
Mode_t targetMode = HasModesIF::MODE_INVALID;
|
||||
Submode_t targetSubmode = 0;
|
||||
|
||||
Countdown switchTimeout = Countdown(2000);
|
||||
// Vorago nees some time to boot properly
|
||||
Countdown bootTimeout = Countdown(supv::BOOT_TIMEOUT_MS);
|
||||
// Countdown interCmdCd = Countdown(supv::INTER_COMMAND_DELAY);
|
||||
|
||||
PoolEntry<uint16_t> adcRawEntry = PoolEntry<uint16_t>(16);
|
||||
PoolEntry<uint16_t> adcEngEntry = PoolEntry<uint16_t>(16);
|
||||
PoolEntry<uint32_t> latchupCounters = PoolEntry<uint32_t>(7);
|
||||
PoolEntry<uint8_t> fmcStateEntry = PoolEntry<uint8_t>(1);
|
||||
PoolEntry<uint8_t> bootStateEntry = PoolEntry<uint8_t>(1);
|
||||
PoolEntry<uint8_t> bootCyclesEntry = PoolEntry<uint8_t>(1);
|
||||
PoolEntry<uint32_t> tempSupEntry = PoolEntry<uint32_t>(1);
|
||||
|
||||
pwrctrl::EnablePl enablePl = pwrctrl::EnablePl(objects::POWER_CONTROLLER);
|
||||
|
||||
struct ActiveCmdInfo {
|
||||
ActiveCmdInfo(DeviceCommandId_t commandId, uint32_t cmdCountdownMs)
|
||||
: commandId(commandId), cmdCountdown(cmdCountdownMs) {}
|
||||
|
||||
DeviceCommandId_t commandId = DeviceHandlerIF::NO_COMMAND_ID;
|
||||
bool isPending = false;
|
||||
bool ackRecv = false;
|
||||
bool ackExeRecv = false;
|
||||
bool replyPacketExpected = false;
|
||||
bool replyPacketReceived = false;
|
||||
MessageQueueId_t commandedBy = MessageQueueIF::NO_QUEUE;
|
||||
bool requiresActionReply = false;
|
||||
Countdown cmdCountdown;
|
||||
};
|
||||
|
||||
uint32_t buildActiveCmdKey(uint16_t moduleApid, uint8_t serviceId);
|
||||
|
||||
// Map for Action commands. For normal commands, a separate static structure will be used.
|
||||
std::map<uint32_t, ActiveCmdInfo> activeActionCmds;
|
||||
|
||||
std::array<uint8_t, supv::MAX_COMMAND_SIZE> commandBuffer{};
|
||||
SpacePacketCreator creator;
|
||||
supv::TcParams spParams = supv::TcParams(creator);
|
||||
DeviceCommandId_t commandedByCached = MessageQueueIF::NO_QUEUE;
|
||||
|
||||
ReturnValue_t parseTmPackets();
|
||||
|
||||
ReturnValue_t sendCommand(DeviceCommandId_t commandId, TcBase& tc, bool replyPacketExpected,
|
||||
uint32_t cmdCountdownMs = 1000);
|
||||
ReturnValue_t sendEmptyCmd(DeviceCommandId_t commandId, uint16_t apid, uint8_t serviceId,
|
||||
bool replyPacketExpected);
|
||||
ReturnValue_t prepareSelBootImageCmd(const uint8_t* commandData);
|
||||
ReturnValue_t prepareSetTimeRefCmd();
|
||||
ReturnValue_t prepareSetBootTimeoutCmd(const uint8_t* commandData, size_t cmdDataLen);
|
||||
ReturnValue_t prepareRestartTriesCmd(const uint8_t* commandData, size_t cmdDataLen);
|
||||
ReturnValue_t prepareDisableHk();
|
||||
ReturnValue_t prepareLatchupConfigCmd(const uint8_t* commandData, DeviceCommandId_t deviceCommand,
|
||||
size_t cmdDataLen);
|
||||
ReturnValue_t prepareSetAlertLimitCmd(const uint8_t* commandData, size_t cmdDataLen);
|
||||
ReturnValue_t prepareFactoryResetCmd(const uint8_t* commandData, size_t len);
|
||||
ReturnValue_t prepareSetShutdownTimeoutCmd(const uint8_t* commandData, size_t cmdDataLen);
|
||||
ReturnValue_t prepareSetGpioCmd(const uint8_t* commandData, size_t commandDataLen);
|
||||
ReturnValue_t prepareReadGpioCmd(const uint8_t* commandData, size_t commandDataLen);
|
||||
ReturnValue_t prepareSetAdcEnabledChannelsCmd(const uint8_t* commandData);
|
||||
ReturnValue_t prepareSetAdcWindowAndStrideCmd(const uint8_t* commandData);
|
||||
ReturnValue_t prepareSetAdcThresholdCmd(const uint8_t* commandData);
|
||||
ReturnValue_t prepareWipeMramCmd(const uint8_t* commandData, size_t cmdDataLen);
|
||||
ReturnValue_t extractUpdateCommand(const uint8_t* commandData, size_t size,
|
||||
supv::UpdateParams& params);
|
||||
ReturnValue_t extractBaseParams(const uint8_t** commandData, size_t& remSize,
|
||||
supv::UpdateParams& params);
|
||||
void handleEvent(EventMessage* eventMessage);
|
||||
|
||||
void handleBadApidServiceCombination(Event event, unsigned int apid, unsigned int serviceId);
|
||||
ReturnValue_t eventSubscription();
|
||||
void handlePacketPrint();
|
||||
bool isCommandAlreadyActive(ActionId_t actionId) const;
|
||||
ReturnValue_t handleAckReport(const uint8_t* data);
|
||||
void printAckFailureInfo(uint16_t statusCode, DeviceCommandId_t commandId);
|
||||
ReturnValue_t handleExecutionReport(const uint8_t* data);
|
||||
ReturnValue_t handleExecutionSuccessReport(ActiveCmdInfo& info, supv::ExecutionReport& report);
|
||||
void handleExecutionFailureReport(ActiveCmdInfo& info, supv::ExecutionReport& report);
|
||||
ReturnValue_t handleHkReport(const uint8_t* data);
|
||||
ReturnValue_t verifyPacket(const uint8_t* start, size_t foundLen);
|
||||
void confirmReplyPacketReceived(supv::Apid apid, uint8_t serviceId);
|
||||
void performCommandCompletionHandling(supv::Apid apid, uint8_t serviceId, ActiveCmdInfo& info);
|
||||
ReturnValue_t handleBootStatusReport(const uint8_t* data);
|
||||
ReturnValue_t genericHandleTm(const char* contextString, const uint8_t* data,
|
||||
LocalPoolDataSetBase& set, supv::Apid apid, uint8_t serviceId);
|
||||
ReturnValue_t handleLatchupStatusReport(const uint8_t* data);
|
||||
|
||||
bool isCommandPending() const;
|
||||
};
|
||||
|
||||
#endif /* LINUX_PAYLOAD_FRESHSUPVHANDLER_H_ */
|
@ -20,9 +20,8 @@ PlocMpsocHandler::PlocMpsocHandler(object_id_t objectId, object_id_t uartComIFid
|
||||
if (comCookie == nullptr) {
|
||||
sif::error << "PlocMPSoCHandler: Invalid communication cookie" << std::endl;
|
||||
}
|
||||
eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5);
|
||||
commandActionHelperQueue =
|
||||
QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5);
|
||||
eventQueue = QueueFactory::instance()->createMessageQueue(10);
|
||||
commandActionHelperQueue = QueueFactory::instance()->createMessageQueue(10);
|
||||
spParams.maxSize = sizeof(commandBuffer);
|
||||
spParams.buf = commandBuffer;
|
||||
}
|
||||
|
@ -504,7 +504,7 @@ ReturnValue_t PlocMpsocSpecialComHelper::checkReceivedTm() {
|
||||
triggerEvent(MPSOC_TM_SIZE_ERROR);
|
||||
return result;
|
||||
}
|
||||
spReader.checkCrc();
|
||||
result = spReader.checkCrc();
|
||||
if (result != returnvalue::OK) {
|
||||
sif::warning << "PLOC MPSoC: CRC check failed" << std::endl;
|
||||
triggerEvent(MPSOC_TM_CRC_MISSMATCH, *sequenceCount);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,394 +0,0 @@
|
||||
#ifndef MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_
|
||||
#define MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_
|
||||
|
||||
#include <linux/payload/PlocSupvUartMan.h>
|
||||
#include <linux/payload/plocSupvDefs.h>
|
||||
#include <mission/controller/controllerdefinitions/PowerCtrlDefinitions.h>
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#include "devices/powerSwitcherList.h"
|
||||
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
|
||||
#include "fsfw/timemanager/Countdown.h"
|
||||
#include "fsfw_hal/linux/gpio/Gpio.h"
|
||||
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
||||
#include "fsfw_hal/linux/serial/SerialComIF.h"
|
||||
|
||||
#ifdef XIPHOS_Q7S
|
||||
#include "bsp_q7s/fs/SdCardManager.h"
|
||||
#endif
|
||||
|
||||
using supv::ExecutionReport;
|
||||
using supv::TcBase;
|
||||
|
||||
static constexpr bool DEBUG_PLOC_SUPV = false;
|
||||
|
||||
/**
|
||||
* @brief This is the device handler for the supervisor of the PLOC which is programmed by
|
||||
* Thales.
|
||||
*
|
||||
* @details The PLOC uses the space packet protocol for communication. On each command the PLOC
|
||||
* answers with at least one acknowledgment and one execution report.
|
||||
* Flight manual:
|
||||
* https://egit.irs.uni-stuttgart.de/redmine/projects/eive-flight-manual/wiki/PLOC_Commands
|
||||
* ILH ICD: https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/
|
||||
* Arbeitsdaten/08_Used%20Components/PLOC&fileid=940960
|
||||
* @author J. Meier
|
||||
*/
|
||||
class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
public:
|
||||
PlocSupervisorHandler(object_id_t objectId, CookieIF* comCookie, Gpio uartIsolatorSwitch,
|
||||
power::Switch_t powerSwitch, PlocSupvUartManager& supvHelper);
|
||||
virtual ~PlocSupervisorHandler();
|
||||
|
||||
virtual ReturnValue_t initialize() override;
|
||||
void performOperationHook() override;
|
||||
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||
const uint8_t* data, size_t size) override;
|
||||
|
||||
protected:
|
||||
void doStartUp() override;
|
||||
void doShutDown() override;
|
||||
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
|
||||
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t* id) override;
|
||||
void fillCommandAndReplyMap() override;
|
||||
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData,
|
||||
size_t commandDataLen) override;
|
||||
ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,
|
||||
size_t* foundLen) override;
|
||||
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) override;
|
||||
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) override;
|
||||
ReturnValue_t enableReplyInReplyMap(DeviceCommandMap::iterator command,
|
||||
uint8_t expectedReplies = 1, bool useAlternateId = false,
|
||||
DeviceCommandId_t alternateReplyID = 0) override;
|
||||
size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override;
|
||||
// ReturnValue_t doSendReadHook() override;
|
||||
void doOffActivity() override;
|
||||
|
||||
private:
|
||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_SUPERVISOR_HANDLER;
|
||||
|
||||
//! [EXPORT] : [COMMENT] PLOC supervisor crc failure in telemetry packet
|
||||
static const Event SUPV_MEMORY_READ_RPT_CRC_FAILURE = MAKE_EVENT(1, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Unhandled event. P1: APID, P2: Service ID
|
||||
static constexpr Event SUPV_UNKNOWN_TM = MAKE_EVENT(2, severity::LOW);
|
||||
static constexpr Event SUPV_UNINIMPLEMENTED_TM = MAKE_EVENT(3, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] PLOC supervisor received acknowledgment failure report
|
||||
static const Event SUPV_ACK_FAILURE = MAKE_EVENT(4, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] PLOC received execution failure report
|
||||
//! P1: ID of command for which the execution failed
|
||||
//! P2: Status code sent by the supervisor handler
|
||||
static const Event SUPV_EXE_FAILURE = MAKE_EVENT(5, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] PLOC supervisor reply has invalid crc
|
||||
static const Event SUPV_CRC_FAILURE_EVENT = MAKE_EVENT(6, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Supervisor helper currently executing a command
|
||||
static const Event SUPV_HELPER_EXECUTING = MAKE_EVENT(7, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Failed to build the command to shutdown the MPSoC
|
||||
static const Event SUPV_MPSOC_SHUTDOWN_BUILD_FAILED = MAKE_EVENT(8, severity::LOW);
|
||||
|
||||
static const uint16_t APID_MASK = 0x7FF;
|
||||
static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF;
|
||||
static const uint8_t EXE_STATUS_OFFSET = 10;
|
||||
static const uint8_t SIZE_NULL_TERMINATOR = 1;
|
||||
// 5 s
|
||||
static const uint32_t EXECUTION_DEFAULT_TIMEOUT = 5000;
|
||||
// 70 S
|
||||
static const uint32_t ACKNOWLEDGE_DEFAULT_TIMEOUT = 70000;
|
||||
// 60 s
|
||||
static const uint32_t MRAM_DUMP_EXECUTION_TIMEOUT = 60000;
|
||||
// 70 s
|
||||
static const uint32_t COPY_ADC_TO_MRAM_TIMEOUT = 70000;
|
||||
// 60 s
|
||||
static const uint32_t MRAM_DUMP_TIMEOUT = 60000;
|
||||
// 4 s
|
||||
static const uint32_t BOOT_TIMEOUT = 4000;
|
||||
enum class StartupState : uint8_t {
|
||||
OFF,
|
||||
BOOTING,
|
||||
SET_TIME,
|
||||
WAIT_FOR_TIME_REPLY,
|
||||
TIME_WAS_SET,
|
||||
ON
|
||||
};
|
||||
|
||||
static constexpr bool SET_TIME_DURING_BOOT = true;
|
||||
|
||||
StartupState startupState = StartupState::OFF;
|
||||
|
||||
uint8_t commandBuffer[supv::MAX_COMMAND_SIZE];
|
||||
SpacePacketCreator creator;
|
||||
supv::TcParams spParams = supv::TcParams(creator);
|
||||
|
||||
/**
|
||||
* This variable is used to store the id of the next reply to receive. This is necessary
|
||||
* because the PLOC sends as reply to each command at least one acknowledgment and execution
|
||||
* report.
|
||||
*/
|
||||
DeviceCommandId_t nextReplyId = supv::NONE;
|
||||
|
||||
SerialComIF* uartComIf = nullptr;
|
||||
LinuxLibgpioIF* gpioComIF = nullptr;
|
||||
Gpio uartIsolatorSwitch;
|
||||
bool shutdownCmdSent = false;
|
||||
|
||||
supv::HkSet hkset;
|
||||
supv::BootStatusReport bootStatusReport;
|
||||
supv::LatchupStatusReport latchupStatusReport;
|
||||
supv::LoggingReport loggingReport;
|
||||
supv::AdcReport adcReport;
|
||||
|
||||
const power::Switch_t powerSwitch = power::NO_SWITCH;
|
||||
supv::TmBase tmReader;
|
||||
|
||||
PlocSupvUartManager& uartManager;
|
||||
MessageQueueIF* eventQueue = nullptr;
|
||||
|
||||
/** Number of expected replies following the MRAM dump command */
|
||||
uint32_t expectedMramDumpPackets = 0;
|
||||
uint32_t receivedMramDumpPackets = 0;
|
||||
/** Set to true as soon as a complete space packet is present in the spacePacketBuffer */
|
||||
bool packetInBuffer = false;
|
||||
|
||||
/** This buffer is used to concatenate space packets received in two different read steps */
|
||||
uint8_t spacePacketBuffer[supv::MAX_PACKET_SIZE];
|
||||
|
||||
#ifdef XIPHOS_Q7S
|
||||
SdCardManager* sdcMan = nullptr;
|
||||
#endif
|
||||
|
||||
// Path to supervisor specific files on SD card
|
||||
std::string supervisorFilePath = "ploc/supervisor";
|
||||
std::string activeMramFile;
|
||||
|
||||
Countdown executionReportTimeout = Countdown(EXECUTION_DEFAULT_TIMEOUT, false);
|
||||
Countdown acknowledgementReportTimeout = Countdown(ACKNOWLEDGE_DEFAULT_TIMEOUT, false);
|
||||
// Vorago nees some time to boot properly
|
||||
Countdown bootTimeout = Countdown(BOOT_TIMEOUT);
|
||||
Countdown mramDumpTimeout = Countdown(MRAM_DUMP_TIMEOUT);
|
||||
|
||||
PoolEntry<uint8_t> fmcStateEntry = PoolEntry<uint8_t>(1);
|
||||
PoolEntry<uint8_t> bootStateEntry = PoolEntry<uint8_t>(1);
|
||||
PoolEntry<uint8_t> bootCyclesEntry = PoolEntry<uint8_t>(1);
|
||||
PoolEntry<uint32_t> tempSupEntry = PoolEntry<uint32_t>(1);
|
||||
|
||||
/**
|
||||
* @brief Adjusts the timeout of the execution report dependent on command
|
||||
*/
|
||||
void setExecutionTimeout(DeviceCommandId_t command);
|
||||
|
||||
void handlePacketPrint();
|
||||
|
||||
/**
|
||||
* @brief Handles event messages received from the supervisor helper
|
||||
*/
|
||||
void handleEvent(EventMessage* eventMessage);
|
||||
|
||||
ReturnValue_t getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches);
|
||||
|
||||
/**
|
||||
* @brief This function checks the crc of the received PLOC reply.
|
||||
*
|
||||
* @param start Pointer to the first byte of the reply.
|
||||
* @param foundLen Pointer to the length of the whole packet.
|
||||
*
|
||||
* @return returnvalue::OK if CRC is ok, otherwise CRC_FAILURE.
|
||||
*/
|
||||
ReturnValue_t verifyPacket(const uint8_t* start, size_t foundLen);
|
||||
|
||||
/**
|
||||
* @brief This function handles the acknowledgment report.
|
||||
*
|
||||
* @param data Pointer to the data holding the acknowledgment report.
|
||||
*
|
||||
* @return returnvalue::OK if successful, otherwise an error code.
|
||||
*/
|
||||
ReturnValue_t handleAckReport(const uint8_t* data);
|
||||
|
||||
/**
|
||||
* @brief This function handles the data of a execution report.
|
||||
*
|
||||
* @param data Pointer to the received data packet.
|
||||
*
|
||||
* @return returnvalue::OK if successful, otherwise an error code.
|
||||
*/
|
||||
ReturnValue_t handleExecutionReport(const uint8_t* data);
|
||||
|
||||
/**
|
||||
* @brief This function handles the housekeeping report. This means verifying the CRC of the
|
||||
* reply and filling the appropriate dataset.
|
||||
*
|
||||
* @param data Pointer to the data buffer holding the housekeeping read report.
|
||||
*
|
||||
* @return returnvalue::OK if successful, otherwise an error code.
|
||||
*/
|
||||
ReturnValue_t handleHkReport(const uint8_t* data);
|
||||
|
||||
/**
|
||||
* @brief This function calls the function to check the CRC of the received boot status report
|
||||
* and fills the associated dataset with the boot status information.
|
||||
*/
|
||||
ReturnValue_t handleBootStatusReport(const uint8_t* data);
|
||||
|
||||
ReturnValue_t handleLatchupStatusReport(const uint8_t* data);
|
||||
void handleBadApidServiceCombination(Event result, unsigned int apid, unsigned int serviceId);
|
||||
ReturnValue_t handleAdcReport(const uint8_t* data);
|
||||
|
||||
/**
|
||||
* @brief Depending on the current active command, this function sets the reply id of the
|
||||
* next reply after a successful acknowledgment report has been received. This is
|
||||
* required by the function getNextReplyLength() to identify the length of the next
|
||||
* reply to read.
|
||||
*/
|
||||
void setNextReplyId();
|
||||
|
||||
/**
|
||||
* @brief This function handles action message replies in case the telemetry has been
|
||||
* requested by another object.
|
||||
*
|
||||
* @param data Pointer to the telemetry data.
|
||||
* @param dataSize Size of telemetry in bytes.
|
||||
* @param replyId Id of the reply. This will be added to the ActionMessage.
|
||||
*/
|
||||
void handleDeviceTm(const uint8_t* data, size_t dataSize, DeviceCommandId_t replyId);
|
||||
|
||||
/**
|
||||
* @brief This function prepares a space packet which does not transport any data in the
|
||||
* packet data field apart from the crc.
|
||||
*/
|
||||
ReturnValue_t prepareEmptyCmd(uint16_t apid, uint8_t serviceId);
|
||||
|
||||
/**
|
||||
* @brief This function initializes the space packet to select the boot image of the MPSoC.
|
||||
*/
|
||||
ReturnValue_t prepareSelBootImageCmd(const uint8_t* commandData);
|
||||
|
||||
ReturnValue_t prepareDisableHk();
|
||||
|
||||
/**
|
||||
* @brief This function fills the commandBuffer with the data to update the time of the
|
||||
* PLOC supervisor.
|
||||
*/
|
||||
ReturnValue_t prepareSetTimeRefCmd();
|
||||
|
||||
/**
|
||||
* @brief This function fills the commandBuffer with the data to change the boot timeout
|
||||
* value in the PLOC supervisor.
|
||||
*/
|
||||
ReturnValue_t prepareSetBootTimeoutCmd(const uint8_t* commandData);
|
||||
|
||||
ReturnValue_t prepareRestartTriesCmd(const uint8_t* commandData);
|
||||
|
||||
ReturnValue_t prepareFactoryResetCmd(const uint8_t* commandData, size_t len);
|
||||
|
||||
/**
|
||||
* @brief This function fills the command buffer with the packet to enable or disable the
|
||||
* watchdogs on the PLOC.
|
||||
*/
|
||||
void prepareWatchdogsEnableCmd(const uint8_t* commandData);
|
||||
|
||||
/**
|
||||
* @brief This function fills the command buffer with the packet to set the watchdog timer
|
||||
* of one of the three watchdogs (PS, PL, INT).
|
||||
*/
|
||||
ReturnValue_t prepareWatchdogsConfigTimeoutCmd(const uint8_t* commandData);
|
||||
|
||||
ReturnValue_t prepareLatchupConfigCmd(const uint8_t* commandData,
|
||||
DeviceCommandId_t deviceCommand);
|
||||
ReturnValue_t prepareSetAlertLimitCmd(const uint8_t* commandData);
|
||||
ReturnValue_t prepareSetAdcEnabledChannelsCmd(const uint8_t* commandData);
|
||||
ReturnValue_t prepareSetAdcWindowAndStrideCmd(const uint8_t* commandData);
|
||||
ReturnValue_t prepareSetAdcThresholdCmd(const uint8_t* commandData);
|
||||
ReturnValue_t prepareRunAutoEmTest(const uint8_t* commandData);
|
||||
ReturnValue_t prepareWipeMramCmd(const uint8_t* commandData);
|
||||
ReturnValue_t prepareSetGpioCmd(const uint8_t* commandData);
|
||||
ReturnValue_t prepareReadGpioCmd(const uint8_t* commandData);
|
||||
|
||||
/**
|
||||
* @brief Copies the content of a space packet to the command buffer.
|
||||
*/
|
||||
void finishTcPrep(TcBase& tc);
|
||||
|
||||
/**
|
||||
* @brief In case an acknowledgment failure reply has been received this function disables
|
||||
* all previously enabled commands and resets the exepected replies variable of an
|
||||
* active command.
|
||||
*/
|
||||
void disableAllReplies();
|
||||
|
||||
void disableReply(DeviceCommandId_t replyId);
|
||||
|
||||
/**
|
||||
* @brief This function sends a failure report if the active action was commanded by an other
|
||||
* object.
|
||||
*
|
||||
* @param replyId The id of the reply which signals a failure.
|
||||
* @param status A status byte which gives information about the failure type.
|
||||
*/
|
||||
void sendFailureReport(DeviceCommandId_t replyId, ReturnValue_t status);
|
||||
|
||||
/**
|
||||
* @brief This function disables the execution report reply. Within this function also the
|
||||
* the variable expectedReplies of an active command will be set to 0.
|
||||
*/
|
||||
void disableExeReportReply();
|
||||
|
||||
/**
|
||||
* @brief This function generates the Service 8 packets for the MRAM dump data.
|
||||
*/
|
||||
ReturnValue_t handleMramDumpPacket(DeviceCommandId_t id);
|
||||
|
||||
/**
|
||||
* @brief With this function the number of expected replies following an MRAM dump command
|
||||
* will be increased. This is necessary to release the command in case not all replies
|
||||
* have been received.
|
||||
*/
|
||||
void increaseExpectedMramReplies(DeviceCommandId_t id);
|
||||
|
||||
/**
|
||||
* @brief Writes the data of the MRAM dump to a file. The file will be created when receiving
|
||||
* the first packet.
|
||||
*/
|
||||
ReturnValue_t handleMramDumpFile(DeviceCommandId_t id);
|
||||
|
||||
/**
|
||||
* @brief Extracts the length field of a spacePacket referenced by the spacePacket pointer.
|
||||
*
|
||||
* @param spacePacket Pointer to the buffer holding the space packet.
|
||||
*
|
||||
* @return The value stored in the length field of the data field.
|
||||
*/
|
||||
uint16_t readSpacePacketLength(uint8_t* spacePacket);
|
||||
|
||||
/**
|
||||
* @brief Extracts the sequence flags from a space packet referenced by the spacePacket
|
||||
* pointer.
|
||||
*
|
||||
* @param spacePacket Pointer to the buffer holding the space packet.
|
||||
*
|
||||
* @return uint8_t where the two least significant bits hold the sequence flags.
|
||||
*/
|
||||
uint8_t readSequenceFlags(uint8_t* spacePacket);
|
||||
|
||||
ReturnValue_t createMramDumpFile();
|
||||
ReturnValue_t getTimeStampString(std::string& timeStamp);
|
||||
|
||||
ReturnValue_t prepareSetShutdownTimeoutCmd(const uint8_t* commandData);
|
||||
|
||||
ReturnValue_t extractUpdateCommand(const uint8_t* commandData, size_t size,
|
||||
supv::UpdateParams& params);
|
||||
ReturnValue_t extractBaseParams(const uint8_t** commandData, size_t& remSize,
|
||||
supv::UpdateParams& params);
|
||||
ReturnValue_t eventSubscription();
|
||||
|
||||
ReturnValue_t handleExecutionSuccessReport(ExecutionReport& report);
|
||||
void handleExecutionFailureReport(ExecutionReport& report);
|
||||
|
||||
void printAckFailureInfo(uint16_t statusCode, DeviceCommandId_t commandId);
|
||||
|
||||
pwrctrl::EnablePl enablePl = pwrctrl::EnablePl(objects::POWER_CONTROLLER);
|
||||
ReturnValue_t checkModeCommand(Mode_t commandedMode, Submode_t commandedSubmode,
|
||||
uint32_t* msToReachTheMode) override;
|
||||
};
|
||||
|
||||
#endif /* MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_ */
|
@ -24,6 +24,7 @@
|
||||
#include "mission/utility/Filenaming.h"
|
||||
#include "mission/utility/ProgressPrinter.h"
|
||||
#include "mission/utility/Timestamp.h"
|
||||
#include "tas/crc.h"
|
||||
|
||||
using namespace returnvalue;
|
||||
using namespace supv;
|
||||
@ -96,9 +97,10 @@ ReturnValue_t PlocSupvUartManager::initialize() {
|
||||
ReturnValue_t PlocSupvUartManager::performOperation(uint8_t operationCode) {
|
||||
bool putTaskToSleep = false;
|
||||
while (true) {
|
||||
lock->lockMutex();
|
||||
state = InternalState::SLEEPING;
|
||||
lock->unlockMutex();
|
||||
{
|
||||
MutexGuard mg(lock);
|
||||
state = InternalState::SLEEPING;
|
||||
}
|
||||
semaphore->acquire();
|
||||
putTaskToSleep = false;
|
||||
#if OBSW_THREAD_TRACING == 1
|
||||
@ -110,9 +112,11 @@ ReturnValue_t PlocSupvUartManager::performOperation(uint8_t operationCode) {
|
||||
break;
|
||||
}
|
||||
handleUartReception();
|
||||
lock->lockMutex();
|
||||
InternalState currentState = state;
|
||||
lock->unlockMutex();
|
||||
InternalState currentState;
|
||||
{
|
||||
MutexGuard mg(lock);
|
||||
currentState = state;
|
||||
}
|
||||
switch (currentState) {
|
||||
case InternalState::SLEEPING:
|
||||
case InternalState::GO_TO_SLEEP: {
|
||||
@ -156,7 +160,7 @@ ReturnValue_t PlocSupvUartManager::handleUartReception() {
|
||||
<< " bytes" << std::endl;
|
||||
return FAILED;
|
||||
} else if (bytesRead > 0) {
|
||||
if (debugMode) {
|
||||
if (DEBUG_MODE) {
|
||||
sif::info << "Received " << bytesRead << " bytes from the PLOC Supervisor:" << std::endl;
|
||||
arrayprinter::print(recBuf.data(), bytesRead);
|
||||
}
|
||||
@ -571,7 +575,7 @@ ReturnValue_t PlocSupvUartManager::handlePacketTransmissionNoReply(
|
||||
size_t packetLen = 0;
|
||||
decodedQueue.retrieve(&packetLen);
|
||||
decodedRingBuf.readData(decodedBuf.data(), packetLen, true);
|
||||
tmReader.setData(decodedBuf.data(), packetLen);
|
||||
tmReader.setReadOnlyData(decodedBuf.data(), packetLen);
|
||||
result = checkReceivedTm();
|
||||
if (result != returnvalue::OK) {
|
||||
continue;
|
||||
@ -617,7 +621,7 @@ int PlocSupvUartManager::handleAckReception(supv::TcBase& tc, size_t packetLen)
|
||||
if (serviceId == static_cast<uint8_t>(supv::tm::TmtcId::ACK) or
|
||||
serviceId == static_cast<uint8_t>(supv::tm::TmtcId::NAK)) {
|
||||
AcknowledgmentReport ackReport(tmReader);
|
||||
ReturnValue_t result = ackReport.parse();
|
||||
ReturnValue_t result = ackReport.parse(false);
|
||||
if (result != returnvalue::OK) {
|
||||
triggerEvent(ACK_RECEPTION_FAILURE);
|
||||
return -1;
|
||||
@ -627,7 +631,7 @@ int PlocSupvUartManager::handleAckReception(supv::TcBase& tc, size_t packetLen)
|
||||
if (serviceId == static_cast<uint8_t>(supv::tm::TmtcId::ACK)) {
|
||||
return 1;
|
||||
} else if (serviceId == static_cast<uint8_t>(supv::tm::TmtcId::NAK)) {
|
||||
ackReport.printStatusInformation();
|
||||
ackReport.printStatusInformationAck();
|
||||
triggerEvent(
|
||||
SUPV_ACK_FAILURE_REPORT,
|
||||
buildApidServiceParam1(ackReport.getRefModuleApid(), ackReport.getRefServiceId()),
|
||||
@ -649,7 +653,7 @@ int PlocSupvUartManager::handleExeAckReception(supv::TcBase& tc, size_t packetLe
|
||||
if (serviceId == static_cast<uint8_t>(supv::tm::TmtcId::EXEC_ACK) or
|
||||
serviceId == static_cast<uint8_t>(supv::tm::TmtcId::EXEC_NAK)) {
|
||||
ExecutionReport exeReport(tmReader);
|
||||
ReturnValue_t result = exeReport.parse();
|
||||
ReturnValue_t result = exeReport.parse(false);
|
||||
if (result != returnvalue::OK) {
|
||||
triggerEvent(EXE_RECEPTION_FAILURE);
|
||||
return -1;
|
||||
@ -659,7 +663,7 @@ int PlocSupvUartManager::handleExeAckReception(supv::TcBase& tc, size_t packetLe
|
||||
if (serviceId == static_cast<uint8_t>(supv::tm::TmtcId::EXEC_ACK)) {
|
||||
return 1;
|
||||
} else if (serviceId == static_cast<uint8_t>(supv::tm::TmtcId::EXEC_NAK)) {
|
||||
exeReport.printStatusInformation();
|
||||
exeReport.printStatusInformationExe();
|
||||
triggerEvent(
|
||||
SUPV_EXE_FAILURE_REPORT,
|
||||
buildApidServiceParam1(exeReport.getRefModuleApid(), exeReport.getRefServiceId()),
|
||||
@ -682,7 +686,7 @@ ReturnValue_t PlocSupvUartManager::checkReceivedTm() {
|
||||
triggerEvent(SUPV_REPLY_SIZE_MISSMATCH, rememberApid);
|
||||
return result;
|
||||
}
|
||||
if (not tmReader.verifyCrc()) {
|
||||
if (tmReader.checkCrc() != returnvalue::OK) {
|
||||
triggerEvent(SUPV_REPLY_CRC_MISSMATCH, rememberApid);
|
||||
return result;
|
||||
}
|
||||
@ -758,7 +762,7 @@ ReturnValue_t PlocSupvUartManager::handleCheckMemoryCommand(uint8_t failStep) {
|
||||
size_t packetLen = 0;
|
||||
decodedQueue.retrieve(&packetLen);
|
||||
decodedRingBuf.readData(decodedBuf.data(), packetLen, true);
|
||||
tmReader.setData(decodedBuf.data(), packetLen);
|
||||
tmReader.setReadOnlyData(decodedBuf.data(), packetLen);
|
||||
result = checkReceivedTm();
|
||||
if (result != returnvalue::OK) {
|
||||
continue;
|
||||
@ -786,7 +790,7 @@ ReturnValue_t PlocSupvUartManager::handleCheckMemoryCommand(uint8_t failStep) {
|
||||
} else if (tmReader.getModuleApid() == Apid::MEM_MAN) {
|
||||
if (ackReceived) {
|
||||
supv::UpdateStatusReport report(tmReader);
|
||||
result = report.parse();
|
||||
result = report.parse(false);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
@ -962,7 +966,7 @@ ReturnValue_t PlocSupvUartManager::handleRunningLongerRequest() {
|
||||
ReturnValue_t PlocSupvUartManager::encodeAndSendPacket(const uint8_t* sendData, size_t sendLen) {
|
||||
size_t encodedLen = 0;
|
||||
addHdlcFraming(sendData, sendLen, encodedSendBuf.data(), &encodedLen, encodedSendBuf.size());
|
||||
if (printTc) {
|
||||
if (PRINT_TC) {
|
||||
sif::debug << "Sending TC" << std::endl;
|
||||
arrayprinter::print(encodedSendBuf.data(), encodedLen);
|
||||
}
|
||||
@ -984,6 +988,9 @@ ReturnValue_t PlocSupvUartManager::readReceivedMessage(CookieIF* cookie, uint8_t
|
||||
return OK;
|
||||
}
|
||||
ipcQueue.retrieve(size);
|
||||
if (*size > ipcBuffer.size()) {
|
||||
return FAILED;
|
||||
}
|
||||
*buffer = ipcBuffer.data();
|
||||
ReturnValue_t result = ipcRingBuf.readData(ipcBuffer.data(), *size, true);
|
||||
if (result != OK) {
|
||||
@ -1054,6 +1061,7 @@ ReturnValue_t PlocSupvUartManager::parseRecRingBufForHdlc(size_t& readSize, size
|
||||
triggerEvent(HDLC_CRC_ERROR);
|
||||
}
|
||||
if (retval != 0) {
|
||||
readSize = ++idx;
|
||||
return HDLC_ERROR;
|
||||
}
|
||||
return returnvalue::OK;
|
||||
@ -1084,11 +1092,14 @@ void PlocSupvUartManager::performUartShutdown() {
|
||||
while (not decodedQueue.empty()) {
|
||||
decodedQueue.pop();
|
||||
}
|
||||
MutexGuard mg(ipcLock);
|
||||
ipcRingBuf.clear();
|
||||
while (not ipcQueue.empty()) {
|
||||
ipcQueue.pop();
|
||||
{
|
||||
MutexGuard mg0(ipcLock);
|
||||
ipcRingBuf.clear();
|
||||
while (not ipcQueue.empty()) {
|
||||
ipcQueue.pop();
|
||||
}
|
||||
}
|
||||
MutexGuard mg1(lock);
|
||||
state = InternalState::GO_TO_SLEEP;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "fsfw/returnvalues/returnvalue.h"
|
||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||
#include "fsfw_hal/linux/serial/SerialComIF.h"
|
||||
#include "tas/crc.h"
|
||||
|
||||
#ifdef XIPHOS_Q7S
|
||||
#include "bsp_q7s/fs/SdCardManager.h"
|
||||
@ -121,6 +120,32 @@ class PlocSupvUartManager : public DeviceCommunicationIF,
|
||||
|
||||
PlocSupvUartManager(object_id_t objectId);
|
||||
virtual ~PlocSupvUartManager();
|
||||
/**
|
||||
* @brief Device specific initialization, using the cookie.
|
||||
* @details
|
||||
* The cookie is already prepared in the factory. If the communication
|
||||
* interface needs to be set up in some way and requires cookie information,
|
||||
* this can be performed in this function, which is called on device handler
|
||||
* initialization.
|
||||
* @param cookie
|
||||
* @return
|
||||
* - @c returnvalue::OK if initialization was successfull
|
||||
* - Everything else triggers failure event with returnvalue as parameter 1
|
||||
*/
|
||||
ReturnValue_t initializeInterface(CookieIF* cookie) override;
|
||||
/**
|
||||
* Called by DHB in the SEND_WRITE doSendWrite().
|
||||
* This function is used to send data to the physical device
|
||||
* by implementing and calling related drivers or wrapper functions.
|
||||
* @param cookie
|
||||
* @param data
|
||||
* @param len If this is 0, nothing shall be sent.
|
||||
* @return
|
||||
* - @c returnvalue::OK for successfull send
|
||||
* - Everything else triggers failure event with returnvalue as parameter 1
|
||||
*/
|
||||
ReturnValue_t sendMessage(CookieIF* cookie, const uint8_t* sendData, size_t sendLen) override;
|
||||
ReturnValue_t readReceivedMessage(CookieIF* cookie, uint8_t** buffer, size_t* size) override;
|
||||
|
||||
ReturnValue_t initialize() override;
|
||||
ReturnValue_t performOperation(uint8_t operationCode = 0) override;
|
||||
@ -206,11 +231,11 @@ class PlocSupvUartManager : public DeviceCommunicationIF,
|
||||
|
||||
struct Update update;
|
||||
|
||||
int serialPort = 0;
|
||||
SemaphoreIF* semaphore;
|
||||
MutexIF* lock;
|
||||
MutexIF* ipcLock;
|
||||
supv::TmBase tmReader;
|
||||
int serialPort = 0;
|
||||
struct termios tty = {};
|
||||
#if OBSW_THREAD_TRACING == 1
|
||||
uint32_t opCounter = 0;
|
||||
@ -257,8 +282,8 @@ class PlocSupvUartManager : public DeviceCommunicationIF,
|
||||
|
||||
std::array<uint8_t, supv::MAX_COMMAND_SIZE> tmBuf{};
|
||||
|
||||
bool printTc = false;
|
||||
bool debugMode = false;
|
||||
static constexpr bool PRINT_TC = false;
|
||||
static constexpr bool DEBUG_MODE = false;
|
||||
bool timestamping = true;
|
||||
|
||||
// Remembers APID to know at which command a procedure failed
|
||||
@ -319,32 +344,6 @@ class PlocSupvUartManager : public DeviceCommunicationIF,
|
||||
void resetSpParams();
|
||||
void pushIpcData(const uint8_t* data, size_t len);
|
||||
|
||||
/**
|
||||
* @brief Device specific initialization, using the cookie.
|
||||
* @details
|
||||
* The cookie is already prepared in the factory. If the communication
|
||||
* interface needs to be set up in some way and requires cookie information,
|
||||
* this can be performed in this function, which is called on device handler
|
||||
* initialization.
|
||||
* @param cookie
|
||||
* @return
|
||||
* - @c returnvalue::OK if initialization was successfull
|
||||
* - Everything else triggers failure event with returnvalue as parameter 1
|
||||
*/
|
||||
ReturnValue_t initializeInterface(CookieIF* cookie) override;
|
||||
|
||||
/**
|
||||
* Called by DHB in the SEND_WRITE doSendWrite().
|
||||
* This function is used to send data to the physical device
|
||||
* by implementing and calling related drivers or wrapper functions.
|
||||
* @param cookie
|
||||
* @param data
|
||||
* @param len If this is 0, nothing shall be sent.
|
||||
* @return
|
||||
* - @c returnvalue::OK for successfull send
|
||||
* - Everything else triggers failure event with returnvalue as parameter 1
|
||||
*/
|
||||
ReturnValue_t sendMessage(CookieIF* cookie, const uint8_t* sendData, size_t sendLen) override;
|
||||
/**
|
||||
* Called by DHB in the GET_WRITE doGetWrite().
|
||||
* Get send confirmation that the data in sendMessage() was sent successfully.
|
||||
@ -369,7 +368,6 @@ class PlocSupvUartManager : public DeviceCommunicationIF,
|
||||
* returnvalue as parameter 1
|
||||
*/
|
||||
ReturnValue_t requestReceiveMessage(CookieIF* cookie, size_t requestLen) override;
|
||||
ReturnValue_t readReceivedMessage(CookieIF* cookie, uint8_t** buffer, size_t* size) override;
|
||||
|
||||
void performUartShutdown();
|
||||
void updateVtime(uint8_t vtime);
|
||||
|
@ -11,13 +11,46 @@
|
||||
#include <mission/payload/plocSpBase.h>
|
||||
|
||||
#include <atomic>
|
||||
#include <optional>
|
||||
|
||||
#include "eive/eventSubsystemIds.h"
|
||||
#include "eive/resultClassIds.h"
|
||||
|
||||
namespace supv {
|
||||
|
||||
static constexpr bool DEBUG_PLOC_SUPV = false;
|
||||
static constexpr bool REDUCE_NORMAL_MODE_PRINTOUT = true;
|
||||
|
||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_SUPERVISOR_HANDLER;
|
||||
|
||||
//! [EXPORT] : [COMMENT] PLOC supervisor crc failure in telemetry packet
|
||||
static const Event SUPV_MEMORY_READ_RPT_CRC_FAILURE = MAKE_EVENT(1, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Unhandled event. P1: APID, P2: Service ID
|
||||
static constexpr Event SUPV_UNKNOWN_TM = MAKE_EVENT(2, severity::LOW);
|
||||
static constexpr Event SUPV_UNINIMPLEMENTED_TM = MAKE_EVENT(3, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] PLOC supervisor received acknowledgment failure report
|
||||
static const Event SUPV_ACK_FAILURE = MAKE_EVENT(4, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] PLOC received execution failure report
|
||||
//! P1: ID of command for which the execution failed
|
||||
//! P2: Status code sent by the supervisor handler
|
||||
static const Event SUPV_EXE_FAILURE = MAKE_EVENT(5, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] PLOC supervisor reply has invalid crc
|
||||
static const Event SUPV_CRC_FAILURE_EVENT = MAKE_EVENT(6, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Supervisor helper currently executing a command
|
||||
static const Event SUPV_HELPER_EXECUTING = MAKE_EVENT(7, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Failed to build the command to shutdown the MPSoC
|
||||
static const Event SUPV_MPSOC_SHUTDOWN_BUILD_FAILED = MAKE_EVENT(8, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Received ACK, but no related command is unknown or has not been sent
|
||||
// by this software instance. P1: Module APID. P2: Service ID.
|
||||
static const Event SUPV_ACK_UNKNOWN_COMMAND = MAKE_EVENT(9, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Received ACK EXE, but no related command is unknown or has not been sent
|
||||
// by this software instance. P1: Module APID. P2: Service ID.
|
||||
static const Event SUPV_EXE_ACK_UNKNOWN_COMMAND = MAKE_EVENT(10, severity::LOW);
|
||||
|
||||
extern std::atomic_bool SUPV_ON;
|
||||
static constexpr uint32_t INTER_COMMAND_DELAY = 20;
|
||||
static constexpr uint32_t BOOT_TIMEOUT_MS = 4000;
|
||||
static constexpr uint32_t MAX_TRANSITION_TIME_TO_ON_MS = BOOT_TIMEOUT_MS + 2000;
|
||||
static constexpr uint32_t MAX_TRANSITION_TIME_TO_OFF_MS = 1000;
|
||||
|
||||
namespace result {
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::SUPV_RETURN_VALUES_IF;
|
||||
@ -107,7 +140,7 @@ static const DeviceCommandId_t FIRST_MRAM_DUMP = 30;
|
||||
static const DeviceCommandId_t SET_GPIO = 34;
|
||||
static const DeviceCommandId_t READ_GPIO = 35;
|
||||
static const DeviceCommandId_t RESTART_SUPERVISOR = 36;
|
||||
static const DeviceCommandId_t LOGGING_REQUEST_COUNTERS = 38;
|
||||
static const DeviceCommandId_t REQUEST_LOGGING_COUNTERS = 38;
|
||||
static constexpr DeviceCommandId_t FACTORY_RESET = 39;
|
||||
static const DeviceCommandId_t CONSECUTIVE_MRAM_DUMP = 43;
|
||||
static const DeviceCommandId_t START_MPSOC_QUIET = 45;
|
||||
@ -120,7 +153,7 @@ static const DeviceCommandId_t DISABLE_AUTO_TM = 51;
|
||||
static const DeviceCommandId_t LOGGING_REQUEST_EVENT_BUFFERS = 54;
|
||||
static const DeviceCommandId_t LOGGING_CLEAR_COUNTERS = 55;
|
||||
static const DeviceCommandId_t LOGGING_SET_TOPIC = 56;
|
||||
static const DeviceCommandId_t REQUEST_ADC_REPORT = 57;
|
||||
static constexpr DeviceCommandId_t REQUEST_ADC_REPORT = 57;
|
||||
static const DeviceCommandId_t RESET_PL = 58;
|
||||
static const DeviceCommandId_t ENABLE_NVMS = 59;
|
||||
static const DeviceCommandId_t CONTINUE_UPDATE = 60;
|
||||
@ -134,7 +167,7 @@ enum ReplyId : DeviceCommandId_t {
|
||||
HK_REPORT = 102,
|
||||
BOOT_STATUS_REPORT = 103,
|
||||
LATCHUP_REPORT = 104,
|
||||
LOGGING_REPORT = 105,
|
||||
COUNTERS_REPORT = 105,
|
||||
ADC_REPORT = 106,
|
||||
UPDATE_STATUS_REPORT = 107,
|
||||
};
|
||||
@ -144,7 +177,7 @@ static const uint16_t SIZE_ACK_REPORT = 14;
|
||||
static const uint16_t SIZE_EXE_REPORT = 14;
|
||||
static const uint16_t SIZE_BOOT_STATUS_REPORT = 24;
|
||||
static const uint16_t SIZE_LATCHUP_STATUS_REPORT = 31;
|
||||
static const uint16_t SIZE_LOGGING_REPORT = 73;
|
||||
static const uint16_t SIZE_COUNTERS_REPORT = 120;
|
||||
static const uint16_t SIZE_ADC_REPORT = 72;
|
||||
|
||||
// 2 bits APID SRC, 00 for OBC, 2 bits APID DEST, 01 for SUPV, 7 bits CMD ID -> Mask 0x080
|
||||
@ -207,12 +240,18 @@ enum class AdcMonId : uint8_t {
|
||||
SET_ENABLED_CHANNELS = 0x02,
|
||||
SET_WINDOW_STRIDE = 0x03,
|
||||
SET_ADC_THRESHOLD = 0x04,
|
||||
COPY_ADC_DATA_TO_MRAM = 0x05
|
||||
COPY_ADC_DATA_TO_MRAM = 0x05,
|
||||
REQUEST_ADC_SAMPLE = 0x06
|
||||
};
|
||||
|
||||
enum class MemManId : uint8_t { ERASE = 0x01, WRITE = 0x02, CHECK = 0x03 };
|
||||
|
||||
enum class DataLoggerServiceId : uint8_t {
|
||||
// Not implemented.
|
||||
READ_MRAM_CFG_DATA_LOGGER = 0x00,
|
||||
REQUEST_COUNTERS = 0x01,
|
||||
// Not implemented.
|
||||
EVENT_BUFFER_DOWNLOAD = 0x02,
|
||||
WIPE_MRAM = 0x05,
|
||||
DUMP_MRAM = 0x06,
|
||||
FACTORY_RESET = 0x07
|
||||
@ -231,10 +270,12 @@ enum class TmtcId : uint8_t { ACK = 0x01, NAK = 0x02, EXEC_ACK = 0x03, EXEC_NAK
|
||||
enum class HkId : uint8_t { REPORT = 0x01, HARDFAULTS = 0x02 };
|
||||
|
||||
enum class BootManId : uint8_t { BOOT_STATUS_REPORT = 0x01 };
|
||||
enum class AdcMonId : uint8_t { ADC_REPORT = 0x01 };
|
||||
|
||||
enum class MemManId : uint8_t { UPDATE_STATUS_REPORT = 0x01 };
|
||||
|
||||
enum class LatchupMonId : uint8_t { LATCHUP_STATUS_REPORT = 0x01 };
|
||||
enum class DataLoggerId : uint8_t { COUNTERS_REPORT = 0x01 };
|
||||
|
||||
} // namespace tm
|
||||
|
||||
@ -321,13 +362,13 @@ static const uint16_t SEQUENCE_COUNT_MASK = 0xFFF;
|
||||
static const uint8_t HK_SET_ENTRIES = 13;
|
||||
static const uint8_t BOOT_REPORT_SET_ENTRIES = 10;
|
||||
static const uint8_t LATCHUP_RPT_SET_ENTRIES = 16;
|
||||
static const uint8_t LOGGING_RPT_SET_ENTRIES = 16;
|
||||
static const uint8_t LOGGING_RPT_SET_ENTRIES = 30;
|
||||
static const uint8_t ADC_RPT_SET_ENTRIES = 32;
|
||||
|
||||
static const uint32_t HK_SET_ID = HK_REPORT;
|
||||
static const uint32_t BOOT_REPORT_SET_ID = BOOT_STATUS_REPORT;
|
||||
static const uint32_t LATCHUP_RPT_ID = LATCHUP_REPORT;
|
||||
static const uint32_t LOGGING_RPT_ID = LOGGING_REPORT;
|
||||
static const uint32_t LOGGING_RPT_ID = COUNTERS_REPORT;
|
||||
static const uint32_t ADC_REPORT_SET_ID = ADC_REPORT;
|
||||
|
||||
namespace timeout {
|
||||
@ -392,7 +433,7 @@ enum PoolIds : lp_id_t {
|
||||
BR_SOC_STATE,
|
||||
POWER_CYCLES,
|
||||
BOOT_AFTER_MS,
|
||||
BOOT_TIMEOUT_MS,
|
||||
BOOT_TIMEOUT_POOL_VAR_MS,
|
||||
ACTIVE_NVM,
|
||||
BP0_STATE,
|
||||
BP1_STATE,
|
||||
@ -417,13 +458,8 @@ enum PoolIds : lp_id_t {
|
||||
LATCHUP_RPT_TIME_MSEC,
|
||||
LATCHUP_RPT_IS_SET,
|
||||
|
||||
LATCHUP_HAPPENED_CNT_0,
|
||||
LATCHUP_HAPPENED_CNT_1,
|
||||
LATCHUP_HAPPENED_CNT_2,
|
||||
LATCHUP_HAPPENED_CNT_3,
|
||||
LATCHUP_HAPPENED_CNT_4,
|
||||
LATCHUP_HAPPENED_CNT_5,
|
||||
LATCHUP_HAPPENED_CNT_6,
|
||||
SIGNATURE,
|
||||
LATCHUP_HAPPENED_CNTS,
|
||||
ADC_DEVIATION_TRIGGERS_CNT,
|
||||
TC_RECEIVED_CNT,
|
||||
TM_AVAILABLE_CNT,
|
||||
@ -432,40 +468,22 @@ enum PoolIds : lp_id_t {
|
||||
MPSOC_BOOT_FAILED_ATTEMPTS,
|
||||
MPSOC_POWER_UP,
|
||||
MPSOC_UPDATES,
|
||||
LAST_RECVD_TC,
|
||||
MPSOC_HEARTBEAT_RESETS,
|
||||
CPU_WDT_RESETS,
|
||||
PS_HEARTBEATS_LOST,
|
||||
PL_HEARTBEATS_LOST,
|
||||
EB_TASK_LOST,
|
||||
BM_TASK_LOST,
|
||||
LM_TASK_LOST,
|
||||
AM_TASK_LOST,
|
||||
TCTMM_TASK_LOST,
|
||||
MM_TASK_LOST,
|
||||
HK_TASK_LOST,
|
||||
DL_TASK_LOST,
|
||||
RWS_TASKS_LOST,
|
||||
|
||||
ADC_RAW_0,
|
||||
ADC_RAW_1,
|
||||
ADC_RAW_2,
|
||||
ADC_RAW_3,
|
||||
ADC_RAW_4,
|
||||
ADC_RAW_5,
|
||||
ADC_RAW_6,
|
||||
ADC_RAW_7,
|
||||
ADC_RAW_8,
|
||||
ADC_RAW_9,
|
||||
ADC_RAW_10,
|
||||
ADC_RAW_11,
|
||||
ADC_RAW_12,
|
||||
ADC_RAW_13,
|
||||
ADC_RAW_14,
|
||||
ADC_RAW_15,
|
||||
ADC_ENG_0,
|
||||
ADC_ENG_1,
|
||||
ADC_ENG_2,
|
||||
ADC_ENG_3,
|
||||
ADC_ENG_4,
|
||||
ADC_ENG_5,
|
||||
ADC_ENG_6,
|
||||
ADC_ENG_7,
|
||||
ADC_ENG_8,
|
||||
ADC_ENG_9,
|
||||
ADC_ENG_10,
|
||||
ADC_ENG_11,
|
||||
ADC_ENG_12,
|
||||
ADC_ENG_13,
|
||||
ADC_ENG_14,
|
||||
ADC_ENG_15
|
||||
ADC_RAW,
|
||||
ADC_ENG,
|
||||
};
|
||||
|
||||
struct TcParams : public ploc::SpTcParams {
|
||||
@ -539,15 +557,6 @@ class TmBase : public ploc::SpTmReader {
|
||||
}
|
||||
}
|
||||
|
||||
bool verifyCrc() {
|
||||
if (checkCrc() == returnvalue::OK) {
|
||||
crcOk = true;
|
||||
}
|
||||
return crcOk;
|
||||
}
|
||||
|
||||
bool crcIsOk() const { return crcOk; }
|
||||
|
||||
uint8_t getServiceId() const { return getPacketData()[TIMESTAMP_LEN]; }
|
||||
|
||||
uint16_t getModuleApid() const { return getApid() & APID_MODULE_MASK; }
|
||||
@ -559,9 +568,6 @@ class TmBase : public ploc::SpTmReader {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
bool crcOk = false;
|
||||
};
|
||||
|
||||
class NoPayloadPacket : public TcBase {
|
||||
@ -769,8 +775,6 @@ class SetRestartTries : public TcBase {
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t restartTries = 0;
|
||||
|
||||
void initPacket(uint8_t restartTries) { payloadStart[0] = restartTries; }
|
||||
};
|
||||
|
||||
@ -831,8 +835,6 @@ class LatchupAlert : public TcBase {
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t latchupId = 0;
|
||||
|
||||
void initPacket(uint8_t latchupId) { payloadStart[0] = latchupId; }
|
||||
};
|
||||
|
||||
@ -862,9 +864,6 @@ class SetAlertlimit : public TcBase {
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t latchupId = 0;
|
||||
uint32_t dutycycle = 0;
|
||||
|
||||
ReturnValue_t initPacket(uint8_t latchupId, uint32_t dutycycle) {
|
||||
payloadStart[0] = latchupId;
|
||||
size_t serLen = 0;
|
||||
@ -1295,8 +1294,8 @@ class VerificationReport {
|
||||
|
||||
virtual ~VerificationReport() = default;
|
||||
|
||||
virtual ReturnValue_t parse() {
|
||||
if (not readerBase.crcIsOk()) {
|
||||
virtual ReturnValue_t parse(bool checkCrc) {
|
||||
if (checkCrc and readerBase.checkCrc() != returnvalue::OK) {
|
||||
return result::CRC_FAILURE;
|
||||
}
|
||||
if (readerBase.getModuleApid() != Apid::TMTC_MAN) {
|
||||
@ -1313,27 +1312,27 @@ class VerificationReport {
|
||||
ReturnValue_t result = SerializeAdapter::deSerialize(&refApid, &payloadStart, &remLen,
|
||||
SerializeIF::Endianness::BIG);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::debug << "VerificationReport: Failed to deserialize reference APID field" << std::endl;
|
||||
sif::warning << "VerificationReport: Failed to deserialize reference APID field" << std::endl;
|
||||
return result;
|
||||
}
|
||||
result = SerializeAdapter::deSerialize(&refServiceId, &payloadStart, &remLen,
|
||||
SerializeIF::Endianness::BIG);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::debug << "VerificationReport: Failed to deserialize reference Service ID field"
|
||||
<< std::endl;
|
||||
sif::warning << "VerificationReport: Failed to deserialize reference Service ID field"
|
||||
<< std::endl;
|
||||
return result;
|
||||
}
|
||||
result = SerializeAdapter::deSerialize(&refSeqCount, &payloadStart, &remLen,
|
||||
SerializeIF::Endianness::BIG);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::debug << "VerificationReport: Failed to deserialize reference sequence count field"
|
||||
<< std::endl;
|
||||
sif::warning << "VerificationReport: Failed to deserialize reference sequence count field"
|
||||
<< std::endl;
|
||||
return result;
|
||||
}
|
||||
result = SerializeAdapter::deSerialize(&statusCode, &payloadStart, &remLen,
|
||||
SerializeIF::Endianness::BIG);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::debug << "VerificationReport: Failed to deserialize status code field" << std::endl;
|
||||
sif::warning << "VerificationReport: Failed to deserialize status code field" << std::endl;
|
||||
return result;
|
||||
}
|
||||
return returnvalue::OK;
|
||||
@ -1350,7 +1349,7 @@ class VerificationReport {
|
||||
|
||||
uint32_t getStatusCode() const { return statusCode; }
|
||||
|
||||
virtual void printStatusInformation(const char* prefix) {
|
||||
virtual void printStatusInformation(const char* prefix) const {
|
||||
bool codeHandled = true;
|
||||
if (statusCode < 0x100) {
|
||||
GeneralStatusCode code = static_cast<GeneralStatusCode>(getStatusCode());
|
||||
@ -1637,15 +1636,15 @@ class AcknowledgmentReport : public VerificationReport {
|
||||
public:
|
||||
AcknowledgmentReport(TmBase& readerBase) : VerificationReport(readerBase) {}
|
||||
|
||||
virtual ReturnValue_t parse() override {
|
||||
ReturnValue_t parse(bool checkCrc) override {
|
||||
if (readerBase.getServiceId() != static_cast<uint8_t>(tm::TmtcId::ACK) and
|
||||
readerBase.getServiceId() != static_cast<uint8_t>(tm::TmtcId::NAK)) {
|
||||
return result::INVALID_SERVICE_ID;
|
||||
}
|
||||
return VerificationReport::parse();
|
||||
return VerificationReport::parse(checkCrc);
|
||||
}
|
||||
|
||||
void printStatusInformation() {
|
||||
void printStatusInformationAck() {
|
||||
VerificationReport::printStatusInformation(STATUS_PRINTOUT_PREFIX);
|
||||
}
|
||||
|
||||
@ -1659,15 +1658,15 @@ class ExecutionReport : public VerificationReport {
|
||||
|
||||
TmBase& getReader() { return readerBase; }
|
||||
|
||||
ReturnValue_t parse() override {
|
||||
ReturnValue_t parse(bool checkCrc) override {
|
||||
if (readerBase.getServiceId() != static_cast<uint8_t>(tm::TmtcId::EXEC_ACK) and
|
||||
readerBase.getServiceId() != static_cast<uint8_t>(tm::TmtcId::EXEC_NAK)) {
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
return VerificationReport::parse();
|
||||
return VerificationReport::parse(checkCrc);
|
||||
}
|
||||
|
||||
void printStatusInformation() {
|
||||
void printStatusInformationExe() {
|
||||
VerificationReport::printStatusInformation(STATUS_PRINTOUT_PREFIX);
|
||||
}
|
||||
|
||||
@ -1679,8 +1678,8 @@ class UpdateStatusReport {
|
||||
public:
|
||||
UpdateStatusReport(TmBase& tmReader) : tmReader(tmReader) {}
|
||||
|
||||
ReturnValue_t parse() {
|
||||
if (not tmReader.crcIsOk()) {
|
||||
ReturnValue_t parse(bool checkCrc) {
|
||||
if (checkCrc and tmReader.checkCrc() != returnvalue::OK) {
|
||||
return result::CRC_FAILURE;
|
||||
}
|
||||
if (tmReader.getModuleApid() != Apid::MEM_MAN) {
|
||||
@ -1742,7 +1741,7 @@ class BootStatusReport : public StaticLocalDataSet<BOOT_REPORT_SET_ENTRIES> {
|
||||
lp_var_t<uint32_t> bootAfterMs = lp_var_t<uint32_t>(sid.objectId, PoolIds::BOOT_AFTER_MS, this);
|
||||
/** The currently set boot timeout */
|
||||
lp_var_t<uint32_t> bootTimeoutMs =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::BOOT_TIMEOUT_MS, this);
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::BOOT_TIMEOUT_POOL_VAR_MS, this);
|
||||
lp_var_t<uint8_t> activeNvm = lp_var_t<uint8_t>(sid.objectId, PoolIds::ACTIVE_NVM, this);
|
||||
/** States of the boot partition pins */
|
||||
lp_var_t<uint8_t> bp0State = lp_var_t<uint8_t>(sid.objectId, PoolIds::BP0_STATE, this);
|
||||
@ -1814,26 +1813,16 @@ class LatchupStatusReport : public StaticLocalDataSet<LATCHUP_RPT_SET_ENTRIES> {
|
||||
/**
|
||||
* @brief This dataset stores the logging report.
|
||||
*/
|
||||
class LoggingReport : public StaticLocalDataSet<LOGGING_RPT_SET_ENTRIES> {
|
||||
class CountersReport : public StaticLocalDataSet<LOGGING_RPT_SET_ENTRIES> {
|
||||
public:
|
||||
LoggingReport(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, LOGGING_RPT_ID) {}
|
||||
CountersReport(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, LOGGING_RPT_ID) {}
|
||||
|
||||
LoggingReport(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, LOGGING_RPT_ID)) {}
|
||||
CountersReport(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, LOGGING_RPT_ID)) {}
|
||||
|
||||
lp_var_t<uint32_t> latchupHappenCnt0 =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_HAPPENED_CNT_0, this);
|
||||
lp_var_t<uint32_t> latchupHappenCnt1 =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_HAPPENED_CNT_1, this);
|
||||
lp_var_t<uint32_t> latchupHappenCnt2 =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_HAPPENED_CNT_2, this);
|
||||
lp_var_t<uint32_t> latchupHappenCnt3 =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_HAPPENED_CNT_3, this);
|
||||
lp_var_t<uint32_t> latchupHappenCnt4 =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_HAPPENED_CNT_4, this);
|
||||
lp_var_t<uint32_t> latchupHappenCnt5 =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_HAPPENED_CNT_5, this);
|
||||
lp_var_t<uint32_t> latchupHappenCnt6 =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_HAPPENED_CNT_6, this);
|
||||
lp_var_t<uint32_t> signature =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_HAPPENED_CNTS, this);
|
||||
lp_vec_t<uint32_t, 7> latchupHappenCnts =
|
||||
lp_vec_t<uint32_t, 7>(sid.objectId, PoolIds::LATCHUP_HAPPENED_CNTS, this);
|
||||
lp_var_t<uint32_t> adcDeviationTriggersCnt =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::ADC_DEVIATION_TRIGGERS_CNT, this);
|
||||
lp_var_t<uint32_t> tcReceivedCnt =
|
||||
@ -1847,23 +1836,31 @@ class LoggingReport : public StaticLocalDataSet<LOGGING_RPT_SET_ENTRIES> {
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::MPSOC_BOOT_FAILED_ATTEMPTS, this);
|
||||
lp_var_t<uint32_t> mpsocPowerup = lp_var_t<uint32_t>(sid.objectId, PoolIds::MPSOC_POWER_UP, this);
|
||||
lp_var_t<uint32_t> mpsocUpdates = lp_var_t<uint32_t>(sid.objectId, PoolIds::MPSOC_UPDATES, this);
|
||||
lp_var_t<uint32_t> lastRecvdTc = lp_var_t<uint32_t>(sid.objectId, PoolIds::LAST_RECVD_TC, this);
|
||||
lp_var_t<uint32_t> mpsocHeartbeatResets =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::MPSOC_HEARTBEAT_RESETS, this);
|
||||
lp_var_t<uint32_t> cpuWdtResets =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::MPSOC_HEARTBEAT_RESETS, this);
|
||||
lp_var_t<uint32_t> psHeartbeatsLost =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::PS_HEARTBEATS_LOST, this);
|
||||
lp_var_t<uint32_t> plHeartbeatsLost =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::PL_HEARTBEATS_LOST, this);
|
||||
lp_var_t<uint32_t> ebTaskLost = lp_var_t<uint32_t>(sid.objectId, PoolIds::EB_TASK_LOST, this);
|
||||
lp_var_t<uint32_t> bmTaskLost = lp_var_t<uint32_t>(sid.objectId, PoolIds::BM_TASK_LOST, this);
|
||||
lp_var_t<uint32_t> lmTaskLost = lp_var_t<uint32_t>(sid.objectId, PoolIds::LM_TASK_LOST, this);
|
||||
lp_var_t<uint32_t> amTaskLost = lp_var_t<uint32_t>(sid.objectId, PoolIds::AM_TASK_LOST, this);
|
||||
lp_var_t<uint32_t> tctmmTaskLost =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::TCTMM_TASK_LOST, this);
|
||||
lp_var_t<uint32_t> mmTaskLost = lp_var_t<uint32_t>(sid.objectId, PoolIds::MM_TASK_LOST, this);
|
||||
lp_var_t<uint32_t> hkTaskLost = lp_var_t<uint32_t>(sid.objectId, PoolIds::HK_TASK_LOST, this);
|
||||
lp_var_t<uint32_t> dlTaskLost = lp_var_t<uint32_t>(sid.objectId, PoolIds::DL_TASK_LOST, this);
|
||||
lp_vec_t<uint32_t, 3> rwsTasksLost =
|
||||
lp_vec_t<uint32_t, 3>(sid.objectId, PoolIds::RWS_TASKS_LOST, this);
|
||||
|
||||
void printSet() {
|
||||
sif::info << "LoggingReport: Latchup happened count 0: " << this->latchupHappenCnt0
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 1: " << this->latchupHappenCnt1
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 2: " << this->latchupHappenCnt2
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 3: " << this->latchupHappenCnt3
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 4: " << this->latchupHappenCnt4
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 5: " << this->latchupHappenCnt5
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 6: " << this->latchupHappenCnt6
|
||||
<< std::endl;
|
||||
for (unsigned i = 0; i < 7; i++) {
|
||||
sif::info << "LoggingReport: Latchup happened count " << i << ": "
|
||||
<< this->latchupHappenCnts[i] << std::endl;
|
||||
}
|
||||
sif::info << "LoggingReport: ADC deviation triggers count: " << this->adcDeviationTriggersCnt
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: TC received count: " << this->tcReceivedCnt << std::endl;
|
||||
@ -1874,88 +1871,29 @@ class LoggingReport : public StaticLocalDataSet<LOGGING_RPT_SET_ENTRIES> {
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: MPSoC power up: " << this->mpsocPowerup << std::endl;
|
||||
sif::info << "LoggingReport: MPSoC updates: " << this->mpsocUpdates << std::endl;
|
||||
sif::info << "LoggingReport: APID of last received TC: 0x" << std::hex << this->lastRecvdTc
|
||||
<< std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This dataset stores the ADC report.
|
||||
*/
|
||||
class AdcReport : public StaticLocalDataSet<ADC_RPT_SET_ENTRIES> {
|
||||
class AdcReport : public StaticLocalDataSet<3> {
|
||||
public:
|
||||
AdcReport(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, ADC_REPORT_SET_ID) {}
|
||||
|
||||
AdcReport(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, ADC_REPORT_SET_ID)) {}
|
||||
|
||||
lp_var_t<uint16_t> adcRaw0 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_0, this);
|
||||
lp_var_t<uint16_t> adcRaw1 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_1, this);
|
||||
lp_var_t<uint16_t> adcRaw2 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_2, this);
|
||||
lp_var_t<uint16_t> adcRaw3 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_3, this);
|
||||
lp_var_t<uint16_t> adcRaw4 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_4, this);
|
||||
lp_var_t<uint16_t> adcRaw5 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_5, this);
|
||||
lp_var_t<uint16_t> adcRaw6 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_6, this);
|
||||
lp_var_t<uint16_t> adcRaw7 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_7, this);
|
||||
lp_var_t<uint16_t> adcRaw8 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_8, this);
|
||||
lp_var_t<uint16_t> adcRaw9 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_9, this);
|
||||
lp_var_t<uint16_t> adcRaw10 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_10, this);
|
||||
lp_var_t<uint16_t> adcRaw11 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_11, this);
|
||||
lp_var_t<uint16_t> adcRaw12 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_12, this);
|
||||
lp_var_t<uint16_t> adcRaw13 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_13, this);
|
||||
lp_var_t<uint16_t> adcRaw14 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_14, this);
|
||||
lp_var_t<uint16_t> adcRaw15 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_15, this);
|
||||
lp_var_t<uint16_t> adcEng0 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_0, this);
|
||||
lp_var_t<uint16_t> adcEng1 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_1, this);
|
||||
lp_var_t<uint16_t> adcEng2 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_2, this);
|
||||
lp_var_t<uint16_t> adcEng3 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_3, this);
|
||||
lp_var_t<uint16_t> adcEng4 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_4, this);
|
||||
lp_var_t<uint16_t> adcEng5 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_5, this);
|
||||
lp_var_t<uint16_t> adcEng6 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_6, this);
|
||||
lp_var_t<uint16_t> adcEng7 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_7, this);
|
||||
lp_var_t<uint16_t> adcEng8 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_8, this);
|
||||
lp_var_t<uint16_t> adcEng9 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_9, this);
|
||||
lp_var_t<uint16_t> adcEng10 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_10, this);
|
||||
lp_var_t<uint16_t> adcEng11 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_11, this);
|
||||
lp_var_t<uint16_t> adcEng12 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_12, this);
|
||||
lp_var_t<uint16_t> adcEng13 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_13, this);
|
||||
lp_var_t<uint16_t> adcEng14 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_14, this);
|
||||
lp_var_t<uint16_t> adcEng15 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_15, this);
|
||||
lp_vec_t<uint16_t, 16> adcRaw = lp_vec_t<uint16_t, 16>(sid.objectId, PoolIds::ADC_RAW, this);
|
||||
lp_vec_t<uint16_t, 16> adcEng = lp_vec_t<uint16_t, 16>(sid.objectId, PoolIds::ADC_ENG, this);
|
||||
|
||||
void printSet() {
|
||||
sif::info << "---- Adc Report: Raw values ----" << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 0: " << std::dec << this->adcRaw0 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 1: " << this->adcRaw1 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 2: " << this->adcRaw2 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 3: " << this->adcRaw3 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 4: " << this->adcRaw4 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 5: " << this->adcRaw5 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 6: " << this->adcRaw6 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 7: " << this->adcRaw7 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 8: " << this->adcRaw8 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 9: " << this->adcRaw9 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 10: " << this->adcRaw10 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 11: " << this->adcRaw11 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 12: " << this->adcRaw12 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 13: " << this->adcRaw13 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 14: " << this->adcRaw14 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 15: " << this->adcRaw15 << std::endl;
|
||||
sif::info << "---- Adc Report: Engineering values ----" << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 0: " << this->adcEng0 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 1: " << this->adcEng1 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 2: " << this->adcEng2 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 3: " << this->adcEng3 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 4: " << this->adcEng4 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 5: " << this->adcEng5 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 6: " << this->adcEng6 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 7: " << this->adcEng7 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 8: " << this->adcEng8 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 9: " << this->adcEng9 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 10: " << this->adcEng10 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 11: " << this->adcEng11 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 12: " << this->adcEng12 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 13: " << this->adcEng13 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 14: " << this->adcEng14 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 15: " << this->adcEng15 << std::endl;
|
||||
for (unsigned i = 0; i < 16; i++) {
|
||||
sif::info << "AdcReport: ADC raw " << i << ": " << std::dec << this->adcRaw[i] << std::endl;
|
||||
}
|
||||
for (unsigned i = 0; i < 16; i++) {
|
||||
sif::info << "AdcReport: ADC eng " << i << ": " << std::dec << this->adcEng[i] << std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -2045,11 +1983,7 @@ class EnableNvms : public TcBase {
|
||||
*/
|
||||
class EnableAutoTm : public TcBase {
|
||||
public:
|
||||
EnableAutoTm(TcParams params) : TcBase(params) {
|
||||
spParams.setFullPayloadLen(PAYLOAD_LENGTH + 2);
|
||||
// spParams.creator.setApid(APID_AUTO_TM);
|
||||
// spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
|
||||
}
|
||||
EnableAutoTm(TcParams params) : TcBase(params) { spParams.setFullPayloadLen(PAYLOAD_LENGTH + 2); }
|
||||
|
||||
ReturnValue_t buildPacket() {
|
||||
auto res = checkSizeAndSerializeHeader();
|
||||
|
Reference in New Issue
Block a user