1 //***************************************************************************** 2 //THIS is only for utopia_core internal use only!!!! 3 //***************************************************************************** 4 #ifndef _UTOPIA_CORE_H_ 5 #define _UTOPIA_CORE_H_ 6 7 #include "MsTypes.h" 8 #include "utopia_dapi.h" 9 #if defined(CONFIG_COMPAT) 10 #include <linux/compat.h> 11 #endif 12 13 #ifdef MSOS_TYPE_ECOS 14 #include "sys/types.h" 15 #endif 16 17 typedef struct _UTOPIA_SHM_ID UTOPIA_SHM_ID; 18 typedef struct _UTOPIA_TIME_STAMP UTOPIA_TIME_STAMP; 19 typedef struct _UTOPIA_RESOURCE UTOPIA_RESOURCE; 20 typedef struct _UTOPIA_RESOURCE_POOL UTOPIA_RESOURCE_POOL; 21 typedef struct _UTOPIA_MODULE_SHM UTOPIA_MODULE_SHM; 22 typedef struct _UTOPIA_MODULE UTOPIA_MODULE; 23 typedef struct _UTOPIA_INSTANCE UTOPIA_INSTANCE; 24 typedef struct _UTOPIA_PRIVATE UTOPIA_PRIVATE; 25 typedef struct _UTOPIA_MODULE_STR_LIST UTOPIA_MODULE_STR_LIST; 26 27 typedef struct _UTOPIA_USER_INSTANCE UTOPIA_USER_INSTANCE; 28 typedef struct _UTOPIA_DDI_OPEN_ARG UTOPIA_DDI_OPEN_ARG; 29 typedef struct _UTOPIA_DDI_IOCTL_ARG UTOPIA_DDI_IOCTL_ARG; 30 typedef struct _UTOPIA_PID_LIST UTOPIA_PID_LIST; 31 typedef struct _UTOPIA_AUTH_IPCHECK_ARG UTOPIA_AUTH_IPCHECK_ARG; 32 typedef struct _UTOPIA_AUTH_HASHINFO_ARG UTOPIA_AUTH_HASHINFO_ARG; 33 34 #if defined(CONFIG_COMPAT) 35 typedef struct _UTOPIA_USER_INSTANCE_32 UTOPIA_USER_INSTANCE_32; 36 typedef struct _UTOPIA_DDI_OPEN_ARG_32 UTOPIA_DDI_OPEN_ARG_32; 37 typedef struct _UTOPIA_DDI_IOCTL_ARG_32 UTOPIA_DDI_IOCTL_ARG_32; 38 #endif 39 40 #define UTOPIA_SEM_NAME_SIZE 50 41 #define UTOPIA_RESOURCE_NO_OCCUPY 0 42 #define INSTANCE_MAX 100 43 #define PROCESS_MAX 100 44 45 struct _UTOPIA_SHM_ID 46 { 47 char name[UTOPIA_SEM_NAME_SIZE]; 48 MS_U32 ID; 49 }; 50 51 struct _UTOPIA_TIME_STAMP 52 { 53 MS_U32 u32Time; 54 MS_U32 u32Owner; 55 }; 56 57 struct _UTOPIA_RESOURCE 58 { 59 UTOPIA_SHM_ID shmid_private; 60 UTOPIA_SHM_ID shmid_next_resource; 61 UTOPIA_SHM_ID shmid_self; 62 UTOPIA_SHM_ID shmid_rpool; 63 UTOPIA_TIME_STAMP sLastAccess; 64 MS_U32 u32OccupyInstantPrt; 65 MS_BOOL bInUse; 66 MS_U32 u32Pid; 67 }; 68 69 struct _UTOPIA_RESOURCE_POOL 70 { 71 UTOPIA_SHM_ID shmid_next_rpool; 72 UTOPIA_SHM_ID shmid_resource_head; 73 UTOPIA_SHM_ID shmid_self; 74 MS_U32 u32ResourceTotal; 75 MS_U32 u32ResourceAvail; 76 MS_U32 u32PoolID; 77 MS_U32 u32ResourcesSemaphore;//semaphore for all resource in this pool 78 MS_U32 u32MutexID; 79 }; 80 81 struct _UTOPIA_MODULE_SHM 82 { 83 UTOPIA_SHM_ID shmid_self; 84 UTOPIA_SHM_ID shmid_rpool_head; 85 UTOPIA_TIME_STAMP sLastAccess; 86 MS_U32 u32ResourcePoolTotal; 87 }; 88 89 struct _UTOPIA_MODULE 90 { 91 UTOPIA_SHM_ID shmid_private; 92 MS_U32 u32ModuleID; 93 UTOPIA_MODULE* psNext; 94 UTOPIA_MODULE_SHM* psModuleShm; 95 FUtopiaOpen fpOpen; 96 FUtopiaClose fpClose; 97 FUtopiaIOctl fpIoctl; 98 UTOPIA_RESOURCE* psResource; 99 MS_U32 u32Version; 100 MS_U32 u32DeviceDebugLevel; //bit31 for MS_UTOPIA_DB_LEVEL_TRACE, other bit for user define 101 UTOPIA_SHM_ID shmid_str; 102 FUtopiaSTR fpSTR; 103 }; 104 105 struct _UTOPIA_INSTANCE 106 { 107 void* pPrivate; 108 UTOPIA_INSTANCE* psNext; 109 MS_U32 u32LastAccessTime; 110 MS_U32 u32OpenThreadName[10]; 111 UTOPIA_MODULE* psModule; 112 UTOPIA_RESOURCE* psResource; 113 MS_U32 u32ModuleVersion; 114 MS_U32 u32AppRequireModuleVersion; 115 MS_U32 u32Pid; 116 }; 117 118 struct _UTOPIA_PRIVATE 119 { 120 UTOPIA_MODULE* psModuleHead;//point to share memory 121 UTOPIA_INSTANCE* psUtopiaInstantHead;//point to normal memory 122 MS_U32 u32MutexID; 123 }; 124 125 struct _UTOPIA_MODULE_STR_LIST 126 { 127 FUtopiaSTR fpSTR; 128 void* pModule; 129 struct _UTOPIA_MODULE_STR_LIST* next; 130 }; 131 132 struct _UTOPIA_USER_INSTANCE 133 { 134 void* psUtopiaInstant; 135 MS_S32 s32Fd; 136 MS_U32 u32KernelSpaceIdentify; 137 MS_U32 u32ModuleID; 138 }; 139 140 141 struct _UTOPIA_DDI_OPEN_ARG 142 { 143 MS_U32 u32ModuleID; 144 MS_U32 u32ModuleVersion; 145 void* pAttribute; 146 }; 147 148 struct _UTOPIA_DDI_IOCTL_ARG 149 { 150 MS_U32 u32Cmd; 151 void* pArg; 152 }; 153 154 struct _UTOPIA_AUTH_IPCHECK_ARG 155 { 156 MS_U32 u32ShmID; 157 MS_U32 u32ClientCounter; 158 MS_U8 u8IpControl[32]; 159 }; 160 161 struct _UTOPIA_PID_LIST 162 { 163 pid_t pid; 164 void* instance_list[INSTANCE_MAX]; 165 int instance_count; 166 UTOPIA_PID_LIST* pNext; 167 }; 168 169 struct _UTOPIA_AUTH_HASHINFO_ARG 170 { 171 MS_U8 u8CusID[2]; 172 MS_U8 u8CusHash[16]; 173 }; 174 175 #if defined(CONFIG_COMPAT) 176 struct _UTOPIA_USER_INSTANCE_32 177 { 178 compat_uptr_t psUtopiaInstant; 179 compat_int_t s32Fd; 180 compat_uint_t u32KernelSpaceIdentify; 181 compat_uint_t u32ModuleID; 182 }; 183 184 185 struct _UTOPIA_DDI_OPEN_ARG_32 186 { 187 compat_uint_t u32ModuleID; 188 compat_uint_t u32ModuleVersion; 189 compat_uptr_t pAttribute; 190 }; 191 192 struct _UTOPIA_DDI_IOCTL_ARG_32 193 { 194 compat_uint_t u32Cmd; 195 compat_uptr_t pArg; 196 }; 197 198 typedef struct 199 { 200 compat_uint_t u32Addr; 201 compat_uint_t u32Size; 202 compat_uint_t u32Interval; 203 unsigned char u8MiuSel; 204 compat_uint_t bcached; 205 } KDrvMPool_Info_t_ARG_32; 206 207 #endif 208 209 #ifdef CONFIG_UTOPIA_PROC_DBG_SUPPORT 210 void mdb_node_create_table(char sMdbNodeName[MDB_NODE_NAME_MAX], FUtopiaMdbIoctl fpMdbIoctl); 211 void mdb_node_create(void); 212 #endif 213 214 #ifndef MSOS_TYPE_LINUX_KERNEL 215 #define PUMA_BOOT 1 216 #if 1//PUMA_BOOT 217 #define MAX_FILE_NUM 200 218 #define BLOCK_SIZE 64 219 #define BLOCK_CONTACT_SIZE BLOCK_SIZE-4 220 #define END_OF_BLOCK_LINKLIST 0xFFFFFFFF 221 #define HIBERNATE_NAME_SIZE 30 222 223 224 225 typedef struct _UTOPIA_HIBERNATE_HEADER UTOPIA_HIBERNATE_HEADER; 226 typedef struct _UTOPIA_HIBERNATE_BLOCK UTOPIA_HIBERNATE_BLOCK; 227 228 229 struct _UTOPIA_HIBERNATE_HEADER 230 { 231 MS_U32 u32HibernateFileExist; 232 char HibernateName[HIBERNATE_NAME_SIZE]; 233 MS_U32 u32FileSize; 234 MS_U32 u32FirstBlock; 235 MS_U32 bUSE; 236 }; 237 238 struct _UTOPIA_HIBERNATE_BLOCK 239 { 240 MS_U8 u8File[BLOCK_CONTACT_SIZE]; 241 MS_U32 u32NextBlock; 242 }; 243 244 245 #endif 246 #endif //#ifndef MSOS_TYPE_LINUX_KERNEL 247 248 249 #endif 250