libyggdrasil  v1.0.0
bsp::BitField< BaseAddress, SizeType, From, To > Struct Template Reference

Bitfield abstraction. Provides a way to read from, write to and pass around bitfields within registers as if they were normal variables. More...

#include <registers.hpp>

Public Member Functions

 BitField ()=default
 
constexpr ALWAYS_INLINE operator SizeType () const
 SizeType conversion operator overload. More...
 
template<typename T >
constexpr ALWAYS_INLINEoperator= (T value) const
 Assignment operator overload. More...
 

Static Public Attributes

static constexpr SizeType Mask = ((1ULL << u64(To - From + 1)) - 1) << From
 Mask to access the bitfield's bits. More...
 

Detailed Description

template<u32 BaseAddress, typename SizeType, u8 From, u8 To>
struct bsp::BitField< BaseAddress, SizeType, From, To >

Bitfield abstraction. Provides a way to read from, write to and pass around bitfields within registers as if they were normal variables.

Template Parameters
BaseAddressRegister base address
SizeTypeRegister size
FromFirst bit to include in bitfield
ToLast bit to include in bitfield

Constructor & Destructor Documentation

◆ BitField()

template<u32 BaseAddress, typename SizeType , u8 From, u8 To>
bsp::BitField< BaseAddress, SizeType, From, To >::BitField ( )
default

Member Function Documentation

◆ operator SizeType()

template<u32 BaseAddress, typename SizeType , u8 From, u8 To>
constexpr ALWAYS_INLINE bsp::BitField< BaseAddress, SizeType, From, To >::operator SizeType ( ) const
inlineconstexpr

SizeType conversion operator overload.

Returns
Value in bitfield

◆ operator=()

template<u32 BaseAddress, typename SizeType , u8 From, u8 To>
template<typename T >
constexpr ALWAYS_INLINE T bsp::BitField< BaseAddress, SizeType, From, To >::operator= ( value) const
inlineconstexpr

Assignment operator overload.

Template Parameters
TType of parameter. Must be unsigned
Parameters
valueValue to assign to bitfield
Returns
new value in bitfield

Member Data Documentation

◆ Mask

template<u32 BaseAddress, typename SizeType , u8 From, u8 To>
constexpr SizeType bsp::BitField< BaseAddress, SizeType, From, To >::Mask = ((1ULL << u64(To - From + 1)) - 1) << From
staticconstexpr

Mask to access the bitfield's bits.


The documentation for this struct was generated from the following file: