Ploc Memory Dumper
This commit is contained in:
parent
a91393b4b4
commit
eb886dc53c
20
linux/devices/devicedefinitions/PlocMemDumpActions.h
Normal file
20
linux/devices/devicedefinitions/PlocMemDumpActions.h
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <fsfw/action/MinMaxParameter.h>
|
||||||
|
#include <fsfw/action/TemplateAction.h>
|
||||||
|
#include <fsfw/introspection/Enum.h>
|
||||||
|
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
||||||
|
|
||||||
|
class PlocMemoryDumper;
|
||||||
|
|
||||||
|
FSFW_ENUM(PlocMemoryDumperCommands, DeviceCommandId_t,
|
||||||
|
((DUMP_MRAM, 1 ,"Dump Memory")))
|
||||||
|
|
||||||
|
class DumpMemoryAction : public TemplateAction<PlocMemoryDumper, DumpMemoryAction, PlocMemoryDumperCommands> {
|
||||||
|
public:
|
||||||
|
DumpMemoryAction(PlocMemoryDumper * owner): TemplateAction(owner, PlocMemoryDumperCommands::DUMP_MRAM) {}
|
||||||
|
|
||||||
|
//Memory is 512KiB
|
||||||
|
MinMaxParameter<uint32_t> startAddress = MinMaxParameter<uint32_t>::createMinMaxParameter(this, "Start Address", 0 , 0x80000);
|
||||||
|
MinMaxParameter<uint32_t> endAddress = MinMaxParameter<uint32_t>::createMinMaxParameter(this, "End Address", 0 , 0x80000);
|
||||||
|
};
|
@ -40,34 +40,19 @@ ReturnValue_t PlocMemoryDumper::performOperation(uint8_t operationCode) {
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMemoryDumper::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
ReturnValue_t PlocMemoryDumper::executeAction(Action* action) { return action->handle(); }
|
||||||
const uint8_t* data, size_t size) {
|
|
||||||
|
ReturnValue_t PlocMemoryDumper::handleAction(DumpMemoryAction* action) {
|
||||||
if (state != State::IDLE) {
|
if (state != State::IDLE) {
|
||||||
return IS_BUSY;
|
return IS_BUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (actionId) {
|
if (action->endAddress <= action->startAddress) {
|
||||||
case DUMP_MRAM: {
|
|
||||||
size_t deserializeSize = sizeof(mram.startAddress) + sizeof(mram.endAddress);
|
|
||||||
SerializeAdapter::deSerialize(&mram.startAddress, &data, &deserializeSize,
|
|
||||||
SerializeIF::Endianness::BIG);
|
|
||||||
SerializeAdapter::deSerialize(&mram.endAddress, &data, &deserializeSize,
|
|
||||||
SerializeIF::Endianness::BIG);
|
|
||||||
if (mram.endAddress > MAX_MRAM_ADDRESS) {
|
|
||||||
return MRAM_ADDRESS_TOO_HIGH;
|
|
||||||
}
|
|
||||||
if (mram.endAddress <= mram.startAddress) {
|
|
||||||
return MRAM_INVALID_ADDRESS_COMBINATION;
|
return MRAM_INVALID_ADDRESS_COMBINATION;
|
||||||
}
|
}
|
||||||
|
mram.startAddress = action->startAddress;
|
||||||
|
mram.endAddress = action->endAddress;
|
||||||
state = State::COMMAND_FIRST_MRAM_DUMP;
|
state = State::COMMAND_FIRST_MRAM_DUMP;
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
sif::warning << "PlocMemoryDumper::executeAction: Received command with invalid action id"
|
|
||||||
<< std::endl;
|
|
||||||
return INVALID_ACTION_ID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return EXECUTION_FINISHED;
|
return EXECUTION_FINISHED;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define MISSION_DEVICES_PLOCMEMORYDUMPER_H_
|
#define MISSION_DEVICES_PLOCMEMORYDUMPER_H_
|
||||||
|
|
||||||
#include <linux/devices/devicedefinitions/PlocMemDumpDefinitions.h>
|
#include <linux/devices/devicedefinitions/PlocMemDumpDefinitions.h>
|
||||||
|
#include <linux/devices/devicedefinitions/PlocMemDumpActions.h>
|
||||||
#include <linux/devices/devicedefinitions/PlocSupervisorDefinitions.h>
|
#include <linux/devices/devicedefinitions/PlocSupervisorDefinitions.h>
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
@ -37,8 +38,9 @@ class PlocMemoryDumper : public SystemObject,
|
|||||||
virtual ~PlocMemoryDumper();
|
virtual ~PlocMemoryDumper();
|
||||||
|
|
||||||
ReturnValue_t performOperation(uint8_t operationCode = 0) override;
|
ReturnValue_t performOperation(uint8_t operationCode = 0) override;
|
||||||
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
ReturnValue_t executeAction(Action* action) override;
|
||||||
const uint8_t* data, size_t size);
|
ReturnValue_t handleAction(DumpMemoryAction* action);
|
||||||
|
ActionHelper *getActionHelper() override;
|
||||||
MessageQueueId_t getCommandQueue() const;
|
MessageQueueId_t getCommandQueue() const;
|
||||||
ReturnValue_t initialize() override;
|
ReturnValue_t initialize() override;
|
||||||
MessageQueueIF* getCommandQueuePtr() override;
|
MessageQueueIF* getCommandQueuePtr() override;
|
||||||
@ -53,9 +55,6 @@ class PlocMemoryDumper : public SystemObject,
|
|||||||
|
|
||||||
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_MEMORY_DUMPER;
|
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_MEMORY_DUMPER;
|
||||||
|
|
||||||
//! [EXPORT] : [COMMENT] The capacity of the MRAM amounts to 512 kB. Thus the maximum address must
|
|
||||||
//! not be higher than 0x7d000.
|
|
||||||
static const ReturnValue_t MRAM_ADDRESS_TOO_HIGH = MAKE_RETURN_CODE(0xA0);
|
|
||||||
//! [EXPORT] : [COMMENT] The specified end address is lower than the start address
|
//! [EXPORT] : [COMMENT] The specified end address is lower than the start address
|
||||||
static const ReturnValue_t MRAM_INVALID_ADDRESS_COMBINATION = MAKE_RETURN_CODE(0xA1);
|
static const ReturnValue_t MRAM_INVALID_ADDRESS_COMBINATION = MAKE_RETURN_CODE(0xA1);
|
||||||
|
|
||||||
@ -73,7 +72,6 @@ class PlocMemoryDumper : public SystemObject,
|
|||||||
|
|
||||||
// Maximum size of mram dump which can be retrieved with one command
|
// Maximum size of mram dump which can be retrieved with one command
|
||||||
static const uint32_t MAX_MRAM_DUMP_SIZE = 100000;
|
static const uint32_t MAX_MRAM_DUMP_SIZE = 100000;
|
||||||
static const uint32_t MAX_MRAM_ADDRESS = 0x7d000;
|
|
||||||
|
|
||||||
MessageQueueIF* commandQueue = nullptr;
|
MessageQueueIF* commandQueue = nullptr;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user