提交 d8eb0cfc 编写于 作者: T tyustli

fix kernel and framework no cast type error

上级 34059c40
......@@ -202,7 +202,7 @@ int dfs_elm_mkfs(rt_device_t dev_id)
int index;
char logic_nbr[2] = {'0', ':'};
work = rt_malloc(_MAX_SS);
work = (BYTE *)rt_malloc(_MAX_SS);
if (RT_NULL == work)
{
return -ENOMEM;
......@@ -233,7 +233,7 @@ int dfs_elm_mkfs(rt_device_t dev_id)
}
else
{
fat = rt_malloc(sizeof(FATFS));
fat = (FATFS *)rt_malloc(sizeof(FATFS));
if (fat == RT_NULL)
{
rt_free(work); /* release memory */
......@@ -340,7 +340,7 @@ int dfs_elm_open(struct dfs_fd *file)
vol = elm_get_vol((FATFS *)fs->data);
if (vol < 0)
return -ENOENT;
drivers_fn = rt_malloc(256);
drivers_fn = (char *)rt_malloc(256);
if (drivers_fn == RT_NULL)
return -ENOMEM;
......@@ -648,7 +648,7 @@ int dfs_elm_unlink(struct dfs_filesystem *fs, const char *path)
vol = elm_get_vol((FATFS *)fs->data);
if (vol < 0)
return -ENOENT;
drivers_fn = rt_malloc(256);
drivers_fn = (char *)rt_malloc(256);
if (drivers_fn == RT_NULL)
return -ENOMEM;
......@@ -680,7 +680,7 @@ int dfs_elm_rename(struct dfs_filesystem *fs, const char *oldpath, const char *n
if (vol < 0)
return -ENOENT;
drivers_oldfn = rt_malloc(256);
drivers_oldfn = (char *)rt_malloc(256);
if (drivers_oldfn == RT_NULL)
return -ENOMEM;
drivers_newfn = newpath;
......@@ -714,7 +714,7 @@ int dfs_elm_stat(struct dfs_filesystem *fs, const char *path, struct stat *st)
vol = elm_get_vol((FATFS *)fs->data);
if (vol < 0)
return -ENOENT;
drivers_fn = rt_malloc(256);
drivers_fn = (char *)rt_malloc(256);
if (drivers_fn == RT_NULL)
return -ENOMEM;
......
......@@ -569,7 +569,7 @@ static WCHAR LfnBuf[_MAX_LFN+1]; /* LFN enabled with static working buffer */
#define FREE_NAMBUF() ff_memfree(lfn)
#else
#define DEF_NAMBUF WCHAR *lfn;
#define INIT_NAMBUF(fs) { lfn = ff_memalloc((_MAX_LFN+1)*2); if (!lfn) LEAVE_FF(fs, FR_NOT_ENOUGH_CORE); (fs)->lfnbuf = lfn; }
#define INIT_NAMBUF(fs) { lfn = (WCHAR *)ff_memalloc((_MAX_LFN+1)*2); if (!lfn) LEAVE_FF(fs, FR_NOT_ENOUGH_CORE); (fs)->lfnbuf = lfn; }
#define FREE_NAMBUF() ff_memfree(lfn)
#endif
......
......@@ -141,7 +141,7 @@ static int fd_alloc(struct dfs_fdtable *fdt, int startfd)
cnt = fdt->maxfd + 4;
cnt = cnt > DFS_FD_MAX ? DFS_FD_MAX : cnt;
fds = rt_realloc(fdt->fds, cnt * sizeof(struct dfs_fd *));
fds = (struct dfs_fd **)rt_realloc(fdt->fds, cnt * sizeof(struct dfs_fd *));
if (fds == NULL) goto __exit; /* return fdt->maxfd */
/* clean the new allocated fds */
......@@ -157,7 +157,7 @@ static int fd_alloc(struct dfs_fdtable *fdt, int startfd)
/* allocate 'struct dfs_fd' */
if (idx < (int)fdt->maxfd && fdt->fds[idx] == RT_NULL)
{
fdt->fds[idx] = rt_calloc(1, sizeof(struct dfs_fd));
fdt->fds[idx] = (struct dfs_fd *)rt_calloc(1, sizeof(struct dfs_fd));
if (fdt->fds[idx] == RT_NULL)
idx = fdt->maxfd;
}
......@@ -393,7 +393,7 @@ char *dfs_normalize_path(const char *directory, const char *filename)
if (filename[0] != '/') /* it's a absolute path, use it directly */
{
fullpath = rt_malloc(strlen(directory) + strlen(filename) + 2);
fullpath = (char *)rt_malloc(strlen(directory) + strlen(filename) + 2);
if (fullpath == NULL)
return NULL;
......
......@@ -600,7 +600,7 @@ static void copyfile(const char *src, const char *dst)
rt_uint8_t *block_ptr;
rt_int32_t read_bytes;
block_ptr = rt_malloc(BUF_SZ);
block_ptr = (rt_uint8_t *)rt_malloc(BUF_SZ);
if (block_ptr == NULL)
{
rt_kprintf("out of memory\n");
......@@ -715,7 +715,7 @@ static void copydir(const char *src, const char *dst)
static const char *_get_path_lastname(const char *path)
{
char *ptr;
if ((ptr = strrchr(path, '/')) == NULL)
if ((ptr = (char *)strrchr(path, '/')) == NULL)
return path;
/* skip the '/' then return */
......
......@@ -265,11 +265,11 @@ RTM_EXPORT(lseek);
*
* note: the old and new file name must be belong to a same file system.
*/
int rename(const char *old, const char *new)
int rename(const char *old_file, const char *new_file)
{
int result;
result = dfs_file_rename(old, new);
result = dfs_file_rename(old_file, new_file);
if (result < 0)
{
rt_set_errno(result);
......
......@@ -54,7 +54,7 @@ static void _poll_add(rt_wqueue_t *wq, rt_pollreq_t *req)
struct rt_poll_table *pt;
struct rt_poll_node *node;
node = rt_malloc(sizeof(struct rt_poll_node));
node = (struct rt_poll_node *)rt_malloc(sizeof(struct rt_poll_node));
if (node == RT_NULL)
return;
......
......@@ -157,7 +157,7 @@ static rt_err_t _audio_dev_open(struct rt_device *dev, rt_uint16_t oflag)
//init pipe for record
{
rt_uint8_t *buf = rt_malloc(CFG_AUDIO_RECORD_PIPE_SIZE);
rt_uint8_t *buf = (rt_uint8_t *)rt_malloc(CFG_AUDIO_RECORD_PIPE_SIZE);
if (buf == RT_NULL)
{
......@@ -382,7 +382,7 @@ static rt_err_t _audio_dev_control(struct rt_device *dev, int cmd, void *args)
if (desc)
{
desc->data_size = AUDIO_DEVICE_DECODE_MP_BLOCK_SZ * 2;
desc->data_ptr = rt_mp_alloc(&audio->mp, RT_WAITING_FOREVER);
desc->data_ptr = (rt_uint8_t *)rt_mp_alloc(&audio->mp, RT_WAITING_FOREVER);
result = RT_EOK;
}
......@@ -440,7 +440,7 @@ rt_err_t rt_audio_register(struct rt_audio_device *audio, const char *name, rt_u
//init memory pool for replay
{
rt_uint8_t *mempool = rt_malloc(AUDIO_DEVICE_DECODE_MP_SZ);
rt_uint8_t *mempool = (rt_uint8_t *)rt_malloc(AUDIO_DEVICE_DECODE_MP_SZ);
rt_mp_init(&audio->mp, "adu_mp", mempool, AUDIO_DEVICE_DECODE_MP_SZ,
AUDIO_DEVICE_DECODE_MP_BLOCK_SZ * 2);
}
......
......@@ -50,7 +50,7 @@ static rt_size_t rt_pipe_read(rt_device_t dev,
if (!(pipe->flag & RT_PIPE_FLAG_BLOCK_RD))
{
level = rt_hw_interrupt_disable();
read_nbytes = rt_ringbuffer_get(&(pipe->ringbuffer), buffer, size);
read_nbytes = rt_ringbuffer_get(&(pipe->ringbuffer), (rt_uint8_t *)buffer, size);
/* if the ringbuffer is empty, there won't be any writer waiting */
if (read_nbytes)
......@@ -68,7 +68,7 @@ static rt_size_t rt_pipe_read(rt_device_t dev,
do {
level = rt_hw_interrupt_disable();
read_nbytes = rt_ringbuffer_get(&(pipe->ringbuffer), buffer, size);
read_nbytes = rt_ringbuffer_get(&(pipe->ringbuffer), (rt_uint8_t *)buffer, size);
if (read_nbytes == 0)
{
rt_thread_suspend(thread);
......@@ -134,10 +134,10 @@ static rt_size_t rt_pipe_write(rt_device_t dev,
if (pipe->flag & RT_PIPE_FLAG_FORCE_WR)
write_nbytes = rt_ringbuffer_put_force(&(pipe->ringbuffer),
buffer, size);
(const rt_uint8_t *)buffer, size);
else
write_nbytes = rt_ringbuffer_put(&(pipe->ringbuffer),
buffer, size);
(const rt_uint8_t *)buffer, size);
_rt_pipe_resume_reader(pipe);
......@@ -153,7 +153,7 @@ static rt_size_t rt_pipe_write(rt_device_t dev,
do {
level = rt_hw_interrupt_disable();
write_nbytes = rt_ringbuffer_put(&(pipe->ringbuffer), buffer, size);
write_nbytes = rt_ringbuffer_put(&(pipe->ringbuffer), (const rt_uint8_t *)buffer, size);
if (write_nbytes == 0)
{
/* pipe full, waiting on suspended write list */
......@@ -270,7 +270,7 @@ rt_err_t rt_audio_pipe_create(const char *name, rt_int32_t flag, rt_size_t size)
return -RT_ENOMEM;
/* create ring buffer of pipe */
rb_memptr = rt_malloc(size);
rb_memptr = (rt_uint8_t *)rt_malloc(size);
if (rb_memptr == RT_NULL)
{
rt_free(pipe);
......
......@@ -132,7 +132,7 @@ static rt_int32_t i2c_writeb(struct rt_i2c_bus_device *bus, rt_uint8_t data)
rt_int32_t i;
rt_uint8_t bit;
struct rt_i2c_bit_ops *ops = bus->priv;
struct rt_i2c_bit_ops *ops = (struct rt_i2c_bit_ops *)bus->priv;
for (i = 7; i >= 0; i--)
{
......@@ -159,7 +159,7 @@ static rt_int32_t i2c_readb(struct rt_i2c_bus_device *bus)
{
rt_uint8_t i;
rt_uint8_t data = 0;
struct rt_i2c_bit_ops *ops = bus->priv;
struct rt_i2c_bit_ops *ops = (struct rt_i2c_bit_ops *)bus->priv;
SDA_H(ops);
i2c_delay(ops);
......@@ -222,7 +222,7 @@ static rt_size_t i2c_send_bytes(struct rt_i2c_bus_device *bus,
static rt_err_t i2c_send_ack_or_nack(struct rt_i2c_bus_device *bus, int ack)
{
struct rt_i2c_bit_ops *ops = bus->priv;
struct rt_i2c_bit_ops *ops = (struct rt_i2c_bit_ops *)bus->priv;
if (ack)
SET_SDA(ops, 0);
......@@ -282,7 +282,7 @@ static rt_int32_t i2c_send_address(struct rt_i2c_bus_device *bus,
rt_uint8_t addr,
rt_int32_t retries)
{
struct rt_i2c_bit_ops *ops = bus->priv;
struct rt_i2c_bit_ops *ops = (struct rt_i2c_bit_ops *)bus->priv;
rt_int32_t i;
rt_err_t ret = 0;
......@@ -306,7 +306,7 @@ static rt_err_t i2c_bit_send_address(struct rt_i2c_bus_device *bus,
{
rt_uint16_t flags = msg->flags;
rt_uint16_t ignore_nack = msg->flags & RT_I2C_IGNORE_NACK;
struct rt_i2c_bit_ops *ops = bus->priv;
struct rt_i2c_bit_ops *ops = (struct rt_i2c_bit_ops *)bus->priv;
rt_uint8_t addr1, addr2;
rt_int32_t retries;
......@@ -369,7 +369,7 @@ static rt_size_t i2c_bit_xfer(struct rt_i2c_bus_device *bus,
rt_uint32_t num)
{
struct rt_i2c_msg *msg;
struct rt_i2c_bit_ops *ops = bus->priv;
struct rt_i2c_bit_ops *ops = (struct rt_i2c_bit_ops *)bus->priv;
rt_int32_t i, ret;
rt_uint16_t ignore_nack;
......
......@@ -28,7 +28,7 @@ static rt_size_t i2c_bus_device_read(rt_device_t dev,
addr = pos & 0xffff;
flags = (pos >> 16) & 0xffff;
return rt_i2c_master_recv(bus, addr, flags, buffer, count);
return rt_i2c_master_recv(bus, addr, flags, (rt_uint8_t *)buffer, count);
}
static rt_size_t i2c_bus_device_write(rt_device_t dev,
......@@ -48,7 +48,7 @@ static rt_size_t i2c_bus_device_write(rt_device_t dev,
addr = pos & 0xffff;
flags = (pos >> 16) & 0xffff;
return rt_i2c_master_send(bus, addr, flags, buffer, count);
return rt_i2c_master_send(bus, addr, flags, (const rt_uint8_t *)buffer, count);
}
static rt_err_t i2c_bus_device_control(rt_device_t dev,
......
......@@ -69,7 +69,7 @@ void rt_sensor_cb(rt_sensor_t sen)
/* ISR for sensor interrupt */
static void irq_callback(void *args)
{
rt_sensor_t sensor = args;
rt_sensor_t sensor = (rt_sensor_t)args;
rt_uint8_t i;
if (sensor->module)
......@@ -389,7 +389,7 @@ int rt_hw_sensor_register(rt_sensor_t sensor,
/* Add a type name for the sensor device */
sensor_name = sensor_name_str[sensor->info.type];
device_name = rt_calloc(1, rt_strlen(sensor_name) + 1 + rt_strlen(name));
device_name = (char *)rt_calloc(1, rt_strlen(sensor_name) + 1 + rt_strlen(name));
if (device_name == RT_NULL)
{
LOG_E("device_name calloc failed!");
......
......@@ -63,15 +63,15 @@ static rt_err_t rx_callback(rt_device_t dev, rt_size_t size)
static void sensor_fifo_rx_entry(void *parameter)
{
rt_device_t dev = parameter;
rt_sensor_t sensor = parameter;
rt_device_t dev = (rt_device_t)parameter;
rt_sensor_t sensor = (rt_sensor_t)parameter;
struct rt_sensor_data *data = RT_NULL;
struct rt_sensor_info info;
rt_size_t res, i;
rt_device_control(dev, RT_SENSOR_CTRL_GET_INFO, &info);
data = rt_malloc(sizeof(struct rt_sensor_data) * info.fifo_max);
data = (struct rt_sensor_data *)rt_malloc(sizeof(struct rt_sensor_data) * info.fifo_max);
if (data == RT_NULL)
{
LOG_E("Memory allocation failed!");
......@@ -137,8 +137,8 @@ MSH_CMD_EXPORT(sensor_fifo, Sensor fifo mode test function);
static void sensor_irq_rx_entry(void *parameter)
{
rt_device_t dev = parameter;
rt_sensor_t sensor = parameter;
rt_device_t dev = (rt_device_t)parameter;
rt_sensor_t sensor = (rt_sensor_t)parameter;
struct rt_sensor_data data;
rt_size_t res, i = 0;
......
......@@ -791,16 +791,16 @@ static rt_size_t rt_serial_read(struct rt_device *dev,
if (dev->open_flag & RT_DEVICE_FLAG_INT_RX)
{
return _serial_int_rx(serial, buffer, size);
return _serial_int_rx(serial, (rt_uint8_t *)buffer, size);
}
#ifdef RT_SERIAL_USING_DMA
else if (dev->open_flag & RT_DEVICE_FLAG_DMA_RX)
{
return _serial_dma_rx(serial, buffer, size);
return _serial_dma_rx(serial, (rt_uint8_t *)buffer, size);
}
#endif /* RT_SERIAL_USING_DMA */
return _serial_poll_rx(serial, buffer, size);
return _serial_poll_rx(serial, (rt_uint8_t *)buffer, size);
}
static rt_size_t rt_serial_write(struct rt_device *dev,
......@@ -817,17 +817,17 @@ static rt_size_t rt_serial_write(struct rt_device *dev,
if (dev->open_flag & RT_DEVICE_FLAG_INT_TX)
{
return _serial_int_tx(serial, buffer, size);
return _serial_int_tx(serial, (const rt_uint8_t *)buffer, size);
}
#ifdef RT_SERIAL_USING_DMA
else if (dev->open_flag & RT_DEVICE_FLAG_DMA_TX)
{
return _serial_dma_tx(serial, buffer, size);
return _serial_dma_tx(serial, (const rt_uint8_t *)buffer, size);
}
#endif /* RT_SERIAL_USING_DMA */
else
{
return _serial_poll_tx(serial, buffer, size);
return _serial_poll_tx(serial, (const rt_uint8_t *)buffer, size);
}
}
......
......@@ -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));
......
......@@ -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);
......
......@@ -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);
......
......@@ -995,7 +995,7 @@ udevice_t rt_usbd_device_new(void)
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbd_device_new\n"));
/* allocate memory for the object */
udevice = rt_malloc(sizeof(struct udevice));
udevice = (udevice_t)rt_malloc(sizeof(struct udevice));
if(udevice == RT_NULL)
{
rt_kprintf("alloc memery failed\n");
......@@ -1109,7 +1109,7 @@ uconfig_t rt_usbd_config_new(void)
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbd_config_new\n"));
/* allocate memory for the object */
cfg = rt_malloc(sizeof(struct uconfig));
cfg = (uconfig_t)rt_malloc(sizeof(struct uconfig));
if(cfg == RT_NULL)
{
rt_kprintf("alloc memery failed\n");
......@@ -2053,7 +2053,7 @@ rt_size_t rt_usbd_ep0_write(udevice_t device, void *buffer, rt_size_t size)
ep0 = &device->dcd->ep0;
ep0->request.size = size;
ep0->request.buffer = buffer;
ep0->request.buffer = (rt_uint8_t *)buffer;
ep0->request.remain_size = size;
if(size >= ep0->id->maxpacket)
{
......@@ -2079,7 +2079,7 @@ rt_size_t rt_usbd_ep0_read(udevice_t device, void *buffer, rt_size_t size,
RT_ASSERT(buffer != RT_NULL);
ep0 = &device->dcd->ep0;
ep0->request.buffer = buffer;
ep0->request.buffer = (rt_uint8_t *)buffer;
ep0->request.remain_size = size;
ep0->rx_indicate = rx_ind;
if(size >= ep0->id->maxpacket)
......
......@@ -56,7 +56,7 @@ int finsh_set_prompt(const char * prompt)
/* strdup */
if(prompt)
{
finsh_prompt_custom = rt_malloc(strlen(prompt)+1);
finsh_prompt_custom = (char *)rt_malloc(strlen(prompt)+1);
if(finsh_prompt_custom)
{
strcpy(finsh_prompt_custom, prompt);
......
......@@ -1308,7 +1308,7 @@ rt_err_t rt_mb_init(rt_mailbox_t mb,
rt_ipc_object_init(&(mb->parent));
/* init mailbox */
mb->msg_pool = msgpool;
mb->msg_pool = (rt_ubase_t *)msgpool;
mb->size = size;
mb->entry = 0;
mb->in_offset = 0;
......@@ -1376,7 +1376,7 @@ rt_mailbox_t rt_mb_create(const char *name, rt_size_t size, rt_uint8_t flag)
/* init mailbox */
mb->size = size;
mb->msg_pool = RT_KERNEL_MALLOC(mb->size * sizeof(rt_ubase_t));
mb->msg_pool = (rt_ubase_t *)RT_KERNEL_MALLOC(mb->size * sizeof(rt_ubase_t));
if (mb->msg_pool == RT_NULL)
{
/* delete mailbox object */
......@@ -1816,7 +1816,7 @@ rt_err_t rt_mq_init(rt_mq_t mq,
{
head = (struct rt_mq_message *)((rt_uint8_t *)mq->msg_pool +
temp * (mq->msg_size + sizeof(struct rt_mq_message)));
head->next = mq->msg_queue_free;
head->next = (struct rt_mq_message *)mq->msg_queue_free;
mq->msg_queue_free = head;
}
......@@ -1909,7 +1909,7 @@ rt_mq_t rt_mq_create(const char *name,
{
head = (struct rt_mq_message *)((rt_uint8_t *)mq->msg_pool +
temp * (mq->msg_size + sizeof(struct rt_mq_message)));
head->next = mq->msg_queue_free;
head->next = (struct rt_mq_message *)mq->msg_queue_free;
mq->msg_queue_free = head;
}
......@@ -2093,7 +2093,7 @@ rt_err_t rt_mq_urgent(rt_mq_t mq, void *buffer, rt_size_t size)
temp = rt_hw_interrupt_disable();
/* link msg to the beginning of message queue */
msg->next = mq->msg_queue_head;
msg->next = (struct rt_mq_message *)mq->msg_queue_head;
mq->msg_queue_head = msg;
/* if there is no tail */
......
......@@ -326,7 +326,7 @@ rt_int32_t rt_memcmp(const void *cs, const void *ct, rt_ubase_t count)
const unsigned char *su1, *su2;
int res = 0;
for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
for (su1 = (const unsigned char *)cs, su2 = (const unsigned char *)ct; 0 < count; ++su1, ++su2, count--)
if ((res = *su1 - *su2) != 0)
break;
......@@ -1117,14 +1117,14 @@ RTM_EXPORT(rt_console_get_device);
*/
rt_device_t rt_console_set_device(const char *name)
{
rt_device_t new, old;
rt_device_t new_device, old_device;
/* save old device */
old = _console_device;
old_device = _console_device;
/* find new console device */
new = rt_device_find(name);
if (new != RT_NULL)
new_device = rt_device_find(name);
if (new_device != RT_NULL)
{
if (_console_device != RT_NULL)
{
......@@ -1133,11 +1133,11 @@ rt_device_t rt_console_set_device(const char *name)
}
/* set new console device */
rt_device_open(new, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_STREAM);
_console_device = new;
rt_device_open(new_device, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_STREAM);
_console_device = new_device;
}
return old;
return old_device;
}
RTM_EXPORT(rt_console_set_device);
#endif
......@@ -1332,7 +1332,9 @@ int __rt_ffs(int value)
#ifdef RT_DEBUG
/* RT_ASSERT(EX)'s hook */
void (*rt_assert_hook)(const char *ex, const char *func, rt_size_t line);
/**
* This function will set a hook function to RT_ASSERT(EX). It will run when the expression is false.
*
......
......@@ -141,7 +141,7 @@ static rt_err_t _rt_thread_init(struct rt_thread *thread,
(void *)rt_thread_exit);
#else
thread->sp = (void *)rt_hw_stack_init(thread->entry, thread->parameter,
(void *)((char *)thread->stack_addr + thread->stack_size - sizeof(rt_ubase_t)),
(rt_uint8_t *)((char *)thread->stack_addr + thread->stack_size - sizeof(rt_ubase_t)),
(void *)rt_thread_exit);
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册