adc report
This commit is contained in:
parent
0bcb332ce9
commit
cf37d74728
@ -115,13 +115,12 @@ new UartComIF(objects::UART_COM_IF);
|
||||
GpioCookie* gpioCookie = new GpioCookie;
|
||||
gpioCookie->addGpio(gpioIds::HEATER_0, heaterGpio);
|
||||
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, gpioCookie, objects::PCDU_HANDLER,
|
||||
pcduSwitches::TCS_BOARD_8V_HEATER_IN);
|
||||
pcdu::TCS_BOARD_8V_HEATER_IN);
|
||||
#endif
|
||||
|
||||
#if OBSW_ADD_PLOC_MPSOC == 1
|
||||
UartCookie* mpsocUartCookie =
|
||||
new UartCookie(objects::PLOC_MPSOC_HANDLER, te0720_1cfa::MPSOC_UART, UartModes::NON_CANONICAL,
|
||||
uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE);
|
||||
UartCookie* mpsocUartCookie = new UartCookie(objects::PLOC_MPSOC_HANDLER, te0720_1cfa::MPSOC_UART,
|
||||
uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE);
|
||||
mpsocUartCookie->setNoFixedSizeReply();
|
||||
PlocMPSoCHelper* plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER);
|
||||
auto mpsocGpioIF = new DummyGpioIF();
|
||||
@ -132,16 +131,15 @@ new UartComIF(objects::UART_COM_IF);
|
||||
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */
|
||||
|
||||
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
||||
/* Configuration for MIO0 on TE0720-03-1CFA */
|
||||
UartCookie* supervisorCookie =
|
||||
new UartCookie(objects::PLOC_SUPERVISOR_HANDLER, std::string("/dev/ttyPS1"),
|
||||
UartModes::NON_CANONICAL, uart::PLOC_SUPV_BAUD, supv::MAX_PACKET_SIZE * 20);
|
||||
uart::PLOC_SUPV_BAUD, supv::MAX_PACKET_SIZE * 20);
|
||||
supervisorCookie->setNoFixedSizeReply();
|
||||
auto supvGpioIF = new DummyGpioIF();
|
||||
auto supvHelper = new PlocSupvHelper(objects::PLOC_SUPERVISOR_HELPER);
|
||||
auto plocSupervisor = new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF,
|
||||
supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, supvGpioIF),
|
||||
pcduSwitches::PDU1_CH6_PLOC_12V, supvHelper);
|
||||
pcdu::PDU1_CH6_PLOC_12V, supvHelper);
|
||||
plocSupervisor->setStartUpImmediately();
|
||||
#endif
|
||||
|
||||
|
@ -51,11 +51,10 @@ static const DeviceCommandId_t PERFORM_UPDATE = 48;
|
||||
static const DeviceCommandId_t TERMINATE_SUPV_HELPER = 49;
|
||||
static const DeviceCommandId_t ENABLE_AUTO_TM = 50;
|
||||
static const DeviceCommandId_t DISABLE_AUTO_TM = 51;
|
||||
static const DeviceCommandId_t ENABLE_ADC_MONITOR_TASK = 52;
|
||||
static const DeviceCommandId_t DISABLE_ADC_MONITOR_TASK = 53;
|
||||
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;
|
||||
|
||||
/** Reply IDs */
|
||||
static const DeviceCommandId_t ACK_REPORT = 50;
|
||||
@ -64,6 +63,7 @@ static const DeviceCommandId_t HK_REPORT = 52;
|
||||
static const DeviceCommandId_t BOOT_STATUS_REPORT = 53;
|
||||
static const DeviceCommandId_t LATCHUP_REPORT = 54;
|
||||
static const DeviceCommandId_t LOGGING_REPORT = 55;
|
||||
static const DeviceCommandId_t ADC_REPORT = 56;
|
||||
|
||||
// Size of complete space packet (6 byte header + size of data + 2 byte CRC)
|
||||
static const uint16_t SIZE_ACK_REPORT = 14;
|
||||
@ -72,6 +72,7 @@ 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_ADC_REPORT = 72;
|
||||
|
||||
/**
|
||||
* SpacePacket apids of telemetry packets
|
||||
@ -83,7 +84,7 @@ static const uint16_t APID_EXE_FAILURE = 0x203;
|
||||
static const uint16_t APID_HK_REPORT = 0x204;
|
||||
static const uint16_t APID_BOOT_STATUS_REPORT = 0x205;
|
||||
static const uint16_t APID_UPDATE_STATUS_REPORT = 0x206;
|
||||
static const uint16_t APID_WDG_STATUS_REPORT = 0x207;
|
||||
static const uint16_t APID_ADC_REPORT = 0x207;
|
||||
static const uint16_t APID_LATCHUP_STATUS_REPORT = 0x208;
|
||||
static const uint16_t APID_SOC_SYSMON = 0x209;
|
||||
static const uint16_t APID_MRAM_DUMP_TM = 0x20A;
|
||||
@ -119,7 +120,7 @@ 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_GET_LATCHUP_STATUS_REPORT = 0xD9;
|
||||
static const uint16_t APID_COPY_ADC_DATA_TO_MRAM = 0xDA;
|
||||
static const uint16_t APID_ADC_MONITOR_TASK = 0xDB;
|
||||
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;
|
||||
@ -209,18 +210,53 @@ enum PoolIds : lp_id_t {
|
||||
TC_RECEIVED,
|
||||
TM_RECEIVED,
|
||||
SOC_BOOTS,
|
||||
SOC_BOOT_FAILS
|
||||
SOC_BOOT_FAILS,
|
||||
|
||||
ADC_RAW_0,
|
||||
ADC_RAW_1,
|
||||
ADC_RAW_2,
|
||||
ADC_RAW_3,
|
||||
ADC_RAW_4,
|
||||
ADC_RAW_5,
|
||||
ADC_RAW_6,
|
||||
ADC_RAW_7,
|
||||
ADC_RAW_8,
|
||||
ADC_RAW_9,
|
||||
ADC_RAW_10,
|
||||
ADC_RAW_11,
|
||||
ADC_RAW_12,
|
||||
ADC_RAW_13,
|
||||
ADC_RAW_14,
|
||||
ADC_RAW_15,
|
||||
ADC_ENG_0,
|
||||
ADC_ENG_1,
|
||||
ADC_ENG_2,
|
||||
ADC_ENG_3,
|
||||
ADC_ENG_4,
|
||||
ADC_ENG_5,
|
||||
ADC_ENG_6,
|
||||
ADC_ENG_7,
|
||||
ADC_ENG_8,
|
||||
ADC_ENG_9,
|
||||
ADC_ENG_10,
|
||||
ADC_ENG_11,
|
||||
ADC_ENG_12,
|
||||
ADC_ENG_13,
|
||||
ADC_ENG_14,
|
||||
ADC_ENG_15
|
||||
};
|
||||
|
||||
static const uint8_t HK_SET_ENTRIES = 13;
|
||||
static const uint8_t BOOT_REPORT_SET_ENTRIES = 10;
|
||||
static const uint8_t LATCHUP_RPT_SET_ENTRIES = 16;
|
||||
static const uint8_t LOGGING_RPT_SET_ENTRIES = 9;
|
||||
static const uint8_t ADC_RPT_SET_ENTRIES = 32;
|
||||
|
||||
static const uint32_t HK_SET_ID = HK_REPORT;
|
||||
static const uint32_t BOOT_REPORT_SET_ID = BOOT_STATUS_REPORT;
|
||||
static const uint32_t LATCHUP_RPT_ID = LATCHUP_REPORT;
|
||||
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
|
||||
@ -1197,36 +1233,6 @@ class DisableAutoTm : public SupvTcSpacePacket {
|
||||
static const uint8_t DISABLE = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class creates the space packet to enable the auto TM generation
|
||||
*/
|
||||
class EnableAdcMonitorTask : public SupvTcSpacePacket {
|
||||
public:
|
||||
EnableAdcMonitorTask() : SupvTcSpacePacket(PAYLOAD_LENGTH, APID_ADC_MONITOR_TASK) {
|
||||
*(this->localData.fields.buffer) = ENABLE;
|
||||
makeCrc();
|
||||
}
|
||||
|
||||
private:
|
||||
static const uint16_t PAYLOAD_LENGTH = 1; // length without CRC field
|
||||
static const uint8_t ENABLE = 1;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class creates the space packet to enable the auto TM generation
|
||||
*/
|
||||
class DisableAdcMonitorTask : public SupvTcSpacePacket {
|
||||
public:
|
||||
DisableAdcMonitorTask() : SupvTcSpacePacket(PAYLOAD_LENGTH, APID_ADC_MONITOR_TASK) {
|
||||
*(this->localData.fields.buffer) = DISABLE;
|
||||
makeCrc();
|
||||
}
|
||||
|
||||
private:
|
||||
static const uint16_t PAYLOAD_LENGTH = 1; // length without CRC field
|
||||
static const uint8_t DISABLE = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class creates the space packet to request the logging data from the supervisor
|
||||
*/
|
||||
@ -1456,6 +1462,86 @@ class UpdateStatusReport : public TmPacket {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This dataset stores the ADC report.
|
||||
*/
|
||||
class AdcReport : public StaticLocalDataSet<ADC_RPT_SET_ENTRIES> {
|
||||
public:
|
||||
AdcReport(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, ADC_REPORT_SET_ID) {}
|
||||
|
||||
AdcReport(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, ADC_REPORT_SET_ID)) {}
|
||||
|
||||
lp_var_t<uint16_t> adcRaw0 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_0, this);
|
||||
lp_var_t<uint16_t> adcRaw1 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_1, this);
|
||||
lp_var_t<uint16_t> adcRaw2 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_2, this);
|
||||
lp_var_t<uint16_t> adcRaw3 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_3, this);
|
||||
lp_var_t<uint16_t> adcRaw4 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_4, this);
|
||||
lp_var_t<uint16_t> adcRaw5 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_5, this);
|
||||
lp_var_t<uint16_t> adcRaw6 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_6, this);
|
||||
lp_var_t<uint16_t> adcRaw7 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_7, this);
|
||||
lp_var_t<uint16_t> adcRaw8 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_8, this);
|
||||
lp_var_t<uint16_t> adcRaw9 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_9, this);
|
||||
lp_var_t<uint16_t> adcRaw10 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_10, this);
|
||||
lp_var_t<uint16_t> adcRaw11 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_11, this);
|
||||
lp_var_t<uint16_t> adcRaw12 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_12, this);
|
||||
lp_var_t<uint16_t> adcRaw13 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_13, this);
|
||||
lp_var_t<uint16_t> adcRaw14 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_14, this);
|
||||
lp_var_t<uint16_t> adcRaw15 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_15, this);
|
||||
lp_var_t<uint16_t> adcEng0 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_0, this);
|
||||
lp_var_t<uint16_t> adcEng1 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_1, this);
|
||||
lp_var_t<uint16_t> adcEng2 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_2, this);
|
||||
lp_var_t<uint16_t> adcEng3 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_3, this);
|
||||
lp_var_t<uint16_t> adcEng4 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_4, this);
|
||||
lp_var_t<uint16_t> adcEng5 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_5, this);
|
||||
lp_var_t<uint16_t> adcEng6 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_6, this);
|
||||
lp_var_t<uint16_t> adcEng7 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_7, this);
|
||||
lp_var_t<uint16_t> adcEng8 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_8, this);
|
||||
lp_var_t<uint16_t> adcEng9 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_9, this);
|
||||
lp_var_t<uint16_t> adcEng10 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_10, this);
|
||||
lp_var_t<uint16_t> adcEng11 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_11, this);
|
||||
lp_var_t<uint16_t> adcEng12 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_12, this);
|
||||
lp_var_t<uint16_t> adcEng13 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_13, this);
|
||||
lp_var_t<uint16_t> adcEng14 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_14, this);
|
||||
lp_var_t<uint16_t> adcEng15 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_15, this);
|
||||
|
||||
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 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;
|
||||
sif::info << "AdcReport: ADC raw 4: " << this->adcRaw4 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 5: " << this->adcRaw5 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 6: " << this->adcRaw6 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 7: " << this->adcRaw7 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 8: " << this->adcRaw8 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 9: " << this->adcRaw9 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 10: " << this->adcRaw10 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 11: " << this->adcRaw11 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 12: " << this->adcRaw12 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 13: " << this->adcRaw13 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 14: " << this->adcRaw14 << std::endl;
|
||||
sif::info << "AdcReport: ADC raw 15: " << this->adcRaw15 << std::endl;
|
||||
sif::info << "---- Adc Report: Engineering values ----" << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 0: " << this->adcEng0 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 1: " << this->adcEng1 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 2: " << this->adcEng2 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 3: " << this->adcEng3 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 4: " << this->adcEng4 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 5: " << this->adcEng5 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 6: " << this->adcEng6 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 7: " << this->adcEng7 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 8: " << this->adcEng8 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 9: " << this->adcEng9 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 10: " << this->adcEng10 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 11: " << this->adcEng11 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 12: " << this->adcEng12 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 13: " << this->adcEng13 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 14: " << this->adcEng14 << std::endl;
|
||||
sif::info << "AdcReport: ADC eng 15: " << this->adcEng15 << std::endl;
|
||||
}
|
||||
};
|
||||
} // namespace supv
|
||||
|
||||
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_PLOCSVPDEFINITIONS_H_ */
|
||||
|
@ -660,8 +660,6 @@ ReturnValue_t PlocMPSoCHandler::handleMemoryReadReport(const uint8_t* data) {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PlocMPSoCHandler::setNextReplyId() {
|
||||
switch (getPendingCommand()) {
|
||||
case mpsoc::TC_MEM_READ:
|
||||
|
@ -22,6 +22,7 @@ PlocSupervisorHandler::PlocSupervisorHandler(object_id_t objectId, object_id_t u
|
||||
bootStatusReport(this),
|
||||
latchupStatusReport(this),
|
||||
loggingReport(this),
|
||||
adcReport(this),
|
||||
powerSwitch(powerSwitch),
|
||||
supvHelper(supvHelper) {
|
||||
if (comCookie == NULL) {
|
||||
@ -247,6 +248,11 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case REQUEST_ADC_REPORT: {
|
||||
prepareEmptyCmd(APID_REQUEST_ADC_REPORT);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case RUN_AUTO_EM_TESTS: {
|
||||
result = prepareRunAutoEmTest(commandData);
|
||||
break;
|
||||
@ -319,18 +325,6 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case ENABLE_ADC_MONITOR_TASK: {
|
||||
EnableAdcMonitorTask packet;
|
||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case DISABLE_ADC_MONITOR_TASK: {
|
||||
DisableAdcMonitorTask packet;
|
||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case LOGGING_REQUEST_COUNTERS: {
|
||||
RequestLoggingData packet(RequestLoggingData::Sa::REQUEST_COUNTERS);
|
||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
||||
@ -387,6 +381,7 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
|
||||
this->insertInCommandMap(SET_ADC_THRESHOLD);
|
||||
this->insertInCommandMap(GET_LATCHUP_STATUS_REPORT);
|
||||
this->insertInCommandMap(COPY_ADC_DATA_TO_MRAM);
|
||||
this->insertInCommandMap(REQUEST_ADC_REPORT);
|
||||
this->insertInCommandMap(RUN_AUTO_EM_TESTS);
|
||||
this->insertInCommandMap(WIPE_MRAM);
|
||||
this->insertInCommandMap(PRINT_CPU_STATS);
|
||||
@ -401,8 +396,6 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
|
||||
this->insertInCommandMap(FACTORY_FLASH);
|
||||
this->insertInCommandMap(ENABLE_AUTO_TM);
|
||||
this->insertInCommandMap(DISABLE_AUTO_TM);
|
||||
this->insertInCommandMap(ENABLE_ADC_MONITOR_TASK);
|
||||
this->insertInCommandMap(DISABLE_ADC_MONITOR_TASK);
|
||||
this->insertInCommandMap(LOGGING_REQUEST_COUNTERS);
|
||||
this->insertInCommandMap(LOGGING_CLEAR_COUNTERS);
|
||||
this->insertInCommandMap(LOGGING_SET_TOPIC);
|
||||
@ -414,110 +407,120 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
|
||||
this->insertInReplyMap(BOOT_STATUS_REPORT, 3, &bootStatusReport, SIZE_BOOT_STATUS_REPORT);
|
||||
this->insertInReplyMap(LATCHUP_REPORT, 3, &latchupStatusReport, SIZE_LATCHUP_STATUS_REPORT);
|
||||
this->insertInReplyMap(LOGGING_REPORT, 3, &loggingReport, SIZE_LOGGING_REPORT);
|
||||
this->insertInReplyMap(ADC_REPORT, 3, &adcReport, SIZE_ADC_REPORT);
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::iterator command,
|
||||
uint8_t expectedReplies,
|
||||
bool useAlternateId,
|
||||
DeviceCommandId_t alternateReplyID) {
|
||||
using namespace supv;
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
|
||||
uint8_t enabledReplies = 0;
|
||||
|
||||
switch (command->first) {
|
||||
case supv::GET_HK_REPORT: {
|
||||
case GET_HK_REPORT: {
|
||||
enabledReplies = 3;
|
||||
result =
|
||||
DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, supv::HK_REPORT);
|
||||
DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, HK_REPORT);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id "
|
||||
<< supv::HK_REPORT << " not in replyMap" << std::endl;
|
||||
<< HK_REPORT << " not in replyMap" << std::endl;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case supv::GET_BOOT_STATUS_REPORT: {
|
||||
case GET_BOOT_STATUS_REPORT: {
|
||||
enabledReplies = 3;
|
||||
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true,
|
||||
supv::BOOT_STATUS_REPORT);
|
||||
BOOT_STATUS_REPORT);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id "
|
||||
<< supv::BOOT_STATUS_REPORT << " not in replyMap" << std::endl;
|
||||
<< BOOT_STATUS_REPORT << " not in replyMap" << std::endl;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case supv::GET_LATCHUP_STATUS_REPORT: {
|
||||
case GET_LATCHUP_STATUS_REPORT: {
|
||||
enabledReplies = 3;
|
||||
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true,
|
||||
supv::LATCHUP_REPORT);
|
||||
LATCHUP_REPORT);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id "
|
||||
<< supv::LATCHUP_REPORT << " not in replyMap" << std::endl;
|
||||
<< LATCHUP_REPORT << " not in replyMap" << std::endl;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case supv::LOGGING_REQUEST_COUNTERS: {
|
||||
case LOGGING_REQUEST_COUNTERS: {
|
||||
enabledReplies = 3;
|
||||
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true,
|
||||
supv::LOGGING_REPORT);
|
||||
LOGGING_REPORT);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id "
|
||||
<< supv::LOGGING_REPORT << " not in replyMap" << std::endl;
|
||||
<< LOGGING_REPORT << " not in replyMap" << std::endl;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case supv::FIRST_MRAM_DUMP: {
|
||||
case REQUEST_ADC_REPORT: {
|
||||
enabledReplies = 3;
|
||||
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true,
|
||||
ADC_REPORT);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id "
|
||||
<< ADC_REPORT << " not in replyMap" << std::endl;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FIRST_MRAM_DUMP: {
|
||||
enabledReplies = 2; // expected replies will be increased in handleMramDumpPacket
|
||||
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true,
|
||||
supv::FIRST_MRAM_DUMP);
|
||||
FIRST_MRAM_DUMP);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id "
|
||||
<< supv::FIRST_MRAM_DUMP << " not in replyMap" << std::endl;
|
||||
<< FIRST_MRAM_DUMP << " not in replyMap" << std::endl;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case supv::CONSECUTIVE_MRAM_DUMP: {
|
||||
case CONSECUTIVE_MRAM_DUMP: {
|
||||
enabledReplies = 2; // expected replies will be increased in handleMramDumpPacket
|
||||
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true,
|
||||
supv::CONSECUTIVE_MRAM_DUMP);
|
||||
CONSECUTIVE_MRAM_DUMP);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id "
|
||||
<< supv::CONSECUTIVE_MRAM_DUMP << " not in replyMap" << std::endl;
|
||||
<< CONSECUTIVE_MRAM_DUMP << " not in replyMap" << std::endl;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case supv::START_MPSOC:
|
||||
case supv::SHUTDOWN_MPSOC:
|
||||
case supv::SEL_MPSOC_BOOT_IMAGE:
|
||||
case supv::SET_BOOT_TIMEOUT:
|
||||
case supv::SET_MAX_RESTART_TRIES:
|
||||
case supv::RESET_MPSOC:
|
||||
case supv::SET_TIME_REF:
|
||||
case supv::ENABLE_LATCHUP_ALERT:
|
||||
case supv::DISABLE_LATCHUP_ALERT:
|
||||
case supv::SET_ALERT_LIMIT:
|
||||
case supv::SET_ADC_ENABLED_CHANNELS:
|
||||
case supv::SET_ADC_WINDOW_AND_STRIDE:
|
||||
case supv::SET_ADC_THRESHOLD:
|
||||
case supv::COPY_ADC_DATA_TO_MRAM:
|
||||
case supv::RUN_AUTO_EM_TESTS:
|
||||
case supv::WIPE_MRAM:
|
||||
case supv::PRINT_CPU_STATS:
|
||||
case supv::SET_GPIO:
|
||||
case supv::READ_GPIO:
|
||||
case supv::RESTART_SUPERVISOR:
|
||||
case supv::FACTORY_RESET_CLEAR_ALL:
|
||||
case supv::FACTORY_RESET_CLEAR_MIRROR:
|
||||
case supv::FACTORY_RESET_CLEAR_CIRCULAR:
|
||||
case supv::DISABLE_PERIOIC_HK_TRANSMISSION:
|
||||
case supv::START_MPSOC_QUIET:
|
||||
case supv::SET_SHUTDOWN_TIMEOUT:
|
||||
case supv::FACTORY_FLASH:
|
||||
case supv::ENABLE_AUTO_TM:
|
||||
case supv::DISABLE_AUTO_TM:
|
||||
case supv::ENABLE_ADC_MONITOR_TASK:
|
||||
case supv::DISABLE_ADC_MONITOR_TASK:
|
||||
case supv::LOGGING_CLEAR_COUNTERS:
|
||||
case supv::LOGGING_SET_TOPIC:
|
||||
case START_MPSOC:
|
||||
case SHUTDOWN_MPSOC:
|
||||
case SEL_MPSOC_BOOT_IMAGE:
|
||||
case SET_BOOT_TIMEOUT:
|
||||
case SET_MAX_RESTART_TRIES:
|
||||
case RESET_MPSOC:
|
||||
case SET_TIME_REF:
|
||||
case ENABLE_LATCHUP_ALERT:
|
||||
case DISABLE_LATCHUP_ALERT:
|
||||
case SET_ALERT_LIMIT:
|
||||
case SET_ADC_ENABLED_CHANNELS:
|
||||
case SET_ADC_WINDOW_AND_STRIDE:
|
||||
case SET_ADC_THRESHOLD:
|
||||
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:
|
||||
case FACTORY_RESET_CLEAR_ALL:
|
||||
case FACTORY_RESET_CLEAR_MIRROR:
|
||||
case FACTORY_RESET_CLEAR_CIRCULAR:
|
||||
case DISABLE_PERIOIC_HK_TRANSMISSION:
|
||||
case START_MPSOC_QUIET:
|
||||
case SET_SHUTDOWN_TIMEOUT:
|
||||
case FACTORY_FLASH:
|
||||
case ENABLE_AUTO_TM:
|
||||
case DISABLE_AUTO_TM:
|
||||
case LOGGING_CLEAR_COUNTERS:
|
||||
case LOGGING_SET_TOPIC:
|
||||
enabledReplies = 2;
|
||||
break;
|
||||
default:
|
||||
@ -530,16 +533,16 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
|
||||
* replies will be enabled here.
|
||||
*/
|
||||
result =
|
||||
DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, supv::ACK_REPORT);
|
||||
DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, ACK_REPORT);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " << supv::ACK_REPORT
|
||||
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " << ACK_REPORT
|
||||
<< " not in replyMap" << std::endl;
|
||||
}
|
||||
|
||||
result =
|
||||
DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, supv::EXE_REPORT);
|
||||
DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, EXE_REPORT);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " << supv::EXE_REPORT
|
||||
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " << EXE_REPORT
|
||||
<< " not in replyMap" << std::endl;
|
||||
}
|
||||
|
||||
@ -586,6 +589,10 @@ ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t* start, size_t r
|
||||
*foundLen = SIZE_LOGGING_REPORT;
|
||||
*foundId = LOGGING_REPORT;
|
||||
break;
|
||||
case (APID_ADC_REPORT):
|
||||
*foundLen = SIZE_ADC_REPORT;
|
||||
*foundId = ADC_REPORT;
|
||||
break;
|
||||
case (APID_EXE_SUCCESS):
|
||||
*foundLen = SIZE_EXE_REPORT;
|
||||
*foundId = EXE_REPORT;
|
||||
@ -616,34 +623,39 @@ ReturnValue_t PlocSupervisorHandler::getSwitches(const uint8_t** switches,
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||
const uint8_t* packet) {
|
||||
using namespace supv;
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
|
||||
switch (id) {
|
||||
case supv::ACK_REPORT: {
|
||||
case ACK_REPORT: {
|
||||
result = handleAckReport(packet);
|
||||
break;
|
||||
}
|
||||
case (supv::HK_REPORT): {
|
||||
case (HK_REPORT): {
|
||||
result = handleHkReport(packet);
|
||||
break;
|
||||
}
|
||||
case (supv::BOOT_STATUS_REPORT): {
|
||||
case (BOOT_STATUS_REPORT): {
|
||||
result = handleBootStatusReport(packet);
|
||||
break;
|
||||
}
|
||||
case (supv::LATCHUP_REPORT): {
|
||||
case (LATCHUP_REPORT): {
|
||||
result = handleLatchupStatusReport(packet);
|
||||
break;
|
||||
}
|
||||
case (supv::LOGGING_REPORT): {
|
||||
case (LOGGING_REPORT): {
|
||||
result = handleLoggingReport(packet);
|
||||
break;
|
||||
}
|
||||
case (supv::FIRST_MRAM_DUMP):
|
||||
case (supv::CONSECUTIVE_MRAM_DUMP):
|
||||
case (ADC_REPORT): {
|
||||
result = handleAdcReport(packet);
|
||||
break;
|
||||
}
|
||||
case (FIRST_MRAM_DUMP):
|
||||
case (CONSECUTIVE_MRAM_DUMP):
|
||||
result = handleMramDumpPacket(id);
|
||||
break;
|
||||
case (supv::EXE_REPORT): {
|
||||
case (EXE_REPORT): {
|
||||
result = handleExecutionReport(packet);
|
||||
break;
|
||||
}
|
||||
@ -712,6 +724,40 @@ ReturnValue_t PlocSupervisorHandler::initializeLocalDataPool(localpool::DataPool
|
||||
localDataPoolMap.emplace(supv::SOC_BOOTS, new PoolEntry<uint32_t>({0}));
|
||||
localDataPoolMap.emplace(supv::SOC_BOOT_FAILS, new PoolEntry<uint32_t>({0}));
|
||||
|
||||
localDataPoolMap.emplace(supv::ADC_RAW_0, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_RAW_1, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_RAW_2, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_RAW_3, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_RAW_4, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_RAW_5, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_RAW_6, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_RAW_7, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_RAW_8, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_RAW_9, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_RAW_10, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_RAW_11, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_RAW_12, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_RAW_13, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_RAW_14, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_RAW_15, new PoolEntry<uint16_t>({0}));
|
||||
|
||||
localDataPoolMap.emplace(supv::ADC_ENG_0, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_ENG_1, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_ENG_2, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_ENG_3, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_ENG_4, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_ENG_5, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_ENG_6, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_ENG_7, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_ENG_8, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_ENG_9, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_ENG_10, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_ENG_11, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_ENG_12, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_ENG_13, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_ENG_14, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(supv::ADC_ENG_15, new PoolEntry<uint16_t>({0}));
|
||||
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
@ -1071,7 +1117,7 @@ ReturnValue_t PlocSupervisorHandler::handleLoggingReport(const uint8_t* data) {
|
||||
size_t size = loggingReport.getSerializedSize();
|
||||
result = loggingReport.deSerialize(&dataField, &size, SerializeIF::Endianness::BIG);
|
||||
if (result != RETURN_OK) {
|
||||
sif::warning << "StarTrackerHandler::handleLoggingReport: Deserialization failed" << std::endl;
|
||||
sif::warning << "PlocSupervisorHandler::handleLoggingReport: Deserialization failed" << std::endl;
|
||||
}
|
||||
loggingReport.setValidityBufferGeneration(true);
|
||||
loggingReport.setValidity(true, true);
|
||||
@ -1086,6 +1132,41 @@ ReturnValue_t PlocSupervisorHandler::handleLoggingReport(const uint8_t* data) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::handleAdcReport(const uint8_t* data) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
|
||||
result = verifyPacket(data, supv::SIZE_ADC_REPORT);
|
||||
|
||||
if (result == SupvReturnValuesIF::CRC_FAILURE) {
|
||||
sif::error << "PlocSupervisorHandler::handleAdcReport: ADC report has "
|
||||
<< "invalid crc" << std::endl;
|
||||
return result;
|
||||
}
|
||||
|
||||
const uint8_t* dataField = data + supv::DATA_FIELD_OFFSET;
|
||||
result = adcReport.read();
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
adcReport.setValidityBufferGeneration(false);
|
||||
size_t size = adcReport.getSerializedSize();
|
||||
result = adcReport.deSerialize(&dataField, &size, SerializeIF::Endianness::BIG);
|
||||
if (result != RETURN_OK) {
|
||||
sif::warning << "PlocSupervisorHandler::handleAdcReport: Deserialization failed" << std::endl;
|
||||
}
|
||||
adcReport.setValidityBufferGeneration(true);
|
||||
adcReport.setValidity(true, true);
|
||||
result = adcReport.commit();
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_PLOC_SUPERVISOR == 1
|
||||
adcReport.printSet();
|
||||
#endif
|
||||
nextReplyId = supv::EXE_REPORT;
|
||||
return result;
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::setNextReplyId() {
|
||||
switch (getPendingCommand()) {
|
||||
case supv::GET_HK_REPORT:
|
||||
@ -1106,6 +1187,9 @@ void PlocSupervisorHandler::setNextReplyId() {
|
||||
case supv::LOGGING_REQUEST_COUNTERS:
|
||||
nextReplyId = supv::LOGGING_REPORT;
|
||||
break;
|
||||
case supv::REQUEST_ADC_REPORT:
|
||||
nextReplyId = supv::ADC_REPORT;
|
||||
break;
|
||||
default:
|
||||
/* If no telemetry is expected the next reply is always the execution report */
|
||||
nextReplyId = supv::EXE_REPORT;
|
||||
|
@ -94,6 +94,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
supv::BootStatusReport bootStatusReport;
|
||||
supv::LatchupStatusReport latchupStatusReport;
|
||||
supv::LoggingReport loggingReport;
|
||||
supv::AdcReport adcReport;
|
||||
|
||||
const power::Switch_t powerSwitch = power::NO_SWITCH;
|
||||
|
||||
@ -178,6 +179,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
|
||||
ReturnValue_t handleLatchupStatusReport(const uint8_t* data);
|
||||
ReturnValue_t handleLoggingReport(const uint8_t* data);
|
||||
ReturnValue_t handleAdcReport(const uint8_t* data);
|
||||
|
||||
/**
|
||||
* @brief Depending on the current active command, this function sets the reply id of the
|
||||
|
Loading…
x
Reference in New Issue
Block a user