AW: [PATCH 05/12] kern_tc.c: Replace atomic functions required by PPS API

Gabriel.Moyano at dlr.de Gabriel.Moyano at dlr.de
Thu Apr 7 09:55:57 UTC 2022


> On 07/04/2022 10:36, Gabriel Moyano wrote:
> > ---
> >   cpukit/include/sys/timepps.h | 4 ++++
> >   cpukit/score/src/kern_tc.c   | 7 +++++++
> >   2 files changed, 11 insertions(+)
> >
> > diff --git a/cpukit/include/sys/timepps.h
> > b/cpukit/include/sys/timepps.h index 621afb08ec..5703381ffa 100644
> > --- a/cpukit/include/sys/timepps.h
> > +++ b/cpukit/include/sys/timepps.h
> > @@ -32,7 +32,11 @@
> >
> >   typedef int pps_handle_t;
> >
> > +#ifndef __rtems__
> >   typedef unsigned pps_seq_t;
> > +#else /* __rtems__ */
> > +typedef Atomic_Uint	pps_seq_t;
> > +#endif /* __rtems__ */
> >
> >   typedef struct ntp_fp {
> >   	unsigned int	integral;
> > diff --git a/cpukit/score/src/kern_tc.c b/cpukit/score/src/kern_tc.c
> > index e57da2c0ca..77f7a9212c 100644
> > --- a/cpukit/score/src/kern_tc.c
> > +++ b/cpukit/score/src/kern_tc.c
> > @@ -1932,10 +1932,17 @@ pps_fetch(struct pps_fetch_args *fapi, struct pps_state *pps)
> >   			tv.tv_usec = fapi->timeout.tv_nsec / 1000;
> >   			timo = tvtohz(&tv);
> >   		}
> > +#ifndef __rtems__
> >   		aseq = atomic_load_int(&pps->ppsinfo.assert_sequence);
> >   		cseq = atomic_load_int(&pps->ppsinfo.clear_sequence);
> >   		while (aseq == atomic_load_int(&pps->ppsinfo.assert_sequence) &&
> >   		    cseq == atomic_load_int(&pps->ppsinfo.clear_sequence)) {
> > +#else /* __rtems__ */
> > +		aseq = atomic_load_acq_int(&pps->ppsinfo.assert_sequence);
> > +		cseq = atomic_load_acq_int(&pps->ppsinfo.clear_sequence);
> > +		while (aseq == atomic_load_acq_int(&pps->ppsinfo.assert_sequence) &&
> > +		    cseq == atomic_load_acq_int(&pps->ppsinfo.clear_sequence)) {
> > +#endif /* __rtems__ */
> >   			if (abi_aware(pps, 1) && pps->driver_mtx != NULL) {
> >   				if (pps->flags & PPSFLAG_MTX_SPIN) {
> >   					err = msleep_spin(pps, pps->driver_mtx,
> 
> Why do you need this change?
> 

If you mean why atomic_load_int() was replaced by atomic_load_acq_int(), it is because atomic_load_int()  is not defined in rtems but in rtems-libbsd.


More information about the devel mailing list