get status function
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit

This commit is contained in:
Jakob Meier 2022-03-25 09:08:01 +01:00
parent 1e2df7bf91
commit 3df7a7f896
3 changed files with 37 additions and 21 deletions

View File

@ -26,6 +26,9 @@ static const DeviceCommandId_t TC_DOWNLINK_PWR_ON = 14;
static const DeviceCommandId_t TC_DOWNLINK_PWR_OFF = 15; static const DeviceCommandId_t TC_DOWNLINK_PWR_OFF = 15;
static const DeviceCommandId_t TC_MODE_REPLAY = 16; static const DeviceCommandId_t TC_MODE_REPLAY = 16;
// Will reset the sequence count of the OBSW
static const DeviceCommandId_t OBSW_RESET_SEQ_COUNT = 50;
static const uint16_t SIZE_ACK_REPORT = 14; 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;

View File

@ -92,10 +92,10 @@ ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueI
mpsoc::FlashWritePusCmd flashWritePusCmd; mpsoc::FlashWritePusCmd flashWritePusCmd;
result = flashWritePusCmd.extractFields(data, size); result = flashWritePusCmd.extractFields(data, size);
if (result != RETURN_OK) { if (result != RETURN_OK) {
return result; return result;
} }
result = plocMPSoCHelper->startFlashWrite(flashWritePusCmd.getObcFile(), result = plocMPSoCHelper->startFlashWrite(flashWritePusCmd.getObcFile(),
flashWritePusCmd.getMPSoCFile()); flashWritePusCmd.getMPSoCFile());
if (result != RETURN_OK) { if (result != RETURN_OK) {
return result; return result;
} }
@ -164,9 +164,13 @@ ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(DeviceCommandId_t device
break; break;
} }
case (mpsoc::TC_MODE_REPLAY): { case (mpsoc::TC_MODE_REPLAY): {
result = prepareTcModeReplay(); result = prepareTcModeReplay();
break; break;
} }
case (mpsoc::OBSW_RESET_SEQ_COUNT): {
sequenceCount = 0;
break;
}
default: default:
sif::debug << "PlocMPSoCHandler::buildCommandFromCommand: Command not implemented" sif::debug << "PlocMPSoCHandler::buildCommandFromCommand: Command not implemented"
<< std::endl; << std::endl;
@ -194,6 +198,7 @@ void PlocMPSoCHandler::fillCommandAndReplyMap() {
this->insertInCommandMap(mpsoc::TC_DOWNLINK_PWR_OFF); this->insertInCommandMap(mpsoc::TC_DOWNLINK_PWR_OFF);
this->insertInCommandMap(mpsoc::TC_REPLAY_WRITE_SEQUENCE); this->insertInCommandMap(mpsoc::TC_REPLAY_WRITE_SEQUENCE);
this->insertInCommandMap(mpsoc::TC_MODE_REPLAY); this->insertInCommandMap(mpsoc::TC_MODE_REPLAY);
this->insertInCommandMap(mpsoc::OBSW_RESET_SEQ_COUNT);
this->insertInReplyMap(mpsoc::ACK_REPORT, 1, nullptr, mpsoc::SIZE_ACK_REPORT); this->insertInReplyMap(mpsoc::ACK_REPORT, 1, 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);
@ -404,19 +409,19 @@ ReturnValue_t PlocMPSoCHandler::prepareTcReplayWriteSequence(const uint8_t* comm
} }
ReturnValue_t PlocMPSoCHandler::prepareTcModeReplay() { ReturnValue_t PlocMPSoCHandler::prepareTcModeReplay() {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
sequenceCount++; sequenceCount++;
mpsoc::TcModeReplay tcModeReplay(sequenceCount); mpsoc::TcModeReplay tcModeReplay(sequenceCount);
result = tcModeReplay.createPacket(); result = tcModeReplay.createPacket();
if (result != RETURN_OK) { if (result != RETURN_OK) {
sequenceCount--; sequenceCount--;
return result; return result;
} }
memcpy(commandBuffer, tcModeReplay.getWholeData(), tcModeReplay.getFullSize()); memcpy(commandBuffer, tcModeReplay.getWholeData(), tcModeReplay.getFullSize());
rawPacket = commandBuffer; rawPacket = commandBuffer;
rawPacketLen = tcModeReplay.getFullSize(); rawPacketLen = tcModeReplay.getFullSize();
nextReplyId = mpsoc::ACK_REPORT; nextReplyId = mpsoc::ACK_REPORT;
return RETURN_OK; return RETURN_OK;
} }
void PlocMPSoCHandler::copyToCommandBuffer(mpsoc::TcBase* tc) { void PlocMPSoCHandler::copyToCommandBuffer(mpsoc::TcBase* tc) {
@ -459,8 +464,9 @@ ReturnValue_t PlocMPSoCHandler::handleAckReport(const uint8_t* data) {
// TODO: Interpretation of status field in acknowledgment report // 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);
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) { if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
triggerEvent(ACK_FAILURE, commandId); triggerEvent(ACK_FAILURE, commandId, status);
} }
sendFailureReport(mpsoc::ACK_REPORT, MPSoCReturnValuesIF::RECEIVED_ACK_FAILURE); sendFailureReport(mpsoc::ACK_REPORT, MPSoCReturnValuesIF::RECEIVED_ACK_FAILURE);
disableAllReplies(); disableAllReplies();
@ -568,6 +574,8 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator
} }
break; break;
} }
case mpsoc::OBSW_RESET_SEQ_COUNT:
break;
default: default:
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Unknown command id" << std::endl; sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Unknown command id" << std::endl;
break; break;
@ -739,7 +747,10 @@ 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: 0x" << std::hex << status << std::endl;
} }
void PlocMPSoCHandler::getStatus(const uint8_t* data) {
return *(data + STATUS_OFFSET) << 8 | *(data + STATUS_OFFSET + 1);
}

View File

@ -206,6 +206,8 @@ private:
void printStatus(const uint8_t* data); void printStatus(const uint8_t* data);
ReturnValue_t prepareTcModeReplay(); ReturnValue_t prepareTcModeReplay();
uint16_t getStatus(const uint8_t* data);
}; };
#endif /* BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_ */ #endif /* BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_ */