PLOC SUPV Update to newer firmware #316

Merged
muellerr merged 99 commits from mueller/tas_ploc_supv_update into develop 2022-11-18 14:27:13 +01:00
2 changed files with 40 additions and 42 deletions
Showing only changes of commit af0853a42b - Show all commits

View File

@ -11,6 +11,7 @@
#include <fstream> #include <fstream>
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "tas/hdlc.h"
#ifdef XIPHOS_Q7S #ifdef XIPHOS_Q7S
#include "bsp_q7s/fs/FilesystemHelper.h" #include "bsp_q7s/fs/FilesystemHelper.h"
#include "bsp_q7s/fs/SdCardManager.h" #include "bsp_q7s/fs/SdCardManager.h"
@ -911,7 +912,7 @@ ReturnValue_t PlocSupvHelper::readReceivedMessage(CookieIF* cookie, uint8_t** bu
return returnvalue::OK; return returnvalue::OK;
} }
ReturnValue_t PlocSupvHelper::parseRecRingBufForHdlc() { ReturnValue_t PlocSupvHelper::parseRecRingBufForHdlc(size_t& readSize) {
size_t availableData = recRingBuf.getAvailableReadData(); size_t availableData = recRingBuf.getAvailableReadData();
if (availableData == 0) { if (availableData == 0) {
return NO_PACKET_FOUND; return NO_PACKET_FOUND;
@ -926,29 +927,23 @@ ReturnValue_t PlocSupvHelper::parseRecRingBufForHdlc() {
bool startMarkerFound = false; bool startMarkerFound = false;
size_t startIdx = 0; size_t startIdx = 0;
return returnvalue::OK; return returnvalue::OK;
// if (result != returnvalue::OK) { for (size_t idx = 0; idx < availableData; idx++) {
// ErrorInfo info; // handle start marker
// info.res = result; if (encodedBuf[idx] == HDLC_START_MARKER) {
// setErrorContext(ErrorTypes::RING_BUF_ERROR, info); if (not startMarkerFound) {
// return result; startMarkerFound = true;
// } startIdx = idx;
// bool stxFound = false; } else {
// size_t stxIdx = 0; readSize = idx;
// for (size_t vectorIdx = 0; vectorIdx < availableData; vectorIdx++) { return POSSIBLE_PACKET_LOSS_CONSECUTIVE_START;
// // handle STX char }
// if (encodedBuf.first[vectorIdx] == DleEncoder::STX_CHAR) { }
// if (not stxFound) { if (encodedBuf[idx] == HDLC_END_MARKER) {
// stxFound = true; if (startMarkerFound) {
// stxIdx = vectorIdx; // Probably a packet, so decode it
// } else { }
// // might be lost packet, so we should advance the read pointer }
// // without skipping the STX }
// readSize = vectorIdx;
// ErrorInfo info;
// setErrorContext(ErrorTypes::CONSECUTIVE_STX_CHARS, info);
// return POSSIBLE_PACKET_LOSS;
// }
// }
// // handle ETX char // // handle ETX char
// if (encodedBuf.first[vectorIdx] == DleEncoder::ETX_CHAR) { // if (encodedBuf.first[vectorIdx] == DleEncoder::ETX_CHAR) {
// if (stxFound) { // if (stxFound) {
@ -959,8 +954,8 @@ ReturnValue_t PlocSupvHelper::parseRecRingBufForHdlc() {
// ReturnValue_t result = // ReturnValue_t result =
// decoder.decode(&encodedBuf.first[stxIdx], availableData - stxIdx, &dummy, // decoder.decode(&encodedBuf.first[stxIdx], availableData - stxIdx, &dummy,
// decodedBuf.first, decodedBuf.second, // decodedBuf.first, decodedBuf.second,
//&decodedLen); if (result == returnvalue::OK) { ctx.setType(ContextType::PACKET_FOUND); //&decodedLen); if (result == returnvalue::OK) {
// ctx.decodedPacket.first = decodedBuf.first; //ctx.setType(ContextType::PACKET_FOUND); ctx.decodedPacket.first = decodedBuf.first;
// ctx.decodedPacket.second = decodedLen; // ctx.decodedPacket.second = decodedLen;
// readSize = ++vectorIdx; // readSize = ++vectorIdx;
// return returnvalue::OK; // return returnvalue::OK;

View File

@ -157,9 +157,12 @@ class PlocSupvHelper : public DeviceCommunicationIF,
static uint32_t buildProgParams1(uint8_t percent, uint16_t seqCount); static uint32_t buildProgParams1(uint8_t percent, uint16_t seqCount);
private: private:
static constexpr ReturnValue_t NO_PACKET_FOUND = returnvalue::makeCode(1, 0); static constexpr ReturnValue_t NO_PACKET_FOUND = returnvalue::makeCode(1, 0);
static constexpr ReturnValue_t DECODE_BUF_TOO_SMALL = returnvalue::makeCode(1, 1); static constexpr ReturnValue_t DECODE_BUF_TOO_SMALL = returnvalue::makeCode(1, 1);
static constexpr ReturnValue_t POSSIBLE_PACKET_LOSS_CONSECUTIVE_START =
returnvalue::makeCode(1, 2);
static constexpr ReturnValue_t POSSIBLE_PACKET_LOSS_CONSECUTIVE_END = returnvalue::makeCode(1, 3);
static const uint16_t CRC16_INIT = 0xFFFF; static const uint16_t CRC16_INIT = 0xFFFF;
// Event buffer reply will carry 24 space packets with 1016 bytes and one space packet with // Event buffer reply will carry 24 space packets with 1016 bytes and one space packet with
// 192 bytes // 192 bytes
@ -246,7 +249,7 @@ class PlocSupvHelper : public DeviceCommunicationIF,
void executeFullCheckMemoryCommand(); void executeFullCheckMemoryCommand();
ReturnValue_t parseRecRingBufForHdlc(); ReturnValue_t parseRecRingBufForHdlc(size_t& readSize);
ReturnValue_t executeUpdate(); ReturnValue_t executeUpdate();
ReturnValue_t continueUpdate(); ReturnValue_t continueUpdate();
ReturnValue_t updateOperation(); ReturnValue_t updateOperation();