Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Mozi
rt-thread
提交
65ecca80
R
rt-thread
项目概览
Mozi
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
0
Star
0
Fork
0
代码
文件
提交
分支
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,发现更多精彩内容 >>
提交
65ecca80
编写于
1月 14, 2022
作者:
mysterywolf
提交者:
Bernard Xiong
1月 20, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[kernel] improve comments
上级
563e4989
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
36 addition
and
26 deletion
+36
-26
src/device.c
src/device.c
+15
-6
src/ipc.c
src/ipc.c
+7
-6
src/thread.c
src/thread.c
+8
-8
src/timer.c
src/timer.c
+6
-6
未找到文件。
src/device.c
浏览文件 @
65ecca80
...
@@ -82,6 +82,7 @@ RTM_EXPORT(rt_device_register);
...
@@ -82,6 +82,7 @@ RTM_EXPORT(rt_device_register);
*/
*/
rt_err_t
rt_device_unregister
(
rt_device_t
dev
)
rt_err_t
rt_device_unregister
(
rt_device_t
dev
)
{
{
/* parameter check */
RT_ASSERT
(
dev
!=
RT_NULL
);
RT_ASSERT
(
dev
!=
RT_NULL
);
RT_ASSERT
(
rt_object_get_type
(
&
dev
->
parent
)
==
RT_Object_Class_Device
);
RT_ASSERT
(
rt_object_get_type
(
&
dev
->
parent
)
==
RT_Object_Class_Device
);
RT_ASSERT
(
rt_object_is_systemobject
(
&
dev
->
parent
));
RT_ASSERT
(
rt_object_is_systemobject
(
&
dev
->
parent
));
...
@@ -143,6 +144,7 @@ RTM_EXPORT(rt_device_create);
...
@@ -143,6 +144,7 @@ RTM_EXPORT(rt_device_create);
*/
*/
void
rt_device_destroy
(
rt_device_t
dev
)
void
rt_device_destroy
(
rt_device_t
dev
)
{
{
/* parameter check */
RT_ASSERT
(
dev
!=
RT_NULL
);
RT_ASSERT
(
dev
!=
RT_NULL
);
RT_ASSERT
(
rt_object_get_type
(
&
dev
->
parent
)
==
RT_Object_Class_Device
);
RT_ASSERT
(
rt_object_get_type
(
&
dev
->
parent
)
==
RT_Object_Class_Device
);
RT_ASSERT
(
rt_object_is_systemobject
(
&
dev
->
parent
)
==
RT_FALSE
);
RT_ASSERT
(
rt_object_is_systemobject
(
&
dev
->
parent
)
==
RT_FALSE
);
...
@@ -202,6 +204,7 @@ rt_err_t rt_device_open(rt_device_t dev, rt_uint16_t oflag)
...
@@ -202,6 +204,7 @@ rt_err_t rt_device_open(rt_device_t dev, rt_uint16_t oflag)
{
{
rt_err_t
result
=
RT_EOK
;
rt_err_t
result
=
RT_EOK
;
/* parameter check */
RT_ASSERT
(
dev
!=
RT_NULL
);
RT_ASSERT
(
dev
!=
RT_NULL
);
RT_ASSERT
(
rt_object_get_type
(
&
dev
->
parent
)
==
RT_Object_Class_Device
);
RT_ASSERT
(
rt_object_get_type
(
&
dev
->
parent
)
==
RT_Object_Class_Device
);
...
@@ -267,6 +270,7 @@ rt_err_t rt_device_close(rt_device_t dev)
...
@@ -267,6 +270,7 @@ rt_err_t rt_device_close(rt_device_t dev)
{
{
rt_err_t
result
=
RT_EOK
;
rt_err_t
result
=
RT_EOK
;
/* parameter check */
RT_ASSERT
(
dev
!=
RT_NULL
);
RT_ASSERT
(
dev
!=
RT_NULL
);
RT_ASSERT
(
rt_object_get_type
(
&
dev
->
parent
)
==
RT_Object_Class_Device
);
RT_ASSERT
(
rt_object_get_type
(
&
dev
->
parent
)
==
RT_Object_Class_Device
);
...
@@ -312,6 +316,7 @@ rt_size_t rt_device_read(rt_device_t dev,
...
@@ -312,6 +316,7 @@ rt_size_t rt_device_read(rt_device_t dev,
void
*
buffer
,
void
*
buffer
,
rt_size_t
size
)
rt_size_t
size
)
{
{
/* parameter check */
RT_ASSERT
(
dev
!=
RT_NULL
);
RT_ASSERT
(
dev
!=
RT_NULL
);
RT_ASSERT
(
rt_object_get_type
(
&
dev
->
parent
)
==
RT_Object_Class_Device
);
RT_ASSERT
(
rt_object_get_type
(
&
dev
->
parent
)
==
RT_Object_Class_Device
);
...
@@ -354,6 +359,7 @@ rt_size_t rt_device_write(rt_device_t dev,
...
@@ -354,6 +359,7 @@ rt_size_t rt_device_write(rt_device_t dev,
const
void
*
buffer
,
const
void
*
buffer
,
rt_size_t
size
)
rt_size_t
size
)
{
{
/* parameter check */
RT_ASSERT
(
dev
!=
RT_NULL
);
RT_ASSERT
(
dev
!=
RT_NULL
);
RT_ASSERT
(
rt_object_get_type
(
&
dev
->
parent
)
==
RT_Object_Class_Device
);
RT_ASSERT
(
rt_object_get_type
(
&
dev
->
parent
)
==
RT_Object_Class_Device
);
...
@@ -389,6 +395,7 @@ RTM_EXPORT(rt_device_write);
...
@@ -389,6 +395,7 @@ RTM_EXPORT(rt_device_write);
*/
*/
rt_err_t
rt_device_control
(
rt_device_t
dev
,
int
cmd
,
void
*
arg
)
rt_err_t
rt_device_control
(
rt_device_t
dev
,
int
cmd
,
void
*
arg
)
{
{
/* parameter check */
RT_ASSERT
(
dev
!=
RT_NULL
);
RT_ASSERT
(
dev
!=
RT_NULL
);
RT_ASSERT
(
rt_object_get_type
(
&
dev
->
parent
)
==
RT_Object_Class_Device
);
RT_ASSERT
(
rt_object_get_type
(
&
dev
->
parent
)
==
RT_Object_Class_Device
);
...
@@ -412,10 +419,11 @@ RTM_EXPORT(rt_device_control);
...
@@ -412,10 +419,11 @@ RTM_EXPORT(rt_device_control);
*
*
* @return RT_EOK
* @return RT_EOK
*/
*/
rt_err_t
rt_err_t
rt_device_set_rx_indicate
(
rt_device_t
dev
,
rt_device_set_rx_indicate
(
rt_device_t
dev
,
rt_err_t
(
*
rx_ind
)
(
rt_device_t
dev
,
rt_err_t
(
*
rx_ind
)(
rt_device_t
dev
,
rt_size_t
size
))
rt_size_t
size
))
{
{
/* parameter check */
RT_ASSERT
(
dev
!=
RT_NULL
);
RT_ASSERT
(
dev
!=
RT_NULL
);
RT_ASSERT
(
rt_object_get_type
(
&
dev
->
parent
)
==
RT_Object_Class_Device
);
RT_ASSERT
(
rt_object_get_type
(
&
dev
->
parent
)
==
RT_Object_Class_Device
);
...
@@ -435,10 +443,11 @@ RTM_EXPORT(rt_device_set_rx_indicate);
...
@@ -435,10 +443,11 @@ RTM_EXPORT(rt_device_set_rx_indicate);
*
*
* @return RT_EOK
* @return RT_EOK
*/
*/
rt_err_t
rt_err_t
rt_device_set_tx_complete
(
rt_device_t
dev
,
rt_device_set_tx_complete
(
rt_device_t
dev
,
rt_err_t
(
*
tx_done
)
(
rt_device_t
dev
,
rt_err_t
(
*
tx_done
)(
rt_device_t
dev
,
void
*
buffer
))
void
*
buffer
))
{
{
/* parameter check */
RT_ASSERT
(
dev
!=
RT_NULL
);
RT_ASSERT
(
dev
!=
RT_NULL
);
RT_ASSERT
(
rt_object_get_type
(
&
dev
->
parent
)
==
RT_Object_Class_Device
);
RT_ASSERT
(
rt_object_get_type
(
&
dev
->
parent
)
==
RT_Object_Class_Device
);
...
...
src/ipc.c
浏览文件 @
65ecca80
...
@@ -725,8 +725,7 @@ RTM_EXPORT(rt_sem_control);
...
@@ -725,8 +725,7 @@ RTM_EXPORT(rt_sem_control);
*
*
* @param flag is the mutex flag, which determines the queuing way of how multiple threads wait
* @param flag is the mutex flag, which determines the queuing way of how multiple threads wait
* when the mutex is not available.
* when the mutex is not available.
* NOTE: The mutex flag can ONLY be RT_IPC_FLAG_PRIO. Using RT_IPC_FLAG_FIFO will seriously affect
* NOTE: This parameter has been obsoleted. It can be RT_IPC_FLAG_PRIO, RT_IPC_FLAG_FIFO or RT_NULL.
* the real-time performance of the system.
*
*
* @return Return the operation status. When the return value is RT_EOK, the initialization is successful.
* @return Return the operation status. When the return value is RT_EOK, the initialization is successful.
* If the return value is any other values, it represents the initialization failed.
* If the return value is any other values, it represents the initialization failed.
...
@@ -735,7 +734,8 @@ RTM_EXPORT(rt_sem_control);
...
@@ -735,7 +734,8 @@ RTM_EXPORT(rt_sem_control);
*/
*/
rt_err_t
rt_mutex_init
(
rt_mutex_t
mutex
,
const
char
*
name
,
rt_uint8_t
flag
)
rt_err_t
rt_mutex_init
(
rt_mutex_t
mutex
,
const
char
*
name
,
rt_uint8_t
flag
)
{
{
(
void
)
flag
;
/* flag parameter has been obsoleted */
RT_UNUSED
(
flag
);
/* parameter check */
/* parameter check */
RT_ASSERT
(
mutex
!=
RT_NULL
);
RT_ASSERT
(
mutex
!=
RT_NULL
);
...
@@ -807,8 +807,7 @@ RTM_EXPORT(rt_mutex_detach);
...
@@ -807,8 +807,7 @@ RTM_EXPORT(rt_mutex_detach);
*
*
* @param flag is the mutex flag, which determines the queuing way of how multiple threads wait
* @param flag is the mutex flag, which determines the queuing way of how multiple threads wait
* when the mutex is not available.
* when the mutex is not available.
* NOTE: The mutex flag can ONLY be RT_IPC_FLAG_PRIO. Using RT_IPC_FLAG_FIFO will seriously affect
* NOTE: This parameter has been obsoleted. It can be RT_IPC_FLAG_PRIO, RT_IPC_FLAG_FIFO or RT_NULL.
* the real-time performance of the system.
*
*
* @return Return a pointer to the mutex object. When the return value is RT_NULL, it means the creation failed.
* @return Return a pointer to the mutex object. When the return value is RT_NULL, it means the creation failed.
*
*
...
@@ -817,7 +816,9 @@ RTM_EXPORT(rt_mutex_detach);
...
@@ -817,7 +816,9 @@ RTM_EXPORT(rt_mutex_detach);
rt_mutex_t
rt_mutex_create
(
const
char
*
name
,
rt_uint8_t
flag
)
rt_mutex_t
rt_mutex_create
(
const
char
*
name
,
rt_uint8_t
flag
)
{
{
struct
rt_mutex
*
mutex
;
struct
rt_mutex
*
mutex
;
(
void
)
flag
;
/* flag parameter has been obsoleted */
RT_UNUSED
(
flag
);
RT_DEBUG_NOT_IN_INTERRUPT
;
RT_DEBUG_NOT_IN_INTERRUPT
;
...
...
src/thread.c
浏览文件 @
65ecca80
...
@@ -130,7 +130,7 @@ static void _thread_timeout(void *parameter)
...
@@ -130,7 +130,7 @@ static void _thread_timeout(void *parameter)
thread
=
(
struct
rt_thread
*
)
parameter
;
thread
=
(
struct
rt_thread
*
)
parameter
;
/*
thread
check */
/*
parameter
check */
RT_ASSERT
(
thread
!=
RT_NULL
);
RT_ASSERT
(
thread
!=
RT_NULL
);
RT_ASSERT
((
thread
->
stat
&
RT_THREAD_STAT_MASK
)
==
RT_THREAD_SUSPEND
);
RT_ASSERT
((
thread
->
stat
&
RT_THREAD_STAT_MASK
)
==
RT_THREAD_SUSPEND
);
RT_ASSERT
(
rt_object_get_type
((
rt_object_t
)
thread
)
==
RT_Object_Class_Thread
);
RT_ASSERT
(
rt_object_get_type
((
rt_object_t
)
thread
)
==
RT_Object_Class_Thread
);
...
@@ -289,7 +289,7 @@ rt_err_t rt_thread_init(struct rt_thread *thread,
...
@@ -289,7 +289,7 @@ rt_err_t rt_thread_init(struct rt_thread *thread,
rt_uint8_t
priority
,
rt_uint8_t
priority
,
rt_uint32_t
tick
)
rt_uint32_t
tick
)
{
{
/*
thread
check */
/*
parameter
check */
RT_ASSERT
(
thread
!=
RT_NULL
);
RT_ASSERT
(
thread
!=
RT_NULL
);
RT_ASSERT
(
stack_start
!=
RT_NULL
);
RT_ASSERT
(
stack_start
!=
RT_NULL
);
...
@@ -340,7 +340,7 @@ RTM_EXPORT(rt_thread_self);
...
@@ -340,7 +340,7 @@ RTM_EXPORT(rt_thread_self);
*/
*/
rt_err_t
rt_thread_startup
(
rt_thread_t
thread
)
rt_err_t
rt_thread_startup
(
rt_thread_t
thread
)
{
{
/*
thread
check */
/*
parameter
check */
RT_ASSERT
(
thread
!=
RT_NULL
);
RT_ASSERT
(
thread
!=
RT_NULL
);
RT_ASSERT
((
thread
->
stat
&
RT_THREAD_STAT_MASK
)
==
RT_THREAD_INIT
);
RT_ASSERT
((
thread
->
stat
&
RT_THREAD_STAT_MASK
)
==
RT_THREAD_INIT
);
RT_ASSERT
(
rt_object_get_type
((
rt_object_t
)
thread
)
==
RT_Object_Class_Thread
);
RT_ASSERT
(
rt_object_get_type
((
rt_object_t
)
thread
)
==
RT_Object_Class_Thread
);
...
@@ -383,7 +383,7 @@ rt_err_t rt_thread_detach(rt_thread_t thread)
...
@@ -383,7 +383,7 @@ rt_err_t rt_thread_detach(rt_thread_t thread)
{
{
rt_base_t
lock
;
rt_base_t
lock
;
/*
thread
check */
/*
parameter
check */
RT_ASSERT
(
thread
!=
RT_NULL
);
RT_ASSERT
(
thread
!=
RT_NULL
);
RT_ASSERT
(
rt_object_get_type
((
rt_object_t
)
thread
)
==
RT_Object_Class_Thread
);
RT_ASSERT
(
rt_object_get_type
((
rt_object_t
)
thread
)
==
RT_Object_Class_Thread
);
RT_ASSERT
(
rt_object_is_systemobject
((
rt_object_t
)
thread
));
RT_ASSERT
(
rt_object_is_systemobject
((
rt_object_t
)
thread
));
...
@@ -486,7 +486,7 @@ rt_err_t rt_thread_delete(rt_thread_t thread)
...
@@ -486,7 +486,7 @@ rt_err_t rt_thread_delete(rt_thread_t thread)
{
{
rt_base_t
lock
;
rt_base_t
lock
;
/*
thread
check */
/*
parameter
check */
RT_ASSERT
(
thread
!=
RT_NULL
);
RT_ASSERT
(
thread
!=
RT_NULL
);
RT_ASSERT
(
rt_object_get_type
((
rt_object_t
)
thread
)
==
RT_Object_Class_Thread
);
RT_ASSERT
(
rt_object_get_type
((
rt_object_t
)
thread
)
==
RT_Object_Class_Thread
);
RT_ASSERT
(
rt_object_is_systemobject
((
rt_object_t
)
thread
)
==
RT_FALSE
);
RT_ASSERT
(
rt_object_is_systemobject
((
rt_object_t
)
thread
)
==
RT_FALSE
);
...
@@ -703,7 +703,7 @@ rt_err_t rt_thread_control(rt_thread_t thread, int cmd, void *arg)
...
@@ -703,7 +703,7 @@ rt_err_t rt_thread_control(rt_thread_t thread, int cmd, void *arg)
{
{
register
rt_base_t
temp
;
register
rt_base_t
temp
;
/*
thread
check */
/*
parameter
check */
RT_ASSERT
(
thread
!=
RT_NULL
);
RT_ASSERT
(
thread
!=
RT_NULL
);
RT_ASSERT
(
rt_object_get_type
((
rt_object_t
)
thread
)
==
RT_Object_Class_Thread
);
RT_ASSERT
(
rt_object_get_type
((
rt_object_t
)
thread
)
==
RT_Object_Class_Thread
);
...
@@ -821,7 +821,7 @@ rt_err_t rt_thread_suspend(rt_thread_t thread)
...
@@ -821,7 +821,7 @@ rt_err_t rt_thread_suspend(rt_thread_t thread)
register
rt_base_t
stat
;
register
rt_base_t
stat
;
register
rt_base_t
temp
;
register
rt_base_t
temp
;
/*
thread
check */
/*
parameter
check */
RT_ASSERT
(
thread
!=
RT_NULL
);
RT_ASSERT
(
thread
!=
RT_NULL
);
RT_ASSERT
(
rt_object_get_type
((
rt_object_t
)
thread
)
==
RT_Object_Class_Thread
);
RT_ASSERT
(
rt_object_get_type
((
rt_object_t
)
thread
)
==
RT_Object_Class_Thread
);
RT_ASSERT
(
thread
==
rt_thread_self
());
RT_ASSERT
(
thread
==
rt_thread_self
());
...
@@ -867,7 +867,7 @@ rt_err_t rt_thread_resume(rt_thread_t thread)
...
@@ -867,7 +867,7 @@ rt_err_t rt_thread_resume(rt_thread_t thread)
{
{
register
rt_base_t
temp
;
register
rt_base_t
temp
;
/*
thread
check */
/*
parameter
check */
RT_ASSERT
(
thread
!=
RT_NULL
);
RT_ASSERT
(
thread
!=
RT_NULL
);
RT_ASSERT
(
rt_object_get_type
((
rt_object_t
)
thread
)
==
RT_Object_Class_Thread
);
RT_ASSERT
(
rt_object_get_type
((
rt_object_t
)
thread
)
==
RT_Object_Class_Thread
);
...
...
src/timer.c
浏览文件 @
65ecca80
...
@@ -257,7 +257,7 @@ void rt_timer_init(rt_timer_t timer,
...
@@ -257,7 +257,7 @@ void rt_timer_init(rt_timer_t timer,
rt_tick_t
time
,
rt_tick_t
time
,
rt_uint8_t
flag
)
rt_uint8_t
flag
)
{
{
/*
tim
er check */
/*
paramet
er check */
RT_ASSERT
(
timer
!=
RT_NULL
);
RT_ASSERT
(
timer
!=
RT_NULL
);
/* timer object initialization */
/* timer object initialization */
...
@@ -278,7 +278,7 @@ rt_err_t rt_timer_detach(rt_timer_t timer)
...
@@ -278,7 +278,7 @@ rt_err_t rt_timer_detach(rt_timer_t timer)
{
{
register
rt_base_t
level
;
register
rt_base_t
level
;
/*
tim
er check */
/*
paramet
er check */
RT_ASSERT
(
timer
!=
RT_NULL
);
RT_ASSERT
(
timer
!=
RT_NULL
);
RT_ASSERT
(
rt_object_get_type
(
&
timer
->
parent
)
==
RT_Object_Class_Timer
);
RT_ASSERT
(
rt_object_get_type
(
&
timer
->
parent
)
==
RT_Object_Class_Timer
);
RT_ASSERT
(
rt_object_is_systemobject
(
&
timer
->
parent
));
RT_ASSERT
(
rt_object_is_systemobject
(
&
timer
->
parent
));
...
@@ -347,7 +347,7 @@ rt_err_t rt_timer_delete(rt_timer_t timer)
...
@@ -347,7 +347,7 @@ rt_err_t rt_timer_delete(rt_timer_t timer)
{
{
register
rt_base_t
level
;
register
rt_base_t
level
;
/*
tim
er check */
/*
paramet
er check */
RT_ASSERT
(
timer
!=
RT_NULL
);
RT_ASSERT
(
timer
!=
RT_NULL
);
RT_ASSERT
(
rt_object_get_type
(
&
timer
->
parent
)
==
RT_Object_Class_Timer
);
RT_ASSERT
(
rt_object_get_type
(
&
timer
->
parent
)
==
RT_Object_Class_Timer
);
RT_ASSERT
(
rt_object_is_systemobject
(
&
timer
->
parent
)
==
RT_FALSE
);
RT_ASSERT
(
rt_object_is_systemobject
(
&
timer
->
parent
)
==
RT_FALSE
);
...
@@ -386,7 +386,7 @@ rt_err_t rt_timer_start(rt_timer_t timer)
...
@@ -386,7 +386,7 @@ rt_err_t rt_timer_start(rt_timer_t timer)
unsigned
int
tst_nr
;
unsigned
int
tst_nr
;
static
unsigned
int
random_nr
;
static
unsigned
int
random_nr
;
/*
tim
er check */
/*
paramet
er check */
RT_ASSERT
(
timer
!=
RT_NULL
);
RT_ASSERT
(
timer
!=
RT_NULL
);
RT_ASSERT
(
rt_object_get_type
(
&
timer
->
parent
)
==
RT_Object_Class_Timer
);
RT_ASSERT
(
rt_object_get_type
(
&
timer
->
parent
)
==
RT_Object_Class_Timer
);
...
@@ -511,7 +511,7 @@ rt_err_t rt_timer_stop(rt_timer_t timer)
...
@@ -511,7 +511,7 @@ rt_err_t rt_timer_stop(rt_timer_t timer)
{
{
register
rt_base_t
level
;
register
rt_base_t
level
;
/*
tim
er check */
/*
paramet
er check */
RT_ASSERT
(
timer
!=
RT_NULL
);
RT_ASSERT
(
timer
!=
RT_NULL
);
RT_ASSERT
(
rt_object_get_type
(
&
timer
->
parent
)
==
RT_Object_Class_Timer
);
RT_ASSERT
(
rt_object_get_type
(
&
timer
->
parent
)
==
RT_Object_Class_Timer
);
...
@@ -547,7 +547,7 @@ rt_err_t rt_timer_control(rt_timer_t timer, int cmd, void *arg)
...
@@ -547,7 +547,7 @@ rt_err_t rt_timer_control(rt_timer_t timer, int cmd, void *arg)
{
{
register
rt_base_t
level
;
register
rt_base_t
level
;
/*
tim
er check */
/*
paramet
er check */
RT_ASSERT
(
timer
!=
RT_NULL
);
RT_ASSERT
(
timer
!=
RT_NULL
);
RT_ASSERT
(
rt_object_get_type
(
&
timer
->
parent
)
==
RT_Object_Class_Timer
);
RT_ASSERT
(
rt_object_get_type
(
&
timer
->
parent
)
==
RT_Object_Class_Timer
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录