print clcw command

This commit is contained in:
Jakob Meier
2021-11-22 10:38:32 +01:00
parent dc0f435dbd
commit 283921cba1
2 changed files with 87 additions and 22 deletions

View File

@ -10,6 +10,8 @@
#include "fsfw/storagemanager/StorageManagerIF.h"
#include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/tasks/ExecutableObjectIF.h"
#include "fsfw/action/ActionHelper.h"
#include "fsfw/action/HasActionsIF.h"
/**
* @brief This class controls the PDEC IP Core implemented in the programmable logic of the
@ -29,7 +31,10 @@
*
* @author J. Meier
*/
class PdecHandler : public SystemObject, public ExecutableObjectIF, public HasReturnvaluesIF {
class PdecHandler : public SystemObject,
public ExecutableObjectIF,
public HasReturnvaluesIF,
public HasActionsIF {
public:
/**
@ -51,6 +56,21 @@ public:
ReturnValue_t initialize() override;
MessageQueueId_t getCommandQueue() const;
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size) override;
/**
* brief Returns the 32-bit wide communication link control word (CLCW)
*/
uint32_t getClcw();
/**
* @rief Reads and prints the CLCW. Can be useful for debugging.
*/
void printClcw();
private:
static const uint8_t INTERFACE_ID = CLASS_ID::PDEC_HANDLER;
@ -63,6 +83,9 @@ private:
static const ReturnValue_t AD_DISCARDED_WAIT = MAKE_RETURN_CODE(0xA4);
static const ReturnValue_t AD_DISCARDED_NS_VS = MAKE_RETURN_CODE(0xA5);
//! [EXPORT] : [COMMENT] Received action message with unknown action id
static const ReturnValue_t COMMAND_NOT_IMPLEMENTED = MAKE_RETURN_CODE(0xB0);
static const ReturnValue_t NO_REPORT = MAKE_RETURN_CODE(0xA6);
//! Error in version number and reserved A and B fields
static const ReturnValue_t ERROR_VERSION_NUMBER = MAKE_RETURN_CODE(0xA7);
@ -88,6 +111,11 @@ private:
//! [EXPORT] : [COMMENT] Read invalid FAR from PDEC after startup
static const Event INVALID_FAR = MAKE_EVENT(2, severity::HIGH);
static const uint32_t QUEUE_SIZE = common::CCSDS_HANDLER_QUEUE_SIZE;
// Action IDs
static const ActionId_t PRINT_CLCW = 0;
static const uint8_t STAT_POSITION = 31;
static const uint8_t FRAME_ANA_POSITION = 28;
static const uint8_t IREASON_POSITION = 25;
@ -182,6 +210,11 @@ private:
WAIT_FOR_RECOVERY
};
/**
* @brief Reads and handles messages stored in the commandQueue
*/
void readCommandQueue(void);
/**
* @brief Opens UIO device assigned to AXI to AHB converter giving access to the PDEC
* registers. The register base address will be mapped into the virtual address space.
@ -284,9 +317,6 @@ private:
*/
uint8_t getOddParity(uint8_t number);
void getClcw();
void printClcw(uint32_t clcw);
object_id_t tcDestinationId;
AcceptsTelecommandsIF* tcDestination = nullptr;
@ -309,8 +339,12 @@ private:
// UIO device file giving access to the PDEC register space
std::string uioRegisters;
ActionHelper actionHelper;
StorageManagerIF* tcStore = nullptr;
MessageQueueIF* commandQueue = nullptr;
State state = State::INIT;
/**
@ -328,8 +362,6 @@ private:
uint32_t pdecFar = 0;
uint8_t tcSegment[TC_SEGMENT_LEN];
uint8_t debugDivider = 0;
};
#endif /* LINUX_OBC_PDECHANDLER_H_ */