am335x watchdog
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的更多相关文章
- am335x watchdog 设备出错
问题描述: am335x watchdog 设备节点打开失败. 如果是直接将omap_wdt 直接编译成uImage,这样会出现打开文件节点失败的情况. 如果单独编译成模块在后面文件系统内插入则不会. ...
- am335x Watchdog 生效导致 LAN8710A action 异常
原因是因为 watchdog 生效的时候,产生的 reset 信号,只有 2.5us 左右,太短了,导致 LAN8710a 未完全重启 在 kernel watchdog 里面增加下面的代码即可 86 ...
- am335x phy led problem
问题描述 连接网线的情况下,每次进行软件"reboot",网口的LINK LED能够正常的熄灭,而ACTIVE LED却是亮的. reboot重启之后,LINK的灯正常变亮,而AC ...
- OK335xS can't reset with reboot
/*********************************************************************** * OK335xS can't reset * 说明: ...
- AM335x(TQ335x)学习笔记——挂载Ramdisk
上篇文章中我们已经能够通过u-boot启动内核了,但是没有能够启动成功,从内核的log中可以看出,内核启动失败的原因是没有挂载到root文件系统,本文将使用busybox制作根文件系统并打包成ramd ...
- 转:AM335x启动流程(BootRom->MLO->Uboot)
http://blog.chinaunix.net/uid-28458801-id-3486399.html 参考文件: 1,AM335x ARM Cortex-A8 Microprocessors ...
- AM335x(TQ335x)学习笔记——USB驱动移植
对于AM335x来讲,TI维护的USB驱动已经非常完善了,本文称之为移植,实际上仅仅是配置内核选项使能USB HOST/OTG功能.废话少说,直接动手开启AM335x的USB驱动配置项. Step1. ...
- AM335x(TQ335x)学习笔记——Nand&&网卡驱动移植
移植完成声卡驱动之后本想再接再励,移植网卡驱动,但没想到的是TI维护的内核太健壮,移植网卡驱动跟之前移植按键驱动一样简单,Nand驱动也是如此,于是,本人将Nand和网卡放在同一篇文章中介绍.介绍之前 ...
- AM335x(TQ335x)学习笔记——WM8960声卡驱动移植
经过一段时间的调试,终于调好了TQ335x的声卡驱动.TQ335x采用的Codec是WM8960,本文来总结下WM8960驱动在AM335x平台上的移植方法.Linux声卡驱动架构有OSS和ALSA两 ...
随机推荐
- [MFC]图形附加alpha透明通道
改动图形而且附加透明通道: 要附加透明度,能够要把图片转化为32位png图片,然后设置对应的alpha值: 1. 怎样把一张图片改动为32位的Png: a) 读取原图片颜色信息 ...
- php 设置自动加载某个页面
首先要找到Php.ini文件. 新建一个php文件,使用phpinfo(); 之后找到 Loaded Configuration File 指定的路径就是php.ini文件 打开文件,找到 auto_ ...
- STORM在线业务实践-集群空闲CPU飙高问题排查(转)
最近将公司的在线业务迁移到Storm集群上,上线后遇到低峰期CPU耗费严重的情况.在解决问题的过程中深入了解了storm的内部实现原理,并且解决了一个storm0.9-0.10版本一直存在的严重bug ...
- 同一个界面内取微信的OPENID和调用微信的分享接口
步骤如下,1:判断URL是否有CODE参数传入,没有则拼接那个微信跳转连接,然后redirect2:有CODE传入,调用微信接口,根据code获取openid和access_token,注意这一步取到 ...
- [svc][op]Ubuntu优化-服务管理(启动级别)
一 修改Ubuntu启动级别 sudo apt-get install sysv-rc-conf 执行: sysv-rc-conf 打x的表示开机启动. 二 启动级别 Ubuntu默认启动级别为2 r ...
- 这个BUG你遇到过吗
今天做项目的时候,当我根据文档集成极光推送的时候,需要导入一些framework 然后我用真机iPhone5c调试的时候,出错 程序停止到这里了,而且,点击下一步,程序并没有什么反应,各位大神有知道原 ...
- 关于Snmp的Trap代码开发之坑
最近是被这个snmp的trap给坑了,其实回想起来主要是对这个不了解.特别是对snmp协议研究不够深入, 真的不想看这些协议东西,只想大概知道.结果在开发snmp trap时候被坑了,下面列下自己踩到 ...
- 通过Windows PowerShell远程管理计算机(精简版)
现在你手中有一台server(主控端),你打算通过主控端远程管理多台server(被控端).这个过程可以通过Windows PowerShell来完成. 首先在被控端上以管理员权限打开PowerShe ...
- pygame绘制文本
def drawText(self,text,posx,posy,textHeight=48,fontColor=(0,0,0),backgroudColor=(255,255,255)): font ...
- iOS调用其它App,如拨打电话、发送邮件等。UIApplication:openURL:方法是实现这一目的的
在iOS开发中,经常需要调用其它App,如拨打电话.发送邮件等.UIApplication:openURL:方法是实现这一目的的最简单方法,该方法一般通过提供的url参数的模式来调用不同的App. 通 ...