clean up error handlng code
This commit is contained in:
@ -136,6 +136,7 @@ ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueI
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
plocMPSoCHelper->setSequenceCount(&sequenceCount);
|
||||
result = plocMPSoCHelper->startFlashWrite(flashWritePusCmd.getObcFile(),
|
||||
flashWritePusCmd.getMPSoCFile());
|
||||
if (result != returnvalue::OK) {
|
||||
@ -150,6 +151,9 @@ ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueI
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
sif::debug << "starting flash read" << std::endl;
|
||||
sif::debug << "sequence count: " << sequenceCount.get() << std::endl;
|
||||
plocMPSoCHelper->setSequenceCount(&sequenceCount);
|
||||
result = plocMPSoCHelper->startFlashRead(flashReadPusCmd.getObcFile(),
|
||||
flashReadPusCmd.getMPSoCFile(),
|
||||
flashReadPusCmd.getReadSize());
|
||||
@ -158,7 +162,6 @@ ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueI
|
||||
}
|
||||
plocMPSoCHelperExecuting = true;
|
||||
return EXECUTION_FINISHED;
|
||||
break;
|
||||
}
|
||||
case (mpsoc::OBSW_RESET_SEQ_COUNT): {
|
||||
sequenceCount = 0;
|
||||
@ -790,7 +793,7 @@ ReturnValue_t PlocMPSoCHandler::handleAckReport(const uint8_t* data) {
|
||||
sif::debug << "PlocMPSoCHandler::handleAckReport: Received Ack failure report" << std::endl;
|
||||
DeviceCommandId_t commandId = getPendingCommand();
|
||||
uint16_t status = getStatus(data);
|
||||
printStatus(data);
|
||||
sif::warning << "Verification report status: " << mpsoc::getStatusString(status) << std::endl;
|
||||
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
|
||||
triggerEvent(ACK_FAILURE, commandId, status);
|
||||
}
|
||||
@ -836,13 +839,12 @@ ReturnValue_t PlocMPSoCHandler::handleExecutionReport(const uint8_t* data) {
|
||||
sif::warning << "PlocMPSoCHandler::handleExecutionReport: Received execution failure report"
|
||||
<< std::endl;
|
||||
DeviceCommandId_t commandId = getPendingCommand();
|
||||
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
|
||||
uint16_t status = getStatus(data);
|
||||
triggerEvent(EXE_FAILURE, commandId, status);
|
||||
} else {
|
||||
if (commandId == DeviceHandlerIF::NO_COMMAND_ID) {
|
||||
sif::debug << "PlocMPSoCHandler::handleExecutionReport: Unknown command id" << std::endl;
|
||||
}
|
||||
printStatus(data);
|
||||
uint16_t status = getStatus(data);
|
||||
sif::warning << "Verification report status: " << mpsoc::getStatusString(status) << std::endl;
|
||||
triggerEvent(EXE_FAILURE, commandId, status);
|
||||
sendFailureReport(mpsoc::EXE_REPORT, MPSoCReturnValuesIF::RECEIVED_EXE_FAILURE);
|
||||
result = IGNORE_REPLY_DATA;
|
||||
cmdDoneHandler(false, MPSoCReturnValuesIF::RECEIVED_EXE_FAILURE);
|
||||
@ -1428,11 +1430,6 @@ void PlocMPSoCHandler::disableExeReportReply() {
|
||||
info->command->second.expectedReplies = 0;
|
||||
}
|
||||
|
||||
void PlocMPSoCHandler::printStatus(const uint8_t* data) {
|
||||
uint16_t status = (*(data + STATUS_OFFSET) << 8) | *(data + STATUS_OFFSET + 1);
|
||||
sif::info << "Verification report status: " << getStatusString(status) << std::endl;
|
||||
}
|
||||
|
||||
uint16_t PlocMPSoCHandler::getStatus(const uint8_t* data) {
|
||||
return (*(data + STATUS_OFFSET) << 8) | *(data + STATUS_OFFSET + 1);
|
||||
}
|
||||
@ -1494,90 +1491,3 @@ void PlocMPSoCHandler::cmdDoneHandler(bool success, ReturnValue_t result) {
|
||||
}
|
||||
disableAllReplies();
|
||||
}
|
||||
|
||||
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_OPEN_FAILED): {
|
||||
return "Flash file open failed";
|
||||
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;
|
||||
}
|
||||
case (mpsoc::status_code::DEFAULT_ERROR_CODE): {
|
||||
return "Default error code";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
std::stringstream ss;
|
||||
ss << "0x" << std::hex << status;
|
||||
return ss.str();
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
Reference in New Issue
Block a user