v1.12.0 #269
@ -98,12 +98,14 @@ void initmission::initTasks() {
|
||||
}
|
||||
#endif /* OBSW_ADD_PLOC_MPSOC == 1*/
|
||||
|
||||
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
||||
PeriodicTaskIF* supvHelperTask = factory->createPeriodicTask(
|
||||
"PLOC_SUPV_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||
result = supvHelperTask->addComponent(objects::PLOC_SUPERVISOR_HELPER);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PLOC_SUPV_HELPER", objects::PLOC_SUPERVISOR_HELPER);
|
||||
}
|
||||
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
|
||||
|
||||
auto taskStarter = [](std::vector<PeriodicTaskIF*>& taskVector, std::string name) {
|
||||
for (const auto& task : taskVector) {
|
||||
@ -119,7 +121,9 @@ void initmission::initTasks() {
|
||||
tmtcDistributor->startTask();
|
||||
tmtcBridgeTask->startTask();
|
||||
tmtcPollingTask->startTask();
|
||||
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
||||
supvHelperTask->startTask();
|
||||
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
|
||||
#if OBSW_ADD_PLOC_MPSOC == 1
|
||||
mpsocHelperTask->startTask();
|
||||
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */
|
||||
|
@ -52,7 +52,6 @@ new UartComIF(objects::UART_COM_IF);
|
||||
uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE);
|
||||
mpsocUartCookie->setNoFixedSizeReply();
|
||||
PlocMPSoCHelper* plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER);
|
||||
new UartComIF(objects::UART_COM_IF);
|
||||
auto dummyGpioIF = new DummyGpioIF();
|
||||
PlocMPSoCHandler* plocMPSoCHandler = new PlocMPSoCHandler(
|
||||
objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocUartCookie, plocMpsocHelper,
|
||||
|
@ -35,7 +35,6 @@ static const DeviceCommandId_t COPY_ADC_DATA_TO_MRAM = 25;
|
||||
static const DeviceCommandId_t RUN_AUTO_EM_TESTS = 28;
|
||||
static const DeviceCommandId_t WIPE_MRAM = 29;
|
||||
static const DeviceCommandId_t FIRST_MRAM_DUMP = 30;
|
||||
static const DeviceCommandId_t PRINT_CPU_STATS = 33;
|
||||
static const DeviceCommandId_t SET_GPIO = 34;
|
||||
static const DeviceCommandId_t READ_GPIO = 35;
|
||||
static const DeviceCommandId_t RESTART_SUPERVISOR = 36;
|
||||
@ -72,7 +71,7 @@ static const uint16_t SIZE_EXE_REPORT = 14;
|
||||
static const uint16_t SIZE_HK_REPORT = 52;
|
||||
static const uint16_t SIZE_BOOT_STATUS_REPORT = 24;
|
||||
static const uint16_t SIZE_LATCHUP_STATUS_REPORT = 31;
|
||||
static const uint16_t SIZE_LOGGING_REPORT = 45;
|
||||
static const uint16_t SIZE_LOGGING_REPORT = 73;
|
||||
static const uint16_t SIZE_ADC_REPORT = 72;
|
||||
|
||||
/**
|
||||
@ -126,7 +125,6 @@ static const uint16_t APID_REQUEST_ADC_REPORT = 0xDB;
|
||||
static const uint16_t APID_RUN_AUTO_EM_TESTS = 0xF2;
|
||||
static const uint16_t APID_WIPE_MRAM = 0xF3;
|
||||
static const uint16_t APID_DUMP_MRAM = 0xF4;
|
||||
static const uint16_t APID_PRINT_CPU_STATS = 0xF8;
|
||||
static const uint16_t APID_SET_GPIO = 0xF9;
|
||||
static const uint16_t APID_READ_GPIO = 0xFA;
|
||||
static const uint16_t APID_RESTART_SUPERVISOR = 0xFB;
|
||||
@ -766,45 +764,6 @@ class RunAutoEmTests : public SpacePacket {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class packages the space packet causing the supervisor to print the CPU load to
|
||||
* the debug output.
|
||||
*/
|
||||
class PrintCpuStats : public SpacePacket {
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param en Print is enabled if en != 0
|
||||
*/
|
||||
PrintCpuStats(uint8_t en)
|
||||
: SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_PRINT_CPU_STATS, DEFAULT_SEQUENCE_COUNT),
|
||||
en(en) {
|
||||
initPacket();
|
||||
}
|
||||
|
||||
private:
|
||||
static const uint16_t DATA_FIELD_LENGTH = 3;
|
||||
static const uint16_t DEFAULT_SEQUENCE_COUNT = 1;
|
||||
|
||||
static const uint16_t CRC_OFFSET = DATA_FIELD_LENGTH - 2;
|
||||
|
||||
uint8_t en = 0;
|
||||
|
||||
void initPacket() {
|
||||
size_t serializedSize = 0;
|
||||
uint8_t* dataFieldPtr = this->localData.fields.buffer;
|
||||
SerializeAdapter::serialize<uint8_t>(&en, &dataFieldPtr, &serializedSize, sizeof(en),
|
||||
SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
|
||||
sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2);
|
||||
uint8_t* crcPos = this->localData.fields.buffer + CRC_OFFSET;
|
||||
SerializeAdapter::serialize<uint16_t>(&crc, &crcPos, &serializedSize, sizeof(crc),
|
||||
SerializeIF::Endianness::BIG);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class packages the space packet to wipe or dump parts of the MRAM.
|
||||
*/
|
||||
@ -1806,19 +1765,19 @@ class LoggingReport : public StaticLocalDataSet<LOGGING_RPT_SET_ENTRIES> {
|
||||
void printSet() {
|
||||
sif::info << "LoggingReport: Latchup happened count 0: " << this->latchupHappenCnt0
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 1: " << this->latchupHappenCnt0
|
||||
sif::info << "LoggingReport: Latchup happened count 1: " << this->latchupHappenCnt1
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 2: " << this->latchupHappenCnt0
|
||||
sif::info << "LoggingReport: Latchup happened count 2: " << this->latchupHappenCnt2
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 3: " << this->latchupHappenCnt0
|
||||
sif::info << "LoggingReport: Latchup happened count 3: " << this->latchupHappenCnt3
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 4: " << this->latchupHappenCnt0
|
||||
sif::info << "LoggingReport: Latchup happened count 4: " << this->latchupHappenCnt4
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 5: " << this->latchupHappenCnt0
|
||||
sif::info << "LoggingReport: Latchup happened count 5: " << this->latchupHappenCnt5
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: Latchup happened count 6: " << this->latchupHappenCnt0
|
||||
sif::info << "LoggingReport: Latchup happened count 6: " << this->latchupHappenCnt6
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: ADC deviation triggers count: " << this->latchupHappenCnt0
|
||||
sif::info << "LoggingReport: ADC deviation triggers count: " << this->adcDeviationTriggersCnt
|
||||
<< std::endl;
|
||||
sif::info << "LoggingReport: TC received count: " << this->tcReceivedCnt << std::endl;
|
||||
sif::info << "LoggingReport: TM available count: " << this->tmAvailableCnt << std::endl;
|
||||
@ -1828,7 +1787,8 @@ class LoggingReport : public StaticLocalDataSet<LOGGING_RPT_SET_ENTRIES> {
|
||||
<< 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;
|
||||
sif::info << "LoggingReport: APID of last received TC: 0x" << std::hex << this->lastRecvdTc
|
||||
<< std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
@ -1932,7 +1892,7 @@ class AdcReport : public StaticLocalDataSet<ADC_RPT_SET_ENTRIES> {
|
||||
|
||||
void printSet() {
|
||||
sif::info << "---- Adc Report: Raw values ----" << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 0: " << this->adcRaw0 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 0: " << std::dec << this->adcRaw0 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 1: " << this->adcRaw1 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 2: " << this->adcRaw2 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 3: " << this->adcRaw3 << std::endl;
|
||||
|
@ -416,7 +416,6 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
|
||||
this->insertInCommandMap(REQUEST_ADC_REPORT);
|
||||
this->insertInCommandMap(RUN_AUTO_EM_TESTS);
|
||||
this->insertInCommandMap(WIPE_MRAM);
|
||||
this->insertInCommandMap(PRINT_CPU_STATS);
|
||||
this->insertInCommandMap(SET_GPIO);
|
||||
this->insertInCommandMap(READ_GPIO);
|
||||
this->insertInCommandMap(RESTART_SUPERVISOR);
|
||||
@ -537,7 +536,6 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
|
||||
case COPY_ADC_DATA_TO_MRAM:
|
||||
case RUN_AUTO_EM_TESTS:
|
||||
case WIPE_MRAM:
|
||||
case PRINT_CPU_STATS:
|
||||
case SET_GPIO:
|
||||
case READ_GPIO:
|
||||
case RESTART_SUPERVISOR:
|
||||
@ -837,6 +835,9 @@ void PlocSupervisorHandler::setExecutionTimeout(DeviceCommandId_t command) {
|
||||
case CONSECUTIVE_MRAM_DUMP:
|
||||
executionTimeout.setTimeout(MRAM_DUMP_EXECUTION_TIMEOUT);
|
||||
break;
|
||||
case COPY_ADC_DATA_TO_MRAM:
|
||||
executionTimeout.setTimeout(COPY_ADC_TO_MRAM_TIMEOUT);
|
||||
break;
|
||||
default:
|
||||
executionTimeout.setTimeout(EXECUTION_DEFAULT_TIMEOUT);
|
||||
break;
|
||||
@ -873,13 +874,14 @@ ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) {
|
||||
result = ack.checkApid();
|
||||
|
||||
switch (result) {
|
||||
case SupvReturnValuesIF::CRC_FAILURE: {
|
||||
// TODO: Interpretation of status field in acknowledgment report
|
||||
sif::debug << "PlocSupervisorHandler::handleAckReport: Received Ack failure report"
|
||||
<< std::endl;
|
||||
case SupvReturnValuesIF::RECEIVED_ACK_FAILURE: {
|
||||
#if OBSW_DEBUG_PLOC_SUPERVISOR == 1
|
||||
sif::debug << "PlocSupervisorHandler: Received Ack failure report with status code: 0x"
|
||||
<< std::hex << ack.getStatusCode() << std::endl;
|
||||
#endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */
|
||||
DeviceCommandId_t commandId = getPendingCommand();
|
||||
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
|
||||
triggerEvent(SUPV_ACK_FAILURE, commandId);
|
||||
triggerEvent(SUPV_ACK_FAILURE, commandId, static_cast<uint32_t>(ack.getStatusCode()));
|
||||
}
|
||||
sendFailureReport(supv::ACK_REPORT, SupvReturnValuesIF::RECEIVED_ACK_FAILURE);
|
||||
disableAllReplies();
|
||||
@ -930,7 +932,7 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data)
|
||||
break;
|
||||
}
|
||||
case (SupvReturnValuesIF::RECEIVED_EXE_FAILURE): {
|
||||
handleExecutionFailureReport();
|
||||
handleExecutionFailureReport(exe.getStatusCode());
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
@ -1172,7 +1174,7 @@ ReturnValue_t PlocSupervisorHandler::handleLoggingReport(const uint8_t* data) {
|
||||
result = verifyPacket(data, supv::SIZE_LOGGING_REPORT);
|
||||
|
||||
if (result == SupvReturnValuesIF::CRC_FAILURE) {
|
||||
sif::error << "PlocSupervisorHandler::handleLoggingReport: Logging report has "
|
||||
sif::warning << "PlocSupervisorHandler::handleLoggingReport: Logging report has "
|
||||
<< "invalid crc" << std::endl;
|
||||
return result;
|
||||
}
|
||||
@ -1853,7 +1855,21 @@ void PlocSupervisorHandler::handleExecutionSuccessReport(const uint8_t* data) {
|
||||
#if OBSW_DEBUG_PLOC_SUPERVISOR == 1
|
||||
sif::info << "PlocSupervisorHandler: Read GPIO TM, State: " << gpioState << std::endl;
|
||||
#endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */
|
||||
handleDeviceTM(reinterpret_cast<uint8_t*>(&gpioState), sizeof(gpioState), supv::EXE_REPORT);
|
||||
DeviceCommandMap::iterator iter = deviceCommandMap.find(commandId);
|
||||
if (iter->second.sendReplyTo == NO_COMMAND_ID) {
|
||||
return;
|
||||
}
|
||||
uint8_t data[sizeof(gpioState)];
|
||||
size_t size = 0;
|
||||
ReturnValue_t result = SerializeAdapter::serialize(
|
||||
&gpioState, data, &size, sizeof(gpioState), SerializeIF::Endianness::BIG);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "PlocSupervisorHandler: Failed to deserialize GPIO state" << std::endl;
|
||||
}
|
||||
result = actionHelper.reportData(iter->second.sendReplyTo, commandId, data, sizeof(data));
|
||||
if (result != RETURN_OK) {
|
||||
sif::warning << "PlocSupervisorHandler: Read GPIO, failed to report data" << std::endl;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case supv::SET_TIME_REF: {
|
||||
@ -1867,13 +1883,11 @@ void PlocSupervisorHandler::handleExecutionSuccessReport(const uint8_t* data) {
|
||||
}
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::handleExecutionFailureReport() {
|
||||
void PlocSupervisorHandler::handleExecutionFailureReport(uint16_t statusCode) {
|
||||
using namespace supv;
|
||||
DeviceCommandId_t commandId = getPendingCommand();
|
||||
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
|
||||
triggerEvent(SUPV_EXE_FAILURE, commandId);
|
||||
} else {
|
||||
sif::debug << "PlocSupervisorHandler::handleExecutionReport: Unknown command id" << std::endl;
|
||||
triggerEvent(SUPV_EXE_FAILURE, commandId, static_cast<uint32_t>(statusCode));
|
||||
}
|
||||
sendFailureReport(EXE_REPORT, SupvReturnValuesIF::RECEIVED_EXE_FAILURE);
|
||||
disableExeReportReply();
|
||||
|
@ -66,6 +66,8 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
//! [EXPORT] : [COMMENT] PLOC supervisor received acknowledgment failure report
|
||||
static const Event SUPV_ACK_FAILURE = MAKE_EVENT(2, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] PLOC received execution failure report
|
||||
//! P1: ID of command for which the execution failed
|
||||
//! P2: Status code sent by the supervisor handler
|
||||
static const Event SUPV_EXE_FAILURE = MAKE_EVENT(3, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] PLOC supervisor reply has invalid crc
|
||||
static const Event SUPV_CRC_FAILURE_EVENT = MAKE_EVENT(4, severity::LOW);
|
||||
@ -82,6 +84,8 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
static const uint32_t EXECUTION_DEFAULT_TIMEOUT = 5000;
|
||||
// 30 s
|
||||
static const uint32_t MRAM_DUMP_EXECUTION_TIMEOUT = 30000;
|
||||
// 70 s
|
||||
static const uint32_t COPY_ADC_TO_MRAM_TIMEOUT = 70000;
|
||||
// 2 s
|
||||
static const uint32_t BOOT_TIMEOUT = 2000;
|
||||
enum class StartupState: uint8_t {
|
||||
@ -363,7 +367,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
ReturnValue_t eventSubscription();
|
||||
|
||||
void handleExecutionSuccessReport(const uint8_t* data);
|
||||
void handleExecutionFailureReport();
|
||||
void handleExecutionFailureReport(uint16_t statusCode);
|
||||
};
|
||||
|
||||
#endif /* MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_ */
|
||||
|
@ -161,6 +161,7 @@ ReturnValue_t PlocSupvHelper::performUpdate() {
|
||||
supv::SequenceFlags seqFlags = supv::SequenceFlags::FIRST_PKT;
|
||||
while (remainingSize > 0) {
|
||||
if (terminate) {
|
||||
terminate = false;
|
||||
return PROCESS_TERMINATED;
|
||||
}
|
||||
if (remainingSize > supv::WriteMemory::CHUNK_MAX) {
|
||||
|
@ -76,7 +76,7 @@
|
||||
#define OBSW_ADD_BPX_BATTERY_HANDLER 0
|
||||
#define OBSW_ADD_STAR_TRACKER 0
|
||||
#define OBSW_ADD_PLOC_SUPERVISOR 1
|
||||
#define OBSW_ADD_PLOC_MPSOC 1
|
||||
#define OBSW_ADD_PLOC_MPSOC 0
|
||||
#define OBSW_ADD_SUN_SENSORS 0
|
||||
#define OBSW_ADD_ACS_BOARD 1
|
||||
#define OBSW_ADD_ACS_HANDLERS 0
|
||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
||||
Subproject commit c7a19f7122fccf3888a4f49d0c88f593bad1e91a
|
||||
Subproject commit 9c3a8e9ff2934b24af2e2eff78b570510b41cad8
|
Loading…
Reference in New Issue
Block a user