00001 /* 00002 Bullet Continuous Collision Detection and Physics Library 00003 Copyright (c) 2003-2007 Erwin Coumans http://bulletphysics.com 00004 00005 This software is provided 'as-is', without any express or implied warranty. 00006 In no event will the authors be held liable for any damages arising from the use of this software. 00007 Permission is granted to anyone to use this software for any purpose, 00008 including commercial applications, and to alter it and redistribute it freely, 00009 subject to the following restrictions: 00010 00011 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 00012 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 00013 3. This notice may not be removed or altered from any source distribution. 00014 */ 00015 00016 #ifndef BT_THREAD_SUPPORT_INTERFACE_H 00017 #define BT_THREAD_SUPPORT_INTERFACE_H 00018 00019 00020 #include <LinearMath/btScalar.h> //for ATTRIBUTE_ALIGNED16 00021 #include "PlatformDefinitions.h" 00022 #include "PpuAddressSpace.h" 00023 00024 class btBarrier { 00025 public: 00026 btBarrier() {} 00027 virtual ~btBarrier() {} 00028 00029 virtual void sync() = 0; 00030 virtual void setMaxCount(int n) = 0; 00031 virtual int getMaxCount() = 0; 00032 }; 00033 00034 class btCriticalSection { 00035 public: 00036 btCriticalSection() {} 00037 virtual ~btCriticalSection() {} 00038 00039 ATTRIBUTE_ALIGNED16(unsigned int mCommonBuff[32]); 00040 00041 virtual unsigned int getSharedParam(int i) = 0; 00042 virtual void setSharedParam(int i,unsigned int p) = 0; 00043 00044 virtual void lock() = 0; 00045 virtual void unlock() = 0; 00046 }; 00047 00048 00049 class btThreadSupportInterface 00050 { 00051 public: 00052 00053 virtual ~btThreadSupportInterface(); 00054 00056 virtual void sendRequest(uint32_t uiCommand, ppu_address_t uiArgument0, uint32_t uiArgument1) =0; 00057 00059 virtual void waitForResponse(unsigned int *puiArgument0, unsigned int *puiArgument1) =0; 00060 00061 00064 00066 virtual void startSPU() =0; 00067 00069 virtual void stopSPU()=0; 00070 00072 virtual void setNumTasks(int numTasks)=0; 00073 00074 virtual int getNumTasks() const = 0; 00075 00076 virtual btBarrier* createBarrier() = 0; 00077 00078 virtual btCriticalSection* createCriticalSection() = 0; 00079 00080 virtual void deleteBarrier(btBarrier* barrier)=0; 00081 00082 virtual void deleteCriticalSection(btCriticalSection* criticalSection)=0; 00083 00084 virtual void* getThreadLocalMemory(int taskId) { return 0; } 00085 00086 }; 00087 00088 #endif //BT_THREAD_SUPPORT_INTERFACE_H 00089