update SCEX code

This commit is contained in:
Robin Müller 2022-08-31 16:07:38 +02:00
parent 74d4741380
commit 839851914a
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
11 changed files with 103 additions and 78 deletions

View File

@ -215,4 +215,6 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
13701;0x3585;REBOOT_SW;MEDIUM; Software reboot occurred. Can also be a systemd reboot. P1: Current Chip, P2: Current Copy;bsp_q7s/core/CoreController.h
13702;0x3586;REBOOT_MECHANISM_TRIGGERED;MEDIUM;The reboot mechanism was triggered. P1: First 16 bits: Last Chip, Last 16 bits: Last Copy, P2: Each byte is the respective reboot count for the slots;bsp_q7s/core/CoreController.h
13703;0x3587;REBOOT_HW;MEDIUM;;bsp_q7s/core/CoreController.h
13800;0x35e8;EXPERIMENT_TIMEDOUT;LOW;;mission/devices/devicedefinitions/ScexDefinitions.h
13800;0x35e8;MISSING_PACKET;LOW;;mission/devices/devicedefinitions/ScexDefinitions.h
13801;0x35e9;EXPERIMENT_TIMEDOUT;LOW;;mission/devices/devicedefinitions/ScexDefinitions.h
13802;0x35ea;MULTI_PACKET_COMMAND_DONE;INFO;;mission/devices/devicedefinitions/ScexDefinitions.h

1 Event ID (dec) Event ID (hex) Name Severity Description File Path
215 13701 0x3585 REBOOT_SW MEDIUM Software reboot occurred. Can also be a systemd reboot. P1: Current Chip, P2: Current Copy bsp_q7s/core/CoreController.h
216 13702 0x3586 REBOOT_MECHANISM_TRIGGERED MEDIUM The reboot mechanism was triggered. P1: First 16 bits: Last Chip, Last 16 bits: Last Copy, P2: Each byte is the respective reboot count for the slots bsp_q7s/core/CoreController.h
217 13703 0x3587 REBOOT_HW MEDIUM bsp_q7s/core/CoreController.h
218 13800 0x35e8 EXPERIMENT_TIMEDOUT MISSING_PACKET LOW mission/devices/devicedefinitions/ScexDefinitions.h
219 13801 0x35e9 EXPERIMENT_TIMEDOUT LOW mission/devices/devicedefinitions/ScexDefinitions.h
220 13802 0x35ea MULTI_PACKET_COMMAND_DONE INFO mission/devices/devicedefinitions/ScexDefinitions.h

View File

@ -1,6 +1,6 @@
Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
0x0000;OK;System-wide code for ok.;0;HasReturnvaluesIF;fsfw/returnvalues/HasReturnvaluesIF.h
0x0001;Failed;Unspecified system-wide code for failed.;1;HasReturnvaluesIF;fsfw/returnvalues/HasReturnvaluesIF.h
0x0000;OK;System-wide code for ok.;0;HasReturnvaluesIF;fsfw/returnvalues/returnvalue.h
0x0001;Failed;Unspecified system-wide code for failed.;1;HasReturnvaluesIF;fsfw/returnvalues/returnvalue.h
0x63a0;NVMB_KeyNotExists;Specified key does not exist in json file;160;NVM_PARAM_BASE;mission/memory/NVMParameterBase.h
0x58a0;SUSS_ErrorUnlockMutex;;160;SUS_HANDLER;mission/devices/SusHandler.h
0x58a1;SUSS_ErrorLockMutex;;161;SUS_HANDLER;mission/devices/SusHandler.h
@ -361,8 +361,9 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
0x2cd2;CCS_TooShortBlockedPacket;;210;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h
0x2cd3;CCS_TooShortMapExtraction;;211;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h
0x4201;PUS11_InvalidTypeTimeWindow;;1;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h
0x4202;PUS11_TimeshiftingNotPossible;;2;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h
0x4203;PUS11_InvalidRelativeTime;;3;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h
0x4202;PUS11_InvalidTimeWindow;;2;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h
0x4203;PUS11_TimeshiftingNotPossible;;3;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h
0x4204;PUS11_InvalidRelativeTime;;4;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h
0x3401;DC_NoReplyReceived;;1;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h
0x3402;DC_ProtocolError;;2;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h
0x3403;DC_Nullpointer;;3;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h

1 Full ID (hex) Name Description Unique ID Subsytem Name File Path
2 0x0000 OK System-wide code for ok. 0 HasReturnvaluesIF fsfw/returnvalues/HasReturnvaluesIF.h fsfw/returnvalues/returnvalue.h
3 0x0001 Failed Unspecified system-wide code for failed. 1 HasReturnvaluesIF fsfw/returnvalues/HasReturnvaluesIF.h fsfw/returnvalues/returnvalue.h
4 0x63a0 NVMB_KeyNotExists Specified key does not exist in json file 160 NVM_PARAM_BASE mission/memory/NVMParameterBase.h
5 0x58a0 SUSS_ErrorUnlockMutex 160 SUS_HANDLER mission/devices/SusHandler.h
6 0x58a1 SUSS_ErrorLockMutex 161 SUS_HANDLER mission/devices/SusHandler.h
361 0x2cd2 CCS_TooShortBlockedPacket 210 CCSDS_HANDLER_IF fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h
362 0x2cd3 CCS_TooShortMapExtraction 211 CCSDS_HANDLER_IF fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h
363 0x4201 PUS11_InvalidTypeTimeWindow 1 PUS_SERVICE_11 fsfw/src/fsfw/pus/Service11TelecommandScheduling.h
364 0x4202 PUS11_TimeshiftingNotPossible PUS11_InvalidTimeWindow 2 PUS_SERVICE_11 fsfw/src/fsfw/pus/Service11TelecommandScheduling.h
365 0x4203 PUS11_InvalidRelativeTime PUS11_TimeshiftingNotPossible 3 PUS_SERVICE_11 fsfw/src/fsfw/pus/Service11TelecommandScheduling.h
366 0x4204 PUS11_InvalidRelativeTime 4 PUS_SERVICE_11 fsfw/src/fsfw/pus/Service11TelecommandScheduling.h
367 0x3401 DC_NoReplyReceived 1 DEVICE_COMMUNICATION_IF fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h
368 0x3402 DC_ProtocolError 2 DEVICE_COMMUNICATION_IF fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h
369 0x3403 DC_Nullpointer 3 DEVICE_COMMUNICATION_IF fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 217 translations.
* @brief Auto-generated event translation file. Contains 219 translations.
* @details
* Generated on: 2022-08-24 16:53:50
* Generated on: 2022-08-31 16:07:07
*/
#include "translateEvents.h"
@ -217,7 +217,9 @@ const char *ALLOC_FAILURE_STRING = "ALLOC_FAILURE";
const char *REBOOT_SW_STRING = "REBOOT_SW";
const char *REBOOT_MECHANISM_TRIGGERED_STRING = "REBOOT_MECHANISM_TRIGGERED";
const char *REBOOT_HW_STRING = "REBOOT_HW";
const char *MISSING_PACKET_STRING = "MISSING_PACKET";
const char *EXPERIMENT_TIMEDOUT_STRING = "EXPERIMENT_TIMEDOUT";
const char *MULTI_PACKET_COMMAND_DONE_STRING = "MULTI_PACKET_COMMAND_DONE";
const char *translateEvents(Event event) {
switch ((event & 0xFFFF)) {
@ -646,7 +648,11 @@ const char *translateEvents(Event event) {
case (13703):
return REBOOT_HW_STRING;
case (13800):
return MISSING_PACKET_STRING;
case (13801):
return EXPERIMENT_TIMEDOUT_STRING;
case (13802):
return MULTI_PACKET_COMMAND_DONE_STRING;
default:
return "UNKNOWN_EVENT";
}

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file.
* @details
* Contains 135 translations.
* Generated on: 2022-08-24 16:53:50
* Generated on: 2022-08-31 16:07:07
*/
#include "translateObjects.h"

View File

@ -34,7 +34,6 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) {
lock->unlockMutex();
while (true) {
semaphore->acquire();
sif::info << "ScexUartReader::performOperation:task was started" << std::endl;
int bytesRead = 0;
while (true) {
bytesRead = read(serialPort, reinterpret_cast<void *>(recBuf.data()),
@ -66,8 +65,6 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) {
}
}
};
// task block comes here
sif::info << "ScexUartReader::performOperation: task was stopped" << std::endl;
}
return OK;
}

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 217 translations.
* @brief Auto-generated event translation file. Contains 219 translations.
* @details
* Generated on: 2022-08-24 16:53:50
* Generated on: 2022-08-31 16:07:07
*/
#include "translateEvents.h"
@ -217,7 +217,9 @@ const char *ALLOC_FAILURE_STRING = "ALLOC_FAILURE";
const char *REBOOT_SW_STRING = "REBOOT_SW";
const char *REBOOT_MECHANISM_TRIGGERED_STRING = "REBOOT_MECHANISM_TRIGGERED";
const char *REBOOT_HW_STRING = "REBOOT_HW";
const char *MISSING_PACKET_STRING = "MISSING_PACKET";
const char *EXPERIMENT_TIMEDOUT_STRING = "EXPERIMENT_TIMEDOUT";
const char *MULTI_PACKET_COMMAND_DONE_STRING = "MULTI_PACKET_COMMAND_DONE";
const char *translateEvents(Event event) {
switch ((event & 0xFFFF)) {
@ -646,7 +648,11 @@ const char *translateEvents(Event event) {
case (13703):
return REBOOT_HW_STRING;
case (13800):
return MISSING_PACKET_STRING;
case (13801):
return EXPERIMENT_TIMEDOUT_STRING;
case (13802):
return MULTI_PACKET_COMMAND_DONE_STRING;
default:
return "UNKNOWN_EVENT";
}

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file.
* @details
* Contains 135 translations.
* Generated on: 2022-08-24 16:53:50
* Generated on: 2022-08-31 16:07:07
*/
#include "translateObjects.h"

View File

@ -94,9 +94,7 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen,
{commandData + 1, commandDataLen - 1}, tempCheck);
// auto iter = deviceReplyMap.find(FRAM);
// auto& info = iter->second.command->second;
// actionHelper.finish(true,info.sendReplyTo, iter->first, OK);
updatePeriodicReply(true, deviceCommand);
break;
}
case (ONE_CELL): {
@ -105,6 +103,7 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic
finishCountdown.resetTimer();
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen,
{commandData + 1, commandDataLen - 1}, tempCheck);
updatePeriodicReply(true, deviceCommand);
break;
}
case (ALL_CELLS_CMD): {
@ -113,6 +112,7 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic
finishCountdown.resetTimer();
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen,
{commandData + 1, commandDataLen - 1}, tempCheck);
updatePeriodicReply(true, deviceCommand);
break;
}
default: {
@ -130,11 +130,11 @@ void ScexDeviceHandler::fillCommandAndReplyMap() {
insertInCommandAndReplyMap(scex::Cmds::TEMP_CMD, 3);
insertInCommandAndReplyMap(scex::Cmds::EXP_STATUS_CMD, 3);
insertInCommandAndReplyMap(scex::Cmds::ALL_CELLS_CMD, 0, nullptr, 0, false, false,
insertInCommandAndReplyMap(scex::Cmds::ALL_CELLS_CMD, 0, nullptr, 0, true, false,
scex::Cmds::ALL_CELLS_CMD, &finishCountdown);
insertInCommandAndReplyMap(scex::Cmds::ONE_CELL, 0, nullptr, 0, false, false,
insertInCommandAndReplyMap(scex::Cmds::ONE_CELL, 0, nullptr, 0, true, false,
scex::Cmds::ONE_CELL, &finishCountdown);
insertInCommandAndReplyMap(scex::Cmds::FRAM, 0, nullptr, 0, false, false, scex::Cmds::FRAM,
insertInCommandAndReplyMap(scex::Cmds::FRAM, 0, nullptr, 0, true, false, scex::Cmds::FRAM,
&finishCountdown);
insertInReplyMap(scex::Cmds::ERROR_REPLY, 3);
@ -167,6 +167,56 @@ ReturnValue_t ScexDeviceHandler::handleValidReply(size_t remSize, DeviceCommandI
size_t* foundLen) {
using namespace scex;
ReturnValue_t result = OK;
switch (helper.getCmd()) {
case (FRAM): {
if (debugMode) {
uint32_t remainingMillis = finishCountdown.getRemainingMillis();
sif::info << "ScexDeviceHandler::handleValidReply: RemMillis: " << remainingMillis
<< std::endl;
}
actionHelper.finish(true, getCommanderQueueId(FRAM), FRAM, result);
result = APERIODIC_REPLY;
break;
}
case (ONE_CELL): {
actionHelper.finish(true, getCommanderQueueId(ONE_CELL), ONE_CELL, result);
result = APERIODIC_REPLY;
break;
}
case (ALL_CELLS_CMD): {
actionHelper.finish(true, getCommanderQueueId(ALL_CELLS_CMD), ALL_CELLS_CMD, result);
result = APERIODIC_REPLY;
break;
}
default: {
break;
}
}
*foundId = helper.getCmd();
*foundLen = remSize;
return result;
}
ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) {
using namespace scex;
ReturnValue_t status = OK;
auto oneFileHandler = [&](std::string cmdName) {
fileId = date_time_string();
std::ostringstream oss("/tmp/scex-", std::ostringstream::ate);
oss << cmdName << fileId << ".bin";
fileName = oss.str();
ofstream out(fileName, ofstream::binary);
if (out.bad()) {
sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName
<< std::endl;
return FAILED;
}
out << helper;
return OK;
};
auto multiFileHandler = [&](std::string cmdName) {
if ((helper.getPacketCounter() == 1) or (not fileNameSet)) {
fileId = date_time_string();
@ -191,59 +241,8 @@ ReturnValue_t ScexDeviceHandler::handleValidReply(size_t remSize, DeviceCommandI
}
out << helper;
}
if (helper.getPacketCounter() == helper.getTotalPacketCounter()) {
*foundId = helper.getCmd();
return OK;
}
return IGNORE_FULL_PACKET;
};
switch (helper.getCmd()) {
case (FRAM): {
if (debugMode) {
uint32_t remainingMillis = finishCountdown.getRemainingMillis();
sif::info << "ScexDeviceHandler::handleValidReply: RemMillis: " << remainingMillis
<< std::endl;
}
result = multiFileHandler("fram_");
break;
}
case (ONE_CELL): {
result = multiFileHandler("one_cell_");
break;
}
case (ALL_CELLS_CMD): {
result = multiFileHandler("all_cell_");
break;
}
default: {
*foundId = helper.getCmd();
break;
}
}
*foundLen = remSize;
return result;
}
ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) {
using namespace scex;
ReturnValue_t status = OK;
auto oneFileHandler = [&](std::string cmdName) {
fileId = date_time_string();
std::ostringstream oss("/tmp/scex-", std::ostringstream::ate);
oss << cmdName << fileId << ".bin";
fileName = oss.str();
ofstream out(fileName, ofstream::binary);
if (out.bad()) {
sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName
<< std::endl;
return FAILED;
}
out << helper;
return OK;
};
switch (id) {
case (PING): {
status = oneFileHandler("ping_");
@ -261,12 +260,20 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
status = oneFileHandler("exp_status_");
break;
}
case(FRAM): {
status = multiFileHandler("fram_");
break;
}
case(ONE_CELL): {
status = multiFileHandler("one_cell_");
break;
}
case(ALL_CELLS_CMD): {
status = multiFileHandler("multi_cell_");
break;
}
default:
// Unknown DeviceCommand
if (id == FRAM or id == ONE_CELL or id == ALL_CELLS_CMD) {
break;
}
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
}
if (helper.getPacketCounter() == helper.getTotalPacketCounter()) {
@ -276,6 +283,10 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
sif::info << "ScexDeviceHandler::interpretDeviceReply:Reader is finished" << std::endl;
fileNameSet = false;
}
if(id == FRAM or id == ALL_CELLS_CMD or id == ONE_CELL) {
triggerEvent(MULTI_PACKET_COMMAND_DONE, id);
updatePeriodicReply(false, id);
}
}
if (debugMode) {
uint32_t remainingMillis = finishCountdown.getRemainingMillis();

View File

@ -4,6 +4,7 @@
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include <linux/devices/ScexHelper.h>
#include <linux/devices/ScexUartReader.h>
#include "commonSubsystemIds.h"
class SdCardMountedIF;

View File

@ -14,8 +14,9 @@ namespace scex {
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SCEX_HANDLER;
static constexpr Event MISSING_PACKET = event::makeEvent(SUBSYSTEM_ID, 0, severity::LOW);
static constexpr Event EXPERIMENT_TIMEDOUT = event::makeEvent(SUBSYSTEM_ID, 0, severity::LOW);
static constexpr Event EXPERIMENT_TIMEDOUT = event::makeEvent(SUBSYSTEM_ID, 1, severity::LOW);
//! FRAM, One Cell or All cells command finished. P1: Command ID
static constexpr Event MULTI_PACKET_COMMAND_DONE = event::makeEvent(SUBSYSTEM_ID, 2, severity::INFO);
enum Cmds : DeviceCommandId_t {
PING = 0b00111,

2
tmtc

@ -1 +1 @@
Subproject commit b4d4a51164af69a22eedd645775061dbb51702b1
Subproject commit e1d84c5b99e99ea9a9687dcd298d815dc4d8d2b6