MHEG  17.9.0
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Pages
Macros | Typedefs | Functions
glue_timers.h File Reference

The timer module allows the use of timers within the MHEG5 component. These timers can be set by other parts of the component and call a callback function when they are triggered. The timer component offers two timer functions: The first is mhegTimerCreate which creates a new timer with a specified timeout, callback, and caller reference and returns a handle. Once the timer expires the callback is called, passing the caller reference and timer handle, with the trigger flag set to True. The callback may be called before the mhegTimerCreate function completes. The second is mhegTimerDestroy which destroys a running or expired timer. If the timer has not triggered mhegTimerDestroy calls the callback with the trigger flag set to False, to allow any client resources associated with this timer to be freed. It is guaranteed that the callback will not be called for this timer once the mhegTimerDestroy function returns. Note: The callback must be reentrant and can be called from either the clients task or a timer component task. More...

#include <techtype.h>
#include "mherrors.h"
#include "glue_type.h"

Go to the source code of this file.

Macros

#define mhegTimerCreate   VT_TimerCreate
 
#define mhegTimerDestroy   VT_TimerDestroy
 

Typedefs

typedef void * H_Timer
 
typedef void(* F_TimerCallback )(BOOLEAN triggered, void *callerRef, H_Timer timerHandle)
 

Functions

E_MhegErr VT_TimerCreate (U32BIT millisecs, F_TimerCallback callback, void *callerRef, H_Timer *pTimerHandle)
 Set a timer for a certain number of millseconds. When the timer expires a specified callback will be called, passing the caller reference value. More...
 
E_MhegErr VT_TimerDestroy (H_Timer timerHandle)
 Destroy the specified timer. A callback will not be invoked for this timer after this function returns. More...
 
E_MhegErr VT_TimersInit (U32BIT task_priority)
 Initialise the timer component. This function must be called before any other timer functions are invoked. More...
 
E_MhegErr VT_TimersExit (void)
 Uninitialise the timer component - all resources are freed. Other timer functions must not be called after calling this function until mhegTimerInit is called again. More...
 

Detailed Description

The timer module allows the use of timers within the MHEG5 component. These timers can be set by other parts of the component and call a callback function when they are triggered. The timer component offers two timer functions: The first is mhegTimerCreate which creates a new timer with a specified timeout, callback, and caller reference and returns a handle. Once the timer expires the callback is called, passing the caller reference and timer handle, with the trigger flag set to True. The callback may be called before the mhegTimerCreate function completes. The second is mhegTimerDestroy which destroys a running or expired timer. If the timer has not triggered mhegTimerDestroy calls the callback with the trigger flag set to False, to allow any client resources associated with this timer to be freed. It is guaranteed that the callback will not be called for this timer once the mhegTimerDestroy function returns. Note: The callback must be reentrant and can be called from either the clients task or a timer component task.

Date
12/11/2001
Author
iwillis

Function Documentation

E_MhegErr VT_TimerCreate ( U32BIT  millisecs,
F_TimerCallback  callback,
void *  callerRef,
H_Timer *  pTimerHandle 
)

Set a timer for a certain number of millseconds. When the timer expires a specified callback will be called, passing the caller reference value.

Parameters
millisecsNumber of milliseconds before callback will be invoked.
callbackPointer to callback function to invoke when timer is triggered.
callerRefCaller reference which is passed to callback function when timer is triggered
pTimerHandlePointer to handle to this timer that must be used to destroy the timer.
Returns
MHERR_OK - Timer has been sucessfully set MHERR_ALLOCATING_MEMORY_REGION - Resource required for setting timer was not available.
E_MhegErr VT_TimerDestroy ( H_Timer  timerHandle)

Destroy the specified timer. A callback will not be invoked for this timer after this function returns.

Parameters
timerHandleHandle of the timer to be destroyed.
Returns
MHERR_OK : Timer has been sucessfully killed MHERR_BAD_PARAMETER : Invalid timer handle was passed MHERR_COMP_NOT_OPEN : Timers not initialised.
E_MhegErr VT_TimersExit ( void  )

Uninitialise the timer component - all resources are freed. Other timer functions must not be called after calling this function until mhegTimerInit is called again.

Returns
MHERR_OK : Timer component sucessfully initialised TIMER_ERR_SYSTEM_ERROR : An unexpected system error ocurred.
E_MhegErr VT_TimersInit ( U32BIT  task_priority)

Initialise the timer component. This function must be called before any other timer functions are invoked.

Returns
MHERR_OK - Timer component sucessfully initialised MHERR_COMP_ALREADY_OPEN - Timer already open. MHERR_ALLOCATING_MEMORY_REGION: A resource required for the timer was not available.