Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2301_76519099
rt-thread
提交
d8eb0cfc
R
rt-thread
项目概览
2301_76519099
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
3
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d8eb0cfc
编写于
6月 18, 2019
作者:
T
tyustli
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix kernel and framework no cast type error
上级
34059c40
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
92 addition
and
90 deletion
+92
-90
components/dfs/filesystems/elmfat/dfs_elm.c
components/dfs/filesystems/elmfat/dfs_elm.c
+6
-6
components/dfs/filesystems/elmfat/ff.c
components/dfs/filesystems/elmfat/ff.c
+1
-1
components/dfs/src/dfs.c
components/dfs/src/dfs.c
+3
-3
components/dfs/src/dfs_file.c
components/dfs/src/dfs_file.c
+2
-2
components/dfs/src/dfs_posix.c
components/dfs/src/dfs_posix.c
+2
-2
components/dfs/src/poll.c
components/dfs/src/poll.c
+1
-1
components/drivers/audio/audio.c
components/drivers/audio/audio.c
+3
-3
components/drivers/audio/audio_pipe.c
components/drivers/audio/audio_pipe.c
+6
-6
components/drivers/i2c/i2c-bit-ops.c
components/drivers/i2c/i2c-bit-ops.c
+6
-6
components/drivers/i2c/i2c_dev.c
components/drivers/i2c/i2c_dev.c
+2
-2
components/drivers/sensors/sensor.c
components/drivers/sensors/sensor.c
+2
-2
components/drivers/sensors/sensor_cmd.c
components/drivers/sensors/sensor_cmd.c
+5
-5
components/drivers/serial/serial.c
components/drivers/serial/serial.c
+6
-6
components/drivers/src/pipe.c
components/drivers/src/pipe.c
+1
-1
components/drivers/src/ringblk_buf.c
components/drivers/src/ringblk_buf.c
+23
-23
components/drivers/src/ringbuffer.c
components/drivers/src/ringbuffer.c
+2
-2
components/drivers/usb/usbdevice/core/core.c
components/drivers/usb/usbdevice/core/core.c
+4
-4
components/finsh/shell.c
components/finsh/shell.c
+1
-1
src/ipc.c
src/ipc.c
+5
-5
src/kservice.c
src/kservice.c
+10
-8
src/thread.c
src/thread.c
+1
-1
未找到文件。
components/dfs/filesystems/elmfat/dfs_elm.c
浏览文件 @
d8eb0cfc
...
...
@@ -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
;
...
...
components/dfs/filesystems/elmfat/ff.c
浏览文件 @
d8eb0cfc
...
...
@@ -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
...
...
components/dfs/src/dfs.c
浏览文件 @
d8eb0cfc
...
...
@@ -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
;
...
...
components/dfs/src/dfs_file.c
浏览文件 @
d8eb0cfc
...
...
@@ -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 */
...
...
components/dfs/src/dfs_posix.c
浏览文件 @
d8eb0cfc
...
...
@@ -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
);
...
...
components/dfs/src/poll.c
浏览文件 @
d8eb0cfc
...
...
@@ -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
;
...
...
components/drivers/audio/audio.c
浏览文件 @
d8eb0cfc
...
...
@@ -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
);
}
...
...
components/drivers/audio/audio_pipe.c
浏览文件 @
d8eb0cfc
...
...
@@ -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
);
...
...
components/drivers/i2c/i2c-bit-ops.c
浏览文件 @
d8eb0cfc
...
...
@@ -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
;
...
...
components/drivers/i2c/i2c_dev.c
浏览文件 @
d8eb0cfc
...
...
@@ -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
,
...
...
components/drivers/sensors/sensor.c
浏览文件 @
d8eb0cfc
...
...
@@ -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!"
);
...
...
components/drivers/sensors/sensor_cmd.c
浏览文件 @
d8eb0cfc
...
...
@@ -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
;
...
...
components/drivers/serial/serial.c
浏览文件 @
d8eb0cfc
...
...
@@ -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
);
}
}
...
...
components/drivers/src/pipe.c
浏览文件 @
d8eb0cfc
...
...
@@ -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
));
...
...
components/drivers/src/ringblk_buf.c
浏览文件 @
d8eb0cfc
...
...
@@ -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
);
...
...
components/drivers/src/ringbuffer.c
浏览文件 @
d8eb0cfc
...
...
@@ -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
);
...
...
components/drivers/usb/usbdevice/core/core.c
浏览文件 @
d8eb0cfc
...
...
@@ -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
)
...
...
components/finsh/shell.c
浏览文件 @
d8eb0cfc
...
...
@@ -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
);
...
...
src/ipc.c
浏览文件 @
d8eb0cfc
...
...
@@ -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 */
...
...
src/kservice.c
浏览文件 @
d8eb0cfc
...
...
@@ -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.
*
...
...
src/thread.c
浏览文件 @
d8eb0cfc
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录