Compare commits

..

3 Commits

Author SHA1 Message Date
d60f4dd3e3
bump tmtc
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
2024-04-11 10:52:26 +02:00
6a0b18ffd0
that should do the job
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
2024-04-11 10:49:29 +02:00
398e7a3a05
MPSoC file split
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
2024-04-11 10:36:38 +02:00
52 changed files with 387 additions and 3301 deletions

View File

@ -16,50 +16,6 @@ will consitute of a breaking change warranting a new major release:
# [unreleased] # [unreleased]
# [v8.1.0] 2024-05-29
## Fixed
- Small fix for transition failure handling of the MPSoC when the `START_MPSOC` action command
to the supervisor fails.
- Fixed inits of arrays within the `MEKF` not being zeros.
- Important bugfix for PLOC SUPV: The SUPV previously was able to steal packets from the special
communication helper, for example during software updates.
- Corrected sigma of STR for `MEKF`.
## Added
- Added new command to cancel the PLOC SUPV special communication helper.
# [v8.0.0] 2024-05-13
- `eive-tmtc` v7.0.0
## Fixed
- Fixed calculation for target rotation rate during pointing modes.
- Possible fix for MPSoC file read algorithm.
## Changed
- Reworked MPSoC handler to be compatible to new MPSoC software image and use
new device handler base class. This should increase the reliability of the communication
significantly.
- MPSoC device modes IDLE, SNAPSHOT and REPLAY are now modelled using submodes.
- Commanding a submode the device is already in will not result in a completion failure
anymore.
## Added
- Added `VERIFY_BOOT` command for MPSoC.
- New command for MPSoC to store camera image in chunks.
# [v7.8.1] 2024-04-11
## Fixed
- Reverted fix for wrong order in quaternion multiplication for computation of the error quaternion.
# [v7.8.0] 2024-04-10 # [v7.8.0] 2024-04-10
## Changed ## Changed
@ -68,7 +24,7 @@ will consitute of a breaking change warranting a new major release:
- All pointing laws are now allowed to use the `MEKF` per default. - All pointing laws are now allowed to use the `MEKF` per default.
- Changed limits in `PWR Controller`. - Changed limits in `PWR Controller`.
- PUS time service: Now dumps the time before and after relative timeshift or setting absolute time - PUS time service: Now dumps the time before and after relative timeshift or setting absolute time
- The `GPS Controller` does not set itself to `OFF` anymore, if it has not detected a valid fix for - The `GPS Controller` does not set itself to `OFF` anymore, if it has not detected a valid fix for
some time. Instead it attempts to reset both GNSS devices once. some time. Instead it attempts to reset both GNSS devices once.
- The maximum time to reach a fix is shortened from 30min to 15min. - The maximum time to reach a fix is shortened from 30min to 15min.
- The time the reset pin of the GNSS devices is pulled is prolonged from 5ms to 10s. - The time the reset pin of the GNSS devices is pulled is prolonged from 5ms to 10s.
@ -77,7 +33,7 @@ will consitute of a breaking change warranting a new major release:
of the controller is changed. As arguments it now displays the new fix and the numer of fix changes of the controller is changed. As arguments it now displays the new fix and the numer of fix changes
missed. missed.
- The number of satellites seen and used is reset to 0, in case they are set to invalid. - The number of satellites seen and used is reset to 0, in case they are set to invalid.
- Altitude, latitude and longitude messages are not checked anymore, in case the mode message was - Altitude, latitude and longitude messages are not checked anymore, in case the mode message was
already invalid. already invalid.
## Added ## Added
@ -291,7 +247,7 @@ will consitute of a breaking change warranting a new major release:
- `ACS Controller` now has the function `performAttitudeControl` which is called prior to passing - `ACS Controller` now has the function `performAttitudeControl` which is called prior to passing
on to the relevant mode functions. It handles all telemetry relevant functions, which were on to the relevant mode functions. It handles all telemetry relevant functions, which were
always called, regardless of the mode. always called, regardless of the mode.
## Added ## Added
- Higher ACS modes can now be entered without a running `MEKF`. Higher modes will collect their - Higher ACS modes can now be entered without a running `MEKF`. Higher modes will collect their

View File

@ -9,8 +9,8 @@
# ############################################################################## # ##############################################################################
cmake_minimum_required(VERSION 3.13) cmake_minimum_required(VERSION 3.13)
set(OBSW_VERSION_MAJOR 8) set(OBSW_VERSION_MAJOR 7)
set(OBSW_VERSION_MINOR 1) set(OBSW_VERSION_MINOR 8)
set(OBSW_VERSION_REVISION 0) set(OBSW_VERSION_REVISION 0)
# set(CMAKE_VERBOSE TRUE) # set(CMAKE_VERBOSE TRUE)

View File

@ -1,545 +0,0 @@
#include <fsfw/globalfunctions/arrayprinter.h>
#include <fsfw/tasks/TaskFactory.h>
#include <linux/payload/PlocMpsocSpecialComHelperLegacy.h>
#include <unistd.h>
#include <filesystem>
#include <fstream>
#ifdef XIPHOS_Q7S
#include "bsp_q7s/fs/FilesystemHelper.h"
#endif
#include "mission/utility/Timestamp.h"
using namespace ploc;
PlocMpsocSpecialComHelperLegacy::PlocMpsocSpecialComHelperLegacy(object_id_t objectId)
: SystemObject(objectId) {
spParams.buf = commandBuffer;
spParams.maxSize = sizeof(commandBuffer);
}
PlocMpsocSpecialComHelperLegacy::~PlocMpsocSpecialComHelperLegacy() {}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::initialize() {
#ifdef XIPHOS_Q7S
sdcMan = SdCardManager::instance();
if (sdcMan == nullptr) {
sif::warning << "PlocMPSoCHelper::initialize: Invalid SD Card Manager" << std::endl;
return returnvalue::FAILED;
}
#endif
return returnvalue::OK;
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::performOperation(uint8_t operationCode) {
ReturnValue_t result = returnvalue::OK;
semaphore.acquire();
while (true) {
#if OBSW_THREAD_TRACING == 1
trace::threadTrace(opCounter, "PLOC MPSOC Helper");
#endif
switch (internalState) {
case InternalState::IDLE: {
semaphore.acquire();
break;
}
case InternalState::FLASH_WRITE: {
result = performFlashWrite();
if (result == returnvalue::OK) {
triggerEvent(MPSOC_FLASH_WRITE_SUCCESSFUL, sequenceCount->get());
} else {
triggerEvent(MPSOC_FLASH_WRITE_FAILED, sequenceCount->get());
}
internalState = InternalState::IDLE;
break;
}
case InternalState::FLASH_READ: {
result = performFlashRead();
if (result == returnvalue::OK) {
triggerEvent(MPSOC_FLASH_READ_SUCCESSFUL, sequenceCount->get());
} else {
triggerEvent(MPSOC_FLASH_READ_FAILED, sequenceCount->get());
}
internalState = InternalState::IDLE;
break;
}
default:
sif::debug << "PlocMPSoCHelper::performOperation: Invalid state" << std::endl;
break;
}
}
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::setComIF(
DeviceCommunicationIF* communicationInterface_) {
uartComIF = dynamic_cast<SerialComIF*>(communicationInterface_);
if (uartComIF == nullptr) {
sif::warning << "PlocMPSoCHelper::initialize: Invalid uart com if" << std::endl;
return returnvalue::FAILED;
}
return returnvalue::OK;
}
void PlocMpsocSpecialComHelperLegacy::setComCookie(CookieIF* comCookie_) { comCookie = comCookie_; }
void PlocMpsocSpecialComHelperLegacy::setSequenceCount(SourceSequenceCounter* sequenceCount_) {
sequenceCount = sequenceCount_;
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::startFlashWrite(std::string obcFile,
std::string mpsocFile) {
if (internalState != InternalState::IDLE) {
return returnvalue::FAILED;
}
ReturnValue_t result = startFlashReadOrWriteBase(std::move(obcFile), std::move(mpsocFile));
if (result != returnvalue::OK) {
return result;
}
internalState = InternalState::FLASH_WRITE;
return semaphore.release();
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::startFlashRead(std::string obcFile,
std::string mpsocFile,
size_t readFileSize) {
if (internalState != InternalState::IDLE) {
return returnvalue::FAILED;
}
ReturnValue_t result = startFlashReadOrWriteBase(std::move(obcFile), std::move(mpsocFile));
if (result != returnvalue::OK) {
return result;
}
flashReadAndWrite.totalReadSize = readFileSize;
internalState = InternalState::FLASH_READ;
return semaphore.release();
}
void PlocMpsocSpecialComHelperLegacy::resetHelper() {
spParams.buf = commandBuffer;
terminate = false;
uartComIF->flushUartRxBuffer(comCookie);
}
void PlocMpsocSpecialComHelperLegacy::stopProcess() { terminate = true; }
ReturnValue_t PlocMpsocSpecialComHelperLegacy::performFlashWrite() {
ReturnValue_t result = returnvalue::OK;
std::ifstream file(flashReadAndWrite.obcFile, std::ifstream::binary);
if (file.bad()) {
return returnvalue::FAILED;
}
result = flashfopen(mpsoc::FileAccessModes::WRITE | mpsoc::FileAccessModes::OPEN_ALWAYS);
if (result != returnvalue::OK) {
return result;
}
// Set position of next character to end of file input stream
file.seekg(0, file.end);
// tellg returns position of character in input stream
size_t remainingSize = file.tellg();
size_t dataLength = 0;
size_t bytesRead = 0;
while (remainingSize > 0) {
if (terminate) {
return returnvalue::OK;
}
// The minus 4 is necessary for unknown reasons. Maybe some bug in the ILH software?
if (remainingSize > mpsoc::MAX_FLASH_WRITE_DATA_SIZE - 4) {
dataLength = mpsoc::MAX_FLASH_WRITE_DATA_SIZE - 4;
} else {
dataLength = remainingSize;
}
if (file.bad() or not file.is_open()) {
return FILE_WRITE_ERROR;
}
file.seekg(bytesRead, file.beg);
file.read(reinterpret_cast<char*>(fileBuf.data()), dataLength);
bytesRead += dataLength;
remainingSize -= dataLength;
mpsoc::TcFlashWrite tc(spParams, *sequenceCount);
result = tc.setPayload(fileBuf.data(), dataLength);
if (result != returnvalue::OK) {
return result;
}
result = tc.finishPacket();
if (result != returnvalue::OK) {
return result;
}
(*sequenceCount)++;
result = handlePacketTransmissionNoReply(tc);
if (result != returnvalue::OK) {
return result;
}
}
result = flashfclose();
if (result != returnvalue::OK) {
return result;
}
return result;
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::performFlashRead() {
std::error_code e;
std::ofstream ofile(flashReadAndWrite.obcFile, std::ios::trunc | std::ios::binary);
if (ofile.bad()) {
return returnvalue::FAILED;
}
ReturnValue_t result = flashfopen(mpsoc::FileAccessModes::READ);
if (result != returnvalue::OK) {
std::filesystem::remove(flashReadAndWrite.obcFile, e);
return result;
}
size_t readSoFar = 0;
size_t nextReadSize = mpsoc::MAX_FLASH_READ_DATA_SIZE;
while (readSoFar < flashReadAndWrite.totalReadSize) {
if (terminate) {
std::filesystem::remove(flashReadAndWrite.obcFile, e);
return returnvalue::OK;
}
nextReadSize = mpsoc::MAX_FLASH_READ_DATA_SIZE;
if (flashReadAndWrite.totalReadSize - readSoFar < mpsoc::MAX_FLASH_READ_DATA_SIZE) {
nextReadSize = flashReadAndWrite.totalReadSize - readSoFar;
}
if (ofile.bad() or not ofile.is_open()) {
std::filesystem::remove(flashReadAndWrite.obcFile, e);
return FILE_READ_ERROR;
}
mpsoc::TcFlashRead flashReadRequest(spParams, *sequenceCount);
result = flashReadRequest.setPayload(nextReadSize);
if (result != returnvalue::OK) {
std::filesystem::remove(flashReadAndWrite.obcFile, e);
return result;
}
result = flashReadRequest.finishPacket();
if (result != returnvalue::OK) {
std::filesystem::remove(flashReadAndWrite.obcFile, e);
return result;
}
(*sequenceCount)++;
result = handlePacketTransmissionFlashRead(flashReadRequest, ofile, nextReadSize);
if (result != returnvalue::OK) {
std::filesystem::remove(flashReadAndWrite.obcFile, e);
return result;
}
readSoFar += nextReadSize;
}
result = flashfclose();
if (result != returnvalue::OK) {
return result;
}
return result;
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::flashfopen(uint8_t mode) {
spParams.buf = commandBuffer;
mpsoc::FlashFopen flashFopen(spParams, *sequenceCount);
ReturnValue_t result = flashFopen.setPayload(flashReadAndWrite.mpsocFile, mode);
if (result != returnvalue::OK) {
return result;
}
result = flashFopen.finishPacket();
if (result != returnvalue::OK) {
return result;
}
(*sequenceCount)++;
result = handlePacketTransmissionNoReply(flashFopen);
if (result != returnvalue::OK) {
return result;
}
return returnvalue::OK;
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::flashfclose() {
spParams.buf = commandBuffer;
mpsoc::FlashFclose flashFclose(spParams, *sequenceCount);
ReturnValue_t result = flashFclose.finishPacket();
if (result != returnvalue::OK) {
return result;
}
(*sequenceCount)++;
result = handlePacketTransmissionNoReply(flashFclose);
if (result != returnvalue::OK) {
return result;
}
return result;
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::handlePacketTransmissionFlashRead(
mpsoc::TcFlashRead& tc, std::ofstream& ofile, size_t expectedReadLen) {
ReturnValue_t result = sendCommand(tc);
if (result != returnvalue::OK) {
return result;
}
result = handleAck();
if (result != returnvalue::OK) {
return result;
}
result = handleTmReception();
if (result != returnvalue::OK) {
return result;
}
// We have the nominal case where the flash read report appears first, or the case where we
// get an EXE failure immediately.
if (spReader.getApid() == mpsoc::apid::TM_FLASH_READ_REPORT) {
result = handleFlashReadReply(ofile, expectedReadLen);
if (result != returnvalue::OK) {
return result;
}
return handleExe();
} else if (spReader.getApid() == mpsoc::apid::EXE_FAILURE) {
handleExeFailure();
} else {
triggerEvent(MPSOC_EXE_INVALID_APID, spReader.getApid(), static_cast<uint32_t>(internalState));
sif::warning << "PLOC MPSoC: Expected execution report "
<< "but received space packet with apid " << std::hex << spReader.getApid()
<< std::endl;
}
return returnvalue::FAILED;
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::handlePacketTransmissionNoReply(ploc::SpTcBase& tc) {
ReturnValue_t result = sendCommand(tc);
if (result != returnvalue::OK) {
return result;
}
result = handleAck();
if (result != returnvalue::OK) {
return result;
}
return handleExe();
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::sendCommand(ploc::SpTcBase& tc) {
ReturnValue_t result = returnvalue::OK;
result = uartComIF->sendMessage(comCookie, tc.getFullPacket(), tc.getFullPacketLen());
if (result != returnvalue::OK) {
sif::warning << "PlocMPSoCHelper::sendCommand: Failed to send command" << std::endl;
triggerEvent(MPSOC_SENDING_COMMAND_FAILED, result, static_cast<uint32_t>(internalState));
return result;
}
return result;
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::handleAck() {
ReturnValue_t result = returnvalue::OK;
result = handleTmReception();
if (result != returnvalue::OK) {
return result;
}
result = checkReceivedTm();
if (result != returnvalue::OK) {
return result;
}
uint16_t apid = spReader.getApid();
if (apid != mpsoc::apid::ACK_SUCCESS) {
handleAckApidFailure(spReader);
return returnvalue::FAILED;
}
return returnvalue::OK;
}
void PlocMpsocSpecialComHelperLegacy::handleAckApidFailure(const ploc::SpTmReader& reader) {
uint16_t apid = reader.getApid();
if (apid == mpsoc::apid::ACK_FAILURE) {
uint16_t status = mpsoc::getStatusFromRawData(reader.getFullData());
sif::warning << "PLOC MPSoC ACK Failure: " << mpsoc::getStatusString(status) << std::endl;
triggerEvent(MPSOC_ACK_FAILURE_REPORT, static_cast<uint32_t>(internalState), status);
} else {
triggerEvent(MPSOC_ACK_INVALID_APID, apid, static_cast<uint32_t>(internalState));
sif::warning << "PlocMPSoCHelper::handleAckApidFailure: Expected acknowledgement report "
<< "but received space packet with apid " << std::hex << apid << std::endl;
}
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::handleExe() {
ReturnValue_t result = returnvalue::OK;
result = handleTmReception();
if (result != returnvalue::OK) {
return result;
}
result = checkReceivedTm();
if (result != returnvalue::OK) {
return result;
}
uint16_t apid = spReader.getApid();
if (apid == mpsoc::apid::EXE_FAILURE) {
handleExeFailure();
return returnvalue::FAILED;
} else if (apid != mpsoc::apid::EXE_SUCCESS) {
triggerEvent(MPSOC_EXE_INVALID_APID, apid, static_cast<uint32_t>(internalState));
sif::warning << "PLOC MPSoC: Expected execution report "
<< "but received space packet with apid " << std::hex << apid << std::endl;
}
return returnvalue::OK;
}
void PlocMpsocSpecialComHelperLegacy::handleExeFailure() {
uint16_t status = mpsoc::getStatusFromRawData(spReader.getFullData());
sif::warning << "PLOC MPSoC EXE Failure: " << mpsoc::getStatusString(status) << std::endl;
triggerEvent(MPSOC_EXE_FAILURE_REPORT, static_cast<uint32_t>(internalState));
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::handleTmReception() {
ReturnValue_t result = returnvalue::OK;
tmCountdown.resetTimer();
size_t readBytes = 0;
size_t currentBytes = 0;
uint32_t usleepDelay = 5;
size_t fullPacketLen = 0;
while (true) {
if (tmCountdown.hasTimedOut()) {
triggerEvent(MPSOC_READ_TIMEOUT, tmCountdown.getTimeoutMs());
return returnvalue::FAILED;
}
result = receive(tmBuf.data() + readBytes, 6, &currentBytes);
if (result != returnvalue::OK) {
return result;
}
spReader.setReadOnlyData(tmBuf.data(), tmBuf.size());
fullPacketLen = spReader.getFullPacketLen();
readBytes += currentBytes;
if (readBytes == 6) {
break;
}
usleep(usleepDelay);
if (usleepDelay < 200000) {
usleepDelay *= 4;
}
}
while (true) {
if (tmCountdown.hasTimedOut()) {
triggerEvent(MPSOC_READ_TIMEOUT, tmCountdown.getTimeoutMs());
return returnvalue::FAILED;
}
result = receive(tmBuf.data() + readBytes, fullPacketLen - readBytes, &currentBytes);
readBytes += currentBytes;
if (fullPacketLen == readBytes) {
break;
}
usleep(usleepDelay);
if (usleepDelay < 200000) {
usleepDelay *= 4;
}
}
// arrayprinter::print(tmBuf.data(), readBytes);
return result;
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::handleFlashReadReply(std::ofstream& ofile,
size_t expectedReadLen) {
ReturnValue_t result = checkReceivedTm();
if (result != returnvalue::OK) {
return result;
}
uint16_t apid = spReader.getApid();
if (apid != mpsoc::apid::TM_FLASH_READ_REPORT) {
triggerEvent(MPSOC_FLASH_READ_PACKET_ERROR, FlashReadErrorType::FLASH_READ_APID_ERROR);
sif::warning << "PLOC MPSoC Flash Read: Unexpected APID" << std::endl;
return result;
}
const uint8_t* packetData = spReader.getPacketData();
size_t deserDummy = spReader.getPacketDataLen() - mpsoc::CRC_SIZE;
uint32_t receivedReadLen = 0;
// I think this is buggy, weird stuff in the short name field.
// std::string receivedShortName = std::string(reinterpret_cast<const char*>(packetData), 12);
// if (receivedShortName != flashReadAndWrite.mpsocFile.substr(0, 11)) {
// sif::warning << "PLOC MPSoC Flash Read: Missmatch between request file name and "
// "received file name"
// << std::endl;
// triggerEvent(MPSOC_FLASH_READ_PACKET_ERROR, FlashReadErrorType::FLASH_READ_FILENAME_ERROR);
// return returnvalue::FAILED;
// }
packetData += 12;
result = SerializeAdapter::deSerialize(&receivedReadLen, &packetData, &deserDummy,
SerializeIF::Endianness::NETWORK);
if (result != returnvalue::OK) {
return result;
}
if (receivedReadLen != expectedReadLen) {
sif::warning << "PLOC MPSoC Flash Read: Missmatch between request read length and "
"received read length"
<< std::endl;
triggerEvent(MPSOC_FLASH_READ_PACKET_ERROR, FlashReadErrorType::FLASH_READ_READLEN_ERROR);
return returnvalue::FAILED;
}
ofile.write(reinterpret_cast<const char*>(packetData), receivedReadLen);
return returnvalue::OK;
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::fileCheck(std::string obcFile) {
#ifdef XIPHOS_Q7S
ReturnValue_t result = FilesystemHelper::checkPath(obcFile);
if (result != returnvalue::OK) {
return result;
}
#elif defined(TE0720_1CFA)
if (not std::filesystem::exists(obcFile)) {
sif::warning << "PlocMPSoCHelper::startFlashWrite: File " << obcFile << "does not exist"
<< std::endl;
return returnvalue::FAILED;
}
#endif
return returnvalue::OK;
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::startFlashReadOrWriteBase(std::string obcFile,
std::string mpsocFile) {
ReturnValue_t result = fileCheck(obcFile);
if (result != returnvalue::OK) {
return result;
}
flashReadAndWrite.obcFile = std::move(obcFile);
flashReadAndWrite.mpsocFile = std::move(mpsocFile);
resetHelper();
return returnvalue::OK;
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::checkReceivedTm() {
ReturnValue_t result = spReader.checkSize();
if (result != returnvalue::OK) {
sif::error << "PLOC MPSoC: Size check on received TM failed" << std::endl;
triggerEvent(MPSOC_TM_SIZE_ERROR);
return result;
}
result = spReader.checkCrc();
if (result != returnvalue::OK) {
sif::warning << "PLOC MPSoC: CRC check failed" << std::endl;
triggerEvent(MPSOC_TM_CRC_MISSMATCH, *sequenceCount);
return result;
}
uint16_t recvSeqCnt = spReader.getSequenceCount();
if (recvSeqCnt != *sequenceCount) {
triggerEvent(MPSOC_HELPER_SEQ_CNT_MISMATCH, *sequenceCount, recvSeqCnt);
*sequenceCount = recvSeqCnt;
}
// This sequence count ping pong does not make any sense but it is how the MPSoC expects it.
(*sequenceCount)++;
return returnvalue::OK;
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::receive(uint8_t* data, size_t requestBytes,
size_t* readBytes) {
ReturnValue_t result = returnvalue::OK;
uint8_t* buffer = nullptr;
result = uartComIF->requestReceiveMessage(comCookie, requestBytes);
if (result != returnvalue::OK) {
sif::warning << "PlocMPSoCHelper::receive: Failed to request reply" << std::endl;
triggerEvent(MPSOC_HELPER_REQUESTING_REPLY_FAILED, result,
static_cast<uint32_t>(static_cast<uint32_t>(internalState)));
return returnvalue::FAILED;
}
result = uartComIF->readReceivedMessage(comCookie, &buffer, readBytes);
if (result != returnvalue::OK) {
sif::warning << "PlocMPSoCHelper::receive: Failed to read received message" << std::endl;
triggerEvent(MPSOC_HELPER_READING_REPLY_FAILED, result, static_cast<uint32_t>(internalState));
return returnvalue::FAILED;
}
if (*readBytes > 0) {
std::memcpy(data, buffer, *readBytes);
}
return result;
}

View File

@ -1,200 +0,0 @@
#ifndef BSP_Q7S_DEVICES_PLOCMPSOCHELPER_H_
#define BSP_Q7S_DEVICES_PLOCMPSOCHELPER_H_
#include <linux/payload/plocMpsocHelpers.h>
#include <mission/utility/trace.h>
#include <string>
#include "OBSWConfig.h"
#include "fsfw/devicehandlers/CookieIF.h"
#include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/osal/linux/BinarySemaphore.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/tasks/ExecutableObjectIF.h"
#include "fsfw/tmtcservices/SourceSequenceCounter.h"
#include "fsfw_hal/linux/serial/SerialComIF.h"
#ifdef XIPHOS_Q7S
#include "bsp_q7s/fs/SdCardManager.h"
#endif
/**
* @brief Helper class for MPSoC of PLOC intended to accelerate large data transfers between
* MPSoC and OBC.
* @author J. Meier
*/
class PlocMpsocSpecialComHelperLegacy : public SystemObject, public ExecutableObjectIF {
public:
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_MPSOC_HELPER;
//! [EXPORT] : [COMMENT] Flash write fails
static const Event MPSOC_FLASH_WRITE_FAILED = MAKE_EVENT(0, severity::LOW);
//! [EXPORT] : [COMMENT] Flash write successful
static const Event MPSOC_FLASH_WRITE_SUCCESSFUL = MAKE_EVENT(1, severity::INFO);
//! [EXPORT] : [COMMENT] Communication interface returned failure when trying to send the command
//! to the MPSoC
//! P1: Return value returned by the communication interface sendMessage function
//! P2: Internal state of MPSoC helper
static const Event MPSOC_SENDING_COMMAND_FAILED = MAKE_EVENT(2, severity::LOW);
//! [EXPORT] : [COMMENT] Request receive message of communication interface failed
//! P1: Return value returned by the communication interface requestReceiveMessage function
//! P2: Internal state of MPSoC helper
static const Event MPSOC_HELPER_REQUESTING_REPLY_FAILED = MAKE_EVENT(3, severity::LOW);
//! [EXPORT] : [COMMENT] Reading receive message of communication interface failed
//! P1: Return value returned by the communication interface readingReceivedMessage function
//! P2: Internal state of MPSoC helper
static const Event MPSOC_HELPER_READING_REPLY_FAILED = MAKE_EVENT(4, severity::LOW);
//! [EXPORT] : [COMMENT] Did not receive acknowledgment report
//! P1: Number of bytes missing
//! P2: Internal state of MPSoC helper
static const Event MPSOC_MISSING_ACK = MAKE_EVENT(5, severity::LOW);
//! [EXPORT] : [COMMENT] Did not receive execution report
//! P1: Number of bytes missing
//! P2: Internal state of MPSoC helper
static const Event MPSOC_MISSING_EXE = MAKE_EVENT(6, severity::LOW);
//! [EXPORT] : [COMMENT] Received acknowledgment failure report
//! P1: Internal state of MPSoC
static const Event MPSOC_ACK_FAILURE_REPORT = MAKE_EVENT(7, severity::LOW);
//! [EXPORT] : [COMMENT] Received execution failure report
//! P1: Internal state of MPSoC
static const Event MPSOC_EXE_FAILURE_REPORT = MAKE_EVENT(8, severity::LOW);
//! [EXPORT] : [COMMENT] Expected acknowledgment report but received space packet with other apid
//! P1: Apid of received space packet
//! P2: Internal state of MPSoC
static const Event MPSOC_ACK_INVALID_APID = MAKE_EVENT(9, severity::LOW);
//! [EXPORT] : [COMMENT] Expected execution report but received space packet with other apid
//! P1: Apid of received space packet
//! P2: Internal state of MPSoC
static const Event MPSOC_EXE_INVALID_APID = MAKE_EVENT(10, severity::LOW);
//! [EXPORT] : [COMMENT] Received sequence count does not match expected sequence count
//! P1: Expected sequence count
//! P2: Received sequence count
static const Event MPSOC_HELPER_SEQ_CNT_MISMATCH = MAKE_EVENT(11, severity::LOW);
static const Event MPSOC_TM_SIZE_ERROR = MAKE_EVENT(12, severity::LOW);
static const Event MPSOC_TM_CRC_MISSMATCH = MAKE_EVENT(13, severity::LOW);
static const Event MPSOC_FLASH_READ_PACKET_ERROR = MAKE_EVENT(14, severity::LOW);
static const Event MPSOC_FLASH_READ_FAILED = MAKE_EVENT(15, severity::LOW);
static const Event MPSOC_FLASH_READ_SUCCESSFUL = MAKE_EVENT(16, severity::INFO);
static const Event MPSOC_READ_TIMEOUT = MAKE_EVENT(17, severity::LOW);
enum FlashReadErrorType : uint32_t {
FLASH_READ_APID_ERROR = 0,
FLASH_READ_FILENAME_ERROR = 1,
FLASH_READ_READLEN_ERROR = 2
};
PlocMpsocSpecialComHelperLegacy(object_id_t objectId);
virtual ~PlocMpsocSpecialComHelperLegacy();
ReturnValue_t initialize() override;
ReturnValue_t performOperation(uint8_t operationCode = 0) override;
ReturnValue_t setComIF(DeviceCommunicationIF* communicationInterface_);
void setComCookie(CookieIF* comCookie_);
/**
* @brief Starts flash write sequence
*
* @param obcFile File where to read from the data
* @param mpsocFile The file of the MPSoC where should be written to
*
* @return returnvalue::OK if successful, otherwise error return value
*/
ReturnValue_t startFlashWrite(std::string obcFile, std::string mpsocFile);
/**
*
* @param obcFile Full target file name on OBC
* @param mpsocFile The file on the MPSoC which should be copied ot the OBC
* @param readFileSize The size of the file on the MPSoC.
* @return
*/
ReturnValue_t startFlashRead(std::string obcFile, std::string mpsocFile, size_t readFileSize);
/**
* @brief Can be used to interrupt a running data transfer.
*/
void stopProcess();
/**
* @brief Sets the sequence count object responsible for the sequence count handling
*/
void setSequenceCount(SourceSequenceCounter* sequenceCount_);
private:
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_MPSOC_HELPER;
//! [EXPORT] : [COMMENT] File error occured for file transfers from OBC to the MPSoC.
static const ReturnValue_t FILE_WRITE_ERROR = MAKE_RETURN_CODE(0xA0);
//! [EXPORT] : [COMMENT] File error occured for file transfers from MPSoC to OBC.
static const ReturnValue_t FILE_READ_ERROR = MAKE_RETURN_CODE(0xA1);
// Maximum number of times the communication interface retries polling data from the reply
// buffer
static const int RETRIES = 10000;
struct FlashInfo {
std::string obcFile;
std::string mpsocFile;
};
struct FlashRead : public FlashInfo {
size_t totalReadSize = 0;
};
struct FlashRead flashReadAndWrite;
#if OBSW_THREAD_TRACING == 1
uint32_t opCounter = 0;
#endif
enum class InternalState { IDLE, FLASH_WRITE, FLASH_READ };
InternalState internalState = InternalState::IDLE;
BinarySemaphore semaphore;
#ifdef XIPHOS_Q7S
SdCardManager* sdcMan = nullptr;
#endif
uint8_t commandBuffer[mpsoc::MAX_COMMAND_SIZE];
SpacePacketCreator creator;
ploc::SpTcParams spParams = ploc::SpTcParams(creator);
Countdown tmCountdown = Countdown(5000);
std::array<uint8_t, mpsoc::SP_MAX_DATA_SIZE> fileBuf{};
std::array<uint8_t, mpsoc::MAX_REPLY_SIZE> tmBuf{};
bool terminate = false;
/**
* Communication interface of MPSoC responsible for low level access. Must be set by the
* MPSoC Handler.
*/
SerialComIF* uartComIF = nullptr;
// Communication cookie. Must be set by the MPSoC Handler
CookieIF* comCookie = nullptr;
// Sequence count, must be set by Ploc MPSoC Handler
SourceSequenceCounter* sequenceCount = nullptr;
ploc::SpTmReader spReader;
void resetHelper();
ReturnValue_t performFlashWrite();
ReturnValue_t performFlashRead();
ReturnValue_t flashfopen(uint8_t accessMode);
ReturnValue_t flashfclose();
ReturnValue_t handlePacketTransmissionNoReply(ploc::SpTcBase& tc);
ReturnValue_t handlePacketTransmissionFlashRead(mpsoc::TcFlashRead& tc, std::ofstream& ofile,
size_t expectedReadLen);
ReturnValue_t handleFlashReadReply(std::ofstream& ofile, size_t expectedReadLen);
ReturnValue_t sendCommand(ploc::SpTcBase& tc);
ReturnValue_t receive(uint8_t* data, size_t requestBytes, size_t* readBytes);
ReturnValue_t handleAck();
ReturnValue_t handleExe();
ReturnValue_t startFlashReadOrWriteBase(std::string obcFile, std::string mpsocFile);
ReturnValue_t fileCheck(std::string obcFile);
void handleAckApidFailure(const ploc::SpTmReader& reader);
void handleExeFailure();
ReturnValue_t handleTmReception();
ReturnValue_t checkReceivedTm();
};
#endif /* BSP_Q7S_DEVICES_PLOCMPSOCHELPER_H_ */

View File

@ -1,7 +1,7 @@
/** /**
* @brief Auto-generated event translation file. Contains 325 translations. * @brief Auto-generated event translation file. Contains 324 translations.
* @details * @details
* Generated on: 2024-05-06 13:47:38 * Generated on: 2024-04-10 11:49:35
*/ */
#include "translateEvents.h" #include "translateEvents.h"
@ -142,7 +142,6 @@ const char *MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH_STRING = "MPSOC_HANDLER_SEQUEN
const char *MPSOC_SHUTDOWN_FAILED_STRING = "MPSOC_SHUTDOWN_FAILED"; const char *MPSOC_SHUTDOWN_FAILED_STRING = "MPSOC_SHUTDOWN_FAILED";
const char *SUPV_NOT_ON_STRING = "SUPV_NOT_ON"; const char *SUPV_NOT_ON_STRING = "SUPV_NOT_ON";
const char *SUPV_REPLY_TIMEOUT_STRING = "SUPV_REPLY_TIMEOUT"; const char *SUPV_REPLY_TIMEOUT_STRING = "SUPV_REPLY_TIMEOUT";
const char *CAM_MUST_BE_ON_FOR_SNAPSHOT_MODE_STRING = "CAM_MUST_BE_ON_FOR_SNAPSHOT_MODE";
const char *SELF_TEST_I2C_FAILURE_STRING = "SELF_TEST_I2C_FAILURE"; const char *SELF_TEST_I2C_FAILURE_STRING = "SELF_TEST_I2C_FAILURE";
const char *SELF_TEST_SPI_FAILURE_STRING = "SELF_TEST_SPI_FAILURE"; const char *SELF_TEST_SPI_FAILURE_STRING = "SELF_TEST_SPI_FAILURE";
const char *SELF_TEST_ADC_FAILURE_STRING = "SELF_TEST_ADC_FAILURE"; const char *SELF_TEST_ADC_FAILURE_STRING = "SELF_TEST_ADC_FAILURE";
@ -607,8 +606,6 @@ const char *translateEvents(Event event) {
return SUPV_NOT_ON_STRING; return SUPV_NOT_ON_STRING;
case (11608): case (11608):
return SUPV_REPLY_TIMEOUT_STRING; return SUPV_REPLY_TIMEOUT_STRING;
case (11609):
return CAM_MUST_BE_ON_FOR_SNAPSHOT_MODE_STRING;
case (11701): case (11701):
return SELF_TEST_I2C_FAILURE_STRING; return SELF_TEST_I2C_FAILURE_STRING;
case (11702): case (11702):

View File

@ -1,8 +1,8 @@
/** /**
* @brief Auto-generated object translation file. * @brief Auto-generated object translation file.
* @details * @details
* Contains 176 translations. * Contains 175 translations.
* Generated on: 2024-05-06 13:47:38 * Generated on: 2024-04-10 11:49:35
*/ */
#include "translateObjects.h" #include "translateObjects.h"
@ -65,7 +65,6 @@ const char *PTME_VC3_CFDP_TM_STRING = "PTME_VC3_CFDP_TM";
const char *PLOC_MPSOC_HANDLER_STRING = "PLOC_MPSOC_HANDLER"; const char *PLOC_MPSOC_HANDLER_STRING = "PLOC_MPSOC_HANDLER";
const char *PLOC_SUPERVISOR_HANDLER_STRING = "PLOC_SUPERVISOR_HANDLER"; const char *PLOC_SUPERVISOR_HANDLER_STRING = "PLOC_SUPERVISOR_HANDLER";
const char *PLOC_SUPERVISOR_HELPER_STRING = "PLOC_SUPERVISOR_HELPER"; const char *PLOC_SUPERVISOR_HELPER_STRING = "PLOC_SUPERVISOR_HELPER";
const char *PLOC_MPSOC_COMMUNICATION_STRING = "PLOC_MPSOC_COMMUNICATION";
const char *SCEX_STRING = "SCEX"; const char *SCEX_STRING = "SCEX";
const char *SOLAR_ARRAY_DEPL_HANDLER_STRING = "SOLAR_ARRAY_DEPL_HANDLER"; const char *SOLAR_ARRAY_DEPL_HANDLER_STRING = "SOLAR_ARRAY_DEPL_HANDLER";
const char *HEATER_HANDLER_STRING = "HEATER_HANDLER"; const char *HEATER_HANDLER_STRING = "HEATER_HANDLER";
@ -303,8 +302,6 @@ const char *translateObject(object_id_t object) {
return PLOC_SUPERVISOR_HANDLER_STRING; return PLOC_SUPERVISOR_HANDLER_STRING;
case 0x44330017: case 0x44330017:
return PLOC_SUPERVISOR_HELPER_STRING; return PLOC_SUPERVISOR_HELPER_STRING;
case 0x44330018:
return PLOC_MPSOC_COMMUNICATION_STRING;
case 0x44330032: case 0x44330032:
return SCEX_STRING; return SCEX_STRING;
case 0x444100A2: case 0x444100A2:

View File

@ -39,6 +39,8 @@
#include "devices/gpioIds.h" #include "devices/gpioIds.h"
#include "fsfw_hal/linux/gpio/Gpio.h" #include "fsfw_hal/linux/gpio/Gpio.h"
#include "linux/payload/FreshSupvHandler.h" #include "linux/payload/FreshSupvHandler.h"
#include "linux/payload/PlocMpsocHandler.h"
#include "linux/payload/PlocMpsocSpecialComHelper.h"
#include "linux/payload/PlocSupvUartMan.h" #include "linux/payload/PlocSupvUartMan.h"
#include "test/gpio/DummyGpioIF.h" #include "test/gpio/DummyGpioIF.h"
#endif #endif
@ -77,10 +79,7 @@ void ObjectFactory::produce(void* args) {
switcherList.emplace_back(initVal); switcherList.emplace_back(initVal);
} }
dummySwitcher->setInitialSwitcherList(switcherList); dummySwitcher->setInitialSwitcherList(switcherList);
#ifdef PLATFORM_UNIX #ifdef PLATFORM_UNIX
// Obsolete dev handler..
/*
new SerialComIF(objects::UART_COM_IF); new SerialComIF(objects::UART_COM_IF);
#if OBSW_ADD_PLOC_MPSOC == 1 #if OBSW_ADD_PLOC_MPSOC == 1
std::string mpscoDev = ""; std::string mpscoDev = "";
@ -91,8 +90,7 @@ void ObjectFactory::produce(void* args) {
new PlocMpsocHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocCookie, new PlocMpsocHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocCookie,
plocMpsocHelper, Gpio(gpioIds::ENABLE_MPSOC_UART, dummyGpioIF), plocMpsocHelper, Gpio(gpioIds::ENABLE_MPSOC_UART, dummyGpioIF),
objects::PLOC_SUPERVISOR_HANDLER); objects::PLOC_SUPERVISOR_HANDLER);
#endif // OBSW_ADD_PLOC_MPSOC == 1 #endif /* OBSW_ADD_PLOC_MPSOC == 1 */
*/
#if OBSW_ADD_PLOC_SUPERVISOR == 1 #if OBSW_ADD_PLOC_SUPERVISOR == 1
std::string plocSupvString = "/dev/ploc_supv"; std::string plocSupvString = "/dev/ploc_supv";
auto supervisorCookie = auto supervisorCookie =

View File

@ -10,9 +10,8 @@
#include <linux/acs/RwPollingTask.h> #include <linux/acs/RwPollingTask.h>
#include <linux/acs/StrComHandler.h> #include <linux/acs/StrComHandler.h>
#include <linux/com/SyrlinksComHandler.h> #include <linux/com/SyrlinksComHandler.h>
#include <linux/payload/FreshMpsocHandler.h>
#include <linux/payload/MpsocCommunication.h>
#include <linux/payload/PlocMemoryDumper.h> #include <linux/payload/PlocMemoryDumper.h>
#include <linux/payload/PlocMpsocHandler.h>
#include <linux/payload/PlocMpsocSpecialComHelper.h> #include <linux/payload/PlocMpsocSpecialComHelper.h>
#include <linux/payload/ScexUartReader.h> #include <linux/payload/ScexUartReader.h>
#include <linux/payload/plocMpsocHelpers.h> #include <linux/payload/plocMpsocHelpers.h>
@ -48,7 +47,6 @@
#include "devices/gpioIds.h" #include "devices/gpioIds.h"
#include "devices/powerSwitcherList.h" #include "devices/powerSwitcherList.h"
#include "eive/definitions.h" #include "eive/definitions.h"
#include "eive/objects.h"
#include "fsfw/ipc/QueueFactory.h" #include "fsfw/ipc/QueueFactory.h"
#include "linux/ObjectFactory.h" #include "linux/ObjectFactory.h"
#include "linux/boardtest/I2cTestClass.h" #include "linux/boardtest/I2cTestClass.h"
@ -61,11 +59,7 @@
#include "linux/ipcore/Ptme.h" #include "linux/ipcore/Ptme.h"
#include "linux/ipcore/PtmeConfig.h" #include "linux/ipcore/PtmeConfig.h"
#include "linux/payload/FreshSupvHandler.h" #include "linux/payload/FreshSupvHandler.h"
#include "linux/payload/MpsocCommunication.h"
#include "linux/payload/PlocMpsocSpecialComHelper.h"
#include "linux/payload/SerialConfig.h"
#include "mission/config/configfile.h" #include "mission/config/configfile.h"
#include "mission/power/defs.h"
#include "mission/system/acs/AcsBoardFdir.h" #include "mission/system/acs/AcsBoardFdir.h"
#include "mission/system/acs/AcsSubsystem.h" #include "mission/system/acs/AcsSubsystem.h"
#include "mission/system/acs/RwAssembly.h" #include "mission/system/acs/RwAssembly.h"
@ -73,7 +67,7 @@
#include "mission/system/acs/acsModeTree.h" #include "mission/system/acs/acsModeTree.h"
#include "mission/system/com/SyrlinksFdir.h" #include "mission/system/com/SyrlinksFdir.h"
#include "mission/system/com/comModeTree.h" #include "mission/system/com/comModeTree.h"
#include "mission/system/payload/payloadModeTree.h" #include "mission/system/payloadModeTree.h"
#include "mission/system/power/GomspacePowerFdir.h" #include "mission/system/power/GomspacePowerFdir.h"
#include "mission/system/tcs/RtdFdir.h" #include "mission/system/tcs/RtdFdir.h"
#include "mission/system/tcs/TcsBoardAssembly.h" #include "mission/system/tcs/TcsBoardAssembly.h"
@ -630,15 +624,14 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwit
auto mpsocGpioCookie = new GpioCookie; auto mpsocGpioCookie = new GpioCookie;
mpsocGpioCookie->addGpio(gpioIds::ENABLE_MPSOC_UART, gpioConfigMPSoC); mpsocGpioCookie->addGpio(gpioIds::ENABLE_MPSOC_UART, gpioConfigMPSoC);
gpioChecker(gpioComIF->addGpios(mpsocGpioCookie), "PLOC MPSoC"); gpioChecker(gpioComIF->addGpios(mpsocGpioCookie), "PLOC MPSoC");
SerialConfig serialCfg(q7s::UART_PLOC_MPSOC_DEV, serial::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE, auto mpsocCookie =
UartModes::NON_CANONICAL); new SerialCookie(objects::PLOC_MPSOC_HANDLER, q7s::UART_PLOC_MPSOC_DEV,
auto mpsocCommunication = new MpsocCommunication(objects::PLOC_MPSOC_COMMUNICATION, serialCfg); serial::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE, UartModes::NON_CANONICAL);
auto specialComHelper = mpsocCookie->setNoFixedSizeReply();
new PlocMpsocSpecialComHelper(objects::PLOC_MPSOC_HELPER, *mpsocCommunication); auto plocMpsocHelper = new PlocMpsocSpecialComHelper(objects::PLOC_MPSOC_HELPER);
DhbConfig dhbConf(objects::PLOC_MPSOC_HANDLER); auto* mpsocHandler = new PlocMpsocHandler(
auto* mpsocHandler = new FreshMpsocHandler( objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocCookie, plocMpsocHelper,
dhbConf, *mpsocCommunication, *specialComHelper, Gpio(gpioIds::ENABLE_MPSOC_UART, gpioComIF), Gpio(gpioIds::ENABLE_MPSOC_UART, gpioComIF), objects::PLOC_SUPERVISOR_HANDLER);
objects::PLOC_SUPERVISOR_HANDLER, pwrSwitcher, power::PDU2_CH8_PAYLOAD_CAMERA);
mpsocHandler->connectModeTreeParent(satsystem::payload::SUBSYSTEM); mpsocHandler->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */ #endif /* OBSW_ADD_PLOC_MPSOC == 1 */
#if OBSW_ADD_PLOC_SUPERVISOR == 1 #if OBSW_ADD_PLOC_SUPERVISOR == 1
@ -657,7 +650,7 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwit
supv::MAX_PACKET_SIZE * 20, UartModes::NON_CANONICAL); supv::MAX_PACKET_SIZE * 20, UartModes::NON_CANONICAL);
supervisorCookie->setNoFixedSizeReply(); supervisorCookie->setNoFixedSizeReply();
new PlocSupvUartManager(objects::PLOC_SUPERVISOR_HELPER); new PlocSupvUartManager(objects::PLOC_SUPERVISOR_HELPER);
dhbConf = DhbConfig(objects::PLOC_SUPERVISOR_HANDLER); DhbConfig dhbConf(objects::PLOC_SUPERVISOR_HANDLER);
auto* supvHandler = auto* supvHandler =
new FreshSupvHandler(dhbConf, supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF), new FreshSupvHandler(dhbConf, supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF),
pwrSwitcher, power::PDU1_CH6_PLOC_12V); pwrSwitcher, power::PDU1_CH6_PLOC_12V);

View File

@ -77,7 +77,6 @@ enum commonObjects : uint32_t {
PLOC_MPSOC_HANDLER = 0x44330015, PLOC_MPSOC_HANDLER = 0x44330015,
PLOC_SUPERVISOR_HANDLER = 0x44330016, PLOC_SUPERVISOR_HANDLER = 0x44330016,
PLOC_SUPERVISOR_HELPER = 0x44330017, PLOC_SUPERVISOR_HELPER = 0x44330017,
PLOC_MPSOC_COMMUNICATION = 0x44330018,
SCEX = 0x44330032, SCEX = 0x44330032,
SOLAR_ARRAY_DEPL_HANDLER = 0x444100A2, SOLAR_ARRAY_DEPL_HANDLER = 0x444100A2,
HEATER_HANDLER = 0x444100A4, HEATER_HANDLER = 0x444100A4,

View File

@ -42,7 +42,6 @@ enum commonClassIds : uint8_t {
PERSISTENT_TM_STORE, // PTM PERSISTENT_TM_STORE, // PTM
TM_SINK, // TMS TM_SINK, // TMS
VIRTUAL_CHANNEL, // VCS VIRTUAL_CHANNEL, // VCS
PLOC_MPSOC_COM, // PLMPCOM
COMMON_CLASS_ID_END // [EXPORT] : [END] COMMON_CLASS_ID_END // [EXPORT] : [END]
}; };
} }

View File

@ -40,7 +40,7 @@
#include "mission/genericFactory.h" #include "mission/genericFactory.h"
#include "mission/system/acs/acsModeTree.h" #include "mission/system/acs/acsModeTree.h"
#include "mission/system/com/comModeTree.h" #include "mission/system/com/comModeTree.h"
#include "mission/system/payload/payloadModeTree.h" #include "mission/system/payloadModeTree.h"
#include "mission/system/tcs/tcsModeTree.h" #include "mission/system/tcs/tcsModeTree.h"
#include "mission/tcs/defs.h" #include "mission/tcs/defs.h"

2
fsfw

@ -1 +1 @@
Subproject commit 42867ad0cba088ab1cb6cb672d001f991f7e4a60 Subproject commit 8b21dd276de72b46b41bc7080d6646180bfa0662

View File

@ -128,15 +128,14 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
11506;0x2cf2;DEPL_SA1_GPIO_SWTICH_OFF_FAILED;HIGH;No description;mission/SolarArrayDeploymentHandler.h 11506;0x2cf2;DEPL_SA1_GPIO_SWTICH_OFF_FAILED;HIGH;No description;mission/SolarArrayDeploymentHandler.h
11507;0x2cf3;DEPL_SA2_GPIO_SWTICH_OFF_FAILED;HIGH;No description;mission/SolarArrayDeploymentHandler.h 11507;0x2cf3;DEPL_SA2_GPIO_SWTICH_OFF_FAILED;HIGH;No description;mission/SolarArrayDeploymentHandler.h
11508;0x2cf4;AUTONOMOUS_DEPLOYMENT_COMPLETED;INFO;No description;mission/SolarArrayDeploymentHandler.h 11508;0x2cf4;AUTONOMOUS_DEPLOYMENT_COMPLETED;INFO;No description;mission/SolarArrayDeploymentHandler.h
11601;0x2d51;MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC crc failure in telemetry packet;linux/payload/plocMpsocHelpers.h 11601;0x2d51;MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC crc failure in telemetry packet;linux/payload/PlocMpsocHandler.h
11602;0x2d52;ACK_FAILURE;LOW;PLOC receive acknowledgment failure report P1: Command Id which leads the acknowledgment failure report P2: The status field inserted by the MPSoC into the data field;linux/payload/plocMpsocHelpers.h 11602;0x2d52;ACK_FAILURE;LOW;PLOC receive acknowledgment failure report P1: Command Id which leads the acknowledgment failure report P2: The status field inserted by the MPSoC into the data field;linux/payload/PlocMpsocHandler.h
11603;0x2d53;EXE_FAILURE;LOW;PLOC receive execution failure report P1: Command Id which leads the execution failure report P2: The status field inserted by the MPSoC into the data field;linux/payload/plocMpsocHelpers.h 11603;0x2d53;EXE_FAILURE;LOW;PLOC receive execution failure report P1: Command Id which leads the execution failure report P2: The status field inserted by the MPSoC into the data field;linux/payload/PlocMpsocHandler.h
11604;0x2d54;MPSOC_HANDLER_CRC_FAILURE;LOW;PLOC reply has invalid crc;linux/payload/plocMpsocHelpers.h 11604;0x2d54;MPSOC_HANDLER_CRC_FAILURE;LOW;PLOC reply has invalid crc;linux/payload/PlocMpsocHandler.h
11605;0x2d55;MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH;LOW;Packet sequence count in received space packet does not match expected count P1: Expected sequence count P2: Received sequence count;linux/payload/plocMpsocHelpers.h 11605;0x2d55;MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH;LOW;Packet sequence count in received space packet does not match expected count P1: Expected sequence count P2: Received sequence count;linux/payload/PlocMpsocHandler.h
11606;0x2d56;MPSOC_SHUTDOWN_FAILED;HIGH;Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and thus also to shutdown the supervisor.;linux/payload/plocMpsocHelpers.h 11606;0x2d56;MPSOC_SHUTDOWN_FAILED;HIGH;Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and thus also to shutdown the supervisor.;linux/payload/PlocMpsocHandler.h
11607;0x2d57;SUPV_NOT_ON;LOW;SUPV not on for boot or shutdown process. P1: 0 for OFF transition, 1 for ON transition.;linux/payload/plocMpsocHelpers.h 11607;0x2d57;SUPV_NOT_ON;LOW;SUPV not on for boot or shutdown process. P1: 0 for OFF transition, 1 for ON transition.;linux/payload/PlocMpsocHandler.h
11608;0x2d58;SUPV_REPLY_TIMEOUT;LOW;SUPV reply timeout.;linux/payload/plocMpsocHelpers.h 11608;0x2d58;SUPV_REPLY_TIMEOUT;LOW;No description;linux/payload/PlocMpsocHandler.h
11609;0x2d59;CAM_MUST_BE_ON_FOR_SNAPSHOT_MODE;LOW;Camera must be commanded on first.;linux/payload/plocMpsocHelpers.h
11701;0x2db5;SELF_TEST_I2C_FAILURE;LOW;Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h 11701;0x2db5;SELF_TEST_I2C_FAILURE;LOW;Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h
11702;0x2db6;SELF_TEST_SPI_FAILURE;LOW;Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h 11702;0x2db6;SELF_TEST_SPI_FAILURE;LOW;Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h
11703;0x2db7;SELF_TEST_ADC_FAILURE;LOW;Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h 11703;0x2db7;SELF_TEST_ADC_FAILURE;LOW;Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h

1 Event ID (dec) Event ID (hex) Name Severity Description File Path
128 11506 0x2cf2 DEPL_SA1_GPIO_SWTICH_OFF_FAILED HIGH No description mission/SolarArrayDeploymentHandler.h
129 11507 0x2cf3 DEPL_SA2_GPIO_SWTICH_OFF_FAILED HIGH No description mission/SolarArrayDeploymentHandler.h
130 11508 0x2cf4 AUTONOMOUS_DEPLOYMENT_COMPLETED INFO No description mission/SolarArrayDeploymentHandler.h
131 11601 0x2d51 MEMORY_READ_RPT_CRC_FAILURE LOW PLOC crc failure in telemetry packet linux/payload/plocMpsocHelpers.h linux/payload/PlocMpsocHandler.h
132 11602 0x2d52 ACK_FAILURE LOW PLOC receive acknowledgment failure report P1: Command Id which leads the acknowledgment failure report P2: The status field inserted by the MPSoC into the data field linux/payload/plocMpsocHelpers.h linux/payload/PlocMpsocHandler.h
133 11603 0x2d53 EXE_FAILURE LOW PLOC receive execution failure report P1: Command Id which leads the execution failure report P2: The status field inserted by the MPSoC into the data field linux/payload/plocMpsocHelpers.h linux/payload/PlocMpsocHandler.h
134 11604 0x2d54 MPSOC_HANDLER_CRC_FAILURE LOW PLOC reply has invalid crc linux/payload/plocMpsocHelpers.h linux/payload/PlocMpsocHandler.h
135 11605 0x2d55 MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH LOW Packet sequence count in received space packet does not match expected count P1: Expected sequence count P2: Received sequence count linux/payload/plocMpsocHelpers.h linux/payload/PlocMpsocHandler.h
136 11606 0x2d56 MPSOC_SHUTDOWN_FAILED HIGH Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and thus also to shutdown the supervisor. linux/payload/plocMpsocHelpers.h linux/payload/PlocMpsocHandler.h
137 11607 0x2d57 SUPV_NOT_ON LOW SUPV not on for boot or shutdown process. P1: 0 for OFF transition, 1 for ON transition. linux/payload/plocMpsocHelpers.h linux/payload/PlocMpsocHandler.h
138 11608 0x2d58 SUPV_REPLY_TIMEOUT LOW SUPV reply timeout. No description linux/payload/plocMpsocHelpers.h linux/payload/PlocMpsocHandler.h
11609 0x2d59 CAM_MUST_BE_ON_FOR_SNAPSHOT_MODE LOW Camera must be commanded on first. linux/payload/plocMpsocHelpers.h
139 11701 0x2db5 SELF_TEST_I2C_FAILURE LOW Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA mission/acs/ImtqHandler.h
140 11702 0x2db6 SELF_TEST_SPI_FAILURE LOW Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA mission/acs/ImtqHandler.h
141 11703 0x2db7 SELF_TEST_ADC_FAILURE LOW Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA mission/acs/ImtqHandler.h

View File

@ -57,7 +57,6 @@
0x44330015;PLOC_MPSOC_HANDLER 0x44330015;PLOC_MPSOC_HANDLER
0x44330016;PLOC_SUPERVISOR_HANDLER 0x44330016;PLOC_SUPERVISOR_HANDLER
0x44330017;PLOC_SUPERVISOR_HELPER 0x44330017;PLOC_SUPERVISOR_HELPER
0x44330018;PLOC_MPSOC_COMMUNICATION
0x44330032;SCEX 0x44330032;SCEX
0x444100A2;SOLAR_ARRAY_DEPL_HANDLER 0x444100A2;SOLAR_ARRAY_DEPL_HANDLER
0x444100A4;HEATER_HANDLER 0x444100A4;HEATER_HANDLER

1 0x42694269 TEST_TASK
57 0x44330015 PLOC_MPSOC_HANDLER
58 0x44330016 PLOC_SUPERVISOR_HANDLER
59 0x44330017 PLOC_SUPERVISOR_HELPER
0x44330018 PLOC_MPSOC_COMMUNICATION
60 0x44330032 SCEX
61 0x444100A2 SOLAR_ARRAY_DEPL_HANDLER
62 0x444100A4 HEATER_HANDLER

View File

@ -128,15 +128,14 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
11506;0x2cf2;DEPL_SA1_GPIO_SWTICH_OFF_FAILED;HIGH;No description;mission/SolarArrayDeploymentHandler.h 11506;0x2cf2;DEPL_SA1_GPIO_SWTICH_OFF_FAILED;HIGH;No description;mission/SolarArrayDeploymentHandler.h
11507;0x2cf3;DEPL_SA2_GPIO_SWTICH_OFF_FAILED;HIGH;No description;mission/SolarArrayDeploymentHandler.h 11507;0x2cf3;DEPL_SA2_GPIO_SWTICH_OFF_FAILED;HIGH;No description;mission/SolarArrayDeploymentHandler.h
11508;0x2cf4;AUTONOMOUS_DEPLOYMENT_COMPLETED;INFO;No description;mission/SolarArrayDeploymentHandler.h 11508;0x2cf4;AUTONOMOUS_DEPLOYMENT_COMPLETED;INFO;No description;mission/SolarArrayDeploymentHandler.h
11601;0x2d51;MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC crc failure in telemetry packet;linux/payload/plocMpsocHelpers.h 11601;0x2d51;MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC crc failure in telemetry packet;linux/payload/PlocMpsocHandler.h
11602;0x2d52;ACK_FAILURE;LOW;PLOC receive acknowledgment failure report P1: Command Id which leads the acknowledgment failure report P2: The status field inserted by the MPSoC into the data field;linux/payload/plocMpsocHelpers.h 11602;0x2d52;ACK_FAILURE;LOW;PLOC receive acknowledgment failure report P1: Command Id which leads the acknowledgment failure report P2: The status field inserted by the MPSoC into the data field;linux/payload/PlocMpsocHandler.h
11603;0x2d53;EXE_FAILURE;LOW;PLOC receive execution failure report P1: Command Id which leads the execution failure report P2: The status field inserted by the MPSoC into the data field;linux/payload/plocMpsocHelpers.h 11603;0x2d53;EXE_FAILURE;LOW;PLOC receive execution failure report P1: Command Id which leads the execution failure report P2: The status field inserted by the MPSoC into the data field;linux/payload/PlocMpsocHandler.h
11604;0x2d54;MPSOC_HANDLER_CRC_FAILURE;LOW;PLOC reply has invalid crc;linux/payload/plocMpsocHelpers.h 11604;0x2d54;MPSOC_HANDLER_CRC_FAILURE;LOW;PLOC reply has invalid crc;linux/payload/PlocMpsocHandler.h
11605;0x2d55;MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH;LOW;Packet sequence count in received space packet does not match expected count P1: Expected sequence count P2: Received sequence count;linux/payload/plocMpsocHelpers.h 11605;0x2d55;MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH;LOW;Packet sequence count in received space packet does not match expected count P1: Expected sequence count P2: Received sequence count;linux/payload/PlocMpsocHandler.h
11606;0x2d56;MPSOC_SHUTDOWN_FAILED;HIGH;Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and thus also to shutdown the supervisor.;linux/payload/plocMpsocHelpers.h 11606;0x2d56;MPSOC_SHUTDOWN_FAILED;HIGH;Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and thus also to shutdown the supervisor.;linux/payload/PlocMpsocHandler.h
11607;0x2d57;SUPV_NOT_ON;LOW;SUPV not on for boot or shutdown process. P1: 0 for OFF transition, 1 for ON transition.;linux/payload/plocMpsocHelpers.h 11607;0x2d57;SUPV_NOT_ON;LOW;SUPV not on for boot or shutdown process. P1: 0 for OFF transition, 1 for ON transition.;linux/payload/PlocMpsocHandler.h
11608;0x2d58;SUPV_REPLY_TIMEOUT;LOW;SUPV reply timeout.;linux/payload/plocMpsocHelpers.h 11608;0x2d58;SUPV_REPLY_TIMEOUT;LOW;No description;linux/payload/PlocMpsocHandler.h
11609;0x2d59;CAM_MUST_BE_ON_FOR_SNAPSHOT_MODE;LOW;Camera must be commanded on first.;linux/payload/plocMpsocHelpers.h
11701;0x2db5;SELF_TEST_I2C_FAILURE;LOW;Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h 11701;0x2db5;SELF_TEST_I2C_FAILURE;LOW;Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h
11702;0x2db6;SELF_TEST_SPI_FAILURE;LOW;Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h 11702;0x2db6;SELF_TEST_SPI_FAILURE;LOW;Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h
11703;0x2db7;SELF_TEST_ADC_FAILURE;LOW;Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h 11703;0x2db7;SELF_TEST_ADC_FAILURE;LOW;Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h

1 Event ID (dec) Event ID (hex) Name Severity Description File Path
128 11506 0x2cf2 DEPL_SA1_GPIO_SWTICH_OFF_FAILED HIGH No description mission/SolarArrayDeploymentHandler.h
129 11507 0x2cf3 DEPL_SA2_GPIO_SWTICH_OFF_FAILED HIGH No description mission/SolarArrayDeploymentHandler.h
130 11508 0x2cf4 AUTONOMOUS_DEPLOYMENT_COMPLETED INFO No description mission/SolarArrayDeploymentHandler.h
131 11601 0x2d51 MEMORY_READ_RPT_CRC_FAILURE LOW PLOC crc failure in telemetry packet linux/payload/plocMpsocHelpers.h linux/payload/PlocMpsocHandler.h
132 11602 0x2d52 ACK_FAILURE LOW PLOC receive acknowledgment failure report P1: Command Id which leads the acknowledgment failure report P2: The status field inserted by the MPSoC into the data field linux/payload/plocMpsocHelpers.h linux/payload/PlocMpsocHandler.h
133 11603 0x2d53 EXE_FAILURE LOW PLOC receive execution failure report P1: Command Id which leads the execution failure report P2: The status field inserted by the MPSoC into the data field linux/payload/plocMpsocHelpers.h linux/payload/PlocMpsocHandler.h
134 11604 0x2d54 MPSOC_HANDLER_CRC_FAILURE LOW PLOC reply has invalid crc linux/payload/plocMpsocHelpers.h linux/payload/PlocMpsocHandler.h
135 11605 0x2d55 MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH LOW Packet sequence count in received space packet does not match expected count P1: Expected sequence count P2: Received sequence count linux/payload/plocMpsocHelpers.h linux/payload/PlocMpsocHandler.h
136 11606 0x2d56 MPSOC_SHUTDOWN_FAILED HIGH Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and thus also to shutdown the supervisor. linux/payload/plocMpsocHelpers.h linux/payload/PlocMpsocHandler.h
137 11607 0x2d57 SUPV_NOT_ON LOW SUPV not on for boot or shutdown process. P1: 0 for OFF transition, 1 for ON transition. linux/payload/plocMpsocHelpers.h linux/payload/PlocMpsocHandler.h
138 11608 0x2d58 SUPV_REPLY_TIMEOUT LOW SUPV reply timeout. No description linux/payload/plocMpsocHelpers.h linux/payload/PlocMpsocHandler.h
11609 0x2d59 CAM_MUST_BE_ON_FOR_SNAPSHOT_MODE LOW Camera must be commanded on first. linux/payload/plocMpsocHelpers.h
139 11701 0x2db5 SELF_TEST_I2C_FAILURE LOW Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA mission/acs/ImtqHandler.h
140 11702 0x2db6 SELF_TEST_SPI_FAILURE LOW Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA mission/acs/ImtqHandler.h
141 11703 0x2db7 SELF_TEST_ADC_FAILURE LOW Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA mission/acs/ImtqHandler.h

View File

@ -56,7 +56,6 @@
0x44330015;PLOC_MPSOC_HANDLER 0x44330015;PLOC_MPSOC_HANDLER
0x44330016;PLOC_SUPERVISOR_HANDLER 0x44330016;PLOC_SUPERVISOR_HANDLER
0x44330017;PLOC_SUPERVISOR_HELPER 0x44330017;PLOC_SUPERVISOR_HELPER
0x44330018;PLOC_MPSOC_COMMUNICATION
0x44330032;SCEX 0x44330032;SCEX
0x444100A2;SOLAR_ARRAY_DEPL_HANDLER 0x444100A2;SOLAR_ARRAY_DEPL_HANDLER
0x444100A4;HEATER_HANDLER 0x444100A4;HEATER_HANDLER

1 0x00005060 P60DOCK_TEST_TASK
56 0x44330015 PLOC_MPSOC_HANDLER
57 0x44330016 PLOC_SUPERVISOR_HANDLER
58 0x44330017 PLOC_SUPERVISOR_HELPER
0x44330018 PLOC_MPSOC_COMMUNICATION
59 0x44330032 SCEX
60 0x444100A2 SOLAR_ARRAY_DEPL_HANDLER
61 0x444100A4 HEATER_HANDLER

View File

@ -561,17 +561,16 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
0x67a2;SADPL_MainSwitchTimeoutFailure;No description;162;SA_DEPL_HANDLER;mission/SolarArrayDeploymentHandler.h 0x67a2;SADPL_MainSwitchTimeoutFailure;No description;162;SA_DEPL_HANDLER;mission/SolarArrayDeploymentHandler.h
0x67a3;SADPL_SwitchingDeplSa1Failed;No description;163;SA_DEPL_HANDLER;mission/SolarArrayDeploymentHandler.h 0x67a3;SADPL_SwitchingDeplSa1Failed;No description;163;SA_DEPL_HANDLER;mission/SolarArrayDeploymentHandler.h
0x67a4;SADPL_SwitchingDeplSa2Failed;No description;164;SA_DEPL_HANDLER;mission/SolarArrayDeploymentHandler.h 0x67a4;SADPL_SwitchingDeplSa2Failed;No description;164;SA_DEPL_HANDLER;mission/SolarArrayDeploymentHandler.h
0x6810;MPSOCRTVIF_CommandTimeout;Command has timed out.;16;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h 0x68a0;MPSOCRTVIF_CrcFailure;Space Packet received from PLOC has invalid CRC;160;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
0x68a0;MPSOCRTVIF_CrcFailure;Space Packet received from PLOC has invalid CRC;160;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h 0x68a1;MPSOCRTVIF_ReceivedAckFailure;Received ACK failure reply from PLOC;161;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
0x68a1;MPSOCRTVIF_ReceivedAckFailure;Received ACK failure reply from PLOC;161;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h 0x68a2;MPSOCRTVIF_ReceivedExeFailure;Received execution failure reply from PLOC;162;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
0x68a2;MPSOCRTVIF_ReceivedExeFailure;Received execution failure reply from PLOC;162;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h 0x68a3;MPSOCRTVIF_InvalidApid;Received space packet with invalid APID from PLOC;163;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
0x68a3;MPSOCRTVIF_InvalidApid;Received space packet with invalid APID from PLOC;163;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h 0x68a4;MPSOCRTVIF_InvalidLength;Received command with invalid length;164;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
0x68a4;MPSOCRTVIF_InvalidLength;Received command with invalid length;164;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h 0x68a5;MPSOCRTVIF_FilenameTooLong;Filename of file in OBC filesystem is too long;165;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
0x68a5;MPSOCRTVIF_FilenameTooLong;Filename of file in OBC filesystem is too long;165;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h 0x68a6;MPSOCRTVIF_MpsocHelperExecuting;MPSoC helper is currently executing a command;166;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
0x68a6;MPSOCRTVIF_MpsocHelperExecuting;MPSoC helper is currently executing a command;166;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h 0x68a7;MPSOCRTVIF_MpsocFilenameTooLong;Filename of MPSoC file is to long (max. 256 bytes);167;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
0x68a7;MPSOCRTVIF_MpsocFilenameTooLong;Filename of MPSoC file is to long (max. 256 bytes);167;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h 0x68a8;MPSOCRTVIF_InvalidParameter;Command has invalid parameter;168;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
0x68a8;MPSOCRTVIF_InvalidParameter;Command has invalid parameter;168;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h 0x68a9;MPSOCRTVIF_NameTooLong;Received command has file string with invalid length;169;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
0x68a9;MPSOCRTVIF_NameTooLong;Received command has file string with invalid length;169;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h
0x69a0;SPVRTVIF_CrcFailure;Space Packet received from PLOC supervisor has invalid CRC;160;SUPV_RETURN_VALUES_IF;linux/payload/plocSupvDefs.h 0x69a0;SPVRTVIF_CrcFailure;Space Packet received from PLOC supervisor has invalid CRC;160;SUPV_RETURN_VALUES_IF;linux/payload/plocSupvDefs.h
0x69a1;SPVRTVIF_InvalidServiceId;No description;161;SUPV_RETURN_VALUES_IF;linux/payload/plocSupvDefs.h 0x69a1;SPVRTVIF_InvalidServiceId;No description;161;SUPV_RETURN_VALUES_IF;linux/payload/plocSupvDefs.h
0x69a2;SPVRTVIF_ReceivedAckFailure;Received ACK failure reply from PLOC supervisor;162;SUPV_RETURN_VALUES_IF;linux/payload/plocSupvDefs.h 0x69a2;SPVRTVIF_ReceivedAckFailure;Received ACK failure reply from PLOC supervisor;162;SUPV_RETURN_VALUES_IF;linux/payload/plocSupvDefs.h
@ -627,7 +626,4 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
0x6f02;TMS_NoWriteActive;No description;2;TM_SINK;mission/tmtc/DirectTmSinkIF.h 0x6f02;TMS_NoWriteActive;No description;2;TM_SINK;mission/tmtc/DirectTmSinkIF.h
0x6f03;TMS_Timeout;No description;3;TM_SINK;mission/tmtc/DirectTmSinkIF.h 0x6f03;TMS_Timeout;No description;3;TM_SINK;mission/tmtc/DirectTmSinkIF.h
0x7000;VCS_ChannelDoesNotExist;No description;0;VIRTUAL_CHANNEL;mission/com/VirtualChannel.h 0x7000;VCS_ChannelDoesNotExist;No description;0;VIRTUAL_CHANNEL;mission/com/VirtualChannel.h
0x7100;PLMPCOM_PacketReceived;No description;0;PLOC_MPSOC_COM;linux/payload/MpsocCommunication.h 0x7200;SCBU_KeyNotFound;No description;0;SCRATCH_BUFFER;bsp_q7s/memory/scratchApi.h
0x7101;PLMPCOM_FaultyPacketSize;No description;1;PLOC_MPSOC_COM;linux/payload/MpsocCommunication.h
0x7102;PLMPCOM_CrcCheckFailed;No description;2;PLOC_MPSOC_COM;linux/payload/MpsocCommunication.h
0x7300;SCBU_KeyNotFound;No description;0;SCRATCH_BUFFER;bsp_q7s/memory/scratchApi.h

1 Full ID (hex) Name Description Unique ID Subsytem Name File Path
561 0x67a2 SADPL_MainSwitchTimeoutFailure No description 162 SA_DEPL_HANDLER mission/SolarArrayDeploymentHandler.h
562 0x67a3 SADPL_SwitchingDeplSa1Failed No description 163 SA_DEPL_HANDLER mission/SolarArrayDeploymentHandler.h
563 0x67a4 SADPL_SwitchingDeplSa2Failed No description 164 SA_DEPL_HANDLER mission/SolarArrayDeploymentHandler.h
564 0x6810 0x68a0 MPSOCRTVIF_CommandTimeout MPSOCRTVIF_CrcFailure Command has timed out. Space Packet received from PLOC has invalid CRC 16 160 MPSOC_RETURN_VALUES_IF linux/payload/plocMpsocHelpers.h linux/payload/mpsocRetvals.h
565 0x68a0 0x68a1 MPSOCRTVIF_CrcFailure MPSOCRTVIF_ReceivedAckFailure Space Packet received from PLOC has invalid CRC Received ACK failure reply from PLOC 160 161 MPSOC_RETURN_VALUES_IF linux/payload/plocMpsocHelpers.h linux/payload/mpsocRetvals.h
566 0x68a1 0x68a2 MPSOCRTVIF_ReceivedAckFailure MPSOCRTVIF_ReceivedExeFailure Received ACK failure reply from PLOC Received execution failure reply from PLOC 161 162 MPSOC_RETURN_VALUES_IF linux/payload/plocMpsocHelpers.h linux/payload/mpsocRetvals.h
567 0x68a2 0x68a3 MPSOCRTVIF_ReceivedExeFailure MPSOCRTVIF_InvalidApid Received execution failure reply from PLOC Received space packet with invalid APID from PLOC 162 163 MPSOC_RETURN_VALUES_IF linux/payload/plocMpsocHelpers.h linux/payload/mpsocRetvals.h
568 0x68a3 0x68a4 MPSOCRTVIF_InvalidApid MPSOCRTVIF_InvalidLength Received space packet with invalid APID from PLOC Received command with invalid length 163 164 MPSOC_RETURN_VALUES_IF linux/payload/plocMpsocHelpers.h linux/payload/mpsocRetvals.h
569 0x68a4 0x68a5 MPSOCRTVIF_InvalidLength MPSOCRTVIF_FilenameTooLong Received command with invalid length Filename of file in OBC filesystem is too long 164 165 MPSOC_RETURN_VALUES_IF linux/payload/plocMpsocHelpers.h linux/payload/mpsocRetvals.h
570 0x68a5 0x68a6 MPSOCRTVIF_FilenameTooLong MPSOCRTVIF_MpsocHelperExecuting Filename of file in OBC filesystem is too long MPSoC helper is currently executing a command 165 166 MPSOC_RETURN_VALUES_IF linux/payload/plocMpsocHelpers.h linux/payload/mpsocRetvals.h
571 0x68a6 0x68a7 MPSOCRTVIF_MpsocHelperExecuting MPSOCRTVIF_MpsocFilenameTooLong MPSoC helper is currently executing a command Filename of MPSoC file is to long (max. 256 bytes) 166 167 MPSOC_RETURN_VALUES_IF linux/payload/plocMpsocHelpers.h linux/payload/mpsocRetvals.h
572 0x68a7 0x68a8 MPSOCRTVIF_MpsocFilenameTooLong MPSOCRTVIF_InvalidParameter Filename of MPSoC file is to long (max. 256 bytes) Command has invalid parameter 167 168 MPSOC_RETURN_VALUES_IF linux/payload/plocMpsocHelpers.h linux/payload/mpsocRetvals.h
573 0x68a8 0x68a9 MPSOCRTVIF_InvalidParameter MPSOCRTVIF_NameTooLong Command has invalid parameter Received command has file string with invalid length 168 169 MPSOC_RETURN_VALUES_IF linux/payload/plocMpsocHelpers.h linux/payload/mpsocRetvals.h
0x68a9 MPSOCRTVIF_NameTooLong Received command has file string with invalid length 169 MPSOC_RETURN_VALUES_IF linux/payload/plocMpsocHelpers.h
574 0x69a0 SPVRTVIF_CrcFailure Space Packet received from PLOC supervisor has invalid CRC 160 SUPV_RETURN_VALUES_IF linux/payload/plocSupvDefs.h
575 0x69a1 SPVRTVIF_InvalidServiceId No description 161 SUPV_RETURN_VALUES_IF linux/payload/plocSupvDefs.h
576 0x69a2 SPVRTVIF_ReceivedAckFailure Received ACK failure reply from PLOC supervisor 162 SUPV_RETURN_VALUES_IF linux/payload/plocSupvDefs.h
626 0x6f02 TMS_NoWriteActive No description 2 TM_SINK mission/tmtc/DirectTmSinkIF.h
627 0x6f03 TMS_Timeout No description 3 TM_SINK mission/tmtc/DirectTmSinkIF.h
628 0x7000 VCS_ChannelDoesNotExist No description 0 VIRTUAL_CHANNEL mission/com/VirtualChannel.h
629 0x7100 0x7200 PLMPCOM_PacketReceived SCBU_KeyNotFound No description 0 PLOC_MPSOC_COM SCRATCH_BUFFER linux/payload/MpsocCommunication.h bsp_q7s/memory/scratchApi.h
0x7101 PLMPCOM_FaultyPacketSize No description 1 PLOC_MPSOC_COM linux/payload/MpsocCommunication.h
0x7102 PLMPCOM_CrcCheckFailed No description 2 PLOC_MPSOC_COM linux/payload/MpsocCommunication.h
0x7300 SCBU_KeyNotFound No description 0 SCRATCH_BUFFER bsp_q7s/memory/scratchApi.h

View File

@ -1,7 +1,7 @@
/** /**
* @brief Auto-generated event translation file. Contains 325 translations. * @brief Auto-generated event translation file. Contains 324 translations.
* @details * @details
* Generated on: 2024-05-06 13:47:38 * Generated on: 2024-04-10 11:49:35
*/ */
#include "translateEvents.h" #include "translateEvents.h"
@ -142,7 +142,6 @@ const char *MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH_STRING = "MPSOC_HANDLER_SEQUEN
const char *MPSOC_SHUTDOWN_FAILED_STRING = "MPSOC_SHUTDOWN_FAILED"; const char *MPSOC_SHUTDOWN_FAILED_STRING = "MPSOC_SHUTDOWN_FAILED";
const char *SUPV_NOT_ON_STRING = "SUPV_NOT_ON"; const char *SUPV_NOT_ON_STRING = "SUPV_NOT_ON";
const char *SUPV_REPLY_TIMEOUT_STRING = "SUPV_REPLY_TIMEOUT"; const char *SUPV_REPLY_TIMEOUT_STRING = "SUPV_REPLY_TIMEOUT";
const char *CAM_MUST_BE_ON_FOR_SNAPSHOT_MODE_STRING = "CAM_MUST_BE_ON_FOR_SNAPSHOT_MODE";
const char *SELF_TEST_I2C_FAILURE_STRING = "SELF_TEST_I2C_FAILURE"; const char *SELF_TEST_I2C_FAILURE_STRING = "SELF_TEST_I2C_FAILURE";
const char *SELF_TEST_SPI_FAILURE_STRING = "SELF_TEST_SPI_FAILURE"; const char *SELF_TEST_SPI_FAILURE_STRING = "SELF_TEST_SPI_FAILURE";
const char *SELF_TEST_ADC_FAILURE_STRING = "SELF_TEST_ADC_FAILURE"; const char *SELF_TEST_ADC_FAILURE_STRING = "SELF_TEST_ADC_FAILURE";
@ -607,8 +606,6 @@ const char *translateEvents(Event event) {
return SUPV_NOT_ON_STRING; return SUPV_NOT_ON_STRING;
case (11608): case (11608):
return SUPV_REPLY_TIMEOUT_STRING; return SUPV_REPLY_TIMEOUT_STRING;
case (11609):
return CAM_MUST_BE_ON_FOR_SNAPSHOT_MODE_STRING;
case (11701): case (11701):
return SELF_TEST_I2C_FAILURE_STRING; return SELF_TEST_I2C_FAILURE_STRING;
case (11702): case (11702):

View File

@ -1,8 +1,8 @@
/** /**
* @brief Auto-generated object translation file. * @brief Auto-generated object translation file.
* @details * @details
* Contains 180 translations. * Contains 179 translations.
* Generated on: 2024-05-06 13:47:38 * Generated on: 2024-04-10 11:49:35
*/ */
#include "translateObjects.h" #include "translateObjects.h"
@ -64,7 +64,6 @@ const char *PTME_VC3_CFDP_TM_STRING = "PTME_VC3_CFDP_TM";
const char *PLOC_MPSOC_HANDLER_STRING = "PLOC_MPSOC_HANDLER"; const char *PLOC_MPSOC_HANDLER_STRING = "PLOC_MPSOC_HANDLER";
const char *PLOC_SUPERVISOR_HANDLER_STRING = "PLOC_SUPERVISOR_HANDLER"; const char *PLOC_SUPERVISOR_HANDLER_STRING = "PLOC_SUPERVISOR_HANDLER";
const char *PLOC_SUPERVISOR_HELPER_STRING = "PLOC_SUPERVISOR_HELPER"; const char *PLOC_SUPERVISOR_HELPER_STRING = "PLOC_SUPERVISOR_HELPER";
const char *PLOC_MPSOC_COMMUNICATION_STRING = "PLOC_MPSOC_COMMUNICATION";
const char *SCEX_STRING = "SCEX"; const char *SCEX_STRING = "SCEX";
const char *SOLAR_ARRAY_DEPL_HANDLER_STRING = "SOLAR_ARRAY_DEPL_HANDLER"; const char *SOLAR_ARRAY_DEPL_HANDLER_STRING = "SOLAR_ARRAY_DEPL_HANDLER";
const char *HEATER_HANDLER_STRING = "HEATER_HANDLER"; const char *HEATER_HANDLER_STRING = "HEATER_HANDLER";
@ -305,8 +304,6 @@ const char *translateObject(object_id_t object) {
return PLOC_SUPERVISOR_HANDLER_STRING; return PLOC_SUPERVISOR_HANDLER_STRING;
case 0x44330017: case 0x44330017:
return PLOC_SUPERVISOR_HELPER_STRING; return PLOC_SUPERVISOR_HELPER_STRING;
case 0x44330018:
return PLOC_MPSOC_COMMUNICATION_STRING;
case 0x44330032: case 0x44330032:
return SCEX_STRING; return SCEX_STRING;
case 0x444100A2: case 0x444100A2:

View File

@ -26,7 +26,7 @@
#include "devConf.h" #include "devConf.h"
#include "devices/gpioIds.h" #include "devices/gpioIds.h"
#include "mission/system/acs/acsModeTree.h" #include "mission/system/acs/acsModeTree.h"
#include "mission/system/payload/payloadModeTree.h" #include "mission/system/payloadModeTree.h"
#include "mission/system/power/epsModeTree.h" #include "mission/system/power/epsModeTree.h"
void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiComIF, void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiComIF,

View File

@ -1,7 +1,7 @@
/** /**
* @brief Auto-generated event translation file. Contains 325 translations. * @brief Auto-generated event translation file. Contains 324 translations.
* @details * @details
* Generated on: 2024-05-06 13:47:38 * Generated on: 2024-04-10 11:49:35
*/ */
#include "translateEvents.h" #include "translateEvents.h"
@ -142,7 +142,6 @@ const char *MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH_STRING = "MPSOC_HANDLER_SEQUEN
const char *MPSOC_SHUTDOWN_FAILED_STRING = "MPSOC_SHUTDOWN_FAILED"; const char *MPSOC_SHUTDOWN_FAILED_STRING = "MPSOC_SHUTDOWN_FAILED";
const char *SUPV_NOT_ON_STRING = "SUPV_NOT_ON"; const char *SUPV_NOT_ON_STRING = "SUPV_NOT_ON";
const char *SUPV_REPLY_TIMEOUT_STRING = "SUPV_REPLY_TIMEOUT"; const char *SUPV_REPLY_TIMEOUT_STRING = "SUPV_REPLY_TIMEOUT";
const char *CAM_MUST_BE_ON_FOR_SNAPSHOT_MODE_STRING = "CAM_MUST_BE_ON_FOR_SNAPSHOT_MODE";
const char *SELF_TEST_I2C_FAILURE_STRING = "SELF_TEST_I2C_FAILURE"; const char *SELF_TEST_I2C_FAILURE_STRING = "SELF_TEST_I2C_FAILURE";
const char *SELF_TEST_SPI_FAILURE_STRING = "SELF_TEST_SPI_FAILURE"; const char *SELF_TEST_SPI_FAILURE_STRING = "SELF_TEST_SPI_FAILURE";
const char *SELF_TEST_ADC_FAILURE_STRING = "SELF_TEST_ADC_FAILURE"; const char *SELF_TEST_ADC_FAILURE_STRING = "SELF_TEST_ADC_FAILURE";
@ -607,8 +606,6 @@ const char *translateEvents(Event event) {
return SUPV_NOT_ON_STRING; return SUPV_NOT_ON_STRING;
case (11608): case (11608):
return SUPV_REPLY_TIMEOUT_STRING; return SUPV_REPLY_TIMEOUT_STRING;
case (11609):
return CAM_MUST_BE_ON_FOR_SNAPSHOT_MODE_STRING;
case (11701): case (11701):
return SELF_TEST_I2C_FAILURE_STRING; return SELF_TEST_I2C_FAILURE_STRING;
case (11702): case (11702):

View File

@ -1,8 +1,8 @@
/** /**
* @brief Auto-generated object translation file. * @brief Auto-generated object translation file.
* @details * @details
* Contains 180 translations. * Contains 179 translations.
* Generated on: 2024-05-06 13:47:38 * Generated on: 2024-04-10 11:49:35
*/ */
#include "translateObjects.h" #include "translateObjects.h"
@ -64,7 +64,6 @@ const char *PTME_VC3_CFDP_TM_STRING = "PTME_VC3_CFDP_TM";
const char *PLOC_MPSOC_HANDLER_STRING = "PLOC_MPSOC_HANDLER"; const char *PLOC_MPSOC_HANDLER_STRING = "PLOC_MPSOC_HANDLER";
const char *PLOC_SUPERVISOR_HANDLER_STRING = "PLOC_SUPERVISOR_HANDLER"; const char *PLOC_SUPERVISOR_HANDLER_STRING = "PLOC_SUPERVISOR_HANDLER";
const char *PLOC_SUPERVISOR_HELPER_STRING = "PLOC_SUPERVISOR_HELPER"; const char *PLOC_SUPERVISOR_HELPER_STRING = "PLOC_SUPERVISOR_HELPER";
const char *PLOC_MPSOC_COMMUNICATION_STRING = "PLOC_MPSOC_COMMUNICATION";
const char *SCEX_STRING = "SCEX"; const char *SCEX_STRING = "SCEX";
const char *SOLAR_ARRAY_DEPL_HANDLER_STRING = "SOLAR_ARRAY_DEPL_HANDLER"; const char *SOLAR_ARRAY_DEPL_HANDLER_STRING = "SOLAR_ARRAY_DEPL_HANDLER";
const char *HEATER_HANDLER_STRING = "HEATER_HANDLER"; const char *HEATER_HANDLER_STRING = "HEATER_HANDLER";
@ -305,8 +304,6 @@ const char *translateObject(object_id_t object) {
return PLOC_SUPERVISOR_HANDLER_STRING; return PLOC_SUPERVISOR_HANDLER_STRING;
case 0x44330017: case 0x44330017:
return PLOC_SUPERVISOR_HELPER_STRING; return PLOC_SUPERVISOR_HELPER_STRING;
case 0x44330018:
return PLOC_MPSOC_COMMUNICATION_STRING;
case 0x44330032: case 0x44330032:
return SCEX_STRING; return SCEX_STRING;
case 0x444100A2: case 0x444100A2:

View File

@ -1,9 +1,7 @@
target_sources( target_sources(
${OBSW_NAME} ${OBSW_NAME}
PUBLIC PlocMemoryDumper.cpp PUBLIC PlocMemoryDumper.cpp
MpsocCommunication.cpp PlocMpsocHandler.cpp
SerialCommunicationHelper.cpp
FreshMpsocHandler.cpp
FreshSupvHandler.cpp FreshSupvHandler.cpp
PlocMpsocSpecialComHelper.cpp PlocMpsocSpecialComHelper.cpp
plocMpsocHelpers.cpp plocMpsocHelpers.cpp

File diff suppressed because it is too large Load Diff

View File

@ -1,212 +0,0 @@
#include "fsfw/action/ActionMessage.h"
#include "fsfw/action/CommandsActionsIF.h"
#include "fsfw/devicehandlers/DeviceHandlerIF.h"
#include "fsfw/devicehandlers/FreshDeviceHandlerBase.h"
#include "fsfw/ipc/MessageQueueIF.h"
#include "fsfw/ipc/messageQueueDefinitions.h"
#include "fsfw/modes/ModeMessage.h"
#include "fsfw/objectmanager/SystemObjectIF.h"
#include "fsfw/power/PowerSwitchIF.h"
#include "fsfw/power/definitions.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw_hal/linux/gpio/Gpio.h"
#include "linux/payload/MpsocCommunication.h"
#include "linux/payload/PlocMpsocSpecialComHelper.h"
#include "linux/payload/plocMpsocHelpers.h"
class FreshMpsocHandler : public FreshDeviceHandlerBase, public CommandsActionsIF {
public:
enum OpCode { DEFAULT_OPERATION = 0, PARSE_TM = 1 };
static constexpr uint32_t MPSOC_MODE_CMD_TIMEOUT_MS = 120000;
FreshMpsocHandler(DhbConfig cfg, MpsocCommunication& comInterface,
PlocMpsocSpecialComHelper& specialComHelper, Gpio uartIsolatorSwitch,
object_id_t supervisorHandler, PowerSwitchIF& powerSwitcher,
power::Switch_t camSwitchId);
/**
* Periodic helper executed function, implemented by child class.
*/
void performDeviceOperation(uint8_t opCode) override;
void performDefaultDeviceOperation();
/**
* Implemented by child class. Handle all command messages which are
* not health, mode, action or housekeeping messages.
* @param message
* @return
*/
ReturnValue_t handleCommandMessage(CommandMessage* message) override;
ReturnValue_t initialize() override;
private:
enum class StartupState { IDLE, HW_INIT, DONE } startupState = StartupState::IDLE;
enum class PowerState { IDLE, PENDING_STARTUP, PENDING_SHUTDOWN, SUPV_FAILED, DONE };
enum TransitionState { NONE, TO_ON, TO_OFF, SUBMODE } transitionState = TransitionState::NONE;
MpsocCommunication& comInterface;
PlocMpsocSpecialComHelper& specialComHelper;
MessageQueueIF* eventQueue = nullptr;
SourceSequenceCounter commandSequenceCount = SourceSequenceCounter(0);
MessageQueueIF* commandActionHelperQueue = nullptr;
CommandActionHelper commandActionHelper;
Gpio uartIsolatorSwitch;
mpsoc::HkReport hkReport;
object_id_t supervisorHandler;
Countdown mpsocBootTransitionCd = Countdown(6500);
Countdown supvTransitionCd = Countdown(3000);
PoolEntry<uint32_t> peStatus = PoolEntry<uint32_t>();
PoolEntry<uint8_t> peMode = PoolEntry<uint8_t>();
PoolEntry<uint8_t> peDownlinkPwrOn = PoolEntry<uint8_t>();
PoolEntry<uint8_t> peDownlinkReplyActive = PoolEntry<uint8_t>();
PoolEntry<uint8_t> peDownlinkJesdSyncStatus = PoolEntry<uint8_t>();
PoolEntry<uint8_t> peDownlinkDacStatus = PoolEntry<uint8_t>();
PoolEntry<uint8_t> peCameraStatus = PoolEntry<uint8_t>();
PoolEntry<uint8_t> peCameraSdiStatus = PoolEntry<uint8_t>();
PoolEntry<float> peCameraFpgaTemp = PoolEntry<float>();
PoolEntry<float> peCameraSocTemp = PoolEntry<float>();
PoolEntry<float> peSysmonTemp = PoolEntry<float>();
PoolEntry<float> peSysmonVccInt = PoolEntry<float>();
PoolEntry<float> peSysmonVccAux = PoolEntry<float>();
PoolEntry<float> peSysmonVccBram = PoolEntry<float>();
PoolEntry<float> peSysmonVccPaux = PoolEntry<float>();
PoolEntry<float> peSysmonVccPint = PoolEntry<float>();
PoolEntry<float> peSysmonVccPdro = PoolEntry<float>();
PoolEntry<float> peSysmonMb12V = PoolEntry<float>();
PoolEntry<float> peSysmonMb3V3 = PoolEntry<float>();
PoolEntry<float> peSysmonMb1V8 = PoolEntry<float>();
PoolEntry<float> peSysmonVcc12V = PoolEntry<float>();
PoolEntry<float> peSysmonVcc5V = PoolEntry<float>();
PoolEntry<float> peSysmonVcc3V3 = PoolEntry<float>();
PoolEntry<float> peSysmonVcc3V3VA = PoolEntry<float>();
PoolEntry<float> peSysmonVcc2V5DDR = PoolEntry<float>();
PoolEntry<float> peSysmonVcc1V2DDR = PoolEntry<float>();
PoolEntry<float> peSysmonVcc0V9 = PoolEntry<float>();
PoolEntry<float> peSysmonVcc0V6VTT = PoolEntry<float>();
PoolEntry<float> peSysmonSafeCotsCur = PoolEntry<float>();
PoolEntry<float> peSysmonNvm4XoCur = PoolEntry<float>();
PoolEntry<uint16_t> peSemUncorrectableErrs = PoolEntry<uint16_t>();
PoolEntry<uint16_t> peSemCorrectableErrs = PoolEntry<uint16_t>();
PoolEntry<uint8_t> peSemStatus = PoolEntry<uint8_t>();
PoolEntry<uint8_t> peRebootMpsocRequired = PoolEntry<uint8_t>();
PowerState powerState;
bool specialComHelperExecuting = false;
struct ActionCommandInfo {
Countdown cmdCountdown = Countdown(mpsoc::DEFAULT_CMD_TIMEOUT_MS);
bool pending = false;
MessageQueueId_t commandedBy = MessageQueueIF::NO_QUEUE;
DeviceCommandId_t pendingCmd = DeviceHandlerIF::NO_COMMAND_ID;
uint16_t pendingCmdMpsocApid = 0;
void reset() {
pending = false;
commandedBy = MessageQueueIF::NO_QUEUE;
pendingCmd = DeviceHandlerIF::NO_COMMAND_ID;
}
void start(DeviceCommandId_t commandId, MessageQueueId_t commandedBy) {
pending = true;
cmdCountdown.resetTimer();
pendingCmd = commandId;
this->commandedBy = commandedBy;
}
} activeCmdInfo;
uint8_t commandBuffer[mpsoc::MAX_COMMAND_SIZE];
SpacePacketCreator creator;
ploc::SpTcParams spParams = ploc::SpTcParams(creator);
Mode_t targetMode = HasModesIF::MODE_UNDEFINED;
Submode_t targetSubmode = 0;
struct TmMemReadReport {
static const uint8_t FIX_SIZE = 14;
size_t rememberRequestedSize = 0;
};
TmMemReadReport tmMemReadReport;
uint32_t lastReplySequenceCount = 0;
uint8_t skipSupvCommandingToOn = false;
PowerSwitchIF& powerSwitcher;
power::Switch_t camSwitchId;
// HK manager abstract functions.
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override;
// Mode abstract functions
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t* msToReachTheMode) override;
// Action override. Forward to user.
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size) override;
/**
* @overload
* @param submode
*/
void startTransition(Mode_t newMode, Submode_t submode) override;
ReturnValue_t performDeviceOperationPreQueueHandling(uint8_t opCode) override;
// CommandsActionsIF overrides.
MessageQueueIF* getCommandQueuePtr() override;
void stepSuccessfulReceived(ActionId_t actionId, uint8_t step) override;
void stepFailedReceived(ActionId_t actionId, uint8_t step, ReturnValue_t returnCode) override;
void dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) override;
void completionSuccessfulReceived(ActionId_t actionId) override;
void completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) override;
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ParameterWrapper* parameterWrapper,
const ParameterWrapper* newValues, uint16_t startAtIndex) override;
void handleActionCommandFailure(ActionId_t actionId, ReturnValue_t returnCode);
ReturnValue_t executeRegularCmd(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t dataLen);
void handleTransitionToOn();
void handleTransitionToOff();
ReturnValue_t commandTcModeReplay();
ReturnValue_t commandTcMemWrite(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t commandTcMemRead(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t commandTcFlashDelete(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t commandTcReplayStart(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t commandTcReplayStop();
ReturnValue_t commandTcDownlinkPwrOn(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t commandTcDownlinkPwrOff();
ReturnValue_t commandTcGetHkReport();
ReturnValue_t commandTcGetDirContent(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t commandTcReplayWriteSequence(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t commandTcCamCmdSend(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t commandTcModeIdle();
ReturnValue_t commandTcCamTakePic(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t commandTcSimplexStreamFile(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t commandTcSplitFile(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t commandTcDownlinkDataModulate(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t commandTcModeSnapshot();
ReturnValue_t finishAndSendTc(DeviceCommandId_t cmdId, mpsoc::TcBase& tcBase,
uint32_t cmdCountdown = mpsoc::DEFAULT_CMD_TIMEOUT_MS);
void handleEvent(EventMessage* eventMessage);
void cmdDoneHandler(bool success, ReturnValue_t result);
ReturnValue_t handleDeviceReply();
ReturnValue_t handleAckReport();
ReturnValue_t handleExecutionReport();
void sendFailureReport(DeviceCommandId_t replyId, ReturnValue_t status);
ReturnValue_t reportReplyData(DeviceCommandId_t tmId);
ReturnValue_t handleGetHkReport();
bool handleHwStartup();
bool handleHwShutdown();
void stopSpecialComHelper();
void commandSubmodeTransition();
void commonSpecialComInit();
void commonSpecialComStop();
void commandInitHandling(ActionId_t actionId, MessageQueueId_t commandedBy);
};

View File

@ -241,10 +241,6 @@ ReturnValue_t FreshSupvHandler::executeAction(ActionId_t actionId, MessageQueueI
uartManager->initiateUpdateContinuation(); uartManager->initiateUpdateContinuation();
return EXECUTION_FINISHED; return EXECUTION_FINISHED;
} }
case ABORT_LONGER_REQUEST: {
uartManager->stop();
return EXECUTION_FINISHED;
}
case MEMORY_CHECK_WITH_FILE: { case MEMORY_CHECK_WITH_FILE: {
UpdateParams params; UpdateParams params;
result = extractBaseParams(&data, size, params); result = extractBaseParams(&data, size, params);
@ -853,10 +849,6 @@ ReturnValue_t FreshSupvHandler::prepareWipeMramCmd(const uint8_t* commandData, s
ReturnValue_t FreshSupvHandler::parseTmPackets() { ReturnValue_t FreshSupvHandler::parseTmPackets() {
uint8_t* receivedData = nullptr; uint8_t* receivedData = nullptr;
size_t receivedSize = 0; size_t receivedSize = 0;
// We do not want to steal packets from the long request handler.
if (uartManager->longerRequestActive()) {
return returnvalue::OK;
}
while (true) { while (true) {
ReturnValue_t result = ReturnValue_t result =
uartManager->readReceivedMessage(comCookie, &receivedData, &receivedSize); uartManager->readReceivedMessage(comCookie, &receivedData, &receivedSize);
@ -1307,7 +1299,7 @@ void FreshSupvHandler::handleExecutionFailureReport(ActiveCmdInfo& info, Executi
triggerEvent(SUPV_EXE_FAILURE, info.commandId, static_cast<uint32_t>(report.getStatusCode())); triggerEvent(SUPV_EXE_FAILURE, info.commandId, static_cast<uint32_t>(report.getStatusCode()));
} }
if (info.commandedBy) { if (info.commandedBy) {
actionHelper.finish(false, info.commandedBy, info.commandId, result::RECEIVED_EXE_FAILURE); actionHelper.finish(false, info.commandedBy, info.commandId, report.getStatusCode());
} }
info.isPending = false; info.isPending = false;
} }

View File

@ -1,75 +0,0 @@
#include "MpsocCommunication.h"
#include "fsfw/globalfunctions/CRC.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/tmtcpacket/ccsds/SpacePacketReader.h"
#include "fsfw/tmtcpacket/ccsds/header.h"
#include "linux/payload/plocMpsocHelpers.h"
#include "unistd.h"
MpsocCommunication::MpsocCommunication(object_id_t objectId, SerialConfig cfg)
: SystemObject(objectId), readRingBuf(4096, true), helper(cfg) {}
ReturnValue_t MpsocCommunication::initialize() { return helper.initialize(); }
ReturnValue_t MpsocCommunication::send(const uint8_t* data, size_t dataLen) {
if (MPSOC_LOW_LEVEL_TX_WIRETAPPING) {
sif::debug << "SEND MPSOC packet with size " << dataLen << std::endl;
}
return helper.send(data, dataLen);
}
ReturnValue_t MpsocCommunication::parseAndRetrieveNextPacket() {
// We do not have a data link layer, so this whole thing is a mess in any case..
// But basically, we try to parse space packets from the internal ring buffer and trasnfer
// them to the higher level device handler. The CRC check is performed here as well, with
// few other ways to detect if we even have a valid packet.
size_t availableReadData = readRingBuf.getAvailableReadData();
// Minimum valid size for a space packet header.
if (availableReadData < ccsds::HEADER_LEN + 1) {
return returnvalue::OK;
}
readRingBuf.readData(readBuf, availableReadData);
spReader.setReadOnlyData(readBuf, sizeof(readBuf));
auto res = spReader.checkSize();
if (res != returnvalue::OK) {
return res;
}
// The packet might be garbage, with no way to recover without a data link layer.
if (spReader.getFullPacketLen() > 4096) {
readRingBuf.clear();
// TODO: Maybe we should also clear the serial input buffer in Linux?
return FAULTY_PACKET_SIZE;
}
if (availableReadData < spReader.getFullPacketLen()) {
// Might be split packet where the rest still has to be read.
return returnvalue::OK;
}
if (CRC::crc16ccitt(readBuf, spReader.getFullPacketLen()) != 0) {
// Possibly invalid packet. We can not even trust the detected packet length.
// Just clear the whole read buffer as well.
readRingBuf.clear();
triggerEvent(mpsoc::CRC_FAILURE);
return CRC_CHECK_FAILED;
}
readRingBuf.deleteData(spReader.getFullPacketLen());
return PACKET_RECEIVED;
}
ReturnValue_t MpsocCommunication::readSerialInterface() {
int bytesRead = read(helper.rawFd(), readBuf, sizeof(readBuf));
if (bytesRead < 0) {
return returnvalue::FAILED;
}
if (bytesRead > 0) {
if (MPSOC_LOW_LEVEL_RX_WIRETAPPING) {
sif::debug << "Read " << bytesRead << " bytes on the MPSoC interface" << std::endl;
}
return readRingBuf.writeData(readBuf, bytesRead);
}
return returnvalue::OK;
}
const SpacePacketReader& MpsocCommunication::getSpReader() const { return spReader; }
SerialCommunicationHelper& MpsocCommunication::getComHelper() { return helper; }

View File

@ -1,44 +0,0 @@
#pragma once
#include <fsfw/objectmanager/SystemObject.h>
#include "eive/resultClassIds.h"
#include "fsfw/container/SimpleRingBuffer.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/tmtcpacket/ccsds/SpacePacketReader.h"
#include "linux/payload/SerialCommunicationHelper.h"
static constexpr bool MPSOC_LOW_LEVEL_TX_WIRETAPPING = false;
static constexpr bool MPSOC_LOW_LEVEL_RX_WIRETAPPING = false;
class MpsocCommunication : public SystemObject {
public:
static const uint8_t CLASS_ID = CLASS_ID::PLOC_MPSOC_COM;
static constexpr ReturnValue_t PACKET_RECEIVED = returnvalue::makeCode(CLASS_ID, 0);
static constexpr ReturnValue_t FAULTY_PACKET_SIZE = returnvalue::makeCode(CLASS_ID, 1);
static constexpr ReturnValue_t CRC_CHECK_FAILED = returnvalue::makeCode(CLASS_ID, 2);
MpsocCommunication(object_id_t objectId, SerialConfig cfg);
ReturnValue_t initialize() override;
ReturnValue_t send(const uint8_t* data, size_t dataLen);
// Should be called periodically to transfer the received data from the MPSoC from the Linux
// buffer to the internal ring buffer for further processing.
ReturnValue_t readSerialInterface();
// Parses the internal ring buffer for packets and checks whether a packet was received.
ReturnValue_t parseAndRetrieveNextPacket();
// Can be used to read the parse packet, if one was received.
const SpacePacketReader& getSpReader() const;
SerialCommunicationHelper& getComHelper();
private:
SpacePacketReader spReader;
uint8_t readBuf[4096];
SimpleRingBuffer readRingBuf;
SerialCommunicationHelper helper;
};

View File

@ -2,15 +2,15 @@
#include <linux/payload/PlocMpsocHandler.h> #include <linux/payload/PlocMpsocHandler.h>
#include <linux/payload/plocSupvDefs.h> #include <linux/payload/plocSupvDefs.h>
#include <sstream>
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "fsfw/datapool/PoolReadGuard.h" #include "fsfw/datapool/PoolReadGuard.h"
#include "fsfw/globalfunctions/CRC.h" #include "fsfw/globalfunctions/CRC.h"
#include "fsfw/ipc/QueueFactory.h"
#include "fsfw/parameters/HasParametersIF.h" #include "fsfw/parameters/HasParametersIF.h"
PlocMpsocHandler::PlocMpsocHandler(object_id_t objectId, object_id_t uartComIFid, PlocMpsocHandler::PlocMpsocHandler(object_id_t objectId, object_id_t uartComIFid,
CookieIF* comCookie, CookieIF* comCookie, PlocMpsocSpecialComHelper* plocMPSoCHelper,
PlocMpsocSpecialComHelperLegacy* plocMPSoCHelper,
Gpio uartIsolatorSwitch, object_id_t supervisorHandler) Gpio uartIsolatorSwitch, object_id_t supervisorHandler)
: DeviceHandlerBase(objectId, uartComIFid, comCookie), : DeviceHandlerBase(objectId, uartComIFid, comCookie),
hkReport(this), hkReport(this),
@ -54,26 +54,24 @@ ReturnValue_t PlocMpsocHandler::initialize() {
return result; return result;
} }
result = manager->subscribeToEvent( result = manager->subscribeToEvent(
eventQueue->getId(), eventQueue->getId(), event::getEventId(PlocMpsocSpecialComHelper::MPSOC_FLASH_WRITE_FAILED));
event::getEventId(PlocMpsocSpecialComHelperLegacy::MPSOC_FLASH_WRITE_FAILED));
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
result = manager->subscribeToEvent( result = manager->subscribeToEvent(
eventQueue->getId(), eventQueue->getId(),
event::getEventId(PlocMpsocSpecialComHelperLegacy::MPSOC_FLASH_WRITE_SUCCESSFUL)); event::getEventId(PlocMpsocSpecialComHelper::MPSOC_FLASH_WRITE_SUCCESSFUL));
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
result = manager->subscribeToEvent( result = manager->subscribeToEvent(
eventQueue->getId(), eventQueue->getId(),
event::getEventId(PlocMpsocSpecialComHelperLegacy::MPSOC_FLASH_READ_SUCCESSFUL)); event::getEventId(PlocMpsocSpecialComHelper::MPSOC_FLASH_READ_SUCCESSFUL));
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
result = manager->subscribeToEvent( result = manager->subscribeToEvent(
eventQueue->getId(), eventQueue->getId(), event::getEventId(PlocMpsocSpecialComHelper::MPSOC_FLASH_READ_FAILED));
event::getEventId(PlocMpsocSpecialComHelperLegacy::MPSOC_FLASH_READ_FAILED));
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
@ -141,7 +139,7 @@ ReturnValue_t PlocMpsocHandler::executeAction(ActionId_t actionId, MessageQueueI
} }
if (specialComHelperExecuting) { if (specialComHelperExecuting) {
return mpsoc::MPSOC_HELPER_EXECUTING; return MPSoCReturnValuesIF::MPSOC_HELPER_EXECUTING;
} }
switch (actionId) { switch (actionId) {
@ -410,7 +408,7 @@ ReturnValue_t PlocMpsocHandler::scanForReply(const uint8_t* start, size_t remain
sif::debug << "PlocMPSoCHandler::scanForReply: Reply has invalid APID 0x" << std::hex sif::debug << "PlocMPSoCHandler::scanForReply: Reply has invalid APID 0x" << std::hex
<< std::setfill('0') << std::setw(2) << apid << std::dec << std::endl; << std::setfill('0') << std::setw(2) << apid << std::dec << std::endl;
*foundLen = remainingSize; *foundLen = remainingSize;
return mpsoc::INVALID_APID; return MPSoCReturnValuesIF::INVALID_APID;
} }
} }
@ -447,7 +445,7 @@ ReturnValue_t PlocMpsocHandler::interpretDeviceReply(DeviceCommandId_t id, const
} }
case (mpsoc::TM_FLASH_DIRECTORY_CONTENT): { case (mpsoc::TM_FLASH_DIRECTORY_CONTENT): {
result = verifyPacket(packet, foundPacketLen); result = verifyPacket(packet, foundPacketLen);
if (result == mpsoc::CRC_FAILURE) { if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
sif::warning << "PLOC MPSoC: Flash directory content reply invalid CRC" << std::endl; sif::warning << "PLOC MPSoC: Flash directory content reply invalid CRC" << std::endl;
} }
/** Send data to commanding queue */ /** Send data to commanding queue */
@ -559,7 +557,7 @@ ReturnValue_t PlocMpsocHandler::prepareTcMemRead(const uint8_t* commandData,
ReturnValue_t PlocMpsocHandler::prepareTcFlashDelete(const uint8_t* commandData, ReturnValue_t PlocMpsocHandler::prepareTcFlashDelete(const uint8_t* commandData,
size_t commandDataLen) { size_t commandDataLen) {
if (commandDataLen > config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE) { if (commandDataLen > config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE) {
return mpsoc::NAME_TOO_LONG; return MPSoCReturnValuesIF::NAME_TOO_LONG;
} }
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
mpsoc::TcFlashDelete tcFlashDelete(spParams, sequenceCount); mpsoc::TcFlashDelete tcFlashDelete(spParams, sequenceCount);
@ -720,7 +718,7 @@ ReturnValue_t PlocMpsocHandler::finishTcPrep(mpsoc::TcBase& tcBase) {
ReturnValue_t PlocMpsocHandler::verifyPacket(const uint8_t* start, size_t foundLen) { ReturnValue_t PlocMpsocHandler::verifyPacket(const uint8_t* start, size_t foundLen) {
if (CRC::crc16ccitt(start, foundLen) != 0) { if (CRC::crc16ccitt(start, foundLen) != 0) {
return mpsoc::CRC_FAILURE; return MPSoCReturnValuesIF::CRC_FAILURE;
} }
return returnvalue::OK; return returnvalue::OK;
} }
@ -729,12 +727,12 @@ ReturnValue_t PlocMpsocHandler::handleAckReport(const uint8_t* data) {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
result = verifyPacket(data, mpsoc::SIZE_ACK_REPORT); result = verifyPacket(data, mpsoc::SIZE_ACK_REPORT);
if (result == mpsoc::CRC_FAILURE) { if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
sif::warning << "PlocMPSoCHandler::handleAckReport: CRC failure" << std::endl; sif::warning << "PlocMPSoCHandler::handleAckReport: CRC failure" << std::endl;
nextReplyId = mpsoc::NONE; nextReplyId = mpsoc::NONE;
replyRawReplyIfnotWiretapped(data, mpsoc::SIZE_ACK_REPORT); replyRawReplyIfnotWiretapped(data, mpsoc::SIZE_ACK_REPORT);
triggerEvent(MPSOC_HANDLER_CRC_FAILURE); triggerEvent(MPSOC_HANDLER_CRC_FAILURE);
sendFailureReport(mpsoc::ACK_REPORT, mpsoc::CRC_FAILURE); sendFailureReport(mpsoc::ACK_REPORT, MPSoCReturnValuesIF::CRC_FAILURE);
disableAllReplies(); disableAllReplies();
return IGNORE_REPLY_DATA; return IGNORE_REPLY_DATA;
} }
@ -773,7 +771,7 @@ ReturnValue_t PlocMpsocHandler::handleExecutionReport(const uint8_t* data) {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
result = verifyPacket(data, mpsoc::SIZE_EXE_REPORT); result = verifyPacket(data, mpsoc::SIZE_EXE_REPORT);
if (result == mpsoc::CRC_FAILURE) { if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
sif::warning << "PlocMPSoCHandler::handleExecutionReport: CRC failure" << std::endl; sif::warning << "PlocMPSoCHandler::handleExecutionReport: CRC failure" << std::endl;
nextReplyId = mpsoc::NONE; nextReplyId = mpsoc::NONE;
return result; return result;
@ -794,9 +792,9 @@ ReturnValue_t PlocMpsocHandler::handleExecutionReport(const uint8_t* data) {
uint16_t status = mpsoc::getStatusFromRawData(data); uint16_t status = mpsoc::getStatusFromRawData(data);
sif::warning << "MPSoC EXE Failure: " << mpsoc::getStatusString(status) << std::endl; sif::warning << "MPSoC EXE Failure: " << mpsoc::getStatusString(status) << std::endl;
triggerEvent(EXE_FAILURE, commandId, status); triggerEvent(EXE_FAILURE, commandId, status);
sendFailureReport(mpsoc::EXE_REPORT, mpsoc::RECEIVED_EXE_FAILURE); sendFailureReport(mpsoc::EXE_REPORT, MPSoCReturnValuesIF::RECEIVED_EXE_FAILURE);
result = IGNORE_REPLY_DATA; result = IGNORE_REPLY_DATA;
cmdDoneHandler(false, mpsoc::RECEIVED_EXE_FAILURE); cmdDoneHandler(false, MPSoCReturnValuesIF::RECEIVED_EXE_FAILURE);
break; break;
} }
default: { default: {
@ -812,7 +810,7 @@ ReturnValue_t PlocMpsocHandler::handleExecutionReport(const uint8_t* data) {
ReturnValue_t PlocMpsocHandler::handleMemoryReadReport(const uint8_t* data) { ReturnValue_t PlocMpsocHandler::handleMemoryReadReport(const uint8_t* data) {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
result = verifyPacket(data, tmMemReadReport.rememberRequestedSize); result = verifyPacket(data, tmMemReadReport.rememberRequestedSize);
if (result == mpsoc::CRC_FAILURE) { if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
sif::warning << "PlocMPSoCHandler::handleMemoryReadReport: Memory read report has invalid crc" sif::warning << "PlocMPSoCHandler::handleMemoryReadReport: Memory read report has invalid crc"
<< std::endl; << std::endl;
} }
@ -1006,7 +1004,7 @@ ReturnValue_t PlocMpsocHandler::handleGetHkReport(const uint8_t* data) {
ReturnValue_t PlocMpsocHandler::handleCamCmdRpt(const uint8_t* data) { ReturnValue_t PlocMpsocHandler::handleCamCmdRpt(const uint8_t* data) {
ReturnValue_t result = verifyPacket(data, foundPacketLen); ReturnValue_t result = verifyPacket(data, foundPacketLen);
if (result == mpsoc::CRC_FAILURE) { if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
sif::warning << "PlocMPSoCHandler::handleCamCmdRpt: CRC failure" << std::endl; sif::warning << "PlocMPSoCHandler::handleCamCmdRpt: CRC failure" << std::endl;
} }
SpacePacketReader packetReader(data, foundPacketLen); SpacePacketReader packetReader(data, foundPacketLen);

View File

@ -1,19 +1,23 @@
#ifndef BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_ #ifndef BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_
#define BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_ #define BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_
#include <linux/payload/PlocMpsocSpecialComHelperLegacy.h> #include <linux/payload/PlocMpsocSpecialComHelper.h>
#include <linux/payload/mpsocRetvals.h>
#include <linux/payload/plocMpsocHelpers.h> #include <linux/payload/plocMpsocHelpers.h>
#include <linux/payload/plocSupvDefs.h> #include <linux/payload/plocSupvDefs.h>
#include <mission/controller/controllerdefinitions/PowerCtrlDefinitions.h> #include <mission/controller/controllerdefinitions/PowerCtrlDefinitions.h>
#include <string>
#include "fsfw/action/CommandActionHelper.h" #include "fsfw/action/CommandActionHelper.h"
#include "fsfw/action/CommandsActionsIF.h" #include "fsfw/action/CommandsActionsIF.h"
#include "fsfw/devicehandlers/DeviceHandlerBase.h" #include "fsfw/devicehandlers/DeviceHandlerBase.h"
#include "fsfw/ipc/QueueFactory.h"
#include "fsfw/tmtcservices/SourceSequenceCounter.h" #include "fsfw/tmtcservices/SourceSequenceCounter.h"
#include "fsfw_hal/linux/gpio/Gpio.h" #include "fsfw_hal/linux/gpio/Gpio.h"
#include "fsfw_hal/linux/serial/SerialComIF.h" #include "fsfw_hal/linux/serial/SerialComIF.h"
static constexpr bool DEBUG_MPSOC_COMMUNICATION = true; static constexpr bool DEBUG_MPSOC_COMMUNICATION = false;
/** /**
* @brief This is the device handler for the MPSoC of the payload computer. * @brief This is the device handler for the MPSoC of the payload computer.
@ -44,7 +48,7 @@ class PlocMpsocHandler : public DeviceHandlerBase, public CommandsActionsIF {
* @param supervisorHandler Object ID of the supervisor handler * @param supervisorHandler Object ID of the supervisor handler
*/ */
PlocMpsocHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF* comCookie, PlocMpsocHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF* comCookie,
PlocMpsocSpecialComHelperLegacy* plocMPSoCHelper, Gpio uartIsolatorSwitch, PlocMpsocSpecialComHelper* plocMPSoCHelper, Gpio uartIsolatorSwitch,
object_id_t supervisorHandler); object_id_t supervisorHandler);
virtual ~PlocMpsocHandler(); virtual ~PlocMpsocHandler();
virtual ReturnValue_t initialize() override; virtual ReturnValue_t initialize() override;
@ -167,7 +171,7 @@ class PlocMpsocHandler : public DeviceHandlerBase, public CommandsActionsIF {
SerialComIF* uartComIf = nullptr; SerialComIF* uartComIf = nullptr;
PlocMpsocSpecialComHelperLegacy* specialComHelper = nullptr; PlocMpsocSpecialComHelper* specialComHelper = nullptr;
Gpio uartIsolatorSwitch; Gpio uartIsolatorSwitch;
object_id_t supervisorHandler = 0; object_id_t supervisorHandler = 0;
CommandActionHelper commandActionHelper; CommandActionHelper commandActionHelper;
@ -182,7 +186,7 @@ class PlocMpsocHandler : public DeviceHandlerBase, public CommandsActionsIF {
}; };
TmMemReadReport tmMemReadReport; TmMemReadReport tmMemReadReport;
Countdown cmdCountdown = Countdown(15000); Countdown cmdCountdown = Countdown(10000);
struct TelemetryBuffer { struct TelemetryBuffer {
uint16_t length = 0; uint16_t length = 0;

View File

@ -6,21 +6,16 @@
#include <filesystem> #include <filesystem>
#include <fstream> #include <fstream>
#include "fsfw/serviceinterface/ServiceInterfacePrinter.h"
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
#include "fsfw/tmtcpacket/ccsds/SpacePacketReader.h"
#include "linux/payload/MpsocCommunication.h"
#include "linux/payload/plocMpsocHelpers.h"
#ifdef XIPHOS_Q7S #ifdef XIPHOS_Q7S
#include "bsp_q7s/fs/FilesystemHelper.h" #include "bsp_q7s/fs/FilesystemHelper.h"
#endif #endif
#include "mission/utility/Timestamp.h"
using namespace ploc; using namespace ploc;
PlocMpsocSpecialComHelper::PlocMpsocSpecialComHelper(object_id_t objectId, PlocMpsocSpecialComHelper::PlocMpsocSpecialComHelper(object_id_t objectId)
MpsocCommunication& comInterface) : SystemObject(objectId) {
: SystemObject(objectId), comInterface(comInterface) {
spParams.buf = commandBuffer; spParams.buf = commandBuffer;
spParams.maxSize = sizeof(commandBuffer); spParams.maxSize = sizeof(commandBuffer);
} }
@ -53,9 +48,9 @@ ReturnValue_t PlocMpsocSpecialComHelper::performOperation(uint8_t operationCode)
case InternalState::FLASH_WRITE: { case InternalState::FLASH_WRITE: {
result = performFlashWrite(); result = performFlashWrite();
if (result == returnvalue::OK) { if (result == returnvalue::OK) {
triggerEvent(MPSOC_FLASH_WRITE_SUCCESSFUL, txSequenceCount.get()); triggerEvent(MPSOC_FLASH_WRITE_SUCCESSFUL, sequenceCount->get());
} else { } else {
triggerEvent(MPSOC_FLASH_WRITE_FAILED, txSequenceCount.get()); triggerEvent(MPSOC_FLASH_WRITE_FAILED, sequenceCount->get());
} }
internalState = InternalState::IDLE; internalState = InternalState::IDLE;
break; break;
@ -63,10 +58,9 @@ ReturnValue_t PlocMpsocSpecialComHelper::performOperation(uint8_t operationCode)
case InternalState::FLASH_READ: { case InternalState::FLASH_READ: {
result = performFlashRead(); result = performFlashRead();
if (result == returnvalue::OK) { if (result == returnvalue::OK) {
triggerEvent(MPSOC_FLASH_READ_SUCCESSFUL, txSequenceCount.get()); triggerEvent(MPSOC_FLASH_READ_SUCCESSFUL, sequenceCount->get());
} else { } else {
sif::printWarning("PLOC MPSoC Helper: Flash read failed with code %04x\n", result); triggerEvent(MPSOC_FLASH_READ_FAILED, sequenceCount->get());
triggerEvent(MPSOC_FLASH_READ_FAILED, txSequenceCount.get(), result);
} }
internalState = InternalState::IDLE; internalState = InternalState::IDLE;
break; break;
@ -78,12 +72,19 @@ ReturnValue_t PlocMpsocSpecialComHelper::performOperation(uint8_t operationCode)
} }
} }
void PlocMpsocSpecialComHelper::setCommandSequenceCount(uint16_t sequenceCount_) { ReturnValue_t PlocMpsocSpecialComHelper::setComIF(DeviceCommunicationIF* communicationInterface_) {
txSequenceCount.set(sequenceCount_); uartComIF = dynamic_cast<SerialComIF*>(communicationInterface_);
if (uartComIF == nullptr) {
sif::warning << "PlocMPSoCHelper::initialize: Invalid uart com if" << std::endl;
return returnvalue::FAILED;
}
return returnvalue::OK;
} }
uint16_t PlocMpsocSpecialComHelper::getCommandSequenceCount() const { void PlocMpsocSpecialComHelper::setComCookie(CookieIF* comCookie_) { comCookie = comCookie_; }
return txSequenceCount.get();
void PlocMpsocSpecialComHelper::setSequenceCount(SourceSequenceCounter* sequenceCount_) {
sequenceCount = sequenceCount_;
} }
ReturnValue_t PlocMpsocSpecialComHelper::startFlashWrite(std::string obcFile, ReturnValue_t PlocMpsocSpecialComHelper::startFlashWrite(std::string obcFile,
@ -116,8 +117,7 @@ ReturnValue_t PlocMpsocSpecialComHelper::startFlashRead(std::string obcFile, std
void PlocMpsocSpecialComHelper::resetHelper() { void PlocMpsocSpecialComHelper::resetHelper() {
spParams.buf = commandBuffer; spParams.buf = commandBuffer;
terminate = false; terminate = false;
auto& helper = comInterface.getComHelper(); uartComIF->flushUartRxBuffer(comCookie);
helper.flushUartRxBuffer();
} }
void PlocMpsocSpecialComHelper::stopProcess() { terminate = true; } void PlocMpsocSpecialComHelper::stopProcess() { terminate = true; }
@ -155,7 +155,7 @@ ReturnValue_t PlocMpsocSpecialComHelper::performFlashWrite() {
file.read(reinterpret_cast<char*>(fileBuf.data()), dataLength); file.read(reinterpret_cast<char*>(fileBuf.data()), dataLength);
bytesRead += dataLength; bytesRead += dataLength;
remainingSize -= dataLength; remainingSize -= dataLength;
mpsoc::TcFlashWrite tc(spParams, txSequenceCount); 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) {
return result; return result;
@ -164,7 +164,7 @@ ReturnValue_t PlocMpsocSpecialComHelper::performFlashWrite() {
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
txSequenceCount.increment(); (*sequenceCount)++;
result = handlePacketTransmissionNoReply(tc); result = handlePacketTransmissionNoReply(tc);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
@ -179,12 +179,8 @@ ReturnValue_t PlocMpsocSpecialComHelper::performFlashWrite() {
ReturnValue_t PlocMpsocSpecialComHelper::performFlashRead() { ReturnValue_t PlocMpsocSpecialComHelper::performFlashRead() {
std::error_code e; std::error_code e;
if (std::filesystem::exists(flashReadAndWrite.obcFile)) { std::ofstream ofile(flashReadAndWrite.obcFile, std::ios::trunc | std::ios::binary);
// Truncate the file first. if (ofile.bad()) {
std::ofstream ofile(flashReadAndWrite.obcFile, std::ios::binary | std::ios::trunc);
}
std::ofstream ofile(flashReadAndWrite.obcFile, std::ios::binary | std::ios::app);
if (ofile.bad() or not ofile.is_open()) {
return returnvalue::FAILED; return returnvalue::FAILED;
} }
ReturnValue_t result = flashfopen(mpsoc::FileAccessModes::READ); ReturnValue_t result = flashfopen(mpsoc::FileAccessModes::READ);
@ -207,7 +203,7 @@ ReturnValue_t PlocMpsocSpecialComHelper::performFlashRead() {
std::filesystem::remove(flashReadAndWrite.obcFile, e); std::filesystem::remove(flashReadAndWrite.obcFile, e);
return FILE_READ_ERROR; return FILE_READ_ERROR;
} }
mpsoc::TcFlashRead flashReadRequest(spParams, txSequenceCount); 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);
@ -218,7 +214,7 @@ ReturnValue_t PlocMpsocSpecialComHelper::performFlashRead() {
std::filesystem::remove(flashReadAndWrite.obcFile, e); std::filesystem::remove(flashReadAndWrite.obcFile, e);
return result; return result;
} }
txSequenceCount.increment(); (*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);
@ -235,7 +231,7 @@ ReturnValue_t PlocMpsocSpecialComHelper::performFlashRead() {
ReturnValue_t PlocMpsocSpecialComHelper::flashfopen(uint8_t mode) { ReturnValue_t PlocMpsocSpecialComHelper::flashfopen(uint8_t mode) {
spParams.buf = commandBuffer; spParams.buf = commandBuffer;
mpsoc::TcFlashFopen flashFopen(spParams, txSequenceCount); mpsoc::FlashFopen flashFopen(spParams, *sequenceCount);
ReturnValue_t result = flashFopen.setPayload(flashReadAndWrite.mpsocFile, mode); ReturnValue_t result = flashFopen.setPayload(flashReadAndWrite.mpsocFile, mode);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
@ -244,7 +240,7 @@ ReturnValue_t PlocMpsocSpecialComHelper::flashfopen(uint8_t mode) {
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
txSequenceCount.increment(); (*sequenceCount)++;
result = handlePacketTransmissionNoReply(flashFopen); result = handlePacketTransmissionNoReply(flashFopen);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
@ -254,12 +250,12 @@ ReturnValue_t PlocMpsocSpecialComHelper::flashfopen(uint8_t mode) {
ReturnValue_t PlocMpsocSpecialComHelper::flashfclose() { ReturnValue_t PlocMpsocSpecialComHelper::flashfclose() {
spParams.buf = commandBuffer; spParams.buf = commandBuffer;
mpsoc::TcFlashFclose flashFclose(spParams, txSequenceCount); mpsoc::FlashFclose flashFclose(spParams, *sequenceCount);
ReturnValue_t result = flashFclose.finishPacket(); ReturnValue_t result = flashFclose.finishPacket();
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
txSequenceCount.increment(); (*sequenceCount)++;
result = handlePacketTransmissionNoReply(flashFclose); result = handlePacketTransmissionNoReply(flashFclose);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
@ -282,7 +278,6 @@ ReturnValue_t PlocMpsocSpecialComHelper::handlePacketTransmissionFlashRead(mpsoc
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
auto& spReader = comInterface.getSpReader();
// We have the nominal case where the flash read report appears first, or the case where we // We have the nominal case where the flash read report appears first, or the case where we
// get an EXE failure immediately. // get an EXE failure immediately.
@ -293,7 +288,7 @@ ReturnValue_t PlocMpsocSpecialComHelper::handlePacketTransmissionFlashRead(mpsoc
} }
return handleExe(); return handleExe();
} else if (spReader.getApid() == mpsoc::apid::EXE_FAILURE) { } else if (spReader.getApid() == mpsoc::apid::EXE_FAILURE) {
handleExeFailure(spReader); handleExeFailure();
} else { } else {
triggerEvent(MPSOC_EXE_INVALID_APID, spReader.getApid(), static_cast<uint32_t>(internalState)); triggerEvent(MPSOC_EXE_INVALID_APID, spReader.getApid(), static_cast<uint32_t>(internalState));
sif::warning << "PLOC MPSoC: Expected execution report " sif::warning << "PLOC MPSoC: Expected execution report "
@ -316,8 +311,8 @@ ReturnValue_t PlocMpsocSpecialComHelper::handlePacketTransmissionNoReply(ploc::S
} }
ReturnValue_t PlocMpsocSpecialComHelper::sendCommand(ploc::SpTcBase& tc) { ReturnValue_t PlocMpsocSpecialComHelper::sendCommand(ploc::SpTcBase& tc) {
ReturnValue_t result = comInterface.send(tc.getFullPacket(), tc.getFullPacketLen()); ReturnValue_t result = returnvalue::OK;
mpsoc::printTxPacket(tc); 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;
triggerEvent(MPSOC_SENDING_COMMAND_FAILED, result, static_cast<uint32_t>(internalState)); triggerEvent(MPSOC_SENDING_COMMAND_FAILED, result, static_cast<uint32_t>(internalState));
@ -336,8 +331,6 @@ ReturnValue_t PlocMpsocSpecialComHelper::handleAck() {
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
const auto& spReader = comInterface.getSpReader();
uint16_t apid = spReader.getApid(); uint16_t apid = spReader.getApid();
if (apid != mpsoc::apid::ACK_SUCCESS) { if (apid != mpsoc::apid::ACK_SUCCESS) {
handleAckApidFailure(spReader); handleAckApidFailure(spReader);
@ -346,7 +339,7 @@ ReturnValue_t PlocMpsocSpecialComHelper::handleAck() {
return returnvalue::OK; return returnvalue::OK;
} }
void PlocMpsocSpecialComHelper::handleAckApidFailure(const SpacePacketReader& reader) { void PlocMpsocSpecialComHelper::handleAckApidFailure(const ploc::SpTmReader& reader) {
uint16_t apid = reader.getApid(); uint16_t apid = reader.getApid();
if (apid == mpsoc::apid::ACK_FAILURE) { if (apid == mpsoc::apid::ACK_FAILURE) {
uint16_t status = mpsoc::getStatusFromRawData(reader.getFullData()); uint16_t status = mpsoc::getStatusFromRawData(reader.getFullData());
@ -370,10 +363,9 @@ ReturnValue_t PlocMpsocSpecialComHelper::handleExe() {
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
const auto& spReader = comInterface.getSpReader();
uint16_t apid = spReader.getApid(); uint16_t apid = spReader.getApid();
if (apid == mpsoc::apid::EXE_FAILURE) { if (apid == mpsoc::apid::EXE_FAILURE) {
handleExeFailure(spReader); handleExeFailure();
return returnvalue::FAILED; return returnvalue::FAILED;
} else if (apid != mpsoc::apid::EXE_SUCCESS) { } else if (apid != mpsoc::apid::EXE_SUCCESS) {
triggerEvent(MPSOC_EXE_INVALID_APID, apid, static_cast<uint32_t>(internalState)); triggerEvent(MPSOC_EXE_INVALID_APID, apid, static_cast<uint32_t>(internalState));
@ -383,7 +375,7 @@ ReturnValue_t PlocMpsocSpecialComHelper::handleExe() {
return returnvalue::OK; return returnvalue::OK;
} }
void PlocMpsocSpecialComHelper::handleExeFailure(const SpacePacketReader& spReader) { void PlocMpsocSpecialComHelper::handleExeFailure() {
uint16_t status = mpsoc::getStatusFromRawData(spReader.getFullData()); uint16_t status = mpsoc::getStatusFromRawData(spReader.getFullData());
sif::warning << "PLOC MPSoC EXE Failure: " << mpsoc::getStatusString(status) << std::endl; sif::warning << "PLOC MPSoC EXE Failure: " << mpsoc::getStatusString(status) << std::endl;
triggerEvent(MPSOC_EXE_FAILURE_REPORT, static_cast<uint32_t>(internalState)); triggerEvent(MPSOC_EXE_FAILURE_REPORT, static_cast<uint32_t>(internalState));
@ -392,32 +384,46 @@ void PlocMpsocSpecialComHelper::handleExeFailure(const SpacePacketReader& spRead
ReturnValue_t PlocMpsocSpecialComHelper::handleTmReception() { ReturnValue_t PlocMpsocSpecialComHelper::handleTmReception() {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
tmCountdown.resetTimer(); tmCountdown.resetTimer();
size_t readBytes = 0;
size_t currentBytes = 0;
uint32_t usleepDelay = 5; uint32_t usleepDelay = 5;
size_t fullPacketLen = 0;
while (true) { while (true) {
if (tmCountdown.hasTimedOut()) { if (tmCountdown.hasTimedOut()) {
triggerEvent(MPSOC_READ_TIMEOUT, tmCountdown.getTimeoutMs()); triggerEvent(MPSOC_READ_TIMEOUT, tmCountdown.getTimeoutMs());
return returnvalue::FAILED; return returnvalue::FAILED;
} }
result = tryReceiveNextReply(); result = receive(tmBuf.data() + readBytes, 6, &currentBytes);
if (result == MpsocCommunication::PACKET_RECEIVED) {
// Need to convert this, we are faking a synchronous API here.
result = returnvalue::OK;
break;
}
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
if (result == MpsocCommunication::FAULTY_PACKET_SIZE) {
sif::printWarning("PLOC MPSoC Helper: retrieving next reply failed: faulty packet size\n");
} else if (result == MpsocCommunication::CRC_CHECK_FAILED) {
sif::printWarning("PLOC MPSoC Helper: retrieving next reply failed: CRC check failed\n");
}
sif::printWarning("PLOC MPSoC Helper: retrieving next reply failed with code %d\n", result);
return result; return result;
} }
spReader.setReadOnlyData(tmBuf.data(), tmBuf.size());
fullPacketLen = spReader.getFullPacketLen();
readBytes += currentBytes;
if (readBytes == 6) {
break;
}
usleep(usleepDelay); usleep(usleepDelay);
if (usleepDelay < 200000) { if (usleepDelay < 200000) {
usleepDelay *= 4; usleepDelay *= 4;
} }
} }
while (true) {
if (tmCountdown.hasTimedOut()) {
triggerEvent(MPSOC_READ_TIMEOUT, tmCountdown.getTimeoutMs());
return returnvalue::FAILED;
}
result = receive(tmBuf.data() + readBytes, fullPacketLen - readBytes, &currentBytes);
readBytes += currentBytes;
if (fullPacketLen == readBytes) {
break;
}
usleep(usleepDelay);
if (usleepDelay < 200000) {
usleepDelay *= 4;
}
}
// arrayprinter::print(tmBuf.data(), readBytes);
return result; return result;
} }
@ -427,7 +433,6 @@ ReturnValue_t PlocMpsocSpecialComHelper::handleFlashReadReply(std::ofstream& ofi
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
auto& spReader = comInterface.getSpReader();
uint16_t apid = spReader.getApid(); uint16_t apid = spReader.getApid();
if (apid != mpsoc::apid::TM_FLASH_READ_REPORT) { if (apid != mpsoc::apid::TM_FLASH_READ_REPORT) {
triggerEvent(MPSOC_FLASH_READ_PACKET_ERROR, FlashReadErrorType::FLASH_READ_APID_ERROR); triggerEvent(MPSOC_FLASH_READ_PACKET_ERROR, FlashReadErrorType::FLASH_READ_APID_ERROR);
@ -493,25 +498,47 @@ ReturnValue_t PlocMpsocSpecialComHelper::startFlashReadOrWriteBase(std::string o
} }
ReturnValue_t PlocMpsocSpecialComHelper::checkReceivedTm() { ReturnValue_t PlocMpsocSpecialComHelper::checkReceivedTm() {
const auto& spReader = comInterface.getSpReader();
ReturnValue_t result = spReader.checkSize(); ReturnValue_t result = spReader.checkSize();
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
sif::error << "PLOC MPSoC: Size check on received TM failed" << std::endl; sif::error << "PLOC MPSoC: Size check on received TM failed" << std::endl;
triggerEvent(MPSOC_TM_SIZE_ERROR); triggerEvent(MPSOC_TM_SIZE_ERROR);
return result; return result;
} }
rxSequenceCount = spReader.getSequenceCount(); result = spReader.checkCrc();
mpsoc::printRxPacket(spReader); if (result != returnvalue::OK) {
sif::warning << "PLOC MPSoC: CRC check failed" << std::endl;
triggerEvent(MPSOC_TM_CRC_MISSMATCH, *sequenceCount);
return result;
}
uint16_t recvSeqCnt = spReader.getSequenceCount();
if (recvSeqCnt != *sequenceCount) {
triggerEvent(MPSOC_HELPER_SEQ_CNT_MISMATCH, *sequenceCount, recvSeqCnt);
*sequenceCount = recvSeqCnt;
}
// This sequence count ping pong does not make any sense but it is how the MPSoC expects it.
(*sequenceCount)++;
return returnvalue::OK; return returnvalue::OK;
} }
ReturnValue_t PlocMpsocSpecialComHelper::tryReceiveNextReply() { ReturnValue_t PlocMpsocSpecialComHelper::receive(uint8_t* data, size_t requestBytes,
size_t* readBytes) {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
result = comInterface.readSerialInterface(); uint8_t* buffer = nullptr;
result = uartComIF->requestReceiveMessage(comCookie, requestBytes);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
sif::warning << "PlocMPSoCHelper::receive: Failed to request reply" << std::endl;
triggerEvent(MPSOC_HELPER_REQUESTING_REPLY_FAILED, result, triggerEvent(MPSOC_HELPER_REQUESTING_REPLY_FAILED, result,
static_cast<uint32_t>(static_cast<uint32_t>(internalState))); static_cast<uint32_t>(static_cast<uint32_t>(internalState)));
return returnvalue::FAILED; return returnvalue::FAILED;
} }
return comInterface.parseAndRetrieveNextPacket(); result = uartComIF->readReceivedMessage(comCookie, &buffer, readBytes);
if (result != returnvalue::OK) {
sif::warning << "PlocMPSoCHelper::receive: Failed to read received message" << std::endl;
triggerEvent(MPSOC_HELPER_READING_REPLY_FAILED, result, static_cast<uint32_t>(internalState));
return returnvalue::FAILED;
}
if (*readBytes > 0) {
std::memcpy(data, buffer, *readBytes);
}
return result;
} }

View File

@ -6,13 +6,14 @@
#include <string> #include <string>
#include "OBSWConfig.h"
#include "fsfw/devicehandlers/CookieIF.h"
#include "fsfw/objectmanager/SystemObject.h" #include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/osal/linux/BinarySemaphore.h" #include "fsfw/osal/linux/BinarySemaphore.h"
#include "fsfw/returnvalues/returnvalue.h" #include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/tasks/ExecutableObjectIF.h" #include "fsfw/tasks/ExecutableObjectIF.h"
#include "fsfw/tmtcpacket/ccsds/SpacePacketReader.h"
#include "fsfw/tmtcservices/SourceSequenceCounter.h" #include "fsfw/tmtcservices/SourceSequenceCounter.h"
#include "linux/payload/MpsocCommunication.h" #include "fsfw_hal/linux/serial/SerialComIF.h"
#ifdef XIPHOS_Q7S #ifdef XIPHOS_Q7S
#include "bsp_q7s/fs/SdCardManager.h" #include "bsp_q7s/fs/SdCardManager.h"
#endif #endif
@ -82,12 +83,15 @@ class PlocMpsocSpecialComHelper : public SystemObject, public ExecutableObjectIF
FLASH_READ_READLEN_ERROR = 2 FLASH_READ_READLEN_ERROR = 2
}; };
PlocMpsocSpecialComHelper(object_id_t objectId, MpsocCommunication& comInterface); PlocMpsocSpecialComHelper(object_id_t objectId);
virtual ~PlocMpsocSpecialComHelper(); virtual ~PlocMpsocSpecialComHelper();
ReturnValue_t initialize() override; ReturnValue_t initialize() override;
ReturnValue_t performOperation(uint8_t operationCode = 0) override; ReturnValue_t performOperation(uint8_t operationCode = 0) override;
ReturnValue_t setComIF(DeviceCommunicationIF* communicationInterface_);
void setComCookie(CookieIF* comCookie_);
/** /**
* @brief Starts flash write sequence * @brief Starts flash write sequence
* *
@ -114,8 +118,7 @@ class PlocMpsocSpecialComHelper : public SystemObject, public ExecutableObjectIF
/** /**
* @brief Sets the sequence count object responsible for the sequence count handling * @brief Sets the sequence count object responsible for the sequence count handling
*/ */
void setCommandSequenceCount(uint16_t sequenceCount_); void setSequenceCount(SourceSequenceCounter* sequenceCount_);
uint16_t getCommandSequenceCount() const;
private: private:
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_MPSOC_HELPER; static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_MPSOC_HELPER;
@ -166,14 +169,12 @@ class PlocMpsocSpecialComHelper : public SystemObject, public ExecutableObjectIF
* Communication interface of MPSoC responsible for low level access. Must be set by the * Communication interface of MPSoC responsible for low level access. Must be set by the
* MPSoC Handler. * MPSoC Handler.
*/ */
// SerialComIF* uartComIF = nullptr; SerialComIF* uartComIF = nullptr;
// Communication cookie. Must be set by the MPSoC Handler // Communication cookie. Must be set by the MPSoC Handler
// CookieIF* comCookie = nullptr; CookieIF* comCookie = nullptr;
MpsocCommunication& comInterface;
// Sequence count, must be set by Ploc MPSoC Handler // Sequence count, must be set by Ploc MPSoC Handler
// ploc::SpTmReader spReader; SourceSequenceCounter* sequenceCount = nullptr;
uint16_t rxSequenceCount = 0; ploc::SpTmReader spReader;
SourceSequenceCounter txSequenceCount = 0;
void resetHelper(); void resetHelper();
ReturnValue_t performFlashWrite(); ReturnValue_t performFlashWrite();
@ -185,13 +186,13 @@ class PlocMpsocSpecialComHelper : public SystemObject, public ExecutableObjectIF
size_t expectedReadLen); size_t expectedReadLen);
ReturnValue_t handleFlashReadReply(std::ofstream& ofile, size_t expectedReadLen); ReturnValue_t handleFlashReadReply(std::ofstream& ofile, size_t expectedReadLen);
ReturnValue_t sendCommand(ploc::SpTcBase& tc); ReturnValue_t sendCommand(ploc::SpTcBase& tc);
ReturnValue_t tryReceiveNextReply(); ReturnValue_t receive(uint8_t* data, size_t requestBytes, size_t* readBytes);
ReturnValue_t handleAck(); ReturnValue_t handleAck();
ReturnValue_t handleExe(); ReturnValue_t handleExe();
ReturnValue_t startFlashReadOrWriteBase(std::string obcFile, std::string mpsocFile); ReturnValue_t startFlashReadOrWriteBase(std::string obcFile, std::string mpsocFile);
ReturnValue_t fileCheck(std::string obcFile); ReturnValue_t fileCheck(std::string obcFile);
void handleAckApidFailure(const SpacePacketReader& reader); void handleAckApidFailure(const ploc::SpTmReader& reader);
void handleExeFailure(const SpacePacketReader& reader); void handleExeFailure();
ReturnValue_t handleTmReception(); ReturnValue_t handleTmReception();
ReturnValue_t checkReceivedTm(); ReturnValue_t checkReceivedTm();
}; };

View File

@ -437,8 +437,6 @@ ReturnValue_t PlocSupvUartManager::writeUpdatePackets() {
// Useful to allow restarting the update // Useful to allow restarting the update
triggerEvent(SUPV_UPDATE_PROGRESS, buildProgParams1(progPercent, update.sequenceCount), triggerEvent(SUPV_UPDATE_PROGRESS, buildProgParams1(progPercent, update.sequenceCount),
update.bytesWritten); update.bytesWritten);
sif::info << "PLOC SUPV update progress " << (int)progPercent << " % at "
<< update.bytesWritten << " bytes" << std::endl;
} }
} }
supv::WriteMemory packet(spParams); supv::WriteMemory packet(spParams);

View File

@ -1,126 +0,0 @@
#include "SerialCommunicationHelper.h"
#include <errno.h>
#include <fcntl.h>
#include <termios.h>
#include <unistd.h>
#include <cstring>
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw_hal/linux/serial/helper.h"
SerialCommunicationHelper::SerialCommunicationHelper(SerialConfig cfg) : cfg(cfg) {}
ReturnValue_t SerialCommunicationHelper::initialize() {
fd = configureUartPort();
if (fd < 0) {
return returnvalue::FAILED;
}
return returnvalue::OK;
}
int SerialCommunicationHelper::rawFd() const { return fd; }
ReturnValue_t SerialCommunicationHelper::send(const uint8_t* data, size_t dataLen) {
if (write(fd, data, dataLen) != static_cast<int>(dataLen)) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "UartComIF::sendMessage: Failed to send data with error code " << errno
<< ": Error description: " << strerror(errno) << std::endl;
#endif
return returnvalue::FAILED;
}
return returnvalue::OK;
}
int SerialCommunicationHelper::configureUartPort() {
struct termios options = {};
int flags = O_RDWR;
if (cfg.getUartMode() == UartModes::CANONICAL) {
// In non-canonical mode, don't specify O_NONBLOCK because these properties will be
// controlled by the VTIME and VMIN parameters and O_NONBLOCK would override this
flags |= O_NONBLOCK;
}
int fd = open(cfg.getDeviceFile().c_str(), flags);
if (fd < 0) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "UartComIF::configureUartPort: Failed to open uart "
<< cfg.getDeviceFile().c_str()
<< "with error code " << errno << strerror(errno) << std::endl;
#endif
return fd;
}
/* Read in existing settings */
if (tcgetattr(fd, &options) != 0) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "UartComIF::configureUartPort: Error " << errno
<< "from tcgetattr: " << strerror(errno) << std::endl;
#endif
return fd;
}
serial::setParity(options, cfg.getParity());
serial::setStopbits(options, cfg.getStopBits());
serial::setBitsPerWord(options, cfg.getBitsPerWord());
setFixedOptions(&options);
serial::setMode(options, cfg.getUartMode());
tcflush(fd, TCIFLUSH);
/* Sets uart to non-blocking mode. Read returns immediately when there are no data available */
options.c_cc[VTIME] = 0;
options.c_cc[VMIN] = 0;
serial::setBaudrate(options, cfg.getBaudrate());
/* Save option settings */
if (tcsetattr(fd, TCSANOW, &options) != 0) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "UartComIF::configureUartPort: Failed to set options with error " << errno
<< ": " << strerror(errno);
#endif
return fd;
}
return fd;
}
void SerialCommunicationHelper::setFixedOptions(struct termios* options) {
/* Disable RTS/CTS hardware flow control */
options->c_cflag &= ~CRTSCTS;
/* Turn on READ & ignore ctrl lines (CLOCAL = 1) */
options->c_cflag |= CREAD | CLOCAL;
/* Disable echo */
options->c_lflag &= ~ECHO;
/* Disable erasure */
options->c_lflag &= ~ECHOE;
/* Disable new-line echo */
options->c_lflag &= ~ECHONL;
/* Disable interpretation of INTR, QUIT and SUSP */
options->c_lflag &= ~ISIG;
/* Turn off s/w flow ctrl */
options->c_iflag &= ~(IXON | IXOFF | IXANY);
/* Disable any special handling of received bytes */
options->c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL);
/* Prevent special interpretation of output bytes (e.g. newline chars) */
options->c_oflag &= ~OPOST;
/* Prevent conversion of newline to carriage return/line feed */
options->c_oflag &= ~ONLCR;
}
ReturnValue_t SerialCommunicationHelper::flushUartRxBuffer() {
serial::flushRxBuf(fd);
return returnvalue::OK;
}
ReturnValue_t SerialCommunicationHelper::flushUartTxBuffer() {
serial::flushTxBuf(fd);
return returnvalue::OK;
}
ReturnValue_t SerialCommunicationHelper::flushUartTxAndRxBuf() {
serial::flushTxRxBuf(fd);
return returnvalue::OK;
}

View File

@ -1,69 +0,0 @@
#pragma once
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
#include <fsfw/objectmanager/SystemObject.h>
#include <fsfw_hal/linux/serial/SerialCookie.h>
#include <fsfw_hal/linux/serial/helper.h>
#include "SerialConfig.h"
#include "fsfw/returnvalues/returnvalue.h"
/**
* @brief This is the communication interface to access serial ports on linux based operating
* systems.
*
* @details The implementation follows the instructions from https://blog.mbedded.ninja/programming/
* operating-systems/linux/linux-serial-ports-using-c-cpp/#disabling-canonical-mode
*
* @author J. Meier
*/
class SerialCommunicationHelper {
public:
SerialCommunicationHelper(SerialConfig serialCfg);
ReturnValue_t send(const uint8_t* data, size_t dataLen);
int rawFd() const;
ReturnValue_t initialize();
/**
* @brief This function discards all data received but not read in the UART buffer.
*/
ReturnValue_t flushUartRxBuffer();
/**
* @brief This function discards all data in the transmit buffer of the UART driver.
*/
ReturnValue_t flushUartTxBuffer();
/**
* @brief This function discards both data in the transmit and receive buffer of the UART.
*/
ReturnValue_t flushUartTxAndRxBuf();
private:
SerialConfig cfg;
int fd = 0;
/**
* @brief This function opens and configures a uart device by using the information stored
* in the uart cookie.
* @param uartCookie Pointer to uart cookie with information about the uart. Contains the
* uart device file, baudrate, parity, stopbits etc.
* @return The file descriptor of the configured uart.
*/
int configureUartPort();
void setStopBitOptions(struct termios* options);
/**
* @brief This function sets options which are not configurable by the uartCookie.
*/
void setFixedOptions(struct termios* options);
/**
* @brief With this function the datasize settings are added to the termios options struct.
*/
void setDatasizeOptions(struct termios* options);
};

View File

@ -1,70 +0,0 @@
#pragma once
#include <fsfw/devicehandlers/CookieIF.h>
#include <fsfw/objectmanager/SystemObjectIF.h>
#include <fsfw_hal/linux/serial/helper.h>
#include <string>
/**
* @brief Cookie for the UartComIF. There are many options available to configure the UART driver.
* The constructor only requests for common options like the baudrate. Other options can
* be set by member functions.
*
* @author J. Meier
*/
class SerialConfig : public CookieIF {
public:
/**
* @brief Constructor for the uart cookie.
* @param deviceFile The device file specifying the uart to use, e.g. "/dev/ttyPS1"
* @param uartMode Specify the UART mode. The canonical mode should be used if the
* messages are separated by a delimited character like '\n'. See the
* termios documentation for more information
* @param baudrate The baudrate to use for input and output.
* @param maxReplyLen The maximum size an object using this cookie expects
* @details
* Default configuration: No parity
* 8 databits (number of bits transfered with one uart frame)
* One stop bit
*/
SerialConfig(std::string deviceFile, UartBaudRate baudrate, size_t maxReplyLen,
UartModes uartMode = UartModes::NON_CANONICAL)
: deviceFile(deviceFile), baudrate(baudrate), maxReplyLen(maxReplyLen), uartMode(uartMode) {}
virtual ~SerialConfig() = default;
UartBaudRate getBaudrate() const { return baudrate; }
size_t getMaxReplyLen() const { return maxReplyLen; }
std::string getDeviceFile() const { return deviceFile; }
Parity getParity() const { return parity; }
BitsPerWord getBitsPerWord() const { return bitsPerWord; }
StopBits getStopBits() const { return stopBits; }
UartModes getUartMode() const { return uartMode; }
/**
* Functions two enable parity checking.
*/
void setParityOdd() { parity = Parity::ODD; }
void setParityEven() { parity = Parity::EVEN; }
/**
* Function two set number of bits per UART frame.
*/
void setBitsPerWord(BitsPerWord bitsPerWord_) { bitsPerWord = bitsPerWord_; }
/**
* Function to specify the number of stopbits.
*/
void setTwoStopBits() { stopBits = StopBits::TWO_STOP_BITS; }
void setOneStopBit() { stopBits = StopBits::ONE_STOP_BIT; }
private:
std::string deviceFile;
UartBaudRate baudrate;
size_t maxReplyLen = 0;
const UartModes uartMode;
Parity parity = Parity::NONE;
BitsPerWord bitsPerWord = BitsPerWord::BITS_8;
StopBits stopBits = StopBits::ONE_STOP_BIT;
};

View File

@ -0,0 +1,33 @@
#ifndef MPSOC_RETURN_VALUES_IF_H_
#define MPSOC_RETURN_VALUES_IF_H_
#include "eive/resultClassIds.h"
#include "fsfw/returnvalues/returnvalue.h"
class MPSoCReturnValuesIF {
public:
static const uint8_t INTERFACE_ID = CLASS_ID::MPSOC_RETURN_VALUES_IF;
//! [EXPORT] : [COMMENT] Space Packet received from PLOC has invalid CRC
static const ReturnValue_t CRC_FAILURE = MAKE_RETURN_CODE(0xA0);
//! [EXPORT] : [COMMENT] Received ACK failure reply from PLOC
static const ReturnValue_t RECEIVED_ACK_FAILURE = MAKE_RETURN_CODE(0xA1);
//! [EXPORT] : [COMMENT] Received execution failure reply from PLOC
static const ReturnValue_t RECEIVED_EXE_FAILURE = MAKE_RETURN_CODE(0xA2);
//! [EXPORT] : [COMMENT] Received space packet with invalid APID from PLOC
static const ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(0xA3);
//! [EXPORT] : [COMMENT] Received command with invalid length
static const ReturnValue_t INVALID_LENGTH = MAKE_RETURN_CODE(0xA4);
//! [EXPORT] : [COMMENT] Filename of file in OBC filesystem is too long
static const ReturnValue_t FILENAME_TOO_LONG = MAKE_RETURN_CODE(0xA5);
//! [EXPORT] : [COMMENT] MPSoC helper is currently executing a command
static const ReturnValue_t MPSOC_HELPER_EXECUTING = MAKE_RETURN_CODE(0xA6);
//! [EXPORT] : [COMMENT] Filename of MPSoC file is to long (max. 256 bytes)
static const ReturnValue_t MPSOC_FILENAME_TOO_LONG = MAKE_RETURN_CODE(0xA7);
//! [EXPORT] : [COMMENT] Command has invalid parameter
static const ReturnValue_t INVALID_PARAMETER = MAKE_RETURN_CODE(0xA8);
//! [EXPORT] : [COMMENT] Received command has file string with invalid length
static const ReturnValue_t NAME_TOO_LONG = MAKE_RETURN_CODE(0xA9);
};
#endif /* MPSOC_RETURN_VALUES_IF_H_ */

View File

@ -1,94 +1,87 @@
#include "plocMpsocHelpers.h" #include "plocMpsocHelpers.h"
#include "fsfw/tmtcpacket/ccsds/SpacePacketReader.h"
#include "mission/payload/plocSpBase.h"
uint16_t mpsoc::getStatusFromRawData(const uint8_t* data) { uint16_t mpsoc::getStatusFromRawData(const uint8_t* data) {
return (*(data + STATUS_OFFSET) << 8) | *(data + STATUS_OFFSET + 1); return (*(data + STATUS_OFFSET) << 8) | *(data + STATUS_OFFSET + 1);
} }
std::string mpsoc::getStatusString(uint16_t status) { std::string mpsoc::getStatusString(uint16_t status) {
switch (status) { switch (status) {
case (mpsoc::statusCode::UNKNOWN_APID): { case (mpsoc::status_code::UNKNOWN_APID): {
return "Unknown APID"; return "Unknown APID";
break; break;
} }
case (mpsoc::statusCode::INCORRECT_LENGTH): { case (mpsoc::status_code::INCORRECT_LENGTH): {
return "Incorrect length"; return "Incorrect length";
break; break;
} }
case (mpsoc::statusCode::FLASH_DRIVE_ERROR): { case (mpsoc::status_code::INCORRECT_CRC): {
return "flash drive error";
break;
}
case (mpsoc::statusCode::INCORRECT_CRC): {
return "Incorrect crc"; return "Incorrect crc";
break; break;
} }
case (mpsoc::statusCode::INCORRECT_PKT_SEQ_CNT): { case (mpsoc::status_code::INCORRECT_PKT_SEQ_CNT): {
return "Incorrect packet sequence count"; return "Incorrect packet sequence count";
break; break;
} }
case (mpsoc::statusCode::TC_NOT_ALLOWED_IN_MODE): { case (mpsoc::status_code::TC_NOT_ALLOWED_IN_MODE): {
return "TC not allowed in this mode"; return "TC not allowed in this mode";
break; break;
} }
case (mpsoc::statusCode::TC_EXEUTION_DISABLED): { case (mpsoc::status_code::TC_EXEUTION_DISABLED): {
return "TC execution disabled"; return "TC execution disabled";
break; break;
} }
case (mpsoc::statusCode::FLASH_MOUNT_FAILED): { case (mpsoc::status_code::FLASH_MOUNT_FAILED): {
return "Flash mount failed"; return "Flash mount failed";
break; break;
} }
case (mpsoc::statusCode::FLASH_FILE_ALREADY_OPEN): { case (mpsoc::status_code::FLASH_FILE_ALREADY_OPEN): {
return "Flash file already open"; return "Flash file already open";
break; break;
} }
case (mpsoc::statusCode::FLASH_FILE_ALREADY_CLOSED): { case (mpsoc::status_code::FLASH_FILE_ALREADY_CLOSED): {
return "Flash file already closed"; return "Flash file already closed";
break; break;
} }
case (mpsoc::statusCode::FLASH_FILE_OPEN_FAILED): { case (mpsoc::status_code::FLASH_FILE_OPEN_FAILED): {
return "Flash file open failed"; return "Flash file open failed";
break; break;
} }
case (mpsoc::statusCode::FLASH_FILE_NOT_OPEN): { case (mpsoc::status_code::FLASH_FILE_NOT_OPEN): {
return "Flash file not open"; return "Flash file not open";
break; break;
} }
case (mpsoc::statusCode::FLASH_UNMOUNT_FAILED): { case (mpsoc::status_code::FLASH_UNMOUNT_FAILED): {
return "Flash unmount failed"; return "Flash unmount failed";
break; break;
} }
case (mpsoc::statusCode::HEAP_ALLOCATION_FAILED): { case (mpsoc::status_code::HEAP_ALLOCATION_FAILED): {
return "Heap allocation failed"; return "Heap allocation failed";
break; break;
} }
case (mpsoc::statusCode::INVALID_PARAMETER): { case (mpsoc::status_code::INVALID_PARAMETER): {
return "Invalid parameter"; return "Invalid parameter";
break; break;
} }
case (mpsoc::statusCode::NOT_INITIALIZED): { case (mpsoc::status_code::NOT_INITIALIZED): {
return "Not initialized"; return "Not initialized";
break; break;
} }
case (mpsoc::statusCode::REBOOT_IMMINENT): { case (mpsoc::status_code::REBOOT_IMMINENT): {
return "Reboot imminent"; return "Reboot imminent";
break; break;
} }
case (mpsoc::statusCode::CORRUPT_DATA): { case (mpsoc::status_code::CORRUPT_DATA): {
return "Corrupt data"; return "Corrupt data";
break; break;
} }
case (mpsoc::statusCode::FLASH_CORRECTABLE_MISMATCH): { case (mpsoc::status_code::FLASH_CORRECTABLE_MISMATCH): {
return "Flash correctable mismatch"; return "Flash correctable mismatch";
break; break;
} }
case (mpsoc::statusCode::FLASH_UNCORRECTABLE_MISMATCH): { case (mpsoc::status_code::FLASH_UNCORRECTABLE_MISMATCH): {
return "Flash uncorrectable mismatch"; return "Flash uncorrectable mismatch";
break; break;
} }
case (mpsoc::statusCode::DEFAULT_ERROR_CODE): { case (mpsoc::status_code::DEFAULT_ERROR_CODE): {
return "Default error code"; return "Default error code";
break; break;
} }
@ -100,19 +93,3 @@ std::string mpsoc::getStatusString(uint16_t status) {
} }
return ""; return "";
} }
void mpsoc::printRxPacket(const SpacePacketReader& spReader) {
if (mpsoc::MPSOC_RX_WIRETAPPING) {
sif::debug << "RECV MPSOC packet. APID 0x" << std::hex << std::setw(3) << spReader.getApid()
<< std::dec << " Size " << spReader.getFullPacketLen() << " SSC "
<< spReader.getSequenceCount() << std::endl;
}
}
void mpsoc::printTxPacket(const ploc::SpTcBase& tcBase) {
if (mpsoc::MPSOC_TX_WIRETAPPING) {
sif::debug << "SEND MPSOC packet. APID 0x" << std::hex << std::setw(3) << tcBase.getApid()
<< " Size " << std::dec << tcBase.getFullPacketLen() << " SSC "
<< tcBase.getSeqCount() << std::endl;
}
}

View File

@ -3,122 +3,16 @@
#include <fsfw/datapoollocal/StaticLocalDataSet.h> #include <fsfw/datapoollocal/StaticLocalDataSet.h>
#include <fsfw/devicehandlers/DeviceHandlerIF.h> #include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <linux/payload/mpsocRetvals.h>
#include <mission/payload/plocSpBase.h> #include <mission/payload/plocSpBase.h>
#include "eive/eventSubsystemIds.h" #include "eive/definitions.h"
#include "eive/resultClassIds.h"
#include "fsfw/action/HasActionsIF.h"
#include "fsfw/events/Event.h"
#include "fsfw/returnvalues/returnvalue.h" #include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/serialize/SerializeAdapter.h" #include "fsfw/serialize/SerializeAdapter.h"
#include "fsfw/serialize/SerializeIF.h" #include "fsfw/serialize/SerializeIF.h"
namespace mpsoc { namespace mpsoc {
static constexpr bool MPSOC_TX_WIRETAPPING = false;
static constexpr bool MPSOC_RX_WIRETAPPING = false;
static constexpr size_t CRC_SIZE = 2;
/**
* @brief Abstract base class for TC space packet of MPSoC.
*/
class TcBase : public ploc::SpTcBase {
public:
virtual ~TcBase() = default;
// Initial length field of space packet. Will always be updated when packet is created.
static const uint16_t INIT_LENGTH = CRC_SIZE;
/**
* @brief Constructor
*
* @param sequenceCount Sequence count of space packet which will be incremented with each
* sent and received packets.
*/
TcBase(ploc::SpTcParams params, uint16_t apid, uint16_t sequenceCount)
: ploc::SpTcBase(params, apid, 0, sequenceCount) {
payloadStart = spParams.buf + ccsds::HEADER_LEN;
spParams.setFullPayloadLen(INIT_LENGTH);
}
/**
* @brief Function to finsh and write the space packet. It is expected that the user has
* set the payload fields in the child class*
* @return returnvalue::OK if packet creation was successful, otherwise error return value
*/
ReturnValue_t finishPacket() {
updateSpFields();
ReturnValue_t res = checkSizeAndSerializeHeader();
if (res != returnvalue::OK) {
return res;
}
return calcAndSetCrc();
}
};
void printRxPacket(const SpacePacketReader& spReader);
void printTxPacket(const ploc::SpTcBase& tcBase);
static constexpr uint32_t DEFAULT_CMD_TIMEOUT_MS = 5000;
static constexpr uint32_t CMD_TIMEOUT_MKFS = 15000;
enum FlashId : uint8_t { FLASH_0 = 0, FLASH_1 = 1 };
static const uint8_t INTERFACE_ID = CLASS_ID::MPSOC_RETURN_VALUES_IF;
//! [EXPORT] : [COMMENT] Space Packet received from PLOC has invalid CRC
static const ReturnValue_t CRC_FAILURE = MAKE_RETURN_CODE(0xA0);
//! [EXPORT] : [COMMENT] Received ACK failure reply from PLOC
static const ReturnValue_t RECEIVED_ACK_FAILURE = MAKE_RETURN_CODE(0xA1);
//! [EXPORT] : [COMMENT] Received execution failure reply from PLOC
static const ReturnValue_t RECEIVED_EXE_FAILURE = MAKE_RETURN_CODE(0xA2);
//! [EXPORT] : [COMMENT] Received space packet with invalid APID from PLOC
static const ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(0xA3);
//! [EXPORT] : [COMMENT] Received command with invalid length
static const ReturnValue_t INVALID_LENGTH = MAKE_RETURN_CODE(0xA4);
//! [EXPORT] : [COMMENT] Filename of file in OBC filesystem is too long
static const ReturnValue_t FILENAME_TOO_LONG = MAKE_RETURN_CODE(0xA5);
//! [EXPORT] : [COMMENT] MPSoC helper is currently executing a command
static const ReturnValue_t MPSOC_HELPER_EXECUTING = MAKE_RETURN_CODE(0xA6);
//! [EXPORT] : [COMMENT] Filename of MPSoC file is to long (max. 256 bytes)
static const ReturnValue_t MPSOC_FILENAME_TOO_LONG = MAKE_RETURN_CODE(0xA7);
//! [EXPORT] : [COMMENT] Command has invalid parameter
static const ReturnValue_t INVALID_PARAMETER = MAKE_RETURN_CODE(0xA8);
//! [EXPORT] : [COMMENT] Received command has file string with invalid length
static const ReturnValue_t NAME_TOO_LONG = MAKE_RETURN_CODE(0xA9);
//! [EXPORT] : [COMMENT] Command has timed out.
static const ReturnValue_t COMMAND_TIMEOUT = MAKE_RETURN_CODE(0x10);
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_MPSOC_HANDLER;
//! [EXPORT] : [COMMENT] PLOC crc failure in telemetry packet
static const Event MEMORY_READ_RPT_CRC_FAILURE = MAKE_EVENT(1, severity::LOW);
//! [EXPORT] : [COMMENT] PLOC receive acknowledgment failure report
//! P1: Command Id which leads the acknowledgment failure report
//! P2: The status field inserted by the MPSoC into the data field
static const Event ACK_FAILURE = MAKE_EVENT(2, severity::LOW);
//! [EXPORT] : [COMMENT] PLOC receive execution failure report
//! P1: Command Id which leads the execution failure report
//! P2: The status field inserted by the MPSoC into the data field
static const Event EXE_FAILURE = MAKE_EVENT(3, severity::LOW);
//! [EXPORT] : [COMMENT] PLOC reply has invalid crc
static const Event MPSOC_HANDLER_CRC_FAILURE = MAKE_EVENT(4, severity::LOW);
//! [EXPORT] : [COMMENT] Packet sequence count in received space packet does not match expected
//! count P1: Expected sequence count P2: Received sequence count
static const Event MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH = MAKE_EVENT(5, severity::LOW);
//! [EXPORT] : [COMMENT] Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and
//! thus also to shutdown the supervisor.
static const Event MPSOC_SHUTDOWN_FAILED = MAKE_EVENT(6, severity::HIGH);
//! [EXPORT] : [COMMENT] SUPV not on for boot or shutdown process. P1: 0 for OFF transition, 1 for
//! ON transition.
static constexpr Event SUPV_NOT_ON = event::makeEvent(SUBSYSTEM_ID, 7, severity::LOW);
//! [EXPORT] : [COMMENT] SUPV reply timeout.
static constexpr Event SUPV_REPLY_TIMEOUT = event::makeEvent(SUBSYSTEM_ID, 8, severity::LOW);
//! [EXPORT] : [COMMENT] Camera must be commanded on first.
static constexpr Event CAM_MUST_BE_ON_FOR_SNAPSHOT_MODE =
event::makeEvent(SUBSYSTEM_ID, 9, severity::LOW);
enum ParamId : uint8_t { SKIP_SUPV_ON_COMMANDING = 0x01 }; enum ParamId : uint8_t { SKIP_SUPV_ON_COMMANDING = 0x01 };
enum FileAccessModes : uint8_t { enum FileAccessModes : uint8_t {
@ -136,8 +30,6 @@ enum FileAccessModes : uint8_t {
}; };
static constexpr uint32_t HK_SET_ID = 0; static constexpr uint32_t HK_SET_ID = 0;
static constexpr uint32_t DEADBEEF_ADDR = 0x40000004;
static constexpr uint32_t DEADBEEF_VALUE = 0xdeadbeef;
namespace poolid { namespace poolid {
enum { enum {
@ -200,8 +92,7 @@ static const DeviceCommandId_t TM_CAM_CMD_RPT = 19;
static const DeviceCommandId_t SET_UART_TX_TRISTATE = 20; static const DeviceCommandId_t SET_UART_TX_TRISTATE = 20;
static const DeviceCommandId_t RELEASE_UART_TX = 21; static const DeviceCommandId_t RELEASE_UART_TX = 21;
static const DeviceCommandId_t TC_CAM_TAKE_PIC = 22; static const DeviceCommandId_t TC_CAM_TAKE_PIC = 22;
// Stream file down using E-Band component directly. static const DeviceCommandId_t TC_SIMPLEX_SEND_FILE = 23;
static const DeviceCommandId_t TC_SIMPLEX_STREAM_FILE = 23;
static const DeviceCommandId_t TC_DOWNLINK_DATA_MODULATE = 24; static const DeviceCommandId_t TC_DOWNLINK_DATA_MODULATE = 24;
static const DeviceCommandId_t TC_MODE_SNAPSHOT = 25; static const DeviceCommandId_t TC_MODE_SNAPSHOT = 25;
static const DeviceCommandId_t TC_GET_HK_REPORT = 26; static const DeviceCommandId_t TC_GET_HK_REPORT = 26;
@ -209,31 +100,16 @@ static const DeviceCommandId_t TM_GET_HK_REPORT = 27;
static const DeviceCommandId_t TC_FLASH_GET_DIRECTORY_CONTENT = 28; static const DeviceCommandId_t TC_FLASH_GET_DIRECTORY_CONTENT = 28;
static const DeviceCommandId_t TM_FLASH_DIRECTORY_CONTENT = 29; static const DeviceCommandId_t TM_FLASH_DIRECTORY_CONTENT = 29;
static constexpr DeviceCommandId_t TC_FLASH_READ_FULL_FILE = 30; static constexpr DeviceCommandId_t TC_FLASH_READ_FULL_FILE = 30;
// Store file on MPSoC.
static const DeviceCommandId_t TC_SPLIT_FILE = 31;
static const DeviceCommandId_t TC_VERIFY_BOOT = 32;
static const DeviceCommandId_t TC_ENABLE_TC_EXECTION = 33;
static const DeviceCommandId_t TC_FLASH_MKFS = 34;
// Will reset the sequence count of the OBSW. Not required anymore after MPSoC update. // Will reset the sequence count of the OBSW
static const DeviceCommandId_t OBSW_RESET_SEQ_COUNT_LEGACY = 50; static const DeviceCommandId_t OBSW_RESET_SEQ_COUNT = 50;
static const uint16_t SIZE_ACK_REPORT = 14; static const uint16_t SIZE_ACK_REPORT = 14;
static const uint16_t SIZE_EXE_REPORT = 14; static const uint16_t SIZE_EXE_REPORT = 14;
static const uint16_t SIZE_TM_MEM_READ_REPORT = 18;
static const uint16_t SIZE_TM_CAM_CMD_RPT = 18;
static constexpr size_t SIZE_TM_HK_REPORT = 369; static constexpr size_t SIZE_TM_HK_REPORT = 369;
enum Submode : uint8_t { IDLE_OR_NONE = 0, REPLAY = 1, SNAPSHOT = 2 };
// Setting the internal mode value to the actual telecommand ID
/*
enum InternalMode {
OFF = HasModesIF::MODE_OFF,
IDLE = ,
REPLAY = TC_MODE_REPLAY,
SNAPSHOT = TC_MODE_SNAPSHOT
};
*/
/** /**
* SpacePacket apids of PLOC telecommands and telemetry. * SpacePacket apids of PLOC telecommands and telemetry.
*/ */
@ -258,8 +134,6 @@ static const uint16_t TC_MODE_SNAPSHOT = 0x120;
static const uint16_t TC_DOWNLINK_DATA_MODULATE = 0x121; static const uint16_t TC_DOWNLINK_DATA_MODULATE = 0x121;
static constexpr uint16_t TC_HK_GET_REPORT = 0x123; static constexpr uint16_t TC_HK_GET_REPORT = 0x123;
static const uint16_t TC_DOWNLINK_PWR_OFF = 0x124; static const uint16_t TC_DOWNLINK_PWR_OFF = 0x124;
static constexpr uint16_t TC_ENABLE_TC_EXECUTION = 0x129;
static constexpr uint16_t TC_FLASH_MKFS = 0x12A;
static const uint16_t TC_CAM_CMD_SEND = 0x12C; static const uint16_t TC_CAM_CMD_SEND = 0x12C;
static constexpr uint16_t TC_FLASH_COPY_FILE = 0x12E; static constexpr uint16_t TC_FLASH_COPY_FILE = 0x12E;
static const uint16_t TC_SIMPLEX_SEND_FILE = 0x130; static const uint16_t TC_SIMPLEX_SEND_FILE = 0x130;
@ -284,15 +158,15 @@ static const uint8_t SPACE_PACKET_HEADER_SIZE = 6;
static const uint8_t STATUS_OFFSET = 10; static const uint8_t STATUS_OFFSET = 10;
static constexpr size_t CRC_SIZE = 2;
/** /**
* The size of payload data which will be forwarded to the requesting object. e.g. PUS Service * The size of payload data which will be forwarded to the requesting object. e.g. PUS Service
* 8. * 8.
*/ */
static const uint8_t SIZE_MEM_READ_RPT_FIX = 6; static const uint8_t SIZE_MEM_READ_RPT_FIX = 6;
static const size_t FILENAME_FIELD_SIZE = 256; static const size_t MAX_FILENAME_SIZE = 256;
// Subtract size of NULL terminator.
static const size_t MAX_FILENAME_SIZE = FILENAME_FIELD_SIZE - 1;
/** /**
* PLOC space packet length for fixed size packets. This is the size of the whole packet data * PLOC space packet length for fixed size packets. This is the size of the whole packet data
@ -327,9 +201,8 @@ static const uint16_t TC_DOWNLINK_PWR_ON_EXECUTION_DELAY = 8;
static const uint16_t TC_CAM_TAKE_PIC_EXECUTION_DELAY = 20; static const uint16_t TC_CAM_TAKE_PIC_EXECUTION_DELAY = 20;
static const uint16_t TC_SIMPLEX_SEND_FILE_DELAY = 80; static const uint16_t TC_SIMPLEX_SEND_FILE_DELAY = 80;
namespace statusCode { namespace status_code {
static const uint16_t DEFAULT_ERROR_CODE = 0x1; static const uint16_t DEFAULT_ERROR_CODE = 0x1;
static constexpr uint16_t FLASH_DRIVE_ERROR = 0xb;
static const uint16_t UNKNOWN_APID = 0x5DD; static const uint16_t UNKNOWN_APID = 0x5DD;
static const uint16_t INCORRECT_LENGTH = 0x5DE; static const uint16_t INCORRECT_LENGTH = 0x5DE;
static const uint16_t INCORRECT_CRC = 0x5DF; static const uint16_t INCORRECT_CRC = 0x5DF;
@ -354,12 +227,49 @@ static const uint16_t RESERVED_1 = 0x5F1;
static const uint16_t RESERVED_2 = 0x5F2; static const uint16_t RESERVED_2 = 0x5F2;
static const uint16_t RESERVED_3 = 0x5F3; static const uint16_t RESERVED_3 = 0x5F3;
static const uint16_t RESERVED_4 = 0x5F4; static const uint16_t RESERVED_4 = 0x5F4;
} // namespace statusCode } // namespace status_code
/**
* @brief Abstract base class for TC space packet of MPSoC.
*/
class TcBase : public ploc::SpTcBase, public MPSoCReturnValuesIF {
public:
virtual ~TcBase() = default;
// Initial length field of space packet. Will always be updated when packet is created.
static const uint16_t INIT_LENGTH = CRC_SIZE;
/**
* @brief Constructor
*
* @param sequenceCount Sequence count of space packet which will be incremented with each
* sent and received packets.
*/
TcBase(ploc::SpTcParams params, uint16_t apid, uint16_t sequenceCount)
: ploc::SpTcBase(params, apid, 0, sequenceCount) {
payloadStart = spParams.buf + ccsds::HEADER_LEN;
spParams.setFullPayloadLen(INIT_LENGTH);
}
/**
* @brief Function to finsh and write the space packet. It is expected that the user has
* set the payload fields in the child class*
* @return returnvalue::OK if packet creation was successful, otherwise error return value
*/
ReturnValue_t finishPacket() {
updateSpFields();
ReturnValue_t res = checkSizeAndSerializeHeader();
if (res != returnvalue::OK) {
return res;
}
return calcAndSetCrc();
}
};
/** /**
* @brief This class helps to build the memory read command for the PLOC. * @brief This class helps to build the memory read command for the PLOC.
*/ */
class TcMemRead : public mpsoc::TcBase { class TcMemRead : public TcBase {
public: public:
/** /**
* @brief Constructor * @brief Constructor
@ -409,7 +319,7 @@ class TcMemRead : public mpsoc::TcBase {
* @brief This class helps to generate the space packet to write data to a memory address within * @brief This class helps to generate the space packet to write data to a memory address within
* the PLOC. * the PLOC.
*/ */
class TcMemWrite : public mpsoc::TcBase { class TcMemWrite : public TcBase {
public: public:
/** /**
* @brief Constructor * @brief Constructor
@ -459,21 +369,24 @@ class TcMemWrite : public mpsoc::TcBase {
/** /**
* @brief Class to help creation of flash fopen command. * @brief Class to help creation of flash fopen command.
*/ */
class TcFlashFopen : public mpsoc::TcBase { class FlashFopen : public TcBase {
public: public:
TcFlashFopen(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, uint8_t mode) { ReturnValue_t setPayload(std::string filename, uint8_t mode) {
accessMode = mode; accessMode = mode;
size_t nameSize = filename.size();
spParams.setFullPayloadLen(256 + sizeof(uint8_t) + CRC_SIZE);
ReturnValue_t result = checkPayloadLen(); ReturnValue_t result = checkPayloadLen();
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
std::memset(payloadStart, 0, FILENAME_FIELD_SIZE); std::memcpy(payloadStart, filename.c_str(), nameSize);
std::memcpy(payloadStart, filename.c_str(), filename.size()); // payloadStart[nameSize] = NULL_TERMINATOR;
payloadStart[FILENAME_FIELD_SIZE] = accessMode; std::memset(payloadStart + nameSize, 0, 256 - nameSize);
spParams.setFullPayloadLen(FILENAME_FIELD_SIZE + 1 + CRC_SIZE); // payloadStart[255] = NULL_TERMINATOR;
payloadStart[256] = accessMode;
return returnvalue::OK; return returnvalue::OK;
} }
@ -484,46 +397,14 @@ class TcFlashFopen : public mpsoc::TcBase {
/** /**
* @brief Class to help creation of flash fclose command. * @brief Class to help creation of flash fclose command.
*/ */
class TcFlashFclose : public TcBase { class FlashFclose : public TcBase {
public: public:
TcFlashFclose(ploc::SpTcParams params, uint16_t sequenceCount) FlashFclose(ploc::SpTcParams params, uint16_t sequenceCount)
: TcBase(params, apid::TC_FLASHFCLOSE, sequenceCount) { : TcBase(params, apid::TC_FLASHFCLOSE, sequenceCount) {
spParams.setFullPayloadLen(CRC_SIZE); spParams.setFullPayloadLen(CRC_SIZE);
} }
}; };
class TcEnableTcExec : public TcBase {
public:
TcEnableTcExec(ploc::SpTcParams params, uint16_t sequenceCount)
: TcBase(params, apid::TC_ENABLE_TC_EXECUTION, sequenceCount) {
spParams.setFullPayloadLen(CRC_SIZE);
}
ReturnValue_t setPayload(const uint8_t* cmdData, size_t cmdDataLen) {
if (cmdDataLen != 2) {
return HasActionsIF::INVALID_PARAMETERS;
}
std::memcpy(payloadStart, cmdData, 2);
spParams.setFullPayloadLen(2 + CRC_SIZE);
return returnvalue::OK;
}
};
class TcFlashMkfs : public TcBase {
public:
TcFlashMkfs(ploc::SpTcParams params, uint16_t sequenceCount, FlashId flashId)
: TcBase(params, apid::TC_FLASH_MKFS, sequenceCount) {
const char* flashIdStr = "0:\\";
if (flashId == FlashId::FLASH_1) {
flashIdStr = "1:\\";
}
std::memcpy(payloadStart, flashIdStr, 3);
// Null terminator
payloadStart[3] = 0;
spParams.setFullPayloadLen(4 + CRC_SIZE);
}
};
/** /**
* @brief Class to build flash write space packet. * @brief Class to build flash write space packet.
*/ */
@ -583,6 +464,15 @@ class TcFlashRead : public TcBase {
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
updateSpFields();
result = checkSizeAndSerializeHeader();
if (result != returnvalue::OK) {
return result;
}
result = calcAndSetCrc();
if (result != returnvalue::OK) {
return result;
}
readSize = readLen; readSize = readLen;
return result; return result;
} }
@ -600,14 +490,20 @@ class TcFlashDelete : public TcBase {
ReturnValue_t setPayload(std::string filename) { ReturnValue_t setPayload(std::string filename) {
size_t nameSize = filename.size(); size_t nameSize = filename.size();
spParams.setFullPayloadLen(FILENAME_FIELD_SIZE + CRC_SIZE); spParams.setFullPayloadLen(nameSize + sizeof(NULL_TERMINATOR) + CRC_SIZE);
auto res = checkPayloadLen(); auto res = checkPayloadLen();
if (res != returnvalue::OK) { if (res != returnvalue::OK) {
return res; return res;
} }
std::memcpy(payloadStart, filename.c_str(), nameSize); std::memcpy(payloadStart, filename.c_str(), nameSize);
*(payloadStart + nameSize) = NULL_TERMINATOR; *(payloadStart + nameSize) = NULL_TERMINATOR;
return returnvalue::OK;
updateSpFields();
res = checkSizeAndSerializeHeader();
if (res != returnvalue::OK) {
return res;
}
return calcAndSetCrc();
} }
}; };
@ -759,9 +655,8 @@ class TcGetDirContent : public TcBase {
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
std::memset(payloadStart, 0, 256);
std::memcpy(payloadStart, commandData, commandDataLen); std::memcpy(payloadStart, commandData, commandDataLen);
payloadStart[255] = 0; payloadStart[255] = '\0';
return result; return result;
} }
}; };
@ -802,7 +697,7 @@ class TcReplayWriteSeq : public TcBase {
static const size_t USE_DECODING_LENGTH = 1; static const size_t USE_DECODING_LENGTH = 1;
ReturnValue_t lengthCheck(size_t commandDataLen) { ReturnValue_t lengthCheck(size_t commandDataLen) {
if (commandDataLen > USE_DECODING_LENGTH + FILENAME_FIELD_SIZE or if (commandDataLen > USE_DECODING_LENGTH + MAX_FILENAME_SIZE or
checkPayloadLen() != returnvalue::OK) { checkPayloadLen() != returnvalue::OK) {
sif::warning << "TcReplayWriteSeq: Command has invalid length " << commandDataLen sif::warning << "TcReplayWriteSeq: Command has invalid length " << commandDataLen
<< std::endl; << std::endl;
@ -815,24 +710,24 @@ class TcReplayWriteSeq : public TcBase {
/** /**
* @brief Helps to extract the fields of the flash write command from the PUS packet. * @brief Helps to extract the fields of the flash write command from the PUS packet.
*/ */
class FlashBasePusCmd { class FlashBasePusCmd : public MPSoCReturnValuesIF {
public: public:
FlashBasePusCmd() = default; FlashBasePusCmd() = default;
virtual ~FlashBasePusCmd() = default; virtual ~FlashBasePusCmd() = default;
virtual ReturnValue_t extractFields(const uint8_t* commandData, size_t commandDataLen) { virtual ReturnValue_t extractFields(const uint8_t* commandData, size_t commandDataLen) {
if (commandDataLen > FILENAME_FIELD_SIZE) { if (commandDataLen > (config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE + MAX_FILENAME_SIZE)) {
return INVALID_LENGTH; return INVALID_LENGTH;
} }
size_t fileLen = strnlen(reinterpret_cast<const char*>(commandData), commandDataLen); size_t fileLen = strnlen(reinterpret_cast<const char*>(commandData), commandDataLen);
if (fileLen > MAX_FILENAME_SIZE) { if (fileLen > (config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE)) {
return FILENAME_TOO_LONG; return FILENAME_TOO_LONG;
} }
obcFile = std::string(reinterpret_cast<const char*>(commandData), fileLen); obcFile = std::string(reinterpret_cast<const char*>(commandData), fileLen);
fileLen = fileLen =
strnlen(reinterpret_cast<const char*>(commandData + obcFile.size() + SIZE_NULL_TERMINATOR), strnlen(reinterpret_cast<const char*>(commandData + obcFile.size() + SIZE_NULL_TERMINATOR),
commandDataLen - obcFile.size() - 1); commandDataLen - obcFile.size() - 1);
if (fileLen > FILENAME_FIELD_SIZE) { if (fileLen > MAX_FILENAME_SIZE) {
return MPSOC_FILENAME_TOO_LONG; return MPSOC_FILENAME_TOO_LONG;
} }
mpsocFile = std::string( mpsocFile = std::string(
@ -843,11 +738,11 @@ class FlashBasePusCmd {
const std::string& getObcFile() const { return obcFile; } const std::string& getObcFile() const { return obcFile; }
const std::string& getMpsocFile() const { return mpsocFile; } const std::string& getMPSoCFile() const { return mpsocFile; }
protected: protected:
size_t getParsedSize() const { size_t getParsedSize() const {
return getObcFile().size() + getMpsocFile().size() + 2 * SIZE_NULL_TERMINATOR; return getObcFile().size() + getMPSoCFile().size() + 2 * SIZE_NULL_TERMINATOR;
} }
static const size_t SIZE_NULL_TERMINATOR = 1; static const size_t SIZE_NULL_TERMINATOR = 1;
@ -914,151 +809,32 @@ class TcCamTakePic : public TcBase {
: TcBase(params, apid::TC_CAM_TAKE_PIC, sequenceCount) {} : TcBase(params, apid::TC_CAM_TAKE_PIC, sequenceCount) {}
ReturnValue_t setPayload(const uint8_t* commandData, size_t commandDataLen) { ReturnValue_t setPayload(const uint8_t* commandData, size_t commandDataLen) {
const uint8_t** dataPtr = &commandData; if (commandDataLen > MAX_DATA_LENGTH) {
if (commandDataLen > FULL_PAYLOAD_SIZE) {
return INVALID_LENGTH;
}
size_t deserLen = commandDataLen;
size_t serLen = 0;
fileName = reinterpret_cast<const char*>(commandData);
if (fileName.size() > MAX_FILENAME_SIZE) {
return FILENAME_TOO_LONG;
}
deserLen -= fileName.length() + 1;
*dataPtr += fileName.length() + 1;
uint8_t** payloadPtr = &payloadStart;
memcpy(payloadStart, fileName.data(), fileName.size());
*payloadPtr += FILENAME_FIELD_SIZE;
serLen += FILENAME_FIELD_SIZE;
ReturnValue_t result = SerializeAdapter::deSerialize(&encoderSettingY, dataPtr, &deserLen,
SerializeIF::Endianness::NETWORK);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::serialize(&encoderSettingY, payloadPtr, &serLen, FULL_PAYLOAD_SIZE,
SerializeIF::Endianness::NETWORK);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&quantizationY, dataPtr, &deserLen,
SerializeIF::Endianness::NETWORK);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::serialize(&quantizationY, payloadPtr, &serLen, FULL_PAYLOAD_SIZE,
SerializeIF::Endianness::NETWORK);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&encoderSettingsCb, dataPtr, &deserLen,
SerializeIF::Endianness::NETWORK);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::serialize(&encoderSettingsCb, payloadPtr, &serLen, FULL_PAYLOAD_SIZE,
SerializeIF::Endianness::NETWORK);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&quantizationCb, dataPtr, &deserLen,
SerializeIF::Endianness::NETWORK);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::serialize(&quantizationCb, payloadPtr, &serLen, FULL_PAYLOAD_SIZE,
SerializeIF::Endianness::NETWORK);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&encoderSettingsCr, dataPtr, &deserLen,
SerializeIF::Endianness::NETWORK);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::serialize(&encoderSettingsCr, payloadPtr, &serLen, FULL_PAYLOAD_SIZE,
SerializeIF::Endianness::NETWORK);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&quantizationCr, dataPtr, &deserLen,
SerializeIF::Endianness::NETWORK);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::serialize(&quantizationCr, payloadPtr, &serLen, FULL_PAYLOAD_SIZE,
SerializeIF::Endianness::NETWORK);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&bypassCompressor, dataPtr, &deserLen,
SerializeIF::Endianness::NETWORK);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::serialize(&bypassCompressor, payloadPtr, &serLen, FULL_PAYLOAD_SIZE,
SerializeIF::Endianness::NETWORK);
if (result != returnvalue::OK) {
return result;
}
spParams.setFullPayloadLen(FULL_PAYLOAD_SIZE + CRC_SIZE);
return returnvalue::OK;
}
std::string fileName;
uint8_t encoderSettingY = 7;
uint64_t quantizationY = 0;
uint8_t encoderSettingsCb = 7;
uint64_t quantizationCb = 0;
uint8_t encoderSettingsCr = 7;
uint64_t quantizationCr = 0;
uint8_t bypassCompressor = 0;
private:
static const size_t PARAMETER_SIZE = 28;
static constexpr size_t FULL_PAYLOAD_SIZE = FILENAME_FIELD_SIZE + PARAMETER_SIZE;
};
/**
* @brief Class to build simplex send file command
*/
class TcSimplexStreamFile : public TcBase {
public:
TcSimplexStreamFile(ploc::SpTcParams params, uint16_t sequenceCount)
: TcBase(params, apid::TC_SIMPLEX_SEND_FILE, sequenceCount) {}
ReturnValue_t setPayload(const uint8_t* commandData, size_t commandDataLen) {
if (commandDataLen > MAX_FILENAME_SIZE) {
return INVALID_LENGTH; return INVALID_LENGTH;
} }
std::string fileName(reinterpret_cast<const char*>(commandData)); std::string fileName(reinterpret_cast<const char*>(commandData));
if (fileName.size() > MAX_FILENAME_SIZE) { if (fileName.size() + sizeof(NULL_TERMINATOR) > MAX_FILENAME_SIZE) {
return FILENAME_TOO_LONG; return FILENAME_TOO_LONG;
} }
if (commandDataLen - (fileName.size() + sizeof(NULL_TERMINATOR)) != PARAMETER_SIZE) {
std::memset(payloadStart, 0, FILENAME_FIELD_SIZE); return INVALID_LENGTH;
std::memcpy(payloadStart, fileName.data(), fileName.length()); }
payloadStart[fileName.length()] = 0; spParams.setFullPayloadLen(commandDataLen + CRC_SIZE);
spParams.setFullPayloadLen(FILENAME_FIELD_SIZE + CRC_SIZE); std::memcpy(payloadStart, commandData, commandDataLen);
;
return returnvalue::OK; return returnvalue::OK;
} }
private: private:
static const size_t MAX_DATA_LENGTH = 286;
static const size_t PARAMETER_SIZE = 28;
}; };
/** /**
* @brief Class to build simplex send file command * @brief Class to build simplex send file command
*/ */
class TcSplitFile : public TcBase { class TcSimplexSendFile : public TcBase {
public: public:
TcSplitFile(ploc::SpTcParams params, uint16_t sequenceCount) TcSimplexSendFile(ploc::SpTcParams params, uint16_t sequenceCount)
: TcBase(params, apid::TC_SIMPLEX_SEND_FILE, sequenceCount) {} : TcBase(params, apid::TC_SIMPLEX_SEND_FILE, sequenceCount) {}
ReturnValue_t setPayload(const uint8_t* commandData, size_t commandDataLen) { ReturnValue_t setPayload(const uint8_t* commandData, size_t commandDataLen) {
@ -1080,24 +856,29 @@ class TcSplitFile : public TcBase {
return INVALID_PARAMETER; return INVALID_PARAMETER;
} }
std::string fileName(reinterpret_cast<const char*>(*dataPtr)); std::string fileName(reinterpret_cast<const char*>(*dataPtr));
if (fileName.size() > MAX_FILENAME_SIZE) { if (fileName.size() + sizeof(NULL_TERMINATOR) > MAX_FILENAME_SIZE) {
return FILENAME_TOO_LONG; return FILENAME_TOO_LONG;
} }
char divStr[16]{}; size_t currentCopyIdx = 0;
sprintf(divStr, "DIV%03u", chunkParameter); size_t payloadLen = fileName.length() + sizeof(NULL_TERMINATOR) + CRC_SIZE;
std::memcpy(payloadStart, divStr, DIV_STR_LEN); if (chunkParameter > 1) {
payloadStart[DIV_STR_LEN] = 0; char divStr[16]{};
std::memset(payloadStart + DIV_STR_LEN + 1, 0, FILENAME_FIELD_SIZE - DIV_STR_LEN - 1); sprintf(divStr, "DIV%03u", chunkParameter);
std::memcpy(payloadStart + DIV_STR_LEN + 1, fileName.data(), fileName.length()); std::memcpy(payloadStart, divStr, DIV_STR_LEN);
spParams.setFullPayloadLen(FILENAME_FIELD_SIZE + CRC_SIZE); payloadLen += DIV_STR_LEN;
currentCopyIdx += DIV_STR_LEN;
}
std::memcpy(payloadStart + currentCopyIdx, *dataPtr, fileName.length());
spParams.setFullPayloadLen(payloadLen);
return returnvalue::OK; return returnvalue::OK;
} }
private: private:
uint32_t chunkParameter = 0; uint32_t chunkParameter = 0;
static constexpr size_t MAX_DATA_LENGTH = 256;
static constexpr size_t MIN_DATA_LENGTH = 4; static constexpr size_t MIN_DATA_LENGTH = 4;
static constexpr size_t DIV_STR_LEN = 6; static constexpr size_t DIV_STR_LEN = 6;
static constexpr size_t MAX_DATA_LENGTH = 4 + MAX_FILENAME_SIZE;
}; };
/** /**

View File

@ -159,7 +159,6 @@ static const DeviceCommandId_t ENABLE_NVMS = 59;
static const DeviceCommandId_t CONTINUE_UPDATE = 60; static const DeviceCommandId_t CONTINUE_UPDATE = 60;
static const DeviceCommandId_t MEMORY_CHECK_WITH_FILE = 61; static const DeviceCommandId_t MEMORY_CHECK_WITH_FILE = 61;
static constexpr DeviceCommandId_t MEMORY_CHECK = 62; static constexpr DeviceCommandId_t MEMORY_CHECK = 62;
static constexpr DeviceCommandId_t ABORT_LONGER_REQUEST = 63;
/** Reply IDs */ /** Reply IDs */
enum ReplyId : DeviceCommandId_t { enum ReplyId : DeviceCommandId_t {

View File

@ -941,7 +941,7 @@ class AcsParameters : public HasParametersIF {
} sunModelParameters; } sunModelParameters;
struct KalmanFilterParameters { struct KalmanFilterParameters {
double sensorNoiseStr = 0.0028 * DEG2RAD; double sensorNoiseStr = 0.1 * DEG2RAD;
double sensorNoiseSus = 8. * DEG2RAD; double sensorNoiseSus = 8. * DEG2RAD;
double sensorNoiseMgm = 4. * DEG2RAD; double sensorNoiseMgm = 4. * DEG2RAD;
double sensorNoiseGyr = 0.1 * DEG2RAD; double sensorNoiseGyr = 0.1 * DEG2RAD;

View File

@ -232,7 +232,6 @@ void Guidance::targetRotationRate(const double timeDelta, double quatIX[4], doub
} }
if (timeDelta != 0.0) { if (timeDelta != 0.0) {
QuaternionOperations::rotationFromQuaternions(quatIX, quatIXprev, timeDelta, refSatRate); QuaternionOperations::rotationFromQuaternions(quatIX, quatIXprev, timeDelta, refSatRate);
VectorOperations<double>::mulScalar(refSatRate, -1, refSatRate, 3);
} else { } else {
std::memcpy(refSatRate, ZERO_VEC3, 3 * sizeof(double)); std::memcpy(refSatRate, ZERO_VEC3, 3 * sizeof(double));
} }
@ -304,9 +303,9 @@ void Guidance::comparePtg(double currentQuat[4], double currentSatRotRate[3], do
// First calculate error quaternion between current and target orientation without reference // First calculate error quaternion between current and target orientation without reference
// quaternion // quaternion
double errorQuatWoRef[4] = {0, 0, 0, 0}; double errorQuatWoRef[4] = {0, 0, 0, 0};
QuaternionOperations::multiply(currentQuat, targetQuat, errorQuatWoRef); QuaternionOperations::multiply(targetQuat, currentQuat, errorQuatWoRef);
// Then add rotation from reference quaternion // Then add rotation from reference quaternion
QuaternionOperations::multiply(refQuat, errorQuatWoRef, errorQuat); QuaternionOperations::multiply(errorQuatWoRef, refQuat, errorQuat);
// Keep scalar part of quaternion positive // Keep scalar part of quaternion positive
if (errorQuat[3] < 0) { if (errorQuat[3] < 0) {
VectorOperations<double>::mulScalar(errorQuat, -1, errorQuat, 4); VectorOperations<double>::mulScalar(errorQuat, -1, errorQuat, 4);
@ -316,9 +315,9 @@ void Guidance::comparePtg(double currentQuat[4], double currentSatRotRate[3], do
// Calculate error satellite rotational rate // Calculate error satellite rotational rate
// Convert target rotational rate into body RF // Convert target rotational rate into body RF
double targetSatRotRateB[3] = {0, 0, 0}; double errorQuatInv[4] = {0, 0, 0, 0}, targetSatRotRateB[3] = {0, 0, 0};
QuaternionOperations::multiplyVector(currentQuat, targetSatRotRate, targetSatRotRateB); QuaternionOperations::inverse(errorQuat, errorQuatInv);
VectorOperations<double>::copy(targetSatRotRateB, targetSatRotRate, 3); QuaternionOperations::multiplyVector(errorQuatInv, targetSatRotRate, targetSatRotRateB);
// Combine the target and reference satellite rotational rates // Combine the target and reference satellite rotational rates
double combinedRefSatRotRate[3] = {0, 0, 0}; double combinedRefSatRotRate[3] = {0, 0, 0};
VectorOperations<double>::add(targetSatRotRate, refSatRotRate, combinedRefSatRotRate, 3); VectorOperations<double>::add(targetSatRotRate, refSatRotRate, combinedRefSatRotRate, 3);

View File

@ -114,13 +114,12 @@ ReturnValue_t MultiplicativeKalmanFilter::mekfEst(
return result; return result;
} }
double measSensMatrix[matrixDimensionFactor][6] = {}, double measSensMatrix[matrixDimensionFactor][6] = {{0}},
measCovMatrix[matrixDimensionFactor][matrixDimensionFactor] = {}, measCovMatrix[matrixDimensionFactor][matrixDimensionFactor] = {{0}},
measVec[matrixDimensionFactor] = {}, estVec[matrixDimensionFactor] = {}; measVec[matrixDimensionFactor] = {0}, estVec[matrixDimensionFactor] = {0};
kfUpdate(susData, mgmData, *measSensMatrix, *measCovMatrix, measVec, estVec); kfUpdate(susData, mgmData, *measSensMatrix, *measCovMatrix, measVec, estVec);
double kalmanGain[6][matrixDimensionFactor]; double kalmanGain[6][matrixDimensionFactor] = {{0}};
std::memset(kalmanGain, 0, sizeof(kalmanGain));
result = kfGain(*measSensMatrix, *measCovMatrix, *kalmanGain, attitudeEstimationData); result = kfGain(*measSensMatrix, *measCovMatrix, *kalmanGain, attitudeEstimationData);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
reset(attitudeEstimationData); reset(attitudeEstimationData);
@ -343,11 +342,10 @@ ReturnValue_t MultiplicativeKalmanFilter::kfGain(
double *measSensMatrix, double *measCovMatrix, double *kalmanGain, double *measSensMatrix, double *measCovMatrix, double *kalmanGain,
acsctrl::AttitudeEstimationData *attitudeEstimationData) { acsctrl::AttitudeEstimationData *attitudeEstimationData) {
// Kalman Gain: K = P * H' / (H * P * H' + R) // Kalman Gain: K = P * H' / (H * P * H' + R)
double kalmanGainDen[matrixDimensionFactor][matrixDimensionFactor] = {}, double kalmanGainDen[matrixDimensionFactor][matrixDimensionFactor] = {{0}},
invKalmanGainDen[matrixDimensionFactor][matrixDimensionFactor] = {}; invKalmanGainDen[matrixDimensionFactor][matrixDimensionFactor] = {{0}},
double residualCov[6][matrixDimensionFactor], measSensMatrixTransposed[6][matrixDimensionFactor]; residualCov[6][matrixDimensionFactor] = {{0}},
std::memset(residualCov, 0, sizeof(residualCov)); measSensMatrixTransposed[6][matrixDimensionFactor] = {{0}};
std::memset(measSensMatrixTransposed, 0, sizeof(measSensMatrixTransposed));
MatrixOperations<double>::transpose(measSensMatrix, *measSensMatrixTransposed, MatrixOperations<double>::transpose(measSensMatrix, *measSensMatrixTransposed,
matrixDimensionFactor, 6); matrixDimensionFactor, 6);
@ -384,7 +382,8 @@ void MultiplicativeKalmanFilter::kfCovAposteriori(double *kalmanGain, double *me
void MultiplicativeKalmanFilter::kfStateAposteriori(double *kalmanGain, double *measVec, void MultiplicativeKalmanFilter::kfStateAposteriori(double *kalmanGain, double *measVec,
double *estVec) { double *estVec) {
double stateVecErr[6] = {0, 0, 0, 0, 0, 0}, plantOutputDiff[matrixDimensionFactor] = {}; double stateVecErr[6] = {0, 0, 0, 0, 0, 0};
double plantOutputDiff[matrixDimensionFactor] = {0};
VectorOperations<double>::subtract(measVec, estVec, plantOutputDiff, matrixDimensionFactor); VectorOperations<double>::subtract(measVec, estVec, plantOutputDiff, matrixDimensionFactor);
MatrixOperations<double>::multiply(kalmanGain, plantOutputDiff, stateVecErr, 6, MatrixOperations<double>::multiply(kalmanGain, plantOutputDiff, stateVecErr, 6,
matrixDimensionFactor, 1); matrixDimensionFactor, 1);

View File

@ -10,7 +10,6 @@
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "eive/definitions.h" #include "eive/definitions.h"
#include "eive/objects.h" #include "eive/objects.h"
#include "linux/payload/FreshMpsocHandler.h"
#include "linux/payload/FreshSupvHandler.h" #include "linux/payload/FreshSupvHandler.h"
#ifndef RPI_TEST_ADIS16507 #ifndef RPI_TEST_ADIS16507
@ -618,21 +617,17 @@ ReturnValue_t pst::pstPayload(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0, thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION); DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0, thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0,
FreshSupvHandler::OpCode::DEFAULT_OPERATION); FreshSupvHandler::OpCode::DEFAULT_OPERATION);
// Parse TM with a bit of delay. Two COM steps which might cover telemetry wehich takes a bit // Two COM TM steps, which might cover telemetry which takes a bit longer to be sent.
// longer to send
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.1, thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.1,
FreshSupvHandler::OpCode::PARSE_TM); FreshSupvHandler::OpCode::PARSE_TM);
thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.2, thisSequence->addSlot(objects::PLOC_SUPERVISOR_HANDLER, length * 0.2,
FreshSupvHandler::OpCode::PARSE_TM); FreshSupvHandler::OpCode::PARSE_TM);
// Parse TM with a bit of delay. Two COM steps which might cover telemetry wehich takes a bit
// longer to send
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.2,
FreshMpsocHandler::OpCode::PARSE_TM);
thisSequence->addSlot(objects::PLOC_MPSOC_HANDLER, length * 0.4,
FreshMpsocHandler::OpCode::PARSE_TM);
thisSequence->addSlot(objects::SCEX, length * 0.6, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SCEX, length * 0.6, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SCEX, length * 0.6, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SCEX, length * 0.6, DeviceHandlerIF::SEND_WRITE);

View File

@ -3,9 +3,8 @@ add_subdirectory(acs)
add_subdirectory(tcs) add_subdirectory(tcs)
add_subdirectory(com) add_subdirectory(com)
add_subdirectory(power) add_subdirectory(power)
add_subdirectory(payload)
target_sources( target_sources(
${LIB_EIVE_MISSION} ${LIB_EIVE_MISSION}
PRIVATE systemTree.cpp DualLanePowerStateMachine.cpp EiveSystem.cpp PRIVATE systemTree.cpp DualLanePowerStateMachine.cpp EiveSystem.cpp
treeUtil.cpp SharedPowerAssemblyBase.cpp) treeUtil.cpp SharedPowerAssemblyBase.cpp payloadModeTree.cpp)

View File

@ -1 +0,0 @@
target_sources(${LIB_EIVE_MISSION} PRIVATE payloadModeTree.cpp)

View File

@ -10,7 +10,7 @@
#include "mission/com/defs.h" #include "mission/com/defs.h"
#include "mission/sysDefs.h" #include "mission/sysDefs.h"
#include "mission/system/acs/acsModeTree.h" #include "mission/system/acs/acsModeTree.h"
#include "mission/system/payload/payloadModeTree.h" #include "mission/system/payloadModeTree.h"
#include "mission/system/power/epsModeTree.h" #include "mission/system/power/epsModeTree.h"
#include "mission/system/tcs/tcsModeTree.h" #include "mission/system/tcs/tcsModeTree.h"
#include "treeUtil.h" #include "treeUtil.h"

View File

@ -9,7 +9,7 @@ export ZYNQ_7020_SYSROOT="/opt/xiphos/sdk/ark/sysroots/cortexa9hf-neon-xiphos-li
export PATH=${CROSS_COMPILE_BIN_PATH}:$PATH export PATH=${CROSS_COMPILE_BIN_PATH}:$PATH
export CROSS_COMPILE="arm-linux-gnueabihf" export CROSS_COMPILE="arm-linux-gnueabihf"
unset EIVE_Q7S_EM # export EIVE_Q7S_EM=1
if [[ -d "eive-obsw" ]]; then if [[ -d "eive-obsw" ]]; then
echo "Detected EIVE OBSW root directory at $(pwd)/eive-obsw. Setting to EIVE_OBSW_ROOT" echo "Detected EIVE OBSW root directory at $(pwd)/eive-obsw. Setting to EIVE_OBSW_ROOT"

View File

@ -4,9 +4,6 @@ import os
import sys import sys
DEFAULT_PORT = 1539
def main(): def main():
args = handle_args() args = handle_args()
cmd = build_cmd(args) cmd = build_cmd(args)
@ -23,7 +20,7 @@ def prompt_ssh_key_removal():
do_remove_key = input( do_remove_key = input(
"Do you want to remove problematic keys on localhost ([Y]/n)?: " "Do you want to remove problematic keys on localhost ([Y]/n)?: "
) )
if do_remove_key.lower() not in ["y", "yes", "1", ""]: if not do_remove_key.lower() in ["y", "yes", "1", ""]:
sys.exit(1) sys.exit(1)
port = 0 port = 0
while True: while True:
@ -57,7 +54,7 @@ def handle_args():
"If files are copied back to host, will be current directory by default", "If files are copied back to host, will be current directory by default",
default="", default="",
) )
parser.add_argument("-P", "--port", help="Target port", default=DEFAULT_PORT) parser.add_argument("-P", "--port", help="Target port", default=1535)
parser.add_argument( parser.add_argument(
"-i", "-i",
"--invert", "--invert",

2
tmtc

@ -1 +1 @@
Subproject commit 9a06c64dfac3f4283c2d5af72a9c095f4726480b Subproject commit 37eafb722b36ebabb50252121c80ef7712216486