📄 devs-watchdog-synth.html
字号:
>Another problem with using wallclock time is that it interferes withdebugging: if the application hits a breakpoint then it is unlikelythat the user will manage to restart it in less than a second, and thewatchdog will not get reset in time. </P><P>To avoid these problems the synthetic target watchdog normally usesconsumed cpu time rather than wallclock time. If the application istimesliced or if it is halted inside gdb then it does not consume anycpu time. The application actually has to spend a whole second's worthof cpu cycles without issuing a reset before the watchdog triggers. </P><P>However using consumed cpu time is not a perfect solution either. Ifthe application makes blocking system calls then it is not using cputime. Interaction with the I/O auxiliary involves system calls, butthese should take only a short amount of time so their effects can beignored. If the application makes direct system calls such as<TTCLASS="FUNCTION">cyg_hal_sys_read</TT> then the system behaviourbecomes undefined. In addition by default the idle thread will makeblocking <TTCLASS="FUNCTION">select</TT> system calls, effectively waitinguntil an interrupt occurs. If an application spends much of its timeidle then the watchdog device may take much longer to trigger thanexpected. It may be desirable to enable the synthetic target HALconfiguration option <TTCLASS="VARNAME">CYGIMP_HAL_IDLE_THREAD_SPIN</TT>,causing the idle thread to spin rather than block, at the cost ofwasted cpu cycles. </P><P>The default is to use consumed cpu time, but this can be changed inthe target definition file: </P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">synth_device watchdog { use wallclock_time …}</PRE></TD></TR></TABLE></DIV><DIVCLASS="REFSECT1"><ANAME="SYNTH-WATCHDOG-GUI"></A><H2>User Interface</H2><P>When the synthetic target is run in graphical mode the watchdog deviceextends the user interface in two ways. The <SPANCLASS="GUIMENU">Help</SPAN>menu is extended with an entry for the watchdog-specificdocumentation. There is also a graphical display of the current stateof the watchdog. Initially the watchdog is asleep: </P><DIVCLASS="INFORMALFIGURE"><ANAME="AEN19112"><P></P><DIVCLASS="MEDIAOBJECT"><P><IMGSRC="asleep.png"ALIGN="CENTER"></P></DIV><P></P></DIV><P>When application code starts the device the watchdog will begin tokeep an eye on things (or occasionally both eyes). </P><DIVCLASS="INFORMALFIGURE"><ANAME="AEN19117"><P></P><DIVCLASS="MEDIAOBJECT"><P><IMGSRC="awake.png"ALIGN="CENTER"></P></DIV><P></P></DIV><P>If the watchdog triggers the display will change again, and optionallythe user can receive an audible alert. The location of the watchdogdisplay within the I/O auxiliary's window can be controlled viaa <BCLASS="COMMAND">watchdog_pack</B> entry in the target definitionfile. For example the following can be used to put the watchdogdisplay to the right of the central text window: </P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">synth_device watchdog { watchdog_pack -in .main.e -side top …}</PRE></TD></TR></TABLE><P>The user interface section of the generic synthetic target HALdocumentation can be consulted for more information on window packing. </P><P>By default the watchdog support will not generate an audible alertwhen the watchdog triggers, to avoid annoying colleagues. Sound can beenabled in the target definition file, and two suitable files<TTCLASS="FILENAME">sound1.au</TT> and <TTCLASS="FILENAME">sound2.au</TT> aresupplied as standard: </P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">synth_device watchdog { sound sound1.au …}</PRE></TD></TR></TABLE><P>An absolute path can be specified if desired: </P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">synth_device watchdog { sound /usr/share/emacs/site-lisp/emacspeak/sounds/default-8k/alarm.au …}</PRE></TD></TR></TABLE><P>Sound facilities are not built into the I/O auxiliary itself, insteadan external program is used. The default player is<BCLASS="COMMAND">play</B>, a front-end to the<SPANCLASS="APPLICATION">sox</SPAN> application shipped with some Linuxdistributions. If another player should be used then this can bespecified in the target definition file: </P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">synth_device watchdog { … sound_player my_sound_player</PRE></TD></TR></TABLE><P>The specified program will be run in the background with a singleargument, the sound file. </P></DIV><DIVCLASS="REFSECT1"><ANAME="DEVS-WATCHDOG-SYNTH-ARGS"></A><H2>Command Line Arguments</H2><P>The watchdog support does not use any command line arguments. Allconfiguration is handled through the target definition file. </P></DIV><DIVCLASS="REFSECT1"><ANAME="DEVS-WATCHDOG-SYNTH-HOOKS"></A><H2>Hooks</H2><P>The watchdog support does not provide any hooks for use by otherscripts. There is rarely any need for customizing the system'sbehaviour when a watchdog triggers because those should be rareevents, even during application development. </P></DIV><DIVCLASS="REFSECT1"><ANAME="DEVS-WATCHDOG-SYNTH-TCL"></A><H2>Additional Tcl Procedures</H2><P>The watchdog support does not provide any additional Tcl procedures orvariables for use by other scripts. </P></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="devs-watchdog-synth-ref.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="ecos-ref.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"> </TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Synthetic Target Watchdog Device</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="devs-watchdog-synth-ref.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"> </TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -