Skip to content

Commit 5fb6cb8

Browse files
committed
修复ringblk_buf在不使用动态内存时报错的问题
1 parent 553b57e commit 5fb6cb8

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

components/drivers/include/ipc/ringblk_buf.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,12 @@ typedef struct rt_rbb *rt_rbb_t;
7676

7777
/* rbb (ring block buffer) API */
7878
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);
79+
rt_size_t rt_rbb_get_buf_size(rt_rbb_t rbb);
80+
81+
#ifdef RT_USING_HEAP
7982
rt_rbb_t rt_rbb_create(rt_size_t buf_size, rt_size_t blk_max_num);
8083
void rt_rbb_destroy(rt_rbb_t rbb);
81-
rt_size_t rt_rbb_get_buf_size(rt_rbb_t rbb);
84+
#endif
8285

8386
/* rbb block API */
8487
rt_rbb_blk_t rt_rbb_blk_alloc(rt_rbb_t rbb, rt_size_t blk_size);

components/drivers/src/ringblk_buf.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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
4444
}
4545
RTM_EXPORT(rt_rbb_init);
4646

47+
#ifdef RT_USING_HEAP
48+
4749
/**
4850
* ring block buffer object create
4951
*
@@ -102,6 +104,8 @@ void rt_rbb_destroy(rt_rbb_t rbb)
102104
}
103105
RTM_EXPORT(rt_rbb_destroy);
104106

107+
#endif
108+
105109
static rt_rbb_blk_t find_empty_blk_in_set(rt_rbb_t rbb)
106110
{
107111
rt_size_t i;

0 commit comments

Comments
 (0)