FreeNOS
|
Represents a configurable timer device. More...
#include <Timer.h>
Data Structures | |
struct | Info |
Timer information structure. More... | |
Public Types | |
enum | Result { Success, NotFound, IOError, InvalidFrequency } |
Result codes. More... | |
Public Member Functions | |
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 | setFrequency (Size hertz) |
Set 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 | tick () |
Process timer tick. 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... | |
Data Fields | |
enum Timer::Result | ALIGN |
Protected Attributes | |
Size | m_ticks |
The current timer ticks. More... | |
Size | m_frequency |
Frequency of the Timer. More... | |
Size | m_int |
Timer interrupt number. More... | |
enum Timer::Result |
struct Timer::Info Timer::ALIGN | ( | 8 | ) |
Timer information structure.
|
virtual |
Get current timer info.
info | Timer Info object pointer for output. |
msecOffset | Optional offset in milliseconds to add |
Definition at line 44 of file Timer.cpp.
References Timer::Info::frequency, m_frequency, m_ticks, Success, and Timer::Info::ticks.
Referenced by ARP::lookupAddress(), ProcessCtlHandler(), ARP::sendRequest(), and FileSystemClient::waitFile().
Size Timer::getFrequency | ( | ) | const |
Get timer frequency.
Definition at line 33 of file Timer.cpp.
References m_frequency.
Referenced by IntelKernel::IntelKernel(), and IntelAPIC::start().
Size Timer::getInterrupt | ( | ) | const |
Get timer interrupt number.
Definition at line 28 of file Timer.cpp.
References m_int.
Referenced by IntelKernel::clocktick(), IntelKernel::enableIRQ(), and IntelKernel::IntelKernel().
|
virtual |
bool Timer::isExpired | ( | const Info & | info | ) | const |
Check if a timer value is expired.
info | Timer info value to compare |
Definition at line 85 of file Timer.cpp.
References Timer::Info::frequency, m_ticks, and Timer::Info::ticks.
Referenced by ARP::lookupAddress(), ProcessManager::schedule(), and FileSystemServer::waitFileHandler().
|
virtual |
Set timer frequency.
hertz | Frequency of the timer in hertz. |
Reimplemented in IntelPIT, BroadcomTimer, and ARMTimer.
Definition at line 38 of file Timer.cpp.
References m_frequency, and Success.
Referenced by ARMTimer::setFrequency().
|
virtual |
|
virtual |
|
virtual |
Process timer tick.
Should be called on each Timer interrupt to keep the m_info variable synchronized with the actual hardware.
Reimplemented in BroadcomTimer, ARMTimer, and KernelTimer.
Definition at line 74 of file Timer.cpp.
References m_ticks, and Success.
Referenced by IntelKernel::clocktick(), SunxiKernel::interrupt(), RaspberryKernel::interrupt(), ARMTimer::tick(), and BroadcomTimer::tick().
|
virtual |
enum Timer::Result Timer::ALIGN |
|
protected |
Frequency of the Timer.
Definition at line 162 of file Timer.h.
Referenced by getCurrent(), getFrequency(), IntelAPIC::IntelAPIC(), BroadcomTimer::setFrequency(), setFrequency(), IntelPIT::setFrequency(), IntelAPIC::start(), KernelTimer::tick(), and IntelAPIC::wait().
|
protected |
Timer interrupt number.
Definition at line 165 of file Timer.h.
Referenced by ARMTimer::ARMTimer(), getInterrupt(), IntelAPIC::IntelAPIC(), IntelPIT::IntelPIT(), and BroadcomTimer::setFrequency().
|
protected |
The current timer ticks.
Definition at line 159 of file Timer.h.
Referenced by getCurrent(), isExpired(), KernelTimer::tick(), and tick().