#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
浏览源代码.
|
#define | ERROR_OK 0 |
| 函数返回值,函数正常结束返回值
|
|
#define | ERROR_NOSUPPORT -1 |
| 函数返回值,不支持返回值
|
|
#define | WATCHDOG_IOCTL_BASE 'W' |
| 定义看门狗
|
|
#define | WDIOC_GETSUPPORT _IOR(WATCHDOG_IOCTL_BASE, 0, struct watchdog_info) |
| 获取看门狗信息
|
|
#define | WDIOC_SETTIMEOUT _IOWR(WATCHDOG_IOCTL_BASE, 6, int) |
| 设置超时间
|
|
#define | WDIOC_GETTIMEOUT _IOR(WATCHDOG_IOCTL_BASE, 7, int) |
| 设置超时间
|
|
#define | WDIOS_DISABLECARD 0x0001 |
| 关闭看门狗定时器
|
|
#define | WDIOS_ENABLECARD 0x0002 |
| 打开看门狗定时器
|
|
#define | WDIOC_SETOPTIONS _IOR(WATCHDOG_IOCTL_BASE, 4, int) |
| 设置关闭状态
|
|
#define | WDIOC_KEEPALIVE _IOR(WATCHDOG_IOCTL_BASE, 5, int) |
| 设置喂狗状态
|
|
- 作者
- zhengchuangyong (zheng.nosp@m.chua.nosp@m.ngyon.nosp@m.g@em.nosp@m.bedsk.nosp@m.y.ne.nosp@m.t)
- 版本
- 1.0
- 日期
- 2021-09-09
- 版权所有
- Copyright (c) 2023 广州省天嵌嵌入式技术股份有限公司
- 修改日志:
Date | Version | Author | Description |
2021-09-09 | 1.0 | zhengchuangyong | 第一次发布,对看门狗一些基本操作的封装,用ioctrl()对其进行设置,如初始化、喂狗、关闭看门狗操作。 |
关闭看门狗
- 参数
-
- 返回
- int 成功为0,失败为-1
int EnableWtd |
( |
int |
TimeOut_s | ) |
|
使能看门狗设备
- 参数
-
- 返回
- int 成功返回看门狗设备描述符,打开看门狗设备失败为-1