1 #ifndef _UTOPIA_DAPI_H_ 2 #define _UTOPIA_DAPI_H_ 3 4 #include "MsTypes.h" 5 /* driver owners need not include this explicitly */ 6 #include "utopia_driver_id.h" 7 #include "MsCommon.h" 8 9 /* 10 * for develop: block on error 11 * for ut: don't block on error 12 */ 13 #define BLOCK_ON_ERROR 1 14 #if BLOCK_ON_ERROR 15 #define RET_OR_BLOCK(ret) MS_PANIC(0); return ret; /* fix compiling warning */ 16 #else 17 #define RET_OR_BLOCK(ret) return ret 18 #endif 19 20 /* print method */ 21 #if defined(ANDROID) 22 #include <cutils/log.h> 23 #define printu ALOGI 24 #elif defined(MSOS_TYPE_LINUX_KERNEL) 25 #define printu printk 26 #else 27 #define printu printf 28 #endif 29 30 /* 31 * type converter 32 */ 33 #define TO_MODULE_PTR(pTmp) ((UTOPIA_MODULE*)pTmp) 34 #define TO_MODULE_SHM_PTR(pTmp) ((UTOPIA_MODULE_SHM*)pTmp) 35 // FIXME: this macro doesn't consider synchronization problem, just for tmp use 36 #define MODULE_PTR_TO_RPOOL_PTR(pModule) \ 37 ((UTOPIA_RESOURCE_POOL*)shmid2va(pModule->psModuleShm->shmid_rpool_head.ID)) 38 39 #define TO_RESOURCE_PTR(pTmp) ((UTOPIA_RESOURCE*)pTmp) 40 // FIXME: this macro doesn't consider synchronization problem, just for tmp use 41 #define RESOURCE_PTR_TO_RPOOL_PTR(pResource) \ 42 ((UTOPIA_RESOURCE_POOL*)shmid2va(pResource->shmid_rpool.ID)) 43 44 #define TO_INSTANCE_PTR(pTmp) ((UTOPIA_INSTANCE*)pTmp) 45 #define TO_RPOOL_PTR(pTmp) ((UTOPIA_RESOURCE_POOL*)pTmp) 46 47 48 typedef enum{ 49 CMD_USIGNAL_PROCESS_KILL =(int) 0xFFFF0001, 50 }UTOPIA_SYSYEM_IOCTL; 51 52 typedef enum{ 53 MDBCMD_CMDLINE = 0x0, 54 MDBCMD_GETINFO 55 }UTOPIA_MDBCMD; 56 57 typedef enum{ 58 MDBRESULT_SUCCESS_FIN = 0x0, 59 MDBRESULT_SUCCESS_NOT_FIN, 60 MDBRESULT_NOT_AVALIBALE 61 }UTOPIA_MDBRESULT; 62 63 #define MDB_NODE_NAME_MAX 32 64 #define MDB_CMDLINE_MAX 255 65 #define MDB_FPIOCTL_LIST_MAX 128 66 typedef struct 67 { 68 MS_U64* u64ReqHdl; 69 MS_U32 u32CmdSize; 70 char pcCmdLine[MDB_CMDLINE_MAX]; 71 UTOPIA_MDBRESULT result; 72 } MDBCMD_CMDLINE_PARAMETER; 73 74 typedef struct 75 { 76 MS_U64* u64ReqHdl; 77 UTOPIA_MDBRESULT result; 78 } MDBCMD_GETINFO_PARAMETER; 79 80 /* 81 * instance functions 82 */ 83 MS_U32 UtopiaInstanceCreate(MS_U32 u32PrivateSize, void** ppInstance); 84 MS_U32 UtopiaInstanceDelete(void* pInstant); 85 MS_U32 UtopiaInstanceGetPrivate(void* pInstance, void** ppPrivate); 86 MS_U32 UtopiaInstanceGetModule(void* pInstance, void** ppModule); 87 /* We hope, we can support poly, ex: JPD and JPD3D as different Module */ 88 MS_U32 UtopiaInstanceGetModuleID(void* pInstance, MS_U32* pu32ModuleID); 89 /* We hope, we can support poly, ex: JPD and JPD3D as different Module */ 90 MS_U32 UtopiaInstanceGetModuleVersion(void* pInstant, MS_U32* pu32Version); 91 /* We hope we can support interface version mantain */ 92 MS_U32 UtopiaInstanceGetAppRequiredModuleVersion(void* pInstance, 93 MS_U32* pu32ModuleVersion); 94 MS_U32 UtopiaInstanceGetPid(void* pInstance); 95 96 /* 97 * module functions 98 */ 99 MS_U32 UtopiaModuleCreate(MS_U32 u32ModuleID, 100 MS_U32 u32PrivateSize, void** ppModule); 101 MS_U32 UtopiaModuleGetPrivate(void* pModule, void** ppPrivate); 102 MS_U32 UtopiaModuleSetSTRPrivate(void* pModule, MS_U32 u32STRPrivateSize); 103 MS_U32 UtopiaModuleGetSTRPrivate(void* pModule, void** ppPrivate); 104 MS_U32 UtopiaModuleRegister(void* pModule); 105 #ifdef CONFIG_UTOPIA_PROC_DBG_SUPPORT 106 MS_U32 UtopiaModuleRegisterMdbNode(char sMdbNodeName[MDB_NODE_NAME_MAX], FUtopiaMdbIoctl fpMdbIoctl); 107 MS_U32 UtopiaCreateMdbNode(void); 108 void* UtopiaModuleGetLocalInstantList(MS_U32 u32ModuleID, void* pLastInstance); 109 #endif 110 MS_U32 UtopiaModuleSetupFunctionPtr(void* pModule, FUtopiaOpen fpOpen, 111 FUtopiaClose fpClose, FUtopiaIOctl fpIoctl); 112 MS_U32 UtopiaModuleSetupSTRFunctionPtr(void* pModuleTmp, FUtopiaSTR fpSTR); 113 MS_U32 UtopiaModuleSuspend(void); 114 MS_U32 UtopiaModuleResume(void); 115 MS_U32 UtopiaModuleSetVersion(void* pModule, MS_U32 u32Version); 116 MS_U32 UtopiaModuleGetDebugLevel(void* pInstance, MS_U32* pu32DebugLevel); 117 MS_U32 UtopiaModuleGetPtr(MS_U32 u32ModuleID, void** ppModule); 118 119 MS_U32 UtopiaModuleQueryMode(MS_U32 u32ModuleID); 120 121 122 /* 123 * resource functions 124 */ 125 MS_U32 UtopiaResourceCreate(char* u8ResourceName, 126 MS_U32 u32PrivateSize, void** ppResource); 127 MS_U32 UtopiaResourceGetPrivate(void* pResource, void** ppPrivate); 128 MS_U32 UtopiaResourceRegister(void* pModule, void* pResouce, MS_U32 u32PoolID); 129 MS_U32 UtopiaResourceObtain(void* pInstant, 130 MS_U32 u32PoolID, void** ppResource); 131 MS_U32 UtopiaResourceTryObtain(void* pInstant, 132 MS_U32 u32PoolID, void** ppResource); 133 MS_U32 UtopiaResourceRelease(void* pResource); 134 MS_U32 UtopiaResourceGetPid(void* pResource); 135 MS_U32 UtopiaResourceGetNext(void* pModTmp, void** ppResource); 136 137 MS_U32 UtopiaModuleAddResourceStart(void* psModule, MS_U32 u32PoolID); 138 MS_U32 UtopiaModuleAddResourceEnd(void* psModule, MS_U32 u32PoolID); 139 MS_U32 UtopiaModuleResetPool(void* pModuleTmp, MS_U32 u32RPoolID); 140 141 MS_U32 UtopiaStrWaitCondition(const char* u8ModuleName, MS_U32 u32Mode, MS_U32 u32Stage); 142 MS_U32 UtopiaStrSendCondition(const char* u8ModuleName, MS_U32 u32Mode, MS_U32 u32Stage); 143 144 MS_U32 UtopiaStrSetData(char *key, char *value); 145 MS_U32 UtopiaStrGetData(char *key, char *value); 146 147 #endif /* _UTOPIA_DAPI_H_ */ 148