- fixed STOP_TRANS response token read.
[libogc.git] / gc / ogc / lwp_heap.h
blobd7255516f970382fbf72aacd266d23f215833b4e
1 #ifndef __LWP_HEAP_H__
2 #define __LWP_HEAP_H__
4 #include <gctypes.h>
5 #include <asm.h>
7 #define HEAP_BLOCK_USED 1
8 #define HEAP_BLOCK_FREE 0
10 #define HEAP_DUMMY_FLAG (0+HEAP_BLOCK_USED)
12 #define HEAP_OVERHEAD (sizeof(u32)*2)
13 #define HEAP_BLOCK_USED_OVERHEAD (sizeof(void*)*2)
14 #define HEAP_MIN_SIZE (HEAP_OVERHEAD+sizeof(heap_block))
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
20 typedef struct _heap_block_st heap_block;
21 struct _heap_block_st {
22 u32 back_flag;
23 u32 front_flag;
24 heap_block *next;
25 heap_block *prev;
28 typedef struct _heap_iblock_st {
29 u32 free_blocks;
30 u32 free_size;
31 u32 used_blocks;
32 u32 used_size;
33 } heap_iblock;
35 typedef struct _heap_cntrl_st {
36 heap_block *start;
37 heap_block *final;
39 heap_block *first;
40 heap_block *perm_null;
41 heap_block *last;
42 u32 pg_size;
43 u32 reserved;
44 } heap_cntrl;
46 u32 __lwp_heap_init(heap_cntrl *theheap,void *start_addr,u32 size,u32 pg_size);
47 void* __lwp_heap_allocate(heap_cntrl *theheap,u32 size);
48 BOOL __lwp_heap_free(heap_cntrl *theheap,void *ptr);
49 u32 __lwp_heap_getinfo(heap_cntrl *theheap,heap_iblock *theinfo);
51 #ifdef LIBOGC_INTERNAL
52 #include <libogc/lwp_heap.inl>
53 #endif
55 #ifdef __cplusplus
57 #endif
59 #endif