Update Power Modules #287
@ -58,8 +58,8 @@
|
|||||||
|
|
||||||
#define OBSW_STAR_TRACKER_GROUND_CONFIG 1
|
#define OBSW_STAR_TRACKER_GROUND_CONFIG 1
|
||||||
#define OBSW_SYRLINKS_SIMULATED 1
|
#define OBSW_SYRLINKS_SIMULATED 1
|
||||||
#define OBSW_ADD_TEST_CODE 1
|
#define OBSW_ADD_TEST_CODE 0
|
||||||
#define OBSW_ADD_TEST_TASK 1
|
#define OBSW_ADD_TEST_TASK 0
|
||||||
#define OBSW_ADD_TEST_PST 0
|
#define OBSW_ADD_TEST_PST 0
|
||||||
// If this is enabled, all other SPI code should be disabled
|
// If this is enabled, all other SPI code should be disabled
|
||||||
#define OBSW_ADD_SPI_TEST_CODE 0
|
#define OBSW_ADD_SPI_TEST_CODE 0
|
||||||
|
@ -16,7 +16,7 @@ class Q7STestTask : public TestTask {
|
|||||||
private:
|
private:
|
||||||
bool doTestSdCard = false;
|
bool doTestSdCard = false;
|
||||||
bool doTestScratchApi = false;
|
bool doTestScratchApi = false;
|
||||||
static constexpr bool DO_TEST_GOMSPACE_API = true;
|
static constexpr bool DO_TEST_GOMSPACE_API = false;
|
||||||
bool doTestGpsShm = false;
|
bool doTestGpsShm = false;
|
||||||
bool doTestGpsSocket = false;
|
bool doTestGpsSocket = false;
|
||||||
bool doTestProtHandler = false;
|
bool doTestProtHandler = false;
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "linux/boardtest/UartTestClass.h"
|
#include "linux/boardtest/UartTestClass.h"
|
||||||
#include "linux/callbacks/gpioCallbacks.h"
|
#include "linux/callbacks/gpioCallbacks.h"
|
||||||
#include "linux/csp/CspComIF.h"
|
#include "linux/csp/CspComIF.h"
|
||||||
#include "linux/csp/CspCookie.h"
|
#include "mission/csp/CspCookie.h"
|
||||||
#include "linux/devices/GPSHyperionLinuxController.h"
|
#include "linux/devices/GPSHyperionLinuxController.h"
|
||||||
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
|
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
|
||||||
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
||||||
|
@ -1 +1 @@
|
|||||||
target_sources(${OBSW_NAME} PUBLIC CspComIF.cpp CspCookie.cpp)
|
target_sources(${OBSW_NAME} PUBLIC CspComIF.cpp)
|
||||||
|
@ -5,8 +5,12 @@
|
|||||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||||
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
|
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
|
||||||
#include <p60pdu.h>
|
#include <p60pdu.h>
|
||||||
|
#include <p60acu.h>
|
||||||
|
#include <p60dock.h>
|
||||||
|
|
||||||
#include "CspCookie.h"
|
#include "mission/csp/CspCookie.h"
|
||||||
|
|
||||||
|
using namespace GOMSPACE;
|
||||||
|
|
||||||
CspComIF::CspComIF(object_id_t objectId) : SystemObject(objectId) {}
|
CspComIF::CspComIF(object_id_t objectId) : SystemObject(objectId) {}
|
||||||
|
|
||||||
@ -82,7 +86,7 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s
|
|||||||
|
|
||||||
uint8_t cspPort;
|
uint8_t cspPort;
|
||||||
uint16_t querySize = 0;
|
uint16_t querySize = 0;
|
||||||
if(cspCookie->getRequest() == CspCookie::SpecialRequestTypes::DEFAULT_COM_IF) {
|
if(cspCookie->getRequest() == GOMSPACE::SpecialRequestTypes::DEFAULT_COM_IF) {
|
||||||
/* Extract csp port and bytes to query from command buffer */
|
/* Extract csp port and bytes to query from command buffer */
|
||||||
result = getPortAndQuerySize(&sendData, &sendLen, &cspPort, &querySize);
|
result = getPortAndQuerySize(&sendData, &sendLen, &cspPort, &querySize);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
@ -94,22 +98,33 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s
|
|||||||
}
|
}
|
||||||
uint8_t cspAddress = cspCookie->getCspAddress();
|
uint8_t cspAddress = cspCookie->getCspAddress();
|
||||||
switch (cspPort) {
|
switch (cspPort) {
|
||||||
case (GOMSPACE::CspPorts::CSP_PING): {
|
case (CspPorts::CSP_PING): {
|
||||||
initiatePingRequest(cspAddress, querySize);
|
initiatePingRequest(cspAddress, querySize);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (GOMSPACE::CspPorts::CSP_REBOOT): {
|
case (CspPorts::CSP_REBOOT): {
|
||||||
csp_reboot(cspAddress);
|
csp_reboot(cspAddress);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (GOMSPACE::CspPorts::P60_PORT_GNDWDT_RESET_ENUM):
|
case (CspPorts::P60_PORT_GNDWDT_RESET_ENUM):
|
||||||
case (GOMSPACE::CspPorts::P60_PORT_RPARAM_ENUM): {
|
case (CspPorts::P60_PORT_RPARAM_ENUM): {
|
||||||
if(cspCookie->getRequest() == CspCookie::SpecialRequestTypes::GET_PDU_HK) {
|
if(cspCookie->getRequest() != SpecialRequestTypes::DEFAULT_COM_IF) {
|
||||||
param_index_t requestStruct{};
|
param_index_t requestStruct{};
|
||||||
requestStruct.physaddr = cspDeviceMap[cspAddress].data();
|
requestStruct.physaddr = cspDeviceMap[cspAddress].data();
|
||||||
|
if(cspCookie->getRequest() == GOMSPACE::SpecialRequestTypes::GET_PDU_HK) {
|
||||||
if(!p60pdu_get_hk(&requestStruct, cspAddress, cspCookie->getTimeout())) {
|
if(!p60pdu_get_hk(&requestStruct, cspAddress, cspCookie->getTimeout())) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if(cspCookie->getRequest() == GOMSPACE::SpecialRequestTypes::GET_ACU_HK) {
|
||||||
|
if(!p60acu_get_hk(&requestStruct, cspAddress, cspCookie->getTimeout())) {
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
}
|
||||||
|
} else if(cspCookie->getRequest() == GOMSPACE::SpecialRequestTypes::GET_P60DOCK_HK) {
|
||||||
|
if(!p60dock_get_hk(&requestStruct, cspAddress, cspCookie->getTimeout())) {
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* No CSP fixed port was selected. Send data to the specified port and
|
/* No CSP fixed port was selected. Send data to the specified port and
|
||||||
* wait for querySize number of bytes */
|
* wait for querySize number of bytes */
|
||||||
|
@ -5,3 +5,4 @@ add_subdirectory(utility)
|
|||||||
add_subdirectory(memory)
|
add_subdirectory(memory)
|
||||||
add_subdirectory(tmtc)
|
add_subdirectory(tmtc)
|
||||||
add_subdirectory(system)
|
add_subdirectory(system)
|
||||||
|
add_subdirectory(csp)
|
||||||
|
1
mission/csp/CMakeLists.txt
Normal file
1
mission/csp/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
target_sources(${LIB_EIVE_MISSION} PRIVATE CspCookie.cpp)
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
CspCookie::CspCookie(uint16_t maxReplyLength_, uint8_t cspAddress_, uint32_t timeoutMs)
|
CspCookie::CspCookie(uint16_t maxReplyLength_, uint8_t cspAddress_, uint32_t timeoutMs)
|
||||||
: maxReplyLength(maxReplyLength_), cspAddress(cspAddress_), timeoutMs(timeoutMs),
|
: maxReplyLength(maxReplyLength_), cspAddress(cspAddress_), timeoutMs(timeoutMs),
|
||||||
reqType(DEFAULT_COM_IF) {}
|
reqType(GOMSPACE::DEFAULT_COM_IF) {}
|
||||||
|
|
||||||
CspCookie::~CspCookie() {}
|
CspCookie::~CspCookie() {}
|
||||||
|
|
||||||
@ -12,11 +12,11 @@ uint8_t CspCookie::getCspAddress() {
|
|||||||
return cspAddress;
|
return cspAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
CspCookie::SpecialRequestTypes CspCookie::getRequest() const {
|
GOMSPACE::SpecialRequestTypes CspCookie::getRequest() const {
|
||||||
return reqType;
|
return reqType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CspCookie::setRequest(SpecialRequestTypes request, size_t replyLen_) {
|
void CspCookie::setRequest(GOMSPACE::SpecialRequestTypes request, size_t replyLen_) {
|
||||||
reqType = request;
|
reqType = request;
|
||||||
replyLen = replyLen_;
|
replyLen = replyLen_;
|
||||||
}
|
}
|
@ -2,7 +2,7 @@
|
|||||||
#define LINUX_CSP_CSPCOOKIE_H_
|
#define LINUX_CSP_CSPCOOKIE_H_
|
||||||
|
|
||||||
#include <fsfw/devicehandlers/CookieIF.h>
|
#include <fsfw/devicehandlers/CookieIF.h>
|
||||||
|
#include "mission/devices/devicedefinitions/GomspaceDefinitions.h"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
@ -13,15 +13,6 @@
|
|||||||
*/
|
*/
|
||||||
class CspCookie : public CookieIF {
|
class CspCookie : public CookieIF {
|
||||||
public:
|
public:
|
||||||
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);
|
CspCookie(uint16_t maxReplyLength_, uint8_t cspAddress_, uint32_t timeoutMs);
|
||||||
virtual ~CspCookie();
|
virtual ~CspCookie();
|
||||||
@ -29,8 +20,8 @@ class CspCookie : public CookieIF {
|
|||||||
void setCspPort(uint8_t port);
|
void setCspPort(uint8_t port);
|
||||||
uint8_t getCspPort() const;
|
uint8_t getCspPort() const;
|
||||||
uint16_t getMaxReplyLength();
|
uint16_t getMaxReplyLength();
|
||||||
SpecialRequestTypes getRequest() const;
|
GOMSPACE::SpecialRequestTypes getRequest() const;
|
||||||
void setRequest(SpecialRequestTypes request, size_t replyLen);
|
void setRequest(GOMSPACE::SpecialRequestTypes request, size_t replyLen);
|
||||||
size_t getReplyLen() const;
|
size_t getReplyLen() const;
|
||||||
uint8_t getCspAddress();
|
uint8_t getCspAddress();
|
||||||
uint32_t getTimeout() const;
|
uint32_t getTimeout() const;
|
||||||
@ -41,7 +32,7 @@ class CspCookie : public CookieIF {
|
|||||||
uint8_t cspAddress;
|
uint8_t cspAddress;
|
||||||
size_t replyLen = 0;
|
size_t replyLen = 0;
|
||||||
uint32_t timeoutMs;
|
uint32_t timeoutMs;
|
||||||
SpecialRequestTypes reqType;
|
GOMSPACE::SpecialRequestTypes reqType;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* LINUX_CSP_CSPCOOKIE_H_ */
|
#endif /* LINUX_CSP_CSPCOOKIE_H_ */
|
@ -1,11 +1,12 @@
|
|||||||
#include "ACUHandler.h"
|
#include "ACUHandler.h"
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
|
|
||||||
|
#include "p60acu_hk.h"
|
||||||
|
|
||||||
ACUHandler::ACUHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie,
|
ACUHandler::ACUHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie,
|
||||||
FailureIsolationBase *customFdir)
|
FailureIsolationBase *customFdir)
|
||||||
: GomspaceDeviceHandler(objectId, comIF, comCookie, customFdir, ACU::MAX_CONFIGTABLE_ADDRESS,
|
: GomspaceDeviceHandler(objectId, comIF, comCookie, customFdir, ACU::MAX_CONFIGTABLE_ADDRESS,
|
||||||
ACU::MAX_HKTABLE_ADDRESS, ACU::HK_TABLE_REPLY_SIZE),
|
ACU::MAX_HKTABLE_ADDRESS, P60ACU_HK_SIZE),
|
||||||
coreHk(this),
|
coreHk(this),
|
||||||
auxHk(this) {}
|
auxHk(this) {}
|
||||||
|
|
||||||
@ -13,7 +14,7 @@ ACUHandler::~ACUHandler() {}
|
|||||||
|
|
||||||
ReturnValue_t ACUHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
|
ReturnValue_t ACUHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
|
||||||
*id = GOMSPACE::REQUEST_HK_TABLE;
|
*id = GOMSPACE::REQUEST_HK_TABLE;
|
||||||
return buildCommandFromCommand(*id, NULL, 0);
|
return buildCommandFromCommand(*id, nullptr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACUHandler::fillCommandAndReplyMap() { GomspaceDeviceHandler::fillCommandAndReplyMap(); }
|
void ACUHandler::fillCommandAndReplyMap() { GomspaceDeviceHandler::fillCommandAndReplyMap(); }
|
||||||
@ -48,7 +49,6 @@ LocalPoolDataSetBase *ACUHandler::getDataSetHandle(sid_t sid) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ACUHandler::parseHkTableReply(const uint8_t *packet) {
|
ReturnValue_t ACUHandler::parseHkTableReply(const uint8_t *packet) {
|
||||||
uint16_t dataOffset = 0;
|
|
||||||
PoolReadGuard pg0(&coreHk);
|
PoolReadGuard pg0(&coreHk);
|
||||||
PoolReadGuard pg1(&auxHk);
|
PoolReadGuard pg1(&auxHk);
|
||||||
auto res0 = pg0.getReadResult();
|
auto res0 = pg0.getReadResult();
|
||||||
@ -59,80 +59,51 @@ ReturnValue_t ACUHandler::parseHkTableReply(const uint8_t *packet) {
|
|||||||
if (res1 != RETURN_OK) {
|
if (res1 != RETURN_OK) {
|
||||||
return res1;
|
return res1;
|
||||||
}
|
}
|
||||||
dataOffset += 12;
|
|
||||||
for (size_t idx = 0; idx < 6; idx++) {
|
for (size_t idx = 0; idx < 6; idx++) {
|
||||||
coreHk.currentInChannels[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1];
|
coreHk.currentInChannels[idx] = as<int16_t>(packet + (idx*2));
|
||||||
dataOffset += 4;
|
|
||||||
}
|
}
|
||||||
for (size_t idx = 0; idx < 6; idx++) {
|
for (size_t idx = 0; idx < 6; idx++) {
|
||||||
coreHk.voltageInChannels[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1];
|
coreHk.voltageInChannels[idx] = as<uint16_t>(packet + 0xc + (idx*2));
|
||||||
dataOffset += 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
coreHk.vcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
coreHk.vcc = as<uint16_t>(packet + 0x1a);
|
||||||
dataOffset += 4;
|
coreHk.vbat = as<uint16_t>(packet + 0x18);
|
||||||
coreHk.vbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
|
||||||
dataOffset += 4;
|
|
||||||
|
|
||||||
for (size_t idx = 0; idx < 3; idx++) {
|
for (size_t idx = 0; idx < 3; idx++) {
|
||||||
coreHk.temperatures[idx] =
|
coreHk.temperatures[idx] = as<int16_t>(packet + 0x1c + (idx*2)) * 0.1;
|
||||||
static_cast<int16_t>((packet[dataOffset] << 8) | packet[dataOffset + 1]) * 0.1;
|
|
||||||
dataOffset += 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
coreHk.mpptMode = packet[dataOffset];
|
coreHk.mpptMode = packet[0x22];
|
||||||
dataOffset += 3;
|
|
||||||
|
|
||||||
for (size_t idx = 0; idx < 6; idx++) {
|
for (size_t idx = 0; idx < 6; idx++) {
|
||||||
coreHk.vboostInChannels[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1];
|
coreHk.vboostInChannels[idx] = as<uint16_t>(packet + 0x24 + (idx*2));
|
||||||
dataOffset += 4;
|
|
||||||
}
|
}
|
||||||
for (size_t idx = 0; idx < 6; idx++) {
|
for (size_t idx = 0; idx < 6; idx++) {
|
||||||
coreHk.powerInChannels[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1];
|
coreHk.powerInChannels[idx] = as<uint16_t>(packet + 0x30 + (idx*2));
|
||||||
dataOffset += 4;
|
|
||||||
}
|
}
|
||||||
for (size_t idx = 0; idx < 3; idx++) {
|
for (size_t idx = 0; idx < 3; idx++) {
|
||||||
auxHk.dacEnables[idx] = packet[dataOffset];
|
auxHk.dacEnables[idx] = *(packet + 0x3c + idx);
|
||||||
dataOffset += 3;
|
|
||||||
}
|
}
|
||||||
for (size_t idx = 0; idx < 6; idx++) {
|
for (size_t idx = 0; idx < 6; idx++) {
|
||||||
auxHk.dacRawChannelVals[idx] = (packet[dataOffset] << 8) | packet[dataOffset + 1];
|
auxHk.dacRawChannelVals[idx] = as<uint16_t>(packet + 0x40 + (idx*2));
|
||||||
dataOffset += 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auxHk.bootCause = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
auxHk.bootCause = as<uint32_t>(packet + 0x50);
|
||||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
coreHk.bootcnt = as<uint32_t>(packet + 0x54);
|
||||||
dataOffset += 6;
|
coreHk.uptime = as<uint32_t>(packet + 0x58);
|
||||||
coreHk.bootcnt = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
auxHk.resetCause = as<uint16_t>(packet + 0x5c);
|
||||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
coreHk.mpptTime = as<uint16_t>(packet + 0x5e);
|
||||||
dataOffset += 6;
|
coreHk.mpptPeriod = as<uint16_t>(packet + 0x60);
|
||||||
coreHk.uptime = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
|
||||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
|
||||||
dataOffset += 6;
|
|
||||||
auxHk.resetCause = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
|
||||||
dataOffset += 4;
|
|
||||||
coreHk.mpptTime = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
|
||||||
/* +12 because here starts the second csp packet */
|
|
||||||
dataOffset += 2 + 12;
|
|
||||||
|
|
||||||
coreHk.mpptPeriod = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
|
||||||
dataOffset += 4;
|
|
||||||
|
|
||||||
for (size_t idx = 0; idx < 8; idx++) {
|
for (size_t idx = 0; idx < 8; idx++) {
|
||||||
auxHk.deviceTypes[idx] = packet[dataOffset];
|
auxHk.deviceTypes[idx] = *(packet + 0x64 + idx);
|
||||||
dataOffset += 3;
|
|
||||||
}
|
}
|
||||||
for (size_t idx = 0; idx < 8; idx++) {
|
for (size_t idx = 0; idx < 8; idx++) {
|
||||||
auxHk.devicesStatus[idx] = packet[dataOffset];
|
auxHk.devicesStatus[idx] = *(packet + 0x6c + idx);
|
||||||
dataOffset += 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auxHk.wdtCntGnd = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
auxHk.wdtCntGnd = as<uint32_t>(packet + 0x74);
|
||||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
auxHk.wdtGndLeft = as<uint32_t>(packet + 0x78);
|
||||||
dataOffset += 6;
|
|
||||||
auxHk.wdtGndLeft = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
|
||||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
|
||||||
dataOffset += 6;
|
|
||||||
coreHk.setValidity(true, true);
|
coreHk.setValidity(true, true);
|
||||||
auxHk.setValidity(true, true);
|
auxHk.setValidity(true, true);
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
#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 <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"
|
||||||
@ -82,14 +80,24 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t d
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (GOMSPACE::REQUEST_HK_TABLE): {
|
case (GOMSPACE::REQUEST_HK_TABLE): {
|
||||||
result = generateRequestFullTableCmd(GOMSPACE::TableIds::HK, hkTableReplySize);
|
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;
|
||||||
|
}
|
||||||
|
result = generateRequestFullTableCmd(reqType, GOMSPACE::TableIds::HK, hkTableReplySize);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (GOMSPACE::REQUEST_CONFIG_TABLE): {
|
case (GOMSPACE::REQUEST_CONFIG_TABLE): {
|
||||||
result = generateRequestFullTableCmd(GOMSPACE::TableIds::CONFIG, configTableReplySize);
|
|
||||||
|
result = generateRequestFullTableCmd(SpecialRequestTypes::DEFAULT_COM_IF,
|
||||||
|
GOMSPACE::TableIds::CONFIG, configTableReplySize);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -429,13 +437,14 @@ ReturnValue_t GomspaceDeviceHandler::generateResetWatchdogCmd() {
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t GomspaceDeviceHandler::generateRequestFullTableCmd(uint8_t tableId,
|
ReturnValue_t GomspaceDeviceHandler::generateRequestFullTableCmd(SpecialRequestTypes reqType,
|
||||||
|
uint8_t tableId,
|
||||||
uint16_t tableReplySize) {
|
uint16_t tableReplySize) {
|
||||||
uint16_t querySize = tableReplySize;
|
uint16_t querySize = tableReplySize;
|
||||||
if(getObjectId() == objects::PDU1_HANDLER or getObjectId() == objects::PDU2_HANDLER) {
|
if(reqType != SpecialRequestTypes::DEFAULT_COM_IF) {
|
||||||
auto* cspCookie = dynamic_cast<CspCookie*>(comCookie);
|
auto* cspCookie = dynamic_cast<CspCookie*>(comCookie);
|
||||||
cspCookie->setRequest(CspCookie::SpecialRequestTypes::GET_PDU_HK, tableReplySize);
|
cspCookie->setRequest(reqType, tableReplySize);
|
||||||
cspCookie->setCspPort(GOMSPACE::CspPorts::P60_PORT_RPARAM_ENUM);
|
cspCookie->setCspPort(CspPorts::P60_PORT_RPARAM_ENUM);
|
||||||
} else {
|
} else {
|
||||||
RequestFullTableCommand requestFullTableCommand(querySize, tableId);
|
RequestFullTableCommand requestFullTableCommand(querySize, tableId);
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef MISSION_DEVICES_GOMSPACEDEVICEHANDLER_H_
|
#ifndef MISSION_DEVICES_GOMSPACEDEVICEHANDLER_H_
|
||||||
#define MISSION_DEVICES_GOMSPACEDEVICEHANDLER_H_
|
#define MISSION_DEVICES_GOMSPACEDEVICEHANDLER_H_
|
||||||
|
|
||||||
|
#include <mission/csp/CspCookie.h>
|
||||||
#include <mission/devices/devicedefinitions/GomSpacePackets.h>
|
#include <mission/devices/devicedefinitions/GomSpacePackets.h>
|
||||||
|
|
||||||
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
|
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
|
||||||
@ -82,7 +83,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 tableSize);
|
virtual ReturnValue_t generateRequestFullTableCmd(GOMSPACE::SpecialRequestTypes reqType, 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
|
||||||
|
@ -3,12 +3,13 @@
|
|||||||
#include <fsfw/datapool/PoolReadGuard.h>
|
#include <fsfw/datapool/PoolReadGuard.h>
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
|
#include "p60dock_hk.h"
|
||||||
|
|
||||||
P60DockHandler::P60DockHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie,
|
P60DockHandler::P60DockHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie,
|
||||||
FailureIsolationBase *customFdir)
|
FailureIsolationBase *customFdir)
|
||||||
: GomspaceDeviceHandler(objectId, comIF, comCookie, customFdir,
|
: GomspaceDeviceHandler(objectId, comIF, comCookie, customFdir,
|
||||||
P60Dock::MAX_CONFIGTABLE_ADDRESS, P60Dock::MAX_HKTABLE_ADDRESS,
|
P60Dock::MAX_CONFIGTABLE_ADDRESS, P60Dock::MAX_HKTABLE_ADDRESS,
|
||||||
P60Dock::HK_TABLE_REPLY_SIZE),
|
P60DOCK_HK_SIZE),
|
||||||
coreHk(this),
|
coreHk(this),
|
||||||
auxHk(this) {}
|
auxHk(this) {}
|
||||||
|
|
||||||
@ -30,7 +31,6 @@ void P60DockHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *
|
|||||||
|
|
||||||
void P60DockHandler::parseHkTableReply(const uint8_t *packet) {
|
void P60DockHandler::parseHkTableReply(const uint8_t *packet) {
|
||||||
using namespace P60Dock;
|
using namespace P60Dock;
|
||||||
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
|
||||||
@ -43,45 +43,27 @@ void P60DockHandler::parseHkTableReply(const uint8_t *packet) {
|
|||||||
* 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;
|
|
||||||
for (uint8_t idx = 0; idx < hk::CHNLS_LEN; idx++) {
|
for (uint8_t idx = 0; idx < hk::CHNLS_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 < hk::CHNLS_LEN; idx++) {
|
for (uint8_t idx = 0; idx < hk::CHNLS_LEN; idx++) {
|
||||||
coreHk.voltages[idx] = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
coreHk.voltages[idx] = as<uint16_t>(packet + 0x1a + (idx*2));
|
||||||
dataOffset += 4;
|
|
||||||
}
|
}
|
||||||
for (uint8_t idx = 0; idx < hk::CHNLS_LEN; idx++) {
|
for (uint8_t idx = 0; idx < hk::CHNLS_LEN; idx++) {
|
||||||
coreHk.outputEnables[idx] = *(packet + dataOffset);
|
coreHk.outputEnables[idx] = *(packet + 0x34 + idx);
|
||||||
dataOffset += 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
coreHk.temperature1 =
|
coreHk.temperature1 = as<int16_t>(packet + 0x44) * 0.1;
|
||||||
static_cast<int16_t>(*(packet + dataOffset) << 8 | *(packet + dataOffset + 1)) * 0.1;
|
coreHk.temperature2 = as<int16_t>(packet + 0x44 + 2) * 0.1;
|
||||||
dataOffset += 4;
|
|
||||||
coreHk.temperature2 =
|
|
||||||
static_cast<int16_t>(*(packet + dataOffset) << 8 | *(packet + dataOffset + 1)) * 0.1;
|
|
||||||
dataOffset += 4;
|
|
||||||
|
|
||||||
auxHk.bootcause = *(packet + dataOffset) << 24 |
|
auxHk.bootcause = as<uint32_t>(packet + 0x48);
|
||||||
|
coreHk.bootCount = as<uint32_t>(packet + 0x4c);
|
||||||
*(packet + dataOffset + 1) << 16 | *(packet + dataOffset + 2) << 8 |
|
|
||||||
*(packet + dataOffset + 3);
|
|
||||||
dataOffset += 6;
|
|
||||||
coreHk.bootCount = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
|
||||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
|
||||||
if (firstHk) {
|
if (firstHk) {
|
||||||
triggerEvent(P60_BOOT_COUNT, coreHk.bootCount.value);
|
triggerEvent(P60_BOOT_COUNT, coreHk.bootCount.value);
|
||||||
}
|
}
|
||||||
dataOffset += 6;
|
auxHk.uptime = as<uint32_t>(packet + 0x50);
|
||||||
auxHk.uptime = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
auxHk.resetcause = as<uint16_t>(packet + 0x54);
|
||||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
uint8_t newBattMode = packet[0x56];
|
||||||
dataOffset += 6;
|
|
||||||
auxHk.resetcause = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
|
||||||
|
|
||||||
dataOffset += 4;
|
|
||||||
uint8_t newBattMode = packet[dataOffset];
|
|
||||||
if (firstHk) {
|
if (firstHk) {
|
||||||
triggerEvent(BATT_MODE, newBattMode);
|
triggerEvent(BATT_MODE, newBattMode);
|
||||||
} else if (newBattMode != coreHk.battMode.value) {
|
} else if (newBattMode != coreHk.battMode.value) {
|
||||||
@ -89,83 +71,46 @@ void P60DockHandler::parseHkTableReply(const uint8_t *packet) {
|
|||||||
}
|
}
|
||||||
coreHk.battMode = newBattMode;
|
coreHk.battMode = newBattMode;
|
||||||
|
|
||||||
dataOffset += 3;
|
auxHk.heaterOn = *(packet + 0x57);
|
||||||
auxHk.heaterOn = *(packet + dataOffset);
|
auxHk.converter5VStatus = *(packet + 0x58);
|
||||||
/* + 13 because here begins a new gomspace csp data field */
|
|
||||||
dataOffset += 13;
|
|
||||||
auxHk.converter5VStatus = *(packet + dataOffset);
|
|
||||||
dataOffset += 3;
|
|
||||||
|
|
||||||
for (uint8_t idx = 0; idx < hk::CHNLS_LEN; idx++) {
|
for (uint8_t idx = 0; idx < hk::CHNLS_LEN; idx++) {
|
||||||
auxHk.latchups[idx] = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
auxHk.latchups[idx] = as<uint16_t>(packet + 0x5a + (idx*2));
|
||||||
dataOffset += 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auxHk.dockVbatVoltageValue = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
auxHk.dockVbatVoltageValue = as<uint16_t>(packet + 0x74);
|
||||||
dataOffset += 4;
|
auxHk.dockVccCurrent = as<int16_t>(packet + 0x76);
|
||||||
auxHk.dockVccCurrent = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
coreHk.batteryCurrent = as<int16_t>(packet + 0x78);
|
||||||
dataOffset += 4;
|
coreHk.batteryVoltage = as<uint16_t>(packet + 0x7a);
|
||||||
coreHk.batteryCurrent = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
|
||||||
dataOffset += 4;
|
|
||||||
coreHk.batteryVoltage = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
|
||||||
dataOffset += 4;
|
|
||||||
|
|
||||||
auxHk.batteryTemperature1 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
auxHk.batteryTemperature1 = as<int16_t>(packet + 0x7c);
|
||||||
dataOffset += 4;
|
auxHk.batteryTemperature2 = as<int16_t>(packet + 0x7c + 2);
|
||||||
auxHk.batteryTemperature2 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
|
||||||
dataOffset += 4;
|
|
||||||
|
|
||||||
for (uint8_t idx = 0; idx < NUM_DEVS; idx++) {
|
for (uint8_t idx = 0; idx < NUM_DEVS; idx++) {
|
||||||
auxHk.devicesType[idx] = *(packet + dataOffset);
|
auxHk.devicesType[idx] = *(packet + 0x80 + idx);
|
||||||
dataOffset += 3;
|
|
||||||
}
|
}
|
||||||
for (uint8_t idx = 0; idx < NUM_DEVS; idx++) {
|
for (uint8_t idx = 0; idx < NUM_DEVS; idx++) {
|
||||||
auxHk.devicesStatus[idx] = *(packet + dataOffset);
|
auxHk.devicesStatus[idx] = *(packet + 0x88 + idx);
|
||||||
dataOffset += 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auxHk.dearmStatus = *(packet + dataOffset);
|
auxHk.dearmStatus = *(packet + 0x90);
|
||||||
dataOffset += 3;
|
|
||||||
|
|
||||||
auxHk.wdtCntGnd = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
auxHk.wdtCntGnd = as<uint32_t>(packet + 0x94);
|
||||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
auxHk.wdtCntI2c = as<uint32_t>(packet + 0x98);
|
||||||
dataOffset += 6;
|
auxHk.wdtCntCan = as<uint32_t>(packet + 0x9c);
|
||||||
auxHk.wdtCntI2c = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
auxHk.wdtCntCsp1 = as<uint32_t>(packet + 0xa0);
|
||||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
auxHk.wdtCntCsp2 = as<uint32_t>(packet + 0xa0 + 4);
|
||||||
dataOffset += 6;
|
auxHk.wdtGndLeft = as<uint32_t>(packet + 0xa8);
|
||||||
auxHk.wdtCntCan = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
auxHk.wdtI2cLeft = as<uint32_t>(packet + 0xac);
|
||||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
auxHk.wdtCanLeft = as<uint32_t>(packet + 0xb0);
|
||||||
dataOffset += 6;
|
|
||||||
auxHk.wdtCntCsp1 = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
|
||||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
|
||||||
dataOffset += 6;
|
|
||||||
auxHk.wdtCntCsp2 = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
|
||||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
|
||||||
dataOffset += 6;
|
|
||||||
|
|
||||||
auxHk.wdtGndLeft = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
auxHk.wdtCspLeft1 = *(packet + 0xb4);
|
||||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
auxHk.wdtCspLeft2 = *(packet + 0xb4 + 1);
|
||||||
dataOffset += 6;
|
|
||||||
auxHk.wdtI2cLeft = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
|
||||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
|
||||||
dataOffset += 6;
|
|
||||||
auxHk.wdtCanLeft = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 |
|
|
||||||
*(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
|
|
||||||
/* +16 because here begins a new gomspace csp packet */
|
|
||||||
dataOffset += 16;
|
|
||||||
|
|
||||||
auxHk.wdtCspLeft1 = *(packet + dataOffset);
|
auxHk.batteryChargeCurrent = as<int16_t>(packet + 0xb6);
|
||||||
dataOffset += 3;
|
auxHk.batteryDischargeCurrent = as<int16_t>(packet + 0xb8);
|
||||||
auxHk.wdtCspLeft2 = *(packet + dataOffset);
|
auxHk.ant6Depl = *(packet + 0xba);
|
||||||
dataOffset += 3;
|
auxHk.ar6Depl = *(packet + 0xbb);
|
||||||
|
|
||||||
auxHk.batteryChargeCurrent = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
|
||||||
dataOffset += 4;
|
|
||||||
auxHk.batteryDischargeCurrent = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
|
|
||||||
dataOffset += 4;
|
|
||||||
auxHk.ant6Depl = *(packet + dataOffset);
|
|
||||||
dataOffset += 3;
|
|
||||||
auxHk.ar6Depl = *(packet + dataOffset);
|
|
||||||
if (firstHk) {
|
if (firstHk) {
|
||||||
firstHk = false;
|
firstHk = false;
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,16 @@
|
|||||||
|
|
||||||
namespace GOMSPACE {
|
namespace GOMSPACE {
|
||||||
|
|
||||||
|
enum SpecialRequestTypes {
|
||||||
|
DEFAULT_COM_IF,
|
||||||
|
GET_PDU_HK,
|
||||||
|
GET_PDU_CONFIG,
|
||||||
|
GET_ACU_HK,
|
||||||
|
GET_ACU_CONFIG,
|
||||||
|
GET_P60DOCK_HK,
|
||||||
|
GET_P60DOCK_CONFIG
|
||||||
|
};
|
||||||
|
|
||||||
enum CspPorts: uint8_t {
|
enum CspPorts: uint8_t {
|
||||||
CSP_PING = 1,
|
CSP_PING = 1,
|
||||||
CSP_REBOOT = 4,
|
CSP_REBOOT = 4,
|
||||||
|
2
thirdparty/gomspace-sw
vendored
2
thirdparty/gomspace-sw
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 0b66e23a8900e315f01cfc52088adad10bdabf26
|
Subproject commit d24a574ffd32bd4da8aa69e768180ccae76d6c85
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
|||||||
Subproject commit d61af604fec53b6a0af8d54e7c01792fc9a68790
|
Subproject commit 079a0f94727dc3f35578dc412aa01c871ae1ac6a
|
Loading…
Reference in New Issue
Block a user