]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 3490] Patch to support Trimble Resolution Receivers
authorJuergen Perlinger <perlinger@ntp.org>
Tue, 4 Jun 2019 05:59:30 +0000 (07:59 +0200)
committerJuergen Perlinger <perlinger@ntp.org>
Tue, 4 Jun 2019 05:59:30 +0000 (07:59 +0200)
bk: 5cf608c2rHzAjEJf65YBftdLOVYdaw

ChangeLog
ntpd/refclock_palisade.c

index 9ff845c81028eeecbd72fd587d28555bc5f781e5..ed68059a9fa660b3c3eed7bb091f06b5dae906f7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+---
+* [Bug 3490] Patch to support Trimble Resolution Receivers <perlinger@ntp.org>
+  - applied (modified) patch by Richard Steedman
+
 ---
 (4.2.8p13) 2019/03/07 Released by Harlan Stenn <stenn@ntp.org>
 
index d69ce9400e686509b1caba9a1659472b2d226987..492c149ad646bfebf1cdb9cf735f09c1ac44c3e6 100644 (file)
@@ -52,6 +52,8 @@
  *
  *
  *
+ * 21/04/18: Added support for Resolution devices.
+ *
  * 31/03/06: Added support for Thunderbolt GPS Disciplined Clock.
  *          Contact: Fernando Pablo Hauscarriaga
  *          E-mail: fernandoph@iar.unlp.edu.ar
@@ -114,6 +116,7 @@ static int decode_date(struct refclockproc *pp, const char *cp);
 #define CLK_THUNDERBOLT        2       /* Trimble Thunderbolt GPS Receiver */
 #define CLK_ACUTIME     3      /* Trimble Acutime Gold */
 #define CLK_ACUTIMEB    4      /* Trimble Actutime Gold Port B */
+#define CLK_RESOLUTION  5      /* Trimble Resolution Receivers */
 
 int praecis_msg;
 static void praecis_parse(struct recvbuf *rbufp, struct peer *peer);
@@ -254,6 +257,37 @@ init_acutime (
        free(tx.data);
 }
 
+/*
+ * init_resolution - Prepares Resolution receiver to be used with NTP
+ */
+static void
+init_resolution (
+       int fd
+       )
+{
+       struct packettx tx;
+       
+       tx.size = 0;
+       tx.data = (u_char *) emalloc(100);
+
+       /* set UTC time */
+       sendsupercmd (&tx, 0x8E, 0xA2);
+       sendbyte     (&tx, 0x3);
+       sendetx      (&tx, fd);
+
+       /* squelch PPS output unless locked to at least one satellite */
+       sendsupercmd (&tx, 0x8E, 0x4E);
+       sendbyte     (&tx, 0x3);
+       sendetx      (&tx, fd);
+       
+       /* activate packets 0x8F-AB and 0x8F-AC */
+       sendsupercmd (&tx, 0x8E, 0xA5);
+       sendint      (&tx, 0x5);
+       sendetx      (&tx, fd);
+
+       free(tx.data);
+}
+
 /*
  * palisade_start - open the devices and initialize data for processing
  */
@@ -321,6 +355,11 @@ palisade_start (
                msyslog(LOG_NOTICE, "Palisade(%d) Acutime Gold mode enabled"
                        ,unit);
                break;
+           case CLK_RESOLUTION:
+               msyslog(LOG_NOTICE, "Palisade(%d) Resolution mode enabled"
+                       ,unit);
+               tio.c_cflag = (CS8|CLOCAL|CREAD|PARENB|PARODD);
+               break;
            default:
                msyslog(LOG_NOTICE, "Palisade(%d) mode unknown",unit);
                break;
@@ -371,6 +410,8 @@ palisade_start (
                init_thunderbolt(fd);
        if (up->type == CLK_ACUTIME)
                init_acutime(fd);
+       if (up->type == CLK_RESOLUTION)
+               init_resolution(fd);
 
        return 1;
 }
@@ -496,7 +537,10 @@ TSIP_decode (
         * proper format, declare bad format and exit.
         */
 
-       if ((up->type != CLK_THUNDERBOLT) & (up->type != CLK_ACUTIME)){
+       if ((up->type != CLK_THUNDERBOLT) &&
+           (up->type != CLK_ACUTIME    ) &&
+           (up->type != CLK_RESOLUTION)   )
+       {
                if ((up->rpt_buf[0] == (char) 0x41) ||
                    (up->rpt_buf[0] == (char) 0x46) ||
                    (up->rpt_buf[0] == (char) 0x54) ||