Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2345VOR
rt-thread
提交
d7b8cf81
R
rt-thread
项目概览
2345VOR
/
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,发现更多精彩内容 >>
提交
d7b8cf81
编写于
1月 07, 2022
作者:
G
Gabriel Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
move some __on_rt_xxxxx_hook from rtdef.h to dedicated c soure files
上级
495e209f
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
96 addition
and
55 deletion
+96
-55
include/rtdef.h
include/rtdef.h
+2
-48
src/ipc.c
src/ipc.c
+13
-1
src/irq.c
src/irq.c
+9
-1
src/kservice.c
src/kservice.c
+7
-0
src/mempool.c
src/mempool.c
+9
-1
src/object.c
src/object.c
+20
-1
src/scheduler.c
src/scheduler.c
+9
-1
src/thread.c
src/thread.c
+12
-1
src/timer.c
src/timer.c
+15
-1
未找到文件。
include/rtdef.h
浏览文件 @
d7b8cf81
...
...
@@ -39,6 +39,7 @@
* 2021-11-19 Meco Man change version number to v4.1.0
* 2021-12-21 Meco Man re-implement RT_UNUSED
* 2022-01-01 Gabriel improve hooking method
* 2022-01-07 Gabriel move some __on_rt_xxxxx_hook to dedicated c soure files
*/
#ifndef __RT_DEF_H__
...
...
@@ -450,12 +451,6 @@ struct rt_object_information
#endif
#endif
#ifndef __on_rt_interrupt_enter_hook
#define __on_rt_interrupt_enter_hook() __ON_HOOK_ARGS(rt_interrupt_enter_hook, ())
#endif
#ifndef __on_rt_interrupt_leave_hook
#define __on_rt_interrupt_leave_hook() __ON_HOOK_ARGS(rt_interrupt_leave_hook, ())
#endif
#ifndef __on_rt_interrupt_switch_hook
#define __on_rt_interrupt_switch_hook() __ON_HOOK_ARGS(rt_interrupt_switch_hook, ())
#endif
...
...
@@ -465,48 +460,7 @@ struct rt_object_information
#ifndef __on_rt_free_hook
#define __on_rt_free_hook(rmem) __ON_HOOK_ARGS(rt_free_hook, (rmem))
#endif
#ifndef __on_rt_mp_alloc_hook
#define __on_rt_mp_alloc_hook(mp, block) __ON_HOOK_ARGS(rt_mp_alloc_hook, (mp, block))
#endif
#ifndef __on_rt_mp_free_hook
#define __on_rt_mp_free_hook(mp, block) __ON_HOOK_ARGS(rt_mp_free_hook, (mp, block))
#endif
#ifndef __on_rt_object_trytake_hook
#define __on_rt_object_trytake_hook(parent) __ON_HOOK_ARGS(rt_object_trytake_hook, (parent))
#endif
#ifndef __on_rt_object_take_hook
#define __on_rt_object_take_hook(parent) __ON_HOOK_ARGS(rt_object_take_hook, (parent))
#endif
#ifndef __on_rt_object_put_hook
#define __on_rt_object_put_hook(parent) __ON_HOOK_ARGS(rt_object_put_hook, (parent))
#endif
#ifndef __on_rt_scheduler_hook
#define __on_rt_scheduler_hook(from, to) __ON_HOOK_ARGS(rt_scheduler_hook, (from, to))
#endif
#ifndef __on_rt_scheduler_switch_hook
#define __on_rt_scheduler_switch_hook(tid) __ON_HOOK_ARGS(rt_scheduler_switch_hook, (tid))
#endif
#ifndef __on_rt_object_attach_hook
#define __on_rt_object_attach_hook(obj) __ON_HOOK_ARGS(rt_object_attach_hook, (obj))
#endif
#ifndef __on_rt_object_detach_hook
#define __on_rt_object_detach_hook(obj) __ON_HOOK_ARGS(rt_object_detach_hook, (obj))
#endif
#ifndef __on_rt_thread_inited_hook
#define __on_rt_thread_inited_hook(thread) __ON_HOOK_ARGS(rt_thread_inited_hook, (thread))
#endif
#ifndef __on_rt_thread_suspend_hook
#define __on_rt_thread_suspend_hook(thread) __ON_HOOK_ARGS(rt_thread_suspend_hook, (thread))
#endif
#ifndef __on_rt_thread_resume_hook
#define __on_rt_thread_resume_hook(thread) __ON_HOOK_ARGS(rt_thread_resume_hook, (thread))
#endif
#ifndef __on_rt_timer_enter_hook
#define __on_rt_timer_enter_hook(t) __ON_HOOK_ARGS(rt_timer_enter_hook, (t))
#endif
#ifndef __on_rt_timer_exit_hook
#define __on_rt_timer_exit_hook(t) __ON_HOOK_ARGS(rt_timer_exit_hook, (t))
#endif
/**@}*/
...
...
src/ipc.c
浏览文件 @
d7b8cf81
...
...
@@ -39,12 +39,24 @@
* 2020-10-11 Meco Man add value overflow-check code
* 2021-01-03 Meco Man implement rt_mb_urgent()
* 2021-05-30 Meco Man implement rt_mutex_trytake()
* 2022-01-07 Gabriel Moving __on_rt_xxxxx_hook to ipc.c
*/
#include <rtthread.h>
#include <rthw.h>
#ifdef RT_USING_HOOK
#ifndef __on_rt_object_trytake_hook
#define __on_rt_object_trytake_hook(parent) __ON_HOOK_ARGS(rt_object_trytake_hook, (parent))
#endif
#ifndef __on_rt_object_take_hook
#define __on_rt_object_take_hook(parent) __ON_HOOK_ARGS(rt_object_take_hook, (parent))
#endif
#ifndef __on_rt_object_put_hook
#define __on_rt_object_put_hook(parent) __ON_HOOK_ARGS(rt_object_put_hook, (parent))
#endif
#if defined(RT_USING_HOOK) && defined(RT_HOOK_USING_FUNC_PTR)
extern
void
(
*
rt_object_trytake_hook
)(
struct
rt_object
*
object
);
extern
void
(
*
rt_object_take_hook
)(
struct
rt_object
*
object
);
extern
void
(
*
rt_object_put_hook
)(
struct
rt_object
*
object
);
...
...
src/irq.c
浏览文件 @
d7b8cf81
...
...
@@ -10,12 +10,20 @@
* 2016-08-09 ArdaFu add interrupt enter and leave hook.
* 2018-11-22 Jesven rt_interrupt_get_nest function add disable irq
* 2021-08-15 Supperthomas fix the comment
* 2022-01-07 Gabriel Moving __on_rt_xxxxx_hook to irq.c
*/
#include <rthw.h>
#include <rtthread.h>
#ifdef RT_USING_HOOK
#ifndef __on_rt_interrupt_enter_hook
#define __on_rt_interrupt_enter_hook() __ON_HOOK_ARGS(rt_interrupt_enter_hook, ())
#endif
#ifndef __on_rt_interrupt_leave_hook
#define __on_rt_interrupt_leave_hook() __ON_HOOK_ARGS(rt_interrupt_leave_hook, ())
#endif
#if defined(RT_USING_HOOK) && defined(RT_HOOK_USING_FUNC_PTR)
static
void
(
*
rt_interrupt_enter_hook
)(
void
);
static
void
(
*
rt_interrupt_leave_hook
)(
void
);
...
...
src/kservice.c
浏览文件 @
d7b8cf81
...
...
@@ -19,6 +19,7 @@
* 2015-07-06 Bernard Add rt_assert_handler routine.
* 2021-02-28 Meco Man add RT_KSERVICE_USING_STDLIB
* 2021-12-20 Meco Man implement rt_strcpy()
* 2022-01-07 Gabriel add __on_rt_assert_hook
*/
#include <rtthread.h>
...
...
@@ -1741,6 +1742,12 @@ int __rt_ffs(int value)
#endif
/* RT_USING_TINY_FFS */
#endif
/* RT_USING_CPU_FFS */
#ifndef __on_rt_assert_hook
#define __on_rt_assert_hook(ex, func, line) __ON_HOOK_ARGS(rt_assert_hook, (ex, func, line))
#endif
#ifdef RT_DEBUG
/* RT_ASSERT(EX)'s hook */
...
...
src/mempool.c
浏览文件 @
d7b8cf81
...
...
@@ -14,6 +14,7 @@
* 2010-10-26 yi.qiu add module support in rt_mp_delete
* 2011-01-24 Bernard add object allocation check.
* 2012-03-22 Bernard fix align issue in rt_mp_init and rt_mp_create.
* 2022-01-07 Gabriel Moving __on_rt_xxxxx_hook to mempool.c
*/
#include <rthw.h>
...
...
@@ -21,7 +22,14 @@
#ifdef RT_USING_MEMPOOL
#ifdef RT_USING_HOOK
#ifndef __on_rt_mp_alloc_hook
#define __on_rt_mp_alloc_hook(mp, block) __ON_HOOK_ARGS(rt_mp_alloc_hook, (mp, block))
#endif
#ifndef __on_rt_mp_free_hook
#define __on_rt_mp_free_hook(mp, block) __ON_HOOK_ARGS(rt_mp_free_hook, (mp, block))
#endif
#if defined(RT_USING_HOOK) && defined(RT_HOOK_USING_FUNC_PTR)
static
void
(
*
rt_mp_alloc_hook
)(
struct
rt_mempool
*
mp
,
void
*
block
);
static
void
(
*
rt_mp_free_hook
)(
struct
rt_mempool
*
mp
,
void
*
block
);
...
...
src/object.c
浏览文件 @
d7b8cf81
...
...
@@ -13,6 +13,7 @@
* 2010-10-26 yi.qiu add module support in rt_object_allocate and rt_object_free
* 2017-12-10 Bernard Add object_info enum.
* 2018-01-25 Bernard Fix the object find issue when enable MODULE.
* 2022-01-07 Gabriel Moving __on_rt_xxxxx_hook to object.c
*/
#include <rtthread.h>
...
...
@@ -113,7 +114,25 @@ static struct rt_object_information _object_container[RT_Object_Info_Unknown] =
#endif
};
#ifdef RT_USING_HOOK
#ifndef __on_rt_object_attach_hook
#define __on_rt_object_attach_hook(obj) __ON_HOOK_ARGS(rt_object_attach_hook, (obj))
#endif
#ifndef __on_rt_object_detach_hook
#define __on_rt_object_detach_hook(obj) __ON_HOOK_ARGS(rt_object_detach_hook, (obj))
#endif
#ifndef __on_rt_object_trytake_hook
#define __on_rt_object_trytake_hook(parent) __ON_HOOK_ARGS(rt_object_trytake_hook, (parent))
#endif
#ifndef __on_rt_object_take_hook
#define __on_rt_object_take_hook(parent) __ON_HOOK_ARGS(rt_object_take_hook, (parent))
#endif
#ifndef __on_rt_object_put_hook
#define __on_rt_object_put_hook(parent) __ON_HOOK_ARGS(rt_object_put_hook, (parent))
#endif
#if defined(RT_USING_HOOK) && defined(RT_HOOK_USING_FUNC_PTR)
static
void
(
*
rt_object_attach_hook
)(
struct
rt_object
*
object
);
static
void
(
*
rt_object_detach_hook
)(
struct
rt_object
*
object
);
void
(
*
rt_object_trytake_hook
)(
struct
rt_object
*
object
);
...
...
src/scheduler.c
浏览文件 @
d7b8cf81
...
...
@@ -27,6 +27,7 @@
* rt_schedule_insert_thread won't insert current task to ready queue
* in smp version, rt_hw_context_switch_interrupt maybe switch to
* new task directly
* 2022-01-07 Gabriel Moving __on_rt_xxxxx_hook to scheduler.c
*
*/
...
...
@@ -47,7 +48,14 @@ struct rt_thread *rt_current_thread = RT_NULL;
rt_uint8_t
rt_current_priority
;
#endif
/* RT_USING_SMP */
#ifdef RT_USING_HOOK
#ifndef __on_rt_scheduler_hook
#define __on_rt_scheduler_hook(from, to) __ON_HOOK_ARGS(rt_scheduler_hook, (from, to))
#endif
#ifndef __on_rt_scheduler_switch_hook
#define __on_rt_scheduler_switch_hook(tid) __ON_HOOK_ARGS(rt_scheduler_switch_hook, (tid))
#endif
#if defined(RT_USING_HOOK) && defined(RT_HOOK_USING_FUNC_PTR)
static
void
(
*
rt_scheduler_hook
)(
struct
rt_thread
*
from
,
struct
rt_thread
*
to
);
static
void
(
*
rt_scheduler_switch_hook
)(
struct
rt_thread
*
tid
);
...
...
src/thread.c
浏览文件 @
d7b8cf81
...
...
@@ -28,13 +28,24 @@
* add support for tasks bound to cpu
* 2021-02-24 Meco Man rearrange rt_thread_control() - schedule the thread when close it
* 2021-11-15 THEWON Remove duplicate work between idle and _thread_exit
* 2022-01-07 Gabriel Moving __on_rt_xxxxx_hook to thread.c
*/
#include <rthw.h>
#include <rtthread.h>
#include <stddef.h>
#ifdef RT_USING_HOOK
#ifndef __on_rt_thread_inited_hook
#define __on_rt_thread_inited_hook(thread) __ON_HOOK_ARGS(rt_thread_inited_hook, (thread))
#endif
#ifndef __on_rt_thread_suspend_hook
#define __on_rt_thread_suspend_hook(thread) __ON_HOOK_ARGS(rt_thread_suspend_hook, (thread))
#endif
#ifndef __on_rt_thread_resume_hook
#define __on_rt_thread_resume_hook(thread) __ON_HOOK_ARGS(rt_thread_resume_hook, (thread))
#endif
#if defined(RT_USING_HOOK) && defined(RT_HOOK_USING_FUNC_PTR)
static
void
(
*
rt_thread_suspend_hook
)(
rt_thread_t
thread
);
static
void
(
*
rt_thread_resume_hook
)
(
rt_thread_t
thread
);
static
void
(
*
rt_thread_inited_hook
)
(
rt_thread_t
thread
);
...
...
src/timer.c
浏览文件 @
d7b8cf81
...
...
@@ -17,6 +17,7 @@
* 2014-07-12 Bernard does not lock scheduler when invoking soft-timer
* timeout function.
* 2021-08-15 supperthomas add the comment
* 2022-01-07 Gabriel Moving __on_rt_xxxxx_hook to timer.c
*/
#include <rtthread.h>
...
...
@@ -47,7 +48,20 @@ ALIGN(RT_ALIGN_SIZE)
static
rt_uint8_t
_timer_thread_stack
[
RT_TIMER_THREAD_STACK_SIZE
];
#endif
/* RT_USING_TIMER_SOFT */
#ifdef RT_USING_HOOK
#ifndef __on_rt_object_take_hook
#define __on_rt_object_take_hook(parent) __ON_HOOK_ARGS(rt_object_take_hook, (parent))
#endif
#ifndef __on_rt_object_put_hook
#define __on_rt_object_put_hook(parent) __ON_HOOK_ARGS(rt_object_put_hook, (parent))
#endif
#ifndef __on_rt_timer_enter_hook
#define __on_rt_timer_enter_hook(t) __ON_HOOK_ARGS(rt_timer_enter_hook, (t))
#endif
#ifndef __on_rt_timer_exit_hook
#define __on_rt_timer_exit_hook(t) __ON_HOOK_ARGS(rt_timer_exit_hook, (t))
#endif
#if defined(RT_USING_HOOK) && defined(RT_HOOK_USING_FUNC_PTR)
extern
void
(
*
rt_object_take_hook
)(
struct
rt_object
*
object
);
extern
void
(
*
rt_object_put_hook
)(
struct
rt_object
*
object
);
static
void
(
*
rt_timer_enter_hook
)(
struct
rt_timer
*
timer
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录