Lines Matching +full:up +full:-

2  * refclock_true - clock driver for the Kinemetrics/TrueTime receivers
3 * Receiver Version 3.0C - tested plain, with CLKLDISC
5 * - Support TL-3 WWV TOD receiver
46 * GOES: (468-DC, usable with GPS->GOES converting antenna)
47 * GPS/TM-TMD:
48 * XL-DC: (a 151-602-210, reported by the driver as a GPS/TM-TMD)
49 * GPS-800 TCU: (an 805-957 with the RS232 Talker/Listener module)
50 * TL-3: 3 channel WWV/H receiver w/ IRIG and RS-232 outputs
51 * OM-DC: getting stale ("OMEGA")
57 * A - control A (this is stripped before we see it)
58 * Q - Quality indication (see below)
59 * C - Carriage return
60 * L - Line feed
63 * 468-DC GOES Receiver:
64 * GPS-TM/TMD Receiver: (default quality codes for XL-DC)
65 * ? +/- 1 milliseconds # +/- 100 microseconds
66 * * +/- 10 microseconds . +/- 1 microsecond
68 * TL-3 Receiver: (default quality codes for TL-3)
70 * space +/- 5 milliseconds
71 * OM-DC OMEGA Receiver: (default quality codes for OMEGA)
73 * > >+- 5 seconds
74 * ? >+/- 500 milliseconds # >+/- 50 milliseconds
75 * * >+/- 5 milliseconds . >+/- 1 millisecond
76 * A-H less than 1 millisecond. Character indicates which station
83 * Notes on 468-DC and OMEGA receiver:
88 * Notes on the 468-DC receiver:
98 * fudge 127.127.5.0 time1 +0.008 time2 -0.004
103 * Notes on the TrueTime TimeLink TL-3 WWV TOD receiver:
107 * from the RS-232 port. Send the receiver "ST1" to turn it on, and
115 * time1 - offset applied to samples when reading WEST satellite (default = 0)
116 * time2 - offset applied to samples when reading EAST satellite (default = 0)
117 * stratum - stratum to assign to this clock (default = 0)
118 * refid - refid assigned to this clock (default = "TRUE", see below)
119 * flag1 - will silence the clock side of ntpd, just reading the clock
121 * flag2 - generate a debug file /tmp/true%d.
122 * flag3 - enable ppsclock streams module
123 * flag4 - use the PCL-720 (BSD/OS only)
136 #define PRECISION (-10) /* precision assumed (about 1 ms) */
199 true_start, /* start up driver */
219 struct true_unit *up;
222 pp = peer->procptr;
223 up = pp->unitptr;
225 want_debugging = (pp->sloppyclockflag & CLK_FLAG2) != 0;
226 now_debugging = (up->debug != NULL);
234 "/tmp/true%d.debug", up->unit);
237 if (fd >= 0 && (up->debug = fdopen(fd, "w"))) {
241 setvbuf(up->debug, buf, _IOLBF, BUFSIZ);
243 setlinebuf(up->debug);
247 fclose(up->debug);
248 up->debug = NULL;
252 if (up->debug) {
253 fprintf(up->debug, "true%d: ", up->unit);
254 vfprintf(up->debug, fmt, ap);
261 * true_start - open the devices and initialize data for processing
269 register struct true_unit *up;
278 fd = refclock_open(&peer->srcadr, device, SPEED232, LDISC_CLK);
285 up = emalloc_zero(sizeof(*up));
286 pp = peer->procptr;
287 pp->io.clock_recv = true_receive;
288 pp->io.srcclock = peer;
289 pp->io.datalen = 0;
290 pp->io.fd = fd;
291 if (!io_addclock(&pp->io)) {
293 pp->io.fd = -1;
294 free(up);
297 pp->unitptr = up;
302 peer->precision = PRECISION;
303 pp->clockdesc = DESCRIPTION;
304 memcpy(&pp->refid, REFID, 4);
305 up->pollcnt = 2;
306 up->type = t_unknown;
307 up->state = s_Base;
310 * Send a CTRL-C character at the start,
323 * true_shutdown - shut down the clock
331 register struct true_unit *up;
334 pp = peer->procptr;
335 up = pp->unitptr;
336 if (pp->io.fd != -1)
337 io_closeclock(&pp->io);
338 if (up != NULL)
339 free(up);
344 * true_receive - receive data from the serial interface on a clock
351 register struct true_unit *up;
366 peer = rbufp->recv_peer;
367 pp = peer->procptr;
368 up = pp->unitptr;
381 pp->lencode = rd_lencode;
382 strlcpy(pp->a_lastcode, rd_lastcode, sizeof(pp->a_lastcode));
383 pp->lastrec = rd_tmp;
384 true_debug(peer, "receive(%s) [%d]\n", pp->a_lastcode,
385 pp->lencode);
387 up->pollcnt = 2;
388 record_clock_stats(&peer->srcadr, pp->a_lastcode);
401 if (pp->a_lastcode[0] == '?' ||
402 strcmp(pp->a_lastcode, "ERROR 05 NO SUCH FUNCTION") == 0) {
408 * Timecode: "nnnnn+nnn-nnn"
411 if ((pp->a_lastcode[5] == '+' || pp->a_lastcode[5] == '-') &&
412 (pp->a_lastcode[9] == '+' || pp->a_lastcode[9] == '-') &&
413 sscanf(pp->a_lastcode, "%5d%*c%3d%*c%3d", &lon, &lat, &off) == 3
432 if (new_station != up->station) {
435 dtemp = pp->fudgetime1;
436 pp->fudgetime1 = pp->fudgetime2;
437 pp->fudgetime2 = dtemp;
438 up->station = new_station;
452 * (from TM/TMD clock when it wants to tell us what it's up to.)
454 if (sscanf(pp->a_lastcode, "F%2d", &i) == 1 && i > 0 && i < 80) {
463 true_debug(peer, "got F%02d - ignoring\n", i);
473 if (pp->a_lastcode[0] == 'V' && pp->a_lastcode[1] == 'E' &&
474 pp->a_lastcode[2] == 'R' && pp->a_lastcode[6] == '.') {
477 msyslog(LOG_INFO, "TL3: %s", pp->a_lastcode);
486 if (strncmp(pp->a_lastcode, " TRUETIME Mk III ", 17) == 0 ||
487 strncmp(pp->a_lastcode, " TRUETIME XL", 12) == 0) {
490 msyslog(LOG_INFO, "TM/TMD/XL: %s", pp->a_lastcode);
501 if ((pp->a_lastcode[0] == 'N' || pp->a_lastcode[0] == 'S') &&
502 (pp->a_lastcode[9] == 'W' || pp->a_lastcode[9] == 'E') &&
503 pp->a_lastcode[18] == '+') {
506 msyslog(LOG_INFO, "TCU-800: %s", pp->a_lastcode);
516 if (pp->a_lastcode[3] == ':' &&
517 pp->a_lastcode[6] == ':' &&
518 pp->a_lastcode[9] == ':' &&
519 sscanf(pp->a_lastcode, "%3d:%2d:%2d:%2d%c",
520 &pp->day, &pp->hour, &pp->minute,
521 &pp->second, &synced) == 5) {
529 pp->leap = LEAP_NOTINSYNC;
531 pp->leap = LEAP_NOWARNING;
537 if ((pp->sloppyclockflag & CLK_FLAG4) && up->pcl720init) {
545 if (!clocktime(pp->day, pp->hour, pp->minute,
546 pp->second, GMT, pp->lastrec.l_ui,
547 &pp->yearstart, &off.l_ui)) {
554 pp->usec = true_sample720();
556 TVUTOTSF(pp->usec, off.l_uf);
562 * adjusted the input time to reflect now (via pp->usec)
565 get_systime(&pp->lastrec);
570 L_SUB(&off, &pp->lastrec);
574 true_debug(peer, "true_sample720: %luus\n", pp->usec);
582 if (!up->polled)
589 if (up->type == t_goes || up->type == t_unknown)
600 pp->lastref = pp->lastrec;
608 up->polled = 0;
622 * true_send - time to send the clock a signal to cough up a time sample
632 pp = peer->procptr;
633 if (!(pp->sloppyclockflag & CLK_FLAG1)) {
640 pp->polls++;
654 struct true_unit *up;
657 pp = peer->procptr;
658 up = pp->unitptr;
662 typeStr(up->type),
663 stateStr(up->state),
668 typeStr(up->type), stateStr(up->state), eventStr(event));
669 switch (up->type) {
675 * Switch back to on-second time codes and return.
678 up->state = s_Start;
695 up->state = s_Start;
698 if (up->state != s_Start && up->state != s_Auto) {
702 up->state = s_Auto;
712 up->state = s_Init;
720 if ( strcmp(pp->a_lastcode, " TRUETIME Mk III") == 0 ||
721 strncmp(pp->a_lastcode, " TRUETIME XL", 12) == 0) {
725 pp->a_lastcode);
729 up->state = s_F18;
733 up->state = s_F50;
737 up->state = s_Start;
740 if (up->state != s_Start && up->state != s_Auto) {
744 up->state = s_Auto;
756 up->state = s_Start;
759 if (up->state != s_Start && up->state != s_Auto) {
763 up->state = s_Auto;
775 up->state = s_Auto;
784 switch (up->state) {
789 up->state = s_InqGOES;
794 up->type = t_goes;
802 up->state = s_InqTL3;
812 up->type = t_tl3;
813 up->state = s_Auto; /* Inq side-effect. */
818 up->state = s_InqOmega;
822 up->type = t_tl3; /* Already sending data */
823 up->state = s_Auto;
834 up->type = t_omega;
835 up->state = s_Auto; /* Inq side-effect. */
839 up->state = s_InqTM;
849 up->type = t_tm;
855 up->state = s_InqTCU;
866 up->type = t_tcu;
871 up->state = s_Base;
891 stateStr(up->state));
901 if ((pp->sloppyclockflag & CLK_FLAG4) && !up->pcl720init) {
909 msyslog(LOG_NOTICE, "PCL-720 initialized");
911 up->pcl720init++;
919 * true_poll - called by the transmit procedure
927 struct true_unit *up;
935 pp = peer->procptr;
936 up = pp->unitptr;
937 if (up->pollcnt > 0) {
938 up->pollcnt--;
948 up->polled = 1;
949 pp->polls++;
954 * true_sample720 - sample the PCL-720
961 /* We wire the PCL-720's 8253.OUT0 to bit 0 of connector 3.
967 msyslog(LOG_NOTICE, "PCL-720 out of synch");
971 f = (65536 - pcl720_read(PCL720_IOB, PCL720_CTR));
973 msyslog(LOG_DEBUG, "PCL-720: %luus", f);