clcw readout
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Jakob Meier 2021-11-03 19:49:41 +01:00
parent 709661ff67
commit 6f85968f3c
2 changed files with 62 additions and 1 deletions

View File

@ -183,6 +183,7 @@ ReturnValue_t PdecHandler::performOperation(uint8_t operationCode) {
if (newTcReceived()) {
handleNewTc();
}
getClcw();
break;
case State::WAIT_FOR_RECOVERY:
break;
@ -432,3 +433,57 @@ uint8_t PdecHandler::getOddParity(uint8_t number) {
parityBit = ~(countBits & 0x1) & 0x1;
return parityBit;
}
void PdecHandler::getClcw() {
uint32_t clcw = *(registerBaseAddress + PDEC_CLCW_OFFSET);
#if OBSW_DEBUG_PDEC_HANDLER == 1
if (debugDivider == 5) {
printClcw(clcw);
debugDivider = 0;
return;
}
debugDivider++;
#endif /* OBSW_DEBUG_PDEC_HANDLER == 1 */
}
void PdecHandler::printClcw(uint32_t clcw) {
uint8_t type = static_cast<uint8_t>((clcw >> 31) & 0x1);
uint8_t versionNo = static_cast<uint8_t>((clcw >> 29) & 0x3);
uint8_t status = static_cast<uint8_t>((clcw >> 26) & 0x7);
uint8_t cop = static_cast<uint8_t>((clcw >> 24) & 0x3);
uint8_t vcId = static_cast<uint8_t>((clcw >> 18) & 0x3F);
uint8_t noRf = static_cast<uint8_t>((clcw >> 15) & 0x1);
uint8_t noBitLock = static_cast<uint8_t>((clcw >> 14) & 0x1);
uint8_t lockoutFlag = static_cast<uint8_t>((clcw >> 13) & 0x1);
uint8_t waitFlag = static_cast<uint8_t>((clcw >> 12) & 0x1);
uint8_t retransmitFlag = static_cast<uint8_t>((clcw >> 11) & 0x1);
uint8_t farmBcnt = static_cast<uint8_t>((clcw >> 9) & 0x3);
// Expected frame sequence number in te next AD frame
uint8_t repValue = static_cast<uint8_t>(clcw & 0xFF);
sif::info << std::setw(30) << std::left << "CLCW type: " << std::hex
<< "0x" << static_cast<unsigned int>(type) << std::endl;
sif::info << std::setw(30) << std::left << "CLCW version no: " << std::hex
<< "0x" << static_cast<unsigned int>(versionNo) << std::endl;
sif::info << std::setw(30) << std::left << "CLCW status: " << std::hex
<< "0x" << static_cast<unsigned int>(status) << std::endl;
sif::info << std::setw(30) << std::left << "CLCW COP: " << std::hex
<< "0x" << static_cast<unsigned int>(cop) << std::endl;
sif::info << std::setw(30) << std::left << "CLCW virtual channel ID: " << std::hex
<< "0x" << static_cast<unsigned int>(vcId) << std::endl;
sif::info << std::setw(30) << std::left << "CLCW no RF: " << std::hex
<< "0x" << static_cast<unsigned int>(noRf) << std::endl;
sif::info << std::setw(30) << std::left << "CLCW no bit lock: " << std::hex
<< "0x" << static_cast<unsigned int>(noBitLock) << std::endl;
sif::info << std::setw(30) << std::left << "CLCW lockout flag: " << std::hex
<< "0x" << static_cast<unsigned int>(lockoutFlag) << std::endl;
sif::info << std::setw(30) << std::left << "CLCW wait flag: " << std::hex
<< "0x" << static_cast<unsigned int>(waitFlag) << std::endl;
sif::info << std::setw(30) << std::left << "CLCW retransmit flag: " << std::hex
<< "0x" << static_cast<unsigned int>(retransmitFlag) << std::endl;
sif::info << std::setw(30) << std::left << "CLCW FARM B count: " << std::hex
<< "0x" << static_cast<unsigned int>(farmBcnt) << std::endl;
sif::info << std::setw(30) << std::left << "CLCW rep value: " << std::hex
<< "0x" << static_cast<unsigned int>(repValue) << std::endl;
}

View File

@ -101,6 +101,7 @@ private:
* Example: PDEC_FAR = 0x2840 => Offset in virtual address space is 0xA10
*/
static const uint32_t PDEC_FAR_OFFSET = 0xA10;
static const uint32_t PDEC_CLCW_OFFSET = 0xA12;
static const uint32_t PDEC_BFREE_OFFSET = 0xA24;
static const uint32_t PDEC_BPTR_OFFSET = 0xA25;
static const uint32_t PDEC_SLEN_OFFSET = 0xA26;
@ -270,6 +271,9 @@ private:
*/
uint8_t getOddParity(uint8_t number);
void getClcw();
void printClcw(uint32_t clcw);
object_id_t tcDestinationId;
AcceptsTelecommandsIF* tcDestination = nullptr;
@ -311,6 +315,8 @@ private:
uint32_t pdecFar = 0;
uint8_t tcSegment[TC_SEGMENT_LEN];
uint8_t debugDivider = 0;
};
#endif /* LINUX_OBC_PDECHANDLER_H_ */