主题 : Mini2440 Watchdog 内核没有配置怎么也有驱动加载了呢? 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 23855
精华: 0
发帖: 17
金钱: 85 两
威望: 17 点
综合积分: 34 分
注册时间: 2010-06-28
最后登录: 2017-09-13
楼主  发表于: 2011-04-27 18:17

 Mini2440 Watchdog 内核没有配置怎么也有驱动加载了呢?

Mini2440 Watchdog 内核没有配置 Device Drivers里面没有选中Watchdog Timer Support,怎么还有s3c2410-wdt加载了呢?

以下是启动信息:
dev0 initialized.
s3c2410-wdt s3c2410-wdt: watchdog in active, reset dis abled, irq en abled
s3c2440-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2440-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440
loop: module loaded
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c24xx-nand s3c2440-nand: Tacls=3, 29ns Twrph0=7 69ns, Twrph1=3 29ns
s3c24xx-nand s3c2440-nand: NAND soft ECC
NAND device: Manufacturer ID: 0xec, Chip ID: 0xd3 (Samsung NAND 1GiB 3,3V 8-bit)

Scanning device for bad blocks
Creating 5 MTD partitions on "NAND 1GiB 3,3V 8-bit":
0x000000000000-0x000000080000 : "uboot"
0x000000080000-0x0000000c0000 : "param"
0x0000000c0000-0x0000003c0000 : "kernel"


而我选择Watchdog Timer Support 及其下的s3c2410 watchdog后,反而出现2次加载的现象,代码里面找来找去找不到在哪加载的,哪位高人指点下!
选择Watchdog Timer Support 的启动信息:
dev0 initialized.
s3c2410-wdt s3c2410-wdt: watchdog in active, reset dis abled, irq en abled
s3c2440-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2440-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440
loop: module loaded
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c24xx-nand s3c2440-nand: Tacls=3, 29ns Twrph0=7 69ns, Twrph1=3 29ns
s3c24xx-nand s3c2440-nand: NAND soft ECC
NAND device: Manufacturer ID: 0xec, Chip ID: 0xd3 (Samsung NAND 1GiB 3,3V 8-bit)

Scanning device for bad blocks
Creating 5 MTD partitions on "NAND 1GiB 3,3V 8-bit":
0x000000000000-0x000000080000 : "uboot"
0x000000080000-0x0000000c0000 : "param"
0x0000000c0000-0x0000003c0000 : "kernel"
0x0000003c0000-0x0000009c0000 : "root"
0x0000009c0000-0x000040000000 : "yaffs"
mice: PS/2 mouse device common for all mice
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
Error: Driver 's3c2410-wdt' is already registered, aborting...
VFS: Mounted root (cramfs filesystem) readonly on device 31:3.




已部分解决,这个是由于我另外又写了个驱动代码,我去掉我自己的那部分就OK了;但我仍然不知道是哪儿加载进去的.
启动信息如下:
Scanning device for bad blocks
Creating 5 MTD partitions on "NAND 1GiB 3,3V 8-bit":
0x000000000000-0x000000080000 : "uboot"
0x000000080000-0x0000000c0000 : "param"
0x0000000c0000-0x0000003c0000 : "kernel"
0x0000003c0000-0x0000009c0000 : "root"
0x0000009c0000-0x000040000000 : "yaffs"
mice: PS/2 mouse device common for all mice
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled

VFS: Mounted root (cramfs filesystem) readonly on device 31:3.
[ 此帖被dualxu在2011-04-27 18:51重新编辑 ]
级别: 新手上路
UID: 23855
精华: 0
发帖: 17
金钱: 85 两
威望: 17 点
综合积分: 34 分
注册时间: 2010-06-28
最后登录: 2017-09-13
1楼  发表于: 2011-04-27 19:02
有个新问题是我使用linux2.6.32.2上的/drivers/watchdog/s3c2410_wdt.c
s3c2410wdt_release中expect_close这个用来干什么的呢?
串口输出如下:
/ # cd bin
/bin # ./linux2440dogfeed.static

reader_test_watchdog.fd=3
s3c2410-wdt s3c2410-wdt: Unexpected close, not stopping watchdog

OK:start watchdog.fd=3
s3c2410-wdt s3c2410-wdt: Unexpected close, not stopping watchdog

feed dog.fd=3
s3c2410-wdt s3c2410-wdt: Unexpected close, not stopping watchdog

feed dog.fd=3
s3c2410-wdt s3c2410-wdt: Unexpected close, not stopping watchdog

feed dog.fd=3
s3c2410-wdt s3c2410-wdt: Unexpected close, not stopping watchdog

我的测试代码如下:

UWORD watchdog_init(UBYTE type, UWORD timeout)
{
int fd;
unsigned cmd;
int i;
int ret;  
//struct watchdog_info wi;

#ifdef _EMU_WATCHDOG_
printf("watchdog_init\n");
#endif
    
fd=open("/dev/watchdog",O_RDWR);
if(fd<0)
{
#ifdef _EMU_WATCHDOG_
printf("device /dev/watchdog open fail\n");
#endif
return -1;
}

//读板卡信息,一般不会使用    
/*
ioctl(fd,WDIOC_GETSUPPORT,&wi);
#ifdef _EMU_WATCHDOG_  
printf("SUPPORT:%d,%s\n",wi.options,wi.identity);
#endif  
*/

//设置15秒,成功返回0,失败返回-1    
i=timeout/1000; //15
ret = ioctl(fd,WDIOC_SETTIMEOUT,&i);
#ifdef _EMU_WATCHDOG_  
printf("SETTIMEOUT:%d,ret = %d\n",i,ret);  
#endif

//读溢出时间
ret = ioctl(fd,WDIOC_SETTIMEOUT,&i);
#ifdef _EMU_WATCHDOG_    
printf("GETTIMEOUT:%d,ret = %d\n",i,ret);  
#endif

//狗工作开始和停止,打开设备(open)和关闭设备(close)有同样的功效    
if(type == WATCHDOG_START)
{
    //开始    
    i=WDIOS_ENABLECARD;
    ret = ioctl(fd,WDIOC_SETOPTIONS,&i);
    #ifdef _EMU_WATCHDOG_  
    printf("WDIOS_ENABLECARD:%d\n",ret);  
    #endif
}
else
{
    //停止    
    i=WDIOS_DISABLECARD;
    ret = ioctl(fd,WDIOC_SETOPTIONS,&i);
    #ifdef _EMU_WATCHDOG_
    printf("WDIOS_DISABLECARD:%d\n",ret);
    #endif
}

close(fd);

return 0;    
}    

/*==============================================================================
函数:
功能:
================================================================================*/
UWORD watchdog(void)
{
int fd;
unsigned cmd;
int i;
int ret;  
//struct watchdog_info wi;

#ifdef _EMU_WATCHDOG_
printf("watchdog\n");
#endif
      
fd=open("/dev/watchdog",O_RDWR);
if(fd<0)
{
#ifdef _EMU_WATCHDOG_
printf("device /dev/watchdog open fail\n");
#endif
return -1;
}

//读溢出时间
ret = ioctl(fd,WDIOC_GETTIMEOUT,&i);
#ifdef _EMU_WATCHDOG_    
printf("GETTIMEOUT:%d,ret=%d\n",i,ret);  
#endif  

//喂狗,成功返回0,没有这条语句ARM将重启动.    
ret = ioctl(fd,WDIOC_KEEPALIVE,NULL);
#ifdef _EMU_WATCHDOG_
printf("WDIOC_KEEPALIVE:%d\n",ret);
#endif

close(fd);
        
return 0;
}    

void reader_test_watchdog(void)
{
int ret;
long j;
int i;

printf("\nreader_test_watchdog.");

j = 0;

ret = watchdog_init(WATCHDOG_START,6000);
if(ret == 0) printf("\nOK:start watchdog.");

while(j<1000){
    for(i=0;i<100;i++) zsleep(9);//9ms
  //printf("\nOK:no feed dog.");
  ret = watchdog();
  if(ret == 0) printf("\nfeed dog.");
  j++;
}

printf("\nOK:now we stop the watchdog.");
ret = watchdog_init(WATCHDOG_STOP,1500);
if(ret==0) printf("\nOK:stop watchdog.");
return;    
}