xref: /freebsd/contrib/ntp/html/drivers/driver28.html (revision ea906c4152774dff300bb26fbfc1e4188351c89a)
19c2daa00SOllivier Robert<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
29c2daa00SOllivier Robert
39c2daa00SOllivier Robert<html>
49c2daa00SOllivier Robert
59c2daa00SOllivier Robert    <head>
69c2daa00SOllivier Robert        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
79c2daa00SOllivier Robert        <meta name="GENERATOR" content="Mozilla/4.01 [en] (Win95; I) [Netscape]">
89c2daa00SOllivier Robert        <title>Shared memoy Driver</title>
9ea906c41SOllivier Robert        <link href="scripts/style.css" type="text/css" rel="stylesheet">
109c2daa00SOllivier Robert    </head>
119c2daa00SOllivier Robert
129c2daa00SOllivier Robert    <body>
139c2daa00SOllivier Robert        <h3>Shared Memory Driver</h3>
149c2daa00SOllivier Robert        <hr>
159c2daa00SOllivier Robert        <h4>Synopsis</h4>
169c2daa00SOllivier Robert        <p>Address: 127.127.28.<i>u</i><br>
179c2daa00SOllivier Robert            Reference ID: <tt>SHM</tt><br>
189c2daa00SOllivier Robert            Driver ID: <tt>SHM</tt></p>
199c2daa00SOllivier Robert        <h4>Description</h4>
209c2daa00SOllivier Robert        <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>
219c2daa00SOllivier Robert        <h4>Structure of shared memory-segment</h4>
229c2daa00SOllivier Robert        <pre>struct shmTime {
239c2daa00SOllivier Robert&nbsp; int&nbsp;&nbsp;&nbsp; mode; /* 0 - if valid set
249c2daa00SOllivier Robert&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; use values,&nbsp;
259c2daa00SOllivier Robert&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; clear valid
269c2daa00SOllivier Robert&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * 1 - if valid set&nbsp;
279c2daa00SOllivier Robert&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;
289c2daa00SOllivier Robert&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; values is equal,
299c2daa00SOllivier Robert&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;
309c2daa00SOllivier Robert&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; clear valid
319c2daa00SOllivier Robert&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */
329c2daa00SOllivier Robert&nbsp; int&nbsp;&nbsp;&nbsp; count;
339c2daa00SOllivier Robert&nbsp; time_t clockTimeStampSec;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* external clock */
349c2daa00SOllivier Robert&nbsp; int&nbsp;&nbsp;&nbsp; clockTimeStampUSec;&nbsp;&nbsp;&nbsp;&nbsp; /* external clock */
359c2daa00SOllivier Robert&nbsp; time_t receiveTimeStampSec;&nbsp;&nbsp;&nbsp; /* internal clock, when external value was received */
369c2daa00SOllivier Robert&nbsp; int&nbsp;&nbsp;&nbsp; receiveTimeStampUSec;&nbsp;&nbsp; /* internal clock, when external value was received */
379c2daa00SOllivier Robert&nbsp; int&nbsp;&nbsp;&nbsp; leap;
389c2daa00SOllivier Robert&nbsp; int&nbsp;&nbsp;&nbsp; precision;
399c2daa00SOllivier Robert&nbsp; int&nbsp;&nbsp;&nbsp; nsamples;
409c2daa00SOllivier Robert&nbsp; int&nbsp;&nbsp;&nbsp; valid;
419c2daa00SOllivier Robert&nbsp; int&nbsp;&nbsp;&nbsp; dummy[10];&nbsp;
429c2daa00SOllivier Robert};</pre>
439c2daa00SOllivier Robert        <h4>Operation mode=0</h4>
449c2daa00SOllivier Robert        <p>When the poll-method of the driver is called, the valid-flag of the shared memory-segment is checked:</p>
459c2daa00SOllivier Robert        <p>If set, the values in the record (clockTimeStampSec, clockTimeStampUSec, receiveTimeStampSec, receiveTimeStampUSec, leap, precision) are passed to ntp, and the valid-flag is cleared.</p>
469c2daa00SOllivier Robert        <p>If not set, a timeout is reported to ntp, nothing else happend</p>
479c2daa00SOllivier Robert        <h4>Operation mode=1</h4>
489c2daa00SOllivier Robert        <p>When the poll-method of the driver is called, the valid-flag of the shared memory-segment is checked:</p>
499c2daa00SOllivier Robert        <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.</p>
509c2daa00SOllivier Robert        <p>If not set, a timeout is reported to ntp, nothing else happend</p>
519c2daa00SOllivier Robert        <h4>Fudge Factors</h4>
529c2daa00SOllivier Robert        <dl>
539c2daa00SOllivier Robert            <dt><tt>time1 <i>time</i></tt>
549c2daa00SOllivier Robert            <dd>Specifies the time offset calibration factor, in seconds and fraction, with default 0.0.
559c2daa00SOllivier Robert            <dt><tt>time2 <i>time</i></tt>
569c2daa00SOllivier Robert            <dd>Not used by this driver.
579c2daa00SOllivier Robert            <dt><tt>stratum <i>number</i></tt>
589c2daa00SOllivier Robert            <dd>Specifies the driver stratum, in decimal from 0 to 15, with default 0.
599c2daa00SOllivier Robert            <dt><tt>refid <i>string</i></tt>
609c2daa00SOllivier Robert            <dd>Specifies the driver reference identifier, an ASCII string from one to four characters, with default <tt>SHM</tt>.
619c2daa00SOllivier Robert            <dt><tt>flag1 0 | 1</tt>
629c2daa00SOllivier Robert            <dd>Not used by this driver.
639c2daa00SOllivier Robert            <dt><tt>flag2 0 | 1</tt>
649c2daa00SOllivier Robert            <dd>Not used by this driver.
659c2daa00SOllivier Robert            <dt><tt>flag3 0 | 1</tt>
669c2daa00SOllivier Robert            <dd>Not used by this driver.
679c2daa00SOllivier Robert            <dt><tt>flag4 0 | 1</tt>
689c2daa00SOllivier Robert            <dd>Not used by this driver.
699c2daa00SOllivier Robert            <h4>Additional Information</h4>
709c2daa00SOllivier Robert            <p><a href="../refclock.html">Reference Clock Drivers</a></p>
719c2daa00SOllivier Robert        </dl>
729c2daa00SOllivier Robert        <hr>
73ea906c41SOllivier Robert        <script type="text/javascript" language="javascript" src="scripts/footer.txt"></script>
749c2daa00SOllivier Robert    </body>
759c2daa00SOllivier Robert
769c2daa00SOllivier Robert</html>