Lines Matching +full:up +full:-

2  * refclock_acts - clock driver for the NIST/USNO/PTB/NPL Computer Time
33 * This driver requires a modem with a Hayes-compatible command set and
35 * modem setup string is hard-coded in the driver and may require
41 * followed by the number itself, including the long-distance prefix
76 * Phone: (303) 494-4774 (Boulder, CO); (808) 335-4721 (Hawaii)
85 * 47999 90-04-18 21:39:15 50 0 +.1 045.0 UTC(NIST) *<CR><LF>
89 * the on-time markers echoed by the driver and used by NIST to measure
91 * recently been changed to eliminate the * on-time indicator. The
96 * Phone: (202) 762-1594 (Washington, DC); (719) 567-6742 (Boulder, CO)
98 * Data Format (two lines, repeating at one-second intervals)
106 * * on-time marker for previous timecode
119 * 1995-01-23 20:58:51 MEZ 10402303260219950123195849740+40000500<CR><LF>
124 * call it up and retrieve the time in one of two formats. As this
133 #define PRECISION (-10) /* precision assumed (about 1 ms) */
168 * &D2 hang up and return to command mode on DTR transition
174 * Y1 enable long-space disconnect
207 l_fp tstamp; /* on-time timestamp */
229 acts_start, /* start up driver */
247 struct actsunit *up;
254 up = emalloc_zero(sizeof(struct actsunit));
255 up->unit = unit;
256 pp = peer->procptr;
257 pp->unitptr = up;
258 pp->io.clock_recv = acts_receive;
259 pp->io.srcclock = peer;
260 pp->io.datalen = 0;
261 pp->io.fd = -1;
266 peer->precision = PRECISION;
267 pp->clockdesc = DESCRIPTION;
268 memcpy(&pp->refid, REFID, 4);
269 peer->sstclktype = CTL_SST_TS_TELEPHONE;
270 up->bufptr = up->buf;
282 * acts_shutdown - shut down the clock
290 struct actsunit *up;
296 pp = peer->procptr;
297 up = pp->unitptr;
299 free(up);
304 * acts_receive - receive data from the serial interface
311 struct actsunit *up;
314 char tbuf[sizeof(up->buf)];
321 * interface kicks up; so, we have to reassemble messages from
323 * the message and at the '*' and '#' on-time characters.
325 peer = rbufp->recv_peer;
326 pp = peer->procptr;
327 up = pp->unitptr;
328 octets = sizeof(up->buf) - (up->bufptr - up->buf);
329 refclock_gtraw(rbufp, tbuf, octets, &pp->lastrec);
332 if (up->bufptr == up->buf) {
333 up->tstamp = pp->lastrec;
336 *up->bufptr = '\0';
337 up->bufptr = up->buf;
338 acts_message(peer, up->buf);
341 *up->bufptr++ = *tptr;
343 up->tstamp = pp->lastrec;
352 * acts_message - process message
360 struct actsunit *up;
371 pp = peer->procptr;
372 up = pp->unitptr;
379 switch (up->state) {
401 up->retry, sys_phone[up->retry]);
402 if (ioctl(pp->io.fd, TIOCMBIS, &dtr) < 0)
404 refclock_write(peer, sys_phone[up->retry],
405 strlen(sys_phone[up->retry]),
408 up->retry++;
409 up->state = S_CONNECT;
410 up->timer = ANSWER;
424 up->state = S_MSG;
425 up->timer = TIMECODE;
436 if (up->msgcnt < MAXCODE)
452 * acts_timeout - called on timeout
460 struct actsunit *up;
470 pp = peer->procptr;
471 up = pp->unitptr;
479 if (-1 != pp->io.fd)
487 if (pp->sloppyclockflag & CLK_FLAG2) {
489 up->unit);
507 up->unit);
508 fd = refclock_open(&peer->srcadr, device, SPEED232, LDISC_ACTS |
514 pp->io.fd = fd;
515 if (!io_addclock(&pp->io)) {
518 pp->io.fd = -1;
521 up->msgcnt = 0;
522 up->bufptr = up->buf;
528 if (sys_phone[up->retry] == NULL) {
530 up->state = S_MSG;
531 up->timer = TIMECODE;
536 * Initialize the modem. This works with Hayes-
544 up->state = S_SETUP;
545 up->timer = SETUP;
568 if (up->msgcnt == 0) {
571 pp->lastref = pp->lastrec;
572 record_clock_stats(&peer->srcadr, pp->a_lastcode);
582 * acts_close - close and prepare for next call.
593 struct actsunit *up;
598 pp = peer->procptr;
599 up = pp->unitptr;
600 if (pp->io.fd != -1) {
603 if (ioctl(pp->io.fd, TIOCMBIC, &dtr) < 0)
605 io_closeclock(&pp->io);
606 pp->io.fd = -1;
608 if (pp->sloppyclockflag & CLK_FLAG2) {
610 LOCKFILE, up->unit);
613 if (up->msgcnt == 0 && up->retry > 0) {
614 if (sys_phone[up->retry] != NULL) {
615 up->state = S_IDLE;
616 up->timer = REDIAL;
620 up->state = S_IDLE;
621 up->timer = 0;
626 * acts_poll - called by the transmit routine
634 struct actsunit *up;
642 pp = peer->procptr;
643 up = pp->unitptr;
644 switch (peer->ttl) {
671 pp->polls++;
672 if (S_IDLE == up->state) {
673 up->retry = 0;
680 * acts_timer - called at one-second intervals
688 struct actsunit *up;
697 pp = peer->procptr;
698 up = pp->unitptr;
699 if (up->timer == 0) {
700 if (pp->sloppyclockflag & CLK_FLAG1) {
701 pp->sloppyclockflag &= ~CLK_FLAG1;
705 up->timer--;
706 if (up->timer == 0)
707 acts_timeout(peer, up->state);
712 * acts_timecode - identify the service and parse the timecode message
720 struct actsunit *up;
731 char flag; /* ACTS on-time character (* or #) */
747 pp = peer->procptr;
748 up = pp->unitptr;
749 pp->nsec = 0;
753 * For USNO format on-time character '*', which is on a line by
757 if (*str == '*' && up->msgcnt > 0)
763 * ACTS format A: "jjjjj yy-mm-dd hh:mm:ss ds l uuu aaaaa
768 "%5ld %2d-%2d-%2d %2d:%2d:%2d %2d %1d %3lf %5lf %9s %c",
769 &mjd, &pp->year, &month, &day, &pp->hour,
770 &pp->minute, &pp->second, &dst, &leap, &dut1,
775 pp->day = ymd2yd(pp->year, month, day);
776 pp->leap = LEAP_NOWARNING;
778 pp->leap = LEAP_ADDSECOND;
780 pp->leap = LEAP_DELSECOND;
781 memcpy(&pp->refid, REFACTS, 4);
782 up->msgcnt++;
783 if (flag != '#' && up->msgcnt < 10)
793 &mjd, &pp->day, &pp->hour, &pp->minute,
794 &pp->second, utc) != 6) {
800 * Wait for the on-time character, which follows in a
804 pp->leap = LEAP_NOWARNING;
805 memcpy(&pp->refid, REFUSNO, 4);
806 up->msgcnt++;
810 * PTB/NPL format: "yyyy-mm-dd hh:mm:ss MEZ"
814 "%*4d-%*2d-%*2d %*2d:%*2d:%2d %*5c%*12c%4d%2d%2d%2d%2d%5ld%2lf%c%2d%3lf%*15c%c",
815 &pp->second, &pp->year, &month, &day, &pp->hour,
816 &pp->minute, &mjd, &dut1, &leapdir, &leapmonth,
821 pp->leap = LEAP_NOWARNING;
824 pp->leap = LEAP_ADDSECOND;
825 else if (leapdir == '-')
826 pp->leap = LEAP_DELSECOND;
828 pp->day = ymd2yd(pp->year, month, day);
829 memcpy(&pp->refid, REFPTB, 4);
830 up->msgcnt++;
839 &synchar, &pp->day, &pp->hour, &pp->minute,
840 &pp->second, &dstchar, &tz) != 7) {
844 pp->leap = LEAP_NOWARNING;
846 pp->leap = LEAP_NOTINSYNC;
847 memcpy(&pp->refid, REFWWVB, 4);
848 up->msgcnt++;
856 &synchar, &qualchar, &pp->year, &pp->day,
857 &pp->hour, &pp->minute, &pp->second, &pp->nsec,
862 pp->nsec *= 1000000;
863 pp->leap = LEAP_NOWARNING;
865 pp->leap = LEAP_NOTINSYNC;
867 pp->leap = LEAP_ADDSECOND;
868 memcpy(&pp->refid, REFWWVB, 4);
869 up->msgcnt++;
886 peer->refid = pp->refid;
887 pp->lastrec = up->tstamp;
888 if (up->msgcnt == 0)
891 strlcpy(pp->a_lastcode, str, sizeof(pp->a_lastcode));
892 pp->lencode = strlen(pp->a_lastcode);
897 pp->lastref = pp->lastrec;