WL865E4-P  36.07.001
m2mb_heap.h
Go to the documentation of this file.
1 /*===============================================================================================*/
2 /* >>> Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. <<< */
23 #ifndef M2MB_HEAP_API_H
24 #define M2MB_HEAP_API_H
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 
30 //#define M2MB_HEAP_DEBUG
31 #ifdef M2MB_HEAP_DEBUG
32 #define MALLOC(len) m2mb_heap_malloc(len, __FILE__, __LINE__)
33 #define REALLOC(ptr,len) m2mb_heap_realloc(ptr, len, __FILE__, __LINE__)
34 #define FREE(ptr) m2mb_heap_free(ptr, __FILE__, __LINE__)
35 #else
36 #define MALLOC(len) malloc(len)
37 #define FREE(ptr) free(ptr)
38 #define REALLOC(ptr,len) realloc(ptr,len)
39 #endif
40 
53 /*-----------------------------------------------------------------------------------------------*/
54 
59 /*-----------------------------------------------------------------------------------------------*/
60 #include <stdlib.h>
61 
62 /* Global defines ==============================================================================*/
63 
64 /* Global typedefs ==========================================================================*/
72 typedef struct M2MB_ALLOC_NODE_DATA
73 {
81 
82 
83 /* Global functions =========================================================*/
84 /*---------------------------------------------------------------------------*/
116 /*---------------------------------------------------------------------------*/
117 void *m2mb_heap_malloc(UINT32 reqBytes, char *file, int line);
118 
119 /*---------------------------------------------------------------------------*/
156 /*---------------------------------------------------------------------------*/
157 void *m2mb_heap_realloc(void *ptr, UINT32 reqBytes, char *file, int line);
158 
159 /*---------------------------------------------------------------------------*/
193 /*---------------------------------------------------------------------------*/
194 void m2mb_heap_free(void *ptr, char *file, int line);
195 
196 /*---------------------------------------------------------------------------*/
223 /*---------------------------------------------------------------------------*/
225 
226 /*---------------------------------------------------------------------------*/
257 /*---------------------------------------------------------------------------*/
259 
260 /*---------------------------------------------------------------------------*/
288 /*---------------------------------------------------------------------------*/
290 
291 /*---------------------------------------------------------------------------*/
325 /*---------------------------------------------------------------------------*/
327 
328 /*---------------------------------------------------------------------------*/
362 /*---------------------------------------------------------------------------*/
363 INT32 m2mb_heap_stat( UINT32 *total_bytes, UINT32 *free_bytes );
364 
368 /*-----------------------------------------------------------------------------------------------*/
369 
370 
371 #ifdef __cplusplus
372 }
373 #endif
374 #endif
unsigned char UINT8
Definition: m2mb_types.h:83
VOID m2mb_heap_resetTrace()
m2mb_heap_resetTrace resets the current node in the list as the trace node.
VOID m2mb_heap_log_init()
m2mb_heap_log_init is called to initialize the heap allocation list.
UINT32 m2mb_heap_getSize(UINT8 *ptr)
m2mb_heap_getSize returns the size of current node data in bytes.
void * m2mb_heap_malloc(UINT32 reqBytes, char *file, int line)
m2mb_heap_malloc allocates the memory for requested bytes(size) along with 20 bytes for M2MB_HEAP_ALL...
Structure for node data.
Definition: m2mb_heap.h:72
void m2mb_heap_free(void *ptr, char *file, int line)
m2mb_heap_free is called to frees the memory pointed by ptr.
M2MB_HEAP_ALLOC_NODE_DATA_T * m2mb_heap_getList(VOID)
m2mb_heap_getList is called to get the pointer to the current node in the M2MB_HEAP_LOG_LIST_T.
unsigned short UINT16
Definition: m2mb_types.h:84
unsigned long int UINT32
Definition: m2mb_types.h:85
INT32 m2mb_heap_stat(UINT32 *total_bytes, UINT32 *free_bytes)
m2mb_heap_stat is called to get the status.
void VOID
Definition: m2mb_types.h:72
signed int INT32
Definition: m2mb_types.h:80
void * m2mb_heap_realloc(void *ptr, UINT32 reqBytes, char *file, int line)
m2mb_heap_realloc is called to reallocate the memory of size reqBytes pointed by pointer ptr...
struct M2MB_ALLOC_NODE_DATA M2MB_HEAP_ALLOC_NODE_DATA_T
Structure for node data.