This is the mail archive of the
ecos-patches@sourceware.org
mailing list for the eCos project.
update synth watchdog driver
- From: Bart Veer <bartv at ecoscentric dot com>
- To: ecos-patches at sourceware dot org
- Date: Wed, 4 Feb 2009 18:06:14 GMT
- Subject: update synth watchdog driver
The generic watchdog code now uses a sensibly prioritized constructor
so there is no need for the synth driver to do its own prioritized
thing.
Bart
2009-02-04 Bart Veer <bartv@ecoscentric.com>
* src/synth_watchdog.cxx: use the generic watchdog package's
prioritized constructor.
Index: src/synth_watchdog.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/watchdog/synth/current/src/synth_watchdog.cxx,v
retrieving revision 1.2
diff -u -p -r1.2 synth_watchdog.cxx
--- src/synth_watchdog.cxx 29 Jan 2009 17:48:51 -0000 1.2
+++ src/synth_watchdog.cxx 4 Feb 2009 18:03:06 -0000
@@ -69,17 +69,10 @@
// The synthetic target's watchdog implementation involves interaction
// with a watchdog.tcl script running in the I/O auxiliary. The device
-// must be instantiated during system initialization, preferably via
-// a prioritized C++ static constructor. The generic watchdog package
-// does have a static object, but it is not prioritized. If
-// CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG is enabled then that object's
-// constructor would get called too late.
-//
-// Instead a private class is defined here, and once instance is created.
-// That instance gets referenced by the Cyg_Watchdog members, so
-// selective linking does not get in the way. Instantiation happens inside
-// the constructor, and the main Cyg_Watchdog::start() and reset() functions
-// involve passing a message to the host-side.
+// is instantiated during system initialization via the generic
+// watchdog package's prioritized constructor. The main
+// Cyg_Watchdog::start() and reset() functions involve passing a
+// message to the host-side.
//
// There is an open issue re. resolution. Usually the hardware imposes
// limits on what resolutions are valid, in fact there may be only one.
@@ -91,22 +84,12 @@
// target-side or host-side configuration is more appropriate, so for
// now a fixed resolution of one second is used.
-class _Synth_Watchdog {
- public:
- _Synth_Watchdog();
- ~_Synth_Watchdog() { }
-
- cyg_uint64 resolution;
-};
-
-// A static instance of the _Synth_Watchdog class, whose constructor will
-// be called at the right time to instantiate host-side support.
-static _Synth_Watchdog _synth_watchdog_object CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_DRIVERS);
-
// Id for communicating with the watchdog instance in the auxiliary
static int aux_id = -1;
-_Synth_Watchdog::_Synth_Watchdog()
+// Hardware initialization.
+void
+Cyg_Watchdog::init_hw(void)
{
// SIGPWR is disabled by default. It has to be reenabled.
struct cyg_hal_sys_sigset_t blocked;
@@ -124,15 +107,6 @@ _Synth_Watchdog::_Synth_Watchdog()
}
}
-// Hardware initialization. This has already happened in the
-// _Synth_Watchdog constructor, all that is needed here is to
-// propagate the resolution.
-void
-Cyg_Watchdog::init_hw(void)
-{
- resolution = _synth_watchdog_object.resolution;
-}
-
void
Cyg_Watchdog::start(void)
{