Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
992d3af3
R
rt-thread
项目概览
BaiXuePrincess
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
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,发现更多精彩内容 >>
提交
992d3af3
编写于
12月 16, 2019
作者:
B
Bernard Xiong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[kernel] code and comments cleanup
上级
bb9a5581
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
67 addition
and
67 deletion
+67
-67
include/libc/libc_signal.h
include/libc/libc_signal.h
+3
-3
include/rtdef.h
include/rtdef.h
+1
-1
include/rthw.h
include/rthw.h
+1
-1
src/clock.c
src/clock.c
+1
-1
src/device.c
src/device.c
+8
-8
src/ipc.c
src/ipc.c
+47
-47
src/kservice.c
src/kservice.c
+1
-1
src/signal.c
src/signal.c
+2
-2
src/thread.c
src/thread.c
+3
-3
未找到文件。
include/libc/libc_signal.h
浏览文件 @
992d3af3
...
...
@@ -24,7 +24,7 @@ extern "C" {
NOTE: P1003.1c/D10, p. 34 adds sigev_notify_function and
sigev_notify_attributes to the sigevent structure. */
union
sigval
union
sigval
{
int
sival_int
;
/* Integer signal value */
void
*
sival_ptr
;
/* Pointer signal value */
...
...
@@ -107,7 +107,7 @@ typedef unsigned long sigset_t;
typedef
void
(
*
_sig_func_ptr
)(
int
);
struct
sigaction
struct
sigaction
{
_sig_func_ptr
sa_handler
;
sigset_t
sa_mask
;
...
...
@@ -163,7 +163,7 @@ typedef unsigned long sigset_t;
typedef
void
(
*
_sig_func_ptr
)(
int
);
struct
sigaction
struct
sigaction
{
_sig_func_ptr
sa_handler
;
sigset_t
sa_mask
;
...
...
include/rtdef.h
浏览文件 @
992d3af3
...
...
@@ -522,7 +522,7 @@ typedef siginfo_t rt_siginfo_t;
/**
* CPUs definitions
*
*
*/
struct
rt_cpu
{
...
...
include/rthw.h
浏览文件 @
992d3af3
...
...
@@ -37,7 +37,7 @@ extern "C" {
#endif
#ifndef RT_CPU_CACHE_LINE_SZ
#define RT_CPU_CACHE_LINE_SZ
32
#define RT_CPU_CACHE_LINE_SZ
32
#endif
enum
RT_HW_CACHE_OPS
...
...
src/clock.c
浏览文件 @
992d3af3
...
...
@@ -25,7 +25,7 @@ static rt_tick_t rt_tick = 0;
#endif
/**
* This function will init system tick and set it to zero.
* This function will init
ialize
system tick and set it to zero.
* @ingroup SystemInit
*
* @deprecated since 1.1.0, this function does not need to be invoked
...
...
src/device.c
浏览文件 @
992d3af3
...
...
@@ -95,7 +95,7 @@ RTM_EXPORT(rt_device_unregister);
* @return the error code, RT_EOK on successfully.
*
* @deprecated since 1.2.x, this function is not needed because the initialization
* of a device is performed when applica
it
on opens it.
* of a device is performed when applica
ti
on opens it.
*/
rt_err_t
rt_device_init_all
(
void
)
{
...
...
@@ -162,7 +162,7 @@ rt_device_t rt_device_create(int type, int attach_size)
size
=
RT_ALIGN
(
sizeof
(
struct
rt_device
),
RT_ALIGN_SIZE
);
attach_size
=
RT_ALIGN
(
attach_size
,
RT_ALIGN_SIZE
);
/* use the tot
o
al size */
/* use the total size */
size
+=
attach_size
;
device
=
(
rt_device_t
)
rt_malloc
(
size
);
...
...
@@ -208,7 +208,7 @@ rt_err_t rt_device_init(rt_device_t dev)
RT_ASSERT
(
dev
!=
RT_NULL
);
/* get device
init handler */
/* get device
_
init handler */
if
(
device_init
!=
RT_NULL
)
{
if
(
!
(
dev
->
flag
&
RT_DEVICE_FLAG_ACTIVATED
))
...
...
@@ -269,7 +269,7 @@ rt_err_t rt_device_open(rt_device_t dev, rt_uint16_t oflag)
return
-
RT_EBUSY
;
}
/* call device
open interface */
/* call device
_
open interface */
if
(
device_open
!=
RT_NULL
)
{
result
=
device_open
(
dev
,
oflag
);
...
...
@@ -317,7 +317,7 @@ rt_err_t rt_device_close(rt_device_t dev)
if
(
dev
->
ref_count
!=
0
)
return
RT_EOK
;
/* call device
close interface */
/* call device
_
close interface */
if
(
device_close
!=
RT_NULL
)
{
result
=
device_close
(
dev
);
...
...
@@ -357,7 +357,7 @@ rt_size_t rt_device_read(rt_device_t dev,
return
0
;
}
/* call device
read interface */
/* call device
_
read interface */
if
(
device_read
!=
RT_NULL
)
{
return
device_read
(
dev
,
pos
,
buffer
,
size
);
...
...
@@ -396,7 +396,7 @@ rt_size_t rt_device_write(rt_device_t dev,
return
0
;
}
/* call device
write interface */
/* call device
_
write interface */
if
(
device_write
!=
RT_NULL
)
{
return
device_write
(
dev
,
pos
,
buffer
,
size
);
...
...
@@ -423,7 +423,7 @@ rt_err_t rt_device_control(rt_device_t dev, int cmd, void *arg)
RT_ASSERT
(
dev
!=
RT_NULL
);
RT_ASSERT
(
rt_object_get_type
(
&
dev
->
parent
)
==
RT_Object_Class_Device
);
/* call device
write interface */
/* call device
_
write interface */
if
(
device_control
!=
RT_NULL
)
{
return
device_control
(
dev
,
cmd
,
arg
);
...
...
src/ipc.c
浏览文件 @
992d3af3
...
...
@@ -60,7 +60,7 @@ extern void (*rt_object_put_hook)(struct rt_object *object);
*/
rt_inline
rt_err_t
rt_ipc_object_init
(
struct
rt_ipc_object
*
ipc
)
{
/* init ipc object */
/* init
ialize
ipc object */
rt_list_init
(
&
(
ipc
->
suspend_thread
));
return
RT_EOK
;
...
...
@@ -159,13 +159,13 @@ rt_inline rt_err_t rt_ipc_list_resume_all(rt_list_t *list)
struct
rt_thread
*
thread
;
register
rt_ubase_t
temp
;
/* wakeup all suspend threads */
/* wakeup all suspend
ed
threads */
while
(
!
rt_list_isempty
(
list
))
{
/* disable interrupt */
temp
=
rt_hw_interrupt_disable
();
/* get next suspend thread */
/* get next suspend
ed
thread */
thread
=
rt_list_entry
(
list
->
next
,
struct
rt_thread
,
tlist
);
/* set error code to RT_ERROR */
thread
->
error
=
-
RT_ERROR
;
...
...
@@ -173,7 +173,7 @@ rt_inline rt_err_t rt_ipc_list_resume_all(rt_list_t *list)
/*
* resume thread
* In rt_thread_resume function, it will remove current thread from
* suspend list
* suspend
ed
list
*/
rt_thread_resume
(
thread
);
...
...
@@ -191,7 +191,7 @@ rt_inline rt_err_t rt_ipc_list_resume_all(rt_list_t *list)
*
* @param sem the semaphore object
* @param name the name of semaphore
* @param value the init value of semaphore
* @param value the init
ial
value of semaphore
* @param flag the flag of semaphore
*
* @return the operation status, RT_EOK on successful
...
...
@@ -204,13 +204,13 @@ rt_err_t rt_sem_init(rt_sem_t sem,
RT_ASSERT
(
sem
!=
RT_NULL
);
RT_ASSERT
(
value
<
0x10000U
);
/* init object */
/* init
ialize
object */
rt_object_init
(
&
(
sem
->
parent
.
parent
),
RT_Object_Class_Semaphore
,
name
);
/* init ipc object */
/* init
ialize
ipc object */
rt_ipc_object_init
(
&
(
sem
->
parent
));
/* set init value */
/* set init
ial
value */
sem
->
value
=
(
rt_uint16_t
)
value
;
/* set parent */
...
...
@@ -236,7 +236,7 @@ rt_err_t rt_sem_detach(rt_sem_t sem)
RT_ASSERT
(
rt_object_get_type
(
&
sem
->
parent
.
parent
)
==
RT_Object_Class_Semaphore
);
RT_ASSERT
(
rt_object_is_systemobject
(
&
sem
->
parent
.
parent
));
/* wakeup all suspend threads */
/* wakeup all suspend
ed
threads */
rt_ipc_list_resume_all
(
&
(
sem
->
parent
.
suspend_thread
));
/* detach semaphore object */
...
...
@@ -251,7 +251,7 @@ RTM_EXPORT(rt_sem_detach);
* This function will create a semaphore from system resource
*
* @param name the name of semaphore
* @param value the init value of semaphore
* @param value the init
ial
value of semaphore
* @param flag the flag of semaphore
*
* @return the created semaphore, RT_NULL on error happen
...
...
@@ -270,10 +270,10 @@ rt_sem_t rt_sem_create(const char *name, rt_uint32_t value, rt_uint8_t flag)
if
(
sem
==
RT_NULL
)
return
sem
;
/* init ipc object */
/* init
ialize
ipc object */
rt_ipc_object_init
(
&
(
sem
->
parent
));
/* set init value */
/* set init
ial
value */
sem
->
value
=
value
;
/* set parent */
...
...
@@ -301,7 +301,7 @@ rt_err_t rt_sem_delete(rt_sem_t sem)
RT_ASSERT
(
rt_object_get_type
(
&
sem
->
parent
.
parent
)
==
RT_Object_Class_Semaphore
);
RT_ASSERT
(
rt_object_is_systemobject
(
&
sem
->
parent
.
parent
)
==
RT_FALSE
);
/* wakeup all suspend threads */
/* wakeup all suspend
ed
threads */
rt_ipc_list_resume_all
(
&
(
sem
->
parent
.
suspend_thread
));
/* delete semaphore object */
...
...
@@ -532,10 +532,10 @@ rt_err_t rt_mutex_init(rt_mutex_t mutex, const char *name, rt_uint8_t flag)
/* parameter check */
RT_ASSERT
(
mutex
!=
RT_NULL
);
/* init object */
/* init
ialize
object */
rt_object_init
(
&
(
mutex
->
parent
.
parent
),
RT_Object_Class_Mutex
,
name
);
/* init ipc object */
/* init
ialize
ipc object */
rt_ipc_object_init
(
&
(
mutex
->
parent
));
mutex
->
value
=
1
;
...
...
@@ -566,10 +566,10 @@ rt_err_t rt_mutex_detach(rt_mutex_t mutex)
RT_ASSERT
(
rt_object_get_type
(
&
mutex
->
parent
.
parent
)
==
RT_Object_Class_Mutex
);
RT_ASSERT
(
rt_object_is_systemobject
(
&
mutex
->
parent
.
parent
));
/* wakeup all suspend threads */
/* wakeup all suspend
ed
threads */
rt_ipc_list_resume_all
(
&
(
mutex
->
parent
.
suspend_thread
));
/* detach
mutex
object */
/* detach
semaphore
object */
rt_object_detach
(
&
(
mutex
->
parent
.
parent
));
return
RT_EOK
;
...
...
@@ -598,7 +598,7 @@ rt_mutex_t rt_mutex_create(const char *name, rt_uint8_t flag)
if
(
mutex
==
RT_NULL
)
return
mutex
;
/* init ipc object */
/* init
ialize
ipc object */
rt_ipc_object_init
(
&
(
mutex
->
parent
));
mutex
->
value
=
1
;
...
...
@@ -631,7 +631,7 @@ rt_err_t rt_mutex_delete(rt_mutex_t mutex)
RT_ASSERT
(
rt_object_get_type
(
&
mutex
->
parent
.
parent
)
==
RT_Object_Class_Mutex
);
RT_ASSERT
(
rt_object_is_systemobject
(
&
mutex
->
parent
.
parent
)
==
RT_FALSE
);
/* wakeup all suspend threads */
/* wakeup all suspend
ed
threads */
rt_ipc_list_resume_all
(
&
(
mutex
->
parent
.
suspend_thread
));
/* delete mutex object */
...
...
@@ -917,16 +917,16 @@ rt_err_t rt_event_init(rt_event_t event, const char *name, rt_uint8_t flag)
/* parameter check */
RT_ASSERT
(
event
!=
RT_NULL
);
/* init object */
/* init
ialize
object */
rt_object_init
(
&
(
event
->
parent
.
parent
),
RT_Object_Class_Event
,
name
);
/* set parent flag */
event
->
parent
.
parent
.
flag
=
flag
;
/* init ipc object */
/* init
ialize
ipc object */
rt_ipc_object_init
(
&
(
event
->
parent
));
/* init event */
/* init
ialize
event */
event
->
set
=
0
;
return
RT_EOK
;
...
...
@@ -980,10 +980,10 @@ rt_event_t rt_event_create(const char *name, rt_uint8_t flag)
/* set parent */
event
->
parent
.
parent
.
flag
=
flag
;
/* init ipc object */
/* init
ialize
ipc object */
rt_ipc_object_init
(
&
(
event
->
parent
));
/* init event */
/* init
ialize
event */
event
->
set
=
0
;
return
event
;
...
...
@@ -1050,7 +1050,7 @@ rt_err_t rt_event_send(rt_event_t event, rt_uint32_t set)
event
->
set
|=
set
;
RT_OBJECT_HOOK_CALL
(
rt_object_put_hook
,
(
&
(
event
->
parent
.
parent
)));
if
(
!
rt_list_isempty
(
&
event
->
parent
.
suspend_thread
))
{
/* search thread list to resume thread */
...
...
@@ -1073,7 +1073,7 @@ rt_err_t rt_event_send(rt_event_t event, rt_uint32_t set)
{
if
(
thread
->
event_set
&
event
->
set
)
{
/* save
recie
ved event set */
/* save
the recei
ved event set */
thread
->
event_set
=
thread
->
event_set
&
event
->
set
;
/* received an OR event */
...
...
@@ -1143,7 +1143,7 @@ rt_err_t rt_event_recv(rt_event_t event,
if
(
set
==
0
)
return
-
RT_ERROR
;
/* init status */
/* init
ialize
status */
status
=
-
RT_ERROR
;
/* get current thread */
thread
=
rt_thread_self
();
...
...
@@ -1253,7 +1253,7 @@ rt_err_t rt_event_control(rt_event_t event, int cmd, void *arg)
/* parameter check */
RT_ASSERT
(
event
!=
RT_NULL
);
RT_ASSERT
(
rt_object_get_type
(
&
event
->
parent
.
parent
)
==
RT_Object_Class_Event
);
if
(
cmd
==
RT_IPC_CMD_RESET
)
{
/* disable interrupt */
...
...
@@ -1262,7 +1262,7 @@ rt_err_t rt_event_control(rt_event_t event, int cmd, void *arg)
/* resume all waiting thread */
rt_ipc_list_resume_all
(
&
event
->
parent
.
suspend_thread
);
/* init event set */
/* init
ialize
event set */
event
->
set
=
0
;
/* enable interrupt */
...
...
@@ -1299,23 +1299,23 @@ rt_err_t rt_mb_init(rt_mailbox_t mb,
{
RT_ASSERT
(
mb
!=
RT_NULL
);
/* init object */
/* init
ialize
object */
rt_object_init
(
&
(
mb
->
parent
.
parent
),
RT_Object_Class_MailBox
,
name
);
/* set parent flag */
mb
->
parent
.
parent
.
flag
=
flag
;
/* init ipc object */
/* init
ialize
ipc object */
rt_ipc_object_init
(
&
(
mb
->
parent
));
/* init mailbox */
/* init
ialize
mailbox */
mb
->
msg_pool
=
(
rt_ubase_t
*
)
msgpool
;
mb
->
size
=
size
;
mb
->
entry
=
0
;
mb
->
in_offset
=
0
;
mb
->
out_offset
=
0
;
/* init an additional list of sender suspend thread */
/* init
ialize
an additional list of sender suspend thread */
rt_list_init
(
&
(
mb
->
suspend_sender_thread
));
return
RT_EOK
;
...
...
@@ -1372,10 +1372,10 @@ rt_mailbox_t rt_mb_create(const char *name, rt_size_t size, rt_uint8_t flag)
/* set parent */
mb
->
parent
.
parent
.
flag
=
flag
;
/* init ipc object */
/* init
ialize
ipc object */
rt_ipc_object_init
(
&
(
mb
->
parent
));
/* init mailbox */
/* init
ialize
mailbox */
mb
->
size
=
size
;
mb
->
msg_pool
=
(
rt_ubase_t
*
)
RT_KERNEL_MALLOC
(
mb
->
size
*
sizeof
(
rt_ubase_t
));
if
(
mb
->
msg_pool
==
RT_NULL
)
...
...
@@ -1389,7 +1389,7 @@ rt_mailbox_t rt_mb_create(const char *name, rt_size_t size, rt_uint8_t flag)
mb
->
in_offset
=
0
;
mb
->
out_offset
=
0
;
/* init an additional list of sender suspend thread */
/* init
ialize
an additional list of sender suspend thread */
rt_list_init
(
&
(
mb
->
suspend_sender_thread
));
return
mb
;
...
...
@@ -1791,27 +1791,27 @@ rt_err_t rt_mq_init(rt_mq_t mq,
/* parameter check */
RT_ASSERT
(
mq
!=
RT_NULL
);
/* init object */
/* init
ialize
object */
rt_object_init
(
&
(
mq
->
parent
.
parent
),
RT_Object_Class_MessageQueue
,
name
);
/* set parent flag */
mq
->
parent
.
parent
.
flag
=
flag
;
/* init ipc object */
/* init
ialize
ipc object */
rt_ipc_object_init
(
&
(
mq
->
parent
));
/* set messa
s
ge pool */
/* set message pool */
mq
->
msg_pool
=
msgpool
;
/* get correct message size */
mq
->
msg_size
=
RT_ALIGN
(
msg_size
,
RT_ALIGN_SIZE
);
mq
->
max_msgs
=
pool_size
/
(
mq
->
msg_size
+
sizeof
(
struct
rt_mq_message
));
/* init message list */
/* init
ialize
message list */
mq
->
msg_queue_head
=
RT_NULL
;
mq
->
msg_queue_tail
=
RT_NULL
;
/* init message empty list */
/* init
ialize
message empty list */
mq
->
msg_queue_free
=
RT_NULL
;
for
(
temp
=
0
;
temp
<
mq
->
max_msgs
;
temp
++
)
{
...
...
@@ -1824,7 +1824,7 @@ rt_err_t rt_mq_init(rt_mq_t mq,
/* the initial entry is zero */
mq
->
entry
=
0
;
/* init an additional list of sender suspend thread */
/* init
ialize
an additional list of sender suspend thread */
rt_list_init
(
&
(
mq
->
suspend_sender_thread
));
return
RT_EOK
;
...
...
@@ -1887,10 +1887,10 @@ rt_mq_t rt_mq_create(const char *name,
/* set parent */
mq
->
parent
.
parent
.
flag
=
flag
;
/* init ipc object */
/* init
ialize
ipc object */
rt_ipc_object_init
(
&
(
mq
->
parent
));
/* init message queue */
/* init
ialize
message queue */
/* get correct message size */
mq
->
msg_size
=
RT_ALIGN
(
msg_size
,
RT_ALIGN_SIZE
);
...
...
@@ -1905,11 +1905,11 @@ rt_mq_t rt_mq_create(const char *name,
return
RT_NULL
;
}
/* init message list */
/* init
ialize
message list */
mq
->
msg_queue_head
=
RT_NULL
;
mq
->
msg_queue_tail
=
RT_NULL
;
/* init message empty list */
/* init
ialize
message empty list */
mq
->
msg_queue_free
=
RT_NULL
;
for
(
temp
=
0
;
temp
<
mq
->
max_msgs
;
temp
++
)
{
...
...
@@ -1922,7 +1922,7 @@ rt_mq_t rt_mq_create(const char *name,
/* the initial entry is zero */
mq
->
entry
=
0
;
/* init an additional list of sender suspend thread */
/* init
ialize
an additional list of sender suspend thread */
rt_list_init
(
&
(
mq
->
suspend_sender_thread
));
return
mq
;
...
...
src/kservice.c
浏览文件 @
992d3af3
...
...
@@ -316,7 +316,7 @@ RTM_EXPORT(rt_memmove);
* This function will compare two areas of memory
*
* @param cs one area of memory
* @param ct
z
nother area of memory
* @param ct
a
nother area of memory
* @param count the size of the area
*
* @return the result
...
...
src/signal.c
浏览文件 @
992d3af3
...
...
@@ -22,8 +22,8 @@
#define RT_SIG_INFO_MAX 32
#endif
#define DBG_TAG "SIGN"
#define DBG_LVL
DBG_WARNING
#define DBG_TAG
"SIGN"
#define DBG_LVL DBG_WARNING
#include <rtdbg.h>
#define sig_mask(sig_no) (1u << sig_no)
...
...
src/thread.c
浏览文件 @
992d3af3
...
...
@@ -179,7 +179,7 @@ static rt_err_t _rt_thread_init(struct rt_thread *thread,
thread
->
cleanup
=
0
;
thread
->
user_data
=
0
;
/* init thread timer */
/* init
ialize
thread timer */
rt_timer_init
(
&
(
thread
->
thread_timer
),
thread
->
name
,
rt_thread_timeout
,
...
...
@@ -242,7 +242,7 @@ rt_err_t rt_thread_init(struct rt_thread *thread,
RT_ASSERT
(
thread
!=
RT_NULL
);
RT_ASSERT
(
stack_start
!=
RT_NULL
);
/* init thread object */
/* init
ialize
thread object */
rt_object_init
((
rt_object_t
)
thread
,
RT_Object_Class_Thread
,
name
);
return
_rt_thread_init
(
thread
,
...
...
@@ -293,7 +293,7 @@ rt_err_t rt_thread_startup(rt_thread_t thread)
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
);
/* set current priority to init priority */
/* set current priority to init
ialize
priority */
thread
->
current_priority
=
thread
->
init_priority
;
/* calculate priority attribute */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录