CCSDS Handler
This commit is contained in:
parent
60a20acc5b
commit
ef40db7fe4
73
mission/tmtc/CCSDSActions.h
Normal file
73
mission/tmtc/CCSDSActions.h
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <fsfw/action/MinMaxParameter.h>
|
||||||
|
#include <fsfw/action/TemplateAction.h>
|
||||||
|
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
||||||
|
#include <fsfw/introspection/Enum.h>
|
||||||
|
|
||||||
|
class CCSDSHandler;
|
||||||
|
|
||||||
|
FSFW_ENUM(
|
||||||
|
CCSDSCommands, DeviceCommandId_t,
|
||||||
|
((SET_LOW_RATE, 0, "Set Low rate"))((SET_HIGH_RATE, 1, "Set High Rate"))(
|
||||||
|
(EN_TRANSMITTER, 2, "Enable Transmitter"))((DISABLE_TRANSMITTER, 3, "Disable Transmitter"))(
|
||||||
|
(ARBITRARY_RATE, 4, "Set Bit Rate"))((ENABLE_TX_CLK_MANIPULATOR, 5,
|
||||||
|
"Enable Tx Clock Manipulator"))(
|
||||||
|
(DISABLE_TX_CLK_MANIPULATOR, 6, "Enable Tx Clock Manipulator"))(
|
||||||
|
(UPDATE_ON_RISING_EDGE, 7, "update data on rising edge"))((UPDATE_ON_FALLING_EDGE, 8,
|
||||||
|
"update data on falling edge")))
|
||||||
|
|
||||||
|
class SetLowRateAction : public TemplateAction<CCSDSHandler, SetLowRateAction, CCSDSCommands> {
|
||||||
|
public:
|
||||||
|
SetLowRateAction(CCSDSHandler* owner)
|
||||||
|
: TemplateAction(owner, CCSDSCommands::SET_LOW_RATE) {}
|
||||||
|
};
|
||||||
|
class SetHighRateAction : public TemplateAction<CCSDSHandler, SetHighRateAction, CCSDSCommands> {
|
||||||
|
public:
|
||||||
|
SetHighRateAction(CCSDSHandler* owner)
|
||||||
|
: TemplateAction(owner, CCSDSCommands::SET_HIGH_RATE) {}
|
||||||
|
};
|
||||||
|
class EnTransmitterAction
|
||||||
|
: public TemplateAction<CCSDSHandler, EnTransmitterAction, CCSDSCommands> {
|
||||||
|
public:
|
||||||
|
EnTransmitterAction(CCSDSHandler* owner)
|
||||||
|
: TemplateAction(owner, CCSDSCommands::EN_TRANSMITTER) {}
|
||||||
|
};
|
||||||
|
class DisableTransmitterAction
|
||||||
|
: public TemplateAction<CCSDSHandler, DisableTransmitterAction, CCSDSCommands> {
|
||||||
|
public:
|
||||||
|
DisableTransmitterAction(CCSDSHandler* owner)
|
||||||
|
: TemplateAction(owner, CCSDSCommands::DISABLE_TRANSMITTER) {}
|
||||||
|
};
|
||||||
|
class ArbitraryRateAction
|
||||||
|
: public TemplateAction<CCSDSHandler, ArbitraryRateAction, CCSDSCommands> {
|
||||||
|
public:
|
||||||
|
ArbitraryRateAction(CCSDSHandler* owner)
|
||||||
|
: TemplateAction(owner, CCSDSCommands::ARBITRARY_RATE) {}
|
||||||
|
|
||||||
|
Parameter<uint32_t> bitrate = Parameter<uint32_t>::createParameter(this, "Bitrate");
|
||||||
|
};
|
||||||
|
class EnableTxClkManipulatorAction
|
||||||
|
: public TemplateAction<CCSDSHandler, EnableTxClkManipulatorAction, CCSDSCommands> {
|
||||||
|
public:
|
||||||
|
EnableTxClkManipulatorAction(CCSDSHandler* owner)
|
||||||
|
: TemplateAction(owner, CCSDSCommands::ENABLE_TX_CLK_MANIPULATOR) {}
|
||||||
|
};
|
||||||
|
class DisableTxClkManipulatorAction
|
||||||
|
: public TemplateAction<CCSDSHandler, DisableTxClkManipulatorAction, CCSDSCommands> {
|
||||||
|
public:
|
||||||
|
DisableTxClkManipulatorAction(CCSDSHandler* owner)
|
||||||
|
: TemplateAction(owner, CCSDSCommands::DISABLE_TX_CLK_MANIPULATOR) {}
|
||||||
|
};
|
||||||
|
class UpdateOnRisingEdgeAction
|
||||||
|
: public TemplateAction<CCSDSHandler, UpdateOnRisingEdgeAction, CCSDSCommands> {
|
||||||
|
public:
|
||||||
|
UpdateOnRisingEdgeAction(CCSDSHandler* owner)
|
||||||
|
: TemplateAction(owner, CCSDSCommands::UPDATE_ON_RISING_EDGE) {}
|
||||||
|
};
|
||||||
|
class UpdateOnFallingEdgeAction
|
||||||
|
: public TemplateAction<CCSDSHandler, UpdateOnFallingEdgeAction, CCSDSCommands> {
|
||||||
|
public:
|
||||||
|
UpdateOnFallingEdgeAction(CCSDSHandler* owner)
|
||||||
|
: TemplateAction(owner, CCSDSCommands::UPDATE_ON_FALLING_EDGE) {}
|
||||||
|
};
|
@ -150,6 +150,8 @@ void CCSDSHandler::readCommandQueue(void) {
|
|||||||
|
|
||||||
MessageQueueId_t CCSDSHandler::getCommandQueue() const { return commandQueue->getId(); }
|
MessageQueueId_t CCSDSHandler::getCommandQueue() const { return commandQueue->getId(); }
|
||||||
|
|
||||||
|
ActionHelper* CCSDSHandler::getActionHelper() { return &actionHelper; }
|
||||||
|
|
||||||
void CCSDSHandler::addVirtualChannel(VcId_t vcId, VirtualChannel* virtualChannel) {
|
void CCSDSHandler::addVirtualChannel(VcId_t vcId, VirtualChannel* virtualChannel) {
|
||||||
if (vcId > common::NUMBER_OF_VIRTUAL_CHANNELS) {
|
if (vcId > common::NUMBER_OF_VIRTUAL_CHANNELS) {
|
||||||
sif::warning << "CCSDSHandler::addVirtualChannel: Invalid virtual channel ID" << std::endl;
|
sif::warning << "CCSDSHandler::addVirtualChannel: Invalid virtual channel ID" << std::endl;
|
||||||
@ -201,55 +203,72 @@ MessageQueueId_t CCSDSHandler::getRequestQueue() {
|
|||||||
return tcDistributorQueueId;
|
return tcDistributorQueueId;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CCSDSHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
ReturnValue_t CCSDSHandler::executeAction(Action* action) { return action->handle(); }
|
||||||
const uint8_t* data, size_t size) {
|
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t CCSDSHandler::handleAction(SetLowRateAction* action) {
|
||||||
switch (actionId) {
|
ReturnValue_t result = ptmeConfig->setRate(RATE_100KBPS);
|
||||||
case SET_LOW_RATE: {
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
result = ptmeConfig->setRate(RATE_100KBPS);
|
return EXECUTION_FINISHED;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case SET_HIGH_RATE: {
|
return result;
|
||||||
result = ptmeConfig->setRate(RATE_500KBPS);
|
}
|
||||||
break;
|
|
||||||
|
ReturnValue_t CCSDSHandler::handleAction(SetHighRateAction* action) {
|
||||||
|
ReturnValue_t result = ptmeConfig->setRate(RATE_500KBPS);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return EXECUTION_FINISHED;
|
||||||
}
|
}
|
||||||
case ARBITRARY_RATE: {
|
return result;
|
||||||
uint32_t bitrate = 0;
|
}
|
||||||
SerializeAdapter::deSerialize(&bitrate, &data, &size, SerializeIF::Endianness::BIG);
|
|
||||||
result = ptmeConfig->setRate(bitrate);
|
ReturnValue_t CCSDSHandler::handleAction(ArbitraryRateAction* action) {
|
||||||
break;
|
ReturnValue_t result = ptmeConfig->setRate(action->bitrate);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return EXECUTION_FINISHED;
|
||||||
}
|
}
|
||||||
case EN_TRANSMITTER: {
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t CCSDSHandler::handleAction(EnTransmitterAction* action) {
|
||||||
enableTransmit();
|
enableTransmit();
|
||||||
return EXECUTION_FINISHED;
|
return EXECUTION_FINISHED;
|
||||||
}
|
}
|
||||||
case DISABLE_TRANSMITTER: {
|
|
||||||
|
ReturnValue_t CCSDSHandler::handleAction(DisableTransmitterAction* action) {
|
||||||
disableTransmit();
|
disableTransmit();
|
||||||
return EXECUTION_FINISHED;
|
return EXECUTION_FINISHED;
|
||||||
}
|
}
|
||||||
case ENABLE_TX_CLK_MANIPULATOR: {
|
|
||||||
result = ptmeConfig->configTxManipulator(true);
|
ReturnValue_t CCSDSHandler::handleAction(EnableTxClkManipulatorAction* action) {
|
||||||
break;
|
ReturnValue_t result = ptmeConfig->configTxManipulator(true);
|
||||||
}
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
case DISABLE_TX_CLK_MANIPULATOR: {
|
|
||||||
result = ptmeConfig->configTxManipulator(false);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case UPDATE_ON_RISING_EDGE: {
|
|
||||||
result = ptmeConfig->invertTxClock(false);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case UPDATE_ON_FALLING_EDGE: {
|
|
||||||
result = ptmeConfig->invertTxClock(true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return COMMAND_NOT_IMPLEMENTED;
|
|
||||||
}
|
|
||||||
if (result != RETURN_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
return EXECUTION_FINISHED;
|
return EXECUTION_FINISHED;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t CCSDSHandler::handleAction(DisableTxClkManipulatorAction* action) {
|
||||||
|
ReturnValue_t result = ptmeConfig->configTxManipulator(false);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return EXECUTION_FINISHED;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t CCSDSHandler::handleAction(UpdateOnRisingEdgeAction* action) {
|
||||||
|
ReturnValue_t result = ptmeConfig->invertTxClock(false);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return EXECUTION_FINISHED;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t CCSDSHandler::handleAction(UpdateOnFallingEdgeAction* action) {
|
||||||
|
ReturnValue_t result = ptmeConfig->invertTxClock(true);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return EXECUTION_FINISHED;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCSDSHandler::checkEvents() {
|
void CCSDSHandler::checkEvents() {
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
|
#include "CCSDSActions.h"
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
#include "VirtualChannel.h"
|
#include "VirtualChannel.h"
|
||||||
#include "fsfw/action/ActionHelper.h"
|
#include "fsfw/action/ActionHelper.h"
|
||||||
@ -76,26 +77,23 @@ class CCSDSHandler : public SystemObject,
|
|||||||
uint16_t getIdentifier() override;
|
uint16_t getIdentifier() override;
|
||||||
MessageQueueId_t getRequestQueue() override;
|
MessageQueueId_t getRequestQueue() override;
|
||||||
|
|
||||||
virtual ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
virtual ActionHelper* getActionHelper() override;
|
||||||
const uint8_t* data, size_t size);
|
virtual ReturnValue_t executeAction(Action* action);
|
||||||
|
ReturnValue_t handleAction(SetLowRateAction* action);
|
||||||
|
ReturnValue_t handleAction(SetHighRateAction* action);
|
||||||
|
ReturnValue_t handleAction(EnTransmitterAction* action);
|
||||||
|
ReturnValue_t handleAction(DisableTransmitterAction* action);
|
||||||
|
ReturnValue_t handleAction(ArbitraryRateAction* action);
|
||||||
|
ReturnValue_t handleAction(EnableTxClkManipulatorAction* action);
|
||||||
|
ReturnValue_t handleAction(DisableTxClkManipulatorAction* action);
|
||||||
|
ReturnValue_t handleAction(UpdateOnRisingEdgeAction* action);
|
||||||
|
ReturnValue_t handleAction(UpdateOnFallingEdgeAction* action);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const uint8_t INTERFACE_ID = CLASS_ID::CCSDS_HANDLER;
|
static const uint8_t INTERFACE_ID = CLASS_ID::CCSDS_HANDLER;
|
||||||
|
|
||||||
static const uint32_t QUEUE_SIZE = common::CCSDS_HANDLER_QUEUE_SIZE;
|
static const uint32_t QUEUE_SIZE = common::CCSDS_HANDLER_QUEUE_SIZE;
|
||||||
|
|
||||||
static const ActionId_t SET_LOW_RATE = 0;
|
|
||||||
static const ActionId_t SET_HIGH_RATE = 1;
|
|
||||||
static const ActionId_t EN_TRANSMITTER = 2;
|
|
||||||
static const ActionId_t DISABLE_TRANSMITTER = 3;
|
|
||||||
static const ActionId_t ARBITRARY_RATE = 4;
|
|
||||||
static const ActionId_t ENABLE_TX_CLK_MANIPULATOR = 5;
|
|
||||||
static const ActionId_t DISABLE_TX_CLK_MANIPULATOR = 6;
|
|
||||||
// Will update data with respect to tx clock signal of cadu bitstream on rising edge
|
|
||||||
static const ActionId_t UPDATE_ON_RISING_EDGE = 7;
|
|
||||||
// Will update data with respect to tx clock signal of cadu bitstream on falling edge
|
|
||||||
static const ActionId_t UPDATE_ON_FALLING_EDGE = 8;
|
|
||||||
|
|
||||||
// Syrlinks supports two bitrates (200 kbps and 1000 kbps)
|
// Syrlinks supports two bitrates (200 kbps and 1000 kbps)
|
||||||
// Due to convolutional code added by the syrlinks the input frequency must be half the
|
// Due to convolutional code added by the syrlinks the input frequency must be half the
|
||||||
// target frequency
|
// target frequency
|
||||||
|
Loading…
Reference in New Issue
Block a user