Zth (libzth)
Loading...
Searching...
No Matches
zth::Register< T, Addr, Fields > Struct Template Reference

Helper class to read/write (bitfields in) hardware registers. More...

#include <regs.h>

Public Types

typedef T type
 

Public Member Functions

 Register () noexcept
 
constexpr Register (type v) noexcept
 
type read () const noexcept
 
type read () noexcept
 
void write () const noexcept
 
void write (type v) const noexcept
 
void write (type v) noexcept
 
 operator type () const noexcept
 

Static Public Member Functions

static type volatile * r () noexcept
 

Public Attributes

union { 
 
   type   value 
 
   Fields   field 
 
};  
 

Detailed Description

template<typename T, uintptr_t Addr, typename Fields>
struct zth::Register< T, Addr, Fields >

Helper class to read/write (bitfields in) hardware registers.

Registers are assumed to be volatile. Only explicit read() and write() access the actual register. All other operations are performed on the locally cached value.

Definition at line 31 of file regs.h.

Member Typedef Documentation

◆ type

template<typename T , uintptr_t Addr, typename Fields >
typedef T zth::Register< T, Addr, Fields >::type

Definition at line 32 of file regs.h.

Constructor & Destructor Documentation

◆ Register() [1/2]

template<typename T , uintptr_t Addr, typename Fields >
zth::Register< T, Addr, Fields >::Register ( )
inlinenoexcept

Definition at line 34 of file regs.h.

◆ Register() [2/2]

template<typename T , uintptr_t Addr, typename Fields >
constexpr zth::Register< T, Addr, Fields >::Register ( type  v)
inlineexplicitconstexprnoexcept

Definition at line 40 of file regs.h.

Member Function Documentation

◆ operator type()

template<typename T , uintptr_t Addr, typename Fields >
zth::Register< T, Addr, Fields >::operator type ( ) const
inlinenoexcept

Definition at line 79 of file regs.h.

◆ r()

template<typename T , uintptr_t Addr, typename Fields >
static type volatile * zth::Register< T, Addr, Fields >::r ( )
inlinestaticnoexcept

Definition at line 49 of file regs.h.

◆ read() [1/2]

template<typename T , uintptr_t Addr, typename Fields >
type zth::Register< T, Addr, Fields >::read ( ) const
inlinenoexcept

Definition at line 54 of file regs.h.

◆ read() [2/2]

template<typename T , uintptr_t Addr, typename Fields >
type zth::Register< T, Addr, Fields >::read ( )
inlinenoexcept

Definition at line 59 of file regs.h.

◆ write() [1/3]

template<typename T , uintptr_t Addr, typename Fields >
void zth::Register< T, Addr, Fields >::write ( ) const
inlinenoexcept

Definition at line 64 of file regs.h.

◆ write() [2/3]

template<typename T , uintptr_t Addr, typename Fields >
void zth::Register< T, Addr, Fields >::write ( type  v) const
inlinenoexcept

Definition at line 69 of file regs.h.

◆ write() [3/3]

template<typename T , uintptr_t Addr, typename Fields >
void zth::Register< T, Addr, Fields >::write ( type  v)
inlinenoexcept

Definition at line 74 of file regs.h.

Member Data Documentation

◆ [union]

union { ... } zth::Register< T, Addr, Fields >

◆ field

template<typename T , uintptr_t Addr, typename Fields >
Fields zth::Register< T, Addr, Fields >::field

Definition at line 46 of file regs.h.

◆ value

template<typename T , uintptr_t Addr, typename Fields >
type zth::Register< T, Addr, Fields >::value

Definition at line 45 of file regs.h.


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