Go to the documentation of this file.00001
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105 #ifndef HEAP_H_0x7033
00106 #define HEAP_H_0x7033
00107
00108
00109
00110 #include <ti/syslink/utils/MemoryDefs.h>
00111 #include <ti/syslink/utils/Trace.h>
00112
00113
00114 #if defined (__cplusplus)
00115 extern "C" {
00116 #endif
00117
00118
00119
00120
00121
00122
00126 typedef struct IHeap_Object_tag IHeap_Object;
00127
00131 typedef struct IHeap_Object * IHeap_Handle;
00132
00133
00134
00135
00136
00137
00139 typedef Ptr (*IHeap_allocFxn) (IHeap_Handle handle,
00140 SizeT size,
00141 SizeT align);
00142
00144 typedef Void (*IHeap_freeFxn) (IHeap_Handle handle,
00145 Ptr block,
00146 SizeT size);
00147
00149 typedef Void (*IHeap_getStatsFxn) (IHeap_Handle handle,
00150 Memory_Stats * stats);
00151
00152
00153
00154
00155
00156 typedef Bool (*IHeap_isBlockingFxn) (IHeap_Handle handle);
00157
00159 typedef Ptr (*IHeap_getKnlHandleFxn) (IHeap_Handle handle);
00160
00161
00162
00163
00164
00165
00169 struct IHeap_Object_tag {
00170 IHeap_allocFxn alloc;
00172 IHeap_freeFxn free;
00174 IHeap_getStatsFxn getStats;
00176 IHeap_isBlockingFxn isBlocking;
00178 IHeap_getKnlHandleFxn getKnlHandle;
00180 Ptr obj;
00182 };
00183
00184
00185
00186
00187
00188
00200 static inline Ptr IHeap_alloc (IHeap_Handle handle,
00201 SizeT size,
00202 SizeT align)
00203 {
00204 Ptr buffer;
00205
00206 GT_assert (curTrace, (((IHeap_Object *) handle)->alloc != NULL));
00207 buffer = ((IHeap_Object *) handle)->alloc (handle, size, align);
00208 return (buffer);
00209 }
00210
00211
00221 static inline Void IHeap_free (IHeap_Handle handle,
00222 Ptr block,
00223 SizeT size)
00224 {
00225 GT_assert (curTrace, (((IHeap_Object *) handle)->free != NULL));
00226 ((IHeap_Object *) handle)->free (handle, block, size);
00227 }
00228
00229
00238 static inline Void IHeap_getStats (IHeap_Handle handle,
00239 Memory_Stats * stats)
00240 {
00241 GT_assert (curTrace, (((IHeap_Object *) handle)->getStats != NULL));
00242 ((IHeap_Object *) handle)->getStats (handle, stats);
00243 }
00244
00245
00256 static inline Bool IHeap_isBlocking (IHeap_Handle handle)
00257 {
00258 Bool isBlocking;
00259 GT_assert (curTrace, (((IHeap_Object *) handle)->isBlocking != NULL));
00260 isBlocking = ((IHeap_Object *) handle)->isBlocking (handle);
00261 return (isBlocking);
00262 }
00263
00264
00276 static inline Ptr IHeap_getKnlHandle (IHeap_Handle handle)
00277 {
00278 Ptr knlHandle;
00279 GT_assert (curTrace, (((IHeap_Object *) handle)->getKnlHandle != NULL));
00280 knlHandle = ((IHeap_Object *) handle)->getKnlHandle (handle);
00281 return (knlHandle);
00282 }
00283
00284
00285 #if defined (__cplusplus)
00286 }
00287 #endif
00288
00289
00290 #endif
00291