Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如果空间不足,申请不到需要的空间,需要回收new_rbb #8979

Merged
merged 1 commit into from
May 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions components/drivers/ipc/ringblk_buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ rt_rbb_blk_t rt_rbb_blk_alloc(rt_rbb_t rbb, rt_size_t blk_size)
else
{
/* no space */
rt_slist_insert(&rbb->free_list, &new_rbb->list);
new_rbb = RT_NULL;
}
}
Expand All @@ -239,23 +240,29 @@ rt_rbb_blk_t rt_rbb_blk_alloc(rt_rbb_t rbb, rt_size_t blk_size)
else
{
/* no space */
rt_slist_insert(&rbb->free_list, &new_rbb->list);
new_rbb = RT_NULL;
}
}
}
else
{
/* the list is empty */
list_append(rbb, &new_rbb->list);
new_rbb->status = RT_RBB_BLK_INITED;
new_rbb->buf = rbb->buf;
new_rbb->size = blk_size;
if(blk_size <= rbb->buf_size)
{
list_append(rbb, &new_rbb->list);
new_rbb->status = RT_RBB_BLK_INITED;
new_rbb->buf = rbb->buf;
new_rbb->size = blk_size;
}
else
{
/* no space */
rt_slist_insert(&rbb->free_list, &new_rbb->list);
new_rbb = RT_NULL;
}
}
}
else
{
new_rbb = RT_NULL;
}

rt_spin_unlock_irqrestore(&(rbb->spinlock), level);

Expand Down
Loading