Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
b4a46f8b
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,发现更多精彩内容 >>
提交
b4a46f8b
编写于
8月 19, 2021
作者:
Thomas_Fly
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add the interrupt disable
上级
39353f5c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
28 addition
and
5 deletion
+28
-5
examples/utest/testcases/kernel/Kconfig
examples/utest/testcases/kernel/Kconfig
+0
-2
examples/utest/testcases/kernel/SConscript
examples/utest/testcases/kernel/SConscript
+0
-1
examples/utest/testcases/kernel/irq_tc.c
examples/utest/testcases/kernel/irq_tc.c
+28
-2
未找到文件。
examples/utest/testcases/kernel/Kconfig
浏览文件 @
b4a46f8b
...
@@ -14,11 +14,9 @@ config UTEST_SEMAPHORE_TC
...
@@ -14,11 +14,9 @@ config UTEST_SEMAPHORE_TC
default n
default n
depends on RT_USING_SEMAPHORE
depends on RT_USING_SEMAPHORE
config UTEST_EVENT_TC
config UTEST_EVENT_TC
bool "event test"
bool "event test"
default n
default n
depends on RT_USING_EVENT
depends on RT_USING_EVENT
endmenu
endmenu
examples/utest/testcases/kernel/SConscript
浏览文件 @
b4a46f8b
...
@@ -17,7 +17,6 @@ if GetDepend(['UTEST_SEMAPHORE_TC']):
...
@@ -17,7 +17,6 @@ if GetDepend(['UTEST_SEMAPHORE_TC']):
if
GetDepend
([
'UTEST_EVENT_TC'
]):
if
GetDepend
([
'UTEST_EVENT_TC'
]):
src
+=
[
'event_tc.c'
]
src
+=
[
'event_tc.c'
]
CPPPATH
=
[
cwd
]
CPPPATH
=
[
cwd
]
group
=
DefineGroup
(
'utestcases'
,
src
,
depend
=
[],
CPPPATH
=
CPPPATH
)
group
=
DefineGroup
(
'utestcases'
,
src
,
depend
=
[],
CPPPATH
=
CPPPATH
)
...
...
examples/utest/testcases/kernel/irq_tc.c
浏览文件 @
b4a46f8b
...
@@ -10,6 +10,8 @@
...
@@ -10,6 +10,8 @@
#include <rtthread.h>
#include <rtthread.h>
#include "utest.h"
#include "utest.h"
#include "rthw.h"
#define UTEST_NAME "irq_tc"
#define UTEST_NAME "irq_tc"
static
uint32_t
irq_count
=
0
;
static
uint32_t
irq_count
=
0
;
static
uint32_t
max_get_nest_count
=
0
;
static
uint32_t
max_get_nest_count
=
0
;
...
@@ -25,12 +27,16 @@ static void irq_callback()
...
@@ -25,12 +27,16 @@ static void irq_callback()
static
void
irq_test
(
void
)
static
void
irq_test
(
void
)
{
{
irq_count
=
0
;
rt_interrupt_enter_sethook
(
irq_callback
);
rt_interrupt_enter_sethook
(
irq_callback
);
rt_
thread_delay
(
2
);
rt_
interrupt_leave_sethook
(
irq_callback
);
LOG_D
(
"start irq_test OK!
\n
"
);
rt_thread_mdelay
(
2
);
LOG_D
(
"%s test irq_test! irq_count %d max_get_nest_count %d
\n
"
,
UTEST_NAME
,
irq_count
,
max_get_nest_count
);
LOG_D
(
"%s test irq_test! irq_count %d max_get_nest_count %d
\n
"
,
UTEST_NAME
,
irq_count
,
max_get_nest_count
);
uassert_int_not_equal
(
0
,
irq_count
);
uassert_int_not_equal
(
0
,
irq_count
);
uassert_int_not_equal
(
0
,
max_get_nest_count
);
uassert_int_not_equal
(
0
,
max_get_nest_count
);
rt_interrupt_enter_sethook
(
RT_NULL
);
rt_interrupt_leave_sethook
(
RT_NULL
);
LOG_D
(
"irq_test OK!
\n
"
);
}
}
static
rt_err_t
utest_tc_init
(
void
)
static
rt_err_t
utest_tc_init
(
void
)
...
@@ -45,8 +51,28 @@ static rt_err_t utest_tc_cleanup(void)
...
@@ -45,8 +51,28 @@ static rt_err_t utest_tc_cleanup(void)
return
RT_EOK
;
return
RT_EOK
;
}
}
static
void
interrupt_test
(
void
)
{
rt_base_t
level
;
uint32_t
i
=
1000
;
rt_interrupt_enter_sethook
(
irq_callback
);
rt_interrupt_leave_sethook
(
irq_callback
);
irq_count
=
0
;
level
=
rt_hw_interrupt_disable
();
while
(
i
)
{
i
--
;
}
uassert_int_equal
(
0
,
irq_count
);
rt_hw_interrupt_enable
(
level
);
rt_interrupt_enter_sethook
(
RT_NULL
);
rt_interrupt_leave_sethook
(
RT_NULL
);
}
static
void
testcase
(
void
)
static
void
testcase
(
void
)
{
{
UTEST_UNIT_RUN
(
irq_test
);
UTEST_UNIT_RUN
(
irq_test
);
UTEST_UNIT_RUN
(
interrupt_test
);
}
}
UTEST_TC_EXPORT
(
testcase
,
"testcases.kernel.irq_tc"
,
utest_tc_init
,
utest_tc_cleanup
,
10
);
UTEST_TC_EXPORT
(
testcase
,
"testcases.kernel.irq_tc"
,
utest_tc_init
,
utest_tc_cleanup
,
10
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录