修复ringblk_buf在不使用动态内存时报错的问题

This commit is contained in:
malongwei 2021-09-01 19:58:23 +08:00
parent 553b57e3a9
commit 5fb6cb8b41
2 changed files with 8 additions and 1 deletions

View File

@ -76,9 +76,12 @@ typedef struct rt_rbb *rt_rbb_t;
/* rbb (ring block buffer) API */
void rt_rbb_init(rt_rbb_t rbb, rt_uint8_t *buf, rt_size_t buf_size, rt_rbb_blk_t block_set, rt_size_t blk_max_num);
rt_size_t rt_rbb_get_buf_size(rt_rbb_t rbb);
#ifdef RT_USING_HEAP
rt_rbb_t rt_rbb_create(rt_size_t buf_size, rt_size_t blk_max_num);
void rt_rbb_destroy(rt_rbb_t rbb);
rt_size_t rt_rbb_get_buf_size(rt_rbb_t rbb);
#endif
/* rbb block API */
rt_rbb_blk_t rt_rbb_blk_alloc(rt_rbb_t rbb, rt_size_t blk_size);

View File

@ -44,6 +44,8 @@ void rt_rbb_init(rt_rbb_t rbb, rt_uint8_t *buf, rt_size_t buf_size, rt_rbb_blk_t
}
RTM_EXPORT(rt_rbb_init);
#ifdef RT_USING_HEAP
/**
* ring block buffer object create
*
@ -102,6 +104,8 @@ void rt_rbb_destroy(rt_rbb_t rbb)
}
RTM_EXPORT(rt_rbb_destroy);
#endif
static rt_rbb_blk_t find_empty_blk_in_set(rt_rbb_t rbb)
{
rt_size_t i;