天嵌二次封装库使用手册  V1.0
tq_wdg.h 文件参考
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
tq_wdg.h 的引用(Include)关系图:

浏览源代码.

结构体

struct  watchdog_info
 看门狗信息结构体 更多...
 

宏定义

#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)
 设置喂狗状态
 

函数

int EnableWtd (int TimeOut_s)
 使能看门狗设备 更多...
 
int FeedWtd (int fd)
 喂狗操作 更多...
 
int DisableWtd (int fd)
 关闭看门狗 更多...
 

详细描述

作者
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
修改日志:
Date Version Author Description
2021-09-09 1.0 zhengchuangyong 第一次发布,对看门狗一些基本操作的封装,用ioctrl()对其进行设置,如初始化、喂狗、关闭看门狗操作。

函数说明

int DisableWtd ( int  fd)

关闭看门狗

参数
fd看门狗设备描述符
返回
int 成功为0,失败为-1
int EnableWtd ( int  TimeOut_s)

使能看门狗设备

参数
TimeOut_s指定看门狗的最大喂狗间隔(秒)
返回
int 成功返回看门狗设备描述符,打开看门狗设备失败为-1
int FeedWtd ( int  fd)

喂狗操作

参数
fd看门狗设备描述符
返回
int 成功为0,失败为-1