This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cyg_alarm - suggestion for enhancement


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.

Also **DON'T FORGET THE CHANGELOG** - otherwise, we have to invent
one for you :-(

On Tue, 2002-08-27 at 21:38, NavEcos wrote:
> On Tue, 2002-08-27 at 15:47, Nick Garnett wrote:
> > NavEcos <ecos@navosha.com> writes:
> > 
> > > Here are the patches to add the following functions to the KAPI:
> > > 
> > > void cyg_alarm_set_callback(
> > >      cyg_handle_t       alarm,
> > >      cyg_alarm_t        *alarmfn /* new alarm callback function       */
> > > );
> > > 
> > > cyg_alarm_t *cyg_alarm_get_callback( cyg_handle_t alarm );
> > > 
> > > 
> > > This will make alarms more compatible with vxWorks' watch dog functions
> > > and make it easier to port from vxWorks to eCos.
> > > 
> > > This is such a trivial change that I'm hoping that we can forgo a
> > > copyright assignment, although my company will be sending a copyright
> > > assignment to you guys eventually for other changes that we think will
> > > be useful to the community at large.
> > > 
> > > The diffs were tested with the KAPI interface.
> > > 
> > 
> > There is just one thing I would change.
> > 
> > The functions should set, and return, both the alarm function and the
> > data value that goes with it. If the function is changed it is likely
> > that the data will need to change too.
> 
> *cough*.  My that was incredibly stupid of me wasn't it?  I decided to
> retrieve the values of the alarm callback function and data that
> accompanies it as 2 separate functions to avoid pointers.  If you would
> rather have it as a single call, let me know and I'll fix it.
> 
> Here are the prototypes now:
> 
> 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 );
> 
> 
> They have been minimally tested.  Attached are the diffs.
> 
> Thank you,
> -Rich
> 
> 
> > -- 
> > Nick Garnett - eCos Kernel Architect
> > http://www.eCosCentric.com/
> > 
> 
> 
> ----
> 

> Index: kernel/current/include/clock.hxx
> ===================================================================
> RCS file: /cvs/ecos/ecos/packages/kernel/current/include/clock.hxx,v
> retrieving revision 1.9
> diff -r1.9 clock.hxx
> 255a256,264
> > 
> >     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 -r1.6 clock.inl
> 132a133,155
> > // 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;
> > }
> > 
> > 
> Index: kernel/current/include/kapi.h
> ===================================================================
> RCS file: /cvs/ecos/ecos/packages/kernel/current/include/kapi.h,v
> retrieving revision 1.17
> diff -r1.17 kapi.h
> 435a436,445
> > 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 );
> > 
> 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 -r1.19 kapi.cxx
> 717a718,740
> > 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());
> > }
> > 
> > 

-- 
------------------------------------------------------------
Gary Thomas                  |
eCosCentric, Ltd.            |  
+1 (970) 229-1963            |  eCos & RedBoot experts
gthomas@ecoscentric.com      |
http://www.ecoscentric.com/  |
------------------------------------------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]