MPSoC Status Codes #262

Merged
muellerr merged 4 commits from meier/ploc into develop 2022-05-26 12:14:19 +02:00
5 changed files with 120 additions and 11 deletions
Showing only changes of commit e9ccb2fd4f - Show all commits

2
fsfw

@ -1 +1 @@
Subproject commit f35b0ffbbd6e0e9cc1a760d0aeb69931907f1d62 Subproject commit c8355251967009559ea790b63c3ebfc67a27efef

View File

@ -100,6 +100,33 @@ static const uint16_t TC_WRITE_SEQ_EXECUTION_DELAY = 80;
// Requires approx. 2 seconds for execution. 8 => 4 seconds // Requires approx. 2 seconds for execution. 8 => 4 seconds
static const uint16_t TC_DOWNLINK_PWR_ON_EXECUTION_DELAY = 8; static const uint16_t TC_DOWNLINK_PWR_ON_EXECUTION_DELAY = 8;
namespace status_code {
static const uint16_t UNKNOWN_APID = 0x5DD;
static const uint16_t INCORRECT_LENGTH = 0x5DE;
static const uint16_t INCORRECT_CRC = 0x5DF;
static const uint16_t INCORRECT_PKT_SEQ_CNT = 0x5E0;
static const uint16_t TC_NOT_ALLOWED_IN_MODE = 0x5E1;
static const uint16_t TC_EXEUTION_DISABLED = 0x5E2;
static const uint16_t FLASH_MOUNT_FAILED = 0x5E3;
static const uint16_t FLASH_FILE_ALREADY_CLOSED = 0x5E4;
static const uint16_t FLASH_FILE_OPEN_FAILED = 0x5E5;
static const uint16_t FLASH_FILE_ALREDY_OPEN = 0x5E6;
static const uint16_t FLASH_FILE_NOT_OPEN = 0x5E7;
static const uint16_t FLASH_UNMOUNT_FAILED = 0x5E8;
static const uint16_t HEAP_ALLOCATION_FAILED = 0x5E9;
static const uint16_t INVALID_PARAMETER = 0x5EA;
static const uint16_t NOT_INITIALIZED = 0x5EB;
static const uint16_t REBOOT_IMMINENT = 0x5EC;
static const uint16_t CORRUPT_DATA = 0x5ED;
static const uint16_t FLASH_CORRECTABLE_MISMATCH = 0x5EE;
static const uint16_t FLASH_UNCORRECTABLE_MISMATCH = 0x5EF;
static const uint16_t RESERVED_0 = 0x5F0;
static const uint16_t RESERVED_1 = 0x5F1;
static const uint16_t RESERVED_2 = 0x5F2;
static const uint16_t RESERVED_3 = 0x5F3;
static const uint16_t RESERVED_4 = 0x5F4;
}
/** /**
* @brief Abstract base class for TC space packet of MPSoC. * @brief Abstract base class for TC space packet of MPSoC.
*/ */
@ -656,9 +683,13 @@ class TcCamcmdSend : public TcBase {
if (commandDataLen > MAX_DATA_LENGTH) { if (commandDataLen > MAX_DATA_LENGTH) {
return INVALID_LENGTH; return INVALID_LENGTH;
} }
std::memcpy(this->getPacketData(), commandData, commandDataLen); uint16_t dataLen = static_cast<uint16_t>(commandDataLen + sizeof(CARRIAGE_RETURN));
*(this->getPacketData() + commandDataLen) = CARRIAGE_RETURN; size_t size = sizeof(dataLen);
uint16_t trueLength = commandDataLen + sizeof(CARRIAGE_RETURN) + CRC_SIZE; SerializeAdapter::serialize(&dataLen, this->getPacketData(), &size, sizeof(dataLen),
SerializeIF::Endianness::BIG);
std::memcpy(this->getPacketData() + sizeof(dataLen), commandData, commandDataLen);
*(this->getPacketData() + sizeof(dataLen) + commandDataLen) = CARRIAGE_RETURN;
uint16_t trueLength = sizeof(dataLen) + commandDataLen + sizeof(CARRIAGE_RETURN) + CRC_SIZE;
this->setPacketDataLength(trueLength - 1); this->setPacketDataLength(trueLength - 1);
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }

View File

@ -589,14 +589,14 @@ ReturnValue_t PlocMPSoCHandler::handleAckReport(const uint8_t* data) {
switch (apid) { switch (apid) {
case mpsoc::apid::ACK_FAILURE: { case mpsoc::apid::ACK_FAILURE: {
// TODO: Interpretation of status field in acknowledgment report
sif::debug << "PlocMPSoCHandler::handleAckReport: Received Ack failure report" << std::endl; sif::debug << "PlocMPSoCHandler::handleAckReport: Received Ack failure report" << std::endl;
DeviceCommandId_t commandId = getPendingCommand(); DeviceCommandId_t commandId = getPendingCommand();
uint16_t status = getStatus(data); uint16_t status = getStatus(data);
printStatus(data);
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) { if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
triggerEvent(ACK_FAILURE, commandId, status); triggerEvent(ACK_FAILURE, commandId, status);
} }
sendFailureReport(mpsoc::ACK_REPORT, MPSoCReturnValuesIF::RECEIVED_ACK_FAILURE); sendFailureReport(mpsoc::ACK_REPORT, status);
disableAllReplies(); disableAllReplies();
nextReplyId = mpsoc::NONE; nextReplyId = mpsoc::NONE;
result = IGNORE_REPLY_DATA; result = IGNORE_REPLY_DATA;
@ -683,17 +683,17 @@ ReturnValue_t PlocMPSoCHandler::handleCamCmdRpt(const uint8_t* data) {
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;
} }
const uint8_t* dataFieldPtr = data + mpsoc::SPACE_PACKET_HEADER_SIZE; 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),
tmCamCmdRpt.rememberSpacePacketSize - mpsoc::SPACE_PACKET_HEADER_SIZE - 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 = *(packet.getPacketData() + packet.getPacketDataLength() - 2); uint8_t ackValue = *(packet.getPacketData() + packet.getPacketDataLength() - 2);
sif::info << "PlocMPSoCHandler: CamCmdRpt message: " << camCmdRptMsg << std::endl; sif::info << "PlocMPSoCHandler: CamCmdRpt message: " << camCmdRptMsg << std::endl;
sif::info << "PlocMPSoCHandler: CamCmdRpt Ack value: 0x" << std::hex sif::info << "PlocMPSoCHandler: CamCmdRpt Ack value: 0x" << std::hex
<< static_cast<unsigned int>(ackValue) << std::endl; << static_cast<unsigned int>(ackValue) << std::endl;
#endif /* OBSW_DEBUG_PLOC_MPSOC == 1 */ #endif /* OBSW_DEBUG_PLOC_MPSOC == 1 */
handleDeviceTM(packet.getPacketData(), packet.getPacketDataLength() - 1, mpsoc::TM_CAM_CMD_RPT); handleDeviceTM(packet.getPacketData() + sizeof(uint16_t), packet.getPacketDataLength() - 1, mpsoc::TM_CAM_CMD_RPT);
return result; return result;
} }
@ -994,7 +994,7 @@ void PlocMPSoCHandler::disableExeReportReply() {
void PlocMPSoCHandler::printStatus(const uint8_t* data) { void PlocMPSoCHandler::printStatus(const uint8_t* data) {
uint16_t status = *(data + STATUS_OFFSET) << 8 | *(data + STATUS_OFFSET + 1); uint16_t status = *(data + STATUS_OFFSET) << 8 | *(data + STATUS_OFFSET + 1);
sif::info << "Verification report status: 0x" << std::hex << status << std::endl; sif::info << "Verification report status: " << getStatusString(status) << std::endl;
} }
uint16_t PlocMPSoCHandler::getStatus(const uint8_t* data) { uint16_t PlocMPSoCHandler::getStatus(const uint8_t* data) {
@ -1033,3 +1033,79 @@ void PlocMPSoCHandler::handleActionCommandFailure(ActionId_t actionId) {
} }
return; return;
} }
std::string PlocMPSoCHandler::getStatusString(uint16_t status) {
switch(status) {
case(mpsoc::status_code::UNKNOWN_APID): {
return "Unknown APID";
break;
}
case(mpsoc::status_code::INCORRECT_LENGTH): {
return "Incorrect length";
break;
}
case(mpsoc::status_code::INCORRECT_CRC): {
return "Incorrect crc";
break;
}
case(mpsoc::status_code::INCORRECT_PKT_SEQ_CNT): {
return "Incorrect packet sequence count";
break;
}
case(mpsoc::status_code::TC_NOT_ALLOWED_IN_MODE): {
return "TC not allowed in this mode";
break;
}
case(mpsoc::status_code::TC_EXEUTION_DISABLED): {
return "TC execution disabled";
break;
}
case(mpsoc::status_code::FLASH_MOUNT_FAILED): {
return "Flash mount failed";
break;
}
case(mpsoc::status_code::FLASH_FILE_ALREADY_CLOSED): {
return "Flash file already closed";
break;
}
case(mpsoc::status_code::FLASH_FILE_NOT_OPEN): {
return "Flash file not open";
break;
}
case(mpsoc::status_code::FLASH_UNMOUNT_FAILED): {
return "Flash unmount failed";
break;
}
case(mpsoc::status_code::HEAP_ALLOCATION_FAILED): {
return "Heap allocation failed";
break;
}
case(mpsoc::status_code::INVALID_PARAMETER): {
return "Invalid parameter";
break;
}
case(mpsoc::status_code::NOT_INITIALIZED): {
return "Not initialized";
break;
}
case(mpsoc::status_code::REBOOT_IMMINENT): {
return "Reboot imminent";
break;
}
case(mpsoc::status_code::CORRUPT_DATA): {
return "Corrupt data";
break;
}
case(mpsoc::status_code::FLASH_CORRECTABLE_MISMATCH): {
return "Flash correctable mismatch";
break;
}
case(mpsoc::status_code::FLASH_UNCORRECTABLE_MISMATCH): {
return "Flash uncorrectable mismatch";
break;
}
default:
break;
}
return "";
}

View File

@ -263,6 +263,8 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
uint16_t getStatus(const uint8_t* data); uint16_t getStatus(const uint8_t* data);
void handleActionCommandFailure(ActionId_t actionId); void handleActionCommandFailure(ActionId_t actionId);
std::string getStatusString(uint16_t status);
}; };
#endif /* BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_ */ #endif /* BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_ */

2
tmtc

@ -1 +1 @@
Subproject commit 15e0861c4def44d4a2facbfd8347b1933d671f21 Subproject commit b54ffcedff7a2a7f9e5e9a4c604e914905863ded