LVM_Types.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/****************************************************************************************
19
20     $Author: beq07716 $
21     $Revision: 1000 $
22     $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $
23
24*****************************************************************************************/
25
26/****************************************************************************************/
27/*                                                                                      */
28/*  Header file defining the standard LifeVibes types for use in the application layer  */
29/*  interface of all LifeVibes modules                                                  */
30/*                                                                                      */
31/****************************************************************************************/
32
33#ifndef LVM_TYPES_H
34#define LVM_TYPES_H
35
36#ifdef __cplusplus
37extern "C" {
38#endif /* __cplusplus */
39
40
41/****************************************************************************************/
42/*                                                                                      */
43/*  definitions                                                                         */
44/*                                                                                      */
45/****************************************************************************************/
46
47#define LVM_NULL                0                   /* NULL pointer */
48
49#define LVM_TRUE                1                   /* Booleans */
50#define LVM_FALSE               0
51
52#define LVM_MAXINT_8            127                 /* Maximum positive integer size */
53#define LVM_MAXINT_16           32767
54#define LVM_MAXINT_32           2147483647
55#define LVM_MAXENUM             2147483647
56
57#define LVM_MODULEID_MASK       0xFF00              /* Mask to extract the calling module ID from callbackId */
58#define LVM_EVENTID_MASK        0x00FF              /* Mask to extract the callback event from callbackId */
59
60/* Memory table*/
61#define LVM_MEMREGION_PERSISTENT_SLOW_DATA      0   /* Offset to the instance memory region */
62#define LVM_MEMREGION_PERSISTENT_FAST_DATA      1   /* Offset to the persistent data memory region */
63#define LVM_MEMREGION_PERSISTENT_FAST_COEF      2   /* Offset to the persistent coefficient memory region */
64#define LVM_MEMREGION_TEMPORARY_FAST            3   /* Offset to temporary memory region */
65
66#define LVM_NR_MEMORY_REGIONS                   4   /* Number of memory regions */
67
68/* Memory partition type */
69#define LVM_MEM_PARTITION0      0                   /* 1st memory partition */
70#define LVM_MEM_PARTITION1      1                   /* 2nd memory partition */
71#define LVM_MEM_PARTITION2      2                   /* 3rd memory partition */
72#define LVM_MEM_PARTITION3      3                   /* 4th memory partition */
73
74/* Use type */
75#define LVM_MEM_PERSISTENT      0                   /* Persistent memory type */
76#define LVM_MEM_SCRATCH         4                   /* Scratch  memory type */
77
78/* Access type */
79#define LVM_MEM_INTERNAL        0                   /* Internal (fast) access memory */
80#define LVM_MEM_EXTERNAL        8                   /* External (slow) access memory */
81
82/* Platform specific */
83#define LVM_PERSISTENT          LVM_MEM_PARTITION0+LVM_MEM_PERSISTENT+LVM_MEM_INTERNAL
84#define LVM_PERSISTENT_DATA     LVM_MEM_PARTITION1+LVM_MEM_PERSISTENT+LVM_MEM_INTERNAL
85#define LVM_PERSISTENT_COEF     LVM_MEM_PARTITION2+LVM_MEM_PERSISTENT+LVM_MEM_INTERNAL
86#define LVM_SCRATCH             LVM_MEM_PARTITION3+LVM_MEM_SCRATCH+LVM_MEM_INTERNAL
87
88/****************************************************************************************/
89/*                                                                                      */
90/*  Basic types                                                                         */
91/*                                                                                      */
92/****************************************************************************************/
93
94typedef     char                LVM_CHAR;           /* ASCII character */
95
96typedef     char                LVM_INT8;           /* Signed 8-bit word */
97typedef     unsigned char       LVM_UINT8;          /* Unsigned 8-bit word */
98
99typedef     short               LVM_INT16;          /* Signed 16-bit word */
100typedef     unsigned short      LVM_UINT16;         /* Unsigned 16-bit word */
101
102typedef     long                LVM_INT32;          /* Signed 32-bit word */
103typedef     unsigned long       LVM_UINT32;         /* Unsigned 32-bit word */
104
105
106/****************************************************************************************/
107/*                                                                                      */
108/*  Standard Enumerated types                                                           */
109/*                                                                                      */
110/****************************************************************************************/
111
112/* Operating mode */
113typedef enum
114{
115    LVM_MODE_OFF    = 0,
116    LVM_MODE_ON     = 1,
117    LVM_MODE_DUMMY  = LVM_MAXENUM
118} LVM_Mode_en;
119
120
121/* Format */
122typedef enum
123{
124    LVM_STEREO          = 0,
125    LVM_MONOINSTEREO    = 1,
126    LVM_MONO            = 2,
127    LVM_SOURCE_DUMMY    = LVM_MAXENUM
128} LVM_Format_en;
129
130
131/* LVM sampling rates */
132typedef enum
133{
134    LVM_FS_8000  = 0,
135    LVM_FS_11025 = 1,
136    LVM_FS_12000 = 2,
137    LVM_FS_16000 = 3,
138    LVM_FS_22050 = 4,
139    LVM_FS_24000 = 5,
140    LVM_FS_32000 = 6,
141    LVM_FS_44100 = 7,
142    LVM_FS_48000 = 8,
143    LVM_FS_INVALID = LVM_MAXENUM-1,
144    LVM_FS_DUMMY = LVM_MAXENUM
145} LVM_Fs_en;
146
147
148/* Memory Types */
149typedef enum
150{
151    LVM_PERSISTENT_SLOW_DATA    = LVM_MEMREGION_PERSISTENT_SLOW_DATA,
152    LVM_PERSISTENT_FAST_DATA    = LVM_MEMREGION_PERSISTENT_FAST_DATA,
153    LVM_PERSISTENT_FAST_COEF    = LVM_MEMREGION_PERSISTENT_FAST_COEF,
154    LVM_TEMPORARY_FAST          = LVM_MEMREGION_TEMPORARY_FAST,
155    LVM_MEMORYTYPE_DUMMY        = LVM_MAXENUM
156} LVM_MemoryTypes_en;
157
158
159/* Memory region definition */
160typedef struct
161{
162    LVM_UINT32                  Size;                   /* Region size in bytes */
163    LVM_MemoryTypes_en          Type;                   /* Region type */
164    void                        *pBaseAddress;          /* Pointer to the region base address */
165} LVM_MemoryRegion_st;
166
167
168/* Memory table containing the region definitions */
169typedef struct
170{
171    LVM_MemoryRegion_st         Region[LVM_NR_MEMORY_REGIONS];  /* One definition for each region */
172} LVM_MemoryTable_st;
173
174
175/****************************************************************************************/
176/*                                                                                      */
177/*  Standard Function Prototypes                                                        */
178/*                                                                                      */
179/****************************************************************************************/
180typedef LVM_INT32 (*LVM_Callback)(void          *pCallbackData,     /* Pointer to the callback data structure */
181                                  void          *pGeneralPurpose,   /* General purpose pointer (e.g. to a data structure needed in the callback) */
182                                  LVM_INT16     GeneralPurpose );   /* General purpose variable (e.g. to be used as callback ID) */
183
184
185/****************************************************************************************/
186/*                                                                                      */
187/*  End of file                                                                         */
188/*                                                                                      */
189/****************************************************************************************/
190
191#ifdef __cplusplus
192}
193#endif /* __cplusplus */
194
195#endif  /* LVM_TYPES_H */
196