it is getting annoying again
This commit is contained in:
parent
4ba9ebf58f
commit
90b7f069dc
@ -136,7 +136,6 @@ ReturnValue_t PlocMpsocHandler::executeAction(ActionId_t actionId, MessageQueueI
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
specialComHelper->setSequenceCount(&sequenceCount);
|
||||
result = specialComHelper->startFlashWrite(flashWritePusCmd.getObcFile(),
|
||||
flashWritePusCmd.getMPSoCFile());
|
||||
if (result != returnvalue::OK) {
|
||||
@ -151,7 +150,6 @@ ReturnValue_t PlocMpsocHandler::executeAction(ActionId_t actionId, MessageQueueI
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
specialComHelper->setSequenceCount(&sequenceCount);
|
||||
result = specialComHelper->startFlashRead(flashReadPusCmd.getObcFile(),
|
||||
flashReadPusCmd.getMPSoCFile(),
|
||||
flashReadPusCmd.getReadSize());
|
||||
@ -226,9 +224,8 @@ void PlocMpsocHandler::doShutDown() {
|
||||
uartIsolatorSwitch.pullLow();
|
||||
commandActionHelper.commandAction(supervisorHandler, supv::SHUTDOWN_MPSOC);
|
||||
powerState = PowerState::SHUTDOWN;
|
||||
break;
|
||||
return;
|
||||
case PowerState::OFF:
|
||||
sequenceCount = 0;
|
||||
hkReport.setReportingEnabled(false);
|
||||
setMode(_MODE_POWER_DOWN);
|
||||
break;
|
||||
@ -236,13 +233,19 @@ void PlocMpsocHandler::doShutDown() {
|
||||
break;
|
||||
}
|
||||
#else
|
||||
sequenceCount = 0;
|
||||
uartIsolatorSwitch.pullLow();
|
||||
hkReport.setReportingEnabled(false);
|
||||
setMode(_MODE_POWER_DOWN);
|
||||
powerState = PowerState::OFF;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (specialComHelper != nullptr) {
|
||||
specialComHelper->stopProcess();
|
||||
}
|
||||
hkReport.setReportingEnabled(false);
|
||||
setMode(_MODE_POWER_DOWN);
|
||||
commandIsPending = false;
|
||||
sequenceCount = 0;
|
||||
plocMPSoCHelperExecuting = false;
|
||||
startupState = StartupState::IDLE;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include <fsfw/globalfunctions/arrayprinter.h>
|
||||
#include <fsfw/tasks/TaskFactory.h>
|
||||
#include <linux/payload/PlocMpsocSpecialComHelper.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
@ -40,16 +42,15 @@ ReturnValue_t PlocMpsocSpecialComHelper::performOperation(uint8_t operationCode)
|
||||
#endif
|
||||
switch (internalState) {
|
||||
case InternalState::IDLE: {
|
||||
sif::debug << "ploc mpsoc helper idle" << std::endl;
|
||||
semaphore.acquire();
|
||||
break;
|
||||
}
|
||||
case InternalState::FLASH_WRITE: {
|
||||
result = performFlashWrite();
|
||||
if (result == returnvalue::OK) {
|
||||
triggerEvent(MPSOC_FLASH_WRITE_SUCCESSFUL);
|
||||
triggerEvent(MPSOC_FLASH_WRITE_SUCCESSFUL, sequenceCount->get());
|
||||
} else {
|
||||
triggerEvent(MPSOC_FLASH_WRITE_FAILED);
|
||||
triggerEvent(MPSOC_FLASH_WRITE_FAILED, sequenceCount->get());
|
||||
}
|
||||
internalState = InternalState::IDLE;
|
||||
break;
|
||||
@ -57,9 +58,9 @@ ReturnValue_t PlocMpsocSpecialComHelper::performOperation(uint8_t operationCode)
|
||||
case InternalState::FLASH_READ: {
|
||||
result = performFlashRead();
|
||||
if (result == returnvalue::OK) {
|
||||
triggerEvent(MPSOC_FLASH_READ_SUCCESSFUL);
|
||||
triggerEvent(MPSOC_FLASH_READ_SUCCESSFUL, sequenceCount->get());
|
||||
} else {
|
||||
triggerEvent(MPSOC_FLASH_READ_FAILED);
|
||||
triggerEvent(MPSOC_FLASH_READ_FAILED, sequenceCount->get());
|
||||
}
|
||||
internalState = InternalState::IDLE;
|
||||
break;
|
||||
@ -155,13 +156,18 @@ ReturnValue_t PlocMpsocSpecialComHelper::performFlashWrite() {
|
||||
file.read(reinterpret_cast<char*>(fileBuf.data()), dataLength);
|
||||
bytesRead += dataLength;
|
||||
remainingSize -= dataLength;
|
||||
(*sequenceCount)++;
|
||||
mpsoc::TcFlashWrite tc(spParams, *sequenceCount);
|
||||
result = tc.buildPacket(fileBuf.data(), dataLength);
|
||||
result = tc.setPayload(fileBuf.data(), dataLength);
|
||||
if (result != returnvalue::OK) {
|
||||
flashfclose();
|
||||
return result;
|
||||
}
|
||||
result = tc.finishPacket();
|
||||
if (result != returnvalue::OK) {
|
||||
flashfclose();
|
||||
return result;
|
||||
}
|
||||
(*sequenceCount)++;
|
||||
result = handlePacketTransmissionNoReply(tc);
|
||||
if (result != returnvalue::OK) {
|
||||
flashfclose();
|
||||
@ -205,7 +211,6 @@ ReturnValue_t PlocMpsocSpecialComHelper::performFlashRead() {
|
||||
flashfclose();
|
||||
return FILE_READ_ERROR;
|
||||
}
|
||||
(*sequenceCount)++;
|
||||
mpsoc::TcFlashRead flashReadRequest(spParams, *sequenceCount);
|
||||
result = flashReadRequest.setPayload(nextReadSize);
|
||||
if (result != returnvalue::OK) {
|
||||
@ -219,15 +224,11 @@ ReturnValue_t PlocMpsocSpecialComHelper::performFlashRead() {
|
||||
flashfclose();
|
||||
return result;
|
||||
}
|
||||
result = handlePacketTransmissionFlashRead(flashReadRequest);
|
||||
if (result != returnvalue::OK) {
|
||||
std::filesystem::remove(flashReadAndWrite.obcFile, e);
|
||||
flashfclose();
|
||||
return result;
|
||||
}
|
||||
result = handleFlashReadReply(ofile, nextReadSize);
|
||||
(*sequenceCount)++;
|
||||
result = handlePacketTransmissionFlashRead(flashReadRequest, ofile, nextReadSize);
|
||||
if (result != returnvalue::OK) {
|
||||
std::filesystem::remove(flashReadAndWrite.obcFile, e);
|
||||
sif::debug << "flash close" << std::endl;
|
||||
flashfclose();
|
||||
return result;
|
||||
}
|
||||
@ -239,7 +240,6 @@ ReturnValue_t PlocMpsocSpecialComHelper::performFlashRead() {
|
||||
|
||||
ReturnValue_t PlocMpsocSpecialComHelper::flashfopen(mpsoc::FileAccessMode mode) {
|
||||
spParams.buf = commandBuffer;
|
||||
(*sequenceCount)++;
|
||||
mpsoc::FlashFopen flashFopen(spParams, *sequenceCount);
|
||||
ReturnValue_t result = flashFopen.setPayload(flashReadAndWrite.mpsocFile, mode);
|
||||
if (result != returnvalue::OK) {
|
||||
@ -249,6 +249,7 @@ ReturnValue_t PlocMpsocSpecialComHelper::flashfopen(mpsoc::FileAccessMode mode)
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
(*sequenceCount)++;
|
||||
result = handlePacketTransmissionNoReply(flashFopen);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
@ -258,12 +259,22 @@ ReturnValue_t PlocMpsocSpecialComHelper::flashfopen(mpsoc::FileAccessMode mode)
|
||||
|
||||
ReturnValue_t PlocMpsocSpecialComHelper::flashfclose() {
|
||||
spParams.buf = commandBuffer;
|
||||
(*sequenceCount)++;
|
||||
mpsoc::FlashFclose flashFclose(spParams, *sequenceCount);
|
||||
return handlePacketTransmissionNoReply(flashFclose);
|
||||
ReturnValue_t result = flashFclose.finishPacket();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
(*sequenceCount)++;
|
||||
result = handlePacketTransmissionNoReply(flashFclose);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocMpsocSpecialComHelper::handlePacketTransmissionFlashRead(mpsoc::TcFlashRead& tc) {
|
||||
ReturnValue_t PlocMpsocSpecialComHelper::handlePacketTransmissionFlashRead(mpsoc::TcFlashRead& tc,
|
||||
std::ofstream& ofile,
|
||||
size_t expectedReadLen) {
|
||||
ReturnValue_t result = sendCommand(tc);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
@ -272,12 +283,29 @@ ReturnValue_t PlocMpsocSpecialComHelper::handlePacketTransmissionFlashRead(mpsoc
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
result = handleTmReception(ccsds::HEADER_LEN + mpsoc::FLASH_READ_MIN_OVERHEAD + tc.readSize +
|
||||
mpsoc::CRC_SIZE);
|
||||
// ccsds::HEADER_LEN + mpsoc::FLASH_READ_MIN_OVERHEAD + tc.readSize + mpsoc::CRC_SIZE
|
||||
result = handleTmReception();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
return handleExe();
|
||||
|
||||
// We have the nominal case where the flash read report appears first, or the case where we
|
||||
// get an EXE failure immediately.
|
||||
if (spReader.getApid() == mpsoc::apid::TM_FLASH_READ_REPORT) {
|
||||
result = handleFlashReadReply(ofile, expectedReadLen);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
return handleExe();
|
||||
} else if (spReader.getApid() == mpsoc::apid::EXE_FAILURE) {
|
||||
handleExeFailure();
|
||||
} else {
|
||||
triggerEvent(MPSOC_EXE_INVALID_APID, spReader.getApid(), static_cast<uint32_t>(internalState));
|
||||
sif::warning << "PLOC MPSoC: Expected execution report "
|
||||
<< "but received space packet with apid " << std::hex << spReader.getApid()
|
||||
<< std::endl;
|
||||
}
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocMpsocSpecialComHelper::handlePacketTransmissionNoReply(ploc::SpTcBase& tc) {
|
||||
@ -294,7 +322,6 @@ ReturnValue_t PlocMpsocSpecialComHelper::handlePacketTransmissionNoReply(ploc::S
|
||||
|
||||
ReturnValue_t PlocMpsocSpecialComHelper::sendCommand(ploc::SpTcBase& tc) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
arrayprinter::print(tc.getFullPacket(), tc.getFullPacketLen());
|
||||
result = uartComIF->sendMessage(comCookie, tc.getFullPacket(), tc.getFullPacketLen());
|
||||
if (result != returnvalue::OK) {
|
||||
sif::warning << "PlocMPSoCHelper::sendCommand: Failed to send command" << std::endl;
|
||||
@ -306,12 +333,12 @@ ReturnValue_t PlocMpsocSpecialComHelper::sendCommand(ploc::SpTcBase& tc) {
|
||||
|
||||
ReturnValue_t PlocMpsocSpecialComHelper::handleAck() {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
result = handleTmReception(mpsoc::SIZE_ACK_REPORT);
|
||||
result = handleTmReception();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
SpTmReader tmPacket(tmBuf.data(), tmBuf.size());
|
||||
result = checkReceivedTm(tmPacket);
|
||||
result = checkReceivedTm();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
@ -327,7 +354,7 @@ void PlocMpsocSpecialComHelper::handleAckApidFailure(const ploc::SpTmReader& rea
|
||||
uint16_t apid = reader.getApid();
|
||||
if (apid == mpsoc::apid::ACK_FAILURE) {
|
||||
uint16_t status = mpsoc::getStatusFromRawData(reader.getFullData());
|
||||
sif::warning << "MPSoC ACK Failure: " << mpsoc::getStatusString(status) << std::endl;
|
||||
sif::warning << "PLOC MPSoC ACK Failure: " << mpsoc::getStatusString(status) << std::endl;
|
||||
triggerEvent(MPSOC_ACK_FAILURE_REPORT, static_cast<uint32_t>(internalState), status);
|
||||
} else {
|
||||
triggerEvent(MPSOC_ACK_INVALID_APID, apid, static_cast<uint32_t>(internalState));
|
||||
@ -339,74 +366,93 @@ void PlocMpsocSpecialComHelper::handleAckApidFailure(const ploc::SpTmReader& rea
|
||||
ReturnValue_t PlocMpsocSpecialComHelper::handleExe() {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
|
||||
result = handleTmReception(mpsoc::SIZE_EXE_REPORT);
|
||||
result = handleTmReception();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
ploc::SpTmReader tmPacket(tmBuf.data(), tmBuf.size());
|
||||
result = checkReceivedTm(tmPacket);
|
||||
result = checkReceivedTm();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
uint16_t apid = tmPacket.getApid();
|
||||
if (apid != mpsoc::apid::EXE_SUCCESS) {
|
||||
handleExeApidFailure(tmPacket);
|
||||
uint16_t apid = spReader.getApid();
|
||||
if (apid == mpsoc::apid::EXE_FAILURE) {
|
||||
handleExeFailure();
|
||||
return returnvalue::FAILED;
|
||||
} else if (apid != mpsoc::apid::EXE_SUCCESS) {
|
||||
triggerEvent(MPSOC_EXE_INVALID_APID, apid, static_cast<uint32_t>(internalState));
|
||||
sif::warning << "PLOC MPSoC: Expected execution report "
|
||||
<< "but received space packet with apid " << std::hex << apid << std::endl;
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
void PlocMpsocSpecialComHelper::handleExeApidFailure(const ploc::SpTmReader& reader) {
|
||||
uint16_t apid = reader.getApid();
|
||||
if (apid == mpsoc::apid::EXE_FAILURE) {
|
||||
uint16_t status = mpsoc::getStatusFromRawData(reader.getFullData());
|
||||
sif::warning << "MPSoC EXE Failure: " << mpsoc::getStatusString(status) << std::endl;
|
||||
triggerEvent(MPSOC_EXE_FAILURE_REPORT, static_cast<uint32_t>(internalState));
|
||||
} else {
|
||||
triggerEvent(MPSOC_EXE_INVALID_APID, apid, static_cast<uint32_t>(internalState));
|
||||
sif::warning << "PlocMPSoCHelper::handleExeApidFailure: Expected execution report "
|
||||
<< "but received space packet with apid " << std::hex << apid << std::endl;
|
||||
}
|
||||
void PlocMpsocSpecialComHelper::handleExeFailure() {
|
||||
uint16_t status = mpsoc::getStatusFromRawData(spReader.getFullData());
|
||||
sif::warning << "PLOC MPSoC EXE Failure: " << mpsoc::getStatusString(status) << std::endl;
|
||||
triggerEvent(MPSOC_EXE_FAILURE_REPORT, static_cast<uint32_t>(internalState));
|
||||
}
|
||||
|
||||
ReturnValue_t PlocMpsocSpecialComHelper::handleTmReception(size_t remainingBytes) {
|
||||
ReturnValue_t PlocMpsocSpecialComHelper::handleTmReception() {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
tmCountdown.resetTimer();
|
||||
size_t readBytes = 0;
|
||||
size_t currentBytes = 0;
|
||||
for (int retries = 0; retries < RETRIES; retries++) {
|
||||
result = receive(tmBuf.data() + readBytes, ¤tBytes, remainingBytes);
|
||||
uint32_t usleepDelay = 5;
|
||||
size_t fullPacketLen = 0;
|
||||
while (true) {
|
||||
if (tmCountdown.hasTimedOut()) {
|
||||
triggerEvent(MPSOC_READ_TIMEOUT, tmCountdown.getTimeoutMs());
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
result = receive(tmBuf.data() + readBytes, 6, ¤tBytes);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
spReader.setReadOnlyData(tmBuf.data(), tmBuf.size());
|
||||
fullPacketLen = spReader.getFullPacketLen();
|
||||
readBytes += currentBytes;
|
||||
remainingBytes = remainingBytes - currentBytes;
|
||||
if (remainingBytes == 0) {
|
||||
if (readBytes == 6) {
|
||||
break;
|
||||
}
|
||||
usleep(usleepDelay);
|
||||
if (usleepDelay < 200000) {
|
||||
usleepDelay *= 4;
|
||||
}
|
||||
}
|
||||
if (remainingBytes != 0) {
|
||||
sif::warning << "PlocMPSoCHelper::handleTmReception: Failed to receive reply" << std::endl;
|
||||
triggerEvent(MPSOC_MISSING_EXE, remainingBytes, static_cast<uint32_t>(internalState));
|
||||
return returnvalue::FAILED;
|
||||
sif::debug << "recvd first 6 bytes" << std::endl;
|
||||
while (true) {
|
||||
if (tmCountdown.hasTimedOut()) {
|
||||
triggerEvent(MPSOC_READ_TIMEOUT, tmCountdown.getTimeoutMs());
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
result = receive(tmBuf.data() + readBytes, fullPacketLen - readBytes, ¤tBytes);
|
||||
readBytes += currentBytes;
|
||||
if (fullPacketLen == readBytes) {
|
||||
sif::debug << "recvd full " << fullPacketLen << std::endl;
|
||||
break;
|
||||
}
|
||||
usleep(usleepDelay);
|
||||
if (usleepDelay < 200000) {
|
||||
usleepDelay *= 4;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocMpsocSpecialComHelper::handleFlashReadReply(std::ofstream& ofile,
|
||||
size_t expectedReadLen) {
|
||||
SpTmReader tmPacket(tmBuf.data(), tmBuf.size());
|
||||
ReturnValue_t result = checkReceivedTm(tmPacket);
|
||||
ReturnValue_t result = checkReceivedTm();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
uint16_t apid = tmPacket.getApid();
|
||||
uint16_t apid = spReader.getApid();
|
||||
if (apid != mpsoc::apid::TM_FLASH_READ_REPORT) {
|
||||
triggerEvent(MPSOC_FLASH_READ_PACKET_ERROR, FlashReadErrorType::FLASH_READ_APID_ERROR);
|
||||
sif::warning << "PLOC MPSoC Flash Read: Unexpected APID" << std::endl;
|
||||
return result;
|
||||
}
|
||||
const uint8_t* packetData = tmPacket.getPacketData();
|
||||
size_t deserDummy = tmPacket.getPacketDataLen() - mpsoc::CRC_SIZE;
|
||||
const uint8_t* packetData = spReader.getPacketData();
|
||||
size_t deserDummy = spReader.getPacketDataLen() - mpsoc::CRC_SIZE;
|
||||
uint32_t receivedReadLen = 0;
|
||||
std::string receivedShortName = std::string(reinterpret_cast<const char*>(packetData), 12);
|
||||
if (receivedShortName != flashReadAndWrite.mpsocFile.substr(0, 12)) {
|
||||
@ -462,21 +508,20 @@ ReturnValue_t PlocMpsocSpecialComHelper::startFlashReadOrWriteBase(std::string o
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocMpsocSpecialComHelper::checkReceivedTm(SpTmReader& reader) {
|
||||
ReturnValue_t result = reader.checkSize();
|
||||
ReturnValue_t PlocMpsocSpecialComHelper::checkReceivedTm() {
|
||||
ReturnValue_t result = spReader.checkSize();
|
||||
if (result != returnvalue::OK) {
|
||||
sif::error << "PlocMPSoCHelper::handleTmReception: Size check on received TM failed"
|
||||
<< std::endl;
|
||||
sif::error << "PLOC MPSoC: Size check on received TM failed" << std::endl;
|
||||
triggerEvent(MPSOC_TM_SIZE_ERROR);
|
||||
return result;
|
||||
}
|
||||
reader.checkCrc();
|
||||
spReader.checkCrc();
|
||||
if (result != returnvalue::OK) {
|
||||
sif::warning << "PlocMPSoCHelper::handleTmReception: CRC check failed" << std::endl;
|
||||
sif::warning << "PLOC MPSoC: CRC check failed" << std::endl;
|
||||
triggerEvent(MPSOC_TM_CRC_MISSMATCH, *sequenceCount);
|
||||
return result;
|
||||
}
|
||||
uint16_t recvSeqCnt = reader.getSequenceCount();
|
||||
uint16_t recvSeqCnt = spReader.getSequenceCount();
|
||||
if (recvSeqCnt != *sequenceCount) {
|
||||
triggerEvent(MPSOC_HELPER_SEQ_CNT_MISMATCH, *sequenceCount, recvSeqCnt);
|
||||
*sequenceCount = recvSeqCnt;
|
||||
@ -486,8 +531,8 @@ ReturnValue_t PlocMpsocSpecialComHelper::checkReceivedTm(SpTmReader& reader) {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocMpsocSpecialComHelper::receive(uint8_t* data, size_t* readBytes,
|
||||
size_t requestBytes) {
|
||||
ReturnValue_t PlocMpsocSpecialComHelper::receive(uint8_t* data, size_t requestBytes,
|
||||
size_t* readBytes) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
uint8_t* buffer = nullptr;
|
||||
result = uartComIF->requestReceiveMessage(comCookie, requestBytes);
|
||||
|
@ -75,6 +75,7 @@ class PlocMpsocSpecialComHelper : public SystemObject, public ExecutableObjectIF
|
||||
static const Event MPSOC_FLASH_READ_PACKET_ERROR = MAKE_EVENT(14, severity::LOW);
|
||||
static const Event MPSOC_FLASH_READ_FAILED = MAKE_EVENT(15, severity::LOW);
|
||||
static const Event MPSOC_FLASH_READ_SUCCESSFUL = MAKE_EVENT(16, severity::INFO);
|
||||
static const Event MPSOC_READ_TIMEOUT = MAKE_EVENT(17, severity::LOW);
|
||||
|
||||
enum FlashReadErrorType : uint32_t {
|
||||
FLASH_READ_APID_ERROR = 0,
|
||||
@ -157,6 +158,8 @@ class PlocMpsocSpecialComHelper : public SystemObject, public ExecutableObjectIF
|
||||
SpacePacketCreator creator;
|
||||
ploc::SpTcParams spParams = ploc::SpTcParams(creator);
|
||||
|
||||
Countdown tmCountdown = Countdown(5000);
|
||||
|
||||
std::array<uint8_t, mpsoc::SP_MAX_DATA_SIZE> fileBuf{};
|
||||
std::array<uint8_t, mpsoc::MAX_REPLY_SIZE> tmBuf{};
|
||||
|
||||
@ -171,6 +174,7 @@ class PlocMpsocSpecialComHelper : public SystemObject, public ExecutableObjectIF
|
||||
CookieIF* comCookie = nullptr;
|
||||
// Sequence count, must be set by Ploc MPSoC Handler
|
||||
SourceSequenceCounter* sequenceCount = nullptr;
|
||||
ploc::SpTmReader spReader;
|
||||
|
||||
void resetHelper();
|
||||
ReturnValue_t performFlashWrite();
|
||||
@ -178,18 +182,19 @@ class PlocMpsocSpecialComHelper : public SystemObject, public ExecutableObjectIF
|
||||
ReturnValue_t flashfopen(mpsoc::FileAccessMode mode);
|
||||
ReturnValue_t flashfclose();
|
||||
ReturnValue_t handlePacketTransmissionNoReply(ploc::SpTcBase& tc);
|
||||
ReturnValue_t handlePacketTransmissionFlashRead(mpsoc::TcFlashRead& tc);
|
||||
ReturnValue_t handlePacketTransmissionFlashRead(mpsoc::TcFlashRead& tc, std::ofstream& ofile,
|
||||
size_t expectedReadLen);
|
||||
ReturnValue_t handleFlashReadReply(std::ofstream& ofile, size_t expectedReadLen);
|
||||
ReturnValue_t sendCommand(ploc::SpTcBase& tc);
|
||||
ReturnValue_t receive(uint8_t* data, size_t* readBytes, size_t requestBytes);
|
||||
ReturnValue_t receive(uint8_t* data, size_t requestBytes, size_t* readBytes);
|
||||
ReturnValue_t handleAck();
|
||||
ReturnValue_t handleExe();
|
||||
ReturnValue_t startFlashReadOrWriteBase(std::string obcFile, std::string mpsocFile);
|
||||
ReturnValue_t fileCheck(std::string obcFile);
|
||||
void handleAckApidFailure(const ploc::SpTmReader& reader);
|
||||
void handleExeApidFailure(const ploc::SpTmReader& reader);
|
||||
ReturnValue_t handleTmReception(size_t remainingBytes);
|
||||
ReturnValue_t checkReceivedTm(ploc::SpTmReader& reader);
|
||||
void handleExeFailure();
|
||||
ReturnValue_t handleTmReception();
|
||||
ReturnValue_t checkReceivedTm();
|
||||
};
|
||||
|
||||
#endif /* BSP_Q7S_DEVICES_PLOCMPSOCHELPER_H_ */
|
||||
|
@ -229,7 +229,7 @@ class TcBase : public ploc::SpTcBase, public MPSoCReturnValuesIF {
|
||||
virtual ~TcBase() = default;
|
||||
|
||||
// Initial length field of space packet. Will always be updated when packet is created.
|
||||
static const uint16_t INIT_LENGTH = 2;
|
||||
static const uint16_t INIT_LENGTH = CRC_SIZE;
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
@ -391,7 +391,9 @@ class FlashFopen : public TcBase {
|
||||
class FlashFclose : public TcBase {
|
||||
public:
|
||||
FlashFclose(ploc::SpTcParams params, uint16_t sequenceCount)
|
||||
: TcBase(params, apid::TC_FLASHFCLOSE, sequenceCount) {}
|
||||
: TcBase(params, apid::TC_FLASHFCLOSE, sequenceCount) {
|
||||
spParams.setFullPayloadLen(CRC_SIZE);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -402,7 +404,7 @@ class TcFlashWrite : public TcBase {
|
||||
TcFlashWrite(ploc::SpTcParams params, uint16_t sequenceCount)
|
||||
: TcBase(params, apid::TC_FLASHWRITE, sequenceCount) {}
|
||||
|
||||
ReturnValue_t buildPacket(const uint8_t* writeData, uint32_t writeLen_) {
|
||||
ReturnValue_t setPayload(const uint8_t* writeData, uint32_t writeLen_) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
writeLen = writeLen_;
|
||||
if (writeLen > SP_MAX_DATA_SIZE) {
|
||||
|
Loading…
Reference in New Issue
Block a user