PLOC SUPV Update to newer firmware #316
@ -310,7 +310,9 @@ enum class TmtcManStatusCode : uint32_t {
|
|||||||
BAD_SP_HEADER = 0x608
|
BAD_SP_HEADER = 0x608
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint16_t APID_MASK = 0x3FF;
|
static constexpr uint16_t APID_MASK_TC = 0x200;
|
||||||
|
static constexpr uint16_t APID_MASK_TM = 0x400;
|
||||||
|
static constexpr uint16_t APID_MODULE_MASK = 0x7F;
|
||||||
static const uint16_t SEQUENCE_COUNT_MASK = 0xFFF;
|
static const uint16_t SEQUENCE_COUNT_MASK = 0xFFF;
|
||||||
|
|
||||||
static const uint8_t HK_SET_ENTRIES = 13;
|
static const uint8_t HK_SET_ENTRIES = 13;
|
||||||
@ -485,7 +487,8 @@ class TcBase : public ploc::SpTcBase {
|
|||||||
: TcBase(params, apid, service, payloadLen, DEFAULT_SEQ_COUNT) {}
|
: TcBase(params, apid, service, payloadLen, DEFAULT_SEQ_COUNT) {}
|
||||||
|
|
||||||
TcBase(TcParams params, uint16_t apid, uint8_t serviceId, size_t payloadLen, uint16_t seqCount)
|
TcBase(TcParams params, uint16_t apid, uint8_t serviceId, size_t payloadLen, uint16_t seqCount)
|
||||||
: ploc::SpTcBase(params, apid, fullSpDataLenFromPayloadLen(payloadLen), seqCount) {
|
: ploc::SpTcBase(params, apid | APID_MASK_TC, fullSpDataLenFromPayloadLen(payloadLen),
|
||||||
|
seqCount) {
|
||||||
setup(serviceId);
|
setup(serviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -496,6 +499,8 @@ class TcBase : public ploc::SpTcBase {
|
|||||||
payloadStart[supv::PAYLOAD_OFFSET] = id;
|
payloadStart[supv::PAYLOAD_OFFSET] = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint16_t getModuleApid() const { return getApid() & APID_MODULE_MASK; }
|
||||||
|
|
||||||
uint8_t getServiceId() const { return payloadStart[supv::PAYLOAD_OFFSET]; }
|
uint8_t getServiceId() const { return payloadStart[supv::PAYLOAD_OFFSET]; }
|
||||||
|
|
||||||
static size_t fullSpDataLenFromPayloadLen(size_t payloadLen) {
|
static size_t fullSpDataLenFromPayloadLen(size_t payloadLen) {
|
||||||
@ -541,6 +546,8 @@ class TmBase : public ploc::SpTmReader {
|
|||||||
|
|
||||||
uint8_t getServiceId() const { return getPacketData()[TIMESTAMP_LEN]; }
|
uint8_t getServiceId() const { return getPacketData()[TIMESTAMP_LEN]; }
|
||||||
|
|
||||||
|
uint16_t getModuleApid() const { return getApid() & APID_MODULE_MASK; }
|
||||||
|
|
||||||
const uint8_t* getPayloadStart() const { return getPacketData() + SECONDARY_HEADER_LEN; }
|
const uint8_t* getPayloadStart() const { return getPacketData() + SECONDARY_HEADER_LEN; }
|
||||||
size_t getPayloadLen() const {
|
size_t getPayloadLen() const {
|
||||||
if (getFullPacketLen() > SECONDARY_HEADER_LEN + ccsds::HEADER_LEN) {
|
if (getFullPacketLen() > SECONDARY_HEADER_LEN + ccsds::HEADER_LEN) {
|
||||||
@ -1430,7 +1437,7 @@ class VerificationReport {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (statusCode < 0x200 and statusCode > 0x100) {
|
} else if (statusCode < 0x200 and statusCode >= 0x100) {
|
||||||
BootManStatusCode code = static_cast<BootManStatusCode>(statusCode);
|
BootManStatusCode code = static_cast<BootManStatusCode>(statusCode);
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case BootManStatusCode::NOTHING_TODO: {
|
case BootManStatusCode::NOTHING_TODO: {
|
||||||
@ -1474,7 +1481,7 @@ class VerificationReport {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (statusCode < 0x300 and statusCode > 0x200) {
|
} else if (statusCode < 0x300 and statusCode >= 0x200) {
|
||||||
MemManStatusCode code = static_cast<MemManStatusCode>(statusCode);
|
MemManStatusCode code = static_cast<MemManStatusCode>(statusCode);
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case MemManStatusCode::SP_NOT_AVAILABLE: {
|
case MemManStatusCode::SP_NOT_AVAILABLE: {
|
||||||
@ -1522,7 +1529,7 @@ class VerificationReport {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (statusCode < 0x400 and statusCode > 0x300) {
|
} else if (statusCode < 0x400 and statusCode >= 0x300) {
|
||||||
PowerManStatusCode code = static_cast<PowerManStatusCode>(statusCode);
|
PowerManStatusCode code = static_cast<PowerManStatusCode>(statusCode);
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case PowerManStatusCode::PG_LOW: {
|
case PowerManStatusCode::PG_LOW: {
|
||||||
|
@ -588,7 +588,7 @@ ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t* start, size_t r
|
|||||||
tmReader.setData(start, remainingSize);
|
tmReader.setData(start, remainingSize);
|
||||||
sif::debug << "PlocSupervisorHandler::scanForReply: Received Packet" << std::endl;
|
sif::debug << "PlocSupervisorHandler::scanForReply: Received Packet" << std::endl;
|
||||||
arrayprinter::print(start, remainingSize);
|
arrayprinter::print(start, remainingSize);
|
||||||
uint16_t apid = tmReader.getApid(); //(*(start) << 8 | *(start + 1)) & APID_MASK;
|
uint16_t apid = tmReader.getModuleApid();
|
||||||
|
|
||||||
switch (apid) {
|
switch (apid) {
|
||||||
case (Apid::TMTC_MAN): {
|
case (Apid::TMTC_MAN): {
|
||||||
|
@ -583,7 +583,7 @@ ReturnValue_t PlocSupvUartManager::handlePacketTransmissionNoReply(
|
|||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (tmReader.getApid() == Apid::TMTC_MAN) {
|
if (tmReader.getModuleApid() == Apid::TMTC_MAN) {
|
||||||
uint8_t serviceId = tmReader.getServiceId();
|
uint8_t serviceId = tmReader.getServiceId();
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
if (not ackReceived) {
|
if (not ackReceived) {
|
||||||
@ -769,7 +769,7 @@ ReturnValue_t PlocSupvUartManager::handleCheckMemoryCommand() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
packetWasHandled = false;
|
packetWasHandled = false;
|
||||||
if (tmReader.getApid() == Apid::TMTC_MAN) {
|
if (tmReader.getModuleApid() == Apid::TMTC_MAN) {
|
||||||
uint8_t serviceId = tmReader.getServiceId();
|
uint8_t serviceId = tmReader.getServiceId();
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
if (not ackReceived) {
|
if (not ackReceived) {
|
||||||
@ -790,7 +790,7 @@ ReturnValue_t PlocSupvUartManager::handleCheckMemoryCommand() {
|
|||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (tmReader.getApid() == Apid::MEM_MAN) {
|
} else if (tmReader.getModuleApid() == Apid::MEM_MAN) {
|
||||||
if (ackReceived) {
|
if (ackReceived) {
|
||||||
supv::UpdateStatusReport report(tmReader);
|
supv::UpdateStatusReport report(tmReader);
|
||||||
result = report.parse();
|
result = report.parse();
|
||||||
@ -1149,6 +1149,7 @@ int PlocSupvUartManager::removeHdlcFramingWithCrcCheck(const uint8_t* src, size_
|
|||||||
if (calcCrc != crc) {
|
if (calcCrc != crc) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
// This does not work because the CRC is little endian
|
||||||
// if(calc_crc16_buff_reflected(dst, tlen) != 0) {
|
// if(calc_crc16_buff_reflected(dst, tlen) != 0) {
|
||||||
// return 1;
|
// return 1;
|
||||||
// }
|
// }
|
||||||
|
Loading…
Reference in New Issue
Block a user