FreeNOS
|
Broadcom System-on-Chip system timer. More...
#include <BroadcomTimer.h>
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... | |
Broadcom System-on-Chip system timer.
Definition at line 60 of file BroadcomTimer.h.
|
virtual |
Set timer frequency.
hertz | Frequency of the timer in hertz. |
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().
|
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.
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().
|
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().
|
private |
I/O instance.
Definition at line 90 of file BroadcomTimer.h.
Referenced by setFrequency(), and tick().