From 3a0db9c9ad401e6490e940b3ac1c205b612176fd Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 2 May 2023 15:04:14 +0200 Subject: [PATCH] add new set --- linux/payload/PlocMpsocHandler.cpp | 44 +++++++++++- linux/payload/PlocMpsocHandler.h | 40 ++++++++++- linux/payload/plocMpscoDefs.h | 103 +++++++++++++++++++++++++++++ mission/tcs/Tmp1075Definitions.h | 2 +- 4 files changed, 186 insertions(+), 3 deletions(-) diff --git a/linux/payload/PlocMpsocHandler.cpp b/linux/payload/PlocMpsocHandler.cpp index 29656c59..b0c56667 100644 --- a/linux/payload/PlocMpsocHandler.cpp +++ b/linux/payload/PlocMpsocHandler.cpp @@ -11,6 +11,7 @@ PlocMPSoCHandler::PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid CookieIF* comCookie, PlocMPSoCHelper* plocMPSoCHelper, Gpio uartIsolatorSwitch, object_id_t supervisorHandler) : DeviceHandlerBase(objectId, uartComIFid, comCookie), + hkReport(this), plocMPSoCHelper(plocMPSoCHelper), uartIsolatorSwitch(uartIsolatorSwitch), supervisorHandler(supervisorHandler), @@ -425,6 +426,41 @@ uint32_t PlocMPSoCHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) ReturnValue_t PlocMPSoCHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager) { + localDataPoolMap.emplace(mpsoc::poolid::STATUS, &peStatus); + localDataPoolMap.emplace(mpsoc::poolid::MODE, &peMode); + 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; } @@ -761,7 +797,6 @@ ReturnValue_t PlocMPSoCHandler::handleGetHkReport(const uint8_t* data) { } ReturnValue_t PlocMPSoCHandler::handleCamCmdRpt(const uint8_t* data) { - ReturnValue_t result = returnvalue::OK; ReturnValue_t result = verifyPacket(data, foundPacketLen); if (result == MPSoCReturnValuesIF::CRC_FAILURE) { sif::warning << "PlocMPSoCHandler::handleCamCmdRpt: CRC failure" << std::endl; @@ -1143,6 +1178,13 @@ void PlocMPSoCHandler::handleActionCommandFailure(ActionId_t actionId) { return; } +LocalPoolDataSetBase* PlocMPSoCHandler::getDataSetHandle(sid_t sid) { + if (sid == hkReport.getSid()) { + return &hkReport; + } + return nullptr; +} + std::string PlocMPSoCHandler::getStatusString(uint16_t status) { switch (status) { case (mpsoc::status_code::UNKNOWN_APID): { diff --git a/linux/payload/PlocMpsocHandler.h b/linux/payload/PlocMpsocHandler.h index e11f05eb..c9850e18 100644 --- a/linux/payload/PlocMpsocHandler.h +++ b/linux/payload/PlocMpsocHandler.h @@ -77,7 +77,8 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF { uint8_t expectedReplies = 1, bool useAlternateId = false, DeviceCommandId_t alternateReplyID = 0) override; size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override; - virtual ReturnValue_t doSendReadHook() override; + ReturnValue_t doSendReadHook() override; + LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override; private: 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 uint8_t STATUS_OFFSET = 10; + mpsoc::HkReport hkReport; + MessageQueueIF* eventQueue = nullptr; MessageQueueIF* commandActionHelperQueue = nullptr; @@ -114,6 +117,41 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF { SpacePacketCreator creator; ploc::SpTcParams spParams = ploc::SpTcParams(creator); + PoolEntry peStatus = PoolEntry(); + PoolEntry peMode = PoolEntry(); + PoolEntry peDownlinkPwrOn = PoolEntry(); + PoolEntry peDownlinkReplyActive = PoolEntry(); + PoolEntry peDownlinkJesdSyncStatus = PoolEntry(); + PoolEntry peDownlinkDacStatus = PoolEntry(); + PoolEntry peCameraStatus = PoolEntry(); + PoolEntry peCameraSdiStatus = PoolEntry(); + PoolEntry peCameraFpgaTemp = PoolEntry(); + PoolEntry peCameraSocTemp = PoolEntry(); + PoolEntry peSysmonTemp = PoolEntry(); + PoolEntry peSysmonVccInt = PoolEntry(); + PoolEntry peSysmonVccAux = PoolEntry(); + PoolEntry peSysmonVccBram = PoolEntry(); + PoolEntry peSysmonVccPaux = PoolEntry(); + PoolEntry peSysmonVccPint = PoolEntry(); + PoolEntry peSysmonVccPdro = PoolEntry(); + PoolEntry peSysmonMb12V = PoolEntry(); + PoolEntry peSysmonMb3V3 = PoolEntry(); + PoolEntry peSysmonMb1V8 = PoolEntry(); + PoolEntry peSysmonVcc12V = PoolEntry(); + PoolEntry peSysmonVcc5V = PoolEntry(); + PoolEntry peSysmonVcc3V3 = PoolEntry(); + PoolEntry peSysmonVcc3V3VA = PoolEntry(); + PoolEntry peSysmonVcc2V5DDR = PoolEntry(); + PoolEntry peSysmonVcc1V2DDR = PoolEntry(); + PoolEntry peSysmonVcc0V9 = PoolEntry(); + PoolEntry peSysmonVcc0V6VTT = PoolEntry(); + PoolEntry peSysmonSafeCotsCur = PoolEntry(); + PoolEntry peSysmonNvm4XoCur = PoolEntry(); + PoolEntry peSemUncorrectableErrs = PoolEntry(); + PoolEntry peSemCorrectableErrs = PoolEntry(); + PoolEntry peSemStatus = PoolEntry(); + PoolEntry peRebootMpsocRequired = PoolEntry(); + /** * 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 diff --git a/linux/payload/plocMpscoDefs.h b/linux/payload/plocMpscoDefs.h index e6acf4bf..1ef72bf5 100644 --- a/linux/payload/plocMpscoDefs.h +++ b/linux/payload/plocMpscoDefs.h @@ -1,6 +1,7 @@ #ifndef MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_ #define MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_ +#include #include #include #include @@ -12,6 +13,47 @@ 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 TC_MEM_WRITE = 1; static const DeviceCommandId_t TC_MEM_READ = 2; @@ -788,6 +830,67 @@ class TcCamcmdSend : public TcBase { 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 status = lp_var_t(sid.objectId, mpsoc::poolid::STATUS, this); + lp_var_t mode = lp_var_t(sid.objectId, mpsoc::poolid::MODE, this); + lp_var_t downlinkPwrOn = + lp_var_t(sid.objectId, mpsoc::poolid::DOWNLINK_PWR_ON, this); + lp_var_t downlinkReplyActive = + lp_var_t(sid.objectId, mpsoc::poolid::DOWNLINK_REPLY_ACTIIVE, this); + lp_var_t downlinkJesdSyncStatus = + lp_var_t(sid.objectId, mpsoc::poolid::DOWNLINK_JESD_SYNC_STATUS, this); + lp_var_t downlinkDacStatus = + lp_var_t(sid.objectId, mpsoc::poolid::DOWNLINK_DAC_STATUS, this); + lp_var_t camStatus = lp_var_t(sid.objectId, mpsoc::poolid::CAM_STATUS, this); + lp_var_t camSdiStatus = + lp_var_t(sid.objectId, mpsoc::poolid::CAM_SDI_STATUS, this); + lp_var_t camFpgaTemp = lp_var_t(sid.objectId, mpsoc::poolid::CAM_FPGA_TEMP, this); + lp_var_t camSocTemp = lp_var_t(sid.objectId, mpsoc::poolid::CAM_SOC_TEMP, this); + lp_var_t sysmonTemp = lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_TEMP, this); + lp_var_t sysmonVccInt = lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCCINT, this); + lp_var_t sysmonVccAux = lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCCAUX, this); + lp_var_t sysmonVccBram = + lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCCBRAM, this); + lp_var_t sysmonVccPaux = + lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCCPAUX, this); + lp_var_t sysmonVccPint = + lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCCPINT, this); + lp_var_t sysmonVccPdro = + lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCCPDRO, this); + lp_var_t sysmonMb12V = lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_MB12V, this); + lp_var_t sysmonMb3V3 = lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_MB3V3, this); + lp_var_t sysmonMb1V8 = lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_MB1V8, this); + lp_var_t sysmonVcc12V = lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCC12V, this); + lp_var_t sysmonVcc5V = lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCC5V, this); + lp_var_t sysmonVcc3V3 = lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCC3V3, this); + lp_var_t sysmonVcc3V3VA = + lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCC3V3VA, this); + lp_var_t sysmonVcc2V5DDR = + lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCC2V5DDR, this); + lp_var_t sysmonVcc1V2DDR = + lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCC1V2DDR, this); + lp_var_t sysmonVcc0V9 = lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCC0V9, this); + lp_var_t sysmonVcc0V6VTT = + lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCC0V6VTT, this); + lp_var_t sysmonSafeCotsCur = + lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_SAFE_COTS_CUR, this); + lp_var_t sysmonNvm4XoCur = + lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_NVM4_XO_CUR, this); + lp_var_t semUncorrectableErrs = + lp_var_t(sid.objectId, mpsoc::poolid::SEM_UNCORRECTABLE_ERRS, this); + lp_var_t semCorrectableErrs = + lp_var_t(sid.objectId, mpsoc::poolid::SEM_CORRECTABLE_ERRS, this); + lp_var_t semStatus = + lp_var_t(sid.objectId, mpsoc::poolid::SEM_CORRECTABLE_ERRS, this); + lp_var_t rebootMpsocRequired = + lp_var_t(sid.objectId, mpsoc::poolid::REBOOT_MPSOC_REQUIRED, this); +}; + } // namespace mpsoc #endif /* MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_ */ diff --git a/mission/tcs/Tmp1075Definitions.h b/mission/tcs/Tmp1075Definitions.h index 946ac82e..345146e6 100644 --- a/mission/tcs/Tmp1075Definitions.h +++ b/mission/tcs/Tmp1075Definitions.h @@ -29,7 +29,7 @@ static const uint8_t MAX_REPLY_LENGTH = GET_TEMP_REPLY_SIZE; enum Tmp1075PoolIds : lp_id_t { TEMPERATURE_C_TMP1075 }; -class Tmp1075Dataset : public StaticLocalDataSet { +class Tmp1075Dataset : public StaticLocalDataSet<2> { public: Tmp1075Dataset(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, TMP1075_DATA_SET_ID) {}