fixed conflicts
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
#include "GPSHyperionLinuxController.h"
|
||||
|
||||
#include <fsfw/timemanager/Stopwatch.h>
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#include "fsfw/FSFW.h"
|
||||
#include "fsfw/datapool/PoolReadGuard.h"
|
||||
@ -106,10 +108,10 @@ ReturnValue_t GPSHyperionLinuxController::handleCommandMessage(CommandMessage *m
|
||||
|
||||
#ifdef FSFW_OSAL_LINUX
|
||||
void GPSHyperionLinuxController::readGpsDataFromGpsd() {
|
||||
gpsmm myGpsmm(GPSD_SHARED_MEMORY, nullptr);
|
||||
gpsmm gpsmm("localhost", DEFAULT_GPSD_PORT);
|
||||
// The data from the device will generally be read all at once. Therefore, we
|
||||
// can set all field here
|
||||
if (not myGpsmm.is_open()) {
|
||||
if (not gpsmm.is_open()) {
|
||||
if (gpsNotOpenSwitch) {
|
||||
// Opening failed
|
||||
#if FSFW_VERBOSE_LEVEL >= 1
|
||||
@ -121,16 +123,41 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() {
|
||||
}
|
||||
return;
|
||||
}
|
||||
// Stopwatch watch;
|
||||
gps_data_t *gps = nullptr;
|
||||
gps = myGpsmm.read();
|
||||
gps = gpsmm.stream(WATCH_ENABLE | WATCH_JSON);
|
||||
if (gps == nullptr) {
|
||||
if (gpsReadFailedSwitch) {
|
||||
gpsReadFailedSwitch = false;
|
||||
sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: Reading GPS data failed"
|
||||
<< std::endl;
|
||||
}
|
||||
return;
|
||||
sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd:: Setting GPSD watch "
|
||||
"policy failed"
|
||||
<< std::endl;
|
||||
}
|
||||
while (gpsmm.waiting(2000)) {
|
||||
gps = gpsmm.read();
|
||||
if (gps == nullptr) {
|
||||
if (gpsReadFailedSwitch) {
|
||||
gpsReadFailedSwitch = false;
|
||||
sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: Reading GPS data failed"
|
||||
<< std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (MODE_SET != (MODE_SET & gps->set)) {
|
||||
if (noModeSetCntr >= 0) {
|
||||
noModeSetCntr++;
|
||||
}
|
||||
if (noModeSetCntr == 10) {
|
||||
// TODO: Trigger event here
|
||||
sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: No mode could be "
|
||||
"read for 10 consecutive reads"
|
||||
<< std::endl;
|
||||
noModeSetCntr = -1;
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
noModeSetCntr = 0;
|
||||
}
|
||||
}
|
||||
gps = gpsmm.stream(WATCH_DISABLE);
|
||||
PoolReadGuard pg(&gpsSet);
|
||||
if (pg.getReadResult() != HasReturnvaluesIF::RETURN_OK) {
|
||||
#if FSFW_VERBOSE_LEVEL >= 1
|
||||
|
@ -55,6 +55,7 @@ class GPSHyperionLinuxController : public ExtendedControllerBase {
|
||||
bool gpsNotOpenSwitch = true;
|
||||
bool gpsReadFailedSwitch = true;
|
||||
bool debugHyperionGps = false;
|
||||
int32_t noModeSetCntr = 0;
|
||||
uint32_t timeIsConstantCounter = 0;
|
||||
Countdown timeUpdateCd = Countdown(60);
|
||||
|
||||
|
@ -55,6 +55,7 @@ static const DeviceCommandId_t LOGGING_REQUEST_EVENT_BUFFERS = 54;
|
||||
static const DeviceCommandId_t LOGGING_CLEAR_COUNTERS = 55;
|
||||
static const DeviceCommandId_t LOGGING_SET_TOPIC = 56;
|
||||
static const DeviceCommandId_t REQUEST_ADC_REPORT = 57;
|
||||
static const DeviceCommandId_t RESET_PL = 58;
|
||||
|
||||
/** Reply IDs */
|
||||
static const DeviceCommandId_t ACK_REPORT = 50;
|
||||
@ -101,6 +102,7 @@ static const uint16_t APID_SEL_MPSOC_BOOT_IMAGE = 0xA3;
|
||||
static const uint16_t APID_SET_BOOT_TIMEOUT = 0xA4;
|
||||
static const uint16_t APID_SET_MAX_RESTART_TRIES = 0xA5;
|
||||
static const uint16_t APID_RESET_MPSOC = 0xA6;
|
||||
static const uint16_t APID_RESET_PL = 0xA7;
|
||||
static const uint16_t APID_GET_BOOT_STATUS_RPT = 0xA8;
|
||||
static const uint16_t APID_PREPARE_UPDATE = 0xA9;
|
||||
static const uint16_t APID_START_MPSOC_QUIET = 0xAA;
|
||||
@ -115,9 +117,9 @@ static const uint16_t APID_AUTO_TM = 0xC5;
|
||||
static const uint16_t APID_ENABLE_LATCHUP_ALERT = 0xD0;
|
||||
static const uint16_t APID_DISABLE_LATCHUP_ALERT = 0xD1;
|
||||
static const uint16_t APID_SET_ALERT_LIMIT = 0xD3;
|
||||
static const uint16_t APID_SET_ADC_ENABLED_CHANNELS = 0xD6;
|
||||
static const uint16_t APID_SET_ADC_WINDOW_AND_STRIDE = 0xD7;
|
||||
static const uint16_t APID_SET_ADC_THRESHOLD = 0xD8;
|
||||
static const uint16_t APID_SET_ADC_ENABLED_CHANNELS = 0xE1;
|
||||
static const uint16_t APID_SET_ADC_WINDOW_AND_STRIDE = 0xE2;
|
||||
static const uint16_t APID_SET_ADC_THRESHOLD = 0xE3;
|
||||
static const uint16_t APID_GET_LATCHUP_STATUS_REPORT = 0xD9;
|
||||
static const uint16_t APID_COPY_ADC_DATA_TO_MRAM = 0xDA;
|
||||
static const uint16_t APID_REQUEST_ADC_REPORT = 0xDB;
|
||||
@ -266,10 +268,10 @@ static const uint32_t LOGGING_RPT_ID = LOGGING_REQUEST_COUNTERS;
|
||||
static const uint32_t ADC_REPORT_SET_ID = REQUEST_ADC_REPORT;
|
||||
|
||||
namespace recv_timeout {
|
||||
// Erase memory can require up to 60 seconds for execution
|
||||
static const uint32_t ERASE_MEMORY = 60000;
|
||||
static const uint32_t UPDATE_STATUS_REPORT = 60000;
|
||||
}
|
||||
// Erase memory can require up to 60 seconds for execution
|
||||
static const uint32_t ERASE_MEMORY = 60000;
|
||||
static const uint32_t UPDATE_STATUS_REPORT = 70000;
|
||||
} // namespace recv_timeout
|
||||
|
||||
/**
|
||||
* @brief This class creates a space packet containing only the header data and the CRC.
|
||||
@ -1136,7 +1138,7 @@ class WriteMemory : public SupvTcSpacePacket {
|
||||
}
|
||||
|
||||
// Although the space packet has space left for 1010 bytes of data to supervisor can only process
|
||||
// update packets with maximum 512 bytes of update data.
|
||||
// update packets with a maximum of 512 bytes.
|
||||
static const uint16_t CHUNK_MAX = 512;
|
||||
|
||||
private:
|
||||
@ -1163,7 +1165,7 @@ class WriteMemory : public SupvTcSpacePacket {
|
||||
SerializeIF::Endianness::BIG);
|
||||
std::memcpy(dataFieldPtr, updateData, length);
|
||||
if (length % 2 != 0) {
|
||||
this->setPacketDataLength(this->getFullSize() + 1);
|
||||
this->setPacketDataLength(length + sizeof(CCSDSPrimaryHeader) + CRC_SIZE - 1);
|
||||
// The data field must be two bytes aligned. Thus, in case the number of bytes to write is odd
|
||||
// a value of zero is added here
|
||||
*(dataFieldPtr + length + 1) = 0;
|
||||
@ -1245,7 +1247,6 @@ class DisableAutoTm : public SupvTcSpacePacket {
|
||||
*/
|
||||
class RequestLoggingData : public SupvTcSpacePacket {
|
||||
public:
|
||||
|
||||
enum class Sa : uint8_t {
|
||||
REQUEST_COUNTERS = 1,
|
||||
REQUEST_EVENT_BUFFERS = 2,
|
||||
@ -1278,9 +1279,7 @@ class TmPacket : public SpacePacket {
|
||||
/**
|
||||
* @brief Returns the payload data length (data field length without CRC)
|
||||
*/
|
||||
uint16_t getPayloadDataLength() {
|
||||
return this->getPacketDataLength() - 1;
|
||||
}
|
||||
uint16_t getPayloadDataLength() { return this->getPacketDataLength() - 1; }
|
||||
|
||||
ReturnValue_t checkCrc() {
|
||||
uint8_t* crcPtr = this->getPacketData() + this->getPayloadDataLength();
|
||||
@ -1294,6 +1293,257 @@ class TmPacket : public SpacePacket {
|
||||
}
|
||||
};
|
||||
|
||||
class VerificationReport : public TmPacket {
|
||||
public:
|
||||
VerificationReport() : TmPacket() {}
|
||||
|
||||
/**
|
||||
* @brief Gets the APID of command which caused the transmission of this verification report.
|
||||
*/
|
||||
uint16_t getRefApid() {
|
||||
uint16_t refApid = 0;
|
||||
size_t size = 0;
|
||||
uint8_t* refApidPtr = this->getPacketData();
|
||||
ReturnValue_t result = SerializeAdapter::deSerialize(&refApid, refApidPtr, &size,
|
||||
SerializeIF::Endianness::BIG);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::debug << "ExecutionReport: Failed to deserialize reference APID field" << std::endl;
|
||||
return result;
|
||||
}
|
||||
return refApid;
|
||||
}
|
||||
|
||||
uint16_t getStatusCode() {
|
||||
uint16_t statusCode = 0;
|
||||
size_t size = 0;
|
||||
uint8_t* statusCodePtr = this->getPacketData() + OFFSET_STATUS_CODE;
|
||||
ReturnValue_t result = SerializeAdapter::deSerialize(&statusCode, statusCodePtr, &size,
|
||||
SerializeIF::Endianness::BIG);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::debug << "ExecutionReport: Failed to deserialize status code field" << std::endl;
|
||||
return result;
|
||||
}
|
||||
return statusCode;
|
||||
}
|
||||
|
||||
virtual ReturnValue_t checkApid() { return HasReturnvaluesIF::RETURN_FAILED; }
|
||||
|
||||
private:
|
||||
static const uint8_t OFFSET_STATUS_CODE = 4;
|
||||
};
|
||||
|
||||
class AcknowledgmentReport : public VerificationReport {
|
||||
public:
|
||||
AcknowledgmentReport() : VerificationReport() {}
|
||||
|
||||
ReturnValue_t checkApid() {
|
||||
uint16_t apid = this->getAPID();
|
||||
if (apid == APID_ACK_SUCCESS) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
} else if (apid == APID_ACK_FAILURE) {
|
||||
printStatusInformation();
|
||||
return SupvReturnValuesIF::RECEIVED_ACK_FAILURE;
|
||||
} else {
|
||||
sif::warning << "AcknowledgmentReport::checkApid: Invalid apid: 0x" << std::hex << apid
|
||||
<< std::endl;
|
||||
return SupvReturnValuesIF::INVALID_APID;
|
||||
}
|
||||
}
|
||||
|
||||
void printStatusInformation() {
|
||||
StatusCode statusCode = static_cast<StatusCode>(getStatusCode());
|
||||
switch (statusCode) {
|
||||
case StatusCode::OK: {
|
||||
sif::warning << "Supervisor acknowledgment report status: Ok" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::BAD_PARAM: {
|
||||
sif::warning << "Supervisor acknowledgment report status: Bad param" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::TIMEOUT: {
|
||||
sif::warning << "Supervisor acknowledgment report status: Timeout" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::RX_ERROR: {
|
||||
sif::warning << "Supervisor acknowledgment report status: RX error" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::TX_ERROR: {
|
||||
sif::warning << "Supervisor acknowledgment report status: TX error" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::HEADER_EMPTY: {
|
||||
sif::warning << "Supervisor acknowledgment report status: Header empty" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::DEFAULT_NAK: {
|
||||
sif::warning << "Supervisor acknowledgment report status: Default code for nak" <<
|
||||
std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::ROUTE_PACKET: {
|
||||
sif::warning << "Supervisor acknowledgment report status: Route packet error" << std::endl;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sif::warning << "AcknowledgmentReport::printStatusInformation: Invalid status code: 0x"
|
||||
<< std::hex << static_cast<uint16_t>(statusCode) << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
enum class StatusCode : uint16_t {
|
||||
OK = 0x0,
|
||||
BAD_PARAM = 0x1,
|
||||
TIMEOUT = 0x2,
|
||||
RX_ERROR = 0x3,
|
||||
TX_ERROR = 0x4,
|
||||
HEADER_EMPTY = 0x5,
|
||||
DEFAULT_NAK = 0x6,
|
||||
ROUTE_PACKET = 0x7
|
||||
};
|
||||
};
|
||||
|
||||
class ExecutionReport : public VerificationReport {
|
||||
public:
|
||||
ExecutionReport() : VerificationReport() {}
|
||||
|
||||
ReturnValue_t checkApid() {
|
||||
uint16_t apid = this->getAPID();
|
||||
if (apid == APID_EXE_SUCCESS) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
} else if (apid == APID_EXE_FAILURE) {
|
||||
printStatusInformation();
|
||||
return SupvReturnValuesIF::RECEIVED_EXE_FAILURE;
|
||||
} else {
|
||||
sif::warning << "ExecutionReport::checkApid: Invalid apid: 0x" << std::hex << apid
|
||||
<< std::endl;
|
||||
return SupvReturnValuesIF::INVALID_APID;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
enum class StatusCode : uint16_t {
|
||||
OK = 0x0,
|
||||
INIT_ERROR = 0x1,
|
||||
BAD_PARAM = 0x2,
|
||||
NOT_INITIALIZED = 0x3,
|
||||
BAD_PERIPH_ID = 0x4,
|
||||
TIMEOUT = 0x5,
|
||||
RX_ERROR = 0x6,
|
||||
TX_ERROR = 0x7,
|
||||
BUF_EMPTY = 0x8,
|
||||
BUF_FULL = 0x9,
|
||||
NAK = 0xA,
|
||||
ARB_LOST = 0xB,
|
||||
BUSY = 0xC,
|
||||
NOT_IMPLEMENTED = 0xD,
|
||||
ALIGNEMENT_ERROR = 0xE,
|
||||
PERIPH_ERR = 0xF,
|
||||
FAILED_LATCH = 0x10,
|
||||
GPIO_HIGH = 0x11,
|
||||
GPIO_LOW = 0x12,
|
||||
TEST_PASSED = 0x13,
|
||||
TEST_FAILED = 0x14
|
||||
};
|
||||
|
||||
void printStatusInformation() {
|
||||
StatusCode statusCode = static_cast<StatusCode>(getStatusCode());
|
||||
switch (statusCode) {
|
||||
case StatusCode::OK: {
|
||||
sif::warning << "Supervisor execution report status: Ok" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::INIT_ERROR: {
|
||||
sif::warning << "Supervisor execution report status: Init error" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::BAD_PARAM: {
|
||||
sif::warning << "Supervisor execution report status: Bad param" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::NOT_INITIALIZED: {
|
||||
sif::warning << "Supervisor execution report status: Not initialized" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::BAD_PERIPH_ID: {
|
||||
sif::warning << "Supervisor execution report status: Bad periph ID" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::TIMEOUT: {
|
||||
sif::warning << "Supervisor execution report status: Timeout" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::RX_ERROR: {
|
||||
sif::warning << "Supervisor execution report status: RX error" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::TX_ERROR: {
|
||||
sif::warning << "Supervisor execution report status: TX error" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::BUF_EMPTY: {
|
||||
sif::warning << "Supervisor execution report status: Buf empty" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::BUF_FULL: {
|
||||
sif::warning << "Supervisor execution report status: Buf full" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::NAK: {
|
||||
sif::warning << "Supervisor execution report status: Nak, default error code" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::ARB_LOST: {
|
||||
sif::warning << "Supervisor execution report status: Arb lost" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::BUSY: {
|
||||
sif::warning << "Supervisor execution report status: Busy" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::NOT_IMPLEMENTED: {
|
||||
sif::warning << "Supervisor execution report status: Not implemented" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::ALIGNEMENT_ERROR: {
|
||||
sif::warning << "Supervisor execution report status: Alignment error" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::PERIPH_ERR: {
|
||||
sif::warning << "Supervisor execution report status: Periph error" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::FAILED_LATCH: {
|
||||
sif::warning << "Supervisor execution report status: Failed latch" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::GPIO_HIGH: {
|
||||
sif::warning << "Supervisor execution report status: GPIO high" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::GPIO_LOW: {
|
||||
sif::warning << "Supervisor execution report status: GPIO low" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::TEST_PASSED: {
|
||||
sif::warning << "Supervisor execution report status: Test passed" << std::endl;
|
||||
break;
|
||||
}
|
||||
case StatusCode::TEST_FAILED: {
|
||||
sif::warning << "Supervisor execution report status: Test failed" << std::endl;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sif::warning << "ExecutionReport::printStatusInformation: Invalid status code: 0x"
|
||||
<< std::hex << static_cast<uint16_t>(statusCode) << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This dataset stores the boot status report of the supervisor.
|
||||
*/
|
||||
@ -1409,31 +1659,36 @@ class LoggingReport : public StaticLocalDataSet<LOGGING_RPT_SET_ENTRIES> {
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::TM_AVAILABLE_CNT, this);
|
||||
lp_var_t<uint32_t> supervisorBoots =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::SUPERVISOR_BOOTS, this);
|
||||
lp_var_t<uint32_t> mpsocBoots =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::MPSOC_BOOTS, this);
|
||||
lp_var_t<uint32_t> mpsocBoots = lp_var_t<uint32_t>(sid.objectId, PoolIds::MPSOC_BOOTS, this);
|
||||
lp_var_t<uint32_t> mpsocBootFailedAttempts =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::MPSOC_BOOT_FAILED_ATTEMPTS, this);
|
||||
lp_var_t<uint32_t> mpsocPowerup =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::MPSOC_POWER_UP, this);
|
||||
lp_var_t<uint32_t> mpsocUpdates =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::MPSOC_UPDATES, this);
|
||||
lp_var_t<uint32_t> lastRecvdTc =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::LAST_RECVD_TC, this);
|
||||
lp_var_t<uint32_t> mpsocPowerup = lp_var_t<uint32_t>(sid.objectId, PoolIds::MPSOC_POWER_UP, this);
|
||||
lp_var_t<uint32_t> mpsocUpdates = lp_var_t<uint32_t>(sid.objectId, PoolIds::MPSOC_UPDATES, this);
|
||||
lp_var_t<uint32_t> lastRecvdTc = lp_var_t<uint32_t>(sid.objectId, PoolIds::LAST_RECVD_TC, this);
|
||||
|
||||
void printSet() {
|
||||
sif::info << "LoggingReport: Latchup happened count 0: " << this->latchupHappenCnt0 << std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 1: " << this->latchupHappenCnt0 << std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 2: " << this->latchupHappenCnt0 << std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 3: " << this->latchupHappenCnt0 << std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 4: " << this->latchupHappenCnt0 << std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 5: " << this->latchupHappenCnt0 << std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 6: " << this->latchupHappenCnt0 << std::endl;
|
||||
sif::info << "LoggingReport: ADC deviation triggers count: " << this->latchupHappenCnt0 << std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 0: " << this->latchupHappenCnt0
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 1: " << this->latchupHappenCnt0
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 2: " << this->latchupHappenCnt0
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 3: " << this->latchupHappenCnt0
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 4: " << this->latchupHappenCnt0
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 5: " << this->latchupHappenCnt0
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 6: " << this->latchupHappenCnt0
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: ADC deviation triggers count: " << this->latchupHappenCnt0
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: TC received count: " << this->tcReceivedCnt << std::endl;
|
||||
sif::info << "LoggingReport: TM available count: " << this->tmAvailableCnt << std::endl;
|
||||
sif::info << "LoggingReport: Supervisor boots: " << this->supervisorBoots << std::endl;
|
||||
sif::info << "LoggingReport: MPSoC boots: " << this->mpsocBoots << std::endl;
|
||||
sif::info << "LoggingReport: MPSoC boot failed attempts: " << this->mpsocBootFailedAttempts << std::endl;
|
||||
sif::info << "LoggingReport: MPSoC boot failed attempts: " << this->mpsocBootFailedAttempts
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: MPSoC power up: " << this->mpsocPowerup << std::endl;
|
||||
sif::info << "LoggingReport: MPSoC updates: " << this->mpsocUpdates << std::endl;
|
||||
sif::info << "LoggingReport: Last received TC: " << this->lastRecvdTc << std::endl;
|
||||
|
@ -344,6 +344,11 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case RESET_PL: {
|
||||
prepareEmptyCmd(APID_RESET_PL);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sif::debug << "PlocSupervisorHandler::buildCommandFromCommand: Command not implemented"
|
||||
<< std::endl;
|
||||
@ -399,10 +404,11 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
|
||||
this->insertInCommandMap(LOGGING_REQUEST_COUNTERS);
|
||||
this->insertInCommandMap(LOGGING_CLEAR_COUNTERS);
|
||||
this->insertInCommandMap(LOGGING_SET_TOPIC);
|
||||
this->insertInCommandMap(RESET_PL);
|
||||
this->insertInCommandAndReplyMap(FIRST_MRAM_DUMP, 3);
|
||||
this->insertInCommandAndReplyMap(CONSECUTIVE_MRAM_DUMP, 3);
|
||||
this->insertInReplyMap(ACK_REPORT, 3, nullptr, SIZE_ACK_REPORT);
|
||||
this->insertInReplyMap(EXE_REPORT, 50, nullptr, SIZE_EXE_REPORT);
|
||||
this->insertInReplyMap(EXE_REPORT, 0, nullptr, SIZE_EXE_REPORT, false, &executionTimeout);
|
||||
this->insertInReplyMap(HK_REPORT, 3, &hkset, SIZE_HK_REPORT);
|
||||
this->insertInReplyMap(BOOT_STATUS_REPORT, 3, &bootStatusReport, SIZE_BOOT_STATUS_REPORT);
|
||||
this->insertInReplyMap(LATCHUP_REPORT, 3, &latchupStatusReport, SIZE_LATCHUP_STATUS_REPORT);
|
||||
@ -521,6 +527,7 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
|
||||
case DISABLE_AUTO_TM:
|
||||
case LOGGING_CLEAR_COUNTERS:
|
||||
case LOGGING_SET_TOPIC:
|
||||
case RESET_PL:
|
||||
enabledReplies = 2;
|
||||
break;
|
||||
default:
|
||||
@ -546,6 +553,8 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
|
||||
<< " not in replyMap" << std::endl;
|
||||
}
|
||||
|
||||
setExecutionTimeout(command->first);
|
||||
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
@ -769,10 +778,24 @@ ReturnValue_t PlocSupervisorHandler::initializeLocalDataPool(localpool::DataPool
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::handleEvent(EventMessage* eventMessage) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
object_id_t objectId = eventMessage->getReporter();
|
||||
Event event = eventMessage->getEvent();
|
||||
switch (objectId) {
|
||||
case objects::PLOC_SUPERVISOR_HELPER: {
|
||||
plocSupvHelperExecuting = false;
|
||||
// After execution of update procedure, PLOC is in a state where it draws approx. 700 mA of
|
||||
// current. To leave this state the shutdown MPSoC command must be sent here.
|
||||
if (event == PlocSupvHelper::SUPV_UPDATE_FAILED ||
|
||||
event == PlocSupvHelper::SUPV_UPDATE_SUCCESSFUL) {
|
||||
result = this->executeAction(supv::SHUTDOWN_MPSOC, NO_COMMANDER, nullptr, 0);
|
||||
if (result != RETURN_OK) {
|
||||
triggerEvent(SUPV_MPSOC_SHUWDOWN_BUILD_FAILED);
|
||||
sif::warning << "PlocSupervisorHandler::handleEvent: Failed to build MPSoC shutdown "
|
||||
"command" << std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -781,6 +804,19 @@ void PlocSupervisorHandler::handleEvent(EventMessage* eventMessage) {
|
||||
}
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::setExecutionTimeout(DeviceCommandId_t command) {
|
||||
using namespace supv;
|
||||
switch(command) {
|
||||
case FIRST_MRAM_DUMP:
|
||||
case CONSECUTIVE_MRAM_DUMP:
|
||||
executionTimeout.setTimeout(MRAM_DUMP_EXECUTION_TIMEOUT);
|
||||
break;
|
||||
default:
|
||||
executionTimeout.setTimeout(EXECUTION_DEFAULT_TIMEOUT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::verifyPacket(const uint8_t* start, size_t foundLen) {
|
||||
uint16_t receivedCrc = *(start + foundLen - 2) << 8 | *(start + foundLen - 1);
|
||||
uint16_t recalculatedCrc = CRC::crc16ccitt(start, foundLen - 2);
|
||||
@ -1223,7 +1259,8 @@ size_t PlocSupervisorHandler::getNextReplyLength(DeviceCommandId_t commandId) {
|
||||
|
||||
DeviceReplyIter iter = deviceReplyMap.find(nextReplyId);
|
||||
if (iter != deviceReplyMap.end()) {
|
||||
if (iter->second.delayCycles == 0) {
|
||||
if ((iter->second.delayCycles == 0 && iter->second.countdown == nullptr) ||
|
||||
(not iter->second.active && iter->second.countdown != nullptr)) {
|
||||
/* Reply inactive */
|
||||
return replyLen;
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "fsfw_hal/linux/gpio/Gpio.h"
|
||||
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
||||
#include "fsfw_hal/linux/uart/UartComIF.h"
|
||||
#include "fsfw/timemanager/Countdown.h"
|
||||
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
|
||||
#include "linux/devices/devicedefinitions/SupvReturnValuesIF.h"
|
||||
#include "PlocSupvHelper.h"
|
||||
@ -71,11 +72,17 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
static const Event SUPV_CRC_FAILURE_EVENT = MAKE_EVENT(4, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Supervisor helper currently executing a command
|
||||
static const Event SUPV_HELPER_EXECUTING = MAKE_EVENT(5, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Failed to build the command to shutdown the MPSoC
|
||||
static const Event SUPV_MPSOC_SHUWDOWN_BUILD_FAILED = MAKE_EVENT(5, severity::LOW);
|
||||
|
||||
static const uint16_t APID_MASK = 0x7FF;
|
||||
static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF;
|
||||
static const uint8_t EXE_STATUS_OFFSET = 10;
|
||||
static const uint8_t SIZE_NULL_TERMINATOR = 1;
|
||||
// 5 s
|
||||
static const uint32_t EXECUTION_DEFAULT_TIMEOUT = 5000;
|
||||
// 30 s
|
||||
static const uint32_t MRAM_DUMP_EXECUTION_TIMEOUT = 30000;
|
||||
|
||||
uint8_t commandBuffer[supv::MAX_COMMAND_SIZE];
|
||||
|
||||
@ -126,6 +133,13 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
// Supervisor helper class currently executing a command
|
||||
bool plocSupvHelperExecuting = false;
|
||||
|
||||
Countdown executionTimeout = Countdown(EXECUTION_DEFAULT_TIMEOUT, false);
|
||||
|
||||
/**
|
||||
* @brief Adjusts the timeout of the execution report dependent on command
|
||||
*/
|
||||
void setExecutionTimeout(DeviceCommandId_t command);
|
||||
|
||||
/**
|
||||
* @brief Handles event messages received from the supervisor helper
|
||||
*/
|
||||
|
@ -149,7 +149,8 @@ ReturnValue_t PlocSupvHelper::performUpdate() {
|
||||
return result;
|
||||
}
|
||||
#if OBSW_DEBUG_PLOC_SUPERVISOR == 1
|
||||
ProgressPrinter progressPrinter("Supervisor update", update.length, ProgressPrinter::ONE_PERCENT);
|
||||
ProgressPrinter progressPrinter("Supervisor update", update.length,
|
||||
ProgressPrinter::HALF_PERCENT);
|
||||
#endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */
|
||||
uint8_t tempData[supv::WriteMemory::CHUNK_MAX];
|
||||
std::ifstream file(update.file, std::ifstream::binary);
|
||||
@ -172,9 +173,9 @@ ReturnValue_t PlocSupvHelper::performUpdate() {
|
||||
file.read(reinterpret_cast<char*>(tempData), dataLength);
|
||||
if (!file) {
|
||||
sif::warning << "PlocSupvHelper::performUpdate: Read only " << file.gcount() << " of "
|
||||
<< dataLength << " bytes" << std::endl;
|
||||
<< dataLength << " bytes" << std::endl;
|
||||
sif::info << "PlocSupvHelper::performUpdate: Failed when trying to read byte "
|
||||
<< bytesWritten << std::endl;
|
||||
<< bytesWritten << std::endl;
|
||||
}
|
||||
remainingSize -= dataLength;
|
||||
} else {
|
||||
@ -280,64 +281,48 @@ ReturnValue_t PlocSupvHelper::sendCommand(SpacePacket& packet) {
|
||||
|
||||
ReturnValue_t PlocSupvHelper::handleAck() {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
supv::TmPacket tmPacket;
|
||||
result = handleTmReception(&tmPacket, supv::SIZE_ACK_REPORT);
|
||||
supv::AcknowledgmentReport ackReport;
|
||||
result = handleTmReception(&ackReport, supv::SIZE_ACK_REPORT);
|
||||
if (result != RETURN_OK) {
|
||||
triggerEvent(ACK_RECEPTION_FAILURE, result, static_cast<uint32_t>(rememberApid));
|
||||
sif::warning << "PlocSupvHelper::handleAck: Error in reception of acknowledgment report"
|
||||
<< std::endl;
|
||||
return result;
|
||||
}
|
||||
uint16_t apid = tmPacket.getAPID();
|
||||
if (apid != supv::APID_ACK_SUCCESS) {
|
||||
handleAckApidFailure(apid);
|
||||
return RETURN_FAILED;
|
||||
result = ackReport.checkApid();
|
||||
if (result != RETURN_OK) {
|
||||
if (result == SupvReturnValuesIF::RECEIVED_ACK_FAILURE) {
|
||||
triggerEvent(SUPV_ACK_FAILURE_REPORT, static_cast<uint32_t>(ackReport.getRefApid()));
|
||||
} else if (result == SupvReturnValuesIF::INVALID_APID) {
|
||||
triggerEvent(SUPV_ACK_INVALID_APID, static_cast<uint32_t>(rememberApid));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
void PlocSupvHelper::handleAckApidFailure(uint16_t apid) {
|
||||
if (apid == supv::APID_ACK_FAILURE) {
|
||||
triggerEvent(SUPV_ACK_FAILURE_REPORT, static_cast<uint32_t>(internalState));
|
||||
sif::warning << "PlocSupvHelper::handleAckApidFailure: Received acknowledgement failure "
|
||||
<< "report" << std::endl;
|
||||
} else {
|
||||
triggerEvent(SUPV_ACK_INVALID_APID, apid, static_cast<uint32_t>(internalState));
|
||||
sif::warning << "PlocSupvHelper::handleAckApidFailure: Expected acknowledgement report "
|
||||
<< "but received space packet with apid " << std::hex << apid << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupvHelper::handleExe(uint32_t timeout) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
supv::TmPacket tmPacket;
|
||||
result = handleTmReception(&tmPacket, supv::SIZE_EXE_REPORT, timeout);
|
||||
supv::ExecutionReport exeReport;
|
||||
result = handleTmReception(&exeReport, supv::SIZE_EXE_REPORT, timeout);
|
||||
if (result != RETURN_OK) {
|
||||
triggerEvent(EXE_RECEPTION_FAILURE, result, static_cast<uint32_t>(rememberApid));
|
||||
sif::warning << "PlocSupvHelper::handleExe: Error in reception of execution report"
|
||||
<< std::endl;
|
||||
return result;
|
||||
}
|
||||
uint16_t apid = tmPacket.getAPID();
|
||||
if (apid != supv::APID_EXE_SUCCESS) {
|
||||
handleExeApidFailure(apid);
|
||||
return RETURN_FAILED;
|
||||
result = exeReport.checkApid();
|
||||
if (result != RETURN_OK) {
|
||||
if (result == SupvReturnValuesIF::RECEIVED_EXE_FAILURE) {
|
||||
triggerEvent(SUPV_EXE_FAILURE_REPORT, static_cast<uint32_t>(exeReport.getRefApid()));
|
||||
} else if (result == SupvReturnValuesIF::INVALID_APID) {
|
||||
triggerEvent(SUPV_EXE_INVALID_APID, static_cast<uint32_t>(rememberApid));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
void PlocSupvHelper::handleExeApidFailure(uint16_t apid) {
|
||||
if (apid == supv::APID_EXE_FAILURE) {
|
||||
triggerEvent(SUPV_EXE_FAILURE_REPORT, static_cast<uint32_t>(internalState));
|
||||
sif::warning << "PlocSupvHelper::handleExeApidFailure: Received execution failure "
|
||||
<< "report" << std::endl;
|
||||
} else {
|
||||
triggerEvent(SUPV_EXE_INVALID_APID, apid, static_cast<uint32_t>(internalState));
|
||||
sif::warning << "PlocSupvHelper::handleExeApidFailure: Expected execution report "
|
||||
<< "but received space packet with apid " << std::hex << apid << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupvHelper::handleTmReception(supv::TmPacket* tmPacket, size_t remainingBytes,
|
||||
uint32_t timeout) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
@ -404,7 +389,8 @@ ReturnValue_t PlocSupvHelper::calcImageCrc() {
|
||||
uint16_t remainder = CRC16_INIT;
|
||||
uint8_t input;
|
||||
#if OBSW_DEBUG_PLOC_SUPERVISOR == 1
|
||||
ProgressPrinter progress("Supervisor update crc calculation", update.length);
|
||||
ProgressPrinter progress("Supervisor update crc calculation", update.length,
|
||||
ProgressPrinter::ONE_PERCENT);
|
||||
#endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */
|
||||
uint32_t byteCount = 0;
|
||||
for (byteCount = 0; byteCount < update.length; byteCount++) {
|
||||
@ -440,9 +426,12 @@ ReturnValue_t PlocSupvHelper::handleCheckMemoryCommand() {
|
||||
static_cast<size_t>(updateStatusReport.getNominalSize()),
|
||||
supv::recv_timeout::UPDATE_STATUS_REPORT);
|
||||
if (result != RETURN_OK) {
|
||||
sif::warning
|
||||
<< "PlocSupvHelper::handleCheckMemoryCommand: Failed to receive update status report"
|
||||
<< std::endl;
|
||||
return result;
|
||||
}
|
||||
result = handleExe();
|
||||
result = handleExe(CRC_EXECUTION_TIMEOUT);
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
@ -452,8 +441,8 @@ ReturnValue_t PlocSupvHelper::handleCheckMemoryCommand() {
|
||||
}
|
||||
result = updateStatusReport.verifycrc(update.crc);
|
||||
if (result != RETURN_OK) {
|
||||
sif::warning << "PlocSupvHelper::performUpdate: CRC failure. Expected CRC 0x" << std::hex
|
||||
<< update.crc << " but received CRC 0x" << updateStatusReport.getCrc()
|
||||
sif::warning << "PlocSupvHelper::handleCheckMemoryCommand: CRC failure. Expected CRC 0x"
|
||||
<< std::hex << update.crc << " but received CRC 0x" << updateStatusReport.getCrc()
|
||||
<< std::endl;
|
||||
return result;
|
||||
}
|
||||
|
@ -61,8 +61,8 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
|
||||
//! [EXPORT] : [COMMENT] Supervisor received acknowledgment failure report
|
||||
//! P1: Internal state of supervisor helper
|
||||
static const Event SUPV_ACK_FAILURE_REPORT = MAKE_EVENT(11, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Supervisor received execution failure report
|
||||
//! P1: Internal state of supervisor
|
||||
//! [EXPORT] : [COMMENT] Execution report failure
|
||||
//! P1:
|
||||
static const Event SUPV_EXE_FAILURE_REPORT = MAKE_EVENT(12, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Supervisor expected acknowledgment report but received space packet with other apid
|
||||
//! P1: Apid of received space packet
|
||||
@ -129,6 +129,7 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
|
||||
static const uint8_t NUM_EVENT_BUFFER_PACKETS = 25;
|
||||
static const size_t SIZE_EVENT_BUFFER_FULL_PACKET = 1024;
|
||||
static const size_t SIZE_EVENT_BUFFER_LAST_PACKET = 200;
|
||||
static const uint32_t CRC_EXECUTION_TIMEOUT = 60000;
|
||||
|
||||
struct Update {
|
||||
uint8_t memoryId;
|
||||
@ -190,8 +191,6 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
|
||||
ReturnValue_t receive(uint8_t* data, size_t* readBytes, size_t requestBytes);
|
||||
ReturnValue_t handleAck();
|
||||
ReturnValue_t handleExe(uint32_t timeout = 1000);
|
||||
void handleAckApidFailure(uint16_t apid);
|
||||
void handleExeApidFailure(uint16_t apid);
|
||||
/**
|
||||
* @brief Handles reading of TM packets from the communication interface
|
||||
*
|
||||
|
@ -53,6 +53,7 @@ debugging. */
|
||||
#define OBSW_ADD_RAD_SENSORS 1
|
||||
#define OBSW_ADD_PL_PCDU 1
|
||||
#define OBSW_ADD_SYRLINKS 0
|
||||
#define OBSW_ADD_GPS 1
|
||||
#define OBSW_ENABLE_SYRLINKS_TRANSMIT_TIMEOUT 0
|
||||
#define OBSW_STAR_TRACKER_GROUND_CONFIG 1
|
||||
#define OBSW_MPSOC_JTAG_BOOT 0
|
||||
|
@ -13,7 +13,7 @@
|
||||
namespace SUBSYSTEM_ID {
|
||||
enum : uint8_t {
|
||||
SUBSYSTEM_ID_START = COMMON_SUBSYSTEM_ID_END,
|
||||
CORE = 136,
|
||||
CORE = 137,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @brief Auto-generated event translation file. Contains 194 translations.
|
||||
* @brief Auto-generated event translation file. Contains 198 translations.
|
||||
* @details
|
||||
* Generated on: 2022-04-27 16:45:31
|
||||
* Generated on: 2022-04-24 12:20:25
|
||||
*/
|
||||
#include "translateEvents.h"
|
||||
|
||||
@ -195,6 +195,10 @@ const char *SUPV_ACK_INVALID_APID_STRING = "SUPV_ACK_INVALID_APID";
|
||||
const char *SUPV_EXE_INVALID_APID_STRING = "SUPV_EXE_INVALID_APID";
|
||||
const char *ACK_RECEPTION_FAILURE_STRING = "ACK_RECEPTION_FAILURE";
|
||||
const char *EXE_RECEPTION_FAILURE_STRING = "EXE_RECEPTION_FAILURE";
|
||||
const char *ALLOC_FAILURE_STRING = "ALLOC_FAILURE";
|
||||
const char *REBOOT_SW_STRING = "REBOOT_SW";
|
||||
const char *REBOOT_MECHANISM_TRIGGERED_STRING = "REBOOT_MECHANISM_TRIGGERED";
|
||||
const char *REBOOT_HW_STRING = "REBOOT_HW";
|
||||
|
||||
const char *translateEvents(Event event) {
|
||||
switch ((event & 0xFFFF)) {
|
||||
@ -578,6 +582,14 @@ const char *translateEvents(Event event) {
|
||||
return ACK_RECEPTION_FAILURE_STRING;
|
||||
case (13616):
|
||||
return EXE_RECEPTION_FAILURE_STRING;
|
||||
case (13700):
|
||||
return ALLOC_FAILURE_STRING;
|
||||
case (13701):
|
||||
return REBOOT_SW_STRING;
|
||||
case (13702):
|
||||
return REBOOT_MECHANISM_TRIGGERED_STRING;
|
||||
case (13703):
|
||||
return REBOOT_HW_STRING;
|
||||
default:
|
||||
return "UNKNOWN_EVENT";
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @brief Auto-generated object translation file.
|
||||
* @details
|
||||
* Contains 116 translations.
|
||||
* Generated on: 2022-04-27 16:45:35
|
||||
* Generated on: 2022-04-24 12:09:01
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
|
Reference in New Issue
Block a user