You can set the order in which programs are terminated by init. Look in
/etc/rc0.d and /etc/rc6.d. Just make sure that your watchdog monitor is one of
the last programs killed by adjusting the number following the K in the script
that kills it.
________________________________________
From: on behalf of Jim
Jackson
Sent: Wednesday, March 09, 2011 8:09 AM
To:
Subject: Re: [ts-7000] How to do soft shutdown with watchdog timer?
On Tue, 8 Mar 2011, Rekcut_Nod wrote:
> I'm using a TS-7260. I monitor a DIO line for the user to shutdown the
> system, at which point I want to close all open ports and devices, and
> issue a "shutdown -h now" command via popen (I'm writing c code).
>
> My question is, if the watchdog is initialized and fed by:
>
> int fd = open("/dev/mem", O_RDWR|O_SYNC);
> volatile unsigned char *wdt_control;
> volatile unsigned char *wdt_feedl;
>
> wdt_control = (unsigned
> char*)mmap(0,getpagesize(),PROT_READ|PROT_WRITE,MAP_SHARED,fd,0x23800000);
> wdt_feed = (unsigned
> char*)mmap(0,getpagesize(),PROT_READ|PROT_WRITE,MAP_SHARED,fd,0x23C00000);
>
> *wdt_feed=0x05;
> *wdt_control=0x07;//set duration to max = 8 seconds
>
> how can I call fclose(fd)?
You just need to need to disable the watchdog - *wdt_feed=0;
then it will not interfer with your shutdown regime.
> I don't want the watchdog to reset the board
> before the "shutdown -h now" is finished, nor do I want the program to be
> terminated by the shutdown command before I've safely released /dev/mem.
> Any suggestions?
>
>
------------------------------------
Yahoo! Groups Links
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|