NetBSD/dist/ntp/html/driver28.htm
2000-03-29 12:38:44 +00:00

134 lines
4.4 KiB
HTML

<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="GENERATOR" CONTENT="Mozilla/4.01 [en] (Win95; I) [Netscape]">
<TITLE>Shared memoy Driver
</TITLE>
</HEAD>
<BODY>
<H3>
Shared Memory Driver</H3>
<HR>
<H4>
Synopsis</H4>
Address: 127.127.28.<I>u</I>
<BR>Reference ID: <TT>SHM</TT>
<BR>Driver ID: <TT>SHM</TT>
<H4>
Description</H4>
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
<H4>
Structure of shared memory-segment</H4>
<PRE>struct shmTime {
&nbsp; int&nbsp;&nbsp;&nbsp; mode; /* 0 - if valid set
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; use values,&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; clear valid
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * 1 - if valid set&nbsp;
&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;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; values is equal,
&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;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; clear valid
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */
&nbsp; int&nbsp;&nbsp;&nbsp; count;
&nbsp; time_t clockTimeStampSec;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* external clock */
&nbsp; int&nbsp;&nbsp;&nbsp; clockTimeStampUSec;&nbsp;&nbsp;&nbsp;&nbsp; /* external clock */
&nbsp; time_t receiveTimeStampSec;&nbsp;&nbsp;&nbsp; /* internal clock, when external value was received */
&nbsp; int&nbsp;&nbsp;&nbsp; receiveTimeStampUSec;&nbsp;&nbsp; /* internal clock, when external value was received */
&nbsp; int&nbsp;&nbsp;&nbsp; leap;
&nbsp; int&nbsp;&nbsp;&nbsp; precision;
&nbsp; int&nbsp;&nbsp;&nbsp; nsamples;
&nbsp; int&nbsp;&nbsp;&nbsp; valid;
&nbsp; int&nbsp;&nbsp;&nbsp; dummy[10];&nbsp;
};</PRE>
<H4>
Operation mode=0</H4>
When the poll-method of the driver is called, the valid-flag of the shared
memory-segment is checked:
<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>If not set, a timeout is reported to ntp, nothing else happend
<H4>
Operation mode=1</H4>
When the poll-method of the driver is called, the valid-flag of the shared
memory-segment is checked:
<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>If not set, a timeout is reported to ntp, nothing else happend
<H4>
Fudge Factors</H4>
<DL>
<DT>
<TT>time1 <I>time</I></TT></DT>
<DD>
Specifies the time offset calibration factor, in seconds and fraction,
with default 0.0.</DD>
<DT>
<TT>time2 <I>time</I></TT></DT>
<DD>
Not used by this driver.</DD>
<DT>
<TT>stratum <I>number</I></TT></DT>
<DD>
Specifies the driver stratum, in decimal from 0 to 15, with default 0.</DD>
<DT>
<TT>refid <I>string</I></TT></DT>
<DD>
Specifies the driver reference identifier, an ASCII string from one to
four characters, with default <TT>SHM</TT>.</DD>
<DT>
<TT>flag1 0 | 1</TT></DT>
<DD>
Not used by this driver.</DD>
<DT>
<TT>flag2 0 | 1</TT></DT>
<DD>
Not used by this driver.</DD>
<DT>
<TT>flag3 0 | 1</TT></DT>
<DD>
Not used by this driver.</DD>
<DT>
<TT>flag4 0 | 1</TT></DT>
<DD>
Not used by this driver.</DD>
<P>Additional Information
<P><A HREF="refclock.htm">Reference Clock Drivers</A></DL>
</BODY>
</HTML>