Zth (libzth)
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 33 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 34 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 36 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 42 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 81 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 51 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 56 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 61 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 66 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 71 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 76 of file regs.h.

Member Data Documentation

◆ 

union { ... }

◆ field

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

Definition at line 48 of file regs.h.

◆ value

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

Definition at line 47 of file regs.h.


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