Golem  v0.1.1
Generic Operating system Libraries for Embedded Multitasking
 All Data Structures Files Functions Variables Pages
/home/ruud/Engineering/software/projects/golem-project-code/trunk/glm_heap.h
Go to the documentation of this file.
1 
23 #ifndef _GLM_HEAP_H_
24 #define _GLM_HEAP_H_
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 /* INCLUDES *******************************************************************/
31 #include <stdlib.h>
32 #include <stdbool.h>
33 #include "glm_intbase.h"
34 
35 
36 /* TYPES **********************************************************************/
37 typedef uint_base_t heap_id_t;
38 
39 
44 typedef struct
45 {
46  char *name;
47  size_t current;
48  size_t max;
49 } heap_stats_t;
50 
51 
52 /* PUBLIC FUNCTIONS ***********************************************************/
53 
54 
60 extern void heap_reset();
61 
62 
74 extern bool heap_create_hid(char * a_name, heap_id_t *a_heap_id);
75 
76 
87 extern bool heap_stats(heap_id_t a_heap_id, heap_stats_t * a_heap_stats);
88 
89 
95 extern void heap_totals(heap_stats_t * a_heap_totals);
96 
97 
107 extern void * heap_malloc(heap_id_t a_id, size_t a_size);
108 
109 
121 extern void * heap_calloc(heap_id_t a_id, size_t a_nr_elements, size_t a_size);
122 
123 
135 extern void * heap_realloc(void * a_ptr, size_t a_size);
136 
137 
142 extern void heap_free(void * a_ptr);
143 
144 
151 extern size_t heap_sizeof(void * a_ptr);
152 
153 
160 extern heap_id_t heap_get_id(void * a_ptr);
161 
162 
171 extern void heap_transfer_owner(void * a_ptr, heap_id_t a_id);
172 
173 
174 #ifdef __cplusplus
175 }
176 #endif
177 
178 #endif /* _GLM_HEAP_H_ */