wdt_test.c
来自「ARM9200+嵌入式linux下看门狗程序」· C语言 代码 · 共 37 行
C
37 行
#include <stdio.h>#include <string.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>#include <stdlib.h>#include <sys/ioctl.h>#include <asm/types.h>#include "watchdog.h"/*******************************************************************/int main(int argc,const char * argv[]){ int fd,timeoutvalue; int c; printf("Enable watchdog\n"); fd=watchdog_enable(); watchdog_get_timeout(&timeoutvalue); printf("Get watchdog timeout =>%d second\n",timeoutvalue); watchdog_set_timeout(10); printf("Set watchdog new timeout => 10 seconds\n"); for(;;){ printf("Press any key to feed watchdog, else to reboot after 10 seconds\n"); c=getchar(); if(c==27)break; watchdog_feed(); } printf("\nDisable watchdog\n"); watchdog_disable(); }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?