Date: Mon, 25 Nov 1996 18:01:49 +0000 From: "Slavik Terletsky" <ts@polynet.lviv.ua> To: FreeBSD-hardware@FreeBSD.org Subject: Help: Watchdog Problem Message-ID: <199611251600.SAA08086@NetSurfer.lp.lviv.ua>
next in thread | raw e-mail | index | archive | help
Hi I have PC (PCA-6157) with WatchDog Feature. PC uses Pentium P54C type 75/90/100/120/133/150 MHz CPU and 82437FX "Triton" chipset,works with standard ISA and/or ISA/PCI bus. WatchDog works this way: The first time the watchdog-soft reads the ENABLE(0x443) port, it enables the watchdog timer. After that the soft must read the ENABLE port at time interval less then 1.6 sec, otherwise the watchdog timer will acvtivate and reset CPU. To disable watchdog timer the soft shoud read DISABLE(0x043) port. I'v written such soft (attached below) and seems it shoud work, but it don't. Question: can anyone say how can i find out why FreeBSD and WatchDog conflicts? Maybe FreeBSD has some codes which read DISABLE port? I'v checked kernel conf and there is no dev listed to read this port. P.S. WatchDog works under DOS. %%%%%%%%%%%%%%%%% CUT HERE %%%%%%%%%%%%%%%%%%% #include <stdio.h> #include <fcntl.h> #include <signal.h> #include <unistd.h> #include <machine/cpufunc.h> #define TIME 1 #define ENABLE 0x443 #define DISABLE 0x043 void disable(); extern int errno; int pd; FILE *fd; unsigned char c; int main(int argc, char *argv[]) { fd = fopen("/var/run/watchdog.pid","r"); if(fd) { fprintf(stderr,"watchdog: /var/run/watchdog.pid: File exists\n"); exit(1); } pd = open("/dev/io",O_RDONLY); /* allow i/o operations */ if(pd < 0) { perror("watchdog: can't open /dev/io"); exit(1); } fd = fopen("/var/run/watchdog.pid","w"); if(!fd) { perror("watchdog: /var/run/watchdog.pid"); exit(1); } switch(fork()) { case -1: /* fork() error */ perror("watchdog"); exit(1); case 0: /* child */ fprintf(fd,"%d\n",(int)getpid()); fclose(fd); (void)signal(SIGTERM,disable); while(1) { c = inbv(ENABLE); sleep(TIME); } default: /* parent */ fprintf(stdout,"WatchDog Enabled\n"); close(pd); fclose(fd); exit(0); } } void disable() { /* disable watchdog while exit */ c = inbv(DISABLE); fprintf(stdout,"WatchDog Disabled\n"); if(unlink("/var/run/watchdog.pid") < 0) { perror("watchdog: /var/run/watchdog.pid"); exit(1); } close(pd); exit(0); } %%%%%%%%%%%%%%%%% CUT HERE %%%%%%%%%%%%%%%%%%% # Slavik Terletsky # University "Lvivska Poytechnika" # # Network Administrator # mailto:ts@polynet.lviv.ua #
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199611251600.SAA08086>