Lines Matching +full:no +full:- +full:dump +full:- +full:oops
6 * broadcast timecode. Alternatively, it can generate the IRIG-B
24 * over the range 0-255. The signal generator by default uses WWV
26 * switches to IRIG-B format.
42 * the transmissionorder is low-order first as the frame is processed
44 * For IRIG the on-time marker M preceeds the first (units) bit, so its
49 * 10, but not yet with other machines. It uses no special features and
54 * v0.23 2007-02-12 dmw:
55 * - Changed statistics to include calculated error
60 * v0.22 2007-02-08 dmw:
61 * - Changed default for rate correction to "enabled", "-j" switch now disables.
62 * - Adjusted help message accordingly.
63 * - Added "2007" to modifications note at end of help message.
66 * v0.21 2007-02-07 dmw:
67 * - adjusted strings for shorten and lengthen to make
71 * v0.20 2007-02-01 dmw:
72 * - Added periodic display of running time along with legend on IRIG-B, allows tracking how
76 * v0.19 2007-01-31 dmw:
77 * - Added tracking of how many seconds have been adjusted,
81 * - Corrected lack of lengthen or shorten of minute & hour
85 * v0.18 2007-01-13 dmw:
86 * - added -k option, which allows force of long or short
87 * cycles, to test against IRIG-B decoder.
90 * v0.17 2007-01-08 dmw:
91 * - Changed -j option to **enable** rate correction, not disable.
94 * v0.17 2007-01-08 dmw:
95 * - Run stability check versus ongoing system clock (assume NTP correction)
97 * Disable this algorithm with -j option.
100 * v0.16 2006-12-18 dmw
101 * - Corrected print of setting of output frequency, always
103 * - Modified to reflect new employer Norscan.
106 * v0.15 2006-12-18 dmw:
107 * - Added count of number of seconds to output then exit,
111 * v0.14 2006-12-17 dmw:
112 * - Corrected WWV(H) signal to leave "tick" sound off of 29th and 59th second of minute.
113 * - Adjusted verbose output format for WWV(H).
116 * v0.13 2006-12-17 dmw:
117 * - Put SPARC code back in, hopefully will work, but I don't have
119 * - Reworked Verbose mode, different flag to initiate (x not v)
121 * - Re-claimed v flag for output level.
122 * - Note that you must define OSS_MODS to get OSS to compile,
127 * v0.12 2006-10-26 dmw:
128 * - Reversed output binary dump for IRIG, makes it easier to read the numbers.
131 * v0.11 2006-10-24 dmw:
132 * - another tweak.
135 * v0.11 2006-10-24 dmw:
136 * - Curses a fix to the fix to the fix of the usaeg.
139 * v0.11 (still) 2006-10-24 dmw:
140 * - Messed with usage message that's all.
143 * v0.11 2006-10-24 dmw:
144 * - oops, needed to note "hours" in usage of that offset.
147 * v0.11 2006-10-24 dmw:
148 * - Added ability to offset actual time sent, from the UTC time
152 * v0.10 2006-10-23 dmw:
153 * - Corrected polarity of correction of offset when going into or out of DST.
154 * - Ensure that zero offset is always positive (pet peeve).
157 * v0.9 2006-10-23 dmw:
158 * - Shift time offset when DST in or out.
161 * v0.8 2006-10-23 dmw:
162 * - made offset of zero default positive.
165 * v0.7 2006-10-23 dmw:
166 * - Added unmodulated and inverted unmodulated output.
169 * v0.6 2006-10-23 dmw:
170 * - Cleaned up usage message.
171 * - Require at least one option, or prints usage message and exits.
174 * v0.5 2006-10-23 dmw:
175 * - Finally added a usage message.
176 * - Added leap second pending and DST change pending into IEEE 1344.
177 * - Default code type is now IRIG-B with IEEE 1344.
180 * v0.4 2006-10-22 dmw:
181 * - Added leap second addition and deletion.
182 * - Added DST changing forward and backward.
183 * - Changed date specification to more conventional year, month, and day of month
187 * v0.2 2006-10-22 dmw:
188 * - Corrected format of legend line.
191 * v0.1 2006-10-22 dmw:
192 * - Added some more verbose output (as is my style)
193 * - Corrected frame format - there were markers in the
195 * - Added header line to show fields of output.
196 * - Added straight binary seconds, were not implemented
198 * - Added IEEE 1344 with parity.
236 #define ISSUE_DATE "2007-02-12"
238 #define SECOND (8000) /* one second of 125-us samples */
242 #define IRIG (1) /* IRIG-B encoder */
260 /* Attempt at unmodulated - "high" */
262 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, /* 0- 9 */
263 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, /* 10-19 */
264 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, /* 20-29 */
265 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, /* 30-39 */
266 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, /* 40-49 */
267 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, /* 50-59 */
268 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, /* 60-69 */
269 247, 247, 247, 247, 247, 247, 247, 247, 247, 247}; /* 70-79 */
271 /* Attempt at unmodulated - "low" */
273 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, /* 0- 9 */
274 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, /* 10-19 */
275 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, /* 20-29 */
276 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, /* 30-39 */
277 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, /* 40-49 */
278 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, /* 50-59 */
279 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, /* 60-69 */
280 119, 119, 119, 119, 119, 119, 119, 119, 119, 119}; /* 70-79 */
285 int c3000[] = {1, 48, 63, 70, 78, 82, 85, 89, 92, 94, /* 0-9 */
286 96, 98, 99, 100, 101, 101, 102, 103, 103, 103, /* 10-19 */
287 103, 103, 103, 103, 102, 101, 101, 100, 99, 98, /* 20-29 */
288 96, 94, 92, 89, 85, 82, 78, 70, 63, 48, /* 30-39 */
289 129, 176, 191, 198, 206, 210, 213, 217, 220, 222, /* 40-49 */
290 224, 226, 227, 228, 229, 229, 230, 231, 231, 231, /* 50-59 */
291 231, 231, 231, 231, 230, 229, 229, 228, 227, 226, /* 60-69 */
292 224, 222, 220, 217, 213, 210, 206, 198, 191, 176}; /* 70-79 */
296 int c6000[] = {1, 63, 78, 86, 93, 98, 101, 104, 107, 110, /* 0-9 */
297 112, 113, 115, 116, 117, 117, 118, 118, 119, 119, /* 10-19 */
298 119, 119, 119, 118, 118, 117, 117, 116, 115, 113, /* 20-29 */
299 112, 110, 107, 104, 101, 98, 93, 86, 78, 63, /* 30-39 */
300 129, 191, 206, 214, 221, 226, 229, 232, 235, 238, /* 40-49 */
301 240, 241, 243, 244, 245, 245, 246, 246, 247, 247, /* 50-59 */
302 247, 247, 247, 246, 246, 245, 245, 244, 243, 241, /* 60-69 */
303 240, 238, 235, 232, 229, 226, 221, 214, 206, 191}; /* 70-79 */
329 #define NODEC (10) /* no decerement to next digit, send PI */
330 #define DECX (11) /* decrement to next digit, send PI, but no tick */
331 #define DATAX (12) /* send data (0, 1, PI), but no tick */
334 * WWV/H format (100-Hz, 9 digits, 1 m frame)
405 * IRIG format frame 10 - MS straight binary seconds
416 {COEF, 2}, /* 9 0x2 0000 - but only 86,401 / 0x1 5181 seconds in a day, so always zero */
421 * IRIG format frame 8 - MS control functions
437 * IRIG format frames 7 & 9 - LS control functions & LS straight binary seconds
453 …* IRIG format frames 2 to 6 - minutes, hours, days, hundreds days, 2 digit years (also called cont…
469 * IRIG format first frame, frame 1 - seconds
472 {MIN, M8}, /* 0 PI (on-time marker for the second at zero cross of 1st cycle) */
495 void WWV_SecondNoTick(int, int); /* send second with no tick */
516 int HourTone = 1500; /* WWV hour on-time frequency */
561 /* and what simulator says we have been running - will slowly */
563 …pectedRunningDifference = 0; /* Stable value that we've obtained from check at initial start-up. */
567 …LITY_BAND ( 2) // Determining initial stability for consecutive differences within +/- this value.
568 #define RUNNING_STABILITY_BAND ( 5) // When running, stability is defined as difference within +/-…
596 char FormatCharacter = '3'; /* Default is IRIG-B with IEEE 1344 extensions */
615 …/* Should be mutually exclusive - generally ensured by code which interprets command line option. …
664 /* String to allow us to put out reversed data - so can read the binary numbers. */
685 exit (-1);
696 while ((temp = getopt(argc, argv, "a:b:c:df:g:hHi:jk:l:o:q:r:stu:xy:z?")) != -1) {
698 while ((temp = getopt(argc, argv, "a:b:c:df:g:hHi:jk:l:o:q:r:stu:v:xy:z?")) != -1) {
721 case 'f': /* select format: i=IRIG-98 (default) 2=IRIG-2004 3-IRIG+IEEE-1344 w=WWV(H) */
735 exit(-1);
779 case 'o': /* Set IEEE 1344 time offset in hours - positive or negative, to the half hour */
781 if (TimeOffset >= -0.2)
789 if ( (TimeOffset - floor(TimeOffset)) >= 0.4)
803 OffsetOnes = -TimeOffset;
805 if ( (ceil(TimeOffset) - TimeOffset) >= 0.4)
816 case 'q': /* Hex quality code 0 to 0x0F - 0 = maximum, 0x0F = no lock */
835 case 'u': /* set DUT1 offset (-7 to +7) */
844 case 'v': /* set output level (0-255) */
865 exit (-1);
893 DstSwitchPendingMinute = DstSwitchMinute - 1;
897 DstSwitchPendingHour--;
901 DstSwitchPendingDayOfYear--;
904 DstSwitchPendingYear--;
920 printf ("\nFormat is IRIG-1998 (no year coded)...\n\n");
927 printf ("\nFormat is IRIG-2004 (BCD year coded)...\n\n");
934 printf ("\nFormat is IRIG with IEEE-1344 (BCD year coded, and more control functions)...\n\n");
941 …printf ("\nFormat is unmodulated IRIG with IEEE-1344 (BCD year coded, and more control functions).…
951 …printf ("\nFormat is inverted unmodulated IRIG with IEEE-1344 (BCD year coded, and more control fu…
967 exit (-1);
983 if (ioctl(fd, SNDCTL_DSP_SETFMT, &AudioFormat)==-1)
986 exit(-1);
992 exit(-1);
997 if (ioctl(fd, SNDCTL_DSP_STEREO, &MonoStereo)==-1)
1000 exit(-1);
1006 exit(-1);
1011 if (ioctl(fd, SNDCTL_DSP_SPEED, &SampleRate)==-1)
1014 exit(-1);
1017 SampleRateDifference = SampleRate - SetSampleRate;
1020 SampleRateDifference = - SampleRateDifference;
1026 exit(-1);
1058 StabilityCount = 0; // No stability yet.
1070 SecondsPartOfTime -= (time_t) (-UseOffsetSecondsInt);
1073 Minute = TimeStructure->tm_min;
1074 Hour = TimeStructure->tm_hour;
1075 DayOfYear = TimeStructure->tm_yday + 1;
1076 Year = TimeStructure->tm_year % 100;
1077 Second = TimeStructure->tm_sec;
1084 delay(SECOND - TimeValue.tv_usec * 8 / 1000);
1116 ptr--;
1122 * no additional alignment.
1125 printf ("IRIG-B time signal, starting point:\n");
1131 …printf ("Codes: \".\" = marker/position indicator, \"-\" = zero dummy bit, \"0\" = zero bit, \"1\"…
1143 …//printf ("| --------------- | ----------------- | ---- | ----------- | ----- | -----…
1166 …RatioError = ((float) (TotalCyclesAdded - TotalCyclesRemoved)) / (1000.0 * (float) CountOfSecondsS…
1175 …printf ("|------- | ------- | ----- | ----------- | ---- | ----------------- |---------…
1178 …printf ("| --------------- | ----------------- | ---- | ----------- | ----- | -------…
1184 RateCorrection = -1;
1210 /* To delete a second, which means we go from 58->60 instead of 58->59->00. */
1216 printf ("\n<--- Ready to delete a leap second...\n");
1220 /* To add a second, which means we go from 59->60->00 instead of 59->00. */
1226 printf ("\n<--- Ready to insert a leap second...\n");
1243 printf ("\n<--- Deleting a leap second...\n");
1251 printf ("\n<--- Inserting a leap second...\n");
1259 printf ("\n<--- Inserted a leap second, now back to zero...\n");
1264 exit (-1);
1277 /* If DST is active, this would mean that at the appointed time, we de-activate DST, */
1311 OffsetOnes--;
1315 printf ("\n<--- DST activated, spring ahead an hour, new offset !...\n");
1318 { /* DST flag is non zero, in DST, going out of DST, "fall back", so no increment of hour. */
1319 Hour--;
1332 OffsetOnes--;
1346 printf ("\n<--- DST de-activated, fall back an hour!...\n");
1354 /* Modified, just in case dumb case where activating DST advances 23h59:59 -> 01h00:00 */
1385 …RatioError = ((float) (TotalCyclesAdded - TotalCyclesRemoved)) / (1000.0 * (float) CountOfSecondsS…
1525 ptr = strlen(code)-1;
1535 * The IRIG second consists of 20 BCD digits of width-
1537 * percent on the 1000-Hz carrier.
1590 exit (-1);
1597 ptr--;
1600 HexValue = isdigit(AsciiValue) ? AsciiValue - '0' : (AsciiValue - 'A')+10;
1604 printf("\n(%c->%X)", AsciiValue, HexValue);
1619 poop(M5-1, 1000, LOW, UnmodulatedInverted);
1626 peep(M5-1, 1000, LOW);
1637 poop(M8-1, 1000, LOW, UnmodulatedInverted);
1644 peep(M8-1, 1000, LOW);
1760 ptr--;
1771 strlcat(OutputDataString, "-", OUTPUT_DATA_STRING_LENGTH);
1775 ptr--;
1776 case NODEC: /* send marker/position indicator IM/PI bit but no decrement pointer */
1781 poop(10 - arg, 1000, LOW, UnmodulatedInverted);
1786 peep(10 - arg, 1000, LOW);
1793 exit (-1);
1816 * The WWV/H second consists of 9 BCD digits of width-
1817 * modulateod pulses 200, 500 and 800 ms at 100-Hz.
1891 ptr--;
1912 case DECX: /* send data bit with no tick */
1913 ptr--;
1941 peep( 990 - arg, HourTone, OFF);
1951 peep(1010 - arg, HourTone, OFF);
1960 peep(1000 - arg, HourTone, OFF);
1973 peep( 990 - arg, tone, OFF);
1983 peep(1010 - arg, tone, OFF);
1992 peep(1000 - arg, tone, OFF);
2017 ptr--;
2058 SecondsRunningRealTime = (unsigned) (NowRealTime - BaseRealTime);
2059 SecondsRunningDifference = SecondsRunningSimulationTime - SecondsRunningRealTime;
2083 && (ExpectedRunningDifference-INITIAL_STABILITY_BAND < SecondsRunningDifference))
2098 …{ // Else clause for "if (StabilityCount < MINIMUM_STABILITY_COUNT))" - OK, so we are supposed to…
2136 && (ExpectedRunningDifference-RUNNING_STABILITY_BAND < SecondsRunningDifference))
2142 …{ // Oops, outside tolerances. Else clause of "if ((ExpectedRunningDifference...SecondsRunningDi…
2166 printf ("> Oops, outside tolerances, but doesn't fit the profiles, how can this be?\n");
2196 int Rate /* <0 -> do a short second, 0 -> normal second, >0 -> long second */
2203 * respectively. Note the 100-Hz data pulses are transmitted 6
2204 * dB below the 1000-Hz sync pulses. Originally the data pulses
2206 * engineers increased that to 6 dB because the Heath GC-1000
2211 peep(code - 30, 100, LOW); /* send data */
2216 peep( 990 - code, 100, OFF);
2227 peep(1010 - code, 100, OFF);
2235 peep(1000 - code, 100, OFF);
2240 * Generate WWV/H 0 or 1 data pulse, with no tick, for 29th and 59th seconds
2244 int Rate /* <0 -> do a short second, 0 -> normal second, >0 -> long second */
2251 * respectively. Note the 100-Hz data pulses are transmitted 6
2252 * dB below the 1000-Hz sync pulses. Originally the data pulses
2254 * engineers increased that to 6 dB because the Heath GC-1000
2257 peep(30, tone, OFF); /* send seconds non-tick */
2258 peep(code - 30, 100, LOW); /* send data */
2263 peep( 990 - code, 100, OFF);
2274 peep(1010 - code, 100, OFF);
2282 peep(1000 - code, 100, OFF);
2385 samples -= BUFLNG;
2392 /* Year - 0 means 2000, 100 means 2100. */
2393 /* Month - 1 means January, 12 means December. */
2394 /* DayOfMonth - 1 is first day of month */
2432 ReturnValue += DaysInMonth [ MonthCounter - 1 ];
2442 printf ("\nConvertMonthDayToDayOfYear(): %4.4d-%2.2d-%2.2d represents day %3d of year.\n",
2452 printf ("\n\nTime Code Generation - IRIG-B or WWV, v%d.%d, %s dmw", VERSION, ISSUE, ISSUE_DATE);
2454 …printf ( "\n $Header: /home/dmw/src/IRIG_generation/ntp-4.2.2p3/util/RCS/tg.c,v 1.28 2007/02/12 …
2456 …printf ("\n\nOptions: -a device_name Output audio device name (default /dev/audio)…
2457 …printf ( "\n -b yymmddhhmm Remove leap second at end of minute specified…
2458 …printf ( "\n -c seconds_to_send Number of seconds to send (default 0 = foreve…
2459 printf ( "\n -d Start with IEEE 1344 DST active");
2460 printf ( "\n -f format_type i = Modulated IRIG-B 1998 (no year coded)");
2461 printf ( "\n 2 = Modulated IRIG-B 2002 (year coded)");
2462 …printf ( "\n 3 = Modulated IRIG-B w/IEEE 1344 (year & cont…
2463 …printf ( "\n 4 = Unmodulated IRIG-B w/IEEE 1344 (year & co…
2464 …printf ( "\n 5 = Inverted unmodulated IRIG-B w/IEEE 1344 (…
2466 …printf ( "\n -g yymmddhhmm Switch into/out of DST at beginning of minute…
2467 …printf ( "\n -i yymmddhhmm Insert leap second at end of minute specified…
2468 …printf ( "\n -j Disable time rate correction against system c…
2469 …printf ( "\n -k nn Force rate correction for testing (+1 = add c…
2470 …printf ( "\n -l time_offset Set offset of time sent to UTC as per compute…
2471 …printf ( "\n -o time_offset Set IEEE 1344 time offset, +/-, to 0.5 hour (…
2472 printf ( "\n -q quality_code_hex Set IEEE 1344 quality code (default 0)");
2473 printf ( "\n -r sample_rate Audio sample rate (default 8000)");
2474 printf ( "\n -s Set leap warning bit (WWV[H] only)");
2475 …printf ( "\n -t sync_frequency WWV(H) on-time pulse tone frequency (default …
2476 printf ( "\n -u DUT1_offset Set WWV(H) DUT1 offset -7 to +7 (default 0)");
2478 …printf ( "\n -v initial_output_level Set initial output level (default %d, must be…
2480 printf ( "\n -x Turn off verbose output (default on)");
2481 …printf ( "\n -y yymmddhhmmss Set initial date and time as specified (defau…
2483 … Dean Weiten, Norscan Instruments Ltd., Winnipeg, MB, Canada, ph (204)-233-9138, E-mail dmw@norsca…
2499 for (IndexCounter = StringLength; IndexCounter >= CentreOfString; IndexCounter--)
2501 TemporaryCharacter = str[IndexCounter-1];
2502 str[IndexCounter-1] = str[StringLength-IndexCounter];
2503 str[StringLength-IndexCounter] = TemporaryCharacter;