added some commands for flash formatting
This commit is contained in:
parent
9d8ad494b3
commit
78815b1e22
@ -500,6 +500,27 @@ ReturnValue_t FreshMpsocHandler::executeRegularCmd(ActionId_t actionId,
|
||||
result = commandTcReplayWriteSequence(commandData, commandDataLen);
|
||||
break;
|
||||
}
|
||||
case (mpsoc::TC_ENABLE_TC_EXECTION): {
|
||||
mpsoc::TcEnableTcExec cmd(spParams, commandSequenceCount);
|
||||
result = cmd.setPayload(commandData, commandDataLen);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
result = finishAndSendTc(actionId, cmd);
|
||||
break;
|
||||
}
|
||||
case (mpsoc::TC_FLASH_MKFS): {
|
||||
if (commandDataLen != 1) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
if (commandData[0] != mpsoc::FlashId::FLASH_0 && commandData[1] != mpsoc::FlashId::FLASH_1) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
mpsoc::TcFlashMkfs cmd(spParams, commandSequenceCount,
|
||||
static_cast<mpsoc::FlashId>(commandData[0]));
|
||||
result = finishAndSendTc(actionId, cmd, mpsoc::CMD_TIMEOUT_MKFS);
|
||||
break;
|
||||
}
|
||||
case (mpsoc::TC_GET_HK_REPORT): {
|
||||
result = commandTcGetHkReport();
|
||||
break;
|
||||
@ -720,7 +741,8 @@ ReturnValue_t FreshMpsocHandler::commandTcModeSnapshot() {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t FreshMpsocHandler::finishAndSendTc(DeviceCommandId_t cmdId, mpsoc::TcBase& tcBase) {
|
||||
ReturnValue_t FreshMpsocHandler::finishAndSendTc(DeviceCommandId_t cmdId, mpsoc::TcBase& tcBase,
|
||||
uint32_t cmdCountdownMs) {
|
||||
ReturnValue_t result = tcBase.finishPacket();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
@ -733,6 +755,7 @@ ReturnValue_t FreshMpsocHandler::finishAndSendTc(DeviceCommandId_t cmdId, mpsoc:
|
||||
<< " Size " << std::dec << tcBase.getFullPacketLen() << " SSC "
|
||||
<< tcBase.getSeqCount() << std::endl;
|
||||
}
|
||||
activeCmdInfo.cmdCountdown.setTimeout(cmdCountdownMs);
|
||||
activeCmdInfo.cmdCountdown.resetTimer();
|
||||
activeCmdInfo.pending = true;
|
||||
activeCmdInfo.pendingCmd = cmdId;
|
||||
|
@ -97,7 +97,7 @@ class FreshMpsocHandler : public FreshDeviceHandlerBase, public CommandsActionsI
|
||||
bool specialComHelperExecuting = false;
|
||||
|
||||
struct ActionCommandInfo {
|
||||
Countdown cmdCountdown = Countdown(5000);
|
||||
Countdown cmdCountdown = Countdown(mpsoc::DEFAULT_CMD_TIMEOUT_MS);
|
||||
bool pending = false;
|
||||
MessageQueueId_t commandedBy = MessageQueueIF::NO_QUEUE;
|
||||
DeviceCommandId_t pendingCmd = DeviceHandlerIF::NO_COMMAND_ID;
|
||||
@ -188,7 +188,8 @@ class FreshMpsocHandler : public FreshDeviceHandlerBase, public CommandsActionsI
|
||||
ReturnValue_t commandTcDownlinkDataModulate(const uint8_t* commandData, size_t commandDataLen);
|
||||
ReturnValue_t commandTcModeSnapshot();
|
||||
|
||||
ReturnValue_t finishAndSendTc(DeviceCommandId_t cmdId, mpsoc::TcBase& tcBase);
|
||||
ReturnValue_t finishAndSendTc(DeviceCommandId_t cmdId, mpsoc::TcBase& tcBase,
|
||||
uint32_t cmdCountdown = mpsoc::DEFAULT_CMD_TIMEOUT_MS);
|
||||
void handleEvent(EventMessage* eventMessage);
|
||||
void cmdDoneHandler(bool success, ReturnValue_t result);
|
||||
ReturnValue_t handleDeviceReply();
|
||||
|
@ -8,12 +8,18 @@
|
||||
#include "eive/definitions.h"
|
||||
#include "eive/eventSubsystemIds.h"
|
||||
#include "eive/resultClassIds.h"
|
||||
#include "fsfw/action/HasActionsIF.h"
|
||||
#include "fsfw/returnvalues/returnvalue.h"
|
||||
#include "fsfw/serialize/SerializeAdapter.h"
|
||||
#include "fsfw/serialize/SerializeIF.h"
|
||||
|
||||
namespace mpsoc {
|
||||
|
||||
static constexpr uint32_t DEFAULT_CMD_TIMEOUT_MS = 5000;
|
||||
static constexpr uint32_t CMD_TIMEOUT_MKFS = 15000;
|
||||
|
||||
enum FlashId : uint8_t { FLASH_0 = 0, FLASH_1 = 0 };
|
||||
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::MPSOC_RETURN_VALUES_IF;
|
||||
|
||||
//! [EXPORT] : [COMMENT] Space Packet received from PLOC has invalid CRC
|
||||
@ -157,6 +163,8 @@ static constexpr DeviceCommandId_t TC_FLASH_READ_FULL_FILE = 30;
|
||||
// Store file on MPSoC.
|
||||
static const DeviceCommandId_t TC_SIMPLEX_STORE_FILE = 31;
|
||||
static const DeviceCommandId_t TC_VERIFY_BOOT = 32;
|
||||
static const DeviceCommandId_t TC_ENABLE_TC_EXECTION = 33;
|
||||
static const DeviceCommandId_t TC_FLASH_MKFS = 34;
|
||||
|
||||
// Will reset the sequence count of the OBSW. Not required anymore after MPSoC update.
|
||||
static const DeviceCommandId_t OBSW_RESET_SEQ_COUNT_LEGACY = 50;
|
||||
@ -203,6 +211,8 @@ static const uint16_t TC_MODE_SNAPSHOT = 0x120;
|
||||
static const uint16_t TC_DOWNLINK_DATA_MODULATE = 0x121;
|
||||
static constexpr uint16_t TC_HK_GET_REPORT = 0x123;
|
||||
static const uint16_t TC_DOWNLINK_PWR_OFF = 0x124;
|
||||
static constexpr uint16_t TC_ENABLE_TC_EXECUTION = 0x129;
|
||||
static constexpr uint16_t TC_FLASH_MKFS = 0x12A;
|
||||
static const uint16_t TC_CAM_CMD_SEND = 0x12C;
|
||||
static constexpr uint16_t TC_FLASH_COPY_FILE = 0x12E;
|
||||
static const uint16_t TC_SIMPLEX_SEND_FILE = 0x130;
|
||||
@ -474,6 +484,32 @@ class FlashFclose : public TcBase {
|
||||
}
|
||||
};
|
||||
|
||||
class TcEnableTcExec : public TcBase {
|
||||
public:
|
||||
TcEnableTcExec(ploc::SpTcParams params, uint16_t sequenceCount)
|
||||
: TcBase(params, apid::TC_ENABLE_TC_EXECUTION, sequenceCount) {
|
||||
spParams.setFullPayloadLen(CRC_SIZE);
|
||||
}
|
||||
|
||||
ReturnValue_t setPayload(const uint8_t* cmdData, size_t cmdDataLen) {
|
||||
if (cmdDataLen != 2) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
std::memcpy(payloadStart, cmdData, 2);
|
||||
spParams.setFullPayloadLen(2 + CRC_SIZE);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
};
|
||||
|
||||
class TcFlashMkfs : public TcBase {
|
||||
public:
|
||||
TcFlashMkfs(ploc::SpTcParams params, uint16_t sequenceCount, FlashId flashId)
|
||||
: TcBase(params, apid::TC_FLASH_MKFS, sequenceCount) {
|
||||
spParams.setFullPayloadLen(1 + CRC_SIZE);
|
||||
payloadStart[0] = flashId;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Class to build flash write space packet.
|
||||
*/
|
||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
||||
Subproject commit 69fda96d7acd78d54a3f653113c8a417febd93c2
|
||||
Subproject commit dfa45dbdba16d2190616eca6ba1dc13e94692b63
|
Loading…
x
Reference in New Issue
Block a user