[PATCH v2] Add TOD Hooks to allow BSP to take action when TOD is set
Joel Sherrill
joel at rtems.org
Fri Nov 15 14:57:51 UTC 2019
On Thu, Nov 14, 2019 at 11:59 PM Sebastian Huber <
sebastian.huber at embedded-brains.de> wrote:
>
>
> On 14/11/2019 21:44, Joel Sherrill wrote:
> > +bool _TOD_Hook_Register(
> > + TOD_Hook *hook
> > +)
> > +{
> > + ISR_lock_Context lock_context;
> > +
> > + /*
> > + * At this time, this method does NOT have a Classic or POSIX API
> > + * that exports it. Any use of this method will be a direct call.
> > + * It should only be called while NOT holding the TOD lock.
> > + */
> > + _Assert( !_TOD_Is_owner() );
> > +
> > + if ( hook == NULL ) {
> > + return FALSE;
> > + }
> > +
> > + _TOD_Lock();
> > + _TOD_Acquire( &lock_context );
> > + _Chain_Append_unprotected( &_TOD_Hooks, &hook->Node );
> > + _TOD_Unlock();
> > + return true;
> > +}
>
> Where is the _TOD_Release()? This function should not test for a NULL
> hook and return void. Such kind of error handling should be done by
> upper layer functions and not at the lowest level.
>
There is no method _TOD_Release in the source tree. I followed the locking
pattern in clockset.c.
_TOD_Lock();
_TOD_Acquire( &lock_context );
retval = _TOD_Set( &tod_as_timespec, &lock_context );
_TOD_Unlock();
There is no upper level. Per our earlier discussions, there is not an API
above the
score on this for register and unregister. So the error checking is needed
here. If there
were a layer about this, the locking and error checking would be there.
And for Chris.. FALSE/false is a habit from the pre-C99 days. Thanks for
catching that.
Also for Chris _Assert() is only active when debug is enabled.
--joel
>
> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone : +49 89 189 47 41-16
> Fax : +49 89 189 47 41-09
> E-Mail : sebastian.huber at embedded-brains.de
> PGP : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20191115/c47177ea/attachment.html>
More information about the devel
mailing list