• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ====================================================================
2 *             Texas Instruments OMAP(TM) Platform Software
3 * (c) Copyright Texas Instruments, Incorporated. All Rights Reserved.
4 *
5 * Use of this software is controlled by the terms and conditions found
6 * in the license agreement under which this software has been supplied.
7 * ==================================================================== */
8 
9 #ifndef OMX_DEBUGMEM_H
10 #define OMX_DEBUGMEM_H
11 
12 #include <stdlib.h> // for size_t
13 
14 #if OMX_DEBUG
15 void* OMX_DebugMem_calloc(size_t num, size_t size,
16                            const char* file, const char* func, int line);
17 void* OMX_DebugMem_malloc(size_t size,
18                            const char* file, const char* func, int line);
19 void* OMX_DebugMem_realloc(void *ptr, size_t size,
20                            const char* file, const char* func, int line);
21 void  OMX_DebugMem_free(void* ptr,
22                          const char* file, const char* func, int line);
23 int   OMX_DebugMem_validate(void *ptr,
24                          const char* file, const char* func, int line);
25 
26 void OMX_DebugMem_dump(const char *file, const char *func, int line);
27 #endif
28 
29 #define OMX_MASK_MEMORY    0x00010000 /** One of the reserved bits from OMX_MASK_USERMASK */
30 
31 #define MEM_DEBUG_HANDLE_DESCR "DebugMemory"
32 
33 #if OMX_DEBUG
34     #define malloc(x)    OMX_DebugMem_malloc(x,__FILE__,__FUNCTION__,__LINE__)
35     #define calloc(n,s)  OMX_DebugMem_calloc(n,s,__FILE__,__FUNCTION__,__LINE__)
36     #define realloc(x,s) OMX_DebugMem_realloc(x,s,__FILE__,__FUNCTION__,__LINE__)
37     #define free(x)      OMX_DebugMem_free(x,__FILE__,__FUNCTION__ ,__LINE__)
38     #define validate(x)  OMX_DebugMem_validate(x, __FILE__,__FUNCTION__ ,__LINE__)
39     #define dump()      OMX_DebugMem_dump( __FILE__,__FUNCTION__ ,__LINE__)
40 #else
41     #define validate(x)
42     #define dump()
43 #endif
44 
45 
46 #endif
47 
48