class to generate pdec config words
This commit is contained in:
@ -9,10 +9,11 @@
|
||||
#include "fsfw/tmtcservices/TmTcMessage.h"
|
||||
#include "fsfw/objectmanager/ObjectManager.h"
|
||||
|
||||
PdecHandler::PdecHandler(object_id_t objectId, object_id_t tcDestinationId, LinuxLibgpioIF* gpioComIF,
|
||||
gpioId_t pdecReset) :
|
||||
PdecHandler::PdecHandler(object_id_t objectId, object_id_t tcDestinationId,
|
||||
LinuxLibgpioIF* gpioComIF, gpioId_t pdecReset, std::string uioMemory,
|
||||
std::string uioRegisters) :
|
||||
SystemObject(objectId), tcDestinationId(tcDestinationId), gpioComIF(gpioComIF), pdecReset(
|
||||
pdecReset) {
|
||||
pdecReset), uioMemory(uioMemory), uioRegisters(uioRegisters) {
|
||||
|
||||
}
|
||||
|
||||
@ -58,7 +59,7 @@ ReturnValue_t PdecHandler::initialize() {
|
||||
}
|
||||
|
||||
ReturnValue_t PdecHandler::getRegisterAddress() {
|
||||
int fd = open(PdecConfig::UIO_PDEC_REGISTERS, O_RDWR);
|
||||
int fd = open(uioRegisters.c_str(), O_RDWR);
|
||||
if (fd < 1) {
|
||||
sif::warning << "PdecHandler::getRegisterAddress: Invalid UIO device file" << std::endl;
|
||||
return RETURN_FAILED;
|
||||
@ -76,7 +77,7 @@ ReturnValue_t PdecHandler::getRegisterAddress() {
|
||||
}
|
||||
|
||||
ReturnValue_t PdecHandler::getMemoryBaseAddress() {
|
||||
int fd = open(PdecConfig::UIO_PDEC_MEMORY, O_RDWR);
|
||||
int fd = open(uioMemory.c_str(), O_RDWR);
|
||||
if (fd < 1) {
|
||||
sif::warning << "PdecHandler::getMemoryBaseAddress: Invalid UIO device file" << std::endl;
|
||||
return RETURN_FAILED;
|
||||
@ -94,17 +95,11 @@ ReturnValue_t PdecHandler::getMemoryBaseAddress() {
|
||||
}
|
||||
|
||||
void PdecHandler::writePdecConfig() {
|
||||
PdecParams_t pdecParams;
|
||||
pdecParams.versionId = 0;
|
||||
pdecParams.bypassFlag = PdecConfig::BYPASS_FLAG;
|
||||
pdecParams.controlCommandFlag = PdecConfig::CONTROL_COMMAND_FLAG;
|
||||
pdecParams.reservedFieldA = 0;
|
||||
pdecParams.spacecraftId = PdecConfig::SPACECRAFT_ID;
|
||||
pdecParams.virtualChannelId = PdecConfig::VIRTUAL_CHANNEL;
|
||||
pdecParams.dummy = 0;
|
||||
pdecParams.positiveWindow = PdecConfig::POSITIVE_WINDOW;
|
||||
pdecParams.negativeWindow = PdecConfig::NEGATIVE_WINDOW;
|
||||
std::memcpy(memoryBaseAddress, &pdecParams, sizeof(pdecParams));
|
||||
|
||||
PdecConfig pdecConfig;
|
||||
|
||||
*memoryBaseAddress = pdecConfig.getConfigWord(0);
|
||||
*(memoryBaseAddress + 1) = pdecConfig.getConfigWord(1);
|
||||
|
||||
// uint8_t routeToPm = calcMapAddrEntry(PM_BUFFER);
|
||||
// Configure all MAP IDs as invalid
|
||||
|
Reference in New Issue
Block a user