鎺ュ彛鍑芥暟璇存槑
来自「简单的watchdog驱动,实现了定时重启」· 代码 · 共 51 行
TXT
51 行
watchdog驱动接口函数有2个: 1,open 函数 2,ioctl函数open 函数原型:int open(const char *pathname,int flags) 参数: pathname: 设备文件路径 flags: 打开文件的方式。 返回值: 成功时,返回文件描述符 失败时,返回-1值 ioctl函数原型:int ioctl(int fileID,unsigned int cmd,unsigned long arg) 参数: fileID: 文件描述符 arg: 传变量的地址 cmd: 为实现接口的不同功能而设定, 具体cmd值如下: * WDIOC_KEEPALIVE: Ping the keepalive to keep us alive for another timeout. * * WDIOC_SETTIMEOUT: Set the timeout for the watchdog. The parameter is generally * an integer number of milliseconds, the watchdog times will * be set to the first value larger than the given time. It will * return EINVAL if the timeout is beyond the capability of the * watchdog timer. For some boards. it is a custom timeout that * is board dependent. Note that this function will automatically * does the keepalive for the watchdog. * * WDIOC_GETTIMEOUT: Get the timeout for programmer. * * WDIOS_DISABLECARD: Turn off the watchdog timer. 返回值: 成功时,返回非负值 失败是,返回负值
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?