Lines Matching +full:up +full:-

2  * refclock_as2201 - clock driver for the Austron 2201A GPS
22 * Buffered RS-232-C Interface Module. Note that the original 2200/2201
30 * a multi-line reply showing the corresponding statistics or other
37 * In order for this code to work, the radio must be placed in non-
44 * default configuration is used with stock kernels and serial-line
55 * available using a gadget box and 1-pps signal from the receiver. This
57 * addition, the serial output and 1-pps signal can be bussed to more
68 #define PRECISION (-20) /* precision assumed (about 1 us) */
96 * specified as the first line of output as an ASCII-encode number. Note
141 as2201_start, /* start up driver */
152 * as2201_start - open the devices and initialize data for processing
160 register struct as2201unit *up;
169 fd = refclock_open(&peer->srcadr, gpsdev, SPEED232, LDISC_CLK);
176 up = emalloc_zero(sizeof(*up));
177 pp = peer->procptr;
178 pp->io.clock_recv = as2201_receive;
179 pp->io.srcclock = peer;
180 pp->io.datalen = 0;
181 pp->io.fd = fd;
182 if (!io_addclock(&pp->io)) {
184 pp->io.fd = -1;
185 free(up);
188 pp->unitptr = up;
193 peer->precision = PRECISION;
194 pp->clockdesc = DESCRIPTION;
195 memcpy((char *)&pp->refid, REFID, 4);
196 up->lastptr = up->stats;
197 up->index = 0;
203 * as2201_shutdown - shut down the clock
211 register struct as2201unit *up;
214 pp = peer->procptr;
215 up = pp->unitptr;
216 if (-1 != pp->io.fd)
217 io_closeclock(&pp->io);
218 if (NULL != up)
219 free(up);
224 * as2201__receive - receive data from the serial interface
231 register struct as2201unit *up;
240 peer = rbufp->recv_peer;
241 pp = peer->procptr;
242 up = pp->unitptr;
243 pp->lencode = refclock_gtlin(rbufp, pp->a_lastcode, BMAX, &trtmp);
247 up->linect, pp->lencode, pp->a_lastcode);
249 if (pp->lencode == 0)
263 if (pp->sloppyclockflag & CLK_FLAG2)
264 pp->lastrec = trtmp;
265 if (up->linect > 0) {
266 up->linect--;
267 if ((int)(up->lastptr - up->stats + pp->lencode) > SMAX - 2)
269 *up->lastptr++ = ' ';
270 memcpy(up->lastptr, pp->a_lastcode, 1 + pp->lencode);
271 up->lastptr += pp->lencode;
274 if (pp->lencode == 1) {
275 up->linect = atoi(pp->a_lastcode);
278 record_clock_stats(&peer->srcadr, up->stats);
281 printf("gps: stat %s\n", up->stats);
285 up->lastptr = up->stats;
286 *up->lastptr = '\0';
293 if (pp->lencode < LENTOC) {
301 if (sscanf(pp->a_lastcode, "%2d:%3d:%2d:%2d:%2d.%3ld", &pp->year,
302 &pp->day, &pp->hour, &pp->minute, &pp->second, &pp->nsec)
307 pp->nsec *= 1000000;
312 if (pp->a_lastcode[2] != ':')
313 pp->leap = LEAP_NOTINSYNC;
315 pp->leap = LEAP_NOWARNING;
331 if ((int)(up->lastptr - up->stats + pp->lencode) > SMAX - 2)
333 memcpy(up->lastptr, pp->a_lastcode, pp->lencode);
334 up->lastptr += pp->lencode;
335 if (pp->sloppyclockflag & CLK_FLAG4) {
336 octets = strlen(stat_command[up->index]);
337 if ((int)(up->lastptr - up->stats + 1 + octets) > SMAX - 2)
339 *up->lastptr++ = ' ';
340 memcpy(up->lastptr, stat_command[up->index], octets);
341 up->lastptr += octets - 1;
342 *up->lastptr = '\0';
343 refclock_write(peer, stat_command[up->index],
344 strlen(stat_command[up->index]),
346 up->index++;
347 if (*stat_command[up->index] == '\0')
348 up->index = 0;
354 * as2201_poll - called by the transmit procedure
372 pp = peer->procptr;
373 if (write(pp->io.fd, "\r*toc\r", 6) != 6) {
376 pp->polls++;
377 if (!(pp->sloppyclockflag & CLK_FLAG2))
378 get_systime(&pp->lastrec);
380 if (pp->coderecv == pp->codeproc) {