7 //#define _POOLBUFFER_DEBUG
11 typedef struct _buf_node
{
12 struct _buf_node
*next
;
13 u8 data
[SECTOR_SIZE
+2];
17 static BufNode s_buf
[BUF_POOL_CNT
];
18 static BufNode
*s_freepool
;
20 void sdgecko_initBufferPool()
23 #ifdef _POOLBUFFER_DEBUG
24 printf("card_initBufferPool()\n");
26 for(i
=0;i
<BUF_POOL_CNT
-1;++i
) {
27 s_buf
[i
].next
= s_buf
+i
+1;
33 u8
* sdgecko_allocBuffer()
38 buf
= s_freepool
->data
;
39 s_freepool
= s_freepool
->next
;
45 void sdgecko_freeBuffer(u8
*buf
)
48 BufNode
*node
= (BufNode
*)(buf
-offsetof(BufNode
,data
));
49 node
->next
= s_freepool
;