Received: from louie.udel.edu by huey.udel.edu id aa02110; 24 Feb 94 18:54 EST Received: from faui45.informatik.uni-erlangen.de by louie.udel.edu id aa13897; 24 Feb 94 18:53 EST Received: from faui43.informatik.uni-erlangen.de by uni-erlangen.de with SMTP; id AA27796 (5.65c-6/7.3v-FAU); Fri, 25 Feb 1994 00:53:32 +0100 Received: from faui45x.informatik.uni-erlangen.de by immd4.informatik.uni-erlangen.de with SMTP; id AA16114 (5.65c-6/7.3m-FAU); Fri, 25 Feb 1994 00:53:31 +0100 From: Frank Kardel Message-Id: <199402242353.AA16114@faui43.informatik.uni-erlangen.de> Subject: patches (parse pps/pll control) To: mills@udel.edu Date: Fri, 25 Feb 94 0:52:59 MET X-Mailer: ELM [version 2.3 PL11] Hi, here are some patches. pps pll control is nor supported by parse. pps output variable are readable via mode 6 messages. diff -c v3/parse/parsestreams.c:1.1.1.10 v3/parse/parsestreams.c:3.19 *** v3/parse/parsestreams.c:1.1.1.10 Fri Feb 25 00:44:41 1994 --- v3/parse/parsestreams.c Fri Feb 25 00:44:41 1994 *************** *** 1,7 **** /* ! * /src/NTP/REPOSITORY/v3/parse/parsestreams.c,v 3.17 1994/02/20 15:18:02 kardel Exp * ! * parsestreams.c,v 3.17 1994/02/20 15:18:02 kardel Exp * * STREAMS module for reference clocks * (SunOS4.x) --- 1,7 ---- /* ! * /src/NTP/REPOSITORY/v3/parse/parsestreams.c,v 3.19 1994/02/24 16:33:54 kardel Exp * ! * parsestreams.c,v 3.19 1994/02/24 16:33:54 kardel Exp * * STREAMS module for reference clocks * (SunOS4.x) *************** *** 16,22 **** */ #ifndef lint ! static char rcsid[] = "parsestreams.c,v 3.17 1994/02/20 15:18:02 kardel Exp"; #endif #include "sys/types.h" --- 16,22 ---- */ #ifndef lint ! static char rcsid[] = "parsestreams.c,v 3.19 1994/02/24 16:33:54 kardel Exp"; #endif #include "sys/types.h" *************** *** 195,201 **** } else { ! static char revision[] = "3.17"; char *s, *S, *t; strncpy(ifm->f_name, mname, FMNAMESZ); --- 195,201 ---- } else { ! static char revision[] = "3.19"; char *s, *S, *t; strncpy(ifm->f_name, mname, FMNAMESZ); *************** *** 1076,1081 **** --- 1076,1086 ---- #define MAXDEPTH 50 /* maximum allowed stream crawl */ + #ifdef PPS_SYNC + extern hardpps(); + extern struct timeval time; + #endif + /* * take external status interrupt (only CD interests us) */ *************** *** 1087,1101 **** register queue_t *q; register unsigned char zsstatus; register int loopcheck; - register unsigned char cdstate; register char *dname; /* * pick up current state */ zsstatus = zsaddr->zscc_control; ! if (za->za_rr0 ^ (cdstate = zsstatus & ZSRR0_CD)) { timestamp_t cdevent; register int status; --- 1092,1109 ---- register queue_t *q; register unsigned char zsstatus; register int loopcheck; register char *dname; + #ifdef PPS_SYNC + register int s; + register long usec; + #endif /* * pick up current state */ zsstatus = zsaddr->zscc_control; ! if ((za->za_rr0 ^ zsstatus) & (ZSRR0_CD|ZSRR0_SYNC)) { timestamp_t cdevent; register int status; *************** *** 1103,1129 **** /* * CONDITIONAL external measurement support */ ! SET_LED(cdstate); /* * inconsistent with upper SET_LED, but this * is for oscilloscope business anyway and we * are just interested in edge delays in the * lower us range */ ! /* * time stamp */ uniqtime(&cdevent.tv); ! ! TIMEVAL_USADD(&cdevent.tv, xsdelay); ! ! q = za->za_ttycommon.t_readq; /* * logical state */ ! status = cd_invert ? cdstate == 0 : cdstate != 0; /* * ok - now the hard part - find ourself */ --- 1111,1155 ---- /* * CONDITIONAL external measurement support */ ! SET_LED(zsstatus & (ZSRR0_CD|ZSRR0_SYNC)); /* * inconsistent with upper SET_LED, but this * is for oscilloscope business anyway and we * are just interested in edge delays in the * lower us range */ ! #ifdef PPS_SYNC ! s = splclock(); ! usec = time.tv_usec; ! #endif /* * time stamp */ uniqtime(&cdevent.tv); ! ! #ifdef PPS_SYNC ! splx(s); ! #endif /* * logical state */ ! status = cd_invert ? (zsstatus & (ZSRR0_CD|ZSRR0_SYNC)) == 0 : (zsstatus & (ZSRR0_CD|ZSRR0_SYNC)) != 0; + #ifdef PPS_SYNC + if (status) + { + usec = cdevent.tv.tv_usec - usec; + if (usec < 0) + usec += 1000000; + + hardpps(&cdevent.tv, usec); + } + #endif + + TIMEVAL_USADD(&cdevent.tv, xsdelay); + + q = za->za_ttycommon.t_readq; + /* * ok - now the hard part - find ourself */ *************** *** 1179,1188 **** /* * only pretend that CD has been handled */ ! za->za_rr0 = za->za_rr0 & ~ZSRR0_CD | zsstatus & ZSRR0_CD; ZSDELAY(2); ! if (!((za->za_rr0 ^ zsstatus) & ~ZSRR0_CD)) { /* * all done - kill status indication and return --- 1205,1214 ---- /* * only pretend that CD has been handled */ ! za->za_rr0 = za->za_rr0 & ~(ZSRR0_CD|ZSRR0_SYNC) | zsstatus & (ZSRR0_CD|ZSRR0_SYNC); ZSDELAY(2); ! if (!((za->za_rr0 ^ zsstatus) & ~(ZSRR0_CD|ZSRR0_SYNC))) { /* * all done - kill status indication and return *************** *** 1260,1265 **** --- 1286,1297 ---- * History: * * parsestreams.c,v + * Revision 3.19 1994/02/24 16:33:54 kardel + * CD events can also be posted on sync flag + * + * Revision 3.18 1994/02/24 14:12:58 kardel + * initial PPS_SYNC support version + * * Revision 3.17 1994/02/20 15:18:02 kardel * rcs id cleanup * diff -c v3/xntpd/ntp_loopfilter.c:1.1.1.33 v3/xntpd/ntp_loopfilter.c:3.40 *** v3/xntpd/ntp_loopfilter.c:1.1.1.33 Fri Feb 25 00:46:20 1994 --- v3/xntpd/ntp_loopfilter.c Fri Feb 25 00:46:21 1994 *************** *** 522,529 **** --- 522,545 ---- ntv.maxerror = sys_rootdispersion + sys_rootdelay / 2; ntv.esterror = sys_rootdispersion; ntv.time_constant = time_constant; + ntv.shift = 0; (void)ntp_adjtime(&ntv); drift_comp = ntv.frequency; + if (ntv.shift != 0) { + char buf[128]; + (void) sprintf(buf, "pps_freq=%s", fptoa(ntv.ybar, 3)); + set_sys_var(buf, strlen(buf)+1, RO|DEF); + (void) sprintf(buf, "pps_disp=%s", fptoa(ntv.disp, 3)); + set_sys_var(buf, strlen(buf)+1, RO|DEF); + (void) sprintf(buf, "pps_interval=%ld",1 << ntv.shift); + set_sys_var(buf, strlen(buf)+1, RO); + (void) sprintf(buf, "pps_intervals=%ld", ntv.calcnt); + set_sys_var(buf, strlen(buf)+1, RO); + (void) sprintf(buf, "pps_jitterexceeded=%ld", ntv.jitcnt); + set_sys_var(buf, strlen(buf)+1, RO); + (void) sprintf(buf, "pps_dispersionexceeded=%ld", ntv.discnt); + set_sys_var(buf, strlen(buf)+1, RO); + } #endif /* KERNEL_PLL */ } else { if (offset < 0) { *************** *** 725,730 **** --- 741,748 ---- "loop_config: skew compensation %s too large", fptoa(tmp, 5)); } else { + char var[40]; + drift_comp = tmp; #if defined(KERNEL_PLL) *************** *** 751,756 **** --- 769,778 ---- syslog(LOG_NOTICE, "%susing kernel phase-lock loop", (pll_control) ? "" : "Not "); + (void)sprintf(var, "kernel_pll=%s", pll_control ? "true" : "false"); + + set_sys_var(var, strlen(var)+1, RO); + #if DEBUG if (debug) printf("pll_control %d\n", pll_control); -- Frank Kardel (kardel@informatik.uni-erlangen.de) All SCSI disks will from now on be required to send an email notice 24 hours prior to complete hardware failure!