am335x watchdog

内核文档kernel/Documentation/watchdog

Qt@aplex:~/kernel/7109/linux-3.2.0/Documentation/watchdog$ ll

total 88

drwxrwxr-x 3 Qt Qt 4096 Jun 8 15:11 ./

drwxrwxr-x 94 Qt Qt 12288 Apr 28 13:09 ../

-rwxrwxr-x 1 Qt Qt 576 Nov 20 2013 00-INDEX*

-rwxrwxr-x 1 Qt Qt 6789 Nov 20 2013 convert_drivers_to_kernel_api.txt*

-rwxrwxr-x 1 Qt Qt 3989 Nov 20 2013 hpwdt.txt*

-rwxrwxr-x 1 Qt Qt 2266 Nov 20 2013 pcwd-watchdog.txt*

drwxrwxr-x 2 Qt Qt 4096 Jun 8 15:11 src/

-rwxrwxr-x 1 Qt Qt 8442 Nov 20 2013 watchdog-api.txt*

-rwxrwxr-x 1 Qt Qt 8387 Nov 20 2013 watchdog-kernel-api.txt*

-rwxrwxr-x 1 Qt Qt 16450 Nov 20 2013 watchdog-parameters.txt*

-rwxrwxr-x 1 Qt Qt 1825 Nov 20 2013 wdt.txt*

参考程序

内核文档kernel/Documentation/watchdog/src/watchdog-simple.c

内核文档kernel/Documentation/watchdog/src/watchdog-test.c

#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; fd = open("/dev/watchdog", O_WRONLY); if (fd == -1) {
fprintf(stderr, "Watchdog device not enabled.\n");
fflush(stderr);
exit(-1);
} if (argc > 1) {
if (!strncasecmp(argv[1], "-d", 2)) {
flags = WDIOS_DISABLECARD;
ioctl(fd, WDIOC_SETOPTIONS, &flags);
fprintf(stderr, "Watchdog card disabled.\n");
fflush(stderr);
exit(0);
} else if (!strncasecmp(argv[1], "-e", 2)) {
flags = WDIOS_ENABLECARD;
ioctl(fd, WDIOC_SETOPTIONS, &flags);
fprintf(stderr, "Watchdog card enabled.\n");
fflush(stderr);
exit(0);
} else {
fprintf(stderr, "-d to disable, -e to enable.\n");
fprintf(stderr, "run by itself to tick the card.\n");
fflush(stderr);
exit(0);
}
} else {
fprintf(stderr, "Watchdog Ticking Away!\n");
fflush(stderr);
} while(1) {
keep_alive();
sleep(1);
}
}

am335x watchdog的更多相关文章

  1. am335x watchdog 设备出错

    问题描述: am335x watchdog 设备节点打开失败. 如果是直接将omap_wdt 直接编译成uImage,这样会出现打开文件节点失败的情况. 如果单独编译成模块在后面文件系统内插入则不会. ...

  2. am335x Watchdog 生效导致 LAN8710A action 异常

    原因是因为 watchdog 生效的时候,产生的 reset 信号,只有 2.5us 左右,太短了,导致 LAN8710a 未完全重启 在 kernel watchdog 里面增加下面的代码即可 86 ...

  3. am335x phy led problem

    问题描述 连接网线的情况下,每次进行软件"reboot",网口的LINK LED能够正常的熄灭,而ACTIVE LED却是亮的. reboot重启之后,LINK的灯正常变亮,而AC ...

  4. OK335xS can't reset with reboot

    /*********************************************************************** * OK335xS can't reset * 说明: ...

  5. AM335x(TQ335x)学习笔记——挂载Ramdisk

    上篇文章中我们已经能够通过u-boot启动内核了,但是没有能够启动成功,从内核的log中可以看出,内核启动失败的原因是没有挂载到root文件系统,本文将使用busybox制作根文件系统并打包成ramd ...

  6. 转:AM335x启动流程(BootRom->MLO->Uboot)

    http://blog.chinaunix.net/uid-28458801-id-3486399.html 参考文件: 1,AM335x ARM Cortex-A8 Microprocessors ...

  7. AM335x(TQ335x)学习笔记——USB驱动移植

    对于AM335x来讲,TI维护的USB驱动已经非常完善了,本文称之为移植,实际上仅仅是配置内核选项使能USB HOST/OTG功能.废话少说,直接动手开启AM335x的USB驱动配置项. Step1. ...

  8. AM335x(TQ335x)学习笔记——Nand&&网卡驱动移植

    移植完成声卡驱动之后本想再接再励,移植网卡驱动,但没想到的是TI维护的内核太健壮,移植网卡驱动跟之前移植按键驱动一样简单,Nand驱动也是如此,于是,本人将Nand和网卡放在同一篇文章中介绍.介绍之前 ...

  9. AM335x(TQ335x)学习笔记——WM8960声卡驱动移植

    经过一段时间的调试,终于调好了TQ335x的声卡驱动.TQ335x采用的Codec是WM8960,本文来总结下WM8960驱动在AM335x平台上的移植方法.Linux声卡驱动架构有OSS和ALSA两 ...

随机推荐

  1. linux查看与开启sshd服务

    1.首先通过物理终端进入到linux上,手工检查ssh发现没运行/etc/init.d/sshd statussshd is stopped 手工启动服务,发现报告权限错误./etc/init.d/s ...

  2. appium操作微信公众号H5 web页面

    安卓微信公众号的H5页面是webview,一般操作需要切换context. 在执行如下步骤,就能直接像识别native样识别webview 1.代码追加: ChromeOptions options ...

  3. Wavenet运行

    作者:桂. 时间:2017-05-10  19:17:32 链接:http://www.cnblogs.com/xingshansi/p/6832219.html 一.环境 python3.5 Win ...

  4. vue组件值传递之父组件向子组件传递(props)

    <template> <div class="hello"> <h1>{{ msg }}</h1> <ul> <l ...

  5. Eclipse color theme jsp javascript显示问题

    Q: 在eclipse 中,设置为sublime格式时, 在编辑器中,jsp中嵌套的javascript底色非常难看. A:在如下位置进行设置,Window -> Preferences-> ...

  6. ASP.NET MVC 操作AD 获取域服务器当前用户姓名和OU信息

    #region 根据当前登录域账号 获取AD用户姓名和所在OU目录 /// <summary> /// 根据当前登录域账号 获取AD用户姓名和所在OU目录 /// </summary ...

  7. modelsim 保存波形文件

    1. do文件记录了仿真的过程和加载的各种库. do文件的保存过程: file——>save format——>D:/modeltech_6.5b/examples/run_wave.do ...

  8. 【Android】7.6 FrameLayout(帧布局)

    分类:C#.Android.VS2015: 创建日期:2016-02-11 一.简介 帧布局是显示多个层次图的有效手段.比如第3章介绍的百度地图就是利用帧布局来实现的,它将图层分为22级分别缓存到指定 ...

  9. [转载] C++的那些事:你真的了解引用吗

    我转载了roony的一篇文章 C++的那些事:你真的了解引用吗 以备以后可以查到. 一.引用的本质是什么 说到引用,一般C++的教材中都是这么定义的: 1.引用就是一个对象的别名. 2.引用不是值不占 ...

  10. C/C++预定义宏

    编译器识别预定义的 ANSI/ISO C99 C 预处理宏,Microsoft C++ 实现将提供更多宏.这些预处理器宏不带参数,并且不能重新定义. ANSI 兼容的预定义宏 __FILE__,__L ...