Update Power Modules #287

Merged
meierj merged 18 commits from mueller/update-p60-module-code into develop 2022-08-29 08:27:36 +02:00
13 changed files with 165 additions and 113 deletions
Showing only changes of commit efb0bce718 - Show all commits

View File

@ -466,6 +466,7 @@ endif()
if(ADD_GOMSPACE_CLIENTS) if(ADD_GOMSPACE_CLIENTS)
target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_GOMSPACE_CLIENTS}) target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_GOMSPACE_CLIENTS})
target_link_libraries(${LIB_EIVE_MISSION} PRIVATE ${LIB_GOMSPACE_CLIENTS})
endif() endif()
if(EIVE_ADD_ETL_LIB) if(EIVE_ADD_ETL_LIB)

View File

@ -3,6 +3,7 @@
#include <bsp_q7s/core/CoreController.h> #include <bsp_q7s/core/CoreController.h>
#include <bsp_q7s/memory/FileSystemHandler.h> #include <bsp_q7s/memory/FileSystemHandler.h>
#include <bsp_q7s/xadc/Xadc.h> #include <bsp_q7s/xadc/Xadc.h>
#include <fsfw/globalfunctions/arrayprinter.h>
#include <fsfw/objectmanager/ObjectManager.h> #include <fsfw/objectmanager/ObjectManager.h>
#include <gps.h> #include <gps.h>
#include <libgpsmm.h> #include <libgpsmm.h>

View File

@ -158,10 +158,10 @@ void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, Ua
} }
void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher) { void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher) {
CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_LENGTH, addresses::P60DOCK); CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_LENGTH, addresses::P60DOCK, 500);
CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, addresses::PDU1); CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, addresses::PDU1, 500);
CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, addresses::PDU2); CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, addresses::PDU2, 500);
CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_LENGTH, addresses::ACU); CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_LENGTH, addresses::ACU, 500);
auto p60Fdir = new GomspacePowerFdir(objects::P60DOCK_HANDLER); auto p60Fdir = new GomspacePowerFdir(objects::P60DOCK_HANDLER);
P60DockHandler* p60dockhandler = P60DockHandler* p60dockhandler =

View File

@ -3,6 +3,8 @@
#include <csp/drivers/can_socketcan.h> #include <csp/drivers/can_socketcan.h>
#include <fsfw/serialize/SerializeAdapter.h> #include <fsfw/serialize/SerializeAdapter.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h> #include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
#include <p60pdu.h>
#include "CspCookie.h" #include "CspCookie.h"
@ -65,44 +67,56 @@ ReturnValue_t CspComIF::initializeInterface(CookieIF* cookie) {
/* Insert device information in CSP map */ /* Insert device information in CSP map */
cspDeviceMap.emplace(cspAddress, vectorBuffer(maxReplyLength)); cspDeviceMap.emplace(cspAddress, vectorBuffer(maxReplyLength));
} }
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, size_t sendLen) { ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, size_t sendLen) {
int result; int result;
if (cookie == NULL) { if (cookie == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
CspCookie* cspCookie = dynamic_cast<CspCookie*>(cookie); CspCookie* cspCookie = dynamic_cast<CspCookie*>(cookie);
if (cspCookie == NULL) { if (cspCookie == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
/* Extract csp port and bytes to query from command buffer */
uint8_t cspPort; uint8_t cspPort;
uint16_t querySize = 0; uint16_t querySize = 0;
result = getPortAndQuerySize(&sendData, &sendLen, &cspPort, &querySize); if(cspCookie->getRequest() == CspCookie::SpecialRequestTypes::DEFAULT_COM_IF) {
if (result != HasReturnvaluesIF::RETURN_OK) { /* Extract csp port and bytes to query from command buffer */
return result; result = getPortAndQuerySize(&sendData, &sendLen, &cspPort, &querySize);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
} else {
cspPort = cspCookie->getCspPort();
querySize = cspCookie->getReplyLen();
} }
uint8_t cspAddress = cspCookie->getCspAddress(); uint8_t cspAddress = cspCookie->getCspAddress();
switch (cspPort) { switch (cspPort) {
case (Ports::CSP_PING): { case (GOMSPACE::CspPorts::CSP_PING): {
initiatePingRequest(cspAddress, querySize); initiatePingRequest(cspAddress, querySize);
break; break;
} }
case (Ports::CSP_REBOOT): { case (GOMSPACE::CspPorts::CSP_REBOOT): {
csp_reboot(cspAddress); csp_reboot(cspAddress);
break; break;
} }
case (Ports::P60_PORT_GNDWDT_RESET): case (GOMSPACE::CspPorts::P60_PORT_GNDWDT_RESET_ENUM):
case (Ports::P60_PORT_RPARAM): { case (GOMSPACE::CspPorts::P60_PORT_RPARAM_ENUM): {
/* No CSP fixed port was selected. Send data to the specified port and if(cspCookie->getRequest() == CspCookie::SpecialRequestTypes::GET_PDU_HK) {
* wait for querySize number of bytes */ param_index_t requestStruct{};
result = cspTransfer(cspAddress, cspPort, sendData, sendLen, querySize); requestStruct.physaddr = cspDeviceMap[cspAddress].data();
if (result != HasReturnvaluesIF::RETURN_OK) { if(!p60pdu_get_hk(&requestStruct, cspAddress, cspCookie->getTimeout())) {
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
}
} else {
/* No CSP fixed port was selected. Send data to the specified port and
* wait for querySize number of bytes */
result = cspTransfer(cspAddress, cspPort, sendData, sendLen, querySize);
if (result != HasReturnvaluesIF::RETURN_OK) {
return HasReturnvaluesIF::RETURN_FAILED;
}
} }
replySize = querySize; replySize = querySize;
break; break;

View File

@ -42,8 +42,6 @@ class CspComIF : public DeviceCommunicationIF, public SystemObject {
ReturnValue_t cspTransfer(uint8_t cspAddress, uint8_t cspPort, const uint8_t *cmdBuffer, ReturnValue_t cspTransfer(uint8_t cspAddress, uint8_t cspPort, const uint8_t *cmdBuffer,
int cmdLen, uint16_t querySize); int cmdLen, uint16_t querySize);
enum Ports { CSP_PING = 1, CSP_REBOOT = 4, P60_PORT_RPARAM = 7, P60_PORT_GNDWDT_RESET = 9 };
typedef uint8_t node_t; typedef uint8_t node_t;
using vectorBuffer = std::vector<uint8_t>; using vectorBuffer = std::vector<uint8_t>;
using VectorBufferMap = std::unordered_map<node_t, vectorBuffer>; using VectorBufferMap = std::unordered_map<node_t, vectorBuffer>;
@ -59,7 +57,6 @@ class CspComIF : public DeviceCommunicationIF, public SystemObject {
/* Interface struct for csp protocol stack */ /* Interface struct for csp protocol stack */
csp_iface_t csp_if; csp_iface_t csp_if;
char canInterface[5] = "can0"; char canInterface[5] = "can0";
int bitrate = 1000; int bitrate = 1000;

View File

@ -1,10 +1,38 @@
#include "CspCookie.h" #include "CspCookie.h"
CspCookie::CspCookie(uint16_t maxReplyLength_, uint8_t cspAddress_) CspCookie::CspCookie(uint16_t maxReplyLength_, uint8_t cspAddress_, uint32_t timeoutMs)
: maxReplyLength(maxReplyLength_), cspAddress(cspAddress_) {} : maxReplyLength(maxReplyLength_), cspAddress(cspAddress_), timeoutMs(timeoutMs),
reqType(DEFAULT_COM_IF) {}
CspCookie::~CspCookie() {} CspCookie::~CspCookie() {}
uint16_t CspCookie::getMaxReplyLength() { return maxReplyLength; } uint16_t CspCookie::getMaxReplyLength() { return maxReplyLength; }
uint8_t CspCookie::getCspAddress() { return cspAddress; } uint8_t CspCookie::getCspAddress() {
return cspAddress;
}
CspCookie::SpecialRequestTypes CspCookie::getRequest() const {
return reqType;
}
void CspCookie::setRequest(SpecialRequestTypes request, size_t replyLen_) {
reqType = request;
replyLen = replyLen_;
}
uint8_t CspCookie::getCspPort() const {
return cspPort;
}
uint32_t CspCookie::getTimeout() const {
return timeoutMs;
}
void CspCookie::setCspPort(uint8_t port) {
cspPort = port;
}
size_t CspCookie::getReplyLen() const {
return replyLen;
}

View File

@ -4,6 +4,7 @@
#include <fsfw/devicehandlers/CookieIF.h> #include <fsfw/devicehandlers/CookieIF.h>
#include <cstdint> #include <cstdint>
#include <cstddef>
/** /**
* @brief This is the cookie for devices supporting the CSP (CubeSat Space * @brief This is the cookie for devices supporting the CSP (CubeSat Space
@ -12,15 +13,35 @@
*/ */
class CspCookie : public CookieIF { class CspCookie : public CookieIF {
public: public:
CspCookie(uint16_t maxReplyLength_, uint8_t cspAddress_); enum SpecialRequestTypes {
DEFAULT_COM_IF,
GET_PDU_HK,
GET_PDU_CONFIG,
GET_ACU_HK,
GET_ACU_CONFIG,
GET_P60DOCK_HK,
GET_P60DOCK_CONFIG
};
CspCookie(uint16_t maxReplyLength_, uint8_t cspAddress_, uint32_t timeoutMs);
virtual ~CspCookie(); virtual ~CspCookie();
void setCspPort(uint8_t port);
uint8_t getCspPort() const;
uint16_t getMaxReplyLength(); uint16_t getMaxReplyLength();
SpecialRequestTypes getRequest() const;
void setRequest(SpecialRequestTypes request, size_t replyLen);
size_t getReplyLen() const;
uint8_t getCspAddress(); uint8_t getCspAddress();
uint32_t getTimeout() const;
private: private:
uint8_t cspPort;
uint16_t maxReplyLength; uint16_t maxReplyLength;
uint8_t cspAddress; uint8_t cspAddress;
size_t replyLen = 0;
uint32_t timeoutMs;
SpecialRequestTypes reqType;
}; };
#endif /* LINUX_CSP_CSPCOOKIE_H_ */ #endif /* LINUX_CSP_CSPCOOKIE_H_ */

View File

@ -2,9 +2,13 @@
#include <common/config/commonObjects.h> #include <common/config/commonObjects.h>
#include <fsfw/datapool/PoolReadGuard.h> #include <fsfw/datapool/PoolReadGuard.h>
#include <fsfw/globalfunctions/arrayprinter.h>
#include <linux/csp/CspComIF.h>
#include <linux/csp/CspCookie.h>
#include "devicedefinitions/GomSpacePackets.h" #include "devicedefinitions/GomSpacePackets.h"
#include "devicedefinitions/powerDefinitions.h" #include "devicedefinitions/powerDefinitions.h"
#include <cassert>
using namespace GOMSPACE; using namespace GOMSPACE;
@ -426,22 +430,29 @@ ReturnValue_t GomspaceDeviceHandler::generateResetWatchdogCmd() {
} }
ReturnValue_t GomspaceDeviceHandler::generateRequestFullTableCmd(uint8_t tableId, ReturnValue_t GomspaceDeviceHandler::generateRequestFullTableCmd(uint8_t tableId,
uint16_t hkTableReplySize) { uint16_t tableReplySize) {
uint16_t querySize = hkTableReplySize; uint16_t querySize = tableReplySize;
RequestFullTableCommand requestFullTableCommand(querySize, tableId); if(getObjectId() == objects::PDU1_HANDLER or getObjectId() == objects::PDU2_HANDLER) {
auto* cspCookie = dynamic_cast<CspCookie*>(comCookie);
cspCookie->setRequest(CspCookie::SpecialRequestTypes::GET_PDU_HK, tableReplySize);
cspCookie->setCspPort(GOMSPACE::CspPorts::P60_PORT_RPARAM_ENUM);
} else {
RequestFullTableCommand requestFullTableCommand(querySize, tableId);
size_t cspPacketLen = 0; size_t cspPacketLen = 0;
uint8_t* buffer = cspPacket; uint8_t* buffer = cspPacket;
ReturnValue_t result = requestFullTableCommand.serialize( ReturnValue_t result = requestFullTableCommand.serialize(
&buffer, &cspPacketLen, sizeof(cspPacket), SerializeIF::Endianness::BIG); &buffer, &cspPacketLen, sizeof(cspPacket), SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "GomspaceDeviceHandler::generateRequestFullTableCmd Failed to serialize " sif::error << "GomspaceDeviceHandler::generateRequestFullTableCmd Failed to serialize "
"full table request command " "full table request command "
<< std::endl; << std::endl;
return result; return result;
}
rawPacket = cspPacket;
rawPacketLen = cspPacketLen;
} }
rawPacket = cspPacket;
rawPacketLen = cspPacketLen;
rememberRequestedSize = querySize; rememberRequestedSize = querySize;
rememberCommandId = GOMSPACE::REQUEST_HK_TABLE; rememberCommandId = GOMSPACE::REQUEST_HK_TABLE;
return RETURN_OK; return RETURN_OK;
@ -458,7 +469,6 @@ ReturnValue_t GomspaceDeviceHandler::printStatus(DeviceCommandId_t cmd) {
ReturnValue_t GomspaceDeviceHandler::parsePduHkTable(PDU::PduCoreHk& coreHk, PDU::PduAuxHk& auxHk, ReturnValue_t GomspaceDeviceHandler::parsePduHkTable(PDU::PduCoreHk& coreHk, PDU::PduAuxHk& auxHk,
const uint8_t* packet) { const uint8_t* packet) {
uint16_t dataOffset = 0;
PoolReadGuard pg0(&coreHk); PoolReadGuard pg0(&coreHk);
PoolReadGuard pg1(&auxHk); PoolReadGuard pg1(&auxHk);
if (pg0.getReadResult() != HasReturnvaluesIF::RETURN_OK or if (pg0.getReadResult() != HasReturnvaluesIF::RETURN_OK or
@ -468,92 +478,51 @@ ReturnValue_t GomspaceDeviceHandler::parsePduHkTable(PDU::PduCoreHk& coreHk, PDU
} }
/* Fist 10 bytes contain the gomspace header. Each variable is preceded by the 16-bit table /* Fist 10 bytes contain the gomspace header. Each variable is preceded by the 16-bit table
* address. */ * address. */
dataOffset += 12; //dataOffset += 12;
for (uint8_t idx = 0; idx < PDU::CHANNELS_LEN; idx++) { for (uint8_t idx = 0; idx < PDU::CHANNELS_LEN; idx++) {
coreHk.currents[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1]; coreHk.currents[idx] = as<int16_t>(packet + (idx * 2));
dataOffset += 4;
} }
for (uint8_t idx = 0; idx < PDU::CHANNELS_LEN; idx++) { for (uint8_t idx = 0; idx < PDU::CHANNELS_LEN; idx++) {
coreHk.voltages[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1]; coreHk.voltages[idx] = as<uint16_t>(packet + 0x12 + (idx*2));
dataOffset += 4;
} }
auxHk.vcc.value = as<int16_t>(packet + 0x24);
auxHk.vcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1); auxHk.vbat.value = as<int16_t>(packet + 0x26);
dataOffset += 4; coreHk.temperature = as<int16_t>(packet + 0x28) * 0.1;
auxHk.vbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
coreHk.temperature =
static_cast<int16_t>(*(packet + dataOffset) << 8 | *(packet + dataOffset + 1)) * 0.1;
dataOffset += 4;
for (uint8_t idx = 0; idx < 3; idx++) { for (uint8_t idx = 0; idx < 3; idx++) {
auxHk.converterEnable[idx] = packet[dataOffset]; auxHk.converterEnable[idx] = packet[0x2a + idx];
dataOffset += 3;
} }
for (uint8_t idx = 0; idx < PDU::CHANNELS_LEN; idx++) { for (uint8_t idx = 0; idx < PDU::CHANNELS_LEN; idx++) {
coreHk.outputEnables[idx] = packet[dataOffset]; coreHk.outputEnables[idx] = packet[0x2e + idx];
dataOffset += 3;
} }
auxHk.bootcause = as<uint32_t>(packet + 0x38);
auxHk.bootcause = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 | coreHk.bootcount = as<uint32_t>(packet + 0x3c);
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3); auxHk.uptime = as<uint32_t>(packet + 0x40);
dataOffset += 6; auxHk.resetcause = as<uint16_t>(packet + 0x44);
coreHk.bootcount = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 | coreHk.battMode = *(packet + 0x46);
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
auxHk.uptime = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
auxHk.resetcause = *(packet + dataOffset + 1) << 8 | *(packet + dataOffset);
dataOffset += 4;
coreHk.battMode = *(packet + dataOffset);
/* +10 because here begins the second gomspace csp packet */
dataOffset += 3 + 10;
for (uint8_t idx = 0; idx < PDU::CHANNELS_LEN; idx++) { for (uint8_t idx = 0; idx < PDU::CHANNELS_LEN; idx++) {
auxHk.latchups[idx] = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1); auxHk.latchups[idx] = as<uint16_t>(packet + 0x48 + (idx*2));
dataOffset += 4;
} }
for (uint8_t idx = 0; idx < PDU::DEVICES_NUM; idx++) { for (uint8_t idx = 0; idx < PDU::DEVICES_NUM; idx++) {
auxHk.deviceTypes[idx] = *(packet + dataOffset); auxHk.deviceTypes[idx] = *(packet + 0x5a + idx);
dataOffset += 3;
} }
for (uint8_t idx = 0; idx < PDU::DEVICES_NUM; idx++) { for (uint8_t idx = 0; idx < PDU::DEVICES_NUM; idx++) {
auxHk.devicesStatus[idx] = *(packet + dataOffset); auxHk.devicesStatus[idx] = *(packet + 0x62 + idx);
dataOffset += 3;
} }
auxHk.gndWdtReboots = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 | auxHk.gndWdtReboots = as<uint32_t>(packet + 0x6c);
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3); auxHk.i2cWdtReboots = as<uint32_t>(packet + 0x70);
dataOffset += 6; auxHk.canWdtReboots = as<uint32_t>(packet + 0x74);
auxHk.i2cWdtReboots = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 | auxHk.csp1WdtReboots = as<uint32_t>(packet + 0x78);
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3); auxHk.csp2WdtReboots = as<uint32_t>(packet + 0x78 + 4);
dataOffset += 6; auxHk.groundWatchdogSecondsLeft = as<uint32_t>(packet + 0x80);
auxHk.canWdtReboots = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 | auxHk.i2cWatchdogSecondsLeft = as<uint32_t>(packet + 0x84);
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3); auxHk.canWatchdogSecondsLeft = as<uint32_t>(packet + 0x88);
dataOffset += 6; auxHk.csp1WatchdogPingsLeft = *(packet + 0x8c);
auxHk.csp1WdtReboots = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 | auxHk.csp2WatchdogPingsLeft = *(packet + 0x8c + 1);
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
auxHk.csp2WdtReboots = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
auxHk.groundWatchdogSecondsLeft = *(packet + dataOffset) << 24 |
*(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
auxHk.i2cWatchdogSecondsLeft = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
auxHk.canWatchdogSecondsLeft = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
auxHk.csp1WatchdogPingsLeft = *(packet + dataOffset);
dataOffset += 3;
auxHk.csp2WatchdogPingsLeft = *(packet + dataOffset);
coreHk.setChanged(true); coreHk.setChanged(true);
if (not coreHk.isValid()) { if (not coreHk.isValid()) {
coreHk.setValidity(true, true); coreHk.setValidity(true, true);

View File

@ -82,7 +82,7 @@ class GomspaceDeviceHandler : public DeviceHandlerBase {
* @brief The command to generate a request to receive the full housekeeping table is device * @brief The command to generate a request to receive the full housekeeping table is device
* specific. Thus the child has to build this command. * specific. Thus the child has to build this command.
*/ */
virtual ReturnValue_t generateRequestFullTableCmd(uint8_t tableId, uint16_t hkTableSize); virtual ReturnValue_t generateRequestFullTableCmd(uint8_t tableId, uint16_t tableSize);
/** /**
* This command handles printing the HK table to the console. This is useful for debugging * This command handles printing the HK table to the console. This is useful for debugging
@ -115,6 +115,7 @@ class GomspaceDeviceHandler : public DeviceHandlerBase {
LocalDataPoolManager &poolManager, LocalDataPoolManager &poolManager,
std::array<uint8_t, PDU::CHANNELS_LEN> initOutEnb); std::array<uint8_t, PDU::CHANNELS_LEN> initOutEnb);
template<typename T> T as(const uint8_t*);
static bool validTableId(uint8_t id); static bool validTableId(uint8_t id);
private: private:
@ -160,4 +161,9 @@ class GomspaceDeviceHandler : public DeviceHandlerBase {
ReturnValue_t generateResetWatchdogCmd(); ReturnValue_t generateResetWatchdogCmd();
}; };
template<typename T>
inline T GomspaceDeviceHandler::as(const uint8_t* ptr) {
return *(reinterpret_cast<const T*>(ptr));
}
#endif /* MISSION_DEVICES_GOMSPACEDEVICEHANDLER_H_ */ #endif /* MISSION_DEVICES_GOMSPACEDEVICEHANDLER_H_ */

View File

@ -2,13 +2,14 @@
#include <fsfw/datapool/PoolReadGuard.h> #include <fsfw/datapool/PoolReadGuard.h>
#include <mission/devices/devicedefinitions/GomSpacePackets.h> #include <mission/devices/devicedefinitions/GomSpacePackets.h>
#include <p60pdu_hk.h>
#include "devices/powerSwitcherList.h" #include "devices/powerSwitcherList.h"
PDU1Handler::PDU1Handler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie, PDU1Handler::PDU1Handler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie,
FailureIsolationBase *customFdir) FailureIsolationBase *customFdir)
: GomspaceDeviceHandler(objectId, comIF, comCookie, customFdir, PDU::MAX_CONFIGTABLE_ADDRESS, : GomspaceDeviceHandler(objectId, comIF, comCookie, customFdir, PDU::MAX_CONFIGTABLE_ADDRESS,
PDU::MAX_HKTABLE_ADDRESS, PDU::HK_TABLE_REPLY_SIZE), PDU::MAX_HKTABLE_ADDRESS, P60PDU_HK_SIZE),
coreHk(this), coreHk(this),
auxHk(this) {} auxHk(this) {}

View File

@ -2,13 +2,14 @@
#include <fsfw/datapool/PoolReadGuard.h> #include <fsfw/datapool/PoolReadGuard.h>
#include <mission/devices/devicedefinitions/GomSpacePackets.h> #include <mission/devices/devicedefinitions/GomSpacePackets.h>
#include <p60pdu_hk.h>
#include "devices/powerSwitcherList.h" #include "devices/powerSwitcherList.h"
PDU2Handler::PDU2Handler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie, PDU2Handler::PDU2Handler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie,
FailureIsolationBase *customFdir) FailureIsolationBase *customFdir)
: GomspaceDeviceHandler(objectId, comIF, comCookie, customFdir, PDU::MAX_CONFIGTABLE_ADDRESS, : GomspaceDeviceHandler(objectId, comIF, comCookie, customFdir, PDU::MAX_CONFIGTABLE_ADDRESS,
PDU::MAX_HKTABLE_ADDRESS, PDU::HK_TABLE_REPLY_SIZE), PDU::MAX_HKTABLE_ADDRESS, P60PDU_HK_SIZE),
coreHk(this), coreHk(this),
auxHk(this) {} auxHk(this) {}

View File

@ -12,6 +12,13 @@
namespace GOMSPACE { namespace GOMSPACE {
enum CspPorts: uint8_t {
CSP_PING = 1,
CSP_REBOOT = 4,
P60_PORT_RPARAM_ENUM = 7,
P60_PORT_GNDWDT_RESET_ENUM = 9
};
enum class Pdu { PDU1, PDU2 }; enum class Pdu { PDU1, PDU2 };
using ChannelSwitchHook = void (*)(Pdu pdu, uint8_t channel, bool on, void* args); using ChannelSwitchHook = void (*)(Pdu pdu, uint8_t channel, bool on, void* args);
@ -466,6 +473,12 @@ class PduAuxHk : public StaticLocalDataSet<36> {
lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU_WDT_CSP_LEFT2, this); lp_var_t<uint8_t>(sid.objectId, P60System::pool::PDU_WDT_CSP_LEFT2, this);
}; };
//class HkWrapper {
//public:
// HkWrapper(PduCoreHk& coreHk, PduAuxHk& auxHk) {
//
// }
//};
} // namespace PDU } // namespace PDU
namespace PDU1 { namespace PDU1 {

@ -1 +1 @@
Subproject commit 6b9db5e60cadcb9bbe1712f0f1b50aede2cbf7be Subproject commit 0b66e23a8900e315f01cfc52088adad10bdabf26