mbgtools-lx  4.2.8
mbgstatus.c
Go to the documentation of this file.
1 
2 /**************************************************************************
3  *
4  * $Id: mbgstatus.c 1.21 2019/04/11 13:03:48 martin TRASH $
5  *
6  * Description:
7  * Main file for mbgstatus program which demonstrates how to
8  * access a Meinberg device via IOCTL calls and prints device
9  * information.
10  *
11  * -----------------------------------------------------------------------
12  * $Log: mbgstatus.c $
13  * Revision 1.21 2019/04/11 13:03:48 martin
14  * Message says 'Last leap second probably' instead of 'eventually'.
15  * Revision 1.20 2019/04/02 15:15:45 martin
16  * Also print raw GPS time in verbose mode.
17  * Removed obsolete debug code.
18  * Revision 1.19 2019/03/11 16:10:24 martin
19  * Als print memory mapped timestamp in verbose mode.
20  * Revision 1.18 2019/02/08 11:08:47 martin
21  * Also print EPLD name in verbose mode.
22  * Revision 1.17 2018/11/15 12:12:37 martin
23  * Individual MBG_MICRO_VERSION codes are now obsolete.
24  * Revision 1.16 2018/07/03 15:28:55 martin
25  * Use -L rather than -l to display unique names of installed devices
26  * Now use -l to list installed devices.
27  * Also read and print TTM in verbose mode.
28  * Use specific API call to read IRIG debug status.
29  * Revision 1.15 2017/12/21 15:57:43 martin
30  * Improved displaying of UTC/leap second parameters.
31  * Revision 1.14 2017/07/05 18:34:46 martin
32  * New way to maintain version information.
33  * Support build under Windows.
34  * Show many more details, at different verbosity levels.
35  * Use more functions from common library modules.
36  * Use codes and inline functions from mbgerror.h.
37  * Proper return codes and exit codes.
38  * Revision 1.13 2009/09/29 15:02:16 martin
39  * Updated version number to 3.4.0.
40  * Revision 1.12 2009/07/24 14:02:59 martin
41  * Display LAN and PTP status of PTP cards.
42  * Updated version number to 3.3.0.
43  * Revision 1.11 2009/06/19 14:20:36 martin
44  * Display raw IRIG time with TCR cards which support this.
45  * Revision 1.10 2009/06/16 08:21:08 martin
46  * Intermediate version 3.1.0a.
47  * Display IRIG debug status, if supported by the card.
48  * Revision 1.9 2009/03/20 11:35:41 martin
49  * Updated version number to 3.1.0.
50  * Updated copyright year to include 2009.
51  * Display signal source after signal level.
52  * Display GPS UTC parameter info, if supported by the card.
53  * Display IRIG control bits, if supported by the card.
54  * Revision 1.8 2008/12/22 12:48:18 martin
55  * Updated description, copyright, revision number and string.
56  * Use unified functions from toolutil module.
57  * Warn if a PCI Express device with unsafe IRQ support is detected.
58  * Account for signed irq_num.
59  * Accept device name(s) on the command line.
60  * Don't use printf() without format, which migth produce warnings
61  * with newer gcc versions.
62  * Revision 1.7 2007/07/24 09:33:52 martin
63  * Fixed display of port and IRQ resources.
64  * Updated copyright to include 2007.
65  * Revision 1.6 2006/03/10 12:38:22 martin
66  * Fixed printing of sign in print_position().
67  * Revision 1.5 2004/11/08 15:41:56 martin
68  * Modified formatted printing of date/time string.
69  * Using type casts to avoid compiler warnings.
70  * Revision 1.4 2003/07/30 08:16:39 martin
71  * Also displays oscillator DAC values for GPS.
72  * Revision 1.3 2003/07/08 15:38:57 martin
73  * Call mbg_find_devices().
74  * Account for swap_doubles() now being called inside
75  * the mbgdevio API functions.
76  * Show IRQ number assigned to a device.
77  * Revision 1.2 2003/04/25 10:28:05 martin
78  * Use new functions from mbgdevio library.
79  * New program version v2.1.
80  * Revision 1.1 2001/09/17 15:08:59 martin
81  *
82  **************************************************************************/
83 
84 // include Meinberg headers
85 #include <mbgdevio.h>
86 #include <mbgutil.h>
87 #include <mbgtime.h>
88 #include <pcpslstr.h>
89 #include <toolutil.h> // common utility functions
90 #include <lan_util.h>
91 #include <deviohlp.h>
92 #include <timeutil.h>
93 #include <str_util.h>
94 #include <nanotime.h>
95 
96 // include system headers
97 #include <stdio.h>
98 #include <stdlib.h>
99 
100 
101 #define MBG_FIRST_COPYRIGHT_YEAR 2001
102 #define MBG_LAST_COPYRIGHT_YEAR 0 // use current year by default
103 
104 static const char *pname = "mbgstatus";
105 
106 
107 static int loops;
108 static int list_only; // list only which devices are installed
109 static int list_only_unique_names; // list only the unique names of all devices
110 static long sleep_secs;
111 static long sleep_usecs;
112 static unsigned int verbose;
113 
117 
118 static int year_limit = 1990;
119 
121 static int invt_reason;
122 
123 static const char *wdays[7] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
124 
127 
128 
129 
130 static /*HDR*/
131 void show_invt_reason( void )
132 {
133  static const char fmt[] = "\n** Warning: %s\nThe command %s.\n";
134 
135  switch ( invt_reason )
136  {
137  case 2:
138  printf( fmt, DEFAULT_STR_IRIG_NOT_CFGD_EN,
139  "\"mbgirigcfg\" can be used to change the settings" );
140  break;
141 
142  case 1:
143  printf( fmt, DEFAULT_STR_IRIG_INVT_EN,
144  "\"mbgctrl DATE=...\" can be used to set the on-board date" );
145  break;
146 
147  } // switch
148 
149 } // show_invt_reason
150 
151 
152 
153 static /*HDR*/
154 void print_pcps_time( const char *s, const PCPS_TIME *tp, const char *tail )
155 {
156  const char *fmt = "%s";
157  char ws[256];
158 
159  if ( s )
160  printf( fmt, s );
161 
162  printf( fmt, pcps_date_time_str( ws, sizeof( ws ), tp, year_limit,
164 
165  if ( ( verbose > 0 ) && _pcps_time_is_read( tp ) )
166  printf( ", st: 0x%02lX", (ulong) tp->status );
167 
168  if ( tail )
169  printf( fmt, tail );
170 
171 } // print_pcps_time
172 
173 
174 
175 static /*HDR*/
176 void print_dms( const char *s, const DMS *p, const char *tail )
177 {
178  const char *fmt = "%s";
179 
180  printf( "%s %c %3i deg %02i min %06.3f sec",
181  s,
182  p->prefix,
183  p->deg,
184  p->min,
185  p->sec
186  );
187 
188  if ( tail )
189  printf( fmt, tail );
190 
191 } // print_dms
192 
193 
194 
195 static /*HDR*/
196 void print_position( const char *s, const POS *p, const char *tail )
197 {
198  const char *fmt = "%s";
199  double r2d = 180 / PI;
200 
201 
202  if ( s )
203  {
204  printf( fmt, s );
205 
206  if ( verbose )
207  printf( "\n" );
208  }
209 
210  if ( verbose > 1 )
211  {
212  printf( " x: %.0fm y: %.0fm z: %.0fm",
213  p->xyz[XP], p->xyz[YP], p->xyz[ZP] );
214 
215  if ( tail )
216  printf( fmt, tail );
217  }
218 
219  // LLA latitude and longitude are in radians, convert to degrees
220  printf( " lat: %+.4f lon: %+.4f alt: %.0fm",
221  p->lla[LAT] * r2d, p->lla[LON] * r2d, p->lla[ALT] );
222 
223  if ( tail )
224  printf( fmt, tail );
225 
226  if ( verbose )
227  {
228  print_dms( " latitude: ", &p->latitude, tail );
229  print_dms( " longitude:", &p->longitude, tail );
230  }
231 
232 } // print_position
233 
234 
235 
236 static /*HDR*/
237 void show_signal( MBG_DEV_HANDLE dh, const PCPS_DEV *pdev, int signal )
238 {
239  int ref_type;
240  int rc;
241 
242  ref_type = _pcps_ref_type( pdev );
243 
244  if ( ref_type >= N_PCPS_REF )
245  ref_type = PCPS_REF_NONE;
246 
247  printf( "Signal: %u%% (%s", signal * 100 / PCPS_SIG_MAX, ref_name[ref_type] );
248 
249  if ( _pcps_is_irig_rx( pdev ) )
250  {
253 
254  rc = mbg_get_irig_rx_info( dh, &irig_rx_info );
255 
256  if ( rc == MBG_SUCCESS )
257  {
258  int idx = irig_rx_info.settings.icode;
259 
260  if ( idx < N_ICODE_RX )
261  {
262  printf( " %s", icode_rx_names[idx] );
263 
264  if ( !( MSK_ICODE_RX_HAS_TZI & ( 1UL << idx ) ) )
265  {
266  if ( _pcps_has_ref_offs( pdev ) )
267  {
268  rc = mbg_get_ref_offs( dh, &ref_offs );
269 
270  if ( rc == MBG_SUCCESS )
271  {
272  int ref_offs_h = ref_offs / MINS_PER_HOUR;
273 
274  if ( abs( ref_offs_h ) > max_ref_offs_h )
275  printf( ", ** UTC offs not configured **" );
276  else
277  printf( ", UTC%+ih", ref_offs_h );
278  }
279  }
280  }
281  }
282  }
283  }
284  else
285  if ( _pcps_has_pzf( pdev ) )
286  printf( "/PZF" );
287 
288  printf( ")\n" );
289 
290 } // show_signal
291 
292 
293 
294 static /*HDR*/
295 void show_time_and_status( MBG_DEV_HANDLE dh, const PCPS_DEV *pdev, const char *tail )
296 {
297  const char status_fmt[] = "Status info: %s%s\n";
298  const char status_err[] = "*** ";
299  const char status_ok[] = "";
300  const char *info_err = ( _pcps_is_gps( pdev ) || _pcps_is_lwr( pdev ) ) ?
301  "ANTENNA FAULTY" : "NO INPUT SIGNAL";
302  const char info_ok[] = "Input signal available";
303  PCPS_TIME t;
304  PCPS_STATUS_STRS strs;
305  int signal;
306  int i;
307  int rc = mbg_get_time( dh, &t );
308 
309  if ( mbg_cond_err_msg( rc, "mbg_get_time" ) )
310  return;
311 
312 
313  print_pcps_time( "Date/time: ", &t, tail );
314 
315  if ( ( verbose > 0 ) && _pcps_has_hr_time( pdev ) )
316  {
317  PCPS_HR_TIME ht = { { 0 } };
318  char ws[80];
319 
320  rc = mbg_get_hr_time( dh, &ht );
321 
322  if ( mbg_cond_err_msg( rc, "mbg_get_hr_time" ) )
323  return;
324 
325  mbg_snprint_hr_time( ws, sizeof( ws ), &ht, 0 ); // raw timestamp?
326  printf( "Local HR time: %s", ws );
327 
328  if ( verbose > 0 )
329  printf( ", st: 0x%04lX", (ulong) ht.status );
330 
331  printf( "%s", tail );
332  }
333 
334  if ( ( verbose > 1 ) && _pcps_has_fast_hr_timestamp( pdev ) )
335  {
336  PCPS_TIME_STAMP ts;
337  char ws[80];
338 
339  rc = mbg_get_fast_hr_timestamp( dh, &ts );
340 
341  if ( mbg_cond_err_msg( rc, "mbg_get_fast_hr_timestamp" ) )
342  return;
343 
344  mbg_snprint_hr_tstamp( ws, sizeof( ws ), &ts, 0, 0 );
345 
346  printf( "Fast MM time: %s", ws );
347  printf( "%s", tail );
348  }
349 
350  if ( ( verbose > 1 ) && _pcps_is_gps( pdev ) )
351  {
352  TTM ttm = { 0 };
353  char ws[80];
354  int n;
355 
356  rc = mbg_get_gps_time( dh, &ttm );
357 
358  if ( mbg_cond_err_msg( rc, "mbg_get_gps_time" ) )
359  return;
360 
361  n = pcps_str_tm_gps_date_time( ws, sizeof( ws ), &ttm.tm );
362  n += snprint_utc_offs( &ws[n], sizeof( ws ) - n, " UTC", ttm.tm.offs_from_utc );
363 
364  printf( "TTM time: %s", ws );
365  printf( ", TTM st: 0x%04X", ttm.tm.status );
366  printf( "%s", tail );
367 
368  printf( "Raw GPS time: wn %u|%06lu.%07lu s", (unsigned) ttm.t.wn,
369  (ulong) ttm.t.sec, (ulong) ttm.t.tick );
370  printf( "%s", tail );
371  }
372 
373  signal = t.signal - PCPS_SIG_BIAS;
374 
375  if ( signal < 0 )
376  signal = 0;
377  else
378  if ( signal > PCPS_SIG_MAX )
379  signal = PCPS_SIG_MAX;
380 
381  if ( _pcps_has_signal( pdev ) )
382  show_signal( dh, pdev, signal );
383 
384  if ( _pcps_has_pzf( pdev ) )
385  {
386  mbg_show_pzf_corr_info( dh, 0 );
387  printf( "\n" );
388  }
389 
390  if ( verbose && _pcps_has_irig_time( pdev ) )
391  {
392  PCPS_IRIG_TIME it;
393 
394  rc = mbg_get_irig_time( dh, &it );
395 
396  if ( !mbg_cond_err_msg( rc, "mbg_get_irig_time" ) )
397  printf( "Raw IRIG time: yday %u, %02u:%02u:%02u\n",
398  it.yday, it.hour, it.min, it.sec );
399  }
400 
401  printf( status_fmt,
402  ( signal < PCPS_SIG_ERR ) ? status_err : status_ok,
403  ( signal < PCPS_SIG_ERR ) ? info_err : info_ok );
404 
405  // Evaluate the status code and setup status messages.
407  _pcps_is_gps( pdev ), &strs );
408 
409  // Print the status messages.
410  for ( i = 0; i < N_PCPS_STATUS_STR; i++ )
411  {
412  PCPS_STATUS_STR *pstr = &strs.s[i];
413  if ( pstr->cp )
414  printf( status_fmt,
415  pstr->is_err ? status_err : status_ok,
416  pstr->cp );
417  }
418 
419  invt_reason = 0;
420 
421  if ( _pcps_is_irig_rx( pdev ) && ( t.status & PCPS_INVT ) )
422  {
424 
425  rc = mbg_get_ref_offs( dh, &ref_offs );
426 
427  if ( !mbg_cond_err_msg( rc, "mbg_get_ref_offs" ) )
428  {
429  if ( _pcps_ref_offs_out_of_range( ref_offs ) )
430  invt_reason = 2;
431  else
432  invt_reason = 1;
433  }
434  }
435 
436 } // show_time_and_status
437 
438 
439 
440 static /*HDR*/
441 void show_sync_time( MBG_DEV_HANDLE dh, const char *tail )
442 {
443  PCPS_TIME t;
444  int rc = mbg_get_sync_time( dh, &t );
445 
446  if ( mbg_cond_err_msg( rc, "mbg_get_sync_time" ) )
447  return;
448 
449  print_pcps_time( "Last sync: ", &t, tail );
450 
451 } // show_sync_time
452 
453 
454 
455 static /*HDR*/
456 void show_ext_stat_info( MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev, const char *tail )
457 {
458  const char *fmt = "%s";
459  RECEIVER_INFO ri = { 0 };
460  ALL_GNSS_INFO agi = { { 0 } };
461  GNSS_SAT_INFO *p_gsi;
462  char ws[80];
463  const char *cp;
464  int i;
465  int rc;
466 
467  // first collect all information
468 
469  rc = mbg_setup_receiver_info( dh, p_dev, &ri );
470 
471  if ( mbg_cond_err_msg( rc, "mbg_setup_receiver_info" ) )
472  return;
473 
474  if ( mbg_rc_is_success( mbg_chk_dev_is_gps( dh ) ) )
475  {
476  rc = mbg_chk_get_all_gnss_info( dh, &agi );
477 
478  if ( mbg_cond_err_msg( rc, "mbg_chk_get_gnss_info" ) )
479  return;
480  }
481 
482  // now print information
483 
484  if ( verbose )
485  {
486  printf( "Feature mask: 0x%08lX\n", (ulong) ri.features );
487 
488  if ( verbose > 2 )
489  printf( "EPLD name: \"%s\"\n", ri.epld_name );
490  }
491 
492  if ( _pcps_has_stat_info( p_dev ) )
493  {
494  if ( _pcps_has_stat_info_mode( p_dev ) )
495  {
496  switch ( agi.stat_info.mode )
497  {
498  case AUTO_166: cp = "Normal Operation"; break;
499  case WARM_166: cp = "Warm Boot"; break;
500  case COLD_166: cp = "Cold Boot"; break;
501 
502  default: // This should never happen!
503  snprintf_safe( ws, sizeof( ws ), "%s mode of operation: %02Xh",
504  str_unknown, agi.stat_info.mode );
505  cp = ws;
506 
507  } // switch
508 
509  printf( "%s", cp );
510  }
511  }
512 
513  if ( agi.n_gnss_supp )
514  {
515  #if defined( DEBUG ) // TODO
516  int must_print_sv_list = _pcps_has_stat_info_svs( p_dev ) && verbose;
517  #else
518  int must_print_sv_list = _pcps_is_gnss( p_dev ) && verbose;
519  #endif
520  int print_multi_lines = ( agi.n_gnss_supp > 1 ) || must_print_sv_list;
521 
522  // print multiple lines
523  // otherwise append to line
524  printf( print_multi_lines ? ":\n" : ", " );
525 
526  for ( i = 0; i < agi.n_gnss_supp; i++ )
527  {
528  static const char * const gnss_type_names[N_GNSS_TYPES] = GNSS_TYPE_STRS;
529  int gnss_type;
530 
531  p_gsi = &agi.gnss_sat_info_idx[i].gnss_sat_info;
532  gnss_type = p_gsi->gnss_type;
533 
534  if ( gnss_type >= N_GNSS_TYPES )
535  {
536  mbg_snprintf( ws, sizeof( ws ), "(%s GNSS type %i): ", str_unknown, gnss_type );
537  cp = ws;
538  }
539  else
540  cp = gnss_type_names[gnss_type];
541 
542  if ( print_multi_lines )
543  printf( " " );
544 
545  if ( agi.gnss_mode_info.settings.gnss_set & ( 1UL << gnss_type ) )
546  {
547  printf( "%i %s sats tracked, %i expected to be visible\n", p_gsi->good_svs, cp, p_gsi->svs_in_view );
548 
549  if ( must_print_sv_list )
550  {
551  int sat_idx;
552 
553  for ( sat_idx = 0; sat_idx < MAX_USED_SATS; sat_idx++ )
554  {
555  int sat_num = p_gsi->svs[sat_idx];
556 
557  #if !defined( DEBUG )
558  if ( sat_num == 0 )
559  break;
560  #endif
561 
562  printf( "%s%i", ( sat_idx == 0 ) ? " Sats: " : ", ", sat_num );
563  }
564 
565  if ( sat_idx ) // the satellite list has been printed
566  printf( "\n" );
567  }
568  }
569  else
570  printf( "%s reception disabled by configuration\n", cp );
571  }
572  }
573 
574  if ( verbose )
575  {
576  printf( "Osc type: %s", osc_name[( ri.osc_type < N_GPS_OSC ) ? ri.osc_type : GPS_OSC_UNKNOWN] );
577 
578  if ( _pcps_has_stat_info( p_dev ) )
579  {
580  printf( ", DAC cal: %+i, fine: %+i",
581  (int) ( agi.stat_info.dac_cal - OSC_DAC_BIAS ),
582  (int) ( agi.stat_info.dac_val - OSC_DAC_BIAS ) );
583  }
584 
585  puts( "" );
586  }
587 
588  if ( tail )
589  printf( fmt, tail );
590 
591 } // show_ext_stat_info
592 
593 
594 
595 static /*HDR*/
596 void show_gps_pos( MBG_DEV_HANDLE dh, const char *tail )
597 {
598  POS pos = { { 0 } };
599  int rc = mbg_get_gps_pos( dh, &pos );
600 
601  if ( mbg_cond_err_msg( rc, "mbg_get_gps_pos" ) )
602  return;
603 
604  print_position( "Receiver Position:", &pos, tail );
605 
606 } // show_gps_pos
607 
608 
609 
610 static /*HDR*/
611 void show_utc_info( MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev )
612 {
613  UTC utc = { 0 };
614  struct tm tm = { 0 };
615  char tmp_str[80];
616  long t_ls_long;
617  time_t t_ls;
618 
619  int rc = mbg_get_utc_parm( dh, &utc );
620 
621  if ( mbg_cond_err_msg( rc, "mbg_get_utc_parm" ) )
622  return;
623 
624 
625  if ( !utc.valid )
626  {
627  puts( "** UTC parameters not valid" );
628  goto out;
629  }
630 
631  t_ls_long = (long) utc.WNlsf * SECS_PER_WEEK
632  + (long) utc.DNt * SECS_PER_DAY
633  + GPS_SEC_BIAS - 1;
634  t_ls = cvt_to_time_t( t_ls_long );
635 
636  rc = mbg_gmtime( &tm, &t_ls );
637 
638  if ( mbg_rc_is_success( rc ) )
639  mbg_snprintf( tmp_str, sizeof( tmp_str ), "at UTC midnight at the end of %s, %04i-%02i-%02i",
640  wdays[tm.tm_wday], tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday );
641  else
642  snprint_gmtime_error( tmp_str, sizeof( tmp_str ), rc, t_ls, __func__ );
643 
644  if ( verbose > 1 )
645  {
646  printf( "UTC correction parameters:\n" );
647 
648  printf( " CSUM: %04X, valid: %04X\n", utc.csum, utc.valid );
649  printf( " t0t: %u|%u.%07u, A0: %g A1: %g\n",
650  utc.t0t.wn, utc.t0t.sec, utc.t0t.tick,
651  utc.A0, utc.A1 );
652  printf( " WNlsf: %u, DN: %u, offs: %i/%i\n",
653  utc.WNlsf, utc.DNt, utc.delta_tls, utc.delta_tlsf );
654  }
655 
656  if ( utc.delta_tls != utc.delta_tlsf )
657  {
658  // A leap second is currently being announced
659  printf( "GPS/UTC offset transition from %is to %is due to leap second\n"
660  "%s %s.\n",
661  utc.delta_tls, utc.delta_tlsf,
662  ( utc.delta_tls < utc.delta_tlsf ) ? "insertion" : "deletion",
663  tmp_str
664  );
665  goto out;
666  }
667 
668 
669  if ( ( utc.WNlsf == 0 ) && ( utc.DNt == 0 ) )
670  {
671  if ( verbose )
672  printf( "Leap second information not set\n" );
673 
674  goto out;
675  }
676 
677 
678  if ( verbose )
679  {
680  printf( "Last leap second probably %s\n", tmp_str );
681  goto out;
682  }
683 
684 
685  printf( "GPS/UTC offset parameter: %is, no leap second announced.\n", utc.delta_tls );
686 
687 out:
688  return;
689 
690 } // show_utc_info
691 
692 
693 
694 static /*HDR*/
696 {
697  MBG_IRIG_CTRL_BITS irig_ctrl_bits;
698 
699  int rc = mbg_get_irig_ctrl_bits( dh, &irig_ctrl_bits );
700 
701  if ( mbg_cond_err_msg( rc, "mbg_get_irig_ctrl_bits" ) )
702  return;
703 
704  printf( "IRIG control bits: %08lX (hex, LSB first)", (ulong) irig_ctrl_bits );
705  printf( ", TFOM: 0x%X", _pcps_tfom_from_irig_ctrl_bits( &irig_ctrl_bits ) );
706  printf( "\n" );
707 
708 } // show_irig_ctrl_bits
709 
710 
711 
712 static /*HDR*/
713 char *str_raw_irig_utc_offs_hours( char *s, size_t max_len, const MBG_RAW_IRIG_DATA *p )
714 {
715  size_t n;
716  long offs = ( p->data_bytes[8] & 0x08 )
717  | ( ( p->data_bytes[8] >> 2 ) & 0x04 )
718  | ( ( p->data_bytes[8] >> 4 ) & 0x02 )
719  | ( ( p->data_bytes[8] >> 6 ) & 0x01 );
720 
721  n = mbg_snprintf( s, max_len, "%c%li", ( p->data_bytes[8] & 0x80 ) ? '-' : '+', offs );
722 
723  if ( p->data_bytes[8] & 0x02 )
724  n += mbg_snprintf( &s[n], max_len - n, "%s", ".5" );
725 
726  return s;
727 
728 } // str_raw_irig_utc_offs_hours
729 
730 
731 
732 static /*HDR*/
734 {
735  MBG_RAW_IRIG_DATA raw_irig_data;
736  char ws[80];
737  int i;
738 
739  int rc = mbg_get_raw_irig_data( dh, &raw_irig_data );
740 
741  if ( mbg_cond_err_msg( rc, "mbg_get_raw_irig_data" ) )
742  return;
743 
744  printf( "Raw IRIG data:" );
745 
746  for ( i = 0; i < sizeof( raw_irig_data ); i++ )
747  printf( " %02X", raw_irig_data.data_bytes[i] );
748 
749  printf( " (hex)" );
750  printf( ", TFOM: 0x%X", _pcps_tfom_from_raw_irig_data( &raw_irig_data ) );
751  printf( ", UTC offs: %sh", str_raw_irig_utc_offs_hours( ws, sizeof( ws ), &raw_irig_data ) );
752  printf( "\n" );
753 
754 } // show_raw_irig_data
755 
756 
757 
758 static /*HDR*/
760 {
761  static const char *status_str[N_MBG_DEBUG_BIT] = MBG_DEBUG_STATUS_STRS;
762 
763  MBG_DEBUG_STATUS st;
764  int i;
765  int rc = mbg_get_debug_status( dh, &st );
766 
767  if ( mbg_cond_err_msg( rc, "show_irig_debug_status" ) )
768  return;
769 
770  printf( "Debug status (hex): %08lX\n", (ulong) st );
771 
772  for ( i = 0; i < N_MBG_DEBUG_BIT; i++ )
773  if ( st & ( 1UL << i ) )
774  printf( " %s\n", status_str[i] );
775 
776 } // show_irig_debug_status
777 
778 
779 
780 static /*HDR*/
782 {
783  IP4_SETTINGS ip4_settings;
784  LAN_IF_INFO lan_if_info;
785  char ws[100];
786 
787  int rc = mbg_get_ip4_state( dh, &ip4_settings );
788 
789  if ( mbg_cond_err_msg( rc, "mbg_get_ip4_state" ) )
790  return;
791 
792  rc = mbg_get_lan_if_info( dh, &lan_if_info );
793 
794  if ( mbg_cond_err_msg( rc, "mbg_get_lan_if_info" ) )
795  return;
796 
797 
798  printf( "On-board LAN interface settings:\n" );
799 
800  snprint_mac_addr( ws, sizeof( ws ), &lan_if_info.mac_addr );
801  printf( " MAC Address: %s\n", ws );
802 
803  snprint_ip4_addr( ws, sizeof( ws ), &ip4_settings.ip_addr, NULL );
804  printf( " IP Address: %s%s\n", ws, ( ip4_settings.flags & IP4_MSK_DHCP ) ?
805  " (DHCP)" : "" );
806 
807  snprint_ip4_addr( ws, sizeof( ws ), &ip4_settings.netmask, NULL );
808  printf( " Net Mask: %s\n", ws );
809 
810  snprint_ip4_addr( ws, sizeof( ws ), &ip4_settings.broad_addr, NULL );
811  printf( " Broadcast Addr: %s\n", ws );
812 
813  snprint_ip4_addr( ws, sizeof( ws ), &ip4_settings.gateway, NULL );
814  printf( " Gateway: %s\n", ws );
815 
816  printf( " Link detected: %s\n", ( ip4_settings.flags & IP4_MSK_LINK ) ? "YES" : "NO" );
817 
818 } // show_lan_intf_state
819 
820 
821 
822 static /*HDR*/
824 {
825  static const char *ptp_role_strs[N_PTP_ROLES] = PTP_ROLE_STRS;
826  static const char *ptp_state_strs[N_PTP_PORT_STATE] = PTP_PORT_STATE_STRS;
827  static const char *ptp_nw_prot_strs[N_PTP_NW_PROT] = PTP_NW_PROT_STRS;
828  static const char *ptp_delay_mech_names[N_PTP_DELAY_MECH] = PTP_DELAY_MECH_NAMES;
829  static const PTP_TABLE ptp_time_source_tbl[] = PTP_TIME_SOURCE_TABLE;
830  static const char *ptp_clock_accuracy_strs[] = PTP_CLOCK_ACCURACY_STRS;
831 
832  char ws[100];
833  const char *cp;
834  int must_show_slave_mode_info;
835  int must_show_master_mode_info;
836  int slave_mode_active;
837  int master_mode_active;
838  int any_mode_active;
839  int utc_offset_valid;
840  PTP_STATE ptp_state;
841  PTP_CFG_INFO ptp_info;
842  int tmp;
843 
844  int rc = mbg_get_ptp_state( dh, &ptp_state );
845 
846  if ( mbg_cond_err_msg( rc, "mbg_get_ptp_state" ) )
847  return;
848 
849  rc = mbg_get_ptp_cfg_info( dh, &ptp_info );
850 
851  if ( mbg_cond_err_msg( rc, "mbg_get_ptp_info" ) )
852  return;
853 
854 
855  // set up some flags controlling which information to be shown
856 
857  must_show_slave_mode_info = ( verbose > 1 ) ||
858  ( ( ( 1UL << ptp_info.settings.ptp_role ) & PTP_ROLE_MSK_SLAVES ) != 0 );
859 
860  must_show_master_mode_info = ( verbose > 1 ) ||
861  ( ( ( 1UL << ptp_info.settings.ptp_role ) & PTP_ROLE_MSK_MASTERS ) != 0 );
862 
863  slave_mode_active = ( ptp_state.port_state == PTP_PORT_STATE_UNCALIBRATED )
864  || ( ptp_state.port_state == PTP_PORT_STATE_SLAVE );
865 
866  master_mode_active = ( ptp_state.port_state == PTP_PORT_STATE_PRE_MASTER )
867  || ( ptp_state.port_state == PTP_PORT_STATE_MASTER )
868  || ( ptp_state.port_state == PTP_PORT_STATE_PASSIVE );
869 
870  any_mode_active = slave_mode_active || master_mode_active;
871 
872 
873  // PTP role and port state
874 
875  printf( "PTP port state:\n" );
876 
877  printf( " Port mode: " );
878 
879  if ( any_mode_active )
880  printf( "%s", ( ptp_state.flags & PTP_FLAG_MSK_IS_UNICAST ) ?
881  "Unicast " : "Multicast " );
882 
883  if ( ptp_state.port_state < N_PTP_PORT_STATE )
884  printf( "%s", ptp_state_strs[ptp_state.port_state] );
885  else
886  printf( "%s, code %i", str_undefined, ptp_state.port_state );
887 
888  if ( !any_mode_active || ( verbose > 1 ) )
889  printf( " in %s role",
890  ( ptp_info.settings.ptp_role < N_PTP_ROLES ) ?
891  ptp_role_strs[ptp_info.settings.ptp_role] : str_undefined );
892 
893  printf( "\n" );
894 
895 
896  if ( !any_mode_active || verbose )
897  {
898  printf( " PTP protocol: " );
899 
900  // If not fully synchronized then not all fields of the PTP_STATE
901  // structure may have been filled, so we show configuration settings
902  // in this case.
903 
904  if ( ptp_state.ptp_prot_version )
905  printf( "v%i, ", ptp_state.ptp_prot_version );
906 
907  tmp = any_mode_active ? ptp_state.nw_prot : ptp_info.settings.nw_prot;
908  printf( "%s", ( tmp < N_PTP_NW_PROT ) ?
909  ptp_nw_prot_strs[tmp] : str_undefined );
910 
911  printf( ", %s step",
912  ( ptp_state.flags & PTP_FLAG_MSK_ONE_STEP ) ? "one" : "two" );
913 
914  tmp = any_mode_active ? ptp_state.domain_number : ptp_info.settings.domain_number;
915  printf( ", domain %i", tmp );
916 
917  tmp = any_mode_active ? ptp_state.delay_mech : ptp_info.settings.delay_mech;
918  printf( ", delay mech. %s", ( tmp < N_PTP_DELAY_MECH ) ?
919  ptp_delay_mech_names[tmp] : str_undefined );
920 
921  tmp = any_mode_active ? ptp_state.log_delay_req_intv : ptp_info.settings.delay_req_intv;
922  printf( ", dly req. intv. 2^%i s", tmp );
923 
924  printf( "\n" );
925  }
926 
927 
928  if ( must_show_slave_mode_info )
929  {
930  cp = ( slave_mode_active || ( verbose > 1 ) ) ? ws : str_not_avail;
931 
932  snprint_octets( ws, sizeof( ws ), ptp_state.gm_id.b,
933  sizeof( ptp_state.gm_id.b ), MAC_SEP_CHAR_ALT, NULL );
934  printf( " Grandmaster ID: %s\n", cp );
935 
936  snprint_nano_time( ws, sizeof( ws ), &ptp_state.offset );
937  printf( " PTP time offset: %s\n", cp );
938 
939  snprint_nano_time( ws, sizeof( ws ), &ptp_state.path_delay );
940  printf( " PTP path delay: %s\n", cp );
941 
942  if ( verbose > 1 )
943  {
944  snprint_nano_time( ws, sizeof( ws ), &ptp_state.mean_path_delay );
945  printf( " Mean path delay: %s\n", cp );
946 
947  snprint_nano_time( ws, sizeof( ws ), &ptp_state.delay_asymmetry );
948  printf( " Delay asymmetry: %s\n", cp );
949  }
950  }
951 
952 
953  // PTP time scale
954 
955  cp = NULL;
956 
957  if ( ptp_state.flags & PTP_FLAG_MSK_TIMESCALE_IS_PTP ) // this is the default
958  {
959  if ( must_show_master_mode_info || verbose )
960  cp = "TAI (standard)";
961  }
962  else // unusual case, print info if available
963  if ( any_mode_active )
964  cp = "arbitrary (non-standard)";
965 
966  if ( cp )
967  printf( " PTP time scale: %s\n", cp );
968 
969 
970  // UTC offset and leap second status
971 
972  utc_offset_valid = ( ptp_state.flags & PTP_FLAG_MSK_UTC_VALID ) != 0;
973 
974  printf( " PTP UTC offset: " );
975 
976  if ( !utc_offset_valid )
977  printf( " %s", str_unknown ); // UTC offset not valid
978 
979  if ( utc_offset_valid || ( verbose > 1 ) )
980  {
981  printf( utc_offset_valid ? " " : " (" );
982 
983  printf( "%+i s", ptp_state.utc_offset );
984 
985  if ( ptp_state.flags & PTP_FLAG_MSK_LS_ANN ) // leap second is announced
986  {
987  // distinguish between leap second insertion and deletion
988  printf( ", leap second %s scheduled",
989  ( ptp_state.flags & PTP_FLAG_MSK_LS_ANN_NEG ) ? "deletion" : "insertion" );
990  }
991 
992  if ( !utc_offset_valid )
993  printf( ")" );
994  }
995 
996  printf( "\n" );
997 
998 
999  if ( verbose > 1 )
1000  {
1001  const PTP_TABLE *p_tbl;
1002 
1003  printf( "PTP clock state:\n" );
1004 
1005  for ( p_tbl = ptp_time_source_tbl; p_tbl->name; p_tbl++ )
1006  if ( p_tbl->value == ptp_state.time_source )
1007  break;
1008 
1009  printf( " Time source: %s\n", p_tbl->name ? p_tbl->name : str_unknown );
1010 
1011  printf( " Clock class: %i\n", ptp_state.clock_class );
1012 
1014 
1015  if ( ( ptp_state.clock_accuracy >= PTP_CLOCK_ACCURACY_NUM_BIAS ) &&
1016  ( ptp_state.clock_accuracy < N_PTP_CLOCK_ACCURACY ) )
1017  cp = ptp_clock_accuracy_strs[ptp_state.clock_accuracy - PTP_CLOCK_ACCURACY_NUM_BIAS];
1018  else
1019  cp = str_undefined;
1020 
1021  printf( " Clock accuracy: %s\n", cp );
1022 
1023 #if 0
1024  time_source
1025  clock_class
1026  clock_accuracy
1027 #endif
1028  printf( " Offs sc. log var: %u", ptp_state.clock_offset_scaled_log_variance );
1029  printf( "\n" );
1030  }
1031 
1032 
1033 
1034 } // show_ptp_state
1035 
1036 
1037 
1038 static /*HDR*/
1040 {
1041  PCPS_IRQ_STAT_INFO irq_stat_info;
1042  int ret_val = 0;
1043  int rc = mbg_get_irq_stat_info( dh, &irq_stat_info );
1044 
1045  if ( mbg_cond_err_msg( rc, "mbg_get_irq_stat_info" ) )
1046  return rc;
1047 
1048  if ( irq_stat_info & PCPS_IRQ_STAT_UNSAFE )
1049  {
1050  static const char *warn_line = "************************************************************************************";
1051 
1052  puts( "" );
1053  puts( warn_line );
1054 
1055  printf(
1056  "** WARNING!\n"
1057  "**\n"
1058  "** Device %s with S/N %s has a firmware version and ASIC version\n"
1059  "** which do not allow safe operation with hardware interrupts (IRQs) enabled.\n"
1060  "**\n"
1061  "** Please see http://www.meinberg.de/english/info/pex-upgrades.htm\n"
1062  "** for information how the card can easily be upgraded, or contact\n"
1063  "** Meinberg support (Email: support@meinberg.de) or your local\n"
1064  "** representative.\n"
1065  ,
1066  _pcps_type_name( p_dev ), _pcps_sernum( p_dev )
1067  );
1068 
1069  if ( irq_stat_info & PCPS_IRQ_STAT_ENABLED )
1070  {
1071  printf(
1072  "**\n"
1073  "** Interrupts are currently enabled for this card (NTP daemon running?)\n"
1074  "** so other access is inhibited to prevent the system from hanging.\n"
1075  );
1076 
1077  ret_val = -1;
1078  }
1079 
1080  puts( warn_line );
1081  puts( "" );
1082  }
1083 
1084  return ret_val;
1085 
1086 } // check_irq_unsafe
1087 
1088 
1089 
1090 static /*HDR*/
1091 int do_mbgstatus( MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev )
1092 {
1093  int ret_val = 0;
1094 
1095  if ( check_irq_unsafe( dh, p_dev ) < 0 )
1096  goto done;
1097 
1098  if ( list_only )
1099  goto done;
1100 
1101  for (;;)
1102  {
1103  if ( _pcps_has_gps_data( p_dev ) )
1104  show_ext_stat_info( dh, p_dev, NULL );
1105 
1106  show_time_and_status( dh, p_dev, "\n" );
1107  show_sync_time( dh, "\n" );
1108 
1109  if ( _pcps_is_gps( p_dev ) )
1110  show_gps_pos( dh, "\n" );
1111 
1112  if ( _pcps_has_utc_parm( p_dev ) && ( _pcps_is_gps( p_dev ) || ( verbose > 0 ) ) )
1113  show_utc_info( dh, p_dev );
1114 
1115  if ( verbose && _pcps_has_irig_ctrl_bits( p_dev ) )
1116  show_irig_ctrl_bits( dh );
1117 
1118  if ( verbose && ( mbg_chk_dev_has_raw_irig_data( dh ) == MBG_SUCCESS ) )
1119  show_raw_irig_data( dh );
1120 
1121  if ( verbose && _pcps_is_irig_rx( p_dev ) )
1122  show_irig_debug_status( dh );
1123 
1124  if ( mbg_chk_dev_has_lan_intf( dh ) == MBG_SUCCESS )
1125  show_lan_intf_state( dh );
1126 
1127  if ( _pcps_has_ptp( p_dev ) )
1128  show_ptp_state( dh );
1129 
1130  show_invt_reason();
1131 
1132  if ( loops > 0 )
1133  loops--;
1134 
1135  if ( loops == 0 )
1136  break;
1137 
1138  if ( sleep_secs )
1139  sleep( sleep_secs );
1140  else
1141  if ( sleep_usecs )
1142  usleep( sleep_usecs );
1143 
1144  printf( "\n" );
1145 
1146  // if this_loops is < 0 then loop forever
1147  }
1148 
1149 done:
1150 
1151  return ret_val;
1152 
1153 } // do_mbgstatus
1154 
1156 
1157 
1158 
1159 static /*HDR*/
1160 void usage( void )
1161 {
1163  "This program prints status information for a device.\n"
1164  "The displayed information depends on the type of the card."
1165  );
1167  mbg_print_opt_info( "-c", "run continuously" );
1168  mbg_print_opt_info( "-l", "list devices only" );
1169  mbg_print_opt_info( "-L", "list unique names of all devices" );
1170  mbg_print_opt_info( "-n num", "run num loops" );
1171  mbg_print_opt_info( "-s num", "sleep num seconds between calls (implies -c)" );
1172  mbg_print_opt_info( "-u num", "sleep num microseconds between calls (implies -c)" );
1173  mbg_print_opt_info( "-v", "increase verbosity" );
1175  puts( "" );
1176 
1177 } // usage
1178 
1179 
1180 
1181 int main( int argc, char *argv[] )
1182 {
1183  int c;
1184  int rc;
1185 
1186  ctry_setup( 0 );
1188  ctry.dt_fmt = DT_FMT_YYYYMMDD;
1189  ctry.dt_sep = '-';
1190 
1192 
1193  // check command line parameters
1194  while ( ( c = getopt( argc, argv, "clLn:s:u:vh?" ) ) != -1 )
1195  {
1196  switch ( c )
1197  {
1198  case 'c':
1199  loops = -1;
1200  break;
1201 
1202  case 'l':
1203  list_only = 1;
1204  break;
1205 
1206  case 'L':
1208  break;
1209 
1210  case 'n':
1211  loops = atoi( optarg );
1212  break;
1213 
1214  case 's':
1215  sleep_secs = atoi( optarg );
1216  loops = -1;
1217  break;
1218 
1219  case 'u':
1220  sleep_usecs = atoi( optarg );
1221  loops = -1;
1222  break;
1223 
1224  case 'v':
1225  verbose++;
1226  break;
1227 
1228  case 'h':
1229  case '?':
1230  default:
1231  must_print_usage = 1;
1232  }
1233  }
1234 
1235  if ( must_print_usage )
1236  {
1237  usage();
1238  return MBG_EXIT_CODE_USAGE;
1239  }
1240 
1241 
1242  if ( list_only_unique_names )
1243  {
1244  MBG_DEV_NAME_LIST_ENTRY *list_head = NULL;
1245  int n_dev = mbg_find_devices_with_names( &list_head, N_SUPP_DEV_BUS );
1246 
1247  if ( n_dev )
1248  {
1250 
1251  printf( "Unique names of devices found:\n" );
1252 
1253  for ( pos = list_head; pos; pos = pos->next )
1254  printf( " %s\n", pos->dev_name );
1255  }
1256  else
1257  printf( "No device found.\n" );
1258 
1259  mbg_free_device_name_list( list_head );
1260  printf( "\n" );
1261 
1262  return MBG_EXIT_CODE_SUCCESS;
1263  }
1264 
1265  if ( verbose )
1266  pcps_date_time_dist = 1;
1267 
1268  // Handle each of the specified devices.
1269  rc = mbg_handle_devices( argc, argv, optind, do_mbgstatus, CHK_DEV_ALL_DEVICES );
1270 
1272 }
DMS longitude
Longitude broken down to degrees, minutes, seconds.
Definition: mbggeo.h:117
size_t snprint_mac_addr(char *s, size_t max_len, const MBG_MAC_ADDR *p_mac_addr)
Print a MAC address to a string.
Definition: lan_util.c:1049
#define OSC_DAC_BIAS
Definition: gpsdefs.h:10613
A structure to used to read the status of the PTP protocol stack.
Definition: gpsdefs.h:13184
static const char * icode_rx_names[N_ICODE_RX]
Definition: mbgstatus.c:115
_MBG_API_ATTR int _MBG_API mbg_get_gps_pos(MBG_DEV_HANDLE dh, POS *p)
Read the current geographic position from a GPS device.
Definition: mbgdevio.c:5905
unknown, or not defined
Definition: pcpsdefs.h:293
int mbg_snprint_hr_tstamp(char *s, size_t max_len, const PCPS_TIME_STAMP *p, long utc_offs, int show_raw)
Print date and time from a PCPS_TIME_STAMP structure to a string.
Definition: toolutil.c:799
#define MAC_SEP_CHAR_ALT
Definition: lan_util.h:98
#define PCPS_SIG_ERR
Definition: pcpsdefs.h:1056
#define _pcps_has_stat_info_svs(_d)
Definition: pcpsdev.h:1246
MBG_GNSS_MODE_SETTINGS settings
Current GNSS mode settings.
Definition: gpsdefs.h:10696
invalid time because battery had been disconnected, or absolute time can&#39;t be decoded safely ...
Definition: pcpsdefs.h:1261
#define MBG_DEBUG_STATUS_STRS
Initializers for debug status bit strings.
Definition: gpsdefs.h:5240
TM_GPS tm
time converted to UTC and/or local time according to TZDL settings
Definition: gpsdefs.h:2717
static void usage(void)
Definition: mbgstatus.c:1160
double A1
+- Clock Correction Coefficient 1 [sec/sec]
Definition: gpsdefs.h:18571
static void print_dms(const char *s, const DMS *p, const char *tail)
Definition: mbgstatus.c:176
#define _pcps_has_pzf(_d)
Definition: pcpsdev.h:1232
uint8_t port_state
one of the enumerated port states, see PTP_PORT_STATES
Definition: gpsdefs.h:13188
int mbg_handle_devices(int argc, char *argv[], int optind, MBG_DEV_HANDLER_FNC *fnc, int chk_dev_flags)
Main action handler that can be called by utility programs.
Definition: toolutil.c:655
void pcps_status_strs(ushort status, int status_is_read, int is_gps, PCPS_STATUS_STRS *pstrs)
Definition: pcpslstr.c:454
see PTP_FLAG_LS_ANN_NEG
Definition: gpsdefs.h:13267
An entry for a table of parameters which can not be accessed by an enumerated index.
Definition: gpsdefs.h:12747
_MBG_API_ATTR int _MBG_API mbg_get_raw_irig_data(MBG_DEV_HANDLE dh, MBG_RAW_IRIG_DATA *p)
Read raw IRIG data from an IRIG receiver.
Definition: mbgdevio.c:5233
int must_print_usage
uint8_t data_bytes[16]
Definition: gpsdefs.h:5425
#define _pcps_time_is_read(_t)
Definition: pcpsdev.h:1344
#define MBG_FIRST_COPYRIGHT_YEAR
Definition: mbgstatus.c:101
#define PTP_ROLE_MSK_MASTERS
Definition: gpsdefs.h:12982
Settings of an IPv4-only network interface.
Definition: gpsdefs.h:11239
#define PTP_ROLE_MSK_SLAVES
Definition: gpsdefs.h:12978
GPS UTC correction parameters.
Definition: gpsdefs.h:18564
void ctry_setup(CTRY_CODE code)
Definition: ctry.c:92
#define PCPS_IRQ_STAT_UNSAFE
Definition: pcpsdev.h:1473
static const char * ref_name[N_PCPS_REF]
Definition: mbgstatus.c:114
uint16_t WNlsf
Week number of nearest leap second.
Definition: gpsdefs.h:18573
static unsigned int verbose
Definition: mbgstatus.c:112
int mbg_show_pzf_corr_info(MBG_DEV_HANDLE dh, int show_corr_step)
Retrieve and print PZF correlation info for a device which supports this.
Definition: toolutil.c:991
MBG_MAC_ADDR mac_addr
MAC address.
Definition: gpsdefs.h:11277
#define _pcps_has_hr_time(_d)
Definition: pcpsdev.h:1149
The structure behind the MBG_DEV_NAME_LIST_ENTRY type.
Definition: mbgdevio.h:660
const char * str_undefined
uint8_t hour
hours, 0..23
Definition: pcpsdefs.h:1215
static int loops
Definition: mbgstatus.c:107
Requested action completed successfully.
Definition: mbgerror.h:631
static void show_irig_ctrl_bits(MBG_DEV_HANDLE dh)
Definition: mbgstatus.c:695
_MBG_API_ATTR int _MBG_API mbg_get_lan_if_info(MBG_DEV_HANDLE dh, LAN_IF_INFO *p)
Read LAN interface information from a device.
Definition: mbgdevio.c:7271
The number of known bits.
Definition: gpsdefs.h:5232
static int list_only_unique_names
Definition: mbgstatus.c:109
int n_gnss_supp
Definition: cfg_hlp.h:450
char epld_name[(8+1)]
ASCIIZ, file name of EPLD image (optional)
Definition: gpsdefs.h:879
int mbg_snprint_hr_time(char *s, size_t max_len, const PCPS_HR_TIME *p, int show_raw)
Print date and time from a PCPS_HR_TIME structure to a string.
Definition: toolutil.c:851
static void show_irig_debug_status(MBG_DEV_HANDLE dh)
Definition: mbgstatus.c:759
#define DEFAULT_STR_IRIG_INVT_EN
Definition: pcpslstr.h:658
static const char * osc_name[N_GPS_OSC]
Definition: mbgstatus.c:116
#define PTP_ROLE_STRS
Name strings for defined PTP roles.
Definition: gpsdefs.h:12994
int mbg_snprintf(char *s, size_t max_len, const char *fmt,...)
A portable, safer implementation of snprintf().
Definition: mbgutil.c:157
_MBG_API_ATTR int _MBG_API mbg_get_irig_rx_info(MBG_DEV_HANDLE dh, IRIG_INFO *p)
Read the current IRIG input settings plus capabilities.
Definition: mbgdevio.c:5028
int8_t delta_tlsf
Future UTC offset to GPS system time after next leap second transition [sec].
Definition: gpsdefs.h:18576
CTRY ctry
Definition: mbgstatus.c:126
NANO_TIME offset
estimated time offset from the upstream time source
Definition: gpsdefs.h:13190
Current IRIG settings and supported codes.
Definition: gpsdefs.h:5054
#define _pcps_sernum(_d)
Definition: pcpsdev.h:1120
#define MBG_REF_OFFS_MAX
The maximum allowed positive / negative ref offset.
Definition: gpsdefs.h:5305
bool mbg_cond_err_msg(int rc, const char *what)
Check if a value is an error code and print an associated error message.
Definition: mbgerror.c:714
int8_t log_delay_req_intv
Definition: gpsdefs.h:13207
number of defined protocols
Definition: gpsdefs.h:12651
#define SECS_PER_WEEK
Definition: mbgtime.h:244
MBG_GNSS_MODE_INFO gnss_mode_info
Definition: cfg_hlp.h:451
#define DEFAULT_GPS_OSC_NAMES
Oscillator type name string initializer.
Definition: gpsdefs.h:2121
static int list_only
Definition: mbgstatus.c:108
_MBG_API_ATTR int _MBG_API mbg_get_utc_parm(MBG_DEV_HANDLE dh, UTC *p)
Read a UTC parameter structure from a device.
Definition: mbgdevio.c:6536
_MBG_API_ATTR int _MBG_API mbg_get_time(MBG_DEV_HANDLE dh, PCPS_TIME *p)
Read a PCPS_TIME structure returning the current date/time/status.
Definition: mbgdevio.c:4491
#define _pcps_is_gps(_d)
Definition: pcpsdev.h:1074
Unable to handle requested action, usage printed.
Definition: mbgerror.h:632
_MBG_API_ATTR int _MBG_API mbg_get_hr_time(MBG_DEV_HANDLE dh, PCPS_HR_TIME *p)
Read the card&#39;s current time with high resolution, including status.
Definition: mbgdevio.c:4625
see PTP_FLAG_TIMESCALE_IS_PTP
Definition: gpsdefs.h:13265
uint32_t sec
the second of that week
Definition: gpsdefs.h:2566
RI_FEATURES features
optional features, see GPS_FEATURE_MASKS
Definition: gpsdefs.h:882
#define mbg_rc_is_success(_rc)
Definition: mbgerror.h:618
DMS latitude
Latitude broken down to degrees, minutes, seconds.
Definition: mbggeo.h:118
_MBG_API_ATTR int _MBG_API mbg_get_fast_hr_timestamp(MBG_DEV_HANDLE dh, PCPS_TIME_STAMP *p)
Read a high resolution PCPS_TIME_STAMP structure via memory mapped access.
Definition: mbgdevio.c:7066
#define _pcps_has_ptp(_d)
Definition: pcpsdev.h:1228
uint8_t delay_mech
see PTP_DELAY_MECHS
Definition: gpsdefs.h:13284
MBG_CHK_SUPP_FNC mbg_chk_dev_is_gps
Check if a device is a GPS receiver.
Definition: mbgdevio.c:1029
#define _pcps_tfom_from_irig_ctrl_bits(_p)
Extract the TFOM code from MBG_IRIG_CTRL_BITS.
Definition: gpsdefs.h:5406
uint8_t ptp_prot_version
PTP protocol version, 1, or 2, usually 2 for v2.
Definition: gpsdefs.h:13187
static IRIG_INFO irig_rx_info
Definition: mbgirigcfg.c:96
uint8_t value
the parameter value
Definition: gpsdefs.h:12749
uint8_t ptp_role
one of the supported PTP roles, see PTP_ROLES
Definition: gpsdefs.h:13285
call callback for all devices
Definition: toolutil.h:89
uint16_t mode
Mode of operation, see RECEIVER_MODES.
Definition: gpsdefs.h:10593
uint8_t b[8]
Definition: gpsdefs.h:13040
T_GPS t0t
Reference Time UTC Parameters [wn|sec].
Definition: gpsdefs.h:18569
see IP4_BIT_LINK
Definition: gpsdefs.h:11342
uint8_t LANGUAGE
Definition: ctry.h:97
#define DEFAULT_STR_IRIG_NOT_CFGD_EN
Definition: pcpslstr.h:637
#define PTP_NW_PROT_STRS
Name strings for the protocols possibly used with PTP.
Definition: gpsdefs.h:12678
see IP4_BIT_DHCP
Definition: gpsdefs.h:11341
#define PCPS_SIG_MAX
Definition: pcpsdefs.h:1058
IP4_ADDR ip_addr
the IP address
Definition: gpsdefs.h:11241
static int max_ref_offs_h
Definition: mbgstatus.c:120
#define N_PCPS_STATUS_STR
Definition: pcpslstr.h:197
void mbg_print_device_options(void)
Print common info on how to specify devices on the command line.
Definition: toolutil.c:270
const char * ptp_clock_accuracy_strs[N_PTP_CLOCK_ACCURACY - PTP_CLOCK_ACCURACY_NUM_BIAS]
void mbg_print_usage_intro(const char *pname, const char *info)
Print usage intro to console.
Definition: toolutil.c:217
const char * name
the parameter name
Definition: gpsdefs.h:12750
static void print_pcps_time(const char *s, const PCPS_TIME *tp, const char *tail)
Definition: mbgstatus.c:154
number of defined ref time sources
Definition: pcpsdefs.h:302
static void print_position(const char *s, const POS *p, const char *tail)
Definition: mbgstatus.c:196
Summary information on all supported GNSS systems.
Definition: cfg_hlp.h:447
Definition: gpsdefs.h:2754
_MBG_API_ATTR int _MBG_API mbg_get_ptp_cfg_info(MBG_DEV_HANDLE dh, PTP_CFG_INFO *p)
Read PTP/IEEE1588 config info and current settings from a device.
Definition: mbgdevio.c:7427
uint16_t nw_prot
see PTP_NW_PROTS
Definition: gpsdefs.h:13280
double A0
+- Clock Correction Coefficient 0 [sec]
Definition: gpsdefs.h:18570
static __mbg_inline time_t cvt_to_time_t(mbg_time_t t)
Definition: timeutil.h:108
int pcps_date_time_dist
PCPS_TIME_STATUS_X status
status bits, see PCPS_TIME_STATUS_FLAGS
Definition: pcpsdefs.h:1089
#define GPS_SEC_BIAS
GPS epoch bias from ordinary time_t epoch.
Definition: mbgtime.h:130
Geographic longitude or latitude in [degrees, minutes, seconds].
Definition: mbggeo.h:90
uint32_t flags
see PTP_STATE_FLAGS
Definition: gpsdefs.h:13189
DAC_VAL dac_cal
Oscillator calibration DAC value ( see OSC_DAC_RANGE, OSC_DAC_BIAS )
Definition: gpsdefs.h:10597
#define _pcps_ref_offs_out_of_range(_n)
Definition: pcpsdev.h:1199
uint8_t gnss_type
GNSS type as enumerated in MBG_GNSS_TYPES.
Definition: gpsdefs.h:10751
see PTP_FLAG_UTC_VALID
Definition: gpsdefs.h:13269
uint8_t sec
seconds, 0..59, may be 60 for leap second
Definition: pcpsdefs.h:1213
char * pcps_date_time_str(char *s, size_t max_len, const PCPS_TIME *t, int year_limit, const char *tz_str)
Definition: pcpslstr.c:344
uint8_t domain_number
the PTP clock domain number, 0:3
Definition: gpsdefs.h:13282
const char * ptp_role_strs[N_PTP_ROLES]
#define _pcps_has_irig_time(_d)
Definition: pcpsdev.h:1190
MBG_DEV_NAME_LIST_ENTRY * next
Definition: mbgdevio.h:663
uint16_t svs_in_view
Num. of satellites that should be visible above the horizon.
Definition: gpsdefs.h:10754
#define _pcps_has_ref_offs(_d)
Definition: pcpsdev.h:1196
A structure to used to query the current configuration and capabilities of a PTP port.
Definition: gpsdefs.h:13342
static void show_gps_pos(MBG_DEV_HANDLE dh, const char *tail)
Definition: mbgstatus.c:596
uint16_t status
status flags, see TM_GPS_STATUS_BIT_MASKS
Definition: gpsdefs.h:2605
uint8_t min
minutes, 0..59
Definition: pcpsdefs.h:1214
uint16_t prefix
&#39;N&#39;, &#39;E&#39;, &#39;S&#39; or &#39;W&#39;
Definition: mbggeo.h:92
Definition: gpsdefs.h:2735
_MBG_API_ATTR int _MBG_API mbg_get_irig_time(MBG_DEV_HANDLE dh, PCPS_IRIG_TIME *p)
Read the IRIG time and day-of-year number from an IRIG receiver.
Definition: mbgdevio.c:5304
PTP_CLOCK_ID gm_id
identifier ot the upstream time source
Definition: gpsdefs.h:13195
#define PCPS_SIG_BIAS
Definition: pcpsdefs.h:1055
A structure used to transmit information on date and time.
Definition: gpsdefs.h:2713
uint16_t deg
[0...90 (lat) or 0...180 (lon)]
Definition: mbggeo.h:93
IRIG_SETTINGS settings
current settings
Definition: gpsdefs.h:5056
#define _pcps_is_lwr(_d)
Definition: pcpsdev.h:1083
uint16_t flags
see MBG_IP4_FLAG_MASKS
Definition: gpsdefs.h:11245
int main(int argc, char *argv[])
Definition: mbgstatus.c:1181
MBG_CHK_SUPP_FNC mbg_chk_dev_has_lan_intf
Check if a device supports simple LAN interface API calls.
Definition: mbgdevio.c:1271
#define DEFAULT_ICODE_RX_NAMES
Initializers for RX timecode format name strings.
Definition: gpsdefs.h:4564
#define PTP_DELAY_MECH_NAMES
Name strings for the PTP delay mechanisms.
Definition: gpsdefs.h:12794
#define _pcps_has_gps_data(_d)
Definition: pcpsdev.h:1207
Satellite information for a particular GNSS type.
Definition: gpsdefs.h:10749
uint8_t clock_class
Definition: gpsdefs.h:13198
double r2d
_MBG_API_ATTR int _MBG_API mbg_get_sync_time(MBG_DEV_HANDLE dh, PCPS_TIME *p)
Read the time when the device has last recently synchronized.
Definition: mbgdevio.c:4555
uint16_t good_svs
Num. of satellites that can currently be received and used.
Definition: gpsdefs.h:10753
#define _pcps_is_gnss(_d)
Definition: pcpsdev.h:1081
static long sleep_usecs
Definition: mbgstatus.c:111
_MBG_API_ATTR int _MBG_API mbg_get_ptp_state(MBG_DEV_HANDLE dh, PTP_STATE *p)
Read PTP/IEEE1588 status from a device.
Definition: mbgdevio.c:7396
size_t snprint_nano_time(char *s, size_t max_len, const NANO_TIME *nt)
Print nano time into string buffer.
Definition: nanotime.c:102
int16_t DNt
The day number at the end of which a leap second occurs.
Definition: gpsdefs.h:18574
const char * str_not_avail
int16_t MBG_REF_OFFS
A data type used to configure the ref offset.
Definition: gpsdefs.h:5297
#define _pcps_has_stat_info(_d)
Definition: pcpsdev.h:1242
#define MINS_PER_HOUR
Definition: mbgtime.h:236
uint16_t yday
day of year, 1..365/366
Definition: pcpsdefs.h:1211
#define _pcps_has_irig_ctrl_bits(_d)
Definition: pcpsdev.h:1187
#define MSK_ICODE_RX_HAS_TZI
A mask of IRIG RX formats supporting time zone information.
Definition: gpsdefs.h:4919
static int check_irq_unsafe(MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev)
Definition: mbgstatus.c:1039
#define PCPS_IRQ_STAT_ENABLED
Definition: pcpsdev.h:1472
static void show_raw_irig_data(MBG_DEV_HANDLE dh)
Definition: mbgstatus.c:733
STAT_INFO stat_info
Definition: cfg_hlp.h:449
ALL_GNSS_SAT_INFO_IDX gnss_sat_info_idx
Definition: cfg_hlp.h:452
static void show_utc_info(MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev)
Definition: mbgstatus.c:611
uint8_t osc_type
type of installed oscillator, see GPS_OSC_TYPES
Definition: gpsdefs.h:884
static void show_time_and_status(MBG_DEV_HANDLE dh, const PCPS_DEV *pdev, const char *tail)
Definition: mbgstatus.c:295
see PTP_FLAG_IS_UNICAST
Definition: gpsdefs.h:13268
NANO_TIME path_delay
Definition: gpsdefs.h:13191
MBG_CHK_SUPP_FNC mbg_chk_dev_has_raw_irig_data
Check if a device supports the mbg_get_raw_irig_data call.
Definition: mbgdevio.c:1719
int snprint_gmtime_error(char *s, size_t max_len, int mbg_errno, time_t t, const char *calling_fnc)
Definition: timeutil.c:55
#define MBG_LAST_COPYRIGHT_YEAR
Definition: mbgstatus.c:102
T_GPS t
time in GPS scale and format
Definition: gpsdefs.h:2716
Raw IRIG time.
Definition: pcpsdefs.h:1207
_MBG_API_ATTR int _MBG_API mbg_get_irq_stat_info(MBG_DEV_HANDLE dh, PCPS_IRQ_STAT_INFO *p)
Read a device&#39;s IRQ status information.
Definition: mbgdevio.c:7238
int MBG_DEV_HANDLER_FNC(MBG_DEV_HANDLE, const PCPS_DEV *)
The type of functions to called to handle a device in a specific way.
Definition: toolutil.h:144
int32_t offs_from_utc
local time offset from UTC [sec]
Definition: gpsdefs.h:2604
number of defined roles
Definition: gpsdefs.h:12944
uint8_t dt_fmt
Definition: ctry.h:128
const char * pcps_tz_name(const PCPS_TIME *t, ulong flags, int is_msf)
Return a static time zone string depending on the UTC offset from a PCPS_TIME structure.
Definition: pcpslstr.c:245
#define MBG_SUCCESS
Error codes used with Meinberg devices and drivers.
Definition: mbgerror.h:259
uint32_t PCPS_IRQ_STAT_INFO
Definition: pcpsdev.h:1468
const char * str_unknown
#define PTP_PORT_STATE_STRS
Name strings for the PTP port states.
Definition: gpsdefs.h:12729
#define MAX_USED_SATS
Definition: gpsdefs.h:10744
_MBG_API_ATTR int _MBG_API mbg_setup_receiver_info(MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev, RECEIVER_INFO *p)
Set up a RECEIVER_INFO structure for a device.
Definition: mbgdevio.c:6329
static __mbg_inline int mbg_gmtime(struct tm *p_tm, const time_t *p_time)
Definition: timeutil.h:118
uint8_t time_source
see PTP_TIME_SOURCES
Definition: gpsdefs.h:13205
A geographic position represented in different formats.
Definition: mbggeo.h:113
uint8_t domain_number
the PTP clock domain number, 0:3
Definition: gpsdefs.h:13204
_MBG_API_ATTR void _MBG_API mbg_free_device_name_list(MBG_DEV_NAME_LIST_ENTRY *list)
Free the memory allocated for a list of MBG_DEV_NAME_LIST_ENTRY entries.
Definition: mbgdevio.c:3981
Definition: myutil.h:117
A buffer used to read raw IRIG data bits from an IRIG receiver.
Definition: gpsdefs.h:5423
Definition: gpsdefs.h:2735
LANGUAGE language
Definition: mbgstatus.c:125
see PTP_FLAG_LS_ANN
Definition: gpsdefs.h:13266
#define _pcps_has_fast_hr_timestamp(_d)
Definition: pcpsdev.h:1224
Action failed for specified device.
Definition: mbgerror.h:634
NANO_TIME mean_path_delay
Definition: gpsdefs.h:13192
uint8_t svs[32]
IDs of the satellites actually used for navigation, 0 == not used.
Definition: gpsdefs.h:10755
#define _pcps_has_signal(_d)
Definition: pcpsdev.h:1178
IP4_ADDR netmask
the network mask
Definition: gpsdefs.h:11242
#define _pcps_has_utc_parm(_d)
Definition: pcpsdev.h:1216
#define _pcps_tfom_from_raw_irig_data(_p)
Extract the TFOM code from MBG_RAW_IRIG_DATA.
Definition: gpsdefs.h:5440
int16_t utc_offset
UTC offset observed against TAI
Definition: gpsdefs.h:13209
int16_t delay_req_intv
log2 of the delay request interval [s]
Definition: gpsdefs.h:13299
XYZ xyz
Always WGS84 ECEF coordinates.
Definition: mbggeo.h:115
PTP_CFG_SETTINGS settings
the current configuration
Definition: gpsdefs.h:13344
uint16_t clock_offset_scaled_log_variance
Definition: gpsdefs.h:13197
#define PTP_CLOCK_ACCURACY_STRS
Name strings for PTP accuracy classes.
Definition: gpsdefs.h:12850
_MBG_API_ATTR int _MBG_API mbg_get_debug_status(MBG_DEV_HANDLE dh, MBG_DEBUG_STATUS *p)
Read a debug status word from a device.
Definition: mbgdevio.c:7790
PCPS_STATUS_STR s[3]
Definition: pcpslstr.h:207
uint16_t icode
IRIG signal code, see ICODE_RX_CODES and ICODE_TX_CODES.
Definition: gpsdefs.h:5001
High resolution time including status and local time offset.
Definition: pcpsdefs.h:1085
number of defined delay mechanisms
Definition: gpsdefs.h:12770
int snprint_utc_offs(char *s, size_t max_len, const char *info, long utc_offs)
Print a UTC offset into a string.
Definition: timeutil.c:211
void mbg_print_help_options(void)
Print info on common program help arguments.
Definition: toolutil.c:257
going to become master
Definition: gpsdefs.h:12717
#define SECS_PER_DAY
Definition: mbgtime.h:243
int8_t delta_tls
Current UTC offset to GPS system time [sec].
Definition: gpsdefs.h:18575
static MBG_REF_OFFS ref_offs
Definition: mbgirigcfg.c:98
number of defined port states
Definition: gpsdefs.h:12722
PCPS_SIG_VAL signal
signal strength, see PCPS_SIG_VAL_DEFS
Definition: pcpsdefs.h:1141
Local calendar date and time, plus sync status.
Definition: pcpsdefs.h:1128
DAC_VAL dac_val
Oscillator fine DAC value.
Definition: gpsdefs.h:10596
uint16_t min
[0...59]
Definition: mbggeo.h:94
LLA lla
Longitude, latitude and altitude, depending on the ellipsoid used for reference.
Definition: mbggeo.h:116
A high resolution time stamp.
Definition: pcpsdefs.h:972
int16_t valid
Flag indicating UTC parameters are valid.
Definition: gpsdefs.h:18567
static void show_signal(MBG_DEV_HANDLE dh, const PCPS_DEV *pdev, int signal)
Definition: mbgstatus.c:237
int mbg_chk_get_all_gnss_info(MBG_DEV_HANDLE dh, ALL_GNSS_INFO *p_agi)
Read or setup all GNSS status information.
Definition: deviohlp.c:159
const char * cp
Definition: pcpslstr.h:201
Definition: gpsdefs.h:2735
char dt_sep
Definition: ctry.h:130
#define _pcps_type_name(_d)
Definition: pcpsdev.h:1068
int snprintf_safe(char *s, size_t max_len, const char *fmt,...)
A portable, safe implementation of snprintf()
Definition: str_util.c:156
void mbg_print_opt_info(const char *opt_name, const char *opt_info)
Print info on a single program option / argument.
Definition: toolutil.c:236
IP4_ADDR gateway
the default gateway
Definition: gpsdefs.h:11244
static void show_lan_intf_state(MBG_DEV_HANDLE dh)
Definition: mbgstatus.c:781
uint32_t gnss_set
bit mask of currently used GNSS systems, see MBG_GNSS_TYPE_MASKS
Definition: gpsdefs.h:10679
uint32_t tick
fractions of a second, 1/RECEIVER_INFO::ticks_per_sec units
Definition: gpsdefs.h:2567
_MBG_API_ATTR int _MBG_API mbg_get_gps_time(MBG_DEV_HANDLE dh, TTM *p)
Read the current board time using a TTM structure.
Definition: mbgdevio.c:5580
the number of known codes
Definition: gpsdefs.h:4556
size_t snprint_ip4_addr(char *s, size_t max_len, const IP4_ADDR *p_addr, const char *info)
Print an IPv4 address to a dotted quad formatted string.
Definition: lan_util.c:217
double sec
[0...59.99999...]
Definition: mbggeo.h:95
static void show_ext_stat_info(MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev, const char *tail)
Definition: mbgstatus.c:456
Definition: ctry.h:124
uint32_t MBG_IRIG_CTRL_BITS
Bit coded return type for PCPS_GET_IRIG_CTRL_BITS.
Definition: gpsdefs.h:5392
static void show_sync_time(MBG_DEV_HANDLE dh, const char *tail)
Definition: mbgstatus.c:441
void mbg_print_program_info(const char *pname, int first_year, int last_year)
Print program info to console.
Definition: toolutil.c:193
#define _pcps_is_irig_rx(_d)
Definition: pcpsdev.h:1078
#define PCPS_REF_NAMES_ENG
Initializer for an array of English reference type names.
Definition: pcpsdefs.h:332
#define PTP_TIME_SOURCE_TABLE
A table of PTP time source codes plus associated name strings.
Definition: gpsdefs.h:12902
see PTP_FLAG_ONE_STEP
Definition: gpsdefs.h:13270
_MBG_API_ATTR int _MBG_API mbg_get_ip4_state(MBG_DEV_HANDLE dh, IP4_SETTINGS *p)
Read LAN IPv4 state from a device.
Definition: mbgdevio.c:7301
size_t snprint_octets(char *s, size_t max_len, const uint8_t *octets, int num_octets, char sep, const char *info)
Print a MAC ID or similar array of octets to a string.
Definition: lan_util.c:990
int pcps_str_tm_gps_date_time(char *s, size_t max_len, const TM_GPS *t)
Definition: pcpslstr.c:387
NANO_TIME delay_asymmetry
Definition: gpsdefs.h:13193
_MBG_API_ATTR int _MBG_API mbg_get_ref_offs(MBG_DEV_HANDLE dh, MBG_REF_OFFS *p)
Read the UTC offset configuration of the reference time from a device.
Definition: mbgdevio.c:4893
_MBG_API_ATTR int _MBG_API mbg_get_irig_ctrl_bits(MBG_DEV_HANDLE dh, MBG_IRIG_CTRL_BITS *p)
Read the control function bits received from an incoming IRIG signal.
Definition: mbgdevio.c:5202
#define _pcps_ref_type(_d)
Definition: pcpsdev.h:1070
IP4_ADDR broad_addr
the broadcast address
Definition: gpsdefs.h:11243
static int year_limit
Definition: mbgstatus.c:118
CSUM csum
Checksum of the remaining bytes.
Definition: gpsdefs.h:18566
unsigned long ulong
Definition: words.h:292
#define GNSS_TYPE_STRS
Name strings for the the known satellite navigation systems.
Definition: gpsdefs.h:10658
char dev_name[40]
Readable device name (Should be MBG_DEV_NAME, which is smaller, though)
Definition: mbgdevio.h:662
A structure used to identify a device type and supported features.
Definition: gpsdefs.h:873
static int invt_reason
Definition: mbgstatus.c:121
#define N_SUPP_DEV_BUS
Definition: cfg_hlp.h:114
uint16_t wn
the week number since the GPS system has been put into operation
Definition: gpsdefs.h:2565
uint8_t clock_accuracy
see PTP_CLOCK_ACCURACIES
Definition: gpsdefs.h:13199
static MBG_DEV_HANDLER_FNC do_mbgstatus
Definition: mbgstatus.c:1155
uint16_t nw_prot
one of the enumerated protocols, see PTP_NW_PROTS
Definition: gpsdefs.h:13186
uint32_t MBG_DEBUG_STATUS
A data type used to read the board&#39;s debug status.
Definition: gpsdefs.h:5204
Definition: gpsdefs.h:2754
_MBG_API_ATTR int _MBG_API mbg_find_devices_with_names(MBG_DEV_NAME_LIST_ENTRY **p_list, int max_devices)
Allocate memory and set up a list of installed and supported devices.
Definition: mbgdevio.c:3897
static long sleep_secs
Definition: mbgstatus.c:110
Simple LAN interface information.
Definition: gpsdefs.h:11274
Number of defined codes.
Definition: gpsdefs.h:10632
static void show_ptp_state(MBG_DEV_HANDLE dh)
Definition: mbgstatus.c:823
static const char * pname
Definition: mbgstatus.c:104
#define _pcps_has_stat_info_mode(_d)
Definition: pcpsdev.h:1244
Device info structure.
Definition: pcpsdev.h:1043
PCPS_TIME_STATUS status
status bits, see PCPS_TIME_STATUS_FLAGS_COMMON
Definition: pcpsdefs.h:1140
uint8_t delay_mech
see PTP_DELAY_MECHS
Definition: gpsdefs.h:13206
see PCPS_TZ_NAME_FORCE_UTC_OFFS
Definition: pcpslstr.h:189
static void show_invt_reason(void)
Definition: mbgstatus.c:131
Definition: gpsdefs.h:2754
static const char * wdays[7]
Definition: mbgstatus.c:123
static char * str_raw_irig_utc_offs_hours(char *s, size_t max_len, const MBG_RAW_IRIG_DATA *p)
Definition: mbgstatus.c:713
#define PI
Definition: mbggeo.h:264