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
<*> 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/
|