Initial import from FreeBSD RELENG_4:
[dragonfly.git] / contrib / ntp / html / driver28.htm
1 <HTML>
2 <HEAD>
3    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
4    <META NAME="GENERATOR" CONTENT="Mozilla/4.01 [en] (Win95; I) [Netscape]">
5    <TITLE>Shared memoy Driver
6 </TITLE>
7 </HEAD>
8 <BODY>
9
10 <H3>
11 Shared Memory Driver</H3>
12
13 <HR>
14 <H4>
15 Synopsis</H4>
16 Address: 127.127.28.<I>u</I>
17 <BR>Reference ID: <TT>SHM</TT>
18 <BR>Driver ID: <TT>SHM</TT>
19 <H4>
20 Description</H4>
21 This driver receives its reference clock info from a shared memory-segment.
22 The shared memory-segment is created with owner-only access for unit 0
23 and 1, and world access for unit 2 and 3
24 <H4>
25 Structure of shared memory-segment</H4>
26
27 <PRE>struct shmTime {
28 &nbsp; int&nbsp;&nbsp;&nbsp; mode; /* 0 - if valid set
29 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; use values,&nbsp;
30 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; clear valid
31 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * 1 - if valid set&nbsp;
32 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if count before and after read of&nbsp;
33 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; values is equal,
34 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; use values&nbsp;
35 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; clear valid
36 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */
37 &nbsp; int&nbsp;&nbsp;&nbsp; count;
38 &nbsp; time_t clockTimeStampSec;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* external clock */
39 &nbsp; int&nbsp;&nbsp;&nbsp; clockTimeStampUSec;&nbsp;&nbsp;&nbsp;&nbsp; /* external clock */
40 &nbsp; time_t receiveTimeStampSec;&nbsp;&nbsp;&nbsp; /* internal clock, when external value was received */
41 &nbsp; int&nbsp;&nbsp;&nbsp; receiveTimeStampUSec;&nbsp;&nbsp; /* internal clock, when external value was received */
42 &nbsp; int&nbsp;&nbsp;&nbsp; leap;
43 &nbsp; int&nbsp;&nbsp;&nbsp; precision;
44 &nbsp; int&nbsp;&nbsp;&nbsp; nsamples;
45 &nbsp; int&nbsp;&nbsp;&nbsp; valid;
46 &nbsp; int&nbsp;&nbsp;&nbsp; dummy[10];&nbsp;
47 };</PRE>
48
49 <H4>
50 Operation mode=0</H4>
51 When the poll-method of the driver is called, the valid-flag of the shared
52 memory-segment is checked:
53
54 <P>If set, the values in the record (clockTimeStampSec, clockTimeStampUSec,
55 receiveTimeStampSec, receiveTimeStampUSec, leap, precision) are passed
56 to ntp, and the valid-flag is cleared.
57
58 <P>If not set, a timeout is reported to ntp, nothing else happend
59 <H4>
60 Operation mode=1</H4>
61 When the poll-method of the driver is called, the valid-flag of the shared
62 memory-segment is checked:
63
64 <P>If set, the count-field of the record is remembered, and the values
65 in the record (clockTimeStampSec, clockTimeStampUSec, receiveTimeStampSec,
66 receiveTimeStampUSec, leap, precision) are read. Then, the remembered count
67 is compared to the count now in the record. If both are equal, the values
68 read from the record are passed to ntp. If they differ, another process
69 has modified the record while it was read out (was not able to produce
70 this case), and failure is reported to ntp. The valid flag is cleared.
71
72 <P>If not set, a timeout is reported to ntp, nothing else happend
73 <H4>
74 Fudge Factors</H4>
75
76 <DL>
77 <DT>
78 <TT>time1 <I>time</I></TT></DT>
79
80 <DD>
81 Specifies the time offset calibration factor, in seconds and fraction,
82 with default 0.0.</DD>
83
84 <DT>
85 <TT>time2 <I>time</I></TT></DT>
86
87 <DD>
88 Not used by this driver.</DD>
89
90 <DT>
91 <TT>stratum <I>number</I></TT></DT>
92
93 <DD>
94 Specifies the driver stratum, in decimal from 0 to 15, with default 0.</DD>
95
96 <DT>
97 <TT>refid <I>string</I></TT></DT>
98
99 <DD>
100 Specifies the driver reference identifier, an ASCII string from one to
101 four characters, with default <TT>SHM</TT>.</DD>
102
103 <DT>
104 <TT>flag1 0 | 1</TT></DT>
105
106 <DD>
107 Not used by this driver.</DD>
108
109 <DT>
110 <TT>flag2 0 | 1</TT></DT>
111
112 <DD>
113 Not used by this driver.</DD>
114
115 <DT>
116 <TT>flag3 0 | 1</TT></DT>
117
118 <DD>
119 Not used by this driver.</DD>
120
121 <DT>
122 <TT>flag4 0 | 1</TT></DT>
123
124 <DD>
125 Not used by this driver.</DD>
126
127
128 <P>Additional Information
129
130 <P><A HREF="refclock.htm">Reference Clock Drivers</A></DL>
131
132 </BODY>
133 </HTML>