嵌入式爱好者

查看: 17445|回复: 3

[Linux] AM335xS-II 看门狗问题不起作用

[复制链接]

3

主题

6

帖子

27

积分

AM335x通行证

扫一扫,手机访问本帖
发表于 2016-11-17 11:19:15 | 显示全部楼层 |阅读模式
在程序中启动看门狗,1秒钟喂狗一次,但程序停止运行了,也就不喂狗啦,但问什么系统不能重新启动,看门狗不起作用,为什么??
回复

使用道具 举报

1

主题

3669

帖子

4111

积分

发表于 2016-11-30 11:39:45 | 显示全部楼层
您好:
     我们测试的看门狗没有发现什么问题,能把您的打印信息发一下吗,或者截个图什么的,我们帮您看一下
技术支持电话:0312-3119192
技术支持邮箱:Android@forlinx.com
点评回复 支持 反对

使用道具 举报

3

主题

6

帖子

27

积分

AM335x通行证

 楼主| 发表于 2016-11-30 17:36:00 | 显示全部楼层
/*
* Watchdog Driver Test Program
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/types.h>
#include <linux/watchdog.h>

int fd;

/*
* This function simply sends an IOCTL to the driver, which in turn ticks
* the PC Watchdog card to reset its internal timer so it doesn't trigger
* a computer reset.
*/
static void keep_alive(void)
{
    int dummy;

    ioctl(fd, WDIOC_KEEPALIVE, &dummy);
}

/*
* The main program.  Run the program with "-d" to disable the card,
* or "-e" to enable the card.
*/
int main(int argc, char *argv[])
{
    int flags;
    int i;
    fd = open("/dev/watchdog", O_WRONLY);

    if (fd == -1) {
        fprintf(stderr, "Watchdog device not enabled.\n");
        fflush(stderr);
        exit(-1);
    }

  

    for(i=0;i<100;i++) {
               
        keep_alive();
        sleep(1);
       
    }
}
这是我的代码,程序退出看门狗不起作用
点评回复 支持 反对

使用道具 举报

3

主题

6

帖子

27

积分

AM335x通行证

 楼主| 发表于 2016-11-30 17:37:03 | 显示全部楼层
你们可以在你们的开发板上试一下
点评回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋| 飞凌嵌入式 ( 冀ICP备12004394号-1 )

GMT+8, 2024-9-29 07:34

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表