4 #include <binder/Parcel.h>
5 #include "BnAndroidShm.h"
7 #include <binder/MemoryHeapBase.h>
9 #include "android/Shm.h" //android extension of shm.h
13 class AndroidShm
: public BnAndroidShm
15 #define MAX_SHARED_MEMORY_COUNT 257
17 int MemAlloc(unsigned int size
);
20 virtual ~AndroidShm();
21 static int instantiate();
22 virtual int sendCommand(const char* command
);
23 virtual int allocShm(const int size
); // if negative return value is error
24 virtual int removeShm(const unsigned int index
); // shared memory Á¦°Å
25 virtual int isAllocated(const unsigned int index
); // allocated ¿©ºÎ È®ÀÎ
26 virtual int setRegistryIndex(const unsigned int index
);
27 virtual int getRegistryIndex();
28 virtual sp
<IMemoryHeap
> InitSemaphore(const char* name
);
29 virtual sp
<IMemoryHeap
> getBuffer(int index
);
30 //virtual status_t onTransact(
32 // const Parcel& data,
37 int testGetBufferByNewProcess();
40 sp
<MemoryHeapBase
> mMemHeap
[MAX_SHARED_MEMORY_COUNT
];
41 unsigned int mRegistryIndex
;
43 // for named semaphore simulation
44 #define MAX_SEMAPHORE_MEMORY_COUNT 300
45 #define MAX_SEMAPHORE_NAME_LENGTH 300
46 sp
<MemoryHeapBase
> mSemaphore
[MAX_SEMAPHORE_MEMORY_COUNT
];
47 char mSemaphoreName
[MAX_SEMAPHORE_MEMORY_COUNT
][MAX_SEMAPHORE_NAME_LENGTH
];