eive-obsw/linux/ipcore/PdecConfig.cpp

43 lines
1.2 KiB
C++
Raw Normal View History

2021-11-02 11:11:38 +01:00
#include "PdecConfig.h"
2022-01-17 15:58:27 +01:00
#include "fsfw/serviceinterface/ServiceInterface.h"
2021-11-02 11:11:38 +01:00
2022-01-17 15:58:27 +01:00
PdecConfig::PdecConfig() { initialize(); }
2021-11-02 11:11:38 +01:00
2022-01-17 15:58:27 +01:00
PdecConfig::~PdecConfig() {}
2021-11-02 11:11:38 +01:00
void PdecConfig::initialize() {
2022-01-17 15:58:27 +01:00
uint32_t word = 0;
word |= (VERSION_ID << 30);
2023-01-19 11:01:59 +01:00
// Setting the bypass flag and the control command flag should not have any
// implication on the operation of the PDEC IP Core
2022-01-17 15:58:27 +01:00
word |= (BYPASS_FLAG << 29);
word |= (CONTROL_COMMAND_FLAG << 28);
2023-01-19 11:01:59 +01:00
2022-01-17 15:58:27 +01:00
word |= (RESERVED_FIELD_A << 26);
word |= (SPACECRAFT_ID << 16);
word |= (VIRTUAL_CHANNEL << 10);
word |= (DUMMY_BITS << 8);
word |= POSITIVE_WINDOW;
configWords[0] = word;
word = 0;
word |= (NEGATIVE_WINDOW << 24);
word |= (HIGH_AU_MAP_ID << 16);
word |= (ENABLE_DERANDOMIZER << 8);
configWords[1] = word;
2021-11-02 11:11:38 +01:00
}
uint32_t PdecConfig::getConfigWord(uint8_t wordNo) {
2022-01-17 15:58:27 +01:00
if (wordNo >= CONFIG_WORDS_NUM) {
sif::error << "PdecConfig::getConfigWord: Invalid word number" << std::endl;
return 0;
}
return configWords[wordNo];
2021-11-02 11:11:38 +01:00
}
uint32_t PdecConfig::getImrReg() {
2022-10-26 14:35:47 +02:00
return static_cast<uint32_t>(enableNewFarIrq << 2) |
static_cast<uint32_t>(enableTcAbortIrq << 1) | static_cast<uint32_t>(enableTcNewIrq);
}