RTOS_MSPM0  1.1
ECE445M starter code
heap.h
Go to the documentation of this file.
1 
13 #ifndef HEAP_H
14 #define HEAP_H
15 
16 #include <stdint.h>
17 
18 // struct for holding statistics on the state of the heap
19 typedef struct heap_stats {
20  uint32_t size; // heap size (in bytes)
21  uint32_t used; // number of bytes used/allocated
22  uint32_t free; // number of bytes available to allocate
23 } heap_stats_t;
24 
25 
33 int32_t Heap_Init(void);
34 
35 
43 void* Heap_Malloc(int32_t desiredBytes);
44 
45 
53 void* Heap_Calloc(int32_t desiredBytes);
54 
55 
65 void* Heap_Realloc(void* oldBlock, int32_t desiredBytes);
66 
67 
75 int32_t Heap_Free(void* pointer);
76 
77 
84 int32_t Heap_Stats(heap_stats_t *stats);
85 
86 
87 #endif //#ifndef HEAP_H
int32_t Heap_Free(void *pointer)
Free memory.
void * Heap_Malloc(int32_t desiredBytes)
Allocate memory.
void * Heap_Calloc(int32_t desiredBytes)
Zero-allocate memory.
int32_t Heap_Init(void)
Initializes/resets the heap to a clean state where no memory is allocated.
int32_t Heap_Stats(heap_stats_t *stats)
Get heap usage.
void * Heap_Realloc(void *oldBlock, int32_t desiredBytes)
Grow/shrink memory.
Definition: heap.h:19