[rtems commit] kern_tc.c: Add atomic dependencies required by the PPS API

Sebastian Huber sebh at rtems.org
Mon May 23 07:04:26 UTC 2022


Module:    rtems
Branch:    master
Commit:    bf61753a9209233119c8e5723463d2e21ef56e2a
Changeset: http://git.rtems.org/rtems/commit/?id=bf61753a9209233119c8e5723463d2e21ef56e2a

Author:    Gabriel Moyano <gabriel.moyano at dlr.de>
Date:      Fri May 20 11:29:55 2022 +0200

kern_tc.c: Add atomic dependencies required by the PPS API

Update #2349.

---

 cpukit/include/sys/timepps.h | 7 +++++++
 cpukit/score/src/kern_tc.c   | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/cpukit/include/sys/timepps.h b/cpukit/include/sys/timepps.h
index 01212f0b43..5703381ffa 100644
--- a/cpukit/include/sys/timepps.h
+++ b/cpukit/include/sys/timepps.h
@@ -24,12 +24,19 @@
 #include <sys/_ffcounter.h>
 #include <sys/ioccom.h>
 #include <sys/time.h>
+#ifdef __rtems__
+#include <rtems/score/atomic.h>
+#endif /* __rtems__ */
 
 #define PPS_API_VERS_1	1
 
 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..f7d0a0b4ba 100644
--- a/cpukit/score/src/kern_tc.c
+++ b/cpukit/score/src/kern_tc.c
@@ -114,6 +114,13 @@ atomic_thread_fence_rel(void)
 	_Atomic_Fence(ATOMIC_ORDER_RELEASE);
 }
 
+static inline u_int
+atomic_load_int(Atomic_Uint *i)
+{
+
+	return (_Atomic_Load_uint(i, ATOMIC_ORDER_RELAXED));
+}
+
 static inline u_int
 atomic_load_acq_int(Atomic_Uint *i)
 {



More information about the vc mailing list