save before changing configuration writing

This commit is contained in:
Jakob Meier 2021-11-01 18:11:29 +01:00
parent 556a3986c1
commit 9191d1ec33
2 changed files with 12 additions and 3 deletions

View File

@ -18,8 +18,10 @@ namespace PdecConfig {
// TC transfer frame configuration parameters // TC transfer frame configuration parameters
static const uint8_t VERSION_ID = 0; static const uint8_t VERSION_ID = 0;
static const uint8_t BYPASS_FLAG = 1; // static const uint8_t BYPASS_FLAG = 1;
static const uint8_t CONTROL_COMMAND_FLAG = 1; // static const uint8_t CONTROL_COMMAND_FLAG = 1;
static const uint8_t BYPASS_FLAG = 0;
static const uint8_t CONTROL_COMMAND_FLAG = 0;
static const uint8_t VIRTUAL_CHANNEL = 0; static const uint8_t VIRTUAL_CHANNEL = 0;
static const uint8_t RESERVED_FIELD_A = 0; static const uint8_t RESERVED_FIELD_A = 0;
static const uint16_t SPACECRAFT_ID = 0x274; static const uint16_t SPACECRAFT_ID = 0x274;

View File

@ -106,10 +106,13 @@ void PdecHandler::writePdecConfig() {
pdecParams.negativeWindow = PdecConfig::NEGATIVE_WINDOW; pdecParams.negativeWindow = PdecConfig::NEGATIVE_WINDOW;
std::memcpy(memoryBaseAddress, &pdecParams, sizeof(pdecParams)); std::memcpy(memoryBaseAddress, &pdecParams, sizeof(pdecParams));
// uint8_t routeToPm = calcMapAddrEntry(PM_BUFFER);
// Configure all MAP IDs as invalid // Configure all MAP IDs as invalid
for (int idx = 0; idx <= MAX_MAP_ADDR; idx += 4) { for (int idx = 0; idx <= MAX_MAP_ADDR; idx += 4) {
*(memoryBaseAddress + MAP_ADDR_LUT_OFFSET + idx / 4) = NO_DESTINATION << 24 *(memoryBaseAddress + MAP_ADDR_LUT_OFFSET + idx / 4) = NO_DESTINATION << 24
| NO_DESTINATION << 16 | NO_DESTINATION << 8 | NO_DESTINATION; | NO_DESTINATION << 16 | NO_DESTINATION << 8 | NO_DESTINATION;
// *(memoryBaseAddress + MAP_ADDR_LUT_OFFSET + idx / 4) = routeToPm << 24
// | routeToPm << 16 | routeToPm << 8 | routeToPm;
} }
@ -123,7 +126,7 @@ ReturnValue_t PdecHandler::resetFarStatFlag() {
uint32_t pdecFar = *(registerBaseAddress + PDEC_FAR_OFFSET); uint32_t pdecFar = *(registerBaseAddress + PDEC_FAR_OFFSET);
if (pdecFar != FAR_RESET) { if (pdecFar != FAR_RESET) {
sif::warning << "PdecHandler::resetFarStatFlag: FAR register did not match expected value." sif::warning << "PdecHandler::resetFarStatFlag: FAR register did not match expected value."
<< " Read value:" << static_cast<unsigned int>(pdecFar) << std::endl; << " Read value: 0x" << std::hex << static_cast<unsigned int>(pdecFar) << std::endl;
return RETURN_FAILED; return RETURN_FAILED;
} }
#if OBSW_DEBUG_PDEC_HANDLER == 1 #if OBSW_DEBUG_PDEC_HANDLER == 1
@ -174,6 +177,10 @@ ReturnValue_t PdecHandler::performOperation(uint8_t operationCode) {
bool PdecHandler::newTcReceived() { bool PdecHandler::newTcReceived() {
uint32_t pdecFar = *(registerBaseAddress + PDEC_FAR_OFFSET); uint32_t pdecFar = *(registerBaseAddress + PDEC_FAR_OFFSET);
sif::debug << "PdecHandler::newTcReceived: pdecFar 0x" << std::hex
<< static_cast<unsigned int>(pdecFar) << std::endl;
if (pdecFar >> STAT_POSITION != NEW_FAR_RECEIVED) { if (pdecFar >> STAT_POSITION != NEW_FAR_RECEIVED) {
return false; return false;
} }