xref: /freebsd/contrib/ntp/include/mbg_gps166.h (revision 416ba5c74546f32a993436a99516d35008e9f384)
1c0b746e5SOllivier Robert /*
2ea906c41SOllivier Robert  * /src/NTP/REPOSITORY/ntp4-dev/include/mbg_gps166.h,v 4.7 2006/06/22 18:41:43 kardel RELEASE_20060622_A
3ea906c41SOllivier Robert  *
4ea906c41SOllivier Robert  * mbg_gps166.h,v 4.7 2006/06/22 18:41:43 kardel RELEASE_20060622_A
5c0b746e5SOllivier Robert  *
6c0b746e5SOllivier Robert  * $Created: Sun Jul 20 09:20:50 1997 $
7c0b746e5SOllivier Robert  *
8ea906c41SOllivier Robert  * File GPSSERIO.H Copyright (c) by Meinberg Funkuhren (www.meinberg.de)
9ea906c41SOllivier Robert  *
10ea906c41SOllivier Robert  * Linkage to PARSE:
11ea906c41SOllivier Robert  * Copyright (c) 1997-2005 by Frank Kardel <kardel <AT> ntp.org>
12ea906c41SOllivier Robert  *
13ea906c41SOllivier Robert  * Redistribution and use in source and binary forms, with or without
14ea906c41SOllivier Robert  * modification, are permitted provided that the following conditions
15ea906c41SOllivier Robert  * are met:
16ea906c41SOllivier Robert  * 1. Redistributions of source code must retain the above copyright
17ea906c41SOllivier Robert  *    notice, this list of conditions and the following disclaimer.
18ea906c41SOllivier Robert  * 2. Redistributions in binary form must reproduce the above copyright
19ea906c41SOllivier Robert  *    notice, this list of conditions and the following disclaimer in the
20ea906c41SOllivier Robert  *    documentation and/or other materials provided with the distribution.
21ea906c41SOllivier Robert  * 3. Neither the name of the author nor the names of its contributors
22ea906c41SOllivier Robert  *    may be used to endorse or promote products derived from this software
23ea906c41SOllivier Robert  *    without specific prior written permission.
24ea906c41SOllivier Robert  *
25ea906c41SOllivier Robert  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
26ea906c41SOllivier Robert  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27ea906c41SOllivier Robert  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28ea906c41SOllivier Robert  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
29ea906c41SOllivier Robert  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30ea906c41SOllivier Robert  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31ea906c41SOllivier Robert  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32ea906c41SOllivier Robert  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33ea906c41SOllivier Robert  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34ea906c41SOllivier Robert  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35ea906c41SOllivier Robert  * SUCH DAMAGE.
36ea906c41SOllivier Robert  *
37c0b746e5SOllivier Robert  */
38c0b746e5SOllivier Robert #ifndef MBG_GPS166_H
39c0b746e5SOllivier Robert #define MBG_GPS166_H
40c0b746e5SOllivier Robert 
41c0b746e5SOllivier Robert 
42*a25439b6SCy Schubert /***************************************************************************
43*a25439b6SCy Schubert  *
44*a25439b6SCy Schubert  *  Definitions taken from Meinberg's gpsserio.h and gpsdefs.h files.
45*a25439b6SCy Schubert  *
46*a25439b6SCy Schubert  *  Author:  Martin Burnicki, Meinberg Funkuhren
47*a25439b6SCy Schubert  *
48*a25439b6SCy Schubert  *  Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
49*a25439b6SCy Schubert  *
50*a25439b6SCy Schubert  *  Description:
51*a25439b6SCy Schubert  *    Structures and codes to be used to access Meinberg GPS clocks via
52*a25439b6SCy Schubert  *    their serial interface COM0. COM0 should be set to a high baud rate,
53*a25439b6SCy Schubert  *    default is 19200.
54*a25439b6SCy Schubert  *
55*a25439b6SCy Schubert  *    Standard Meinberg GPS serial operation is to send the Meinberg
56*a25439b6SCy Schubert  *    standard time string automatically once per second, once per
57*a25439b6SCy Schubert  *    minute, or on request per ASCII '?'.
58*a25439b6SCy Schubert  *
59*a25439b6SCy Schubert  *    GPS parameter setup or parameter readout uses blocks of binary
60*a25439b6SCy Schubert  *    data which have to be isolated from the standard string. A block
61*a25439b6SCy Schubert  *    of data starts with a SOH code (ASCII Start Of Header, 0x01)
62*a25439b6SCy Schubert  *    followed by a message header with constant length and a block of
63*a25439b6SCy Schubert  *    data with variable length.
64*a25439b6SCy Schubert  *
65*a25439b6SCy Schubert  *    The first field (cmd) of the message header holds the command
66*a25439b6SCy Schubert  *    code resp. the type of data to be transmitted. The next field (len)
67*a25439b6SCy Schubert  *    gives the number of data bytes that follow the header. This number
68*a25439b6SCy Schubert  *    ranges from 0 to sizeof( MSG_DATA ). The third field (data_csum)
69*a25439b6SCy Schubert  *    holds a checksum of all data bytes and the last field of the header
70*a25439b6SCy Schubert  *    finally holds the checksum of the header itself.
71*a25439b6SCy Schubert  *
72*a25439b6SCy Schubert  ***************************************************************************/
73c0b746e5SOllivier Robert 
74*a25439b6SCy Schubert /**
75*a25439b6SCy Schubert  * @brief GPS epoch bias from ordinary time_t epoch
76*a25439b6SCy Schubert  *
77*a25439b6SCy Schubert  * The Unix time_t epoch is usually 1970-01-01 00:00 whereas
78*a25439b6SCy Schubert  * the GPS epoch is 1980-01-06 00:00, so the difference is 10 years,
79*a25439b6SCy Schubert  * plus 2 days due to leap years (1972 and 1976), plus the difference
80*a25439b6SCy Schubert  * of the day-of-month (6 - 1), so:<br>
81*a25439b6SCy Schubert  *
82*a25439b6SCy Schubert  * time_t t = ( gps_week * ::SECS_PER_WEEK ) + sec_of_week + ::GPS_SEC_BIAS
83*a25439b6SCy Schubert  */
84*a25439b6SCy Schubert #define GPS_SEC_BIAS   315964800UL     // ( ( ( 10UL * 365UL ) + 2 + 5 ) * SECS_PER_DAY )
85c0b746e5SOllivier Robert 
86c0b746e5SOllivier Robert 
87*a25439b6SCy Schubert #ifndef _COM_HS_DEFINED
88*a25439b6SCy Schubert   /**
89*a25439b6SCy Schubert    * @brief Enumeration of handshake modes
90*a25439b6SCy Schubert    */
91*a25439b6SCy Schubert   enum COM_HANSHAKE_MODES { HS_NONE, HS_XONXOFF, HS_RTSCTS, N_COM_HS };
92*a25439b6SCy Schubert   #define _COM_HS_DEFINED
93*a25439b6SCy Schubert #endif
94c0b746e5SOllivier Robert 
95*a25439b6SCy Schubert #ifndef _COM_PARM_DEFINED
96*a25439b6SCy Schubert   /**
97*a25439b6SCy Schubert    * @brief A data type to configure a serial port's baud rate
98*a25439b6SCy Schubert    *
99*a25439b6SCy Schubert    * @see ::MBG_BAUD_RATES
100*a25439b6SCy Schubert    */
101*a25439b6SCy Schubert   typedef int32_t BAUD_RATE;
102c0b746e5SOllivier Robert 
103*a25439b6SCy Schubert   /**
104*a25439b6SCy Schubert    * @brief Indices used to identify a parameter in the framing string
105*a25439b6SCy Schubert    *
106*a25439b6SCy Schubert    * @see ::MBG_FRAMING_STRS
107*a25439b6SCy Schubert    */
108*a25439b6SCy Schubert   enum MBG_FRAMING_STR_IDXS { F_DBITS, F_PRTY, F_STBITS };
109*a25439b6SCy Schubert 
110*a25439b6SCy Schubert   /**
111*a25439b6SCy Schubert    * @brief A structure to store the configuration of a serial port
112*a25439b6SCy Schubert    */
113*a25439b6SCy Schubert   typedef struct
114*a25439b6SCy Schubert   {
115*a25439b6SCy Schubert     BAUD_RATE baud_rate;  ///< transmission speed, e.g. 19200L, see ::MBG_BAUD_RATES
116*a25439b6SCy Schubert     char framing[4];      ///< ASCIIZ framing string, e.g. "8N1" or "7E2", see ::MBG_FRAMING_STRS
117*a25439b6SCy Schubert     int16_t handshake;    ///< handshake mode, yet only ::HS_NONE supported
118*a25439b6SCy Schubert 
119*a25439b6SCy Schubert   } COM_PARM;
120*a25439b6SCy Schubert 
121*a25439b6SCy Schubert   #define _COM_PARM_DEFINED
122*a25439b6SCy Schubert #endif
123*a25439b6SCy Schubert 
124*a25439b6SCy Schubert 
125*a25439b6SCy Schubert /**
126*a25439b6SCy Schubert  * @brief Enumeration of modes supported for time string transmission
127*a25439b6SCy Schubert  *
128*a25439b6SCy Schubert  * This determines e.g. at which point in time a string starts
129*a25439b6SCy Schubert  * to be transmitted via the serial port.
130*a25439b6SCy Schubert  * Used with ::PORT_SETTINGS::mode.
131*a25439b6SCy Schubert  *
132*a25439b6SCy Schubert  * @see ::STR_MODE_MASKS
133*a25439b6SCy Schubert  */
134*a25439b6SCy Schubert enum STR_MODES
135*a25439b6SCy Schubert {
136*a25439b6SCy Schubert   STR_ON_REQ,     ///< transmission on request by received '?' character only
137*a25439b6SCy Schubert   STR_PER_SEC,    ///< transmission automatically if second changes
138*a25439b6SCy Schubert   STR_PER_MIN,    ///< transmission automatically if minute changes
139*a25439b6SCy Schubert   STR_AUTO,       ///< transmission automatically if required, e.g. on capture event
140*a25439b6SCy Schubert   STR_ON_REQ_SEC, ///< transmission if second changes and a request has been received before
141*a25439b6SCy Schubert   N_STR_MODE      ///< the number of known modes
142c0b746e5SOllivier Robert };
143c0b746e5SOllivier Robert 
144*a25439b6SCy Schubert 
145*a25439b6SCy Schubert /**
146*a25439b6SCy Schubert  * The number of serial ports which are at least available
147*a25439b6SCy Schubert  * even with very old GPS receiver models. For devices providing
148*a25439b6SCy Schubert  * a ::RECEIVER_INFO structure the number of provided COM ports
149*a25439b6SCy Schubert  * is available in ::RECEIVER_INFO::n_com_ports.
150c0b746e5SOllivier Robert  */
151*a25439b6SCy Schubert #define DEFAULT_N_COM   2
152*a25439b6SCy Schubert 
153*a25439b6SCy Schubert 
154*a25439b6SCy Schubert /**
155*a25439b6SCy Schubert  * @brief A The structure used to store the configuration of two serial ports
156*a25439b6SCy Schubert  *
157*a25439b6SCy Schubert  * @deprecated This structure is deprecated, ::PORT_SETTINGS and related structures
158*a25439b6SCy Schubert  * should be used instead, if supported by the device.
159*a25439b6SCy Schubert  */
160*a25439b6SCy Schubert typedef struct
161*a25439b6SCy Schubert {
162*a25439b6SCy Schubert   COM_PARM com[DEFAULT_N_COM];    ///< COM0 and COM1 settings
163*a25439b6SCy Schubert   uint8_t mode[DEFAULT_N_COM];    ///< COM0 and COM1 output mode
164*a25439b6SCy Schubert 
165*a25439b6SCy Schubert } PORT_PARM;
166*a25439b6SCy Schubert 
167*a25439b6SCy Schubert 
168*a25439b6SCy Schubert /**
169*a25439b6SCy Schubert  * @brief The type of a GPS command code
170*a25439b6SCy Schubert  *
171*a25439b6SCy Schubert  * @see ::GPS_CMD_CODES
172*a25439b6SCy Schubert  */
173*a25439b6SCy Schubert typedef uint16_t GPS_CMD;
174*a25439b6SCy Schubert 
175*a25439b6SCy Schubert 
176*a25439b6SCy Schubert /**
177*a25439b6SCy Schubert  * @brief Control codes to be or'ed with a particular command/type code
178*a25439b6SCy Schubert  */
179*a25439b6SCy Schubert enum GPS_CMD_CTRL_CODES
180*a25439b6SCy Schubert {
181*a25439b6SCy Schubert   GPS_REQACK = 0x8000,   ///< to device: request acknowledge
182*a25439b6SCy Schubert   GPS_ACK    = 0x4000,   ///< from device: acknowledge a command
183*a25439b6SCy Schubert   GPS_NACK   = 0x2000,   ///< from device: error evaluating a command
184*a25439b6SCy Schubert };
185*a25439b6SCy Schubert 
186*a25439b6SCy Schubert #define GPS_CTRL_MSK  0xF000   ///< bit mask of all ::GPS_CMD_CTRL_CODES
187*a25439b6SCy Schubert 
188*a25439b6SCy Schubert 
189*a25439b6SCy Schubert /**
190*a25439b6SCy Schubert  * @brief Command codes for the binary protocol
191*a25439b6SCy Schubert  *
192*a25439b6SCy Schubert  * These codes specify commands and associated data types used by Meinberg's
193*a25439b6SCy Schubert  * binary protocol to exchange data with a device via serial port, direct USB,
194*a25439b6SCy Schubert  * or socket I/O.
195*a25439b6SCy Schubert  *
196*a25439b6SCy Schubert  * Some commands and associated data structures can be read (r) from a device, others
197*a25439b6SCy Schubert  * can be written (w) to the device, and some can also be sent automatically (a) by
198*a25439b6SCy Schubert  * a device after a ::GPS_AUTO_ON command has been sent to the device.
199*a25439b6SCy Schubert  * The individual command codes are marked with (rwa) accordingly, where '-' is used
200*a25439b6SCy Schubert  * to indicate that a particular mode is not supported.
201*a25439b6SCy Schubert  *
202*a25439b6SCy Schubert  * @note Not all command code are supported by all devices.
203*a25439b6SCy Schubert  * See the hints for a particular command.
204*a25439b6SCy Schubert  *
205*a25439b6SCy Schubert  * @note If ::GPS_ALM, ::GPS_EPH or a code named ..._IDX is sent to retrieve
206*a25439b6SCy Schubert  * some data from a device then an uint16_t parameter must be also supplied
207*a25439b6SCy Schubert  * in order to specify the index number of the data set to be returned.
208*a25439b6SCy Schubert  * The valid index range depends on the command code.
209*a25439b6SCy Schubert  * For ::GPS_ALM and ::GPS_EPH the index is the SV number which may be 0 or
210*a25439b6SCy Schubert  * ::MIN_SVNO_GPS to ::MAX_SVNO_GPS. If the number is 0 then all ::N_SVNO_GPS
211*a25439b6SCy Schubert  * almanacs or ephemeris data structures are returned.
212*a25439b6SCy Schubert  *
213*a25439b6SCy Schubert  * @see ::GPS_CMD_CODES_TABLE
214*a25439b6SCy Schubert  */
215*a25439b6SCy Schubert enum GPS_CMD_CODES
216*a25439b6SCy Schubert { /* system data */
217*a25439b6SCy Schubert   GPS_AUTO_ON = 0x000,  ///< (-w-) no data, enable auto-msgs from device
218*a25439b6SCy Schubert   GPS_AUTO_OFF,         ///< (-w-) no data, disable auto-msgs from device
219*a25439b6SCy Schubert   GPS_SW_REV,           ///< (r--) deprecated, ::SW_REV, software revision, use only if ::GPS_RECEIVER_INFO not supp.
220*a25439b6SCy Schubert   GPS_BVAR_STAT,        ///< (r--) ::BVAR_STAT, status of buffered variables, only if ::GPS_MODEL_HAS_BVAR_STAT
221*a25439b6SCy Schubert   GPS_TIME,             ///< (-wa) ::TTM, current time or capture, or init board time
222*a25439b6SCy Schubert   GPS_POS_XYZ,          ///< (rw-) ::XYZ, current position in ECEF coordinates, only if ::GPS_MODEL_HAS_POS_XYZ
223*a25439b6SCy Schubert   GPS_POS_LLA,          ///< (rw-) ::LLA, current position in geographic coordinates, only if ::GPS_MODEL_HAS_POS_LLA
224*a25439b6SCy Schubert   GPS_TZDL,             ///< (rw-) ::TZDL, time zone / daylight saving, only if ::GPS_MODEL_HAS_TZDL
225*a25439b6SCy Schubert   GPS_PORT_PARM,        ///< (rw-) deprecated, ::PORT_PARM, use ::PORT_SETTINGS etc. if ::GPS_RECEIVER_INFO supported
226*a25439b6SCy Schubert   GPS_SYNTH,            ///< (rw-) ::SYNTH, synthesizer settings, only if ::GPS_HAS_SYNTH
227*a25439b6SCy Schubert   GPS_ANT_INFO,         ///< (r-a) ::ANT_INFO, time diff after antenna disconnect, only if ::GPS_MODEL_HAS_ANT_INFO
228*a25439b6SCy Schubert   GPS_UCAP,             ///< (r-a) ::TTM, user capture events, only if ::RECEIVER_INFO::n_ucaps > 0
229*a25439b6SCy Schubert 
230*a25439b6SCy Schubert   /* GPS data */
231*a25439b6SCy Schubert   GPS_CFGH = 0x100,     ///< (rw-) ::CFGH, SVs' configuration and health codes
232*a25439b6SCy Schubert   GPS_ALM,              ///< (rw-) req: uint16_t SV num, ::SV_ALM, one SV's almanac
233*a25439b6SCy Schubert   GPS_EPH,              ///< (rw-) req: uint16_t SV num, ::SV_EPH, one SV's ephemeris
234*a25439b6SCy Schubert   GPS_UTC,              ///< (rw-) ::UTC, GPS %UTC correction parameters
235*a25439b6SCy Schubert   GPS_IONO,             ///< (rw-) ::IONO, GPS ionospheric correction parameters
236*a25439b6SCy Schubert   GPS_ASCII_MSG         ///< (r--) ::ASCII_MSG, the GPS ASCII message
237*a25439b6SCy Schubert };
238*a25439b6SCy Schubert 
239c0b746e5SOllivier Robert 
240c0b746e5SOllivier Robert #ifndef _CSUM_DEFINED
241*a25439b6SCy Schubert   typedef uint16_t CSUM;  /* checksum used by some structures stored in non-volatile memory */
242c0b746e5SOllivier Robert   #define _CSUM_DEFINED
243c0b746e5SOllivier Robert #endif
244c0b746e5SOllivier Robert 
245c0b746e5SOllivier Robert 
246*a25439b6SCy Schubert /**
247*a25439b6SCy Schubert  * @brief The header of a binary message.
248*a25439b6SCy Schubert  */
249*a25439b6SCy Schubert typedef struct
250*a25439b6SCy Schubert {
251*a25439b6SCy Schubert   GPS_CMD cmd;      ///< see ::GPS_CMD_CODES
252*a25439b6SCy Schubert   uint16_t len;     ///< length of the data portion appended after the header
253*a25439b6SCy Schubert   CSUM data_csum;   ///< checksum of the data portion appended after the header
254*a25439b6SCy Schubert   CSUM hdr_csum;    ///< checksum of the preceding header bytes
255*a25439b6SCy Schubert 
256c0b746e5SOllivier Robert } GPS_MSG_HDR;
257c0b746e5SOllivier Robert 
258c0b746e5SOllivier Robert 
259*a25439b6SCy Schubert #define GPS_ID_STR_LEN      16
260*a25439b6SCy Schubert #define GPS_ID_STR_SIZE     ( GPS_ID_STR_LEN + 1 )
261*a25439b6SCy Schubert 
262*a25439b6SCy Schubert /**
263*a25439b6SCy Schubert  * @brief Software revision information
264*a25439b6SCy Schubert  *
265*a25439b6SCy Schubert  * Contains a software revision code, plus an optional
266*a25439b6SCy Schubert  * identifier for a customized version.
267*a25439b6SCy Schubert  */
268*a25439b6SCy Schubert typedef struct
269*a25439b6SCy Schubert {
270*a25439b6SCy Schubert   uint16_t code;               ///< Version number, e.g. 0x0120 means v1.20
271*a25439b6SCy Schubert   char name[GPS_ID_STR_SIZE];  ///< Optional string identifying a customized version
272*a25439b6SCy Schubert   uint8_t reserved;            ///< Reserved field to yield even structure size
273*a25439b6SCy Schubert 
274c0b746e5SOllivier Robert } SW_REV;
275c0b746e5SOllivier Robert 
276c0b746e5SOllivier Robert 
277*a25439b6SCy Schubert /**
278*a25439b6SCy Schubert  * @brief GNSS satellite numbers
279*a25439b6SCy Schubert  *
280*a25439b6SCy Schubert  * @todo: Check if MAX_SVNO_GLN is 94 instead of 95, and thus
281*a25439b6SCy Schubert  *        N_SVNO_GLN is 30 instead of 31, as reported by Wikipedia.
282*a25439b6SCy Schubert  */
283*a25439b6SCy Schubert enum GNSS_SVNOS
284*a25439b6SCy Schubert {
285*a25439b6SCy Schubert   MIN_SVNO_GPS = 1,       ///< min. GPS satellite PRN number
286*a25439b6SCy Schubert   MAX_SVNO_GPS = 32,      ///< max. GPS satellite PRN number
287*a25439b6SCy Schubert   N_SVNO_GPS = 32,        ///< max. number of active GPS satellites
288c0b746e5SOllivier Robert 
289*a25439b6SCy Schubert   MIN_SVNO_WAAS = 33,     ///< min. WAAS satellite number
290*a25439b6SCy Schubert   MAX_SVNO_WAAS = 64,     ///< max. WAAS satellite number
291*a25439b6SCy Schubert   N_SVNO_WAAS = 32,       ///< max. number of active WAAS satellites
292*a25439b6SCy Schubert 
293*a25439b6SCy Schubert   MIN_SVNO_GLONASS = 65,  ///< min. Glonass satellite number (64 + sat slot ID)
294*a25439b6SCy Schubert   MAX_SVNO_GLONASS = 95,  ///< max. Glonass satellite number (64 + sat slot ID)
295*a25439b6SCy Schubert   N_SVNO_GLONASS = 31     ///< max. number of active Glonass satellites
296*a25439b6SCy Schubert };
297c0b746e5SOllivier Robert 
298c0b746e5SOllivier Robert 
299*a25439b6SCy Schubert typedef uint16_t SVNO;    ///< the number of an SV (Space Vehicle, i.e. satellite)
300*a25439b6SCy Schubert typedef uint16_t HEALTH;  ///< an SV's 6 bit health code
301*a25439b6SCy Schubert typedef uint16_t CFG;     ///< an SV's 4 bit configuration code
302*a25439b6SCy Schubert typedef uint16_t IOD;     ///< Issue-Of-Data code
303c0b746e5SOllivier Robert 
304c0b746e5SOllivier Robert 
305*a25439b6SCy Schubert /**
306*a25439b6SCy Schubert  * @brief Status flags of battery buffered data
307*a25439b6SCy Schubert  *
308*a25439b6SCy Schubert  * Related to data received from the satellites, or data derived thereof.
309*a25439b6SCy Schubert  *
310*a25439b6SCy Schubert  * All '0' means OK, single bits set to '1' indicate
311*a25439b6SCy Schubert  * the associated type of GPS data is not available.
312*a25439b6SCy Schubert  *
313*a25439b6SCy Schubert  * @see ::BVAR_FLAGS
314*a25439b6SCy Schubert  */
315*a25439b6SCy Schubert typedef uint16_t BVAR_STAT;
316*a25439b6SCy Schubert 
317*a25439b6SCy Schubert #define _mbg_swab_bvar_stat( _p )  _mbg_swab16( (_p) )
318*a25439b6SCy Schubert 
319*a25439b6SCy Schubert 
320*a25439b6SCy Schubert /**
321*a25439b6SCy Schubert  * @brief Enumeration of flag bits used to define ::BVAR_FLAGS
322*a25439b6SCy Schubert  *
323*a25439b6SCy Schubert  * For each bit which is set this means the associated data set in
324*a25439b6SCy Schubert  * non-volatile memory is not available, or incomplete.
325*a25439b6SCy Schubert  * Most data sets will just be re-collected from the data streams sent
326*a25439b6SCy Schubert  * by the satellites. However, the receiver position has usually been
327*a25439b6SCy Schubert  * computed earlier during normal operation, and will be re-computed
328*a25439b6SCy Schubert  * when a sufficient number of satellites can be received.
329*a25439b6SCy Schubert  *
330*a25439b6SCy Schubert  * @see ::BVAR_STAT
331*a25439b6SCy Schubert  * @see ::BVAR_FLAGS
332*a25439b6SCy Schubert  * @see ::BVAR_FLAG_NAMES
333*a25439b6SCy Schubert  */
334*a25439b6SCy Schubert enum BVAR_FLAG_BITS
335*a25439b6SCy Schubert {
336*a25439b6SCy Schubert   BVAR_BIT_CFGH_INVALID,      ///< Satellite configuration and health parameters incomplete
337*a25439b6SCy Schubert   BVAR_BIT_ALM_NOT_COMPLETE,  ///< Almanac parameters incomplete
338*a25439b6SCy Schubert   BVAR_BIT_UTC_INVALID,       ///< %UTC offset parameters incomplete
339*a25439b6SCy Schubert   BVAR_BIT_IONO_INVALID,      ///< Ionospheric correction parameters incomplete
340*a25439b6SCy Schubert   BVAR_BIT_RCVR_POS_INVALID,  ///< No valid receiver position available
341*a25439b6SCy Schubert   N_BVAR_BIT                  ///< number of defined ::BVAR_STAT bits
342*a25439b6SCy Schubert };
343*a25439b6SCy Schubert 
344*a25439b6SCy Schubert 
345*a25439b6SCy Schubert /**
346*a25439b6SCy Schubert  * @brief Bit masks associated with ::BVAR_FLAG_BITS
347*a25439b6SCy Schubert  *
348*a25439b6SCy Schubert  * Used with ::BVAR_STAT.
349*a25439b6SCy Schubert  *
350*a25439b6SCy Schubert  * @see ::BVAR_STAT
351*a25439b6SCy Schubert  * @see ::BVAR_FLAG_BITS
352*a25439b6SCy Schubert  * @see ::BVAR_FLAG_NAMES
353*a25439b6SCy Schubert  */
354*a25439b6SCy Schubert enum BVAR_FLAGS
355*a25439b6SCy Schubert {
356*a25439b6SCy Schubert   BVAR_CFGH_INVALID     = ( 1UL << BVAR_BIT_CFGH_INVALID ),      ///< see ::BVAR_BIT_CFGH_INVALID
357*a25439b6SCy Schubert   BVAR_ALM_NOT_COMPLETE = ( 1UL << BVAR_BIT_ALM_NOT_COMPLETE ),  ///< see ::BVAR_BIT_ALM_NOT_COMPLETE
358*a25439b6SCy Schubert   BVAR_UTC_INVALID      = ( 1UL << BVAR_BIT_UTC_INVALID ),       ///< see ::BVAR_BIT_UTC_INVALID
359*a25439b6SCy Schubert   BVAR_IONO_INVALID     = ( 1UL << BVAR_BIT_IONO_INVALID ),      ///< see ::BVAR_BIT_IONO_INVALID
360*a25439b6SCy Schubert   BVAR_RCVR_POS_INVALID = ( 1UL << BVAR_BIT_RCVR_POS_INVALID ),  ///< see ::BVAR_BIT_RCVR_POS_INVALID
361*a25439b6SCy Schubert };
362*a25439b6SCy Schubert 
363*a25439b6SCy Schubert 
364*a25439b6SCy Schubert /**
365*a25439b6SCy Schubert  * @brief A structure used to hold time in GPS format
366*a25439b6SCy Schubert  *
367*a25439b6SCy Schubert  * Date and time refer to the linear time scale defined by GPS, with
368*a25439b6SCy Schubert  * the epoch starting at %UTC midnight at the beginning of January 6, 1980.
369*a25439b6SCy Schubert  *
370*a25439b6SCy Schubert  * GPS time is counted by the week numbers since the epoch, plus second
371*a25439b6SCy Schubert  * of the week, plus fraction of the second. The week number transmitted
372*a25439b6SCy Schubert  * by the satellites rolls over from 1023 to 0, but Meinberg devices
373*a25439b6SCy Schubert  * just continue to count the weeks beyond the 1024 week limit to keep
374*a25439b6SCy Schubert  * the receiver's internal time.
375*a25439b6SCy Schubert  *
376*a25439b6SCy Schubert  * %UTC time differs from GPS time since a number of leap seconds have
377*a25439b6SCy Schubert  * been inserted in the %UTC time scale after the GPS epoche. The number
378*a25439b6SCy Schubert  * of leap seconds is disseminated by the satellites using the ::UTC
379*a25439b6SCy Schubert  * parameter set, which also provides info on pending leap seconds.
380*a25439b6SCy Schubert  */
381*a25439b6SCy Schubert typedef struct
382*a25439b6SCy Schubert {
383*a25439b6SCy Schubert   uint16_t wn;     ///< the week number since GPS has been installed
384*a25439b6SCy Schubert   uint32_t sec;    ///< the second of that week
385*a25439b6SCy Schubert   uint32_t tick;   ///< fractions of a second, 1/::RECEIVER_INFO::ticks_per_sec units
386*a25439b6SCy Schubert 
387c0b746e5SOllivier Robert } T_GPS;
388c0b746e5SOllivier Robert 
389c0b746e5SOllivier Robert 
390*a25439b6SCy Schubert /**
391*a25439b6SCy Schubert  * @brief Local date and time computed from GPS time
392*a25439b6SCy Schubert  *
393*a25439b6SCy Schubert  * The current number of leap seconds have to be added to get %UTC
394*a25439b6SCy Schubert  * from GPS time. Additional corrections could have been made according
395*a25439b6SCy Schubert  * to the time zone/daylight saving parameters ::TZDL defined by the user.
396*a25439b6SCy Schubert  * The status field can be checked to see which corrections
397*a25439b6SCy Schubert  * have actually been applied.
398*a25439b6SCy Schubert  *
399*a25439b6SCy Schubert  * @note Conversion from GPS time to %UTC and/or local time can only be
400*a25439b6SCy Schubert  * done if some valid ::UTC correction parameters are available in the
401*a25439b6SCy Schubert  * receiver's non-volatile memory.
402*a25439b6SCy Schubert  */
403*a25439b6SCy Schubert typedef struct
404*a25439b6SCy Schubert {
405*a25439b6SCy Schubert   int16_t year;           ///< year number, 0..9999
406*a25439b6SCy Schubert   int8_t month;           ///< month, 1..12
407*a25439b6SCy Schubert   int8_t mday;            ///< day of month, 1..31
408*a25439b6SCy Schubert   int16_t yday;           ///< day of year, 1..365, or 366 in case of leap year
409*a25439b6SCy Schubert   int8_t wday;            ///< day of week, 0..6 == Sun..Sat
410*a25439b6SCy Schubert   int8_t hour;            ///< hours, 0..23
411*a25439b6SCy Schubert   int8_t min;             ///< minutes, 0..59
412*a25439b6SCy Schubert   int8_t sec;             ///< seconds, 0..59, or 60 in case of inserted leap second
413*a25439b6SCy Schubert   int32_t frac;           ///< fractions of a second, 1/::RECEIVER_INFO::ticks_per_sec units
414*a25439b6SCy Schubert   int32_t offs_from_utc;  ///< local time offset from %UTC [sec]
415*a25439b6SCy Schubert   uint16_t status;        ///< status flags, see ::TM_GPS_STATUS_BIT_MASKS
416c0b746e5SOllivier Robert 
417*a25439b6SCy Schubert } TM_GPS;
418c0b746e5SOllivier Robert 
419c0b746e5SOllivier Robert 
420c0b746e5SOllivier Robert 
421*a25439b6SCy Schubert /**
422*a25439b6SCy Schubert  * @brief Status flag bits used to define ::TM_GPS_STATUS_BIT_MASKS
423*a25439b6SCy Schubert  *
424*a25439b6SCy Schubert  * These bits report info on the time conversion from GPS time to %UTC
425*a25439b6SCy Schubert  * and/or local time as well as device status info.
426*a25439b6SCy Schubert  *
427*a25439b6SCy Schubert  * @see ::TM_GPS_STATUS_BIT_MASKS
428*a25439b6SCy Schubert  */
429*a25439b6SCy Schubert enum TM_GPS_STATUS_BITS
430*a25439b6SCy Schubert {
431*a25439b6SCy Schubert   TM_BIT_UTC,          ///< %UTC correction has been made
432*a25439b6SCy Schubert   TM_BIT_LOCAL,        ///< %UTC has been converted to local time according to ::TZDL settings
433*a25439b6SCy Schubert   TM_BIT_DL_ANN,       ///< state of daylight saving is going to change
434*a25439b6SCy Schubert   TM_BIT_DL_ENB,       ///< daylight saving is in effect
435*a25439b6SCy Schubert   TM_BIT_LS_ANN,       ///< leap second pending
436*a25439b6SCy Schubert   TM_BIT_LS_ENB,       ///< current second is leap second
437*a25439b6SCy Schubert   TM_BIT_LS_ANN_NEG,   ///< set in addition to ::TM_BIT_LS_ANN if leap sec is negative
438*a25439b6SCy Schubert   TM_BIT_INVT,         ///< invalid time, e.g. if RTC battery bas been empty
439c0b746e5SOllivier Robert 
440*a25439b6SCy Schubert   TM_BIT_EXT_SYNC,     ///< synchronized externally
441*a25439b6SCy Schubert   TM_BIT_HOLDOVER,     ///< in holdover mode after previous synchronization
442*a25439b6SCy Schubert   TM_BIT_ANT_SHORT,    ///< antenna cable short circuited
443*a25439b6SCy Schubert   TM_BIT_NO_WARM,      ///< OCXO has not warmed up
444*a25439b6SCy Schubert   TM_BIT_ANT_DISCONN,  ///< antenna currently disconnected
445*a25439b6SCy Schubert   TM_BIT_SYN_FLAG,     ///< TIME_SYN output is low
446*a25439b6SCy Schubert   TM_BIT_NO_SYNC,      ///< time sync actually not verified
447*a25439b6SCy Schubert   TM_BIT_NO_POS        ///< position actually not verified, LOCK LED off
448*a25439b6SCy Schubert };
449c0b746e5SOllivier Robert 
450*a25439b6SCy Schubert 
451*a25439b6SCy Schubert /**
452*a25439b6SCy Schubert  * @brief Status flag masks used with ::TM_GPS::status
453*a25439b6SCy Schubert  *
454*a25439b6SCy Schubert  * These bits report info on the time conversion from GPS time to %UTC
455*a25439b6SCy Schubert  * and/or local time as well as device status info.
456*a25439b6SCy Schubert  *
457*a25439b6SCy Schubert  * @see ::TM_GPS_STATUS_BITS
458*a25439b6SCy Schubert  */
459*a25439b6SCy Schubert enum TM_GPS_STATUS_BIT_MASKS
460*a25439b6SCy Schubert {
461*a25439b6SCy Schubert   TM_UTC         = ( 1UL << TM_BIT_UTC ),          ///< see ::TM_BIT_UTC
462*a25439b6SCy Schubert   TM_LOCAL       = ( 1UL << TM_BIT_LOCAL ),        ///< see ::TM_BIT_LOCAL
463*a25439b6SCy Schubert   TM_DL_ANN      = ( 1UL << TM_BIT_DL_ANN ),       ///< see ::TM_BIT_DL_ANN
464*a25439b6SCy Schubert   TM_DL_ENB      = ( 1UL << TM_BIT_DL_ENB ),       ///< see ::TM_BIT_DL_ENB
465*a25439b6SCy Schubert   TM_LS_ANN      = ( 1UL << TM_BIT_LS_ANN ),       ///< see ::TM_BIT_LS_ANN
466*a25439b6SCy Schubert   TM_LS_ENB      = ( 1UL << TM_BIT_LS_ENB ),       ///< see ::TM_BIT_LS_ENB
467*a25439b6SCy Schubert   TM_LS_ANN_NEG  = ( 1UL << TM_BIT_LS_ANN_NEG ),   ///< see ::TM_BIT_LS_ANN_NEG
468*a25439b6SCy Schubert   TM_INVT        = ( 1UL << TM_BIT_INVT ),         ///< see ::TM_BIT_INVT
469*a25439b6SCy Schubert 
470*a25439b6SCy Schubert   TM_EXT_SYNC    = ( 1UL << TM_BIT_EXT_SYNC ),     ///< see ::TM_BIT_EXT_SYNC
471*a25439b6SCy Schubert   TM_HOLDOVER    = ( 1UL << TM_BIT_HOLDOVER ),     ///< see ::TM_BIT_HOLDOVER
472*a25439b6SCy Schubert   TM_ANT_SHORT   = ( 1UL << TM_BIT_ANT_SHORT ),    ///< see ::TM_BIT_ANT_SHORT
473*a25439b6SCy Schubert   TM_NO_WARM     = ( 1UL << TM_BIT_NO_WARM ),      ///< see ::TM_BIT_NO_WARM
474*a25439b6SCy Schubert   TM_ANT_DISCONN = ( 1UL << TM_BIT_ANT_DISCONN ),  ///< see ::TM_BIT_ANT_DISCONN
475*a25439b6SCy Schubert   TM_SYN_FLAG    = ( 1UL << TM_BIT_SYN_FLAG ),     ///< see ::TM_BIT_SYN_FLAG
476*a25439b6SCy Schubert   TM_NO_SYNC     = ( 1UL << TM_BIT_NO_SYNC ),      ///< see ::TM_BIT_NO_SYNC
477*a25439b6SCy Schubert   TM_NO_POS      = ( 1UL << TM_BIT_NO_POS )        ///< see ::TM_BIT_NO_POS
478*a25439b6SCy Schubert };
479*a25439b6SCy Schubert 
480*a25439b6SCy Schubert 
481*a25439b6SCy Schubert /**
482*a25439b6SCy Schubert  * @brief A structure used to transmit information on date and time
483*a25439b6SCy Schubert  *
484*a25439b6SCy Schubert  * This structure can be used to transfer the current time, in which
485*a25439b6SCy Schubert  * case the channel field has to be set to -1, or an event capture time
486*a25439b6SCy Schubert  * retrieved from the on-board FIFO, in which case the channel field
487*a25439b6SCy Schubert  * contains the index of the time capture input, e.g. 0 or 1.
488*a25439b6SCy Schubert  */
489*a25439b6SCy Schubert typedef struct
490*a25439b6SCy Schubert {
491*a25439b6SCy Schubert   int16_t channel;  ///< -1: the current on-board time; >= 0 the capture channel number
492*a25439b6SCy Schubert   T_GPS t;          ///< time in GPS scale and format
493*a25439b6SCy Schubert   TM_GPS tm;        ///< time converted to %UTC and/or local time according to ::TZDL settings
494*a25439b6SCy Schubert 
495c0b746e5SOllivier Robert } TTM;
496c0b746e5SOllivier Robert 
497c0b746e5SOllivier Robert 
498c0b746e5SOllivier Robert 
499c0b746e5SOllivier Robert /* Two types of variables used to store a position. Type XYZ is */
500c0b746e5SOllivier Robert /* used with a position in earth centered, earth fixed (ECEF) */
501c0b746e5SOllivier Robert /* coordinates whereas type LLA holds such a position converted */
502c0b746e5SOllivier Robert /* to geographic coordinates as defined by WGS84 (World Geodetic */
503c0b746e5SOllivier Robert /* System from 1984). */
504c0b746e5SOllivier Robert 
505*a25439b6SCy Schubert /**
506*a25439b6SCy Schubert  * @brief Sequence and number of components of a cartesian position
507*a25439b6SCy Schubert  */
508*a25439b6SCy Schubert enum XYZ_FIELDS { XP, YP, ZP, N_XYZ };  // x, y, z
509c0b746e5SOllivier Robert 
510*a25439b6SCy Schubert /**
511*a25439b6SCy Schubert  * @brief A position in cartesian coordinates
512*a25439b6SCy Schubert  *
513*a25439b6SCy Schubert  * Usually earth centered, earth fixed (ECEF) coordinates,
514*a25439b6SCy Schubert  * in [m].
515*a25439b6SCy Schubert  *
516*a25439b6SCy Schubert  * @note In the original code this is an array of double.
517*a25439b6SCy Schubert  *
518*a25439b6SCy Schubert  * @see ::XYZ_FIELDS
519*a25439b6SCy Schubert  */
520*a25439b6SCy Schubert typedef l_fp XYZ[N_XYZ];
521c0b746e5SOllivier Robert 
522c0b746e5SOllivier Robert 
523*a25439b6SCy Schubert /**
524*a25439b6SCy Schubert  * @brief Sequence and number of components of a geographic position
525*a25439b6SCy Schubert  */
526*a25439b6SCy Schubert enum LLA_FIELDS { LAT, LON, ALT, N_LLA };  /* latitude, longitude, altitude */
527c0b746e5SOllivier Robert 
528*a25439b6SCy Schubert /**
529*a25439b6SCy Schubert  * @brief A geographic position based on latitude, longitude, and altitude
530*a25439b6SCy Schubert  *
531*a25439b6SCy Schubert  * The geographic position associated to specific cartesian coordinates
532*a25439b6SCy Schubert  * depends on the characteristics of the ellipsoid used for the computation,
533*a25439b6SCy Schubert  * the so-called geographic datum. GPS uses the WGS84 (World Geodetic System
534*a25439b6SCy Schubert  * from 1984) ellipsoid by default.
535*a25439b6SCy Schubert  *
536*a25439b6SCy Schubert  * lon, lat in [rad], alt in [m]
537*a25439b6SCy Schubert  *
538*a25439b6SCy Schubert  * @note In the original code this is an array of double.
539*a25439b6SCy Schubert  *
540*a25439b6SCy Schubert  * @see ::LLA_FIELDS
541*a25439b6SCy Schubert  */
542*a25439b6SCy Schubert typedef l_fp LLA[N_LLA];
543c0b746e5SOllivier Robert 
544c0b746e5SOllivier Robert 
545*a25439b6SCy Schubert /**
546*a25439b6SCy Schubert  * @defgroup group_synth Synthesizer parameters
547*a25439b6SCy Schubert  *
548*a25439b6SCy Schubert  * Synthesizer frequency is expressed as a
549*a25439b6SCy Schubert  * four digit decimal number (freq) to be multiplied by 0.1 Hz and an
550*a25439b6SCy Schubert  * base 10 exponent (range). If the effective frequency is less than
551*a25439b6SCy Schubert  * 10 kHz its phase is synchronized corresponding to the variable phase.
552*a25439b6SCy Schubert  * Phase may be in a range from -360 deg to +360 deg with a resolution
553*a25439b6SCy Schubert  * of 0.1 deg, so the resulting numbers to be stored are in a range of
554*a25439b6SCy Schubert  * -3600 to +3600.
555*a25439b6SCy Schubert  *
556*a25439b6SCy Schubert  * Example:<br>
557*a25439b6SCy Schubert  * Assume the value of freq is 2345 (decimal) and the value of phase is 900.
558*a25439b6SCy Schubert  * If range == 0 the effective frequency is 234.5 Hz with a phase of +90 deg.
559*a25439b6SCy Schubert  * If range == 1 the synthesizer will generate a 2345 Hz output frequency
560*a25439b6SCy Schubert  * and so on.
561*a25439b6SCy Schubert  *
562*a25439b6SCy Schubert  * Limitations:<br>
563*a25439b6SCy Schubert  * If freq == 0 the synthesizer is disabled. If range == 0 the least
564*a25439b6SCy Schubert  * significant digit of freq is limited to 0, 3, 5 or 6. The resulting
565*a25439b6SCy Schubert  * frequency is shown in the examples below:
566*a25439b6SCy Schubert  *    - freq == 1230  -->  123.0 Hz
567*a25439b6SCy Schubert  *    - freq == 1233  -->  123 1/3 Hz (real 1/3 Hz, NOT 123.3 Hz)
568*a25439b6SCy Schubert  *    - freq == 1235  -->  123.5 Hz
569*a25439b6SCy Schubert  *    - freq == 1236  -->  123 2/3 Hz (real 2/3 Hz, NOT 123.6 Hz)
570*a25439b6SCy Schubert  *
571*a25439b6SCy Schubert  * If range == ::MAX_SYNTH_RANGE the value of freq must not exceed 1000, so
572*a25439b6SCy Schubert  * the output frequency is limited to 10 MHz (see ::MAX_SYNTH_FREQ_VAL).
573*a25439b6SCy Schubert  *
574*a25439b6SCy Schubert  * @{ */
575c0b746e5SOllivier Robert 
576*a25439b6SCy Schubert #define N_SYNTH_FREQ_DIGIT  4    ///< number of digits to edit
577*a25439b6SCy Schubert #define MAX_SYNTH_FREQ   1000    ///< if range == ::MAX_SYNTH_RANGE
578c0b746e5SOllivier Robert 
579c0b746e5SOllivier Robert #define MIN_SYNTH_RANGE     0
580c0b746e5SOllivier Robert #define MAX_SYNTH_RANGE     5
581*a25439b6SCy Schubert #define N_SYNTH_RANGE       ( MAX_SYNTH_RANGE - MIN_SYNTH_RANGE + 1 )
582*a25439b6SCy Schubert 
583*a25439b6SCy Schubert #define N_SYNTH_PHASE_DIGIT  4
584c0b746e5SOllivier Robert #define MAX_SYNTH_PHASE      3600
585c0b746e5SOllivier Robert 
586*a25439b6SCy Schubert 
587*a25439b6SCy Schubert #define MAX_SYNTH_FREQ_EDIT  9999  ///< max sequence of digits when editing
588*a25439b6SCy Schubert 
589*a25439b6SCy Schubert 
590*a25439b6SCy Schubert /**
591*a25439b6SCy Schubert  * @brief The maximum frequency that can be configured for the synthesizer
592*a25439b6SCy Schubert  */
593*a25439b6SCy Schubert #define MAX_SYNTH_FREQ_VAL   10000000UL     ///< 10 MHz
594*a25439b6SCy Schubert /*   == MAX_SYNTH_FREQ * 10^(MAX_SYNTH_RANGE-1) */
595*a25439b6SCy Schubert 
596*a25439b6SCy Schubert /**
597*a25439b6SCy Schubert  * @brief The synthesizer's phase is only be synchronized if the frequency is below this limit
598*a25439b6SCy Schubert  */
599*a25439b6SCy Schubert #define SYNTH_PHASE_SYNC_LIMIT   10000UL    ///< 10 kHz
600*a25439b6SCy Schubert 
601*a25439b6SCy Schubert /**
602*a25439b6SCy Schubert  * A Macro used to determine the position of the decimal point
603*a25439b6SCy Schubert  * when printing the synthesizer frequency as 4 digit value
604*a25439b6SCy Schubert  */
605*a25439b6SCy Schubert #define _synth_dp_pos_from_range( _r ) \
606*a25439b6SCy Schubert   ( ( ( N_SYNTH_RANGE - (_r) ) % ( N_SYNTH_FREQ_DIGIT - 1 ) ) + 1 )
607*a25439b6SCy Schubert 
608*a25439b6SCy Schubert /**
609*a25439b6SCy Schubert  * @brief Synthesizer frequency units
610*a25439b6SCy Schubert  *
611*a25439b6SCy Schubert  * An initializer for commonly displayed synthesizer frequency units
612*a25439b6SCy Schubert  * (::N_SYNTH_RANGE strings)
613*a25439b6SCy Schubert  */
614*a25439b6SCy Schubert #define DEFAULT_FREQ_RANGES \
615*a25439b6SCy Schubert {                           \
616*a25439b6SCy Schubert   "Hz",                     \
617*a25439b6SCy Schubert   "kHz",                    \
618*a25439b6SCy Schubert   "kHz",                    \
619*a25439b6SCy Schubert   "kHz",                    \
620*a25439b6SCy Schubert   "MHz",                    \
621*a25439b6SCy Schubert   "MHz",                    \
622*a25439b6SCy Schubert }
623*a25439b6SCy Schubert 
624*a25439b6SCy Schubert 
625*a25439b6SCy Schubert 
626*a25439b6SCy Schubert /**
627*a25439b6SCy Schubert  * @brief Synthesizer configuration parameters
628*a25439b6SCy Schubert  */
629*a25439b6SCy Schubert typedef struct
630*a25439b6SCy Schubert {
631*a25439b6SCy Schubert   int16_t freq;    ///< four digits used; scale: 0.1 Hz; e.g. 1234 -> 123.4 Hz
632*a25439b6SCy Schubert   int16_t range;   ///< scale factor for freq; 0..::MAX_SYNTH_RANGE
633*a25439b6SCy Schubert   int16_t phase;   ///< -::MAX_SYNTH_PHASE..+::MAX_SYNTH_PHASE; >0 -> pulses later
634*a25439b6SCy Schubert 
635c0b746e5SOllivier Robert } SYNTH;
636c0b746e5SOllivier Robert 
637*a25439b6SCy Schubert #define _mbg_swab_synth( _p )   \
638*a25439b6SCy Schubert {                               \
639*a25439b6SCy Schubert   _mbg_swab16( &(_p)->freq );   \
640*a25439b6SCy Schubert   _mbg_swab16( &(_p)->range );  \
641*a25439b6SCy Schubert   _mbg_swab16( &(_p)->phase );  \
642*a25439b6SCy Schubert }
643c0b746e5SOllivier Robert 
644c0b746e5SOllivier Robert 
645*a25439b6SCy Schubert /**
646*a25439b6SCy Schubert  * @brief Enumeration of synthesizer states
647*a25439b6SCy Schubert  */
648*a25439b6SCy Schubert enum SYNTH_STATES
649*a25439b6SCy Schubert {
650*a25439b6SCy Schubert   SYNTH_DISABLED,   ///< disbled by cfg, i.e. freq == 0.0
651*a25439b6SCy Schubert   SYNTH_OFF,        ///< not enabled after power-up
652*a25439b6SCy Schubert   SYNTH_FREE,       ///< enabled, but not synchronized
653*a25439b6SCy Schubert   SYNTH_DRIFTING,   ///< has initially been sync'd, but now running free
654*a25439b6SCy Schubert   SYNTH_SYNC,       ///< fully synchronized
655*a25439b6SCy Schubert   N_SYNTH_STATE     ///< the number of known states
656c0b746e5SOllivier Robert };
657c0b746e5SOllivier Robert 
658c0b746e5SOllivier Robert 
659*a25439b6SCy Schubert /**
660*a25439b6SCy Schubert  * @brief A structure used to report the synthesizer state
661*a25439b6SCy Schubert  */
662*a25439b6SCy Schubert typedef struct
663*a25439b6SCy Schubert {
664*a25439b6SCy Schubert   uint8_t state;     ///< state code as enumerated in ::SYNTH_STATES
665*a25439b6SCy Schubert   uint8_t flags;     ///< reserved, currently always 0
666c0b746e5SOllivier Robert 
667*a25439b6SCy Schubert } SYNTH_STATE;
668c0b746e5SOllivier Robert 
669*a25439b6SCy Schubert #define _mbg_swab_synth_state( _p )  _nop_macro_fnc()
670c0b746e5SOllivier Robert 
671*a25439b6SCy Schubert #define SYNTH_FLAG_PHASE_IGNORED  0x01
672*a25439b6SCy Schubert 
673*a25439b6SCy Schubert /** @} defgroup group_synth */
674*a25439b6SCy Schubert 
675*a25439b6SCy Schubert 
676*a25439b6SCy Schubert 
677*a25439b6SCy Schubert /**
678*a25439b6SCy Schubert  * @defgroup group_tzdl Time zone / daylight saving parameters
679*a25439b6SCy Schubert  *
680*a25439b6SCy Schubert  * Example: <br>
681*a25439b6SCy Schubert  * For automatic daylight saving enable/disable in Central Europe,
682*a25439b6SCy Schubert  * the variables are to be set as shown below: <br>
683*a25439b6SCy Schubert  *   - offs = 3600L           one hour from %UTC
684*a25439b6SCy Schubert  *   - offs_dl = 3600L        one additional hour if daylight saving enabled
685*a25439b6SCy Schubert  *   - tm_on = first Sunday from March 25, 02:00:00h ( year |= ::DL_AUTO_FLAG )
686*a25439b6SCy Schubert  *   - tm_off = first Sunday from October 25, 03:00:00h ( year |= ::DL_AUTO_FLAG )
687*a25439b6SCy Schubert  *   - name[0] == "CET  "     name if daylight saving not enabled
688*a25439b6SCy Schubert  *   - name[1] == "CEST "     name if daylight saving is enabled
689*a25439b6SCy Schubert  *
690*a25439b6SCy Schubert  * @{ */
691*a25439b6SCy Schubert 
692*a25439b6SCy Schubert /**
693*a25439b6SCy Schubert  * @brief The name of a time zone
694*a25439b6SCy Schubert  *
695*a25439b6SCy Schubert  * @note Up to 5 printable characters, plus trailing zero
696*a25439b6SCy Schubert  */
697*a25439b6SCy Schubert typedef char TZ_NAME[6];
698*a25439b6SCy Schubert 
699*a25439b6SCy Schubert /**
700*a25439b6SCy Schubert  * @brief Time zone / daylight saving parameters
701*a25439b6SCy Schubert  *
702*a25439b6SCy Schubert  * This structure is used to specify how a device converts on-board %UTC
703*a25439b6SCy Schubert  * to local time, including computation of beginning and end of daylight
704*a25439b6SCy Schubert  * saving time (DST), if required.
705*a25439b6SCy Schubert  *
706*a25439b6SCy Schubert  * @note The ::TZDL structure contains members of type ::TM_GPS to specify
707*a25439b6SCy Schubert  * the times for beginning and end of DST. However, the ::TM_GPS::frac,
708*a25439b6SCy Schubert  * ::TM_GPS::offs_from_utc, and ::TM_GPS::status fields of these ::TZDL::tm_on
709*a25439b6SCy Schubert  * and ::TZDL::tm_off members are ignored for the conversion to local time,
710*a25439b6SCy Schubert  * and thus should be 0.
711*a25439b6SCy Schubert  */
712*a25439b6SCy Schubert typedef struct
713*a25439b6SCy Schubert {
714*a25439b6SCy Schubert   int32_t offs;      ///< standard offset from %UTC to local time [sec]
715*a25439b6SCy Schubert   int32_t offs_dl;   ///< additional offset if daylight saving enabled [sec]
716*a25439b6SCy Schubert   TM_GPS tm_on;      ///< date/time when daylight saving starts
717*a25439b6SCy Schubert   TM_GPS tm_off;     ///< date/time when daylight saving ends
718*a25439b6SCy Schubert   TZ_NAME name[2];   ///< names without and with daylight saving enabled
719*a25439b6SCy Schubert 
720*a25439b6SCy Schubert } TZDL;
721*a25439b6SCy Schubert 
722*a25439b6SCy Schubert /**
723*a25439b6SCy Schubert  * @brief A flag indicating automatic computation of DST
724*a25439b6SCy Schubert  *
725*a25439b6SCy Schubert  * If this flag is or'ed to the year numbers in ::TZDL::tm_on and ::TZDL::tm_off
726*a25439b6SCy Schubert  * then daylight saving is computed automatically year by year.
727*a25439b6SCy Schubert  */
728*a25439b6SCy Schubert #define DL_AUTO_FLAG  0x8000
729*a25439b6SCy Schubert 
730*a25439b6SCy Schubert /** @} defgroup group_tzdl */
731*a25439b6SCy Schubert 
732*a25439b6SCy Schubert 
733*a25439b6SCy Schubert 
734*a25439b6SCy Schubert /**
735*a25439b6SCy Schubert  * @brief Antenna status and error at reconnect information
736*a25439b6SCy Schubert  *
737*a25439b6SCy Schubert  * The structure below reflects the status of the antenna,
738*a25439b6SCy Schubert  * the times of last disconnect/reconnect, and the board's
739*a25439b6SCy Schubert  * clock offset when it has synchronized again after the
740*a25439b6SCy Schubert  * disconnection interval.
741*a25439b6SCy Schubert  *
742*a25439b6SCy Schubert  * @note ::ANT_INFO::status changes back to ::ANT_RECONN only
743*a25439b6SCy Schubert  * after the antenna has been reconnected <b>and</b> the
744*a25439b6SCy Schubert  * receiver has re-synchronized to the satellite signal.
745*a25439b6SCy Schubert  * In this case ::ANT_INFO::delta_t reports the time offset
746*a25439b6SCy Schubert  * before resynchronization, i.e. how much the internal
747*a25439b6SCy Schubert  * time has drifted while the antenna was disconnected.
748*a25439b6SCy Schubert  */
749*a25439b6SCy Schubert typedef struct
750*a25439b6SCy Schubert {
751*a25439b6SCy Schubert   int16_t status;      ///< current status of antenna, see ::ANT_STATUS_CODES
752*a25439b6SCy Schubert   TM_GPS tm_disconn;   ///< time of antenna disconnect
753*a25439b6SCy Schubert   TM_GPS tm_reconn;    ///< time of antenna reconnect
754*a25439b6SCy Schubert   int32_t delta_t;     ///< clock offs at reconn. time in 1/::RECEIVER_INFO::ticks_per_sec units
755*a25439b6SCy Schubert 
756*a25439b6SCy Schubert } ANT_INFO;
757*a25439b6SCy Schubert 
758*a25439b6SCy Schubert 
759*a25439b6SCy Schubert /**
760*a25439b6SCy Schubert  * @brief Status code used with ::ANT_INFO::status
761*a25439b6SCy Schubert  */
762*a25439b6SCy Schubert enum ANT_STATUS_CODES
763*a25439b6SCy Schubert {
764*a25439b6SCy Schubert   ANT_INVALID,   ///< No other fields valid since antenna has not yet been disconnected
765*a25439b6SCy Schubert   ANT_DISCONN,   ///< Antenna is disconnected, tm_reconn and delta_t not yet set
766*a25439b6SCy Schubert   ANT_RECONN,    ///< Antenna has been disconnect, and receiver sync. after reconnect, so all fields valid
767*a25439b6SCy Schubert   N_ANT_STATUS_CODES  ///< the number of known status codes
768*a25439b6SCy Schubert };
769*a25439b6SCy Schubert 
770*a25439b6SCy Schubert 
771*a25439b6SCy Schubert 
772*a25439b6SCy Schubert /**
773*a25439b6SCy Schubert  * @brief Summary of configuration and health data of all satellites
774*a25439b6SCy Schubert  */
775*a25439b6SCy Schubert typedef struct
776*a25439b6SCy Schubert {
777*a25439b6SCy Schubert   CSUM csum;                  ///< checksum of the remaining bytes
778*a25439b6SCy Schubert   int16_t valid;              ///< flag data are valid
779*a25439b6SCy Schubert 
780*a25439b6SCy Schubert   T_GPS tot_51;               ///< time of transmission, page 51
781*a25439b6SCy Schubert   T_GPS tot_63;               ///< time of transmission, page 63
782*a25439b6SCy Schubert   T_GPS t0a;                  ///< complete reference time almanac
783*a25439b6SCy Schubert 
784*a25439b6SCy Schubert   CFG cfg[N_SVNO_GPS];        ///< 4 bit SV configuration code from page 63
785*a25439b6SCy Schubert   HEALTH health[N_SVNO_GPS];  ///< 6 bit SV health codes from pages 51, 63
786*a25439b6SCy Schubert 
787c0b746e5SOllivier Robert } CFGH;
788c0b746e5SOllivier Robert 
789c0b746e5SOllivier Robert 
790c0b746e5SOllivier Robert 
791*a25439b6SCy Schubert /**
792*a25439b6SCy Schubert  * @brief GPS %UTC correction parameters
793*a25439b6SCy Schubert  *
794*a25439b6SCy Schubert  * %UTC correction parameters basically as sent by the GPS satellites.
795*a25439b6SCy Schubert  *
796*a25439b6SCy Schubert  * The csum field is only used by the card's firmware to check the
797*a25439b6SCy Schubert  * consistency of the structure in non-volatile memory.
798*a25439b6SCy Schubert  *
799*a25439b6SCy Schubert  * The field labeled valid indicates if the parameter set is valid, i.e.
800*a25439b6SCy Schubert  * if it contains data received from the satellites.
801*a25439b6SCy Schubert  *
802*a25439b6SCy Schubert  * t0t, A0 and A1 contain fractional correction parameters for the current
803*a25439b6SCy Schubert  * GPS-%UTC time offset in addition to the whole seconds. This is evaluated
804*a25439b6SCy Schubert  * by the receivers' firmware to convert GPS time to %UTC time.
805*a25439b6SCy Schubert  *
806*a25439b6SCy Schubert  * The delta_tls field contains the current full seconds offset between
807*a25439b6SCy Schubert  * GPS time and %UTC, which corresponds to the number of leap seconds inserted
808*a25439b6SCy Schubert  * into the %UTC time scale since GPS was put into operation in January 1980.
809*a25439b6SCy Schubert  *
810*a25439b6SCy Schubert  * delta_tlfs holds the number of "future" leap seconds, i.e. the %UTC offset
811*a25439b6SCy Schubert  * after the next leap second event defined by WNlsf and DNt.
812*a25439b6SCy Schubert  *
813*a25439b6SCy Schubert  * The fields WNlsf and DNt specify the GPS week number and the day number
814*a25439b6SCy Schubert  * in that week for the end of which a leap second has been scheduled.
815*a25439b6SCy Schubert  *
816*a25439b6SCy Schubert  * @note: The satellites transmit WNlsf only as a signed 8 bit value, so it
817*a25439b6SCy Schubert  * can only define a point in time which is +/- 127 weeks off the current time.
818*a25439b6SCy Schubert  * The firmware tries to expand this based on the current week number, but
819*a25439b6SCy Schubert  * the result is ambiguous if the leap second occurs or occurred more
820*a25439b6SCy Schubert  * than 127 weeks in the future or past.
821*a25439b6SCy Schubert  *
822*a25439b6SCy Schubert  * So the leap second date should <b>only</b> be evaluated and displayed
823*a25439b6SCy Schubert  * in a user interface if the fields delta_tls and delta_tlsf have
824*a25439b6SCy Schubert  * different values, in which case there is indeed a leap second announcement
825*a25439b6SCy Schubert  * inside the +/- 127 week range.
826*a25439b6SCy Schubert  *
827*a25439b6SCy Schubert  * @note In the original code the type of A0 and A1 is double.
828*a25439b6SCy Schubert  */
829*a25439b6SCy Schubert typedef struct
830*a25439b6SCy Schubert {
831*a25439b6SCy Schubert   CSUM csum;          ///<  Checksum of the remaining bytes
832*a25439b6SCy Schubert   int16_t valid;      ///<  Flag indicating %UTC parameters are valid
833c0b746e5SOllivier Robert 
834*a25439b6SCy Schubert   T_GPS t0t;          ///<  Reference Time %UTC Parameters [wn|sec]
835*a25439b6SCy Schubert   l_fp A0;            ///<  +- Clock Correction Coefficient 0 [sec]
836*a25439b6SCy Schubert   l_fp A1;            ///<  +- Clock Correction Coefficient 1 [sec/sec]
837c0b746e5SOllivier Robert 
838*a25439b6SCy Schubert   uint16_t WNlsf;     ///<  Week number of nearest leap second
839*a25439b6SCy Schubert   int16_t DNt;        ///<  The day number at the end of which a leap second occurs
840*a25439b6SCy Schubert   int8_t delta_tls;   ///<  Current %UTC offset to GPS system time [sec]
841*a25439b6SCy Schubert   int8_t delta_tlsf;  ///<  Future %UTC offset to GPS system time after next leap second transition [sec]
842c0b746e5SOllivier Robert 
843c0b746e5SOllivier Robert } UTC;
844c0b746e5SOllivier Robert 
845c0b746e5SOllivier Robert 
846*a25439b6SCy Schubert /**
847*a25439b6SCy Schubert  * @brief GPS ASCII message
848*a25439b6SCy Schubert  */
849*a25439b6SCy Schubert typedef struct
850*a25439b6SCy Schubert {
851*a25439b6SCy Schubert   CSUM csum;       ///< checksum of the remaining bytes */
852*a25439b6SCy Schubert   int16_t valid;   ///< flag data are valid
853*a25439b6SCy Schubert   char s[23];      ///< 22 chars GPS ASCII message plus trailing zero
854c0b746e5SOllivier Robert 
855*a25439b6SCy Schubert } ASCII_MSG;
856c0b746e5SOllivier Robert 
857c0b746e5SOllivier Robert 
858*a25439b6SCy Schubert /**
859*a25439b6SCy Schubert  * @brief Ephemeris parameters of one specific satellite
860*a25439b6SCy Schubert  *
861*a25439b6SCy Schubert  * Needed to compute the position of a satellite at a given time with
862*a25439b6SCy Schubert  * high precision. Valid for an interval of 4 to 6 hours from start
863*a25439b6SCy Schubert  * of transmission.
864*a25439b6SCy Schubert  */
865*a25439b6SCy Schubert typedef struct
866*a25439b6SCy Schubert {
867*a25439b6SCy Schubert   CSUM csum;       ///<    checksum of the remaining bytes
868*a25439b6SCy Schubert   int16_t valid;   ///<    flag data are valid
869c0b746e5SOllivier Robert 
870*a25439b6SCy Schubert   HEALTH health;   ///<    health indication of transmitting SV      [---]
871*a25439b6SCy Schubert   IOD IODC;        ///<    Issue Of Data, Clock
872*a25439b6SCy Schubert   IOD IODE2;       ///<    Issue of Data, Ephemeris (Subframe 2)
873*a25439b6SCy Schubert   IOD IODE3;       ///<    Issue of Data, Ephemeris (Subframe 3)
874*a25439b6SCy Schubert   T_GPS tt;        ///<    time of transmission
875*a25439b6SCy Schubert   T_GPS t0c;       ///<    Reference Time Clock                      [---]
876*a25439b6SCy Schubert   T_GPS t0e;       ///<    Reference Time Ephemeris                  [---]
877c0b746e5SOllivier Robert 
878*a25439b6SCy Schubert   l_fp sqrt_A;     ///<    Square Root of semi-major Axis        [sqrt(m)]
879*a25439b6SCy Schubert   l_fp e;          ///<    Eccentricity                              [---]
880*a25439b6SCy Schubert   l_fp M0;         ///< +- Mean Anomaly at Ref. Time                 [rad]
881*a25439b6SCy Schubert   l_fp omega;      ///< +- Argument of Perigee                       [rad]
882*a25439b6SCy Schubert   l_fp OMEGA0;     ///< +- Longit. of Asc. Node of orbit plane       [rad]
883*a25439b6SCy Schubert   l_fp OMEGADOT;   ///< +- Rate of Right Ascension               [rad/sec]
884*a25439b6SCy Schubert   l_fp deltan;     ///< +- Mean Motion Diff. from computed value [rad/sec]
885*a25439b6SCy Schubert   l_fp i0;         ///< +- Inclination Angle                         [rad]
886*a25439b6SCy Schubert   l_fp idot;       ///< +- Rate of Inclination Angle             [rad/sec]
887*a25439b6SCy Schubert   l_fp crc;        ///< +- Cosine Corr. Term to Orbit Radius           [m]
888*a25439b6SCy Schubert   l_fp crs;        ///< +- Sine Corr. Term to Orbit Radius             [m]
889*a25439b6SCy Schubert   l_fp cuc;        ///< +- Cosine Corr. Term to Arg. of Latitude     [rad]
890*a25439b6SCy Schubert   l_fp cus;        ///< +- Sine Corr. Term to Arg. of Latitude       [rad]
891*a25439b6SCy Schubert   l_fp cic;        ///< +- Cosine Corr. Term to Inclination Angle    [rad]
892*a25439b6SCy Schubert   l_fp cis;        ///< +- Sine Corr. Term to Inclination Angle      [rad]
893c0b746e5SOllivier Robert 
894*a25439b6SCy Schubert   l_fp af0;        ///< +- Clock Correction Coefficient 0            [sec]
895*a25439b6SCy Schubert   l_fp af1;        ///< +- Clock Correction Coefficient 1        [sec/sec]
896*a25439b6SCy Schubert   l_fp af2;        ///< +- Clock Correction Coefficient 2      [sec/sec^2]
897*a25439b6SCy Schubert   l_fp tgd;        ///< +- estimated group delay differential        [sec]
898c0b746e5SOllivier Robert 
899*a25439b6SCy Schubert   uint16_t URA;    ///<    predicted User Range Accuracy
900c0b746e5SOllivier Robert 
901*a25439b6SCy Schubert   uint8_t L2code;  ///<    code on L2 channel                         [---]
902*a25439b6SCy Schubert   uint8_t L2flag;  ///<    L2 P data flag                             [---]
903c0b746e5SOllivier Robert 
904c0b746e5SOllivier Robert } EPH;
905c0b746e5SOllivier Robert 
906c0b746e5SOllivier Robert 
907c0b746e5SOllivier Robert 
908*a25439b6SCy Schubert /**
909*a25439b6SCy Schubert  * @brief Almanac parameters of one specific satellite
910*a25439b6SCy Schubert  *
911*a25439b6SCy Schubert  * A reduced precision set of parameters used to check if a satellite
912*a25439b6SCy Schubert  * is in view at a given time. Valid for an interval of more than 7 days
913*a25439b6SCy Schubert  * from start of transmission.
914*a25439b6SCy Schubert  */
915*a25439b6SCy Schubert typedef struct
916*a25439b6SCy Schubert {
917*a25439b6SCy Schubert   CSUM csum;       ///<    checksum of the remaining bytes
918*a25439b6SCy Schubert   int16_t valid;   ///<    flag data are valid
919c0b746e5SOllivier Robert 
920*a25439b6SCy Schubert   HEALTH health;   ///<                                               [---]
921*a25439b6SCy Schubert   T_GPS t0a;       ///<    Reference Time Almanac                     [sec]
922c0b746e5SOllivier Robert 
923*a25439b6SCy Schubert   l_fp sqrt_A;     ///<    Square Root of semi-major Axis         [sqrt(m)]
924*a25439b6SCy Schubert   l_fp e;          ///<    Eccentricity                               [---]
925*a25439b6SCy Schubert 
926*a25439b6SCy Schubert   l_fp M0;         ///< +- Mean Anomaly at Ref. Time                  [rad]
927*a25439b6SCy Schubert   l_fp omega;      ///< +- Argument of Perigee                        [rad]
928*a25439b6SCy Schubert   l_fp OMEGA0;     ///< +- Longit. of Asc. Node of orbit plane        [rad]
929*a25439b6SCy Schubert   l_fp OMEGADOT;   ///< +- Rate of Right Ascension                [rad/sec]
930*a25439b6SCy Schubert   l_fp deltai;     ///< +-                                            [rad]
931*a25439b6SCy Schubert   l_fp af0;        ///< +- Clock Correction Coefficient 0             [sec]
932*a25439b6SCy Schubert   l_fp af1;        ///< +- Clock Correction Coefficient 1         [sec/sec]
933*a25439b6SCy Schubert 
934c0b746e5SOllivier Robert } ALM;
935c0b746e5SOllivier Robert 
936c0b746e5SOllivier Robert 
937c0b746e5SOllivier Robert 
938*a25439b6SCy Schubert /**
939*a25439b6SCy Schubert  * @brief Ionospheric correction parameters
940*a25439b6SCy Schubert  */
941*a25439b6SCy Schubert typedef struct
942*a25439b6SCy Schubert {
943*a25439b6SCy Schubert   CSUM csum;       ///<    checksum of the remaining bytes
944*a25439b6SCy Schubert   int16_t valid;   ///<    flag data are valid
945c0b746e5SOllivier Robert 
946*a25439b6SCy Schubert   l_fp alpha_0;    ///<    Ionosph. Corr. Coeff. Alpha 0              [sec]
947*a25439b6SCy Schubert   l_fp alpha_1;    ///<    Ionosph. Corr. Coeff. Alpha 1          [sec/deg]
948*a25439b6SCy Schubert   l_fp alpha_2;    ///<    Ionosph. Corr. Coeff. Alpha 2        [sec/deg^2]
949*a25439b6SCy Schubert   l_fp alpha_3;    ///<    Ionosph. Corr. Coeff. Alpha 3        [sec/deg^3]
950c0b746e5SOllivier Robert 
951*a25439b6SCy Schubert   l_fp beta_0;     ///<    Ionosph. Corr. Coeff. Beta 0               [sec]
952*a25439b6SCy Schubert   l_fp beta_1;     ///<    Ionosph. Corr. Coeff. Beta 1           [sec/deg]
953*a25439b6SCy Schubert   l_fp beta_2;     ///<    Ionosph. Corr. Coeff. Beta 2         [sec/deg^2]
954*a25439b6SCy Schubert   l_fp beta_3;     ///<    Ionosph. Corr. Coeff. Beta 3         [sec/deg^3]
955c0b746e5SOllivier Robert 
956c0b746e5SOllivier Robert } IONO;
957c0b746e5SOllivier Robert 
958*a25439b6SCy Schubert 
959*a25439b6SCy Schubert 
960*a25439b6SCy Schubert void mbg_tm_str (char **, TM_GPS *, int, int);
9612b15cb3dSCy Schubert void mbg_tgps_str (char **, T_GPS *, int);
9622b15cb3dSCy Schubert void get_mbg_header (unsigned char **, GPS_MSG_HDR *);
9632b15cb3dSCy Schubert void put_mbg_header (unsigned char **, GPS_MSG_HDR *);
9642b15cb3dSCy Schubert void get_mbg_sw_rev (unsigned char **, SW_REV *);
9652b15cb3dSCy Schubert void get_mbg_ascii_msg (unsigned char **, ASCII_MSG *);
9662b15cb3dSCy Schubert void get_mbg_svno (unsigned char **, SVNO *);
9672b15cb3dSCy Schubert void get_mbg_health (unsigned char **, HEALTH *);
9682b15cb3dSCy Schubert void get_mbg_cfg (unsigned char **, CFG *);
9692b15cb3dSCy Schubert void get_mbg_tgps (unsigned char **, T_GPS *);
970*a25439b6SCy Schubert void get_mbg_tm (unsigned char **, TM_GPS *);
9712b15cb3dSCy Schubert void get_mbg_ttm (unsigned char **, TTM *);
9722b15cb3dSCy Schubert void get_mbg_synth (unsigned char **, SYNTH *);
9732b15cb3dSCy Schubert void get_mbg_tzdl (unsigned char **, TZDL *);
9742b15cb3dSCy Schubert void get_mbg_antinfo (unsigned char **, ANT_INFO *);
9752b15cb3dSCy Schubert void get_mbg_cfgh (unsigned char **, CFGH *);
9762b15cb3dSCy Schubert void get_mbg_utc (unsigned char **, UTC *);
9772b15cb3dSCy Schubert void get_mbg_lla (unsigned char **, LLA);
9782b15cb3dSCy Schubert void get_mbg_xyz (unsigned char **, XYZ);
9792b15cb3dSCy Schubert void get_mbg_portparam (unsigned char **, PORT_PARM *);
9802b15cb3dSCy Schubert void get_mbg_eph (unsigned char **, EPH *);
9812b15cb3dSCy Schubert void get_mbg_alm (unsigned char **, ALM *);
9822b15cb3dSCy Schubert void get_mbg_iono (unsigned char **, IONO *);
983c0b746e5SOllivier Robert 
984*a25439b6SCy Schubert CSUM mbg_csum (unsigned char *, unsigned int);
985c0b746e5SOllivier Robert 
986c0b746e5SOllivier Robert #endif
987c0b746e5SOllivier Robert /*
988ea906c41SOllivier Robert  * History:
989ea906c41SOllivier Robert  *
990c0b746e5SOllivier Robert  * mbg_gps166.h,v
991ea906c41SOllivier Robert  * Revision 4.7  2006/06/22 18:41:43  kardel
992ea906c41SOllivier Robert  * clean up signedness (gcc 4)
993ea906c41SOllivier Robert  *
994ea906c41SOllivier Robert  * Revision 4.6  2005/10/07 22:11:56  kardel
995ea906c41SOllivier Robert  * bounded buffer implementation
996ea906c41SOllivier Robert  *
997ea906c41SOllivier Robert  * Revision 4.5.2.1  2005/09/25 10:23:48  kardel
998ea906c41SOllivier Robert  * support bounded buffers
999ea906c41SOllivier Robert  *
1000ea906c41SOllivier Robert  * Revision 4.5  2005/06/25 10:58:45  kardel
1001ea906c41SOllivier Robert  * add missing log keywords
1002ea906c41SOllivier Robert  *
1003c0b746e5SOllivier Robert  * Revision 4.1  1998/06/12 15:07:30  kardel
1004c0b746e5SOllivier Robert  * fixed prototyping
1005c0b746e5SOllivier Robert  *
1006c0b746e5SOllivier Robert  * Revision 4.0  1998/04/10 19:50:42  kardel
1007c0b746e5SOllivier Robert  * Start 4.0 release version numbering
1008c0b746e5SOllivier Robert  *
1009c0b746e5SOllivier Robert  * Revision 1.1  1998/04/10 19:27:34  kardel
1010c0b746e5SOllivier Robert  * initial NTP VERSION 4 integration of PARSE with GPS166 binary support
1011c0b746e5SOllivier Robert  *
1012c0b746e5SOllivier Robert  * Revision 1.1  1997/10/06 20:55:38  kardel
1013c0b746e5SOllivier Robert  * new parse structure
1014c0b746e5SOllivier Robert  *
1015c0b746e5SOllivier Robert  */
1016