12c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/*
22c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent * Copyright (C) 2004-2010 NXP Software
32c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent * Copyright (C) 2010 The Android Open Source Project
42c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent *
52c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent * Licensed under the Apache License, Version 2.0 (the "License");
62c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent * you may not use this file except in compliance with the License.
72c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent * You may obtain a copy of the License at
82c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent *
92c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent *      http://www.apache.org/licenses/LICENSE-2.0
102c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent *
112c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent * Unless required by applicable law or agreed to in writing, software
122c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent * distributed under the License is distributed on an "AS IS" BASIS,
132c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
142c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent * See the License for the specific language governing permissions and
152c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent * limitations under the License.
162c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent */
172c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
182c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/****************************************************************************************/
192c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/*                                                                                      */
202c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/*  Header file defining the standard LifeVibes types for use in the application layer  */
212c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/*  interface of all LifeVibes modules                                                  */
222c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/*                                                                                      */
232c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/****************************************************************************************/
242c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
252c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#ifndef LVM_TYPES_H
262c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_TYPES_H
272c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
282c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#ifdef __cplusplus
292c87e9c923b0362fabf8c97ff63997542394c428Eric Laurentextern "C" {
302c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#endif /* __cplusplus */
312c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
322c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
332c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/****************************************************************************************/
342c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/*                                                                                      */
352c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/*  definitions                                                                         */
362c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/*                                                                                      */
372c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/****************************************************************************************/
382c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
392c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_NULL                0                   /* NULL pointer */
402c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
412c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_TRUE                1                   /* Booleans */
422c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_FALSE               0
432c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
442c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_MAXINT_8            127                 /* Maximum positive integer size */
452c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_MAXINT_16           32767
462c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_MAXINT_32           2147483647
472c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_MAXENUM             2147483647
482c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
492c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_MODULEID_MASK       0xFF00              /* Mask to extract the calling module ID from callbackId */
502c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_EVENTID_MASK        0x00FF              /* Mask to extract the callback event from callbackId */
512c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
522c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/* Memory table*/
532c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_MEMREGION_PERSISTENT_SLOW_DATA      0   /* Offset to the instance memory region */
542c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_MEMREGION_PERSISTENT_FAST_DATA      1   /* Offset to the persistent data memory region */
552c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_MEMREGION_PERSISTENT_FAST_COEF      2   /* Offset to the persistent coefficient memory region */
562c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_MEMREGION_TEMPORARY_FAST            3   /* Offset to temporary memory region */
572c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
582c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_NR_MEMORY_REGIONS                   4   /* Number of memory regions */
592c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
602c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/* Memory partition type */
612c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_MEM_PARTITION0      0                   /* 1st memory partition */
622c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_MEM_PARTITION1      1                   /* 2nd memory partition */
632c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_MEM_PARTITION2      2                   /* 3rd memory partition */
642c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_MEM_PARTITION3      3                   /* 4th memory partition */
652c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
662c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/* Use type */
672c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_MEM_PERSISTENT      0                   /* Persistent memory type */
682c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_MEM_SCRATCH         4                   /* Scratch  memory type */
692c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
702c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/* Access type */
712c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_MEM_INTERNAL        0                   /* Internal (fast) access memory */
722c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_MEM_EXTERNAL        8                   /* External (slow) access memory */
732c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
742c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/* Platform specific */
752c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_PERSISTENT          LVM_MEM_PARTITION0+LVM_MEM_PERSISTENT+LVM_MEM_INTERNAL
762c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_PERSISTENT_DATA     LVM_MEM_PARTITION1+LVM_MEM_PERSISTENT+LVM_MEM_INTERNAL
772c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_PERSISTENT_COEF     LVM_MEM_PARTITION2+LVM_MEM_PERSISTENT+LVM_MEM_INTERNAL
782c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#define LVM_SCRATCH             LVM_MEM_PARTITION3+LVM_MEM_SCRATCH+LVM_MEM_INTERNAL
792c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
802c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/****************************************************************************************/
812c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/*                                                                                      */
822c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/*  Basic types                                                                         */
832c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/*                                                                                      */
842c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/****************************************************************************************/
852c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
862c87e9c923b0362fabf8c97ff63997542394c428Eric Laurenttypedef     char                LVM_CHAR;           /* ASCII character */
872c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
882c87e9c923b0362fabf8c97ff63997542394c428Eric Laurenttypedef     char                LVM_INT8;           /* Signed 8-bit word */
892c87e9c923b0362fabf8c97ff63997542394c428Eric Laurenttypedef     unsigned char       LVM_UINT8;          /* Unsigned 8-bit word */
902c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
912c87e9c923b0362fabf8c97ff63997542394c428Eric Laurenttypedef     short               LVM_INT16;          /* Signed 16-bit word */
922c87e9c923b0362fabf8c97ff63997542394c428Eric Laurenttypedef     unsigned short      LVM_UINT16;         /* Unsigned 16-bit word */
932c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
942c87e9c923b0362fabf8c97ff63997542394c428Eric Laurenttypedef     long                LVM_INT32;          /* Signed 32-bit word */
952c87e9c923b0362fabf8c97ff63997542394c428Eric Laurenttypedef     unsigned long       LVM_UINT32;         /* Unsigned 32-bit word */
962c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
972c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
982c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/****************************************************************************************/
992c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/*                                                                                      */
1002c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/*  Standard Enumerated types                                                           */
1012c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/*                                                                                      */
1022c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/****************************************************************************************/
1032c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
1042c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/* Operating mode */
1052c87e9c923b0362fabf8c97ff63997542394c428Eric Laurenttypedef enum
1062c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent{
1072c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    LVM_MODE_OFF    = 0,
1082c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    LVM_MODE_ON     = 1,
1092c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    LVM_MODE_DUMMY  = LVM_MAXENUM
1102c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent} LVM_Mode_en;
1112c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
1122c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
1132c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/* Format */
1142c87e9c923b0362fabf8c97ff63997542394c428Eric Laurenttypedef enum
1152c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent{
1162c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    LVM_STEREO          = 0,
1172c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    LVM_MONOINSTEREO    = 1,
1182c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    LVM_MONO            = 2,
1192c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    LVM_SOURCE_DUMMY    = LVM_MAXENUM
1202c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent} LVM_Format_en;
1212c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
1222c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
1232c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/* LVM sampling rates */
1242c87e9c923b0362fabf8c97ff63997542394c428Eric Laurenttypedef enum
1252c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent{
1262c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    LVM_FS_8000  = 0,
1272c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    LVM_FS_11025 = 1,
1282c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    LVM_FS_12000 = 2,
1292c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    LVM_FS_16000 = 3,
1302c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    LVM_FS_22050 = 4,
1312c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    LVM_FS_24000 = 5,
1322c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    LVM_FS_32000 = 6,
1332c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    LVM_FS_44100 = 7,
1342c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    LVM_FS_48000 = 8,
1352c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    LVM_FS_INVALID = LVM_MAXENUM-1,
1362c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    LVM_FS_DUMMY = LVM_MAXENUM
1372c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent} LVM_Fs_en;
1382c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
1392c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
1402c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/* Memory Types */
1412c87e9c923b0362fabf8c97ff63997542394c428Eric Laurenttypedef enum
1422c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent{
1432c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    LVM_PERSISTENT_SLOW_DATA    = LVM_MEMREGION_PERSISTENT_SLOW_DATA,
1442c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    LVM_PERSISTENT_FAST_DATA    = LVM_MEMREGION_PERSISTENT_FAST_DATA,
1452c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    LVM_PERSISTENT_FAST_COEF    = LVM_MEMREGION_PERSISTENT_FAST_COEF,
1462c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    LVM_TEMPORARY_FAST          = LVM_MEMREGION_TEMPORARY_FAST,
1472c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    LVM_MEMORYTYPE_DUMMY        = LVM_MAXENUM
1482c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent} LVM_MemoryTypes_en;
1492c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
1502c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
1512c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/* Memory region definition */
1522c87e9c923b0362fabf8c97ff63997542394c428Eric Laurenttypedef struct
1532c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent{
1542c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    LVM_UINT32                  Size;                   /* Region size in bytes */
1552c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    LVM_MemoryTypes_en          Type;                   /* Region type */
1562c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    void                        *pBaseAddress;          /* Pointer to the region base address */
1572c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent} LVM_MemoryRegion_st;
1582c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
1592c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
1602c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/* Memory table containing the region definitions */
1612c87e9c923b0362fabf8c97ff63997542394c428Eric Laurenttypedef struct
1622c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent{
1632c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent    LVM_MemoryRegion_st         Region[LVM_NR_MEMORY_REGIONS];  /* One definition for each region */
1642c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent} LVM_MemoryTable_st;
1652c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
1662c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
1672c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/****************************************************************************************/
1682c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/*                                                                                      */
1692c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/*  Standard Function Prototypes                                                        */
1702c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/*                                                                                      */
1712c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/****************************************************************************************/
1722c87e9c923b0362fabf8c97ff63997542394c428Eric Laurenttypedef LVM_INT32 (*LVM_Callback)(void          *pCallbackData,     /* Pointer to the callback data structure */
1732c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent                                  void          *pGeneralPurpose,   /* General purpose pointer (e.g. to a data structure needed in the callback) */
1742c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent                                  LVM_INT16     GeneralPurpose );   /* General purpose variable (e.g. to be used as callback ID) */
1752c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
1762c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
1772c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/****************************************************************************************/
1782c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/*                                                                                      */
1792c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/*  End of file                                                                         */
1802c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/*                                                                                      */
1812c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent/****************************************************************************************/
1822c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
1832c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#ifdef __cplusplus
1842c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent}
1852c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#endif /* __cplusplus */
1862c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent
1872c87e9c923b0362fabf8c97ff63997542394c428Eric Laurent#endif  /* LVM_TYPES_H */
188