This commit is contained in:
parent
d28ec2c31a
commit
567d68107d
@ -116,20 +116,20 @@ ReturnValue_t PdecConfig::getNegativeWindow(uint8_t& negativeWindow) {
|
|||||||
|
|
||||||
ReturnValue_t PdecConfig::writeFrameHeaderFirstWord() {
|
ReturnValue_t PdecConfig::writeFrameHeaderFirstWord() {
|
||||||
uint32_t word = 0;
|
uint32_t word = 0;
|
||||||
ReturnValue_t result = createFirstWord(&word);
|
ReturnValue_t result = createFirstWord(&word);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
*(memoryBaseAddress + FRAME_HEADER_OFFSET + OFFSET_FIRST_CONFIG_WORD) = word;
|
*(memoryBaseAddress + FRAME_HEADER_OFFSET + OFFSET_FIRST_CONFIG_WORD) = word;
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PdecConfig::writeFrameHeaderSecondWord() {
|
ReturnValue_t PdecConfig::writeFrameHeaderSecondWord() {
|
||||||
uint32_t word = 0;
|
uint32_t word = 0;
|
||||||
ReturnValue_t result = createSecondWord(&word);
|
ReturnValue_t result = createSecondWord(&word);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
*(memoryBaseAddress + FRAME_HEADER_OFFSET + OFFSET_SECOND_CONFIG_WORD) = word;
|
*(memoryBaseAddress + FRAME_HEADER_OFFSET + OFFSET_SECOND_CONFIG_WORD) = word;
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
@ -171,47 +171,47 @@ uint8_t PdecConfig::getOddParity(uint8_t number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PdecConfig::createFirstWord(uint32_t* word) {
|
ReturnValue_t PdecConfig::createFirstWord(uint32_t* word) {
|
||||||
*word = 0;
|
*word = 0;
|
||||||
*word |= (VERSION_ID << 30);
|
*word |= (VERSION_ID << 30);
|
||||||
|
|
||||||
// Setting the bypass flag and the control command flag should not have any
|
// Setting the bypass flag and the control command flag should not have any
|
||||||
// implication on the operation of the PDEC IP Core
|
// implication on the operation of the PDEC IP Core
|
||||||
*word |= (BYPASS_FLAG << 29);
|
*word |= (BYPASS_FLAG << 29);
|
||||||
*word |= (CONTROL_COMMAND_FLAG << 28);
|
*word |= (CONTROL_COMMAND_FLAG << 28);
|
||||||
|
|
||||||
*word |= (RESERVED_FIELD_A << 26);
|
*word |= (RESERVED_FIELD_A << 26);
|
||||||
*word |= (SPACECRAFT_ID << 16);
|
*word |= (SPACECRAFT_ID << 16);
|
||||||
*word |= (VIRTUAL_CHANNEL << 10);
|
*word |= (VIRTUAL_CHANNEL << 10);
|
||||||
*word |= (DUMMY_BITS << 8);
|
*word |= (DUMMY_BITS << 8);
|
||||||
uint8_t positiveWindow = 0;
|
uint8_t positiveWindow = 0;
|
||||||
ReturnValue_t result =
|
ReturnValue_t result =
|
||||||
localParameterHandler.getValue(pdecconfigdefs::paramkeys::POSITIVE_WINDOW, positiveWindow);
|
localParameterHandler.getValue(pdecconfigdefs::paramkeys::POSITIVE_WINDOW, positiveWindow);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
*word |= static_cast<uint32_t>(positiveWindow);
|
*word |= static_cast<uint32_t>(positiveWindow);
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PdecConfig::createSecondWord(uint32_t* word) {
|
ReturnValue_t PdecConfig::createSecondWord(uint32_t* word) {
|
||||||
uint8_t negativeWindow = 0;
|
uint8_t negativeWindow = 0;
|
||||||
ReturnValue_t result =
|
ReturnValue_t result =
|
||||||
localParameterHandler.getValue(pdecconfigdefs::paramkeys::NEGATIVE_WINDOW, negativeWindow);
|
localParameterHandler.getValue(pdecconfigdefs::paramkeys::NEGATIVE_WINDOW, negativeWindow);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
*word = 0;
|
*word = 0;
|
||||||
*word = 0;
|
*word = 0;
|
||||||
*word |= (static_cast<uint32_t>(negativeWindow) << 24);
|
*word |= (static_cast<uint32_t>(negativeWindow) << 24);
|
||||||
*word |= (HIGH_AU_MAP_ID << 16);
|
*word |= (HIGH_AU_MAP_ID << 16);
|
||||||
*word |= (ENABLE_DERANDOMIZER << 8);
|
*word |= (ENABLE_DERANDOMIZER << 8);
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t PdecConfig::readbackFirstWord() {
|
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() {
|
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);
|
ReturnValue_t getNegativeWindow(uint8_t& negativeWindow);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Creates the first word of the PDEC configuration
|
* @brief Creates the first word of the PDEC configuration
|
||||||
*
|
*
|
||||||
* @param word The created word will be written to this pointer
|
* @param word The created word will be written to this pointer
|
||||||
*
|
*
|
||||||
* @return OK if successful, otherwise error return value
|
* @return OK if successful, otherwise error return value
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
ReturnValue_t createFirstWord(uint32_t* word);
|
ReturnValue_t createFirstWord(uint32_t* word);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Creates the second word of the PDEC configuration
|
* @brief Creates the second word of the PDEC configuration
|
||||||
*
|
*
|
||||||
* @param word The created word will be written to this pointer
|
* @param word The created word will be written to this pointer
|
||||||
*
|
*
|
||||||
* @return OK if successful, otherwise error return value
|
* @return OK if successful, otherwise error return value
|
||||||
*/
|
*/
|
||||||
ReturnValue_t createSecondWord(uint32_t* word);
|
ReturnValue_t createSecondWord(uint32_t* word);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Reads first config word from the config memory
|
* @brief Reads first config word from the config memory
|
||||||
*
|
*
|
||||||
* @return The config word
|
* @return The config word
|
||||||
*/
|
*/
|
||||||
uint32_t readbackFirstWord();
|
uint32_t readbackFirstWord();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Reads the second config word from the config memory
|
* @brief Reads the second config word from the config memory
|
||||||
*
|
*
|
||||||
* @return The config word
|
* @return The config word
|
||||||
*/
|
*/
|
||||||
uint32_t readbackSecondWord();
|
uint32_t readbackSecondWord();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// TC transfer frame configuration parameters
|
// TC transfer frame configuration parameters
|
||||||
|
@ -579,28 +579,26 @@ void PdecHandler::handleIReason(uint32_t pdecFar, ReturnValue_t parameter1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PdecHandler::checkConfig() {
|
void PdecHandler::checkConfig() {
|
||||||
uint32_t firstWord = 0;
|
uint32_t firstWord = 0;
|
||||||
ReturnValue_t result = pdecConfig.createFirstWord(&firstWord);
|
ReturnValue_t result = pdecConfig.createFirstWord(&firstWord);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
// This should normally never happen during runtime. So here is just
|
// This should normally never happen during runtime. So here is just
|
||||||
// output a warning
|
// output a warning
|
||||||
sif::warning << "PdecHandler::checkConfig: Failed to create first word"
|
sif::warning << "PdecHandler::checkConfig: Failed to create first word" << std::endl;
|
||||||
<< std::endl;
|
return;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
uint32_t secondWord = 0;
|
uint32_t secondWord = 0;
|
||||||
result = pdecConfig.createSecondWord(&secondWord);
|
result = pdecConfig.createSecondWord(&secondWord);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
// This should normally never happen during runtime. So here is just
|
// This should normally never happen during runtime. So here is just
|
||||||
// output a warning
|
// output a warning
|
||||||
sif::warning << "PdecHandler::checkConfig: Failed to create second word"
|
sif::warning << "PdecHandler::checkConfig: Failed to create second word" << std::endl;
|
||||||
<< std::endl;
|
return;
|
||||||
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() {
|
void PdecHandler::handleNewTc() {
|
||||||
|
Loading…
Reference in New Issue
Block a user