• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2004-2010 NXP Software
3  * Copyright (C) 2010 The Android Open Source Project
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef __LVM_TIMER_H__
19 #define __LVM_TIMER_H__
20 
21 #include "LVM_Types.h"
22 
23 /****************************************************************************************/
24 /*                                                                                      */
25 /*  Header file for the LVM_Timer library                                               */
26 /*                                                                                      */
27 /*  Functionality:                                                                      */
28 /*  The timer will count down a number of ms, based on the number of samples it         */
29 /*  sees and the curent sampling rate.  When the timer expires, a registered            */
30 /*  callback function will be called.                                                   */
31 /*  The maximal number of sampless that can be called by the timer is 2^32, which       */
32 /*  corresponds to 24.8 hours at a sampling rate of 48 kHz                              */
33 /*  The timer currently does not suport changes in sampling rate while timing.          */
34 /****************************************************************************************/
35 
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif /* __cplusplus */
40 
41 /****************************************************************************************/
42 /*  TYPE DEFINITIONS                                                                    */
43 /****************************************************************************************/
44 
45 typedef struct
46 {
47     /*
48      * The memory area created using this structure is internally
49      * typecast to LVM_Timer_Instance_Private_t and used.
50      * The LVM_Timer_Instance_Private_t structure has 3 pointer type elements
51      * 2 elements of type LVM_INT32 and one element of type LVM_INT16.
52      * Inorder to cater both 32 and 64 bit builds, Storage array should
53      * have a minimum of 9 elements of type LVM_INT32.
54      */
55     LVM_INT32 Storage[9];
56 
57 } LVM_Timer_Instance_t;
58 
59 typedef struct
60 {
61     LVM_INT32  SamplingRate;
62     LVM_INT16  TimeInMs;
63     LVM_INT32  CallBackParam;
64     void       *pCallBackParams;
65     void       *pCallbackInstance;
66     void       (*pCallBack)(void*,void*,LVM_INT32);
67 
68 } LVM_Timer_Params_t;
69 
70 /****************************************************************************************/
71 /*  FUNCTION PROTOTYPES                                                                 */
72 /****************************************************************************************/
73 
74 void LVM_Timer_Init (   LVM_Timer_Instance_t       *pInstance,
75                         LVM_Timer_Params_t         *pParams     );
76 
77 
78 void LVM_Timer      (   LVM_Timer_Instance_t       *pInstance,
79                         LVM_INT16                       BlockSize );
80 
81 
82 /****************************************************************************************/
83 /*  END OF HEADER                                                                       */
84 /****************************************************************************************/
85 
86 #ifdef __cplusplus
87 }
88 #endif /* __cplusplus */
89 
90 #endif  /* __LVM_TIMER_H__ */
91