chonky #670

Merged
muellerr merged 278 commits from v3.0.0-dev into main 2023-06-11 14:25:21 +02:00
12 changed files with 62 additions and 55 deletions
Showing only changes of commit e03df2ebca - Show all commits

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

@ -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 12700 12614 0x319c 0x3146 TRANSITION_BACK_TO_OFF MPSOC_FLASH_READ_PACKET_ERROR MEDIUM LOW Could not transition properly and went back to ALL OFF No description mission/payload/PayloadPcduHandler.h linux/payload/PlocMpsocSpecialComHelper.h
195 12701 12615 0x319d 0x3147 NEG_V_OUT_OF_BOUNDS MPSOC_FLASH_READ_FAILED MEDIUM LOW P1: 0 -> too low, 1 -> too high P2: Float value No description mission/payload/PayloadPcduHandler.h linux/payload/PlocMpsocSpecialComHelper.h
196 12702 12616 0x319e 0x3148 U_DRO_OUT_OF_BOUNDS MPSOC_FLASH_READ_SUCCESSFUL MEDIUM INFO P1: 0 -> too low, 1 -> too high P2: Float value No description mission/payload/PayloadPcduHandler.h linux/payload/PlocMpsocSpecialComHelper.h
197 12617 0x3149 MPSOC_READ_TIMEOUT LOW No description linux/payload/PlocMpsocSpecialComHelper.h
198 12703 12700 0x319f 0x319c I_DRO_OUT_OF_BOUNDS TRANSITION_BACK_TO_OFF MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value Could not transition properly and went back to ALL OFF mission/payload/PayloadPcduHandler.h
199 12704 12701 0x31a0 0x319d U_X8_OUT_OF_BOUNDS NEG_V_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value mission/payload/PayloadPcduHandler.h
200 12705 12702 0x31a1 0x319e I_X8_OUT_OF_BOUNDS 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 12700 12614 0x319c 0x3146 TRANSITION_BACK_TO_OFF MPSOC_FLASH_READ_PACKET_ERROR MEDIUM LOW Could not transition properly and went back to ALL OFF No description mission/payload/PayloadPcduHandler.h linux/payload/PlocMpsocSpecialComHelper.h
195 12701 12615 0x319d 0x3147 NEG_V_OUT_OF_BOUNDS MPSOC_FLASH_READ_FAILED MEDIUM LOW P1: 0 -> too low, 1 -> too high P2: Float value No description mission/payload/PayloadPcduHandler.h linux/payload/PlocMpsocSpecialComHelper.h
196 12702 12616 0x319e 0x3148 U_DRO_OUT_OF_BOUNDS MPSOC_FLASH_READ_SUCCESSFUL MEDIUM INFO P1: 0 -> too low, 1 -> too high P2: Float value No description mission/payload/PayloadPcduHandler.h linux/payload/PlocMpsocSpecialComHelper.h
197 12617 0x3149 MPSOC_READ_TIMEOUT LOW No description linux/payload/PlocMpsocSpecialComHelper.h
198 12703 12700 0x319f 0x319c I_DRO_OUT_OF_BOUNDS TRANSITION_BACK_TO_OFF MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value Could not transition properly and went back to ALL OFF mission/payload/PayloadPcduHandler.h
199 12704 12701 0x31a0 0x319d U_X8_OUT_OF_BOUNDS NEG_V_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value mission/payload/PayloadPcduHandler.h
200 12705 12702 0x31a1 0x319e I_X8_OUT_OF_BOUNDS 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:
@ -1209,7 +1220,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

@ -140,7 +140,6 @@ 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) { if (remainingSize > mpsoc::SP_MAX_DATA_SIZE) {
@ -149,7 +148,6 @@ ReturnValue_t PlocMpsocSpecialComHelper::performFlashWrite() {
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 +157,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;
} }
} }
@ -198,8 +193,6 @@ 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;
@ -209,35 +202,31 @@ ReturnValue_t PlocMpsocSpecialComHelper::performFlashRead() {
sif::debug << "reading " << nextReadSize << " bytes from offset " << readSoFar << std::endl; 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;
} }
result = flashfclose();
if (result != returnvalue::OK) {
return result;
}
sif::debug << "read file done" << std::endl; sif::debug << "read file done" << std::endl;
return result; return result;
} }
@ -299,10 +288,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();
@ -346,14 +331,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;
@ -464,14 +448,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..
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);

2
tmtc

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