Global Config Handler #271
@ -47,8 +47,8 @@
|
|||||||
#include "mission/utility/GlobalConfigHandler.h"
|
#include "mission/utility/GlobalConfigHandler.h"
|
||||||
|
|
||||||
void Factory::setStaticFrameworkObjectIds() {
|
void Factory::setStaticFrameworkObjectIds() {
|
||||||
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
PusServiceBase::PUS_DISTRIBUTOR = objects::PUS_PACKET_DISTRIBUTOR;
|
||||||
PusServiceBase::packetDestination = objects::TM_FUNNEL;
|
PusServiceBase::PACKET_DESTINATION = objects::TM_FUNNEL;
|
||||||
|
|
||||||
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
|
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||||
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
|
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
|
||||||
@ -57,8 +57,7 @@ void Factory::setStaticFrameworkObjectIds() {
|
|||||||
// No storage object for now.
|
// No storage object for now.
|
||||||
TmFunnel::storageDestination = objects::NO_OBJECT;
|
TmFunnel::storageDestination = objects::NO_OBJECT;
|
||||||
|
|
||||||
VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION;
|
VerificationReporter::DEFAULT_RECEIVER = objects::PUS_SERVICE_1_VERIFICATION;
|
||||||
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::produce(void* args) {
|
void ObjectFactory::produce(void* args) {
|
||||||
|
@ -92,7 +92,7 @@ ReturnValue_t CoreController::initializeLocalDataPool(localpool::DataPool &local
|
|||||||
localDataPoolMap.emplace(core::TEMPERATURE, new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(core::TEMPERATURE, new PoolEntry<float>({0}));
|
||||||
localDataPoolMap.emplace(core::PS_VOLTAGE, new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(core::PS_VOLTAGE, new PoolEntry<float>({0}));
|
||||||
localDataPoolMap.emplace(core::PL_VOLTAGE, new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(core::PL_VOLTAGE, new PoolEntry<float>({0}));
|
||||||
poolManager.subscribeForPeriodicPacket(hkSet.getSid(), false, 10.0, false);
|
poolManager.subscribeForRegularPeriodicPacket({hkSet.getSid(), false, 10.0});
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,8 +95,8 @@
|
|||||||
ResetArgs RESET_ARGS_GNSS;
|
ResetArgs RESET_ARGS_GNSS;
|
||||||
|
|
||||||
void Factory::setStaticFrameworkObjectIds() {
|
void Factory::setStaticFrameworkObjectIds() {
|
||||||
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
PusServiceBase::PUS_DISTRIBUTOR = objects::PUS_PACKET_DISTRIBUTOR;
|
||||||
PusServiceBase::packetDestination = objects::TM_FUNNEL;
|
PusServiceBase::PACKET_DESTINATION = objects::TM_FUNNEL;
|
||||||
|
|
||||||
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
|
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||||
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
|
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
|
||||||
@ -117,8 +117,7 @@ void Factory::setStaticFrameworkObjectIds() {
|
|||||||
|
|
||||||
LocalDataPoolManager::defaultHkDestination = objects::PUS_SERVICE_3_HOUSEKEEPING;
|
LocalDataPoolManager::defaultHkDestination = objects::PUS_SERVICE_3_HOUSEKEEPING;
|
||||||
|
|
||||||
VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION;
|
VerificationReporter::DEFAULT_RECEIVER = objects::PUS_SERVICE_1_VERIFICATION;
|
||||||
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::setStatics() { Factory::setStaticFrameworkObjectIds(); }
|
void ObjectFactory::setStatics() { Factory::setStaticFrameworkObjectIds(); }
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include "commonConfig.h"
|
#include "commonConfig.h"
|
||||||
|
|
||||||
#include "fsfw/tmtcpacket/SpacePacket.h"
|
#include "fsfw/tmtcpacket/ccsds/defs.h"
|
||||||
#include "tmtc/apid.h"
|
#include "tmtc/apid.h"
|
||||||
|
|
||||||
const fsfw::Version common::OBSW_VERSION{OBSW_VERSION_MAJOR, OBSW_VERSION_MINOR,
|
const fsfw::Version common::OBSW_VERSION{OBSW_VERSION_MAJOR, OBSW_VERSION_MINOR,
|
||||||
OBSW_VERSION_REVISION, OBSW_VERSION_CST_GIT_SHA1};
|
OBSW_VERSION_REVISION, OBSW_VERSION_CST_GIT_SHA1};
|
||||||
const uint16_t common::PUS_PACKET_ID = spacepacket::getTcSpacePacketIdFromApid(apid::EIVE_OBSW);
|
const uint16_t common::PUS_PACKET_ID = ccsds::getTcSpacePacketIdFromApid(apid::EIVE_OBSW);
|
||||||
|
@ -87,7 +87,7 @@ ReturnValue_t GPSHyperionLinuxController::initializeLocalDataPool(
|
|||||||
localDataPoolMap.emplace(GpsHyperion::SATS_IN_USE, new PoolEntry<uint8_t>());
|
localDataPoolMap.emplace(GpsHyperion::SATS_IN_USE, new PoolEntry<uint8_t>());
|
||||||
localDataPoolMap.emplace(GpsHyperion::SATS_IN_VIEW, new PoolEntry<uint8_t>());
|
localDataPoolMap.emplace(GpsHyperion::SATS_IN_VIEW, new PoolEntry<uint8_t>());
|
||||||
localDataPoolMap.emplace(GpsHyperion::FIX_MODE, new PoolEntry<uint8_t>());
|
localDataPoolMap.emplace(GpsHyperion::FIX_MODE, new PoolEntry<uint8_t>());
|
||||||
poolManager.subscribeForPeriodicPacket(gpsSet.getSid(), false, 30.0, false);
|
poolManager.subscribeForRegularPeriodicPacket({gpsSet.getSid(), 30.0});
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "eive/definitions.h"
|
#include "eive/definitions.h"
|
||||||
#include "fsfw/globalfunctions/CRC.h"
|
#include "fsfw/globalfunctions/CRC.h"
|
||||||
#include "fsfw/serialize/SerializeAdapter.h"
|
#include "fsfw/serialize/SerializeAdapter.h"
|
||||||
#include "fsfw/tmtcpacket/SpacePacket.h"
|
#include "mission/devices/devicedefinitions/SpBase.h"
|
||||||
|
|
||||||
namespace mpsoc {
|
namespace mpsoc {
|
||||||
|
|
||||||
@ -73,6 +73,8 @@ static const char NULL_TERMINATOR = '\0';
|
|||||||
static const uint8_t MIN_SPACE_PACKET_LENGTH = 7;
|
static const uint8_t MIN_SPACE_PACKET_LENGTH = 7;
|
||||||
static const uint8_t SPACE_PACKET_HEADER_SIZE = 6;
|
static const uint8_t SPACE_PACKET_HEADER_SIZE = 6;
|
||||||
|
|
||||||
|
static constexpr size_t CRC_SIZE = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The size of payload data which will be forwarded to the requesting object. e.g. PUS Service
|
* The size of payload data which will be forwarded to the requesting object. e.g. PUS Service
|
||||||
* 8.
|
* 8.
|
||||||
@ -88,8 +90,14 @@ static const size_t MAX_FILENAME_SIZE = 256;
|
|||||||
static const uint16_t LENGTH_TC_MEM_WRITE = 12;
|
static const uint16_t LENGTH_TC_MEM_WRITE = 12;
|
||||||
static const uint16_t LENGTH_TC_MEM_READ = 8;
|
static const uint16_t LENGTH_TC_MEM_READ = 8;
|
||||||
|
|
||||||
static const size_t MAX_REPLY_SIZE = SpacePacket::PACKET_MAX_SIZE * 3;
|
/**
|
||||||
static const size_t MAX_COMMAND_SIZE = SpacePacket::PACKET_MAX_SIZE;
|
* Maximum SP packet size as specified in the TAS Supversior ICD.
|
||||||
|
* https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_TAS-ILH-IRS/ICD-PLOC/TAS&fileid=942896
|
||||||
|
* at sheet README
|
||||||
|
*/
|
||||||
|
static constexpr size_t SP_MAX_SIZE = 1024;
|
||||||
|
static const size_t MAX_REPLY_SIZE = SP_MAX_SIZE * 3;
|
||||||
|
static const size_t MAX_COMMAND_SIZE = SP_MAX_SIZE;
|
||||||
static const size_t MAX_DATA_SIZE = 1016;
|
static const size_t MAX_DATA_SIZE = 1016;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -130,8 +138,10 @@ static const uint16_t RESERVED_4 = 0x5F4;
|
|||||||
/**
|
/**
|
||||||
* @brief Abstract base class for TC space packet of MPSoC.
|
* @brief Abstract base class for TC space packet of MPSoC.
|
||||||
*/
|
*/
|
||||||
class TcBase : public SpacePacket, public MPSoCReturnValuesIF {
|
class TcBase : public ploc::SpTcBase, public MPSoCReturnValuesIF {
|
||||||
public:
|
public:
|
||||||
|
virtual ~TcBase() = default;
|
||||||
|
|
||||||
// Initial length field of space packet. Will always be updated when packet is created.
|
// Initial length field of space packet. Will always be updated when packet is created.
|
||||||
static const uint16_t INIT_LENGTH = 1;
|
static const uint16_t INIT_LENGTH = 1;
|
||||||
|
|
||||||
@ -141,8 +151,12 @@ class TcBase : public SpacePacket, public MPSoCReturnValuesIF {
|
|||||||
* @param sequenceCount Sequence count of space packet which will be incremented with each
|
* @param sequenceCount Sequence count of space packet which will be incremented with each
|
||||||
* sent and received packets.
|
* sent and received packets.
|
||||||
*/
|
*/
|
||||||
TcBase(uint16_t apid, uint16_t sequenceCount)
|
TcBase(ploc::SpTcParams params, uint16_t apid, uint16_t sequenceCount)
|
||||||
: SpacePacket(INIT_LENGTH, true, apid, sequenceCount) {}
|
: ploc::SpTcBase(params, apid, sequenceCount) {
|
||||||
|
spParams.setDataFieldLen(INIT_LENGTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t buildPacket() { return buildPacket(nullptr, 0); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Function to initialize the space packet
|
* @brief Function to initialize the space packet
|
||||||
@ -152,17 +166,22 @@ class TcBase : public SpacePacket, public MPSoCReturnValuesIF {
|
|||||||
*
|
*
|
||||||
* @return RETURN_OK if packet creation was successful, otherwise error return value
|
* @return RETURN_OK if packet creation was successful, otherwise error return value
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t createPacket(const uint8_t* commandData, size_t commandDataLen) {
|
ReturnValue_t buildPacket(const uint8_t* commandData, size_t commandDataLen) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
payloadStart = spParams.buf + ccsds::HEADER_LEN;
|
||||||
result = initPacket(commandData, commandDataLen);
|
ReturnValue_t res;
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (commandData != nullptr and commandDataLen > 0) {
|
||||||
return result;
|
res = initPacket(commandData, commandDataLen);
|
||||||
|
if (res != result::OK) {
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
result = addCrc();
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
return result;
|
|
||||||
|
updateSpFields();
|
||||||
|
res = checkSizeAndSerializeHeader();
|
||||||
|
if (res != result::OK) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
return calcCrc();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -175,45 +194,6 @@ class TcBase : public SpacePacket, public MPSoCReturnValuesIF {
|
|||||||
virtual ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
|
virtual ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Calculates and adds the CRC
|
|
||||||
*/
|
|
||||||
ReturnValue_t addCrc() {
|
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
|
||||||
size_t serializedSize = 0;
|
|
||||||
uint32_t full_size = getFullSize();
|
|
||||||
uint16_t crc = CRC::crc16ccitt(getWholeData(), full_size - CRC_SIZE);
|
|
||||||
result = SerializeAdapter::serialize<uint16_t>(
|
|
||||||
&crc, this->localData.byteStream + full_size - CRC_SIZE, &serializedSize, sizeof(crc),
|
|
||||||
SerializeIF::Endianness::BIG);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
sif::debug << "TcBase::addCrc: Failed to serialize crc field" << std::endl;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Class for handling tm replies of the PLOC MPSoC.
|
|
||||||
*/
|
|
||||||
class TmPacket : public SpacePacket, public MPSoCReturnValuesIF {
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief Constructor creates idle packet and sets length field to maximum allowed size.
|
|
||||||
*/
|
|
||||||
TmPacket() : SpacePacket(PACKET_MAX_SIZE) {}
|
|
||||||
|
|
||||||
ReturnValue_t checkCrc() {
|
|
||||||
uint8_t* crcPtr = this->getPacketData() + this->getPacketDataLength() - 1;
|
|
||||||
uint16_t receivedCrc = *(crcPtr) << 8 | *(crcPtr + 1);
|
|
||||||
uint16_t recalculatedCrc =
|
|
||||||
CRC::crc16ccitt(this->localData.byteStream, this->getFullSize() - CRC_SIZE);
|
|
||||||
if (recalculatedCrc != receivedCrc) {
|
|
||||||
return CRC_FAILURE;
|
|
||||||
}
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -224,22 +204,22 @@ class TcMemRead : public TcBase {
|
|||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*/
|
*/
|
||||||
TcMemRead(uint16_t sequenceCount) : TcBase(apid::TC_MEM_READ, sequenceCount) {
|
TcMemRead(ploc::SpTcParams params, uint16_t sequenceCount)
|
||||||
this->setPacketDataLength(PACKET_LENGTH);
|
: TcBase(params, apid::TC_MEM_READ, sequenceCount) {
|
||||||
|
spParams.setPayloadLen(COMMAND_LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t getMemLen() const { return memLen; }
|
uint16_t getMemLen() const { return memLen; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
|
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
result = lengthCheck(commandDataLen);
|
result = lengthCheck(commandDataLen);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
std::memcpy(this->localData.fields.buffer, commandData, MEM_ADDRESS_SIZE);
|
std::memcpy(payloadStart, commandData, MEM_ADDRESS_SIZE);
|
||||||
std::memcpy(this->localData.fields.buffer + MEM_ADDRESS_SIZE, commandData + MEM_ADDRESS_SIZE,
|
std::memcpy(payloadStart + MEM_ADDRESS_SIZE, commandData + MEM_ADDRESS_SIZE, MEM_LEN_SIZE);
|
||||||
MEM_LEN_SIZE);
|
|
||||||
size_t size = sizeof(memLen);
|
size_t size = sizeof(memLen);
|
||||||
const uint8_t* memLenPtr = commandData + MEM_ADDRESS_SIZE;
|
const uint8_t* memLenPtr = commandData + MEM_ADDRESS_SIZE;
|
||||||
result =
|
result =
|
||||||
@ -259,7 +239,7 @@ class TcMemRead : public TcBase {
|
|||||||
uint16_t memLen = 0;
|
uint16_t memLen = 0;
|
||||||
|
|
||||||
ReturnValue_t lengthCheck(size_t commandDataLen) {
|
ReturnValue_t lengthCheck(size_t commandDataLen) {
|
||||||
if (commandDataLen != COMMAND_LENGTH) {
|
if (commandDataLen != COMMAND_LENGTH or checkPayloadLen() != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return INVALID_LENGTH;
|
return INVALID_LENGTH;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
@ -275,31 +255,45 @@ class TcMemWrite : public TcBase {
|
|||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*/
|
*/
|
||||||
TcMemWrite(uint16_t sequenceCount) : TcBase(apid::TC_MEM_WRITE, sequenceCount) {}
|
TcMemWrite(ploc::SpTcParams params, uint16_t sequenceCount)
|
||||||
|
: TcBase(params, apid::TC_MEM_WRITE, sequenceCount) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
|
|
||||||
|
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
result = lengthCheck(commandDataLen);
|
result = lengthCheck(commandDataLen);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
std::memcpy(this->localData.fields.buffer, commandData, commandDataLen);
|
|
||||||
uint16_t memLen =
|
uint16_t memLen =
|
||||||
*(commandData + MEM_ADDRESS_SIZE) << 8 | *(commandData + MEM_ADDRESS_SIZE + 1);
|
*(commandData + MEM_ADDRESS_SIZE) << 8 | *(commandData + MEM_ADDRESS_SIZE + 1);
|
||||||
this->setPacketDataLength(memLen * 4 + FIX_LENGTH - 1);
|
spParams.setPayloadLen(MIN_FIXED_PAYLOAD_LENGTH + memLen * 4);
|
||||||
|
result = checkPayloadLen();
|
||||||
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
std::memcpy(payloadStart, commandData, commandDataLen);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Min length consists of 4 byte address, 2 byte mem length field, 4 byte data (1 word)
|
// 4 byte address, 2 byte mem length field
|
||||||
static const size_t MIN_COMMAND_DATA_LENGTH = 10;
|
|
||||||
static const size_t MEM_ADDRESS_SIZE = 4;
|
static const size_t MEM_ADDRESS_SIZE = 4;
|
||||||
static const size_t FIX_LENGTH = 8;
|
static const size_t MIN_FIXED_PAYLOAD_LENGTH = MEM_ADDRESS_SIZE + 2;
|
||||||
|
// Min length consists of 4 byte address, 2 byte mem length field, 4 byte data (1 word)
|
||||||
|
static const size_t MIN_COMMAND_DATA_LENGTH = MIN_FIXED_PAYLOAD_LENGTH + 4;
|
||||||
|
|
||||||
|
|
||||||
ReturnValue_t lengthCheck(size_t commandDataLen) {
|
ReturnValue_t lengthCheck(size_t commandDataLen) {
|
||||||
if (commandDataLen < MIN_COMMAND_DATA_LENGTH) {
|
if (commandDataLen < MIN_COMMAND_DATA_LENGTH) {
|
||||||
sif::warning << "TcMemWrite: Command has invalid length " << commandDataLen << std::endl;
|
sif::warning << "TcMemWrite: Length " << commandDataLen << " smaller than minimum " <<
|
||||||
|
MIN_COMMAND_DATA_LENGTH << std::endl;
|
||||||
|
return INVALID_LENGTH;
|
||||||
|
}
|
||||||
|
if(commandDataLen + CRC_SIZE > spParams.maxSize) {
|
||||||
|
sif::warning << "TcMemWrite: Length " << commandDataLen << " larger than allowed " <<
|
||||||
|
spParams.maxSize - CRC_SIZE << std::endl;
|
||||||
return INVALID_LENGTH;
|
return INVALID_LENGTH;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
@ -309,9 +303,10 @@ class TcMemWrite : public TcBase {
|
|||||||
/**
|
/**
|
||||||
* @brief Class to help creation of flash fopen command.
|
* @brief Class to help creation of flash fopen command.
|
||||||
*/
|
*/
|
||||||
class FlashFopen : public TcBase {
|
class FlashFopen : public ploc::SpTcBase {
|
||||||
public:
|
public:
|
||||||
FlashFopen(uint16_t sequenceCount) : TcBase(apid::TC_FLASHFOPEN, sequenceCount) {}
|
FlashFopen(ploc::SpTcParams params, uint16_t sequenceCount)
|
||||||
|
: ploc::SpTcBase(params, apid::TC_FLASHFOPEN, sequenceCount) {}
|
||||||
|
|
||||||
static const char APPEND = 'a';
|
static const char APPEND = 'a';
|
||||||
static const char WRITE = 'w';
|
static const char WRITE = 'w';
|
||||||
@ -319,19 +314,17 @@ class FlashFopen : public TcBase {
|
|||||||
|
|
||||||
ReturnValue_t createPacket(std::string filename, char accessMode_) {
|
ReturnValue_t createPacket(std::string filename, char accessMode_) {
|
||||||
accessMode = accessMode_;
|
accessMode = accessMode_;
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
|
||||||
size_t nameSize = filename.size();
|
size_t nameSize = filename.size();
|
||||||
std::memcpy(this->getPacketData(), filename.c_str(), nameSize);
|
spParams.setPayloadLen(nameSize + sizeof(NULL_TERMINATOR) + sizeof(accessMode));
|
||||||
*(this->getPacketData() + nameSize) = NULL_TERMINATOR;
|
ReturnValue_t result = checkPayloadLen();
|
||||||
std::memcpy(this->getPacketData() + nameSize + sizeof(NULL_TERMINATOR), &accessMode,
|
|
||||||
sizeof(accessMode));
|
|
||||||
this->setPacketDataLength(nameSize + sizeof(NULL_TERMINATOR) + sizeof(accessMode) + CRC_SIZE -
|
|
||||||
1);
|
|
||||||
result = addCrc();
|
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return result;
|
std::memcpy(payloadStart, filename.c_str(), nameSize);
|
||||||
|
*(spParams.buf + nameSize) = NULL_TERMINATOR;
|
||||||
|
std::memcpy(payloadStart + nameSize + sizeof(NULL_TERMINATOR), &accessMode, sizeof(accessMode));
|
||||||
|
updateSpFields();
|
||||||
|
return calcCrc();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -341,52 +334,57 @@ class FlashFopen : public TcBase {
|
|||||||
/**
|
/**
|
||||||
* @brief Class to help creation of flash fclose command.
|
* @brief Class to help creation of flash fclose command.
|
||||||
*/
|
*/
|
||||||
class FlashFclose : public TcBase {
|
class FlashFclose : public ploc::SpTcBase {
|
||||||
public:
|
public:
|
||||||
FlashFclose(uint16_t sequenceCount) : TcBase(apid::TC_FLASHFCLOSE, sequenceCount) {}
|
FlashFclose(ploc::SpTcParams params, uint16_t sequenceCount)
|
||||||
|
: ploc::SpTcBase(params, apid::TC_FLASHFCLOSE, sequenceCount) {}
|
||||||
|
|
||||||
ReturnValue_t createPacket(std::string filename) {
|
ReturnValue_t createPacket(std::string filename) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
|
||||||
size_t nameSize = filename.size();
|
size_t nameSize = filename.size();
|
||||||
std::memcpy(this->getPacketData(), filename.c_str(), nameSize);
|
spParams.setPayloadLen(nameSize + sizeof(NULL_TERMINATOR));
|
||||||
*(this->getPacketData() + nameSize) = NULL_TERMINATOR;
|
ReturnValue_t result = checkPayloadLen();
|
||||||
this->setPacketDataLength(nameSize + sizeof(NULL_TERMINATOR) + CRC_SIZE - 1);
|
|
||||||
result = addCrc();
|
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return result;
|
std::memcpy(payloadStart, filename.c_str(), nameSize);
|
||||||
|
*(payloadStart + nameSize) = NULL_TERMINATOR;
|
||||||
|
return calcCrc();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Class to build flash write space packet.
|
* @brief Class to build flash write space packet.
|
||||||
*/
|
*/
|
||||||
class TcFlashWrite : public TcBase {
|
class TcFlashWrite : public ploc::SpTcBase {
|
||||||
public:
|
public:
|
||||||
TcFlashWrite(uint16_t sequenceCount) : TcBase(apid::TC_FLASHWRITE, sequenceCount) {}
|
TcFlashWrite(ploc::SpTcParams params, uint16_t sequenceCount)
|
||||||
|
: ploc::SpTcBase(params, apid::TC_FLASHWRITE, sequenceCount) {}
|
||||||
|
|
||||||
ReturnValue_t createPacket(const uint8_t* writeData, uint32_t writeLen_) {
|
ReturnValue_t buildPacket(const uint8_t* writeData, uint32_t writeLen_) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
writeLen = writeLen_;
|
writeLen = writeLen_;
|
||||||
if (writeLen > MAX_DATA_SIZE) {
|
if (writeLen > MAX_DATA_SIZE) {
|
||||||
sif::debug << "FlashWrite::createPacket: Command data too big" << std::endl;
|
sif::debug << "FlashWrite::createPacket: Command data too big" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
spParams.setPayloadLen(static_cast<uint16_t>(writeLen) + 4);
|
||||||
|
result = checkPayloadLen();
|
||||||
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
size_t serializedSize = 0;
|
size_t serializedSize = 0;
|
||||||
result =
|
result = SerializeAdapter::serialize(&writeLen, payloadStart, &serializedSize, sizeof(writeLen),
|
||||||
SerializeAdapter::serialize<uint32_t>(&writeLen, this->getPacketData(), &serializedSize,
|
SerializeIF::Endianness::BIG);
|
||||||
sizeof(writeLen), SerializeIF::Endianness::BIG);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
std::memcpy(this->getPacketData() + sizeof(writeLen), writeData, writeLen);
|
std::memcpy(payloadStart + sizeof(writeLen), writeData, writeLen);
|
||||||
this->setPacketDataLength(static_cast<uint16_t>(writeLen + CRC_SIZE - 1));
|
updateSpFields();
|
||||||
result = addCrc();
|
auto res = checkSizeAndSerializeHeader();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (res != result::OK) {
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return calcCrc();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -396,21 +394,27 @@ class TcFlashWrite : public TcBase {
|
|||||||
/**
|
/**
|
||||||
* @brief Class to help creation of flash delete command.
|
* @brief Class to help creation of flash delete command.
|
||||||
*/
|
*/
|
||||||
class TcFlashDelete : public TcBase {
|
class TcFlashDelete : public ploc::SpTcBase {
|
||||||
public:
|
public:
|
||||||
TcFlashDelete(uint16_t sequenceCount) : TcBase(apid::TC_FLASHDELETE, sequenceCount) {}
|
TcFlashDelete(ploc::SpTcParams params, uint16_t sequenceCount)
|
||||||
|
: ploc::SpTcBase(params, apid::TC_FLASHDELETE, sequenceCount) {}
|
||||||
|
|
||||||
ReturnValue_t createPacket(std::string filename) {
|
ReturnValue_t buildPacket(std::string filename) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
|
||||||
size_t nameSize = filename.size();
|
size_t nameSize = filename.size();
|
||||||
std::memcpy(this->getPacketData(), filename.c_str(), nameSize);
|
spParams.setPayloadLen(nameSize + sizeof(NULL_TERMINATOR));
|
||||||
*(this->getPacketData() + nameSize) = NULL_TERMINATOR;
|
auto res = checkPayloadLen();
|
||||||
this->setPacketDataLength(nameSize + sizeof(NULL_TERMINATOR) + CRC_SIZE - 1);
|
if(res != HasReturnvaluesIF::RETURN_OK) {
|
||||||
result = addCrc();
|
return res;
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
return result;
|
std::memcpy(payloadStart, filename.c_str(), nameSize);
|
||||||
|
*(payloadStart + nameSize) = NULL_TERMINATOR;
|
||||||
|
|
||||||
|
updateSpFields();
|
||||||
|
res = checkSizeAndSerializeHeader();
|
||||||
|
if (res != result::OK) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
return calcCrc();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -419,17 +423,8 @@ class TcFlashDelete : public TcBase {
|
|||||||
*/
|
*/
|
||||||
class TcReplayStop : public TcBase {
|
class TcReplayStop : public TcBase {
|
||||||
public:
|
public:
|
||||||
TcReplayStop(uint16_t sequenceCount) : TcBase(apid::TC_REPLAY_STOP, sequenceCount) {}
|
TcReplayStop(ploc::SpTcParams params, uint16_t sequenceCount)
|
||||||
|
: TcBase(params, apid::TC_REPLAY_STOP, sequenceCount) {}
|
||||||
ReturnValue_t createPacket() {
|
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
|
||||||
result = addCrc();
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
this->setPacketDataLength(static_cast<uint16_t>(CRC_SIZE - 1));
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -440,11 +435,13 @@ class TcReplayStart : public TcBase {
|
|||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*/
|
*/
|
||||||
TcReplayStart(uint16_t sequenceCount) : TcBase(apid::TC_REPLAY_START, sequenceCount) {}
|
TcReplayStart(ploc::SpTcParams params, uint16_t sequenceCount)
|
||||||
|
: TcBase(params, apid::TC_REPLAY_START, sequenceCount) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
|
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
spParams.setPayloadLen(commandDataLen);
|
||||||
result = lengthCheck(commandDataLen);
|
result = lengthCheck(commandDataLen);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
@ -453,8 +450,7 @@ class TcReplayStart : public TcBase {
|
|||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
std::memcpy(this->localData.fields.buffer, commandData, commandDataLen);
|
std::memcpy(payloadStart, commandData, commandDataLen);
|
||||||
this->setPacketDataLength(commandDataLen + CRC_SIZE - 1);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,7 +460,7 @@ class TcReplayStart : public TcBase {
|
|||||||
static const uint8_t ONCE = 1;
|
static const uint8_t ONCE = 1;
|
||||||
|
|
||||||
ReturnValue_t lengthCheck(size_t commandDataLen) {
|
ReturnValue_t lengthCheck(size_t commandDataLen) {
|
||||||
if (commandDataLen != COMMAND_DATA_LENGTH) {
|
if (commandDataLen != COMMAND_DATA_LENGTH or checkPayloadLen() != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "TcReplayStart: Command has invalid length " << commandDataLen << std::endl;
|
sif::warning << "TcReplayStart: Command has invalid length " << commandDataLen << std::endl;
|
||||||
return INVALID_LENGTH;
|
return INVALID_LENGTH;
|
||||||
}
|
}
|
||||||
@ -488,10 +484,11 @@ class TcDownlinkPwrOn : public TcBase {
|
|||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*/
|
*/
|
||||||
TcDownlinkPwrOn(uint16_t sequenceCount) : TcBase(apid::TC_DOWNLINK_PWR_ON, sequenceCount) {}
|
TcDownlinkPwrOn(ploc::SpTcParams params, uint16_t sequenceCount)
|
||||||
|
: TcBase(params, apid::TC_DOWNLINK_PWR_ON, sequenceCount) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
|
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
result = lengthCheck(commandDataLen);
|
result = lengthCheck(commandDataLen);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
@ -505,10 +502,13 @@ class TcDownlinkPwrOn : public TcBase {
|
|||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
std::memcpy(this->localData.fields.buffer, commandData, commandDataLen);
|
spParams.setPayloadLen(commandDataLen + sizeof(MAX_AMPLITUDE));
|
||||||
std::memcpy(this->localData.fields.buffer + commandDataLen, &MAX_AMPLITUDE,
|
result = checkPayloadLen();
|
||||||
sizeof(MAX_AMPLITUDE));
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
this->setPacketDataLength(commandDataLen + sizeof(MAX_AMPLITUDE) + CRC_SIZE - 1);
|
return result;
|
||||||
|
}
|
||||||
|
std::memcpy(payloadStart, commandData, commandDataLen);
|
||||||
|
std::memcpy(payloadStart + commandDataLen, &MAX_AMPLITUDE, sizeof(MAX_AMPLITUDE));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -555,17 +555,8 @@ class TcDownlinkPwrOn : public TcBase {
|
|||||||
*/
|
*/
|
||||||
class TcDownlinkPwrOff : public TcBase {
|
class TcDownlinkPwrOff : public TcBase {
|
||||||
public:
|
public:
|
||||||
TcDownlinkPwrOff(uint16_t sequenceCount) : TcBase(apid::TC_DOWNLINK_PWR_OFF, sequenceCount) {}
|
TcDownlinkPwrOff(ploc::SpTcParams params, uint16_t sequenceCount)
|
||||||
|
: TcBase(params, apid::TC_DOWNLINK_PWR_OFF, sequenceCount) {}
|
||||||
ReturnValue_t createPacket() {
|
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
|
||||||
result = addCrc();
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
this->setPacketDataLength(static_cast<uint16_t>(CRC_SIZE - 1));
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -576,19 +567,19 @@ class TcReplayWriteSeq : public TcBase {
|
|||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*/
|
*/
|
||||||
TcReplayWriteSeq(uint16_t sequenceCount)
|
TcReplayWriteSeq(ploc::SpTcParams params, uint16_t sequenceCount)
|
||||||
: TcBase(apid::TC_REPLAY_WRITE_SEQUENCE, sequenceCount) {}
|
: TcBase(params, apid::TC_REPLAY_WRITE_SEQUENCE, sequenceCount) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
|
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
spParams.setPayloadLen(commandDataLen + sizeof(NULL_TERMINATOR));
|
||||||
result = lengthCheck(commandDataLen);
|
result = lengthCheck(commandDataLen);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
std::memcpy(this->localData.fields.buffer, commandData, commandDataLen);
|
std::memcpy(payloadStart, commandData, commandDataLen);
|
||||||
*(this->localData.fields.buffer + commandDataLen) = NULL_TERMINATOR;
|
*(payloadStart + commandDataLen) = NULL_TERMINATOR;
|
||||||
this->setPacketDataLength(commandDataLen + sizeof(NULL_TERMINATOR) + CRC_SIZE - 1);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -596,7 +587,8 @@ class TcReplayWriteSeq : public TcBase {
|
|||||||
static const size_t USE_DECODING_LENGTH = 1;
|
static const size_t USE_DECODING_LENGTH = 1;
|
||||||
|
|
||||||
ReturnValue_t lengthCheck(size_t commandDataLen) {
|
ReturnValue_t lengthCheck(size_t commandDataLen) {
|
||||||
if (commandDataLen > USE_DECODING_LENGTH + MAX_FILENAME_SIZE) {
|
if (commandDataLen > USE_DECODING_LENGTH + MAX_FILENAME_SIZE or
|
||||||
|
checkPayloadLen() != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "TcReplayWriteSeq: Command has invalid length " << commandDataLen
|
sif::warning << "TcReplayWriteSeq: Command has invalid length " << commandDataLen
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return INVALID_LENGTH;
|
return INVALID_LENGTH;
|
||||||
@ -643,17 +635,8 @@ class FlashWritePusCmd : public MPSoCReturnValuesIF {
|
|||||||
*/
|
*/
|
||||||
class TcModeReplay : public TcBase {
|
class TcModeReplay : public TcBase {
|
||||||
public:
|
public:
|
||||||
TcModeReplay(uint16_t sequenceCount) : TcBase(apid::TC_MODE_REPLAY, sequenceCount) {}
|
TcModeReplay(ploc::SpTcParams params, uint16_t sequenceCount)
|
||||||
|
: TcBase(params, apid::TC_MODE_REPLAY, sequenceCount) {}
|
||||||
ReturnValue_t createPacket() {
|
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
|
||||||
result = addCrc();
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
this->setPacketDataLength(static_cast<uint16_t>(CRC_SIZE - 1));
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -661,36 +644,32 @@ class TcModeReplay : public TcBase {
|
|||||||
*/
|
*/
|
||||||
class TcModeIdle : public TcBase {
|
class TcModeIdle : public TcBase {
|
||||||
public:
|
public:
|
||||||
TcModeIdle(uint16_t sequenceCount) : TcBase(apid::TC_MODE_IDLE, sequenceCount) {}
|
TcModeIdle(ploc::SpTcParams params, uint16_t sequenceCount)
|
||||||
|
: TcBase(params, apid::TC_MODE_IDLE, sequenceCount) {}
|
||||||
ReturnValue_t createPacket() {
|
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
|
||||||
result = addCrc();
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
this->setPacketDataLength(static_cast<uint16_t>(CRC_SIZE - 1));
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class TcCamcmdSend : public TcBase {
|
class TcCamcmdSend : public TcBase {
|
||||||
public:
|
public:
|
||||||
TcCamcmdSend(uint16_t sequenceCount) : TcBase(apid::TC_CAM_CMD_SEND, sequenceCount) {}
|
TcCamcmdSend(ploc::SpTcParams params, uint16_t sequenceCount)
|
||||||
|
: TcBase(params, apid::TC_CAM_CMD_SEND, sequenceCount) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
|
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
|
||||||
if (commandDataLen > MAX_DATA_LENGTH) {
|
if (commandDataLen > MAX_DATA_LENGTH) {
|
||||||
return INVALID_LENGTH;
|
return INVALID_LENGTH;
|
||||||
}
|
}
|
||||||
uint16_t dataLen = static_cast<uint16_t>(commandDataLen + sizeof(CARRIAGE_RETURN));
|
uint16_t dataLen = static_cast<uint16_t>(commandDataLen + sizeof(CARRIAGE_RETURN));
|
||||||
|
spParams.setPayloadLen(sizeof(dataLen) + commandDataLen + sizeof(CARRIAGE_RETURN));
|
||||||
|
auto res = checkPayloadLen();
|
||||||
|
if(res != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
size_t size = sizeof(dataLen);
|
size_t size = sizeof(dataLen);
|
||||||
SerializeAdapter::serialize(&dataLen, this->getPacketData(), &size, sizeof(dataLen),
|
SerializeAdapter::serialize(&dataLen, payloadStart, &size, sizeof(dataLen),
|
||||||
SerializeIF::Endianness::BIG);
|
SerializeIF::Endianness::BIG);
|
||||||
std::memcpy(this->getPacketData() + sizeof(dataLen), commandData, commandDataLen);
|
std::memcpy(payloadStart + sizeof(dataLen), commandData, commandDataLen);
|
||||||
*(this->getPacketData() + sizeof(dataLen) + commandDataLen) = CARRIAGE_RETURN;
|
*(payloadStart + sizeof(dataLen) + commandDataLen) = CARRIAGE_RETURN;
|
||||||
uint16_t trueLength = sizeof(dataLen) + commandDataLen + sizeof(CARRIAGE_RETURN) + CRC_SIZE;
|
|
||||||
this->setPacketDataLength(trueLength - 1);
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -19,6 +19,8 @@ PlocMPSoCHandler::PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid
|
|||||||
eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5);
|
eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5);
|
||||||
commandActionHelperQueue =
|
commandActionHelperQueue =
|
||||||
QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5);
|
QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5);
|
||||||
|
spParams.maxSize = sizeof(commandBuffer);
|
||||||
|
spParams.buf = commandBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlocMPSoCHandler::~PlocMPSoCHandler() {}
|
PlocMPSoCHandler::~PlocMPSoCHandler() {}
|
||||||
@ -206,6 +208,7 @@ ReturnValue_t PlocMPSoCHandler::buildTransitionDeviceCommand(DeviceCommandId_t*
|
|||||||
ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||||
const uint8_t* commandData,
|
const uint8_t* commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
|
spParams.buf = commandBuffer;
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
switch (deviceCommand) {
|
switch (deviceCommand) {
|
||||||
case (mpsoc::TC_MEM_WRITE): {
|
case (mpsoc::TC_MEM_WRITE): {
|
||||||
@ -286,16 +289,23 @@ void PlocMPSoCHandler::fillCommandAndReplyMap() {
|
|||||||
this->insertInReplyMap(mpsoc::ACK_REPORT, 3, nullptr, mpsoc::SIZE_ACK_REPORT);
|
this->insertInReplyMap(mpsoc::ACK_REPORT, 3, nullptr, mpsoc::SIZE_ACK_REPORT);
|
||||||
this->insertInReplyMap(mpsoc::EXE_REPORT, 3, nullptr, mpsoc::SIZE_EXE_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);
|
this->insertInReplyMap(mpsoc::TM_MEMORY_READ_REPORT, 2, nullptr, mpsoc::SIZE_TM_MEM_READ_REPORT);
|
||||||
this->insertInReplyMap(mpsoc::TM_CAM_CMD_RPT, 2, nullptr, SpacePacket::PACKET_MAX_SIZE);
|
this->insertInReplyMap(mpsoc::TM_CAM_CMD_RPT, 2, nullptr, mpsoc::SP_MAX_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
||||||
DeviceCommandId_t* foundId, size_t* foundLen) {
|
DeviceCommandId_t* foundId, size_t* foundLen) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
SpacePacket spacePacket;
|
SpacePacketReader spacePacket;
|
||||||
std::memcpy(spacePacket.getWholeData(), start, remainingSize);
|
spacePacket.setReadOnlyData(start, remainingSize);
|
||||||
uint16_t apid = spacePacket.getAPID();
|
if (spacePacket.isNull()) {
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
auto res = spacePacket.checkSize();
|
||||||
|
if (res != RETURN_OK) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
uint16_t apid = spacePacket.getApid();
|
||||||
|
|
||||||
switch (apid) {
|
switch (apid) {
|
||||||
case (mpsoc::apid::ACK_SUCCESS):
|
case (mpsoc::apid::ACK_SUCCESS):
|
||||||
@ -311,7 +321,7 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
|
|||||||
*foundId = mpsoc::TM_MEMORY_READ_REPORT;
|
*foundId = mpsoc::TM_MEMORY_READ_REPORT;
|
||||||
break;
|
break;
|
||||||
case (mpsoc::apid::TM_CAM_CMD_RPT):
|
case (mpsoc::apid::TM_CAM_CMD_RPT):
|
||||||
*foundLen = spacePacket.getFullSize();
|
*foundLen = spacePacket.getFullPacketLen();
|
||||||
tmCamCmdRpt.rememberSpacePacketSize = *foundLen;
|
tmCamCmdRpt.rememberSpacePacketSize = *foundLen;
|
||||||
*foundId = mpsoc::TM_CAM_CMD_RPT;
|
*foundId = mpsoc::TM_CAM_CMD_RPT;
|
||||||
break;
|
break;
|
||||||
@ -394,13 +404,13 @@ ReturnValue_t PlocMPSoCHandler::prepareTcMemWrite(const uint8_t* commandData,
|
|||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
sequenceCount++;
|
sequenceCount++;
|
||||||
mpsoc::TcMemWrite tcMemWrite(sequenceCount);
|
mpsoc::TcMemWrite tcMemWrite(spParams, sequenceCount);
|
||||||
result = tcMemWrite.createPacket(commandData, commandDataLen);
|
result = tcMemWrite.buildPacket(commandData, commandDataLen);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sequenceCount--;
|
sequenceCount--;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
copyToCommandBuffer(&tcMemWrite);
|
finishTcPrep();
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -408,13 +418,13 @@ ReturnValue_t PlocMPSoCHandler::prepareTcMemRead(const uint8_t* commandData,
|
|||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
sequenceCount++;
|
sequenceCount++;
|
||||||
mpsoc::TcMemRead tcMemRead(sequenceCount);
|
mpsoc::TcMemRead tcMemRead(spParams, sequenceCount);
|
||||||
result = tcMemRead.createPacket(commandData, commandDataLen);
|
result = tcMemRead.buildPacket(commandData, commandDataLen);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sequenceCount--;
|
sequenceCount--;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
copyToCommandBuffer(&tcMemRead);
|
finishTcPrep();
|
||||||
tmMemReadReport.rememberRequestedSize = tcMemRead.getMemLen() * 4 + TmMemReadReport::FIX_SIZE;
|
tmMemReadReport.rememberRequestedSize = tcMemRead.getMemLen() * 4 + TmMemReadReport::FIX_SIZE;
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
@ -426,14 +436,14 @@ ReturnValue_t PlocMPSoCHandler::prepareTcFlashDelete(const uint8_t* commandData,
|
|||||||
}
|
}
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
sequenceCount++;
|
sequenceCount++;
|
||||||
mpsoc::TcFlashDelete tcFlashDelete(sequenceCount);
|
mpsoc::TcFlashDelete tcFlashDelete(spParams, sequenceCount);
|
||||||
result = tcFlashDelete.createPacket(
|
result = tcFlashDelete.buildPacket(
|
||||||
std::string(reinterpret_cast<const char*>(commandData), commandDataLen));
|
std::string(reinterpret_cast<const char*>(commandData), commandDataLen));
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sequenceCount--;
|
sequenceCount--;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
copyToCommandBuffer(&tcFlashDelete);
|
finishTcPrep();
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -441,26 +451,26 @@ ReturnValue_t PlocMPSoCHandler::prepareTcReplayStart(const uint8_t* commandData,
|
|||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
sequenceCount++;
|
sequenceCount++;
|
||||||
mpsoc::TcReplayStart tcReplayStart(sequenceCount);
|
mpsoc::TcReplayStart tcReplayStart(spParams, sequenceCount);
|
||||||
result = tcReplayStart.createPacket(commandData, commandDataLen);
|
result = tcReplayStart.buildPacket(commandData, commandDataLen);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sequenceCount--;
|
sequenceCount--;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
copyToCommandBuffer(&tcReplayStart);
|
finishTcPrep();
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::prepareTcReplayStop() {
|
ReturnValue_t PlocMPSoCHandler::prepareTcReplayStop() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
sequenceCount++;
|
sequenceCount++;
|
||||||
mpsoc::TcReplayStop tcReplayStop(sequenceCount);
|
mpsoc::TcReplayStop tcReplayStop(spParams, sequenceCount);
|
||||||
result = tcReplayStop.createPacket();
|
result = tcReplayStop.buildPacket();
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sequenceCount--;
|
sequenceCount--;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
copyToCommandBuffer(&tcReplayStop);
|
finishTcPrep();
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -468,26 +478,26 @@ ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOn(const uint8_t* commandDat
|
|||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
sequenceCount++;
|
sequenceCount++;
|
||||||
mpsoc::TcDownlinkPwrOn tcDownlinkPwrOn(sequenceCount);
|
mpsoc::TcDownlinkPwrOn tcDownlinkPwrOn(spParams, sequenceCount);
|
||||||
result = tcDownlinkPwrOn.createPacket(commandData, commandDataLen);
|
result = tcDownlinkPwrOn.buildPacket(commandData, commandDataLen);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sequenceCount--;
|
sequenceCount--;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
copyToCommandBuffer(&tcDownlinkPwrOn);
|
finishTcPrep();
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOff() {
|
ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOff() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
sequenceCount++;
|
sequenceCount++;
|
||||||
mpsoc::TcDownlinkPwrOff tcDownlinkPwrOff(sequenceCount);
|
mpsoc::TcDownlinkPwrOff tcDownlinkPwrOff(spParams, sequenceCount);
|
||||||
result = tcDownlinkPwrOff.createPacket();
|
result = tcDownlinkPwrOff.buildPacket();
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sequenceCount--;
|
sequenceCount--;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
copyToCommandBuffer(&tcDownlinkPwrOff);
|
finishTcPrep();
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -495,45 +505,39 @@ ReturnValue_t PlocMPSoCHandler::prepareTcReplayWriteSequence(const uint8_t* comm
|
|||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
sequenceCount++;
|
sequenceCount++;
|
||||||
mpsoc::TcReplayWriteSeq tcReplayWriteSeq(sequenceCount);
|
mpsoc::TcReplayWriteSeq tcReplayWriteSeq(spParams, sequenceCount);
|
||||||
result = tcReplayWriteSeq.createPacket(commandData, commandDataLen);
|
result = tcReplayWriteSeq.buildPacket(commandData, commandDataLen);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sequenceCount--;
|
sequenceCount--;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
copyToCommandBuffer(&tcReplayWriteSeq);
|
finishTcPrep();
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::prepareTcModeReplay() {
|
ReturnValue_t PlocMPSoCHandler::prepareTcModeReplay() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
sequenceCount++;
|
sequenceCount++;
|
||||||
mpsoc::TcModeReplay tcModeReplay(sequenceCount);
|
mpsoc::TcModeReplay tcModeReplay(spParams, sequenceCount);
|
||||||
result = tcModeReplay.createPacket();
|
result = tcModeReplay.buildPacket();
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sequenceCount--;
|
sequenceCount--;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
memcpy(commandBuffer, tcModeReplay.getWholeData(), tcModeReplay.getFullSize());
|
finishTcPrep();
|
||||||
rawPacket = commandBuffer;
|
|
||||||
rawPacketLen = tcModeReplay.getFullSize();
|
|
||||||
nextReplyId = mpsoc::ACK_REPORT;
|
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::prepareTcModeIdle() {
|
ReturnValue_t PlocMPSoCHandler::prepareTcModeIdle() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
sequenceCount++;
|
sequenceCount++;
|
||||||
mpsoc::TcModeIdle tcModeIdle(sequenceCount);
|
mpsoc::TcModeIdle tcModeIdle(spParams, sequenceCount);
|
||||||
result = tcModeIdle.createPacket();
|
result = tcModeIdle.buildPacket();
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sequenceCount--;
|
sequenceCount--;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
memcpy(commandBuffer, tcModeIdle.getWholeData(), tcModeIdle.getFullSize());
|
finishTcPrep();
|
||||||
rawPacket = commandBuffer;
|
|
||||||
rawPacketLen = tcModeIdle.getFullSize();
|
|
||||||
nextReplyId = mpsoc::ACK_REPORT;
|
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -541,26 +545,18 @@ ReturnValue_t PlocMPSoCHandler::prepareTcCamCmdSend(const uint8_t* commandData,
|
|||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
sequenceCount++;
|
sequenceCount++;
|
||||||
mpsoc::TcCamcmdSend tcCamCmdSend(sequenceCount);
|
mpsoc::TcCamcmdSend tcCamCmdSend(spParams, sequenceCount);
|
||||||
result = tcCamCmdSend.createPacket(commandData, commandDataLen);
|
result = tcCamCmdSend.buildPacket(commandData, commandDataLen);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sequenceCount--;
|
sequenceCount--;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
copyToCommandBuffer(&tcCamCmdSend);
|
finishTcPrep();
|
||||||
nextReplyId = mpsoc::TM_CAM_CMD_RPT;
|
nextReplyId = mpsoc::TM_CAM_CMD_RPT;
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocMPSoCHandler::copyToCommandBuffer(mpsoc::TcBase* tc) {
|
void PlocMPSoCHandler::finishTcPrep() { nextReplyId = mpsoc::ACK_REPORT; }
|
||||||
if (tc == nullptr) {
|
|
||||||
sif::debug << "PlocMPSoCHandler::copyToCommandBuffer: Invalid TC" << std::endl;
|
|
||||||
}
|
|
||||||
memcpy(commandBuffer, tc->getWholeData(), tc->getFullSize());
|
|
||||||
rawPacket = commandBuffer;
|
|
||||||
rawPacketLen = tc->getFullSize();
|
|
||||||
nextReplyId = mpsoc::ACK_REPORT;
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::verifyPacket(const uint8_t* start, size_t foundLen) {
|
ReturnValue_t PlocMPSoCHandler::verifyPacket(const uint8_t* start, size_t foundLen) {
|
||||||
uint16_t receivedCrc = *(start + foundLen - 2) << 8 | *(start + foundLen - 1);
|
uint16_t receivedCrc = *(start + foundLen - 2) << 8 | *(start + foundLen - 1);
|
||||||
@ -677,12 +673,11 @@ ReturnValue_t PlocMPSoCHandler::handleMemoryReadReport(const uint8_t* data) {
|
|||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::handleCamCmdRpt(const uint8_t* data) {
|
ReturnValue_t PlocMPSoCHandler::handleCamCmdRpt(const uint8_t* data) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
SpacePacket packet;
|
|
||||||
std::memcpy(packet.getWholeData(), data, tmCamCmdRpt.rememberSpacePacketSize);
|
|
||||||
result = verifyPacket(data, tmCamCmdRpt.rememberSpacePacketSize);
|
result = verifyPacket(data, tmCamCmdRpt.rememberSpacePacketSize);
|
||||||
if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
|
if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
|
||||||
sif::warning << "PlocMPSoCHandler::handleCamCmdRpt: CRC failure" << std::endl;
|
sif::warning << "PlocMPSoCHandler::handleCamCmdRpt: CRC failure" << std::endl;
|
||||||
}
|
}
|
||||||
|
SpacePacketReader packetReader(data, tmCamCmdRpt.rememberSpacePacketSize);
|
||||||
const uint8_t* dataFieldPtr = data + mpsoc::SPACE_PACKET_HEADER_SIZE + sizeof(uint16_t);
|
const uint8_t* dataFieldPtr = data + mpsoc::SPACE_PACKET_HEADER_SIZE + sizeof(uint16_t);
|
||||||
std::string camCmdRptMsg(
|
std::string camCmdRptMsg(
|
||||||
reinterpret_cast<const char*>(dataFieldPtr),
|
reinterpret_cast<const char*>(dataFieldPtr),
|
||||||
@ -693,8 +688,8 @@ ReturnValue_t PlocMPSoCHandler::handleCamCmdRpt(const uint8_t* data) {
|
|||||||
sif::info << "PlocMPSoCHandler: CamCmdRpt Ack value: 0x" << std::hex
|
sif::info << "PlocMPSoCHandler: CamCmdRpt Ack value: 0x" << std::hex
|
||||||
<< static_cast<unsigned int>(ackValue) << std::endl;
|
<< static_cast<unsigned int>(ackValue) << std::endl;
|
||||||
#endif /* OBSW_DEBUG_PLOC_MPSOC == 1 */
|
#endif /* OBSW_DEBUG_PLOC_MPSOC == 1 */
|
||||||
handleDeviceTM(packet.getPacketData() + sizeof(uint16_t), packet.getPacketDataLength() - 1,
|
handleDeviceTM(packetReader.getPacketData() + sizeof(uint16_t),
|
||||||
mpsoc::TM_CAM_CMD_RPT);
|
packetReader.getPacketDataLen() - 1, mpsoc::TM_CAM_CMD_RPT);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -818,7 +813,7 @@ size_t PlocMPSoCHandler::getNextReplyLength(DeviceCommandId_t commandId) {
|
|||||||
case mpsoc::TM_CAM_CMD_RPT:
|
case mpsoc::TM_CAM_CMD_RPT:
|
||||||
// Read acknowledgment, camera and execution report in one go because length of camera
|
// Read acknowledgment, camera and execution report in one go because length of camera
|
||||||
// report is not fixed
|
// report is not fixed
|
||||||
replyLen = SpacePacket::PACKET_MAX_SIZE;
|
replyLen = mpsoc::SP_MAX_SIZE;
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
replyLen = iter->second.replyLen;
|
replyLen = iter->second.replyLen;
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#include "fsfw/action/CommandsActionsIF.h"
|
#include "fsfw/action/CommandsActionsIF.h"
|
||||||
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
|
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
|
||||||
#include "fsfw/ipc/QueueFactory.h"
|
#include "fsfw/ipc/QueueFactory.h"
|
||||||
#include "fsfw/tmtcpacket/SpacePacket.h"
|
|
||||||
#include "fsfw/tmtcservices/SourceSequenceCounter.h"
|
#include "fsfw/tmtcservices/SourceSequenceCounter.h"
|
||||||
#include "fsfw_hal/linux/gpio/Gpio.h"
|
#include "fsfw_hal/linux/gpio/Gpio.h"
|
||||||
#include "fsfw_hal/linux/uart/UartComIF.h"
|
#include "fsfw_hal/linux/uart/UartComIF.h"
|
||||||
@ -111,10 +110,11 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
|
|||||||
// Initiate the sequence count with the maximum value. It is incremented before
|
// Initiate the sequence count with the maximum value. It is incremented before
|
||||||
// a packet is sent, so the first value will be 0 accordingly using
|
// a packet is sent, so the first value will be 0 accordingly using
|
||||||
// the wrap around of the counter.
|
// the wrap around of the counter.
|
||||||
SourceSequenceCounter sequenceCount =
|
SourceSequenceCounter sequenceCount = SourceSequenceCounter(ccsds::LIMIT_SEQUENCE_COUNT - 1);
|
||||||
SourceSequenceCounter(SpacePacketBase::LIMIT_SEQUENCE_COUNT - 1);
|
|
||||||
|
|
||||||
uint8_t commandBuffer[mpsoc::MAX_COMMAND_SIZE];
|
uint8_t commandBuffer[mpsoc::MAX_COMMAND_SIZE];
|
||||||
|
SpacePacketCreator creator;
|
||||||
|
ploc::SpTcParams spParams = ploc::SpTcParams(creator);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This variable is used to store the id of the next reply to receive. This is necessary
|
* This variable is used to store the id of the next reply to receive. This is necessary
|
||||||
@ -148,7 +148,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
|
|||||||
|
|
||||||
struct TelemetryBuffer {
|
struct TelemetryBuffer {
|
||||||
uint16_t length = 0;
|
uint16_t length = 0;
|
||||||
uint8_t buffer[SpacePacket::PACKET_MAX_SIZE];
|
uint8_t buffer[mpsoc::SP_MAX_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
TelemetryBuffer tmBuffer;
|
TelemetryBuffer tmBuffer;
|
||||||
@ -172,10 +172,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
|
|||||||
ReturnValue_t prepareTcReplayWriteSequence(const uint8_t* commandData, size_t commandDataLen);
|
ReturnValue_t prepareTcReplayWriteSequence(const uint8_t* commandData, size_t commandDataLen);
|
||||||
ReturnValue_t prepareTcCamCmdSend(const uint8_t* commandData, size_t commandDataLen);
|
ReturnValue_t prepareTcCamCmdSend(const uint8_t* commandData, size_t commandDataLen);
|
||||||
ReturnValue_t prepareTcModeIdle();
|
ReturnValue_t prepareTcModeIdle();
|
||||||
/**
|
void finishTcPrep();
|
||||||
* @brief Copies space packet into command buffer
|
|
||||||
*/
|
|
||||||
void copyToCommandBuffer(mpsoc::TcBase* tc);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function checks the crc of the received PLOC reply.
|
* @brief This function checks the crc of the received PLOC reply.
|
||||||
|
@ -10,7 +10,12 @@
|
|||||||
|
|
||||||
#include "mission/utility/Timestamp.h"
|
#include "mission/utility/Timestamp.h"
|
||||||
|
|
||||||
PlocMPSoCHelper::PlocMPSoCHelper(object_id_t objectId) : SystemObject(objectId) {}
|
using namespace ploc;
|
||||||
|
|
||||||
|
PlocMPSoCHelper::PlocMPSoCHelper(object_id_t objectId) : SystemObject(objectId) {
|
||||||
|
spParams.buf = commandBuffer;
|
||||||
|
spParams.maxSize = sizeof(commandBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
PlocMPSoCHelper::~PlocMPSoCHelper() {}
|
PlocMPSoCHelper::~PlocMPSoCHelper() {}
|
||||||
|
|
||||||
@ -99,6 +104,7 @@ ReturnValue_t PlocMPSoCHelper::startFlashWrite(std::string obcFile, std::string
|
|||||||
ReturnValue_t PlocMPSoCHelper::resetHelper() {
|
ReturnValue_t PlocMPSoCHelper::resetHelper() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
semaphore.release();
|
semaphore.release();
|
||||||
|
spParams.buf = commandBuffer;
|
||||||
terminate = false;
|
terminate = false;
|
||||||
result = uartComIF->flushUartRxBuffer(comCookie);
|
result = uartComIF->flushUartRxBuffer(comCookie);
|
||||||
return result;
|
return result;
|
||||||
@ -138,8 +144,11 @@ ReturnValue_t PlocMPSoCHelper::performFlashWrite() {
|
|||||||
return FILE_CLOSED_ACCIDENTALLY;
|
return FILE_CLOSED_ACCIDENTALLY;
|
||||||
}
|
}
|
||||||
(*sequenceCount)++;
|
(*sequenceCount)++;
|
||||||
mpsoc::TcFlashWrite tc(*sequenceCount);
|
mpsoc::TcFlashWrite tc(spParams, *sequenceCount);
|
||||||
tc.createPacket(tempData, dataLength);
|
result = tc.buildPacket(tempData, dataLength);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
result = handlePacketTransmission(tc);
|
result = handlePacketTransmission(tc);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
@ -154,8 +163,9 @@ ReturnValue_t PlocMPSoCHelper::performFlashWrite() {
|
|||||||
|
|
||||||
ReturnValue_t PlocMPSoCHelper::flashfopen() {
|
ReturnValue_t PlocMPSoCHelper::flashfopen() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
spParams.buf = commandBuffer;
|
||||||
(*sequenceCount)++;
|
(*sequenceCount)++;
|
||||||
mpsoc::FlashFopen flashFopen(*sequenceCount);
|
mpsoc::FlashFopen flashFopen(spParams, *sequenceCount);
|
||||||
result = flashFopen.createPacket(flashWrite.mpsocFile, mpsoc::FlashFopen::APPEND);
|
result = flashFopen.createPacket(flashWrite.mpsocFile, mpsoc::FlashFopen::APPEND);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
@ -169,8 +179,9 @@ ReturnValue_t PlocMPSoCHelper::flashfopen() {
|
|||||||
|
|
||||||
ReturnValue_t PlocMPSoCHelper::flashfclose() {
|
ReturnValue_t PlocMPSoCHelper::flashfclose() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
spParams.buf = commandBuffer;
|
||||||
(*sequenceCount)++;
|
(*sequenceCount)++;
|
||||||
mpsoc::FlashFclose flashFclose(*sequenceCount);
|
mpsoc::FlashFclose flashFclose(spParams, *sequenceCount);
|
||||||
result = flashFclose.createPacket(flashWrite.mpsocFile);
|
result = flashFclose.createPacket(flashWrite.mpsocFile);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
@ -182,7 +193,7 @@ ReturnValue_t PlocMPSoCHelper::flashfclose() {
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHelper::handlePacketTransmission(mpsoc::TcBase& tc) {
|
ReturnValue_t PlocMPSoCHelper::handlePacketTransmission(ploc::SpTcBase& tc) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
result = sendCommand(tc);
|
result = sendCommand(tc);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
@ -199,9 +210,9 @@ ReturnValue_t PlocMPSoCHelper::handlePacketTransmission(mpsoc::TcBase& tc) {
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHelper::sendCommand(mpsoc::TcBase& tc) {
|
ReturnValue_t PlocMPSoCHelper::sendCommand(ploc::SpTcBase& tc) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
result = uartComIF->sendMessage(comCookie, tc.getWholeData(), tc.getFullSize());
|
result = uartComIF->sendMessage(comCookie, tc.getFullPacket(), tc.getFullPacketLen());
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::warning << "PlocMPSoCHelper::sendCommand: Failed to send command" << std::endl;
|
sif::warning << "PlocMPSoCHelper::sendCommand: Failed to send command" << std::endl;
|
||||||
triggerEvent(MPSOC_SENDING_COMMAND_FAILED, result, static_cast<uint32_t>(internalState));
|
triggerEvent(MPSOC_SENDING_COMMAND_FAILED, result, static_cast<uint32_t>(internalState));
|
||||||
@ -212,12 +223,16 @@ ReturnValue_t PlocMPSoCHelper::sendCommand(mpsoc::TcBase& tc) {
|
|||||||
|
|
||||||
ReturnValue_t PlocMPSoCHelper::handleAck() {
|
ReturnValue_t PlocMPSoCHelper::handleAck() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
mpsoc::TmPacket tmPacket;
|
result = handleTmReception(mpsoc::SIZE_ACK_REPORT);
|
||||||
result = handleTmReception(&tmPacket, mpsoc::SIZE_ACK_REPORT);
|
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
uint16_t apid = tmPacket.getAPID();
|
SpTmReader tmPacket(tmBuf.data(), tmBuf.size());
|
||||||
|
result = checkReceivedTm(tmPacket);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
uint16_t apid = tmPacket.getApid();
|
||||||
if (apid != mpsoc::apid::ACK_SUCCESS) {
|
if (apid != mpsoc::apid::ACK_SUCCESS) {
|
||||||
handleAckApidFailure(apid);
|
handleAckApidFailure(apid);
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
@ -239,12 +254,17 @@ void PlocMPSoCHelper::handleAckApidFailure(uint16_t apid) {
|
|||||||
|
|
||||||
ReturnValue_t PlocMPSoCHelper::handleExe() {
|
ReturnValue_t PlocMPSoCHelper::handleExe() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
mpsoc::TmPacket tmPacket;
|
|
||||||
result = handleTmReception(&tmPacket, mpsoc::SIZE_EXE_REPORT);
|
result = handleTmReception(mpsoc::SIZE_EXE_REPORT);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
uint16_t apid = tmPacket.getAPID();
|
ploc::SpTmReader tmPacket(tmBuf.data(), tmBuf.size());
|
||||||
|
result = checkReceivedTm(tmPacket);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
uint16_t apid = tmPacket.getApid();
|
||||||
if (apid != mpsoc::apid::EXE_SUCCESS) {
|
if (apid != mpsoc::apid::EXE_SUCCESS) {
|
||||||
handleExeApidFailure(apid);
|
handleExeApidFailure(apid);
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
@ -264,12 +284,12 @@ void PlocMPSoCHelper::handleExeApidFailure(uint16_t apid) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHelper::handleTmReception(mpsoc::TmPacket* tmPacket, size_t remainingBytes) {
|
ReturnValue_t PlocMPSoCHelper::handleTmReception(size_t remainingBytes) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
size_t readBytes = 0;
|
size_t readBytes = 0;
|
||||||
size_t currentBytes = 0;
|
size_t currentBytes = 0;
|
||||||
for (int retries = 0; retries < RETRIES; retries++) {
|
for (int retries = 0; retries < RETRIES; retries++) {
|
||||||
result = receive(tmPacket->getWholeData() + readBytes, ¤tBytes, remainingBytes);
|
result = receive(tmBuf.data() + readBytes, ¤tBytes, remainingBytes);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -284,18 +304,30 @@ ReturnValue_t PlocMPSoCHelper::handleTmReception(mpsoc::TmPacket* tmPacket, size
|
|||||||
triggerEvent(MPSOC_MISSING_EXE, remainingBytes, static_cast<uint32_t>(internalState));
|
triggerEvent(MPSOC_MISSING_EXE, remainingBytes, static_cast<uint32_t>(internalState));
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
result = tmPacket->checkCrc();
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t PlocMPSoCHelper::checkReceivedTm(SpTmReader& reader) {
|
||||||
|
ReturnValue_t result = reader.checkSize();
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
sif::error << "PlocMPSoCHelper::handleTmReception: Size check on received TM failed"
|
||||||
|
<< std::endl;
|
||||||
|
triggerEvent(MPSOC_TM_SIZE_ERROR);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
reader.checkCrc();
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::warning << "PlocMPSoCHelper::handleTmReception: CRC check failed" << std::endl;
|
sif::warning << "PlocMPSoCHelper::handleTmReception: CRC check failed" << std::endl;
|
||||||
|
triggerEvent(MPSOC_TM_CRC_MISSMATCH, *sequenceCount);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
(*sequenceCount)++;
|
(*sequenceCount)++;
|
||||||
uint16_t recvSeqCnt = tmPacket->getPacketSequenceCount();
|
uint16_t recvSeqCnt = reader.getSequenceCount();
|
||||||
if (recvSeqCnt != *sequenceCount) {
|
if (recvSeqCnt != *sequenceCount) {
|
||||||
triggerEvent(MPSOC_HELPER_SEQ_CNT_MISMATCH, *sequenceCount, recvSeqCnt);
|
triggerEvent(MPSOC_HELPER_SEQ_CNT_MISMATCH, *sequenceCount, recvSeqCnt);
|
||||||
*sequenceCount = recvSeqCnt;
|
*sequenceCount = recvSeqCnt;
|
||||||
}
|
}
|
||||||
return result;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHelper::receive(uint8_t* data, size_t* readBytes, size_t requestBytes) {
|
ReturnValue_t PlocMPSoCHelper::receive(uint8_t* data, size_t* readBytes, size_t requestBytes) {
|
||||||
|
@ -67,6 +67,8 @@ class PlocMPSoCHelper : public SystemObject, public ExecutableObjectIF, public H
|
|||||||
//! P1: Expected sequence count
|
//! P1: Expected sequence count
|
||||||
//! P2: Received sequence count
|
//! P2: Received sequence count
|
||||||
static const Event MPSOC_HELPER_SEQ_CNT_MISMATCH = MAKE_EVENT(11, severity::LOW);
|
static const Event MPSOC_HELPER_SEQ_CNT_MISMATCH = MAKE_EVENT(11, severity::LOW);
|
||||||
|
static const Event MPSOC_TM_SIZE_ERROR = MAKE_EVENT(12, severity::LOW);
|
||||||
|
static const Event MPSOC_TM_CRC_MISSMATCH = MAKE_EVENT(13, severity::LOW);
|
||||||
|
|
||||||
PlocMPSoCHelper(object_id_t objectId);
|
PlocMPSoCHelper(object_id_t objectId);
|
||||||
virtual ~PlocMPSoCHelper();
|
virtual ~PlocMPSoCHelper();
|
||||||
@ -123,6 +125,10 @@ class PlocMPSoCHelper : public SystemObject, public ExecutableObjectIF, public H
|
|||||||
SdCardManager* sdcMan = nullptr;
|
SdCardManager* sdcMan = nullptr;
|
||||||
#endif
|
#endif
|
||||||
uint8_t commandBuffer[mpsoc::MAX_COMMAND_SIZE];
|
uint8_t commandBuffer[mpsoc::MAX_COMMAND_SIZE];
|
||||||
|
SpacePacketCreator creator;
|
||||||
|
ploc::SpTcParams spParams = ploc::SpTcParams(creator);
|
||||||
|
|
||||||
|
std::array<uint8_t, mpsoc::MAX_REPLY_SIZE> tmBuf;
|
||||||
|
|
||||||
bool terminate = false;
|
bool terminate = false;
|
||||||
|
|
||||||
@ -134,20 +140,21 @@ class PlocMPSoCHelper : public SystemObject, public ExecutableObjectIF, public H
|
|||||||
// Communication cookie. Must be set by the MPSoC Handler
|
// Communication cookie. Must be set by the MPSoC Handler
|
||||||
CookieIF* comCookie = nullptr;
|
CookieIF* comCookie = nullptr;
|
||||||
// Sequence count, must be set by Ploc MPSoC Handler
|
// Sequence count, must be set by Ploc MPSoC Handler
|
||||||
SourceSequenceCounter* sequenceCount;
|
SourceSequenceCounter* sequenceCount = nullptr;
|
||||||
|
|
||||||
ReturnValue_t resetHelper();
|
ReturnValue_t resetHelper();
|
||||||
ReturnValue_t performFlashWrite();
|
ReturnValue_t performFlashWrite();
|
||||||
ReturnValue_t flashfopen();
|
ReturnValue_t flashfopen();
|
||||||
ReturnValue_t flashfclose();
|
ReturnValue_t flashfclose();
|
||||||
ReturnValue_t handlePacketTransmission(mpsoc::TcBase& tc);
|
ReturnValue_t handlePacketTransmission(ploc::SpTcBase& tc);
|
||||||
ReturnValue_t sendCommand(mpsoc::TcBase& tc);
|
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* readBytes, size_t requestBytes);
|
||||||
ReturnValue_t handleAck();
|
ReturnValue_t handleAck();
|
||||||
ReturnValue_t handleExe();
|
ReturnValue_t handleExe();
|
||||||
void handleAckApidFailure(uint16_t apid);
|
void handleAckApidFailure(uint16_t apid);
|
||||||
void handleExeApidFailure(uint16_t apid);
|
void handleExeApidFailure(uint16_t apid);
|
||||||
ReturnValue_t handleTmReception(mpsoc::TmPacket* tmPacket, size_t remainingBytes);
|
ReturnValue_t handleTmReception(size_t remainingBytes);
|
||||||
|
ReturnValue_t checkReceivedTm(ploc::SpTmReader& reader);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* BSP_Q7S_DEVICES_PLOCMPSOCHELPER_H_ */
|
#endif /* BSP_Q7S_DEVICES_PLOCMPSOCHELPER_H_ */
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
#include "fsfw/objectmanager/SystemObject.h"
|
#include "fsfw/objectmanager/SystemObject.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||||
#include "fsfw/tmtcpacket/SpacePacket.h"
|
|
||||||
#include "linux/fsfwconfig/objects/systemObjectList.h"
|
#include "linux/fsfwconfig/objects/systemObjectList.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,6 +28,11 @@ PlocSupervisorHandler::PlocSupervisorHandler(object_id_t objectId, object_id_t u
|
|||||||
if (comCookie == NULL) {
|
if (comCookie == NULL) {
|
||||||
sif::error << "PlocSupervisorHandler: Invalid com cookie" << std::endl;
|
sif::error << "PlocSupervisorHandler: Invalid com cookie" << std::endl;
|
||||||
}
|
}
|
||||||
|
if (supvHelper == nullptr) {
|
||||||
|
sif::error << "PlocSupervisorHandler: Invalid PlocSupvHelper object" << std::endl;
|
||||||
|
}
|
||||||
|
spParams.buf = commandBuffer;
|
||||||
|
spParams.maxSize = sizeof(commandBuffer);
|
||||||
eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5);
|
eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,6 +159,7 @@ void PlocSupervisorHandler::doStartUp() {
|
|||||||
uartIsolatorSwitch.pullHigh();
|
uartIsolatorSwitch.pullHigh();
|
||||||
startupState = StartupState::SET_TIME;
|
startupState = StartupState::SET_TIME;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case StartupState::SET_TIME_EXECUTING:
|
case StartupState::SET_TIME_EXECUTING:
|
||||||
break;
|
break;
|
||||||
@ -194,6 +200,7 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
|
|||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
using namespace supv;
|
using namespace supv;
|
||||||
ReturnValue_t result = RETURN_FAILED;
|
ReturnValue_t result = RETURN_FAILED;
|
||||||
|
spParams.buf = commandBuffer;
|
||||||
switch (deviceCommand) {
|
switch (deviceCommand) {
|
||||||
case GET_HK_REPORT: {
|
case GET_HK_REPORT: {
|
||||||
prepareEmptyCmd(APID_GET_HK_REPORT);
|
prepareEmptyCmd(APID_GET_HK_REPORT);
|
||||||
@ -314,21 +321,30 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FACTORY_RESET_CLEAR_ALL: {
|
case FACTORY_RESET_CLEAR_ALL: {
|
||||||
FactoryReset packet(FactoryReset::Op::CLEAR_ALL);
|
FactoryReset packet(spParams);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
result = packet.buildPacket(FactoryReset::Op::CLEAR_ALL);
|
||||||
result = RETURN_OK;
|
if (result != RETURN_OK) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FACTORY_RESET_CLEAR_MIRROR: {
|
case FACTORY_RESET_CLEAR_MIRROR: {
|
||||||
FactoryReset packet(FactoryReset::Op::MIRROR_ENTRIES);
|
FactoryReset packet(spParams);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
result = packet.buildPacket(FactoryReset::Op::MIRROR_ENTRIES);
|
||||||
result = RETURN_OK;
|
if (result != RETURN_OK) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FACTORY_RESET_CLEAR_CIRCULAR: {
|
case FACTORY_RESET_CLEAR_CIRCULAR: {
|
||||||
FactoryReset packet(FactoryReset::Op::CIRCULAR_ENTRIES);
|
FactoryReset packet(spParams);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
result = packet.buildPacket(FactoryReset::Op::CIRCULAR_ENTRIES);
|
||||||
result = RETURN_OK;
|
if (result != RETURN_OK) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case START_MPSOC_QUIET: {
|
case START_MPSOC_QUIET: {
|
||||||
@ -347,34 +363,49 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ENABLE_AUTO_TM: {
|
case ENABLE_AUTO_TM: {
|
||||||
EnableAutoTm packet;
|
EnableAutoTm packet(spParams);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
result = packet.buildPacket();
|
||||||
result = RETURN_OK;
|
if (result != RETURN_OK) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DISABLE_AUTO_TM: {
|
case DISABLE_AUTO_TM: {
|
||||||
DisableAutoTm packet;
|
DisableAutoTm packet(spParams);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
result = packet.buildPacket();
|
||||||
result = RETURN_OK;
|
if (result != RETURN_OK) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LOGGING_REQUEST_COUNTERS: {
|
case LOGGING_REQUEST_COUNTERS: {
|
||||||
RequestLoggingData packet(RequestLoggingData::Sa::REQUEST_COUNTERS);
|
RequestLoggingData packet(spParams);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
result = packet.buildPacket(RequestLoggingData::Sa::REQUEST_COUNTERS);
|
||||||
result = RETURN_OK;
|
if (result != RETURN_OK) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LOGGING_CLEAR_COUNTERS: {
|
case LOGGING_CLEAR_COUNTERS: {
|
||||||
RequestLoggingData packet(RequestLoggingData::Sa::CLEAR_COUNTERS);
|
RequestLoggingData packet(spParams);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
result = packet.buildPacket(RequestLoggingData::Sa::CLEAR_COUNTERS);
|
||||||
result = RETURN_OK;
|
if (result != RETURN_OK) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LOGGING_SET_TOPIC: {
|
case LOGGING_SET_TOPIC: {
|
||||||
uint8_t tpc = *(commandData);
|
uint8_t tpc = *(commandData);
|
||||||
RequestLoggingData packet(RequestLoggingData::Sa::SET_LOGGING_TOPIC, tpc);
|
RequestLoggingData packet(spParams);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
result = packet.buildPacket(RequestLoggingData::Sa::SET_LOGGING_TOPIC, tpc);
|
||||||
result = RETURN_OK;
|
if (result != RETURN_OK) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case RESET_PL: {
|
case RESET_PL: {
|
||||||
@ -874,8 +905,11 @@ ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) {
|
|||||||
using namespace supv;
|
using namespace supv;
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
AcknowledgmentReport ack;
|
AcknowledgmentReport ack(data, SIZE_ACK_REPORT);
|
||||||
ack.addWholeData(data, SIZE_ACK_REPORT);
|
result = ack.checkSize();
|
||||||
|
if(result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
result = ack.checkCrc();
|
result = ack.checkCrc();
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
@ -928,8 +962,11 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data)
|
|||||||
using namespace supv;
|
using namespace supv;
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
ExecutionReport exe;
|
ExecutionReport exe(data, SIZE_EXE_REPORT);
|
||||||
exe.addWholeData(data, SIZE_EXE_REPORT);
|
result = exe.checkSize();
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
result = exe.checkCrc();
|
result = exe.checkCrc();
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
@ -1354,15 +1391,25 @@ void PlocSupervisorHandler::handleDeviceTM(const uint8_t* data, size_t dataSize,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::prepareEmptyCmd(uint16_t apid) {
|
ReturnValue_t PlocSupervisorHandler::prepareEmptyCmd(uint16_t apid) {
|
||||||
supv::ApidOnlyPacket packet(apid);
|
supv::ApidOnlyPacket packet(spParams, apid);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
ReturnValue_t result = packet.buildPacket();
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::prepareSelBootImageCmd(const uint8_t* commandData) {
|
ReturnValue_t PlocSupervisorHandler::prepareSelBootImageCmd(const uint8_t* commandData) {
|
||||||
supv::MPSoCBootSelect packet(*commandData, *(commandData + 1), *(commandData + 2),
|
supv::MPSoCBootSelect packet(spParams);
|
||||||
*(commandData + 3));
|
ReturnValue_t result =
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
packet.buildPacket(*commandData, *(commandData + 1), *(commandData + 2), *(commandData + 3));
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::prepareSetTimeRefCmd() {
|
ReturnValue_t PlocSupervisorHandler::prepareSetTimeRefCmd() {
|
||||||
@ -1373,27 +1420,46 @@ ReturnValue_t PlocSupervisorHandler::prepareSetTimeRefCmd() {
|
|||||||
<< std::endl;
|
<< std::endl;
|
||||||
return SupvReturnValuesIF::GET_TIME_FAILURE;
|
return SupvReturnValuesIF::GET_TIME_FAILURE;
|
||||||
}
|
}
|
||||||
supv::SetTimeRef packet(&time);
|
supv::SetTimeRef packet(spParams);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
result = packet.buildPacket(&time);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::prepareDisableHk() {
|
ReturnValue_t PlocSupervisorHandler::prepareDisableHk() {
|
||||||
supv::DisablePeriodicHkTransmission packet;
|
supv::DisablePeriodicHkTransmission packet(spParams);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
ReturnValue_t result = packet.buildPacket();
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::prepareSetBootTimeoutCmd(const uint8_t* commandData) {
|
ReturnValue_t PlocSupervisorHandler::prepareSetBootTimeoutCmd(const uint8_t* commandData) {
|
||||||
|
supv::SetBootTimeout packet(spParams);
|
||||||
uint32_t timeout = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8 |
|
uint32_t timeout = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8 |
|
||||||
*(commandData + 3);
|
*(commandData + 3);
|
||||||
supv::SetBootTimeout packet(timeout);
|
ReturnValue_t result = packet.buildPacket(timeout);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::prepareRestartTriesCmd(const uint8_t* commandData) {
|
ReturnValue_t PlocSupervisorHandler::prepareRestartTriesCmd(const uint8_t* commandData) {
|
||||||
uint8_t restartTries = *(commandData);
|
uint8_t restartTries = *(commandData);
|
||||||
supv::SetRestartTries packet(restartTries);
|
supv::SetRestartTries packet(spParams);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
ReturnValue_t result = packet.buildPacket(restartTries);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::prepareLatchupConfigCmd(const uint8_t* commandData,
|
ReturnValue_t PlocSupervisorHandler::prepareLatchupConfigCmd(const uint8_t* commandData,
|
||||||
@ -1405,13 +1471,21 @@ ReturnValue_t PlocSupervisorHandler::prepareLatchupConfigCmd(const uint8_t* comm
|
|||||||
}
|
}
|
||||||
switch (deviceCommand) {
|
switch (deviceCommand) {
|
||||||
case (supv::ENABLE_LATCHUP_ALERT): {
|
case (supv::ENABLE_LATCHUP_ALERT): {
|
||||||
supv::LatchupAlert packet(true, latchupId);
|
supv::LatchupAlert packet(spParams);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
result = packet.buildPacket(true, latchupId);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (supv::DISABLE_LATCHUP_ALERT): {
|
case (supv::DISABLE_LATCHUP_ALERT): {
|
||||||
supv::LatchupAlert packet(false, latchupId);
|
supv::LatchupAlert packet(spParams);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
result = packet.buildPacket(false, latchupId);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
@ -1433,31 +1507,50 @@ ReturnValue_t PlocSupervisorHandler::prepareSetAlertLimitCmd(const uint8_t* comm
|
|||||||
if (latchupId > 6) {
|
if (latchupId > 6) {
|
||||||
return SupvReturnValuesIF::INVALID_LATCHUP_ID;
|
return SupvReturnValuesIF::INVALID_LATCHUP_ID;
|
||||||
}
|
}
|
||||||
supv::SetAlertlimit packet(latchupId, dutycycle);
|
supv::SetAlertlimit packet(spParams);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
ReturnValue_t result = packet.buildPacket(latchupId, dutycycle);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::prepareSetAdcEnabledChannelsCmd(const uint8_t* commandData) {
|
ReturnValue_t PlocSupervisorHandler::prepareSetAdcEnabledChannelsCmd(const uint8_t* commandData) {
|
||||||
uint16_t ch = *(commandData) << 8 | *(commandData + 1);
|
uint16_t ch = *(commandData) << 8 | *(commandData + 1);
|
||||||
supv::SetAdcEnabledChannels packet(ch);
|
supv::SetAdcEnabledChannels packet(spParams);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
ReturnValue_t result = packet.buildPacket(ch);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::prepareSetAdcWindowAndStrideCmd(const uint8_t* commandData) {
|
ReturnValue_t PlocSupervisorHandler::prepareSetAdcWindowAndStrideCmd(const uint8_t* commandData) {
|
||||||
uint8_t offset = 0;
|
uint8_t offset = 0;
|
||||||
uint16_t windowSize = *(commandData + offset) << 8 | *(commandData + offset + 1);
|
uint16_t windowSize = *(commandData + offset) << 8 | *(commandData + offset + 1);
|
||||||
offset += 2;
|
offset += 2;
|
||||||
uint16_t stridingStepSize = *(commandData + offset) << 8 | *(commandData + offset + 1);
|
uint16_t stridingStepSize = *(commandData + offset) << 8 | *(commandData + offset + 1);
|
||||||
supv::SetAdcWindowAndStride packet(windowSize, stridingStepSize);
|
supv::SetAdcWindowAndStride packet(spParams);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
ReturnValue_t result = packet.buildPacket(windowSize, stridingStepSize);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::prepareSetAdcThresholdCmd(const uint8_t* commandData) {
|
ReturnValue_t PlocSupervisorHandler::prepareSetAdcThresholdCmd(const uint8_t* commandData) {
|
||||||
uint32_t threshold = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8 |
|
uint32_t threshold = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8 |
|
||||||
*(commandData + 3);
|
*(commandData + 3);
|
||||||
supv::SetAdcThreshold packet(threshold);
|
supv::SetAdcThreshold packet(spParams);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
ReturnValue_t result = packet.buildPacket(threshold);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::prepareRunAutoEmTest(const uint8_t* commandData) {
|
ReturnValue_t PlocSupervisorHandler::prepareRunAutoEmTest(const uint8_t* commandData) {
|
||||||
@ -1465,8 +1558,12 @@ ReturnValue_t PlocSupervisorHandler::prepareRunAutoEmTest(const uint8_t* command
|
|||||||
if (test != 1 && test != 2) {
|
if (test != 1 && test != 2) {
|
||||||
return SupvReturnValuesIF::INVALID_TEST_PARAM;
|
return SupvReturnValuesIF::INVALID_TEST_PARAM;
|
||||||
}
|
}
|
||||||
supv::RunAutoEmTests packet(test);
|
supv::RunAutoEmTests packet(spParams);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
ReturnValue_t result = packet.buildPacket(test);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1479,8 +1576,12 @@ ReturnValue_t PlocSupervisorHandler::prepareWipeMramCmd(const uint8_t* commandDa
|
|||||||
if ((stop - start) <= 0) {
|
if ((stop - start) <= 0) {
|
||||||
return SupvReturnValuesIF::INVALID_MRAM_ADDRESSES;
|
return SupvReturnValuesIF::INVALID_MRAM_ADDRESSES;
|
||||||
}
|
}
|
||||||
supv::MramCmd packet(start, stop, supv::MramCmd::MramAction::WIPE);
|
supv::MramCmd packet(spParams);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
ReturnValue_t result = packet.buildPacket(start, stop, supv::MramCmd::MramAction::WIPE);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1490,42 +1591,52 @@ ReturnValue_t PlocSupervisorHandler::prepareDumpMramCmd(const uint8_t* commandDa
|
|||||||
size_t size = sizeof(start) + sizeof(stop);
|
size_t size = sizeof(start) + sizeof(stop);
|
||||||
SerializeAdapter::deSerialize(&start, &commandData, &size, SerializeIF::Endianness::BIG);
|
SerializeAdapter::deSerialize(&start, &commandData, &size, SerializeIF::Endianness::BIG);
|
||||||
SerializeAdapter::deSerialize(&stop, &commandData, &size, SerializeIF::Endianness::BIG);
|
SerializeAdapter::deSerialize(&stop, &commandData, &size, SerializeIF::Endianness::BIG);
|
||||||
supv::MramCmd packet(start, stop, supv::MramCmd::MramAction::DUMP);
|
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
|
||||||
if ((stop - start) <= 0) {
|
if ((stop - start) <= 0) {
|
||||||
return SupvReturnValuesIF::INVALID_MRAM_ADDRESSES;
|
return SupvReturnValuesIF::INVALID_MRAM_ADDRESSES;
|
||||||
}
|
}
|
||||||
|
supv::MramCmd packet(spParams);
|
||||||
|
ReturnValue_t result = packet.buildPacket(start, stop, supv::MramCmd::MramAction::DUMP);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
expectedMramDumpPackets = (stop - start) / supv::MAX_DATA_CAPACITY;
|
expectedMramDumpPackets = (stop - start) / supv::MAX_DATA_CAPACITY;
|
||||||
if ((stop - start) % supv::MAX_DATA_CAPACITY) {
|
if ((stop - start) % supv::MAX_DATA_CAPACITY) {
|
||||||
expectedMramDumpPackets++;
|
expectedMramDumpPackets++;
|
||||||
}
|
}
|
||||||
receivedMramDumpPackets = 0;
|
receivedMramDumpPackets = 0;
|
||||||
|
|
||||||
|
finishTcPrep();
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::prepareSetGpioCmd(const uint8_t* commandData) {
|
ReturnValue_t PlocSupervisorHandler::prepareSetGpioCmd(const uint8_t* commandData) {
|
||||||
uint8_t port = *commandData;
|
uint8_t port = *commandData;
|
||||||
uint8_t pin = *(commandData + 1);
|
uint8_t pin = *(commandData + 1);
|
||||||
uint8_t val = *(commandData + 2);
|
uint8_t val = *(commandData + 2);
|
||||||
supv::SetGpio packet(port, pin, val);
|
supv::SetGpio packet(spParams);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
ReturnValue_t result = packet.buildPacket(port, pin, val);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::prepareReadGpioCmd(const uint8_t* commandData) {
|
ReturnValue_t PlocSupervisorHandler::prepareReadGpioCmd(const uint8_t* commandData) {
|
||||||
uint8_t port = *commandData;
|
uint8_t port = *commandData;
|
||||||
uint8_t pin = *(commandData + 1);
|
uint8_t pin = *(commandData + 1);
|
||||||
supv::ReadGpio packet(port, pin);
|
supv::ReadGpio packet(spParams);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
ReturnValue_t result = packet.buildPacket(port, pin);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::packetToOutBuffer(uint8_t* packetData, size_t fullSize) {
|
void PlocSupervisorHandler::finishTcPrep() { nextReplyId = supv::ACK_REPORT; }
|
||||||
memcpy(commandBuffer, packetData, fullSize);
|
|
||||||
rawPacket = commandBuffer;
|
|
||||||
rawPacketLen = fullSize;
|
|
||||||
nextReplyId = supv::ACK_REPORT;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlocSupervisorHandler::prepareSetShutdownTimeoutCmd(const uint8_t* commandData) {
|
ReturnValue_t PlocSupervisorHandler::prepareSetShutdownTimeoutCmd(const uint8_t* commandData) {
|
||||||
uint32_t timeout = 0;
|
uint32_t timeout = 0;
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
size_t size = sizeof(timeout);
|
size_t size = sizeof(timeout);
|
||||||
@ -1536,8 +1647,13 @@ void PlocSupervisorHandler::prepareSetShutdownTimeoutCmd(const uint8_t* commandD
|
|||||||
<< "PlocSupervisorHandler::prepareSetShutdownTimeoutCmd: Failed to deserialize timeout"
|
<< "PlocSupervisorHandler::prepareSetShutdownTimeoutCmd: Failed to deserialize timeout"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
supv::SetShutdownTimeout packet(timeout);
|
supv::SetShutdownTimeout packet(spParams);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
result = packet.buildPacket(timeout);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::prepareLoggingRequest(const uint8_t* commandData,
|
ReturnValue_t PlocSupervisorHandler::prepareLoggingRequest(const uint8_t* commandData,
|
||||||
@ -1545,8 +1661,12 @@ ReturnValue_t PlocSupervisorHandler::prepareLoggingRequest(const uint8_t* comman
|
|||||||
using namespace supv;
|
using namespace supv;
|
||||||
RequestLoggingData::Sa sa = static_cast<RequestLoggingData::Sa>(*commandData);
|
RequestLoggingData::Sa sa = static_cast<RequestLoggingData::Sa>(*commandData);
|
||||||
uint8_t tpc = *(commandData + 1);
|
uint8_t tpc = *(commandData + 1);
|
||||||
RequestLoggingData packet(sa, tpc);
|
RequestLoggingData packet(spParams);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
ReturnValue_t result = packet.buildPacket(sa, tpc);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1554,8 +1674,12 @@ ReturnValue_t PlocSupervisorHandler::prepareEnableNvmsCommand(const uint8_t* com
|
|||||||
using namespace supv;
|
using namespace supv;
|
||||||
uint8_t nvm01 = *(commandData);
|
uint8_t nvm01 = *(commandData);
|
||||||
uint8_t nvm3 = *(commandData + 1);
|
uint8_t nvm3 = *(commandData + 1);
|
||||||
EnableNvms packet(nvm01, nvm3);
|
EnableNvms packet(spParams);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
ReturnValue_t result = packet.buildPacket(nvm01, nvm3);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
finishTcPrep();
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1743,8 +1867,8 @@ void PlocSupervisorHandler::increaseExpectedMramReplies(DeviceCommandId_t id) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint8_t sequenceFlags = spacePacketBuffer[2] >> 6;
|
uint8_t sequenceFlags = spacePacketBuffer[2] >> 6;
|
||||||
if (sequenceFlags != static_cast<uint8_t>(supv::SequenceFlags::LAST_PKT) &&
|
if (sequenceFlags != static_cast<uint8_t>(ccsds::SequenceFlags::LAST_SEGMENT) &&
|
||||||
(sequenceFlags != static_cast<uint8_t>(supv::SequenceFlags::STANDALONE_PKT))) {
|
(sequenceFlags != static_cast<uint8_t>(ccsds::SequenceFlags::UNSEGMENTED))) {
|
||||||
// Command expects at least one MRAM packet more and the execution report
|
// Command expects at least one MRAM packet more and the execution report
|
||||||
info->expectedReplies = 2;
|
info->expectedReplies = 2;
|
||||||
mramReplyInfo->countdown->resetTimer();
|
mramReplyInfo->countdown->resetTimer();
|
||||||
@ -1770,8 +1894,8 @@ ReturnValue_t PlocSupervisorHandler::handleMramDumpFile(DeviceCommandId_t id) {
|
|||||||
uint16_t packetLen = readSpacePacketLength(spacePacketBuffer);
|
uint16_t packetLen = readSpacePacketLength(spacePacketBuffer);
|
||||||
uint8_t sequenceFlags = readSequenceFlags(spacePacketBuffer);
|
uint8_t sequenceFlags = readSequenceFlags(spacePacketBuffer);
|
||||||
if (id == supv::FIRST_MRAM_DUMP) {
|
if (id == supv::FIRST_MRAM_DUMP) {
|
||||||
if (sequenceFlags == static_cast<uint8_t>(supv::SequenceFlags::FIRST_PKT) ||
|
if (sequenceFlags == static_cast<uint8_t>(ccsds::SequenceFlags::FIRST_SEGMENT) ||
|
||||||
(sequenceFlags == static_cast<uint8_t>(supv::SequenceFlags::STANDALONE_PKT))) {
|
(sequenceFlags == static_cast<uint8_t>(ccsds::SequenceFlags::UNSEGMENTED))) {
|
||||||
result = createMramDumpFile();
|
result = createMramDumpFile();
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
@ -1899,23 +2023,29 @@ ReturnValue_t PlocSupervisorHandler::eventSubscription() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::handleExecutionSuccessReport(const uint8_t* data) {
|
ReturnValue_t PlocSupervisorHandler::handleExecutionSuccessReport(const uint8_t* data) {
|
||||||
DeviceCommandId_t commandId = getPendingCommand();
|
DeviceCommandId_t commandId = getPendingCommand();
|
||||||
switch (commandId) {
|
switch (commandId) {
|
||||||
case supv::READ_GPIO: {
|
case supv::READ_GPIO: {
|
||||||
supv::ExecutionReport exe;
|
supv::ExecutionReport exe(data, supv::SIZE_EXE_REPORT);
|
||||||
exe.addWholeData(data, supv::SIZE_EXE_REPORT);
|
if (exe.isNull()) {
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
ReturnValue_t result = exe.checkSize();
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
uint16_t gpioState = exe.getStatusCode();
|
uint16_t gpioState = exe.getStatusCode();
|
||||||
#if OBSW_DEBUG_PLOC_SUPERVISOR == 1
|
#if OBSW_DEBUG_PLOC_SUPERVISOR == 1
|
||||||
sif::info << "PlocSupervisorHandler: Read GPIO TM, State: " << gpioState << std::endl;
|
sif::info << "PlocSupervisorHandler: Read GPIO TM, State: " << gpioState << std::endl;
|
||||||
#endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */
|
#endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */
|
||||||
DeviceCommandMap::iterator iter = deviceCommandMap.find(commandId);
|
DeviceCommandMap::iterator iter = deviceCommandMap.find(commandId);
|
||||||
if (iter->second.sendReplyTo == NO_COMMAND_ID) {
|
if (iter->second.sendReplyTo == NO_COMMAND_ID) {
|
||||||
return;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
uint8_t data[sizeof(gpioState)];
|
uint8_t data[sizeof(gpioState)];
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
ReturnValue_t result = SerializeAdapter::serialize(&gpioState, data, &size, sizeof(gpioState),
|
result = SerializeAdapter::serialize(&gpioState, data, &size, sizeof(gpioState),
|
||||||
SerializeIF::Endianness::BIG);
|
SerializeIF::Endianness::BIG);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::debug << "PlocSupervisorHandler: Failed to deserialize GPIO state" << std::endl;
|
sif::debug << "PlocSupervisorHandler: Failed to deserialize GPIO state" << std::endl;
|
||||||
@ -1935,6 +2065,7 @@ void PlocSupervisorHandler::handleExecutionSuccessReport(const uint8_t* data) {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::handleExecutionFailureReport(uint16_t statusCode) {
|
void PlocSupervisorHandler::handleExecutionFailureReport(uint16_t statusCode) {
|
||||||
|
@ -100,6 +100,8 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
|||||||
StartupState startupState = StartupState::OFF;
|
StartupState startupState = StartupState::OFF;
|
||||||
|
|
||||||
uint8_t commandBuffer[supv::MAX_COMMAND_SIZE];
|
uint8_t commandBuffer[supv::MAX_COMMAND_SIZE];
|
||||||
|
SpacePacketCreator creator;
|
||||||
|
ploc::SpTcParams spParams = ploc::SpTcParams(creator);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This variable is used to store the id of the next reply to receive. This is necessary
|
* This variable is used to store the id of the next reply to receive. This is necessary
|
||||||
@ -233,14 +235,14 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
|||||||
* @brief This function prepares a space packet which does not transport any data in the
|
* @brief This function prepares a space packet which does not transport any data in the
|
||||||
* packet data field apart from the crc.
|
* packet data field apart from the crc.
|
||||||
*/
|
*/
|
||||||
void prepareEmptyCmd(uint16_t apid);
|
ReturnValue_t prepareEmptyCmd(uint16_t apid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function initializes the space packet to select the boot image of the MPSoC.
|
* @brief This function initializes the space packet to select the boot image of the MPSoC.
|
||||||
*/
|
*/
|
||||||
void prepareSelBootImageCmd(const uint8_t* commandData);
|
ReturnValue_t prepareSelBootImageCmd(const uint8_t* commandData);
|
||||||
|
|
||||||
void prepareDisableHk();
|
ReturnValue_t prepareDisableHk();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function fills the commandBuffer with the data to update the time of the
|
* @brief This function fills the commandBuffer with the data to update the time of the
|
||||||
@ -252,9 +254,9 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
|||||||
* @brief This function fills the commandBuffer with the data to change the boot timeout
|
* @brief This function fills the commandBuffer with the data to change the boot timeout
|
||||||
* value in the PLOC supervisor.
|
* value in the PLOC supervisor.
|
||||||
*/
|
*/
|
||||||
void prepareSetBootTimeoutCmd(const uint8_t* commandData);
|
ReturnValue_t prepareSetBootTimeoutCmd(const uint8_t* commandData);
|
||||||
|
|
||||||
void prepareRestartTriesCmd(const uint8_t* commandData);
|
ReturnValue_t prepareRestartTriesCmd(const uint8_t* commandData);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function fills the command buffer with the packet to enable or disable the
|
* @brief This function fills the command buffer with the packet to enable or disable the
|
||||||
@ -271,21 +273,21 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
|||||||
ReturnValue_t prepareLatchupConfigCmd(const uint8_t* commandData,
|
ReturnValue_t prepareLatchupConfigCmd(const uint8_t* commandData,
|
||||||
DeviceCommandId_t deviceCommand);
|
DeviceCommandId_t deviceCommand);
|
||||||
ReturnValue_t prepareSetAlertLimitCmd(const uint8_t* commandData);
|
ReturnValue_t prepareSetAlertLimitCmd(const uint8_t* commandData);
|
||||||
void prepareSetAdcEnabledChannelsCmd(const uint8_t* commandData);
|
ReturnValue_t prepareSetAdcEnabledChannelsCmd(const uint8_t* commandData);
|
||||||
void prepareSetAdcWindowAndStrideCmd(const uint8_t* commandData);
|
ReturnValue_t prepareSetAdcWindowAndStrideCmd(const uint8_t* commandData);
|
||||||
void prepareSetAdcThresholdCmd(const uint8_t* commandData);
|
ReturnValue_t prepareSetAdcThresholdCmd(const uint8_t* commandData);
|
||||||
ReturnValue_t prepareRunAutoEmTest(const uint8_t* commandData);
|
ReturnValue_t prepareRunAutoEmTest(const uint8_t* commandData);
|
||||||
ReturnValue_t prepareWipeMramCmd(const uint8_t* commandData);
|
ReturnValue_t prepareWipeMramCmd(const uint8_t* commandData);
|
||||||
ReturnValue_t prepareDumpMramCmd(const uint8_t* commandData);
|
ReturnValue_t prepareDumpMramCmd(const uint8_t* commandData);
|
||||||
void prepareSetGpioCmd(const uint8_t* commandData);
|
ReturnValue_t prepareSetGpioCmd(const uint8_t* commandData);
|
||||||
void prepareReadGpioCmd(const uint8_t* commandData);
|
ReturnValue_t prepareReadGpioCmd(const uint8_t* commandData);
|
||||||
ReturnValue_t prepareLoggingRequest(const uint8_t* commandData, size_t commandDataLen);
|
ReturnValue_t prepareLoggingRequest(const uint8_t* commandData, size_t commandDataLen);
|
||||||
ReturnValue_t prepareEnableNvmsCommand(const uint8_t* commandData);
|
ReturnValue_t prepareEnableNvmsCommand(const uint8_t* commandData);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Copies the content of a space packet to the command buffer.
|
* @brief Copies the content of a space packet to the command buffer.
|
||||||
*/
|
*/
|
||||||
void packetToOutBuffer(uint8_t* packetData, size_t fullSize);
|
void finishTcPrep();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief In case an acknowledgment failure reply has been received this function disables
|
* @brief In case an acknowledgment failure reply has been received this function disables
|
||||||
@ -363,13 +365,13 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
|||||||
ReturnValue_t createMramDumpFile();
|
ReturnValue_t createMramDumpFile();
|
||||||
ReturnValue_t getTimeStampString(std::string& timeStamp);
|
ReturnValue_t getTimeStampString(std::string& timeStamp);
|
||||||
|
|
||||||
void prepareSetShutdownTimeoutCmd(const uint8_t* commandData);
|
ReturnValue_t prepareSetShutdownTimeoutCmd(const uint8_t* commandData);
|
||||||
|
|
||||||
ReturnValue_t extractUpdateCommand(const uint8_t* commandData, size_t size, std::string* file,
|
ReturnValue_t extractUpdateCommand(const uint8_t* commandData, size_t size, std::string* file,
|
||||||
uint8_t* memoryId, uint32_t* startAddress);
|
uint8_t* memoryId, uint32_t* startAddress);
|
||||||
ReturnValue_t eventSubscription();
|
ReturnValue_t eventSubscription();
|
||||||
|
|
||||||
void handleExecutionSuccessReport(const uint8_t* data);
|
ReturnValue_t handleExecutionSuccessReport(const uint8_t* data);
|
||||||
void handleExecutionFailureReport(uint16_t statusCode);
|
void handleExecutionFailureReport(uint16_t statusCode);
|
||||||
|
|
||||||
void printAckFailureInfo(uint16_t statusCode, DeviceCommandId_t commandId);
|
void printAckFailureInfo(uint16_t statusCode, DeviceCommandId_t commandId);
|
||||||
|
@ -16,7 +16,10 @@
|
|||||||
#include "mission/utility/ProgressPrinter.h"
|
#include "mission/utility/ProgressPrinter.h"
|
||||||
#include "mission/utility/Timestamp.h"
|
#include "mission/utility/Timestamp.h"
|
||||||
|
|
||||||
PlocSupvHelper::PlocSupvHelper(object_id_t objectId) : SystemObject(objectId) {}
|
PlocSupvHelper::PlocSupvHelper(object_id_t objectId) : SystemObject(objectId) {
|
||||||
|
spParams.maxSize = sizeof(commandBuffer);
|
||||||
|
resetSpParams();
|
||||||
|
}
|
||||||
|
|
||||||
PlocSupvHelper::~PlocSupvHelper() {}
|
PlocSupvHelper::~PlocSupvHelper() {}
|
||||||
|
|
||||||
@ -210,7 +213,7 @@ ReturnValue_t PlocSupvHelper::writeUpdatePackets() {
|
|||||||
uint8_t tempData[supv::WriteMemory::CHUNK_MAX];
|
uint8_t tempData[supv::WriteMemory::CHUNK_MAX];
|
||||||
std::ifstream file(update.file, std::ifstream::binary);
|
std::ifstream file(update.file, std::ifstream::binary);
|
||||||
uint16_t dataLength = 0;
|
uint16_t dataLength = 0;
|
||||||
supv::SequenceFlags seqFlags;
|
ccsds::SequenceFlags seqFlags;
|
||||||
while (update.remainingSize > 0) {
|
while (update.remainingSize > 0) {
|
||||||
if (terminate) {
|
if (terminate) {
|
||||||
terminate = false;
|
terminate = false;
|
||||||
@ -235,14 +238,21 @@ ReturnValue_t PlocSupvHelper::writeUpdatePackets() {
|
|||||||
return FILE_CLOSED_ACCIDENTALLY;
|
return FILE_CLOSED_ACCIDENTALLY;
|
||||||
}
|
}
|
||||||
if (update.bytesWritten == 0) {
|
if (update.bytesWritten == 0) {
|
||||||
seqFlags = supv::SequenceFlags::FIRST_PKT;
|
seqFlags = ccsds::SequenceFlags::FIRST_SEGMENT;
|
||||||
} else if (update.remainingSize == 0) {
|
} else if (update.remainingSize == 0) {
|
||||||
seqFlags = supv::SequenceFlags::LAST_PKT;
|
seqFlags = ccsds::SequenceFlags::LAST_SEGMENT;
|
||||||
} else {
|
} else {
|
||||||
seqFlags = supv::SequenceFlags::CONTINUED_PKT;
|
seqFlags = ccsds::SequenceFlags::CONTINUATION;
|
||||||
}
|
}
|
||||||
supv::WriteMemory packet(seqFlags, update.sequenceCount++, update.memoryId,
|
resetSpParams();
|
||||||
|
supv::WriteMemory packet(spParams);
|
||||||
|
result = packet.buildPacket(seqFlags, update.sequenceCount++, update.memoryId,
|
||||||
update.startAddress + update.bytesWritten, dataLength, tempData);
|
update.startAddress + update.bytesWritten, dataLength, tempData);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
update.sequenceCount--;
|
||||||
|
triggerEvent(WRITE_MEMORY_FAILED, update.packetNum);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
result = handlePacketTransmission(packet);
|
result = handlePacketTransmission(packet);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
update.sequenceCount--;
|
update.sequenceCount--;
|
||||||
@ -262,7 +272,12 @@ ReturnValue_t PlocSupvHelper::writeUpdatePackets() {
|
|||||||
ReturnValue_t PlocSupvHelper::performEventBufferRequest() {
|
ReturnValue_t PlocSupvHelper::performEventBufferRequest() {
|
||||||
using namespace supv;
|
using namespace supv;
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
RequestLoggingData packet(RequestLoggingData::Sa::REQUEST_EVENT_BUFFERS);
|
resetSpParams();
|
||||||
|
RequestLoggingData packet(spParams);
|
||||||
|
result = packet.buildPacket(RequestLoggingData::Sa::REQUEST_EVENT_BUFFERS);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
result = sendCommand(packet);
|
result = sendCommand(packet);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
@ -284,7 +299,12 @@ ReturnValue_t PlocSupvHelper::performEventBufferRequest() {
|
|||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::selectMemory() {
|
ReturnValue_t PlocSupvHelper::selectMemory() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
supv::MPSoCBootSelect packet(update.memoryId);
|
resetSpParams();
|
||||||
|
supv::MPSoCBootSelect packet(spParams);
|
||||||
|
result = packet.buildPacket(update.memoryId);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
result = handlePacketTransmission(packet);
|
result = handlePacketTransmission(packet);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
@ -294,7 +314,9 @@ ReturnValue_t PlocSupvHelper::selectMemory() {
|
|||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::prepareUpdate() {
|
ReturnValue_t PlocSupvHelper::prepareUpdate() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
supv::ApidOnlyPacket packet(supv::APID_PREPARE_UPDATE);
|
resetSpParams();
|
||||||
|
supv::ApidOnlyPacket packet(spParams, supv::APID_PREPARE_UPDATE);
|
||||||
|
result = packet.buildPacket();
|
||||||
result = handlePacketTransmission(packet, PREPARE_UPDATE_EXECUTION_REPORT);
|
result = handlePacketTransmission(packet, PREPARE_UPDATE_EXECUTION_REPORT);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
@ -304,7 +326,12 @@ ReturnValue_t PlocSupvHelper::prepareUpdate() {
|
|||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::eraseMemory() {
|
ReturnValue_t PlocSupvHelper::eraseMemory() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
supv::EraseMemory eraseMemory(update.memoryId, update.startAddress, update.length);
|
resetSpParams();
|
||||||
|
supv::EraseMemory eraseMemory(spParams);
|
||||||
|
result = eraseMemory.buildPacket(update.memoryId, update.startAddress, update.length);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
result = handlePacketTransmission(eraseMemory, supv::recv_timeout::ERASE_MEMORY);
|
result = handlePacketTransmission(eraseMemory, supv::recv_timeout::ERASE_MEMORY);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
@ -312,7 +339,7 @@ ReturnValue_t PlocSupvHelper::eraseMemory() {
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::handlePacketTransmission(SpacePacket& packet,
|
ReturnValue_t PlocSupvHelper::handlePacketTransmission(ploc::SpTcBase& packet,
|
||||||
uint32_t timeoutExecutionReport) {
|
uint32_t timeoutExecutionReport) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
result = sendCommand(packet);
|
result = sendCommand(packet);
|
||||||
@ -330,10 +357,10 @@ ReturnValue_t PlocSupvHelper::handlePacketTransmission(SpacePacket& packet,
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::sendCommand(SpacePacket& packet) {
|
ReturnValue_t PlocSupvHelper::sendCommand(ploc::SpTcBase& packet) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
rememberApid = packet.getAPID();
|
rememberApid = packet.getApid();
|
||||||
result = uartComIF->sendMessage(comCookie, packet.getWholeData(), packet.getFullSize());
|
result = uartComIF->sendMessage(comCookie, packet.getFullPacket(), packet.getFullPacketLen());
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::warning << "PlocSupvHelper::sendCommand: Failed to send command" << std::endl;
|
sif::warning << "PlocSupvHelper::sendCommand: Failed to send command" << std::endl;
|
||||||
triggerEvent(SUPV_SENDING_COMMAND_FAILED, result, static_cast<uint32_t>(internalState));
|
triggerEvent(SUPV_SENDING_COMMAND_FAILED, result, static_cast<uint32_t>(internalState));
|
||||||
@ -344,14 +371,19 @@ ReturnValue_t PlocSupvHelper::sendCommand(SpacePacket& packet) {
|
|||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::handleAck() {
|
ReturnValue_t PlocSupvHelper::handleAck() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
supv::AcknowledgmentReport ackReport;
|
|
||||||
result = handleTmReception(&ackReport, supv::SIZE_ACK_REPORT);
|
result = handleTmReception(supv::SIZE_ACK_REPORT);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
triggerEvent(ACK_RECEPTION_FAILURE, result, static_cast<uint32_t>(rememberApid));
|
triggerEvent(ACK_RECEPTION_FAILURE, result, static_cast<uint32_t>(rememberApid));
|
||||||
sif::warning << "PlocSupvHelper::handleAck: Error in reception of acknowledgment report"
|
sif::warning << "PlocSupvHelper::handleAck: Error in reception of acknowledgment report"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
supv::AcknowledgmentReport ackReport(tmBuf.data(), tmBuf.size());
|
||||||
|
result = checkReceivedTm(ackReport);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
result = ackReport.checkApid();
|
result = ackReport.checkApid();
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
if (result == SupvReturnValuesIF::RECEIVED_ACK_FAILURE) {
|
if (result == SupvReturnValuesIF::RECEIVED_ACK_FAILURE) {
|
||||||
@ -366,14 +398,19 @@ ReturnValue_t PlocSupvHelper::handleAck() {
|
|||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::handleExe(uint32_t timeout) {
|
ReturnValue_t PlocSupvHelper::handleExe(uint32_t timeout) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
supv::ExecutionReport exeReport;
|
|
||||||
result = handleTmReception(&exeReport, supv::SIZE_EXE_REPORT, timeout);
|
result = handleTmReception(supv::SIZE_EXE_REPORT, timeout);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
triggerEvent(EXE_RECEPTION_FAILURE, result, static_cast<uint32_t>(rememberApid));
|
triggerEvent(EXE_RECEPTION_FAILURE, result, static_cast<uint32_t>(rememberApid));
|
||||||
sif::warning << "PlocSupvHelper::handleExe: Error in reception of execution report"
|
sif::warning << "PlocSupvHelper::handleExe: Error in reception of execution report"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
supv::ExecutionReport exeReport(tmBuf.data(), tmBuf.size());
|
||||||
|
result = checkReceivedTm(exeReport);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
result = exeReport.checkApid();
|
result = exeReport.checkApid();
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
if (result == SupvReturnValuesIF::RECEIVED_EXE_FAILURE) {
|
if (result == SupvReturnValuesIF::RECEIVED_EXE_FAILURE) {
|
||||||
@ -386,14 +423,13 @@ ReturnValue_t PlocSupvHelper::handleExe(uint32_t timeout) {
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::handleTmReception(supv::TmPacket* tmPacket, size_t remainingBytes,
|
ReturnValue_t PlocSupvHelper::handleTmReception(size_t remainingBytes, uint32_t timeout) {
|
||||||
uint32_t timeout) {
|
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
size_t readBytes = 0;
|
size_t readBytes = 0;
|
||||||
size_t currentBytes = 0;
|
size_t currentBytes = 0;
|
||||||
Countdown countdown(timeout);
|
Countdown countdown(timeout);
|
||||||
while (!countdown.hasTimedOut()) {
|
while (!countdown.hasTimedOut()) {
|
||||||
result = receive(tmPacket->getWholeData() + readBytes, ¤tBytes, remainingBytes);
|
result = receive(tmBuf.data() + readBytes, ¤tBytes, remainingBytes);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -408,9 +444,18 @@ ReturnValue_t PlocSupvHelper::handleTmReception(supv::TmPacket* tmPacket, size_t
|
|||||||
<< remainingBytes << " bytes" << std::endl;
|
<< remainingBytes << " bytes" << std::endl;
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
result = tmPacket->checkCrc();
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t PlocSupvHelper::checkReceivedTm(ploc::SpTmReader& reader) {
|
||||||
|
ReturnValue_t result = reader.checkSize();
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::warning << "PlocSupvHelper::handleTmReception: CRC check failed" << std::endl;
|
triggerEvent(SUPV_REPLY_SIZE_MISSMATCH, rememberApid);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = reader.checkCrc();
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
triggerEvent(SUPV_REPLY_CRC_MISSMATCH, rememberApid);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -476,8 +521,13 @@ ReturnValue_t PlocSupvHelper::calcImageCrc() {
|
|||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::handleCheckMemoryCommand() {
|
ReturnValue_t PlocSupvHelper::handleCheckMemoryCommand() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
resetSpParams();
|
||||||
// Verification of update write procedure
|
// Verification of update write procedure
|
||||||
supv::CheckMemory packet(update.memoryId, update.startAddress, update.length);
|
supv::CheckMemory packet(spParams);
|
||||||
|
result = packet.buildPacket(update.memoryId, update.startAddress, update.length);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
result = sendCommand(packet);
|
result = sendCommand(packet);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
@ -486,10 +536,14 @@ ReturnValue_t PlocSupvHelper::handleCheckMemoryCommand() {
|
|||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
supv::UpdateStatusReport updateStatusReport;
|
supv::UpdateStatusReport updateStatusReport(tmBuf.data(), tmBuf.size());
|
||||||
result = handleTmReception(&updateStatusReport,
|
result = handleTmReception(static_cast<size_t>(updateStatusReport.getNominalSize()),
|
||||||
static_cast<size_t>(updateStatusReport.getNominalSize()),
|
|
||||||
supv::recv_timeout::UPDATE_STATUS_REPORT);
|
supv::recv_timeout::UPDATE_STATUS_REPORT);
|
||||||
|
result = updateStatusReport.checkCrc();
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
sif::warning << "PlocSupvHelper::handleTmReception: CRC check failed" << std::endl;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::warning
|
sif::warning
|
||||||
<< "PlocSupvHelper::handleCheckMemoryCommand: Failed to receive update status report"
|
<< "PlocSupvHelper::handleCheckMemoryCommand: Failed to receive update status report"
|
||||||
@ -529,7 +583,7 @@ ReturnValue_t PlocSupvHelper::handleEventBufferReception() {
|
|||||||
std::ofstream file(filename, std::ios_base::app | std::ios_base::out);
|
std::ofstream file(filename, std::ios_base::app | std::ios_base::out);
|
||||||
uint32_t packetsRead = 0;
|
uint32_t packetsRead = 0;
|
||||||
size_t requestLen = 0;
|
size_t requestLen = 0;
|
||||||
supv::TmPacket tmPacket;
|
ploc::SpTmReader tmReader(tmBuf.data(), tmBuf.size());
|
||||||
for (packetsRead = 0; packetsRead < NUM_EVENT_BUFFER_PACKETS; packetsRead++) {
|
for (packetsRead = 0; packetsRead < NUM_EVENT_BUFFER_PACKETS; packetsRead++) {
|
||||||
if (terminate) {
|
if (terminate) {
|
||||||
triggerEvent(SUPV_EVENT_BUFFER_REQUEST_TERMINATED, packetsRead - 1);
|
triggerEvent(SUPV_EVENT_BUFFER_REQUEST_TERMINATED, packetsRead - 1);
|
||||||
@ -541,22 +595,29 @@ ReturnValue_t PlocSupvHelper::handleEventBufferReception() {
|
|||||||
} else {
|
} else {
|
||||||
requestLen = SIZE_EVENT_BUFFER_FULL_PACKET;
|
requestLen = SIZE_EVENT_BUFFER_FULL_PACKET;
|
||||||
}
|
}
|
||||||
result = handleTmReception(&tmPacket, requestLen);
|
result = handleTmReception(requestLen);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::debug << "PlocSupvHelper::handleEventBufferReception: Failed while trying to read packet"
|
sif::debug << "PlocSupvHelper::handleEventBufferReception: Failed while trying to read packet"
|
||||||
<< " " << packetsRead + 1 << std::endl;
|
<< " " << packetsRead + 1 << std::endl;
|
||||||
file.close();
|
file.close();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
uint16_t apid = tmPacket.getAPID();
|
ReturnValue_t result = tmReader.checkCrc();
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
triggerEvent(SUPV_REPLY_CRC_MISSMATCH, rememberApid);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
uint16_t apid = tmReader.getApid();
|
||||||
if (apid != supv::APID_MRAM_DUMP_TM) {
|
if (apid != supv::APID_MRAM_DUMP_TM) {
|
||||||
sif::warning << "PlocSupvHelper::handleEventBufferReception: Did not expect space packet "
|
sif::warning << "PlocSupvHelper::handleEventBufferReception: Did not expect space packet "
|
||||||
<< "with APID 0x" << std::hex << apid << std::endl;
|
<< "with APID 0x" << std::hex << apid << std::endl;
|
||||||
file.close();
|
file.close();
|
||||||
return EVENT_BUFFER_REPLY_INVALID_APID;
|
return EVENT_BUFFER_REPLY_INVALID_APID;
|
||||||
}
|
}
|
||||||
file.write(reinterpret_cast<const char*>(tmPacket.getPacketData()),
|
file.write(reinterpret_cast<const char*>(tmReader.getPacketData()),
|
||||||
tmPacket.getPayloadDataLength());
|
tmReader.getPayloadDataLength());
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlocSupvHelper::resetSpParams() { spParams.buf = commandBuffer; }
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||||
#include "fsfw_hal/linux/uart/UartComIF.h"
|
#include "fsfw_hal/linux/uart/UartComIF.h"
|
||||||
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
|
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
|
||||||
|
|
||||||
#ifdef XIPHOS_Q7S
|
#ifdef XIPHOS_Q7S
|
||||||
#include "bsp_q7s/memory/SdCardManager.h"
|
#include "bsp_q7s/memory/SdCardManager.h"
|
||||||
#endif
|
#endif
|
||||||
@ -85,6 +86,8 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
|
|||||||
//! [EXPORT] : [COMMENT] Update procedure failed when sending packet with number P1
|
//! [EXPORT] : [COMMENT] Update procedure failed when sending packet with number P1
|
||||||
//! P1: Packet number for which the memory write command fails
|
//! P1: Packet number for which the memory write command fails
|
||||||
static const Event WRITE_MEMORY_FAILED = MAKE_EVENT(19, severity::LOW);
|
static const Event WRITE_MEMORY_FAILED = MAKE_EVENT(19, severity::LOW);
|
||||||
|
static const Event SUPV_REPLY_SIZE_MISSMATCH = MAKE_EVENT(20, severity::LOW);
|
||||||
|
static const Event SUPV_REPLY_CRC_MISSMATCH = MAKE_EVENT(21, severity::LOW);
|
||||||
|
|
||||||
PlocSupvHelper(object_id_t objectId);
|
PlocSupvHelper(object_id_t objectId);
|
||||||
virtual ~PlocSupvHelper();
|
virtual ~PlocSupvHelper();
|
||||||
@ -176,6 +179,10 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
|
|||||||
SdCardManager* sdcMan = nullptr;
|
SdCardManager* sdcMan = nullptr;
|
||||||
#endif
|
#endif
|
||||||
uint8_t commandBuffer[supv::MAX_COMMAND_SIZE];
|
uint8_t commandBuffer[supv::MAX_COMMAND_SIZE];
|
||||||
|
SpacePacketCreator creator;
|
||||||
|
ploc::SpTcParams spParams = ploc::SpTcParams(creator);
|
||||||
|
|
||||||
|
std::array<uint8_t, supv::MAX_COMMAND_SIZE> tmBuf;
|
||||||
|
|
||||||
bool terminate = false;
|
bool terminate = false;
|
||||||
|
|
||||||
@ -195,9 +202,9 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
|
|||||||
ReturnValue_t continueUpdate();
|
ReturnValue_t continueUpdate();
|
||||||
ReturnValue_t writeUpdatePackets();
|
ReturnValue_t writeUpdatePackets();
|
||||||
ReturnValue_t performEventBufferRequest();
|
ReturnValue_t performEventBufferRequest();
|
||||||
ReturnValue_t handlePacketTransmission(SpacePacket& packet,
|
ReturnValue_t handlePacketTransmission(ploc::SpTcBase& packet,
|
||||||
uint32_t timeoutExecutionReport = 60000);
|
uint32_t timeoutExecutionReport = 60000);
|
||||||
ReturnValue_t sendCommand(SpacePacket& packet);
|
ReturnValue_t sendCommand(ploc::SpTcBase& packet);
|
||||||
/**
|
/**
|
||||||
* @brief Function which reads form the communication interface
|
* @brief Function which reads form the communication interface
|
||||||
*
|
*
|
||||||
@ -218,8 +225,9 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
|
|||||||
* @note It can take up to 70 seconds until the supervisor replies with an acknowledgment
|
* @note It can take up to 70 seconds until the supervisor replies with an acknowledgment
|
||||||
* failure report.
|
* failure report.
|
||||||
*/
|
*/
|
||||||
ReturnValue_t handleTmReception(supv::TmPacket* tmPacket, size_t remainingBytes,
|
ReturnValue_t handleTmReception(size_t remainingBytes, uint32_t timeout = 70000);
|
||||||
uint32_t timeout = 70000);
|
ReturnValue_t checkReceivedTm(ploc::SpTmReader& reader);
|
||||||
|
|
||||||
ReturnValue_t selectMemory();
|
ReturnValue_t selectMemory();
|
||||||
ReturnValue_t prepareUpdate();
|
ReturnValue_t prepareUpdate();
|
||||||
ReturnValue_t eraseMemory();
|
ReturnValue_t eraseMemory();
|
||||||
@ -236,6 +244,8 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
|
|||||||
*/
|
*/
|
||||||
uint32_t getFileSize(std::string filename);
|
uint32_t getFileSize(std::string filename);
|
||||||
ReturnValue_t handleEventBufferReception();
|
ReturnValue_t handleEventBufferReception();
|
||||||
|
|
||||||
|
void resetSpParams();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* BSP_Q7S_DEVICES_PLOCSUPVHELPER_H_ */
|
#endif /* BSP_Q7S_DEVICES_PLOCSUPVHELPER_H_ */
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include <fsfw/datapool/PoolReadGuard.h>
|
|
||||||
#include "AcsController.h"
|
#include "AcsController.h"
|
||||||
|
|
||||||
|
#include <fsfw/datapool/PoolReadGuard.h>
|
||||||
|
|
||||||
AcsController::AcsController(object_id_t objectId)
|
AcsController::AcsController(object_id_t objectId)
|
||||||
: ExtendedControllerBase(objectId, objects::NO_OBJECT),
|
: ExtendedControllerBase(objectId, objects::NO_OBJECT), mgmData(this) {}
|
||||||
mgmData(this) {}
|
|
||||||
|
|
||||||
ReturnValue_t AcsController::handleCommandMessage(CommandMessage *message) {
|
ReturnValue_t AcsController::handleCommandMessage(CommandMessage *message) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
@ -45,7 +45,7 @@ ReturnValue_t AcsController::initializeLocalDataPool(localpool::DataPool &localD
|
|||||||
localDataPoolMap.emplace(acsctrl::PoolIds::MGM_3_RM3100_UT, &mgm3PoolVec);
|
localDataPoolMap.emplace(acsctrl::PoolIds::MGM_3_RM3100_UT, &mgm3PoolVec);
|
||||||
localDataPoolMap.emplace(acsctrl::PoolIds::MGM_IMTQ_CAL_NT, &imtqMgmPoolVec);
|
localDataPoolMap.emplace(acsctrl::PoolIds::MGM_IMTQ_CAL_NT, &imtqMgmPoolVec);
|
||||||
localDataPoolMap.emplace(acsctrl::PoolIds::MGM_IMTQ_CAL_ACT_STATUS, &imtqCalActStatus);
|
localDataPoolMap.emplace(acsctrl::PoolIds::MGM_IMTQ_CAL_ACT_STATUS, &imtqCalActStatus);
|
||||||
poolManager.subscribeForPeriodicPacket(mgmData.getSid(), false, 5.0, false);
|
poolManager.subscribeForRegularPeriodicPacket({mgmData.getSid(), 5.0});
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,8 +2,9 @@
|
|||||||
#define MISSION_CONTROLLER_ACSCONTROLLER_H_
|
#define MISSION_CONTROLLER_ACSCONTROLLER_H_
|
||||||
|
|
||||||
#include <commonObjects.h>
|
#include <commonObjects.h>
|
||||||
#include "controllerdefinitions/AcsCtrlDefinitions.h"
|
|
||||||
#include <fsfw/controller/ExtendedControllerBase.h>
|
#include <fsfw/controller/ExtendedControllerBase.h>
|
||||||
|
|
||||||
|
#include "controllerdefinitions/AcsCtrlDefinitions.h"
|
||||||
#include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h"
|
#include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h"
|
||||||
#include "fsfw_hal/devicehandlers/MgmRM3100Handler.h"
|
#include "fsfw_hal/devicehandlers/MgmRM3100Handler.h"
|
||||||
#include "mission/devices/devicedefinitions/IMTQHandlerDefinitions.h"
|
#include "mission/devices/devicedefinitions/IMTQHandlerDefinitions.h"
|
||||||
@ -33,11 +34,16 @@ class AcsController : public ExtendedControllerBase {
|
|||||||
// MGMs
|
// MGMs
|
||||||
acsctrl::MgmData mgmData;
|
acsctrl::MgmData mgmData;
|
||||||
|
|
||||||
MGMLIS3MDL::MgmPrimaryDataset mgm0Lis3Set = MGMLIS3MDL::MgmPrimaryDataset(objects::MGM_0_LIS3_HANDLER);
|
MGMLIS3MDL::MgmPrimaryDataset mgm0Lis3Set =
|
||||||
RM3100::Rm3100PrimaryDataset mgm1Rm3100Set = RM3100::Rm3100PrimaryDataset(objects::MGM_1_RM3100_HANDLER);
|
MGMLIS3MDL::MgmPrimaryDataset(objects::MGM_0_LIS3_HANDLER);
|
||||||
MGMLIS3MDL::MgmPrimaryDataset mgm2Lis3Set = MGMLIS3MDL::MgmPrimaryDataset(objects::MGM_2_LIS3_HANDLER);
|
RM3100::Rm3100PrimaryDataset mgm1Rm3100Set =
|
||||||
RM3100::Rm3100PrimaryDataset mgm3Rm3100Set = RM3100::Rm3100PrimaryDataset(objects::MGM_3_RM3100_HANDLER);
|
RM3100::Rm3100PrimaryDataset(objects::MGM_1_RM3100_HANDLER);
|
||||||
IMTQ::CalibratedMtmMeasurementSet imtqMgmSet = IMTQ::CalibratedMtmMeasurementSet(objects::IMTQ_HANDLER);
|
MGMLIS3MDL::MgmPrimaryDataset mgm2Lis3Set =
|
||||||
|
MGMLIS3MDL::MgmPrimaryDataset(objects::MGM_2_LIS3_HANDLER);
|
||||||
|
RM3100::Rm3100PrimaryDataset mgm3Rm3100Set =
|
||||||
|
RM3100::Rm3100PrimaryDataset(objects::MGM_3_RM3100_HANDLER);
|
||||||
|
IMTQ::CalibratedMtmMeasurementSet imtqMgmSet =
|
||||||
|
IMTQ::CalibratedMtmMeasurementSet(objects::IMTQ_HANDLER);
|
||||||
|
|
||||||
PoolEntry<float> mgm0PoolVec = PoolEntry<float>(3);
|
PoolEntry<float> mgm0PoolVec = PoolEntry<float>(3);
|
||||||
PoolEntry<float> mgm1PoolVec = PoolEntry<float>(3);
|
PoolEntry<float> mgm1PoolVec = PoolEntry<float>(3);
|
||||||
@ -45,6 +51,7 @@ class AcsController : public ExtendedControllerBase {
|
|||||||
PoolEntry<float> mgm3PoolVec = PoolEntry<float>(3);
|
PoolEntry<float> mgm3PoolVec = PoolEntry<float>(3);
|
||||||
PoolEntry<int32_t> imtqMgmPoolVec = PoolEntry<int32_t>(3);
|
PoolEntry<int32_t> imtqMgmPoolVec = PoolEntry<int32_t>(3);
|
||||||
PoolEntry<uint8_t> imtqCalActStatus = PoolEntry<uint8_t>();
|
PoolEntry<uint8_t> imtqCalActStatus = PoolEntry<uint8_t>();
|
||||||
|
|
||||||
void copyMgmData();
|
void copyMgmData();
|
||||||
|
|
||||||
// Initial delay to make sure all pool variables have been initialized their owners
|
// Initial delay to make sure all pool variables have been initialized their owners
|
||||||
|
@ -200,10 +200,12 @@ ReturnValue_t ThermalController::initializeLocalDataPool(localpool::DataPool& lo
|
|||||||
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_ADC_PAYLOAD_PCDU,
|
localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_ADC_PAYLOAD_PCDU,
|
||||||
new PoolEntry<float>({0.0}));
|
new PoolEntry<float>({0.0}));
|
||||||
|
|
||||||
poolManager.subscribeForPeriodicPacket(sensorTemperatures.getSid(), false, 1.0, false);
|
poolManager.subscribeForRegularPeriodicPacket(
|
||||||
poolManager.subscribeForPeriodicPacket(susTemperatures.getSid(), false, 1.0, false);
|
subdp::RegularHkPeriodicParams(sensorTemperatures.getSid(), false, 10.0));
|
||||||
poolManager.subscribeForPeriodicPacket(deviceTemperatures.getSid(), false, 1.0, false);
|
poolManager.subscribeForRegularPeriodicPacket(
|
||||||
|
subdp::RegularHkPeriodicParams(susTemperatures.getSid(), false, 10.0));
|
||||||
|
poolManager.subscribeForRegularPeriodicPacket(
|
||||||
|
subdp::RegularHkPeriodicParams(deviceTemperatures.getSid(), false, 10.0));
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
#ifndef MISSION_CONTROLLER_CONTROLLERDEFINITIONS_ACSCTRLDEFINITIONS_H_
|
#ifndef MISSION_CONTROLLER_CONTROLLERDEFINITIONS_ACSCTRLDEFINITIONS_H_
|
||||||
#define MISSION_CONTROLLER_CONTROLLERDEFINITIONS_ACSCTRLDEFINITIONS_H_
|
#define MISSION_CONTROLLER_CONTROLLERDEFINITIONS_ACSCTRLDEFINITIONS_H_
|
||||||
|
|
||||||
#include <fsfw/datapoollocal/localPoolDefinitions.h>
|
|
||||||
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
|
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
|
||||||
|
#include <fsfw/datapoollocal/localPoolDefinitions.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace acsctrl {
|
namespace acsctrl {
|
||||||
|
|
||||||
enum SetIds : uint32_t {
|
enum SetIds : uint32_t { MGM_SENSOR_DATA };
|
||||||
MGM_SENSOR_DATA
|
|
||||||
};
|
|
||||||
|
|
||||||
enum PoolIds : lp_id_t {
|
enum PoolIds : lp_id_t {
|
||||||
MGM_0_LIS3_UT,
|
MGM_0_LIS3_UT,
|
||||||
@ -20,7 +19,6 @@ enum PoolIds : lp_id_t {
|
|||||||
MGM_IMTQ_CAL_ACT_STATUS
|
MGM_IMTQ_CAL_ACT_STATUS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static constexpr uint8_t MGM_SET_ENTRIES = 10;
|
static constexpr uint8_t MGM_SET_ENTRIES = 10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,12 +35,12 @@ public:
|
|||||||
lp_vec_t<float, 3> mgm3Rm3100 = lp_vec_t<float, 3>(sid.objectId, MGM_3_RM3100_UT, this);
|
lp_vec_t<float, 3> mgm3Rm3100 = lp_vec_t<float, 3>(sid.objectId, MGM_3_RM3100_UT, this);
|
||||||
// The IMTQ measurements are in integer nT
|
// The IMTQ measurements are in integer nT
|
||||||
lp_vec_t<int32_t, 3> imtqCal = lp_vec_t<int32_t, 3>(sid.objectId, MGM_IMTQ_CAL_NT, this);
|
lp_vec_t<int32_t, 3> imtqCal = lp_vec_t<int32_t, 3>(sid.objectId, MGM_IMTQ_CAL_NT, this);
|
||||||
lp_var_t<uint8_t> actuationCalStatus = lp_var_t<uint8_t>(sid.objectId,
|
lp_var_t<uint8_t> actuationCalStatus =
|
||||||
MGM_IMTQ_CAL_ACT_STATUS, this);
|
lp_var_t<uint8_t>(sid.objectId, MGM_IMTQ_CAL_ACT_STATUS, this);
|
||||||
private:
|
|
||||||
|
|
||||||
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace acsctrl
|
||||||
|
|
||||||
#endif /* MISSION_CONTROLLER_CONTROLLERDEFINITIONS_ACSCTRLDEFINITIONS_H_ */
|
#endif /* MISSION_CONTROLLER_CONTROLLERDEFINITIONS_ACSCTRLDEFINITIONS_H_ */
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
#include <fsfw/pus/Service9TimeManagement.h>
|
#include <fsfw/pus/Service9TimeManagement.h>
|
||||||
#include <fsfw/storagemanager/PoolManager.h>
|
#include <fsfw/storagemanager/PoolManager.h>
|
||||||
#include <fsfw/tcdistribution/CCSDSDistributor.h>
|
#include <fsfw/tcdistribution/CCSDSDistributor.h>
|
||||||
#include <fsfw/tcdistribution/PUSDistributor.h>
|
#include <fsfw/tcdistribution/PusDistributor.h>
|
||||||
#include <fsfw/timemanager/TimeStamper.h>
|
#include <fsfw/timemanager/CdsShortTimeStamper.h>
|
||||||
#include <mission/tmtc/TmFunnel.h>
|
#include <mission/tmtc/TmFunnel.h>
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
@ -54,7 +54,8 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) {
|
|||||||
*healthTable_ = healthTable;
|
*healthTable_ = healthTable;
|
||||||
}
|
}
|
||||||
new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER);
|
new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER);
|
||||||
new TimeStamper(objects::TIME_STAMPER);
|
new VerificationReporter();
|
||||||
|
auto* timeStamper = new CdsShortTimeStamper(objects::TIME_STAMPER);
|
||||||
|
|
||||||
{
|
{
|
||||||
PoolManager::LocalPoolConfig poolCfg = {{300, 16}, {300, 32}, {200, 64},
|
PoolManager::LocalPoolConfig poolCfg = {{300, 16}, {300, 32}, {200, 64},
|
||||||
@ -75,15 +76,14 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto* ccsdsDistrib = new CCSDSDistributor(apid::EIVE_OBSW, objects::CCSDS_PACKET_DISTRIBUTOR);
|
auto* ccsdsDistrib = new CCSDSDistributor(apid::EIVE_OBSW, objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||||
new PUSDistributor(apid::EIVE_OBSW, objects::PUS_PACKET_DISTRIBUTOR,
|
new PusDistributor(apid::EIVE_OBSW, objects::PUS_PACKET_DISTRIBUTOR, ccsdsDistrib);
|
||||||
objects::CCSDS_PACKET_DISTRIBUTOR);
|
|
||||||
|
|
||||||
uint8_t vc = 0;
|
uint8_t vc = 0;
|
||||||
#if OBSW_TM_TO_PTME == 1
|
#if OBSW_TM_TO_PTME == 1
|
||||||
vc = config::LIVE_TM;
|
vc = config::LIVE_TM;
|
||||||
#endif
|
#endif
|
||||||
// Every TM packet goes through this funnel
|
// Every TM packet goes through this funnel
|
||||||
new TmFunnel(objects::TM_FUNNEL, 50, vc);
|
new TmFunnel(objects::TM_FUNNEL, *timeStamper, 50, vc);
|
||||||
|
|
||||||
// PUS service stack
|
// PUS service stack
|
||||||
new Service1TelecommandVerification(objects::PUS_SERVICE_1_VERIFICATION, apid::EIVE_OBSW,
|
new Service1TelecommandVerification(objects::PUS_SERVICE_1_VERIFICATION, apid::EIVE_OBSW,
|
||||||
@ -92,15 +92,18 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) {
|
|||||||
pus::PUS_SERVICE_2, 3, 10);
|
pus::PUS_SERVICE_2, 3, 10);
|
||||||
new Service3Housekeeping(objects::PUS_SERVICE_3_HOUSEKEEPING, apid::EIVE_OBSW,
|
new Service3Housekeeping(objects::PUS_SERVICE_3_HOUSEKEEPING, apid::EIVE_OBSW,
|
||||||
pus::PUS_SERVICE_3);
|
pus::PUS_SERVICE_3);
|
||||||
new Service5EventReporting(objects::PUS_SERVICE_5_EVENT_REPORTING, apid::EIVE_OBSW,
|
new Service5EventReporting(
|
||||||
pus::PUS_SERVICE_5, 15, 45);
|
PsbParams(objects::PUS_SERVICE_5_EVENT_REPORTING, apid::EIVE_OBSW, pus::PUS_SERVICE_5), 15,
|
||||||
|
45);
|
||||||
new Service8FunctionManagement(objects::PUS_SERVICE_8_FUNCTION_MGMT, apid::EIVE_OBSW,
|
new Service8FunctionManagement(objects::PUS_SERVICE_8_FUNCTION_MGMT, apid::EIVE_OBSW,
|
||||||
pus::PUS_SERVICE_8, 3, 60);
|
pus::PUS_SERVICE_8, 3, 60);
|
||||||
new Service9TimeManagement(objects::PUS_SERVICE_9_TIME_MGMT, apid::EIVE_OBSW, pus::PUS_SERVICE_9);
|
new Service9TimeManagement(
|
||||||
|
PsbParams(objects::PUS_SERVICE_9_TIME_MGMT, apid::EIVE_OBSW, pus::PUS_SERVICE_9));
|
||||||
|
|
||||||
new Service11TelecommandScheduling<common::OBSW_MAX_SCHEDULED_TCS>(
|
new Service11TelecommandScheduling<common::OBSW_MAX_SCHEDULED_TCS>(
|
||||||
objects::PUS_SERVICE_11_TC_SCHEDULER, apid::EIVE_OBSW, pus::PUS_SERVICE_11, ccsdsDistrib);
|
PsbParams(objects::PUS_SERVICE_11_TC_SCHEDULER, apid::EIVE_OBSW, pus::PUS_SERVICE_11),
|
||||||
new Service17Test(objects::PUS_SERVICE_17_TEST, apid::EIVE_OBSW, pus::PUS_SERVICE_17);
|
ccsdsDistrib);
|
||||||
|
new Service17Test(PsbParams(objects::PUS_SERVICE_17_TEST, apid::EIVE_OBSW, pus::PUS_SERVICE_17));
|
||||||
new Service20ParameterManagement(objects::PUS_SERVICE_20_PARAMETERS, apid::EIVE_OBSW,
|
new Service20ParameterManagement(objects::PUS_SERVICE_20_PARAMETERS, apid::EIVE_OBSW,
|
||||||
pus::PUS_SERVICE_20);
|
pus::PUS_SERVICE_20);
|
||||||
new CService200ModeCommanding(objects::PUS_SERVICE_200_MODE_MGMT, apid::EIVE_OBSW,
|
new CService200ModeCommanding(objects::PUS_SERVICE_200_MODE_MGMT, apid::EIVE_OBSW,
|
||||||
|
@ -170,8 +170,10 @@ ReturnValue_t ACUHandler::initializeLocalDataPool(localpool::DataPool &localData
|
|||||||
localDataPoolMap.emplace(pool::ACU_WDT_CNT_GND, new PoolEntry<uint32_t>({0}));
|
localDataPoolMap.emplace(pool::ACU_WDT_CNT_GND, new PoolEntry<uint32_t>({0}));
|
||||||
localDataPoolMap.emplace(pool::ACU_WDT_GND_LEFT, new PoolEntry<uint32_t>({0}));
|
localDataPoolMap.emplace(pool::ACU_WDT_GND_LEFT, new PoolEntry<uint32_t>({0}));
|
||||||
|
|
||||||
poolManager.subscribeForPeriodicPacket(coreHk.getSid(), false, 10.0, true);
|
poolManager.subscribeForDiagPeriodicPacket(
|
||||||
poolManager.subscribeForPeriodicPacket(auxHk.getSid(), false, 30.0, false);
|
subdp::DiagnosticsHkPeriodicParams(coreHk.getSid(), false, 10.0));
|
||||||
|
poolManager.subscribeForRegularPeriodicPacket(
|
||||||
|
subdp::RegularHkPeriodicParams(auxHk.getSid(), false, 30.0));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +270,8 @@ ReturnValue_t BpxBatteryHandler::initializeLocalDataPool(localpool::DataPool& lo
|
|||||||
localDataPoolMap.emplace(BpxBattery::BATTERY_HEATER_MODE, &battheatMode);
|
localDataPoolMap.emplace(BpxBattery::BATTERY_HEATER_MODE, &battheatMode);
|
||||||
localDataPoolMap.emplace(BpxBattery::BATTHEAT_LOW_LIMIT, &battheatLow);
|
localDataPoolMap.emplace(BpxBattery::BATTHEAT_LOW_LIMIT, &battheatLow);
|
||||||
localDataPoolMap.emplace(BpxBattery::BATTHEAT_HIGH_LIMIT, &battheatHigh);
|
localDataPoolMap.emplace(BpxBattery::BATTHEAT_HIGH_LIMIT, &battheatHigh);
|
||||||
poolManager.subscribeForPeriodicPacket(hkSet.getSid(), false, 30.0, false);
|
poolManager.subscribeForRegularPeriodicPacket(
|
||||||
|
subdp::RegularHkPeriodicParams(hkSet.getSid(), false, 30.0));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,7 +363,8 @@ ReturnValue_t GyroADIS1650XHandler::initializeLocalDataPool(localpool::DataPool
|
|||||||
localDataPoolMap.emplace(ADIS1650X::FILTER_SETTINGS, new PoolEntry<uint8_t>());
|
localDataPoolMap.emplace(ADIS1650X::FILTER_SETTINGS, new PoolEntry<uint8_t>());
|
||||||
localDataPoolMap.emplace(ADIS1650X::MSC_CTRL_REGISTER, new PoolEntry<uint16_t>());
|
localDataPoolMap.emplace(ADIS1650X::MSC_CTRL_REGISTER, new PoolEntry<uint16_t>());
|
||||||
localDataPoolMap.emplace(ADIS1650X::DEC_RATE_REGISTER, new PoolEntry<uint16_t>());
|
localDataPoolMap.emplace(ADIS1650X::DEC_RATE_REGISTER, new PoolEntry<uint16_t>());
|
||||||
poolManager.subscribeForPeriodicPacket(primaryDataset.getSid(), false, 5.0, true);
|
poolManager.subscribeForRegularPeriodicPacket(
|
||||||
|
subdp::RegularHkPeriodicParams(primaryDataset.getSid(), false, 5.0));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -604,9 +604,12 @@ ReturnValue_t IMTQHandler::initializeLocalDataPool(localpool::DataPool& localDat
|
|||||||
localDataPoolMap.emplace(IMTQ::FINA_NEG_Z_COIL_Y_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
localDataPoolMap.emplace(IMTQ::FINA_NEG_Z_COIL_Y_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
||||||
localDataPoolMap.emplace(IMTQ::FINA_NEG_Z_COIL_Z_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
localDataPoolMap.emplace(IMTQ::FINA_NEG_Z_COIL_Z_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
||||||
|
|
||||||
poolManager.subscribeForPeriodicPacket(engHkDataset.getSid(), false, 10.0, true);
|
poolManager.subscribeForDiagPeriodicPacket(
|
||||||
poolManager.subscribeForPeriodicPacket(calMtmMeasurementSet.getSid(), false, 10.0, true);
|
subdp::DiagnosticsHkPeriodicParams(engHkDataset.getSid(), false, 10.0));
|
||||||
poolManager.subscribeForPeriodicPacket(rawMtmMeasurementSet.getSid(), false, 10.0, true);
|
poolManager.subscribeForDiagPeriodicPacket(
|
||||||
|
subdp::DiagnosticsHkPeriodicParams(calMtmMeasurementSet.getSid(), false, 10.0));
|
||||||
|
poolManager.subscribeForDiagPeriodicPacket(
|
||||||
|
subdp::DiagnosticsHkPeriodicParams(rawMtmMeasurementSet.getSid(), false, 10.0));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +184,8 @@ ReturnValue_t Max31865EiveHandler::initializeLocalDataPool(localpool::DataPool&
|
|||||||
localDataPoolMap.emplace(static_cast<lp_id_t>(PoolIds::LAST_FAULT_BYTE),
|
localDataPoolMap.emplace(static_cast<lp_id_t>(PoolIds::LAST_FAULT_BYTE),
|
||||||
new PoolEntry<uint8_t>({0}));
|
new PoolEntry<uint8_t>({0}));
|
||||||
localDataPoolMap.emplace(static_cast<lp_id_t>(PoolIds::FAULT_BYTE), new PoolEntry<uint8_t>({0}));
|
localDataPoolMap.emplace(static_cast<lp_id_t>(PoolIds::FAULT_BYTE), new PoolEntry<uint8_t>({0}));
|
||||||
poolManager.subscribeForPeriodicPacket(sensorDataset.getSid(), false, 30.0, false);
|
poolManager.subscribeForRegularPeriodicPacket(
|
||||||
|
subdp::RegularHkPeriodicParams(sensorDataset.getSid(), false, 30.0));
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -514,7 +514,8 @@ ReturnValue_t Max31865PT1000Handler::initializeLocalDataPool(localpool::DataPool
|
|||||||
localDataPoolMap.emplace(static_cast<lp_id_t>(PoolIds::LAST_FAULT_BYTE),
|
localDataPoolMap.emplace(static_cast<lp_id_t>(PoolIds::LAST_FAULT_BYTE),
|
||||||
new PoolEntry<uint8_t>({0}));
|
new PoolEntry<uint8_t>({0}));
|
||||||
localDataPoolMap.emplace(static_cast<lp_id_t>(PoolIds::FAULT_BYTE), new PoolEntry<uint8_t>({0}));
|
localDataPoolMap.emplace(static_cast<lp_id_t>(PoolIds::FAULT_BYTE), new PoolEntry<uint8_t>({0}));
|
||||||
poolManager.subscribeForPeriodicPacket(sensorDataset.getSid(), false, 30.0, false);
|
poolManager.subscribeForRegularPeriodicPacket(
|
||||||
|
subdp::RegularHkPeriodicParams(sensorDataset.getSid(), false, 30.0));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,8 +225,10 @@ ReturnValue_t P60DockHandler::initializeLocalDataPool(localpool::DataPool &local
|
|||||||
|
|
||||||
localDataPoolMap.emplace(pool::P60DOCK_ANT6_DEPL, new PoolEntry<int8_t>({0}));
|
localDataPoolMap.emplace(pool::P60DOCK_ANT6_DEPL, new PoolEntry<int8_t>({0}));
|
||||||
localDataPoolMap.emplace(pool::P60DOCK_AR6_DEPL, new PoolEntry<int8_t>({0}));
|
localDataPoolMap.emplace(pool::P60DOCK_AR6_DEPL, new PoolEntry<int8_t>({0}));
|
||||||
poolManager.subscribeForPeriodicPacket(coreHk.getSid(), false, 10.0, false);
|
poolManager.subscribeForDiagPeriodicPacket(
|
||||||
poolManager.subscribeForPeriodicPacket(auxHk.getSid(), false, 30.0, false);
|
subdp::DiagnosticsHkPeriodicParams(coreHk.getSid(), false, 10.0));
|
||||||
|
poolManager.subscribeForRegularPeriodicPacket(
|
||||||
|
subdp::RegularHkPeriodicParams(auxHk.getSid(), false, 30.0));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,7 +394,8 @@ ReturnValue_t PCDUHandler::initializeLocalDataPool(localpool::DataPool& localDat
|
|||||||
using namespace pcdu;
|
using namespace pcdu;
|
||||||
localDataPoolMap.emplace(PoolIds::PDU1_SWITCHES, &pdu1Switches);
|
localDataPoolMap.emplace(PoolIds::PDU1_SWITCHES, &pdu1Switches);
|
||||||
localDataPoolMap.emplace(PoolIds::PDU2_SWITCHES, &pdu2Switches);
|
localDataPoolMap.emplace(PoolIds::PDU2_SWITCHES, &pdu2Switches);
|
||||||
poolManager.subscribeForPeriodicPacket(switcherSet.getSid(), false, 5.0, true);
|
poolManager.subscribeForRegularPeriodicPacket(
|
||||||
|
subdp::RegularHkPeriodicParams(switcherSet.getSid(), false, 5.0));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,8 +30,7 @@ class PCDUHandler : public PowerSwitchIF,
|
|||||||
|
|
||||||
virtual ReturnValue_t initialize() override;
|
virtual ReturnValue_t initialize() override;
|
||||||
virtual ReturnValue_t performOperation(uint8_t counter) override;
|
virtual ReturnValue_t performOperation(uint8_t counter) override;
|
||||||
virtual void handleChangedDataset(sid_t sid,
|
virtual void handleChangedDataset(sid_t sid, store_address_t storeId = store_address_t::invalid(),
|
||||||
store_address_t storeId = storeId::INVALID_STORE_ADDRESS,
|
|
||||||
bool* clearMessage = nullptr) override;
|
bool* clearMessage = nullptr) override;
|
||||||
|
|
||||||
virtual ReturnValue_t sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) override;
|
virtual ReturnValue_t sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) override;
|
||||||
|
@ -86,8 +86,10 @@ void PDU1Handler::parseHkTableReply(const uint8_t *packet) {
|
|||||||
ReturnValue_t PDU1Handler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
ReturnValue_t PDU1Handler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||||
LocalDataPoolManager &poolManager) {
|
LocalDataPoolManager &poolManager) {
|
||||||
initializePduPool(localDataPoolMap, poolManager, pcdu::INIT_SWITCHES_PDU1);
|
initializePduPool(localDataPoolMap, poolManager, pcdu::INIT_SWITCHES_PDU1);
|
||||||
poolManager.subscribeForPeriodicPacket(coreHk.getSid(), false, 10.0, true);
|
poolManager.subscribeForDiagPeriodicPacket(
|
||||||
poolManager.subscribeForPeriodicPacket(auxHk.getSid(), false, 30.0, false);
|
subdp::DiagnosticsHkPeriodicParams(coreHk.getSid(), false, 10.0));
|
||||||
|
poolManager.subscribeForRegularPeriodicPacket(
|
||||||
|
subdp::RegularHkPeriodicParams(auxHk.getSid(), false, 30.0));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,8 +49,10 @@ void PDU2Handler::parseHkTableReply(const uint8_t *packet) {
|
|||||||
ReturnValue_t PDU2Handler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
ReturnValue_t PDU2Handler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||||
LocalDataPoolManager &poolManager) {
|
LocalDataPoolManager &poolManager) {
|
||||||
initializePduPool(localDataPoolMap, poolManager, pcdu::INIT_SWITCHES_PDU2);
|
initializePduPool(localDataPoolMap, poolManager, pcdu::INIT_SWITCHES_PDU2);
|
||||||
poolManager.subscribeForPeriodicPacket(coreHk.getSid(), false, 10.0, true);
|
poolManager.subscribeForDiagPeriodicPacket(
|
||||||
poolManager.subscribeForPeriodicPacket(auxHk.getSid(), false, 30.0, false);
|
subdp::DiagnosticsHkPeriodicParams(coreHk.getSid(), false, 10.0));
|
||||||
|
poolManager.subscribeForRegularPeriodicPacket(
|
||||||
|
subdp::RegularHkPeriodicParams(auxHk.getSid(), false, 30.0));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,7 +295,8 @@ ReturnValue_t PayloadPcduHandler::initializeLocalDataPool(localpool::DataPool& l
|
|||||||
localDataPoolMap.emplace(plpcdu::PlPcduPoolIds::CHANNEL_VEC, &channelValues);
|
localDataPoolMap.emplace(plpcdu::PlPcduPoolIds::CHANNEL_VEC, &channelValues);
|
||||||
localDataPoolMap.emplace(plpcdu::PlPcduPoolIds::PROCESSED_VEC, &processedValues);
|
localDataPoolMap.emplace(plpcdu::PlPcduPoolIds::PROCESSED_VEC, &processedValues);
|
||||||
localDataPoolMap.emplace(plpcdu::PlPcduPoolIds::TEMP, &tempC);
|
localDataPoolMap.emplace(plpcdu::PlPcduPoolIds::TEMP, &tempC);
|
||||||
poolManager.subscribeForPeriodicPacket(adcSet.getSid(), false, 5.0, true);
|
poolManager.subscribeForDiagPeriodicPacket(
|
||||||
|
subdp::DiagnosticsHkPeriodicParams(adcSet.getSid(), false, 5.0));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +204,8 @@ ReturnValue_t RadiationSensorHandler::initializeLocalDataPool(localpool::DataPoo
|
|||||||
localDataPoolMap.emplace(RAD_SENSOR::AIN5, new PoolEntry<uint16_t>({0}));
|
localDataPoolMap.emplace(RAD_SENSOR::AIN5, new PoolEntry<uint16_t>({0}));
|
||||||
localDataPoolMap.emplace(RAD_SENSOR::AIN6, new PoolEntry<uint16_t>({0}));
|
localDataPoolMap.emplace(RAD_SENSOR::AIN6, new PoolEntry<uint16_t>({0}));
|
||||||
localDataPoolMap.emplace(RAD_SENSOR::AIN7, new PoolEntry<uint16_t>({0}));
|
localDataPoolMap.emplace(RAD_SENSOR::AIN7, new PoolEntry<uint16_t>({0}));
|
||||||
poolManager.subscribeForPeriodicPacket(dataset.getSid(), false, 20.0, false);
|
poolManager.subscribeForRegularPeriodicPacket(
|
||||||
|
subdp::RegularHkPeriodicParams(dataset.getSid(), false, 20.0));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,9 +277,12 @@ ReturnValue_t RwHandler::initializeLocalDataPool(localpool::DataPool& localDataP
|
|||||||
localDataPoolMap.emplace(RwDefinitions::SPI_BYTES_READ, new PoolEntry<uint32_t>({0}));
|
localDataPoolMap.emplace(RwDefinitions::SPI_BYTES_READ, new PoolEntry<uint32_t>({0}));
|
||||||
localDataPoolMap.emplace(RwDefinitions::SPI_REG_OVERRUN_ERRORS, new PoolEntry<uint32_t>({0}));
|
localDataPoolMap.emplace(RwDefinitions::SPI_REG_OVERRUN_ERRORS, new PoolEntry<uint32_t>({0}));
|
||||||
localDataPoolMap.emplace(RwDefinitions::SPI_TOTAL_ERRORS, new PoolEntry<uint32_t>({0}));
|
localDataPoolMap.emplace(RwDefinitions::SPI_TOTAL_ERRORS, new PoolEntry<uint32_t>({0}));
|
||||||
poolManager.subscribeForPeriodicPacket(statusSet.getSid(), false, 5.0, true);
|
poolManager.subscribeForDiagPeriodicPacket(
|
||||||
poolManager.subscribeForPeriodicPacket(tmDataset.getSid(), false, 30.0, false);
|
subdp::DiagnosticsHkPeriodicParams(statusSet.getSid(), false, 5.0));
|
||||||
poolManager.subscribeForPeriodicPacket(lastResetStatusSet.getSid(), false, 30.0, false);
|
poolManager.subscribeForRegularPeriodicPacket(
|
||||||
|
subdp::RegularHkPeriodicParams(tmDataset.getSid(), false, 30.0));
|
||||||
|
poolManager.subscribeForRegularPeriodicPacket(
|
||||||
|
subdp::RegularHkPeriodicParams(lastResetStatusSet.getSid(), false, 30.0));
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +202,8 @@ ReturnValue_t SusHandler::initializeLocalDataPool(localpool::DataPool &localData
|
|||||||
LocalDataPoolManager &poolManager) {
|
LocalDataPoolManager &poolManager) {
|
||||||
localDataPoolMap.emplace(SUS::TEMPERATURE_C, &tempC);
|
localDataPoolMap.emplace(SUS::TEMPERATURE_C, &tempC);
|
||||||
localDataPoolMap.emplace(SUS::CHANNEL_VEC, &channelVec);
|
localDataPoolMap.emplace(SUS::CHANNEL_VEC, &channelVec);
|
||||||
poolManager.subscribeForPeriodicPacket(dataset.getSid(), false, 5.0, true);
|
poolManager.subscribeForDiagPeriodicPacket(
|
||||||
|
subdp::DiagnosticsHkPeriodicParams(dataset.getSid(), false, 5.0));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -621,9 +621,12 @@ ReturnValue_t SyrlinksHkHandler::initializeLocalDataPool(localpool::DataPool& lo
|
|||||||
localDataPoolMap.emplace(syrlinks::TEMP_BASEBAND_BOARD, new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(syrlinks::TEMP_BASEBAND_BOARD, new PoolEntry<float>({0}));
|
||||||
localDataPoolMap.emplace(syrlinks::TEMP_POWER_AMPLIFIER, new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(syrlinks::TEMP_POWER_AMPLIFIER, new PoolEntry<float>({0}));
|
||||||
|
|
||||||
poolManager.subscribeForPeriodicPacket(txDataset.getSid(), false, 5.0, true);
|
poolManager.subscribeForDiagPeriodicPacket(
|
||||||
poolManager.subscribeForPeriodicPacket(rxDataset.getSid(), false, 5.0, true);
|
subdp::DiagnosticsHkPeriodicParams(txDataset.getSid(), false, 5.0));
|
||||||
poolManager.subscribeForPeriodicPacket(temperatureSet.getSid(), false, 10.0, false);
|
poolManager.subscribeForDiagPeriodicPacket(
|
||||||
|
subdp::DiagnosticsHkPeriodicParams(rxDataset.getSid(), false, 5.0));
|
||||||
|
poolManager.subscribeForRegularPeriodicPacket(
|
||||||
|
subdp::RegularHkPeriodicParams(temperatureSet.getSid(), false, 10.0));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,6 +123,7 @@ uint32_t Tmp1075Handler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) {
|
|||||||
ReturnValue_t Tmp1075Handler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
ReturnValue_t Tmp1075Handler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||||
LocalDataPoolManager &poolManager) {
|
LocalDataPoolManager &poolManager) {
|
||||||
localDataPoolMap.emplace(TMP1075::TEMPERATURE_C_TMP1075, new PoolEntry<float>({0.0}));
|
localDataPoolMap.emplace(TMP1075::TEMPERATURE_C_TMP1075, new PoolEntry<float>({0.0}));
|
||||||
poolManager.subscribeForPeriodicPacket(dataset.getSid(), false, 30.0, false);
|
poolManager.subscribeForRegularPeriodicPacket(
|
||||||
|
subdp::RegularHkPeriodicParams(dataset.getSid(), false, 30.0));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
122
mission/devices/devicedefinitions/SpBase.h
Normal file
122
mission/devices/devicedefinitions/SpBase.h
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_SPBASE_H_
|
||||||
|
#define MISSION_DEVICES_DEVICEDEFINITIONS_SPBASE_H_
|
||||||
|
|
||||||
|
#include <fsfw/tmtcpacket/ccsds/SpacePacketCreator.h>
|
||||||
|
#include <fsfw/tmtcpacket/ccsds/SpacePacketReader.h>
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
namespace ploc {
|
||||||
|
|
||||||
|
struct SpTcParams {
|
||||||
|
SpTcParams(SpacePacketCreator& creator) : creator(creator) {}
|
||||||
|
|
||||||
|
SpTcParams(SpacePacketCreator& creator, uint8_t* buf, size_t maxSize)
|
||||||
|
: creator(creator), buf(buf), maxSize(maxSize) {}
|
||||||
|
|
||||||
|
void setPayloadLen(size_t payloadLen_) { dataFieldLen = payloadLen_ + 2; }
|
||||||
|
|
||||||
|
void setDataFieldLen(size_t dataFieldLen_) { dataFieldLen = dataFieldLen_; }
|
||||||
|
|
||||||
|
SpacePacketCreator& creator;
|
||||||
|
uint8_t* buf = nullptr;
|
||||||
|
size_t maxSize = 0;
|
||||||
|
size_t dataFieldLen = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class SpTcBase {
|
||||||
|
public:
|
||||||
|
SpTcBase(SpTcParams params) : spParams(params) {
|
||||||
|
payloadStart = spParams.buf + ccsds::HEADER_LEN;
|
||||||
|
updateSpFields();
|
||||||
|
}
|
||||||
|
|
||||||
|
SpTcBase(SpTcParams params, uint16_t apid, uint16_t seqCount) : spParams(params) {
|
||||||
|
spParams.creator.setApid(apid);
|
||||||
|
spParams.creator.setSeqCount(seqCount);
|
||||||
|
payloadStart = spParams.buf + ccsds::HEADER_LEN;
|
||||||
|
updateSpFields();
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateSpFields() {
|
||||||
|
spParams.creator.setDataLen(spParams.dataFieldLen - 1);
|
||||||
|
spParams.creator.setPacketType(ccsds::PacketType::TC);
|
||||||
|
}
|
||||||
|
|
||||||
|
const uint8_t* getFullPacket() const { return spParams.buf; }
|
||||||
|
|
||||||
|
size_t getFullPacketLen() const { return spParams.creator.getFullPacketLen(); }
|
||||||
|
|
||||||
|
uint16_t getApid() const { return spParams.creator.getApid(); }
|
||||||
|
|
||||||
|
ReturnValue_t checkPayloadLen() {
|
||||||
|
if (ccsds::HEADER_LEN + spParams.dataFieldLen > spParams.maxSize) {
|
||||||
|
return SerializeIF::BUFFER_TOO_SHORT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result::OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t serializeHeader() {
|
||||||
|
updateSpFields();
|
||||||
|
size_t serLen = 0;
|
||||||
|
return spParams.creator.serializeBe(spParams.buf, serLen, spParams.maxSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t checkSizeAndSerializeHeader() {
|
||||||
|
ReturnValue_t result = checkPayloadLen();
|
||||||
|
if (result != result::OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return serializeHeader();
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t calcCrc() {
|
||||||
|
/* Calculate crc */
|
||||||
|
uint16_t crc = CRC::crc16ccitt(spParams.buf, ccsds::HEADER_LEN + spParams.dataFieldLen - 2);
|
||||||
|
|
||||||
|
/* Add crc to packet data field of space packet */
|
||||||
|
size_t serializedSize = 0;
|
||||||
|
return SerializeAdapter::serialize<uint16_t>(&crc, &payloadStart, &serializedSize, sizeof(crc),
|
||||||
|
SerializeIF::Endianness::BIG);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
ploc::SpTcParams spParams;
|
||||||
|
uint8_t* payloadStart;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Class for handling tm replies of the supervisor.
|
||||||
|
*/
|
||||||
|
class SpTmReader : public SpacePacketReader {
|
||||||
|
public:
|
||||||
|
SpTmReader() = default;
|
||||||
|
/**
|
||||||
|
* @brief Constructor creates idle packet and sets length field to maximum allowed size.
|
||||||
|
*/
|
||||||
|
SpTmReader(const uint8_t* buf, size_t maxSize) : SpacePacketReader(buf, maxSize) {}
|
||||||
|
|
||||||
|
ReturnValue_t setData(const uint8_t* buf, size_t maxSize) {
|
||||||
|
return setReadOnlyData(buf, maxSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns the payload data length (data field length without CRC)
|
||||||
|
*/
|
||||||
|
uint16_t getPayloadDataLength() { return getPacketDataLen() - 2; }
|
||||||
|
|
||||||
|
ReturnValue_t checkCrc() {
|
||||||
|
const uint8_t* crcPtr = getFullData() + getFullPacketLen() - CRC_SIZE;
|
||||||
|
uint16_t receivedCrc = *(crcPtr) << 8 | *(crcPtr + 1);
|
||||||
|
uint16_t recalculatedCrc = CRC::crc16ccitt(getFullData(), getFullPacketLen() - CRC_SIZE);
|
||||||
|
if (recalculatedCrc != receivedCrc) {
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace ploc
|
||||||
|
|
||||||
|
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_SPBASE_H_ */
|
@ -1,6 +1,7 @@
|
|||||||
#include <fsfw/ipc/QueueFactory.h>
|
#include <fsfw/ipc/QueueFactory.h>
|
||||||
#include <fsfw/objectmanager/ObjectManager.h>
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||||
|
#include <fsfw/timemanager/CdsShortTimeStamper.h>
|
||||||
#include <fsfw/tmtcpacket/pus/tm.h>
|
#include <fsfw/tmtcpacket/pus/tm.h>
|
||||||
#include <mission/tmtc/TmFunnel.h>
|
#include <mission/tmtc/TmFunnel.h>
|
||||||
|
|
||||||
@ -9,8 +10,12 @@
|
|||||||
object_id_t TmFunnel::downlinkDestination = objects::NO_OBJECT;
|
object_id_t TmFunnel::downlinkDestination = objects::NO_OBJECT;
|
||||||
object_id_t TmFunnel::storageDestination = objects::NO_OBJECT;
|
object_id_t TmFunnel::storageDestination = objects::NO_OBJECT;
|
||||||
|
|
||||||
TmFunnel::TmFunnel(object_id_t objectId, uint32_t messageDepth, uint8_t reportReceptionVc)
|
TmFunnel::TmFunnel(object_id_t objectId, CdsShortTimeStamper& timeReader, uint32_t messageDepth,
|
||||||
: SystemObject(objectId), messageDepth(messageDepth), reportReceptionVc(reportReceptionVc) {
|
uint8_t reportReceptionVc)
|
||||||
|
: SystemObject(objectId),
|
||||||
|
timeReader(timeReader),
|
||||||
|
messageDepth(messageDepth),
|
||||||
|
reportReceptionVc(reportReceptionVc) {
|
||||||
auto mqArgs = MqArgs(objectId, static_cast<void*>(this));
|
auto mqArgs = MqArgs(objectId, static_cast<void*>(this));
|
||||||
tmQueue = QueueFactory::instance()->createMessageQueue(
|
tmQueue = QueueFactory::instance()->createMessageQueue(
|
||||||
messageDepth, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs);
|
messageDepth, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs);
|
||||||
@ -49,11 +54,15 @@ ReturnValue_t TmFunnel::handlePacket(TmTcMessage* message) {
|
|||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
TmPacketPusC packet(packetData);
|
|
||||||
packet.setPacketSequenceCount(this->sourceSequenceCount);
|
PusTmZeroCopyWriter packet(timeReader, packetData, size);
|
||||||
sourceSequenceCount++;
|
result = packet.parseDataWithoutCrcCheck();
|
||||||
sourceSequenceCount = sourceSequenceCount % SpacePacketBase::LIMIT_SEQUENCE_COUNT;
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
packet.setErrorControl();
|
return result;
|
||||||
|
}
|
||||||
|
packet.setSequenceCount(sourceSequenceCount++);
|
||||||
|
sourceSequenceCount = sourceSequenceCount % ccsds::LIMIT_SEQUENCE_COUNT;
|
||||||
|
packet.updateErrorControl();
|
||||||
|
|
||||||
result = tmQueue->sendToDefault(message);
|
result = tmQueue->sendToDefault(message);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
@ -107,7 +116,7 @@ ReturnValue_t TmFunnel::initialize() {
|
|||||||
AcceptsTelemetryIF* storageTarget =
|
AcceptsTelemetryIF* storageTarget =
|
||||||
ObjectManager::instance()->get<AcceptsTelemetryIF>(storageDestination);
|
ObjectManager::instance()->get<AcceptsTelemetryIF>(storageDestination);
|
||||||
if (storageTarget != nullptr) {
|
if (storageTarget != nullptr) {
|
||||||
storageQueue->setDefaultDestination(storageTarget->getReportReceptionQueue());
|
storageQueue->setDefaultDestination(storageTarget->getReportReceptionQueue(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
return SystemObject::initialize();
|
return SystemObject::initialize();
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <fsfw/ipc/MessageQueueIF.h>
|
#include <fsfw/ipc/MessageQueueIF.h>
|
||||||
#include <fsfw/objectmanager/SystemObject.h>
|
#include <fsfw/objectmanager/SystemObject.h>
|
||||||
#include <fsfw/tasks/ExecutableObjectIF.h>
|
#include <fsfw/tasks/ExecutableObjectIF.h>
|
||||||
|
#include <fsfw/timemanager/CdsShortTimeStamper.h>
|
||||||
#include <fsfw/tmtcservices/AcceptsTelemetryIF.h>
|
#include <fsfw/tmtcservices/AcceptsTelemetryIF.h>
|
||||||
#include <fsfw/tmtcservices/TmTcMessage.h>
|
#include <fsfw/tmtcservices/TmTcMessage.h>
|
||||||
|
|
||||||
@ -23,7 +24,8 @@ class TmFunnel : public AcceptsTelemetryIF, public ExecutableObjectIF, public Sy
|
|||||||
friend void(Factory::setStaticFrameworkObjectIds)();
|
friend void(Factory::setStaticFrameworkObjectIds)();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TmFunnel(object_id_t objectId, uint32_t messageDepth = 20, uint8_t reportReceptionVc = 0);
|
TmFunnel(object_id_t objectId, CdsShortTimeStamper& timeReader, uint32_t messageDepth = 20,
|
||||||
|
uint8_t reportReceptionVc = 0);
|
||||||
virtual ~TmFunnel();
|
virtual ~TmFunnel();
|
||||||
|
|
||||||
virtual MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel = 0) override;
|
virtual MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel = 0) override;
|
||||||
@ -35,6 +37,7 @@ class TmFunnel : public AcceptsTelemetryIF, public ExecutableObjectIF, public Sy
|
|||||||
static object_id_t storageDestination;
|
static object_id_t storageDestination;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
CdsShortTimeStamper& timeReader;
|
||||||
uint32_t messageDepth = 0;
|
uint32_t messageDepth = 0;
|
||||||
uint8_t reportReceptionVc = 0;
|
uint8_t reportReceptionVc = 0;
|
||||||
uint16_t sourceSequenceCount = 0;
|
uint16_t sourceSequenceCount = 0;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include <fsfw/objectmanager/ObjectManager.h>
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||||
#include <fsfw/storagemanager/PoolManager.h>
|
#include <fsfw/storagemanager/PoolManager.h>
|
||||||
#include <fsfw/timemanager/TimeStamper.h>
|
#include <fsfw/timemanager/CdsShortTimeStamper.h>
|
||||||
|
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
ServiceInterfaceStream sif::debug("DEBUG ");
|
ServiceInterfaceStream sif::debug("DEBUG ");
|
||||||
@ -28,7 +28,7 @@ void factory(void* args) {
|
|||||||
eventManager = new EventManagerMock();
|
eventManager = new EventManagerMock();
|
||||||
new HealthTable(objects::HEALTH_TABLE);
|
new HealthTable(objects::HEALTH_TABLE);
|
||||||
new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER);
|
new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER);
|
||||||
new TimeStamper(objects::TIME_STAMPER);
|
new CdsShortTimeStamper(objects::TIME_STAMPER);
|
||||||
|
|
||||||
{
|
{
|
||||||
PoolManager::LocalPoolConfig poolCfg = {{300, 16}, {200, 32}, {150, 64}, {150, 128},
|
PoolManager::LocalPoolConfig poolCfg = {{300, 16}, {200, 32}, {150, 64}, {150, 128},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user