Lines Matching +full:clock +full:- +full:accuracy

2  * refclock_arbiter - clock driver for Arbiter 1088A/B Satellite
3 * Controlled Clock
21 * This driver supports the Arbiter 1088A/B Satellite Controlled Clock.
22 * The claimed accuracy of this clock is 100 ns relative to the PPS
39 * on-time = <cr>
53 * Format TQ (IEEE P1344 estimated worst-case time quality)
55 * 0 clock locked, maximum accuracy
56 * F clock failure, time not reliable
57 * 4 clock unlocked, accuracy < 1 us
58 * 5 clock unlocked, accuracy < 10 us
59 * 6 clock unlocked, accuracy < 100 us
60 * 7 clock unlocked, accuracy < 1 ms
61 * 8 clock unlocked, accuracy < 10 ms
62 * 9 clock unlocked, accuracy < 100 ms
63 * A clock unlocked, accuracy < 1 s
64 * B clock unlocked, accuracy < 10 s
81 * deviation mode and connected to a 1-PPS signal, the last two numbers
93 #define PRECISION (-20) /* precision assumed (about 1 us) */
106 #define COMMAND_HALT_BCAST ( (peer->MODE % 2) ? "O0" : "B0" )
107 #define COMMAND_START_BCAST ( (peer->MODE % 2) ? "O5" : "B5" )
143 * arb_start - open the devices and initialize data for processing
160 fd = refclock_open(&peer->srcadr, device, SPEED232, LDISC_CLK); in arb_start()
168 pp = peer->procptr; in arb_start()
169 pp->io.clock_recv = arb_receive; in arb_start()
170 pp->io.srcclock = peer; in arb_start()
171 pp->io.datalen = 0; in arb_start()
172 pp->io.fd = fd; in arb_start()
173 if (!io_addclock(&pp->io)) { in arb_start()
175 pp->io.fd = -1; in arb_start()
179 pp->unitptr = up; in arb_start()
184 peer->precision = PRECISION; in arb_start()
185 pp->clockdesc = DESCRIPTION; in arb_start()
186 memcpy((char *)&pp->refid, REFID, 4); in arb_start()
187 if (peer->MODE > 1) { in arb_start()
188 msyslog(LOG_NOTICE, "ARBITER: Invalid mode %d", peer->MODE); in arb_start()
190 pp->io.fd = -1; in arb_start()
195 if(debug) { printf("arbiter: mode = %d.\n", peer->MODE); } in arb_start()
203 * arb_shutdown - shut down the clock
214 pp = peer->procptr; in arb_shutdown()
215 up = pp->unitptr; in arb_shutdown()
216 if (-1 != pp->io.fd) in arb_shutdown()
217 io_closeclock(&pp->io); in arb_shutdown()
224 * arb_receive - receive data from the serial interface
242 peer = rbufp->recv_peer; in arb_receive()
243 pp = peer->procptr; in arb_receive()
244 up = pp->unitptr; in arb_receive()
252 * and expects the echo followed some time later by the on-time in arb_receive()
264 pp->lastrec = up->laststamp; in arb_receive()
265 up->laststamp = trtmp; in arb_receive()
269 if (up->tcswitch == 0) { in arb_receive()
273 * ignore; sometimes the clock doesn't stop spewing in arb_receive()
281 up->qualchar = tbuf[2]; in arb_receive()
286 strlcpy(up->status, tbuf + 2, in arb_receive()
287 sizeof(up->status)); in arb_receive()
288 if (pp->sloppyclockflag & CLK_FLAG4) in arb_receive()
296 strlcpy(up->latlon, tbuf + 2, sizeof(up->latlon)); in arb_receive()
301 strlcat(up->latlon, " ", sizeof(up->latlon)); in arb_receive()
302 strlcat(up->latlon, tbuf + 2, sizeof(up->latlon)); in arb_receive()
307 strlcat(up->latlon, " ", sizeof(up->latlon)); in arb_receive()
308 strlcat(up->latlon, tbuf + 2, sizeof(up->latlon)); in arb_receive()
313 strlcat(up->latlon, " ", sizeof(up->latlon)); in arb_receive()
314 strlcat(up->latlon, tbuf + 2, sizeof(up->latlon)); in arb_receive()
315 record_clock_stats(&peer->srcadr, up->latlon); in arb_receive()
318 printf("arbiter: %s\n", up->latlon); in arb_receive()
334 up->tcswitch++; in arb_receive()
335 if (up->tcswitch <= 1 || temp < LENARB) in arb_receive()
341 strlcpy(pp->a_lastcode, tbuf, sizeof(pp->a_lastcode)); in arb_receive()
342 pp->a_lastcode[LENARB - 2] = up->qualchar; in arb_receive()
343 strlcat(pp->a_lastcode, up->status, sizeof(pp->a_lastcode)); in arb_receive()
344 pp->lencode = strlen(pp->a_lastcode); in arb_receive()
346 if (sscanf(pp->a_lastcode, "%c%2d %3d %2d:%2d:%2d", in arb_receive()
347 &syncchar, &pp->year, &pp->day, &pp->hour, in arb_receive()
348 &pp->minute, &pp->second) != 6) { in arb_receive()
355 * We decode the clock dispersion from the time quality in arb_receive()
358 switch (up->qualchar) { in arb_receive()
360 case '0': /* locked, max accuracy */ in arb_receive()
361 pp->disp = 1e-7; in arb_receive()
362 pp->lastref = pp->lastrec; in arb_receive()
365 case '4': /* unlock accuracy < 1 us */ in arb_receive()
366 pp->disp = 1e-6; in arb_receive()
369 case '5': /* unlock accuracy < 10 us */ in arb_receive()
370 pp->disp = 1e-5; in arb_receive()
373 case '6': /* unlock accuracy < 100 us */ in arb_receive()
374 pp->disp = 1e-4; in arb_receive()
377 case '7': /* unlock accuracy < 1 ms */ in arb_receive()
378 pp->disp = .001; in arb_receive()
381 case '8': /* unlock accuracy < 10 ms */ in arb_receive()
382 pp->disp = .01; in arb_receive()
385 case '9': /* unlock accuracy < 100 ms */ in arb_receive()
386 pp->disp = .1; in arb_receive()
389 case 'A': /* unlock accuracy < 1 s */ in arb_receive()
390 pp->disp = 1; in arb_receive()
393 case 'B': /* unlock accuracy < 10 s */ in arb_receive()
394 pp->disp = 10; in arb_receive()
397 case 'F': /* clock failure */ in arb_receive()
398 pp->disp = MAXDISPERSE; in arb_receive()
405 pp->disp = MAXDISPERSE; in arb_receive()
412 pp->leap = LEAP_NOTINSYNC; in arb_receive()
414 pp->leap = LEAP_NOWARNING; in arb_receive()
422 else if (peer->disp > MAXDISTANCE) in arb_receive()
425 /* if (up->tcswitch >= MAXSTAGE) { */ in arb_receive()
432 * arb_poll - called by the transmit procedure
444 * Time to poll the clock. The Arbiter clock responds to a "B5" in arb_poll()
448 * be the only customer reading the clock. Only one customer in arb_poll()
449 * need poll the clock; all others just listen in. in arb_poll()
451 pp = peer->procptr; in arb_poll()
452 up = pp->unitptr; in arb_poll()
453 pp->polls++; in arb_poll()
454 up->tcswitch = 0; in arb_poll()
462 if (pp->coderecv == pp->codeproc) { in arb_poll()
467 record_clock_stats(&peer->srcadr, pp->a_lastcode); in arb_poll()
471 pp->lencode, pp->a_lastcode); in arb_poll()