StuBS
Ticker Class Reference

The Ticker device demonstrates HPET interrupts. More...

#include <device/ticker.h>

Inheritance diagram for Ticker:
[legend]
Collaboration diagram for Ticker:
[legend]

Public Member Functions

 Ticker ()
 
bool windup (uint64_t us)
 Windup / initialize.
 
bool prologue () override
 Prologue of timer interrupts.
 
void epilogue () override
 Epilogue of timer interrupts.
 
uint64_t interval () const
 Retrieve the interrupt interval.
 
void activate ()
 Activate the timer.
 
void stop ()
 Stop the timer.
 
- Public Member Functions inherited from Gate
 Gate ()
 Constructor.
 
virtual ~Gate ()
 Destructor.
 
bool is_queued () const
 Status about the epilogue.
 
void set_queued (bool val)
 Set epilogue status.
 

Private Member Functions

 Ticker (const Ticker &)=delete
 
Tickeroperator= (const Ticker &)=delete
 

Private Attributes

uint64_t counter
 
uint64_t usecs
 
HPET::Comparatorcomparator
 

Additional Inherited Members

- Protected Member Functions inherited from Queue< T, ContainerType >::Node
 Node ()
 

Detailed Description

The Ticker device demonstrates HPET interrupts.

Periodic HPET interrupts increase the counter, which is displayed on a designated spot on the screen and shows the current systems runtime.

Constructor & Destructor Documentation

◆ Ticker() [1/2]

Ticker::Ticker ( const Ticker )
privatedelete

◆ Ticker() [2/2]

Ticker::Ticker ( )
inline

Member Function Documentation

◆ operator=()

Ticker & Ticker::operator= ( const Ticker )
privatedelete

◆ windup()

bool Ticker::windup ( uint64_t  us)

Windup / initialize.

Assigns itself to the Plugbox and initializes a HPET::Comparator in such a way that regular interrupts are triggered approx. every us microseconds when Ticker::activate() is called.

Note
This method must find a comparator capable of periodic interrupts.
For IOAPIC::config use Trigger Mode `LEVEL` with Polarity `LOW` to ensure operation on both Qemu/KVM and our test hardware.
Parameters
usDesired interrupt interval in microseconds.
Returns
Indicates if the interval could be set.

◆ prologue()

bool Ticker::prologue ( )
overridevirtual

Prologue of timer interrupts.

Returns
true if the interrupt was issued by the HPET and Ticker::epilogue should be executed.

Implements Gate.

◆ epilogue()

void Ticker::epilogue ( )
overridevirtual

Epilogue of timer interrupts.

Increases and displays the counter value (uptime)

Reimplemented from Gate.

◆ interval()

uint64_t Ticker::interval ( ) const
inline

Retrieve the interrupt interval.

Returns
Interval in microseconds

◆ activate()

void Ticker::activate ( )
inline

Activate the timer.

◆ stop()

void Ticker::stop ( )
inline

Stop the timer.

Member Data Documentation

◆ counter

uint64_t Ticker::counter
private

◆ usecs

uint64_t Ticker::usecs
private

◆ comparator

HPET::Comparator* Ticker::comparator
private

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