Alarm Class Reference

List of all members.

Public Types

enum  { INFINITE = 0 }
typedef void(* Handler )()

Public Member Functions

 Alarm (const RTC::Microseconds &time, int times, Handler handler)
 Alarm (const RTC::Microseconds &time, int times)
 ~Alarm ()
void wait ()

Static Public Member Functions

static TSC::Hertz frequency ()
static void delay (const RTC::Microseconds &time)
static int init (System_Info *si)
static int alarmLoop ()
static RTC::Microseconds period ()

Static Public Attributes

static const int SINGLE_TIME = 1

Private Types

typedef Relative_Queue< Alarm,
List_Element_Rank, ATOMIC
AlarmQueue
typedef Queue< Handler, ATOMICHandlerQueue

Static Private Member Functions

static void master (const RTC::Microseconds &time, const Handler &handler)
static void timerHandler (void)

Private Attributes

Timer::Tick _ticks
int _times
AlarmQueue::Element _link
Semaphore _sem
Handler _handler
HandlerQueue::Element _handlerLink

Static Private Attributes

static const Type_Id TYPE = Type<Alarm>::TYPE
static const int FREQUENCY = __SYS(Traits)<Timer>::FREQUENCY
static const bool ATOMIC = true
static Timer _timer
static volatile Timer::Tick _elapsed
static Handler _master
static Timer::Tick _masterTicks = 1
static AlarmQueue _requests
static HandlerQueue _handlerQueue
static Thread_alarmThread

Friends

class Scheduler


Detailed Description

level Alarm object
Author:
EPOS-- and Group 06

Definition at line 24 of file alarm.h.


Member Typedef Documentation

typedef void(* Alarm::Handler)()

The alarm callback handler

typedef Queue<Handler, ATOMIC> Alarm::HandlerQueue [private]

Defies the HandlerQueue type

Definition at line 48 of file alarm.h.


Constructor & Destructor Documentation

Alarm::Alarm ( const RTC::Microseconds &  time,
int  times,
Handler  handler 
)

Alarm constructor for asynchronous function callback

Parameters:
time the number of RTC::Microseconds (unsigned long)
times the number of times to repeat the Alarm the callback to be called asynchronously

Definition at line 50 of file alarm.cc.

Alarm::Alarm ( const RTC::Microseconds &  time,
int  times 
)

Alarm constructor that will free a waiting after the alarm conclusion

Definition at line 60 of file alarm.cc.

Alarm::~Alarm (  ) 

Alarm destructor

Definition at line 45 of file alarm.cc.


Member Function Documentation

int Alarm::alarmLoop (  )  [static]

AlarmLoop callback.

Definition at line 25 of file alarm.cc.

void Alarm::delay ( const RTC::Microseconds &  time  )  [static]

Delays the Thread that called the delay

Parameters:
time the number of RTC::Microseconds to wait until the execution is proceeded

Definition at line 87 of file alarm.cc.

static TSC::Hertz Alarm::frequency (  )  [inline, static]

Returns the current frequency of the Timer

Definition at line 87 of file alarm.h.

int Alarm::init ( System_Info *  si  )  [static]

Init handler

Parameters:
si System_Info struct

Definition at line 18 of file alarm_init.cc.

void Alarm::master ( const RTC::Microseconds &  time,
const Handler handler 
) [static, private]

Private setMaster function

Parameters:
time the number of microseconds between each activation of the master
handler the master callback

Definition at line 74 of file alarm.cc.

static RTC::Microseconds Alarm::period (  )  [inline, static]

Gets the current Alarm period

Definition at line 109 of file alarm.h.

void Alarm::timerHandler ( void   )  [static, private]

The internal timerHandler function

free all waiting Thread

Definition at line 94 of file alarm.cc.

void Alarm::wait (  ) 

Waits the alarm to signal. If already signaled and times equals to zero doesn't wait and if the times is different of zero than waits till the next signal

Only waits if the Alarm has yet to be signalized

Definition at line 82 of file alarm.cc.


Member Data Documentation

Thread * Alarm::_alarmThread [static, private]

The Alarm Handler Thread initialized on Scheduler

Definition at line 187 of file alarm.h.

volatile Timer::Tick Alarm::_elapsed [static, private]

The number of time elapsed since the system initialization

Definition at line 162 of file alarm.h.

The Alarm handler callback

Definition at line 148 of file alarm.h.

HandlerQueue::Element Alarm::_handlerLink [private]

The handler link to the HandlerQueue

Definition at line 152 of file alarm.h.

A Queue of Handler that will be called from the Handler Thread

Definition at line 182 of file alarm.h.

AlarmQueue::Element Alarm::_link [private]

Internal link to intrusive list

Definition at line 138 of file alarm.h.

Alarm::Handler Alarm::_master [static, private]

The master Alarm callback

Definition at line 167 of file alarm.h.

Timer::Tick Alarm::_masterTicks = 1 [static, private]

The interval of ticks of the master Alarm

Definition at line 172 of file alarm.h.

Alarm::AlarmQueue Alarm::_requests [static, private]

Alarm request internal Queue

Definition at line 177 of file alarm.h.

Semaphore to callback functions

Definition at line 143 of file alarm.h.

Timer::Tick Alarm::_ticks [private]

The number of _ticks to signal the Alarm

Definition at line 130 of file alarm.h.

__BEGIN_SYS Timer Alarm::_timer [static, private]

Timer singleton

Definition at line 157 of file alarm.h.

int Alarm::_times [private]

Number of times that the Alarm will be signalized

Definition at line 134 of file alarm.h.

const bool Alarm::ATOMIC = true [static, private]

ATOMIC constant (for better code reading)

Definition at line 41 of file alarm.h.

const int Alarm::FREQUENCY = __SYS(Traits)<Timer>::FREQUENCY [static, private]

Defines the Alarm frequency as an alias to Traits<Timer>::FREQUENCY

Definition at line 36 of file alarm.h.

const int Alarm::SINGLE_TIME = 1 [static]

defines a SINGLE_TIME constant, which is actually the number one

Definition at line 58 of file alarm.h.


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

Generated on Mon May 4 09:42:22 2009 for EPOS-- by  doxygen 1.5.8