PLOC MPSoC dir content report #634

Merged
meggert merged 54 commits from ploc_mpsoc_dir_content_report_2 into v2.1.0-dev 2023-05-15 09:40:03 +02:00
3 changed files with 58 additions and 12 deletions
Showing only changes of commit f225d9a7c1 - Show all commits

View File

@ -247,6 +247,10 @@ ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(DeviceCommandId_t device
result = prepareTcReplayWriteSequence(commandData, commandDataLen); result = prepareTcReplayWriteSequence(commandData, commandDataLen);
break; break;
} }
case (mpsoc::TC_GET_HK_REPORT): {
result = prepareTcGetHkReport();
break;
}
case (mpsoc::TC_MODE_REPLAY): { case (mpsoc::TC_MODE_REPLAY): {
result = prepareTcModeReplay(); result = prepareTcModeReplay();
break; break;
@ -304,6 +308,7 @@ void PlocMPSoCHandler::fillCommandAndReplyMap() {
this->insertInCommandMap(mpsoc::TC_MODE_REPLAY); this->insertInCommandMap(mpsoc::TC_MODE_REPLAY);
this->insertInCommandMap(mpsoc::TC_MODE_IDLE); this->insertInCommandMap(mpsoc::TC_MODE_IDLE);
this->insertInCommandMap(mpsoc::TC_CAM_CMD_SEND); this->insertInCommandMap(mpsoc::TC_CAM_CMD_SEND);
this->insertInCommandMap(mpsoc::TC_GET_HK_REPORT);
this->insertInCommandMap(mpsoc::RELEASE_UART_TX); this->insertInCommandMap(mpsoc::RELEASE_UART_TX);
this->insertInCommandMap(mpsoc::SET_UART_TX_TRISTATE); this->insertInCommandMap(mpsoc::SET_UART_TX_TRISTATE);
this->insertInCommandMap(mpsoc::TC_CAM_TAKE_PIC); this->insertInCommandMap(mpsoc::TC_CAM_TAKE_PIC);
@ -313,6 +318,7 @@ void PlocMPSoCHandler::fillCommandAndReplyMap() {
this->insertInReplyMap(mpsoc::ACK_REPORT, 3, nullptr, mpsoc::SIZE_ACK_REPORT); 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::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_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_CAM_CMD_RPT, 2, nullptr, mpsoc::SP_MAX_SIZE); this->insertInReplyMap(mpsoc::TM_CAM_CMD_RPT, 2, nullptr, mpsoc::SP_MAX_SIZE);
} }
@ -346,9 +352,15 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
break; break;
case (mpsoc::apid::TM_CAM_CMD_RPT): case (mpsoc::apid::TM_CAM_CMD_RPT):
*foundLen = spacePacket.getFullPacketLen(); *foundLen = spacePacket.getFullPacketLen();
tmCamCmdRpt.rememberSpacePacketSize = *foundLen; foundPacketLen = *foundLen;
*foundId = mpsoc::TM_CAM_CMD_RPT; *foundId = mpsoc::TM_CAM_CMD_RPT;
break; break;
case (mpsoc::apid::TM_HK_GET_REPORT): {
*foundLen = spacePacket.getFullPacketLen();
foundPacketLen = *foundLen;
*foundId = mpsoc::TM_GET_HK_REPORT;
break;
}
case (mpsoc::apid::EXE_SUCCESS): case (mpsoc::apid::EXE_SUCCESS):
*foundLen = mpsoc::SIZE_EXE_REPORT; *foundLen = mpsoc::SIZE_EXE_REPORT;
*foundId = mpsoc::EXE_REPORT; *foundId = mpsoc::EXE_REPORT;
@ -386,6 +398,10 @@ ReturnValue_t PlocMPSoCHandler::interpretDeviceReply(DeviceCommandId_t id, const
result = handleMemoryReadReport(packet); result = handleMemoryReadReport(packet);
break; break;
} }
case (mpsoc::TM_GET_HK_REPORT): {
result = handleGetHkReport(packet);
break;
}
case (mpsoc::TM_CAM_CMD_RPT): { case (mpsoc::TM_CAM_CMD_RPT): {
result = handleCamCmdRpt(packet); result = handleCamCmdRpt(packet);
break; break;
@ -512,6 +528,17 @@ ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOff() {
return returnvalue::OK; return returnvalue::OK;
} }
ReturnValue_t PlocMPSoCHandler::prepareTcGetHkReport() {
ReturnValue_t result = returnvalue::OK;
mpsoc::TcGetHkReport tcDownlinkPwrOff(spParams, sequenceCount);
result = tcDownlinkPwrOff.buildPacket();
if (result != returnvalue::OK) {
return result;
}
finishTcPrep(tcDownlinkPwrOff.getFullPacketLen());
return returnvalue::OK;
}
ReturnValue_t PlocMPSoCHandler::prepareTcReplayWriteSequence(const uint8_t* commandData, ReturnValue_t PlocMPSoCHandler::prepareTcReplayWriteSequence(const uint8_t* commandData,
size_t commandDataLen) { size_t commandDataLen) {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
@ -724,17 +751,25 @@ ReturnValue_t PlocMPSoCHandler::handleMemoryReadReport(const uint8_t* data) {
return result; return result;
} }
ReturnValue_t PlocMPSoCHandler::handleGetHkReport(const uint8_t* data) {
ReturnValue_t result = verifyPacket(data, foundPacketLen);
if (result != returnvalue::OK) {
return result;
}
SpacePacketReader packetReader(data, foundPacketLen);
return returnvalue::OK;
}
ReturnValue_t PlocMPSoCHandler::handleCamCmdRpt(const uint8_t* data) { ReturnValue_t PlocMPSoCHandler::handleCamCmdRpt(const uint8_t* data) {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
result = verifyPacket(data, tmCamCmdRpt.rememberSpacePacketSize); ReturnValue_t result = verifyPacket(data, foundPacketLen);
if (result == MPSoCReturnValuesIF::CRC_FAILURE) { if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
sif::warning << "PlocMPSoCHandler::handleCamCmdRpt: CRC failure" << std::endl; sif::warning << "PlocMPSoCHandler::handleCamCmdRpt: CRC failure" << std::endl;
} }
SpacePacketReader packetReader(data, tmCamCmdRpt.rememberSpacePacketSize); SpacePacketReader packetReader(data, foundPacketLen);
const uint8_t* dataFieldPtr = data + mpsoc::SPACE_PACKET_HEADER_SIZE + sizeof(uint16_t); const uint8_t* dataFieldPtr = data + mpsoc::SPACE_PACKET_HEADER_SIZE + sizeof(uint16_t);
std::string camCmdRptMsg( std::string camCmdRptMsg(reinterpret_cast<const char*>(dataFieldPtr),
reinterpret_cast<const char*>(dataFieldPtr), foundPacketLen - mpsoc::SPACE_PACKET_HEADER_SIZE - sizeof(uint16_t) - 3);
tmCamCmdRpt.rememberSpacePacketSize - mpsoc::SPACE_PACKET_HEADER_SIZE - sizeof(uint16_t) - 3);
#if OBSW_DEBUG_PLOC_MPSOC == 1 #if OBSW_DEBUG_PLOC_MPSOC == 1
uint8_t ackValue = *(packetReader.getFullData() + packetReader.getFullPacketLen() - 2); uint8_t ackValue = *(packetReader.getFullData() + packetReader.getFullPacketLen() - 2);
sif::info << "PlocMPSoCHandler: CamCmdRpt message: " << camCmdRptMsg << std::endl; sif::info << "PlocMPSoCHandler: CamCmdRpt message: " << camCmdRptMsg << std::endl;

View File

@ -138,17 +138,12 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
TmMemReadReport tmMemReadReport; TmMemReadReport tmMemReadReport;
struct TmCamCmdRpt {
size_t rememberSpacePacketSize = 0;
};
TmCamCmdRpt tmCamCmdRpt;
struct TelemetryBuffer { struct TelemetryBuffer {
uint16_t length = 0; uint16_t length = 0;
uint8_t buffer[mpsoc::SP_MAX_SIZE]; uint8_t buffer[mpsoc::SP_MAX_SIZE];
}; };
size_t foundPacketLen = 0;
TelemetryBuffer tmBuffer; TelemetryBuffer tmBuffer;
enum class PowerState { OFF, BOOTING, SHUTDOWN, ON }; enum class PowerState { OFF, BOOTING, SHUTDOWN, ON };
@ -167,6 +162,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
ReturnValue_t prepareTcReplayStop(); ReturnValue_t prepareTcReplayStop();
ReturnValue_t prepareTcDownlinkPwrOn(const uint8_t* commandData, size_t commandDataLen); ReturnValue_t prepareTcDownlinkPwrOn(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t prepareTcDownlinkPwrOff(); ReturnValue_t prepareTcDownlinkPwrOff();
ReturnValue_t prepareTcGetHkReport();
ReturnValue_t prepareTcReplayWriteSequence(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 prepareTcCamCmdSend(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t prepareTcModeIdle(); ReturnValue_t prepareTcModeIdle();
@ -213,6 +209,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
*/ */
ReturnValue_t handleMemoryReadReport(const uint8_t* data); ReturnValue_t handleMemoryReadReport(const uint8_t* data);
ReturnValue_t handleGetHkReport(const uint8_t* data);
ReturnValue_t handleCamCmdRpt(const uint8_t* data); ReturnValue_t handleCamCmdRpt(const uint8_t* data);
/** /**

View File

@ -37,6 +37,8 @@ static const DeviceCommandId_t TC_CAM_TAKE_PIC = 22;
static const DeviceCommandId_t TC_SIMPLEX_SEND_FILE = 23; static const DeviceCommandId_t TC_SIMPLEX_SEND_FILE = 23;
static const DeviceCommandId_t TC_DOWNLINK_DATA_MODULATE = 24; static const DeviceCommandId_t TC_DOWNLINK_DATA_MODULATE = 24;
static const DeviceCommandId_t TC_MODE_SNAPSHOT = 25; static const DeviceCommandId_t TC_MODE_SNAPSHOT = 25;
static const DeviceCommandId_t TC_GET_HK_REPORT = 26;
static const DeviceCommandId_t TM_GET_HK_REPORT = 27;
// Will reset the sequence count of the OBSW // Will reset the sequence count of the OBSW
static const DeviceCommandId_t OBSW_RESET_SEQ_COUNT = 50; static const DeviceCommandId_t OBSW_RESET_SEQ_COUNT = 50;
@ -45,6 +47,7 @@ static const uint16_t SIZE_ACK_REPORT = 14;
static const uint16_t SIZE_EXE_REPORT = 14; static const uint16_t SIZE_EXE_REPORT = 14;
static const uint16_t SIZE_TM_MEM_READ_REPORT = 18; static const uint16_t SIZE_TM_MEM_READ_REPORT = 18;
static const uint16_t SIZE_TM_CAM_CMD_RPT = 18; static const uint16_t SIZE_TM_CAM_CMD_RPT = 18;
static constexpr size_t SIZE_TM_HK_REPORT = 369;
/** /**
* SpacePacket apids of PLOC telecommands and telemetry. * SpacePacket apids of PLOC telecommands and telemetry.
@ -65,6 +68,8 @@ static const uint16_t TC_MODE_IDLE = 0x11E;
static const uint16_t TC_MODE_REPLAY = 0x11F; static const uint16_t TC_MODE_REPLAY = 0x11F;
static const uint16_t TC_MODE_SNAPSHOT = 0x120; static const uint16_t TC_MODE_SNAPSHOT = 0x120;
static const uint16_t TC_DOWNLINK_DATA_MODULATE = 0x121; static const uint16_t TC_DOWNLINK_DATA_MODULATE = 0x121;
static constexpr uint16_t TC_HK_GET_REPORT = 0x123;
static constexpr uint16_t TM_HK_GET_REPORT = 0x408;
static const uint16_t TC_DOWNLINK_PWR_OFF = 0x124; static const uint16_t TC_DOWNLINK_PWR_OFF = 0x124;
static const uint16_t TC_CAM_CMD_SEND = 0x12C; static const uint16_t TC_CAM_CMD_SEND = 0x12C;
static const uint16_t TC_SIMPLEX_SEND_FILE = 0x130; static const uint16_t TC_SIMPLEX_SEND_FILE = 0x130;
@ -561,6 +566,15 @@ class TcDownlinkPwrOn : public TcBase {
} }
}; };
/**
* @brief Class to build replay stop space packet.
*/
class TcGetHkReport : public TcBase {
public:
TcGetHkReport(ploc::SpTcParams params, uint16_t sequenceCount)
: TcBase(params, apid::TC_HK_GET_REPORT, sequenceCount) {}
};
/** /**
* @brief Class to build replay stop space packet. * @brief Class to build replay stop space packet.
*/ */