From: Harlan Stenn Date: Thu, 28 Nov 2002 04:09:43 +0000 (-0500) Subject: Praecis CDMA mods for the Trimble Palisade driver. X-Git-Tag: NTP_4_1_1C_RC1~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c5c0244e3a2f5ebd117a23752fd49f54be82ebd;p=thirdparty%2Fntp.git Praecis CDMA mods for the Trimble Palisade driver. From: Mark Santcroos bk: 3de59707RQHxNxOSKNlwJ9EFKHU_ew --- diff --git a/html/driver29.htm b/html/driver29.htm index 3cddfc2a3..60d90aa7f 100644 --- a/html/driver29.htm +++ b/html/driver29.htm @@ -366,6 +366,19 @@ by the driver. If triggering the event pulse fails, the driver falls back to this mode automatically. +

+Mode Parameter

+ +
+
+mode number
+ +
+The mode parameter to the server command specifies the specific hardware this +driver is for. The default is 0 for a normal Trimble Palisade. The only other +option at this time is 1 for a Endrun Praecis in Trimble emulation mode.
+
+

DEFINEs

The following constants are defined in the driver source code. These defines diff --git a/ntpd/refclock_palisade.c b/ntpd/refclock_palisade.c index 4b36b7880..c7b078adb 100644 --- a/ntpd/refclock_palisade.c +++ b/ntpd/refclock_palisade.c @@ -88,6 +88,16 @@ struct refclock refclock_palisade = { int day_of_year P((char *dt)); +/* Extract the clock type from the mode setting */ +#define CLK_TYPE(x) ((int)(((x)->ttlmax) & 0x7F)) + +/* Supported clock types */ +#define CLK_TRIMBLE 0 /* Trimble Palisade */ +#define CLK_PRAECIS 1 /* Endrun Technologies Praecis */ + +int praecis_msg; +static void praecis_parse(struct recvbuf *rbufp, struct peer *peer); + /* * palisade_start - open the devices and initialize data for processing */ @@ -195,6 +205,19 @@ palisade_start ( memset((char *)up, 0, sizeof(struct palisade_unit)); + up->type = CLK_TYPE(peer); + switch (up->type) { + case CLK_TRIMBLE: + /* Normal mode, do nothing */ + break; + case CLK_PRAECIS: + msyslog(LOG_NOTICE, "Palisade(%d) Praecis mode enabled\n",unit); + break; + default: + msyslog(LOG_NOTICE, "Palisade(%d) mode unknown\n",unit); + break; + } + pp = peer->procptr; pp->io.clock_recv = palisade_io; pp->io.srcclock = (caddr_t)peer; @@ -620,10 +643,43 @@ palisade_poll ( if (pp->sloppyclockflag & CLK_FLAG2) return; /* using synchronous packet input */ + if(up->type == CLK_PRAECIS) { + if(write(peer->procptr->io.fd,"SPSTAT\r\n",8) < 0) + msyslog(LOG_ERR, "Palisade(%d) write: %m:",unit); + else { + praecis_msg = 1; + return; + } + } + if (HW_poll(pp) < 0) refclock_report(peer, CEVNT_FAULT); } +static void +praecis_parse(struct recvbuf *rbufp, struct peer *peer) +{ + static char buf[100]; + static int p = 0; + struct refclockproc *pp; + + pp = peer->procptr; + + memcpy(buf+p,rbufp->recv_space.X_recv_buffer, rbufp->recv_length); + p += rbufp->recv_length; + + if(buf[p-2] == '\r' && buf[p-1] == '\n') { + buf[p-2] = NULL; + record_clock_stats(&peer->srcadr, buf); + + p = 0; + praecis_msg = 0; + + if (HW_poll(pp) < 0) + refclock_report(peer, CEVNT_FAULT); + + } +} static void palisade_io ( @@ -649,6 +705,13 @@ palisade_io ( pp = peer->procptr; up = (struct palisade_unit *)pp->unitptr; + if(up->type == CLK_PRAECIS) { + if(praecis_msg) { + praecis_parse(rbufp,peer); + return; + } + } + c = (char *) &rbufp->recv_space; d = c + rbufp->recv_length; diff --git a/ntpd/refclock_palisade.h b/ntpd/refclock_palisade.h index cc3771639..7e1ed4965 100644 --- a/ntpd/refclock_palisade.h +++ b/ntpd/refclock_palisade.h @@ -146,6 +146,7 @@ struct palisade_unit { char rpt_status; /* TSIP Parser State */ short rpt_cnt; /* TSIP packet length so far */ char rpt_buf[BMAX]; /* packet assembly buffer */ + int type; /* Clock mode type */ }; /*