driver28.html revision 1.1.1.1 1 1.1 kardel <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 1.1 kardel
3 1.1 kardel <html>
4 1.1 kardel
5 1.1 kardel <head>
6 1.1 kardel <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
7 1.1 kardel <meta name="GENERATOR" content="Mozilla/4.01 [en] (Win95; I) [Netscape]">
8 1.1 kardel <title>Shared memoy Driver</title>
9 1.1 kardel <link href="scripts/style.css" type="text/css" rel="stylesheet">
10 1.1 kardel </head>
11 1.1 kardel
12 1.1 kardel <body>
13 1.1 kardel <h3>Shared Memory Driver</h3>
14 1.1 kardel <hr>
15 1.1 kardel <h4>Synopsis</h4>
16 1.1 kardel <p>Address: 127.127.28.<i>u</i><br>
17 1.1 kardel Reference ID: <tt>SHM</tt><br>
18 1.1 kardel Driver ID: <tt>SHM</tt></p>
19 1.1 kardel
20 1.1 kardel <h4>Description</h4>
21 1.1 kardel <p>This driver receives its reference clock info from a shared memory-segment. The shared memory-segment is created with owner-only access for unit 0 and 1, and world access for unit 2 and 3</p>
22 1.1 kardel
23 1.1 kardel <h4>Structure of shared memory-segment</h4>
24 1.1 kardel <pre>struct shmTime {
25 1.1 kardel int mode; /* 0 - if valid set
26 1.1 kardel * use values,
27 1.1 kardel * clear valid
28 1.1 kardel * 1 - if valid set
29 1.1 kardel * if count before and after read of
30 1.1 kardel * values is equal,
31 1.1 kardel * use values
32 1.1 kardel * clear valid
33 1.1 kardel */
34 1.1 kardel int count;
35 1.1 kardel time_t clockTimeStampSec; /* external clock */
36 1.1 kardel int clockTimeStampUSec; /* external clock */
37 1.1 kardel time_t receiveTimeStampSec; /* internal clock, when external value was received */
38 1.1 kardel int receiveTimeStampUSec; /* internal clock, when external value was received */
39 1.1 kardel int leap;
40 1.1 kardel int precision;
41 1.1 kardel int nsamples;
42 1.1 kardel int valid;
43 1.1 kardel int dummy[10];
44 1.1 kardel };</pre>
45 1.1 kardel
46 1.1 kardel <h4>Operation mode=0</h4>
47 1.1 kardel <p>Each second, the valid-flag of the shared memory-segment is checked:</p>
48 1.1 kardel <p>If set, the values in the record (clockTimeStampSec, clockTimeStampUSec, receiveTimeStampSec, receiveTimeStampUSec, leap, precision) are passed to ntp, and the valid-flag is cleared and a counter is bumped.</p>
49 1.1 kardel <p>If not set, a counter is bumped</p>
50 1.1 kardel <h4>Operation mode=1</h4>
51 1.1 kardel <p>Each second, the valid-flag of the shared memory-segment is checked:</p>
52 1.1 kardel <p>If set, the count-field of the record is remembered, and the values in the record (clockTimeStampSec, clockTimeStampUSec, receiveTimeStampSec, receiveTimeStampUSec, leap, precision) are read. Then, the remembered count is compared to the count now in the record. If both are equal, the values read from the record are passed to ntp. If they differ, another process has modified the record while it was read out (was not able to produce this case), and failure is reported to ntp. The valid flag is cleared and a counter is bumped.</p>
53 1.1 kardel <p>If not set, a counter is bumped</p>
54 1.1 kardel
55 1.1 kardel
56 1.1 kardel <h4>gpsd</h4>
57 1.1 kardel
58 1.1 kardel <a href="http://gpsd.berlios.de/"><i>gpsd</i></a>
59 1.1 kardel knows how to talk to many GPS devices.
60 1.1 kardel It works with <i>ntpd</i> through the SHM driver.
61 1.1 kardel <P>
62 1.1 kardel The <i>gpsd</i> man page suggests setting minpoll and maxpoll to 4.
63 1.1 kardel That was an attempt to reduce jitter.
64 1.1 kardel The SHM driver was fixed (ntp-4.2.5p138) to collect data each second rather than
65 1.1 kardel once per polling interval so that suggestion is no longer reasonable.
66 1.1 kardel <P>
67 1.1 kardel
68 1.1 kardel
69 1.1 kardel <h4>Clockstats</h4>
70 1.1 kardel If flag4 is set when the driver is polled, a clockstats record is written.
71 1.1 kardel The first 3 fields are the normal date, time, and IP address common to all clockstats records.
72 1.1 kardel <P>
73 1.1 kardel The 4th field is the number of second ticks since the last poll.
74 1.1 kardel The 5th field is the number of good data samples found. The last 64 will be used by ntpd.
75 1.1 kardel The 6th field is the number of sample that didn't have valid data ready.
76 1.1 kardel The 7th field is the number of bad samples.
77 1.1 kardel The 8th field is the number of times the the mode 1 info was update while nptd was trying to grab a sample.
78 1.1 kardel <P>
79 1.1 kardel
80 1.1 kardel Here is a sample showing the GPS reception fading out:
81 1.1 kardel <pre>
82 1.1 kardel 54364 84927.157 127.127.28.0 66 65 1 0 0
83 1.1 kardel 54364 84990.161 127.127.28.0 63 63 0 0 0
84 1.1 kardel 54364 85053.160 127.127.28.0 63 63 0 0 0
85 1.1 kardel 54364 85116.159 127.127.28.0 63 62 1 0 0
86 1.1 kardel 54364 85180.158 127.127.28.0 64 63 1 0 0
87 1.1 kardel 54364 85246.161 127.127.28.0 66 66 0 0 0
88 1.1 kardel 54364 85312.157 127.127.28.0 66 50 16 0 0
89 1.1 kardel 54364 85375.160 127.127.28.0 63 41 22 0 0
90 1.1 kardel 54364 85439.155 127.127.28.0 64 64 0 0 0
91 1.1 kardel 54364 85505.158 127.127.28.0 66 36 30 0 0
92 1.1 kardel 54364 85569.157 127.127.28.0 64 0 64 0 0
93 1.1 kardel 54364 85635.157 127.127.28.0 66 0 66 0 0
94 1.1 kardel 54364 85700.160 127.127.28.0 65 0 65 0 0
95 1.1 kardel </pre>
96 1.1 kardel
97 1.1 kardel <h4>Fudge Factors</h4>
98 1.1 kardel <dl>
99 1.1 kardel <dt><tt>time1 <i>time</i></tt>
100 1.1 kardel <dd>Specifies the time offset calibration factor, in seconds and fraction, with default 0.0.
101 1.1 kardel <dt><tt>time2 <i>time</i></tt>
102 1.1 kardel <dd>Not used by this driver.
103 1.1 kardel <dt><tt>stratum <i>number</i></tt>
104 1.1 kardel <dd>Specifies the driver stratum, in decimal from 0 to 15, with default 0.
105 1.1 kardel <dt><tt>refid <i>string</i></tt>
106 1.1 kardel <dd>Specifies the driver reference identifier, an ASCII string from one to four characters, with default <tt>SHM</tt>.
107 1.1 kardel <dt><tt>flag1 0 | 1</tt>
108 1.1 kardel <dd>Not used by this driver.
109 1.1 kardel <dt><tt>flag2 0 | 1</tt>
110 1.1 kardel <dd>Not used by this driver.
111 1.1 kardel <dt><tt>flag3 0 | 1</tt>
112 1.1 kardel <dd>Not used by this driver.
113 1.1 kardel <dt><tt>flag4 0 | 1</tt>
114 1.1 kardel <dd>If flag4 is set, clockstats records will be written when the driver is polled.
115 1.1 kardel <h4>Additional Information</h4>
116 1.1 kardel <p><a href="../refclock.html">Reference Clock Drivers</a></p>
117 1.1 kardel </dl>
118 1.1 kardel <hr>
119 1.1 kardel <script type="text/javascript" language="javascript" src="scripts/footer.txt"></script>
120 1.1 kardel </body>
121 1.1 kardel
122 1.1 kardel </html>
123 1.1 kardel
124