various fixes, store file works now
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
This commit is contained in:
parent
b9ad396fb4
commit
2431994180
@ -265,7 +265,7 @@ ReturnValue_t FreshMpsocHandler::executeAction(ActionId_t actionId, MessageQueue
|
||||
return result;
|
||||
}
|
||||
result = specialComHelper.startFlashWrite(flashWritePusCmd.getObcFile(),
|
||||
flashWritePusCmd.getMPSoCFile());
|
||||
flashWritePusCmd.getMpsocFile());
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
@ -279,7 +279,7 @@ ReturnValue_t FreshMpsocHandler::executeAction(ActionId_t actionId, MessageQueue
|
||||
return result;
|
||||
}
|
||||
result = specialComHelper.startFlashRead(flashReadPusCmd.getObcFile(),
|
||||
flashReadPusCmd.getMPSoCFile(),
|
||||
flashReadPusCmd.getMpsocFile(),
|
||||
flashReadPusCmd.getReadSize());
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
|
@ -103,6 +103,8 @@ ReturnValue_t PlocMpsocSpecialComHelper::startFlashRead(std::string obcFile, std
|
||||
}
|
||||
flashReadAndWrite.totalReadSize = readFileSize;
|
||||
internalState = InternalState::FLASH_READ;
|
||||
sif::info << "PLOC MPSoC: Reading " << mpsocFile << " with size " << readFileSize << " to "
|
||||
<< obcFile << std::endl;
|
||||
return semaphore.release();
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,10 @@ std::string mpsoc::getStatusString(uint16_t status) {
|
||||
return "Incorrect length";
|
||||
break;
|
||||
}
|
||||
case (mpsoc::statusCode::FLASH_DRIVE_ERROR): {
|
||||
return "flash drive error";
|
||||
break;
|
||||
}
|
||||
case (mpsoc::statusCode::INCORRECT_CRC): {
|
||||
return "Incorrect crc";
|
||||
break;
|
||||
|
@ -283,6 +283,7 @@ static const uint16_t TC_SIMPLEX_SEND_FILE_DELAY = 80;
|
||||
|
||||
namespace statusCode {
|
||||
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 INCORRECT_LENGTH = 0x5DE;
|
||||
static const uint16_t INCORRECT_CRC = 0x5DF;
|
||||
@ -843,11 +844,11 @@ class FlashBasePusCmd {
|
||||
|
||||
const std::string& getObcFile() const { return obcFile; }
|
||||
|
||||
const std::string& getMPSoCFile() const { return mpsocFile; }
|
||||
const std::string& getMpsocFile() const { return mpsocFile; }
|
||||
|
||||
protected:
|
||||
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;
|
||||
|
||||
@ -1034,7 +1035,7 @@ class TcSimplexStreamFile : public TcBase {
|
||||
: TcBase(params, apid::TC_SIMPLEX_SEND_FILE, sequenceCount) {}
|
||||
|
||||
ReturnValue_t setPayload(const uint8_t* commandData, size_t commandDataLen) {
|
||||
if (commandDataLen > MAX_DATA_LENGTH) {
|
||||
if (commandDataLen > MAX_FILENAME_SIZE) {
|
||||
return INVALID_LENGTH;
|
||||
}
|
||||
std::string fileName(reinterpret_cast<const char*>(commandData));
|
||||
@ -1042,14 +1043,15 @@ class TcSimplexStreamFile : public TcBase {
|
||||
return FILENAME_TOO_LONG;
|
||||
}
|
||||
|
||||
std::memset(payloadStart, 0, FILENAME_FIELD_SIZE);
|
||||
std::memcpy(payloadStart, fileName.data(), fileName.length());
|
||||
payloadStart[fileName.length()] = 0;
|
||||
spParams.setFullPayloadLen(fileName.length() + 1);
|
||||
spParams.setFullPayloadLen(FILENAME_FIELD_SIZE + CRC_SIZE);
|
||||
;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
private:
|
||||
static constexpr size_t MAX_DATA_LENGTH = 256;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1082,14 +1084,13 @@ class TcSimplexStoreFile : public TcBase {
|
||||
if (fileName.size() > MAX_FILENAME_SIZE) {
|
||||
return FILENAME_TOO_LONG;
|
||||
}
|
||||
sif::debug << "file name: " << fileName << std::endl;
|
||||
char divStr[16]{};
|
||||
sprintf(divStr, "DIV%03u", chunkParameter);
|
||||
sif::debug << "div str: " << divStr << std::endl;
|
||||
std::memcpy(payloadStart, divStr, DIV_STR_LEN);
|
||||
std::memset(payloadStart + DIV_STR_LEN, 0, FILENAME_FIELD_SIZE);
|
||||
std::memcpy(payloadStart + DIV_STR_LEN, fileName.data(), fileName.length());
|
||||
spParams.setFullPayloadLen(DIV_STR_LEN + FILENAME_FIELD_SIZE + CRC_SIZE);
|
||||
payloadStart[DIV_STR_LEN] = 0;
|
||||
std::memset(payloadStart + DIV_STR_LEN + 1, 0, FILENAME_FIELD_SIZE - DIV_STR_LEN - 1);
|
||||
std::memcpy(payloadStart + DIV_STR_LEN + 1, fileName.data(), fileName.length());
|
||||
spParams.setFullPayloadLen(FILENAME_FIELD_SIZE + CRC_SIZE);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
@ -1097,7 +1098,7 @@ class TcSimplexStoreFile : public TcBase {
|
||||
uint32_t chunkParameter = 0;
|
||||
static constexpr size_t MIN_DATA_LENGTH = 4;
|
||||
static constexpr size_t DIV_STR_LEN = 6;
|
||||
static constexpr size_t MAX_DATA_LENGTH = DIV_STR_LEN + FILENAME_FIELD_SIZE;
|
||||
static constexpr size_t MAX_DATA_LENGTH = 4 + MAX_FILENAME_SIZE;
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user