The Pedigree Project  0.1
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
HostedTimer Class Reference
+ Inheritance diagram for HostedTimer:
+ Collaboration diagram for HostedTimer:

Classes

class  Alarm
 

Public Member Functions

virtual bool registerHandler (TimerHandler *handler)
 
virtual bool unregisterHandler (TimerHandler *handler)
 
virtual void addAlarm (class Event *pEvent, size_t alarmSecs, size_t alarmUsecs=0)
 
virtual void removeAlarm (class Event *pEvent)
 
virtual size_t removeAlarm (class Event *pEvent, bool bRetZero)
 
virtual size_t getYear ()
 
virtual uint8_t getMonth ()
 
virtual uint8_t getDayOfMonth ()
 
virtual uint8_t getDayOfWeek ()
 
virtual uint8_t getHour ()
 
virtual uint8_t getMinute ()
 
virtual uint8_t getSecond ()
 
virtual uint64_t getNanosecond ()
 
virtual uint64_t getTickCount ()
 
virtual uint64_t getTickCountNano ()
 
bool initialise () INITIALISATION_ONLY
 
virtual void synchronise (bool tohw=false)
 
void uninitialise ()
 
- Public Member Functions inherited from Timer
virtual Time::Timestamp getUnixTimestamp ()
 

Static Public Member Functions

static HostedTimerinstance ()
 

Protected Member Functions

 HostedTimer () INITIALISATION_ONLY
 
virtual ~HostedTimer ()
 
- Protected Member Functions inherited from Timer
 Timer ()
 
virtual ~Timer ()
 

Private Member Functions

 HostedTimer (const HostedTimer &)
 
HostedTimeroperator= (const HostedTimer &)
 
virtual bool irq (irq_id_t number, InterruptState &state)
 
virtual ~IrqHandler ()
 

Private Attributes

size_t m_Year
 
uint8_t m_Month
 
uint8_t m_DayOfMonth
 
uint8_t m_DayOfWeek
 
uint8_t m_Hour
 
uint8_t m_Minute
 
uint8_t m_Second
 
uint64_t m_Nanosecond
 
__pedigree_hosted::timer_t m_Timer
 
irq_id_t m_IrqId
 
TimerHandlerm_Handlers [MAX_TIMER_HANDLERS]
 
List< Alarm * > m_Alarms
 

Static Private Attributes

static HostedTimer m_Instance
 

Detailed Description

Definition at line 38 of file kernel/machine/hosted/Timer.h.

Constructor & Destructor Documentation

HostedTimer::HostedTimer ( )
protected

The default constructor

Definition at line 253 of file hosted/Timer.cc.

virtual HostedTimer::~HostedTimer ( )
inlineprotectedvirtual

The destructor

Definition at line 78 of file kernel/machine/hosted/Timer.h.

HostedTimer::HostedTimer ( const HostedTimer )
private

The copy-constructor

Note
NOT implemented

Member Function Documentation

void HostedTimer::addAlarm ( class Event pEvent,
size_t  alarmSecs,
size_t  alarmUsecs = 0 
)
virtual

Dispatches the Event pEvent to the current thread in alarmSecs time.

Parameters
pEventEvent to dispatch.
alarmSecsNumber of seconds to wait.

Implements Timer.

Definition at line 42 of file hosted/Timer.cc.

References Processor::information().

uint8_t HostedTimer::getDayOfMonth ( )
virtual

Get the current day of month

Returns
the current day of month

Implements Timer.

Definition at line 139 of file hosted/Timer.cc.

uint8_t HostedTimer::getDayOfWeek ( )
virtual

Get the current day of week

Returns
the current day of week

Implements Timer.

Definition at line 144 of file hosted/Timer.cc.

uint8_t HostedTimer::getHour ( )
virtual

Get the current hour

Returns
the current hour

Implements Timer.

Definition at line 149 of file hosted/Timer.cc.

uint8_t HostedTimer::getMinute ( )
virtual

Get the current minute

Returns
the current minute

Implements Timer.

Definition at line 154 of file hosted/Timer.cc.

uint8_t HostedTimer::getMonth ( )
virtual

Get the current month

Returns
the current month

Implements Timer.

Definition at line 134 of file hosted/Timer.cc.

uint64_t HostedTimer::getNanosecond ( )
virtual

Get the current nanosecond

Returns
the current nanosecond

Implements Timer.

Definition at line 164 of file hosted/Timer.cc.

uint8_t HostedTimer::getSecond ( )
virtual

Get the current second

Returns
the current second

Implements Timer.

Definition at line 159 of file hosted/Timer.cc.

uint64_t HostedTimer::getTickCount ( )
virtual

Get the Tick count (time elapsed since system bootup)

Returns
the tick count in milliseconds

Implements Timer.

Definition at line 169 of file hosted/Timer.cc.

Referenced by irq().

+ Here is the caller graph for this function:

uint64_t HostedTimer::getTickCountNano ( )
virtual

Get the Tick count (time elapsed since system bootup) in nanosconds.

Returns
the tick count in nanoseconds

Reimplemented from Timer.

Definition at line 176 of file hosted/Timer.cc.

size_t HostedTimer::getYear ( )
virtual

Get the current year

Returns
the current year

Implements Timer.

Definition at line 129 of file hosted/Timer.cc.

bool HostedTimer::initialise ( )

Initialises the class

Returns
true, if successfull, false otherwise
Todo:
error message or something

Definition at line 183 of file hosted/Timer.cc.

References IrqManager::registerIsaIrqHandler().

Referenced by HostedMachine::initialise().

+ Here is the caller graph for this function:

bool HostedTimer::irq ( irq_id_t  number,
InterruptState &  state 
)
privatevirtual

Called when the handler is registered with the irq manager and the irq occurred

Note
If this function returns false you have to call IrqManager::acknowledgeIrq() when you removed the interrupt reason.
Parameters
[in]numberthe irq number
Returns
should return true, if the interrupt reason was removed, or false otherwise

Implements IrqHandler.

Definition at line 260 of file hosted/Timer.cc.

References g_FreePages, Machine::getSerial(), getTickCount(), m_Alarms, m_DayOfMonth, m_Handlers, m_Hour, m_Minute, m_Month, m_Nanosecond, m_Second, m_Year, Thread::sendEvent(), IrqManager::tick(), TimerHandler::timer(), and UNLIKELY.

HostedTimer& HostedTimer::operator= ( const HostedTimer )
private

The assignment operator

Note
NOT implemented
void HostedTimer::removeAlarm ( class Event pEvent)
virtual

Removes the event pEvent from the alarm queue.

Parameters
pEventEvent to remove alarm for.

Implements Timer.

Definition at line 50 of file hosted/Timer.cc.

size_t HostedTimer::removeAlarm ( class Event pEvent,
bool  bRetZero 
)
virtual

Removes the event pEvent from the alarm queue.

Parameters
pEventEvent to remove alarm for.
bRetZeroIf true, returns zero rather the time until firing
Returns
The number of seconds before the event would have fired, or zero if bRetZero is true.

Implements Timer.

Definition at line 63 of file hosted/Timer.cc.

void HostedTimer::synchronise ( bool  tohw = false)
virtual

Synchronise the time/date with the hardware

Reimplemented from Timer.

Definition at line 223 of file hosted/Timer.cc.

void HostedTimer::uninitialise ( )

Uninitialises the class

Definition at line 242 of file hosted/Timer.cc.

References IrqManager::unregisterHandler().

Member Data Documentation

List<Alarm *> HostedTimer::m_Alarms
private

List of alarms.

Definition at line 142 of file kernel/machine/hosted/Timer.h.

Referenced by irq().

uint8_t HostedTimer::m_DayOfMonth
private

The current day of month

Definition at line 100 of file kernel/machine/hosted/Timer.h.

Referenced by irq().

uint8_t HostedTimer::m_DayOfWeek
private

The current day of week

Definition at line 102 of file kernel/machine/hosted/Timer.h.

TimerHandler* HostedTimer::m_Handlers[MAX_TIMER_HANDLERS]
private

All timer handlers installed

Definition at line 122 of file kernel/machine/hosted/Timer.h.

Referenced by irq().

uint8_t HostedTimer::m_Hour
private

The current hour

Definition at line 104 of file kernel/machine/hosted/Timer.h.

Referenced by irq().

HostedTimer HostedTimer::m_Instance
staticprivate

The HostedTimer class instance

Definition at line 119 of file kernel/machine/hosted/Timer.h.

irq_id_t HostedTimer::m_IrqId
private

Registered handler.

Definition at line 116 of file kernel/machine/hosted/Timer.h.

uint8_t HostedTimer::m_Minute
private

The current minute

Definition at line 106 of file kernel/machine/hosted/Timer.h.

Referenced by irq().

uint8_t HostedTimer::m_Month
private

The current month

Definition at line 98 of file kernel/machine/hosted/Timer.h.

Referenced by irq().

uint64_t HostedTimer::m_Nanosecond
private

The current nanosecond

Definition at line 110 of file kernel/machine/hosted/Timer.h.

Referenced by irq().

uint8_t HostedTimer::m_Second
private

The current second

Definition at line 108 of file kernel/machine/hosted/Timer.h.

Referenced by irq().

__pedigree_hosted::timer_t HostedTimer::m_Timer
private

Tick source.

Definition at line 113 of file kernel/machine/hosted/Timer.h.

size_t HostedTimer::m_Year
private

The current year

Definition at line 96 of file kernel/machine/hosted/Timer.h.

Referenced by irq().


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