summaryrefslogtreecommitdiffstats
path: root/app/ntp.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/ntp.c')
-rw-r--r--app/ntp.c79
1 files changed, 79 insertions, 0 deletions
diff --git a/app/ntp.c b/app/ntp.c
new file mode 100644
index 0000000..1c109ce
--- /dev/null
+++ b/app/ntp.c
@@ -0,0 +1,79 @@
+#include "project.h"
+
+
+typedef struct {
+ union {
+ struct {
+ uint32_t li: 2;
+ uint32_t vn: 3;
+ uint32_t mode: 3;
+ uint32_t stratum: 8;
+ uint32_t poll: 8;
+ uint32_t precision: 8;
+ };
+ uint32_t word_0;
+ };
+
+ uint32_t root_delay;
+ uint32_t root_dispersion;
+ uint32_t reference_id;
+
+ uint64_t reference_ts;
+ uint64_t origin_ts;
+ uint64_t receive_ts;
+ uint64_t transmit_ts;
+} ntp_packet_t;
+
+
+
+
+#if 0
+packet (uint8_t *_p)
+{
+ EPOCH reftime = pll_decompose (pll_last_update);
+
+ ntp_packet_t rx = (uint8_t *)_p;
+ ntp_packet_t tx;
+
+
+ tx.li = NTP LEAP_MEH;
+ tx.vn = NTP_VERSION;
+ tx.mode = NTP_MODE_SERVER;
+ tx.poll = ?
+ tx.precision = ?
+ tx.rootdelay = ?
+ tx.rootdisp = ?
+ tx.refid = FCC ('M', 'S', 'F', 0);
+ tx.reftime =;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+#endif