fsfw/memory/MemoryMessage.h

49 lines
2.0 KiB
C
Raw Normal View History

2020-09-26 14:51:00 +02:00
#ifndef FSFW_MEMORY_MEMORYMESSAGE_H_
#define FSFW_MEMORY_MEMORYMESSAGE_H_
2020-08-13 20:53:35 +02:00
#include "../ipc/CommandMessage.h"
#include "../storagemanager/StorageManagerIF.h"
class MemoryMessage {
public:
2020-09-26 14:51:00 +02:00
// Instantiation forbidden.
MemoryMessage() = delete;
2020-06-17 21:15:19 +02:00
static const uint8_t MESSAGE_ID = messagetypes::MEMORY;
static const Command_t CMD_MEMORY_LOAD = MAKE_COMMAND_ID( 0x01 );
static const Command_t CMD_MEMORY_DUMP = MAKE_COMMAND_ID( 0x02 );
static const Command_t CMD_MEMORY_CHECK = MAKE_COMMAND_ID( 0x03 );
static const Command_t REPLY_MEMORY_DUMP = MAKE_COMMAND_ID( 0x10 );
static const Command_t REPLY_MEMORY_CHECK = MAKE_COMMAND_ID( 0x30 );
static const Command_t REPLY_MEMORY_FAILED = MAKE_COMMAND_ID( 0xE0 );
static const Command_t END_OF_MEMORY_COPY = MAKE_COMMAND_ID(0xF0);
static uint32_t getAddress( const CommandMessage* message );
2020-09-26 14:51:00 +02:00
static store_address_t getStoreID(const CommandMessage* message);
static uint32_t getLength( const CommandMessage* message );
2020-09-26 14:51:00 +02:00
static ReturnValue_t getErrorCode(const CommandMessage* message);
static uint16_t getCrc(const CommandMessage* message );
static ReturnValue_t getCrcReturnValue(const CommandMessage* message);
static Command_t getInitialCommand(const CommandMessage* message);
static void setMemoryDumpCommand(CommandMessage* message,
uint32_t address, uint32_t length );
static void setMemoryDumpReply(CommandMessage* message,
store_address_t storageID);
static void setMemoryLoadCommand(CommandMessage* message,
uint32_t address, store_address_t storageID );
2020-09-26 14:54:23 +02:00
static void setMemoryCheckCommand(CommandMessage* message,
2020-09-26 14:51:00 +02:00
uint32_t address, uint32_t length);
2020-09-26 14:54:23 +02:00
static void setMemoryCheckReply(CommandMessage* message,
2020-09-26 14:51:00 +02:00
uint16_t crc);
2020-09-26 14:54:23 +02:00
static void setMemoryReplyFailed(CommandMessage* message,
2020-09-26 14:51:00 +02:00
ReturnValue_t errorCode, Command_t initialCommand);
2020-09-26 14:54:23 +02:00
static void setMemoryCopyEnd(CommandMessage* message);
static void setCrcReturnValue(CommandMessage*, ReturnValue_t returnValue);
2020-09-26 14:51:00 +02:00
static void clear(CommandMessage* message);
};
2020-09-26 14:51:00 +02:00
#endif /* FSFW_MEMORY_MEMORYMESSAGE_H_ */