summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriel Moyano <gabriel.moyano@dlr.de>2022-05-20 11:30:02 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2022-05-23 09:09:03 +0200
commit5ccf9605ddfd0a226f7f1c6c3ecde8623b82c837 (patch)
tree4c52b771835c26304c4964268990db654a96b01f
parenttimepps.h: PPS_SYNC defined by default (diff)
downloadrtems-5ccf9605ddfd0a226f7f1c6c3ecde8623b82c837.tar.bz2
timecounter.h: Add _Timecounter_Discipline()
Update #2349.
Diffstat (limited to '')
-rw-r--r--cpukit/include/rtems/score/timecounter.h17
-rw-r--r--cpukit/include/sys/timepps.h9
2 files changed, 26 insertions, 0 deletions
diff --git a/cpukit/include/rtems/score/timecounter.h b/cpukit/include/rtems/score/timecounter.h
index ae1e2612f8..6559801559 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 35dfdcbf66..030c734477 100644
--- a/cpukit/include/sys/timepps.h
+++ b/cpukit/include/sys/timepps.h
@@ -27,6 +27,10 @@
#ifdef __rtems__
#include <rtems/score/atomic.h>
#define PPS_SYNC
+#define hardpps _Timecounter_Discipline
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
#endif /* __rtems__ */
#define PPS_API_VERS_1 1
@@ -295,4 +299,9 @@ time_pps_kcbind(pps_handle_t handle, const int kernel_consumer,
#endif /* KERNEL */
+#ifdef __rtems__
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* __rtems__ */
#endif /* !_SYS_TIMEPPS_H_ */