refclock_palisade.c (ntp-4.2.8p14) | : | refclock_palisade.c (ntp-4.2.8p15) | ||
---|---|---|---|---|
skipping to change at line 307 | skipping to change at line 307 | |||
palisade_start ( | palisade_start ( | |||
int unit, | int unit, | |||
struct peer *peer | struct peer *peer | |||
) | ) | |||
{ | { | |||
struct palisade_unit *up; | struct palisade_unit *up; | |||
struct refclockproc *pp; | struct refclockproc *pp; | |||
int fd; | int fd; | |||
char gpsdev[20]; | char gpsdev[20]; | |||
struct termios tio; | struct termios tio; | |||
u_int speed; | ||||
snprintf(gpsdev, sizeof(gpsdev), DEVICE, unit); | snprintf(gpsdev, sizeof(gpsdev), DEVICE, unit); | |||
/* | /* | |||
* Open serial port. | * Open serial port. | |||
*/ | */ | |||
u_int speed; | ||||
speed = (CLK_TYPE(peer) == CLK_COPERNICUS) ? SPEED232COP : SPEED232; | speed = (CLK_TYPE(peer) == CLK_COPERNICUS) ? SPEED232COP : SPEED232; | |||
fd = refclock_open(gpsdev, speed, LDISC_RAW); | fd = refclock_open(gpsdev, speed, LDISC_RAW); | |||
if (fd <= 0) { | if (fd <= 0) { | |||
#ifdef DEBUG | #ifdef DEBUG | |||
printf("Palisade(%d) start: open %s failed\n", unit, gpsdev); | printf("Palisade(%d) start: open %s failed\n", unit, gpsdev); | |||
#endif | #endif | |||
return 0; | return 0; | |||
} | } | |||
msyslog(LOG_NOTICE, "Palisade(%d) fd: %d dev: %s", unit, fd, | msyslog(LOG_NOTICE, "Palisade(%d) fd: %d dev: %s", unit, fd, | |||
skipping to change at line 939 | skipping to change at line 939 | |||
GPS_UTC_Offset = (int)getsingle((u_char *) &mb(6)); | GPS_UTC_Offset = (int)getsingle((u_char *) &mb(6)); | |||
if (GPS_UTC_Offset == 0){ /* Check UTC Offset */ | if (GPS_UTC_Offset == 0){ /* Check UTC Offset */ | |||
#ifdef DEBUG | #ifdef DEBUG | |||
printf("TSIP_decode: UTC Offset Unknown\n"); | printf("TSIP_decode: UTC Offset Unknown\n"); | |||
#endif | #endif | |||
refclock_report(peer, CEVNT_BADREPLY); | refclock_report(peer, CEVNT_BADREPLY); | |||
up->polled = -1; | up->polled = -1; | |||
return 0; | return 0; | |||
} | } | |||
/* Get date & time from WN & ToW minus offset */ | /* Get date & time from WN & ToW minus offset */ | |||
TCivilDate cd; | { | |||
TGpsDatum wd; | TCivilDate cd; | |||
l_fp ugo; /* UTC-GPS offset, negative number */ | TGpsDatum wd; | |||
ugo.Ul_i.Xl_i = (int32_t)-GPS_UTC_Offset; | l_fp ugo; /* UTC-GPS offset, negative number */ | |||
ugo.l_uf = 0; | ugo.Ul_i.Xl_i = (int32_t)-GPS_UTC_Offset; | |||
wd = gpscal_from_gpsweek((wn % 1024), (int32_t)tow, ugo); | ugo.l_uf = 0; | |||
gpscal_to_calendar(&cd, &wd); | wd = gpscal_from_gpsweek((wn % 1024), (int32_t)tow, ugo); | |||
pp->year = cd.year; | gpscal_to_calendar(&cd, &wd); | |||
pp->day = cd.yearday; | pp->year = cd.year; | |||
pp->hour = cd.hour; | pp->day = cd.yearday; | |||
pp->minute = cd.minute; | pp->hour = cd.hour; | |||
pp->second = cd.second; | pp->minute = cd.minute; | |||
pp->nsec = 0; | pp->second = cd.second; | |||
pp->leap = LEAP_NOWARNING; | pp->nsec = 0; | |||
#ifdef DEBUG | pp->leap = LEAP_NOWARNING; | |||
if (debug > 1) { | #ifdef DEBUG | |||
printf("GPS TOW: %ld\n", tow); | if (debug > 1) { | |||
printf("GPS WN: %d\n", wn); | printf("GPS TOW: %ld\n", tow); | |||
printf("GPS UTC-GPS Offset: %d\n", GPS_UTC_Offset); | printf("GPS WN: %d\n", wn); | |||
printf("TSIP_decode: unit %d: %02X #%d %02d:%02d:%02d.%09 | printf("GPS UTC-GPS Offset: %d\n", GPS_UTC_Offset | |||
ld %02d/%02d/%04d ", | ); | |||
up->unit, mb(0) & 0xff, event, pp->hour, pp->minut | printf("TSIP_decode: unit %d: %02X #%d %02d:%02d: | |||
e, pp->second, | %02d.%09ld %02d/%02d/%04d ", | |||
pp->nsec, cd.month, cd.monthday, pp->year); | up->unit, mb(0) & 0xff, event, pp->hour, p | |||
} | p->minute, pp->second, | |||
pp->nsec, cd.month, cd.monthday, pp->year) | ||||
; | ||||
} | ||||
#endif | #endif | |||
} | ||||
return 1; | return 1; | |||
} | } | |||
/* Health Status for Acutime Receiver */ | /* Health Status for Acutime Receiver */ | |||
else if ((up->rpt_buf[0] == PACKET_46) & (up->type == CLK_ACUTIME)) { | else if ((up->rpt_buf[0] == PACKET_46) & (up->type == CLK_ACUTIME)) { | |||
#ifdef DEBUG | #ifdef DEBUG | |||
if (debug > 1) | if (debug > 1) | |||
/* Status Codes */ | /* Status Codes */ | |||
switch (mb(0)) { | switch (mb(0)) { | |||
case 0x00: | case 0x00: | |||
End of changes. 4 change blocks. | ||||
26 lines changed or deleted | 30 lines changed or added |