simulavr  1.1.0
HWPrescaler Class Reference

Prescaler unit for support timers with clock. More...

#include <timerprescaler.h>

Inheritance diagram for HWPrescaler:

Public Member Functions

 HWPrescaler (AvrDevice *core, const std::string &tracename)
 Creates HWPrescaler instance without reset feature. More...
 
 HWPrescaler (AvrDevice *core, const std::string &tracename, IOSpecialReg *ioreg, int resetBit)
 Creates HWPrescaler instance with reset but without sync reset feature. More...
 
 HWPrescaler (AvrDevice *core, const std::string &tracename, IOSpecialReg *ioreg, int resetBit, int resetSyncBit)
 Creates HWPrescaler instance with reset and sync reset feature. More...
 
virtual unsigned int CpuCycle ()
 Count functionality for prescaler. More...
 
unsigned short GetValue ()
 Get method for current prescaler counter value. More...
 
void Reset ()
 Reset method, sets prescaler counter to 0. More...
 
- Public Member Functions inherited from Hardware
 Hardware (AvrDevice *core)
 
virtual ~Hardware ()
 
virtual void ClearIrqFlag (unsigned int vector)
 
virtual bool IsLevelInterrupt (unsigned int vector)
 
virtual bool LevelInterruptPending (unsigned int vector)
 
- Public Member Functions inherited from IOSpecialRegClient
virtual ~IOSpecialRegClient ()
 

Protected Member Functions

unsigned char set_from_reg (const IOSpecialReg *reg, unsigned char nv)
 IO register interface set method, see IOSpecialRegClient. More...
 
unsigned char get_from_client (const IOSpecialReg *reg, unsigned char v)
 IO register interface get method, see IOSpecialRegClient. More...
 

Protected Attributes

IOSpecialRegresetRegister
 instance of IO register with reset bits More...
 
unsigned short preScaleValue
 prescaler counter value More...
 
bool countEnable
 

Private Attributes

int _resetBit
 holds bit position for reset bit on IO register More...
 
int _resetSyncBit
 holds sync bit position for prescaler reset synchronisation More...
 

Detailed Description

Prescaler unit for support timers with clock.

This is a prescaler unit without external clock input, features reset and reset sync bit. Size of prescaler is 10 bit.

Definition at line 37 of file timerprescaler.h.

Constructor & Destructor Documentation

◆ HWPrescaler() [1/3]

HWPrescaler::HWPrescaler ( AvrDevice core,
const std::string &  tracename 
)

Creates HWPrescaler instance without reset feature.

Definition at line 29 of file timerprescaler.cpp.

References AvrDevice::AddToCycleList(), AvrDevice::coreTraceGroup, preScaleValue, resetRegister, and trace_direct().

Referenced by get_from_client().

◆ HWPrescaler() [2/3]

HWPrescaler::HWPrescaler ( AvrDevice core,
const std::string &  tracename,
IOSpecialReg ioreg,
int  resetBit 
)

Creates HWPrescaler instance with reset but without sync reset feature.

Definition at line 40 of file timerprescaler.cpp.

References AvrDevice::AddToCycleList(), IOSpecialReg::connectSRegClient(), AvrDevice::coreTraceGroup, preScaleValue, resetRegister, and trace_direct().

◆ HWPrescaler() [3/3]

HWPrescaler::HWPrescaler ( AvrDevice core,
const std::string &  tracename,
IOSpecialReg ioreg,
int  resetBit,
int  resetSyncBit 
)

Creates HWPrescaler instance with reset and sync reset feature.

Definition at line 55 of file timerprescaler.cpp.

References AvrDevice::AddToCycleList(), IOSpecialReg::connectSRegClient(), AvrDevice::coreTraceGroup, preScaleValue, resetRegister, and trace_direct().

Member Function Documentation

◆ CpuCycle()

virtual unsigned int HWPrescaler::CpuCycle ( void  )
inlinevirtual

Count functionality for prescaler.

Reimplemented from Hardware.

Reimplemented in HWPrescalerAsync.

Definition at line 67 of file timerprescaler.h.

◆ get_from_client()

unsigned char HWPrescaler::get_from_client ( const IOSpecialReg reg,
unsigned char  v 
)
inlineprotectedvirtual

IO register interface get method, see IOSpecialRegClient.

Implements IOSpecialRegClient.

Definition at line 50 of file timerprescaler.h.

References HWPrescaler().

◆ GetValue()

unsigned short HWPrescaler::GetValue ( )
inline

Get method for current prescaler counter value.

Definition at line 75 of file timerprescaler.h.

References preScaleValue.

Referenced by PrescalerMultiplexer::isClock(), and PrescalerMultiplexerExt::isClock().

◆ Reset()

void HWPrescaler::Reset ( void  )
inlinevirtual

Reset method, sets prescaler counter to 0.

Reimplemented from Hardware.

Definition at line 77 of file timerprescaler.h.

Referenced by set_from_reg().

◆ set_from_reg()

unsigned char HWPrescaler::set_from_reg ( const IOSpecialReg reg,
unsigned char  nv 
)
protectedvirtual

IO register interface set method, see IOSpecialRegClient.

Implements IOSpecialRegClient.

Reimplemented in HWPrescalerAsync.

Definition at line 71 of file timerprescaler.cpp.

References _resetBit, _resetSyncBit, countEnable, Reset(), and resetRegister.

Referenced by HWPrescalerAsync::set_from_reg().

Member Data Documentation

◆ _resetBit

int HWPrescaler::_resetBit
private

holds bit position for reset bit on IO register

Definition at line 40 of file timerprescaler.h.

Referenced by set_from_reg().

◆ _resetSyncBit

int HWPrescaler::_resetSyncBit
private

holds sync bit position for prescaler reset synchronisation

Definition at line 41 of file timerprescaler.h.

Referenced by set_from_reg().

◆ countEnable

bool HWPrescaler::countEnable
protected

enables counting of prescaler (for reset sync)

Definition at line 46 of file timerprescaler.h.

Referenced by HWPrescalerAsync::CpuCycle(), and set_from_reg().

◆ preScaleValue

unsigned short HWPrescaler::preScaleValue
protected

prescaler counter value

Definition at line 45 of file timerprescaler.h.

Referenced by HWPrescalerAsync::CpuCycle(), GetValue(), and HWPrescaler().

◆ resetRegister

IOSpecialReg* HWPrescaler::resetRegister
protected

instance of IO register with reset bits

Definition at line 44 of file timerprescaler.h.

Referenced by HWPrescaler(), and set_from_reg().


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