Lines Matching +full:reset +full:- +full:synchronized

2  * refclock_wwvb - clock driver for Spectracom WWVB and GPS receivers
27 * Synchronized Clocks and the Netclock/GPS Master Clock. Both the WWVB
36 * The WWVB and GPS clocks should be configured for 24-hour display,
53 * on-time = first <cr>
65 * on-time = <cr>
81 * and reset to ' ' on the first day of the following month. The d is
85 * synchronized to the indicated time as returned.
87 * This driver does not need to be told which format is in use - it
117 #define PRECISION (-13) /* precision assumed (about 100 us) */
118 #define PPS_PRECISION (-13) /* precision assumed (about 100 us) */
175 * wwvb_start - open the devices and initialize data for processing
192 fd = refclock_open(&peer->srcadr, device, SPEED232, LDISC_CLK); in wwvb_start()
200 pp = peer->procptr; in wwvb_start()
201 pp->io.clock_recv = wwvb_receive; in wwvb_start()
202 pp->io.srcclock = peer; in wwvb_start()
203 pp->io.datalen = 0; in wwvb_start()
204 pp->io.fd = fd; in wwvb_start()
205 if (!io_addclock(&pp->io)) { in wwvb_start()
207 pp->io.fd = -1; in wwvb_start()
211 pp->unitptr = up; in wwvb_start()
216 peer->precision = PRECISION; in wwvb_start()
217 pp->clockdesc = DESCRIPTION; in wwvb_start()
218 memcpy(&pp->refid, REFID, 4); in wwvb_start()
224 * wwvb_shutdown - shut down the clock
235 pp = peer->procptr; in wwvb_shutdown()
236 up = pp->unitptr; in wwvb_shutdown()
237 if (-1 != pp->io.fd) in wwvb_shutdown()
238 io_closeclock(&pp->io); in wwvb_shutdown()
245 * wwvb_receive - receive data from the serial interface
269 peer = rbufp->recv_peer; in wwvb_receive()
270 pp = peer->procptr; in wwvb_receive()
271 up = pp->unitptr; in wwvb_receive()
272 temp = refclock_gtlin(rbufp, pp->a_lastcode, BMAX, &trtmp); in wwvb_receive()
278 * +-50 us relative to the pps; however, on an unmodified 8170 in wwvb_receive()
283 * Save the timestamp of each <CR> in up->laststamp. Lines with in wwvb_receive()
287 * The preceding <CR> is the on-time character for both formats. in wwvb_receive()
288 * The timestamp provided with non-empty lines corresponds to in wwvb_receive()
294 if (up->prev_eol_cr) { in wwvb_receive()
298 up->laststamp = trtmp; in wwvb_receive()
302 up->prev_eol_cr = !up->prev_eol_cr; in wwvb_receive()
305 pp->lencode = temp; in wwvb_receive()
306 pp->lastrec = up->laststamp; in wwvb_receive()
307 up->laststamp = trtmp; in wwvb_receive()
308 up->prev_eol_cr = TRUE; in wwvb_receive()
311 prettydate(&trtmp), prettydate(&pp->lastrec))); in wwvb_receive()
312 if (L_ISZERO(&pp->lastrec)) in wwvb_receive()
323 switch (pp->lencode) { in wwvb_receive()
330 if (sscanf(pp->a_lastcode, in wwvb_receive()
332 &syncchar, &pp->day, &pp->hour, &pp->minute, in wwvb_receive()
333 &pp->second, &tmpchar, &dstchar, &tz) == 8) { in wwvb_receive()
334 pp->nsec = 0; in wwvb_receive()
343 if (sscanf(pp->a_lastcode, in wwvb_receive()
345 &syncchar, &qualchar, &pp->year, &pp->day, in wwvb_receive()
346 &pp->hour, &pp->minute, &pp->second, &pp->nsec, in wwvb_receive()
348 pp->nsec *= 1000000; in wwvb_receive()
357 * WARNING: Undocumented, and the on-time character # is in wwvb_receive()
361 if (sscanf(pp->a_lastcode, in wwvb_receive()
363 &syncchar, &pp->year, &month, &day, &pp->hour, in wwvb_receive()
364 &pp->minute, &pp->second, &dstchar, &leapchar) == 8) in wwvb_receive()
366 pp->day = ymd2yd(pp->year, month, day); in wwvb_receive()
367 pp->nsec = 0; in wwvb_receive()
379 if (up->linect > 0) { in wwvb_receive()
380 up->linect--; in wwvb_receive()
381 record_clock_stats(&peer->srcadr, in wwvb_receive()
382 pp->a_lastcode); in wwvb_receive()
393 * Once synchronized, the dispersion depends only on the in wwvb_receive()
399 pp->disp = .001; in wwvb_receive()
400 pp->lastref = pp->lastrec; in wwvb_receive()
404 pp->disp = .01; in wwvb_receive()
408 pp->disp = .1; in wwvb_receive()
412 pp->disp = .5; in wwvb_receive()
416 pp->disp = MAXDISPERSE; in wwvb_receive()
420 pp->disp = MAXDISPERSE; in wwvb_receive()
425 pp->leap = LEAP_NOTINSYNC; in wwvb_receive()
427 pp->leap = LEAP_ADDSECOND; in wwvb_receive()
429 pp->leap = LEAP_NOWARNING; in wwvb_receive()
436 up->tcount++; in wwvb_receive()
437 if (peer->flags & FLAG_PPS) in wwvb_receive()
441 if (!refclock_process_f(pp, pp->fudgetime2)) in wwvb_receive()
447 * wwvb_timer - called once per second by the transmit procedure
469 pp = peer->procptr; in wwvb_timer()
470 up = pp->unitptr; in wwvb_timer()
471 if (up->linect > 0) in wwvb_timer()
475 if (write(pp->io.fd, &pollchar, 1) != 1) in wwvb_timer()
483 if (up->ppsapi_lit && in wwvb_timer()
484 refclock_pps(peer, &up->atom, pp->sloppyclockflag) > 0) { in wwvb_timer()
485 up->pcount++, in wwvb_timer()
486 peer->flags |= FLAG_PPS; in wwvb_timer()
487 peer->precision = PPS_PRECISION; in wwvb_timer()
494 * wwvb_poll - called by the transmit procedure
509 pp = peer->procptr; in wwvb_poll()
510 up = pp->unitptr; in wwvb_poll()
511 pp->polls++; in wwvb_poll()
517 if (pp->sloppyclockflag & CLK_FLAG4 && pp->hour < in wwvb_poll()
518 (int)up->lasthour) in wwvb_poll()
519 up->linect = MONLIN; in wwvb_poll()
520 up->lasthour = (u_char)pp->hour; in wwvb_poll()
527 if (up->pcount == 0) { in wwvb_poll()
528 peer->flags &= ~FLAG_PPS; in wwvb_poll()
529 peer->precision = PRECISION; in wwvb_poll()
531 if (up->tcount == 0) { in wwvb_poll()
532 pp->coderecv = pp->codeproc; in wwvb_poll()
536 up->pcount = up->tcount = 0; in wwvb_poll()
538 if (pp->coderecv == pp->codeproc) { in wwvb_poll()
544 record_clock_stats(&peer->srcadr, pp->a_lastcode); in wwvb_poll()
547 printf("wwvb: timecode %d %s\n", pp->lencode, in wwvb_poll()
548 pp->a_lastcode); in wwvb_poll()
554 * wwvb_control - fudge parameters have been set or changed
568 pp = peer->procptr; in wwvb_control()
569 up = pp->unitptr; in wwvb_control()
571 if (!(pp->sloppyclockflag & CLK_FLAG1)) { in wwvb_control()
572 if (!up->ppsapi_tried) in wwvb_control()
574 up->ppsapi_tried = 0; in wwvb_control()
575 if (!up->ppsapi_lit) in wwvb_control()
577 peer->flags &= ~FLAG_PPS; in wwvb_control()
578 peer->precision = PRECISION; in wwvb_control()
579 time_pps_destroy(up->atom.handle); in wwvb_control()
580 up->atom.handle = 0; in wwvb_control()
581 up->ppsapi_lit = 0; in wwvb_control()
585 if (up->ppsapi_tried) in wwvb_control()
590 up->ppsapi_tried = 1; in wwvb_control()
591 if (refclock_ppsapi(pp->io.fd, &up->atom)) { in wwvb_control()
592 up->ppsapi_lit = 1; in wwvb_control()
597 refnumtoa(&peer->srcadr)); in wwvb_control()