xref: /freebsd/contrib/ntp/ntpd/jupiter.h (revision 6990ffd8a95caaba6858ad44ff1b3157d1efba8f)
1 /* @(#) $Header: /cvs/ntp/ntpd/jupiter.h,v 1.1.1.1 1999/05/26 00:48:19 stenn Exp $ (LBL) */
2 
3 /*
4  * Rockwell Jupiter GPS receiver definitions
5  *
6  * This is all based on the "Zodiac GPS Receiver Family Designer's
7  * Guide" (dated 12/96)
8  */
9 
10 #define JUPITER_SYNC		0x81ff	/* sync word (book says 0xff81 !?!?) */
11 #define JUPITER_ALL		0xffff	/* disable all output messages */
12 
13 /* Output messages (sent by the Jupiter board) */
14 #define JUPITER_O_GPOS		1000	/* geodetic position status */
15 #define JUPITER_O_EPOS		1001	/* ECEF position status */
16 #define JUPITER_O_CHAN		1002	/* channel summary */
17 #define JUPITER_O_VIS		1003	/* visible satellites */
18 #define JUPITER_O_DGPS		1005	/* differential GPS status */
19 #define JUPITER_O_MEAS		1007	/* channel measurement */
20 #define JUPITER_O_ID		1011	/* receiver id */
21 #define JUPITER_O_USER		1012	/* user-settings output */
22 #define JUPITER_O_TEST		1100	/* built-in test results */
23 #define JUPITER_O_MARK		1102	/* measurement time mark */
24 #define JUPITER_O_PULSE		1108	/* UTC time mark pulse output */
25 #define JUPITER_O_PORT		1130	/* serial port com parameters in use */
26 #define JUPITER_O_EUP		1135	/* EEPROM update */
27 #define JUPITER_O_ESTAT		1136	/* EEPROM status */
28 
29 /* Input messages (sent to the Jupiter board) */
30 #define JUPITER_I_PVTINIT	1200	/* geodetic position and velocity */
31 #define JUPITER_I_USER		1210	/* user-defined datum */
32 #define JUPITER_I_MAPSEL	1211	/* map datum select */
33 #define JUPITER_I_ELEV		1212	/* satellite elevation mask control */
34 #define JUPITER_I_CAND		1213	/* satellite candidate select */
35 #define JUPITER_I_DGPS		1214	/* differential GPS control */
36 #define JUPITER_I_COLD		1216	/* cold start control */
37 #define JUPITER_I_VALID		1217	/* solution validity criteria */
38 #define JUPITER_I_ALT		1219	/* user-entered altitude input */
39 #define JUPITER_I_PLAT		1220	/* application platform control */
40 #define JUPITER_I_NAV		1221	/* nav configuration */
41 #define JUPITER_I_TEST		1300	/* preform built-in test command */
42 #define JUPITER_I_RESTART	1303	/* restart command */
43 #define JUPITER_I_PORT		1330	/* serial port com parameters */
44 #define JUPITER_I_PROTO		1331	/* message protocol control */
45 #define JUPITER_I_RDGPS		1351	/* raw DGPS RTCM SC-104 data */
46 
47 struct jheader {
48 	u_short sync;		/* (JUPITER_SYNC) */
49 	u_short id;		/* message id */
50 	u_short len;		/* number of data short wordss (w/o cksum) */
51 	u_char reqid;		/* JUPITER_REQID_MASK bits available as id */
52 	u_char flags;		/* flags */
53 	u_short hsum;		/* header cksum */
54 };
55 
56 #define JUPITER_REQID_MASK	0x3f	/* bits available as id */
57 #define JUPITER_FLAG_NAK	0x01	/* negative acknowledgement */
58 #define JUPITER_FLAG_ACK	0x02	/* acknowledgement */
59 #define JUPITER_FLAG_REQUEST	0x04	/* request ACK or NAK */
60 #define JUPITER_FLAG_QUERY	0x08	/* request one shot output message */
61 #define JUPITER_FLAG_LOG	0x20	/* request periodic output message */
62 #define JUPITER_FLAG_CONN	0x40	/* enable periodic message */
63 #define JUPITER_FLAG_DISC	0x80	/* disable periodic message */
64 
65 #define JUPITER_H_FLAG_BITS \
66     "\020\1NAK\2ACK\3REQUEST\4QUERY\5MBZ\6LOG\7CONN\10DISC"
67 
68 /* Log request messages (data payload when using JUPITER_FLAG_LOG) */
69 struct jrequest {
70 	u_short trigger;		/* if 0, trigger on time trigger on
71 					   update (e.g. new almanac) */
72 	u_short interval;		/* frequency in seconds */
73 	u_short offset;			/* offset into minute */
74 	u_short dsum;			/* checksum */
75 };
76 
77 /* JUPITER_O_GPOS (1000) */
78 struct jgpos {
79 	u_short stime[2];		/* set time (10 ms ticks) */
80 	u_short seq;			/* sequence number */
81 	u_short sseq;			/* sat measurement sequence number */
82 	u_short navval;			/* navigation soltuion validity */
83 	u_short navtype;		/* navigation solution type */
84 	u_short nmeas;			/* # of measurements used in solution */
85 	u_short polar;			/* if 1 then polar navigation */
86 	u_short gweek;			/* GPS week number */
87 	u_short sweek[2];		/* GPS seconds into week */
88 	u_short nsweek[2];		/* GPS nanoseconds into second */
89 	u_short utcday;			/* 1 to 31 */
90 	u_short utcmon;			/* 1 to 12 */
91 	u_short utcyear;		/* 1980 to 2079 */
92 	u_short utchour;		/* 0 to 23 */
93 	u_short utcmin;			/* 0 to 59 */
94 	u_short utcsec;			/* 0 to 59 */
95 	u_short utcnsec[2];		/* 0 to 999999999 */
96 	u_short lat[2];			/* latitude (radians) */
97 	u_short lon[2];			/* longitude (radians) */
98 	u_short height[2];		/* height (meters) */
99 	u_short gsep;			/* geoidal separation */
100 	u_short speed[2];		/* ground speed (meters/sec) */
101 	u_short course;			/* true course (radians) */
102 	u_short mvar;
103 	u_short climb;
104 	u_short mapd;
105 	u_short herr[2];
106 	u_short verr[2];
107 	u_short terr[2];
108 	u_short hverr;
109 	u_short bias[2];
110 	u_short biassd[2];
111 	u_short drift[2];
112 	u_short driftsd[2];
113 	u_short dsum;			/* checksum */
114 };
115 #define JUPITER_O_GPOS_NAV_NOALT	0x01	/* altitude used */
116 #define JUPITER_O_GPOS_NAV_NODGPS	0x02	/* no differential GPS */
117 #define JUPITER_O_GPOS_NAV_NOSAT	0x04	/* not enough satellites */
118 #define JUPITER_O_GPOS_NAV_MAXH		0x08	/* exceeded max EHPE */
119 #define JUPITER_O_GPOS_NAV_MAXV		0x10	/* exceeded max EVPE */
120 
121 /* JUPITER_O_CHAN (1002) */
122 struct jchan {
123 	u_short stime[2];		/* set time (10 ms ticks) */
124 	u_short seq;			/* sequence number */
125 	u_short sseq;			/* sat measurement sequence number */
126 	u_short gweek;			/* GPS week number */
127 	u_short sweek[2];		/* GPS seconds into week */
128 	u_short gpsns[2];		/* GPS nanoseconds from epoch */
129 	struct jchan2 {
130 		u_short flags;		/* flags */
131 		u_short prn;		/* satellite PRN */
132 		u_short chan;		/* channel number */
133 	} sat[12];
134 	u_short dsum;
135 };
136 
137 /* JUPITER_O_VIS (1003) */
138 struct jvis {
139 	u_short stime[2];		/* set time (10 ms ticks) */
140 	u_short seq;			/* sequence number */
141 	u_short gdop;			/* best possible GDOP */
142 	u_short pdop;			/* best possible PDOP */
143 	u_short hdop;			/* best possible HDOP */
144 	u_short vdop;			/* best possible VDOP */
145 	u_short tdop;			/* best possible TDOP */
146 	u_short nvis;			/* number of visible satellites */
147 	struct jvis2 {
148 		u_short prn;		/* satellite PRN */
149 		u_short azi;		/* satellite azimuth (radians) */
150 		u_short elev;		/* satellite elevation (radians) */
151 	} sat[12];
152 	u_short dsum;			/* checksum */
153 };
154 
155 /* JUPITER_O_ID (1011) */
156 struct jid {
157 	u_short stime[2];		/* set time (10 ms ticks) */
158 	u_short seq;			/* sequence number */
159 	char chans[20];			/* number of channels (ascii) */
160 	char vers[20];			/* software version (ascii) */
161 	char date[20];			/* software date (ascii) */
162 	char opts[20];			/* software options (ascii) */
163 	char reserved[20];
164 	u_short dsum;			/* checksum */
165 };
166 
167 /* JUPITER_O_USER (1012) */
168 struct juser {
169 	u_short stime[2];		/* set time (10 ms ticks) */
170 	u_short seq;			/* sequence number */
171 	u_short status;			/* operatinoal status */
172 	u_short coldtmo;		/* cold start time-out */
173 	u_short dgpstmo;		/* DGPS correction time-out*/
174 	u_short emask;			/* elevation mask */
175 	u_short selcand[2];		/* selected candidate */
176 	u_short solflags;		/* solution validity criteria */
177 	u_short nsat;			/* number of satellites in track */
178 	u_short herr[2];		/* minimum expected horizontal error */
179 	u_short verr[2];		/* minimum expected vertical error */
180 	u_short platform;		/* application platform */
181 	u_short dsum;			/* checksum */
182 };
183 
184 /* JUPITER_O_PULSE (1108) */
185 struct jpulse {
186 	u_short stime[2];		/* set time (10 ms ticks) */
187 	u_short seq;			/* sequence number */
188 	u_short reserved[5];
189 	u_short sweek[2];		/* GPS seconds into week */
190 	short offs;			/* GPS to UTC time offset (seconds) */
191 	u_short offns[2];		/* GPS to UTC offset (nanoseconds) */
192 	u_short flags;			/* flags */
193 	u_short dsum;			/* checksum */
194 };
195 #define JUPITER_O_PULSE_VALID		0x1	/* time mark validity */
196 #define JUPITER_O_PULSE_UTC		0x2	/* GPS/UTC sync */
197 
198 /* JUPITER_O_EUP (1135) */
199 struct jeup {
200 	u_short stime[2];		/* set time (10 ms ticks) */
201 	u_short seq;			/* sequence number */
202 	u_char dataid;			/* data id */
203 	u_char prn;			/* satellite PRN */
204 	u_short dsum;			/* checksum */
205 };
206 
207 /* JUPITER_I_RESTART (1303) */
208 struct jrestart {
209 	u_short seq;			/* sequence number */
210 	u_short flags;
211 	u_short dsum;			/* checksum */
212 };
213 #define JUPITER_I_RESTART_INVRAM	0x01
214 #define JUPITER_I_RESTART_INVEEPROM	0x02
215 #define JUPITER_I_RESTART_INVRTC	0x04
216 #define JUPITER_I_RESTART_COLD		0x80
217 
218 /* JUPITER_I_PVTINIT (1200) */
219 struct jpvtinit {
220 	u_short flags;
221 	u_short gweek;			/* GPS week number */
222 	u_short sweek[2];		/* GPS seconds into week */
223 	u_short utcday;			/* 1 to 31 */
224 	u_short utcmon;			/* 1 to 12 */
225 	u_short utcyear;		/* 1980 to 2079 */
226 	u_short utchour;		/* 0 to 23 */
227 	u_short utcmin;			/* 0 to 59 */
228 	u_short utcsec;			/* 0 to 59 */
229 	u_short lat[2];			/* latitude (radians) */
230 	u_short lon[2];			/* longitude (radians) */
231 	u_short height[2];		/* height (meters) */
232 	u_short speed[2];		/* ground speed (meters/sec) */
233 	u_short course;			/* true course (radians) */
234 	u_short climb;
235 	u_short dsum;
236 };
237 #define JUPITER_I_PVTINIT_FORCE		0x01
238 #define JUPITER_I_PVTINIT_GPSVAL	0x02
239 #define JUPITER_I_PVTINIT_UTCVAL	0x04
240 #define JUPITER_I_PVTINIT_POSVAL	0x08
241 #define JUPITER_I_PVTINIT_ALTVAL	0x10
242 #define JUPITER_I_PVTINIT_SPDVAL	0x12
243 #define JUPITER_I_PVTINIT_MAGVAL	0x14
244 #define JUPITER_I_PVTINIT_CLIMBVAL	0x18
245 
246 /* JUPITER_I_PLAT (1220) */
247 struct jplat {
248 	u_short seq;			/* sequence number */
249 	u_short platform;		/* application platform */
250 	u_short dsum;
251 };
252 #define JUPITER_I_PLAT_DEFAULT		0	/* default dynamics */
253 #define JUPITER_I_PLAT_LOW		2	/* pedestrian */
254 #define JUPITER_I_PLAT_MED		5	/* land (e.g. automobile) */
255 #define JUPITER_I_PLAT_HIGH		6	/* air */
256