[PATCH v4 10/11] timecounter.h: Add _Timecounter_Discipline()

Gabriel Moyano gabriel.moyano at dlr.de
Fri May 20 09:30:02 UTC 2022


---
 cpukit/include/rtems/score/timecounter.h | 17 +++++++++++++++++
 cpukit/include/sys/timepps.h             |  3 +++
 2 files changed, 20 insertions(+)

diff --git a/cpukit/include/rtems/score/timecounter.h b/cpukit/include/rtems/score/timecounter.h
index fdade06128..95e0839cff 100644
--- a/cpukit/include/rtems/score/timecounter.h
+++ b/cpukit/include/rtems/score/timecounter.h
@@ -300,6 +300,23 @@ void _Timecounter_NTP_update_second(int64_t *adjustment, time_t *newsec);
  */
 uint64_t _Timecounter_Get_frequency(void);
 
+/**
+ * @brief Updates the timecounter frequency adjustment used by
+ * _Timecounter_Set_NTP_update_second().
+ *
+ * This function is part of the time synchronization using a PPS
+ * (Pulse Per Second) signal.
+ *
+ * When an event (a rising or falling edge of the PPS signal) occurs, the
+ * functions pps_capture() and pps_event() are executed. Only if the kernel
+ * consumer is configured to be PPS_KC_HARDPPS, the timecounter is disciplined.
+ *
+ * @param[in] tsp is the time at PPS event
+ *
+ * @param[i] nsec is the time in nanoseconds from the last PPS event
+ */
+void _Timecounter_Discipline(struct timespec *tsp, long nsec);
+
 /** @} */
 
 #ifdef __cplusplus
diff --git a/cpukit/include/sys/timepps.h b/cpukit/include/sys/timepps.h
index 30bca70c8d..731c33cfcd 100644
--- a/cpukit/include/sys/timepps.h
+++ b/cpukit/include/sys/timepps.h
@@ -27,6 +27,7 @@
 #ifdef __rtems__
 #include <rtems/score/atomic.h>
 #define PPS_SYNC
+#define hardpps _Timecounter_Discipline
 #endif /* __rtems__ */
 
 #define PPS_API_VERS_1	1
@@ -203,7 +204,9 @@ void pps_event(struct pps_state *pps, int event);
 void pps_init(struct pps_state *pps);
 void pps_init_abi(struct pps_state *pps);
 int pps_ioctl(unsigned long cmd, caddr_t data, struct pps_state *pps);
+#ifndef __rtems__
 void hardpps(struct timespec *tsp, long nsec);
+#endif /* __rtems__ */
 
 #else /* !_KERNEL */
 
-- 
2.25.1



More information about the devel mailing list