summaryrefslogtreecommitdiff
path: root/doc/explan_ntpshm.c.xml
blob: 97e64012e8670a877e20dd8acf0fb141d8d211de (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<sect1 id="ntpshmwrite.c"><title><filename>ntpshmwrite.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>

<tfoot>
<row>
  <entry spanname='s1' align='left'>Notes based on code as of Tue Apr 6 10:17:55 2010 -0400.</entry>
</row>
</tfoot>

<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 memory segments, flagging the
  availability 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>

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