Devuan fork of gpsd
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.8 KiB

  1. <sect1 id="ntpshmwrite.c"><title><filename>ntpshmwrite.c</filename></title>
  2. <informaltable frame='all' pgwide='1'>
  3. <tgroup cols='2'>
  4. <colspec colname='c1'></colspec>
  5. <colspec colname='c2'></colspec>
  6. <spanspec spanname='s1' namest='c1' nameend='c2'></spanspec>
  7. <thead>
  8. <row>
  9. <entry>Functions:-</entry><entry>This puts time information into a shared memory segment for the ntp daemon to use.</entry>
  10. </row>
  11. </thead>
  12. <tfoot>
  13. <row>
  14. <entry spanname='s1' align='left'>Notes based on code as of Tue Apr 6 10:17:55 2010 -0400.</entry>
  15. </row>
  16. </tfoot>
  17. <tbody>
  18. <row>
  19. <entry><function>static struct shmTime *getShmTime(int unit)</function></entry>
  20. <entry><para>This requests a block of shared memory to communicate
  21. to the ntp daemon. It returns a pointer to the memory on success or
  22. NULL on failure.</para></entry>
  23. </row>
  24. <row>
  25. <entry><function>void ntpshm_init(struct gps_context_t *context, bool enablepps)</function></entry>
  26. <entry><para>Attaches all ntp shared memory segments, flagging the
  27. availability of the NMEA and 1pps capabilities as
  28. appropriate.</para></entry>
  29. </row>
  30. <row>
  31. <entry><function>int ntpshm_alloc(struct gps_context_t *context)</function></entry>
  32. <entry><para>This tries to allocate a free ntp shared memory
  33. segment.</para><para>If one is available, initialise it for use and
  34. flag it as in use.</para><para>Returns the segment number on success
  35. or -1 on failure.</para></entry>
  36. </row>
  37. <row>
  38. <entry><function>bool ntpshm_free(struct gps_context_t *context, int segment)</function></entry>
  39. <entry><para>This tries to release a previously allocated ntp shared
  40. memory segment. Indicates the outcome by returning true (success) or
  41. false.</para></entry>
  42. </row>
  43. <row>
  44. <entry><function>int ntpshm_put(struct gps_device_t *session, double fixtime)</function></entry>
  45. <entry><para>If the shared memory index allocated to the session is
  46. valid and the <function>shmTime</function> structure of the session
  47. is valid, store the time of the fix.</para><para>Success is
  48. indicated by a return value of 1 and errors are indicated by a
  49. return value of 0.</para></entry>
  50. </row>
  51. <row>
  52. <entry><function>int ntpshm_pps(struct gps_device_t *session, struct timeval *tv)</function></entry>
  53. <entry><para>This code is only available if the 1PPS function is
  54. compiled in.</para><para>The shared memory structures are checked
  55. for validity and if not valid, a 0 is returned.</para><para>The time
  56. received is then checked to be within 100 milliseconds of the PC's
  57. internal time and if not, a -1 is
  58. returned.</para><para></para><para>The time received is then checked
  59. to be within 500 milliseconds of the second boundary and if not, the
  60. shared memory structure is advised that lock is lost and a -1 is
  61. returned.</para><para>If good, the time is stored in the shared
  62. memory and 1 is returned.</para></entry>
  63. </row>
  64. </tbody>
  65. </tgroup>
  66. </informaltable>
  67. </sect1>