Merge branch 'develop' into scex-additions
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit

This commit is contained in:
Robin Müller 2022-09-12 16:23:08 +02:00
commit da739636f3
20 changed files with 194 additions and 66 deletions

View File

@ -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

View File

@ -454,8 +454,9 @@ if(TGT_BSP MATCHES "arm/q7s")
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_GPS} ${LIB_ARCSEC})
endif()
target_link_libraries(${UNITTEST_NAME} PRIVATE Catch2 ${LIB_EIVE_MISSION}
rapidcsv ${LIB_DUMMIES} ${LIB_GOMSPACE_CLIENTS})
target_link_libraries(
${UNITTEST_NAME} PRIVATE Catch2 ${LIB_EIVE_MISSION} rapidcsv ${LIB_DUMMIES}
${LIB_GOMSPACE_CLIENTS})
if(TGT_BSP MATCHES "arm/egse")
target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_ARCSEC})

2
fsfw

@ -1 +1 @@
Subproject commit 9a590a3fcd81ed4dd48de503522b6d71f64205d2
Subproject commit cf8fe7ea728bea077b9936bcf0db96845bc6419e

View File

@ -166,6 +166,26 @@ 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<const TableInfo*>(sendData);
int result = gs_rparam_save(cspAddress, cspCookie->getTimeout(), tableInfo->sourceTable,
tableInfo->targetTable);
if (result != 0) {
return returnvalue::FAILED;
}
} else if(req == GOMSPACE::SpecialRequestTypes::LOAD_TABLE) {
if(sendLen < 2) {
return returnvalue::FAILED;
}
const TableInfo* tableInfo = reinterpret_cast<const TableInfo*>(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

View File

@ -87,7 +87,7 @@ ReturnValue_t GPSHyperionLinuxController::initializeLocalDataPool(
localDataPoolMap.emplace(GpsHyperion::SATS_IN_USE, new PoolEntry<uint8_t>());
localDataPoolMap.emplace(GpsHyperion::SATS_IN_VIEW, new PoolEntry<uint8_t>());
localDataPoolMap.emplace(GpsHyperion::FIX_MODE, new PoolEntry<uint8_t>());
poolManager.subscribeForRegularPeriodicPacket({gpsSet.getSid(), 30.0});
poolManager.subscribeForRegularPeriodicPacket({gpsSet.getSid(), false, 30.0});
return returnvalue::OK;
}

View File

@ -1830,7 +1830,7 @@ ReturnValue_t StarTrackerHandler::handleChecksumReply() {
}
PoolReadGuard rg(&checksumSet);
checksumSet.checksum = checksumReply.getChecksum();
handleDeviceTM(&checksumSet, startracker::CHECKSUM);
handleDeviceTm(checksumSet, startracker::CHECKSUM);
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1
checksumReply.printChecksum();
#endif /* OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1 */

View File

@ -45,7 +45,7 @@ ReturnValue_t AcsController::initializeLocalDataPool(localpool::DataPool &localD
localDataPoolMap.emplace(acsctrl::PoolIds::MGM_3_RM3100_UT, &mgm3PoolVec);
localDataPoolMap.emplace(acsctrl::PoolIds::MGM_IMTQ_CAL_NT, &imtqMgmPoolVec);
localDataPoolMap.emplace(acsctrl::PoolIds::MGM_IMTQ_CAL_ACT_STATUS, &imtqCalActStatus);
poolManager.subscribeForRegularPeriodicPacket({mgmData.getSid(), 5.0});
poolManager.subscribeForRegularPeriodicPacket({mgmData.getSid(), false, 5.0});
return returnvalue::OK;
}

View File

@ -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));

View File

@ -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() {}

View File

@ -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;

View File

@ -43,7 +43,7 @@ void ACUHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pack
}
void ACUHandler::letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t *packet) {
handleDeviceTM(packet, ACU::CONFIG_TABLE_SIZE, id);
handleDeviceTm(packet, ACU::CONFIG_TABLE_SIZE, id);
}
LocalPoolDataSetBase *ACUHandler::getDataSetHandle(sid_t sid) {

View File

@ -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<CspCookie*>(comCookie);
cspCookie->setRequest(SpecialRequestTypes::DEFAULT_COM_IF, 0);
ReturnValue_t result = childCommandHook(deviceCommand, commandData, commandDataLen);
switch (deviceCommand) {
case (GOMSPACE::PING): {
@ -84,37 +86,87 @@ 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);
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);
result = generateRequestFullCfgTableCmd(devType, tableCfg.cfgTableSize,
deviceCommand, cspCookie);
if (result != returnvalue::OK) {
return result;
}
break;
}
case (GOMSPACE::LOAD_TABLE): {
if (commandDataLen != 2) {
return HasActionsIF::INVALID_PARAMETERS;
}
auto* info = reinterpret_cast<GOMSPACE::TableInfo*>(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;
}
auto* info = reinterpret_cast<GOMSPACE::TableInfo*>(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);
cspCookie->setCspPort(CspPorts::P60_PORT_RPARAM_ENUM);
cspCookie->setRequest(SpecialRequestTypes::SAVE_TABLE, 0);
rememberCommandId = deviceCommand;
break;
}
case (GOMSPACE::SAVE_TABLE_DEFAULT): {
if (commandDataLen != 1) {
return HasActionsIF::INVALID_PARAMETERS;
}
auto* info = reinterpret_cast<GOMSPACE::TableInfo*>(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);
cspCookie->setCspPort(CspPorts::P60_PORT_RPARAM_ENUM);
cspCookie->setRequest(SpecialRequestTypes::SAVE_TABLE, 0);
rememberCommandId = deviceCommand;
break;
}
default:
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
}
@ -131,6 +183,9 @@ 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);
insertInCommandMap(GOMSPACE::LOAD_TABLE);
}
ReturnValue_t GomspaceDeviceHandler::scanForReply(const uint8_t* start, size_t remainingSize,
@ -177,7 +232,7 @@ ReturnValue_t GomspaceDeviceHandler::interpretDeviceReply(DeviceCommandId_t id,
switch (id) {
case (GOMSPACE::PING): {
SerializeElement<uint32_t> replyTime = *packet;
handleDeviceTM(&replyTime, id, true);
handleDeviceTm(replyTime, true);
break;
}
case (GOMSPACE::PARAM_GET): {
@ -204,7 +259,7 @@ ReturnValue_t GomspaceDeviceHandler::interpretDeviceReply(DeviceCommandId_t id,
uint16_t address = cspGetParamReply.getAddress();
/* Pack relevant information into a tm packet */
ParamReply paramReply(action, tableId, address, payloadLength, tempPayloadBuffer);
handleDeviceTM(&paramReply, id, true);
handleDeviceTm(paramReply, id, true);
break;
}
case (GOMSPACE::PARAM_SET): {
@ -443,6 +498,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;
@ -462,19 +530,40 @@ ReturnValue_t GomspaceDeviceHandler::generateResetWatchdogCmd() {
return returnvalue::OK;
}
ReturnValue_t GomspaceDeviceHandler::generateRequestFullTableCmd(SpecialRequestTypes reqType,
uint8_t tableId,
ReturnValue_t GomspaceDeviceHandler::generateRequestFullHkTableCmd(DeviceType dev,
uint16_t tableReplySize,
DeviceCommandId_t id) {
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;
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);
}
auto* cspCookie = dynamic_cast<CspCookie*>(comCookie);
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;
}

View File

@ -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);
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

View File

@ -24,11 +24,6 @@ ReturnValue_t P60DockHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
void P60DockHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) {
parseHkTableReply(packet);
/**
* Hk table will be sent to the commander if hk table request was not triggered by the
* P60DockHandler itself.
*/
handleDeviceTM(&coreHk, id, true);
}
void P60DockHandler::parseHkTableReply(const uint8_t *packet) {
@ -273,5 +268,5 @@ void P60DockHandler::printHkTableLatchups() {
void P60DockHandler::setDebugMode(bool enable) { this->debugMode = enable; }
void P60DockHandler::letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t *packet) {
handleDeviceTM(packet, P60Dock::CONFIG_TABLE_SIZE, id);
handleDeviceTm(packet, P60Dock::CONFIG_TABLE_SIZE, id);
}

View File

@ -22,7 +22,6 @@ ReturnValue_t PDU1Handler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
void PDU1Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) {
parseHkTableReply(packet);
handleDeviceTM(&coreHk, id, true);
}
void PDU1Handler::assignChannelHookFunction(GOMSPACE::ChannelSwitchHook hook, void *args) {
@ -81,7 +80,7 @@ ReturnValue_t PDU1Handler::setParamCallback(SetParamMessageUnpacker &unpacker,
}
void PDU1Handler::letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t *packet) {
handleDeviceTM(packet, PDU::CONFIG_TABLE_SIZE, id);
handleDeviceTm(packet, PDU::CONFIG_TABLE_SIZE, id);
}
void PDU1Handler::parseHkTableReply(const uint8_t *packet) {

View File

@ -22,15 +22,10 @@ ReturnValue_t PDU2Handler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
void PDU2Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) {
parseHkTableReply(packet);
/**
* Hk table will be sent to the commander if hk table request was not triggered by the
* PDU2Handler itself.
*/
handleDeviceTM(&coreHk, id, true);
}
void PDU2Handler::letChildHandleConfigReply(DeviceCommandId_t id, const uint8_t *packet) {
handleDeviceTM(packet, PDU::CONFIG_TABLE_SIZE, id);
handleDeviceTm(packet, PDU::CONFIG_TABLE_SIZE, id);
}
void PDU2Handler::assignChannelHookFunction(GOMSPACE::ChannelSwitchHook hook, void *args) {

View File

@ -18,14 +18,23 @@
namespace GOMSPACE {
enum SpecialRequestTypes {
struct TableInfo {
uint8_t sourceTable;
uint8_t targetTable;
};
enum DeviceType { PDU, ACU, P60DOCK };
enum class SpecialRequestTypes {
DEFAULT_COM_IF,
GET_PDU_HK,
GET_PDU_CONFIG,
GET_ACU_HK,
GET_ACU_CONFIG,
GET_P60DOCK_HK,
GET_P60DOCK_CONFIG
GET_P60DOCK_CONFIG,
SAVE_TABLE,
LOAD_TABLE
};
enum CspPorts : uint8_t {
@ -53,14 +62,18 @@ 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 LOAD_TABLE = 20;
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

2
tmtc

@ -1 +1 @@
Subproject commit 05dd17386070b9f333977f1f2b9f5651f9053b65
Subproject commit 603b7e8574d74ba60692115133cde3cd8b8bd423