WIP: PLOC MPSoC read file #624

Closed
muellerr wants to merge 58 commits from ploc_mpsoc_read_file into v2.1.0-dev
28 changed files with 1303 additions and 277 deletions

View File

@ -16,12 +16,49 @@ will consitute of a breaking change warranting a new major release:
# [unreleased] # [unreleased]
# [v2.2.0] to be released
# [v2.1.0] to be released
## Changed
- Adapt EM configuration to include all GomSpace PCDU devices except the ACU. For the ACU
(which broke), a dummy will still be used.
- Event Manager queue depth is configurable now.
- Do not construct and schedule broken TMP1075 device anymore.
- Do not track payload modes in system mode tables.
- ACS modes derived from system modes.
- Larger allowed path and file sizes for STR and PLOC MPSoC modules.
- More robust MPSoC flash read and write command data handling.
## Added
- Add the remaining system modes.
- Add support for MPSoC HK packet.
- Add support for MPSoC Flash Directory Content Report.
- Dynamically enable and disable HK packets for MPSoC on `ON` and `OFF` commands.
- PLOC MPSoC device handler: Read file support.
## Fixed
- Host build is working again. Added reduced live TM helper which schedules the PUS and CFDP
funnel.
# [v2.0.5] to be released
- The dual lane assembly transition failed handler started new transitions towards the current mode
instead of the target mode. This means that if the dual lane assembly never reached the initial
submode (e.g. mode normal and submode dual side), it will transition back to the current mode,
which miht be `MODE_OFF`. Furthermore, this can lead to invalid internal states, so the subsequent
recovery handling becomes stuck in the custom recovery sequence when swichting power back on.
- The dual lane custom recovery handling was adapted to always perform proper power switch handling
irrespective of current or target modes.
# [v2.0.4] 2023-04-19 # [v2.0.4] 2023-04-19
## Fixed ## Fixed
- The dual lane assembly device handlers did not properly set their datasets - The dual lane assembly datasets were not marked invalid properly on OFF transitions.
to invalid on off transitions
# [v2.0.3] 2023-04-17 # [v2.0.3] 2023-04-17

View File

@ -146,8 +146,11 @@ set(OBSW_ADD_TMP_DEVICES
${INIT_VAL} ${INIT_VAL}
CACHE STRING "Add TMP devices") CACHE STRING "Add TMP devices")
set(OBSW_ADD_GOMSPACE_PCDU set(OBSW_ADD_GOMSPACE_PCDU
${INIT_VAL} 1
CACHE STRING "Add GomSpace PCDU modules") CACHE STRING "Add GomSpace PCDU modules")
set(OBSW_ADD_GOMSPACE_ACU
${INIT_VAL}
CACHE STRING "Add GomSpace ACU submodule")
set(OBSW_ADD_RW set(OBSW_ADD_RW
${INIT_VAL} ${INIT_VAL}
CACHE STRING "Add RW modules") CACHE STRING "Add RW modules")

View File

@ -64,8 +64,9 @@ void ObjectFactory::produce(void* args) {
PersistentTmStores persistentStores; PersistentTmStores persistentStores;
auto sdcMan = new DummySdCardManager("/tmp"); auto sdcMan = new DummySdCardManager("/tmp");
ObjectFactory::produceGenericObjects(nullptr, &pusFunnel, &cfdpFunnel, *sdcMan, &ipcStore, ObjectFactory::produceGenericObjects(nullptr, &pusFunnel, &cfdpFunnel, *sdcMan, &ipcStore,
&tmStore, persistentStores); &tmStore, persistentStores, 120);
new TmFunnelHandler(objects::LIVE_TM_TASK, *pusFunnel, *cfdpFunnel);
auto* dummyGpioIF = new DummyGpioIF(); auto* dummyGpioIF = new DummyGpioIF();
auto* dummySwitcher = new DummyPowerSwitcher(objects::PCDU_HANDLER, 18, 0); auto* dummySwitcher = new DummyPowerSwitcher(objects::PCDU_HANDLER, 18, 0);
std::vector<ReturnValue_t> switcherList; std::vector<ReturnValue_t> switcherList;

View File

@ -59,19 +59,15 @@ void scheduling::initTasks() {
"DIST", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); "DIST", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
ReturnValue_t result = tmtcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR); ReturnValue_t result = tmtcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
sif::error << "adding CCSDS distributor failed" << std::endl; sif::error << "Adding CCSDS distributor failed" << std::endl;
} }
result = tmtcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR); result = tmtcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
sif::error << "adding PUS distributor failed" << std::endl; sif::error << "Adding PUS distributor failed" << std::endl;
}
result = tmtcDistributor->addComponent(objects::TM_FUNNEL);
if (result != returnvalue::OK) {
sif::error << "adding TM funnel failed" << std::endl;
} }
result = tmtcDistributor->addComponent(objects::CFDP_DISTRIBUTOR); result = tmtcDistributor->addComponent(objects::CFDP_DISTRIBUTOR);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
sif::error << "adding CFDP distributor failed" << std::endl; sif::error << "Adding CFDP distributor failed" << std::endl;
} }
result = tmtcDistributor->addComponent(objects::UDP_TMTC_SERVER); result = tmtcDistributor->addComponent(objects::UDP_TMTC_SERVER);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
@ -95,6 +91,13 @@ void scheduling::initTasks() {
sif::error << "Add component UDP Polling failed" << std::endl; sif::error << "Add component UDP Polling failed" << std::endl;
} }
PeriodicTaskIF* liveTmTask = factory->createPeriodicTask(
"LIVE_TM", 55, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, nullptr, &RR_SCHEDULING);
result = liveTmTask->addComponent(objects::LIVE_TM_TASK);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("LIVE_TM", objects::LIVE_TM_TASK);
}
PeriodicTaskIF* pusHighPrio = factory->createPeriodicTask( PeriodicTaskIF* pusHighPrio = factory->createPeriodicTask(
"PUS_HIGH_PRIO", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc); "PUS_HIGH_PRIO", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusHighPrio->addComponent(objects::PUS_SERVICE_1_VERIFICATION); result = pusHighPrio->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
@ -149,7 +152,7 @@ void scheduling::initTasks() {
"THERMAL_CTL_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc); "THERMAL_CTL_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
result = thermalTask->addComponent(objects::CORE_CONTROLLER); result = thermalTask->addComponent(objects::CORE_CONTROLLER);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
scheduling::printAddObjectError("Core controller dummy", objects::CORE_CONTROLLER); scheduling::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER);
} }
result = thermalTask->addComponent(objects::THERMAL_CONTROLLER); result = thermalTask->addComponent(objects::THERMAL_CONTROLLER);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
@ -217,6 +220,7 @@ void scheduling::initTasks() {
tmtcDistributor->startTask(); tmtcDistributor->startTask();
udpPollingTask->startTask(); udpPollingTask->startTask();
tcpPollingTask->startTask(); tcpPollingTask->startTask();
liveTmTask->startTask();
pusHighPrio->startTask(); pusHighPrio->startTask();
pusMedPrio->startTask(); pusMedPrio->startTask();

View File

@ -22,6 +22,9 @@
#define OBSW_COMMAND_SAFE_MODE_AT_STARTUP 1 #define OBSW_COMMAND_SAFE_MODE_AT_STARTUP 1
#define OBSW_ADD_GOMSPACE_PCDU @OBSW_ADD_GOMSPACE_PCDU@ #define OBSW_ADD_GOMSPACE_PCDU @OBSW_ADD_GOMSPACE_PCDU@
// This define is necessary because the EM setup has the P60 dock module, but no ACU on the P60
// module because it broke.
#define OBSW_ADD_GOMSPACE_ACU @OBSW_ADD_GOMSPACE_ACU@
#define OBSW_ADD_MGT @OBSW_ADD_MGT@ #define OBSW_ADD_MGT @OBSW_ADD_MGT@
#define OBSW_ADD_BPX_BATTERY_HANDLER @OBSW_ADD_BPX_BATTERY_HANDLER@ #define OBSW_ADD_BPX_BATTERY_HANDLER @OBSW_ADD_BPX_BATTERY_HANDLER@
#define OBSW_ADD_STAR_TRACKER @OBSW_ADD_STAR_TRACKER@ #define OBSW_ADD_STAR_TRACKER @OBSW_ADD_STAR_TRACKER@

View File

@ -189,7 +189,6 @@ void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF,
*i2cComIF = new I2cComIF(objects::I2C_COM_IF); *i2cComIF = new I2cComIF(objects::I2C_COM_IF);
*uartComIF = new SerialComIF(objects::UART_COM_IF); *uartComIF = new SerialComIF(objects::UART_COM_IF);
*spiMainComIF = new SpiComIF(objects::SPI_MAIN_COM_IF, q7s::SPI_DEFAULT_DEV, **gpioComIF); *spiMainComIF = new SpiComIF(objects::SPI_MAIN_COM_IF, q7s::SPI_DEFAULT_DEV, **gpioComIF);
//*spiRWComIF = new SpiComIF(objects::SPI_RW_COM_IF, q7s::SPI_RW_DEV, **gpioComIF);
} }
void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher, void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher,
@ -197,7 +196,6 @@ void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchI
CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_SIZE, addresses::P60DOCK, 500); CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_SIZE, addresses::P60DOCK, 500);
CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_SIZE, addresses::PDU1, 500); CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_SIZE, addresses::PDU1, 500);
CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_SIZE, addresses::PDU2, 500); CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_SIZE, addresses::PDU2, 500);
CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_SIZE, addresses::ACU, 500);
auto p60Fdir = new GomspacePowerFdir(objects::P60DOCK_HANDLER); auto p60Fdir = new GomspacePowerFdir(objects::P60DOCK_HANDLER);
P60DockHandler* p60dockhandler = new P60DockHandler(objects::P60DOCK_HANDLER, objects::CSP_COM_IF, P60DockHandler* p60dockhandler = new P60DockHandler(objects::P60DOCK_HANDLER, objects::CSP_COM_IF,
@ -211,9 +209,12 @@ void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchI
Pdu2Handler* pdu2handler = new Pdu2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF, Pdu2Handler* pdu2handler = new Pdu2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF,
pdu2CspCookie, pdu2Fdir, enableHkSets); pdu2CspCookie, pdu2Fdir, enableHkSets);
#if OBSW_ADD_GOMSPACE_ACU == 1
CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_SIZE, addresses::ACU, 500);
auto acuFdir = new GomspacePowerFdir(objects::ACU_HANDLER); auto acuFdir = new GomspacePowerFdir(objects::ACU_HANDLER);
ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, acuCspCookie, ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, acuCspCookie,
acuFdir, enableHkSets); acuFdir, enableHkSets);
#endif
auto pcduHandler = new PcduHandler(objects::PCDU_HANDLER, 50); auto pcduHandler = new PcduHandler(objects::PCDU_HANDLER, 50);
/** /**
@ -223,7 +224,9 @@ void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchI
p60dockhandler->setModeNormal(); p60dockhandler->setModeNormal();
pdu1handler->setModeNormal(); pdu1handler->setModeNormal();
pdu2handler->setModeNormal(); pdu2handler->setModeNormal();
#if OBSW_ADD_GOMSPACE_ACU == 1
acuhandler->setModeNormal(); acuhandler->setModeNormal();
#endif
if (pwrSwitcher != nullptr) { if (pwrSwitcher != nullptr) {
*pwrSwitcher = pcduHandler; *pwrSwitcher = pcduHandler;
} }

View File

@ -36,7 +36,8 @@ void ObjectFactory::produce(void* args) {
PersistentTmStores stores; PersistentTmStores stores;
ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel, ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel,
*SdCardManager::instance(), &ipcStore, &tmStore, stores); *SdCardManager::instance(), &ipcStore, &tmStore, stores,
200);
LinuxLibgpioIF* gpioComIF = nullptr; LinuxLibgpioIF* gpioComIF = nullptr;
SerialComIF* uartComIF = nullptr; SerialComIF* uartComIF = nullptr;
@ -56,6 +57,11 @@ void ObjectFactory::produce(void* args) {
#endif #endif
#if OBSW_ADD_GOMSPACE_PCDU == 1 #if OBSW_ADD_GOMSPACE_PCDU == 1
dummyCfg.addPowerDummies = false; dummyCfg.addPowerDummies = false;
// The ACU broke.
dummyCfg.addOnlyAcuDummy = true;
#endif
#if OBSW_ADD_BPX_BATTERY_HANDLER == 1
dummyCfg.addBpxBattDummy = false;
#endif #endif
#if OBSW_ADD_ACS_BOARD == 1 #if OBSW_ADD_ACS_BOARD == 1
dummyCfg.addAcsBoardDummies = false; dummyCfg.addAcsBoardDummies = false;
@ -89,7 +95,7 @@ void ObjectFactory::produce(void* args) {
// createRadSensorComponent(gpioComIF); // createRadSensorComponent(gpioComIF);
#if OBSW_ADD_ACS_BOARD == 1 #if OBSW_ADD_ACS_BOARD == 1
createAcsBoardComponents(*spiMainComIF, gpioComIF, uartComIF, *pwrSwitcher); createAcsBoardComponents(*spiMainComIF, gpioComIF, uartComIF, *pwrSwitcher, true);
#else #else
// Still add all GPIOs for EM. // Still add all GPIOs for EM.
GpioCookie* acsBoardGpios = new GpioCookie(); GpioCookie* acsBoardGpios = new GpioCookie();

View File

@ -32,7 +32,8 @@ void ObjectFactory::produce(void* args) {
PersistentTmStores stores; PersistentTmStores stores;
ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel, ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel,
*SdCardManager::instance(), &ipcStore, &tmStore, stores); *SdCardManager::instance(), &ipcStore, &tmStore, stores,
200);
LinuxLibgpioIF* gpioComIF = nullptr; LinuxLibgpioIF* gpioComIF = nullptr;
SerialComIF* uartComIF = nullptr; SerialComIF* uartComIF = nullptr;

View File

@ -34,8 +34,8 @@ static constexpr uint32_t STR_IMG_HELPER_QUEUE_SIZE = 50;
static constexpr uint8_t LIVE_TM = 0; static constexpr uint8_t LIVE_TM = 0;
/* Limits for filename and path checks */ /* Limits for filename and path checks */
static constexpr uint32_t MAX_PATH_SIZE = 100; static constexpr uint32_t MAX_PATH_SIZE = 200;
static constexpr uint32_t MAX_FILENAME_SIZE = 50; static constexpr uint32_t MAX_FILENAME_SIZE = 100;
static constexpr uint32_t SA_DEPL_INIT_BUFFER_SECS = 120; static constexpr uint32_t SA_DEPL_INIT_BUFFER_SECS = 120;
// Burn time for autonomous deployment // Burn time for autonomous deployment

View File

@ -45,7 +45,9 @@
void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpioIF) { void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpioIF) {
new ComIFDummy(objects::DUMMY_COM_IF); new ComIFDummy(objects::DUMMY_COM_IF);
auto* comCookieDummy = new ComCookieDummy(); auto* comCookieDummy = new ComCookieDummy();
if (cfg.addBpxBattDummy) {
new BpxDummy(objects::BPX_BATT_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new BpxDummy(objects::BPX_BATT_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
}
if (cfg.addCoreCtrlCfg) { if (cfg.addCoreCtrlCfg) {
new CoreControllerDummy(objects::CORE_CONTROLLER); new CoreControllerDummy(objects::CORE_CONTROLLER);
} }
@ -75,8 +77,9 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio
auto* imtqDummy = new ImtqDummy(objects::IMTQ_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); auto* imtqDummy = new ImtqDummy(objects::IMTQ_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
imtqDummy->enableThermalModule(ThermalStateCfg()); imtqDummy->enableThermalModule(ThermalStateCfg());
imtqDummy->connectModeTreeParent(*imtqAssy); imtqDummy->connectModeTreeParent(*imtqAssy);
if (cfg.addPowerDummies) { if (cfg.addOnlyAcuDummy) {
new AcuDummy(objects::ACU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new AcuDummy(objects::ACU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
} else if (cfg.addPowerDummies) {
new PduDummy(objects::PDU1_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new PduDummy(objects::PDU1_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new PduDummy(objects::PDU2_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new PduDummy(objects::PDU2_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new P60DockDummy(objects::P60DOCK_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new P60DockDummy(objects::P60DOCK_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);

View File

@ -6,9 +6,13 @@ class GpioIF;
namespace dummy { namespace dummy {
// Default values targeted towards EM.
struct DummyCfg { struct DummyCfg {
bool addCoreCtrlCfg = true; bool addCoreCtrlCfg = true;
// Special variant because the ACU broke. Overrides addPowerDummies, only ACU dummy will be added.
bool addOnlyAcuDummy = false;
bool addPowerDummies = true; bool addPowerDummies = true;
bool addBpxBattDummy = true;
bool addSyrlinksDummies = true; bool addSyrlinksDummies = true;
bool addAcsBoardDummies = true; bool addAcsBoardDummies = true;
bool addSusDummies = true; bool addSusDummies = true;

View File

@ -11,6 +11,7 @@ PlocMPSoCHandler::PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid
CookieIF* comCookie, PlocMPSoCHelper* plocMPSoCHelper, CookieIF* comCookie, PlocMPSoCHelper* plocMPSoCHelper,
Gpio uartIsolatorSwitch, object_id_t supervisorHandler) Gpio uartIsolatorSwitch, object_id_t supervisorHandler)
: DeviceHandlerBase(objectId, uartComIFid, comCookie), : DeviceHandlerBase(objectId, uartComIFid, comCookie),
hkReport(this),
plocMPSoCHelper(plocMPSoCHelper), plocMPSoCHelper(plocMPSoCHelper),
uartIsolatorSwitch(uartIsolatorSwitch), uartIsolatorSwitch(uartIsolatorSwitch),
supervisorHandler(supervisorHandler), supervisorHandler(supervisorHandler),
@ -123,11 +124,8 @@ ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueI
} }
switch (actionId) { switch (actionId) {
case mpsoc::TC_FLASHWRITE: { case mpsoc::TC_FLASH_WRITE_FULL_FILE: {
if (size > config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE) { mpsoc::FlashBasePusCmd flashWritePusCmd;
return MPSoCReturnValuesIF::FILENAME_TOO_LONG;
}
mpsoc::FlashWritePusCmd flashWritePusCmd;
result = flashWritePusCmd.extractFields(data, size); result = flashWritePusCmd.extractFields(data, size);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
@ -140,6 +138,22 @@ ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueI
plocMPSoCHelperExecuting = true; plocMPSoCHelperExecuting = true;
return EXECUTION_FINISHED; return EXECUTION_FINISHED;
} }
case mpsoc::TC_FLASH_READ_FULL_FILE: {
mpsoc::FlashReadPusCmd flashReadPusCmd;
result = flashReadPusCmd.extractFields(data, size);
if (result != returnvalue::OK) {
return result;
}
result = plocMPSoCHelper->startFlashRead(flashReadPusCmd.getObcFile(),
flashReadPusCmd.getMPSoCFile(),
flashReadPusCmd.getReadSize());
if (result != returnvalue::OK) {
return result;
}
plocMPSoCHelperExecuting = true;
return EXECUTION_FINISHED;
break;
}
case (mpsoc::OBSW_RESET_SEQ_COUNT): { case (mpsoc::OBSW_RESET_SEQ_COUNT): {
sequenceCount = 0; sequenceCount = 0;
return EXECUTION_FINISHED; return EXECUTION_FINISHED;
@ -159,6 +173,7 @@ void PlocMPSoCHandler::doStartUp() {
powerState = PowerState::BOOTING; powerState = PowerState::BOOTING;
break; break;
case PowerState::ON: case PowerState::ON:
hkReport.setReportingEnabled(true);
setMode(_MODE_TO_ON); setMode(_MODE_TO_ON);
uartIsolatorSwitch.pullHigh(); uartIsolatorSwitch.pullHigh();
break; break;
@ -167,11 +182,13 @@ void PlocMPSoCHandler::doStartUp() {
} }
#else #else
powerState = PowerState::ON; powerState = PowerState::ON;
hkReport.setReportingEnabled(true);
setMode(_MODE_TO_ON); setMode(_MODE_TO_ON);
uartIsolatorSwitch.pullHigh(); uartIsolatorSwitch.pullHigh();
#endif /* not MSPOC_JTAG_BOOT == 1 */ #endif /* not MSPOC_JTAG_BOOT == 1 */
#else #else
powerState = PowerState::ON; powerState = PowerState::ON;
hkReport.setReportingEnabled(true);
setMode(_MODE_TO_ON); setMode(_MODE_TO_ON);
#endif /* XIPHOS_Q7S */ #endif /* XIPHOS_Q7S */
} }
@ -187,6 +204,7 @@ void PlocMPSoCHandler::doShutDown() {
break; break;
case PowerState::OFF: case PowerState::OFF:
sequenceCount = 0; sequenceCount = 0;
hkReport.setReportingEnabled(false);
setMode(_MODE_POWER_DOWN); setMode(_MODE_POWER_DOWN);
break; break;
default: default:
@ -195,6 +213,7 @@ void PlocMPSoCHandler::doShutDown() {
#else #else
sequenceCount = 0; sequenceCount = 0;
uartIsolatorSwitch.pullLow(); uartIsolatorSwitch.pullLow();
hkReport.setReportingEnabled(false);
setMode(_MODE_POWER_DOWN); setMode(_MODE_POWER_DOWN);
powerState = PowerState::OFF; powerState = PowerState::OFF;
#endif #endif
@ -202,7 +221,8 @@ void PlocMPSoCHandler::doShutDown() {
} }
ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
return NOTHING_TO_SEND; *id = mpsoc::TC_GET_HK_REPORT;
return buildCommandFromCommand(*id, nullptr, 0);
} }
ReturnValue_t PlocMPSoCHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) { ReturnValue_t PlocMPSoCHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
@ -247,6 +267,14 @@ ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(DeviceCommandId_t device
result = prepareTcReplayWriteSequence(commandData, commandDataLen); result = prepareTcReplayWriteSequence(commandData, commandDataLen);
break; break;
} }
case (mpsoc::TC_GET_HK_REPORT): {
result = prepareTcGetHkReport();
break;
}
case (mpsoc::TC_FLASH_GET_DIRECTORY_CONTENT): {
result = prepareTcGetDirContent(commandData, commandDataLen);
break;
}
case (mpsoc::TC_MODE_REPLAY): { case (mpsoc::TC_MODE_REPLAY): {
result = prepareTcModeReplay(); result = prepareTcModeReplay();
break; break;
@ -296,6 +324,8 @@ void PlocMPSoCHandler::fillCommandAndReplyMap() {
this->insertInCommandMap(mpsoc::TC_MEM_WRITE); this->insertInCommandMap(mpsoc::TC_MEM_WRITE);
this->insertInCommandMap(mpsoc::TC_MEM_READ); this->insertInCommandMap(mpsoc::TC_MEM_READ);
this->insertInCommandMap(mpsoc::TC_FLASHDELETE); this->insertInCommandMap(mpsoc::TC_FLASHDELETE);
insertInCommandMap(mpsoc::TC_FLASH_WRITE_FULL_FILE);
insertInCommandMap(mpsoc::TC_FLASH_READ_FULL_FILE);
this->insertInCommandMap(mpsoc::TC_REPLAY_START); this->insertInCommandMap(mpsoc::TC_REPLAY_START);
this->insertInCommandMap(mpsoc::TC_REPLAY_STOP); this->insertInCommandMap(mpsoc::TC_REPLAY_STOP);
this->insertInCommandMap(mpsoc::TC_DOWNLINK_PWR_ON); this->insertInCommandMap(mpsoc::TC_DOWNLINK_PWR_ON);
@ -304,16 +334,20 @@ void PlocMPSoCHandler::fillCommandAndReplyMap() {
this->insertInCommandMap(mpsoc::TC_MODE_REPLAY); this->insertInCommandMap(mpsoc::TC_MODE_REPLAY);
this->insertInCommandMap(mpsoc::TC_MODE_IDLE); this->insertInCommandMap(mpsoc::TC_MODE_IDLE);
this->insertInCommandMap(mpsoc::TC_CAM_CMD_SEND); this->insertInCommandMap(mpsoc::TC_CAM_CMD_SEND);
this->insertInCommandMap(mpsoc::TC_GET_HK_REPORT);
this->insertInCommandMap(mpsoc::RELEASE_UART_TX); this->insertInCommandMap(mpsoc::RELEASE_UART_TX);
this->insertInCommandMap(mpsoc::SET_UART_TX_TRISTATE); this->insertInCommandMap(mpsoc::SET_UART_TX_TRISTATE);
this->insertInCommandMap(mpsoc::TC_CAM_TAKE_PIC); this->insertInCommandMap(mpsoc::TC_CAM_TAKE_PIC);
this->insertInCommandMap(mpsoc::TC_FLASH_GET_DIRECTORY_CONTENT);
this->insertInCommandMap(mpsoc::TC_SIMPLEX_SEND_FILE); this->insertInCommandMap(mpsoc::TC_SIMPLEX_SEND_FILE);
this->insertInCommandMap(mpsoc::TC_DOWNLINK_DATA_MODULATE); this->insertInCommandMap(mpsoc::TC_DOWNLINK_DATA_MODULATE);
this->insertInCommandMap(mpsoc::TC_MODE_SNAPSHOT); this->insertInCommandMap(mpsoc::TC_MODE_SNAPSHOT);
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_GET_HK_REPORT, 2, nullptr, mpsoc::SIZE_TM_HK_REPORT);
this->insertInReplyMap(mpsoc::TM_CAM_CMD_RPT, 2, nullptr, mpsoc::SP_MAX_SIZE); this->insertInReplyMap(mpsoc::TM_CAM_CMD_RPT, 2, nullptr, mpsoc::SP_MAX_SIZE);
this->insertInReplyMap(mpsoc::TM_FLASH_DIRECTORY_CONTENT, 2, nullptr, 0);
} }
ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remainingSize, ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remainingSize,
@ -331,6 +365,11 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
} }
uint16_t apid = spacePacket.getApid(); uint16_t apid = spacePacket.getApid();
auto handleDedicatedReply = [&](DeviceCommandId_t replyId) {
*foundLen = spacePacket.getFullPacketLen();
foundPacketLen = *foundLen;
*foundId = replyId;
};
switch (apid) { switch (apid) {
case (mpsoc::apid::ACK_SUCCESS): case (mpsoc::apid::ACK_SUCCESS):
*foundLen = mpsoc::SIZE_ACK_REPORT; *foundLen = mpsoc::SIZE_ACK_REPORT;
@ -345,10 +384,16 @@ 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.getFullPacketLen(); handleDedicatedReply(mpsoc::TM_CAM_CMD_RPT);
tmCamCmdRpt.rememberSpacePacketSize = *foundLen;
*foundId = mpsoc::TM_CAM_CMD_RPT;
break; break;
case (mpsoc::apid::TM_HK_GET_REPORT): {
handleDedicatedReply(mpsoc::TM_GET_HK_REPORT);
break;
}
case (mpsoc::apid::TM_FLASH_DIRECTORY_CONTENT): {
handleDedicatedReply(mpsoc::TM_FLASH_DIRECTORY_CONTENT);
break;
}
case (mpsoc::apid::EXE_SUCCESS): case (mpsoc::apid::EXE_SUCCESS):
*foundLen = mpsoc::SIZE_EXE_REPORT; *foundLen = mpsoc::SIZE_EXE_REPORT;
*foundId = mpsoc::EXE_REPORT; *foundId = mpsoc::EXE_REPORT;
@ -386,10 +431,26 @@ ReturnValue_t PlocMPSoCHandler::interpretDeviceReply(DeviceCommandId_t id, const
result = handleMemoryReadReport(packet); result = handleMemoryReadReport(packet);
break; break;
} }
case (mpsoc::TM_GET_HK_REPORT): {
result = handleGetHkReport(packet);
break;
}
case (mpsoc::TM_CAM_CMD_RPT): { case (mpsoc::TM_CAM_CMD_RPT): {
result = handleCamCmdRpt(packet); result = handleCamCmdRpt(packet);
break; break;
} }
case (mpsoc::TM_FLASH_DIRECTORY_CONTENT): {
result = verifyPacket(packet, foundPacketLen);
if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
sif::warning << "PLOC MPSoC: Flash directory content reply invalid CRC" << std::endl;
}
/** Send data to commanding queue */
handleDeviceTm(packet + mpsoc::DATA_FIELD_OFFSET,
foundPacketLen - mpsoc::DATA_FIELD_OFFSET - mpsoc::CRC_SIZE,
mpsoc::TM_FLASH_DIRECTORY_CONTENT);
nextReplyId = mpsoc::EXE_REPORT;
return result;
}
case (mpsoc::EXE_REPORT): { case (mpsoc::EXE_REPORT): {
result = handleExecutionReport(packet); result = handleExecutionReport(packet);
break; break;
@ -403,12 +464,49 @@ ReturnValue_t PlocMPSoCHandler::interpretDeviceReply(DeviceCommandId_t id, const
return result; return result;
} }
void PlocMPSoCHandler::setNormalDatapoolEntriesInvalid() {} void PlocMPSoCHandler::setNormalDatapoolEntriesInvalid() {
PoolReadGuard pg(&hkReport);
hkReport.setValidity(false, true);
}
uint32_t PlocMPSoCHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 5000; } uint32_t PlocMPSoCHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 5000; }
ReturnValue_t PlocMPSoCHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, ReturnValue_t PlocMPSoCHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) { LocalDataPoolManager& poolManager) {
localDataPoolMap.emplace(mpsoc::poolid::STATUS, &peStatus);
localDataPoolMap.emplace(mpsoc::poolid::MODE, &peMode);
localDataPoolMap.emplace(mpsoc::poolid::DOWNLINK_PWR_ON, &peDownlinkPwrOn);
localDataPoolMap.emplace(mpsoc::poolid::DOWNLINK_JESD_SYNC_STATUS, &peDownlinkJesdSyncStatus);
localDataPoolMap.emplace(mpsoc::poolid::DOWNLINK_DAC_STATUS, &peDownlinkDacStatus);
localDataPoolMap.emplace(mpsoc::poolid::CAM_STATUS, &peCameraStatus);
localDataPoolMap.emplace(mpsoc::poolid::CAM_SDI_STATUS, &peCameraSdiStatus);
localDataPoolMap.emplace(mpsoc::poolid::CAM_FPGA_TEMP, &peCameraFpgaTemp);
localDataPoolMap.emplace(mpsoc::poolid::CAM_SOC_TEMP, &peCameraSocTemp);
localDataPoolMap.emplace(mpsoc::poolid::SYSMON_TEMP, &peSysmonTemp);
localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCCINT, &peSysmonVccInt);
localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCCAUX, &peSysmonVccAux);
localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCCBRAM, &peSysmonVccBram);
localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCCPAUX, &peSysmonVccPaux);
localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCCPINT, &peSysmonVccPint);
localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCCPDRO, &peSysmonVccPdro);
localDataPoolMap.emplace(mpsoc::poolid::SYSMON_MB12V, &peSysmonMb12V);
localDataPoolMap.emplace(mpsoc::poolid::SYSMON_MB3V3, &peSysmonMb3V3);
localDataPoolMap.emplace(mpsoc::poolid::SYSMON_MB1V8, &peSysmonMb1V8);
localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC12V, &peSysmonVcc12V);
localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC3V3, &peSysmonVcc3V3);
localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC3V3VA, &peSysmonVcc3V3VA);
localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC2V5DDR, &peSysmonVcc2V5DDR);
localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC1V2DDR, &peSysmonVcc1V2DDR);
localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC0V9, &peSysmonVcc0V9);
localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC0V6VTT, &peSysmonVcc0V6VTT);
localDataPoolMap.emplace(mpsoc::poolid::SYSMON_SAFE_COTS_CUR, &peSysmonSafeCotsCur);
localDataPoolMap.emplace(mpsoc::poolid::SYSMON_NVM4_XO_CUR, &peSysmonNvm4XoCur);
localDataPoolMap.emplace(mpsoc::poolid::SEM_UNCORRECTABLE_ERRS, &peSemUncorrectableErrs);
localDataPoolMap.emplace(mpsoc::poolid::SEM_CORRECTABLE_ERRS, &peSemCorrectableErrs);
localDataPoolMap.emplace(mpsoc::poolid::SEM_STATUS, &peSemStatus);
localDataPoolMap.emplace(mpsoc::poolid::REBOOT_MPSOC_REQUIRED, &peRebootMpsocRequired);
poolManager.subscribeForRegularPeriodicPacket(
subdp::RegularHkPeriodicParams(hkReport.getSid(), false, 10.0));
return returnvalue::OK; return returnvalue::OK;
} }
@ -512,6 +610,17 @@ ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOff() {
return returnvalue::OK; return returnvalue::OK;
} }
ReturnValue_t PlocMPSoCHandler::prepareTcGetHkReport() {
ReturnValue_t result = returnvalue::OK;
mpsoc::TcGetHkReport tcDownlinkPwrOff(spParams, sequenceCount);
result = tcDownlinkPwrOff.buildPacket();
if (result != returnvalue::OK) {
return result;
}
finishTcPrep(tcDownlinkPwrOff.getFullPacketLen());
return returnvalue::OK;
}
ReturnValue_t PlocMPSoCHandler::prepareTcReplayWriteSequence(const uint8_t* commandData, ReturnValue_t PlocMPSoCHandler::prepareTcReplayWriteSequence(const uint8_t* commandData,
size_t commandDataLen) { size_t commandDataLen) {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
@ -561,9 +670,8 @@ ReturnValue_t PlocMPSoCHandler::prepareTcCamCmdSend(const uint8_t* commandData,
ReturnValue_t PlocMPSoCHandler::prepareTcCamTakePic(const uint8_t* commandData, ReturnValue_t PlocMPSoCHandler::prepareTcCamTakePic(const uint8_t* commandData,
size_t commandDataLen) { size_t commandDataLen) {
ReturnValue_t result = returnvalue::OK;
mpsoc::TcCamTakePic tcCamTakePic(spParams, sequenceCount); mpsoc::TcCamTakePic tcCamTakePic(spParams, sequenceCount);
result = tcCamTakePic.buildPacket(commandData, commandDataLen); ReturnValue_t result = tcCamTakePic.buildPacket(commandData, commandDataLen);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
@ -573,9 +681,8 @@ ReturnValue_t PlocMPSoCHandler::prepareTcCamTakePic(const uint8_t* commandData,
ReturnValue_t PlocMPSoCHandler::prepareTcSimplexSendFile(const uint8_t* commandData, ReturnValue_t PlocMPSoCHandler::prepareTcSimplexSendFile(const uint8_t* commandData,
size_t commandDataLen) { size_t commandDataLen) {
ReturnValue_t result = returnvalue::OK;
mpsoc::TcSimplexSendFile tcSimplexSendFile(spParams, sequenceCount); mpsoc::TcSimplexSendFile tcSimplexSendFile(spParams, sequenceCount);
result = tcSimplexSendFile.buildPacket(commandData, commandDataLen); ReturnValue_t result = tcSimplexSendFile.buildPacket(commandData, commandDataLen);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
@ -583,11 +690,21 @@ ReturnValue_t PlocMPSoCHandler::prepareTcSimplexSendFile(const uint8_t* commandD
return returnvalue::OK; return returnvalue::OK;
} }
ReturnValue_t PlocMPSoCHandler::prepareTcGetDirContent(const uint8_t* commandData,
size_t commandDataLen) {
mpsoc::TcGetDirContent tcGetDirContent(spParams, sequenceCount);
ReturnValue_t result = tcGetDirContent.buildPacket(commandData, commandDataLen);
if (result != returnvalue::OK) {
return result;
}
finishTcPrep(tcGetDirContent.getFullPacketLen());
return returnvalue::OK;
}
ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkDataModulate(const uint8_t* commandData, ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkDataModulate(const uint8_t* commandData,
size_t commandDataLen) { size_t commandDataLen) {
ReturnValue_t result = returnvalue::OK;
mpsoc::TcDownlinkDataModulate tcDownlinkDataModulate(spParams, sequenceCount); mpsoc::TcDownlinkDataModulate tcDownlinkDataModulate(spParams, sequenceCount);
result = tcDownlinkDataModulate.buildPacket(commandData, commandDataLen); ReturnValue_t result = tcDownlinkDataModulate.buildPacket(commandData, commandDataLen);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
@ -596,9 +713,8 @@ ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkDataModulate(const uint8_t* com
} }
ReturnValue_t PlocMPSoCHandler::prepareTcModeSnapshot() { ReturnValue_t PlocMPSoCHandler::prepareTcModeSnapshot() {
ReturnValue_t result = returnvalue::OK;
mpsoc::TcModeSnapshot tcModeSnapshot(spParams, sequenceCount); mpsoc::TcModeSnapshot tcModeSnapshot(spParams, sequenceCount);
result = tcModeSnapshot.buildPacket(); ReturnValue_t result = tcModeSnapshot.buildPacket();
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
@ -718,30 +834,206 @@ ReturnValue_t PlocMPSoCHandler::handleMemoryReadReport(const uint8_t* data) {
uint16_t memLen = uint16_t memLen =
*(data + mpsoc::MEM_READ_RPT_LEN_OFFSET) << 8 | *(data + mpsoc::MEM_READ_RPT_LEN_OFFSET + 1); *(data + mpsoc::MEM_READ_RPT_LEN_OFFSET) << 8 | *(data + mpsoc::MEM_READ_RPT_LEN_OFFSET + 1);
/** Send data to commanding queue */ /** Send data to commanding queue */
handleDeviceTM(data + mpsoc::DATA_FIELD_OFFSET, mpsoc::SIZE_MEM_READ_RPT_FIX + memLen * 4, handleDeviceTm(data + mpsoc::DATA_FIELD_OFFSET, mpsoc::SIZE_MEM_READ_RPT_FIX + memLen * 4,
mpsoc::TM_MEMORY_READ_REPORT); mpsoc::TM_MEMORY_READ_REPORT);
nextReplyId = mpsoc::EXE_REPORT; nextReplyId = mpsoc::EXE_REPORT;
return result; return result;
} }
ReturnValue_t PlocMPSoCHandler::handleGetHkReport(const uint8_t* data) {
ReturnValue_t result = verifyPacket(data, foundPacketLen);
if (result != returnvalue::OK) {
return result;
}
SpacePacketReader packetReader(data, foundPacketLen);
const uint8_t* dataStart = data + 6;
PoolReadGuard pg(&hkReport);
size_t deserLen = mpsoc::SIZE_TM_HK_REPORT;
SerializeIF::Endianness endianness = SerializeIF::Endianness::NETWORK;
result = SerializeAdapter::deSerialize(&hkReport.status.value, &dataStart, &deserLen, endianness);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&hkReport.mode.value, &dataStart, &deserLen, endianness);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&hkReport.downlinkPwrOn.value, &dataStart, &deserLen,
endianness);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&hkReport.downlinkReplyActive.value, &dataStart, &deserLen,
endianness);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&hkReport.downlinkJesdSyncStatus.value, &dataStart,
&deserLen, endianness);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&hkReport.downlinkDacStatus.value, &dataStart, &deserLen,
endianness);
if (result != returnvalue::OK) {
return result;
}
result =
SerializeAdapter::deSerialize(&hkReport.camStatus.value, &dataStart, &deserLen, endianness);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&hkReport.camSdiStatus.value, &dataStart, &deserLen,
endianness);
if (result != returnvalue::OK) {
return result;
}
result =
SerializeAdapter::deSerialize(&hkReport.camFpgaTemp.value, &dataStart, &deserLen, endianness);
if (result != returnvalue::OK) {
return result;
}
result =
SerializeAdapter::deSerialize(&hkReport.sysmonTemp.value, &dataStart, &deserLen, endianness);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&hkReport.sysmonVccInt.value, &dataStart, &deserLen,
endianness);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&hkReport.sysmonVccAux.value, &dataStart, &deserLen,
endianness);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&hkReport.sysmonVccBram.value, &dataStart, &deserLen,
endianness);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&hkReport.sysmonVccPaux.value, &dataStart, &deserLen,
endianness);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&hkReport.sysmonVccPint.value, &dataStart, &deserLen,
endianness);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&hkReport.sysmonVccPdro.value, &dataStart, &deserLen,
endianness);
if (result != returnvalue::OK) {
return result;
}
result =
SerializeAdapter::deSerialize(&hkReport.sysmonMb12V.value, &dataStart, &deserLen, endianness);
if (result != returnvalue::OK) {
return result;
}
result =
SerializeAdapter::deSerialize(&hkReport.sysmonMb3V3.value, &dataStart, &deserLen, endianness);
if (result != returnvalue::OK) {
return result;
}
result =
SerializeAdapter::deSerialize(&hkReport.sysmonMb1V8.value, &dataStart, &deserLen, endianness);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&hkReport.sysmonVcc12V.value, &dataStart, &deserLen,
endianness);
if (result != returnvalue::OK) {
return result;
}
result =
SerializeAdapter::deSerialize(&hkReport.sysmonVcc5V.value, &dataStart, &deserLen, endianness);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&hkReport.sysmonVcc3V3.value, &dataStart, &deserLen,
endianness);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&hkReport.sysmonVcc3V3VA.value, &dataStart, &deserLen,
endianness);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&hkReport.sysmonVcc2V5DDR.value, &dataStart, &deserLen,
endianness);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&hkReport.sysmonVcc1V2DDR.value, &dataStart, &deserLen,
endianness);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&hkReport.sysmonVcc0V9.value, &dataStart, &deserLen,
endianness);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&hkReport.sysmonVcc0V6VTT.value, &dataStart, &deserLen,
endianness);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&hkReport.sysmonSafeCotsCur.value, &dataStart, &deserLen,
endianness);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&hkReport.sysmonNvm4XoCur.value, &dataStart, &deserLen,
endianness);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&hkReport.semUncorrectableErrs.value, &dataStart,
&deserLen, endianness);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&hkReport.semCorrectableErrs.value, &dataStart, &deserLen,
endianness);
if (result != returnvalue::OK) {
return result;
}
result =
SerializeAdapter::deSerialize(&hkReport.semStatus.value, &dataStart, &deserLen, endianness);
if (result != returnvalue::OK) {
return result;
}
// Skip the weird filename
dataStart += 256;
result = SerializeAdapter::deSerialize(&hkReport.rebootMpsocRequired, &dataStart, &deserLen,
endianness);
if (result != returnvalue::OK) {
return result;
}
return returnvalue::OK;
}
ReturnValue_t PlocMPSoCHandler::handleCamCmdRpt(const uint8_t* data) { ReturnValue_t PlocMPSoCHandler::handleCamCmdRpt(const uint8_t* data) {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = verifyPacket(data, foundPacketLen);
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); SpacePacketReader packetReader(data, foundPacketLen);
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), foundPacketLen - mpsoc::SPACE_PACKET_HEADER_SIZE - sizeof(uint16_t) - 3);
tmCamCmdRpt.rememberSpacePacketSize - mpsoc::SPACE_PACKET_HEADER_SIZE - sizeof(uint16_t) - 3);
#if OBSW_DEBUG_PLOC_MPSOC == 1 #if OBSW_DEBUG_PLOC_MPSOC == 1
uint8_t ackValue = *(packetReader.getFullData() + packetReader.getFullPacketLen() - 2); uint8_t ackValue = *(packetReader.getFullData() + packetReader.getFullPacketLen() - 2);
sif::info << "PlocMPSoCHandler: CamCmdRpt message: " << camCmdRptMsg << std::endl; sif::info << "PlocMPSoCHandler: CamCmdRpt message: " << camCmdRptMsg << std::endl;
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(packetReader.getPacketData() + sizeof(uint16_t), handleDeviceTm(packetReader.getPacketData() + sizeof(uint16_t),
packetReader.getPacketDataLen() - 1, mpsoc::TM_CAM_CMD_RPT); packetReader.getPacketDataLen() - 1, mpsoc::TM_CAM_CMD_RPT);
return result; return result;
} }
@ -753,6 +1045,16 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator
uint8_t enabledReplies = 0; uint8_t enabledReplies = 0;
auto enableThreeReplies = [&](DeviceCommandId_t replyId) {
enabledReplies = 3;
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, replyId);
if (result != returnvalue::OK) {
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id "
<< mpsoc::TM_MEMORY_READ_REPORT << " not in replyMap" << std::endl;
return result;
}
return returnvalue::OK;
};
switch (command->first) { switch (command->first) {
case mpsoc::TC_MEM_WRITE: case mpsoc::TC_MEM_WRITE:
case mpsoc::TC_FLASHDELETE: case mpsoc::TC_FLASHDELETE:
@ -769,24 +1071,30 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator
case mpsoc::TC_MODE_SNAPSHOT: case mpsoc::TC_MODE_SNAPSHOT:
enabledReplies = 2; enabledReplies = 2;
break; break;
case mpsoc::TC_MEM_READ: { case mpsoc::TC_GET_HK_REPORT: {
enabledReplies = 3; result = enableThreeReplies(mpsoc::TM_GET_HK_REPORT);
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, if (result != returnvalue::OK) {
mpsoc::TM_MEMORY_READ_REPORT); return result;
}
break;
}
case mpsoc::TC_MEM_READ: {
result = enableThreeReplies(mpsoc::TM_MEMORY_READ_REPORT);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id "
<< mpsoc::TM_MEMORY_READ_REPORT << " not in replyMap" << std::endl;
return result; return result;
} }
break; break;
} }
case mpsoc::TC_CAM_CMD_SEND: { case mpsoc::TC_CAM_CMD_SEND: {
enabledReplies = 3; result = enableThreeReplies(mpsoc::TM_CAM_CMD_RPT);
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, if (result != returnvalue::OK) {
mpsoc::TM_CAM_CMD_RPT); return result;
}
break;
}
case mpsoc::TC_FLASH_GET_DIRECTORY_CONTENT: {
result = enableThreeReplies(mpsoc::TM_FLASH_DIRECTORY_CONTENT);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id "
<< mpsoc::TM_CAM_CMD_RPT << " not in replyMap" << std::endl;
return result; return result;
} }
break; break;
@ -857,6 +1165,7 @@ void PlocMPSoCHandler::setNextReplyId() {
break; break;
} }
} }
size_t PlocMPSoCHandler::getNextReplyLength(DeviceCommandId_t commandId) { size_t PlocMPSoCHandler::getNextReplyLength(DeviceCommandId_t commandId) {
size_t replyLen = 0; size_t replyLen = 0;
@ -881,6 +1190,10 @@ size_t PlocMPSoCHandler::getNextReplyLength(DeviceCommandId_t commandId) {
// report is not fixed // report is not fixed
replyLen = mpsoc::SP_MAX_SIZE; replyLen = mpsoc::SP_MAX_SIZE;
break; break;
case mpsoc::TM_FLASH_DIRECTORY_CONTENT:
// I think the reply size is not fixed either.
replyLen = mpsoc::SP_MAX_SIZE;
break;
default: { default: {
replyLen = iter->second.replyLen; replyLen = iter->second.replyLen;
break; break;
@ -958,7 +1271,7 @@ void PlocMPSoCHandler::completionFailedReceived(ActionId_t actionId, ReturnValue
handleActionCommandFailure(actionId); handleActionCommandFailure(actionId);
} }
void PlocMPSoCHandler::handleDeviceTM(const uint8_t* data, size_t dataSize, void PlocMPSoCHandler::handleDeviceTm(const uint8_t* data, size_t dataSize,
DeviceCommandId_t replyId) { DeviceCommandId_t replyId) {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
@ -996,6 +1309,13 @@ void PlocMPSoCHandler::disableAllReplies() {
DeviceCommandId_t commandId = getPendingCommand(); DeviceCommandId_t commandId = getPendingCommand();
auto disableCommandWithReply = [&](DeviceCommandId_t replyId) {
iter = deviceReplyMap.find(replyId);
info = &(iter->second);
info->delayCycles = 0;
info->active = false;
info->command = deviceCommandMap.end();
};
/* If the command expects a telemetry packet the appropriate tm reply will be disabled here */ /* If the command expects a telemetry packet the appropriate tm reply will be disabled here */
switch (commandId) { switch (commandId) {
case TC_MEM_WRITE: case TC_MEM_WRITE:
@ -1013,19 +1333,19 @@ void PlocMPSoCHandler::disableAllReplies() {
case TC_MODE_SNAPSHOT: case TC_MODE_SNAPSHOT:
break; break;
case TC_MEM_READ: { case TC_MEM_READ: {
iter = deviceReplyMap.find(TM_MEMORY_READ_REPORT); disableCommandWithReply(TM_MEMORY_READ_REPORT);
info = &(iter->second); break;
info->delayCycles = 0; }
info->active = false; case TC_GET_HK_REPORT: {
info->command = deviceCommandMap.end(); disableCommandWithReply(TM_GET_HK_REPORT);
break;
}
case TC_FLASH_GET_DIRECTORY_CONTENT: {
disableCommandWithReply(TM_FLASH_DIRECTORY_CONTENT);
break; break;
} }
case TC_CAM_CMD_SEND: { case TC_CAM_CMD_SEND: {
iter = deviceReplyMap.find(TM_CAM_CMD_RPT); disableCommandWithReply(TM_CAM_CMD_RPT);
info = &(iter->second);
info->delayCycles = 0;
info->active = false;
info->command = deviceCommandMap.end();
break; break;
} }
default: { default: {
@ -1108,6 +1428,13 @@ void PlocMPSoCHandler::handleActionCommandFailure(ActionId_t actionId) {
return; return;
} }
LocalPoolDataSetBase* PlocMPSoCHandler::getDataSetHandle(sid_t sid) {
if (sid == hkReport.getSid()) {
return &hkReport;
}
return nullptr;
}
std::string PlocMPSoCHandler::getStatusString(uint16_t status) { std::string PlocMPSoCHandler::getStatusString(uint16_t status) {
switch (status) { switch (status) {
case (mpsoc::status_code::UNKNOWN_APID): { case (mpsoc::status_code::UNKNOWN_APID): {

View File

@ -77,7 +77,8 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
uint8_t expectedReplies = 1, bool useAlternateId = false, uint8_t expectedReplies = 1, bool useAlternateId = false,
DeviceCommandId_t alternateReplyID = 0) override; DeviceCommandId_t alternateReplyID = 0) override;
size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override; size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override;
virtual ReturnValue_t doSendReadHook() override; ReturnValue_t doSendReadHook() override;
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
private: private:
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_MPSOC_HANDLER; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_MPSOC_HANDLER;
@ -105,6 +106,8 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF; static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF;
static const uint8_t STATUS_OFFSET = 10; static const uint8_t STATUS_OFFSET = 10;
mpsoc::HkReport hkReport;
MessageQueueIF* eventQueue = nullptr; MessageQueueIF* eventQueue = nullptr;
MessageQueueIF* commandActionHelperQueue = nullptr; MessageQueueIF* commandActionHelperQueue = nullptr;
@ -114,6 +117,41 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
SpacePacketCreator creator; SpacePacketCreator creator;
ploc::SpTcParams spParams = ploc::SpTcParams(creator); ploc::SpTcParams spParams = ploc::SpTcParams(creator);
PoolEntry<uint8_t> peStatus = PoolEntry<uint8_t>();
PoolEntry<uint8_t> peMode = PoolEntry<uint8_t>();
PoolEntry<uint8_t> peDownlinkPwrOn = PoolEntry<uint8_t>();
PoolEntry<uint8_t> peDownlinkReplyActive = PoolEntry<uint8_t>();
PoolEntry<uint8_t> peDownlinkJesdSyncStatus = PoolEntry<uint8_t>();
PoolEntry<uint8_t> peDownlinkDacStatus = PoolEntry<uint8_t>();
PoolEntry<uint8_t> peCameraStatus = PoolEntry<uint8_t>();
PoolEntry<uint8_t> peCameraSdiStatus = PoolEntry<uint8_t>();
PoolEntry<float> peCameraFpgaTemp = PoolEntry<float>();
PoolEntry<float> peCameraSocTemp = PoolEntry<float>();
PoolEntry<float> peSysmonTemp = PoolEntry<float>();
PoolEntry<float> peSysmonVccInt = PoolEntry<float>();
PoolEntry<float> peSysmonVccAux = PoolEntry<float>();
PoolEntry<float> peSysmonVccBram = PoolEntry<float>();
PoolEntry<float> peSysmonVccPaux = PoolEntry<float>();
PoolEntry<float> peSysmonVccPint = PoolEntry<float>();
PoolEntry<float> peSysmonVccPdro = PoolEntry<float>();
PoolEntry<float> peSysmonMb12V = PoolEntry<float>();
PoolEntry<float> peSysmonMb3V3 = PoolEntry<float>();
PoolEntry<float> peSysmonMb1V8 = PoolEntry<float>();
PoolEntry<float> peSysmonVcc12V = PoolEntry<float>();
PoolEntry<float> peSysmonVcc5V = PoolEntry<float>();
PoolEntry<float> peSysmonVcc3V3 = PoolEntry<float>();
PoolEntry<float> peSysmonVcc3V3VA = PoolEntry<float>();
PoolEntry<float> peSysmonVcc2V5DDR = PoolEntry<float>();
PoolEntry<float> peSysmonVcc1V2DDR = PoolEntry<float>();
PoolEntry<float> peSysmonVcc0V9 = PoolEntry<float>();
PoolEntry<float> peSysmonVcc0V6VTT = PoolEntry<float>();
PoolEntry<float> peSysmonSafeCotsCur = PoolEntry<float>();
PoolEntry<float> peSysmonNvm4XoCur = PoolEntry<float>();
PoolEntry<uint16_t> peSemUncorrectableErrs = PoolEntry<uint16_t>();
PoolEntry<uint16_t> peSemCorrectableErrs = PoolEntry<uint16_t>();
PoolEntry<uint8_t> peSemStatus = PoolEntry<uint8_t>();
PoolEntry<uint8_t> peRebootMpsocRequired = PoolEntry<uint8_t>();
/** /**
* 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
* because the PLOC sends as reply to each command at least one acknowledgment and execution * because the PLOC sends as reply to each command at least one acknowledgment and execution
@ -138,17 +176,12 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
TmMemReadReport tmMemReadReport; TmMemReadReport tmMemReadReport;
struct TmCamCmdRpt {
size_t rememberSpacePacketSize = 0;
};
TmCamCmdRpt tmCamCmdRpt;
struct TelemetryBuffer { struct TelemetryBuffer {
uint16_t length = 0; uint16_t length = 0;
uint8_t buffer[mpsoc::SP_MAX_SIZE]; uint8_t buffer[mpsoc::SP_MAX_SIZE];
}; };
size_t foundPacketLen = 0;
TelemetryBuffer tmBuffer; TelemetryBuffer tmBuffer;
enum class PowerState { OFF, BOOTING, SHUTDOWN, ON }; enum class PowerState { OFF, BOOTING, SHUTDOWN, ON };
@ -167,6 +200,8 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
ReturnValue_t prepareTcReplayStop(); ReturnValue_t prepareTcReplayStop();
ReturnValue_t prepareTcDownlinkPwrOn(const uint8_t* commandData, size_t commandDataLen); ReturnValue_t prepareTcDownlinkPwrOn(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t prepareTcDownlinkPwrOff(); ReturnValue_t prepareTcDownlinkPwrOff();
ReturnValue_t prepareTcGetHkReport();
ReturnValue_t prepareTcGetDirContent(const uint8_t* commandData, size_t commandDataLen);
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();
@ -213,6 +248,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
*/ */
ReturnValue_t handleMemoryReadReport(const uint8_t* data); ReturnValue_t handleMemoryReadReport(const uint8_t* data);
ReturnValue_t handleGetHkReport(const uint8_t* data);
ReturnValue_t handleCamCmdRpt(const uint8_t* data); ReturnValue_t handleCamCmdRpt(const uint8_t* data);
/** /**
@ -231,7 +267,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
* @param dataSize Size of telemetry in bytes. * @param dataSize Size of telemetry in bytes.
* @param replyId Id of the reply. This will be added to the ActionMessage. * @param replyId Id of the reply. This will be added to the ActionMessage.
*/ */
void handleDeviceTM(const uint8_t* data, size_t dataSize, DeviceCommandId_t replyId); void handleDeviceTm(const uint8_t* data, size_t dataSize, DeviceCommandId_t replyId);
/** /**
* @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

View File

@ -51,6 +51,16 @@ ReturnValue_t PlocMPSoCHelper::performOperation(uint8_t operationCode) {
internalState = InternalState::IDLE; internalState = InternalState::IDLE;
break; break;
} }
case InternalState::FLASH_READ: {
result = performFlashRead();
if (result == returnvalue::OK) {
triggerEvent(MPSOC_FLASH_READ_SUCCESSFUL);
} else {
triggerEvent(MPSOC_FLASH_READ_FAILED);
}
internalState = InternalState::IDLE;
break;
}
default: default:
sif::debug << "PlocMPSoCHelper::performOperation: Invalid state" << std::endl; sif::debug << "PlocMPSoCHelper::performOperation: Invalid state" << std::endl;
break; break;
@ -74,32 +84,22 @@ void PlocMPSoCHelper::setSequenceCount(SourceSequenceCounter* sequenceCount_) {
} }
ReturnValue_t PlocMPSoCHelper::startFlashWrite(std::string obcFile, std::string mpsocFile) { ReturnValue_t PlocMPSoCHelper::startFlashWrite(std::string obcFile, std::string mpsocFile) {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = startFlashReadOrWriteBase(std::move(obcFile), std::move(mpsocFile));
#ifdef XIPHOS_Q7S
result = FilesystemHelper::checkPath(obcFile);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = FilesystemHelper::fileExists(mpsocFile);
if (result != returnvalue::OK) {
return result;
}
#endif
#ifdef TE0720_1CFA
if (not std::filesystem::exists(obcFile)) {
sif::warning << "PlocMPSoCHelper::startFlashWrite: File " << obcFile << "does not exist"
<< std::endl;
return returnvalue::FAILED;
}
#endif
flashWrite.obcFile = obcFile;
flashWrite.mpsocFile = mpsocFile;
internalState = InternalState::FLASH_WRITE; internalState = InternalState::FLASH_WRITE;
result = resetHelper(); return result;
}
ReturnValue_t PlocMPSoCHelper::startFlashRead(std::string obcFile, std::string mpsocFile,
size_t readFileSize) {
ReturnValue_t result = startFlashReadOrWriteBase(std::move(obcFile), std::move(mpsocFile));
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
flashReadAndWrite.totalReadSize = readFileSize;
internalState = InternalState::FLASH_READ;
return result; return result;
} }
@ -116,12 +116,14 @@ void PlocMPSoCHelper::stopProcess() { terminate = true; }
ReturnValue_t PlocMPSoCHelper::performFlashWrite() { ReturnValue_t PlocMPSoCHelper::performFlashWrite() {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
std::ifstream file(flashReadAndWrite.obcFile, std::ifstream::binary);
if (file.bad()) {
return returnvalue::FAILED;
}
result = flashfopen(); result = flashfopen();
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
uint8_t tempData[mpsoc::MAX_DATA_SIZE];
std::ifstream file(flashWrite.obcFile, std::ifstream::binary);
// Set position of next character to end of file input stream // Set position of next character to end of file input stream
file.seekg(0, file.end); file.seekg(0, file.end);
// tellg returns position of character in input stream // tellg returns position of character in input stream
@ -130,29 +132,32 @@ ReturnValue_t PlocMPSoCHelper::performFlashWrite() {
size_t bytesRead = 0; size_t bytesRead = 0;
while (remainingSize > 0) { while (remainingSize > 0) {
if (terminate) { if (terminate) {
flashfclose();
return returnvalue::OK; return returnvalue::OK;
} }
if (remainingSize > mpsoc::MAX_DATA_SIZE) { if (remainingSize > mpsoc::SP_MAX_DATA_SIZE) {
dataLength = mpsoc::MAX_DATA_SIZE; dataLength = mpsoc::SP_MAX_DATA_SIZE;
} else { } else {
dataLength = remainingSize; dataLength = remainingSize;
} }
if (file.is_open()) { if (file.bad() or not file.is_open()) {
flashfclose();
return FILE_WRITE_ERROR;
}
file.seekg(bytesRead, file.beg); file.seekg(bytesRead, file.beg);
file.read(reinterpret_cast<char*>(tempData), dataLength); file.read(reinterpret_cast<char*>(fileBuf.data()), dataLength);
bytesRead += dataLength; bytesRead += dataLength;
remainingSize -= dataLength; remainingSize -= dataLength;
} else {
return FILE_CLOSED_ACCIDENTALLY;
}
(*sequenceCount)++; (*sequenceCount)++;
mpsoc::TcFlashWrite tc(spParams, *sequenceCount); mpsoc::TcFlashWrite tc(spParams, *sequenceCount);
result = tc.buildPacket(tempData, dataLength); result = tc.buildPacket(fileBuf.data(), dataLength);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
flashfclose();
return result; return result;
} }
result = handlePacketTransmission(tc); result = handlePacketTransmissionNoReply(tc);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
flashfclose();
return result; return result;
} }
} }
@ -163,16 +168,69 @@ ReturnValue_t PlocMPSoCHelper::performFlashWrite() {
return result; return result;
} }
ReturnValue_t PlocMPSoCHelper::performFlashRead() {
std::error_code e;
std::ofstream ofile(flashReadAndWrite.obcFile, std::ios::trunc | std::ios::binary);
if (ofile.bad()) {
return returnvalue::FAILED;
}
ReturnValue_t result = flashfopen();
if (result != returnvalue::OK) {
std::filesystem::remove(flashReadAndWrite.obcFile, e);
return result;
}
size_t readSoFar = 0;
size_t nextReadSize = mpsoc::MAX_FLASH_READ_DATA_SIZE;
while (readSoFar < flashReadAndWrite.totalReadSize) {
if (terminate) {
std::filesystem::remove(flashReadAndWrite.obcFile, e);
flashfclose();
return returnvalue::OK;
}
nextReadSize = mpsoc::MAX_FLASH_READ_DATA_SIZE;
if (flashReadAndWrite.totalReadSize - readSoFar < mpsoc::MAX_FLASH_READ_DATA_SIZE) {
nextReadSize = flashReadAndWrite.totalReadSize - readSoFar;
}
if (ofile.bad() or not ofile.is_open()) {
std::filesystem::remove(flashReadAndWrite.obcFile, e);
flashfclose();
return FILE_READ_ERROR;
}
mpsoc::TcFlashRead flashReadRequest(spParams, *sequenceCount);
result = flashReadRequest.buildPacket(nextReadSize);
if (result != returnvalue::OK) {
std::filesystem::remove(flashReadAndWrite.obcFile, e);
flashfclose();
return result;
}
result = handlePacketTransmissionFlashRead(flashReadRequest);
if (result != returnvalue::OK) {
std::filesystem::remove(flashReadAndWrite.obcFile, e);
flashfclose();
return result;
}
result = handleFlashReadReply(ofile, nextReadSize);
if (result != returnvalue::OK) {
std::filesystem::remove(flashReadAndWrite.obcFile, e);
flashfclose();
return result;
}
(*sequenceCount)++;
readSoFar += nextReadSize;
}
return result;
}
ReturnValue_t PlocMPSoCHelper::flashfopen() { ReturnValue_t PlocMPSoCHelper::flashfopen() {
ReturnValue_t result = returnvalue::OK;
spParams.buf = commandBuffer; spParams.buf = commandBuffer;
(*sequenceCount)++; (*sequenceCount)++;
mpsoc::FlashFopen flashFopen(spParams, *sequenceCount); mpsoc::FlashFopen flashFopen(spParams, *sequenceCount);
result = flashFopen.createPacket(flashWrite.mpsocFile, mpsoc::FlashFopen::APPEND); ReturnValue_t result =
flashFopen.createPacket(flashReadAndWrite.mpsocFile, mpsoc::FlashFopen::APPEND);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = handlePacketTransmission(flashFopen); result = handlePacketTransmissionNoReply(flashFopen);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
@ -180,24 +238,18 @@ ReturnValue_t PlocMPSoCHelper::flashfopen() {
} }
ReturnValue_t PlocMPSoCHelper::flashfclose() { ReturnValue_t PlocMPSoCHelper::flashfclose() {
ReturnValue_t result = returnvalue::OK;
spParams.buf = commandBuffer; spParams.buf = commandBuffer;
(*sequenceCount)++; (*sequenceCount)++;
mpsoc::FlashFclose flashFclose(spParams, *sequenceCount); mpsoc::FlashFclose flashFclose(spParams, *sequenceCount);
result = flashFclose.createPacket(flashWrite.mpsocFile); ReturnValue_t result = flashFclose.createPacket(flashReadAndWrite.mpsocFile);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = handlePacketTransmission(flashFclose); return handlePacketTransmissionNoReply(flashFclose);
if (result != returnvalue::OK) {
return result;
}
return returnvalue::OK;
} }
ReturnValue_t PlocMPSoCHelper::handlePacketTransmission(ploc::SpTcBase& tc) { ReturnValue_t PlocMPSoCHelper::handlePacketTransmissionFlashRead(mpsoc::TcFlashRead& tc) {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = sendCommand(tc);
result = sendCommand(tc);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
@ -205,11 +257,24 @@ ReturnValue_t PlocMPSoCHelper::handlePacketTransmission(ploc::SpTcBase& tc) {
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = handleExe(); result = handleTmReception(ccsds::HEADER_LEN + mpsoc::FLASH_READ_MIN_OVERHEAD + tc.readSize +
mpsoc::CRC_SIZE);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
return returnvalue::OK; return handleExe();
}
ReturnValue_t PlocMPSoCHelper::handlePacketTransmissionNoReply(ploc::SpTcBase& tc) {
ReturnValue_t result = sendCommand(tc);
if (result != returnvalue::OK) {
return result;
}
result = handleAck();
if (result != returnvalue::OK) {
return result;
}
return handleExe();
} }
ReturnValue_t PlocMPSoCHelper::sendCommand(ploc::SpTcBase& tc) { ReturnValue_t PlocMPSoCHelper::sendCommand(ploc::SpTcBase& tc) {
@ -309,6 +374,74 @@ ReturnValue_t PlocMPSoCHelper::handleTmReception(size_t remainingBytes) {
return result; return result;
} }
ReturnValue_t PlocMPSoCHelper::handleFlashReadReply(std::ofstream& ofile, size_t expectedReadLen) {
SpTmReader tmPacket(tmBuf.data(), tmBuf.size());
ReturnValue_t result = checkReceivedTm(tmPacket);
if (result != returnvalue::OK) {
return result;
}
uint16_t apid = tmPacket.getApid();
if (apid != mpsoc::apid::TM_FLASH_READ_REPORT) {
triggerEvent(MPSOC_FLASH_READ_PACKET_ERROR, FlashReadErrorType::FLASH_READ_APID_ERROR);
sif::warning << "PLOC MPSoC Flash Read: Unexpected APID" << std::endl;
return result;
}
const uint8_t* packetData = tmPacket.getPacketData();
size_t deserDummy = tmPacket.getPacketDataLen() - mpsoc::CRC_SIZE;
uint32_t receivedReadLen = 0;
std::string receivedShortName = std::string(reinterpret_cast<const char*>(packetData), 12);
if (receivedShortName != flashReadAndWrite.mpsocFile.substr(0, 12)) {
sif::warning << "PLOC MPSoC Flash Read: Missmatch between request file name and "
"received file name"
<< std::endl;
triggerEvent(MPSOC_FLASH_READ_PACKET_ERROR, FlashReadErrorType::FLASH_READ_FILENAME_ERROR);
return returnvalue::FAILED;
}
packetData += 12;
result = SerializeAdapter::deSerialize(&receivedReadLen, &packetData, &deserDummy,
SerializeIF::Endianness::NETWORK);
if (result != returnvalue::OK) {
return result;
}
if (receivedReadLen != expectedReadLen) {
sif::warning << "PLOC MPSoC Flash Read: Missmatch between request read length and "
"received read length"
<< std::endl;
triggerEvent(MPSOC_FLASH_READ_PACKET_ERROR, FlashReadErrorType::FLASH_READ_READLEN_ERROR);
return returnvalue::FAILED;
}
ofile.write(reinterpret_cast<const char*>(packetData), receivedReadLen);
return returnvalue::OK;
}
ReturnValue_t PlocMPSoCHelper::fileCheck(std::string obcFile) {
#ifdef XIPHOS_Q7S
ReturnValue_t result = FilesystemHelper::checkPath(obcFile);
if (result != returnvalue::OK) {
return result;
}
#elif defined(TE0720_1CFA)
if (not std::filesystem::exists(obcFile)) {
sif::warning << "PlocMPSoCHelper::startFlashWrite: File " << obcFile << "does not exist"
<< std::endl;
return returnvalue::FAILED;
}
#endif
return returnvalue::OK;
}
ReturnValue_t PlocMPSoCHelper::startFlashReadOrWriteBase(std::string obcFile,
std::string mpsocFile) {
ReturnValue_t result = fileCheck(obcFile);
if (result != returnvalue::OK) {
return result;
}
flashReadAndWrite.obcFile = std::move(obcFile);
flashReadAndWrite.mpsocFile = std::move(mpsocFile);
return resetHelper();
}
ReturnValue_t PlocMPSoCHelper::checkReceivedTm(SpTmReader& reader) { ReturnValue_t PlocMPSoCHelper::checkReceivedTm(SpTmReader& reader) {
ReturnValue_t result = reader.checkSize(); ReturnValue_t result = reader.checkSize();
if (result != returnvalue::OK) { if (result != returnvalue::OK) {

View File

@ -6,6 +6,7 @@
#include <string> #include <string>
#include "OBSWConfig.h"
#include "fsfw/devicehandlers/CookieIF.h" #include "fsfw/devicehandlers/CookieIF.h"
#include "fsfw/objectmanager/SystemObject.h" #include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/osal/linux/BinarySemaphore.h" #include "fsfw/osal/linux/BinarySemaphore.h"
@ -29,7 +30,7 @@ class PlocMPSoCHelper : public SystemObject, public ExecutableObjectIF {
//! [EXPORT] : [COMMENT] Flash write fails //! [EXPORT] : [COMMENT] Flash write fails
static const Event MPSOC_FLASH_WRITE_FAILED = MAKE_EVENT(0, severity::LOW); static const Event MPSOC_FLASH_WRITE_FAILED = MAKE_EVENT(0, severity::LOW);
//! [EXPORT] : [COMMENT] Flash write successful //! [EXPORT] : [COMMENT] Flash write successful
static const Event MPSOC_FLASH_WRITE_SUCCESSFUL = MAKE_EVENT(1, severity::LOW); static const Event MPSOC_FLASH_WRITE_SUCCESSFUL = MAKE_EVENT(1, severity::INFO);
//! [EXPORT] : [COMMENT] Communication interface returned failure when trying to send the command //! [EXPORT] : [COMMENT] Communication interface returned failure when trying to send the command
//! to the MPSoC //! to the MPSoC
//! P1: Return value returned by the communication interface sendMessage function //! P1: Return value returned by the communication interface sendMessage function
@ -71,6 +72,15 @@ class PlocMPSoCHelper : public SystemObject, public ExecutableObjectIF {
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_SIZE_ERROR = MAKE_EVENT(12, severity::LOW);
static const Event MPSOC_TM_CRC_MISSMATCH = MAKE_EVENT(13, severity::LOW); static const Event MPSOC_TM_CRC_MISSMATCH = MAKE_EVENT(13, severity::LOW);
static const Event MPSOC_FLASH_READ_PACKET_ERROR = MAKE_EVENT(14, severity::LOW);
static const Event MPSOC_FLASH_READ_FAILED = MAKE_EVENT(15, severity::LOW);
static const Event MPSOC_FLASH_READ_SUCCESSFUL = MAKE_EVENT(16, severity::INFO);
enum FlashReadErrorType : uint32_t {
FLASH_READ_APID_ERROR = 0,
FLASH_READ_FILENAME_ERROR = 1,
FLASH_READ_READLEN_ERROR = 2
};
PlocMPSoCHelper(object_id_t objectId); PlocMPSoCHelper(object_id_t objectId);
virtual ~PlocMPSoCHelper(); virtual ~PlocMPSoCHelper();
@ -90,6 +100,14 @@ class PlocMPSoCHelper : public SystemObject, public ExecutableObjectIF {
* @return returnvalue::OK if successful, otherwise error return value * @return returnvalue::OK if successful, otherwise error return value
*/ */
ReturnValue_t startFlashWrite(std::string obcFile, std::string mpsocFile); ReturnValue_t startFlashWrite(std::string obcFile, std::string mpsocFile);
/**
*
* @param obcFile Full target file name on OBC
* @param mpsocFile The file on the MPSoC which should be copied ot the OBC
* @param readFileSize The size of the file on the MPSoC.
* @return
*/
ReturnValue_t startFlashRead(std::string obcFile, std::string mpsocFile, size_t readFileSize);
/** /**
* @brief Can be used to interrupt a running data transfer. * @brief Can be used to interrupt a running data transfer.
@ -104,20 +122,25 @@ class PlocMPSoCHelper : public SystemObject, public ExecutableObjectIF {
private: private:
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_MPSOC_HELPER; static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_MPSOC_HELPER;
//! [EXPORT] : [COMMENT] File accidentally close //! [EXPORT] : [COMMENT] File error occured for file transfers from OBC to the MPSoC.
static const ReturnValue_t FILE_CLOSED_ACCIDENTALLY = MAKE_RETURN_CODE(0xA0); static const ReturnValue_t FILE_WRITE_ERROR = MAKE_RETURN_CODE(0xA0);
//! [EXPORT] : [COMMENT] File error occured for file transfers from MPSoC to OBC.
static const ReturnValue_t FILE_READ_ERROR = MAKE_RETURN_CODE(0xA1);
// Maximum number of times the communication interface retries polling data from the reply // Maximum number of times the communication interface retries polling data from the reply
// buffer // buffer
static const int RETRIES = 10000; static const int RETRIES = 10000;
struct FlashWrite { struct FlashInfo {
std::string obcFile; std::string obcFile;
std::string mpsocFile; std::string mpsocFile;
}; };
struct FlashWrite flashWrite; struct FlashRead : public FlashInfo {
size_t totalReadSize = 0;
};
struct FlashRead flashReadAndWrite;
#if OBSW_THREAD_TRACING == 1 #if OBSW_THREAD_TRACING == 1
uint32_t opCounter = 0; uint32_t opCounter = 0;
#endif #endif
@ -134,7 +157,8 @@ class PlocMPSoCHelper : public SystemObject, public ExecutableObjectIF {
SpacePacketCreator creator; SpacePacketCreator creator;
ploc::SpTcParams spParams = ploc::SpTcParams(creator); ploc::SpTcParams spParams = ploc::SpTcParams(creator);
std::array<uint8_t, mpsoc::MAX_REPLY_SIZE> tmBuf; std::array<uint8_t, mpsoc::SP_MAX_DATA_SIZE> fileBuf{};
std::array<uint8_t, mpsoc::MAX_REPLY_SIZE> tmBuf{};
bool terminate = false; bool terminate = false;
@ -150,13 +174,18 @@ class PlocMPSoCHelper : public SystemObject, public ExecutableObjectIF {
ReturnValue_t resetHelper(); ReturnValue_t resetHelper();
ReturnValue_t performFlashWrite(); ReturnValue_t performFlashWrite();
ReturnValue_t performFlashRead();
ReturnValue_t flashfopen(); ReturnValue_t flashfopen();
ReturnValue_t flashfclose(); ReturnValue_t flashfclose();
ReturnValue_t handlePacketTransmission(ploc::SpTcBase& tc); ReturnValue_t handlePacketTransmissionNoReply(ploc::SpTcBase& tc);
ReturnValue_t handlePacketTransmissionFlashRead(mpsoc::TcFlashRead& tc);
ReturnValue_t handleFlashReadReply(std::ofstream& ofile, size_t expectedReadLen);
ReturnValue_t sendCommand(ploc::SpTcBase& 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();
ReturnValue_t startFlashReadOrWriteBase(std::string obcFile, std::string mpsocFile);
ReturnValue_t fileCheck(std::string obcFile);
void handleAckApidFailure(uint16_t apid); void handleAckApidFailure(uint16_t apid);
void handleExeApidFailure(uint16_t apid); void handleExeApidFailure(uint16_t apid);
ReturnValue_t handleTmReception(size_t remainingBytes); ReturnValue_t handleTmReception(size_t remainingBytes);

View File

@ -1,6 +1,7 @@
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_ #ifndef MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_
#define MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_ #define MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
#include <fsfw/devicehandlers/DeviceHandlerIF.h> #include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <linux/payload/mpsocRetvals.h> #include <linux/payload/mpsocRetvals.h>
#include <mission/payload/plocSpBase.h> #include <mission/payload/plocSpBase.h>
@ -12,6 +13,47 @@
namespace mpsoc { namespace mpsoc {
static constexpr uint32_t HK_SET_ID = 0;
namespace poolid {
enum {
STATUS = 0,
MODE = 1,
DOWNLINK_PWR_ON = 2,
DOWNLINK_REPLY_ACTIIVE = 3,
DOWNLINK_JESD_SYNC_STATUS = 4,
DOWNLINK_DAC_STATUS = 5,
CAM_STATUS = 6,
CAM_SDI_STATUS = 7,
CAM_FPGA_TEMP = 8,
CAM_SOC_TEMP = 9,
SYSMON_TEMP = 10,
SYSMON_VCCINT = 11,
SYSMON_VCCAUX = 12,
SYSMON_VCCBRAM = 13,
SYSMON_VCCPAUX = 14,
SYSMON_VCCPINT = 15,
SYSMON_VCCPDRO = 16,
SYSMON_MB12V = 17,
SYSMON_MB3V3 = 18,
SYSMON_MB1V8 = 19,
SYSMON_VCC12V = 20,
SYSMON_VCC5V = 21,
SYSMON_VCC3V3 = 22,
SYSMON_VCC3V3VA = 23,
SYSMON_VCC2V5DDR = 24,
SYSMON_VCC1V2DDR = 25,
SYSMON_VCC0V9 = 26,
SYSMON_VCC0V6VTT = 27,
SYSMON_SAFE_COTS_CUR = 28,
SYSMON_NVM4_XO_CUR = 29,
SEM_UNCORRECTABLE_ERRS = 30,
SEM_CORRECTABLE_ERRS = 31,
SEM_STATUS = 32,
REBOOT_MPSOC_REQUIRED = 33,
};
}
static const DeviceCommandId_t NONE = 0; static const DeviceCommandId_t NONE = 0;
static const DeviceCommandId_t TC_MEM_WRITE = 1; static const DeviceCommandId_t TC_MEM_WRITE = 1;
static const DeviceCommandId_t TC_MEM_READ = 2; static const DeviceCommandId_t TC_MEM_READ = 2;
@ -20,7 +62,7 @@ static const DeviceCommandId_t EXE_REPORT = 5;
static const DeviceCommandId_t TM_MEMORY_READ_REPORT = 6; static const DeviceCommandId_t TM_MEMORY_READ_REPORT = 6;
static const DeviceCommandId_t TC_FLASHFOPEN = 7; static const DeviceCommandId_t TC_FLASHFOPEN = 7;
static const DeviceCommandId_t TC_FLASHFCLOSE = 8; static const DeviceCommandId_t TC_FLASHFCLOSE = 8;
static const DeviceCommandId_t TC_FLASHWRITE = 9; static const DeviceCommandId_t TC_FLASH_WRITE_FULL_FILE = 9;
static const DeviceCommandId_t TC_FLASHDELETE = 10; static const DeviceCommandId_t TC_FLASHDELETE = 10;
static const DeviceCommandId_t TC_REPLAY_START = 11; static const DeviceCommandId_t TC_REPLAY_START = 11;
static const DeviceCommandId_t TC_REPLAY_STOP = 12; static const DeviceCommandId_t TC_REPLAY_STOP = 12;
@ -37,6 +79,11 @@ static const DeviceCommandId_t TC_CAM_TAKE_PIC = 22;
static const DeviceCommandId_t TC_SIMPLEX_SEND_FILE = 23; static const DeviceCommandId_t TC_SIMPLEX_SEND_FILE = 23;
static const DeviceCommandId_t TC_DOWNLINK_DATA_MODULATE = 24; static const DeviceCommandId_t TC_DOWNLINK_DATA_MODULATE = 24;
static const DeviceCommandId_t TC_MODE_SNAPSHOT = 25; static const DeviceCommandId_t TC_MODE_SNAPSHOT = 25;
static const DeviceCommandId_t TC_GET_HK_REPORT = 26;
static const DeviceCommandId_t TM_GET_HK_REPORT = 27;
static const DeviceCommandId_t TC_FLASH_GET_DIRECTORY_CONTENT = 28;
static const DeviceCommandId_t TM_FLASH_DIRECTORY_CONTENT = 29;
static constexpr DeviceCommandId_t TC_FLASH_READ_FULL_FILE = 30;
// Will reset the sequence count of the OBSW // Will reset the sequence count of the OBSW
static const DeviceCommandId_t OBSW_RESET_SEQ_COUNT = 50; static const DeviceCommandId_t OBSW_RESET_SEQ_COUNT = 50;
@ -45,6 +92,7 @@ static const uint16_t SIZE_ACK_REPORT = 14;
static const uint16_t SIZE_EXE_REPORT = 14; static const uint16_t SIZE_EXE_REPORT = 14;
static const uint16_t SIZE_TM_MEM_READ_REPORT = 18; static const uint16_t SIZE_TM_MEM_READ_REPORT = 18;
static const uint16_t SIZE_TM_CAM_CMD_RPT = 18; static const uint16_t SIZE_TM_CAM_CMD_RPT = 18;
static constexpr size_t SIZE_TM_HK_REPORT = 369;
/** /**
* SpacePacket apids of PLOC telecommands and telemetry. * SpacePacket apids of PLOC telecommands and telemetry.
@ -57,23 +105,31 @@ static const uint16_t TC_DOWNLINK_PWR_ON = 0x113;
static const uint16_t TC_MEM_WRITE = 0x114; static const uint16_t TC_MEM_WRITE = 0x114;
static const uint16_t TC_MEM_READ = 0x115; static const uint16_t TC_MEM_READ = 0x115;
static const uint16_t TC_CAM_TAKE_PIC = 0x116; static const uint16_t TC_CAM_TAKE_PIC = 0x116;
static const uint16_t TC_FLASHWRITE = 0x117; static constexpr uint16_t TC_FLASHWRITE = 0x117;
static constexpr uint16_t TC_FLASHREAD = 0x118;
static const uint16_t TC_FLASHFOPEN = 0x119; static const uint16_t TC_FLASHFOPEN = 0x119;
static const uint16_t TC_FLASHFCLOSE = 0x11A; static const uint16_t TC_FLASHFCLOSE = 0x11A;
static constexpr uint16_t TC_FLASH_GET_DIRECTORY_CONTENT = 0x11B;
static const uint16_t TC_FLASHDELETE = 0x11C; static const uint16_t TC_FLASHDELETE = 0x11C;
static constexpr uint16_t TC_FLASH_CREATE_DIR = 0x11D;
static const uint16_t TC_MODE_IDLE = 0x11E; static const uint16_t TC_MODE_IDLE = 0x11E;
static const uint16_t TC_MODE_REPLAY = 0x11F; static const uint16_t TC_MODE_REPLAY = 0x11F;
static const uint16_t TC_MODE_SNAPSHOT = 0x120; static const uint16_t TC_MODE_SNAPSHOT = 0x120;
static const uint16_t TC_DOWNLINK_DATA_MODULATE = 0x121; static const uint16_t TC_DOWNLINK_DATA_MODULATE = 0x121;
static constexpr uint16_t TC_HK_GET_REPORT = 0x123;
static const uint16_t TC_DOWNLINK_PWR_OFF = 0x124; static const uint16_t TC_DOWNLINK_PWR_OFF = 0x124;
static const uint16_t TC_CAM_CMD_SEND = 0x12C; static const uint16_t TC_CAM_CMD_SEND = 0x12C;
static constexpr uint16_t TC_FLASH_COPY_FILE = 0x12E;
static const uint16_t TC_SIMPLEX_SEND_FILE = 0x130; static const uint16_t TC_SIMPLEX_SEND_FILE = 0x130;
static const uint16_t TM_MEMORY_READ_REPORT = 0x404;
static const uint16_t ACK_SUCCESS = 0x400; static const uint16_t ACK_SUCCESS = 0x400;
static const uint16_t ACK_FAILURE = 0x401; static const uint16_t ACK_FAILURE = 0x401;
static const uint16_t EXE_SUCCESS = 0x402; static const uint16_t EXE_SUCCESS = 0x402;
static const uint16_t EXE_FAILURE = 0x403; static const uint16_t EXE_FAILURE = 0x403;
static const uint16_t TM_MEMORY_READ_REPORT = 0x404;
static const uint16_t TM_FLASH_READ_REPORT = 0x405;
static constexpr uint16_t TM_FLASH_DIRECTORY_CONTENT = 0x406;
static const uint16_t TM_CAM_CMD_RPT = 0x407; static const uint16_t TM_CAM_CMD_RPT = 0x407;
static constexpr uint16_t TM_HK_GET_REPORT = 0x408;
} // namespace apid } // namespace apid
/** Offset from first byte in space packet to first byte of data field */ /** Offset from first byte in space packet to first byte of data field */
@ -106,9 +162,13 @@ static const uint16_t LENGTH_TC_MEM_READ = 8;
* at sheet README * at sheet README
*/ */
static constexpr size_t SP_MAX_SIZE = 1024; static constexpr size_t SP_MAX_SIZE = 1024;
static const size_t MAX_REPLY_SIZE = SP_MAX_SIZE * 3; static constexpr size_t MAX_REPLY_SIZE = SP_MAX_SIZE * 3;
static const size_t MAX_COMMAND_SIZE = SP_MAX_SIZE; static constexpr size_t MAX_COMMAND_SIZE = SP_MAX_SIZE;
static const size_t MAX_DATA_SIZE = 1016; // 1016 bytes.
static constexpr size_t SP_MAX_DATA_SIZE = SP_MAX_SIZE - ccsds::HEADER_LEN - CRC_SIZE;
static constexpr size_t FLASH_READ_MIN_OVERHEAD = 16;
// 1000 bytes.
static const size_t MAX_FLASH_READ_DATA_SIZE = SP_MAX_DATA_SIZE - FLASH_READ_MIN_OVERHEAD;
/** /**
* The replay write sequence command has a maximum delay for the execution report which amounts to * The replay write sequence command has a maximum delay for the execution report which amounts to
@ -374,8 +434,8 @@ class TcFlashWrite : public ploc::SpTcBase {
ReturnValue_t buildPacket(const uint8_t* writeData, uint32_t writeLen_) { ReturnValue_t buildPacket(const uint8_t* writeData, uint32_t writeLen_) {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
writeLen = writeLen_; writeLen = writeLen_;
if (writeLen > MAX_DATA_SIZE) { if (writeLen > SP_MAX_DATA_SIZE) {
sif::debug << "FlashWrite::createPacket: Command data too big" << std::endl; sif::error << "TcFlashWrite: Command data too big" << std::endl;
return returnvalue::FAILED; return returnvalue::FAILED;
} }
spParams.setFullPayloadLen(static_cast<uint16_t>(writeLen) + 4 + CRC_SIZE); spParams.setFullPayloadLen(static_cast<uint16_t>(writeLen) + 4 + CRC_SIZE);
@ -391,9 +451,9 @@ class TcFlashWrite : public ploc::SpTcBase {
} }
std::memcpy(payloadStart + sizeof(writeLen), writeData, writeLen); std::memcpy(payloadStart + sizeof(writeLen), writeData, writeLen);
updateSpFields(); updateSpFields();
auto res = checkSizeAndSerializeHeader(); result = checkSizeAndSerializeHeader();
if (res != returnvalue::OK) { if (result != returnvalue::OK) {
return res; return result;
} }
return calcAndSetCrc(); return calcAndSetCrc();
} }
@ -402,6 +462,43 @@ class TcFlashWrite : public ploc::SpTcBase {
uint32_t writeLen = 0; uint32_t writeLen = 0;
}; };
class TcFlashRead : public ploc::SpTcBase {
public:
TcFlashRead(ploc::SpTcParams params, uint16_t sequenceCount)
: ploc::SpTcBase(params, apid::TC_FLASHWRITE, sequenceCount) {}
ReturnValue_t buildPacket(uint32_t readLen) {
if (readLen > MAX_FLASH_READ_DATA_SIZE) {
sif::error << "TcFlashRead: Read length " << readLen << " too large" << std::endl;
return returnvalue::FAILED;
}
spParams.setFullPayloadLen(readLen + FLASH_READ_MIN_OVERHEAD + CRC_SIZE);
ReturnValue_t result = checkPayloadLen();
if (result != returnvalue::OK) {
return result;
}
size_t serializedSize = ccsds::HEADER_LEN;
result = SerializeAdapter::serialize(&readLen, payloadStart, &serializedSize, spParams.maxSize,
SerializeIF::Endianness::NETWORK);
if (result != returnvalue::OK) {
return result;
}
updateSpFields();
result = checkSizeAndSerializeHeader();
if (result != returnvalue::OK) {
return result;
}
result = calcAndSetCrc();
if (result != returnvalue::OK) {
return result;
}
readSize = readLen;
return result;
}
uint32_t readSize = 0;
};
/** /**
* @brief Class to help creation of flash delete command. * @brief Class to help creation of flash delete command.
*/ */
@ -561,6 +658,32 @@ class TcDownlinkPwrOn : public TcBase {
} }
}; };
/**
* @brief Class to build replay stop space packet.
*/
class TcGetHkReport : public TcBase {
public:
TcGetHkReport(ploc::SpTcParams params, uint16_t sequenceCount)
: TcBase(params, apid::TC_HK_GET_REPORT, sequenceCount) {}
};
class TcGetDirContent : public TcBase {
public:
TcGetDirContent(ploc::SpTcParams params, uint16_t sequenceCount)
: TcBase(params, apid::TC_FLASH_GET_DIRECTORY_CONTENT, sequenceCount) {}
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
ReturnValue_t result = returnvalue::OK;
spParams.setFullPayloadLen(commandDataLen + sizeof(NULL_TERMINATOR) + CRC_SIZE);
if (result != returnvalue::OK) {
return result;
}
std::memcpy(payloadStart, commandData, commandDataLen);
*(payloadStart + commandDataLen) = NULL_TERMINATOR;
return result;
}
};
/** /**
* @brief Class to build replay stop space packet. * @brief Class to build replay stop space packet.
*/ */
@ -611,36 +734,69 @@ class TcReplayWriteSeq : public TcBase {
/** /**
* @brief Helps to extract the fields of the flash write command from the PUS packet. * @brief Helps to extract the fields of the flash write command from the PUS packet.
*/ */
class FlashWritePusCmd : public MPSoCReturnValuesIF { class FlashBasePusCmd : public MPSoCReturnValuesIF {
public: public:
FlashWritePusCmd(){}; FlashBasePusCmd() = default;
virtual ~FlashBasePusCmd() = default;
ReturnValue_t extractFields(const uint8_t* commandData, size_t commandDataLen) { virtual ReturnValue_t extractFields(const uint8_t* commandData, size_t commandDataLen) {
if (commandDataLen > (config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE + MAX_FILENAME_SIZE)) { if (commandDataLen > (config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE + MAX_FILENAME_SIZE)) {
return INVALID_LENGTH; return INVALID_LENGTH;
} }
obcFile = std::string(reinterpret_cast<const char*>(commandData)); size_t fileLen = strnlen(reinterpret_cast<const char*>(commandData), commandDataLen);
if (obcFile.size() > (config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE)) { if (fileLen > (config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE)) {
return FILENAME_TOO_LONG; return FILENAME_TOO_LONG;
} }
mpsocFile = std::string( obcFile = std::string(reinterpret_cast<const char*>(commandData), fileLen);
reinterpret_cast<const char*>(commandData + obcFile.size() + SIZE_NULL_TERMINATOR)); fileLen =
if (mpsocFile.size() > MAX_FILENAME_SIZE) { strnlen(reinterpret_cast<const char*>(commandData + obcFile.size() + SIZE_NULL_TERMINATOR),
commandDataLen - obcFile.size() - 1);
if (fileLen > MAX_FILENAME_SIZE) {
return MPSOC_FILENAME_TOO_LONG; return MPSOC_FILENAME_TOO_LONG;
} }
mpsocFile = std::string(
reinterpret_cast<const char*>(commandData + obcFile.size() + SIZE_NULL_TERMINATOR),
fileLen);
return returnvalue::OK; return returnvalue::OK;
} }
std::string getObcFile() { return obcFile; } const std::string& getObcFile() const { return obcFile; }
std::string getMPSoCFile() { return mpsocFile; } const std::string& getMPSoCFile() const { return mpsocFile; }
protected:
size_t getParsedSize() const {
return getObcFile().size() + getMPSoCFile().size() + 2 * SIZE_NULL_TERMINATOR;
}
static const size_t SIZE_NULL_TERMINATOR = 1;
private: private:
static const size_t SIZE_NULL_TERMINATOR = 1; std::string obcFile;
std::string obcFile = ""; std::string mpsocFile;
std::string mpsocFile = "";
}; };
class FlashReadPusCmd : public FlashBasePusCmd {
public:
FlashReadPusCmd(){};
ReturnValue_t extractFields(const uint8_t* commandData, size_t commandDataLen) override {
ReturnValue_t result = FlashBasePusCmd::extractFields(commandData, commandDataLen);
if (result != returnvalue::OK) {
return result;
}
if (commandDataLen < (getParsedSize() + 4)) {
return returnvalue::FAILED;
}
size_t deserDummy = 4;
return SerializeAdapter::deSerialize(&readSize, commandData + getParsedSize(), &deserDummy,
SerializeIF::Endianness::NETWORK);
}
size_t getReadSize() const { return readSize; }
private:
size_t readSize = 0;
};
/** /**
* @brief Class to build replay stop space packet. * @brief Class to build replay stop space packet.
*/ */
@ -774,6 +930,67 @@ class TcCamcmdSend : public TcBase {
static const uint8_t CARRIAGE_RETURN = 0xD; static const uint8_t CARRIAGE_RETURN = 0xD;
}; };
class HkReport : public StaticLocalDataSet<36> {
public:
HkReport(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, HK_SET_ID) {}
HkReport(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, HK_SET_ID)) {}
lp_var_t<uint32_t> status = lp_var_t<uint32_t>(sid.objectId, mpsoc::poolid::STATUS, this);
lp_var_t<uint8_t> mode = lp_var_t<uint8_t>(sid.objectId, mpsoc::poolid::MODE, this);
lp_var_t<uint8_t> downlinkPwrOn =
lp_var_t<uint8_t>(sid.objectId, mpsoc::poolid::DOWNLINK_PWR_ON, this);
lp_var_t<uint8_t> downlinkReplyActive =
lp_var_t<uint8_t>(sid.objectId, mpsoc::poolid::DOWNLINK_REPLY_ACTIIVE, this);
lp_var_t<uint8_t> downlinkJesdSyncStatus =
lp_var_t<uint8_t>(sid.objectId, mpsoc::poolid::DOWNLINK_JESD_SYNC_STATUS, this);
lp_var_t<uint8_t> downlinkDacStatus =
lp_var_t<uint8_t>(sid.objectId, mpsoc::poolid::DOWNLINK_DAC_STATUS, this);
lp_var_t<uint8_t> camStatus = lp_var_t<uint8_t>(sid.objectId, mpsoc::poolid::CAM_STATUS, this);
lp_var_t<uint8_t> camSdiStatus =
lp_var_t<uint8_t>(sid.objectId, mpsoc::poolid::CAM_SDI_STATUS, this);
lp_var_t<float> camFpgaTemp = lp_var_t<float>(sid.objectId, mpsoc::poolid::CAM_FPGA_TEMP, this);
lp_var_t<float> camSocTemp = lp_var_t<float>(sid.objectId, mpsoc::poolid::CAM_SOC_TEMP, this);
lp_var_t<float> sysmonTemp = lp_var_t<float>(sid.objectId, mpsoc::poolid::SYSMON_TEMP, this);
lp_var_t<float> sysmonVccInt = lp_var_t<float>(sid.objectId, mpsoc::poolid::SYSMON_VCCINT, this);
lp_var_t<float> sysmonVccAux = lp_var_t<float>(sid.objectId, mpsoc::poolid::SYSMON_VCCAUX, this);
lp_var_t<float> sysmonVccBram =
lp_var_t<float>(sid.objectId, mpsoc::poolid::SYSMON_VCCBRAM, this);
lp_var_t<float> sysmonVccPaux =
lp_var_t<float>(sid.objectId, mpsoc::poolid::SYSMON_VCCPAUX, this);
lp_var_t<float> sysmonVccPint =
lp_var_t<float>(sid.objectId, mpsoc::poolid::SYSMON_VCCPINT, this);
lp_var_t<float> sysmonVccPdro =
lp_var_t<float>(sid.objectId, mpsoc::poolid::SYSMON_VCCPDRO, this);
lp_var_t<float> sysmonMb12V = lp_var_t<float>(sid.objectId, mpsoc::poolid::SYSMON_MB12V, this);
lp_var_t<float> sysmonMb3V3 = lp_var_t<float>(sid.objectId, mpsoc::poolid::SYSMON_MB3V3, this);
lp_var_t<float> sysmonMb1V8 = lp_var_t<float>(sid.objectId, mpsoc::poolid::SYSMON_MB1V8, this);
lp_var_t<float> sysmonVcc12V = lp_var_t<float>(sid.objectId, mpsoc::poolid::SYSMON_VCC12V, this);
lp_var_t<float> sysmonVcc5V = lp_var_t<float>(sid.objectId, mpsoc::poolid::SYSMON_VCC5V, this);
lp_var_t<float> sysmonVcc3V3 = lp_var_t<float>(sid.objectId, mpsoc::poolid::SYSMON_VCC3V3, this);
lp_var_t<float> sysmonVcc3V3VA =
lp_var_t<float>(sid.objectId, mpsoc::poolid::SYSMON_VCC3V3VA, this);
lp_var_t<float> sysmonVcc2V5DDR =
lp_var_t<float>(sid.objectId, mpsoc::poolid::SYSMON_VCC2V5DDR, this);
lp_var_t<float> sysmonVcc1V2DDR =
lp_var_t<float>(sid.objectId, mpsoc::poolid::SYSMON_VCC1V2DDR, this);
lp_var_t<float> sysmonVcc0V9 = lp_var_t<float>(sid.objectId, mpsoc::poolid::SYSMON_VCC0V9, this);
lp_var_t<float> sysmonVcc0V6VTT =
lp_var_t<float>(sid.objectId, mpsoc::poolid::SYSMON_VCC0V6VTT, this);
lp_var_t<float> sysmonSafeCotsCur =
lp_var_t<float>(sid.objectId, mpsoc::poolid::SYSMON_SAFE_COTS_CUR, this);
lp_var_t<float> sysmonNvm4XoCur =
lp_var_t<float>(sid.objectId, mpsoc::poolid::SYSMON_NVM4_XO_CUR, this);
lp_var_t<uint16_t> semUncorrectableErrs =
lp_var_t<uint16_t>(sid.objectId, mpsoc::poolid::SEM_UNCORRECTABLE_ERRS, this);
lp_var_t<uint16_t> semCorrectableErrs =
lp_var_t<uint16_t>(sid.objectId, mpsoc::poolid::SEM_CORRECTABLE_ERRS, this);
lp_var_t<uint8_t> semStatus =
lp_var_t<uint8_t>(sid.objectId, mpsoc::poolid::SEM_CORRECTABLE_ERRS, this);
lp_var_t<uint8_t> rebootMpsocRequired =
lp_var_t<uint8_t>(sid.objectId, mpsoc::poolid::REBOOT_MPSOC_REQUIRED, this);
};
} // namespace mpsoc } // namespace mpsoc
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_ */ #endif /* MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_ */

View File

@ -3,6 +3,7 @@
#include <eive/eventSubsystemIds.h> #include <eive/eventSubsystemIds.h>
#include <fsfw/modes/HasModesIF.h> #include <fsfw/modes/HasModesIF.h>
#include <mission/sysDefs.h>
namespace acs { namespace acs {
@ -11,12 +12,12 @@ enum class SimpleSensorMode { NORMAL = 0, OFF = 1 };
// These modes are the modes of the ACS controller and of the ACS subsystem. // These modes are the modes of the ACS controller and of the ACS subsystem.
enum AcsMode : Mode_t { enum AcsMode : Mode_t {
OFF = HasModesIF::MODE_OFF, OFF = HasModesIF::MODE_OFF,
SAFE = 10, SAFE = satsystem::Mode::SAFE,
PTG_IDLE = 11, PTG_IDLE = satsystem::Mode::PTG_IDLE,
PTG_NADIR = 12, PTG_NADIR = satsystem::Mode::PTG_NADIR,
PTG_TARGET = 13, PTG_TARGET = satsystem::Mode::PTG_TARGET,
PTG_TARGET_GS = 14, PTG_TARGET_GS = satsystem::Mode::PTG_TARGET_GS,
PTG_INERTIAL = 15, PTG_INERTIAL = satsystem::Mode::PTG_INERTIAL,
}; };
enum SafeSubmode : Submode_t { DEFAULT = 0, DETUMBLE = 1 }; enum SafeSubmode : Submode_t { DEFAULT = 0, DETUMBLE = 1 };

View File

@ -17,6 +17,7 @@ extern "C" {
#include <thread> #include <thread>
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "eive/definitions.h"
std::atomic_bool JCFG_DONE(false); std::atomic_bool JCFG_DONE(false);
@ -152,7 +153,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
return EXECUTION_FINISHED; return EXECUTION_FINISHED;
} }
case (startracker::SET_JSON_FILE_NAME): { case (startracker::SET_JSON_FILE_NAME): {
if (size > MAX_PATH_SIZE) { if (size > config::MAX_PATH_SIZE) {
return FILE_PATH_TOO_LONG; return FILE_PATH_TOO_LONG;
} }
paramJsonFile = std::string(reinterpret_cast<const char*>(data), size); paramJsonFile = std::string(reinterpret_cast<const char*>(data), size);
@ -189,7 +190,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if (size > MAX_PATH_SIZE + MAX_FILE_NAME) { if (size > config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE) {
return FILE_PATH_TOO_LONG; return FILE_PATH_TOO_LONG;
} }
result = strHelper->startImageUpload(std::string(reinterpret_cast<const char*>(data), size)); result = strHelper->startImageUpload(std::string(reinterpret_cast<const char*>(data), size));
@ -204,7 +205,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if (size > MAX_PATH_SIZE) { if (size > config::MAX_PATH_SIZE) {
return FILE_PATH_TOO_LONG; return FILE_PATH_TOO_LONG;
} }
result = result =
@ -228,14 +229,14 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
return EXECUTION_FINISHED; return EXECUTION_FINISHED;
} }
case (startracker::CHANGE_IMAGE_DOWNLOAD_FILE): { case (startracker::CHANGE_IMAGE_DOWNLOAD_FILE): {
if (size > MAX_FILE_NAME) { if (size > config::MAX_FILENAME_SIZE) {
return FILENAME_TOO_LONG; return FILENAME_TOO_LONG;
} }
strHelper->setDownloadImageName(std::string(reinterpret_cast<const char*>(data), size)); strHelper->setDownloadImageName(std::string(reinterpret_cast<const char*>(data), size));
return EXECUTION_FINISHED; return EXECUTION_FINISHED;
} }
case (startracker::SET_FLASH_READ_FILENAME): { case (startracker::SET_FLASH_READ_FILENAME): {
if (size > MAX_FILE_NAME) { if (size > config::MAX_FILENAME_SIZE) {
return FILENAME_TOO_LONG; return FILENAME_TOO_LONG;
} }
strHelper->setFlashReadFilename(std::string(reinterpret_cast<const char*>(data), size)); strHelper->setFlashReadFilename(std::string(reinterpret_cast<const char*>(data), size));
@ -246,7 +247,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if (size > MAX_PATH_SIZE + MAX_FILE_NAME) { if (size > config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE) {
return FILE_PATH_TOO_LONG; return FILE_PATH_TOO_LONG;
} }
result = result =
@ -1568,7 +1569,7 @@ ReturnValue_t StarTrackerHandler::executeFlashReadCommand(const uint8_t* command
<< std::endl; << std::endl;
return result; return result;
} }
if (commandDataLen - sizeof(startRegion) - sizeof(length) > MAX_PATH_SIZE) { if (commandDataLen - sizeof(startRegion) - sizeof(length) > config::MAX_PATH_SIZE) {
sif::warning << "StarTrackerHandler::executeFlashReadCommand: Received command with invalid" sif::warning << "StarTrackerHandler::executeFlashReadCommand: Received command with invalid"
<< " path and filename" << std::endl; << " path and filename" << std::endl;
return FILE_PATH_TOO_LONG; return FILE_PATH_TOO_LONG;
@ -1708,7 +1709,7 @@ ReturnValue_t StarTrackerHandler::prepareParamCommand(const uint8_t* commandData
bool reinitSet) { bool reinitSet) {
// Stopwatch watch; // Stopwatch watch;
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
if (commandDataLen > MAX_PATH_SIZE) { if (commandDataLen > config::MAX_PATH_SIZE) {
return FILE_PATH_TOO_LONG; return FILE_PATH_TOO_LONG;
} }
if (reinitSet) { if (reinitSet) {

View File

@ -144,9 +144,6 @@ class StarTrackerHandler : public DeviceHandlerBase {
//! [EXPORT] : [COMMENT] Failed to boot star tracker into bootloader mode //! [EXPORT] : [COMMENT] Failed to boot star tracker into bootloader mode
static const Event BOOTING_BOOTLOADER_FAILED_EVENT = MAKE_EVENT(2, severity::LOW); static const Event BOOTING_BOOTLOADER_FAILED_EVENT = MAKE_EVENT(2, severity::LOW);
static const size_t MAX_PATH_SIZE = 50;
static const size_t MAX_FILE_NAME = 30;
static const uint8_t STATUS_OFFSET = 2; static const uint8_t STATUS_OFFSET = 2;
static const uint8_t PARAMS_OFFSET = 2; static const uint8_t PARAMS_OFFSET = 2;
static const uint8_t TICKS_OFFSET = 3; static const uint8_t TICKS_OFFSET = 3;

View File

@ -96,9 +96,10 @@ std::atomic_bool tcs::TCS_BOARD_SHORTLY_UNAVAILABLE = false;
void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFunnel** pusFunnel, void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFunnel** pusFunnel,
CfdpTmFunnel** cfdpFunnel, SdCardMountedIF& sdcMan, CfdpTmFunnel** cfdpFunnel, SdCardMountedIF& sdcMan,
StorageManagerIF** ipcStore, StorageManagerIF** tmStore, StorageManagerIF** ipcStore, StorageManagerIF** tmStore,
PersistentTmStores& stores) { PersistentTmStores& stores,
uint32_t eventManagerQueueDepth) {
// Framework objects // Framework objects
new EventManager(objects::EVENT_MANAGER, 160); new EventManager(objects::EVENT_MANAGER, eventManagerQueueDepth);
auto healthTable = new HealthTable(objects::HEALTH_TABLE); auto healthTable = new HealthTable(objects::HEALTH_TABLE);
if (healthTable_ != nullptr) { if (healthTable_ != nullptr) {
*healthTable_ = healthTable; *healthTable_ = healthTable;

View File

@ -45,7 +45,7 @@ namespace ObjectFactory {
void produceGenericObjects(HealthTableIF** healthTable, PusTmFunnel** pusFunnel, void produceGenericObjects(HealthTableIF** healthTable, PusTmFunnel** pusFunnel,
CfdpTmFunnel** cfdpFunnel, SdCardMountedIF& sdcMan, CfdpTmFunnel** cfdpFunnel, SdCardMountedIF& sdcMan,
StorageManagerIF** ipcStore, StorageManagerIF** tmStore, StorageManagerIF** ipcStore, StorageManagerIF** tmStore,
PersistentTmStores& stores); PersistentTmStores& stores, uint32_t eventManagerQueueDepth);
void createGenericHeaterComponents(GpioIF& gpioIF, PowerSwitchIF& pwrSwitcher, void createGenericHeaterComponents(GpioIF& gpioIF, PowerSwitchIF& pwrSwitcher,
HeaterHandler*& heaterHandler); HeaterHandler*& heaterHandler);

View File

@ -5,9 +5,11 @@
#include "fsfw/tasks/PeriodicTaskIF.h" #include "fsfw/tasks/PeriodicTaskIF.h"
void scheduling::scheduleTmpTempSensors(PeriodicTaskIF* tmpTask) { void scheduling::scheduleTmpTempSensors(PeriodicTaskIF* tmpTask) {
const std::array<object_id_t, 5> tmpIds = { const std::array<object_id_t, 4> tmpIds = {objects::TMP1075_HANDLER_TCS_0,
objects::TMP1075_HANDLER_TCS_0, objects::TMP1075_HANDLER_TCS_1, objects::TMP1075_HANDLER_TCS_1,
objects::TMP1075_HANDLER_PLPCDU_0, objects::TMP1075_HANDLER_PLPCDU_1, objects::TMP1075_HANDLER_PLPCDU_0,
// damaged.
// objects::TMP1075_HANDLER_PLPCDU_1,
objects::TMP1075_HANDLER_IF_BOARD}; objects::TMP1075_HANDLER_IF_BOARD};
for (const auto& tmpId : tmpIds) { for (const auto& tmpId : tmpIds) {
tmpTask->addComponent(tmpId, DeviceHandlerIF::PERFORM_OPERATION); tmpTask->addComponent(tmpId, DeviceHandlerIF::PERFORM_OPERATION);

View File

@ -1,16 +1,28 @@
#ifndef MISSION_SYSDEFS_H_ #ifndef MISSION_SYSDEFS_H_
#define MISSION_SYSDEFS_H_ #define MISSION_SYSDEFS_H_
#include <atomic> #include <fsfw/action/ActionMessage.h>
#include <fsfw/action/HasActionsIF.h>
#include <fsfw/modes/ModeMessage.h>
#include <fsfw/serialize/SerializeIF.h>
#include "acs/defs.h" #include <atomic>
#include <cstring>
extern std::atomic_uint16_t I2C_FATAL_ERRORS; extern std::atomic_uint16_t I2C_FATAL_ERRORS;
namespace satsystem { namespace satsystem {
enum Mode : Mode_t { BOOT = 5, SAFE = acs::AcsMode::SAFE, PTG_IDLE = acs::AcsMode::PTG_IDLE }; enum Mode : Mode_t {
BOOT = 5,
// DO NOT CHANGE THE ORDER starting from here, breaks ACS mode checks.
SAFE = 10,
PTG_IDLE = 11,
PTG_NADIR = 12,
PTG_TARGET = 13,
PTG_TARGET_GS = 14,
PTG_INERTIAL = 15,
};
} }
namespace xsc { namespace xsc {

View File

@ -39,18 +39,22 @@ void EiveSystem::announceMode(bool recursive) {
modeStr = "POINTING IDLE"; modeStr = "POINTING IDLE";
break; break;
} }
case (acs::AcsMode::PTG_INERTIAL): { case (satsystem::Mode::PTG_NADIR): {
modeStr = "POINTING INERTIAL"; modeStr = "POINTING NADIR";
break; break;
} }
case (acs::AcsMode::PTG_TARGET): { case (satsystem::Mode::PTG_TARGET): {
modeStr = "POINTING TARGET"; modeStr = "POINTING TARGET";
break; break;
} }
case (acs::AcsMode::PTG_TARGET_GS): { case (satsystem::Mode::PTG_TARGET_GS): {
modeStr = "POINTING TARGET GS"; modeStr = "POINTING TARGET GS";
break; break;
} }
case (satsystem::Mode::PTG_INERTIAL): {
modeStr = "POINTING INERTIAL";
break;
}
} }
sif::info << "EIVE system is now in " << modeStr << " mode" << std::endl; sif::info << "EIVE system is now in " << modeStr << " mode" << std::endl;
return Subsystem::announceMode(recursive); return Subsystem::announceMode(recursive);

View File

@ -183,11 +183,11 @@ void DualLaneAssemblyBase::handleModeTransitionFailed(ReturnValue_t result) {
// transition to dual mode. // transition to dual mode.
if (not tryingOtherSide) { if (not tryingOtherSide) {
triggerEvent(CANT_KEEP_MODE, mode, submode); triggerEvent(CANT_KEEP_MODE, mode, submode);
startTransition(mode, nextSubmode); startTransition(targetMode, nextSubmode);
tryingOtherSide = true; tryingOtherSide = true;
} else { } else {
triggerEvent(transitionOtherSideFailedEvent, mode, targetSubmode); triggerEvent(transitionOtherSideFailedEvent, targetMode, targetSubmode);
startTransition(mode, Submodes::DUAL_MODE); startTransition(targetMode, Submodes::DUAL_MODE);
} }
} }
@ -205,7 +205,8 @@ bool DualLaneAssemblyBase::checkAndHandleRecovery() {
opCode = pwrStateMachine.fsm(); opCode = pwrStateMachine.fsm();
if (opCode == OpCodes::TO_OFF_DONE or opCode == OpCodes::TIMEOUT_OCCURED) { if (opCode == OpCodes::TO_OFF_DONE or opCode == OpCodes::TIMEOUT_OCCURED) {
customRecoveryStates = RecoveryCustomStates::POWER_SWITCHING_ON; customRecoveryStates = RecoveryCustomStates::POWER_SWITCHING_ON;
pwrStateMachine.start(targetMode, targetSubmode); // Command power back on in any case.
pwrStateMachine.start(HasModesIF::MODE_ON, targetSubmode);
} }
} }
if (customRecoveryStates == POWER_SWITCHING_ON) { if (customRecoveryStates == POWER_SWITCHING_ON) {

View File

@ -22,6 +22,10 @@ const auto check = subsystem::checkInsert;
void buildBootSequence(Subsystem& ss, ModeListEntry& eh); void buildBootSequence(Subsystem& ss, ModeListEntry& eh);
void buildSafeSequence(Subsystem& ss, ModeListEntry& eh); void buildSafeSequence(Subsystem& ss, ModeListEntry& eh);
void buildIdleSequence(Subsystem& ss, ModeListEntry& eh); void buildIdleSequence(Subsystem& ss, ModeListEntry& eh);
void buildPtgNadirSequence(Subsystem& ss, ModeListEntry& eh);
void buildPtgTargetSequence(Subsystem& ss, ModeListEntry& eh);
void buildPtgTargetGsSequence(Subsystem& ss, ModeListEntry& eh);
void buildPtgInertialSequence(Subsystem& ss, ModeListEntry& eh);
} // namespace } // namespace
static const auto OFF = HasModesIF::MODE_OFF; static const auto OFF = HasModesIF::MODE_OFF;
@ -40,6 +44,10 @@ void satsystem::init() {
buildBootSequence(EIVE_SYSTEM, entry); buildBootSequence(EIVE_SYSTEM, entry);
buildSafeSequence(EIVE_SYSTEM, entry); buildSafeSequence(EIVE_SYSTEM, entry);
buildIdleSequence(EIVE_SYSTEM, entry); buildIdleSequence(EIVE_SYSTEM, entry);
buildPtgNadirSequence(EIVE_SYSTEM, entry);
buildPtgTargetSequence(EIVE_SYSTEM, entry);
buildPtgTargetGsSequence(EIVE_SYSTEM, entry);
buildPtgInertialSequence(EIVE_SYSTEM, entry);
EIVE_SYSTEM.setInitialMode(satsystem::Mode::BOOT, 0); EIVE_SYSTEM.setInitialMode(satsystem::Mode::BOOT, 0);
} }
@ -68,88 +76,44 @@ auto EIVE_TABLE_IDLE_TRANS_0 =
auto EIVE_TABLE_IDLE_TRANS_1 = auto EIVE_TABLE_IDLE_TRANS_1 =
std::make_pair((satsystem::Mode::PTG_IDLE << 24) | 3, FixedArrayList<ModeListEntry, 5>()); std::make_pair((satsystem::Mode::PTG_IDLE << 24) | 3, FixedArrayList<ModeListEntry, 5>());
auto EIVE_SEQUENCE_PTG_NADIR =
std::make_pair(satsystem::Mode::PTG_NADIR, FixedArrayList<ModeListEntry, 5>());
auto EIVE_TABLE_PTG_NADIR_TGT =
std::make_pair((satsystem::Mode::PTG_NADIR << 24) | 1, FixedArrayList<ModeListEntry, 5>());
auto EIVE_TABLE_PTG_NADIR_TRANS_0 =
std::make_pair((satsystem::Mode::PTG_NADIR << 24) | 2, FixedArrayList<ModeListEntry, 5>());
auto EIVE_TABLE_PTG_NADIR_TRANS_1 =
std::make_pair((satsystem::Mode::PTG_NADIR << 24) | 3, FixedArrayList<ModeListEntry, 5>());
auto EIVE_SEQUENCE_PTG_TARGET =
std::make_pair(satsystem::Mode::PTG_TARGET, FixedArrayList<ModeListEntry, 5>());
auto EIVE_TABLE_PTG_TARGET_TGT =
std::make_pair((satsystem::Mode::PTG_TARGET << 24) | 1, FixedArrayList<ModeListEntry, 5>());
auto EIVE_TABLE_PTG_TARGET_TRANS_0 =
std::make_pair((satsystem::Mode::PTG_TARGET << 24) | 2, FixedArrayList<ModeListEntry, 5>());
auto EIVE_TABLE_PTG_TARGET_TRANS_1 =
std::make_pair((satsystem::Mode::PTG_TARGET << 24) | 3, FixedArrayList<ModeListEntry, 5>());
auto EIVE_SEQUENCE_PTG_TARGET_GS =
std::make_pair(satsystem::Mode::PTG_TARGET_GS, FixedArrayList<ModeListEntry, 5>());
auto EIVE_TABLE_PTG_TARGET_GS_TGT =
std::make_pair((satsystem::Mode::PTG_TARGET_GS << 24) | 1, FixedArrayList<ModeListEntry, 5>());
auto EIVE_TABLE_PTG_TARGET_GS_TRANS_0 =
std::make_pair((satsystem::Mode::PTG_TARGET_GS << 24) | 2, FixedArrayList<ModeListEntry, 5>());
auto EIVE_TABLE_PTG_TARGET_GS_TRANS_1 =
std::make_pair((satsystem::Mode::PTG_TARGET_GS << 24) | 3, FixedArrayList<ModeListEntry, 5>());
auto EIVE_SEQUENCE_PTG_INERTIAL =
std::make_pair(satsystem::Mode::PTG_INERTIAL, FixedArrayList<ModeListEntry, 5>());
auto EIVE_TABLE_PTG_INERTIAL_TGT =
std::make_pair((satsystem::Mode::PTG_INERTIAL << 24) | 1, FixedArrayList<ModeListEntry, 5>());
auto EIVE_TABLE_PTG_INERTIAL_TRANS_0 =
std::make_pair((satsystem::Mode::PTG_INERTIAL << 24) | 2, FixedArrayList<ModeListEntry, 5>());
auto EIVE_TABLE_PTG_INERTIAL_TRANS_1 =
std::make_pair((satsystem::Mode::PTG_INERTIAL << 24) | 3, FixedArrayList<ModeListEntry, 5>());
namespace { namespace {
void buildSafeSequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::buildSafeSequence";
auto ctxc = context.c_str();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table,
bool allowAllSubmodes = false) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
if (allowAllSubmodes) {
eh.allowAllSubmodes();
}
check(table.insert(eh), ctxc);
};
// Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
bool checkSuccess) {
eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess);
check(sequence.insert(eh), ctxc);
};
// Do no track submode to allow transitions to DETUMBLE submode.
iht(objects::ACS_SUBSYSTEM, acs::AcsMode::SAFE, 0, EIVE_TABLE_SAFE_TGT.second, true);
iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_SAFE_TGT.second);
check(ss.addTable(TableEntry(EIVE_TABLE_SAFE_TGT.first, &EIVE_TABLE_SAFE_TGT.second)), ctxc);
// Build SAFE transition 0.
iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_SAFE_TRANS_0.second);
iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_SAFE_TRANS_0.second);
iht(objects::ACS_SUBSYSTEM, acs::AcsMode::SAFE, 0, EIVE_TABLE_SAFE_TRANS_0.second, true);
check(ss.addTable(TableEntry(EIVE_TABLE_SAFE_TRANS_0.first, &EIVE_TABLE_SAFE_TRANS_0.second)),
ctxc);
// Build Safe sequence
ihs(EIVE_SEQUENCE_SAFE.second, EIVE_TABLE_SAFE_TGT.first, 0, false);
ihs(EIVE_SEQUENCE_SAFE.second, EIVE_TABLE_SAFE_TRANS_0.first, 0, false);
check(ss.addSequence(SequenceEntry(EIVE_SEQUENCE_SAFE.first, &EIVE_SEQUENCE_SAFE.second,
EIVE_SEQUENCE_SAFE.first)),
ctxc);
}
void buildIdleSequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::buildIdleSequence";
auto ctxc = context.c_str();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
check(table.insert(eh), ctxc);
};
// Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
bool checkSuccess) {
eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess);
check(sequence.insert(eh), ctxc);
};
iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_IDLE, 0, EIVE_TABLE_IDLE_TGT.second);
check(ss.addTable(TableEntry(EIVE_TABLE_IDLE_TGT.first, &EIVE_TABLE_IDLE_TGT.second)), ctxc);
// Build IDLE transition 0
iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_IDLE_TRANS_0.second);
iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_IDLE_TRANS_0.second);
iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_IDLE, 0, EIVE_TABLE_IDLE_TRANS_0.second);
check(ss.addTable(TableEntry(EIVE_TABLE_IDLE_TRANS_0.first, &EIVE_TABLE_IDLE_TRANS_0.second)),
ctxc);
// Build IDLE sequence
ihs(EIVE_SEQUENCE_IDLE.second, EIVE_TABLE_IDLE_TGT.first, 0, false);
ihs(EIVE_SEQUENCE_IDLE.second, EIVE_TABLE_IDLE_TRANS_0.first, 0, false);
check(ss.addSequence(SequenceEntry(EIVE_SEQUENCE_IDLE.first, &EIVE_SEQUENCE_IDLE.second,
EIVE_SEQUENCE_SAFE.first)),
ctxc);
}
void buildBootSequence(Subsystem& ss, ModeListEntry& eh) { void buildBootSequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::buildBootSequence"; std::string context = "satsystem::buildBootSequence";
auto ctxc = context.c_str(); auto ctxc = context.c_str();
@ -194,4 +158,240 @@ void buildBootSequence(Subsystem& ss, ModeListEntry& eh) {
EIVE_SEQUENCE_SAFE.first)), EIVE_SEQUENCE_SAFE.first)),
ctxc); ctxc);
} }
void buildSafeSequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::buildSafeSequence";
auto ctxc = context.c_str();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table,
bool allowAllSubmodes = false) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
if (allowAllSubmodes) {
eh.allowAllSubmodes();
}
check(table.insert(eh), ctxc);
};
// Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
bool checkSuccess) {
eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess);
check(sequence.insert(eh), ctxc);
};
// Do no track submode to allow transitions to DETUMBLE submode.
iht(objects::ACS_SUBSYSTEM, acs::AcsMode::SAFE, 0, EIVE_TABLE_SAFE_TGT.second, true);
check(ss.addTable(TableEntry(EIVE_TABLE_SAFE_TGT.first, &EIVE_TABLE_SAFE_TGT.second)), ctxc);
// Build SAFE transition 0.
iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_SAFE_TRANS_0.second);
iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_SAFE_TRANS_0.second);
iht(objects::ACS_SUBSYSTEM, acs::AcsMode::SAFE, 0, EIVE_TABLE_SAFE_TRANS_0.second, true);
check(ss.addTable(TableEntry(EIVE_TABLE_SAFE_TRANS_0.first, &EIVE_TABLE_SAFE_TRANS_0.second)),
ctxc);
// Build Safe sequence
ihs(EIVE_SEQUENCE_SAFE.second, EIVE_TABLE_SAFE_TGT.first, 0, false);
ihs(EIVE_SEQUENCE_SAFE.second, EIVE_TABLE_SAFE_TRANS_0.first, 0, false);
check(ss.addSequence(SequenceEntry(EIVE_SEQUENCE_SAFE.first, &EIVE_SEQUENCE_SAFE.second,
EIVE_SEQUENCE_SAFE.first)),
ctxc);
}
void buildIdleSequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::buildIdleSequence";
auto ctxc = context.c_str();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
check(table.insert(eh), ctxc);
};
// Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
bool checkSuccess) {
eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess);
check(sequence.insert(eh), ctxc);
};
iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_IDLE, 0, EIVE_TABLE_IDLE_TGT.second);
check(ss.addTable(TableEntry(EIVE_TABLE_IDLE_TGT.first, &EIVE_TABLE_IDLE_TGT.second)), ctxc);
// Build IDLE transition 0
iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_IDLE_TRANS_0.second);
iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_IDLE, 0, EIVE_TABLE_IDLE_TRANS_0.second);
check(ss.addTable(TableEntry(EIVE_TABLE_IDLE_TRANS_0.first, &EIVE_TABLE_IDLE_TRANS_0.second)),
ctxc);
// Build IDLE sequence
ihs(EIVE_SEQUENCE_IDLE.second, EIVE_TABLE_IDLE_TGT.first, 0, false);
ihs(EIVE_SEQUENCE_IDLE.second, EIVE_TABLE_IDLE_TRANS_0.first, 0, false);
check(ss.addSequence(SequenceEntry(EIVE_SEQUENCE_IDLE.first, &EIVE_SEQUENCE_IDLE.second,
EIVE_SEQUENCE_SAFE.first)),
ctxc);
}
void buildPtgNadirSequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::buildPtgNadirSequence";
auto ctxc = context.c_str();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
check(table.insert(eh), ctxc);
};
// Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
bool checkSuccess) {
eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess);
check(sequence.insert(eh), ctxc);
};
iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_NADIR, 0, EIVE_TABLE_PTG_NADIR_TGT.second);
check(ss.addTable(TableEntry(EIVE_TABLE_PTG_NADIR_TGT.first, &EIVE_TABLE_PTG_NADIR_TGT.second)),
ctxc);
// Build PTG_NADIR transition 0
iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_PTG_NADIR_TRANS_0.second);
iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_NADIR, 0, EIVE_TABLE_PTG_NADIR_TRANS_0.second);
check(ss.addTable(
TableEntry(EIVE_TABLE_PTG_NADIR_TRANS_0.first, &EIVE_TABLE_PTG_NADIR_TRANS_0.second)),
ctxc);
// Build PTG_NADIR sequence
ihs(EIVE_SEQUENCE_PTG_NADIR.second, EIVE_TABLE_PTG_NADIR_TGT.first, 0, false);
ihs(EIVE_SEQUENCE_PTG_NADIR.second, EIVE_TABLE_PTG_NADIR_TRANS_0.first, 0, false);
check(ss.addSequence(SequenceEntry(EIVE_SEQUENCE_PTG_NADIR.first, &EIVE_SEQUENCE_PTG_NADIR.second,
EIVE_SEQUENCE_IDLE.first)),
ctxc);
}
void buildPtgTargetSequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::buildPtgTargetSequence";
auto ctxc = context.c_str();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
check(table.insert(eh), ctxc);
};
// Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
bool checkSuccess) {
eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess);
check(sequence.insert(eh), ctxc);
};
iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_TARGET, 0, EIVE_TABLE_PTG_TARGET_TGT.second);
check(ss.addTable(TableEntry(EIVE_TABLE_PTG_TARGET_TGT.first, &EIVE_TABLE_PTG_TARGET_TGT.second)),
ctxc);
// Build PTG_TARGET transition 0
iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_PTG_TARGET_TRANS_0.second);
iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_TARGET, 0, EIVE_TABLE_PTG_TARGET_TRANS_0.second);
check(ss.addTable(
TableEntry(EIVE_TABLE_PTG_TARGET_TRANS_0.first, &EIVE_TABLE_PTG_TARGET_TRANS_0.second)),
ctxc);
// Build PTG_TARGET sequence
ihs(EIVE_SEQUENCE_PTG_TARGET.second, EIVE_TABLE_PTG_TARGET_TGT.first, 0, false);
ihs(EIVE_SEQUENCE_PTG_TARGET.second, EIVE_TABLE_PTG_TARGET_TRANS_0.first, 0, false);
check(ss.addSequence(SequenceEntry(EIVE_SEQUENCE_PTG_TARGET.first,
&EIVE_SEQUENCE_PTG_TARGET.second, EIVE_SEQUENCE_IDLE.first)),
ctxc);
}
void buildPtgTargetGsSequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::buildPtgTargetGsSequence";
auto ctxc = context.c_str();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
check(table.insert(eh), ctxc);
};
// Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
bool checkSuccess) {
eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess);
check(sequence.insert(eh), ctxc);
};
iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_TARGET_GS, 0, EIVE_TABLE_PTG_TARGET_GS_TGT.second);
check(ss.addTable(
TableEntry(EIVE_TABLE_PTG_TARGET_GS_TGT.first, &EIVE_TABLE_PTG_TARGET_GS_TGT.second)),
ctxc);
// Build PTG_TARGET_GS transition 0
iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_PTG_TARGET_GS_TRANS_0.second);
iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_TARGET_GS, 0,
EIVE_TABLE_PTG_TARGET_GS_TRANS_0.second);
check(ss.addTable(TableEntry(EIVE_TABLE_PTG_TARGET_GS_TRANS_0.first,
&EIVE_TABLE_PTG_TARGET_GS_TRANS_0.second)),
ctxc);
// Build PTG_TARGET_GS sequence
ihs(EIVE_SEQUENCE_PTG_TARGET_GS.second, EIVE_TABLE_PTG_TARGET_GS_TGT.first, 0, false);
ihs(EIVE_SEQUENCE_PTG_TARGET_GS.second, EIVE_TABLE_PTG_TARGET_GS_TRANS_0.first, 0, false);
check(
ss.addSequence(SequenceEntry(EIVE_SEQUENCE_PTG_TARGET_GS.first,
&EIVE_SEQUENCE_PTG_TARGET_GS.second, EIVE_SEQUENCE_IDLE.first)),
ctxc);
}
void buildPtgInertialSequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::buildPtgInertialSequence";
auto ctxc = context.c_str();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
check(table.insert(eh), ctxc);
};
// Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
bool checkSuccess) {
eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess);
check(sequence.insert(eh), ctxc);
};
iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_INERTIAL, 0, EIVE_TABLE_PTG_INERTIAL_TGT.second);
check(ss.addTable(
TableEntry(EIVE_TABLE_PTG_INERTIAL_TGT.first, &EIVE_TABLE_PTG_INERTIAL_TGT.second)),
ctxc);
// Build PTG_INERTIAL transition 0
iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_PTG_INERTIAL_TRANS_0.second);
iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_INERTIAL, 0,
EIVE_TABLE_PTG_INERTIAL_TRANS_0.second);
check(ss.addTable(TableEntry(EIVE_TABLE_PTG_INERTIAL_TRANS_0.first,
&EIVE_TABLE_PTG_INERTIAL_TRANS_0.second)),
ctxc);
// Build PTG_INERTIAL sequence
ihs(EIVE_SEQUENCE_PTG_INERTIAL.second, EIVE_TABLE_PTG_INERTIAL_TGT.first, 0, false);
ihs(EIVE_SEQUENCE_PTG_INERTIAL.second, EIVE_TABLE_PTG_INERTIAL_TRANS_0.first, 0, false);
check(ss.addSequence(SequenceEntry(EIVE_SEQUENCE_PTG_INERTIAL.first,
&EIVE_SEQUENCE_PTG_INERTIAL.second, EIVE_SEQUENCE_IDLE.first)),
ctxc);
}
} // namespace } // namespace

View File

@ -29,7 +29,7 @@ static const uint8_t MAX_REPLY_LENGTH = GET_TEMP_REPLY_SIZE;
enum Tmp1075PoolIds : lp_id_t { TEMPERATURE_C_TMP1075 }; enum Tmp1075PoolIds : lp_id_t { TEMPERATURE_C_TMP1075 };
class Tmp1075Dataset : public StaticLocalDataSet<sizeof(float)> { class Tmp1075Dataset : public StaticLocalDataSet<2> {
public: public:
Tmp1075Dataset(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, TMP1075_DATA_SET_ID) {} Tmp1075Dataset(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, TMP1075_DATA_SET_ID) {}

2
tmtc

@ -1 +1 @@
Subproject commit 5fbd19bb6cca0790373a809d78f2307adca9d0c8 Subproject commit e0e9a310b9a49bee742b9cf0f98baccfab3b03ee