e-band control commands

This commit is contained in:
Jakob Meier
2022-03-21 16:21:51 +01:00
parent 664670573a
commit bbed4a3b6e
7 changed files with 258 additions and 26 deletions

View File

@ -142,6 +142,26 @@ ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(
result = prepareTcFlashDelete(commandData, commandDataLen);
break;
}
case(mpsoc::TC_REPLAY_START): {
result = prepareTcReplayStart(commandData, commandDataLen);
break;
}
case(mpsoc::TC_REPLAY_STOP): {
result = prepareTcReplayStop();
break;
}
case(mpsoc::TC_DOWNLINK_PWR_ON): {
result = prepareTcDownlinkPwrOn(commandData, commandDataLen);
break;
}
case(mpsoc::TC_DOWNLINK_PWR_OFF): {
result = prepareTcDownlinkPwrOff();
break;
}
case(mpsoc::TC_REPLAY_WRITE_SEQUENCE): {
result = prepareTcReplayWriteSequence(commandData, commandDataLen);
break;
}
default:
sif::debug << "PlocMPSoCHandler::buildCommandFromCommand: Command not implemented" << std::endl;
result = DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
@ -161,6 +181,12 @@ ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(
void PlocMPSoCHandler::fillCommandAndReplyMap() {
this->insertInCommandMap(mpsoc::TC_MEM_WRITE);
this->insertInCommandMap(mpsoc::TC_MEM_READ);
this->insertInCommandMap(mpsoc::TC_FLASHDELETE);
this->insertInCommandMap(mpsoc::TC_REPLAY_START);
this->insertInCommandMap(mpsoc::TC_REPLAY_STOP);
this->insertInCommandMap(mpsoc::TC_DOWNLINK_PWR_ON);
this->insertInCommandMap(mpsoc::TC_DOWNLINK_PWR_OFF);
this->insertInCommandMap(mpsoc::TC_REPLAY_WRITE_SEQUENCE);
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);
@ -321,10 +347,64 @@ ReturnValue_t PlocMPSoCHandler::prepareTcReplayStart(
sequenceCount--;
return result;
}
copyToCommandBuffer (&tcFlashDelete);
copyToCommandBuffer(&tcReplayStart);
return RETURN_OK;
}
ReturnValue_t PlocMPSoCHandler::prepareTcReplayStop() {
ReturnValue_t result = RETURN_OK;
sequenceCount++;
mpsoc::TcReplayStop tcReplayStop(sequenceCount);
result = tcReplayStop.createPacket();
if (result != RETURN_OK) {
sequenceCount--;
return result;
}
copyToCommandBuffer(&tcReplayStop);
return RETURN_OK;
}
ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOn(
const uint8_t * commandData, size_t commandDataLen) {
ReturnValue_t result = RETURN_OK;
sequenceCount++;
mpsoc::TcDownlinkPwrOn tcDownlinkPwrOn(sequenceCount);
result = tcDownlinkPwrOn.createPacket(commandData, commandDataLen);
if (result != RETURN_OK) {
sequenceCount--;
return result;
}
copyToCommandBuffer(&tcDownlinkPwrOn);
return RETURN_OK;
}
ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOff() {
ReturnValue_t result = RETURN_OK;
sequenceCount++;
mpsoc::TcDownlinkPwrOff tcDownlinkPwrOff(sequenceCount);
result = tcDownlinkPwrOff.createPacket();
if (result != RETURN_OK) {
sequenceCount--;
return result;
}
copyToCommandBuffer(&tcDownlinkPwrOff);
return RETURN_OK;
}
ReturnValue_t PlocMPSoCHandler::prepareTcReplayWriteSequence(const uint8_t* commandData,
size_t commandDataLen) {
ReturnValue_t result = RETURN_OK;
sequenceCount++;
mpsoc::TcReplayWriteSeq tcReplayWriteSeq(sequenceCount);
result = tcReplayWriteSeq.createPacket(commandData, commandDataLen);
if (result != RETURN_OK) {
sequenceCount--;
return result;
}
copyToCommandBuffer(&tcReplayWriteSeq);
return RETURN_OK;
}
void PlocMPSoCHandler::copyToCommandBuffer(mpsoc::TcBase* tc) {
if (tc == nullptr) {
sif::debug << "PlocMPSoCHandler::copyToCommandBuffer: Invalid TC" << std::endl;
@ -458,6 +538,11 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator
switch (command->first) {
case mpsoc::TC_MEM_WRITE:
case mpsoc::TC_FLASHDELETE:
case mpsoc::TC_REPLAY_START:
case mpsoc::TC_REPLAY_STOP:
case mpsoc::TC_DOWNLINK_PWR_ON:
case mpsoc::TC_DOWNLINK_PWR_OFF:
case mpsoc::TC_REPLAY_WRITE_SEQUENCE:
enabledReplies = 2;
break;
case mpsoc::TC_MEM_READ: {
@ -493,6 +578,23 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator
<< " not in replyMap" << std::endl;
}
switch(command->first) {
case mpsoc::TC_REPLAY_WRITE_SEQUENCE: {
DeviceReplyIter iter = deviceReplyMap.find(mpsoc::EXE_REPORT);
if (iter != deviceReplyMap.end()) {
// Overwrite delay cycles because replay write sequence command can required up to
// 30 seconds for execution
iter->second.delayCycles = mpsoc::TC_WRITE_SEQ_EXECUTION_DELAY;
}
else {
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Unknown reply id" << std::endl;
}
break;
}
default:
break;
}
return RETURN_OK;
}