cyg_alarm - suggestion for enhancement
NavEcos
ecos@navosha.com
Wed Aug 28 14:36:00 GMT 2002
On Wed, 2002-08-28 at 04:45, Gary Thomas wrote:
> Just a minor point: please send diffs using the "universal patch"
> method (-u). This makes them much easier to install, given that
> the sources do change.
Oh. Sorry about that, I didn't realize. I have included another diff
with "cvs diff -u" this time. I do not use patches often.
> Also **DON'T FORGET THE CHANGELOG** - otherwise, we have to invent
> one for you :-(
Like this:
"Added the ability to set the alarm callback function as well as
retrieve the current callback function to make alarms more compatible
with vxWorks' wdXXX functions."
Sorry this is so painful.
-Rich
-------------- next part --------------
Index: kernel/current/include/clock.hxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/kernel/current/include/clock.hxx,v
retrieving revision 1.9
diff -u -r1.9 clock.hxx
--- kernel/current/include/clock.hxx 23 May 2002 23:06:46 -0000 1.9
+++ kernel/current/include/clock.hxx 28 Aug 2002 19:44:14 -0000
@@ -253,6 +253,15 @@
cyg_tick_count *trigger, // Next trigger time
cyg_tick_count *interval // Current interval
);
+
+ void set_callback (
+ cyg_alarm_fn *alarmfn, // new alarm callback function
+ CYG_ADDRWORD data // Call-back data
+ );
+
+ cyg_alarm_fn *get_callback ();
+
+ CYG_ADDRWORD get_data ();
};
// -------------------------------------------------------------------------
Index: kernel/current/include/clock.inl
===================================================================
RCS file: /cvs/ecos/ecos/packages/kernel/current/include/clock.inl,v
retrieving revision 1.6
diff -u -r1.6 clock.inl
--- kernel/current/include/clock.inl 23 May 2002 23:06:46 -0000 1.6
+++ kernel/current/include/clock.inl 28 Aug 2002 19:44:14 -0000
@@ -130,6 +130,29 @@
if( enabled ) counter->rem_alarm(this);
}
+// Change the alarm callback function
+inline void Cyg_Alarm::set_callback (
+ cyg_alarm_fn *alarmfn,
+ CYG_ADDRWORD newdata
+ )
+{
+ alarm = alarmfn;
+ data = newdata;
+}
+
+// Get the alarm callback function
+inline cyg_alarm_fn *Cyg_Alarm::get_callback ()
+{
+ return alarm;
+}
+
+// Get the alarm callback data
+inline CYG_ADDRWORD Cyg_Alarm::get_data ()
+{
+ return data;
+}
+
+
// -------------------------------------------------------------------------
#endif // ifndef CYGONCE_KERNEL_CLOCK_INL
Index: kernel/current/include/kapi.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/kernel/current/include/kapi.h,v
retrieving revision 1.17
diff -u -r1.17 kapi.h
--- kernel/current/include/kapi.h 5 Aug 2002 21:53:26 -0000 1.17
+++ kernel/current/include/kapi.h 28 Aug 2002 19:44:15 -0000
@@ -433,6 +433,16 @@
void cyg_alarm_disable( cyg_handle_t alarm );
+void cyg_alarm_set_callback(
+ cyg_handle_t alarm,
+ cyg_alarm_t *alarmfn, /* new alarm callback function */
+ cyg_addrword_t data /* new alarm callback data */
+);
+
+cyg_alarm_t *cyg_alarm_get_callback( cyg_handle_t alarm );
+
+cyg_addrword_t cyg_alarm_get_data( cyg_handle_t alarm );
+
/*---------------------------------------------------------------------------*/
/* Mail boxes */
void cyg_mbox_create(
Index: kernel/current/src/common/kapi.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/kernel/current/src/common/kapi.cxx,v
retrieving revision 1.19
diff -u -r1.19 kapi.cxx
--- kernel/current/src/common/kapi.cxx 23 May 2002 23:06:52 -0000 1.19
+++ kernel/current/src/common/kapi.cxx 28 Aug 2002 19:44:16 -0000
@@ -715,6 +715,29 @@
((Cyg_Alarm *)alarm)->disable();
}
+externC void cyg_alarm_set_callback(
+ cyg_handle_t alarm,
+ cyg_alarm_t *alarmfn, /* new alarm callback function */
+ cyg_addrword_t data /* new alarm callback data */
+)
+{
+ ((Cyg_Alarm *)alarm)->set_callback (
+ (cyg_alarm_fn *)alarmfn,
+ (CYG_ADDRWORD)data
+ );
+}
+
+externC cyg_alarm_t *cyg_alarm_get_callback( cyg_handle_t alarm )
+{
+ return (cyg_alarm_t *)(((Cyg_Alarm *)alarm)->get_callback());
+}
+
+externC cyg_addrword_t cyg_alarm_get_data( cyg_handle_t alarm )
+{
+ return (cyg_addrword_t)(((Cyg_Alarm *)alarm)->get_data());
+}
+
+
/*---------------------------------------------------------------------------*/
/* Mail boxes */
More information about the Ecos-patches
mailing list