restructured flash write command
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#ifdef XIPHOS_Q7S
|
||||
#include "bsp_q7s/memory/FileSystemHelper.h"
|
||||
#endif
|
||||
@ -65,7 +66,7 @@ void PlocMPSoCHelper::setSequenceCount(SourceSequenceCounter* sequenceCount_) {
|
||||
sequenceCount = sequenceCount_;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocMPSoCHelper::startFlashWrite(std::string file) {
|
||||
ReturnValue_t PlocMPSoCHelper::startFlashWrite(std::string obcFile, std::string mpsocFile) {
|
||||
#ifdef XIPHOS_Q7S
|
||||
ReturnValue_t result = FilesystemHelper::checkPath(file);
|
||||
if (result != RETURN_OK) {
|
||||
@ -76,7 +77,16 @@ ReturnValue_t PlocMPSoCHelper::startFlashWrite(std::string file) {
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
flashWrite.file = file;
|
||||
#ifdef TE0720_1CFA
|
||||
if (not std::filesystem::exists(obcFile)) {
|
||||
sif::warning << "PlocMPSoCHelper::startFlashWrite: File " << obcFile << "does not exist"
|
||||
<< std::endl;
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
#endif
|
||||
|
||||
flashWrite.obcFile = obcFile;
|
||||
flashWrite.mpsocFile = mpsocFile;
|
||||
internalState = InternalState::FLASH_WRITE;
|
||||
semaphore.release();
|
||||
terminate = false;
|
||||
@ -92,7 +102,7 @@ ReturnValue_t PlocMPSoCHelper::performFlashWrite() {
|
||||
return result;
|
||||
}
|
||||
uint8_t tempData[mpsoc::MAX_DATA_SIZE];
|
||||
std::ifstream file(flashWrite.file, std::ifstream::binary);
|
||||
std::ifstream file(flashWrite.obcFile, std::ifstream::binary);
|
||||
// Set position of next character to end of file input stream
|
||||
file.seekg(0, file.end);
|
||||
// tellg returns position of character in input stream
|
||||
@ -135,7 +145,7 @@ ReturnValue_t PlocMPSoCHelper::flashfopen() {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
(*sequenceCount)++;
|
||||
mpsoc::FlashFopen flashFopen(*sequenceCount);
|
||||
result = flashFopen.createPacket(flashWrite.file, mpsoc::FlashFopen::APPEND);
|
||||
result = flashFopen.createPacket(flashWrite.mpsocFile, mpsoc::FlashFopen::APPEND);
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
@ -150,7 +160,7 @@ ReturnValue_t PlocMPSoCHelper::flashfclose() {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
(*sequenceCount)++;
|
||||
mpsoc::FlashFclose flashFclose(*sequenceCount);
|
||||
result = flashFclose.createPacket(flashWrite.file);
|
||||
result = flashFclose.createPacket(flashWrite.mpsocFile);
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user