Merge remote-tracking branch 'origin/develop' into mueller/pus-15-tm-storage
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
This commit is contained in:
@ -122,6 +122,7 @@ static const DeviceCommandId_t RESET_PL = 58;
|
||||
static const DeviceCommandId_t ENABLE_NVMS = 59;
|
||||
static const DeviceCommandId_t CONTINUE_UPDATE = 60;
|
||||
static const DeviceCommandId_t MEMORY_CHECK_WITH_FILE = 61;
|
||||
static constexpr DeviceCommandId_t MEMORY_CHECK = 62;
|
||||
|
||||
/** Reply IDs */
|
||||
enum ReplyId : DeviceCommandId_t {
|
||||
@ -1198,7 +1199,7 @@ class WriteMemory : public TcBase {
|
||||
if (updateDataLen % 2 != 0) {
|
||||
// The data field must be two bytes aligned. Thus, in case the number of bytes to write is odd
|
||||
// a value of zero is added here
|
||||
data[updateDataLen + 1] = 0;
|
||||
data[updateDataLen] = 0;
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
@ -411,6 +411,7 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
|
||||
insertInCommandMap(SET_GPIO);
|
||||
insertInCommandMap(READ_GPIO);
|
||||
insertInCommandMap(FACTORY_RESET);
|
||||
insertInCommandMap(MEMORY_CHECK);
|
||||
insertInCommandMap(SET_SHUTDOWN_TIMEOUT);
|
||||
insertInCommandMap(FACTORY_FLASH);
|
||||
insertInCommandMap(SET_ADC_ENABLED_CHANNELS);
|
||||
@ -421,6 +422,7 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
|
||||
// ACK replies, use countdown for them
|
||||
insertInReplyMap(ACK_REPORT, 0, nullptr, SIZE_ACK_REPORT, false, &acknowledgementReportTimeout);
|
||||
insertInReplyMap(EXE_REPORT, 0, nullptr, SIZE_EXE_REPORT, false, &executionReportTimeout);
|
||||
insertInReplyMap(MEMORY_CHECK, 5, nullptr, 0, false);
|
||||
|
||||
// TM replies
|
||||
insertInReplyMap(HK_REPORT, 3, &hkset, SIZE_HK_REPORT);
|
||||
@ -507,6 +509,16 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MEMORY_CHECK: {
|
||||
enabledReplies = 3;
|
||||
result =
|
||||
DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, MEMORY_CHECK);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id " << MEMORY_CHECK
|
||||
<< " not in replyMap" << std::endl;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case START_MPSOC:
|
||||
case SHUTDOWN_MPSOC:
|
||||
case SEL_MPSOC_BOOT_IMAGE:
|
||||
@ -625,10 +637,7 @@ ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t* start, size_t r
|
||||
static_cast<uint8_t>(supv::tm::MemManId::UPDATE_STATUS_REPORT)) {
|
||||
*foundLen = tmReader.getFullPacketLen();
|
||||
*foundId = ReplyId::UPDATE_STATUS_REPORT;
|
||||
// TODO: I think this will be handled by the uart manager?
|
||||
// Actually, this is a bit tricky. Maybe the lower level will have two separate ring
|
||||
// buffers, one for internally handled packets and one for packets which are handled
|
||||
// here?
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -667,6 +676,10 @@ ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||
result = handleExecutionReport(packet);
|
||||
break;
|
||||
}
|
||||
case (UPDATE_STATUS_REPORT): {
|
||||
// TODO: handle status report here
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
sif::debug << "PlocSupervisorHandler::interpretDeviceReply: Unknown device reply id"
|
||||
<< std::endl;
|
||||
|
@ -116,7 +116,9 @@ ReturnValue_t PlocSupvUartManager::performOperation(uint8_t operationCode) {
|
||||
break;
|
||||
}
|
||||
case InternalState::DEDICATED_REQUEST: {
|
||||
updateVtime(1);
|
||||
handleRunningLongerRequest();
|
||||
updateVtime(2);
|
||||
MutexGuard mg(lock);
|
||||
state = InternalState::DEFAULT;
|
||||
break;
|
||||
@ -379,6 +381,11 @@ ReturnValue_t PlocSupvUartManager::writeUpdatePackets() {
|
||||
ProgressPrinter::HALF_PERCENT);
|
||||
#endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */
|
||||
uint8_t tempData[supv::WriteMemory::CHUNK_MAX + 1]{};
|
||||
if (not std::filesystem::exists(update.file)) {
|
||||
sif::error << "PlocSupvUartManager::writeUpdatePackets: File " << update.file
|
||||
<< " does not exist" << std::endl;
|
||||
return HasFileSystemIF::FILE_DOES_NOT_EXIST;
|
||||
}
|
||||
std::ifstream file(update.file, std::ifstream::binary);
|
||||
uint16_t dataLength = 0;
|
||||
ccsds::SequenceFlags seqFlags;
|
||||
@ -548,6 +555,7 @@ ReturnValue_t PlocSupvUartManager::handlePacketTransmissionNoReply(
|
||||
return result;
|
||||
}
|
||||
Countdown countdown(timeoutExecutionReport);
|
||||
dur_millis_t currentDelay = 5;
|
||||
bool ackReceived = false;
|
||||
bool packetWasHandled = false;
|
||||
while (true) {
|
||||
@ -585,7 +593,10 @@ ReturnValue_t PlocSupvUartManager::handlePacketTransmissionNoReply(
|
||||
decodedRingBuf.deleteData(packetLen);
|
||||
}
|
||||
} else {
|
||||
TaskFactory::delayTask(20);
|
||||
TaskFactory::delayTask(currentDelay);
|
||||
if (currentDelay < 80) {
|
||||
currentDelay *= 2;
|
||||
}
|
||||
}
|
||||
if (countdown.hasTimedOut()) {
|
||||
return result::NO_REPLY_TIMEOUT;
|
||||
@ -1090,9 +1101,11 @@ void PlocSupvUartManager::addHdlcFraming(const uint8_t* src, size_t slen, uint8_
|
||||
}
|
||||
|
||||
size_t dummy = 0;
|
||||
uint8_t crcRaw[2];
|
||||
// hdlc crc16 is in little endian format
|
||||
SerializeAdapter::serialize(&crc16, dst + tlen, &dummy, maxDest, SerializeIF::Endianness::LITTLE);
|
||||
tlen += dummy;
|
||||
SerializeAdapter::serialize(&crc16, crcRaw, &dummy, maxDest, SerializeIF::Endianness::LITTLE);
|
||||
hdlc_add_byte(crcRaw[0], dst, &tlen);
|
||||
hdlc_add_byte(crcRaw[1], dst, &tlen);
|
||||
|
||||
dst[tlen++] = 0x7C;
|
||||
*dlen = tlen;
|
||||
@ -1136,3 +1149,9 @@ bool PlocSupvUartManager::longerRequestActive() const {
|
||||
MutexGuard mg(lock);
|
||||
return state == InternalState::DEDICATED_REQUEST;
|
||||
}
|
||||
|
||||
void PlocSupvUartManager::updateVtime(uint8_t vtime) {
|
||||
tcgetattr(serialPort, &tty);
|
||||
tty.c_cc[VTIME] = vtime;
|
||||
tcsetattr(serialPort, TCSANOW, &tty);
|
||||
}
|
||||
|
@ -368,6 +368,7 @@ class PlocSupvUartManager : public DeviceCommunicationIF,
|
||||
ReturnValue_t readReceivedMessage(CookieIF* cookie, uint8_t** buffer, size_t* size) override;
|
||||
|
||||
void performUartShutdown();
|
||||
void updateVtime(uint8_t vtime);
|
||||
};
|
||||
|
||||
#endif /* BSP_Q7S_DEVICES_PLOCSUPVHELPER_H_ */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @brief Auto-generated event translation file. Contains 239 translations.
|
||||
* @details
|
||||
* Generated on: 2022-11-16 15:25:08
|
||||
* Generated on: 2022-11-28 18:24:37
|
||||
*/
|
||||
#include "translateEvents.h"
|
||||
|
||||
@ -135,7 +135,7 @@ const char *SUPV_ACK_FAILURE_STRING = "SUPV_ACK_FAILURE";
|
||||
const char *SUPV_EXE_FAILURE_STRING = "SUPV_EXE_FAILURE";
|
||||
const char *SUPV_CRC_FAILURE_EVENT_STRING = "SUPV_CRC_FAILURE_EVENT";
|
||||
const char *SUPV_HELPER_EXECUTING_STRING = "SUPV_HELPER_EXECUTING";
|
||||
const char *SUPV_MPSOC_SHUWDOWN_BUILD_FAILED_STRING = "SUPV_MPSOC_SHUWDOWN_BUILD_FAILED";
|
||||
const char *SUPV_MPSOC_SHUTDOWN_BUILD_FAILED_STRING = "SUPV_MPSOC_SHUTDOWN_BUILD_FAILED";
|
||||
const char *SANITIZATION_FAILED_STRING = "SANITIZATION_FAILED";
|
||||
const char *MOUNTED_SD_CARD_STRING = "MOUNTED_SD_CARD";
|
||||
const char *SEND_MRAM_DUMP_FAILED_STRING = "SEND_MRAM_DUMP_FAILED";
|
||||
@ -504,7 +504,7 @@ const char *translateEvents(Event event) {
|
||||
case (12007):
|
||||
return SUPV_HELPER_EXECUTING_STRING;
|
||||
case (12008):
|
||||
return SUPV_MPSOC_SHUWDOWN_BUILD_FAILED_STRING;
|
||||
return SUPV_MPSOC_SHUTDOWN_BUILD_FAILED_STRING;
|
||||
case (12100):
|
||||
return SANITIZATION_FAILED_STRING;
|
||||
case (12101):
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @brief Auto-generated object translation file.
|
||||
* @details
|
||||
* Contains 148 translations.
|
||||
* Generated on: 2022-11-16 15:25:08
|
||||
* Generated on: 2022-11-28 18:24:37
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
|
Reference in New Issue
Block a user