DVBCore  17.9.0
Open Source DVB Engine
 All Data Structures Files Functions Typedefs Macros Pages
stbheap.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2004 Ocean Blue Software Ltd
4  *
5  * This file is part of a DTVKit Software Component
6  * You are permitted to copy, modify or distribute this file subject to the terms
7  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
8  *
9  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
10  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
11  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * If you or your organisation is not a member of DTVKit then you have access
14  * to this source code outside of the terms of the licence agreement
15  * and you are expected to delete this and any associated files immediately.
16  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
17  *******************************************************************************/
24 #ifndef _STBHEAP_H
25 
26 #define _STBHEAP_H
27 
28 #include "techtype.h"
29 
30 //---Constant and macro definitions for public use-----------------------------
31 
32 #ifndef PGW_ENABLED
33 //#define PGW_ENABLED
34 #endif
35 
36 //---Enumerations for public use-----------------------------------------------
37 
38 //---Global type defs for public use-------------------------------------------
39 
40 //---Global Function prototypes for public use---------------------------------
41 
42 void STB_HeapInitialise(void);
43 
44 // RAM functions
45 #ifndef PGW_ENABLED
46 void* STB_GetMemory(U32BIT bytes);
47 void STB_FreeMemory(void *addr);
48 void* STB_ResizeMemory(void *ptr, U32BIT new_num_bytes);
49 
50 void* STB_AppGetMemory(U32BIT bytes);
51 void STB_AppFreeMemory(void *addr);
52 void* STB_AppResizeMemory(void *ptr, U32BIT new_num_bytes);
53 #else
54 void* STB_GetMemoryPGW(U32BIT bytes, char *filename, int linenum);
55 void STB_FreeMemoryPGW(void *addr, char *filename, int linenum);
56 void* STB_ResizeMemoryPGW(void *ptr, U32BIT size, char *filename, int lineno);
57 
58 void* STB_AppGetMemoryPGW(U32BIT bytes, char *filename, int linenum);
59 void STB_AppFreeMemoryPGW(void *addr, char *filename, int linenum);
60 void* STB_AppResizeMemoryPGW(void *ptr, U32BIT size, char *filename, int lineno);
61 
62 void STB_MemoryDumpPGW(BOOLEAN full);
63 
64  #define STB_GetMemory(a) STB_GetMemoryPGW(a, __FILE__, __LINE__)
65  #define STB_FreeMemory(a) STB_FreeMemoryPGW(a, __FILE__, __LINE__)
66  #define STB_ResizeMemory(a, b) STB_ResizeMemoryPGW(a, b, __FILE__, __LINE__)
67 
68  #define STB_AppGetMemory(a) STB_AppGetMemoryPGW(a, __FILE__, __LINE__)
69  #define STB_AppFreeMemory(a) STB_AppFreeMemoryPGW(a, __FILE__, __LINE__)
70  #define STB_AppResizeMemory(a, b) STB_AppResizeMemoryPGW(a, b, __FILE__, __LINE__)
71 #endif
72 void STB_AppRegisterCacheFreeFunction(BOOLEAN (*callback_function)(void));
73 
74 void STB_GetHeapStats(U32BIT *total_app, U32BIT *max_app, U32BIT *num_app,
75  U32BIT *total_mem, U32BIT *max_mem, U32BIT *num_mem);
76 
77 #endif // _STBHEAP_H
78 
79 //*****************************************************************************
80 // End of file
81 //*****************************************************************************
82 
void * STB_GetMemory(U32BIT bytes)
Attempts to allocate memory from the heap.
Definition: stbheap.c:221
void * STB_AppGetMemory(U32BIT bytes)
Attempts to allocate memory from the application heap.
Definition: stbheap.c:651
void * STB_ResizeMemory(void *ptr, U32BIT new_num_bytes)
Re-allocates a given memory area to the new size, ensuring data contained within the original memory ...
Definition: stbheap.c:550
void * STB_AppResizeMemory(void *ptr, U32BIT new_num_bytes)
Re-allocates a given memory area to the new size, ensuring data contained within the original memory ...
Definition: stbheap.c:891
void STB_FreeMemory(void *addr)
Releases previously allocated heap memory.
Definition: stbheap.c:336
System Wide Global Technical Data Type Definitions.
void STB_AppFreeMemory(void *addr)
Releases previously allocated application heap memory.
Definition: stbheap.c:781