2016-06-15 23:48:41 +02:00
|
|
|
#ifndef MEMORYHELPER_H_
|
|
|
|
#define MEMORYHELPER_H_
|
2020-08-13 20:53:35 +02:00
|
|
|
#include "../ipc/CommandMessage.h"
|
|
|
|
#include "AcceptsMemoryMessagesIF.h"
|
|
|
|
#include "../returnvalues/HasReturnvaluesIF.h"
|
|
|
|
#include "../storagemanager/StorageManagerIF.h"
|
|
|
|
#include "../ipc/MessageQueueIF.h"
|
2016-06-15 23:48:41 +02:00
|
|
|
|
|
|
|
class MemoryHelper : public HasReturnvaluesIF {
|
|
|
|
public:
|
2018-07-12 16:29:32 +02:00
|
|
|
static const uint8_t INTERFACE_ID = CLASS_ID::MEMORY_HELPER;
|
2016-06-15 23:48:41 +02:00
|
|
|
static const ReturnValue_t UNKNOWN_CMD = MAKE_RETURN_CODE(0xE0);
|
|
|
|
static const ReturnValue_t INVALID_ADDRESS = MAKE_RETURN_CODE(0xE1);
|
|
|
|
static const ReturnValue_t INVALID_SIZE = MAKE_RETURN_CODE(0xE2);
|
|
|
|
static const ReturnValue_t STATE_MISMATCH = MAKE_RETURN_CODE(0xE3);
|
|
|
|
private:
|
|
|
|
HasMemoryIF* workOnThis;
|
2018-07-12 16:29:32 +02:00
|
|
|
MessageQueueIF* queueToUse;
|
2016-06-15 23:48:41 +02:00
|
|
|
StorageManagerIF* ipcStore;
|
|
|
|
store_address_t ipcAddress;
|
|
|
|
Command_t lastCommand;
|
|
|
|
MessageQueueId_t lastSender;
|
|
|
|
uint8_t* reservedSpaceInIPC;
|
2018-07-12 16:29:32 +02:00
|
|
|
bool busy;
|
2016-06-15 23:48:41 +02:00
|
|
|
void handleMemoryLoad(CommandMessage* message);
|
|
|
|
void handleMemoryCheckOrDump(CommandMessage* message);
|
2018-07-13 18:28:26 +02:00
|
|
|
ReturnValue_t initialize();
|
2016-06-15 23:48:41 +02:00
|
|
|
public:
|
|
|
|
ReturnValue_t handleMemoryCommand(CommandMessage* message);
|
|
|
|
void completeLoad( ReturnValue_t errorCode, const uint8_t* dataToCopy = NULL, const uint32_t size = 0, uint8_t* copyHere = NULL );
|
|
|
|
void completeDump( ReturnValue_t errorCode, const uint8_t* dataToCopy = NULL, const uint32_t size = 0);
|
|
|
|
void swapMatrixCopy( uint8_t *out, const uint8_t *in, uint32_t totalSize, uint8_t datatypeSize);
|
2018-07-13 18:28:26 +02:00
|
|
|
ReturnValue_t initialize(MessageQueueIF* queueToUse_);
|
2018-07-12 16:29:32 +02:00
|
|
|
MemoryHelper( HasMemoryIF* workOnThis, MessageQueueIF* useThisQueue );
|
2016-06-15 23:48:41 +02:00
|
|
|
~MemoryHelper();
|
|
|
|
};
|
|
|
|
#endif /* MEMORYHELPER_H_ */
|