summaryrefslogtreecommitdiff
path: root/doc/explan_ntpshm.c.xml
blob: cf74c769978e0a912dbf668d1d27fceeb91d94f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<sect1 id="ntpshm.c"><title><filename>ntpshm.c</filename></title>
<informaltable frame='all' pgwide='1'>
<tgroup cols='2'>
<colspec colname='c1'></colspec>
<colspec colname='c2'></colspec>
<spanspec spanname='s1' namest='c1' nameend='c2'></spanspec>

<thead>
<row>
  <entry>Functions:-</entry><entry>This puts time information into a shared memory segment for the ntp daemon to use.</entry>
</row>
</thead>

<tbody>
<row>
  <entry><function>static struct shmTime *getShmTime(int unit)</function></entry>
  <entry><para>This requests a block of shared memory to communicate to the ntp daemon. It returns a pointer to the memory on success or NULL on failure.</para></entry>
</row>
<row>
  <entry><function>void ntpshm_init(struct gps_context_t *context, bool enablepps)</function></entry>
  <entry><para>Attaches all ntp shared memeory segments, flagging the avaliablilty of the NMEA and 1pps capabilities as appropriate.</para></entry>
</row>
<row>
  <entry><function>int ntpshm_alloc(struct gps_context_t *context)</function></entry>
  <entry><para>This tries to allocate a free ntp shared memory segment.</para><para>If one is available, initialise it for use and flag it as in use.</para><para>Returns the segment number on success or -1 on failure.</para></entry>
</row>
<row>
  <entry><function>bool ntpshm_free(struct gps_context_t *context, int segment)</function></entry>
  <entry><para>This tries to release a previously allocated ntp shared memory segment. Indicates the outcome by returning true (success) or false.</para></entry>
</row>
<row>
  <entry><function>int ntpshm_put(struct gps_device_t *session, double fixtime)</function></entry>
  <entry><para>If the shared memory index allocated to the session is valid and the <function>shmTime</function> structure of the session is valid, store the time of the fix.</para><para>Success is indicated by a return value of 1 and errors are indicated by a return value of 0.</para></entry>
</row>
<row>
  <entry><function>int ntpshm_pps(struct gps_device_t *session, struct timeval *tv)</function></entry>
  <entry><para>This code is only available if the 1PPS function is compiled in.</para><para>The shared memory structures are checked for validity and if not valid, a 0 is returned.</para><para>The time received is then checked to be within 100 milliseconds of the PC's internal time and if not, a -1 is returned.</para><para></para><para>The time received is then checked to be within 500 milliseconds of the second boundary and if not, the shared memory structure is advised that lock is lost and a -1 is returned.</para><para>If good, the time is stored in the shared memory and 1 is returned.</para></entry>
</row>
</tbody>

<tfoot>
<row>
  <entry spanname='s1' align='left'>Notes based on <function>$Id: ntpshm.c 4412 2007-08-21 15:48:02Z ckuethe $</function></entry>
</row>
</tfoot>

</tgroup>
</informaltable>
</sect1>