Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
682da9b2
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,发现更多精彩内容 >>
提交
682da9b2
编写于
6月 10, 2018
作者:
B
Bernard Xiong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Kernel] Remove object container in module feature.
上级
c83c8d84
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
9 addition
and
978 deletion
+9
-978
components/finsh/cmd.c
components/finsh/cmd.c
+0
-107
components/finsh/msh.c
components/finsh/msh.c
+1
-1
components/libc/compilers/newlib/syscalls.c
components/libc/compilers/newlib/syscalls.c
+6
-29
src/idle.c
src/idle.c
+0
-18
src/module.c
src/module.c
+2
-749
src/object.c
src/object.c
+0
-74
未找到文件。
components/finsh/cmd.c
浏览文件 @
682da9b2
...
...
@@ -614,113 +614,6 @@ int list_module(void)
}
FINSH_FUNCTION_EXPORT
(
list_module
,
list
module
in
system
);
MSH_CMD_EXPORT
(
list_module
,
list
module
in
system
);
int
list_mod_detail
(
const
char
*
name
)
{
int
i
;
struct
rt_module
*
module
;
/* find module */
if
((
module
=
rt_module_find
(
name
))
!=
RT_NULL
)
{
/* module has entry point */
if
(
!
(
module
->
parent
.
flag
&
RT_MODULE_FLAG_WITHOUTENTRY
))
{
struct
rt_thread
*
thread
;
struct
rt_list_node
*
tlist
;
rt_uint8_t
*
ptr
;
/* list main thread in module */
if
(
module
->
module_thread
!=
RT_NULL
)
{
rt_uint8_t
stat
;
rt_kprintf
(
"main thread pri status sp stack size max used left tick error
\n
"
);
rt_kprintf
(
"------------- ---- ------- ---------- ---------- ---------- ---------- ---
\n
"
);
thread
=
module
->
module_thread
;
rt_kprintf
(
"%-8.*s 0x%02x"
,
RT_NAME_MAX
,
thread
->
name
,
thread
->
current_priority
);
stat
=
(
thread
->
stat
&
RT_THREAD_STAT_MASK
);
if
(
stat
==
RT_THREAD_READY
)
rt_kprintf
(
" ready "
);
else
if
(
stat
==
RT_THREAD_SUSPEND
)
rt_kprintf
(
" suspend"
);
else
if
(
stat
==
RT_THREAD_INIT
)
rt_kprintf
(
" init "
);
ptr
=
(
rt_uint8_t
*
)
thread
->
stack_addr
;
while
(
*
ptr
==
'#'
)
ptr
++
;
rt_kprintf
(
" 0x%08x 0x%08x 0x%08x 0x%08x %03d
\n
"
,
thread
->
stack_size
+
((
rt_uint32_t
)
thread
->
stack_addr
-
(
rt_uint32_t
)
thread
->
sp
),
thread
->
stack_size
,
thread
->
stack_size
-
((
rt_uint32_t
)
ptr
-
(
rt_uint32_t
)
thread
->
stack_addr
),
thread
->
remaining_tick
,
thread
->
error
);
}
/* list sub thread in module */
tlist
=
&
module
->
module_object
[
RT_Object_Class_Thread
].
object_list
;
if
(
!
rt_list_isempty
(
tlist
))
_list_thread
(
tlist
);
#ifdef RT_USING_SEMAPHORE
/* list semaphored in module */
tlist
=
&
module
->
module_object
[
RT_Object_Class_Semaphore
].
object_list
;
if
(
!
rt_list_isempty
(
tlist
))
_list_sem
(
tlist
);
#endif
#ifdef RT_USING_MUTEX
/* list mutex in module */
tlist
=
&
module
->
module_object
[
RT_Object_Class_Mutex
].
object_list
;
if
(
!
rt_list_isempty
(
tlist
))
_list_mutex
(
tlist
);
#endif
#ifdef RT_USING_EVENT
/* list event in module */
tlist
=
&
module
->
module_object
[
RT_Object_Class_Event
].
object_list
;
if
(
!
rt_list_isempty
(
tlist
))
_list_event
(
tlist
);
#endif
#ifdef RT_USING_MAILBOX
/* list mailbox in module */
tlist
=
&
module
->
module_object
[
RT_Object_Class_MailBox
].
object_list
;
if
(
!
rt_list_isempty
(
tlist
))
_list_mailbox
(
tlist
);
#endif
#ifdef RT_USING_MESSAGEQUEUE
/* list message queue in module */
tlist
=
&
module
->
module_object
[
RT_Object_Class_MessageQueue
].
object_list
;
if
(
!
rt_list_isempty
(
tlist
))
_list_msgqueue
(
tlist
);
#endif
#ifdef RT_USING_MEMHEAP
/* list memory heap in module */
tlist
=
&
module
->
module_object
[
RT_Object_Class_MemHeap
].
object_list
;
if
(
!
rt_list_isempty
(
tlist
))
_list_memheap
(
tlist
);
#endif
#ifdef RT_USING_MEMPOOL
/* list memory pool in module */
tlist
=
&
module
->
module_object
[
RT_Object_Class_MemPool
].
object_list
;
if
(
!
rt_list_isempty
(
tlist
))
_list_mempool
(
tlist
);
#endif
#ifdef RT_USING_DEVICE
/* list device in module */
tlist
=
&
module
->
module_object
[
RT_Object_Class_Device
].
object_list
;
if
(
!
rt_list_isempty
(
tlist
))
_list_device
(
tlist
);
#endif
/* list timer in module */
tlist
=
&
module
->
module_object
[
RT_Object_Class_Timer
].
object_list
;
if
(
!
rt_list_isempty
(
tlist
))
_list_timer
(
tlist
);
}
if
(
module
->
nsym
>
0
)
{
rt_kprintf
(
"symbol address
\n
"
);
rt_kprintf
(
"-------- ----------
\n
"
);
/* list module export symbols */
for
(
i
=
0
;
i
<
module
->
nsym
;
i
++
)
{
rt_kprintf
(
"%s 0x%x
\n
"
,
module
->
symtab
[
i
].
name
,
module
->
symtab
[
i
].
addr
);
}
}
}
return
0
;
}
FINSH_FUNCTION_EXPORT
(
list_mod_detail
,
list
module
objects
in
system
)
#endif
long
list
(
void
)
...
...
components/finsh/msh.c
浏览文件 @
682da9b2
...
...
@@ -333,7 +333,7 @@ int msh_exec(char *cmd, rt_size_t length)
{
return
cmd_ret
;
}
#if
def RT_USING_MODULE
#if
defined(RT_USING_MODULE) && defined(RT_USING_DFS)
if
(
msh_exec_module
(
cmd
,
length
)
==
0
)
{
return
0
;
...
...
components/libc/compilers/newlib/syscalls.c
浏览文件 @
682da9b2
...
...
@@ -7,7 +7,7 @@
#include <dfs_posix.h>
#endif
#ifdef RT_USING_PTHREADS
#ifdef RT_USING_PTHREADS
#include <pthread.h>
#endif
...
...
@@ -126,7 +126,7 @@ _open_r(struct _reent *ptr, const char *file, int flags, int mode)
#endif
}
_ssize_t
_ssize_t
_read_r
(
struct
_reent
*
ptr
,
int
fd
,
void
*
buf
,
size_t
nbytes
)
{
#ifndef RT_USING_DFS
...
...
@@ -372,7 +372,7 @@ void *_calloc_r (struct _reent *ptr, size_t size, size_t len)
return
result
;
}
void
void
_free_r
(
struct
_reent
*
ptr
,
void
*
addr
)
{
rt_free
(
addr
);
...
...
@@ -387,43 +387,20 @@ _exit (int status)
module
=
rt_module_self
();
if
(
module
!=
RT_NULL
)
{
struct
rt_list_node
*
list
;
struct
rt_object
*
object
;
rt_enter_critical
();
/* delete all threads in the module */
list
=
&
module
->
module_object
[
RT_Object_Class_Thread
].
object_list
;
while
(
list
->
next
!=
list
)
{
object
=
rt_list_entry
(
list
->
next
,
struct
rt_object
,
list
);
if
(
rt_object_is_systemobject
(
object
)
==
RT_TRUE
)
{
/* detach static object */
rt_thread_detach
((
rt_thread_t
)
object
);
}
else
{
/* delete dynamic object */
rt_thread_delete
((
rt_thread_t
)
object
);
}
}
/* delete main thread */
rt_thread_delete
(
module
->
module_thread
);
rt_exit_critical
();
rt_thread_suspend
(
rt_thread_self
());
/* re-schedule */
rt_schedule
();
}
#endif
rt_kprintf
(
"thread:%s exit with %d
\n
"
,
rt_thread_self
()
->
name
,
status
);
RT_ASSERT
(
0
);
while
(
1
);
}
void
void
_system
(
const
char
*
s
)
{
/* not support this call */
...
...
src/idle.c
浏览文件 @
682da9b2
...
...
@@ -175,24 +175,6 @@ void rt_thread_idle_excute(void)
/* delete thread object */
rt_object_delete
((
rt_object_t
)
thread
);
#endif
#ifdef RT_USING_MODULE
if
(
module
!=
RT_NULL
)
{
extern
rt_err_t
rt_module_destroy
(
rt_module_t
module
);
/* if sub thread list and main thread are all empty */
if
((
module
->
module_thread
==
RT_NULL
)
&&
rt_list_isempty
(
&
module
->
module_object
[
RT_Object_Class_Thread
].
object_list
))
{
module
->
nref
--
;
}
/* destroy module */
if
(
module
->
nref
==
0
)
rt_module_destroy
(
module
);
}
#endif
}
}
...
...
src/module.c
浏览文件 @
682da9b2
此差异已折叠。
点击以展开。
src/object.c
浏览文件 @
682da9b2
...
...
@@ -252,15 +252,9 @@ void rt_object_init(struct rt_object *object,
register
rt_base_t
temp
;
struct
rt_object_information
*
information
;
#ifdef RT_USING_MODULE
/* get module object information */
information
=
(
rt_module_self
()
!=
RT_NULL
)
?
&
rt_module_self
()
->
module_object
[
type
]
:
rt_object_get_information
(
type
);
#else
/* get object information */
information
=
rt_object_get_information
(
type
);
RT_ASSERT
(
information
!=
RT_NULL
);
#endif
/* initialize object's parameters */
...
...
@@ -324,18 +318,9 @@ rt_object_t rt_object_allocate(enum rt_object_class_type type, const char *name)
RT_DEBUG_NOT_IN_INTERRUPT
;
#ifdef RT_USING_MODULE
/*
* get module object information,
* module object should be managed by kernel object container
*/
information
=
(
rt_module_self
()
!=
RT_NULL
&&
(
type
!=
RT_Object_Class_Module
))
?
&
rt_module_self
()
->
module_object
[
type
]
:
rt_object_get_information
(
type
);
#else
/* get object information */
information
=
rt_object_get_information
(
type
);
RT_ASSERT
(
information
!=
RT_NULL
);
#endif
object
=
(
struct
rt_object
*
)
RT_KERNEL_MALLOC
(
information
->
object_size
);
if
(
object
==
RT_NULL
)
...
...
@@ -458,65 +443,6 @@ rt_object_t rt_object_find(const char *name, rt_uint8_t type)
/* which is invoke in interrupt status */
RT_DEBUG_NOT_IN_INTERRUPT
;
#ifdef RT_USING_MODULE
/* check whether to find a object inside a module. */
{
const
char
*
name_ptr
;
int
module_name_length
;
name_ptr
=
name
;
while
((
*
name_ptr
!=
'\0'
)
&&
(
*
name_ptr
!=
'/'
))
name_ptr
++
;
if
(
*
name_ptr
==
'/'
)
{
struct
rt_module
*
module
=
RT_NULL
;
/* get the name length of module */
module_name_length
=
name_ptr
-
name
;
/* enter critical */
rt_enter_critical
();
/* find module */
information
=
rt_object_get_information
(
RT_Object_Class_Module
);
RT_ASSERT
(
information
!=
RT_NULL
);
for
(
node
=
information
->
object_list
.
next
;
node
!=
&
(
information
->
object_list
);
node
=
node
->
next
)
{
object
=
rt_list_entry
(
node
,
struct
rt_object
,
list
);
if
((
rt_strncmp
(
object
->
name
,
name
,
module_name_length
)
==
0
)
&&
(
module_name_length
==
RT_NAME_MAX
||
object
->
name
[
module_name_length
]
==
'\0'
))
{
/* get module */
module
=
(
struct
rt_module
*
)
object
;
break
;
}
}
rt_exit_critical
();
/* there is no this module inside the system */
if
(
module
==
RT_NULL
)
return
RT_NULL
;
/* get the object pool of module */
information
=
&
(
module
->
module_object
[
type
]);
/* get object name */
while
((
*
name_ptr
==
'/'
)
&&
(
*
name_ptr
!=
'\0'
))
name_ptr
++
;
if
(
*
name_ptr
==
'\0'
)
{
if
(
type
==
RT_Object_Class_Module
)
return
object
;
return
RT_NULL
;
}
/* point to the object name */
name
=
name_ptr
;
}
}
#endif
/* enter critical */
rt_enter_critical
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录