4.6.4. 测试指南¶
4.6.4.1. 测试环境¶
4.6.4.1.1. 硬件¶
开发板,或D211的FPGA板
4.6.4.1.2. 软件¶
PC端的串口终端软件,用于PC和开发板进行串口通信
luban中带有的test_wdt测试工具
4.6.4.1.3. 软件配置¶
在luban的根目录下通过 make menuconfig 可以打开 test_wdt 测试工具的编译:
Artinchip packages
Sample code
[*] test-watchdog
4.6.4.2. test_wdt 测试¶
test_wdt的主要功能是通过ioctl标准接口,来查询、设置Watchdog的。
板子上的test_wdt位于 /usr/local/bin/
,无需进入该目录,在shell中直接运行test_wdt即可。
test_wdt的帮助信息:
[aic@] # test_wdt -u
Compile time: Apr 16 2022 14:31:42
Usage: test_wdt [options]
-i, --info Print the status and infomation
-s, --set-timeout Set a timeout, in second
-g, --get-timeout Get the current timeout, in second
-p, --set-pretimeout Set a pretimeout, in second
-G, --get-pretimeout Get the current pretimeout, in second
-k, --keepalive Keepalive the watchdog
-u, --usage
Example: test_wdt -c 0 -s 12
Example: test_wdt -c 1 -s 100 -p 90
注解
WDT V1.0驱动中对timeout参数的范围有限制:[1, 3600],即最小1秒、最多1小时。
Linux的Watchdog子系统中对pretimeout参数有限制:pretimeout必须小于timeout。
test_wdt的使用示例:
[aic@] # test_wdt -i
In Artinchip Watchdog timer watchdog V0, options 0x8180
Status: 32768
Boot status: 0
[aic@] # test_wdt -s 3601
wdt_set_timeout()125 - Set chan0 timeout 3601, pretimeout 0
[ERROR] wdt_set_timeout()128 - Failed to set timeout 22[Invalid argument]
[aic@] # test_wdt -s 0
wdt_set_timeout()125 - Set chan0 timeout 0, pretimeout 0
[ERROR] wdt_set_timeout()128 - Failed to set timeout 22[Invalid argument]
[aic@] # test_wdt -g
wdt_get_timeout()155 - Get chan0 timeout 16
[aic@] # test_wdt -s 2
wdt_set_timeout()125 - Set chan0 timeout 2, pretimeout 0
[aic@] # test_wdt -g
wdt_get_timeout()155 - Get chan0 timeout 2
[aic@] # test_wdt -s 9
wdt_set_timeout()125 - Set chan0 timeout 9, pretimeout 0
[aic@] # test_wdt -g
wdt_get_timeout()155 - Get chan0 timeout 9
[aic@] # test_wdt -s 9 -p 4
wdt_set_timeout()125 - Set chan0 timeout 9, pretimeout 4