00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef _SUPPORT_SUPPORTMISC_H_
00014 #define _SUPPORT_SUPPORTMISC_H_
00015
00016 #include <support/SupportDefs.h>
00017 #include <support/IBinder.h>
00018 #include <support/IMemory.h>
00019 #include <support/KeyedVector.h>
00020 #include <support/Locker.h>
00021
00022 #include <support/StaticValue.h>
00023
00024
00025 #include <support_p/ValueMapFormat.h>
00026
00027 #include <stdlib.h>
00028 #include <string.h>
00029
00030 #if TARGET_HOST == TARGET_HOST_PALMOS
00031 #include <Kernel.h>
00032 #endif
00033
00034 #include <SysThreadConcealed.h>
00035
00036 #if _SUPPORTS_NAMESPACE
00037 namespace palmos {
00038 namespace support {
00039 #endif
00040
00041 enum {
00042 kPackedSmallAtomType = B_PACK_SMALL_TYPE(B_ATOM_TYPE, sizeof(void*)),
00043 kPackedSmallAtomWeakType = B_PACK_SMALL_TYPE(B_ATOM_WEAK_TYPE, sizeof(void*)),
00044 kPackedSmallBinderType = B_PACK_SMALL_TYPE(B_BINDER_TYPE, sizeof(void*)),
00045 kPackedSmallBinderWeakType = B_PACK_SMALL_TYPE(B_BINDER_WEAK_TYPE, sizeof(void*)),
00046 kPackedSmallBinderHandleType = B_PACK_SMALL_TYPE(B_BINDER_HANDLE_TYPE, sizeof(void*)),
00047 kPackedSmallBinderWeakHandleType = B_PACK_SMALL_TYPE(B_BINDER_WEAK_HANDLE_TYPE, sizeof(void*)),
00048 };
00049
00050
00051 #if (defined(__GNUC__) && (__GNUC__ < 3) && !defined(__CC_ARM))
00052 #define DECLARE_RETURN(x) return x
00053 #else
00054 #define DECLARE_RETURN(x)
00055 #endif
00056
00057
00058 #if !LIBBE_BOOTSTRAP
00059 void __initialize_looper(void);
00060 void __stop_looper(void);
00061 void __terminate_looper(void);
00062 #endif
00063
00064
00065 void dbg_init_gehnaphore(volatile int32_t* value);
00066 void dbg_lock_gehnaphore(volatile int32_t* value);
00067 void dbg_unlock_gehnaphore(volatile int32_t* value);
00068
00069
00070 typedef void (*binder_cleanup_func)();
00071 void add_binder_cleanup_func(binder_cleanup_func func);
00072 void rem_binder_cleanup_func(binder_cleanup_func func);
00073 void call_binder_cleanup_funcs();
00074
00075
00076 void enable_thread_syslog();
00077 void disable_thread_syslog();
00078 extern int32_t g_syslogTLS;
00079
00080
00081
00082
00083
00084
00085
00086 void acquire_object(const small_flat_data& obj, const void* who);
00087 void release_object(const small_flat_data& obj, const void* who);
00088
00089 #if defined(SUPPORTS_ATOM_DEBUG) && SUPPORTS_ATOM_DEBUG
00090 void rename_object(const small_flat_data& obj, const void* newWho, const void* oldWho);
00091 #else
00092 inline void rename_object(const small_flat_data&, const void*, const void*) { }
00093 #endif
00094
00095 void flatten_binder(const sptr<IBinder>& binder, small_flat_data* out);
00096 void flatten_binder(const wptr<IBinder>& binder, small_flat_data* out);
00097 status_t unflatten_binder(const small_flat_data& flat, sptr<IBinder>* out);
00098 status_t unflatten_binder(const small_flat_data& flat, wptr<IBinder>* out);
00099
00100
00101
00102
00103
00104
00105 struct flat_binder_object;
00106
00107
00108 void acquire_object(const flat_binder_object& obj, const void* who);
00109 void release_object(const flat_binder_object& obj, const void* who);
00110
00111 void flatten_binder(const sptr<IBinder>& binder, flat_binder_object* out);
00112 void flatten_binder(const wptr<IBinder>& binder, flat_binder_object* out);
00113 status_t unflatten_binder(const flat_binder_object& flat, sptr<IBinder>* out);
00114 status_t unflatten_binder(const flat_binder_object& flat, wptr<IBinder>* out);
00115
00116
00117
00118
00119
00120 struct area_translation_info
00121 {
00122 sptr<IMemoryHeap> heap;
00123 int32_t count;
00124 };
00125
00126 #if _SUPPORTS_NAMESPACE
00127 } }
00128 #endif
00129
00130 #if _SUPPORTS_NAMESPACE
00131 namespace palmos {
00132 namespace osp {
00133 using namespace palmos::support;
00134 #endif
00135
00136 extern SKeyedVector<sptr<IBinder>, area_translation_info> gAreaTranslationCache;
00137 extern SLocker gAreaTranslationLock;
00138
00139 #if _SUPPORTS_NAMESPACE
00140 } }
00141 #endif
00142
00143
00144 #if _SUPPORTS_NAMESPACE
00145 namespace palmos {
00146 namespace support {
00147 #endif
00148
00149 void __terminate_shared_buffer(void);
00150
00151
00152 extern SLocker g_parcel_pool_lock;
00153
00154 struct parcel_pool_cleanup {
00155 parcel_pool_cleanup();
00156 ~parcel_pool_cleanup();
00157 };
00158 extern parcel_pool_cleanup g_parcel_pool_cleanup;
00159
00160 extern sysThreadDirectFuncs g_threadDirectFuncs;
00161
00162 #if _SUPPORTS_NAMESPACE
00163 } }
00164 #endif
00165
00166 #endif