From 567d68107da39fcba4f791b74ec066624c826b22 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Aug 2023 15:06:22 +0200 Subject: [PATCH] auto-formatting --- linux/ipcore/PdecConfig.cpp | 80 ++++++++++++++++++------------------ linux/ipcore/PdecConfig.h | 56 ++++++++++++------------- linux/ipcore/PdecHandler.cpp | 30 +++++++------- 3 files changed, 82 insertions(+), 84 deletions(-) diff --git a/linux/ipcore/PdecConfig.cpp b/linux/ipcore/PdecConfig.cpp index 8399f6d3..19423862 100644 --- a/linux/ipcore/PdecConfig.cpp +++ b/linux/ipcore/PdecConfig.cpp @@ -116,20 +116,20 @@ ReturnValue_t PdecConfig::getNegativeWindow(uint8_t& negativeWindow) { ReturnValue_t PdecConfig::writeFrameHeaderFirstWord() { uint32_t word = 0; - ReturnValue_t result = createFirstWord(&word); - if (result != returnvalue::OK) { - return result; - } + ReturnValue_t result = createFirstWord(&word); + if (result != returnvalue::OK) { + return result; + } *(memoryBaseAddress + FRAME_HEADER_OFFSET + OFFSET_FIRST_CONFIG_WORD) = word; return returnvalue::OK; } ReturnValue_t PdecConfig::writeFrameHeaderSecondWord() { uint32_t word = 0; - ReturnValue_t result = createSecondWord(&word); - if (result != returnvalue::OK) { - return result; - } + ReturnValue_t result = createSecondWord(&word); + if (result != returnvalue::OK) { + return result; + } *(memoryBaseAddress + FRAME_HEADER_OFFSET + OFFSET_SECOND_CONFIG_WORD) = word; return returnvalue::OK; } @@ -171,47 +171,47 @@ uint8_t PdecConfig::getOddParity(uint8_t number) { } ReturnValue_t PdecConfig::createFirstWord(uint32_t* word) { - *word = 0; - *word |= (VERSION_ID << 30); + *word = 0; + *word |= (VERSION_ID << 30); - // Setting the bypass flag and the control command flag should not have any - // implication on the operation of the PDEC IP Core - *word |= (BYPASS_FLAG << 29); - *word |= (CONTROL_COMMAND_FLAG << 28); + // Setting the bypass flag and the control command flag should not have any + // implication on the operation of the PDEC IP Core + *word |= (BYPASS_FLAG << 29); + *word |= (CONTROL_COMMAND_FLAG << 28); - *word |= (RESERVED_FIELD_A << 26); - *word |= (SPACECRAFT_ID << 16); - *word |= (VIRTUAL_CHANNEL << 10); - *word |= (DUMMY_BITS << 8); - uint8_t positiveWindow = 0; - ReturnValue_t result = - localParameterHandler.getValue(pdecconfigdefs::paramkeys::POSITIVE_WINDOW, positiveWindow); - if (result != returnvalue::OK) { - return result; - } - *word |= static_cast(positiveWindow); - return returnvalue::OK; + *word |= (RESERVED_FIELD_A << 26); + *word |= (SPACECRAFT_ID << 16); + *word |= (VIRTUAL_CHANNEL << 10); + *word |= (DUMMY_BITS << 8); + uint8_t positiveWindow = 0; + ReturnValue_t result = + localParameterHandler.getValue(pdecconfigdefs::paramkeys::POSITIVE_WINDOW, positiveWindow); + if (result != returnvalue::OK) { + return result; + } + *word |= static_cast(positiveWindow); + return returnvalue::OK; } ReturnValue_t PdecConfig::createSecondWord(uint32_t* word) { - uint8_t negativeWindow = 0; - ReturnValue_t result = - localParameterHandler.getValue(pdecconfigdefs::paramkeys::NEGATIVE_WINDOW, negativeWindow); - if (result != returnvalue::OK) { - return result; - } - *word = 0; - *word = 0; - *word |= (static_cast(negativeWindow) << 24); - *word |= (HIGH_AU_MAP_ID << 16); - *word |= (ENABLE_DERANDOMIZER << 8); - return returnvalue::OK; + uint8_t negativeWindow = 0; + ReturnValue_t result = + localParameterHandler.getValue(pdecconfigdefs::paramkeys::NEGATIVE_WINDOW, negativeWindow); + if (result != returnvalue::OK) { + return result; + } + *word = 0; + *word = 0; + *word |= (static_cast(negativeWindow) << 24); + *word |= (HIGH_AU_MAP_ID << 16); + *word |= (ENABLE_DERANDOMIZER << 8); + return returnvalue::OK; } uint32_t PdecConfig::readbackFirstWord() { - return *(memoryBaseAddress + FRAME_HEADER_OFFSET + OFFSET_FIRST_CONFIG_WORD); + return *(memoryBaseAddress + FRAME_HEADER_OFFSET + OFFSET_FIRST_CONFIG_WORD); } uint32_t PdecConfig::readbackSecondWord() { - return *(memoryBaseAddress + FRAME_HEADER_OFFSET + OFFSET_SECOND_CONFIG_WORD); + return *(memoryBaseAddress + FRAME_HEADER_OFFSET + OFFSET_SECOND_CONFIG_WORD); } diff --git a/linux/ipcore/PdecConfig.h b/linux/ipcore/PdecConfig.h index e3faee4d..1f2ed9c8 100644 --- a/linux/ipcore/PdecConfig.h +++ b/linux/ipcore/PdecConfig.h @@ -49,37 +49,37 @@ class PdecConfig { ReturnValue_t getNegativeWindow(uint8_t& negativeWindow); /** - * @brief Creates the first word of the PDEC configuration - * - * @param word The created word will be written to this pointer - * - * @return OK if successful, otherwise error return value - * - */ - ReturnValue_t createFirstWord(uint32_t* word); + * @brief Creates the first word of the PDEC configuration + * + * @param word The created word will be written to this pointer + * + * @return OK if successful, otherwise error return value + * + */ + ReturnValue_t createFirstWord(uint32_t* word); - /** - * @brief Creates the second word of the PDEC configuration - * - * @param word The created word will be written to this pointer - * - * @return OK if successful, otherwise error return value - */ - ReturnValue_t createSecondWord(uint32_t* word); + /** + * @brief Creates the second word of the PDEC configuration + * + * @param word The created word will be written to this pointer + * + * @return OK if successful, otherwise error return value + */ + ReturnValue_t createSecondWord(uint32_t* word); - /** - * @brief Reads first config word from the config memory - * - * @return The config word - */ - uint32_t readbackFirstWord(); + /** + * @brief Reads first config word from the config memory + * + * @return The config word + */ + uint32_t readbackFirstWord(); - /** - * @brief Reads the second config word from the config memory - * - * @return The config word - */ - uint32_t readbackSecondWord(); + /** + * @brief Reads the second config word from the config memory + * + * @return The config word + */ + uint32_t readbackSecondWord(); private: // TC transfer frame configuration parameters diff --git a/linux/ipcore/PdecHandler.cpp b/linux/ipcore/PdecHandler.cpp index 91aec623..189dfca8 100644 --- a/linux/ipcore/PdecHandler.cpp +++ b/linux/ipcore/PdecHandler.cpp @@ -579,28 +579,26 @@ void PdecHandler::handleIReason(uint32_t pdecFar, ReturnValue_t parameter1) { } void PdecHandler::checkConfig() { - uint32_t firstWord = 0; + uint32_t firstWord = 0; ReturnValue_t result = pdecConfig.createFirstWord(&firstWord); if (result != returnvalue::OK) { - // This should normally never happen during runtime. So here is just - // output a warning - sif::warning << "PdecHandler::checkConfig: Failed to create first word" - << std::endl; - return; + // This should normally never happen during runtime. So here is just + // output a warning + sif::warning << "PdecHandler::checkConfig: Failed to create first word" << std::endl; + return; } - uint32_t secondWord = 0; + uint32_t secondWord = 0; result = pdecConfig.createSecondWord(&secondWord); if (result != returnvalue::OK) { - // This should normally never happen during runtime. So here is just - // output a warning - sif::warning << "PdecHandler::checkConfig: Failed to create second word" - << std::endl; - return; + // This should normally never happen during runtime. So here is just + // output a warning + sif::warning << "PdecHandler::checkConfig: Failed to create second word" << std::endl; + return; + } + if (firstWord != pdecConfig.readbackFirstWord() or + secondWord != pdecConfig.readbackSecondWord()) { + triggerEvent(PDEC_CONFIG_CORRUPTED, firstWord, secondWord); } - if (firstWord != pdecConfig.readbackFirstWord() or - secondWord != pdecConfig.readbackSecondWord()) { - triggerEvent(PDEC_CONFIG_CORRUPTED, firstWord, secondWord); - } } void PdecHandler::handleNewTc() {