Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
alios-things
AliOS-Things
提交
0f188941
A
AliOS-Things
项目概览
alios-things
/
AliOS-Things
11 个月 前同步成功
通知
62
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
AliOS-Things
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
0f188941
编写于
4月 01, 2020
作者:
Z
zhangtian
提交者:
Jinliang Li
4月 13, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
BugID:26273920:[umesh2_demo]add watchdog option
Change-Id: I94b38a1d5e1949fd81c0cddbc668a05ee94ccf9f
上级
8071f180
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
73 addition
and
0 deletion
+73
-0
application/example/umesh2_demo/Config.in
application/example/umesh2_demo/Config.in
+6
-0
application/example/umesh2_demo/mesh_service_example.c
application/example/umesh2_demo/mesh_service_example.c
+67
-0
未找到文件。
application/example/umesh2_demo/Config.in
浏览文件 @
0f188941
...
...
@@ -15,6 +15,12 @@ if AOS_APP_UMESH2_DEMO
default y
help
enable printf heap size
config ENABLE_WATCH_DOG
bool "enable hardware watchdog"
default y
help
hardware watchdog
config ENABLE_LOOP_TEST
bool "running without deinit"
...
...
application/example/umesh2_demo/mesh_service_example.c
浏览文件 @
0f188941
...
...
@@ -317,12 +317,79 @@ err:
return
;
}
#if (ENABLE_WATCH_DOG)
#include "aos/hal/wdg.h"
#define WDG_PORT_NUM 0
/* task parameters */
#define TASK_FEEDWDG_NAME "feedwdg"
#define TASK_FEEDWDG_STACKSIZE 2048
#define TASK_FEEDWDG_PRI 32
#define TAG "umesh2 demo"
/* task handle */
aos_task_t
task_feedwdg
;
static
wdg_dev_t
watchdog
;
/* task entry */
static
void
task_feedwdg_entry
(
void
*
arg
)
{
unsigned
int
n
=
0
;
/**
* The task fed the watchdog every 1000ms. The feeding interval must be less than the
* watchdog timeout, otherwise it will trigger by mistake.
*/
while
(
1
)
{
n
++
;
if
(
n
%
5
==
0
)
{
LOG
(
"feed the watchdog!
\n
"
);
}
hal_wdg_reload
(
&
watchdog
);
aos_msleep
(
1500
);
}
}
void
hal_watchdog_app_enable
(
void
)
{
int
ret
;
/* wdg port set */
watchdog
.
port
=
WDG_PORT_NUM
;
/* set reload time to 1500ms */
watchdog
.
config
.
timeout
=
8000
;
/* init watchdog with the given settings */
ret
=
hal_wdg_init
(
&
watchdog
);
if
(
ret
!=
0
)
{
LOGE
(
TAG
,
"watchdog init error !
\n
"
);
return
-
1
;
}
/* Create the task to feed the watchdog */
ret
=
aos_task_new_ext
(
&
task_feedwdg
,
TASK_FEEDWDG_NAME
,
task_feedwdg_entry
,
NULL
,
TASK_FEEDWDG_STACKSIZE
,
TASK_FEEDWDG_PRI
);
if
(
ret
!=
0
)
{
LOGE
(
TAG
,
"create watchdog task error
\r\n
"
);
ret
=
hal_wdg_finalize
(
&
watchdog
);
if
(
ret
!=
0
)
{
LOGE
(
TAG
,
"delete watchdog error!
\r\n
"
);
}
return
;
}
}
#endif
int
application_start
(
int
argc
,
char
**
argv
)
{
LOG
(
"application_start"
);
#if ENABLE_WATCH_DOG
hal_watchdog_app_enable
();
#endif
#if ENABLE_PRINT_HEAP
print_heap
();
aos_post_delayed_action
(
5000
,
monitor_work
,
NULL
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录