⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 观也u内核和开发法程序/。很好用
💻 C
字号:
#include <stdio.h>#include <string.h>#include <malloc.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>#include <signal.h>#include <sys/ioctl.h>#define put_wtd_data 0x5010void FeedDog();   int fd;int main(void){   int times;   if((fd=open("/dev/2410wtd",O_RDWR))==-1)   {      perror("open eror");      exit(1);   }   printf("open ok\n");   times=0;   while(1)   {	FeedDog();	//*(int *)0=0;	//sleep(10);	sleep(1);	times++;	printf("times=%d\n",times);   }   close(fd);   return 0;}void FeedDog(){   unsigned int *arginfo=(unsigned int *)malloc(4);   *arginfo=0x2000;//5s       mast feed dog in "5"s    you can define it according  your programm , such as *arginfo=0x1000   "2.5"S    if(ioctl(fd,put_wtd_data,arginfo)!=0)   {      perror("ioctl erreor");      exit(1);   }	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -