simulavr  1.1.0
IOReg< P > Class Template Reference

IO register to be specialized for a certain class/hardware. More...

#include <pin.h>

Inheritance diagram for IOReg< P >:

Public Types

typedef unsigned char(P::* getter_t) ()
 
typedef void(P::* setter_t) (unsigned char)
 
typedef unsigned char(P::* getter_bit_t) (unsigned int)
 
typedef void(P::* setter_bit_t) (bool, unsigned int)
 

Public Member Functions

 IOReg (TraceValueRegister *registry, const std::string &tracename, P *_p, getter_t _g=0, setter_t _s=0, getter_bit_t _gb=0, setter_bit_t _sb=0)
 
void hardwareChange (unsigned char val)
 
void releaseTraceValue (void)
 
virtual void set_bit (unsigned int bitaddr)
 
virtual void clear_bit (unsigned int bitaddr)
 
- Public Member Functions inherited from RWMemoryMember
 RWMemoryMember (TraceValueRegister *registry, const std::string &tracename="", const int index=-1)
 
 RWMemoryMember (void)
 
 operator unsigned char () const
 Read access on memory. More...
 
unsigned char operator= (unsigned char val)
 Write access on memory. More...
 
unsigned char operator= (const RWMemoryMember &mm)
 Write access on memory. More...
 
virtual ~RWMemoryMember ()
 
const std::string & GetTraceName (void)
 
bool IsInvalid (void) const
 

Protected Member Functions

unsigned char get () const
 
void set (unsigned char val)
 

Private Attributes

P * p
 
getter_t g
 
setter_t s
 
getter_bit_t gb
 
setter_bit_t sb
 

Additional Inherited Members

- Protected Attributes inherited from RWMemoryMember
TraceValuetv
 
TraceValueRegisterregistry
 
const std::string tracename
 
const bool isInvalid
 

Detailed Description

template<class P>
class IOReg< P >

IO register to be specialized for a certain class/hardware.

The template parameter class P specifies the class type in which the io register resides.

Definition at line 35 of file pin.h.

Member Typedef Documentation

◆ getter_bit_t

template<class P>
typedef unsigned char(P::* IOReg< P >::getter_bit_t) (unsigned int)

Definition at line 291 of file rwmem.h.

◆ getter_t

template<class P>
typedef unsigned char(P::* IOReg< P >::getter_t) ()

Definition at line 289 of file rwmem.h.

◆ setter_bit_t

template<class P>
typedef void(P::* IOReg< P >::setter_bit_t) (bool, unsigned int)

Definition at line 292 of file rwmem.h.

◆ setter_t

template<class P>
typedef void(P::* IOReg< P >::setter_t) (unsigned char)

Definition at line 290 of file rwmem.h.

Constructor & Destructor Documentation

◆ IOReg()

template<class P>
IOReg< P >::IOReg ( TraceValueRegister registry,
const std::string &  tracename,
P *  _p,
getter_t  _g = 0,
setter_t  _s = 0,
getter_bit_t  _gb = 0,
setter_bit_t  _sb = 0 
)
inline

Creates an IO control register for controlling hardware units

Parameters
_ppointer to object this will be part of
_gpointer to get method
_spointer to set method

Definition at line 297 of file rwmem.h.

Member Function Documentation

◆ clear_bit()

template<class P>
virtual void IOReg< P >::clear_bit ( unsigned int  bitaddr)
inlinevirtual

bitwise access to IOReg from CBI

Reimplemented from RWMemoryMember.

Definition at line 345 of file rwmem.h.

◆ get()

template<class P>
unsigned char IOReg< P >::get ( ) const
inlineprotectedvirtual

This function as the oppposite to get() is expected to read the real byte.

Implements RWMemoryMember.

Definition at line 360 of file rwmem.h.

◆ hardwareChange()

template<class P>
void IOReg< P >::hardwareChange ( unsigned char  val)
inline

Reflects a value change from hardware (for example timer count occured)

Parameters
valthe new register value

Definition at line 318 of file rwmem.h.

Referenced by HWPort::CalcOutputs(), HWStackSram::Pop(), HWStackSram::Push(), HWPort::SetDdr(), HWPort::SetPin(), HWPort::SetPinBit(), HWPort::SetPort(), HWStackSram::SetSph(), and HWStackSram::SetSpl().

◆ releaseTraceValue()

template<class P>
void IOReg< P >::releaseTraceValue ( void  )
inline

Releases the TraceValue to hide this IOReg from registry

Definition at line 320 of file rwmem.h.

Referenced by HWTimer16::HWTimer16(), HWTimer8::HWTimer8(), and HWUsart::HWUsart().

◆ set()

template<class P>
void IOReg< P >::set ( unsigned char  nv)
inlineprotectedvirtual

This function is the function which will be called by the above access operators and is expected to do the real work when writing a byte.

Implements RWMemoryMember.

Definition at line 368 of file rwmem.h.

◆ set_bit()

template<class P>
virtual void IOReg< P >::set_bit ( unsigned int  bitaddr)
inlinevirtual

bitwise access to IOReg from SBI

Reimplemented from RWMemoryMember.

Definition at line 329 of file rwmem.h.

Member Data Documentation

◆ g

template<class P>
getter_t IOReg< P >::g
private

Definition at line 378 of file rwmem.h.

◆ gb

template<class P>
getter_bit_t IOReg< P >::gb
private

Definition at line 380 of file rwmem.h.

◆ p

template<class P>
P* IOReg< P >::p
private

Definition at line 377 of file rwmem.h.

◆ s

template<class P>
setter_t IOReg< P >::s
private

Definition at line 379 of file rwmem.h.

◆ sb

template<class P>
setter_bit_t IOReg< P >::sb
private

Definition at line 381 of file rwmem.h.


The documentation for this class was generated from the following files: