v1.10.0 #220

Merged
meierj merged 592 commits from develop into main 2022-04-22 07:42:20 +02:00
3 changed files with 37 additions and 21 deletions
Showing only changes of commit 3df7a7f896 - Show all commits

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_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_EXE_REPORT = 14;
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;
result = flashWritePusCmd.extractFields(data, size);
if (result != RETURN_OK) {
return result;
return result;
}
result = plocMPSoCHelper->startFlashWrite(flashWritePusCmd.getObcFile(),
flashWritePusCmd.getMPSoCFile());
flashWritePusCmd.getMPSoCFile());
if (result != RETURN_OK) {
return result;
}
@ -164,9 +164,13 @@ ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(DeviceCommandId_t device
break;
}
case (mpsoc::TC_MODE_REPLAY): {
result = prepareTcModeReplay();
break;
}
result = prepareTcModeReplay();
break;
}
case (mpsoc::OBSW_RESET_SEQ_COUNT): {
sequenceCount = 0;
break;
}
default:
sif::debug << "PlocMPSoCHandler::buildCommandFromCommand: Command not implemented"
<< std::endl;
@ -194,6 +198,7 @@ void PlocMPSoCHandler::fillCommandAndReplyMap() {
this->insertInCommandMap(mpsoc::TC_DOWNLINK_PWR_OFF);
this->insertInCommandMap(mpsoc::TC_REPLAY_WRITE_SEQUENCE);
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::EXE_REPORT, 3, nullptr, mpsoc::SIZE_EXE_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 result = RETURN_OK;
sequenceCount++;
mpsoc::TcModeReplay tcModeReplay(sequenceCount);
result = tcModeReplay.createPacket();
if (result != RETURN_OK) {
sequenceCount--;
return result;
}
memcpy(commandBuffer, tcModeReplay.getWholeData(), tcModeReplay.getFullSize());
rawPacket = commandBuffer;
rawPacketLen = tcModeReplay.getFullSize();
nextReplyId = mpsoc::ACK_REPORT;
return RETURN_OK;
ReturnValue_t result = RETURN_OK;
sequenceCount++;
mpsoc::TcModeReplay tcModeReplay(sequenceCount);
result = tcModeReplay.createPacket();
if (result != RETURN_OK) {
sequenceCount--;
return result;
}
memcpy(commandBuffer, tcModeReplay.getWholeData(), tcModeReplay.getFullSize());
rawPacket = commandBuffer;
rawPacketLen = tcModeReplay.getFullSize();
nextReplyId = mpsoc::ACK_REPORT;
return RETURN_OK;
}
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
sif::debug << "PlocMPSoCHandler::handleAckReport: Received Ack failure report" << std::endl;
DeviceCommandId_t commandId = getPendingCommand();
uint16_t status = getStatus(data);
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
triggerEvent(ACK_FAILURE, commandId);
triggerEvent(ACK_FAILURE, commandId, status);
}
sendFailureReport(mpsoc::ACK_REPORT, MPSoCReturnValuesIF::RECEIVED_ACK_FAILURE);
disableAllReplies();
@ -568,6 +574,8 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator
}
break;
}
case mpsoc::OBSW_RESET_SEQ_COUNT:
break;
default:
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Unknown command id" << std::endl;
break;
@ -739,7 +747,10 @@ void PlocMPSoCHandler::disableExeReportReply() {
}
void PlocMPSoCHandler::printStatus(const uint8_t* data) {
uint16_t status = *(data + STATUS_OFFSET) << 8 | *(data + STATUS_OFFSET + 1);
sif::info << "Verification report status: 0x" << std::hex << status << std::endl;
uint16_t status = *(data + STATUS_OFFSET) << 8 | *(data + STATUS_OFFSET + 1);
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);
ReturnValue_t prepareTcModeReplay();
uint16_t getStatus(const uint8_t* data);
};
#endif /* BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_ */