LVM_Timer.h revision 2c8e5cab3faa6d360e222b7a6c40a80083d021ac
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/*                                                                      */
22/*     Project::   My Project                                           */
23/*     $Author: beq07716 $*/
24/*     $Revision: 1000 $*/
25/*     $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
26/*                                                                      */
27/************************************************************************/
28#include "LVM_Types.h"
29
30/****************************************************************************************/
31/*                                                                                      */
32/*  Header file for the LVM_Timer library                                               */
33/*                                                                                      */
34/*  Functionality:                                                                      */
35/*  The timer will count down a number of ms, based on the number of samples it         */
36/*  sees and the curent sampling rate.  When the timer expires, a registered            */
37/*  callback function will be called.                                                   */
38/*  The maximal number of sampless that can be called by the timer is 2^32, which       */
39/*  corresponds to 24.8 hours at a sampling rate of 48 kHz                              */
40/*  The timer currently does not suport changes in sampling rate while timing.          */
41/****************************************************************************************/
42
43
44#ifdef __cplusplus
45extern "C" {
46#endif /* __cplusplus */
47
48/****************************************************************************************/
49/*  TYPE DEFINITIONS                                                                    */
50/****************************************************************************************/
51
52typedef struct
53{
54    LVM_INT32 Storage[6];
55
56} LVM_Timer_Instance_t;
57
58typedef struct
59{
60    LVM_INT32  SamplingRate;
61    LVM_INT16  TimeInMs;
62    LVM_INT32  CallBackParam;
63    void       *pCallBackParams;
64    void       *pCallbackInstance;
65    void       (*pCallBack)(void*,void*,LVM_INT32);
66
67} LVM_Timer_Params_t;
68
69/****************************************************************************************/
70/*  FUNCTION PROTOTYPES                                                                 */
71/****************************************************************************************/
72
73void LVM_Timer_Init (   LVM_Timer_Instance_t       *pInstance,
74                        LVM_Timer_Params_t         *pParams     );
75
76
77void LVM_Timer      (   LVM_Timer_Instance_t       *pInstance,
78                        LVM_INT16                       BlockSize );
79
80
81/****************************************************************************************/
82/*  END OF HEADER                                                                       */
83/****************************************************************************************/
84
85#ifdef __cplusplus
86}
87#endif /* __cplusplus */
88
89#endif  /* __LVM_TIMER_H__ */
90