7 void memb_init(struct memb_blks
*blk
)
9 UIP_MEMSET(blk
->mem
,0,(MEM_ALIGN_SIZE(blk
->size
)+sizeof(u32
))*blk
->num
);
12 void* memb_alloc(struct memb_blks
*blk
)
18 for(i
=0;i
<blk
->num
;i
++) {
21 return (void*)(ptr
+1);
23 ptr
= (u32
*)(u8
*)ptr
+(MEM_ALIGN_SIZE(blk
->size
)+sizeof(u32
));
28 u8
memb_free(struct memb_blks
*blk
,void *ptr
)
34 ptr2
= (u32
*)blk
->mem
;
35 for(i
=0;i
<blk
->num
;i
++) {
36 if(ptr2
==(ptr1
- 1)) {
39 ptr2
= (u32
*)(u8
*)ptr2
+(MEM_ALIGN_SIZE(blk
->size
)+sizeof(u32
));
44 u8
memb_ref(struct memb_blks
*blk
,void *ptr
)
46 u32
*pref
= ptr
-sizeof(u32
);