FreeNOS
Public Member Functions | Private Attributes
BroadcomTimer Class Reference

Broadcom System-on-Chip system timer. More...

#include <BroadcomTimer.h>

Inheritance diagram for BroadcomTimer:
Timer

Public Member Functions

virtual Result setFrequency (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 Attributes

u32 m_cycles
 Number of internal cycles needed to provide the current timer frequency. More...
 
ARMIO m_io
 I/O instance. 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

Broadcom System-on-Chip system timer.

Definition at line 60 of file BroadcomTimer.h.

Member Function Documentation

◆ setFrequency()

BroadcomTimer::Result BroadcomTimer::setFrequency ( Size  hertz)
virtual

Set timer frequency.

Parameters
hertzFrequency of the timer in hertz.
Returns
Result code.

Reimplemented from Timer.

Definition at line 21 of file BroadcomTimer.cpp.

References BCM_IRQ_SYSTIMERM1, BCM_SYSTIMER_FREQ, M1, m_cycles, Timer::m_frequency, Timer::m_int, m_io, ARMIO::read(), Timer::Success, SYSTIMER_C1, SYSTIMER_CLO, SYSTIMER_CS, and ARMIO::write().

Referenced by RaspberryKernel::RaspberryKernel().

◆ tick()

BroadcomTimer::Result BroadcomTimer::tick ( )
virtual

Process timer tick.

Should be called on each Timer interrupt to keep the m_info variable synchronized with the actual hardware. Also clears the timer interrupt flag.

Returns
Result code.

Reimplemented from Timer.

Definition at line 35 of file BroadcomTimer.cpp.

References M1, m_cycles, m_io, ARMIO::read(), SYSTIMER_C1, SYSTIMER_CLO, SYSTIMER_CS, Timer::tick(), and ARMIO::write().

Field Documentation

◆ m_cycles

u32 BroadcomTimer::m_cycles
private

Number of internal cycles needed to provide the current timer frequency.

Definition at line 87 of file BroadcomTimer.h.

Referenced by setFrequency(), and tick().

◆ m_io

ARMIO BroadcomTimer::m_io
private

I/O instance.

Definition at line 90 of file BroadcomTimer.h.

Referenced by setFrequency(), and tick().


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