s3c2440 看门狗 设置使用例程
在嵌入式工控领域,为保障程序的持续运行,使用看门狗是必须的。
调狐上网,发现详细介绍s3c2440 Watchdog的资料真不多。于是就对着linux kernel里的代码自己研究吧。
偶写的测试例程如下所示:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <termios.h>
#include <errno.h>
#include <signal.h>
#include <time.h>
#include <pthread.h>
#include <sys/time.h>
#include <linux/watchdog.h>
#include <sys/ioctl.h>
time_t backTime;
struct tm *pBackTime;
int wt_fd;
static void sigAlarm(int sig)
{
char flag = '0';
(void)time(&backTime);
pBackTime= localtime(&backTime);
printf("day: %d; hour: %d; min: %d; sec: %d/n", pBackTi
s3c2440 看门狗 设置使用例程
最新推荐文章于 2018-08-24 21:57:19 发布
这篇博客介绍了如何在s3c2440平台上设置和使用看门狗,包括打开设备、设置超时时间、定时重置看门狗以及关闭看门狗的C语言例程。通过信号处理函数`sigAlarm`实现定时喂狗,确保程序的稳定运行。测试中发现42秒是该平台的最大超时时间。
摘要由CSDN通过智能技术生成