10 void btmemb_init(struct memb_blks
*blk
)
12 MEMSET(blk
->mem
,0,(MEM_ALIGN_SIZE(blk
->size
)+sizeof(u32
))*blk
->num
);
15 void* btmemb_alloc(struct memb_blks
*blk
)
22 _CPU_ISR_Disable(level
);
24 for(i
=0;i
<blk
->num
;i
++) {
28 _CPU_ISR_Restore(level
);
31 ptr
= (u32
*)((u8
*)ptr
+(MEM_ALIGN_SIZE(blk
->size
)+sizeof(u32
)));
33 _CPU_ISR_Restore(level
);
37 u8
btmemb_free(struct memb_blks
*blk
,void *ptr
)
44 _CPU_ISR_Disable(level
);
46 ptr2
= (u32
*)blk
->mem
;
47 for(i
=0;i
<blk
->num
;i
++) {
48 if(ptr2
==(ptr1
- 1)) {
50 _CPU_ISR_Restore(level
);
53 ptr2
= (u32
*)((u8
*)ptr2
+(MEM_ALIGN_SIZE(blk
->size
)+sizeof(u32
)));
55 _CPU_ISR_Restore(level
);
59 u8
btmemb_ref(struct memb_blks
*blk
,void *ptr
)
65 _CPU_ISR_Disable(level
);
66 pref
= ptr
-sizeof(u32
);
68 _CPU_ISR_Restore(level
);