All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | List of all members
CSiriusTimer Class Reference

Sirius Timer Class. More...

#include <sir_timer.h>

Collaboration diagram for CSiriusTimer:
Collaboration graph

Public Member Functions

bool SetStartUnused (uint8_t ui8StartUnused)
 Set start of Unused value. More...
 
int GetNextUnused (THandleUnused tHU, void *pThis, uint32_t ui32SizeOfStruct)
 Get the next free Unused value. More...
 
bool Handle_Unused (cvmx_wqe_t *pWQE)
 Handle a packet that has the Unused field of the Work Queue Entry set. More...
 
sir_timer_t AddToCurrentTime (sir_timer_t tDelta_ms)
 Create a time value of tDelta_ms mili seconds in the future. More...
 
bool NowIsLater (sir_timer_t tTime)
 Test if current time is later than the time value tTime. More...
 
sir_timer_t SubstractFromCurrentTime (sir_timer_t tDelta_ms)
 Create a time value of tDelta_ms mili seconds in the past. More...
 
sir_timer_t AbsDiffCurrentTime (sir_timer_t tTime)
 Calculate the absolute difference between the current time and the time value tTime. More...
 
int64_t RelDiffCurrentTime (sir_timer_t tTime)
 Calculate the releative difference between the current time and the time value tTime. More...
 
sir_timer_t SetToCurrentTime ()
 Set the time value the the current time. More...
 
void TimInit (void)
 Initialize the CTimer class. More...
 

Static Public Member Functions

static CSiriusTimerInstance (void)
 Singleton for the CSiriusTimer class. More...
 
static int GetAndAddNrOfPacketsInUse (int iIncrement)
 DIAGNOSTIC: Get and/or increment the number of packets that are used by the CTimer class. More...
 
template<class T >
static bool TimLaunchPacket (T *pTimerData, uint8_t ui8Unused, uint32_t ui32Tag, uint32_t ui32Grp)
 Create a timer packet and launch it. More...
 
static void TimRemovePacket (cvmx_wqe_t *pWQE)
 Delete this timer packet. More...
 
static bool TimReLaunchPacket (cvmx_wqe_t *pWQE, uint64_t ui64Ticks)
 Relaunch the timer packet. More...
 

Detailed Description

Sirius Timer Class.

This class handles all kinds of issues that are related to time and the handling of packets that have the Unused field set in the Work Queue Entry.

Definition at line 56 of file sir_timer.h.

Member Function Documentation

sir_timer_t CSiriusTimer::AbsDiffCurrentTime ( sir_timer_t  tTime)

Calculate the absolute difference between the current time and the time value tTime.

sir_timer_t CSiriusTimer::AddToCurrentTime ( sir_timer_t  tDelta_ms)

Create a time value of tDelta_ms mili seconds in the future.

static int CSiriusTimer::GetAndAddNrOfPacketsInUse ( int  iIncrement)
static

DIAGNOSTIC: Get and/or increment the number of packets that are used by the CTimer class.

int CSiriusTimer::GetNextUnused ( THandleUnused  tHU,
void *  pThis,
uint32_t  ui32SizeOfStruct 
)

Get the next free Unused value.

Register a call back function to an Unused value in the Work Queu Entry. When a packet is handled to Sirius with this Unused value set, Sirius will call the corresponding function. In thsi way, the application does not have to remeber which unused value has what functionality. Sets the first value of the unused field for the unused field in the Work Que Entry that will be returned when

Parameters
[in]tHUFunction pointer to function that should handle packets with the Unused field of the WQE set to the value that was
Returns
Unused value assigned to this function pointer
bool CSiriusTimer::Handle_Unused ( cvmx_wqe_t *  pWQE)

Handle a packet that has the Unused field of the Work Queue Entry set.

This function will call the corresponding function that has been registered via GetNextUnused() for the value in the Unused field in the Work Queue Entry

Parameters
[in]pWQEPointer to the packets' Work Queue Entry
Returns
The return value of the called function if there is a function registered for this Unused value or false if there is no function registered for this Unused value. The return value indicates the packet has been digested by the called function (true) or not (false)
static CSiriusTimer* CSiriusTimer::Instance ( void  )
static

Singleton for the CSiriusTimer class.

Get a reference to an instance of this class and if it does not exist yet, create one.

Returns
pointer to instance of class
bool CSiriusTimer::NowIsLater ( sir_timer_t  tTime)

Test if current time is later than the time value tTime.

int64_t CSiriusTimer::RelDiffCurrentTime ( sir_timer_t  tTime)

Calculate the releative difference between the current time and the time value tTime.

bool CSiriusTimer::SetStartUnused ( uint8_t  ui8StartUnused)

Set start of Unused value.

Sets the first value of the unused field for the Unused field in the Work Que Entry that will be returned when GetNextUnused() is called. If not set by this function, the first value returned by GetNextUnsed() will be one ('1'). Because Sirius uses several different Unused values. this function can be used to reserve some values for the application. This function should be called before the Sirius class is initialized.

Parameters
[in]ui8StartUnsedFirst value that should be given when GetNextUnused() is called.
Returns
Pointer to instance of class
sir_timer_t CSiriusTimer::SetToCurrentTime ( )

Set the time value the the current time.

sir_timer_t CSiriusTimer::SubstractFromCurrentTime ( sir_timer_t  tDelta_ms)

Create a time value of tDelta_ms mili seconds in the past.

void CSiriusTimer::TimInit ( void  )

Initialize the CTimer class.

template<class T >
static bool CSiriusTimer::TimLaunchPacket ( T *  pTimerData,
uint8_t  ui8Unused,
uint32_t  ui32Tag,
uint32_t  ui32Grp 
)
inlinestatic

Create a timer packet and launch it.

Parameters
[in]pTimerDataPointer to an user specified struct that contains user specific data. Note that this struct must contain a 'ui64Ticks' field. This field must contain the nr of ticks to wait for the timer packet to appear on one of the cores. One timer tick equals 2 mili secs
[in]ui8UnusedUnused value for the WQE field to be used for this timer packet
[in]ui32TagThe tag value used for this timer packet. If > zero, atomic tag type will be used, otherwise tag type NULL will be used.
[in]ui32GrpThe core group that will handle this packet
Returns
true Launch was successful
false Otherwise

Definition at line 134 of file sir_timer.h.

static bool CSiriusTimer::TimReLaunchPacket ( cvmx_wqe_t *  pWQE,
uint64_t  ui64Ticks 
)
inlinestatic

Relaunch the timer packet.

Packet handlers that are registered via GetNextUnused() will receive the packets that are launched via TimLaunchPacket(). These packets will be removed via TimRemovePacket() of relaunced via this function.

Parameters
[in]pWQEPointer to the Work Queue Entry of the packet to be relaunched
[in]ui64TicksNr of ticks to wait before this timer packet should appear on one of the cores. One tick equels 2 mili secs
Returns
true Relaunch was successful
false Otherwise

Definition at line 195 of file sir_timer.h.

static void CSiriusTimer::TimRemovePacket ( cvmx_wqe_t *  pWQE)
inlinestatic

Delete this timer packet.

Definition at line 173 of file sir_timer.h.


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