From 25e6afd831b94b9735cc6691ee19c8edc921aca7 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 8 Apr 2018 01:14:30 +0100 Subject: working decoding --- app/ntp.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 app/ntp.c (limited to 'app/ntp.c') 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 -- cgit v1.2.3