ploc udpdater wip

This commit is contained in:
Jakob.Meier 2021-08-04 10:20:36 +02:00
parent ba51ca58f3
commit c431deede0
7 changed files with 111 additions and 2 deletions

View File

@ -153,7 +153,7 @@ public:
sd::SdCard prefSdCard = sd::SdCard::NONE);
/**
* If sd::SdCard::NONE is passed as an argument, this funtion will get the currently
* If sd::SdCard::NONE is passed as an argument, this function will get the currently
* preferred SD card from the scratch buffer.
* @param prefSdCardPtr
* @return

View File

@ -19,6 +19,7 @@ enum commonClassIds: uint8_t {
PLOC_SUPERVISOR_HANDLER, //PLSV
SUS_HANDLER, //SUSS
CCSDS_IP_CORE_BRIDGE, //IPCI
PLOC_UPDATER, //PLUD
COMMON_CLASS_ID_END // [EXPORT] : [END]
};

View File

@ -80,7 +80,9 @@ enum commonObjects: uint32_t {
RW3 = 0x44120003,
RW4 = 0x44120004,
START_TRACKER = 0x44130001
START_TRACKER = 0x44130001,
PLOC_UPDATER = 0x44300000
};
}

View File

@ -76,6 +76,7 @@ namespace config {
/* Add mission configuration flags here */
static constexpr uint32_t OBSW_FILESYSTEM_HANDLER_QUEUE_SIZE = 50;
static constexpr uint32_t PLOC_UPDATER_QUEUE_SIZE = 50;
#ifdef __cplusplus
}

View File

@ -18,6 +18,7 @@ target_sources(${TARGET_NAME} PUBLIC
GyroADIS16507Handler.cpp
RwHandler.cpp
StarTrackerHandler.cpp
PlocUpdater.cpp
)

View File

@ -0,0 +1,59 @@
#include <mission/devices/PlocUpdater.h>
PlocUpdater::PlocUpdater() : commandActionHelper(this) {
commandQueue = QueueFactory::instance()->createMessageQueue(QUEUE_SIZE);
}
PlocUpdater::~PlocUpdater() {
}
ReturnValue_t PlocUpdater::executeAction(ActionId_t actionId,
MessageQueueId_t commandedBy, const uint8_t* data, uint32_t size) {
if (state == BUSY) {
return UPDATER_BUSY;
}
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
dumpData.address = 0;
receivedDataSize = 0;
timer.resetTimer();
switch (actionId) {
case UPDATE_NVM0_A:
break;
case UPDATE_NVM0_B:
break;
case UPDATE_NVM1_A:
break;
case UPDATE_NVM1_B:
break;
dumpData.size = STRHandler::IMAGE_HEADER_SIZE;
dumpData.memoryId = STRHandler::ASC_MID_IMAGE;
result = commandActionHelper.commandAction(objects::STR_HANDLER,
STRHandler::ASC_SEND_IMAGE_TC_ID, &dumpData);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
state = EXPECT_IMAGE_SIZE;
break;
case FETCH_MIRU_DATA:
dumpData.memoryId = STRHandler::ASC_MID_MASSMEMORY;
dumpData.size = chunkSize;
result = commandActionHelper.commandAction(objects::STR_HANDLER,
STRHandler::ASC_MIRU_DUMP_DATA_TC_ID, &dumpData);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
state = MIRU_DATA_REQUESTED;
break;
default:
return INVALID_ACTION_ID;
}
return EXECUTION_FINISHED;
}
MessageQueueId_t PlocUpdater::getCommandQueue() const {
return commandQueue.getId();
}
PlocUpdater::prepare
getCurrentMountPrefix

View File

@ -0,0 +1,45 @@
#ifndef MISSION_DEVICES_PLOCUPDATER_H_
#define MISSION_DEVICES_PLOCUPDATER_H_
#include "fsfw/action/CommandActionHelper.h"
/**
* @brief An object of this class can be used to perform the software updates of the PLOC. The
* software update will be fetched via file system messages from the SD card handler,
* split into multiple space packets and sent to the PlocSupervisorHandler.
*
* @details The MPSoC has to boot memories (NVM0 and NVM1) where each stores two images (Partition A
* and Partition B)
*
* @author J. Meier
*/
class PlocUpdater : public SystemObject,
public HasActionsIF,
public ExecutableObjectIF {
public:
static const ActionId_t UPDATE_NVM0_A = 0;
static const ActionId_t UPDATE_NVM0_B = 0;
static const ActionId_t UPDATE_NVM1_A = 0;
static const ActionId_t UPDATE_NVM1_B = 0;
PlocUpdater();
virtual ~PlocUpdater();
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size);
MessageQueueId_t getCommandQueue() const;
private:
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_UPDATER;
//! [EXPORT] : [COMMENT] Updater is already performing an update
static const ReturnValue_t UPDATER_BUSY = MAKE_RETURN_CODE(0xA0);
static constexpr uint32_t QUEUE_SIZE = config::PLOC_UPDATER_QUEUE_SIZE;
CommandActionHelper commandActionHelper;
};
#endif /* MISSION_DEVICES_PLOCUPDATER_H_ */