00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00053 #ifndef ti_sdo_winceutils_cmem_CMEM_H
00054 #define ti_sdo_winceutils_cmem_CMEM_H
00055
00056 #include <windows.h>
00057
00058 #if defined (__cplusplus)
00059 extern "C" {
00060 #endif
00061
00064
00065 #define CMEM_VERSION 0x02200000U
00066
00067
00068 #define CMEM_WB 0x0100
00069 #define CMEM_INV 0x0200
00070 #define CMEM_HEAP 0x0400
00071 #define CMEM_POOL 0x0000
00072 #define CMEM_CACHED 0x0800
00073 #define CMEM_NONCACHED 0x0000
00074 #define CMEM_PHYS 0x1000
00075
00076
00077 #define CMEM_IOCALLOC 1
00078 #define CMEM_IOCALLOCHEAP 2
00079 #define CMEM_IOCFREE 3
00080 #define CMEM_IOCGETPHYS 4
00081 #define CMEM_IOCGETSIZE 5
00082 #define CMEM_IOCGETPOOL 6
00083 #define CMEM_IOCCACHE 7
00084 #define CMEM_IOCGETVERSION 8
00085 #define CMEM_IOCGETBLOCK 9
00086
00087
00088
00089
00090
00091
00092 #define CMEM_IOCCACHEWBINV CMEM_IOCCACHE | CMEM_WB | CMEM_INV
00093 #define CMEM_IOCCACHEWB CMEM_IOCCACHE | CMEM_WB
00094 #define CMEM_IOCCACHEINV CMEM_IOCCACHE | CMEM_INV
00095 #define CMEM_IOCALLOCCACHED CMEM_IOCALLOC | CMEM_CACHED
00096 #define CMEM_IOCALLOCHEAPCACHED CMEM_IOCALLOCHEAP | CMEM_CACHED
00097 #define CMEM_IOCFREEHEAP CMEM_IOCFREE | CMEM_HEAP
00098 #define CMEM_IOCFREEPHYS CMEM_IOCFREE | CMEM_PHYS
00099 #define CMEM_IOCFREEHEAPPHYS CMEM_IOCFREE | CMEM_HEAP | CMEM_PHYS
00100
00101 #define CMEM_IOCCMDMASK 0x000000ff
00102
00107 typedef struct CMEM_AllocParams {
00108 int type;
00109 int flags;
00110 size_t alignment;
00113 } CMEM_AllocParams;
00114
00115 extern CMEM_AllocParams CMEM_DEFAULTPARAMS;
00116
00117 typedef struct CMEM_BlockAttrs {
00118 unsigned long phys_base;
00119 size_t size;
00120 } CMEM_BlockAttrs;
00121
00126 union CMEM_AllocUnion {
00127 struct {
00128 size_t size;
00129 size_t align;
00130 int blockid;
00131 DWORD dwProcId;
00132 } alloc_heap_inparams;
00133 struct {
00134 int poolid;
00135 int blockid;
00136 DWORD dwProcId;
00137 } alloc_pool_inparams;
00138 struct {
00139 int poolid;
00140 int blockid;
00141 } get_size_inparams;
00142 struct {
00143 size_t size;
00144 int blockid;
00145 } get_pool_inparams;
00146 struct {
00147 unsigned long physp;
00148 unsigned long virtp;
00149 size_t size;
00150 } alloc_pool_outparams;
00151 struct {
00152 unsigned long physp;
00153 size_t size;
00154 } get_block_outparams;
00155 struct {
00156 int poolid;
00157 size_t size;
00158 } free_outparams;
00159 unsigned long physp;
00160 unsigned long virtp;
00161 int size;
00162 int poolid;
00163 int blockid;
00164 };
00165
00175 int CMEM_init(void);
00176
00192 int CMEM_getPool(size_t size);
00193
00210 int CMEM_getPool2(int blockid, size_t size);
00211
00231 void *CMEM_allocPool(int poolid, CMEM_AllocParams *params);
00232
00253 void *CMEM_allocPool2(int blockid, int poolid, CMEM_AllocParams *params);
00254
00277 void *CMEM_alloc(size_t size, CMEM_AllocParams *params);
00278
00303 void *CMEM_alloc2(int blockid, size_t size, CMEM_AllocParams *params);
00304
00325 int CMEM_free(void *ptr, CMEM_AllocParams *params);
00326
00336 unsigned long CMEM_getPhys(void *ptr);
00337
00351 int CMEM_cacheWb(void *ptr, size_t size);
00352
00366 int CMEM_cacheInv(void *ptr, size_t size);
00367
00382 int CMEM_cacheWbInv(void *ptr, size_t size);
00383
00391 int CMEM_getVersion(void);
00392
00406 int CMEM_getBlock(unsigned long *pphys_base, size_t *psize);
00407
00422 int CMEM_getBlockAttrs(int blockid, CMEM_BlockAttrs *pattrs);
00423
00436 int CMEM_exit(void);
00437
00440 #if defined (__cplusplus)
00441 }
00442 #endif
00443
00444 #endif
00445
00446
00447
00448