HbbTv  17.9.0
Open source HBBTV engine
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
timer.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2014 Ocean Blue Software Ltd
4  *
5  * This file is part of a DTVKit Software Component
6  * You are permitted to copy, modify or distribute this file subject to the terms
7  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
8  *
9  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
10  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
11  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * If you or your organisation is not a member of DTVKit then you have access
14  * to this source code outside of the terms of the licence agreement
15  * and you are expected to delete this and any associated files immediately.
16  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
17  *******************************************************************************/
26 /* pre-processor mechanism so multiple inclusions don't cause compilation error*/
27 
28 #ifndef _TIMER_H
29 
30 #define _TIMER_H
31 
32 #include "hbbtv_types.h"
33 
34 
35 /*---Constant and macro definitions for public use-----------------------------*/
36 
37 /*---Enumerations for public use-----------------------------------------------*/
38 
39 /*---Global type defs for public use-------------------------------------------*/
40 
41 typedef void *TMR_HANDLE;
42 
43 /*******************************************************************************
44  * NAME: F_TMR_CALLBACK
45  * Callback called either when a timer expires or an unexpired timer is
46  * destroyed.
47  *
48  * Returns : void
49  *
50  * Parameter Flow Description
51  * ------------------------------------------------------------------------------
52  * triggered IN True when the callback is invoked because the timer has
53  * expired, otherwise false.
54  * callerRef IN Caller reference which was passed when the timer was
55  * created.
56  * timerHandle IN Handle of the timer that caused the callback to be
57  * invoked.
58  *
59  *******************************************************************************/
60 typedef void (*F_TMR_CALLBACK)(BOOLEAN triggered,
61  void *callerRef, TMR_HANDLE timerHandle);
62 
63 
64 /*---Global Function prototypes for public use---------------------------------*/
65 
66 /*******************************************************************************
67  *@begin
68  * NAME: HBBTV_TmrCreate
69  * Set a timer for a certain number of millseconds. When the timer expires
70  * a specified callback will be called, passing the caller reference value.
71  *
72  * Returns : HBBTV_OK - Timer has been sucessfully set
73  *
74  * Parameter Flow Description
75  * ------------------------------------------------------------------------------
76  * millisecs IN Number of milliseconds before callback will be invoked.
77  * callback IN Pointer to callback function to invoke when timer is
78  * triggered.
79  * callerRef IN Caller reference which is passed to callback function
80  * when timer is triggered
81  * p_timer_handle OUT Pointer to handle to this timer that must be used to
82  * destroy the timer.
83  *
84  * Additional information:
85  *
86  *@end
87  *******************************************************************************/
88 E_HBBTV_ERR HBBTV_TmrCreate(U32BIT millisecs, F_TMR_CALLBACK callback,
89  void *callerRef, TMR_HANDLE *p_timer_handle);
90 
91 /*******************************************************************************
92  *@begin
93  * NAME: HBBTV_TmrDestroy
94  * Destroy the specified timer. A callback will not be invoked for this
95  * timer after this function returns.
96  *
97  * Returns : HBBTV_OK : Timer has been sucessfully killed
98  * HBBTV_ERR_BAD_PARAMETER : Invalid timer handle was passed
99  * HBBTV_ERR_COMP_NOT_OPEN : Timers not initialised.
100  *
101  * Parameter Flow Description
102  * ------------------------------------------------------------------------------
103  * timerHandle IN Handle of the timer to be destroyed.
104  *
105  * Additional information:
106  *
107  *@end
108  *******************************************************************************/
109 E_HBBTV_ERR HBBTV_TmrDestroy(TMR_HANDLE timerHandle);
110 
111 /*******************************************************************************
112  *@begin
113  * NAME: HBBTV_TmrInit
114  * Initialise the timer component. This function must be called before
115  * any other timer functions are invoked.
116  *
117  * Returns : HBBTV_OK - Timer component sucessfully initialised
118  * HBBTV_ERR_COMP_ALREADY_OPEN - Timer already open.
119  *
120  * Parameter Flow Description
121  * ------------------------------------------------------------------------------
122  *
123  * Additional information:
124  *
125  *@end
126  *******************************************************************************/
127 E_HBBTV_ERR HBBTV_TmrInit(U32BIT task_priority);
128 
129 /*******************************************************************************
130  *@begin
131  * NAME: HBBTV_TmrExit
132  * Uninitialise the timer component - all resources are freed. Other
133  * timer functions must not be called after calling this function until
134  * mhegTimerInit is called again.
135  *
136  * Returns : HBBTV_OK : Timer component sucessfully initialised
137  * TIMER_ERR_SYSTEM_ERROR : An unexpected system error ocurred.
138  *
139  * Parameter Flow Description
140  * ------------------------------------------------------------------------------
141  *
142  * Additional information:
143  *
144  *@end
145  *******************************************************************************/
146 E_HBBTV_ERR HBBTV_TmrExit(void);
147 
148 #endif /* _TIMER_H */
Definition of general purpose types.