fix kernel and framework no cast type error

This commit is contained in:
tyustli
2019-06-18 20:09:19 +08:00
parent 34059c40c4
commit d8eb0cfc1e
21 changed files with 92 additions and 90 deletions
+1 -1
View File
@@ -425,7 +425,7 @@ rt_pipe_t *rt_pipe_create(const char *name, int bufsz)
rt_pipe_t *pipe;
rt_device_t dev;
pipe = rt_malloc(sizeof(rt_pipe_t));
pipe = (rt_pipe_t *)rt_malloc(sizeof(rt_pipe_t));
if (pipe == RT_NULL) return RT_NULL;
rt_memset(pipe, 0, sizeof(rt_pipe_t));
+23 -23
View File
@@ -134,16 +134,16 @@ rt_rbb_blk_t rt_rbb_blk_alloc(rt_rbb_t rbb, rt_size_t blk_size)
{
rt_base_t level;
rt_size_t empty1 = 0, empty2 = 0;
rt_rbb_blk_t head, tail, new = NULL;
rt_rbb_blk_t head, tail, new_rbb = NULL;
RT_ASSERT(rbb);
RT_ASSERT(blk_size < (1L << 24));
level = rt_hw_interrupt_disable();
new = find_empty_blk_in_set(rbb);
new_rbb = find_empty_blk_in_set(rbb);
if (rt_slist_len(&rbb->blk_list) < rbb->blk_max_num && new)
if (rt_slist_len(&rbb->blk_list) < rbb->blk_max_num && new_rbb)
{
if (rt_slist_len(&rbb->blk_list) > 0)
{
@@ -163,22 +163,22 @@ rt_rbb_blk_t rt_rbb_blk_alloc(rt_rbb_t rbb, rt_size_t blk_size)
if (empty1 >= blk_size)
{
rt_slist_append(&rbb->blk_list, &new->list);
new->status = RT_RBB_BLK_INITED;
new->buf = tail->buf + tail->size;
new->size = blk_size;
rt_slist_append(&rbb->blk_list, &new_rbb->list);
new_rbb->status = RT_RBB_BLK_INITED;
new_rbb->buf = tail->buf + tail->size;
new_rbb->size = blk_size;
}
else if (empty2 >= blk_size)
{
rt_slist_append(&rbb->blk_list, &new->list);
new->status = RT_RBB_BLK_INITED;
new->buf = rbb->buf;
new->size = blk_size;
rt_slist_append(&rbb->blk_list, &new_rbb->list);
new_rbb->status = RT_RBB_BLK_INITED;
new_rbb->buf = rbb->buf;
new_rbb->size = blk_size;
}
else
{
/* no space */
new = NULL;
new_rbb = NULL;
}
}
else
@@ -194,35 +194,35 @@ rt_rbb_blk_t rt_rbb_blk_alloc(rt_rbb_t rbb, rt_size_t blk_size)
if (empty1 >= blk_size)
{
rt_slist_append(&rbb->blk_list, &new->list);
new->status = RT_RBB_BLK_INITED;
new->buf = tail->buf + tail->size;
new->size = blk_size;
rt_slist_append(&rbb->blk_list, &new_rbb->list);
new_rbb->status = RT_RBB_BLK_INITED;
new_rbb->buf = tail->buf + tail->size;
new_rbb->size = blk_size;
}
else
{
/* no space */
new = NULL;
new_rbb = NULL;
}
}
}
else
{
/* the list is empty */
rt_slist_append(&rbb->blk_list, &new->list);
new->status = RT_RBB_BLK_INITED;
new->buf = rbb->buf;
new->size = blk_size;
rt_slist_append(&rbb->blk_list, &new_rbb->list);
new_rbb->status = RT_RBB_BLK_INITED;
new_rbb->buf = rbb->buf;
new_rbb->size = blk_size;
}
}
else
{
new = NULL;
new_rbb = NULL;
}
rt_hw_interrupt_enable(level);
return new;
return new_rbb;
}
RTM_EXPORT(rt_rbb_blk_alloc);
+2 -2
View File
@@ -332,11 +332,11 @@ struct rt_ringbuffer* rt_ringbuffer_create(rt_uint16_t size)
size = RT_ALIGN_DOWN(size, RT_ALIGN_SIZE);
rb = rt_malloc(sizeof(struct rt_ringbuffer));
rb = (struct rt_ringbuffer *)rt_malloc(sizeof(struct rt_ringbuffer));
if (rb == RT_NULL)
goto exit;
pool = rt_malloc(size);
pool = (rt_uint8_t *)rt_malloc(size);
if (pool == RT_NULL)
{
rt_free(rb);