fix kernel and framework no cast type error
This commit is contained in:
parent
34059c40c4
commit
d8eb0cfc1e
|
@ -202,7 +202,7 @@ int dfs_elm_mkfs(rt_device_t dev_id)
|
||||||
int index;
|
int index;
|
||||||
char logic_nbr[2] = {'0', ':'};
|
char logic_nbr[2] = {'0', ':'};
|
||||||
|
|
||||||
work = rt_malloc(_MAX_SS);
|
work = (BYTE *)rt_malloc(_MAX_SS);
|
||||||
if (RT_NULL == work)
|
if (RT_NULL == work)
|
||||||
{
|
{
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -233,7 +233,7 @@ int dfs_elm_mkfs(rt_device_t dev_id)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fat = rt_malloc(sizeof(FATFS));
|
fat = (FATFS *)rt_malloc(sizeof(FATFS));
|
||||||
if (fat == RT_NULL)
|
if (fat == RT_NULL)
|
||||||
{
|
{
|
||||||
rt_free(work); /* release memory */
|
rt_free(work); /* release memory */
|
||||||
|
@ -340,7 +340,7 @@ int dfs_elm_open(struct dfs_fd *file)
|
||||||
vol = elm_get_vol((FATFS *)fs->data);
|
vol = elm_get_vol((FATFS *)fs->data);
|
||||||
if (vol < 0)
|
if (vol < 0)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
drivers_fn = rt_malloc(256);
|
drivers_fn = (char *)rt_malloc(256);
|
||||||
if (drivers_fn == RT_NULL)
|
if (drivers_fn == RT_NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -648,7 +648,7 @@ int dfs_elm_unlink(struct dfs_filesystem *fs, const char *path)
|
||||||
vol = elm_get_vol((FATFS *)fs->data);
|
vol = elm_get_vol((FATFS *)fs->data);
|
||||||
if (vol < 0)
|
if (vol < 0)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
drivers_fn = rt_malloc(256);
|
drivers_fn = (char *)rt_malloc(256);
|
||||||
if (drivers_fn == RT_NULL)
|
if (drivers_fn == RT_NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -680,7 +680,7 @@ int dfs_elm_rename(struct dfs_filesystem *fs, const char *oldpath, const char *n
|
||||||
if (vol < 0)
|
if (vol < 0)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
drivers_oldfn = rt_malloc(256);
|
drivers_oldfn = (char *)rt_malloc(256);
|
||||||
if (drivers_oldfn == RT_NULL)
|
if (drivers_oldfn == RT_NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
drivers_newfn = newpath;
|
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);
|
vol = elm_get_vol((FATFS *)fs->data);
|
||||||
if (vol < 0)
|
if (vol < 0)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
drivers_fn = rt_malloc(256);
|
drivers_fn = (char *)rt_malloc(256);
|
||||||
if (drivers_fn == RT_NULL)
|
if (drivers_fn == RT_NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
|
|
@ -569,7 +569,7 @@ static WCHAR LfnBuf[_MAX_LFN+1]; /* LFN enabled with static working buffer */
|
||||||
#define FREE_NAMBUF() ff_memfree(lfn)
|
#define FREE_NAMBUF() ff_memfree(lfn)
|
||||||
#else
|
#else
|
||||||
#define DEF_NAMBUF WCHAR *lfn;
|
#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)
|
#define FREE_NAMBUF() ff_memfree(lfn)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ static int fd_alloc(struct dfs_fdtable *fdt, int startfd)
|
||||||
cnt = fdt->maxfd + 4;
|
cnt = fdt->maxfd + 4;
|
||||||
cnt = cnt > DFS_FD_MAX ? DFS_FD_MAX : cnt;
|
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 */
|
if (fds == NULL) goto __exit; /* return fdt->maxfd */
|
||||||
|
|
||||||
/* clean the new allocated fds */
|
/* clean the new allocated fds */
|
||||||
|
@ -157,7 +157,7 @@ static int fd_alloc(struct dfs_fdtable *fdt, int startfd)
|
||||||
/* allocate 'struct dfs_fd' */
|
/* allocate 'struct dfs_fd' */
|
||||||
if (idx < (int)fdt->maxfd && fdt->fds[idx] == RT_NULL)
|
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)
|
if (fdt->fds[idx] == RT_NULL)
|
||||||
idx = fdt->maxfd;
|
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 */
|
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)
|
if (fullpath == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -600,7 +600,7 @@ static void copyfile(const char *src, const char *dst)
|
||||||
rt_uint8_t *block_ptr;
|
rt_uint8_t *block_ptr;
|
||||||
rt_int32_t read_bytes;
|
rt_int32_t read_bytes;
|
||||||
|
|
||||||
block_ptr = rt_malloc(BUF_SZ);
|
block_ptr = (rt_uint8_t *)rt_malloc(BUF_SZ);
|
||||||
if (block_ptr == NULL)
|
if (block_ptr == NULL)
|
||||||
{
|
{
|
||||||
rt_kprintf("out of memory\n");
|
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)
|
static const char *_get_path_lastname(const char *path)
|
||||||
{
|
{
|
||||||
char *ptr;
|
char *ptr;
|
||||||
if ((ptr = strrchr(path, '/')) == NULL)
|
if ((ptr = (char *)strrchr(path, '/')) == NULL)
|
||||||
return path;
|
return path;
|
||||||
|
|
||||||
/* skip the '/' then return */
|
/* 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.
|
* 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;
|
int result;
|
||||||
|
|
||||||
result = dfs_file_rename(old, new);
|
result = dfs_file_rename(old_file, new_file);
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
{
|
{
|
||||||
rt_set_errno(result);
|
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_table *pt;
|
||||||
struct rt_poll_node *node;
|
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)
|
if (node == RT_NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ static rt_err_t _audio_dev_open(struct rt_device *dev, rt_uint16_t oflag)
|
||||||
|
|
||||||
//init pipe for record
|
//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)
|
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)
|
if (desc)
|
||||||
{
|
{
|
||||||
desc->data_size = AUDIO_DEVICE_DECODE_MP_BLOCK_SZ * 2;
|
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;
|
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
|
//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,
|
rt_mp_init(&audio->mp, "adu_mp", mempool, AUDIO_DEVICE_DECODE_MP_SZ,
|
||||||
AUDIO_DEVICE_DECODE_MP_BLOCK_SZ * 2);
|
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))
|
if (!(pipe->flag & RT_PIPE_FLAG_BLOCK_RD))
|
||||||
{
|
{
|
||||||
level = rt_hw_interrupt_disable();
|
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 the ringbuffer is empty, there won't be any writer waiting */
|
||||||
if (read_nbytes)
|
if (read_nbytes)
|
||||||
|
@ -68,7 +68,7 @@ static rt_size_t rt_pipe_read(rt_device_t dev,
|
||||||
|
|
||||||
do {
|
do {
|
||||||
level = rt_hw_interrupt_disable();
|
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)
|
if (read_nbytes == 0)
|
||||||
{
|
{
|
||||||
rt_thread_suspend(thread);
|
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)
|
if (pipe->flag & RT_PIPE_FLAG_FORCE_WR)
|
||||||
write_nbytes = rt_ringbuffer_put_force(&(pipe->ringbuffer),
|
write_nbytes = rt_ringbuffer_put_force(&(pipe->ringbuffer),
|
||||||
buffer, size);
|
(const rt_uint8_t *)buffer, size);
|
||||||
else
|
else
|
||||||
write_nbytes = rt_ringbuffer_put(&(pipe->ringbuffer),
|
write_nbytes = rt_ringbuffer_put(&(pipe->ringbuffer),
|
||||||
buffer, size);
|
(const rt_uint8_t *)buffer, size);
|
||||||
|
|
||||||
_rt_pipe_resume_reader(pipe);
|
_rt_pipe_resume_reader(pipe);
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ static rt_size_t rt_pipe_write(rt_device_t dev,
|
||||||
|
|
||||||
do {
|
do {
|
||||||
level = rt_hw_interrupt_disable();
|
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)
|
if (write_nbytes == 0)
|
||||||
{
|
{
|
||||||
/* pipe full, waiting on suspended write list */
|
/* 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;
|
return -RT_ENOMEM;
|
||||||
|
|
||||||
/* create ring buffer of pipe */
|
/* create ring buffer of pipe */
|
||||||
rb_memptr = rt_malloc(size);
|
rb_memptr = (rt_uint8_t *)rt_malloc(size);
|
||||||
if (rb_memptr == RT_NULL)
|
if (rb_memptr == RT_NULL)
|
||||||
{
|
{
|
||||||
rt_free(pipe);
|
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_int32_t i;
|
||||||
rt_uint8_t bit;
|
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--)
|
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 i;
|
||||||
rt_uint8_t data = 0;
|
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);
|
SDA_H(ops);
|
||||||
i2c_delay(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)
|
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)
|
if (ack)
|
||||||
SET_SDA(ops, 0);
|
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_uint8_t addr,
|
||||||
rt_int32_t retries)
|
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_int32_t i;
|
||||||
rt_err_t ret = 0;
|
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 flags = msg->flags;
|
||||||
rt_uint16_t ignore_nack = msg->flags & RT_I2C_IGNORE_NACK;
|
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_uint8_t addr1, addr2;
|
||||||
rt_int32_t retries;
|
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)
|
rt_uint32_t num)
|
||||||
{
|
{
|
||||||
struct rt_i2c_msg *msg;
|
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_int32_t i, ret;
|
||||||
rt_uint16_t ignore_nack;
|
rt_uint16_t ignore_nack;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ static rt_size_t i2c_bus_device_read(rt_device_t dev,
|
||||||
addr = pos & 0xffff;
|
addr = pos & 0xffff;
|
||||||
flags = (pos >> 16) & 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,
|
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;
|
addr = pos & 0xffff;
|
||||||
flags = (pos >> 16) & 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,
|
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 */
|
/* ISR for sensor interrupt */
|
||||||
static void irq_callback(void *args)
|
static void irq_callback(void *args)
|
||||||
{
|
{
|
||||||
rt_sensor_t sensor = args;
|
rt_sensor_t sensor = (rt_sensor_t)args;
|
||||||
rt_uint8_t i;
|
rt_uint8_t i;
|
||||||
|
|
||||||
if (sensor->module)
|
if (sensor->module)
|
||||||
|
@ -389,7 +389,7 @@ int rt_hw_sensor_register(rt_sensor_t sensor,
|
||||||
|
|
||||||
/* Add a type name for the sensor device */
|
/* Add a type name for the sensor device */
|
||||||
sensor_name = sensor_name_str[sensor->info.type];
|
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)
|
if (device_name == RT_NULL)
|
||||||
{
|
{
|
||||||
LOG_E("device_name calloc failed!");
|
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)
|
static void sensor_fifo_rx_entry(void *parameter)
|
||||||
{
|
{
|
||||||
rt_device_t dev = parameter;
|
rt_device_t dev = (rt_device_t)parameter;
|
||||||
rt_sensor_t sensor = parameter;
|
rt_sensor_t sensor = (rt_sensor_t)parameter;
|
||||||
struct rt_sensor_data *data = RT_NULL;
|
struct rt_sensor_data *data = RT_NULL;
|
||||||
struct rt_sensor_info info;
|
struct rt_sensor_info info;
|
||||||
rt_size_t res, i;
|
rt_size_t res, i;
|
||||||
|
|
||||||
rt_device_control(dev, RT_SENSOR_CTRL_GET_INFO, &info);
|
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)
|
if (data == RT_NULL)
|
||||||
{
|
{
|
||||||
LOG_E("Memory allocation failed!");
|
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)
|
static void sensor_irq_rx_entry(void *parameter)
|
||||||
{
|
{
|
||||||
rt_device_t dev = parameter;
|
rt_device_t dev = (rt_device_t)parameter;
|
||||||
rt_sensor_t sensor = parameter;
|
rt_sensor_t sensor = (rt_sensor_t)parameter;
|
||||||
struct rt_sensor_data data;
|
struct rt_sensor_data data;
|
||||||
rt_size_t res, i = 0;
|
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)
|
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
|
#ifdef RT_SERIAL_USING_DMA
|
||||||
else if (dev->open_flag & RT_DEVICE_FLAG_DMA_RX)
|
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 */
|
#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,
|
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)
|
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
|
#ifdef RT_SERIAL_USING_DMA
|
||||||
else if (dev->open_flag & RT_DEVICE_FLAG_DMA_TX)
|
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 */
|
#endif /* RT_SERIAL_USING_DMA */
|
||||||
else
|
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_pipe_t *pipe;
|
||||||
rt_device_t dev;
|
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;
|
if (pipe == RT_NULL) return RT_NULL;
|
||||||
|
|
||||||
rt_memset(pipe, 0, sizeof(rt_pipe_t));
|
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_base_t level;
|
||||||
rt_size_t empty1 = 0, empty2 = 0;
|
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(rbb);
|
||||||
RT_ASSERT(blk_size < (1L << 24));
|
RT_ASSERT(blk_size < (1L << 24));
|
||||||
|
|
||||||
level = rt_hw_interrupt_disable();
|
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)
|
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)
|
if (empty1 >= blk_size)
|
||||||
{
|
{
|
||||||
rt_slist_append(&rbb->blk_list, &new->list);
|
rt_slist_append(&rbb->blk_list, &new_rbb->list);
|
||||||
new->status = RT_RBB_BLK_INITED;
|
new_rbb->status = RT_RBB_BLK_INITED;
|
||||||
new->buf = tail->buf + tail->size;
|
new_rbb->buf = tail->buf + tail->size;
|
||||||
new->size = blk_size;
|
new_rbb->size = blk_size;
|
||||||
}
|
}
|
||||||
else if (empty2 >= blk_size)
|
else if (empty2 >= blk_size)
|
||||||
{
|
{
|
||||||
rt_slist_append(&rbb->blk_list, &new->list);
|
rt_slist_append(&rbb->blk_list, &new_rbb->list);
|
||||||
new->status = RT_RBB_BLK_INITED;
|
new_rbb->status = RT_RBB_BLK_INITED;
|
||||||
new->buf = rbb->buf;
|
new_rbb->buf = rbb->buf;
|
||||||
new->size = blk_size;
|
new_rbb->size = blk_size;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* no space */
|
/* no space */
|
||||||
new = NULL;
|
new_rbb = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
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)
|
if (empty1 >= blk_size)
|
||||||
{
|
{
|
||||||
rt_slist_append(&rbb->blk_list, &new->list);
|
rt_slist_append(&rbb->blk_list, &new_rbb->list);
|
||||||
new->status = RT_RBB_BLK_INITED;
|
new_rbb->status = RT_RBB_BLK_INITED;
|
||||||
new->buf = tail->buf + tail->size;
|
new_rbb->buf = tail->buf + tail->size;
|
||||||
new->size = blk_size;
|
new_rbb->size = blk_size;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* no space */
|
/* no space */
|
||||||
new = NULL;
|
new_rbb = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* the list is empty */
|
/* the list is empty */
|
||||||
rt_slist_append(&rbb->blk_list, &new->list);
|
rt_slist_append(&rbb->blk_list, &new_rbb->list);
|
||||||
new->status = RT_RBB_BLK_INITED;
|
new_rbb->status = RT_RBB_BLK_INITED;
|
||||||
new->buf = rbb->buf;
|
new_rbb->buf = rbb->buf;
|
||||||
new->size = blk_size;
|
new_rbb->size = blk_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
new = NULL;
|
new_rbb = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
rt_hw_interrupt_enable(level);
|
rt_hw_interrupt_enable(level);
|
||||||
|
|
||||||
return new;
|
return new_rbb;
|
||||||
}
|
}
|
||||||
RTM_EXPORT(rt_rbb_blk_alloc);
|
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);
|
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)
|
if (rb == RT_NULL)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
pool = rt_malloc(size);
|
pool = (rt_uint8_t *)rt_malloc(size);
|
||||||
if (pool == RT_NULL)
|
if (pool == RT_NULL)
|
||||||
{
|
{
|
||||||
rt_free(rb);
|
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"));
|
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbd_device_new\n"));
|
||||||
|
|
||||||
/* allocate memory for the object */
|
/* allocate memory for the object */
|
||||||
udevice = rt_malloc(sizeof(struct udevice));
|
udevice = (udevice_t)rt_malloc(sizeof(struct udevice));
|
||||||
if(udevice == RT_NULL)
|
if(udevice == RT_NULL)
|
||||||
{
|
{
|
||||||
rt_kprintf("alloc memery failed\n");
|
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"));
|
RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbd_config_new\n"));
|
||||||
|
|
||||||
/* allocate memory for the object */
|
/* allocate memory for the object */
|
||||||
cfg = rt_malloc(sizeof(struct uconfig));
|
cfg = (uconfig_t)rt_malloc(sizeof(struct uconfig));
|
||||||
if(cfg == RT_NULL)
|
if(cfg == RT_NULL)
|
||||||
{
|
{
|
||||||
rt_kprintf("alloc memery failed\n");
|
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 = &device->dcd->ep0;
|
||||||
ep0->request.size = size;
|
ep0->request.size = size;
|
||||||
ep0->request.buffer = buffer;
|
ep0->request.buffer = (rt_uint8_t *)buffer;
|
||||||
ep0->request.remain_size = size;
|
ep0->request.remain_size = size;
|
||||||
if(size >= ep0->id->maxpacket)
|
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);
|
RT_ASSERT(buffer != RT_NULL);
|
||||||
|
|
||||||
ep0 = &device->dcd->ep0;
|
ep0 = &device->dcd->ep0;
|
||||||
ep0->request.buffer = buffer;
|
ep0->request.buffer = (rt_uint8_t *)buffer;
|
||||||
ep0->request.remain_size = size;
|
ep0->request.remain_size = size;
|
||||||
ep0->rx_indicate = rx_ind;
|
ep0->rx_indicate = rx_ind;
|
||||||
if(size >= ep0->id->maxpacket)
|
if(size >= ep0->id->maxpacket)
|
||||||
|
|
|
@ -56,7 +56,7 @@ int finsh_set_prompt(const char * prompt)
|
||||||
/* strdup */
|
/* strdup */
|
||||||
if(prompt)
|
if(prompt)
|
||||||
{
|
{
|
||||||
finsh_prompt_custom = rt_malloc(strlen(prompt)+1);
|
finsh_prompt_custom = (char *)rt_malloc(strlen(prompt)+1);
|
||||||
if(finsh_prompt_custom)
|
if(finsh_prompt_custom)
|
||||||
{
|
{
|
||||||
strcpy(finsh_prompt_custom, prompt);
|
strcpy(finsh_prompt_custom, prompt);
|
||||||
|
|
10
src/ipc.c
10
src/ipc.c
|
@ -1308,7 +1308,7 @@ rt_err_t rt_mb_init(rt_mailbox_t mb,
|
||||||
rt_ipc_object_init(&(mb->parent));
|
rt_ipc_object_init(&(mb->parent));
|
||||||
|
|
||||||
/* init mailbox */
|
/* init mailbox */
|
||||||
mb->msg_pool = msgpool;
|
mb->msg_pool = (rt_ubase_t *)msgpool;
|
||||||
mb->size = size;
|
mb->size = size;
|
||||||
mb->entry = 0;
|
mb->entry = 0;
|
||||||
mb->in_offset = 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 */
|
/* init mailbox */
|
||||||
mb->size = size;
|
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)
|
if (mb->msg_pool == RT_NULL)
|
||||||
{
|
{
|
||||||
/* delete mailbox object */
|
/* 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 +
|
head = (struct rt_mq_message *)((rt_uint8_t *)mq->msg_pool +
|
||||||
temp * (mq->msg_size + sizeof(struct rt_mq_message)));
|
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;
|
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 +
|
head = (struct rt_mq_message *)((rt_uint8_t *)mq->msg_pool +
|
||||||
temp * (mq->msg_size + sizeof(struct rt_mq_message)));
|
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;
|
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();
|
temp = rt_hw_interrupt_disable();
|
||||||
|
|
||||||
/* link msg to the beginning of message queue */
|
/* 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;
|
mq->msg_queue_head = msg;
|
||||||
|
|
||||||
/* if there is no tail */
|
/* 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;
|
const unsigned char *su1, *su2;
|
||||||
int res = 0;
|
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)
|
if ((res = *su1 - *su2) != 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1117,14 +1117,14 @@ RTM_EXPORT(rt_console_get_device);
|
||||||
*/
|
*/
|
||||||
rt_device_t rt_console_set_device(const char *name)
|
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 */
|
/* save old device */
|
||||||
old = _console_device;
|
old_device = _console_device;
|
||||||
|
|
||||||
/* find new console device */
|
/* find new console device */
|
||||||
new = rt_device_find(name);
|
new_device = rt_device_find(name);
|
||||||
if (new != RT_NULL)
|
if (new_device != RT_NULL)
|
||||||
{
|
{
|
||||||
if (_console_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 */
|
/* set new console device */
|
||||||
rt_device_open(new, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_STREAM);
|
rt_device_open(new_device, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_STREAM);
|
||||||
_console_device = new;
|
_console_device = new_device;
|
||||||
}
|
}
|
||||||
|
|
||||||
return old;
|
return old_device;
|
||||||
}
|
}
|
||||||
RTM_EXPORT(rt_console_set_device);
|
RTM_EXPORT(rt_console_set_device);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1332,7 +1332,9 @@ int __rt_ffs(int value)
|
||||||
|
|
||||||
#ifdef RT_DEBUG
|
#ifdef RT_DEBUG
|
||||||
/* RT_ASSERT(EX)'s hook */
|
/* RT_ASSERT(EX)'s hook */
|
||||||
|
|
||||||
void (*rt_assert_hook)(const char *ex, const char *func, rt_size_t line);
|
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.
|
* 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);
|
(void *)rt_thread_exit);
|
||||||
#else
|
#else
|
||||||
thread->sp = (void *)rt_hw_stack_init(thread->entry, thread->parameter,
|
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);
|
(void *)rt_thread_exit);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue