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