From owner-freebsd-hardware Mon Nov 25 08:09:40 1996 Return-Path: owner-hardware Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id IAA00437 for hardware-outgoing; Mon, 25 Nov 1996 08:09:40 -0800 (PST) Received: from Guard.PolyNet.Lviv.UA (Guard.PolyNet.Lviv.UA [194.44.138.1]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id IAA29290 for ; Mon, 25 Nov 1996 08:02:52 -0800 (PST) Received: (from smap@localhost) by Guard.PolyNet.Lviv.UA (8.7.5/8.6.12) id SAA14258 for ; Mon, 25 Nov 1996 18:01:17 +0200 (EET) Received: from netsurfer.lp.lviv.ua(192.168.0.3) by Guard.Polynet.Lviv.UA via smap (V2.0beta) id xma014256; Mon, 25 Nov 96 18:00:53 +0200 Received: (from smap@localhost) by NetSurfer.lp.lviv.ua (8.6.12/8.6.12) id SAA08086 for ; Mon, 25 Nov 1996 18:00:52 +0200 Message-Id: <199611251600.SAA08086@NetSurfer.lp.lviv.ua> Received: from ws6.lp.lviv.ua(192.168.0.37) by NetSurfer.lp.lviv.ua via smap (V2.0beta) id xma008081; Mon, 25 Nov 96 18:00:44 +0200 Comments: Authenticated sender is From: "Slavik Terletsky" Organization: State University "Lvivska Polytechnika" To: FreeBSD-hardware@FreeBSD.org Date: Mon, 25 Nov 1996 18:01:49 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Help: Watchdog Problem Reply-to: ts@polynet.lviv.ua Priority: normal X-mailer: Pegasus Mail for Windows (v2.42a) Sender: owner-hardware@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk 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 #include #include #include #include #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 #