📄 devs-watchdog-synth.html
字号:
>Another problem with using wallclock time is that it interferes with
debugging: if the application hits a breakpoint then it is unlikely
that the user will manage to restart it in less than a second, and the
watchdog will not get reset in time.
</P
><P
>To avoid these problems the synthetic target watchdog normally uses
consumed cpu time rather than wallclock time. If the application is
timesliced or if it is halted inside gdb then it does not consume any
cpu time. The application actually has to spend a whole second's worth
of cpu cycles without issuing a reset before the watchdog triggers.
</P
><P
>However using consumed cpu time is not a perfect solution either. If
the application makes blocking system calls then it is not using cpu
time. Interaction with the I/O auxiliary involves system calls, but
these should take only a short amount of time so their effects can be
ignored. If the application makes direct system calls such as
<TT
CLASS="FUNCTION"
>cyg_hal_sys_read</TT
> then the system behaviour
becomes undefined. In addition by default the idle thread will make
blocking <TT
CLASS="FUNCTION"
>select</TT
> system calls, effectively waiting
until an interrupt occurs. If an application spends much of its time
idle then the watchdog device may take much longer to trigger than
expected. It may be desirable to enable the synthetic target HAL
configuration option <TT
CLASS="VARNAME"
>CYGIMP_HAL_IDLE_THREAD_SPIN</TT
>,
causing the idle thread to spin rather than block, at the cost of
wasted cpu cycles.
</P
><P
>The default is to use consumed cpu time, but this can be changed in
the target definition file:
</P
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>synth_device watchdog {
use wallclock_time
…
}</PRE
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="SYNTH-WATCHDOG-GUI"
></A
><H2
>User Interface</H2
><P
>When the synthetic target is run in graphical mode the watchdog device
extends the user interface in two ways. The <SPAN
CLASS="GUIMENU"
>Help</SPAN
>
menu is extended with an entry for the watchdog-specific
documentation. There is also a graphical display of the current state
of the watchdog. Initially the watchdog is asleep:
</P
><DIV
CLASS="INFORMALFIGURE"
><A
NAME="AEN19112"><P
></P
><DIV
CLASS="MEDIAOBJECT"
><P
><IMG
SRC="asleep.png"
ALIGN="CENTER"></P
></DIV
><P
></P
></DIV
><P
>When application code starts the device the watchdog will begin to
keep an eye on things (or occasionally both eyes).
</P
><DIV
CLASS="INFORMALFIGURE"
><A
NAME="AEN19117"><P
></P
><DIV
CLASS="MEDIAOBJECT"
><P
><IMG
SRC="awake.png"
ALIGN="CENTER"></P
></DIV
><P
></P
></DIV
><P
>If the watchdog triggers the display will change again, and optionally
the user can receive an audible alert. The location of the watchdog
display within the I/O auxiliary's window can be controlled via
a <B
CLASS="COMMAND"
>watchdog_pack</B
> entry in the target definition
file. For example the following can be used to put the watchdog
display to the right of the central text window:
</P
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="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 HAL
documentation can be consulted for more information on window packing.
</P
><P
>By default the watchdog support will not generate an audible alert
when the watchdog triggers, to avoid annoying colleagues. Sound can be
enabled in the target definition file, and two suitable files
<TT
CLASS="FILENAME"
>sound1.au</TT
> and <TT
CLASS="FILENAME"
>sound2.au</TT
> are
supplied as standard:
</P
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>synth_device watchdog {
sound sound1.au
…
}</PRE
></TD
></TR
></TABLE
><P
>An absolute path can be specified if desired:
</P
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="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, instead
an external program is used. The default player is
<B
CLASS="COMMAND"
>play</B
>, a front-end to the
<SPAN
CLASS="APPLICATION"
>sox</SPAN
> application shipped with some Linux
distributions. If another player should be used then this can be
specified in the target definition file:
</P
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="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 single
argument, the sound file.
</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="DEVS-WATCHDOG-SYNTH-ARGS"
></A
><H2
>Command Line Arguments</H2
><P
>The watchdog support does not use any command line arguments. All
configuration is handled through the target definition file.
</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="DEVS-WATCHDOG-SYNTH-HOOKS"
></A
><H2
>Hooks</H2
><P
>The watchdog support does not provide any hooks for use by other
scripts. There is rarely any need for customizing the system's
behaviour when a watchdog triggers because those should be rare
events, even during application development.
</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="DEVS-WATCHDOG-SYNTH-TCL"
></A
><H2
>Additional Tcl Procedures</H2
><P
>The watchdog support does not provide any additional Tcl procedures or
variables for use by other scripts.
</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="devs-watchdog-synth-ref.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ecos-ref.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
> </TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Synthetic Target Watchdog Device</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="devs-watchdog-synth-ref.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
> </TD
></TR
></TABLE
></DIV
></BODY
></HTML
>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -