WIP: PTME: Separate registers for VCs #636
@ -29,6 +29,7 @@ TODO: New firmware package version.
|
|||||||
## Changed
|
## Changed
|
||||||
|
|
||||||
- Removed PTME busy/ready signals. Those were not used anyway because register reads are used now.
|
- Removed PTME busy/ready signals. Those were not used anyway because register reads are used now.
|
||||||
|
- Update PTME config register code: Each VC now has its own configuration register.
|
||||||
|
|
||||||
# [v2.1.0] to be released
|
# [v2.1.0] to be released
|
||||||
|
|
||||||
@ -95,7 +96,6 @@ TODO: New firmware package version.
|
|||||||
|
|
||||||
# [v2.0.5] 2023-05-11
|
# [v2.0.5] 2023-05-11
|
||||||
|
|
||||||
|
|
||||||
- The dual lane assembly transition failed handler started new transitions towards the current mode
|
- The dual lane assembly transition failed handler started new transitions towards the current mode
|
||||||
instead of the target mode. This means that if the dual lane assembly never reached the initial
|
instead of the target mode. This means that if the dual lane assembly never reached the initial
|
||||||
submode (e.g. mode normal and submode dual side), it will transition back to the current mode,
|
submode (e.g. mode normal and submode dual side), it will transition back to the current mode,
|
||||||
|
@ -32,7 +32,7 @@ ReturnValue_t AxiPtmeConfig::writeCaduRateReg(uint8_t rateVal) {
|
|||||||
sif::warning << "AxiPtmeConfig::writeCaduRateReg: Failed to lock mutex" << std::endl;
|
sif::warning << "AxiPtmeConfig::writeCaduRateReg: Failed to lock mutex" << std::endl;
|
||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
*(baseAddress + CADU_BITRATE_REG) = static_cast<uint32_t>(rateVal);
|
*(baseAddress + ADDR_CADU_BITRATE_REG) = static_cast<uint32_t>(rateVal);
|
||||||
result = mutex->unlockMutex();
|
result = mutex->unlockMutex();
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "AxiPtmeConfig::writeCaduRateReg: Failed to unlock mutex" << std::endl;
|
sif::warning << "AxiPtmeConfig::writeCaduRateReg: Failed to unlock mutex" << std::endl;
|
||||||
@ -42,27 +42,27 @@ ReturnValue_t AxiPtmeConfig::writeCaduRateReg(uint8_t rateVal) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AxiPtmeConfig::enableTxclockManipulator() {
|
void AxiPtmeConfig::enableTxclockManipulator() {
|
||||||
writeBit(COMMON_CONFIG_REG, true, BitPos::EN_TX_CLK_MANIPULATOR);
|
writeBit(ADDR_COMMON_CONFIG_REG, true, BitPos::EN_TX_CLK_MANIPULATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AxiPtmeConfig::disableTxclockManipulator() {
|
void AxiPtmeConfig::disableTxclockManipulator() {
|
||||||
writeBit(COMMON_CONFIG_REG, false, BitPos::EN_TX_CLK_MANIPULATOR);
|
writeBit(ADDR_COMMON_CONFIG_REG, false, BitPos::EN_TX_CLK_MANIPULATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AxiPtmeConfig::enableTxclockInversion() {
|
void AxiPtmeConfig::enableTxclockInversion() {
|
||||||
writeBit(COMMON_CONFIG_REG, true, BitPos::INVERT_CLOCK);
|
writeBit(ADDR_COMMON_CONFIG_REG, true, BitPos::INVERT_CLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AxiPtmeConfig::disableTxclockInversion() {
|
void AxiPtmeConfig::disableTxclockInversion() {
|
||||||
writeBit(COMMON_CONFIG_REG, false, BitPos::INVERT_CLOCK);
|
writeBit(ADDR_COMMON_CONFIG_REG, false, BitPos::INVERT_CLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AxiPtmeConfig::enableBatPriorityBit() {
|
void AxiPtmeConfig::enableBatPriorityBit() {
|
||||||
writeBit(COMMON_CONFIG_REG, true, BitPos::EN_BAT_PRIORITY);
|
writeBit(ADDR_COMMON_CONFIG_REG, true, BitPos::EN_BAT_PRIORITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AxiPtmeConfig::disableBatPriorityBit() {
|
void AxiPtmeConfig::disableBatPriorityBit() {
|
||||||
writeBit(COMMON_CONFIG_REG, false, BitPos::EN_BAT_PRIORITY);
|
writeBit(ADDR_COMMON_CONFIG_REG, false, BitPos::EN_BAT_PRIORITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AxiPtmeConfig::writeReg(uint32_t regOffset, uint32_t writeVal) {
|
void AxiPtmeConfig::writeReg(uint32_t regOffset, uint32_t writeVal) {
|
||||||
@ -75,21 +75,62 @@ uint32_t AxiPtmeConfig::readReg(uint32_t regOffset) {
|
|||||||
return *(baseAddress + regOffset / ADRESS_DIVIDER);
|
return *(baseAddress + regOffset / ADRESS_DIVIDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AxiPtmeConfig::writePollThreshold(AxiPtmeConfig::IdlePollThreshold pollThreshold) {
|
void AxiPtmeConfig::writePollThreshold(uint8_t vcIdx,
|
||||||
uint32_t regVal = readCommonCfgReg();
|
AxiPtmeConfig::IdlePollThreshold pollThreshold) {
|
||||||
|
uint32_t regVal = readVcCfgReg(vcIdx);
|
||||||
// Clear bits first
|
// Clear bits first
|
||||||
regVal &= ~(0b111 << 3);
|
regVal &= ~(0b111 << 13);
|
||||||
regVal |= (static_cast<uint8_t>(pollThreshold) << 3);
|
regVal |= (static_cast<uint8_t>(pollThreshold) << 13);
|
||||||
writeCommonCfgReg(regVal);
|
writeVcCfgReg(vcIdx, regVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
AxiPtmeConfig::IdlePollThreshold AxiPtmeConfig::readPollThreshold() {
|
AxiPtmeConfig::IdlePollThreshold AxiPtmeConfig::readPollThreshold(uint8_t vcIdx) {
|
||||||
uint32_t regVal = readCommonCfgReg();
|
uint32_t regVal = readVcCfgReg(vcIdx);
|
||||||
return static_cast<AxiPtmeConfig::IdlePollThreshold>((regVal >> 3) & 0b111);
|
return static_cast<AxiPtmeConfig::IdlePollThreshold>((regVal >> 13) & 0b111);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AxiPtmeConfig::writeCommonCfgReg(uint32_t value) { writeReg(COMMON_CONFIG_REG, value); }
|
void AxiPtmeConfig::writeCommonCfgReg(uint32_t value) { writeReg(ADDR_COMMON_CONFIG_REG, value); }
|
||||||
uint32_t AxiPtmeConfig::readCommonCfgReg() { return readReg(COMMON_CONFIG_REG); }
|
|
||||||
|
uint32_t AxiPtmeConfig::readCommonCfgReg() { return readReg(ADDR_COMMON_CONFIG_REG); }
|
||||||
|
|
||||||
|
uint32_t AxiPtmeConfig::readVcCfgReg(uint8_t vcIdx) {
|
||||||
|
switch (vcIdx) {
|
||||||
|
case (0): {
|
||||||
|
return readReg(ADDR_VC0_REG);
|
||||||
|
}
|
||||||
|
case (1): {
|
||||||
|
return readReg(ADDR_VC1_REG);
|
||||||
|
}
|
||||||
|
case (2): {
|
||||||
|
return readReg(ADDR_VC2_REG);
|
||||||
|
}
|
||||||
|
case (3): {
|
||||||
|
return readReg(ADDR_VC3_REG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AxiPtmeConfig::writeVcCfgReg(uint8_t vcIdx, uint32_t reg) {
|
||||||
|
switch (vcIdx) {
|
||||||
|
case (0): {
|
||||||
|
writeReg(ADDR_VC0_REG, reg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (1): {
|
||||||
|
writeReg(ADDR_VC1_REG, reg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (2): {
|
||||||
|
writeReg(ADDR_VC2_REG, reg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (3): {
|
||||||
|
writeReg(ADDR_VC3_REG, reg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AxiPtmeConfig::writeBit(uint32_t regOffset, bool bitVal, BitPos bitPos) {
|
void AxiPtmeConfig::writeBit(uint32_t regOffset, bool bitVal, BitPos bitPos) {
|
||||||
uint32_t readVal = readReg(regOffset);
|
uint32_t readVal = readReg(regOffset);
|
||||||
|
@ -67,14 +67,20 @@ class AxiPtmeConfig : public SystemObject {
|
|||||||
void enableBatPriorityBit();
|
void enableBatPriorityBit();
|
||||||
void disableBatPriorityBit();
|
void disableBatPriorityBit();
|
||||||
|
|
||||||
void writePollThreshold(IdlePollThreshold pollThreshold);
|
void writePollThreshold(uint8_t vcIdx, IdlePollThreshold pollThreshold);
|
||||||
IdlePollThreshold readPollThreshold();
|
IdlePollThreshold readPollThreshold(uint8_t vcIdx);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Address of register storing the bitrate configuration parameter
|
// Address of register storing the bitrate configuration parameter
|
||||||
static const uint32_t CADU_BITRATE_REG = 0x0;
|
static const uint32_t ADDR_CADU_BITRATE_REG = 0;
|
||||||
// Address of register storing common configuration parameters
|
// Address of register storing common configuration parameters
|
||||||
static const uint32_t COMMON_CONFIG_REG = 0x4;
|
static const uint32_t ADDR_COMMON_CONFIG_REG = 4;
|
||||||
|
static const uint32_t ADDR_FRAME_LENGTH_REG = 8;
|
||||||
|
static const uint32_t ADDR_VC0_REG = 12;
|
||||||
|
static const uint32_t ADDR_VC1_REG = 16;
|
||||||
|
static const uint32_t ADDR_VC2_REG = 20;
|
||||||
|
static const uint32_t ADDR_VC3_REG = 24;
|
||||||
|
|
||||||
static const uint32_t ADRESS_DIVIDER = 4;
|
static const uint32_t ADRESS_DIVIDER = 4;
|
||||||
|
|
||||||
enum class BitPos : uint32_t { EN_TX_CLK_MANIPULATOR = 0, INVERT_CLOCK = 1, EN_BAT_PRIORITY = 2 };
|
enum class BitPos : uint32_t { EN_TX_CLK_MANIPULATOR = 0, INVERT_CLOCK = 1, EN_BAT_PRIORITY = 2 };
|
||||||
@ -106,6 +112,9 @@ class AxiPtmeConfig : public SystemObject {
|
|||||||
uint32_t readCommonCfgReg();
|
uint32_t readCommonCfgReg();
|
||||||
void writeCommonCfgReg(uint32_t value);
|
void writeCommonCfgReg(uint32_t value);
|
||||||
|
|
||||||
|
uint32_t readVcCfgReg(uint8_t vcIdx);
|
||||||
|
void writeVcCfgReg(uint8_t vcIdx, uint32_t reg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets one bit in a register
|
* @brief Sets one bit in a register
|
||||||
*
|
*
|
||||||
|
@ -50,6 +50,8 @@ void PtmeConfig::enableBatPriorityBit(bool enable) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PtmeConfig::setPollThreshold(AxiPtmeConfig::IdlePollThreshold pollThreshold) {
|
void PtmeConfig::setAllPollThresholds(AxiPtmeConfig::IdlePollThreshold pollThreshold) {
|
||||||
axiPtmeConfig->writePollThreshold(pollThreshold);
|
for (uint8_t idx = 0; idx < 4; idx++) {
|
||||||
|
axiPtmeConfig->writePollThreshold(idx, pollThreshold);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ class PtmeConfig : public SystemObject {
|
|||||||
*/
|
*/
|
||||||
void enableBatPriorityBit(bool enable);
|
void enableBatPriorityBit(bool enable);
|
||||||
|
|
||||||
void setPollThreshold(AxiPtmeConfig::IdlePollThreshold pollThreshold);
|
void setAllPollThresholds(AxiPtmeConfig::IdlePollThreshold pollThreshold);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const uint8_t INTERFACE_ID = CLASS_ID::RATE_SETTER;
|
static const uint8_t INTERFACE_ID = CLASS_ID::RATE_SETTER;
|
||||||
|
@ -76,7 +76,7 @@ ReturnValue_t CcsdsIpCoreHandler::initialize() {
|
|||||||
|
|
||||||
// This also pulls the PTME out of reset state.
|
// This also pulls the PTME out of reset state.
|
||||||
updateBatPriorityFromParam();
|
updateBatPriorityFromParam();
|
||||||
ptmeConfig.setPollThreshold(
|
ptmeConfig.setAllPollThresholds(
|
||||||
static_cast<AxiPtmeConfig::IdlePollThreshold>(params.pollThresholdParam));
|
static_cast<AxiPtmeConfig::IdlePollThreshold>(params.pollThresholdParam));
|
||||||
resetPtme();
|
resetPtme();
|
||||||
ptmeLocked = false;
|
ptmeLocked = false;
|
||||||
@ -322,7 +322,7 @@ void CcsdsIpCoreHandler::performPtmeUpdateWhenApplicable() {
|
|||||||
doResetPtme = true;
|
doResetPtme = true;
|
||||||
}
|
}
|
||||||
if (updateContext.updatePollThreshold) {
|
if (updateContext.updatePollThreshold) {
|
||||||
ptmeConfig.setPollThreshold(
|
ptmeConfig.setAllPollThresholds(
|
||||||
static_cast<AxiPtmeConfig::IdlePollThreshold>(params.pollThresholdParam));
|
static_cast<AxiPtmeConfig::IdlePollThreshold>(params.pollThresholdParam));
|
||||||
updateContext.updatePollThreshold = false;
|
updateContext.updatePollThreshold = false;
|
||||||
doResetPtme = true;
|
doResetPtme = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user