From 7dde1150e8bf355c82ae858eac6cba86d9f7f3a4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 31 Aug 2022 22:52:32 +0200 Subject: [PATCH 1/9] gom space commands --- fsfw | 2 +- linux/csp/CspComIF.cpp | 10 +++++ mission/core/GenericFactory.cpp | 2 +- mission/csp/CspCookie.h | 2 +- mission/devices/GomspaceDeviceHandler.cpp | 41 +++++++++++++++++++ .../devicedefinitions/GomspaceDefinitions.h | 15 +++++-- tmtc | 2 +- 7 files changed, 67 insertions(+), 7 deletions(-) diff --git a/fsfw b/fsfw index 2fa76d36..496dac89 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 2fa76d366325372e92a2188f71f143a485e652fc +Subproject commit 496dac89e4c094e03578f40d8651485f7f378cb2 diff --git a/linux/csp/CspComIF.cpp b/linux/csp/CspComIF.cpp index eb6487ed..b52bcfa2 100644 --- a/linux/csp/CspComIF.cpp +++ b/linux/csp/CspComIF.cpp @@ -166,6 +166,16 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s if (result != 0) { return returnvalue::FAILED; } + } else if(req == GOMSPACE::SpecialRequestTypes::SAVE_TABLE) { + if(sendLen < 2) { + return returnvalue::FAILED; + } + const TableInfo* tableInfo = reinterpret_cast(sendData); + int result = gs_rparam_save(cspAddress, cspCookie->getTimeout(), tableInfo->sourceTable, + tableInfo->targetTable); + if (result != 0) { + return returnvalue::FAILED; + } } } else { /* No CSP fixed port was selected. Send data to the specified port and diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp index 0a9be3f9..bbd2bb98 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -96,7 +96,7 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) { PsbParams(objects::PUS_SERVICE_5_EVENT_REPORTING, apid::EIVE_OBSW, pus::PUS_SERVICE_5), 15, 45); new Service8FunctionManagement(objects::PUS_SERVICE_8_FUNCTION_MGMT, apid::EIVE_OBSW, - pus::PUS_SERVICE_8, 3, 60); + pus::PUS_SERVICE_8, 16, 60); new Service9TimeManagement( PsbParams(objects::PUS_SERVICE_9_TIME_MGMT, apid::EIVE_OBSW, pus::PUS_SERVICE_9)); diff --git a/mission/csp/CspCookie.h b/mission/csp/CspCookie.h index 441eb413..9eb0a639 100644 --- a/mission/csp/CspCookie.h +++ b/mission/csp/CspCookie.h @@ -28,7 +28,7 @@ class CspCookie : public CookieIF { uint32_t getTimeout() const; private: - uint8_t cspPort; + uint8_t cspPort = 0; uint16_t maxReplyLength; uint8_t cspAddress; size_t replyLen = 0; diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index 5acd209e..aa4459b4 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -115,6 +115,45 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d } break; } + case (GOMSPACE::SAVE_TABLE_FILE): { + if(commandDataLen > 2) { + return HasActionsIF::INVALID_PARAMETERS; + } + auto* info = reinterpret_cast(cspPacket); + if(commandData[0] != 0 and commandData[0] != 1 and commandData[0] != 2 and commandData[0] != 4) { + return HasActionsIF::INVALID_PARAMETERS; + } + info->sourceTable = commandData[0]; + if (info->sourceTable != 4) { + if(commandDataLen == 2) { + info->targetTable = commandData[1]; + } else { + info->targetTable = info->sourceTable; + } + } else { + // Will be ignored, still set the value which is always used + info->targetTable = 4; + } + rawPacket = cspPacket; + rawPacketLen = sizeof(GOMSPACE::TableInfo); + rememberCommandId = deviceCommand; + break; + } + case (GOMSPACE::SAVE_TABLE_DEFAULT): { + if(commandDataLen != 1) { + return HasActionsIF::INVALID_PARAMETERS; + } + auto* info = reinterpret_cast(cspPacket); + if(commandData[0] != 0 and commandData[0] != 1 and commandData[0] != 2) { + return HasActionsIF::INVALID_PARAMETERS; + } + info->sourceTable = commandData[0]; + info->targetTable = info->sourceTable + 4; + rawPacket = cspPacket; + rawPacketLen = sizeof(GOMSPACE::TableInfo); + rememberCommandId = deviceCommand; + break; + } default: return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; } @@ -131,6 +170,8 @@ void GomspaceDeviceHandler::fillCommandAndReplyMap() { this->insertInCommandMap(GOMSPACE::GNDWDT_RESET); this->insertInCommandMap(GOMSPACE::PRINT_SWITCH_V_I); this->insertInCommandMap(GOMSPACE::PRINT_LATCHUPS); + insertInCommandMap(GOMSPACE::SAVE_TABLE_FILE); + insertInCommandMap(GOMSPACE::SAVE_TABLE_DEFAULT); } ReturnValue_t GomspaceDeviceHandler::scanForReply(const uint8_t* start, size_t remainingSize, diff --git a/mission/devices/devicedefinitions/GomspaceDefinitions.h b/mission/devices/devicedefinitions/GomspaceDefinitions.h index 5447bf42..52a66e84 100644 --- a/mission/devices/devicedefinitions/GomspaceDefinitions.h +++ b/mission/devices/devicedefinitions/GomspaceDefinitions.h @@ -18,6 +18,11 @@ namespace GOMSPACE { +struct TableInfo { + uint8_t sourceTable; + uint8_t targetTable; +}; + enum SpecialRequestTypes { DEFAULT_COM_IF, GET_PDU_HK, @@ -25,7 +30,8 @@ enum SpecialRequestTypes { GET_ACU_HK, GET_ACU_CONFIG, GET_P60DOCK_HK, - GET_P60DOCK_CONFIG + GET_P60DOCK_CONFIG, + SAVE_TABLE }; enum CspPorts : uint8_t { @@ -53,14 +59,17 @@ static const uint8_t P60_PORT_GNDWDT_RESET = 9; * Device commands are derived from the rparam.h of the gomspace lib.. * IDs above 50 are reserved for device specific commands. */ +static const DeviceCommandId_t PARAM_GET = 0; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t PING = 1; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t NONE = 2; // Set when no command is pending static const DeviceCommandId_t REBOOT = 4; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t GNDWDT_RESET = 9; //!< [EXPORT] : [COMMAND] -static const DeviceCommandId_t PARAM_GET = 0; //!< [EXPORT] : [COMMAND] -static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t REQUEST_HK_TABLE = 16; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t REQUEST_CONFIG_TABLE = 17; //!< [EXPORT] : [COMMAND] +static const DeviceCommandId_t SAVE_TABLE_FILE = 18; +static const DeviceCommandId_t SAVE_TABLE_DEFAULT = 19; +static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND] + // Not implemented yet // static const DeviceCommandId_t REQUEST_CALIB_TABLE = 18; //!< [EXPORT] : [COMMAND] //! [EXPORT] : [COMMAND] Print switch states, voltages and currents to the console diff --git a/tmtc b/tmtc index 05dd1738..cc31a756 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 05dd17386070b9f333977f1f2b9f5651f9053b65 +Subproject commit cc31a756856623ecc2eec80e155557ac208f10a2 From 3d71cce30b2f317c5449e359928a00f6fba298ae Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 1 Sep 2022 11:04:24 +0200 Subject: [PATCH 2/9] bugfix --- fsfw | 2 +- mission/devices/GomspaceDeviceHandler.cpp | 10 ++++++---- mission/devices/GomspaceDeviceHandler.h | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/fsfw b/fsfw index 496dac89..cf8fe7ea 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 496dac89e4c094e03578f40d8651485f7f378cb2 +Subproject commit cf8fe7ea728bea077b9936bcf0db96845bc6419e diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index aa4459b4..ec0001ac 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -44,6 +44,8 @@ ReturnValue_t GomspaceDeviceHandler::buildTransitionDeviceCommand(DeviceCommandI ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData, size_t commandDataLen) { + auto* cspCookie = dynamic_cast(comCookie); + cspCookie->setRequest(SpecialRequestTypes::DEFAULT_COM_IF, 0); ReturnValue_t result = childCommandHook(deviceCommand, commandData, commandDataLen); switch (deviceCommand) { case (GOMSPACE::PING): { @@ -93,7 +95,7 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d reqType = SpecialRequestTypes::GET_P60DOCK_HK; } result = generateRequestFullTableCmd(reqType, GOMSPACE::TableIds::HK, tableCfg.hkTableSize, - deviceCommand); + deviceCommand, cspCookie); if (result != returnvalue::OK) { return result; } @@ -109,7 +111,7 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d reqType = SpecialRequestTypes::GET_P60DOCK_CONFIG; } result = generateRequestFullTableCmd(reqType, GOMSPACE::TableIds::CONFIG, - tableCfg.cfgTableSize, deviceCommand); + tableCfg.cfgTableSize, deviceCommand, cspCookie); if (result != returnvalue::OK) { return result; } @@ -506,13 +508,13 @@ ReturnValue_t GomspaceDeviceHandler::generateResetWatchdogCmd() { ReturnValue_t GomspaceDeviceHandler::generateRequestFullTableCmd(SpecialRequestTypes reqType, uint8_t tableId, uint16_t tableReplySize, - DeviceCommandId_t id) { + DeviceCommandId_t id, + CspCookie* cspCookie) { uint16_t querySize = tableReplySize; if (reqType == SpecialRequestTypes::DEFAULT_COM_IF) { sif::warning << "Default communication for table requests not implemented anymore" << std::endl; return returnvalue::FAILED; } - auto* cspCookie = dynamic_cast(comCookie); cspCookie->setRequest(reqType, tableReplySize); cspCookie->setCspPort(CspPorts::P60_PORT_RPARAM_ENUM); rememberRequestedSize = querySize; diff --git a/mission/devices/GomspaceDeviceHandler.h b/mission/devices/GomspaceDeviceHandler.h index af847b8a..da4fc136 100644 --- a/mission/devices/GomspaceDeviceHandler.h +++ b/mission/devices/GomspaceDeviceHandler.h @@ -84,7 +84,7 @@ class GomspaceDeviceHandler : public DeviceHandlerBase { */ virtual ReturnValue_t generateRequestFullTableCmd(GOMSPACE::SpecialRequestTypes reqType, uint8_t tableId, uint16_t tableSize, - DeviceCommandId_t id); + DeviceCommandId_t id, CspCookie* cspCookie); /** * This command handles printing the HK table to the console. This is useful for debugging From 27129f3b66971aaac83dd844d9565e54a61e3986 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 1 Sep 2022 11:18:55 +0200 Subject: [PATCH 3/9] increase number of allowed consecutive commands for service 8 --- mission/core/GenericFactory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp index 0a9be3f9..bbd2bb98 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -96,7 +96,7 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) { PsbParams(objects::PUS_SERVICE_5_EVENT_REPORTING, apid::EIVE_OBSW, pus::PUS_SERVICE_5), 15, 45); new Service8FunctionManagement(objects::PUS_SERVICE_8_FUNCTION_MGMT, apid::EIVE_OBSW, - pus::PUS_SERVICE_8, 3, 60); + pus::PUS_SERVICE_8, 16, 60); new Service9TimeManagement( PsbParams(objects::PUS_SERVICE_9_TIME_MGMT, apid::EIVE_OBSW, pus::PUS_SERVICE_9)); From 4e92fd442117ab2cb039c65937ac0f02c8a8e262 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 1 Sep 2022 15:23:39 +0200 Subject: [PATCH 4/9] some simplifications --- mission/devices/GomspaceDeviceHandler.cpp | 95 ++++++++++++------- mission/devices/GomspaceDeviceHandler.h | 19 +++- .../devicedefinitions/GomspaceDefinitions.h | 4 +- tmtc | 2 +- 4 files changed, 80 insertions(+), 40 deletions(-) diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index ec0001ac..5ae676e4 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -86,48 +86,41 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d break; } case (GOMSPACE::REQUEST_HK_TABLE): { - auto reqType = SpecialRequestTypes::DEFAULT_COM_IF; - if (getObjectId() == objects::PDU1_HANDLER or getObjectId() == objects::PDU2_HANDLER) { - reqType = SpecialRequestTypes::GET_PDU_HK; - } else if (getObjectId() == objects::ACU_HANDLER) { - reqType = SpecialRequestTypes::GET_ACU_HK; - } else if (getObjectId() == objects::P60DOCK_HANDLER) { - reqType = SpecialRequestTypes::GET_P60DOCK_HK; + DeviceType devType; + if(getDevType(devType) != returnvalue::OK) { + return returnvalue::FAILED; } - result = generateRequestFullTableCmd(reqType, GOMSPACE::TableIds::HK, tableCfg.hkTableSize, - deviceCommand, cspCookie); + result = + generateRequestFullHkTableCmd(devType, tableCfg.hkTableSize, deviceCommand, cspCookie); if (result != returnvalue::OK) { return result; } break; } case (GOMSPACE::REQUEST_CONFIG_TABLE): { - auto reqType = SpecialRequestTypes::DEFAULT_COM_IF; - if (getObjectId() == objects::PDU1_HANDLER or getObjectId() == objects::PDU2_HANDLER) { - reqType = SpecialRequestTypes::GET_PDU_CONFIG; - } else if (getObjectId() == objects::ACU_HANDLER) { - reqType = SpecialRequestTypes::GET_ACU_CONFIG; - } else if (getObjectId() == objects::P60DOCK_HANDLER) { - reqType = SpecialRequestTypes::GET_P60DOCK_CONFIG; + DeviceType devType; + if(getDevType(devType) != returnvalue::OK) { + return returnvalue::FAILED; } - result = generateRequestFullTableCmd(reqType, GOMSPACE::TableIds::CONFIG, - tableCfg.cfgTableSize, deviceCommand, cspCookie); + result = generateRequestFullCfgTableCmd(devType, tableCfg.cfgTableSize, + deviceCommand, cspCookie); if (result != returnvalue::OK) { return result; } break; } case (GOMSPACE::SAVE_TABLE_FILE): { - if(commandDataLen > 2) { + if (commandDataLen > 2) { return HasActionsIF::INVALID_PARAMETERS; } auto* info = reinterpret_cast(cspPacket); - if(commandData[0] != 0 and commandData[0] != 1 and commandData[0] != 2 and commandData[0] != 4) { + if (commandData[0] != 0 and commandData[0] != 1 and commandData[0] != 2 and + commandData[0] != 4) { return HasActionsIF::INVALID_PARAMETERS; } info->sourceTable = commandData[0]; if (info->sourceTable != 4) { - if(commandDataLen == 2) { + if (commandDataLen == 2) { info->targetTable = commandData[1]; } else { info->targetTable = info->sourceTable; @@ -142,11 +135,11 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d break; } case (GOMSPACE::SAVE_TABLE_DEFAULT): { - if(commandDataLen != 1) { + if (commandDataLen != 1) { return HasActionsIF::INVALID_PARAMETERS; } auto* info = reinterpret_cast(cspPacket); - if(commandData[0] != 0 and commandData[0] != 1 and commandData[0] != 2) { + if (commandData[0] != 0 and commandData[0] != 1 and commandData[0] != 2) { return HasActionsIF::INVALID_PARAMETERS; } info->sourceTable = commandData[0]; @@ -486,6 +479,19 @@ bool GomspaceDeviceHandler::validTableId(uint8_t id) { return false; } +ReturnValue_t GomspaceDeviceHandler::getDevType(GOMSPACE::DeviceType& type) const { + if (getObjectId() == objects::PDU1_HANDLER or getObjectId() == objects::PDU2_HANDLER) { + type = DeviceType::PDU; + } else if (getObjectId() == objects::ACU_HANDLER) { + type = DeviceType::ACU; + } else if (getObjectId() == objects::P60DOCK_HANDLER) { + type = DeviceType::P60DOCK; + } else { + return returnvalue::FAILED; + } + return returnvalue::OK; +} + ReturnValue_t GomspaceDeviceHandler::generateResetWatchdogCmd() { WatchdogResetCommand watchdogResetCommand; size_t cspPacketLen = 0; @@ -505,19 +511,40 @@ ReturnValue_t GomspaceDeviceHandler::generateResetWatchdogCmd() { return returnvalue::OK; } -ReturnValue_t GomspaceDeviceHandler::generateRequestFullTableCmd(SpecialRequestTypes reqType, - uint8_t tableId, - uint16_t tableReplySize, - DeviceCommandId_t id, - CspCookie* cspCookie) { - uint16_t querySize = tableReplySize; - if (reqType == SpecialRequestTypes::DEFAULT_COM_IF) { - sif::warning << "Default communication for table requests not implemented anymore" << std::endl; - return returnvalue::FAILED; +ReturnValue_t GomspaceDeviceHandler::generateRequestFullHkTableCmd(DeviceType dev, + uint16_t tableReplySize, + DeviceCommandId_t id, + CspCookie* cspCookie) { + if (dev == DeviceType::ACU) { + cspCookie->setRequest(SpecialRequestTypes::GET_ACU_HK, tableReplySize); + } else if (dev == DeviceType::P60DOCK) { + cspCookie->setRequest(SpecialRequestTypes::GET_P60DOCK_HK, tableReplySize); + } else if (dev == DeviceType::PDU) { + cspCookie->setRequest(SpecialRequestTypes::GET_PDU_HK, tableReplySize); } - cspCookie->setRequest(reqType, tableReplySize); cspCookie->setCspPort(CspPorts::P60_PORT_RPARAM_ENUM); - rememberRequestedSize = querySize; + rememberRequestedSize = tableReplySize; + rememberCommandId = id; + return returnvalue::OK; +} + +ReturnValue_t GomspaceDeviceHandler::generateRequestFullCfgTableCmd(DeviceType dev, + uint16_t tableReplySize, + DeviceCommandId_t id, + CspCookie* cspCookie) { + if (dev == DeviceType::ACU) { + cspCookie->setRequest(SpecialRequestTypes::GET_ACU_CONFIG, tableReplySize); + } else if (dev == DeviceType::P60DOCK) { + cspCookie->setRequest(SpecialRequestTypes::GET_P60DOCK_CONFIG, tableReplySize); + } else if (dev == DeviceType::PDU) { + cspCookie->setRequest(SpecialRequestTypes::GET_PDU_CONFIG, tableReplySize); + } + cspCookie->setCspPort(CspPorts::P60_PORT_RPARAM_ENUM); + // Unfortunately, this does not work.. + // cspPacket[0] = defaultTable; + // rawPacket = cspPacket; + // rawPacketLen = 1; + rememberRequestedSize = tableReplySize; rememberCommandId = id; return returnvalue::OK; } diff --git a/mission/devices/GomspaceDeviceHandler.h b/mission/devices/GomspaceDeviceHandler.h index da4fc136..528cd2dd 100644 --- a/mission/devices/GomspaceDeviceHandler.h +++ b/mission/devices/GomspaceDeviceHandler.h @@ -82,10 +82,21 @@ class GomspaceDeviceHandler : public DeviceHandlerBase { * @brief The command to generate a request to receive the full housekeeping table is device * specific. Thus the child has to build this command. */ - virtual ReturnValue_t generateRequestFullTableCmd(GOMSPACE::SpecialRequestTypes reqType, - uint8_t tableId, uint16_t tableSize, - DeviceCommandId_t id, CspCookie* cspCookie); - + ReturnValue_t generateRequestFullHkTableCmd(GOMSPACE::DeviceType devType, uint16_t tableSize, + DeviceCommandId_t id, CspCookie *cspCookie); + /** + * Unfortunately, it was not possible to specify the table ID (e.g. request table from + * default store) + * @param devType + * @param tableSize + * @param id + * @param cspCookie + * @return + */ + ReturnValue_t generateRequestFullCfgTableCmd(GOMSPACE::DeviceType devType, + uint16_t tableSize, DeviceCommandId_t id, + CspCookie *cspCookie); + ReturnValue_t getDevType(GOMSPACE::DeviceType& type) const; /** * This command handles printing the HK table to the console. This is useful for debugging * purposes diff --git a/mission/devices/devicedefinitions/GomspaceDefinitions.h b/mission/devices/devicedefinitions/GomspaceDefinitions.h index 52a66e84..4a356aa9 100644 --- a/mission/devices/devicedefinitions/GomspaceDefinitions.h +++ b/mission/devices/devicedefinitions/GomspaceDefinitions.h @@ -23,6 +23,8 @@ struct TableInfo { uint8_t targetTable; }; +enum DeviceType { PDU, ACU, P60DOCK }; + enum SpecialRequestTypes { DEFAULT_COM_IF, GET_PDU_HK, @@ -68,7 +70,7 @@ static const DeviceCommandId_t REQUEST_HK_TABLE = 16; //!< [EXPORT] : [COMM static const DeviceCommandId_t REQUEST_CONFIG_TABLE = 17; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t SAVE_TABLE_FILE = 18; static const DeviceCommandId_t SAVE_TABLE_DEFAULT = 19; -static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND] +static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND] // Not implemented yet // static const DeviceCommandId_t REQUEST_CALIB_TABLE = 18; //!< [EXPORT] : [COMMAND] diff --git a/tmtc b/tmtc index cc31a756..abecbe44 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit cc31a756856623ecc2eec80e155557ac208f10a2 +Subproject commit abecbe44016313f1b51a29d1358fccb9f541d542 From 87f430fdee6e95ad9d2ed8e8eb9a14bcc710f629 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 1 Sep 2022 16:58:51 +0200 Subject: [PATCH 5/9] some bugfixes for save table feature --- mission/devices/GomspaceDeviceHandler.cpp | 4 ++++ tmtc | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index 5ae676e4..197195e6 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -131,6 +131,8 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d } rawPacket = cspPacket; rawPacketLen = sizeof(GOMSPACE::TableInfo); + cspCookie->setCspPort(CspPorts::P60_PORT_RPARAM_ENUM); + cspCookie->setRequest(SpecialRequestTypes::SAVE_TABLE, 0); rememberCommandId = deviceCommand; break; } @@ -146,6 +148,8 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d info->targetTable = info->sourceTable + 4; rawPacket = cspPacket; rawPacketLen = sizeof(GOMSPACE::TableInfo); + cspCookie->setCspPort(CspPorts::P60_PORT_RPARAM_ENUM); + cspCookie->setRequest(SpecialRequestTypes::SAVE_TABLE, 0); rememberCommandId = deviceCommand; break; } diff --git a/tmtc b/tmtc index abecbe44..e162e5c5 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit abecbe44016313f1b51a29d1358fccb9f541d542 +Subproject commit e162e5c51b0bf08b2018e4169a07eed1e4f7eacb From 6ae0249fdc2367577e00afecb4e660f2e0474987 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 1 Sep 2022 17:31:43 +0200 Subject: [PATCH 6/9] load table command --- linux/csp/CspComIF.cpp | 10 ++++++++++ mission/csp/CspCookie.cpp | 3 ++- mission/devices/GomspaceDeviceHandler.cpp | 15 +++++++++++++++ .../devicedefinitions/GomspaceDefinitions.h | 6 ++++-- tmtc | 2 +- 5 files changed, 32 insertions(+), 4 deletions(-) diff --git a/linux/csp/CspComIF.cpp b/linux/csp/CspComIF.cpp index b52bcfa2..5d8c3fd6 100644 --- a/linux/csp/CspComIF.cpp +++ b/linux/csp/CspComIF.cpp @@ -176,6 +176,16 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s if (result != 0) { return returnvalue::FAILED; } + } else if(req == GOMSPACE::SpecialRequestTypes::LOAD_TABLE) { + if(sendLen < 2) { + return returnvalue::FAILED; + } + const TableInfo* tableInfo = reinterpret_cast(sendData); + int result = gs_rparam_load(cspAddress, cspCookie->getTimeout(), tableInfo->sourceTable, + tableInfo->targetTable); + if (result != 0) { + return returnvalue::FAILED; + } } } else { /* No CSP fixed port was selected. Send data to the specified port and diff --git a/mission/csp/CspCookie.cpp b/mission/csp/CspCookie.cpp index f6ab1eed..228a8058 100644 --- a/mission/csp/CspCookie.cpp +++ b/mission/csp/CspCookie.cpp @@ -1,10 +1,11 @@ #include "CspCookie.h" +using namespace GOMSPACE; CspCookie::CspCookie(uint16_t maxReplyLength_, uint8_t cspAddress_, uint32_t timeoutMs) : maxReplyLength(maxReplyLength_), cspAddress(cspAddress_), timeoutMs(timeoutMs), - reqType(GOMSPACE::DEFAULT_COM_IF) {} + reqType(SpecialRequestTypes::DEFAULT_COM_IF) {} CspCookie::~CspCookie() {} diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index 197195e6..ebfcf2a9 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -109,6 +109,20 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d } break; } + case (GOMSPACE::LOAD_TABLE): { + if (commandDataLen != 2) { + return HasActionsIF::INVALID_PARAMETERS; + } + auto* info = reinterpret_cast(cspPacket); + info->sourceTable = commandData[0]; + info->targetTable = commandData[1]; + rawPacket = cspPacket; + rawPacketLen = sizeof(GOMSPACE::TableInfo); + cspCookie->setCspPort(CspPorts::P60_PORT_RPARAM_ENUM); + cspCookie->setRequest(SpecialRequestTypes::LOAD_TABLE, 0); + rememberCommandId = deviceCommand; + break; + } case (GOMSPACE::SAVE_TABLE_FILE): { if (commandDataLen > 2) { return HasActionsIF::INVALID_PARAMETERS; @@ -171,6 +185,7 @@ void GomspaceDeviceHandler::fillCommandAndReplyMap() { this->insertInCommandMap(GOMSPACE::PRINT_LATCHUPS); insertInCommandMap(GOMSPACE::SAVE_TABLE_FILE); insertInCommandMap(GOMSPACE::SAVE_TABLE_DEFAULT); + insertInCommandMap(GOMSPACE::LOAD_TABLE); } ReturnValue_t GomspaceDeviceHandler::scanForReply(const uint8_t* start, size_t remainingSize, diff --git a/mission/devices/devicedefinitions/GomspaceDefinitions.h b/mission/devices/devicedefinitions/GomspaceDefinitions.h index 4a356aa9..cab71362 100644 --- a/mission/devices/devicedefinitions/GomspaceDefinitions.h +++ b/mission/devices/devicedefinitions/GomspaceDefinitions.h @@ -25,7 +25,7 @@ struct TableInfo { enum DeviceType { PDU, ACU, P60DOCK }; -enum SpecialRequestTypes { +enum class SpecialRequestTypes { DEFAULT_COM_IF, GET_PDU_HK, GET_PDU_CONFIG, @@ -33,7 +33,8 @@ enum SpecialRequestTypes { GET_ACU_CONFIG, GET_P60DOCK_HK, GET_P60DOCK_CONFIG, - SAVE_TABLE + SAVE_TABLE, + LOAD_TABLE }; enum CspPorts : uint8_t { @@ -70,6 +71,7 @@ static const DeviceCommandId_t REQUEST_HK_TABLE = 16; //!< [EXPORT] : [COMM static const DeviceCommandId_t REQUEST_CONFIG_TABLE = 17; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t SAVE_TABLE_FILE = 18; static const DeviceCommandId_t SAVE_TABLE_DEFAULT = 19; +static const DeviceCommandId_t LOAD_TABLE = 20; static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND] // Not implemented yet diff --git a/tmtc b/tmtc index e162e5c5..6085c654 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit e162e5c51b0bf08b2018e4169a07eed1e4f7eacb +Subproject commit 6085c6543c0beb24cc427fae16d1fa2897a2fe5a From 923adbdb1a98ea46fbdd6cb643d61f42dffe1b23 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 1 Sep 2022 17:40:21 +0200 Subject: [PATCH 7/9] bump tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 6085c654..f366b1c3 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 6085c6543c0beb24cc427fae16d1fa2897a2fe5a +Subproject commit f366b1c3f61f9d19bc0a5829caecdd2ae4285601 From a76816f05536ceb66007ac09eabc6ce787942bf9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 2 Sep 2022 13:16:56 +0200 Subject: [PATCH 8/9] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce393fea..30890da2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ list yields a list of all related PRs for each release. GomSpace TM tables - Add API to retrieve GomSpace device parameter tables PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/287 +- Add API to save and load GomSpace config tables + PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/293 +- Increase number of allowed consescutive action commands from 3 to 16 + PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/294 # [v1.13.0] 24.08.2022 From e381b00a131d1adb2307371138c43a59b3f6d77b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 2 Sep 2022 13:19:55 +0200 Subject: [PATCH 9/9] re-point tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index f366b1c3..603b7e85 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit f366b1c3f61f9d19bc0a5829caecdd2ae4285601 +Subproject commit 603b7e8574d74ba60692115133cde3cd8b8bd423