FreeNOS
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
ARMTimer Class Reference

ARM Generic Timer. More...

#include <ARMTimer.h>

Inheritance diagram for ARMTimer:
Timer

Public Member Functions

 ARMTimer ()
 Constructor. More...
 
virtual Result setFrequency (const Size hertz)
 Set timer frequency. More...
 
virtual Result tick ()
 Process timer tick. More...
 
- Public Member Functions inherited from Timer
struct Timer::Info ALIGN (8) Info
 Timer information structure. More...
 
 Timer ()
 Constructor. More...
 
Size getInterrupt () const
 Get timer interrupt number. More...
 
Size getFrequency () const
 Get timer frequency. More...
 
virtual Result getCurrent (Info *info, const Size msecOffset=0)
 Get current timer info. More...
 
virtual Result initialize ()
 Initialize the timer. More...
 
virtual Result start ()
 Start the timer. More...
 
virtual Result stop ()
 Stop the timer. More...
 
virtual Result wait (u32 microseconds) const
 Busy wait a number of microseconds. More...
 
bool isExpired (const Info &info) const
 Check if a timer value is expired. More...
 

Private Member Functions

u32 getSystemFrequency (void) const
 Retrieve system timer frequency. More...
 
void setPL1PhysicalTimerValue (const u32 value)
 Set Physical Timer 1 value. More...
 
void setPL1PhysicalTimerControl (const u32 value)
 Set Physical Timer 1 control value. More...
 

Private Attributes

Size m_initialTimerCounter
 Currently configured initial timer counter. More...
 

Static Private Attributes

static const u32 TimerControlEnable = 1
 Set this bit in the PL1 control register to enable it. More...
 

Additional Inherited Members

- Public Types inherited from Timer
enum  Result { Success, NotFound, IOError, InvalidFrequency }
 Result codes. More...
 
- Data Fields inherited from Timer
enum Timer::Result ALIGN
 
- Protected Attributes inherited from Timer
Size m_ticks
 The current timer ticks. More...
 
Size m_frequency
 Frequency of the Timer. More...
 
Size m_int
 Timer interrupt number. More...
 

Detailed Description

ARM Generic Timer.

Definition at line 39 of file ARMTimer.h.

Constructor & Destructor Documentation

◆ ARMTimer()

ARMTimer::ARMTimer ( )

Constructor.

Definition at line 22 of file ARMTimer.cpp.

References Timer::m_int.

Member Function Documentation

◆ getSystemFrequency()

u32 ARMTimer::getSystemFrequency ( void  ) const
private

Retrieve system timer frequency.

Returns
System frequency

Definition at line 28 of file ARMTimer.cpp.

References mrc.

Referenced by setFrequency().

◆ setFrequency()

ARMTimer::Result ARMTimer::setFrequency ( const Size  hertz)
virtual

Set timer frequency.

Parameters
hertzFrequency of the timer in hertz.
Returns
Result code

Reimplemented from Timer.

Definition at line 52 of file ARMTimer.cpp.

References getSystemFrequency(), m_initialTimerCounter, Timer::setFrequency(), and tick().

Referenced by SunxiKernel::SunxiKernel().

◆ setPL1PhysicalTimerControl()

void ARMTimer::setPL1PhysicalTimerControl ( const u32  value)
private

Set Physical Timer 1 control value.

Parameters
valueNew timer control value

Definition at line 47 of file ARMTimer.cpp.

References mcr.

Referenced by tick().

◆ setPL1PhysicalTimerValue()

void ARMTimer::setPL1PhysicalTimerValue ( const u32  value)
private

Set Physical Timer 1 value.

Parameters
valueNew timer value

Definition at line 42 of file ARMTimer.cpp.

References mcr.

Referenced by tick().

◆ tick()

ARMTimer::Result ARMTimer::tick ( )
virtual

Process timer tick.

Should be called on each timer interrupt to restart the timer by applying the initial timer counter value.

Returns
Result code

Reimplemented from Timer.

Definition at line 60 of file ARMTimer.cpp.

References m_initialTimerCounter, setPL1PhysicalTimerControl(), setPL1PhysicalTimerValue(), Timer::tick(), and TimerControlEnable.

Referenced by setFrequency().

Field Documentation

◆ m_initialTimerCounter

Size ARMTimer::m_initialTimerCounter
private

Currently configured initial timer counter.

Definition at line 98 of file ARMTimer.h.

Referenced by setFrequency(), and tick().

◆ TimerControlEnable

const u32 ARMTimer::TimerControlEnable = 1
staticprivate

Set this bit in the PL1 control register to enable it.

Definition at line 44 of file ARMTimer.h.

Referenced by tick().


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