1/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/****************************************************************************************
18 * @file name:          LVM_Types.h
19
20*****************************************************************************************/
21
22/****************************************************************************************/
23/*                                                                                      */
24/*  Header file defining the standard LifeVibes types for use in the application layer  */
25/*  interface of all LifeVibes modules                                                  */
26/*                                                                                      */
27/****************************************************************************************/
28
29#ifndef LVM_TYPES_H
30#define LVM_TYPES_H
31
32#ifdef __cplusplus
33extern "C" {
34#endif /* __cplusplus */
35
36
37/****************************************************************************************/
38/*                                                                                      */
39/*  definitions                                                                         */
40/*                                                                                      */
41/****************************************************************************************/
42
43#define LVM_NULL                0                   /* NULL pointer */
44
45#define LVM_TRUE                1                   /* Booleans */
46#define LVM_FALSE               0
47
48#define LVM_MAXINT_8            127                 /* Maximum positive integer size */
49#define LVM_MAXINT_16           32767
50#define LVM_MAXINT_32           2147483647
51#define LVM_MAXENUM             2147483647
52
53#define LVM_MODULEID_MASK       0xFF00              /* Mask to extract the calling module ID
54                                                        from callbackId */
55#define LVM_EVENTID_MASK        0x00FF              /* Mask to extract the callback event from
56                                                         callbackId */
57
58/* Memory table*/
59#define LVM_MEMREGION_PERSISTENT_SLOW_DATA      0   /* Offset to the instance memory region */
60#define LVM_MEMREGION_PERSISTENT_FAST_DATA      1   /* Offset to the persistent data memory
61                                                        region */
62#define LVM_MEMREGION_PERSISTENT_FAST_COEF      2   /* Offset to the persistent coefficient
63                                                        memory region */
64#define LVM_MEMREGION_TEMPORARY_FAST            3   /* Offset to temporary memory region */
65
66
67/****************************************************************************************/
68/*                                                                                      */
69/*  Basic types                                                                         */
70/*                                                                                      */
71/****************************************************************************************/
72
73typedef     char                LVM_CHAR;           /* ASCII character */
74
75typedef     char                LVM_INT8;           /* Signed 8-bit word */
76typedef     unsigned char       LVM_UINT8;          /* Unsigned 8-bit word */
77
78typedef     short               LVM_INT16;          /* Signed 16-bit word */
79typedef     unsigned short      LVM_UINT16;         /* Unsigned 16-bit word */
80
81typedef     long                LVM_INT32;          /* Signed 32-bit word */
82typedef     unsigned long       LVM_UINT32;         /* Unsigned 32-bit word */
83
84
85/****************************************************************************************/
86/*                                                                                      */
87/*  Standard Enumerated types                                                           */
88/*                                                                                      */
89/****************************************************************************************/
90
91/* Operating mode */
92typedef enum
93{
94    LVM_MODE_OFF    = 0,
95    LVM_MODE_ON     = 1,
96    LVM_MODE_DUMMY  = LVM_MAXENUM
97} LVM_Mode_en;
98
99
100/* Format */
101typedef enum
102{
103    LVM_STEREO          = 0,
104    LVM_MONOINSTEREO    = 1,
105    LVM_MONO            = 2,
106    LVM_SOURCE_DUMMY    = LVM_MAXENUM
107} LVM_Format_en;
108
109
110/* Word length */
111typedef enum
112{
113    LVM_16_BIT      = 0,
114    LVM_32_BIT      = 1,
115    LVM_WORDLENGTH_DUMMY = LVM_MAXENUM
116} LVM_WordLength_en;
117
118
119/* LVM sampling rates */
120typedef enum
121{
122    LVM_FS_8000  = 0,
123    LVM_FS_11025 = 1,
124    LVM_FS_12000 = 2,
125    LVM_FS_16000 = 3,
126    LVM_FS_22050 = 4,
127    LVM_FS_24000 = 5,
128    LVM_FS_32000 = 6,
129    LVM_FS_44100 = 7,
130    LVM_FS_48000 = 8,
131    LVM_FS_INVALID = LVM_MAXENUM-1,
132    LVM_FS_DUMMY = LVM_MAXENUM
133} LVM_Fs_en;
134
135
136/* Memory Types */
137typedef enum
138{
139    LVM_PERSISTENT_SLOW_DATA    = LVM_MEMREGION_PERSISTENT_SLOW_DATA,
140    LVM_PERSISTENT_FAST_DATA    = LVM_MEMREGION_PERSISTENT_FAST_DATA,
141    LVM_PERSISTENT_FAST_COEF    = LVM_MEMREGION_PERSISTENT_FAST_COEF,
142    LVM_TEMPORARY_FAST          = LVM_MEMREGION_TEMPORARY_FAST,
143    LVM_MEMORYTYPE_DUMMY        = LVM_MAXENUM
144} LVM_MemoryTypes_en;
145
146
147/* Memory region definition */
148typedef struct
149{
150    LVM_UINT32                  Size;                   /* Region size in bytes */
151    LVM_MemoryTypes_en          Type;                   /* Region type */
152    void                        *pBaseAddress;          /* Pointer to the region base address */
153} LVM_MemoryRegion_st;
154
155
156/****************************************************************************************/
157/*                                                                                      */
158/*  Standard Function Prototypes                                                        */
159/*                                                                                      */
160/****************************************************************************************/
161typedef LVM_INT32 (*LVM_Callback)(void          *pCallbackData,     /* Pointer to the callback
162                                                                     data structure */
163                                  void          *pGeneralPurpose,   /* General purpose pointer
164                                                                    (e.g. to a data structure
165                                                                    needed in the callback) */
166                                  LVM_INT16     GeneralPurpose );   /* General purpose variable
167                                  (e.g. to be used as callback ID) */
168
169
170/****************************************************************************************/
171/*                                                                                      */
172/*  End of file                                                                         */
173/*                                                                                      */
174/****************************************************************************************/
175
176#ifdef __cplusplus
177}
178#endif /* __cplusplus */
179
180#endif  /* LVM_TYPES_H */
181