Lines Matching +full:write +full:- +full:1 +full:- +full:bps
2 * refclock_pst - clock driver for PSTI/Traconex WWV/WWVH receivers
25 * The DIPswitches should be set for 9600 bps line speed, 24-hour day-
26 * of-year format and UTC time zone. Automatic correction for DST should
41 * on-time = first <cr>
43 * a = AM/PM indicator (' ' for 24-hour mode)
46 * s = daylight-saving indicator (' ' for 24-hour mode)
76 #define PRECISION (-10) /* precision assumed (about 1 ms) */
80 #define PST_PHI (10e-6) /* max clock oscillator offset */
114 * pst_start - open the devices and initialize data for processing
131 fd = refclock_open(&peer->srcadr, device, SPEED232, LDISC_CLK); in pst_start()
139 pp = peer->procptr; in pst_start()
140 pp->io.clock_recv = pst_receive; in pst_start()
141 pp->io.srcclock = peer; in pst_start()
142 pp->io.datalen = 0; in pst_start()
143 pp->io.fd = fd; in pst_start()
144 if (!io_addclock(&pp->io)) { in pst_start()
146 pp->io.fd = -1; in pst_start()
150 pp->unitptr = up; in pst_start()
155 peer->precision = PRECISION; in pst_start()
156 pp->clockdesc = DESCRIPTION; in pst_start()
157 memcpy((char *)&pp->refid, WWVREFID, 4); in pst_start()
158 return (1); in pst_start()
163 * pst_shutdown - shut down the clock
174 pp = peer->procptr; in pst_shutdown()
175 up = pp->unitptr; in pst_shutdown()
176 if (-1 != pp->io.fd) in pst_shutdown()
177 io_closeclock(&pp->io); in pst_shutdown()
184 * pst_receive - receive data from the serial interface
204 peer = rbufp->recv_peer; in pst_receive()
205 pp = peer->procptr; in pst_receive()
206 up = pp->unitptr; in pst_receive()
207 up->lastptr += refclock_gtlin(rbufp, up->lastptr, pp->a_lastcode in pst_receive()
208 + BMAX - 2 - up->lastptr, &trtmp); in pst_receive()
209 *up->lastptr++ = ' '; in pst_receive()
210 *up->lastptr = '\0'; in pst_receive()
216 if (up->tcswitch == 0) in pst_receive()
217 pp->lastrec = trtmp; in pst_receive()
218 up->tcswitch++; in pst_receive()
219 pp->lencode = up->lastptr - pp->a_lastcode; in pst_receive()
220 if (up->tcswitch < 3) in pst_receive()
228 if (pp->lencode < LENPST) { in pst_receive()
237 if (sscanf(pp->a_lastcode, in pst_receive()
239 &mchar, &pp->hour, &pp->minute, &pp->second, &pp->nsec, in pst_receive()
240 &daychar, junque, &pp->day, info, <emp) != 10) { in pst_receive()
244 pp->nsec *= 1000000; in pst_receive()
254 pp->leap = LEAP_NOTINSYNC; in pst_receive()
256 memcpy((char *)&pp->refid, WWVHREFID, 4); in pst_receive()
258 memcpy((char *)&pp->refid, WWVREFID, 4); in pst_receive()
259 if (peer->stratum <= 1) in pst_receive()
260 peer->refid = pp->refid; in pst_receive()
262 pp->lastref = pp->lastrec; in pst_receive()
263 pp->disp = PST_PHI * ltemp * 60; in pst_receive()
271 else if (peer->disp > MAXDISTANCE) in pst_receive()
277 * pst_poll - called by the transmit procedure
296 pp = peer->procptr; in pst_poll()
297 up = pp->unitptr; in pst_poll()
298 up->tcswitch = 0; in pst_poll()
299 up->lastptr = pp->a_lastcode; in pst_poll()
300 if (write(pp->io.fd, "QTQDQMT", 6) != 6) in pst_poll()
302 if (pp->coderecv == pp->codeproc) { in pst_poll()
307 record_clock_stats(&peer->srcadr, pp->a_lastcode); in pst_poll()
310 printf("pst: timecode %d %s\n", pp->lencode, in pst_poll()
311 pp->a_lastcode); in pst_poll()
313 pp->polls++; in pst_poll()