Refactoring Syrlinks COM #517

Merged
muellerr merged 7 commits from refactoring_syrlinks_com_if into develop 2023-03-24 14:49:09 +01:00
37 changed files with 364 additions and 85 deletions

View File

@ -29,6 +29,8 @@ will consitute of a breaking change warranting a new major release:
should prevent them from blocking or slowing down the system even during dumps
(at least in theory).
- STR: Fix weird issues on datalink layer data reception which sometimes occur.
- Syrlinks FDIR: Fully allow FDIR to do more recoveries. Assembly should take care of preventing
the switch to go off.
## Changed
@ -41,6 +43,10 @@ will consitute of a breaking change warranting a new major release:
- `StrHelper` renamed to `StrComHandler`, is now a `DeviceHandlerIF` directly and does not wrap
a separate UART COM interface anymore.
- TCS: Local pool variables are members now.
- Syrlinks: Create dedicated COM helper which uses a ring buffer to parse the Syrlinks datalinklayer
and should make communication more reliable even on high CPU loads.
- Syrlinks: Two communication cycles per PST.
- Fine-tuning of various task priorities.
# [v1.39.1] 2023-03-22

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 279 translations.
* @brief Auto-generated event translation file. Contains 278 translations.
* @details
* Generated on: 2023-03-22 01:14:08
* Generated on: 2023-03-24 02:13:12
*/
#include "translateEvents.h"
@ -172,7 +172,7 @@ const char *FIRMWARE_UPDATE_SUCCESSFUL_STRING = "FIRMWARE_UPDATE_SUCCESSFUL";
const char *FIRMWARE_UPDATE_FAILED_STRING = "FIRMWARE_UPDATE_FAILED";
const char *STR_HELPER_READING_REPLY_FAILED_STRING = "STR_HELPER_READING_REPLY_FAILED";
const char *STR_HELPER_COM_ERROR_STRING = "STR_HELPER_COM_ERROR";
const char *STR_HELPER_REPLY_TIMEOUT_STRING = "STR_HELPER_REPLY_TIMEOUT";
const char *STR_COM_REPLY_TIMEOUT_STRING = "STR_COM_REPLY_TIMEOUT";
const char *STR_HELPER_DEC_ERROR_STRING = "STR_HELPER_DEC_ERROR";
const char *POSITION_MISMATCH_STRING = "POSITION_MISMATCH";
const char *STR_HELPER_FILE_NOT_EXISTS_STRING = "STR_HELPER_FILE_NOT_EXISTS";
@ -617,7 +617,7 @@ const char *translateEvents(Event event) {
case (12510):
return STR_HELPER_COM_ERROR_STRING;
case (12511):
return STR_HELPER_REPLY_TIMEOUT_STRING;
return STR_COM_REPLY_TIMEOUT_STRING;
case (12513):
return STR_HELPER_DEC_ERROR_STRING;
case (12514):

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file.
* @details
* Contains 169 translations.
* Generated on: 2023-03-22 01:14:08
* Generated on: 2023-03-24 02:13:12
*/
#include "translateObjects.h"
@ -86,6 +86,7 @@ const char *RTD_13_IC16_PLPCDU_HEATSPREADER_STRING = "RTD_13_IC16_PLPCDU_HEATSPR
const char *RTD_14_IC17_TCS_BOARD_STRING = "RTD_14_IC17_TCS_BOARD";
const char *RTD_15_IC18_IMTQ_STRING = "RTD_15_IC18_IMTQ";
const char *SYRLINKS_HANDLER_STRING = "SYRLINKS_HANDLER";
const char *SYRLINKS_COM_HANDLER_STRING = "SYRLINKS_COM_HANDLER";
const char *ARDUINO_COM_IF_STRING = "ARDUINO_COM_IF";
const char *DUMMY_COM_IF_STRING = "DUMMY_COM_IF";
const char *SCEX_UART_READER_STRING = "SCEX_UART_READER";
@ -171,7 +172,6 @@ const char *LOG_STORE_AND_TM_TASK_STRING = "LOG_STORE_AND_TM_TASK";
const char *HK_STORE_AND_TM_TASK_STRING = "HK_STORE_AND_TM_TASK";
const char *CFDP_STORE_AND_TM_TASK_STRING = "CFDP_STORE_AND_TM_TASK";
const char *DOWNLINK_RAM_STORE_STRING = "DOWNLINK_RAM_STORE";
const char *CCSDS_IP_CORE_BRIDGE_STRING = "CCSDS_IP_CORE_BRIDGE";
const char *THERMAL_TEMP_INSERTER_STRING = "THERMAL_TEMP_INSERTER";
const char *DUMMY_INTERFACE_STRING = "DUMMY_INTERFACE";
const char *NO_OBJECT_STRING = "NO_OBJECT";
@ -338,6 +338,8 @@ const char *translateObject(object_id_t object) {
return RTD_15_IC18_IMTQ_STRING;
case 0x445300A3:
return SYRLINKS_HANDLER_STRING;
case 0x445300A4:
return SYRLINKS_COM_HANDLER_STRING;
case 0x49000001:
return ARDUINO_COM_IF_STRING;
case 0x49000002:
@ -508,8 +510,6 @@ const char *translateObject(object_id_t object) {
return CFDP_STORE_AND_TM_TASK_STRING;
case 0x73040004:
return DOWNLINK_RAM_STORE_STRING;
case 0x73500000:
return CCSDS_IP_CORE_BRIDGE_STRING;
case 0x90000003:
return THERMAL_TEMP_INSERTER_STRING;
case 0xCAFECAFE:

View File

@ -14,7 +14,6 @@
/*******************************************************************/
#define OBSW_ENABLE_PERIODIC_HK 0
#define OBSW_ENABLE_SYRLINKS_TRANSMIT_TIMEOUT 0
// This switch will cause the SW to command the EIVE system object to safe mode. This will
// trigger a lot of events, so it can make sense to disable this for debugging purposes
#define OBSW_COMMAND_SAFE_MODE_AT_STARTUP 1

View File

@ -4,6 +4,7 @@
#include <linux/devices/AcsBoardPolling.h>
#include <linux/devices/ImtqPollingTask.h>
#include <linux/devices/RwPollingTask.h>
#include <linux/devices/SyrlinksComHandler.h>
#include <linux/devices/startracker/StrComHandler.h>
#include <mission/devices/GyrL3gCustomHandler.h>
#include <mission/devices/MgmLis3CustomHandler.h>
@ -596,12 +597,13 @@ void ObjectFactory::createSyrlinksComponents(PowerSwitchIF* pwrSwitcher) {
syrlinks::MAX_REPLY_SIZE, UartModes::NON_CANONICAL);
syrlinksUartCookie->setParityEven();
new SyrlinksComHandler(objects::SYRLINKS_COM_HANDLER);
auto* syrlinksAssy = new SyrlinksAssembly(objects::SYRLINKS_ASSY);
syrlinksAssy->connectModeTreeParent(satsystem::com::SUBSYSTEM);
auto syrlinksFdir = new SyrlinksFdir(objects::SYRLINKS_HANDLER);
auto syrlinksHandler =
new SyrlinksHandler(objects::SYRLINKS_HANDLER, objects::UART_COM_IF, syrlinksUartCookie,
pcdu::PDU1_CH1_SYRLINKS_12V, syrlinksFdir);
new SyrlinksHandler(objects::SYRLINKS_HANDLER, objects::SYRLINKS_COM_HANDLER,
syrlinksUartCookie, pcdu::PDU1_CH1_SYRLINKS_12V, syrlinksFdir);
syrlinksHandler->setPowerSwitcher(pwrSwitcher);
syrlinksHandler->connectModeTreeParent(*syrlinksAssy);
#if OBSW_DEBUG_SYRLINKS == 1

View File

@ -82,7 +82,7 @@ void scheduling::initTasks() {
#endif
PeriodicTaskIF* coreCtrlTask = factory->createPeriodicTask(
"CORE_CTRL", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc, &RR_SCHEDULING);
"CORE_CTRL", 55, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc, &RR_SCHEDULING);
result = coreCtrlTask->addComponent(objects::CORE_CONTROLLER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER);
@ -120,18 +120,16 @@ void scheduling::initTasks() {
#if OBSW_ADD_TCPIP_SERVERS == 1
#if OBSW_ADD_TMTC_UDP_SERVER == 1
PeriodicTaskIF* udpPollingTask =
factory->createPeriodicTask("UDP_TMTC_POLLING", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0,
missedDeadlineFunc, &RR_SCHEDULING);
PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask(
"UDP_TMTC_POLLING", 0, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = udpPollingTask->addComponent(objects::UDP_TMTC_POLLING_TASK);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("UDP_POLLING", objects::UDP_TMTC_POLLING_TASK);
}
#endif
#if OBSW_ADD_TMTC_TCP_SERVER == 1
PeriodicTaskIF* tcpPollingTask =
factory->createPeriodicTask("TCP_TMTC_POLLING", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0,
missedDeadlineFunc, &RR_SCHEDULING);
PeriodicTaskIF* tcpPollingTask = factory->createPeriodicTask(
"TCP_TMTC_POLLING", 0, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = tcpPollingTask->addComponent(objects::TCP_TMTC_POLLING_TASK);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("UDP_POLLING", objects::TCP_TMTC_POLLING_TASK);
@ -208,13 +206,14 @@ void scheduling::initTasks() {
scheduling::printAddObjectError("CFDP_STORE_AND_TM", objects::CFDP_STORE_AND_TM_TASK);
}
// TODO: Use user priorities for this task.
#if OBSW_ADD_CFDP_COMPONENTS == 1
PeriodicTaskIF* cfdpTask =
factory->createPeriodicTask("CFDP_HANDLER", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4,
missedDeadlineFunc, &RR_SCHEDULING);
result = cfdpTask->addComponent(objects::CFDP_HANDLER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("CFDP Handler", objects::CFDP_HANDLER);
scheduling::printAddObjectError("CFDP", objects::CFDP_HANDLER);
}
#endif
@ -238,7 +237,7 @@ void scheduling::initTasks() {
#if OBSW_ADD_RW == 1
PeriodicTaskIF* rwPolling =
factory->createPeriodicTask("RW_POLLING_TASK", 85, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2,
factory->createPeriodicTask("RW_POLLING_TASK", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2,
0.4, missedDeadlineFunc, &RR_SCHEDULING);
result = rwPolling->addComponent(objects::RW_POLLING_TASK);
if (result != returnvalue::OK) {
@ -317,6 +316,15 @@ void scheduling::initTasks() {
}
#endif
#if OBSW_ADD_SYRLINKS == 1
PeriodicTaskIF* syrlinksCom = factory->createPeriodicTask(
"SYRLINKS_COM", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
result = syrlinksCom->addComponent(objects::SYRLINKS_COM_HANDLER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("SYRLINKS_COM", objects::SYRLINKS_COM_HANDLER);
}
#endif
#if OBSW_ADD_STAR_TRACKER == 1
// Relatively high priority to make sure STR COM works well.
PeriodicTaskIF* strHelperTask =
@ -328,6 +336,7 @@ void scheduling::initTasks() {
}
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
// TODO: Use regular scheduler for this task
#if OBSW_ADD_PLOC_MPSOC == 1
PeriodicTaskIF* mpsocHelperTask =
factory->createPeriodicTask("PLOC_MPSOC_HELPER", 0, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2,
@ -338,6 +347,7 @@ void scheduling::initTasks() {
}
#endif /* OBSW_ADD_PLOC_MPSOC */
// TODO: Use regular scheduler for this task
#if OBSW_ADD_PLOC_SUPERVISOR == 1
PeriodicTaskIF* supvHelperTask =
factory->createPeriodicTask("PLOC_SUPV_HELPER", 0, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0,
@ -349,7 +359,7 @@ void scheduling::initTasks() {
#endif /* OBSW_ADD_PLOC_SUPERVISOR */
PeriodicTaskIF* plTask = factory->createPeriodicTask(
"PL_TASK", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc, &RR_SCHEDULING);
"PL_TASK", 25, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc, &RR_SCHEDULING);
plTask->addComponent(objects::CAM_SWITCHER);
scheduling::addMpsocSupvHandlers(plTask);
scheduling::scheduleScexDev(plTask);
@ -416,6 +426,9 @@ void scheduling::initTasks() {
#if OBSW_ADD_ACS_BOARD == 1
acsBrdPolling->startTask();
#endif
#if OBSW_ADD_SYRLINKS == 1
syrlinksCom->startTask();
#endif
#if OBSW_ADD_MGT == 1
imtqPolling->startTask();
#endif
@ -486,9 +499,8 @@ void scheduling::createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction
/* Polling Sequence Table Default */
#if OBSW_ADD_SPI_TEST_CODE == 0
FixedTimeslotTaskIF* syrlinksPst =
factory.createFixedTimeslotTask("SYRLINKS", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5,
missedDeadlineFunc, &RR_SCHEDULING);
FixedTimeslotTaskIF* syrlinksPst = factory.createFixedTimeslotTask(
"SYRLINKS", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc, &RR_SCHEDULING);
result = pst::pstSyrlinks(syrlinksPst);
if (result != returnvalue::OK) {
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
@ -546,11 +558,11 @@ void scheduling::createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction
}
result = pusHighPrio->addComponent(objects::EVENT_MANAGER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
scheduling::printAddObjectError("EVENT_MGMT", objects::EVENT_MANAGER);
}
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS_9", objects::PUS_SERVICE_9_TIME_MGMT);
scheduling::printAddObjectError("PUS_TIME", objects::PUS_SERVICE_9_TIME_MGMT);
}
taskVec.push_back(pusHighPrio);

View File

@ -39,6 +39,7 @@ enum : uint8_t {
TCS_CONTROLLER = 141,
COM_SUBSYSTEM = 142,
PERSISTENT_TM_STORE = 143,
SYRLINKS_COM = 144,
COMMON_SUBSYSTEM_ID_END
};

View File

@ -123,8 +123,7 @@ enum commonObjects : uint32_t {
SUS_11_R_LOC_XBYMZB_PT_ZB = 0x44120043,
SYRLINKS_HANDLER = 0x445300A3,
// might be obsolete, was not used in Q7S FM SW
// CCSDS_IP_CORE_BRIDGE = 0x73500000,
SYRLINKS_COM_HANDLER = 0x445300A4,
/* 0x49 ('I') for Communication Interfaces */
ACS_BOARD_POLLING_TASK = 0x49060004,

View File

@ -166,7 +166,7 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
12508;0x30dc;FIRMWARE_UPDATE_FAILED;LOW;Firmware update failed;linux/devices/startracker/StrComHandler.h
12509;0x30dd;STR_HELPER_READING_REPLY_FAILED;LOW;Failed to read communication interface reply data P1: Return code of failed communication interface read call P1: Upload/download position for which the read call failed;linux/devices/startracker/StrComHandler.h
12510;0x30de;STR_HELPER_COM_ERROR;LOW;Unexpected stop of decoding sequence P1: Return code of failed communication interface read call P1: Upload/download position for which the read call failed;linux/devices/startracker/StrComHandler.h
12511;0x30df;STR_HELPER_REPLY_TIMEOUT;LOW;Star tracker did not send a valid reply for a certain timeout. P1: Position of upload or download packet for which the packet wa sent. P2: Timeout;linux/devices/startracker/StrComHandler.h
12511;0x30df;STR_COM_REPLY_TIMEOUT;LOW;Star tracker did not send a valid reply for a certain timeout. P1: Position of upload or download packet for which the packet wa sent. P2: Timeout;linux/devices/startracker/StrComHandler.h
12513;0x30e1;STR_HELPER_DEC_ERROR;LOW;Error during decoding of received reply occurred P1: Return value of decoding function P2: Position of upload/download packet, or address of flash write/read request;linux/devices/startracker/StrComHandler.h
12514;0x30e2;POSITION_MISMATCH;LOW;Position mismatch P1: The expected position and thus the position for which the image upload/download failed;linux/devices/startracker/StrComHandler.h
12515;0x30e3;STR_HELPER_FILE_NOT_EXISTS;LOW;Specified file does not exist P1: Internal state of str helper;linux/devices/startracker/StrComHandler.h
@ -239,7 +239,6 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
13630;0x353e;SUPV_UPDATE_PROGRESS;INFO;Will be triggered every 5 percent of the update progress. P1: First byte percent, third and fourth byte Sequence Count, P2: Bytes written;linux/devices/ploc/PlocSupvUartMan.h
13631;0x353f;HDLC_FRAME_REMOVAL_ERROR;INFO;No description;linux/devices/ploc/PlocSupvUartMan.h
13632;0x3540;HDLC_CRC_ERROR;INFO;No description;linux/devices/ploc/PlocSupvUartMan.h
13700;0x3584;FDIR_REACTION_IGNORED;MEDIUM;No description;mission/devices/devicedefinitions/SyrlinksDefinitions.h
13701;0x3585;TX_ON;INFO;Transmitter is on now. P1: Submode, P2: Current default datarate.;mission/devices/devicedefinitions/SyrlinksDefinitions.h
13702;0x3586;TX_OFF;INFO;Transmitter is off now.;mission/devices/devicedefinitions/SyrlinksDefinitions.h
13800;0x35e8;MISSING_PACKET;LOW;No description;mission/devices/devicedefinitions/ScexDefinitions.h

1 Event ID (dec) Event ID (hex) Name Severity Description File Path
166 12508 0x30dc FIRMWARE_UPDATE_FAILED LOW Firmware update failed linux/devices/startracker/StrComHandler.h
167 12509 0x30dd STR_HELPER_READING_REPLY_FAILED LOW Failed to read communication interface reply data P1: Return code of failed communication interface read call P1: Upload/download position for which the read call failed linux/devices/startracker/StrComHandler.h
168 12510 0x30de STR_HELPER_COM_ERROR LOW Unexpected stop of decoding sequence P1: Return code of failed communication interface read call P1: Upload/download position for which the read call failed linux/devices/startracker/StrComHandler.h
169 12511 0x30df STR_HELPER_REPLY_TIMEOUT STR_COM_REPLY_TIMEOUT LOW Star tracker did not send a valid reply for a certain timeout. P1: Position of upload or download packet for which the packet wa sent. P2: Timeout linux/devices/startracker/StrComHandler.h
170 12513 0x30e1 STR_HELPER_DEC_ERROR LOW Error during decoding of received reply occurred P1: Return value of decoding function P2: Position of upload/download packet, or address of flash write/read request linux/devices/startracker/StrComHandler.h
171 12514 0x30e2 POSITION_MISMATCH LOW Position mismatch P1: The expected position and thus the position for which the image upload/download failed linux/devices/startracker/StrComHandler.h
172 12515 0x30e3 STR_HELPER_FILE_NOT_EXISTS LOW Specified file does not exist P1: Internal state of str helper linux/devices/startracker/StrComHandler.h
239 13630 0x353e SUPV_UPDATE_PROGRESS INFO Will be triggered every 5 percent of the update progress. P1: First byte percent, third and fourth byte Sequence Count, P2: Bytes written linux/devices/ploc/PlocSupvUartMan.h
240 13631 0x353f HDLC_FRAME_REMOVAL_ERROR INFO No description linux/devices/ploc/PlocSupvUartMan.h
241 13632 0x3540 HDLC_CRC_ERROR INFO No description linux/devices/ploc/PlocSupvUartMan.h
13700 0x3584 FDIR_REACTION_IGNORED MEDIUM No description mission/devices/devicedefinitions/SyrlinksDefinitions.h
242 13701 0x3585 TX_ON INFO Transmitter is on now. P1: Submode, P2: Current default datarate. mission/devices/devicedefinitions/SyrlinksDefinitions.h
243 13702 0x3586 TX_OFF INFO Transmitter is off now. mission/devices/devicedefinitions/SyrlinksDefinitions.h
244 13800 0x35e8 MISSING_PACKET LOW No description mission/devices/devicedefinitions/ScexDefinitions.h

View File

@ -78,6 +78,7 @@
0x44420030;RTD_14_IC17_TCS_BOARD
0x44420031;RTD_15_IC18_IMTQ
0x445300A3;SYRLINKS_HANDLER
0x445300A4;SYRLINKS_COM_HANDLER
0x49000001;ARDUINO_COM_IF
0x49000002;DUMMY_COM_IF
0x49010006;SCEX_UART_READER
@ -163,7 +164,6 @@
0x73040002;HK_STORE_AND_TM_TASK
0x73040003;CFDP_STORE_AND_TM_TASK
0x73040004;DOWNLINK_RAM_STORE
0x73500000;CCSDS_IP_CORE_BRIDGE
0x90000003;THERMAL_TEMP_INSERTER
0xCAFECAFE;DUMMY_INTERFACE
0xFFFFFFFF;NO_OBJECT

1 0x42694269 TEST_TASK
78 0x44420030 RTD_14_IC17_TCS_BOARD
79 0x44420031 RTD_15_IC18_IMTQ
80 0x445300A3 SYRLINKS_HANDLER
81 0x445300A4 SYRLINKS_COM_HANDLER
82 0x49000001 ARDUINO_COM_IF
83 0x49000002 DUMMY_COM_IF
84 0x49010006 SCEX_UART_READER
164 0x73040002 HK_STORE_AND_TM_TASK
165 0x73040003 CFDP_STORE_AND_TM_TASK
166 0x73040004 DOWNLINK_RAM_STORE
0x73500000 CCSDS_IP_CORE_BRIDGE
167 0x90000003 THERMAL_TEMP_INSERTER
168 0xCAFECAFE DUMMY_INTERFACE
169 0xFFFFFFFF NO_OBJECT

View File

@ -321,6 +321,7 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
0x3404;DC_InvalidCookieType;No description;4;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h
0x3405;DC_NotActive;No description;5;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h
0x3406;DC_TooMuchData;No description;6;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h
0x3407;DC_Busy;No description;7;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h
0x3601;CFDP_InvalidTlvType;No description;1;CFDP;fsfw/src/fsfw/cfdp/definitions.h
0x3602;CFDP_InvalidDirectiveField;No description;2;CFDP;fsfw/src/fsfw/cfdp/definitions.h
0x3603;CFDP_InvalidPduDatafieldLen;No description;3;CFDP;fsfw/src/fsfw/cfdp/definitions.h

1 Full ID (hex) Name Description Unique ID Subsytem Name File Path
321 0x3404 DC_InvalidCookieType No description 4 DEVICE_COMMUNICATION_IF fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h
322 0x3405 DC_NotActive No description 5 DEVICE_COMMUNICATION_IF fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h
323 0x3406 DC_TooMuchData No description 6 DEVICE_COMMUNICATION_IF fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h
324 0x3407 DC_Busy No description 7 DEVICE_COMMUNICATION_IF fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h
325 0x3601 CFDP_InvalidTlvType No description 1 CFDP fsfw/src/fsfw/cfdp/definitions.h
326 0x3602 CFDP_InvalidDirectiveField No description 2 CFDP fsfw/src/fsfw/cfdp/definitions.h
327 0x3603 CFDP_InvalidPduDatafieldLen No description 3 CFDP fsfw/src/fsfw/cfdp/definitions.h

View File

@ -59,3 +59,4 @@
141;TCS_CONTROLLER
142;COM_SUBSYSTEM
143;PERSISTENT_TM_STORE
144;SYRLINKS_COM

1 22 MEMORY
59 141 TCS_CONTROLLER
60 142 COM_SUBSYSTEM
61 143 PERSISTENT_TM_STORE
62 144 SYRLINKS_COM

View File

@ -166,7 +166,7 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
12508;0x30dc;FIRMWARE_UPDATE_FAILED;LOW;Firmware update failed;linux/devices/startracker/StrComHandler.h
12509;0x30dd;STR_HELPER_READING_REPLY_FAILED;LOW;Failed to read communication interface reply data P1: Return code of failed communication interface read call P1: Upload/download position for which the read call failed;linux/devices/startracker/StrComHandler.h
12510;0x30de;STR_HELPER_COM_ERROR;LOW;Unexpected stop of decoding sequence P1: Return code of failed communication interface read call P1: Upload/download position for which the read call failed;linux/devices/startracker/StrComHandler.h
12511;0x30df;STR_HELPER_REPLY_TIMEOUT;LOW;Star tracker did not send a valid reply for a certain timeout. P1: Position of upload or download packet for which the packet wa sent. P2: Timeout;linux/devices/startracker/StrComHandler.h
12511;0x30df;STR_COM_REPLY_TIMEOUT;LOW;Star tracker did not send a valid reply for a certain timeout. P1: Position of upload or download packet for which the packet wa sent. P2: Timeout;linux/devices/startracker/StrComHandler.h
12513;0x30e1;STR_HELPER_DEC_ERROR;LOW;Error during decoding of received reply occurred P1: Return value of decoding function P2: Position of upload/download packet, or address of flash write/read request;linux/devices/startracker/StrComHandler.h
12514;0x30e2;POSITION_MISMATCH;LOW;Position mismatch P1: The expected position and thus the position for which the image upload/download failed;linux/devices/startracker/StrComHandler.h
12515;0x30e3;STR_HELPER_FILE_NOT_EXISTS;LOW;Specified file does not exist P1: Internal state of str helper;linux/devices/startracker/StrComHandler.h
@ -239,7 +239,6 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
13630;0x353e;SUPV_UPDATE_PROGRESS;INFO;Will be triggered every 5 percent of the update progress. P1: First byte percent, third and fourth byte Sequence Count, P2: Bytes written;linux/devices/ploc/PlocSupvUartMan.h
13631;0x353f;HDLC_FRAME_REMOVAL_ERROR;INFO;No description;linux/devices/ploc/PlocSupvUartMan.h
13632;0x3540;HDLC_CRC_ERROR;INFO;No description;linux/devices/ploc/PlocSupvUartMan.h
13700;0x3584;FDIR_REACTION_IGNORED;MEDIUM;No description;mission/devices/devicedefinitions/SyrlinksDefinitions.h
13701;0x3585;TX_ON;INFO;Transmitter is on now. P1: Submode, P2: Current default datarate.;mission/devices/devicedefinitions/SyrlinksDefinitions.h
13702;0x3586;TX_OFF;INFO;Transmitter is off now.;mission/devices/devicedefinitions/SyrlinksDefinitions.h
13800;0x35e8;MISSING_PACKET;LOW;No description;mission/devices/devicedefinitions/ScexDefinitions.h

1 Event ID (dec) Event ID (hex) Name Severity Description File Path
166 12508 0x30dc FIRMWARE_UPDATE_FAILED LOW Firmware update failed linux/devices/startracker/StrComHandler.h
167 12509 0x30dd STR_HELPER_READING_REPLY_FAILED LOW Failed to read communication interface reply data P1: Return code of failed communication interface read call P1: Upload/download position for which the read call failed linux/devices/startracker/StrComHandler.h
168 12510 0x30de STR_HELPER_COM_ERROR LOW Unexpected stop of decoding sequence P1: Return code of failed communication interface read call P1: Upload/download position for which the read call failed linux/devices/startracker/StrComHandler.h
169 12511 0x30df STR_HELPER_REPLY_TIMEOUT STR_COM_REPLY_TIMEOUT LOW Star tracker did not send a valid reply for a certain timeout. P1: Position of upload or download packet for which the packet wa sent. P2: Timeout linux/devices/startracker/StrComHandler.h
170 12513 0x30e1 STR_HELPER_DEC_ERROR LOW Error during decoding of received reply occurred P1: Return value of decoding function P2: Position of upload/download packet, or address of flash write/read request linux/devices/startracker/StrComHandler.h
171 12514 0x30e2 POSITION_MISMATCH LOW Position mismatch P1: The expected position and thus the position for which the image upload/download failed linux/devices/startracker/StrComHandler.h
172 12515 0x30e3 STR_HELPER_FILE_NOT_EXISTS LOW Specified file does not exist P1: Internal state of str helper linux/devices/startracker/StrComHandler.h
239 13630 0x353e SUPV_UPDATE_PROGRESS INFO Will be triggered every 5 percent of the update progress. P1: First byte percent, third and fourth byte Sequence Count, P2: Bytes written linux/devices/ploc/PlocSupvUartMan.h
240 13631 0x353f HDLC_FRAME_REMOVAL_ERROR INFO No description linux/devices/ploc/PlocSupvUartMan.h
241 13632 0x3540 HDLC_CRC_ERROR INFO No description linux/devices/ploc/PlocSupvUartMan.h
13700 0x3584 FDIR_REACTION_IGNORED MEDIUM No description mission/devices/devicedefinitions/SyrlinksDefinitions.h
242 13701 0x3585 TX_ON INFO Transmitter is on now. P1: Submode, P2: Current default datarate. mission/devices/devicedefinitions/SyrlinksDefinitions.h
243 13702 0x3586 TX_OFF INFO Transmitter is off now. mission/devices/devicedefinitions/SyrlinksDefinitions.h
244 13800 0x35e8 MISSING_PACKET LOW No description mission/devices/devicedefinitions/ScexDefinitions.h

View File

@ -77,6 +77,7 @@
0x44420030;RTD_14_IC17_TCS_BOARD
0x44420031;RTD_15_IC18_IMTQ
0x445300A3;SYRLINKS_HANDLER
0x445300A4;SYRLINKS_COM_HANDLER
0x49000000;ARDUINO_COM_IF
0x49010005;GPIO_IF
0x49010006;SCEX_UART_READER
@ -168,6 +169,5 @@
0x73040002;HK_STORE_AND_TM_TASK
0x73040003;CFDP_STORE_AND_TM_TASK
0x73040004;DOWNLINK_RAM_STORE
0x73500000;CCSDS_IP_CORE_BRIDGE
0x90000003;THERMAL_TEMP_INSERTER
0xFFFFFFFF;NO_OBJECT

1 0x00005060 P60DOCK_TEST_TASK
77 0x44420030 RTD_14_IC17_TCS_BOARD
78 0x44420031 RTD_15_IC18_IMTQ
79 0x445300A3 SYRLINKS_HANDLER
80 0x445300A4 SYRLINKS_COM_HANDLER
81 0x49000000 ARDUINO_COM_IF
82 0x49010005 GPIO_IF
83 0x49010006 SCEX_UART_READER
169 0x73040002 HK_STORE_AND_TM_TASK
170 0x73040003 CFDP_STORE_AND_TM_TASK
171 0x73040004 DOWNLINK_RAM_STORE
0x73500000 CCSDS_IP_CORE_BRIDGE
172 0x90000003 THERMAL_TEMP_INSERTER
173 0xFFFFFFFF NO_OBJECT

View File

@ -321,6 +321,7 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
0x3404;DC_InvalidCookieType;No description;4;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h
0x3405;DC_NotActive;No description;5;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h
0x3406;DC_TooMuchData;No description;6;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h
0x3407;DC_Busy;No description;7;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h
0x3601;CFDP_InvalidTlvType;No description;1;CFDP;fsfw/src/fsfw/cfdp/definitions.h
0x3602;CFDP_InvalidDirectiveField;No description;2;CFDP;fsfw/src/fsfw/cfdp/definitions.h
0x3603;CFDP_InvalidPduDatafieldLen;No description;3;CFDP;fsfw/src/fsfw/cfdp/definitions.h
@ -474,6 +475,7 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
0x53b7;STRH_StartrackerNotRunningFirmware;Star tracker must be in firmware mode to run this command;183;STR_HANDLER;linux/devices/startracker/StarTrackerHandler.h
0x53b8;STRH_StartrackerNotRunningBootloader;Star tracker must be in bootloader mode to run this command;184;STR_HANDLER;linux/devices/startracker/StarTrackerHandler.h
0x5400;DWLPWRON_NoReplyAvailable;No description;0;DWLPWRON_CMD;linux/devices/ImtqPollingTask.h
0x5401;DWLPWRON_NoPacketFound;No description;1;DWLPWRON_CMD;linux/devices/SyrlinksComHandler.h
0x5402;DWLPWRON_InvalidCrc;No description;2;DWLPWRON_CMD;linux/devices/ScexHelper.h
0x54e0;DWLPWRON_InvalidMode;Received command has invalid JESD mode (valid modes are 0 - 5);224;DWLPWRON_CMD;linux/devices/devicedefinitions/PlocMPSoCDefinitions.h
0x54e1;DWLPWRON_InvalidLaneRate;Received command has invalid lane rate (valid lane rate are 0 - 9);225;DWLPWRON_CMD;linux/devices/devicedefinitions/PlocMPSoCDefinitions.h
@ -491,7 +493,6 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
0x58a1;SUSS_ErrorLockMutex;No description;161;SUS_HANDLER;mission/devices/LegacySusHandler.h
0x59a0;IPCI_PapbBusy;No description;160;CCSDS_IP_CORE_BRIDGE;linux/ipcore/PapbVcInterface.h
0x5aa0;PTME_UnknownVcId;No description;160;PTME;linux/ipcore/Ptme.h
0x5c00;STRHLP_Busy;No description;0;STR_HELPER;linux/devices/startracker/StrComHandler.h
0x5c01;STRHLP_SdNotMounted;SD card specified in path string not mounted;1;STR_HELPER;linux/devices/startracker/StrComHandler.h
0x5c02;STRHLP_FileNotExists;Specified file does not exist on filesystem;2;STR_HELPER;linux/devices/startracker/StrComHandler.h
0x5c03;STRHLP_PathNotExists;Specified path does not exist;3;STR_HELPER;linux/devices/startracker/StrComHandler.h

1 Full ID (hex) Name Description Unique ID Subsytem Name File Path
321 0x3404 DC_InvalidCookieType No description 4 DEVICE_COMMUNICATION_IF fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h
322 0x3405 DC_NotActive No description 5 DEVICE_COMMUNICATION_IF fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h
323 0x3406 DC_TooMuchData No description 6 DEVICE_COMMUNICATION_IF fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h
324 0x3407 DC_Busy No description 7 DEVICE_COMMUNICATION_IF fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h
325 0x3601 CFDP_InvalidTlvType No description 1 CFDP fsfw/src/fsfw/cfdp/definitions.h
326 0x3602 CFDP_InvalidDirectiveField No description 2 CFDP fsfw/src/fsfw/cfdp/definitions.h
327 0x3603 CFDP_InvalidPduDatafieldLen No description 3 CFDP fsfw/src/fsfw/cfdp/definitions.h
475 0x53b7 STRH_StartrackerNotRunningFirmware Star tracker must be in firmware mode to run this command 183 STR_HANDLER linux/devices/startracker/StarTrackerHandler.h
476 0x53b8 STRH_StartrackerNotRunningBootloader Star tracker must be in bootloader mode to run this command 184 STR_HANDLER linux/devices/startracker/StarTrackerHandler.h
477 0x5400 DWLPWRON_NoReplyAvailable No description 0 DWLPWRON_CMD linux/devices/ImtqPollingTask.h
478 0x5401 DWLPWRON_NoPacketFound No description 1 DWLPWRON_CMD linux/devices/SyrlinksComHandler.h
479 0x5402 DWLPWRON_InvalidCrc No description 2 DWLPWRON_CMD linux/devices/ScexHelper.h
480 0x54e0 DWLPWRON_InvalidMode Received command has invalid JESD mode (valid modes are 0 - 5) 224 DWLPWRON_CMD linux/devices/devicedefinitions/PlocMPSoCDefinitions.h
481 0x54e1 DWLPWRON_InvalidLaneRate Received command has invalid lane rate (valid lane rate are 0 - 9) 225 DWLPWRON_CMD linux/devices/devicedefinitions/PlocMPSoCDefinitions.h
493 0x58a1 SUSS_ErrorLockMutex No description 161 SUS_HANDLER mission/devices/LegacySusHandler.h
494 0x59a0 IPCI_PapbBusy No description 160 CCSDS_IP_CORE_BRIDGE linux/ipcore/PapbVcInterface.h
495 0x5aa0 PTME_UnknownVcId No description 160 PTME linux/ipcore/Ptme.h
0x5c00 STRHLP_Busy No description 0 STR_HELPER linux/devices/startracker/StrComHandler.h
496 0x5c01 STRHLP_SdNotMounted SD card specified in path string not mounted 1 STR_HELPER linux/devices/startracker/StrComHandler.h
497 0x5c02 STRHLP_FileNotExists Specified file does not exist on filesystem 2 STR_HELPER linux/devices/startracker/StrComHandler.h
498 0x5c03 STRHLP_PathNotExists Specified path does not exist 3 STR_HELPER linux/devices/startracker/StrComHandler.h

View File

@ -59,3 +59,4 @@
141;TCS_CONTROLLER
142;COM_SUBSYSTEM
143;PERSISTENT_TM_STORE
144;SYRLINKS_COM

1 22 MEMORY
59 141 TCS_CONTROLLER
60 142 COM_SUBSYSTEM
61 143 PERSISTENT_TM_STORE
62 144 SYRLINKS_COM

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 279 translations.
* @brief Auto-generated event translation file. Contains 278 translations.
* @details
* Generated on: 2023-03-22 01:14:08
* Generated on: 2023-03-24 02:13:12
*/
#include "translateEvents.h"
@ -172,7 +172,7 @@ const char *FIRMWARE_UPDATE_SUCCESSFUL_STRING = "FIRMWARE_UPDATE_SUCCESSFUL";
const char *FIRMWARE_UPDATE_FAILED_STRING = "FIRMWARE_UPDATE_FAILED";
const char *STR_HELPER_READING_REPLY_FAILED_STRING = "STR_HELPER_READING_REPLY_FAILED";
const char *STR_HELPER_COM_ERROR_STRING = "STR_HELPER_COM_ERROR";
const char *STR_HELPER_REPLY_TIMEOUT_STRING = "STR_HELPER_REPLY_TIMEOUT";
const char *STR_COM_REPLY_TIMEOUT_STRING = "STR_COM_REPLY_TIMEOUT";
const char *STR_HELPER_DEC_ERROR_STRING = "STR_HELPER_DEC_ERROR";
const char *POSITION_MISMATCH_STRING = "POSITION_MISMATCH";
const char *STR_HELPER_FILE_NOT_EXISTS_STRING = "STR_HELPER_FILE_NOT_EXISTS";
@ -617,7 +617,7 @@ const char *translateEvents(Event event) {
case (12510):
return STR_HELPER_COM_ERROR_STRING;
case (12511):
return STR_HELPER_REPLY_TIMEOUT_STRING;
return STR_COM_REPLY_TIMEOUT_STRING;
case (12513):
return STR_HELPER_DEC_ERROR_STRING;
case (12514):

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file.
* @details
* Contains 173 translations.
* Generated on: 2023-03-22 01:14:08
* Generated on: 2023-03-24 02:13:12
*/
#include "translateObjects.h"
@ -85,6 +85,7 @@ const char *RTD_13_IC16_PLPCDU_HEATSPREADER_STRING = "RTD_13_IC16_PLPCDU_HEATSPR
const char *RTD_14_IC17_TCS_BOARD_STRING = "RTD_14_IC17_TCS_BOARD";
const char *RTD_15_IC18_IMTQ_STRING = "RTD_15_IC18_IMTQ";
const char *SYRLINKS_HANDLER_STRING = "SYRLINKS_HANDLER";
const char *SYRLINKS_COM_HANDLER_STRING = "SYRLINKS_COM_HANDLER";
const char *ARDUINO_COM_IF_STRING = "ARDUINO_COM_IF";
const char *GPIO_IF_STRING = "GPIO_IF";
const char *SCEX_UART_READER_STRING = "SCEX_UART_READER";
@ -176,7 +177,6 @@ const char *LOG_STORE_AND_TM_TASK_STRING = "LOG_STORE_AND_TM_TASK";
const char *HK_STORE_AND_TM_TASK_STRING = "HK_STORE_AND_TM_TASK";
const char *CFDP_STORE_AND_TM_TASK_STRING = "CFDP_STORE_AND_TM_TASK";
const char *DOWNLINK_RAM_STORE_STRING = "DOWNLINK_RAM_STORE";
const char *CCSDS_IP_CORE_BRIDGE_STRING = "CCSDS_IP_CORE_BRIDGE";
const char *THERMAL_TEMP_INSERTER_STRING = "THERMAL_TEMP_INSERTER";
const char *NO_OBJECT_STRING = "NO_OBJECT";
@ -340,6 +340,8 @@ const char *translateObject(object_id_t object) {
return RTD_15_IC18_IMTQ_STRING;
case 0x445300A3:
return SYRLINKS_HANDLER_STRING;
case 0x445300A4:
return SYRLINKS_COM_HANDLER_STRING;
case 0x49000000:
return ARDUINO_COM_IF_STRING;
case 0x49010005:
@ -522,8 +524,6 @@ const char *translateObject(object_id_t object) {
return CFDP_STORE_AND_TM_TASK_STRING;
case 0x73040004:
return DOWNLINK_RAM_STORE_STRING;
case 0x73500000:
return CCSDS_IP_CORE_BRIDGE_STRING;
case 0x90000003:
return THERMAL_TEMP_INSERTER_STRING;
case 0xFFFFFFFF:

View File

@ -221,7 +221,7 @@ ReturnValue_t AcsBoardPolling::sendMessage(CookieIF* cookie, const uint8_t* send
}
}
if (state == InternalState::IDLE) {
state = InternalState::BUSY;
state = InternalState::IS_BUSY;
}
}
semaphore->release();

View File

@ -20,7 +20,7 @@ class AcsBoardPolling : public SystemObject,
ReturnValue_t initialize() override;
private:
enum class InternalState { IDLE, BUSY } state = InternalState::IDLE;
enum class InternalState { IDLE, IS_BUSY } state = InternalState::IDLE;
MutexIF* ipcLock;
static constexpr MutexIF::TimeoutType LOCK_TYPE = MutexIF::TimeoutType::WAITING;
static constexpr uint32_t LOCK_TIMEOUT = 20;

View File

@ -11,7 +11,8 @@ target_sources(
ScexDleParser.cpp
ScexHelper.cpp
RwPollingTask.cpp
AcsBoardPolling.cpp)
AcsBoardPolling.cpp
SyrlinksComHandler.cpp)
add_subdirectory(ploc)

View File

@ -245,7 +245,7 @@ ReturnValue_t ImtqPollingTask::sendMessage(CookieIF* cookie, const uint8_t* send
if (state != InternalState::IDLE) {
return returnvalue::FAILED;
}
state = InternalState::BUSY;
state = InternalState::IS_BUSY;
}
semaphore->release();

View File

@ -23,7 +23,7 @@ class ImtqPollingTask : public SystemObject,
private:
static constexpr ReturnValue_t NO_REPLY_AVAILABLE = returnvalue::makeCode(2, 0);
enum class InternalState { IDLE, BUSY } state = InternalState::IDLE;
enum class InternalState { IDLE, IS_BUSY } state = InternalState::IDLE;
imtq::RequestType currentRequest = imtq::RequestType::MEASURE_NO_ACTUATION;
SemaphoreIF* semaphore;

View File

@ -147,7 +147,7 @@ ReturnValue_t RwPollingTask::sendMessage(CookieIF* cookie, const uint8_t* sendDa
rwCookie->currentRampTime = rampTime;
rwCookie->specialRequest = specialRequest;
if (state == InternalState::IDLE) {
state = InternalState::BUSY;
state = InternalState::IS_BUSY;
semaphore->release();
}
}

View File

@ -41,7 +41,7 @@ class RwPollingTask : public SystemObject, public ExecutableObjectIF, public Dev
ReturnValue_t initialize() override;
private:
enum class InternalState { IDLE, BUSY } state = InternalState::IDLE;
enum class InternalState { IDLE, IS_BUSY } state = InternalState::IDLE;
SemaphoreIF* semaphore;
bool debugMode = false;
bool modeAndSpeedWasSet = false;

View File

@ -77,7 +77,7 @@ ReturnValue_t SusPolling::sendMessage(CookieIF* cookie, const uint8_t* sendData,
susDevs[susIdx].mode = susReq->mode;
}
if (state == InternalState::IDLE) {
state = InternalState::BUSY;
state = InternalState::IS_BUSY;
semaphore->release();
}
return OK;

View File

@ -18,7 +18,7 @@ class SusPolling : public SystemObject, public ExecutableObjectIF, public Device
ReturnValue_t initialize() override;
private:
enum class InternalState { IDLE, BUSY } state = InternalState::IDLE;
enum class InternalState { IDLE, IS_BUSY } state = InternalState::IDLE;
struct SusDev {
SpiCookie* cookie = nullptr;

View File

@ -0,0 +1,209 @@
#include "SyrlinksComHandler.h"
#include <fcntl.h>
#include <fsfw/ipc/MutexGuard.h>
#include <fsfw/tasks/SemaphoreFactory.h>
#include <fsfw/tasks/TaskFactory.h>
#include <fsfw/timemanager/Stopwatch.h>
#include <fsfw_hal/linux/serial/SerialCookie.h>
#include <fsfw_hal/linux/serial/helper.h>
#include <unistd.h>
using namespace returnvalue;
SyrlinksComHandler::SyrlinksComHandler(object_id_t objectId)
: SystemObject(objectId), ringBuf(2048, true) {
lock = MutexFactory::instance()->createMutex();
semaphore = SemaphoreFactory::instance()->createBinarySemaphore();
semaphore->acquire();
}
ReturnValue_t SyrlinksComHandler::performOperation(uint8_t opCode) {
while (true) {
lock->lockMutex();
state = State::SLEEPING;
lock->unlockMutex();
semaphore->acquire();
// Stopwatch watch;
readOneReply();
}
return returnvalue::OK;
}
ReturnValue_t SyrlinksComHandler::initializeInterface(CookieIF *cookie) {
if (cookie == nullptr) {
return returnvalue::FAILED;
}
SerialCookie *serCookie = dynamic_cast<SerialCookie *>(cookie);
if (serCookie == nullptr) {
return DeviceCommunicationIF::INVALID_COOKIE_TYPE;
}
// comCookie = serCookie;
std::string devname = serCookie->getDeviceFile();
/* Get file descriptor */
serialPort = open(devname.c_str(), O_RDWR);
if (serialPort < 0) {
sif::warning << "SyrlinksComHandler: open call failed with error [" << errno << ", "
<< strerror(errno) << std::endl;
return returnvalue::FAILED;
}
// Setting up UART parameters
serial::setStopbits(tty, serCookie->getStopBits());
serial::setParity(tty, serCookie->getParity());
serial::setBitsPerWord(tty, BitsPerWord::BITS_8);
tty.c_cflag &= ~CRTSCTS; // Disable RTS/CTS hardware flow control
serial::enableRead(tty);
serial::ignoreCtrlLines(tty);
// Use non-canonical mode and clear echo flag
tty.c_lflag &= ~(ICANON | ECHO);
// Non-blocking mode, use polling
tty.c_cc[VTIME] = 0;
tty.c_cc[VMIN] = 0;
serial::setBaudrate(tty, serCookie->getBaudrate());
if (tcsetattr(serialPort, TCSANOW, &tty) != 0) {
sif::warning << "ScexUartReader::initializeInterface: tcsetattr call failed with error ["
<< errno << ", " << strerror(errno) << std::endl;
}
// Flush received and unread data
tcflush(serialPort, TCIOFLUSH);
return returnvalue::OK;
}
ReturnValue_t SyrlinksComHandler::sendMessage(CookieIF *cookie, const uint8_t *sendData,
size_t sendLen) {
{
MutexGuard mg(lock);
if (state != State::SLEEPING) {
return BUSY;
}
}
serial::flushRxBuf(serialPort);
ssize_t writtenBytes = write(serialPort, sendData, sendLen);
if (writtenBytes != static_cast<ssize_t>(sendLen)) {
sif::warning << "StrComHandler: Sending packet failed" << std::endl;
return returnvalue::FAILED;
}
{
MutexGuard mg(lock);
state = State::ACTIVE;
}
semaphore->release();
return returnvalue::OK;
}
ReturnValue_t SyrlinksComHandler::getSendSuccess(CookieIF *cookie) { return returnvalue::OK; }
ReturnValue_t SyrlinksComHandler::requestReceiveMessage(CookieIF *cookie, size_t requestLen) {
return returnvalue::OK;
}
ReturnValue_t SyrlinksComHandler::handleSerialReception() {
ssize_t bytesRead = read(serialPort, reinterpret_cast<void *>(recBuf.data()),
static_cast<unsigned int>(recBuf.size()));
if (bytesRead == 0) {
return NO_SERIAL_DATA_READ;
} else if (bytesRead < 0) {
sif::warning << "SyrlinksComHandler: read call failed with error [" << errno << ", "
<< strerror(errno) << "]" << std::endl;
return FAILED;
} else if (bytesRead >= static_cast<int>(recBuf.size())) {
sif::error << "SyrlinksComHandler: Receive buffer too small for " << bytesRead << " bytes"
<< std::endl;
return FAILED;
} else if (bytesRead > 0) {
// sif::debug << "Received " << bytesRead << " bytes from the Syrlinks" << std::endl;
// arrayprinter::print(recBuf.data(), bytesRead);
ringBuf.writeData(recBuf.data(), bytesRead);
}
return OK;
}
ReturnValue_t SyrlinksComHandler::readReceivedMessage(CookieIF *cookie, uint8_t **buffer,
size_t *size) {
MutexGuard mg(lock);
if (replyResult != returnvalue::OK) {
ReturnValue_t tmp = replyResult;
replyResult = returnvalue::OK;
return tmp;
}
if (replyLen == 0) {
*size = 0;
return returnvalue::OK;
}
*buffer = ipcBuf.data();
*size = replyLen;
replyLen = 0;
return returnvalue::OK;
}
ReturnValue_t SyrlinksComHandler::readOneReply() {
ReturnValue_t result;
uint32_t nextDelayMs = 1;
replyTimeout.resetTimer();
while (true) {
handleSerialReception();
result = tryReadingOneSyrlinksReply();
if (result == returnvalue::OK) {
return returnvalue::OK;
}
if (replyTimeout.hasTimedOut()) {
{
MutexGuard mg(lock);
replyResult = DeviceCommunicationIF::NO_REPLY_RECEIVED;
}
return returnvalue::FAILED;
}
TaskFactory::delayTask(nextDelayMs);
if (nextDelayMs < 32) {
nextDelayMs *= 2;
}
}
}
ReturnValue_t SyrlinksComHandler::tryReadingOneSyrlinksReply() {
size_t bytesToRead = ringBuf.getAvailableReadData();
if (bytesToRead == 0) {
return NO_PACKET_FOUND;
}
bool startMarkerFound = false;
size_t startIdx = 0;
ringBuf.readData(recBuf.data(), bytesToRead);
for (size_t idx = 0; idx < bytesToRead; idx++) {
if (recBuf[idx] == START_MARKER) {
if (startMarkerFound) {
// Probably lost a packet. Discard broken packet.
sif::warning << "SyrlinksComHandler: Detected 2 consecutive start markers" << std::endl;
ringBuf.deleteData(idx);
} else {
startMarkerFound = true;
startIdx = idx;
}
}
if (recBuf[idx] == END_MARKER) {
if (startMarkerFound) {
{
MutexGuard mg(lock);
replyLen = idx - startIdx + 1;
}
// Copy detected packet to IPC buffer so it can be passed back to the device handler.
if (replyLen > ipcBuf.size()) {
sif::error << "SyrlinksComHandler: Detected reply too large" << std::endl;
ringBuf.deleteData(idx);
return returnvalue::FAILED;
}
// sif::debug << "Detected Syrlinks reply with length " << replyLen << std::endl;
std::memcpy(ipcBuf.data(), recBuf.data() + startIdx, replyLen);
ringBuf.deleteData(idx + 1);
return returnvalue::OK;
} else {
// Probably lost a packet. Discard broken packet.
sif::warning << "SyrlinksComHandler: Detected 2 consecutive end markers" << std::endl;
ringBuf.deleteData(idx + 1);
}
}
}
return NO_PACKET_FOUND;
}

View File

@ -0,0 +1,52 @@
#ifndef LINUX_DEVICES_SYRLINKSCOMHANDLER_H_
#define LINUX_DEVICES_SYRLINKSCOMHANDLER_H_
#include <fsfw/container/SimpleRingBuffer.h>
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
#include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/tasks/ExecutableObjectIF.h>
#include <fsfw/tasks/SemaphoreIF.h>
#include <termios.h>
class SyrlinksComHandler : public DeviceCommunicationIF,
public ExecutableObjectIF,
public SystemObject {
public:
SyrlinksComHandler(object_id_t objectId);
private:
static constexpr char START_MARKER = '<';
static constexpr char END_MARKER = '>';
//! [EXPORT] : [SKIP]
static constexpr ReturnValue_t NO_SERIAL_DATA_READ = returnvalue::makeCode(2, 0);
static constexpr ReturnValue_t NO_PACKET_FOUND = returnvalue::makeCode(2, 1);
enum class State { SLEEPING, ACTIVE } state = State::SLEEPING;
MutexIF *lock;
SemaphoreIF *semaphore;
int serialPort = 0;
struct termios tty {};
Countdown replyTimeout = Countdown(2000);
std::array<uint8_t, 2048> recBuf{};
SimpleRingBuffer ringBuf;
std::array<uint8_t, 1024> ipcBuf{};
size_t replyLen = 0;
ReturnValue_t replyResult = returnvalue::OK;
ReturnValue_t handleSerialReception();
ReturnValue_t performOperation(uint8_t opCode) override;
ReturnValue_t initializeInterface(CookieIF *cookie) override;
ReturnValue_t sendMessage(CookieIF *cookie, const uint8_t *sendData, size_t sendLen) override;
ReturnValue_t getSendSuccess(CookieIF *cookie) override;
ReturnValue_t requestReceiveMessage(CookieIF *cookie, size_t requestLen) override;
ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) override;
ReturnValue_t readOneReply();
ReturnValue_t tryReadingOneSyrlinksReply();
};
#endif /* LINUX_DEVICES_SYRLINKSCOMHANDLER_H_ */

View File

@ -7,6 +7,9 @@ ArcsecDatalinkLayer::~ArcsecDatalinkLayer() {}
ReturnValue_t ArcsecDatalinkLayer::checkRingBufForFrame(const uint8_t** decodedFrame,
size_t& frameLen) {
size_t currentLen = decodeRingBuf.getAvailableReadData();
if (currentLen == 0) {
return DEC_IN_PROGRESS;
}
decodeRingBuf.readData(rxAnalysisBuffer, currentLen);
for (size_t idx = 0; idx < currentLen; idx++) {
enum arc_dec_result decResult =

View File

@ -650,10 +650,9 @@ ReturnValue_t StrComHandler::sendMessage(CookieIF* cookie, const uint8_t* sendDa
const uint8_t* txFrame;
size_t frameLen;
datalinkLayer.encodeFrame(sendData, sendLen, &txFrame, frameLen);
size_t bytesWritten = write(serialPort, txFrame, frameLen);
if (bytesWritten != frameLen) {
sif::warning << "ScexUartReader::sendMessage: Sending ping command to solar experiment failed"
<< std::endl;
ssize_t bytesWritten = write(serialPort, txFrame, frameLen);
if (bytesWritten != static_cast<ssize_t>(frameLen)) {
sif::warning << "StrComHandler: Sending packet failed" << std::endl;
return returnvalue::FAILED;
}
// Hacky, but the alternatives look bleak. The raw data contains the information we need
@ -744,12 +743,12 @@ ReturnValue_t StrComHandler::handleSerialReception() {
if (bytesRead == 0) {
return NO_SERIAL_DATA_READ;
} else if (bytesRead < 0) {
sif::warning << "PlocSupvHelper::performOperation: read call failed with error [" << errno
<< ", " << strerror(errno) << "]" << std::endl;
sif::warning << "StrComHandler: read call failed with error [" << errno << ", "
<< strerror(errno) << "]" << std::endl;
return FAILED;
} else if (bytesRead >= static_cast<int>(recBuf.size())) {
sif::error << "PlocSupvHelper::performOperation: Receive buffer too small for " << bytesRead
<< " bytes" << std::endl;
sif::error << "StrComHandler: Receive buffer too small for " << bytesRead << " bytes"
<< std::endl;
return FAILED;
} else if (bytesRead > 0) {
// sif::info << "Received " << bytesRead << " bytes from the STR" << std::endl;

View File

@ -28,7 +28,6 @@ class StrComHandler : public SystemObject, public DeviceCommunicationIF, public
public:
static const uint8_t INTERFACE_ID = CLASS_ID::STR_HELPER;
static const ReturnValue_t BUSY = MAKE_RETURN_CODE(0);
//! [EXPORT] : [COMMENT] SD card specified in path string not mounted
static const ReturnValue_t SD_NOT_MOUNTED = MAKE_RETURN_CODE(1);
//! [EXPORT] : [COMMENT] Specified file does not exist on filesystem

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 279 translations.
* @brief Auto-generated event translation file. Contains 278 translations.
* @details
* Generated on: 2023-03-22 01:14:08
* Generated on: 2023-03-24 02:13:12
*/
#include "translateEvents.h"
@ -172,7 +172,7 @@ const char *FIRMWARE_UPDATE_SUCCESSFUL_STRING = "FIRMWARE_UPDATE_SUCCESSFUL";
const char *FIRMWARE_UPDATE_FAILED_STRING = "FIRMWARE_UPDATE_FAILED";
const char *STR_HELPER_READING_REPLY_FAILED_STRING = "STR_HELPER_READING_REPLY_FAILED";
const char *STR_HELPER_COM_ERROR_STRING = "STR_HELPER_COM_ERROR";
const char *STR_HELPER_REPLY_TIMEOUT_STRING = "STR_HELPER_REPLY_TIMEOUT";
const char *STR_COM_REPLY_TIMEOUT_STRING = "STR_COM_REPLY_TIMEOUT";
const char *STR_HELPER_DEC_ERROR_STRING = "STR_HELPER_DEC_ERROR";
const char *POSITION_MISMATCH_STRING = "POSITION_MISMATCH";
const char *STR_HELPER_FILE_NOT_EXISTS_STRING = "STR_HELPER_FILE_NOT_EXISTS";
@ -617,7 +617,7 @@ const char *translateEvents(Event event) {
case (12510):
return STR_HELPER_COM_ERROR_STRING;
case (12511):
return STR_HELPER_REPLY_TIMEOUT_STRING;
return STR_COM_REPLY_TIMEOUT_STRING;
case (12513):
return STR_HELPER_DEC_ERROR_STRING;
case (12514):

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file.
* @details
* Contains 173 translations.
* Generated on: 2023-03-22 01:14:08
* Generated on: 2023-03-24 02:13:12
*/
#include "translateObjects.h"
@ -85,6 +85,7 @@ const char *RTD_13_IC16_PLPCDU_HEATSPREADER_STRING = "RTD_13_IC16_PLPCDU_HEATSPR
const char *RTD_14_IC17_TCS_BOARD_STRING = "RTD_14_IC17_TCS_BOARD";
const char *RTD_15_IC18_IMTQ_STRING = "RTD_15_IC18_IMTQ";
const char *SYRLINKS_HANDLER_STRING = "SYRLINKS_HANDLER";
const char *SYRLINKS_COM_HANDLER_STRING = "SYRLINKS_COM_HANDLER";
const char *ARDUINO_COM_IF_STRING = "ARDUINO_COM_IF";
const char *GPIO_IF_STRING = "GPIO_IF";
const char *SCEX_UART_READER_STRING = "SCEX_UART_READER";
@ -176,7 +177,6 @@ const char *LOG_STORE_AND_TM_TASK_STRING = "LOG_STORE_AND_TM_TASK";
const char *HK_STORE_AND_TM_TASK_STRING = "HK_STORE_AND_TM_TASK";
const char *CFDP_STORE_AND_TM_TASK_STRING = "CFDP_STORE_AND_TM_TASK";
const char *DOWNLINK_RAM_STORE_STRING = "DOWNLINK_RAM_STORE";
const char *CCSDS_IP_CORE_BRIDGE_STRING = "CCSDS_IP_CORE_BRIDGE";
const char *THERMAL_TEMP_INSERTER_STRING = "THERMAL_TEMP_INSERTER";
const char *NO_OBJECT_STRING = "NO_OBJECT";
@ -340,6 +340,8 @@ const char *translateObject(object_id_t object) {
return RTD_15_IC18_IMTQ_STRING;
case 0x445300A3:
return SYRLINKS_HANDLER_STRING;
case 0x445300A4:
return SYRLINKS_COM_HANDLER_STRING;
case 0x49000000:
return ARDUINO_COM_IF_STRING;
case 0x49010005:
@ -522,8 +524,6 @@ const char *translateObject(object_id_t object) {
return CFDP_STORE_AND_TM_TASK_STRING;
case 0x73040004:
return DOWNLINK_RAM_STORE_STRING;
case 0x73500000:
return CCSDS_IP_CORE_BRIDGE_STRING;
case 0x90000003:
return THERMAL_TEMP_INSERTER_STRING;
case 0xFFFFFFFF:

View File

@ -21,13 +21,15 @@
ReturnValue_t pst::pstSyrlinks(FixedTimeslotTaskIF *thisSequence) {
uint32_t length = thisSequence->getPeriodMs();
#if OBSW_ADD_SYRLINKS == 1
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.25, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.25, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.4, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
#endif
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.7, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.7, DeviceHandlerIF::GET_READ);
static_cast<void>(length);

View File

@ -10,7 +10,6 @@ enum class ParameterId : uint8_t { DATARATE = 0 };
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SYRLINKS;
static constexpr Event FDIR_REACTION_IGNORED = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
//! [EXPORT] : [COMMENT] Transmitter is on now. P1: Submode, P2: Current default datarate.
static constexpr Event TX_ON = event::makeEvent(SUBSYSTEM_ID, 1, severity::INFO);
//! [EXPORT] : [COMMENT] Transmitter is off now.

View File

@ -23,8 +23,7 @@ ReturnValue_t SyrlinksFdir::eventReceived(EventMessage* event) {
case DeviceHandlerIF::DEVICE_WANTS_HARD_REBOOT:
// We'll try a recovery as long as defined in MAX_REBOOT.
// Might cause some AssemblyBase cycles, so keep number low.
// handleRecovery(event->getEvent());
triggerEvent(syrlinks::FDIR_REACTION_IGNORED, event->getEvent(), 0);
handleRecovery(event->getEvent());
break;
case DeviceHandlerIF::DEVICE_INTERPRETING_REPLY_FAILED:
case DeviceHandlerIF::DEVICE_READING_REPLY_FAILED:
@ -33,8 +32,7 @@ ReturnValue_t SyrlinksFdir::eventReceived(EventMessage* event) {
case DeviceHandlerIF::DEVICE_BUILDING_COMMAND_FAILED:
// These faults all mean that there were stupid replies from a device.
if (strangeReplyCount.incrementAndCheck()) {
// handleRecovery(event->getEvent());
triggerEvent(syrlinks::FDIR_REACTION_IGNORED, event->getEvent(), 0);
handleRecovery(event->getEvent());
}
break;
case DeviceHandlerIF::DEVICE_SENDING_COMMAND_FAILED:
@ -48,7 +46,6 @@ ReturnValue_t SyrlinksFdir::eventReceived(EventMessage* event) {
// else
if (missedReplyCount.incrementAndCheck()) {
handleRecovery(event->getEvent());
// triggerEvent(syrlinks::FDIR_REACTION_IGNORED, event->getEvent(), 0);
}
break;
case StorageManagerIF::GET_DATA_FAILED:
@ -81,7 +78,6 @@ ReturnValue_t SyrlinksFdir::eventReceived(EventMessage* event) {
case Fuse::POWER_BELOW_LOW_LIMIT:
// Device might got stuck during boot, retry.
handleRecovery(event->getEvent());
triggerEvent(syrlinks::FDIR_REACTION_IGNORED, event->getEvent(), 0);
break;
//****Thermal*****
case ThermalComponentIF::COMPONENT_TEMP_LOW:
@ -113,14 +109,12 @@ void SyrlinksFdir::eventConfirmed(EventMessage* event) {
case DeviceHandlerIF::DEVICE_REQUESTING_REPLY_FAILED:
case DeviceHandlerIF::DEVICE_MISSED_REPLY:
if (missedReplyCount.incrementAndCheck()) {
// handleRecovery(event->getEvent());
triggerEvent(syrlinks::FDIR_REACTION_IGNORED, event->getEvent(), 0);
handleRecovery(event->getEvent());
}
break;
case PowerSwitchIF::SWITCH_WENT_OFF:
// This means the switch went off only for one device.
// handleRecovery(event->getEvent());
triggerEvent(syrlinks::FDIR_REACTION_IGNORED, event->getEvent(), 0);
handleRecovery(event->getEvent());
break;
default:
break;