Merge branch 'ploc_mpsoc_read_file_2' of https://egit.irs.uni-stuttgart.de/eive/eive-obsw into ploc_mpsoc_read_file_2
All checks were successful
EIVE/eive-obsw/pipeline/pr-v2.1.0-dev This commit looks good

This commit is contained in:
Robin Müller 2023-05-19 09:41:51 +02:00
commit a814746c53
17 changed files with 104 additions and 80 deletions

View File

@ -47,6 +47,7 @@ will consitute of a breaking change warranting a new major release:
## Added ## Added
- Add the remaining system modes. - Add the remaining system modes.
- PLOC MPSoC flash read command working.
## Fixed ## Fixed
@ -65,6 +66,7 @@ will consitute of a breaking change warranting a new major release:
- Fixed correction for `GPS Altitude` in case the sensor data is out of the expected bonds. - Fixed correction for `GPS Altitude` in case the sensor data is out of the expected bonds.
- PLOC MPSoC special communication is now scheduled, which allows flash read and flash write - PLOC MPSoC special communication is now scheduled, which allows flash read and flash write
commands to work. commands to work.
- Fixed the MPSoC flash write command.
# [v2.0.5] 2023-05-11 # [v2.0.5] 2023-05-11

View File

@ -1,7 +1,7 @@
/** /**
* @brief Auto-generated event translation file. Contains 294 translations. * @brief Auto-generated event translation file. Contains 295 translations.
* @details * @details
* Generated on: 2023-05-15 15:20:19 * Generated on: 2023-05-17 17:15:34
*/ */
#include "translateEvents.h" #include "translateEvents.h"
@ -200,6 +200,7 @@ const char *MPSOC_TM_CRC_MISSMATCH_STRING = "MPSOC_TM_CRC_MISSMATCH";
const char *MPSOC_FLASH_READ_PACKET_ERROR_STRING = "MPSOC_FLASH_READ_PACKET_ERROR"; const char *MPSOC_FLASH_READ_PACKET_ERROR_STRING = "MPSOC_FLASH_READ_PACKET_ERROR";
const char *MPSOC_FLASH_READ_FAILED_STRING = "MPSOC_FLASH_READ_FAILED"; const char *MPSOC_FLASH_READ_FAILED_STRING = "MPSOC_FLASH_READ_FAILED";
const char *MPSOC_FLASH_READ_SUCCESSFUL_STRING = "MPSOC_FLASH_READ_SUCCESSFUL"; const char *MPSOC_FLASH_READ_SUCCESSFUL_STRING = "MPSOC_FLASH_READ_SUCCESSFUL";
const char *MPSOC_READ_TIMEOUT_STRING = "MPSOC_READ_TIMEOUT";
const char *TRANSITION_BACK_TO_OFF_STRING = "TRANSITION_BACK_TO_OFF"; const char *TRANSITION_BACK_TO_OFF_STRING = "TRANSITION_BACK_TO_OFF";
const char *NEG_V_OUT_OF_BOUNDS_STRING = "NEG_V_OUT_OF_BOUNDS"; const char *NEG_V_OUT_OF_BOUNDS_STRING = "NEG_V_OUT_OF_BOUNDS";
const char *U_DRO_OUT_OF_BOUNDS_STRING = "U_DRO_OUT_OF_BOUNDS"; const char *U_DRO_OUT_OF_BOUNDS_STRING = "U_DRO_OUT_OF_BOUNDS";
@ -692,6 +693,8 @@ const char *translateEvents(Event event) {
return MPSOC_FLASH_READ_FAILED_STRING; return MPSOC_FLASH_READ_FAILED_STRING;
case (12616): case (12616):
return MPSOC_FLASH_READ_SUCCESSFUL_STRING; return MPSOC_FLASH_READ_SUCCESSFUL_STRING;
case (12617):
return MPSOC_READ_TIMEOUT_STRING;
case (12700): case (12700):
return TRANSITION_BACK_TO_OFF_STRING; return TRANSITION_BACK_TO_OFF_STRING;
case (12701): case (12701):

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file. * @brief Auto-generated object translation file.
* @details * @details
* Contains 171 translations. * Contains 171 translations.
* Generated on: 2023-05-15 15:20:19 * Generated on: 2023-05-17 17:15:34
*/ */
#include "translateObjects.h" #include "translateObjects.h"

View File

@ -80,6 +80,7 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio
if (cfg.addOnlyAcuDummy) { if (cfg.addOnlyAcuDummy) {
new AcuDummy(objects::ACU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new AcuDummy(objects::ACU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
} else if (cfg.addPowerDummies) { } else if (cfg.addPowerDummies) {
new AcuDummy(objects::ACU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new PduDummy(objects::PDU1_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new PduDummy(objects::PDU1_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new PduDummy(objects::PDU2_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new PduDummy(objects::PDU2_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new P60DockDummy(objects::P60DOCK_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new P60DockDummy(objects::P60DOCK_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);

View File

@ -194,6 +194,7 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
12614;0x3146;MPSOC_FLASH_READ_PACKET_ERROR;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h 12614;0x3146;MPSOC_FLASH_READ_PACKET_ERROR;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h
12615;0x3147;MPSOC_FLASH_READ_FAILED;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h 12615;0x3147;MPSOC_FLASH_READ_FAILED;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h
12616;0x3148;MPSOC_FLASH_READ_SUCCESSFUL;INFO;No description;linux/payload/PlocMpsocSpecialComHelper.h 12616;0x3148;MPSOC_FLASH_READ_SUCCESSFUL;INFO;No description;linux/payload/PlocMpsocSpecialComHelper.h
12617;0x3149;MPSOC_READ_TIMEOUT;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h
12700;0x319c;TRANSITION_BACK_TO_OFF;MEDIUM;Could not transition properly and went back to ALL OFF;mission/payload/PayloadPcduHandler.h 12700;0x319c;TRANSITION_BACK_TO_OFF;MEDIUM;Could not transition properly and went back to ALL OFF;mission/payload/PayloadPcduHandler.h
12701;0x319d;NEG_V_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/payload/PayloadPcduHandler.h 12701;0x319d;NEG_V_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/payload/PayloadPcduHandler.h
12702;0x319e;U_DRO_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/payload/PayloadPcduHandler.h 12702;0x319e;U_DRO_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/payload/PayloadPcduHandler.h

1 Event ID (dec) Event ID (hex) Name Severity Description File Path
194 12614 0x3146 MPSOC_FLASH_READ_PACKET_ERROR LOW No description linux/payload/PlocMpsocSpecialComHelper.h
195 12615 0x3147 MPSOC_FLASH_READ_FAILED LOW No description linux/payload/PlocMpsocSpecialComHelper.h
196 12616 0x3148 MPSOC_FLASH_READ_SUCCESSFUL INFO No description linux/payload/PlocMpsocSpecialComHelper.h
197 12617 0x3149 MPSOC_READ_TIMEOUT LOW No description linux/payload/PlocMpsocSpecialComHelper.h
198 12700 0x319c TRANSITION_BACK_TO_OFF MEDIUM Could not transition properly and went back to ALL OFF mission/payload/PayloadPcduHandler.h
199 12701 0x319d NEG_V_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value mission/payload/PayloadPcduHandler.h
200 12702 0x319e U_DRO_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value mission/payload/PayloadPcduHandler.h

View File

@ -194,6 +194,7 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
12614;0x3146;MPSOC_FLASH_READ_PACKET_ERROR;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h 12614;0x3146;MPSOC_FLASH_READ_PACKET_ERROR;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h
12615;0x3147;MPSOC_FLASH_READ_FAILED;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h 12615;0x3147;MPSOC_FLASH_READ_FAILED;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h
12616;0x3148;MPSOC_FLASH_READ_SUCCESSFUL;INFO;No description;linux/payload/PlocMpsocSpecialComHelper.h 12616;0x3148;MPSOC_FLASH_READ_SUCCESSFUL;INFO;No description;linux/payload/PlocMpsocSpecialComHelper.h
12617;0x3149;MPSOC_READ_TIMEOUT;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h
12700;0x319c;TRANSITION_BACK_TO_OFF;MEDIUM;Could not transition properly and went back to ALL OFF;mission/payload/PayloadPcduHandler.h 12700;0x319c;TRANSITION_BACK_TO_OFF;MEDIUM;Could not transition properly and went back to ALL OFF;mission/payload/PayloadPcduHandler.h
12701;0x319d;NEG_V_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/payload/PayloadPcduHandler.h 12701;0x319d;NEG_V_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/payload/PayloadPcduHandler.h
12702;0x319e;U_DRO_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/payload/PayloadPcduHandler.h 12702;0x319e;U_DRO_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/payload/PayloadPcduHandler.h

1 Event ID (dec) Event ID (hex) Name Severity Description File Path
194 12614 0x3146 MPSOC_FLASH_READ_PACKET_ERROR LOW No description linux/payload/PlocMpsocSpecialComHelper.h
195 12615 0x3147 MPSOC_FLASH_READ_FAILED LOW No description linux/payload/PlocMpsocSpecialComHelper.h
196 12616 0x3148 MPSOC_FLASH_READ_SUCCESSFUL INFO No description linux/payload/PlocMpsocSpecialComHelper.h
197 12617 0x3149 MPSOC_READ_TIMEOUT LOW No description linux/payload/PlocMpsocSpecialComHelper.h
198 12700 0x319c TRANSITION_BACK_TO_OFF MEDIUM Could not transition properly and went back to ALL OFF mission/payload/PayloadPcduHandler.h
199 12701 0x319d NEG_V_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value mission/payload/PayloadPcduHandler.h
200 12702 0x319e U_DRO_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value mission/payload/PayloadPcduHandler.h

View File

@ -1,7 +1,7 @@
/** /**
* @brief Auto-generated event translation file. Contains 294 translations. * @brief Auto-generated event translation file. Contains 295 translations.
* @details * @details
* Generated on: 2023-05-15 15:20:19 * Generated on: 2023-05-17 17:15:34
*/ */
#include "translateEvents.h" #include "translateEvents.h"
@ -200,6 +200,7 @@ const char *MPSOC_TM_CRC_MISSMATCH_STRING = "MPSOC_TM_CRC_MISSMATCH";
const char *MPSOC_FLASH_READ_PACKET_ERROR_STRING = "MPSOC_FLASH_READ_PACKET_ERROR"; const char *MPSOC_FLASH_READ_PACKET_ERROR_STRING = "MPSOC_FLASH_READ_PACKET_ERROR";
const char *MPSOC_FLASH_READ_FAILED_STRING = "MPSOC_FLASH_READ_FAILED"; const char *MPSOC_FLASH_READ_FAILED_STRING = "MPSOC_FLASH_READ_FAILED";
const char *MPSOC_FLASH_READ_SUCCESSFUL_STRING = "MPSOC_FLASH_READ_SUCCESSFUL"; const char *MPSOC_FLASH_READ_SUCCESSFUL_STRING = "MPSOC_FLASH_READ_SUCCESSFUL";
const char *MPSOC_READ_TIMEOUT_STRING = "MPSOC_READ_TIMEOUT";
const char *TRANSITION_BACK_TO_OFF_STRING = "TRANSITION_BACK_TO_OFF"; const char *TRANSITION_BACK_TO_OFF_STRING = "TRANSITION_BACK_TO_OFF";
const char *NEG_V_OUT_OF_BOUNDS_STRING = "NEG_V_OUT_OF_BOUNDS"; const char *NEG_V_OUT_OF_BOUNDS_STRING = "NEG_V_OUT_OF_BOUNDS";
const char *U_DRO_OUT_OF_BOUNDS_STRING = "U_DRO_OUT_OF_BOUNDS"; const char *U_DRO_OUT_OF_BOUNDS_STRING = "U_DRO_OUT_OF_BOUNDS";
@ -692,6 +693,8 @@ const char *translateEvents(Event event) {
return MPSOC_FLASH_READ_FAILED_STRING; return MPSOC_FLASH_READ_FAILED_STRING;
case (12616): case (12616):
return MPSOC_FLASH_READ_SUCCESSFUL_STRING; return MPSOC_FLASH_READ_SUCCESSFUL_STRING;
case (12617):
return MPSOC_READ_TIMEOUT_STRING;
case (12700): case (12700):
return TRANSITION_BACK_TO_OFF_STRING; return TRANSITION_BACK_TO_OFF_STRING;
case (12701): case (12701):

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file. * @brief Auto-generated object translation file.
* @details * @details
* Contains 175 translations. * Contains 175 translations.
* Generated on: 2023-05-15 15:20:19 * Generated on: 2023-05-17 17:15:34
*/ */
#include "translateObjects.h" #include "translateObjects.h"

View File

@ -1,7 +1,7 @@
/** /**
* @brief Auto-generated event translation file. Contains 294 translations. * @brief Auto-generated event translation file. Contains 295 translations.
* @details * @details
* Generated on: 2023-05-15 15:20:19 * Generated on: 2023-05-17 17:15:34
*/ */
#include "translateEvents.h" #include "translateEvents.h"
@ -200,6 +200,7 @@ const char *MPSOC_TM_CRC_MISSMATCH_STRING = "MPSOC_TM_CRC_MISSMATCH";
const char *MPSOC_FLASH_READ_PACKET_ERROR_STRING = "MPSOC_FLASH_READ_PACKET_ERROR"; const char *MPSOC_FLASH_READ_PACKET_ERROR_STRING = "MPSOC_FLASH_READ_PACKET_ERROR";
const char *MPSOC_FLASH_READ_FAILED_STRING = "MPSOC_FLASH_READ_FAILED"; const char *MPSOC_FLASH_READ_FAILED_STRING = "MPSOC_FLASH_READ_FAILED";
const char *MPSOC_FLASH_READ_SUCCESSFUL_STRING = "MPSOC_FLASH_READ_SUCCESSFUL"; const char *MPSOC_FLASH_READ_SUCCESSFUL_STRING = "MPSOC_FLASH_READ_SUCCESSFUL";
const char *MPSOC_READ_TIMEOUT_STRING = "MPSOC_READ_TIMEOUT";
const char *TRANSITION_BACK_TO_OFF_STRING = "TRANSITION_BACK_TO_OFF"; const char *TRANSITION_BACK_TO_OFF_STRING = "TRANSITION_BACK_TO_OFF";
const char *NEG_V_OUT_OF_BOUNDS_STRING = "NEG_V_OUT_OF_BOUNDS"; const char *NEG_V_OUT_OF_BOUNDS_STRING = "NEG_V_OUT_OF_BOUNDS";
const char *U_DRO_OUT_OF_BOUNDS_STRING = "U_DRO_OUT_OF_BOUNDS"; const char *U_DRO_OUT_OF_BOUNDS_STRING = "U_DRO_OUT_OF_BOUNDS";
@ -692,6 +693,8 @@ const char *translateEvents(Event event) {
return MPSOC_FLASH_READ_FAILED_STRING; return MPSOC_FLASH_READ_FAILED_STRING;
case (12616): case (12616):
return MPSOC_FLASH_READ_SUCCESSFUL_STRING; return MPSOC_FLASH_READ_SUCCESSFUL_STRING;
case (12617):
return MPSOC_READ_TIMEOUT_STRING;
case (12700): case (12700):
return TRANSITION_BACK_TO_OFF_STRING; return TRANSITION_BACK_TO_OFF_STRING;
case (12701): case (12701):

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file. * @brief Auto-generated object translation file.
* @details * @details
* Contains 175 translations. * Contains 175 translations.
* Generated on: 2023-05-15 15:20:19 * Generated on: 2023-05-17 17:15:34
*/ */
#include "translateObjects.h" #include "translateObjects.h"

View File

@ -53,15 +53,26 @@ ReturnValue_t PlocMpsocHandler::initialize() {
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = manager->subscribeToEventRange( result = manager->subscribeToEvent(
eventQueue->getId(), event::getEventId(PlocMpsocSpecialComHelper::MPSOC_FLASH_WRITE_FAILED), eventQueue->getId(), event::getEventId(PlocMpsocSpecialComHelper::MPSOC_FLASH_WRITE_FAILED));
if (result != returnvalue::OK) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
result = manager->subscribeToEvent(
eventQueue->getId(),
event::getEventId(PlocMpsocSpecialComHelper::MPSOC_FLASH_WRITE_SUCCESSFUL)); event::getEventId(PlocMpsocSpecialComHelper::MPSOC_FLASH_WRITE_SUCCESSFUL));
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 return ObjectManagerIF::CHILD_INIT_FAILED;
sif::warning << "PlocMPSoCHandler::initialize: Failed to subscribe to events from " }
" ploc mpsoc helper" result = manager->subscribeToEvent(
<< std::endl; eventQueue->getId(),
#endif event::getEventId(PlocMpsocSpecialComHelper::MPSOC_FLASH_READ_SUCCESSFUL));
if (result != returnvalue::OK) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
result = manager->subscribeToEvent(
eventQueue->getId(), event::getEventId(PlocMpsocSpecialComHelper::MPSOC_FLASH_READ_FAILED));
if (result != returnvalue::OK) {
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
@ -125,7 +136,7 @@ ReturnValue_t PlocMpsocHandler::executeAction(ActionId_t actionId, MessageQueueI
} }
} }
if (plocMPSoCHelperExecuting) { if (specialComHelperExecuting) {
return MPSoCReturnValuesIF::MPSOC_HELPER_EXECUTING; return MPSoCReturnValuesIF::MPSOC_HELPER_EXECUTING;
} }
@ -141,7 +152,7 @@ ReturnValue_t PlocMpsocHandler::executeAction(ActionId_t actionId, MessageQueueI
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
plocMPSoCHelperExecuting = true; specialComHelperExecuting = true;
return EXECUTION_FINISHED; return EXECUTION_FINISHED;
} }
case mpsoc::TC_FLASH_READ_FULL_FILE: { case mpsoc::TC_FLASH_READ_FULL_FILE: {
@ -156,7 +167,7 @@ ReturnValue_t PlocMpsocHandler::executeAction(ActionId_t actionId, MessageQueueI
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
plocMPSoCHelperExecuting = true; specialComHelperExecuting = true;
return EXECUTION_FINISHED; return EXECUTION_FINISHED;
} }
case (mpsoc::OBSW_RESET_SEQ_COUNT): { case (mpsoc::OBSW_RESET_SEQ_COUNT): {
@ -241,12 +252,12 @@ void PlocMpsocHandler::doShutDown() {
setMode(_MODE_POWER_DOWN); setMode(_MODE_POWER_DOWN);
commandIsPending = false; commandIsPending = false;
sequenceCount = 0; sequenceCount = 0;
plocMPSoCHelperExecuting = false; specialComHelperExecuting = false;
startupState = StartupState::IDLE; startupState = StartupState::IDLE;
} }
ReturnValue_t PlocMpsocHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { ReturnValue_t PlocMpsocHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
if (not commandIsPending and not plocMPSoCHelperExecuting) { if (not commandIsPending and not specialComHelperExecuting) {
*id = mpsoc::TC_GET_HK_REPORT; *id = mpsoc::TC_GET_HK_REPORT;
commandIsPending = true; commandIsPending = true;
cmdCountdown.resetTimer(); cmdCountdown.resetTimer();
@ -548,7 +559,7 @@ void PlocMpsocHandler::handleEvent(EventMessage* eventMessage) {
object_id_t objectId = eventMessage->getReporter(); object_id_t objectId = eventMessage->getReporter();
switch (objectId) { switch (objectId) {
case objects::PLOC_MPSOC_HELPER: { case objects::PLOC_MPSOC_HELPER: {
plocMPSoCHelperExecuting = false; specialComHelperExecuting = false;
break; break;
} }
default: default:
@ -643,6 +654,10 @@ ReturnValue_t PlocMpsocHandler::prepareTcGetHkReport() {
ReturnValue_t PlocMpsocHandler::prepareTcReplayWriteSequence(const uint8_t* commandData, ReturnValue_t PlocMpsocHandler::prepareTcReplayWriteSequence(const uint8_t* commandData,
size_t commandDataLen) { size_t commandDataLen) {
mpsoc::TcReplayWriteSeq tcReplayWriteSeq(spParams, sequenceCount); mpsoc::TcReplayWriteSeq tcReplayWriteSeq(spParams, sequenceCount);
ReturnValue_t result = tcReplayWriteSeq.setPayload(commandData, commandDataLen);
if (result != returnvalue::OK) {
return result;
}
finishTcPrep(tcReplayWriteSeq); finishTcPrep(tcReplayWriteSeq);
return returnvalue::OK; return returnvalue::OK;
} }
@ -662,6 +677,10 @@ ReturnValue_t PlocMpsocHandler::prepareTcModeIdle() {
ReturnValue_t PlocMpsocHandler::prepareTcCamCmdSend(const uint8_t* commandData, ReturnValue_t PlocMpsocHandler::prepareTcCamCmdSend(const uint8_t* commandData,
size_t commandDataLen) { size_t commandDataLen) {
mpsoc::TcCamcmdSend tcCamCmdSend(spParams, sequenceCount); mpsoc::TcCamcmdSend tcCamCmdSend(spParams, sequenceCount);
ReturnValue_t result = tcCamCmdSend.setPayload(commandData, commandDataLen);
if (result != returnvalue::OK) {
return result;
}
finishTcPrep(tcCamCmdSend); finishTcPrep(tcCamCmdSend);
nextReplyId = mpsoc::TM_CAM_CMD_RPT; nextReplyId = mpsoc::TM_CAM_CMD_RPT;
return returnvalue::OK; return returnvalue::OK;
@ -670,6 +689,10 @@ ReturnValue_t PlocMpsocHandler::prepareTcCamCmdSend(const uint8_t* commandData,
ReturnValue_t PlocMpsocHandler::prepareTcCamTakePic(const uint8_t* commandData, ReturnValue_t PlocMpsocHandler::prepareTcCamTakePic(const uint8_t* commandData,
size_t commandDataLen) { size_t commandDataLen) {
mpsoc::TcCamTakePic tcCamTakePic(spParams, sequenceCount); mpsoc::TcCamTakePic tcCamTakePic(spParams, sequenceCount);
ReturnValue_t result = tcCamTakePic.setPayload(commandData, commandDataLen);
if (result != returnvalue::OK) {
return result;
}
finishTcPrep(tcCamTakePic); finishTcPrep(tcCamTakePic);
return returnvalue::OK; return returnvalue::OK;
} }
@ -1209,7 +1232,7 @@ size_t PlocMpsocHandler::getNextReplyLength(DeviceCommandId_t commandId) {
ReturnValue_t PlocMpsocHandler::doSendReadHook() { ReturnValue_t PlocMpsocHandler::doSendReadHook() {
// Prevent DHB from polling UART during commands executed by the mpsoc helper task // Prevent DHB from polling UART during commands executed by the mpsoc helper task
if (plocMPSoCHelperExecuting) { if (specialComHelperExecuting) {
return returnvalue::FAILED; return returnvalue::FAILED;
} }
return returnvalue::OK; return returnvalue::OK;

View File

@ -168,7 +168,7 @@ class PlocMpsocHandler : public DeviceHandlerBase, public CommandsActionsIF {
CommandActionHelper commandActionHelper; CommandActionHelper commandActionHelper;
// Used to block incoming commands when MPSoC helper class is currently executing a command // Used to block incoming commands when MPSoC helper class is currently executing a command
bool plocMPSoCHelperExecuting = false; bool specialComHelperExecuting = false;
bool commandIsPending = false; bool commandIsPending = false;
struct TmMemReadReport { struct TmMemReadReport {

View File

@ -128,7 +128,7 @@ ReturnValue_t PlocMpsocSpecialComHelper::performFlashWrite() {
if (file.bad()) { if (file.bad()) {
return returnvalue::FAILED; return returnvalue::FAILED;
} }
result = flashfopen(mpsoc::FileAccessMode::WRITE); result = flashfopen(mpsoc::FileAccessModes::WRITE | mpsoc::FileAccessModes::OPEN_ALWAYS);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
@ -140,16 +140,15 @@ ReturnValue_t PlocMpsocSpecialComHelper::performFlashWrite() {
size_t bytesRead = 0; size_t bytesRead = 0;
while (remainingSize > 0) { while (remainingSize > 0) {
if (terminate) { if (terminate) {
flashfclose();
return returnvalue::OK; return returnvalue::OK;
} }
if (remainingSize > mpsoc::SP_MAX_DATA_SIZE) { // The minus 4 is necessary for unknown reasons. Maybe some bug in the ILH software?
dataLength = mpsoc::SP_MAX_DATA_SIZE; if (remainingSize > mpsoc::MAX_FLASH_WRITE_DATA_SIZE - 4) {
dataLength = mpsoc::MAX_FLASH_WRITE_DATA_SIZE - 4;
} else { } else {
dataLength = remainingSize; dataLength = remainingSize;
} }
if (file.bad() or not file.is_open()) { if (file.bad() or not file.is_open()) {
flashfclose();
return FILE_WRITE_ERROR; return FILE_WRITE_ERROR;
} }
file.seekg(bytesRead, file.beg); file.seekg(bytesRead, file.beg);
@ -159,18 +158,15 @@ ReturnValue_t PlocMpsocSpecialComHelper::performFlashWrite() {
mpsoc::TcFlashWrite tc(spParams, *sequenceCount); mpsoc::TcFlashWrite tc(spParams, *sequenceCount);
result = tc.setPayload(fileBuf.data(), dataLength); result = tc.setPayload(fileBuf.data(), dataLength);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
flashfclose();
return result; return result;
} }
result = tc.finishPacket(); result = tc.finishPacket();
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
flashfclose();
return result; return result;
} }
(*sequenceCount)++; (*sequenceCount)++;
result = handlePacketTransmissionNoReply(tc); result = handlePacketTransmissionNoReply(tc);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
flashfclose();
return result; return result;
} }
} }
@ -182,13 +178,12 @@ ReturnValue_t PlocMpsocSpecialComHelper::performFlashWrite() {
} }
ReturnValue_t PlocMpsocSpecialComHelper::performFlashRead() { ReturnValue_t PlocMpsocSpecialComHelper::performFlashRead() {
sif::debug << "performing flash read" << std::endl;
std::error_code e; std::error_code e;
std::ofstream ofile(flashReadAndWrite.obcFile, std::ios::trunc | std::ios::binary); std::ofstream ofile(flashReadAndWrite.obcFile, std::ios::trunc | std::ios::binary);
if (ofile.bad()) { if (ofile.bad()) {
return returnvalue::FAILED; return returnvalue::FAILED;
} }
ReturnValue_t result = flashfopen(mpsoc::FileAccessMode::READ); ReturnValue_t result = flashfopen(mpsoc::FileAccessModes::READ);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
std::filesystem::remove(flashReadAndWrite.obcFile, e); std::filesystem::remove(flashReadAndWrite.obcFile, e);
return result; return result;
@ -198,51 +193,43 @@ ReturnValue_t PlocMpsocSpecialComHelper::performFlashRead() {
while (readSoFar < flashReadAndWrite.totalReadSize) { while (readSoFar < flashReadAndWrite.totalReadSize) {
if (terminate) { if (terminate) {
std::filesystem::remove(flashReadAndWrite.obcFile, e); std::filesystem::remove(flashReadAndWrite.obcFile, e);
// TODO: Might not be needed
// flashfclose();
return returnvalue::OK; return returnvalue::OK;
} }
nextReadSize = mpsoc::MAX_FLASH_READ_DATA_SIZE; nextReadSize = mpsoc::MAX_FLASH_READ_DATA_SIZE;
if (flashReadAndWrite.totalReadSize - readSoFar < mpsoc::MAX_FLASH_READ_DATA_SIZE) { if (flashReadAndWrite.totalReadSize - readSoFar < mpsoc::MAX_FLASH_READ_DATA_SIZE) {
nextReadSize = flashReadAndWrite.totalReadSize - readSoFar; nextReadSize = flashReadAndWrite.totalReadSize - readSoFar;
} }
sif::debug << "reading " << nextReadSize << " bytes from offset " << readSoFar << std::endl;
if (ofile.bad() or not ofile.is_open()) { if (ofile.bad() or not ofile.is_open()) {
std::filesystem::remove(flashReadAndWrite.obcFile, e); std::filesystem::remove(flashReadAndWrite.obcFile, e);
// TODO: Might not be needed
// flashfclose();
return FILE_READ_ERROR; return FILE_READ_ERROR;
} }
mpsoc::TcFlashRead flashReadRequest(spParams, *sequenceCount); mpsoc::TcFlashRead flashReadRequest(spParams, *sequenceCount);
result = flashReadRequest.setPayload(nextReadSize); result = flashReadRequest.setPayload(nextReadSize);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
std::filesystem::remove(flashReadAndWrite.obcFile, e); std::filesystem::remove(flashReadAndWrite.obcFile, e);
// TODO: Might not be needed
// flashfclose();
return result; return result;
} }
result = flashReadRequest.finishPacket(); result = flashReadRequest.finishPacket();
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
std::filesystem::remove(flashReadAndWrite.obcFile, e); std::filesystem::remove(flashReadAndWrite.obcFile, e);
// TODO: Might not be needed
// flashfclose();
return result; return result;
} }
(*sequenceCount)++; (*sequenceCount)++;
result = handlePacketTransmissionFlashRead(flashReadRequest, ofile, nextReadSize); result = handlePacketTransmissionFlashRead(flashReadRequest, ofile, nextReadSize);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
std::filesystem::remove(flashReadAndWrite.obcFile, e); std::filesystem::remove(flashReadAndWrite.obcFile, e);
// TODO: Might not be needed
// flashfclose();
return result; return result;
} }
readSoFar += nextReadSize; readSoFar += nextReadSize;
} }
sif::debug << "read file done" << std::endl; result = flashfclose();
if (result != returnvalue::OK) {
return result;
}
return result; return result;
} }
ReturnValue_t PlocMpsocSpecialComHelper::flashfopen(mpsoc::FileAccessMode mode) { ReturnValue_t PlocMpsocSpecialComHelper::flashfopen(uint8_t mode) {
spParams.buf = commandBuffer; spParams.buf = commandBuffer;
mpsoc::FlashFopen flashFopen(spParams, *sequenceCount); mpsoc::FlashFopen flashFopen(spParams, *sequenceCount);
ReturnValue_t result = flashFopen.setPayload(flashReadAndWrite.mpsocFile, mode); ReturnValue_t result = flashFopen.setPayload(flashReadAndWrite.mpsocFile, mode);
@ -299,10 +286,6 @@ ReturnValue_t PlocMpsocSpecialComHelper::handlePacketTransmissionFlashRead(mpsoc
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
result = handleTmReception();
if (result != returnvalue::OK) {
return result;
}
return handleExe(); return handleExe();
} else if (spReader.getApid() == mpsoc::apid::EXE_FAILURE) { } else if (spReader.getApid() == mpsoc::apid::EXE_FAILURE) {
handleExeFailure(); handleExeFailure();
@ -329,8 +312,6 @@ ReturnValue_t PlocMpsocSpecialComHelper::handlePacketTransmissionNoReply(ploc::S
ReturnValue_t PlocMpsocSpecialComHelper::sendCommand(ploc::SpTcBase& tc) { ReturnValue_t PlocMpsocSpecialComHelper::sendCommand(ploc::SpTcBase& tc) {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
sif::debug << "sending TC" << std::endl;
arrayprinter::print(tc.getFullPacket(), tc.getFullPacketLen());
result = uartComIF->sendMessage(comCookie, tc.getFullPacket(), tc.getFullPacketLen()); result = uartComIF->sendMessage(comCookie, tc.getFullPacket(), tc.getFullPacketLen());
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
sif::warning << "PlocMPSoCHelper::sendCommand: Failed to send command" << std::endl; sif::warning << "PlocMPSoCHelper::sendCommand: Failed to send command" << std::endl;
@ -346,14 +327,13 @@ ReturnValue_t PlocMpsocSpecialComHelper::handleAck() {
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
SpTmReader tmPacket(tmBuf.data(), tmBuf.size());
result = checkReceivedTm(); result = checkReceivedTm();
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
uint16_t apid = tmPacket.getApid(); uint16_t apid = spReader.getApid();
if (apid != mpsoc::apid::ACK_SUCCESS) { if (apid != mpsoc::apid::ACK_SUCCESS) {
handleAckApidFailure(tmPacket); handleAckApidFailure(spReader);
return returnvalue::FAILED; return returnvalue::FAILED;
} }
return returnvalue::OK; return returnvalue::OK;
@ -428,7 +408,6 @@ ReturnValue_t PlocMpsocSpecialComHelper::handleTmReception() {
usleepDelay *= 4; usleepDelay *= 4;
} }
} }
// sif::debug << "recvd first 6 bytes" << std::endl;
while (true) { while (true) {
if (tmCountdown.hasTimedOut()) { if (tmCountdown.hasTimedOut()) {
triggerEvent(MPSOC_READ_TIMEOUT, tmCountdown.getTimeoutMs()); triggerEvent(MPSOC_READ_TIMEOUT, tmCountdown.getTimeoutMs());
@ -437,7 +416,6 @@ ReturnValue_t PlocMpsocSpecialComHelper::handleTmReception() {
result = receive(tmBuf.data() + readBytes, fullPacketLen - readBytes, &currentBytes); result = receive(tmBuf.data() + readBytes, fullPacketLen - readBytes, &currentBytes);
readBytes += currentBytes; readBytes += currentBytes;
if (fullPacketLen == readBytes) { if (fullPacketLen == readBytes) {
// sif::debug << "recvd full " << fullPacketLen << std::endl;
break; break;
} }
usleep(usleepDelay); usleep(usleepDelay);
@ -445,7 +423,7 @@ ReturnValue_t PlocMpsocSpecialComHelper::handleTmReception() {
usleepDelay *= 4; usleepDelay *= 4;
} }
} }
arrayprinter::print(tmBuf.data(), readBytes); // arrayprinter::print(tmBuf.data(), readBytes);
return result; return result;
} }
@ -464,14 +442,15 @@ ReturnValue_t PlocMpsocSpecialComHelper::handleFlashReadReply(std::ofstream& ofi
const uint8_t* packetData = spReader.getPacketData(); const uint8_t* packetData = spReader.getPacketData();
size_t deserDummy = spReader.getPacketDataLen() - mpsoc::CRC_SIZE; size_t deserDummy = spReader.getPacketDataLen() - mpsoc::CRC_SIZE;
uint32_t receivedReadLen = 0; uint32_t receivedReadLen = 0;
std::string receivedShortName = std::string(reinterpret_cast<const char*>(packetData), 12); // I think this is buggy, weird stuff in the short name field.
if (receivedShortName != flashReadAndWrite.mpsocFile.substr(0, 12)) { // std::string receivedShortName = std::string(reinterpret_cast<const char*>(packetData), 12);
sif::warning << "PLOC MPSoC Flash Read: Missmatch between request file name and " // if (receivedShortName != flashReadAndWrite.mpsocFile.substr(0, 11)) {
"received file name" // sif::warning << "PLOC MPSoC Flash Read: Missmatch between request file name and "
<< std::endl; // "received file name"
triggerEvent(MPSOC_FLASH_READ_PACKET_ERROR, FlashReadErrorType::FLASH_READ_FILENAME_ERROR); // << std::endl;
return returnvalue::FAILED; // triggerEvent(MPSOC_FLASH_READ_PACKET_ERROR, FlashReadErrorType::FLASH_READ_FILENAME_ERROR);
} // return returnvalue::FAILED;
// }
packetData += 12; packetData += 12;
result = SerializeAdapter::deSerialize(&receivedReadLen, &packetData, &deserDummy, result = SerializeAdapter::deSerialize(&receivedReadLen, &packetData, &deserDummy,
SerializeIF::Endianness::NETWORK); SerializeIF::Endianness::NETWORK);

View File

@ -179,7 +179,7 @@ class PlocMpsocSpecialComHelper : public SystemObject, public ExecutableObjectIF
void resetHelper(); void resetHelper();
ReturnValue_t performFlashWrite(); ReturnValue_t performFlashWrite();
ReturnValue_t performFlashRead(); ReturnValue_t performFlashRead();
ReturnValue_t flashfopen(mpsoc::FileAccessMode mode); ReturnValue_t flashfopen(uint8_t accessMode);
ReturnValue_t flashfclose(); ReturnValue_t flashfclose();
ReturnValue_t handlePacketTransmissionNoReply(ploc::SpTcBase& tc); ReturnValue_t handlePacketTransmissionNoReply(ploc::SpTcBase& tc);
ReturnValue_t handlePacketTransmissionFlashRead(mpsoc::TcFlashRead& tc, std::ofstream& ofile, ReturnValue_t handlePacketTransmissionFlashRead(mpsoc::TcFlashRead& tc, std::ofstream& ofile,

View File

@ -33,6 +33,10 @@ std::string mpsoc::getStatusString(uint16_t status) {
return "Flash mount failed"; return "Flash mount failed";
break; break;
} }
case (mpsoc::status_code::FLASH_FILE_ALREADY_OPEN): {
return "Flash file already open";
break;
}
case (mpsoc::status_code::FLASH_FILE_ALREADY_CLOSED): { case (mpsoc::status_code::FLASH_FILE_ALREADY_CLOSED): {
return "Flash file already closed"; return "Flash file already closed";
break; break;

View File

@ -13,12 +13,16 @@
namespace mpsoc { namespace mpsoc {
enum FileAccessMode : uint8_t { enum FileAccessModes : uint8_t {
// Opens a file, fails if the file does not exist.
OPEN_EXISTING = 0x00, OPEN_EXISTING = 0x00,
READ = 0x01, READ = 0x01,
WRITE = 0x02, WRITE = 0x02,
// Creates a new file, fails if it already exists.
CREATE_NEW = 0x04, CREATE_NEW = 0x04,
// Creates a new file, existing file is truncated and overwritten.
CREATE_ALWAYS = 0x08, CREATE_ALWAYS = 0x08,
// Opens the file if it is existing. If not, a new file is created.
OPEN_ALWAYS = 0x10, OPEN_ALWAYS = 0x10,
OPEN_APPEND = 0x30 OPEN_APPEND = 0x30
}; };
@ -182,6 +186,8 @@ static constexpr size_t SP_MAX_DATA_SIZE = SP_MAX_SIZE - ccsds::HEADER_LEN - CRC
static constexpr size_t FLASH_READ_MIN_OVERHEAD = 16; static constexpr size_t FLASH_READ_MIN_OVERHEAD = 16;
// 1000 bytes. // 1000 bytes.
static const size_t MAX_FLASH_READ_DATA_SIZE = SP_MAX_DATA_SIZE - FLASH_READ_MIN_OVERHEAD; static const size_t MAX_FLASH_READ_DATA_SIZE = SP_MAX_DATA_SIZE - FLASH_READ_MIN_OVERHEAD;
// 1012 bytes, 4 bytes for the write length.
static constexpr size_t MAX_FLASH_WRITE_DATA_SIZE = SP_MAX_DATA_SIZE - sizeof(uint32_t);
/** /**
* The replay write sequence command has a maximum delay for the execution report which amounts to * The replay write sequence command has a maximum delay for the execution report which amounts to
@ -204,7 +210,7 @@ static const uint16_t TC_EXEUTION_DISABLED = 0x5E2;
static const uint16_t FLASH_MOUNT_FAILED = 0x5E3; static const uint16_t FLASH_MOUNT_FAILED = 0x5E3;
static const uint16_t FLASH_FILE_ALREADY_CLOSED = 0x5E4; static const uint16_t FLASH_FILE_ALREADY_CLOSED = 0x5E4;
static const uint16_t FLASH_FILE_OPEN_FAILED = 0x5E5; static const uint16_t FLASH_FILE_OPEN_FAILED = 0x5E5;
static const uint16_t FLASH_FILE_ALREDY_OPEN = 0x5E6; static const uint16_t FLASH_FILE_ALREADY_OPEN = 0x5E6;
static const uint16_t FLASH_FILE_NOT_OPEN = 0x5E7; static const uint16_t FLASH_FILE_NOT_OPEN = 0x5E7;
static const uint16_t FLASH_UNMOUNT_FAILED = 0x5E8; static const uint16_t FLASH_UNMOUNT_FAILED = 0x5E8;
static const uint16_t HEAP_ALLOCATION_FAILED = 0x5E9; static const uint16_t HEAP_ALLOCATION_FAILED = 0x5E9;
@ -366,7 +372,7 @@ class FlashFopen : public TcBase {
FlashFopen(ploc::SpTcParams params, uint16_t sequenceCount) FlashFopen(ploc::SpTcParams params, uint16_t sequenceCount)
: TcBase(params, apid::TC_FLASHFOPEN, sequenceCount) {} : TcBase(params, apid::TC_FLASHFOPEN, sequenceCount) {}
ReturnValue_t setPayload(std::string filename, FileAccessMode mode) { ReturnValue_t setPayload(std::string filename, uint8_t mode) {
accessMode = mode; accessMode = mode;
size_t nameSize = filename.size(); size_t nameSize = filename.size();
spParams.setFullPayloadLen(256 + sizeof(uint8_t) + CRC_SIZE); spParams.setFullPayloadLen(256 + sizeof(uint8_t) + CRC_SIZE);
@ -378,12 +384,12 @@ class FlashFopen : public TcBase {
// payloadStart[nameSize] = NULL_TERMINATOR; // payloadStart[nameSize] = NULL_TERMINATOR;
std::memset(payloadStart + nameSize, 0, 256 - nameSize); std::memset(payloadStart + nameSize, 0, 256 - nameSize);
// payloadStart[255] = NULL_TERMINATOR; // payloadStart[255] = NULL_TERMINATOR;
payloadStart[256] = static_cast<uint8_t>(accessMode); payloadStart[256] = accessMode;
return returnvalue::OK; return returnvalue::OK;
} }
private: private:
FileAccessMode accessMode = FileAccessMode::OPEN_EXISTING; uint8_t accessMode = FileAccessModes::OPEN_EXISTING;
}; };
/** /**
@ -406,14 +412,13 @@ class TcFlashWrite : public TcBase {
: TcBase(params, apid::TC_FLASHWRITE, sequenceCount) {} : TcBase(params, apid::TC_FLASHWRITE, sequenceCount) {}
ReturnValue_t setPayload(const uint8_t* writeData, uint32_t writeLen_) { ReturnValue_t setPayload(const uint8_t* writeData, uint32_t writeLen_) {
ReturnValue_t result = returnvalue::OK;
writeLen = writeLen_; writeLen = writeLen_;
if (writeLen > SP_MAX_DATA_SIZE) { if (writeLen > MAX_FLASH_WRITE_DATA_SIZE) {
sif::error << "TcFlashWrite: Command data too big" << std::endl; sif::error << "TcFlashWrite: Command data too big" << std::endl;
return returnvalue::FAILED; return returnvalue::FAILED;
} }
spParams.setFullPayloadLen(static_cast<uint16_t>(writeLen) + 4 + CRC_SIZE); spParams.setFullPayloadLen(sizeof(uint32_t) + static_cast<uint16_t>(writeLen) + CRC_SIZE);
result = checkPayloadLen(); ReturnValue_t result = checkPayloadLen();
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
@ -423,7 +428,7 @@ class TcFlashWrite : public TcBase {
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
std::memcpy(payloadStart + sizeof(writeLen), writeData, writeLen); std::memcpy(payloadStart + sizeof(uint32_t), writeData, writeLen);
updateSpFields(); updateSpFields();
result = checkSizeAndSerializeHeader(); result = checkSizeAndSerializeHeader();
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
@ -873,7 +878,6 @@ class TcCamcmdSend : public TcBase {
TcCamcmdSend(ploc::SpTcParams params, uint16_t sequenceCount) TcCamcmdSend(ploc::SpTcParams params, uint16_t sequenceCount)
: TcBase(params, apid::TC_CAM_CMD_SEND, sequenceCount) {} : TcBase(params, apid::TC_CAM_CMD_SEND, sequenceCount) {}
protected:
ReturnValue_t setPayload(const uint8_t* commandData, size_t commandDataLen) { ReturnValue_t setPayload(const uint8_t* commandData, size_t commandDataLen) {
if (commandDataLen > MAX_DATA_LENGTH) { if (commandDataLen > MAX_DATA_LENGTH) {
return INVALID_LENGTH; return INVALID_LENGTH;

2
tmtc

@ -1 +1 @@
Subproject commit b8e1c7afe91bddfea2b139217320033f3a3b0efb Subproject commit 6ec0ce20fa98877c9f88acb5fe9129254291344b