com subsystem
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit

This commit is contained in:
Robin Müller 2023-01-27 14:44:40 +01:00
parent d58e79d1ec
commit 438f9f3358
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
14 changed files with 179 additions and 80 deletions

View File

@ -580,13 +580,13 @@ void ObjectFactory::createSolarArrayDeploymentComponents(PowerSwitchIF& pwrSwitc
void ObjectFactory::createSyrlinksComponents(PowerSwitchIF* pwrSwitcher) { void ObjectFactory::createSyrlinksComponents(PowerSwitchIF* pwrSwitcher) {
auto* syrlinksUartCookie = auto* syrlinksUartCookie =
new SerialCookie(objects::SYRLINKS_HK_HANDLER, q7s::UART_SYRLINKS_DEV, uart::SYRLINKS_BAUD, new SerialCookie(objects::SYRLINKS_HANDLER, q7s::UART_SYRLINKS_DEV, uart::SYRLINKS_BAUD,
syrlinks::MAX_REPLY_SIZE, UartModes::NON_CANONICAL); syrlinks::MAX_REPLY_SIZE, UartModes::NON_CANONICAL);
syrlinksUartCookie->setParityEven(); syrlinksUartCookie->setParityEven();
auto syrlinksFdir = new SyrlinksFdir(objects::SYRLINKS_HK_HANDLER); auto syrlinksFdir = new SyrlinksFdir(objects::SYRLINKS_HANDLER);
auto syrlinksHandler = auto syrlinksHandler =
new SyrlinksHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF, syrlinksUartCookie, new SyrlinksHandler(objects::SYRLINKS_HANDLER, objects::UART_COM_IF, syrlinksUartCookie,
pcdu::PDU1_CH1_SYRLINKS_12V, syrlinksFdir); pcdu::PDU1_CH1_SYRLINKS_12V, syrlinksFdir);
syrlinksHandler->setPowerSwitcher(pwrSwitcher); syrlinksHandler->setPowerSwitcher(pwrSwitcher);
syrlinksHandler->setStartUpImmediately(); syrlinksHandler->setStartUpImmediately();

View File

@ -117,7 +117,8 @@ enum commonObjects : uint32_t {
SUS_5_N_LOC_XFYMZB_PT_ZB = 0x44120037, SUS_5_N_LOC_XFYMZB_PT_ZB = 0x44120037,
SUS_11_R_LOC_XBYMZB_PT_ZB = 0x44120043, SUS_11_R_LOC_XBYMZB_PT_ZB = 0x44120043,
SYRLINKS_HK_HANDLER = 0x445300A3, SYRLINKS_HANDLER = 0x445300A3,
CCSDS_IP_CORE_BRIDGE = 0x73500000,
/* 0x49 ('I') for Communication Interfaces */ /* 0x49 ('I') for Communication Interfaces */
SPI_RTD_COM_IF = 0x49020006, SPI_RTD_COM_IF = 0x49020006,

View File

@ -41,7 +41,7 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitch) {
new SaDeplDummy(objects::SOLAR_ARRAY_DEPL_HANDLER); new SaDeplDummy(objects::SOLAR_ARRAY_DEPL_HANDLER);
new StarTrackerDummy(objects::STAR_TRACKER, objects::DUMMY_COM_IF, comCookieDummy); new StarTrackerDummy(objects::STAR_TRACKER, objects::DUMMY_COM_IF, comCookieDummy);
if (cfg.addSyrlinksDummies) { if (cfg.addSyrlinksDummies) {
new SyrlinksDummy(objects::SYRLINKS_HK_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new SyrlinksDummy(objects::SYRLINKS_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
} }
new ImtqDummy(objects::IMTQ_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new ImtqDummy(objects::IMTQ_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
if (cfg.addPowerDummies) { if (cfg.addPowerDummies) {

View File

@ -39,8 +39,6 @@ enum sourceObjects : uint32_t {
FW_ADDRESS_END = TIME_STAMPER, FW_ADDRESS_END = TIME_STAMPER,
PUS_SERVICE_6 = 0x51000500, PUS_SERVICE_6 = 0x51000500,
CCSDS_IP_CORE_BRIDGE = 0x73500000,
/* 0x49 ('I') for Communication Interfaces **/ /* 0x49 ('I') for Communication Interfaces **/
ARDUINO_COM_IF = 0x49000000, ARDUINO_COM_IF = 0x49000000,
CSP_COM_IF = 0x49050001, CSP_COM_IF = 0x49050001,

View File

@ -487,12 +487,11 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) {
static_cast<void>(length); static_cast<void>(length);
#if OBSW_ADD_SYRLINKS == 1 #if OBSW_ADD_SYRLINKS == 1
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0, thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
#endif #endif
#if OBSW_ADD_STAR_TRACKER == 1 #if OBSW_ADD_STAR_TRACKER == 1

View File

@ -9,6 +9,17 @@ enum class Datarate : uint8_t {
NUM_DATARATES NUM_DATARATES
}; };
} enum Submode : uint8_t {
RX_ONLY,
RX_AND_TX_DEFAULT_DATARATE,
RX_AND_TX_LOW_DATARATE,
RX_AND_TX_HIGH_DATARATE,
RX_AND_TX_CW,
NUM_SUBMODES
};
enum class CcsdsSubmode : uint8_t { UNSET = 0, DATARATE_LOW = 1, DATARATE_HIGH = 2 };
} // namespace com
#endif /* MISSION_COMDEFS_H_ */ #endif /* MISSION_COMDEFS_H_ */

View File

@ -746,7 +746,7 @@ void ThermalController::copyDevices() {
{ {
lp_var_t<float> tempSyrlinksPowerAmplifier = lp_var_t<float> tempSyrlinksPowerAmplifier =
lp_var_t<float>(objects::SYRLINKS_HK_HANDLER, syrlinks::TEMP_POWER_AMPLIFIER); lp_var_t<float>(objects::SYRLINKS_HANDLER, syrlinks::TEMP_POWER_AMPLIFIER);
PoolReadGuard pg(&tempSyrlinksPowerAmplifier, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); PoolReadGuard pg(&tempSyrlinksPowerAmplifier, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) { if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read syrlinks power amplifier temperature" sif::warning << "ThermalController: Failed to read syrlinks power amplifier temperature"
@ -761,7 +761,7 @@ void ThermalController::copyDevices() {
{ {
lp_var_t<float> tempSyrlinksBasebandBoard = lp_var_t<float> tempSyrlinksBasebandBoard =
lp_var_t<float>(objects::SYRLINKS_HK_HANDLER, syrlinks::TEMP_BASEBAND_BOARD); lp_var_t<float>(objects::SYRLINKS_HANDLER, syrlinks::TEMP_BASEBAND_BOARD);
PoolReadGuard pg(&tempSyrlinksBasebandBoard, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); PoolReadGuard pg(&tempSyrlinksBasebandBoard, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT);
if (pg.getReadResult() != returnvalue::OK) { if (pg.getReadResult() != returnvalue::OK) {
sif::warning << "ThermalController: Failed to read syrlinks baseband board temperature" sif::warning << "ThermalController: Failed to read syrlinks baseband board temperature"

View File

@ -694,7 +694,7 @@ ReturnValue_t SyrlinksHandler::handleAckReply(const uint8_t* packet) {
ReturnValue_t SyrlinksHandler::isModeCombinationValid(Mode_t mode, Submode_t submode) { ReturnValue_t SyrlinksHandler::isModeCombinationValid(Mode_t mode, Submode_t submode) {
if (mode == HasModesIF::MODE_ON or mode == DeviceHandlerIF::MODE_NORMAL) { if (mode == HasModesIF::MODE_ON or mode == DeviceHandlerIF::MODE_NORMAL) {
if (submode >= syrlinks::Submode::NUM_SUBMODES) { if (submode >= com::Submode::NUM_SUBMODES) {
return HasModesIF::INVALID_SUBMODE; return HasModesIF::INVALID_SUBMODE;
} }
return returnvalue::OK; return returnvalue::OK;
@ -772,7 +772,7 @@ void SyrlinksHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
}; };
if (tgtMode == HasModesIF::MODE_ON or tgtMode == DeviceHandlerIF::MODE_NORMAL) { if (tgtMode == HasModesIF::MODE_ON or tgtMode == DeviceHandlerIF::MODE_NORMAL) {
switch (getSubmode()) { switch (getSubmode()) {
case (syrlinks::Submode::RX_AND_TX_DEFAULT_DATARATE): { case (com::Submode::RX_AND_TX_DEFAULT_DATARATE): {
if (datarateCfgRaw == static_cast<uint8_t>(com::Datarate::LOW_RATE_MODULATION_BPSK)) { if (datarateCfgRaw == static_cast<uint8_t>(com::Datarate::LOW_RATE_MODULATION_BPSK)) {
if (txOnHandler(InternalState::SELECT_MODULATION_BPSK)) { if (txOnHandler(InternalState::SELECT_MODULATION_BPSK)) {
return; return;
@ -785,23 +785,23 @@ void SyrlinksHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
} }
break; break;
} }
case (syrlinks::Submode::RX_AND_TX_LOW_DATARATE): { case (com::Submode::RX_AND_TX_LOW_DATARATE): {
if (txOnHandler(InternalState::SELECT_MODULATION_BPSK)) { if (txOnHandler(InternalState::SELECT_MODULATION_BPSK)) {
return; return;
} }
break; break;
} }
case (syrlinks::Submode::RX_AND_TX_HIGH_DATARATE): { case (com::Submode::RX_AND_TX_HIGH_DATARATE): {
if (txOnHandler(InternalState::SELECT_MODULATION_0QPSK)) { if (txOnHandler(InternalState::SELECT_MODULATION_0QPSK)) {
return; return;
} }
break; break;
} }
case (syrlinks::Submode::RX_ONLY): { case (com::Submode::RX_ONLY): {
txStandbyHandler(); txStandbyHandler();
return; return;
} }
case (syrlinks::Submode::RX_AND_TX_CW): { case (com::Submode::RX_AND_TX_CW): {
if (internalState == InternalState::IDLE) { if (internalState == InternalState::IDLE) {
internalState = InternalState::SET_TX_STANDBY; internalState = InternalState::SET_TX_STANDBY;
commandExecuted = false; commandExecuted = false;

View File

@ -8,15 +8,6 @@ namespace syrlinks {
enum class ParameterId : uint8_t { DATARATE = 0 }; enum class ParameterId : uint8_t { DATARATE = 0 };
enum Submode {
RX_ONLY,
RX_AND_TX_DEFAULT_DATARATE,
RX_AND_TX_LOW_DATARATE,
RX_AND_TX_HIGH_DATARATE,
RX_AND_TX_CW,
NUM_SUBMODES
};
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SYRLINKS; static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SYRLINKS;
static constexpr Event FDIR_REACTION_IGNORED = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM); static constexpr Event FDIR_REACTION_IGNORED = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);

View File

@ -1,2 +1,4 @@
target_sources(${LIB_EIVE_MISSION} PRIVATE acsModeTree.cpp payloadModeTree.cpp comModeTree.cpp target_sources(
tcsModeTree.cpp system.cpp util.cpp) ${LIB_EIVE_MISSION}
PRIVATE acsModeTree.cpp payloadModeTree.cpp comModeTree.cpp tcsModeTree.cpp
system.cpp util.cpp)

View File

@ -1,11 +1,12 @@
#include "comModeTree.h" #include "comModeTree.h"
#include "eive/objects.h"
#include <fsfw/devicehandlers/DeviceHandlerIF.h> #include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <fsfw/modes/HasModesIF.h> #include <fsfw/modes/HasModesIF.h>
#include <fsfw/returnvalues/returnvalue.h> #include <fsfw/returnvalues/returnvalue.h>
#include <fsfw/subsystem/Subsystem.h> #include <fsfw/subsystem/Subsystem.h>
#include "eive/objects.h"
#include "mission/comDefs.h"
#include "util.h" #include "util.h"
const auto check = subsystem::checkInsert; const auto check = subsystem::checkInsert;
@ -16,30 +17,47 @@ static const auto OFF = HasModesIF::MODE_OFF;
static const auto ON = HasModesIF::MODE_ON; static const auto ON = HasModesIF::MODE_ON;
static const auto NML = DeviceHandlerIF::MODE_NORMAL; static const auto NML = DeviceHandlerIF::MODE_NORMAL;
auto COM_SEQUENCE_TX_OFF = std::make_pair(NML << 24, FixedArrayList<ModeListEntry, 2>()); auto COM_SEQUENCE_RX_ONLY = std::make_pair(NML, FixedArrayList<ModeListEntry, 2>());
auto COM_TABLE_TX_OFF_TGT = std::make_pair((NML << 24) | 1, FixedArrayList<ModeListEntry, 1>()); auto COM_TABLE_RX_ONLY_TGT = std::make_pair((NML << 24) | 1, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_TX_OFF_TRANS = std::make_pair((NML << 24) | 2, FixedArrayList<ModeListEntry, 6>()); auto COM_TABLE_RX_ONLY_TRANS_0 =
std::make_pair((NML << 24) | 2, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_ONLY_TRANS_1 =
std::make_pair((NML << 24) | 3, FixedArrayList<ModeListEntry, 3>());
auto COM_SEQUENCE_TX_ON = std::make_pair(NML << 24, FixedArrayList<ModeListEntry, 2>()); auto COM_SEQUENCE_RX_AND_TX_LOW_RATE = std::make_pair(NML, FixedArrayList<ModeListEntry, 2>());
auto COM_TABLE_TX_ON_TGT = std::make_pair((NML << 24) | 1, FixedArrayList<ModeListEntry, 1>()); auto COM_TABLE_RX_AND_TX_LOW_RATE_TGT =
auto COM_TABLE_TX_ON_TRANS = std::make_pair((NML << 24) | 2, FixedArrayList<ModeListEntry, 6>()); std::make_pair((NML << 24) | 1, FixedArrayList<ModeListEntry, 1>());
auto COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_0 =
std::make_pair((NML << 24) | 2, FixedArrayList<ModeListEntry, 6>());
auto COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_1 =
std::make_pair((NML << 24) | 2, FixedArrayList<ModeListEntry, 6>());
auto COM_SEQUENCE_RX_AND_TX_HIGH_RATE = std::make_pair(NML, FixedArrayList<ModeListEntry, 2>());
auto COM_TABLE_RX_AND_TX_HIGH_RATE_TGT =
std::make_pair((NML << 24) | 1, FixedArrayList<ModeListEntry, 1>());
auto COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_0 =
std::make_pair((NML << 24) | 2, FixedArrayList<ModeListEntry, 6>());
auto COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_1 =
std::make_pair((NML << 24) | 2, FixedArrayList<ModeListEntry, 6>());
namespace { namespace {
void buildTxOffSequence(Subsystem& ss, ModeListEntry& eh); void buildRxOnlySequence(Subsystem& ss, ModeListEntry& eh);
void buildTxOnSequence(Subsystem& ss, ModeListEntry& eh); void buildTxAndRxLowRateSequence(Subsystem& ss, ModeListEntry& eh);
void buildTxAndRxHighRateSequence(Subsystem& ss, ModeListEntry& eh);
} // namespace } // namespace
void satsystem::com::init() { void satsystem::com::init() {
ModeListEntry entry; ModeListEntry entry;
buildTxOffSequence(SUBSYSTEM, entry); buildRxOnlySequence(SUBSYSTEM, entry);
buildTxOnSequence(SUBSYSTEM, entry); buildTxAndRxLowRateSequence(SUBSYSTEM, entry);
SUBSYSTEM.setInitialMode(NML, 0 /* TODO: Which submode? */); buildTxAndRxHighRateSequence(SUBSYSTEM, entry);
SUBSYSTEM.setInitialMode(NML, ::com::Submode::RX_ONLY);
} }
namespace { namespace {
void buildTxOffSequence(Subsystem& ss, ModeListEntry& eh) { void buildRxOnlySequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::com::buildTxOffSequence"; std::string context = "satsystem::com::buildRxOnlySequence";
auto ctxc = context.c_str(); auto ctxc = context.c_str();
// Insert Helper Table // Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table) { auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table) {
@ -57,24 +75,33 @@ void buildTxOffSequence(Subsystem& ss, ModeListEntry& eh) {
check(sequence.insert(eh), ctxc); check(sequence.insert(eh), ctxc);
}; };
// Build TX OFF table // Build RX Only table. We could track the state of the CCSDS IP core handler
iht(objects::SYRLINKS_HK_HANDLER, NML, 0/* TODO */, COM_TABLE_TX_OFF_TGT.second); // as well but I do not think this is necessary because enabling that should
check(ss.addTable(TableEntry(COM_SEQUENCE_TX_OFF.first, &COM_TABLE_TX_OFF_TGT.second)), ctxc); // not intefere with the Syrlinks Handler.
iht(objects::SYRLINKS_HANDLER, NML, ::com::Submode::RX_ONLY, COM_TABLE_RX_ONLY_TGT.second);
check(ss.addTable(TableEntry(COM_TABLE_RX_ONLY_TGT.first, &COM_TABLE_RX_ONLY_TGT.second)), ctxc);
// Build TX OFF transition // Build RX Only transition 0
iht(objects::SYRLINKS_HK_HANDLER, NML, 0/* TODO */, COM_TABLE_TX_OFF_TRANS.second); iht(objects::SYRLINKS_HANDLER, NML, ::com::Submode::RX_ONLY, COM_TABLE_RX_ONLY_TRANS_0.second);
check(ss.addTable(TableEntry(COM_SEQUENCE_TX_OFF.first, &COM_TABLE_TX_OFF_TRANS.second)), ctxc); check(ss.addTable(TableEntry(COM_TABLE_RX_ONLY_TRANS_0.first, &COM_TABLE_RX_ONLY_TRANS_0.second)),
ctxc);
// Build RX Only transition 1
iht(objects::CCSDS_IP_CORE_BRIDGE, OFF, 0, COM_TABLE_RX_ONLY_TRANS_1.second);
check(ss.addTable(TableEntry(COM_TABLE_RX_ONLY_TRANS_1.first, &COM_TABLE_RX_ONLY_TRANS_1.second)),
ctxc);
// Build TX OFF sequence // Build TX OFF sequence
ihs(COM_SEQUENCE_TX_OFF.second, COM_TABLE_TX_OFF_TGT.first, 0, false); ihs(COM_SEQUENCE_RX_ONLY.second, COM_TABLE_RX_ONLY_TGT.first, 0, true);
ihs(COM_SEQUENCE_TX_OFF.second, COM_TABLE_TX_OFF_TRANS.first, 0, false); ihs(COM_SEQUENCE_RX_ONLY.second, COM_TABLE_RX_ONLY_TRANS_0.first, 0, true);
check(ss.addSequence(SequenceEntry(COM_TABLE_TX_OFF_TRANS.first, &COM_TABLE_TX_OFF_TRANS.second, ihs(COM_SEQUENCE_RX_ONLY.second, COM_TABLE_RX_ONLY_TRANS_1.first, 0, true);
COM_TABLE_TX_OFF_TRANS.first)), check(ss.addSequence(SequenceEntry(COM_SEQUENCE_RX_ONLY.first, &COM_SEQUENCE_RX_ONLY.second,
COM_SEQUENCE_RX_ONLY.first)),
ctxc); ctxc);
} }
void buildTxOnSequence(Subsystem& ss, ModeListEntry& eh) { void buildTxAndRxLowRateSequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::com::buildTxOnSequence"; std::string context = "satsystem::com::buildTxAndRxLowRateSequence";
auto ctxc = context.c_str(); auto ctxc = context.c_str();
// Insert Helper Table // Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table) { auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table) {
@ -92,19 +119,90 @@ void buildTxOnSequence(Subsystem& ss, ModeListEntry& eh) {
check(sequence.insert(eh), ctxc); check(sequence.insert(eh), ctxc);
}; };
// Build TX ON table // Build RX and TX low datarate table.
iht(objects::SYRLINKS_HK_HANDLER, NML, /*TODO*/0, COM_TABLE_TX_ON_TGT.second); iht(objects::SYRLINKS_HANDLER, NML, ::com::Submode::RX_AND_TX_LOW_DATARATE,
check(ss.addTable(TableEntry(COM_SEQUENCE_TX_ON.first, &COM_TABLE_TX_ON_TGT.second)), ctxc); COM_TABLE_RX_AND_TX_LOW_RATE_TGT.second);
iht(objects::CCSDS_IP_CORE_BRIDGE, ON, static_cast<Submode_t>(::com::CcsdsSubmode::DATARATE_LOW),
COM_TABLE_RX_AND_TX_LOW_RATE_TGT.second);
check(ss.addTable(TableEntry(COM_TABLE_RX_AND_TX_LOW_RATE_TGT.first,
&COM_TABLE_RX_AND_TX_LOW_RATE_TGT.second)),
ctxc);
// Build TX ON transition // Build TX and RX low datarate transition 0, switch CCSDS handler first
iht(objects::SYRLINKS_HK_HANDLER, NML, /*TODO*/0, COM_TABLE_TX_ON_TRANS.second); iht(objects::CCSDS_IP_CORE_BRIDGE, ON, static_cast<Submode_t>(::com::CcsdsSubmode::DATARATE_LOW),
check(ss.addTable(TableEntry(COM_SEQUENCE_TX_ON.first, &COM_TABLE_TX_ON_TRANS.second)), ctxc); COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_0.second);
check(ss.addTable(TableEntry(COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_0.first,
&COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_0.second)),
ctxc);
// Build TX ON sequence // Build TX and RX low transition 1
ihs(COM_SEQUENCE_TX_ON.second, COM_TABLE_TX_ON_TGT.first, 0, false); iht(objects::SYRLINKS_HANDLER, NML, ::com::Submode::RX_AND_TX_LOW_DATARATE,
ihs(COM_SEQUENCE_TX_ON.second, COM_TABLE_TX_ON_TRANS.first, 0, false); COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_1.second);
check(ss.addSequence(SequenceEntry(COM_TABLE_TX_ON_TRANS.first, &COM_TABLE_TX_ON_TRANS.second, check(ss.addTable(TableEntry(COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_1.first,
COM_TABLE_TX_ON_TRANS.first)), &COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_1.second)),
ctxc);
// Build TX and RX low datarate sequence
ihs(COM_SEQUENCE_RX_AND_TX_LOW_RATE.second, COM_TABLE_RX_AND_TX_LOW_RATE_TGT.first, 0, true);
ihs(COM_SEQUENCE_RX_AND_TX_LOW_RATE.second, COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_0.first, 0, true);
ihs(COM_SEQUENCE_RX_AND_TX_LOW_RATE.second, COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_1.first, 0, true);
check(ss.addSequence(SequenceEntry(COM_SEQUENCE_RX_AND_TX_LOW_RATE.first,
&COM_SEQUENCE_RX_AND_TX_LOW_RATE.second,
COM_SEQUENCE_RX_ONLY.first)),
ctxc);
}
void buildTxAndRxHighRateSequence(Subsystem& ss, ModeListEntry& eh) {
std::string context = "satsystem::com::buildTxAndRxHighRateSequence";
auto ctxc = context.c_str();
// Insert Helper Table
auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList<ModeListEntry>& table) {
eh.setObject(obj);
eh.setMode(mode);
eh.setSubmode(submode);
check(table.insert(eh), ctxc);
};
// Insert Helper Sequence
auto ihs = [&](ArrayList<ModeListEntry>& sequence, Mode_t tableId, uint32_t waitSeconds,
bool checkSuccess) {
eh.setTableId(tableId);
eh.setWaitSeconds(waitSeconds);
eh.setCheckSuccess(checkSuccess);
check(sequence.insert(eh), ctxc);
};
// Build RX and TX low datarate table.
iht(objects::SYRLINKS_HANDLER, NML, ::com::Submode::RX_AND_TX_HIGH_DATARATE,
COM_TABLE_RX_AND_TX_HIGH_RATE_TGT.second);
iht(objects::CCSDS_IP_CORE_BRIDGE, ON, static_cast<Submode_t>(::com::CcsdsSubmode::DATARATE_HIGH),
COM_TABLE_RX_AND_TX_HIGH_RATE_TGT.second);
check(ss.addTable(TableEntry(COM_TABLE_RX_AND_TX_HIGH_RATE_TGT.first,
&COM_TABLE_RX_AND_TX_HIGH_RATE_TGT.second)),
ctxc);
// Build TX and RX low datarate transition 0, switch CCSDS handler first
iht(objects::CCSDS_IP_CORE_BRIDGE, ON, static_cast<Submode_t>(::com::CcsdsSubmode::DATARATE_HIGH),
COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_0.second);
check(ss.addTable(TableEntry(COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_0.first,
&COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_0.second)),
ctxc);
// Build TX and RX low transition 1
iht(objects::SYRLINKS_HANDLER, NML, ::com::Submode::RX_AND_TX_HIGH_DATARATE,
COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_1.second);
check(ss.addTable(TableEntry(COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_1.first,
&COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_1.second)),
ctxc);
// Build TX and RX low datarate sequence
ihs(COM_SEQUENCE_RX_AND_TX_HIGH_RATE.second, COM_TABLE_RX_AND_TX_HIGH_RATE_TGT.first, 0, true);
ihs(COM_SEQUENCE_RX_AND_TX_HIGH_RATE.second, COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_0.first, 0,
true);
ihs(COM_SEQUENCE_RX_AND_TX_HIGH_RATE.second, COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_1.first, 0,
true);
check(ss.addSequence(SequenceEntry(COM_SEQUENCE_RX_AND_TX_HIGH_RATE.first,
&COM_SEQUENCE_RX_AND_TX_HIGH_RATE.second,
COM_SEQUENCE_RX_ONLY.first)),
ctxc); ctxc);
} }

View File

@ -9,7 +9,7 @@ namespace com {
extern Subsystem SUBSYSTEM; extern Subsystem SUBSYSTEM;
void init(); void init();
} } // namespace com
} // namespace satsystem } // namespace satsystem

View File

@ -228,12 +228,12 @@ ReturnValue_t CcsdsIpCoreHandler::executeAction(ActionId_t actionId, MessageQueu
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
switch (actionId) { switch (actionId) {
case SET_LOW_RATE: { case SET_LOW_RATE: {
submode = static_cast<Submode_t>(Submode::DATARATE_LOW); submode = static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_LOW);
result = ptmeConfig->setRate(RATE_100KBPS); result = ptmeConfig->setRate(RATE_100KBPS);
break; break;
} }
case SET_HIGH_RATE: { case SET_HIGH_RATE: {
submode = static_cast<Submode_t>(Submode::DATARATE_HIGH); submode = static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_HIGH);
result = ptmeConfig->setRate(RATE_500KBPS); result = ptmeConfig->setRate(RATE_500KBPS);
break; break;
} }
@ -365,8 +365,8 @@ void CcsdsIpCoreHandler::getMode(Mode_t* mode, Submode_t* submode) {
ReturnValue_t CcsdsIpCoreHandler::checkModeCommand(Mode_t mode, Submode_t submode, ReturnValue_t CcsdsIpCoreHandler::checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t* msToReachTheMode) { uint32_t* msToReachTheMode) {
if (mode == HasModesIF::MODE_ON) { if (mode == HasModesIF::MODE_ON) {
if (submode != static_cast<Submode_t>(Submode::DATARATE_HIGH) and if (submode != static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_HIGH) and
submode != static_cast<Submode_t>(Submode::DATARATE_LOW)) { submode != static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_LOW)) {
return HasModesIF::INVALID_SUBMODE; return HasModesIF::INVALID_SUBMODE;
} }
} else if (mode != HasModesIF::MODE_OFF) { } else if (mode != HasModesIF::MODE_OFF) {
@ -379,12 +379,12 @@ ReturnValue_t CcsdsIpCoreHandler::checkModeCommand(Mode_t mode, Submode_t submod
void CcsdsIpCoreHandler::startTransition(Mode_t mode, Submode_t submode) { void CcsdsIpCoreHandler::startTransition(Mode_t mode, Submode_t submode) {
if (mode == HasModesIF::MODE_ON) { if (mode == HasModesIF::MODE_ON) {
enableTransmit(); enableTransmit();
if (submode == static_cast<Submode_t>(Submode::DATARATE_HIGH)) { if (submode == static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_HIGH)) {
ReturnValue_t result = ptmeConfig->setRate(RATE_500KBPS); ReturnValue_t result = ptmeConfig->setRate(RATE_500KBPS);
if (result == returnvalue::OK) { if (result == returnvalue::OK) {
mode = HasModesIF::MODE_ON; mode = HasModesIF::MODE_ON;
} }
} else if (submode == static_cast<Submode_t>(Submode::DATARATE_LOW)) { } else if (submode == static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_LOW)) {
ReturnValue_t result = ptmeConfig->setRate(RATE_100KBPS); ReturnValue_t result = ptmeConfig->setRate(RATE_100KBPS);
if (result == returnvalue::OK) { if (result == returnvalue::OK) {
mode = HasModesIF::MODE_ON; mode = HasModesIF::MODE_ON;

View File

@ -22,8 +22,7 @@
#include "fsfw_hal/common/gpio/GpioIF.h" #include "fsfw_hal/common/gpio/GpioIF.h"
#include "fsfw_hal/common/gpio/gpioDefinitions.h" #include "fsfw_hal/common/gpio/gpioDefinitions.h"
#include "linux/ipcore/PtmeConfig.h" #include "linux/ipcore/PtmeConfig.h"
#include "mission/comDefs.h"
enum class Submode : uint8_t { UNSET = 0, DATARATE_LOW = 1, DATARATE_HIGH = 2 };
/** /**
* @brief This class handles the data exchange with the CCSDS IP cores implemented in the * @brief This class handles the data exchange with the CCSDS IP cores implemented in the
@ -139,7 +138,7 @@ class CcsdsIpCoreHandler : public SystemObject,
ActionHelper actionHelper; ActionHelper actionHelper;
Mode_t mode = HasModesIF::MODE_OFF; Mode_t mode = HasModesIF::MODE_OFF;
Submode_t submode = static_cast<Submode_t>(Submode::UNSET); Submode_t submode = static_cast<Submode_t>(com::CcsdsSubmode::UNSET);
ModeHelper modeHelper; ModeHelper modeHelper;
MessageQueueId_t tcDistributorQueueId = MessageQueueIF::NO_QUEUE; MessageQueueId_t tcDistributorQueueId = MessageQueueIF::NO_QUEUE;