2022-11-02 10:20:14 +01:00
|
|
|
#include "CcsdsIpCoreHandler.h"
|
2021-11-22 18:01:16 +01:00
|
|
|
|
2022-11-02 10:20:14 +01:00
|
|
|
#include <linux/ipcore/PdecHandler.h>
|
|
|
|
#include <linux/ipcore/PtmeConfig.h>
|
2021-09-19 12:27:48 +02:00
|
|
|
|
2022-01-17 15:58:27 +01:00
|
|
|
#include "fsfw/events/EventManagerIF.h"
|
|
|
|
#include "fsfw/ipc/QueueFactory.h"
|
|
|
|
#include "fsfw/objectmanager/ObjectManager.h"
|
2022-01-25 18:55:52 +01:00
|
|
|
#include "fsfw/serialize/SerializeAdapter.h"
|
2022-01-17 15:58:27 +01:00
|
|
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
|
|
|
#include "fsfw/serviceinterface/serviceInterfaceDefintions.h"
|
2022-05-12 18:32:19 +02:00
|
|
|
#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h"
|
|
|
|
|
2022-11-02 10:20:14 +01:00
|
|
|
CcsdsIpCoreHandler::CcsdsIpCoreHandler(object_id_t objectId, object_id_t ptmeId,
|
|
|
|
object_id_t tcDestination, PtmeConfig* ptmeConfig,
|
|
|
|
GpioIF* gpioIF, gpioId_t enTxClock, gpioId_t enTxData,
|
|
|
|
uint32_t transmitterTimeout)
|
2022-01-17 15:58:27 +01:00
|
|
|
: SystemObject(objectId),
|
|
|
|
ptmeId(ptmeId),
|
|
|
|
tcDestination(tcDestination),
|
|
|
|
parameterHelper(this),
|
|
|
|
actionHelper(this, nullptr),
|
2022-01-30 17:16:17 +01:00
|
|
|
ptmeConfig(ptmeConfig),
|
2022-01-17 15:58:27 +01:00
|
|
|
gpioIF(gpioIF),
|
|
|
|
enTxClock(enTxClock),
|
2022-03-26 13:54:05 +01:00
|
|
|
enTxData(enTxData),
|
2022-06-27 08:53:14 +02:00
|
|
|
transmitterTimeout(transmitterTimeout) {
|
2022-01-17 15:58:27 +01:00
|
|
|
commandQueue = QueueFactory::instance()->createMessageQueue(QUEUE_SIZE);
|
2022-02-19 16:42:22 +01:00
|
|
|
auto mqArgs = MqArgs(objectId, static_cast<void*>(this));
|
|
|
|
eventQueue =
|
|
|
|
QueueFactory::instance()->createMessageQueue(10, EventMessage::EVENT_MESSAGE_SIZE, &mqArgs);
|
2021-09-19 12:27:48 +02:00
|
|
|
}
|
|
|
|
|
2022-11-02 10:20:14 +01:00
|
|
|
CcsdsIpCoreHandler::~CcsdsIpCoreHandler() {}
|
2021-09-19 12:27:48 +02:00
|
|
|
|
2022-11-02 10:20:14 +01:00
|
|
|
ReturnValue_t CcsdsIpCoreHandler::performOperation(uint8_t operationCode) {
|
2022-01-17 15:58:27 +01:00
|
|
|
checkEvents();
|
|
|
|
readCommandQueue();
|
|
|
|
handleTelemetry();
|
|
|
|
handleTelecommands();
|
|
|
|
checkTxTimer();
|
2022-08-24 17:27:47 +02:00
|
|
|
return returnvalue::OK;
|
2021-09-19 12:27:48 +02:00
|
|
|
}
|
|
|
|
|
2022-11-02 10:20:14 +01:00
|
|
|
void CcsdsIpCoreHandler::handleTelemetry() {
|
2022-01-17 15:58:27 +01:00
|
|
|
VirtualChannelMapIter iter;
|
|
|
|
for (iter = virtualChannelMap.begin(); iter != virtualChannelMap.end(); iter++) {
|
|
|
|
iter->second->performOperation();
|
|
|
|
}
|
2021-09-22 16:54:55 +02:00
|
|
|
}
|
|
|
|
|
2022-11-02 10:20:14 +01:00
|
|
|
void CcsdsIpCoreHandler::handleTelecommands() {}
|
2021-09-22 16:54:55 +02:00
|
|
|
|
2022-11-02 10:20:14 +01:00
|
|
|
ReturnValue_t CcsdsIpCoreHandler::initialize() {
|
2022-08-24 17:27:47 +02:00
|
|
|
ReturnValue_t result = returnvalue::OK;
|
2022-01-17 15:58:27 +01:00
|
|
|
PtmeIF* ptme = ObjectManager::instance()->get<PtmeIF>(ptmeId);
|
|
|
|
if (ptme == nullptr) {
|
|
|
|
sif::warning << "Invalid PTME object" << std::endl;
|
|
|
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
|
|
|
}
|
|
|
|
|
|
|
|
AcceptsTelecommandsIF* tcDistributor =
|
|
|
|
ObjectManager::instance()->get<AcceptsTelecommandsIF>(tcDestination);
|
|
|
|
if (tcDistributor == nullptr) {
|
2021-11-01 12:41:20 +01:00
|
|
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
2022-11-02 10:20:14 +01:00
|
|
|
sif::error << "CcsdsHandler::initialize: Invalid TC Distributor object" << std::endl;
|
2021-11-01 12:41:20 +01:00
|
|
|
#endif
|
2022-01-17 15:58:27 +01:00
|
|
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
|
|
|
}
|
2021-11-01 12:41:20 +01:00
|
|
|
|
2022-01-17 15:58:27 +01:00
|
|
|
tcDistributorQueueId = tcDistributor->getRequestQueue();
|
2021-11-01 12:41:20 +01:00
|
|
|
|
2022-01-17 15:58:27 +01:00
|
|
|
result = parameterHelper.initialize();
|
2022-08-24 17:27:47 +02:00
|
|
|
if (result != returnvalue::OK) {
|
2022-01-17 15:58:27 +01:00
|
|
|
return result;
|
|
|
|
}
|
2021-09-29 14:47:20 +02:00
|
|
|
|
2022-01-17 15:58:27 +01:00
|
|
|
result = actionHelper.initialize(commandQueue);
|
2022-08-24 17:27:47 +02:00
|
|
|
if (result != returnvalue::OK) {
|
2022-01-17 15:58:27 +01:00
|
|
|
return result;
|
|
|
|
}
|
2021-11-21 18:07:05 +01:00
|
|
|
|
2022-01-17 15:58:27 +01:00
|
|
|
VirtualChannelMapIter iter;
|
|
|
|
for (iter = virtualChannelMap.begin(); iter != virtualChannelMap.end(); iter++) {
|
|
|
|
result = iter->second->initialize();
|
2022-08-24 17:27:47 +02:00
|
|
|
if (result != returnvalue::OK) {
|
2022-01-17 15:58:27 +01:00
|
|
|
return result;
|
2021-09-29 14:47:20 +02:00
|
|
|
}
|
2022-01-17 15:58:27 +01:00
|
|
|
iter->second->setPtmeObject(ptme);
|
|
|
|
}
|
2021-09-29 14:47:20 +02:00
|
|
|
|
2022-01-17 15:58:27 +01:00
|
|
|
EventManagerIF* manager = ObjectManager::instance()->get<EventManagerIF>(objects::EVENT_MANAGER);
|
|
|
|
if (manager == nullptr) {
|
2021-11-22 18:01:16 +01:00
|
|
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
2022-11-02 10:20:14 +01:00
|
|
|
sif::error << "CcsdsHandler::initialize: Invalid event manager" << std::endl;
|
2021-11-22 18:01:16 +01:00
|
|
|
#endif
|
2022-01-17 15:58:27 +01:00
|
|
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
|
|
|
}
|
|
|
|
result = manager->registerListener(eventQueue->getId());
|
2022-08-24 17:27:47 +02:00
|
|
|
if (result != returnvalue::OK) {
|
2021-12-02 08:05:33 +01:00
|
|
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
2022-11-02 10:20:14 +01:00
|
|
|
sif::warning << "CcsdsHandler::initialize: Failed to register CCSDS handler as event "
|
2022-01-17 15:58:27 +01:00
|
|
|
"listener"
|
|
|
|
<< std::endl;
|
2021-12-02 08:05:33 +01:00
|
|
|
#endif
|
2022-01-17 15:58:27 +01:00
|
|
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
|
|
|
;
|
|
|
|
}
|
|
|
|
result = manager->subscribeToEventRange(eventQueue->getId(),
|
|
|
|
event::getEventId(PdecHandler::CARRIER_LOCK),
|
|
|
|
event::getEventId(PdecHandler::BIT_LOCK_PDEC));
|
2022-08-24 17:27:47 +02:00
|
|
|
if (result != returnvalue::OK) {
|
2021-11-22 18:01:16 +01:00
|
|
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
2022-11-02 10:20:14 +01:00
|
|
|
sif::error << "CcsdsHandler::initialize: Failed to subscribe to events from PDEC "
|
2022-01-17 15:58:27 +01:00
|
|
|
"handler"
|
|
|
|
<< std::endl;
|
2021-11-22 18:01:16 +01:00
|
|
|
#endif
|
2022-01-17 15:58:27 +01:00
|
|
|
return result;
|
|
|
|
}
|
2022-01-30 17:16:17 +01:00
|
|
|
result = ptmeConfig->initialize();
|
2022-08-24 17:27:47 +02:00
|
|
|
if (result != returnvalue::OK) {
|
2022-01-30 17:16:17 +01:00
|
|
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
|
|
|
}
|
|
|
|
|
2022-08-24 17:27:47 +02:00
|
|
|
if (result != returnvalue::OK) {
|
2022-05-12 18:32:19 +02:00
|
|
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
|
|
|
}
|
|
|
|
|
2022-01-30 17:16:17 +01:00
|
|
|
#if OBSW_SYRLINKS_SIMULATED == 1
|
2022-06-23 12:05:56 +02:00
|
|
|
// Update data on rising edge
|
|
|
|
ptmeConfig->invertTxClock(false);
|
2022-06-23 20:12:56 +02:00
|
|
|
transmitterCountdown.setTimeout(transmitterTimeout);
|
|
|
|
linkState = UP;
|
|
|
|
forwardLinkstate();
|
2022-01-30 17:16:17 +01:00
|
|
|
#endif /* OBSW_SYRLINKS_SIMULATED == 1*/
|
|
|
|
|
2022-01-17 15:58:27 +01:00
|
|
|
return result;
|
2021-09-19 12:27:48 +02:00
|
|
|
}
|
|
|
|
|
2022-11-02 10:20:14 +01:00
|
|
|
void CcsdsIpCoreHandler::readCommandQueue(void) {
|
2022-01-17 15:58:27 +01:00
|
|
|
CommandMessage commandMessage;
|
2022-08-24 17:27:47 +02:00
|
|
|
ReturnValue_t result = returnvalue::FAILED;
|
2021-09-19 12:27:48 +02:00
|
|
|
|
2022-01-17 15:58:27 +01:00
|
|
|
result = commandQueue->receiveMessage(&commandMessage);
|
2022-08-24 17:27:47 +02:00
|
|
|
if (result == returnvalue::OK) {
|
2022-01-17 15:58:27 +01:00
|
|
|
result = parameterHelper.handleParameterMessage(&commandMessage);
|
2022-08-24 17:27:47 +02:00
|
|
|
if (result == returnvalue::OK) {
|
2022-01-17 15:58:27 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
result = actionHelper.handleActionMessage(&commandMessage);
|
2022-08-24 17:27:47 +02:00
|
|
|
if (result == returnvalue::OK) {
|
2022-01-17 15:58:27 +01:00
|
|
|
return;
|
2021-09-22 16:54:55 +02:00
|
|
|
}
|
2022-01-17 15:58:27 +01:00
|
|
|
CommandMessage reply;
|
|
|
|
reply.setReplyRejected(CommandMessage::UNKNOWN_COMMAND, commandMessage.getCommand());
|
|
|
|
commandQueue->reply(&reply);
|
|
|
|
return;
|
|
|
|
}
|
2021-09-19 12:27:48 +02:00
|
|
|
}
|
|
|
|
|
2022-11-02 10:20:14 +01:00
|
|
|
MessageQueueId_t CcsdsIpCoreHandler::getCommandQueue() const { return commandQueue->getId(); }
|
2021-09-19 12:27:48 +02:00
|
|
|
|
2022-11-02 10:20:14 +01:00
|
|
|
void CcsdsIpCoreHandler::addVirtualChannel(VcId_t vcId, VirtualChannel* virtualChannel) {
|
2022-01-17 15:58:27 +01:00
|
|
|
if (vcId > common::NUMBER_OF_VIRTUAL_CHANNELS) {
|
2022-11-02 10:20:14 +01:00
|
|
|
sif::warning << "CcsdsHandler::addVirtualChannel: Invalid virtual channel ID" << std::endl;
|
2022-01-17 15:58:27 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (virtualChannel == nullptr) {
|
2022-11-02 10:20:14 +01:00
|
|
|
sif::warning << "CcsdsHandler::addVirtualChannel: Invalid virtual channel interface"
|
2022-01-17 15:58:27 +01:00
|
|
|
<< std::endl;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto status = virtualChannelMap.emplace(vcId, virtualChannel);
|
|
|
|
if (status.second == false) {
|
2022-11-02 10:20:14 +01:00
|
|
|
sif::warning << "CcsdsHandler::addVirtualChannel: Failed to add virtual channel to "
|
2022-01-17 15:58:27 +01:00
|
|
|
"virtual channel map"
|
|
|
|
<< std::endl;
|
|
|
|
return;
|
|
|
|
}
|
2021-09-19 12:27:48 +02:00
|
|
|
}
|
|
|
|
|
2022-11-02 10:20:14 +01:00
|
|
|
MessageQueueId_t CcsdsIpCoreHandler::getReportReceptionQueue(uint8_t virtualChannel) const {
|
2022-01-17 15:58:27 +01:00
|
|
|
if (virtualChannel < common::NUMBER_OF_VIRTUAL_CHANNELS) {
|
2022-10-21 11:31:38 +02:00
|
|
|
auto iter = virtualChannelMap.find(virtualChannel);
|
2022-01-17 15:58:27 +01:00
|
|
|
if (iter != virtualChannelMap.end()) {
|
|
|
|
return iter->second->getReportReceptionQueue();
|
|
|
|
} else {
|
2022-11-02 10:20:14 +01:00
|
|
|
sif::warning << "CcsdsHandler::getReportReceptionQueue: Virtual channel with ID "
|
2022-01-17 15:58:27 +01:00
|
|
|
<< static_cast<unsigned int>(virtualChannel) << " not in virtual channel map"
|
|
|
|
<< std::endl;
|
|
|
|
return MessageQueueIF::NO_QUEUE;
|
|
|
|
}
|
|
|
|
} else {
|
2022-11-02 10:20:14 +01:00
|
|
|
sif::debug << "CcsdsHandler::getReportReceptionQueue: Invalid virtual channel requested";
|
2022-01-17 15:58:27 +01:00
|
|
|
}
|
|
|
|
return MessageQueueIF::NO_QUEUE;
|
2021-09-19 12:27:48 +02:00
|
|
|
}
|
|
|
|
|
2022-11-02 10:20:14 +01:00
|
|
|
ReturnValue_t CcsdsIpCoreHandler::getParameter(uint8_t domainId, uint8_t uniqueIdentifier,
|
|
|
|
ParameterWrapper* parameterWrapper,
|
|
|
|
const ParameterWrapper* newValues,
|
|
|
|
uint16_t startAtIndex) {
|
2022-08-24 17:27:47 +02:00
|
|
|
return returnvalue::OK;
|
2021-09-19 12:27:48 +02:00
|
|
|
}
|
2021-11-01 12:41:20 +01:00
|
|
|
|
2022-11-02 10:20:14 +01:00
|
|
|
uint32_t CcsdsIpCoreHandler::getIdentifier() const { return 0; }
|
2021-11-01 12:41:20 +01:00
|
|
|
|
2022-11-02 10:20:14 +01:00
|
|
|
MessageQueueId_t CcsdsIpCoreHandler::getRequestQueue() const {
|
2022-01-17 15:58:27 +01:00
|
|
|
// Forward packets directly to TC distributor
|
|
|
|
return tcDistributorQueueId;
|
2021-11-01 12:41:20 +01:00
|
|
|
}
|
2021-11-21 18:07:05 +01:00
|
|
|
|
2022-11-02 10:20:14 +01:00
|
|
|
ReturnValue_t CcsdsIpCoreHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
|
|
|
const uint8_t* data, size_t size) {
|
2022-08-24 17:27:47 +02:00
|
|
|
ReturnValue_t result = returnvalue::OK;
|
2022-01-17 15:58:27 +01:00
|
|
|
switch (actionId) {
|
2021-11-22 18:01:16 +01:00
|
|
|
case SET_LOW_RATE: {
|
2022-01-30 17:16:17 +01:00
|
|
|
result = ptmeConfig->setRate(RATE_100KBPS);
|
2022-01-25 18:55:52 +01:00
|
|
|
break;
|
2021-11-22 18:01:16 +01:00
|
|
|
}
|
|
|
|
case SET_HIGH_RATE: {
|
2022-01-30 17:16:17 +01:00
|
|
|
result = ptmeConfig->setRate(RATE_500KBPS);
|
2022-01-25 18:55:52 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case ARBITRARY_RATE: {
|
|
|
|
uint32_t bitrate = 0;
|
|
|
|
SerializeAdapter::deSerialize(&bitrate, &data, &size, SerializeIF::Endianness::BIG);
|
2022-01-30 17:16:17 +01:00
|
|
|
result = ptmeConfig->setRate(bitrate);
|
2022-01-25 18:55:52 +01:00
|
|
|
break;
|
2021-11-22 18:01:16 +01:00
|
|
|
}
|
|
|
|
case EN_TRANSMITTER: {
|
2022-01-17 15:58:27 +01:00
|
|
|
enableTransmit();
|
|
|
|
return EXECUTION_FINISHED;
|
2021-11-22 18:01:16 +01:00
|
|
|
}
|
2022-01-30 17:16:17 +01:00
|
|
|
case DISABLE_TRANSMITTER: {
|
2022-01-17 15:58:27 +01:00
|
|
|
disableTransmit();
|
|
|
|
return EXECUTION_FINISHED;
|
2021-11-22 18:01:16 +01:00
|
|
|
}
|
2022-01-30 17:16:17 +01:00
|
|
|
case ENABLE_TX_CLK_MANIPULATOR: {
|
|
|
|
result = ptmeConfig->configTxManipulator(true);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
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;
|
|
|
|
}
|
2021-11-21 18:07:05 +01:00
|
|
|
default:
|
2022-01-17 15:58:27 +01:00
|
|
|
return COMMAND_NOT_IMPLEMENTED;
|
|
|
|
}
|
2022-08-24 17:27:47 +02:00
|
|
|
if (result != returnvalue::OK) {
|
2022-01-26 17:59:31 +01:00
|
|
|
return result;
|
2022-01-25 18:55:52 +01:00
|
|
|
}
|
|
|
|
return EXECUTION_FINISHED;
|
2021-11-21 18:07:05 +01:00
|
|
|
}
|
2021-11-22 18:01:16 +01:00
|
|
|
|
2022-11-02 10:20:14 +01:00
|
|
|
void CcsdsIpCoreHandler::checkEvents() {
|
2022-01-17 15:58:27 +01:00
|
|
|
EventMessage event;
|
2022-08-24 17:27:47 +02:00
|
|
|
for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == returnvalue::OK;
|
2022-01-17 15:58:27 +01:00
|
|
|
result = eventQueue->receiveMessage(&event)) {
|
|
|
|
switch (event.getMessageId()) {
|
|
|
|
case EventMessage::EVENT_MESSAGE:
|
|
|
|
handleEvent(&event);
|
|
|
|
break;
|
|
|
|
default:
|
2022-11-02 10:20:14 +01:00
|
|
|
sif::debug << "CcsdsHandler::checkEvents: Did not subscribe to this event message"
|
2022-01-17 15:58:27 +01:00
|
|
|
<< std::endl;
|
|
|
|
break;
|
2021-11-22 18:01:16 +01:00
|
|
|
}
|
2022-01-17 15:58:27 +01:00
|
|
|
}
|
2021-11-22 18:01:16 +01:00
|
|
|
}
|
|
|
|
|
2022-11-02 10:20:14 +01:00
|
|
|
void CcsdsIpCoreHandler::handleEvent(EventMessage* eventMessage) {
|
2022-01-17 15:58:27 +01:00
|
|
|
Event event = eventMessage->getEvent();
|
|
|
|
switch (event) {
|
2021-11-25 14:09:06 +01:00
|
|
|
case PdecHandler::BIT_LOCK_PDEC: {
|
2022-01-17 15:58:27 +01:00
|
|
|
handleBitLockEvent();
|
|
|
|
break;
|
2021-11-22 18:01:16 +01:00
|
|
|
}
|
|
|
|
case PdecHandler::CARRIER_LOCK: {
|
2022-01-17 15:58:27 +01:00
|
|
|
handleCarrierLockEvent();
|
|
|
|
break;
|
2021-11-22 18:01:16 +01:00
|
|
|
}
|
|
|
|
default:
|
2022-11-02 10:20:14 +01:00
|
|
|
sif::debug << "CcsdsHandler::handleEvent: Did not subscribe to this event" << std::endl;
|
2022-01-17 15:58:27 +01:00
|
|
|
break;
|
|
|
|
}
|
2021-11-22 18:01:16 +01:00
|
|
|
}
|
|
|
|
|
2022-11-02 10:20:14 +01:00
|
|
|
void CcsdsIpCoreHandler::handleBitLockEvent() {
|
2022-01-17 15:58:27 +01:00
|
|
|
if (transmitterCountdown.isBusy()) {
|
|
|
|
// Transmitter already enabled
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
enableTransmit();
|
2021-11-22 18:01:16 +01:00
|
|
|
}
|
|
|
|
|
2022-11-02 10:20:14 +01:00
|
|
|
void CcsdsIpCoreHandler::handleCarrierLockEvent() {
|
2022-01-17 15:58:27 +01:00
|
|
|
if (!enableTxWhenCarrierLock) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
enableTransmit();
|
2021-11-22 18:01:16 +01:00
|
|
|
}
|
|
|
|
|
2022-11-02 10:20:14 +01:00
|
|
|
void CcsdsIpCoreHandler::forwardLinkstate() {
|
2022-01-17 15:58:27 +01:00
|
|
|
VirtualChannelMapIter iter;
|
|
|
|
for (iter = virtualChannelMap.begin(); iter != virtualChannelMap.end(); iter++) {
|
|
|
|
iter->second->setLinkState(linkState);
|
|
|
|
}
|
2021-11-22 18:01:16 +01:00
|
|
|
}
|
|
|
|
|
2022-11-02 10:20:14 +01:00
|
|
|
void CcsdsIpCoreHandler::enableTransmit() {
|
2022-01-17 15:58:27 +01:00
|
|
|
if (transmitterCountdown.isBusy()) {
|
|
|
|
// Transmitter already enabled
|
|
|
|
return;
|
|
|
|
}
|
2022-03-30 18:11:21 +02:00
|
|
|
#ifndef TE0720_1CFA
|
2022-01-17 15:58:27 +01:00
|
|
|
gpioIF->pullHigh(enTxClock);
|
|
|
|
gpioIF->pullHigh(enTxData);
|
2022-06-23 20:12:56 +02:00
|
|
|
#endif
|
2021-11-22 18:01:16 +01:00
|
|
|
}
|
|
|
|
|
2022-11-02 10:20:14 +01:00
|
|
|
void CcsdsIpCoreHandler::checkTxTimer() {
|
2022-01-17 15:58:27 +01:00
|
|
|
if (linkState == DOWN) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (transmitterCountdown.hasTimedOut()) {
|
|
|
|
disableTransmit();
|
|
|
|
}
|
2021-11-22 18:01:16 +01:00
|
|
|
}
|
|
|
|
|
2022-11-02 10:20:14 +01:00
|
|
|
void CcsdsIpCoreHandler::disableTransmit() {
|
2022-06-23 20:12:56 +02:00
|
|
|
#ifndef TE0720_1CFA
|
2022-01-17 15:58:27 +01:00
|
|
|
gpioIF->pullLow(enTxClock);
|
|
|
|
gpioIF->pullLow(enTxData);
|
2022-06-23 20:12:56 +02:00
|
|
|
#endif
|
2022-01-17 15:58:27 +01:00
|
|
|
linkState = DOWN;
|
|
|
|
forwardLinkstate();
|
|
|
|
transmitterCountdown.setTimeout(0);
|
2021-11-22 18:01:16 +01:00
|
|
|
}
|
2022-09-16 11:43:11 +02:00
|
|
|
|
2022-11-02 10:20:14 +01:00
|
|
|
const char* CcsdsIpCoreHandler::getName() const { return "CCSDS Handler"; }
|