Go to the documentation of this file.
31 #include <type_traits>
44 template<u32 BaseAddress,
typename SizeType, u8 From, u8 To>
47 static constexpr SizeType
Mask = ((1ULL <<
u64(To - From + 1)) - 1) << From;
71 SizeType bitfieldValue = (registerRef & ~
Mask) | ((
static_cast<SizeType
>(value) << From) &
Mask);
73 registerRef = bitfieldValue;
78 static_assert(From <= To,
"Start bit needs to be lower than end bit");
89 template<addr_t BaseAddress, auto Offset,
typename SizeType = reg_t>
100 template<u8 From, u8 To>
103 static_assert((BaseAddress %
sizeof(SizeType)) == 0,
"MMIO Register address is not correctly aligned");
MMIO Register abstraction. Gives access to bitfields within the register as well as a reference to th...
Definition: registers.hpp:90
Commonly used type definitions and helper templates.
volatile T IO
MMIO type template.
Definition: types.hpp:59
uint64_t u64
Definition: types.h:39
#define ALWAYS_INLINE
Definition: attributes.h:34
static auto & Value
Reference to the register value.
Definition: registers.hpp:92
Commonly used C++ and GNU attributes.
Bitfield abstraction. Provides a way to read from, write to and pass around bitfields within register...
Definition: registers.hpp:45
Definition: cortex.hpp:33
static constexpr SizeType Mask
Mask to access the bitfield's bits.
Definition: registers.hpp:47
std::uint32_t addr_t
ARM32 specific types.
Definition: types.hpp:90
constexpr ALWAYS_INLINE T operator=(T value) const
Assignment operator overload.
Definition: registers.hpp:68