to this mode automatically.</dd>
</dl>
+<h2>
+<font size=+1>Mode Parameter</font></h2>
+
+<dl>
+<dt>
+<tt><font size=+1>mode <i>number</i></font></tt></dt>
+
+<dd>
+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.</dd>
+</dl>
+
<h2>
<font size=+1>DEFINEs</font></h2>
The following constants are defined in the driver source code. These defines
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
*/
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;
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 (
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;