This commit is contained in:
parent
d28ec2c31a
commit
567d68107d
@ -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<uint32_t>(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<uint32_t>(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<uint32_t>(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<uint32_t>(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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user