Massive refactor to accommodate RISC-V targets
- Refactored entire codebase (excluding the Insight component) to accommodate multiple target architectures (no longer specific to AVR) - Deleted 'generate SVD' GDB monitor command - I will eventually move this functionality to the Bloom website - Added unit size property to address spaces - Many other changes which I couldn't be bothered to describe here
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <cassert>
|
||||
|
||||
#include "src/DebugToolDrivers/Protocols/RiscVDebugSpec/DebugModule/DebugModule.hpp"
|
||||
|
||||
namespace DebugToolDrivers::Protocols::RiscVDebugSpec::DebugModule::Registers
|
||||
{
|
||||
struct AbstractCommandRegister
|
||||
{
|
||||
enum CommandType: std::uint8_t
|
||||
{
|
||||
REGISTER_ACCESS = 0x00,
|
||||
QUICK_ACCESS = 0x01,
|
||||
MEMORY_ACCESS = 0x02,
|
||||
};
|
||||
|
||||
std::uint32_t control = 0;
|
||||
CommandType commandType = CommandType::REGISTER_ACCESS;
|
||||
|
||||
AbstractCommandRegister() = default;
|
||||
|
||||
constexpr AbstractCommandRegister(std::uint32_t control, CommandType commandType)
|
||||
: control(control)
|
||||
, commandType(commandType)
|
||||
{}
|
||||
|
||||
constexpr explicit AbstractCommandRegister(RegisterValue registerValue)
|
||||
: control(static_cast<std::uint32_t>(registerValue & 0x00FFFFFF))
|
||||
, commandType(static_cast<CommandType>((registerValue >> 24) & 0xFF))
|
||||
{}
|
||||
|
||||
[[nodiscard]] constexpr RegisterValue value() const {
|
||||
assert(this->control <= 0x00FFFFFF);
|
||||
|
||||
return RegisterValue{0}
|
||||
| static_cast<RegisterValue>(this->control & 0x00FFFFFF)
|
||||
| static_cast<RegisterValue>(this->commandType) << 24
|
||||
;
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user