explan_drivers.c.xml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <sect1 id="drivers.c"><title><filename>drivers.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 is the main driver for NMEA, both plain vanilla and any manufacturer specific variety of NMEA output. This is NOT where manufacturer specific binary matters are handled.</entry>
  10. </row>
  11. </thead>
  12. <tfoot>
  13. <row>
  14. <entry spanname='s1' align='left'>Notes based on cde as of Mon Apr 5 21:38:06 2010 -0400.</entry>
  15. </row>
  16. </tfoot>
  17. <tbody>
  18. <row>
  19. <entry><function>ssize_t generic_get(struct gps_device_t *session)</function></entry>
  20. <entry><para>This is a wrapper to call the real packet getter function, <function>packet_get()</function>.</para></entry>
  21. </row>
  22. <row>
  23. <entry><function>ssize_t pass_rtcm(struct gps_device_t *session, char *buf, size_t rtcmbytes)</function></entry>
  24. <entry><para>This writes the rtcm data to the device.</para></entry>
  25. </row>
  26. <row>
  27. <entry><function>gps_mask_t nmea_parse_input(struct gps_device_t *session)</function></entry>
  28. <entry><para>If the packet is a comment packet, ignore it and return 0.</para><para>If it is one of several binary packets, issue a warning to that effect.</para><para>If the relevant driver exists, switch to that driver and get it to parse the packet. The return value is that of the binary parser.</para><para>If the driver does not exist, ignore the packet and return 0.</para><para>If after all this, it is likely to be an NMEA packet, so try to parse it with the NMEA parser. If that returns a 0 (unsuccessful), then check if it is a trigger packet for one of the triggerable drivers.</para><para>If this succeeds, return 1, otherwise issue an unrecognised packet error.</para><para>Finally checks are made against openBSD's NMEA Line Discipline to make use of timestamping and if ntpd synchronising is active, the time is passed to the ntp daemon.</para></entry>
  29. </row>
  30. <row>
  31. <entry><function>static void nmea_probe_subtype(struct gps_device_t *session, unsigned int seq)</function></entry>
  32. <entry><para>This tries to probe for the NMEA mode of several popular chipsets. Most are detected by a trigger string.</para></entry>
  33. </row>
  34. <row>
  35. <entry> </entry>
  36. <entry><para>Several functions are omitted which are device specific. These are not covered here since they ARE device specific.</para></entry>
  37. </row>
  38. <row>
  39. <entry><function>static gps_mask_t rtcm104_analyze(struct gps_device_t *session)</function></entry>
  40. <entry><para>This function calls <function>rtcm_unpack()</function> to unpack rtcm packets into the session buffer.</para></entry>
  41. </row>
  42. <row>
  43. <entry> </entry>
  44. <entry><para>The last important thing in this code is an array of addresses, one for each compiled-in driver. This address gets us to the <quote>capabilities</quote> table in the bottom of each driver where we find what functions a driver supports and the entry address for each function.</para></entry>
  45. </row>
  46. </tbody>
  47. </tgroup>
  48. </informaltable>
  49. </sect1>