PLOC MPSoC dir content report #634
@ -253,6 +253,10 @@ ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(DeviceCommandId_t device
|
||||
result = prepareTcGetHkReport();
|
||||
break;
|
||||
}
|
||||
case (mpsoc::TC_FLASH_GET_DIRECTORY_CONTENT): {
|
||||
result = prepareTcGetDirContent(commandData, commandDataLen);
|
||||
break;
|
||||
}
|
||||
case (mpsoc::TC_MODE_REPLAY): {
|
||||
result = prepareTcModeReplay();
|
||||
break;
|
||||
@ -314,14 +318,16 @@ void PlocMPSoCHandler::fillCommandAndReplyMap() {
|
||||
this->insertInCommandMap(mpsoc::RELEASE_UART_TX);
|
||||
this->insertInCommandMap(mpsoc::SET_UART_TX_TRISTATE);
|
||||
this->insertInCommandMap(mpsoc::TC_CAM_TAKE_PIC);
|
||||
this->insertInCommandMap(mpsoc::TC_FLASH_GET_DIRECTORY_CONTENT);
|
||||
this->insertInCommandMap(mpsoc::TC_SIMPLEX_SEND_FILE);
|
||||
this->insertInCommandMap(mpsoc::TC_DOWNLINK_DATA_MODULATE);
|
||||
this->insertInCommandMap(mpsoc::TC_MODE_SNAPSHOT);
|
||||
this->insertInReplyMap(mpsoc::ACK_REPORT, 3, nullptr, mpsoc::SIZE_ACK_REPORT);
|
||||
this->insertInReplyMap(mpsoc::EXE_REPORT, 3, nullptr, mpsoc::SIZE_EXE_REPORT);
|
||||
this->insertInReplyMap(mpsoc::TM_MEMORY_READ_REPORT, 2, nullptr, mpsoc::SIZE_TM_MEM_READ_REPORT);
|
||||
this->insertInReplyMap(mpsoc::TM_GET_HK_REPORT, 2, nullptr, 0);
|
||||
this->insertInReplyMap(mpsoc::TM_GET_HK_REPORT, 2, nullptr, mpsoc::SIZE_TM_HK_REPORT);
|
||||
this->insertInReplyMap(mpsoc::TM_CAM_CMD_RPT, 2, nullptr, mpsoc::SP_MAX_SIZE);
|
||||
this->insertInReplyMap(mpsoc::TM_FLASH_DIRECTORY_CONTENT, 2, nullptr, 0);
|
||||
}
|
||||
|
||||
ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
||||
@ -339,6 +345,11 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
|
||||
}
|
||||
uint16_t apid = spacePacket.getApid();
|
||||
|
||||
auto handleDedicatedReply = [&](DeviceCommandId_t replyId) {
|
||||
*foundLen = spacePacket.getFullPacketLen();
|
||||
foundPacketLen = *foundLen;
|
||||
*foundId = replyId;
|
||||
};
|
||||
switch (apid) {
|
||||
case (mpsoc::apid::ACK_SUCCESS):
|
||||
*foundLen = mpsoc::SIZE_ACK_REPORT;
|
||||
@ -353,14 +364,14 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
|
||||
*foundId = mpsoc::TM_MEMORY_READ_REPORT;
|
||||
break;
|
||||
case (mpsoc::apid::TM_CAM_CMD_RPT):
|
||||
*foundLen = spacePacket.getFullPacketLen();
|
||||
foundPacketLen = *foundLen;
|
||||
*foundId = mpsoc::TM_CAM_CMD_RPT;
|
||||
handleDedicatedReply(mpsoc::TM_CAM_CMD_RPT);
|
||||
break;
|
||||
case (mpsoc::apid::TM_HK_GET_REPORT): {
|
||||
*foundLen = spacePacket.getFullPacketLen();
|
||||
foundPacketLen = *foundLen;
|
||||
*foundId = mpsoc::TM_GET_HK_REPORT;
|
||||
handleDedicatedReply(mpsoc::TM_GET_HK_REPORT);
|
||||
break;
|
||||
}
|
||||
case (mpsoc::apid::TM_FLASH_DIRECTORY_CONTENT): {
|
||||
handleDedicatedReply(mpsoc::TM_FLASH_DIRECTORY_CONTENT);
|
||||
break;
|
||||
}
|
||||
case (mpsoc::apid::EXE_SUCCESS):
|
||||
@ -408,6 +419,18 @@ ReturnValue_t PlocMPSoCHandler::interpretDeviceReply(DeviceCommandId_t id, const
|
||||
result = handleCamCmdRpt(packet);
|
||||
break;
|
||||
}
|
||||
case (mpsoc::TM_FLASH_DIRECTORY_CONTENT): {
|
||||
result = verifyPacket(packet, foundPacketLen);
|
||||
if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
|
||||
sif::warning << "PLOC MPSoC: Flash directory content reply invalid CRC" << std::endl;
|
||||
}
|
||||
/** Send data to commanding queue */
|
||||
handleDeviceTm(packet + mpsoc::DATA_FIELD_OFFSET,
|
||||
foundPacketLen - mpsoc::DATA_FIELD_OFFSET - mpsoc::CRC_SIZE,
|
||||
mpsoc::TM_FLASH_DIRECTORY_CONTENT);
|
||||
nextReplyId = mpsoc::EXE_REPORT;
|
||||
return result;
|
||||
}
|
||||
case (mpsoc::EXE_REPORT): {
|
||||
result = handleExecutionReport(packet);
|
||||
break;
|
||||
@ -421,7 +444,10 @@ ReturnValue_t PlocMPSoCHandler::interpretDeviceReply(DeviceCommandId_t id, const
|
||||
return result;
|
||||
}
|
||||
|
||||
void PlocMPSoCHandler::setNormalDatapoolEntriesInvalid() {}
|
||||
void PlocMPSoCHandler::setNormalDatapoolEntriesInvalid() {
|
||||
PoolReadGuard pg(&hkReport);
|
||||
hkReport.setValidity(false, true);
|
||||
}
|
||||
|
||||
uint32_t PlocMPSoCHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 5000; }
|
||||
|
||||
@ -624,9 +650,8 @@ ReturnValue_t PlocMPSoCHandler::prepareTcCamCmdSend(const uint8_t* commandData,
|
||||
|
||||
ReturnValue_t PlocMPSoCHandler::prepareTcCamTakePic(const uint8_t* commandData,
|
||||
size_t commandDataLen) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
mpsoc::TcCamTakePic tcCamTakePic(spParams, sequenceCount);
|
||||
result = tcCamTakePic.buildPacket(commandData, commandDataLen);
|
||||
ReturnValue_t result = tcCamTakePic.buildPacket(commandData, commandDataLen);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
@ -636,9 +661,8 @@ ReturnValue_t PlocMPSoCHandler::prepareTcCamTakePic(const uint8_t* commandData,
|
||||
|
||||
ReturnValue_t PlocMPSoCHandler::prepareTcSimplexSendFile(const uint8_t* commandData,
|
||||
size_t commandDataLen) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
mpsoc::TcSimplexSendFile tcSimplexSendFile(spParams, sequenceCount);
|
||||
result = tcSimplexSendFile.buildPacket(commandData, commandDataLen);
|
||||
ReturnValue_t result = tcSimplexSendFile.buildPacket(commandData, commandDataLen);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
@ -646,11 +670,21 @@ ReturnValue_t PlocMPSoCHandler::prepareTcSimplexSendFile(const uint8_t* commandD
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocMPSoCHandler::prepareTcGetDirContent(const uint8_t* commandData,
|
||||
size_t commandDataLen) {
|
||||
mpsoc::TcGetDirContent tcGetDirContent(spParams, sequenceCount);
|
||||
ReturnValue_t result = tcGetDirContent.buildPacket(commandData, commandDataLen);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
finishTcPrep(tcGetDirContent.getFullPacketLen());
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkDataModulate(const uint8_t* commandData,
|
||||
size_t commandDataLen) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
mpsoc::TcDownlinkDataModulate tcDownlinkDataModulate(spParams, sequenceCount);
|
||||
result = tcDownlinkDataModulate.buildPacket(commandData, commandDataLen);
|
||||
ReturnValue_t result = tcDownlinkDataModulate.buildPacket(commandData, commandDataLen);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
@ -659,9 +693,8 @@ ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkDataModulate(const uint8_t* com
|
||||
}
|
||||
|
||||
ReturnValue_t PlocMPSoCHandler::prepareTcModeSnapshot() {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
mpsoc::TcModeSnapshot tcModeSnapshot(spParams, sequenceCount);
|
||||
result = tcModeSnapshot.buildPacket();
|
||||
ReturnValue_t result = tcModeSnapshot.buildPacket();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
@ -781,7 +814,7 @@ ReturnValue_t PlocMPSoCHandler::handleMemoryReadReport(const uint8_t* data) {
|
||||
uint16_t memLen =
|
||||
*(data + mpsoc::MEM_READ_RPT_LEN_OFFSET) << 8 | *(data + mpsoc::MEM_READ_RPT_LEN_OFFSET + 1);
|
||||
/** Send data to commanding queue */
|
||||
handleDeviceTM(data + mpsoc::DATA_FIELD_OFFSET, mpsoc::SIZE_MEM_READ_RPT_FIX + memLen * 4,
|
||||
handleDeviceTm(data + mpsoc::DATA_FIELD_OFFSET, mpsoc::SIZE_MEM_READ_RPT_FIX + memLen * 4,
|
||||
mpsoc::TM_MEMORY_READ_REPORT);
|
||||
nextReplyId = mpsoc::EXE_REPORT;
|
||||
return result;
|
||||
@ -980,7 +1013,7 @@ ReturnValue_t PlocMPSoCHandler::handleCamCmdRpt(const uint8_t* data) {
|
||||
sif::info << "PlocMPSoCHandler: CamCmdRpt Ack value: 0x" << std::hex
|
||||
<< static_cast<unsigned int>(ackValue) << std::endl;
|
||||
#endif /* OBSW_DEBUG_PLOC_MPSOC == 1 */
|
||||
handleDeviceTM(packetReader.getPacketData() + sizeof(uint16_t),
|
||||
handleDeviceTm(packetReader.getPacketData() + sizeof(uint16_t),
|
||||
packetReader.getPacketDataLen() - 1, mpsoc::TM_CAM_CMD_RPT);
|
||||
return result;
|
||||
}
|
||||
@ -1039,6 +1072,13 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator
|
||||
}
|
||||
break;
|
||||
}
|
||||
case mpsoc::TC_FLASH_GET_DIRECTORY_CONTENT: {
|
||||
result = enableThreeReplies(mpsoc::TM_FLASH_DIRECTORY_CONTENT);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case mpsoc::OBSW_RESET_SEQ_COUNT:
|
||||
break;
|
||||
default:
|
||||
@ -1105,6 +1145,7 @@ void PlocMPSoCHandler::setNextReplyId() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
size_t PlocMPSoCHandler::getNextReplyLength(DeviceCommandId_t commandId) {
|
||||
size_t replyLen = 0;
|
||||
|
||||
@ -1206,7 +1247,7 @@ void PlocMPSoCHandler::completionFailedReceived(ActionId_t actionId, ReturnValue
|
||||
handleActionCommandFailure(actionId);
|
||||
}
|
||||
|
||||
void PlocMPSoCHandler::handleDeviceTM(const uint8_t* data, size_t dataSize,
|
||||
void PlocMPSoCHandler::handleDeviceTm(const uint8_t* data, size_t dataSize,
|
||||
DeviceCommandId_t replyId) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
|
||||
@ -1275,6 +1316,10 @@ void PlocMPSoCHandler::disableAllReplies() {
|
||||
disableCommandWithReply(TM_GET_HK_REPORT);
|
||||
break;
|
||||
}
|
||||
case TC_FLASH_GET_DIRECTORY_CONTENT: {
|
||||
disableCommandWithReply(TM_FLASH_DIRECTORY_CONTENT);
|
||||
break;
|
||||
}
|
||||
case TC_CAM_CMD_SEND: {
|
||||
disableCommandWithReply(TM_CAM_CMD_RPT);
|
||||
break;
|
||||
|
@ -201,6 +201,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
|
||||
ReturnValue_t prepareTcDownlinkPwrOn(const uint8_t* commandData, size_t commandDataLen);
|
||||
ReturnValue_t prepareTcDownlinkPwrOff();
|
||||
ReturnValue_t prepareTcGetHkReport();
|
||||
ReturnValue_t prepareTcGetDirContent(const uint8_t* commandData, size_t commandDataLen);
|
||||
ReturnValue_t prepareTcReplayWriteSequence(const uint8_t* commandData, size_t commandDataLen);
|
||||
ReturnValue_t prepareTcCamCmdSend(const uint8_t* commandData, size_t commandDataLen);
|
||||
ReturnValue_t prepareTcModeIdle();
|
||||
@ -266,7 +267,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
|
||||
* @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);
|
||||
void handleDeviceTm(const uint8_t* data, size_t dataSize, DeviceCommandId_t replyId);
|
||||
|
||||
/**
|
||||
* @brief In case an acknowledgment failure reply has been received this function disables
|
||||
|
@ -623,6 +623,23 @@ class TcGetHkReport : public TcBase {
|
||||
: TcBase(params, apid::TC_HK_GET_REPORT, sequenceCount) {}
|
||||
};
|
||||
|
||||
class TcGetDirContent : public TcBase {
|
||||
public:
|
||||
TcGetDirContent(ploc::SpTcParams params, uint16_t sequenceCount)
|
||||
: TcBase(params, apid::TC_FLASH_GET_DIRECTORY_CONTENT, sequenceCount) {}
|
||||
|
||||
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
spParams.setFullPayloadLen(commandDataLen + sizeof(NULL_TERMINATOR) + CRC_SIZE);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
std::memcpy(payloadStart, commandData, commandDataLen);
|
||||
*(payloadStart + commandDataLen) = NULL_TERMINATOR;
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Class to build replay stop space packet.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user