GBDK 2020 Docs
API Documentation for GBDK 2020
malloc.h
Go to the documentation of this file.
1 
7 #ifndef __SYS_MALLOC_H
8 #define __SYS_MALLOC_H
9 
10 #include <types.h>
11 
12 /* The various constants */
16 #define MALLOC_FREE 1
17 #define MALLOC_USED 2
18 
21 #define MALLOC_MAGIC 123
22 
23 /* malloc hunk header definition */
24 typedef struct smalloc_hunk mmalloc_hunk;
25 typedef struct smalloc_hunk * pmmalloc_hunk;
26 
27 struct smalloc_hunk {
28  unsigned char magic; /* Magic number - indicates valid hunk header */
29  pmmalloc_hunk next; /* Pointer to the next hunk */
30  unsigned int size; /* Size in bytes of this region */
31  int status; /* One of MALLOC_FREE or MALLOC_USED */
32 };
33 
36 
39 
41 void malloc_gc(void) NONBANKED;
43 void debug( char *routine, char *msg ) NONBANKED;
44 
45 #endif /* __SYS_MALLOC_H */
smalloc_hunk::size
unsigned int size
Definition: malloc.h:30
uint8_t
unsigned char uint8_t
Definition: stdint.h:51
malloc_first
pmmalloc_hunk malloc_first
smalloc_hunk::next
pmmalloc_hunk next
Definition: malloc.h:29
pmmalloc_hunk
struct smalloc_hunk * pmmalloc_hunk
Definition: malloc.h:25
smalloc_hunk::magic
unsigned char magic
Definition: malloc.h:28
smalloc_hunk::status
int status
Definition: malloc.h:31
debug
void debug(char *routine, char *msg) NONBANKED
smalloc_hunk
Definition: malloc.h:27
malloc_gc
void malloc_gc(void) NONBANKED
malloc_heap_start
uint8_t malloc_heap_start
NONBANKED
#define NONBANKED
Definition: types.h:12