Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_46254178
rt-thread
提交
67f2f323
R
rt-thread
项目概览
weixin_46254178
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
1
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,发现更多精彩内容 >>
提交
67f2f323
编写于
8月 06, 2021
作者:
mysterywolf
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[kernel] 规范内部函数命名
上级
054f6db3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
42 addition
and
41 deletion
+42
-41
src/cpu.c
src/cpu.c
+9
-9
src/object.c
src/object.c
+5
-4
src/signal.c
src/signal.c
+4
-4
src/thread.c
src/thread.c
+24
-24
未找到文件。
src/cpu.c
浏览文件 @
67f2f323
...
...
@@ -11,13 +11,13 @@
#include <rtthread.h>
#ifdef RT_USING_SMP
static
struct
rt_cpu
rt
_cpus
[
RT_CPUS_NR
];
static
struct
rt_cpu
_cpus
[
RT_CPUS_NR
];
rt_hw_spinlock_t
_cpus_lock
;
/*
* disable scheduler
*/
static
void
rt
_preempt_disable
(
void
)
static
void
_cpu
_preempt_disable
(
void
)
{
register
rt_base_t
level
;
struct
rt_thread
*
current_thread
;
...
...
@@ -42,7 +42,7 @@ static void rt_preempt_disable(void)
/*
* enable scheduler
*/
static
void
rt
_preempt_enable
(
void
)
static
void
_cpu
_preempt_enable
(
void
)
{
register
rt_base_t
level
;
struct
rt_thread
*
current_thread
;
...
...
@@ -73,7 +73,7 @@ RTM_EXPORT(rt_spin_lock_init)
void
rt_spin_lock
(
struct
rt_spinlock
*
lock
)
{
rt
_preempt_disable
();
_cpu
_preempt_disable
();
rt_hw_spin_lock
(
&
lock
->
lock
);
}
RTM_EXPORT
(
rt_spin_lock
)
...
...
@@ -81,7 +81,7 @@ RTM_EXPORT(rt_spin_lock)
void
rt_spin_unlock
(
struct
rt_spinlock
*
lock
)
{
rt_hw_spin_unlock
(
&
lock
->
lock
);
rt
_preempt_enable
();
_cpu
_preempt_enable
();
}
RTM_EXPORT
(
rt_spin_unlock
)
...
...
@@ -89,7 +89,7 @@ rt_base_t rt_spin_lock_irqsave(struct rt_spinlock *lock)
{
unsigned
long
level
;
rt
_preempt_disable
();
_cpu
_preempt_disable
();
level
=
rt_hw_local_irq_disable
();
rt_hw_spin_lock
(
&
lock
->
lock
);
...
...
@@ -103,7 +103,7 @@ void rt_spin_unlock_irqrestore(struct rt_spinlock *lock, rt_base_t level)
rt_hw_spin_unlock
(
&
lock
->
lock
);
rt_hw_local_irq_enable
(
level
);
rt
_preempt_enable
();
_cpu
_preempt_enable
();
}
RTM_EXPORT
(
rt_spin_unlock_irqrestore
)
...
...
@@ -112,12 +112,12 @@ RTM_EXPORT(rt_spin_unlock_irqrestore)
*/
struct
rt_cpu
*
rt_cpu_self
(
void
)
{
return
&
rt
_cpus
[
rt_hw_cpu_id
()];
return
&
_cpus
[
rt_hw_cpu_id
()];
}
struct
rt_cpu
*
rt_cpu_index
(
int
index
)
{
return
&
rt
_cpus
[
index
];
return
&
_cpus
[
index
];
}
/**
...
...
src/object.c
浏览文件 @
67f2f323
...
...
@@ -23,7 +23,7 @@
#endif
/* RT_USING_MODULE */
/*
* define object_info for the number of
rt
_object_container items.
* define object_info for the number of _object_container items.
*/
enum
rt_object_info_type
{
...
...
@@ -60,8 +60,9 @@ enum rt_object_info_type
};
#define _OBJ_CONTAINER_LIST_INIT(c) \
{&(rt_object_container[c].object_list), &(rt_object_container[c].object_list)}
static
struct
rt_object_information
rt_object_container
[
RT_Object_Info_Unknown
]
=
{&(_object_container[c].object_list), &(_object_container[c].object_list)}
static
struct
rt_object_information
_object_container
[
RT_Object_Info_Unknown
]
=
{
/* initialize object container - thread */
{
RT_Object_Class_Thread
,
_OBJ_CONTAINER_LIST_INIT
(
RT_Object_Info_Thread
),
sizeof
(
struct
rt_thread
)},
...
...
@@ -211,7 +212,7 @@ rt_object_get_information(enum rt_object_class_type type)
int
index
;
for
(
index
=
0
;
index
<
RT_Object_Info_Unknown
;
index
++
)
if
(
rt_object_container
[
index
].
type
==
type
)
return
&
rt
_object_container
[
index
];
if
(
_object_container
[
index
].
type
==
type
)
return
&
_object_container
[
index
];
return
RT_NULL
;
}
...
...
src/signal.c
浏览文件 @
67f2f323
...
...
@@ -35,7 +35,7 @@ struct siginfo_node
struct
rt_slist_node
list
;
};
static
struct
rt_mempool
*
_
rt_
siginfo_pool
;
static
struct
rt_mempool
*
_siginfo_pool
;
static
void
_signal_deliver
(
rt_thread_t
tid
);
void
rt_thread_handle_sig
(
rt_bool_t
clean_state
);
...
...
@@ -538,7 +538,7 @@ int rt_thread_kill(rt_thread_t tid, int sig)
}
rt_hw_interrupt_enable
(
level
);
si_node
=
(
struct
siginfo_node
*
)
rt_mp_alloc
(
_
rt_
siginfo_pool
,
0
);
si_node
=
(
struct
siginfo_node
*
)
rt_mp_alloc
(
_siginfo_pool
,
0
);
if
(
si_node
)
{
rt_slist_init
(
&
(
si_node
->
list
));
...
...
@@ -576,8 +576,8 @@ int rt_thread_kill(rt_thread_t tid, int sig)
int
rt_system_signal_init
(
void
)
{
_
rt_
siginfo_pool
=
rt_mp_create
(
"signal"
,
RT_SIG_INFO_MAX
,
sizeof
(
struct
siginfo_node
));
if
(
_
rt_
siginfo_pool
==
RT_NULL
)
_siginfo_pool
=
rt_mp_create
(
"signal"
,
RT_SIG_INFO_MAX
,
sizeof
(
struct
siginfo_node
));
if
(
_siginfo_pool
==
RT_NULL
)
{
LOG_E
(
"create memory pool for signal info failed."
);
RT_ASSERT
(
0
);
...
...
src/thread.c
浏览文件 @
67f2f323
...
...
@@ -77,7 +77,7 @@ void rt_thread_inited_sethook(void (*hook)(rt_thread_t thread))
#endif
/* RT_USING_HOOK */
/* must be invoke witch rt_hw_interrupt_disable */
static
void
_
rt_
thread_cleanup_execute
(
rt_thread_t
thread
)
static
void
_thread_cleanup_execute
(
rt_thread_t
thread
)
{
register
rt_base_t
level
;
#ifdef RT_USING_MODULE
...
...
@@ -101,7 +101,7 @@ static void _rt_thread_cleanup_execute(rt_thread_t thread)
rt_hw_interrupt_enable
(
level
);
}
static
void
_
rt_
thread_exit
(
void
)
static
void
_thread_exit
(
void
)
{
struct
rt_thread
*
thread
;
register
rt_base_t
level
;
...
...
@@ -112,7 +112,7 @@ static void _rt_thread_exit(void)
/* disable interrupt */
level
=
rt_hw_interrupt_disable
();
_
rt_
thread_cleanup_execute
(
thread
);
_thread_cleanup_execute
(
thread
);
/* remove from schedule */
rt_schedule_remove_thread
(
thread
);
...
...
@@ -139,14 +139,14 @@ static void _rt_thread_exit(void)
rt_hw_interrupt_enable
(
level
);
}
static
rt_err_t
_
rt_
thread_init
(
struct
rt_thread
*
thread
,
const
char
*
name
,
void
(
*
entry
)(
void
*
parameter
),
void
*
parameter
,
void
*
stack_start
,
rt_uint32_t
stack_size
,
rt_uint8_t
priority
,
rt_uint32_t
tick
)
static
rt_err_t
_thread_init
(
struct
rt_thread
*
thread
,
const
char
*
name
,
void
(
*
entry
)(
void
*
parameter
),
void
*
parameter
,
void
*
stack_start
,
rt_uint32_t
stack_size
,
rt_uint8_t
priority
,
rt_uint32_t
tick
)
{
/* init thread list */
rt_list_init
(
&
(
thread
->
tlist
));
...
...
@@ -163,11 +163,11 @@ static rt_err_t _rt_thread_init(struct rt_thread *thread,
#ifdef ARCH_CPU_STACK_GROWS_UPWARD
thread
->
sp
=
(
void
*
)
rt_hw_stack_init
(
thread
->
entry
,
thread
->
parameter
,
(
void
*
)((
char
*
)
thread
->
stack_addr
),
(
void
*
)
_
rt_
thread_exit
);
(
void
*
)
_thread_exit
);
#else
thread
->
sp
=
(
void
*
)
rt_hw_stack_init
(
thread
->
entry
,
thread
->
parameter
,
(
rt_uint8_t
*
)((
char
*
)
thread
->
stack_addr
+
thread
->
stack_size
-
sizeof
(
rt_ubase_t
)),
(
void
*
)
_
rt_
thread_exit
);
(
void
*
)
_thread_exit
);
#endif
/* ARCH_CPU_STACK_GROWS_UPWARD */
/* priority init */
...
...
@@ -274,14 +274,14 @@ rt_err_t rt_thread_init(struct rt_thread *thread,
/* initialize thread object */
rt_object_init
((
rt_object_t
)
thread
,
RT_Object_Class_Thread
,
name
);
return
_
rt_
thread_init
(
thread
,
name
,
entry
,
parameter
,
stack_start
,
stack_size
,
priority
,
tick
);
return
_thread_init
(
thread
,
name
,
entry
,
parameter
,
stack_start
,
stack_size
,
priority
,
tick
);
}
RTM_EXPORT
(
rt_thread_init
);
...
...
@@ -376,7 +376,7 @@ rt_err_t rt_thread_detach(rt_thread_t thread)
rt_schedule_remove_thread
(
thread
);
}
_
rt_
thread_cleanup_execute
(
thread
);
_thread_cleanup_execute
(
thread
);
/* release thread timer */
rt_timer_detach
(
&
(
thread
->
thread_timer
));
...
...
@@ -440,7 +440,7 @@ rt_thread_t rt_thread_create(const char *name,
return
RT_NULL
;
}
_
rt_
thread_init
(
thread
,
_thread_init
(
thread
,
name
,
entry
,
parameter
,
...
...
@@ -479,7 +479,7 @@ rt_err_t rt_thread_delete(rt_thread_t thread)
rt_schedule_remove_thread
(
thread
);
}
_
rt_
thread_cleanup_execute
(
thread
);
_thread_cleanup_execute
(
thread
);
/* release thread timer */
rt_timer_detach
(
&
(
thread
->
thread_timer
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录