124 #define MBG_FIRST_COPYRIGHT_YEAR 2001 125 #define MBG_LAST_COPYRIGHT_YEAR 0 // use default 129 static const char *
pname =
"mbgctrl";
152 #define _get_time_scale_name( _i ) \ 153 ( ( (_i) < N_MBG_TIME_SCALE ) ? time_scale_names[_i] : str_unknown ) 157 #define _get_pout_mode_name( _i ) \ 158 ( ( (_i) < N_POUT_MODES ) ? pout_mode_names_eng[_i] : str_unknown ) 161 static const char no_gps_cmd[] =
"does not support GPS commands";
162 static const char no_tzdl[] =
"does not support configurable time zone";
163 static const char no_tz[] =
"does not support time zones";
164 static const char no_synth[] =
"has no synthesizer output";
167 static const char no_time_scale[] =
"does not support a configurable time scale";
169 static const char no_ptp[] =
"does not provide PTP";
170 static const char no_cab_len[] =
"does not support antenna signal delay compensation";
256 #define SHOW_INDENT_1 " " 257 #define SHOW_INDENT_2 " " 316 #define _ptp_role_name( _i ) \ 317 ( ( (_i) < N_PTP_ROLES ) ? ptp_roles[_i] : str_unknown ) 319 #define _ptp_role_name_short( _i ) \ 320 ( ( (_i) < N_PTP_ROLES ) ? ptp_roles_short[_i] : str_unknown ) 334 __attribute__( ( format( printf, 4, 5 ) ) )
336 const
char *cmd_parm, const
char *cmd_comment_fmt, ... )
341 if ( p_ind->indent_1 )
342 n += printf(
"%*s", p_ind->indent_1,
str_empty );
346 n += printf(
"%s", p_opt->cmd_name );
352 n+= printf(
"%s",
"<n>" );
354 n += printf(
"=%s", cmd_parm );
359 if ( cmd_comment_fmt )
364 if ( p_ind->indent_2 )
366 int w = p_ind->indent_2 - n;
374 va_start( arg_list, cmd_comment_fmt );
375 n += vprintf( cmd_comment_fmt, arg_list );
399 __attribute__( ( format( printf, 2, 3 ) ) )
409 va_start( arg_list, fmt );
410 n += vprintf( fmt, arg_list );
426 int n_known,
const char *
const names[],
STR_FNC *s_fnc,
429 const char *str_s_fnc = s_fnc ? s_fnc( inst_idx ) :
str_empty;
435 supp_mask = ( 1
UL << n_known ) - 1;
438 printf(
"Known %s%s: ", info_1, str_s_fnc );
440 printf(
"No %s%s known.", info_1, str_s_fnc );
446 printf(
"%s", info_1 );
449 printf(
" %s", info_2 );
452 printf(
" (%04lX)", (
ulong) supp_mask );
459 printf(
"No %s.", info_1 );
462 printf(
" %s", info_2 );
475 for ( i = 0; i < n_known; i++ )
479 if ( ( supp_mask & ( 1
UL << i ) ) == 0 )
501 printf(
"%s%s", n_printed ? str_sep :
str_empty, cp );
516 printf(
"This device %s.\n", msg );
530 printf(
"The clock's time zone setting has been set to %s.\n", s );
547 printf(
"The clock's time zone setting has been set to %s.\n", info );
558 const char *tz_info = NULL;
559 TZDL *tz_tzdl = NULL;
563 if ( strcmp( tz_name,
"UTC" ) == 0 )
569 else if ( strcmp( tz_name,
"CET" ) == 0 )
575 else if ( strcmp( tz_name,
"EET" ) == 0 )
583 printf(
"** Unknown timezone name %s\n", tz_name );
613 printf(
"%s timezone offset: UTC%+lis", info, (
long) tzdl.
offs );
625 long tzdl_offs = atol( s );
629 fprintf( stderr,
"** Time zone offset %li exceeds range (%li..%li)\n",
634 tzdl.
offs = (int32_t) tzdl_offs;
651 printf(
"%s synthesizer settings: freq %i.%iE%i Hz, phase %+i.%i deg", info,
672 long freq = strtol( s, &cp, 10 ) * 10;
676 long frac = strtol( ++cp, NULL, 10 );
677 if ( frac < 0 || frac > 9 )
707 printf(
"On-board LAN interface settings:" );
710 printf(
" (DHCP client)\n" );
716 printf(
" IP Address: %s\n", ws );
719 printf(
" Net Mask: %s\n", ws );
722 printf(
" Broadcast Addr: %s\n", ws );
725 printf(
" Gateway: %s\n", ws );
739 int abs_i = abs( i );
763 int unicast_supported;
773 printf(
"\nPTP configuration:\n");
789 if ( unicast_supported )
798 printf(
"\nConfigured PTP unicast master" );
804 printf(
" (not used for this role)" );
808 printf(
" GM Host: %s\n", p->
gm_host );
811 printf(
" GM Clock ID: %s%s\n", ws,
847 uint32_t supp_mask,
const char *info )
852 for ( i = 0; i < n_entries; i++ )
856 if ( strncmp( s, cp, strlen( cp ) ) == 0 )
857 if ( supp_mask & ( 1
UL << i ) )
861 printf(
"error: %s %s\n",
862 ( i == n_entries ) ?
"unknown" :
"unsupported",
886 char *cp = strstr( arg,
id );
929 int n_entries, uint32_t supp_mask,
const char *info )
970 int16_t range_max,
int is_supported,
const char *info )
986 if ( ( tmp < range_min ) || ( tmp > range_max ) )
988 printf(
"error: %s %i out of range (%i..%i)\n", info, tmp, range_min, range_max );
993 printf(
" setting %s: %i\n", info, tmp );
1018 int unicast_supported;
1019 int uc_master_idx = 0;
1020 const char *err_info = NULL;
1030 prv_all_ptp_cfg_info = all_ptp_cfg_info;
1039 p_uc_settings = &p_uc_info->
settings;
1108 printf(
"error: No valid V1 HWC settings!\n" );
1122 if ( !unicast_supported )
1146 if ( !unicast_supported )
1155 printf(
" GM IP Address: %s\n", ws );
1157 memset( p_uc_settings->
gm_host, 0,
sizeof( p_uc_settings->
gm_host ) );
1158 strcpy( p_uc_settings->
gm_host, ws );
1180 if ( !unicast_supported )
1190 idx =
sizeof( gm_clock_id );
1195 if ( idx !=
sizeof( gm_clock_id ) )
1197 printf(
"Syntax error in specified GM clock ID\n" );
1205 printf(
" setting GM Clock ID: %s\n", ws );
1221 if ( !unicast_supported )
1231 printf(
" setting GM port id: %d%s\n", p_uc_settings->
gm_port_id,
1268 1,
"delay req. intv." );
1280 unicast_supported,
"msg. duration" );
1288 if ( memcmp( &all_ptp_cfg_info, &prv_all_ptp_cfg_info,
sizeof( all_ptp_cfg_info ) ) != 0 )
1300 printf(
"Invalid parameter in argument" );
1303 printf(
" %s", err_info );
1316 size_t l = strlen( p->
name );
1319 if ( strncmp( s, p->
name, l ) != 0 )
1363 if ( strcmp( arg,
"DHCP" ) == 0 )
1365 ip4_settings = prv_ip4_settings;
1398 if ( ip4_settings.
ip_addr == 0 )
1401 if ( ip4_settings.
ip_addr == 0 )
1403 printf(
"*** Aborting: No IP address specified\n" );
1407 if ( ip4_settings.
netmask == 0 )
1410 if ( ip4_settings.
netmask == 0 )
1412 printf(
"*** Aborting: No network mask specified\n" );
1417 default_broad_addr = ip4_settings.
ip_addr | ~ip4_settings.
netmask;
1420 ip4_settings.
broad_addr = default_broad_addr;
1422 if ( ip4_settings.
broad_addr != default_broad_addr )
1428 printf(
"*** Warning: Broadcast address %s does not match the default broadcast address %s\n",
1432 if ( ip4_settings.
gateway == 0 )
1448 printf(
"*** Warning: invalid LAN interface parameter syntax\n" );
1464 double r2d = 180 /
PI;
1466 new_pos_lla[
LAT] = strtod( gp, &cp ) /
r2d;
1471 new_pos_lla[
LON] = strtod( cp, &cp ) /
r2d;
1476 new_pos_lla[
ALT] = strtod( cp, &cp );
1479 ( ( new_pos_lla[
LAT] * r2d ) < -90 ) ||
1480 ( ( new_pos_lla[
LAT] * r2d ) > +90 ) ||
1481 ( ( new_pos_lla[
LON] * r2d ) < -180 ) ||
1482 ( ( new_pos_lla[
LON] * r2d ) > +180 ) ||
1483 ( new_pos_lla[
ALT] < -50 ) ||
1484 ( new_pos_lla[
ALT] > 20000 )
1494 printf(
"The clock's receiver position has been set to lat=%+.4f, lon=%+.4f, alt=%.0fm\n",
1495 new_pos_lla[
LAT] * r2d, new_pos_lla[
LON] * r2d, new_pos_lla[
ALT] );
1501 fprintf( stderr,
"** Invalid GPS position parameters: %s\n", gp );
1511 const char *sdate,
const char *stime )
1515 unsigned int year = 0;
1516 unsigned int month = 0;
1517 unsigned int mday = 0;
1518 unsigned int hour = 0;
1519 unsigned int min = 0;
1520 unsigned int sec = 0;
1521 unsigned int sec100 = 0;
1528 if ( sdate == NULL || stime == NULL )
1539 rc = sscanf( sdate,
"%u-%u-%u", &year, &month, &mday );
1542 || ( month < 1 ) || ( month > 12 )
1543 || ( mday < 1 ) || ( mday > 31 ) )
1545 printf(
"** Invalid date: %04u-%02u-%02u\n", year, month, mday );
1553 rc = sscanf( stime,
"%u:%u:%u.%u", &hour, &min, &sec, &sec100 );
1559 || ( sec100 > 99 ) )
1561 printf(
"** Invalid time: %02u:%02u:%02u.%02u\n", hour, min, sec, sec100 );
1626 struct tm tm = { 0 };
1628 tm.tm_year = year - 1900;
1629 tm.tm_mon = month - 1;
1658 printf(
"Device date/time have been set.\n" );
1700 ( p_rpcfg->
pii[0].port_info.port_settings.parm.baud_rate == 0 ) )
1720 const PORT_SETTINGS *p_ps = &p_rpcfg->
pii[port_num].port_info.port_settings;
1722 int n = snprintf( s, sz,
"\"%s\" %s at %lu/%s",
1745 printf(
"Serial port COM%u: %s.\n", i, ws );
1756 const char *msg_nsupp_drvr =
"is not supported by the driver software";
1758 const PORT_INFO *p_pi = &p_rpcfg->
pii[port_num].port_info;
1766 printf(
"** Baud rate %lu is not supported by %s%u.\n",
1771 printf(
"** Framing %s %s.\n", p_ps->
parm.
framing, msg_nsupp_drvr );
1774 printf(
"** Framing %s is not supported by %s%u.\n",
1779 printf(
"** Handshake mode %u %s.\n", p_ps->
parm.
handshake, msg_nsupp_drvr );
1782 printf(
"** Handshake mode %u is not supported by %s%u.\n",
1787 printf(
"** String type index %u exceeds number of string types supp. by device.\n",
1791 printf(
"** String type \"%s\" is not supported by %s%u.\n",
1793 port_name, port_num );
1797 printf(
"** String mode index %u exceeds number of string modes supported by driver software (%u).\n",
1801 printf(
"** String mode \"%s\" is not supported by string type \"%s\" via %s%u .\n",
1804 port_name, port_num );
1843 for ( i = 0; i <
sizeof( p_ps->
parm.
framing ); i++ )
1847 if ( !isalnum( c ) )
1863 ul = strtoul( cp, &p_tail, 10 );
1876 ul = strtoul( cp, &p_tail, 10 );
1901 printf(
"The clock's COM%u port has been set to %s.\n", port_num, ws );
1907 fprintf( stderr,
"** Invalid COM port parameters: %s\n", parm_str );
1924 ( api[0].pout_info.supp_modes == 0 ) )
1948 usage_line( p_ind, p_opt, NULL,
"Show settings of the programmable output(s)" );
1949 usage_line( p_ind, p_opt,
"MODE:<m>[,LEN:<l>][,INV:<i>][,OIS:<o>][,SHIFT:<s>]",
"Configure programmable output <n>" );
1954 printf(
" MODE:<m> Specifies the programmable output mode with index <m>, see mbgctrl -?.\n" 1955 " Please note that subsequent parameters may only be appropriate for specific modes.\n\n" );
1957 printf(
" LEN:<l> Specifies the pulse lenght for modes that support this.\n" 1958 " <l> is an integer value in 10 ms units, i.e. <l> = 20 yields 200 ms.\n\n" );
1960 printf(
" INV:<i> \"Inverted\" flag specifying if the output level is to be inverted,\n" 1961 " if the output supports this.\n" 1962 " Values for <i>: 1 invert output level, 0 don't invert.\n\n" );
1964 printf(
" OIS:<o> \"Only If Sync\" flag specifying if the output is to be enabled ONLY\n" 1965 " while the device is synchronized, if the output supports this.\n" 1966 " Values for <o>: 1 enable this feature, 0 disable this feature\n" 1967 " NOTE: This overrides the Enable Flags settings (parameter \"EF\").\n" 1968 " The output is enabled ONLY when the device state changes to \"synchronized\"\n" 1969 " after power-up, and is disabled again when the device enters holdover mode,\n" 1970 " i.e. the reference signal is lost.\n\n" );
1972 printf(
" SHIFT:<s> Specifies a phase shift of the output slope, if the output supports this.\n" 1973 " <s> is an integer value, in nanoseconds.\n" 1974 " The maximum range is %+li to %+li ns,\n" 1975 " corresponding to %+li to %+li ms.\n" 1976 " The effective resolution depends on the resolution of the device's internal clock,\n" 1977 " which may be e.g. 10 or 20 ns, depending on the device type. See mbgctrl -?.\n\n",
1979 (
long) DEFAULT_POUT_PULSE_SHIFT_MIN / 1000L, (
long) DEFAULT_POUT_PULSE_SHIFT_MAX / 1000L );
1995 for ( i = 0; i < n_pout; i++ )
2000 printf(
"Programmable output %i:\n", i );
2011 usage_note( p_ind_detailed->
indent_2,
"Pulse length is fixed and can't be changed." );
2014 usage_note( p_ind_detailed->
indent_2,
"Output supports pulse shift with resolution %u ns.",
2041 POUT_INFO *p_pi = &api[inst_num].pout_info;
2043 const char *err_info = NULL;
2056 memcpy( prv_api, api,
sizeof( prv_api ) );
2073 printf(
"Programmable output mode %i out of range (0..%i)\n", idx,
N_POUT_MODES - 1 );
2079 printf(
"Programmable output mode %i (%s) not supported for output %i\n",
2085 printf(
"Programmable output mode for output %i changed to %s (%i)\n",
2105 printf(
"Pulse length parameter not supported for mode \"%s\"\n",
2119 printf(
"Warning. pulse length %i (%i ms) is fix and can't be changed!\n",
2125 printf(
"Pulse length for programmable output %i changed to %i (%i ms)\n",
2144 if ( idx < 0 || idx > 1 )
2146 printf(
"Invalid flag value %i for parameter %s, must be 0 or 1\n", idx,
pout_name_inv );
2154 printf(
"Warning: Output level can't be inverted for output %i\n", inst_num );
2164 printf(
"Output level for output %i%s inverted\n",
2182 if ( idx < 0 || idx > 1 )
2184 printf(
"Invalid flag value %i for parameter %s, must be 0 or 1\n", idx,
pout_name_ois );
2192 printf(
"Warning: \"Only if sync\" flag not supported for output %i\n", inst_num );
2202 printf(
"\"Only if sync\" flag%s set for output %i\n",
2218 long pulse_shift = atol( cp );
2222 printf(
"Warning: pulse shift not supported for output %i\n", inst_num );
2228 printf(
"Pulse shift not supported for mode \"%s\"\n",
2237 printf(
"Pulse shift %li ns out of range (%+li..%+li ns)\n", pulse_shift,
2245 long l = pulse_shift - rem;
2247 #if 0 && defined( DEBUG ) 2248 printf(
"DEBUG: s %li, rem %li, l %li\n", pulse_shift, rem, l );
2251 if ( l != pulse_shift )
2253 printf(
"Warning: pulse shift %+li ns not appropriate for resolution %u ns, truncating to %li ns.\n",
2261 printf(
"Pulse shift for programmable output %i changed to %li ns\n",
2266 for ( i = 0; i < n_pout; i++ )
2270 if ( memcmp( p_ps, &prv_api[i].pout_info.pout_settings,
sizeof( *p_ps ) ) )
2283 printf(
"Invalid parameter in argument" );
2286 printf(
" %s", err_info );
2312 printf(
"%s:", cmd_info );
2316 for ( i = 0; i < n_pout; i++ )
2328 printf(
"Output %i: ", i );
2335 printf(
", len %u ms", (
unsigned int) ps->
mode_param * 10 );
2352 const char *cp = NULL;
2363 printf(
", %sdisabled %sif sync. lost",
2390 printf(
"%s:%u", info, ( flag ==
EF_OFF ) ? 0 : 1 );
2407 printf(
"%s enable flags: ", info );
2429 size_t l = strlen( p->
name );
2431 if ( strncmp( s, p->
name, l ) != 0 )
2439 if ( s[l] !=
'0' && s[l] !=
'1' )
2522 printf(
"NOTE: the command code %u has been sent to the GPS clock.\n", cmd );
2539 printf(
"%s antenna cable length: %u meter(s)", info, len );
2571 event_time = time( NULL ) + strtol( s, NULL, 10 );
2572 event_ts.
sec = (uint32_t) event_time;
2581 printf(
"Event time set to UTC %s\n", ws );
2600 printf(
"This device does not support a configurable time scale.\n" );
2633 printf(
"%s time scale index: %u (%s)", info, tsci.
settings.
scale,
2660 printf(
"*** Error: new time scale index (%u) out of range (0..%u)\n",
2667 printf(
"*** Warning: new time scale index (%u) not supported by device\n",
2693 printf(
"Usage: %s cmd [dev]\n" 2695 "where cmd can be one of the following:\n" 2696 " BOOT set GPS clock to warm boot mode, sat info is kept\n" 2697 " COLDBOOT set GPS clock to cold boot mode, all sat info is cleared\n" 2698 " GPSPOS=x.x,y.y,z set GPS position to (lat,lon,alt)\n",
2703 printf(
" DATE=yyyy-mm-dd set on-board date to year, month, day-of-month\n" 2704 " TIME=hh:mm:ss.hh set on-board time to hours, mins, secs, hundredths\n" 2708 printf(
" TIMESCALE show clock's time scale setting, if supported\n" 2709 " TIMESCALE=<n> set clock's time scale to scale with index <n>\n" 2716 printf(
" Known time scales:\n" );
2717 for ( i = 0; i < n_time_scale; i++ )
2722 printf(
" (default)" );
2728 printf(
" (Configurable time scales not supported by this device)\n" );
2731 printf(
" TZOFFS show clock's time zone offset, if supported\n" 2732 " TZOFFS=<n> set clock's basic time zone to UTC with additional offset, in seconds\n" 2735 printf(
" TZ=UTC set time zone code to %s\n" 2736 " TZ=CET set time zone code to %s\n" 2737 " TZ=EET set time zone code to %s\n",
2744 printf(
" COMPARM show clock's COM port parameters\n" 2745 " COM<n>=<bd>,<f>[,<t>[,<m>]] set parameters of clock's port COM<n>" 2749 " <bd> is one of:" );
2754 " <f> is one of:" );
2758 printf(
"\n <t> optional time string format index" );
2768 printf(
"\n %u: %s", i, p_sti->
long_name );
2772 printf(
"\n <m> optional time string mode index" );
2782 " Please note not each baud rate, framing, string format and mode\n" 2783 " must necessarily be supported by every individual serial port.\n" );
2792 printf(
" EF show clock's enable flags\n" 2793 " EF=SERIAL:0,PULSES:1,SYNTH:0 modify clock's enable flags\n" 2795 " SERIAL controls the serial port output\n" 2796 " PULSES controls pulse outputs and IRIG timecode output, if available\n" 2797 " SYNTH controls a programmable synthesizer output, if available\n" 2799 " 0 or 1 controls when the corresponding output signals are enabled:\n" 2800 " 0: only after the card has synchronized to its incoming signal\n" 2801 " 1: immediately after power-up\n" 2803 " Please note that not every device supports enable flags.\n" 2807 printf(
" LAN show board's LAN interface settings\n" 2808 " LAN=DHCP set LAN interface to be configured via DHCP\n" 2809 " LAN=IP:<ip>[,NM:<nm>][,BA:<ba>][,GW:<gw>] set LAN interface to given static settings\n" 2811 " where each of <ip>,<nm>,<ba>,<gw> is an IPv4 address of the form aaa.bbb.ccc.ddd, e.g.:\n" 2812 " IP:192.168.1.115 specifies the IP address\n" 2813 " NM:255.255.255.0 specifies the net mask\n" 2814 " BA:192.168.1.255 specifies the broadcast address\n" 2815 " GW:192.168.1.1 specifies the default gateway\n" 2817 " If no broadcast address is specified then the default broadcast address\n" 2818 " is computed from the IP address and the network mask.\n" 2820 " Please note that not every device provides a LAN interface.\n" 2821 " Also, the IP values above are examples only. The real values to be used\n" 2822 " depend on the settings of the network to which the card is attached.\n" 2826 printf(
" PTP show board's PTP settings\n" 2827 " PTP=NP:<np>[,DM:<dm>][,DO:<do>][,HW:<hw>] set general PTP protocol parameters\n" 2830 " NP:IP4 specifies UDP/IPv4 (Layer 3) as network protocol\n" 2831 " NP:ETH specifies IEEE 802.3 (Layer 2) as network protocol\n" 2832 " DM:E2E specifies end-to-end delay mechanism\n" 2833 " DM:P2P specifies peer-to-peer delay mechanism\n" 2834 " DO:0 specifies PTP domain number [0..255]\n" 2835 " HW:1 specifies if the \"v1 hardware compatibility flag\" shall be set ('1') or disabled ('0')\n" 2836 " (this is usually not required)\n" 2840 printf(
" If the PTP device supports unicast slave mode then the following parameters\n" 2841 " can be specified to configure a unicast master to be queried:\n" 2842 " PTP=ROLE:<rl>[,GMIP:<ip>][,GMID:<id>][,PID:<po>][,SMI:<sr>][,AMI:<ar>][,DRI:<dr>][,DUR:<du>] set PTP unicast parameters\n" 2845 " ROLE:MCS specifies \"Multicast Slave\" PTP role\n" 2846 " ROLE:UCS specifies \"Unicast Slave\" PTP role\n" 2847 " GMIP:192.168.1.115 specifies the IP address of the grandmaster\n" 2848 " GMID:FF:FF:FF:FF:FF:FF:FF:FF specifies the Clock ID of the grandmaster, or '*' as wildcard for all 'FF'\n" 2849 " PID:1 specifies the target Port ID of the grandmaster port to be used, or '*' for wildcard\n" 2850 " SMI:0 specifies the Sync Message Interval requested from the grandmaster in 2^x seconds [-6..6]\n" 2851 " AMI:1 specifies the Announce Message Interval requested from the grandmaster in 2^x seconds [-6..6]\n" 2852 " DRI:1 specifies the Delay Request Interval requested from the grandmaster in 2^x seconds [-6..6]\n" 2853 " DUR:300 specifies the duration in seconds how long the master shall send messages to the slave until a timeout or renewal occurs\n" 2857 printf(
" ANT_CABLE_LEN show the configured antenna cable length\n" 2858 " ANT_CABLE_LEN=<len> set the antenna cable length to be compensated to <len>, in meters.\n" 2860 " Please note note this parameter is only supported with cards which provide\n" 2861 " compensation of the antenna cable signal propagation delay, i.e. GPS cards.\n" 2868 printf(
" EVENT=<n> set event time to system time + <n> seconds\n" );
2878 char *match = strstr( s, keyword );
2880 if ( match && ( match == s ) )
2881 return &s[strlen( keyword )];
2893 const char *sdate = NULL;
2894 const char *stime = NULL;
2898 int error_occurred = 0;
2902 for ( i = 1; i < argc; i++ )
2912 if ( ( strcmp( argv[i],
"-?" ) == 0 ) ||
2913 ( strcmp( argv[i],
"-h" ) == 0 ) ||
2914 ( strcmp( argv[i],
"--help" ) == 0 ) )
2920 if ( strcmp( argv[i],
"COLDBOOT" ) == 0 )
2933 if ( strcmp( argv[i],
"BOOT" ) == 0 )
3008 printf(
"** Invalid parameter: %s\n", argv[i] );
3016 printf(
"** This device does not provide a configurable COM port.\n" );
3040 port_num = strtoul( cp, &p_tail, 10 );
3044 printf(
"** Invalid COM port specification: %s\n", argv[i] );
3053 printf(
"** COM port number %lu exceeds maximum %u\n",
3061 printf(
"** Invalid COM port specification: %s\n", argv[i] );
3087 printf(
"Programmable outputs not supported!\n" );
3091 pout_num = strtoul( cp, &p_tail, 10 );
3095 show_pout( dh, &ohs_pout, p_dev,
"Current programmable outputs settings" );
3101 if ( pout_num >= n_pout )
3103 printf(
"** Programmable output number %lu exceeds maximum %lu\n",
3111 printf(
"** Invalid programmable output specification: %s\n", argv[i] );
3116 rc =
eval_pout( dh, ++cp, (
unsigned) pout_num );
3118 show_pout( dh, &ohs_pout, p_dev,
"Current programmable outputs settings" );
3130 char *info =
"Current";
3144 printf(
"*** Warning: invalid enable flag parameter syntax\n" );
3164 char *info =
"Current";
3197 char *info =
"Current";
3230 char *info =
"Current";
3263 char *info =
"Current";
3296 char *info =
"Current";
3325 char *info =
"Current";
3366 printf(
"*** Warning: invalid event time parameter\n" );
3380 printf(
"** Unknown command: %s\n", argv[i] );
3388 if ( sdate || stime )
3396 if ( error_occurred )
3429 sizeof( tmp_dev_fn ) );
3460 usage( dh, pdev, &ri, &rpcfg );
POUT_DATA pout_data
Additional configuration data, see POUT_DATA.
static const char str_spc_not[]
PTP_CFG_INFO ptp_cfg_info
uint8_t pulse_shift_res
pulse shift resolution, in [ns], only if POUT_SUPP_PULSE_SHIFT, see POUT_DATA::pulse_shift ...
static const char ptp_name_ami[]
uint8_t PCPS_TZCODE
Type of variable to hold a TZ code.
the number of known modes
#define MBG_PS_MSK_HS
see MBG_PS_BIT_HS
uint8_t n_str_type
max num of string types supported by any port
TM_GPS tm
time converted to UTC and/or local time according to TZDL settings
uint8_t year
year of the century, 0..99
_MBG_API_ATTR int _MBG_API mbg_set_gps_cmd(MBG_DEV_HANDLE dh, const GPS_CMD *p)
Send one of the PC_GPS_COMMANDS to a GPS receiver device.
static void show_serial_settings(MBG_DEV_HANDLE dh, const RECEIVER_PORT_CFG *p_rpcfg, const RECEIVER_INFO *p_ri)
static int chk_parm_name(const char *arg, const char *id, char **p)
Lookup a parameter in an argument list and check if a colon is appended.
COM_PARM parm
transmission speed, framing, etc.
#define _ptp_role_name(_i)
static const char pout_name_shift[]
static const char ip4_name_ba[]
_MBG_API_ATTR int _MBG_API mbg_get_gps_ant_cable_len(MBG_DEV_HANDLE dh, ANT_CABLE_LEN *p)
Read the configured antenna cable length from a device.
#define _get_time_scale_name(_i)
static const char pout_name_len[]
static int set_event_time(MBG_DEV_HANDLE dh, const char *s)
static const char ptp_name_gmid[]
const char * not_supp_msg
static int snprint_port_cfg(char *s, int sz, unsigned int port_num, const RECEIVER_PORT_CFG *p_rpcfg)
uint16_t PTP_PORT_ID
A PTP port ID.
static int get_n_time_scale(MBG_DEV_HANDLE dh, MBG_TIME_SCALE_INFO *p_tsci)
static int set_tzdl_offs(MBG_DEV_HANDLE dh, const char *s)
#define POUT_MODES_MODE_PARAM_AS_PULSE_LEN
POUT modes which use POUT_SETTINGS::mode_param as pulse length.
minimum message duration [s]
Settings of an IPv4-only network interface.
int32_t frac
fractions of a second, 1/RECEIVER_INFO::ticks_per_sec units
uint32_t IP4_ADDR
An IPv4 address.
uint8_t mday
day of month, 0..31
static void printf_ef(uint16_t flag, const char *info)
uint16_t n_supp_master
number of unicast masters which can be specified
uint8_t sec100
hundredths of seconds, 0..99, 10 ms resolution
A structure used to configure a PTP port.
uint32_t flags
see PTP_CFG_FLAG_MASKS
#define MBG_PS_MSK_STR_MODE
see MBG_PS_BIT_STR_MODE
_MBG_API_ATTR int _MBG_API mbg_set_time_scale_settings(MBG_DEV_HANDLE dh, const MBG_TIME_SCALE_SETTINGS *p)
Write the time scale configuration to a device.
Requested action completed successfully.
Information on a supported string format.
Time scale configuration settings plus capabilities.
int16_t ann_intv
announce interval [log2 s]
static const char ef_name_serial[]
const INDENTS show_indents
#define MBG_ERR_PARM_FMT
parameter string format error
#define _pcps_has_cab_len(_d)
int16_t freq
four digits used; scale: 0.1 Hz; e.g. 1234 -> 123.4 Hz
_MBG_API_ATTR int _MBG_API mbg_set_gps_enable_flags(MBG_DEV_HANDLE dh, const ENABLE_FLAGS *p)
Write an ;;ENABLE_FLAGS structure to configure when outputs shall be enabled.
PTP_UC_MASTER_CFG_LIMITS ptp_uc_master_cfg_limits
int16_t sync_intv_max
log2 of maximum sync interval [s]
#define MBG_ERR_INV_PARM
Invalid parameter.
#define MBG_PS_MSK_STR_TYPE
see MBG_PS_BIT_STR_TYPE
static int show_ptp_cfg(MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev, const char *info)
uint8_t scale
current time scale code, see MBG_TIME_SCALES
_MBG_API_ATTR int _MBG_API mbg_get_time_scale_info(MBG_DEV_HANDLE dh, MBG_TIME_SCALE_INFO *p)
Read the current time scale settings and which time scales are supported.
#define PTP_ROLE_STRS
Name strings for defined PTP roles.
static const char str_spc_wildcard[]
int16_t channel
-1: the current on-board time; >= 0 the capture channel number
#define _pcps_has_event_time(_d)
uint32_t ticks_per_sec
resolution of fractions of seconds, see GPS_TICKS_PER_SEC
Configuration settings of a serial port.
#define DEFAULT_ENG_MODE_NAMES
Initializer for an English mode name string table.
bool mbg_cond_err_msg(int rc, const char *what)
Check if a value is an error code and print an associated error message.
#define TZ_INFO_EET_EEST_EN
static const char ptp_name_del[]
PCPS_SECONDS sec
seconds since 1970, usually UTC scale
static int set_tz_code(MBG_DEV_HANDLE dh, PCPS_TZCODE tzcode, const char *s)
#define TZ_INFO_CET_CEST_EN
int8_t sec
seconds, 0..59, or 60 in case of inserted leap second
number of defined protocols
#define MBG_PS_MSK_STR_TYPE_OVR_DEV
see MBG_PS_BIT_STR_TYPE_OVR_DEV
#define MAX_POUT_PULSE_LEN
10 secs, in 10 msec units
static int set_ptp_cfg(MBG_DEV_HANDLE dh, const char *arg, const PCPS_DEV *p_dev)
int16_t phase
-MAX_SYNTH_PHASE..+MAX_SYNTH_PHASE; >0 -> pulses later
#define _int_from_size_t(_n)
_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.
static int set_lan_intf(MBG_DEV_HANDLE dh, const char *arg, const PCPS_DEV *p_dev)
Unable to handle requested action, usage printed.
#define DEFAULT_TZDL_EET_EEST_EN
static const char ptp_name_dur[]
#define MBG_ERR_GENERIC
Generic error.
_MBG_API_ATTR int _MBG_API mbg_set_tzcode(MBG_DEV_HANDLE dh, const PCPS_TZCODE *p)
Write time zone/daylight saving configuration code to a device.
static const char ef_name_synth[]
MBG_TIME_SCALE_SETTINGS max_settings
number of scales, all supported flags
#define mbg_rc_is_success(_rc)
#define _pcps_has_ptp(_d)
uint8_t delay_mech
see PTP_DELAY_MECHS
static const char no_synth[]
#define MBG_ERR_RANGE
input parameter was out of range
int mbg_get_serial_settings(MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev, RECEIVER_PORT_CFG *p_rpcfg, const RECEIVER_INFO *p_ri)
Read all serial port settings and supported configuration parameters.
both serial ports on, use with ENABLE_FLAGS::serial
uint8_t mday
day of month, 0..31
uint8_t month
month, 1..12
static const char ptp_name_v1[]
_MBG_API_ATTR int _MBG_API mbg_get_ip4_settings(MBG_DEV_HANDLE dh, IP4_SETTINGS *p)
Read LAN IPv4 settings from a device.
static const char ptp_name_pid[]
uint8_t ptp_role
one of the supported PTP roles, see PTP_ROLES
static const char no_tzdl[]
uint8_t min
minutes, 0..59
int8_t mday
day of month, 1..31
uint8_t n_com_ports
number of on-board serial ports
uint16_t mode
Mode of operation, see POUT_MODES.
uint8_t sec
seconds, 0..59, or 60 if leap second
char long_name[23]
long name of the string format
MBG_CHK_SUPP_FNC * chk_supp_fnc
static const char tz_info_eet_eest[]
const char *() STR_FNC(int idx)
#define MBG_PS_MSK_BAUD_RATE_OVR_SW
Flag bit masks associated with MBG_COM_CFG_STATUS_BITS.
int16_t year
year number, 0..9999
#define PTP_NW_PROT_STRS
Name strings for the protocols possibly used with PTP.
Configuration settings for a single programmable pulse output.
e.g. COM0=, COM1=, etc. vs. TZ=
IP4_ADDR ip_addr
the IP address
#define PTP_CFG_MSK_V1_HW_COMPAT
see PTP_CFG_V1_HW_COMPAT
uint32_t supp_flags
a bit mask of supported features, see PTP_CFG_FLAG_MASKS
static const char no_cab_len[]
Current settings and general capabilities of a programmable pulse output.
_MBG_API_ATTR int _MBG_API mbg_get_synth(MBG_DEV_HANDLE dh, SYNTH *p)
Read the current frequency synthesizer settings from a device.
static const char *const pout_mode_names_eng[N_POUT_MODES]
see POUT_BIT_NOT_INVERTIBLE, POUT_INVERTED
#define MBG_LAST_COPYRIGHT_YEAR
static const char * intv_str(int i)
static int show_synth(MBG_DEV_HANDLE dh, const char *info)
int16_t ann_intv
log2 of the announce interval [s]
static int ef_check_parm(const char *s, EF_INFO *p)
uint16_t nw_prot
see PTP_NW_PROTS
_MBG_API_ATTR int _MBG_API mbg_set_time(MBG_DEV_HANDLE dh, const PCPS_STIME *p)
Set the device's on-board clock to a given date and time.
uint16_t model_code
identifier for receiver model, see GPS_MODEL_CODES
PTP_UC_MASTER_SETTINGS settings
current settings
static const char ptp_name_dri[]
char framing[4]
ASCIIZ framing string, e.g. "8N1" or "7E2", see MBG_FRAMING_STRS.
MBG_HOSTNAME gm_host
grandmaster's hostname or IP address
uint8_t str_type
index of the supported time string formats, see STR_TYPE_INFO_IDX
uint8_t domain_number
the PTP clock domain number, 0:3
static const char * nw_prot_short[]
static int help_pout_arg(MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev, const OPT_HANDLER_SPEC *p_opt, CTRL_FLAGS ctrl_flags)
static int set_time_scale(MBG_DEV_HANDLE dh, const char *arg, const PCPS_DEV *p_dev)
ALL_PTP_UC_MASTER_INFO_IDX all_ptp_uc_master_info_idx
static const char no_enable_flags[]
uint16_t mode_param
Optional parameter depending on the mode, see POUT_MODES_PARAM_MASKS.
uint16_t ANT_CABLE_LEN
A data type used to configure the length of an antenna cable [m].
#define _pcps_has_time_scale(_d)
static const char tz_info_utc[]
A structure to used to query the current configuration and capabilities of a PTP port.
static int print_indent(int i)
#define MBG_TIME_SCALE_STRS
int main(int argc, char *argv[])
uint16_t status
status flags, see TM_GPS_STATUS_BIT_MASKS
static int show_pout(MBG_DEV_HANDLE dh, const OPT_HANDLER_SPEC *p_opt, const PCPS_DEV *p_devx, const char *cmd_info)
static int send_gps_cmd(MBG_DEV_HANDLE dh, ushort cmd)
#define MBG_PS_MSK_BAUD_RATE
see MBG_PS_BIT_BAUD_RATE
static const PTP_CLOCK_ID clock_id_wildcard
#define PTP_NW_PROT_STRS_SHORT
Short name strings for the protocols possibly used with PTP.
OPT_HANDLER_SPEC ohs_pout
static int set_timezone(MBG_DEV_HANDLE dh, const char *tz_name, const PCPS_DEV *p_dev)
A structure used to transmit information on date and time.
force a GPS receiver to boot mode
int16_t delay_req_intv
delay request interval [log2 s]
both pulses P_SEC and P_MIN on, use with ENABLE_FLAGS::pulses
#define MBG_ERR_CFG
Tried to write invalid configuration parameters to device, has to match PCPS_ERR_CFG (see also MBG_ER...
int str_to_octets(uint8_t *octets, int num_octets, const char *s)
Set a MAC ID or a similar array of octets from a string.
uint16_t flags
see MBG_IP4_FLAG_MASKS
see POUT_BIT_FIXED_PULSE_LEN
uint16_t serial
EF_OFF or EF_SERIAL_BOTH
static const char ef_name_pulses[]
PCPS_FRAC_32 frac
binary fractions of second, see PCPS_FRAC_32
static __mbg_inline uint32_t get_supp_ptp_role_mask(uint32_t flags)
Derive a "supported PTP roles" bit mask from PTP_CFG_INFO::supp_flags.
static void usage(MBG_DEV_HANDLE dh, PCPS_DEV *p_dev, RECEIVER_INFO *p_ri, RECEIVER_PORT_CFG *p_rpcfg)
static int check_get_pout_cfg(MBG_DEV_HANDLE dh, ALL_POUT_INFO_IDX api, RECEIVER_INFO *p_ri)
Limits to be considered when specifying PTP unicast masters.
static const char tz_info_cet_cest[]
#define PTP_DELAY_MECH_NAMES
Name strings for the PTP delay mechanisms.
#define _pcps_has_gps_data(_d)
#define _ptp_role_name_short(_i)
see POUT_BIT_INVERTED, POUT_NOT_INVERTIBLE
PTP_PORT_ID gm_port_id
use target port ID of master port (e.g. 135) or PTP_PORT_ID_WILDCARD
static const char * ptp_roles_short[]
static int set_gps_pos(MBG_DEV_HANDLE dh, const char *gp)
int MBG_CHK_SUPP_FNC(MBG_DEV_HANDLE dh)
The type of functions to check if a feature is supported.
#define _pcps_has_tzcode(_d)
const char * mbg_baud_rate_strs[N_MBG_BAUD_RATES]
static int check_setup_receiver_info(MBG_DEV_HANDLE dh, RECEIVER_INFO *p_ri)
static const char pout_name_inv[]
static int get_chk_str_table_idx(const char *s, const char *tbl[], int n_entries, uint32_t supp_mask, const char *info)
Lookup a string in a string table and return the table index.
static int set_enable_flags(MBG_DEV_HANDLE dh, const char *arg, const PCPS_DEV *p_dev)
static const char ip4_name_gw[]
int SET_FNC(MBG_DEV_HANDLE, const char *, int)
All PTP configuration parameters.
#define _pcps_has_tzdl(_d)
static const char ip4_name_ip[]
#define POUT_MODES_DATA_PULSE_SHIFT
POUT modes which use POUT_DATA::pulse_shift.
int32_t offs
standard offset from UTC to local time [sec]
#define PTP_ROLE_STRS_SHORT
Short name strings for defined PTP roles.
#define _pcps_has_lan_intf(_d)
_MBG_API_ATTR int _MBG_API mbg_set_gps_tzdl(MBG_DEV_HANDLE dh, const TZDL *p)
Write the card's time zone/daylight saving parameters.
#define _is_supported(_i, _msk)
const INDENTS usage_indents
_MBG_API_ATTR int _MBG_API mbg_set_event_time(MBG_DEV_HANDLE dh, const PCPS_TIME_STAMP *p)
static const char ptp_name_smi[]
_MBG_API_ATTR int _MBG_API mbg_get_gps_all_pout_info(MBG_DEV_HANDLE dh, POUT_INFO_IDX pii[], const RECEIVER_INFO *p_ri)
Read current configuraton and features provided by the programmable pulse outputs.
static int set_synth(MBG_DEV_HANDLE dh, const char *s)
#define DEFAULT_ENG_POUT_NAMES
An initializer for a table of English POUT name strings.
uint8_t year
year of the century, 0..99
int16_t delay_req_intv_min
log2 of minimum delay request interval [s]
static const char * str_parm_p(const char *s, const char *keyword)
Current settings and general capabilities of a serial port.
#define PTP_CFG_MSK_SUPPORT_PTP_UNICAST
A bit mask of the unicast role bits within the flag bits.
#define DEFAULT_TZDL_CET_CEST_EN
static const char ptp_name_role[]
struct OPT_HANDLER_SPEC_S OPT_HANDLER_SPEC
Configuration settings specifiying how to query a PTP unicast master.
int mbg_save_all_ptp_cfg_info(MBG_DEV_HANDLE dh, const ALL_PTP_CFG_INFO *p)
Write all PTP settings to a device.
uint8_t sec100
hundredths of seconds, 0..99, 10 ms resolution
the number of known baud rates
int32_t offs_from_utc
local time offset from UTC [sec]
_MBG_API_ATTR int _MBG_API mbg_set_synth(MBG_DEV_HANDLE dh, const SYNTH *p)
Write frequency synthesizer configuration settings to a device.
Time zone / daylight saving parameters.
#define POUT_MODES_TIMEOUT
POUT modes which use POUT_SETTINGS::timeout.
static const char * mode_names[N_STR_MODE]
#define MBG_SUCCESS
Error codes used with Meinberg devices and drivers.
static const char no_event_time[]
_MBG_API_ATTR int _MBG_API mbg_get_gps_tzdl(MBG_DEV_HANDLE dh, TZDL *p)
Read the card's time zone/daylight saving parameters.
static int show_time_scale(MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev, const char *info)
static int err_unicast_nsupp
Synthesizer configuration parameters.
see POUT_BIT_IF_SYNC_ONLY, POUT_SUPP_IF_SYNC_ONLY
#define MBG_PS_MSK_FRAMING_OVR_SW
see MBG_PS_BIT_FRAMING_OVR_SW
static const char no_lan_intf[]
_MBG_API_ATTR void _MBG_API mbg_close_device(MBG_DEV_HANDLE *dev_handle)
Close a device handle and set the handle value to MBG_INVALID_DEV_HANDLE.
POUT_INFO_IDX ALL_POUT_INFO_IDX[10]
An array of configuration settings for all programmable pulse outputs.
static TZDL tzdl_eet_eest
#define MBG_PS_MSK_FRAMING
see MBG_PS_BIT_FRAMING
int16_t sync_intv_min
log2 of minimum sync interval [s]
_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.
#define PTP_PORT_ID_WILDCARD
#define PCPS_TZCODE_MEZMESZ
static const char pout_name_mode[]
Action failed for specified device.
Current settings and general capabilities of a unicast master.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_time_scale
Check if a device supports configurable time scales.
static const char no_ptp[]
CTRL_FLAG_MASKS
flag masks used with CTRL_FLAGS
_MBG_API_ATTR int _MBG_API mbg_set_gps_pout_settings(MBG_DEV_HANDLE dh, const POUT_SETTINGS *p, int idx)
Write the configuration for a single programmable pulse output.
_MBG_API_ATTR int _MBG_API mbg_set_ip4_settings(MBG_DEV_HANDLE dh, const IP4_SETTINGS *p)
Write LAN IPv4 settings to a device.
#define DEFAULT_POUT_PULSE_SHIFT_MAX
Default maximum value for POUT_DATA::pulse_shift, in [ns].
#define MBG_PS_MSK_STR_MODE_OVR_SW
see MBG_PS_BIT_STR_MODE_OVR_SW
synthesizer on, use with ENABLE_FLAGS::synth
static void print_bit_mask_list(const char *info_1, const char *info_2, uint32_t supp_mask, int n_known, const char *const names[], STR_FNC *s_fnc, int inst_idx, CTRL_FLAGS ctrl_flags, const INDENTS *p_ind)
const char * mbg_framing_strs[N_MBG_FRAMINGS]
IP4_ADDR netmask
the network mask
static int chk_int16_parm(const char *arg, const char *id, int16_t *p, int16_t range_min, int16_t range_max, int is_supported, const char *info)
Lookup an int16_t parameter in an argument list.
int16_t delay_req_intv
log2 of the delay request interval [s]
uint8_t mode
string mode, see STR_MODES
static const char * delay_mech[]
uint8_t wday
day of week, 1..7, 1 = Monday
_MBG_API_ATTR int _MBG_API mbg_set_gps_pos_lla(MBG_DEV_HANDLE dh, const LLA p)
Set the GPS receiver position using LLA coordinates.
PTP_CFG_SETTINGS settings
the current configuration
static const char str_spc_not_supp[]
#define _wday_sun06_to_mon17(d)
#define MBG_INVALID_DEV_HANDLE
the number of known modes
static int set_date_time(MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev, const char *sdate, const char *stime)
int mbg_save_serial_settings(MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev, RECEIVER_PORT_CFG *p_rpcfg, int port_num)
Write the configuration settings for a single serial port to a device.
static long max_tzdl_offs
number of defined delay mechanisms
const INDENTS usage_indents_detailed
static void print_port_info_errors(const char *port_name, unsigned int port_num, int flags, const RECEIVER_PORT_CFG *p_rpcfg)
let the clock clear its system variables
#define MBG_PS_MSK_HS_OVR_SW
see MBG_PS_BIT_HS_OVR_SW
#define DEFAULT_POUT_PULSE_SHIFT_MIN
Default minimum value for POUT_DATA::pulse_shift, in [ns].
uint32_t supp_delay_mech
a bit mask of supported delay mechanisms, see PTP_DELAY_MECH_MASKS
associated outputs off until synchronized
static const char * pname
uint16_t pulses
EF_OFF or EF_PULSES_BOTH
A high resolution time stamp.
double LLA[N_LLA]
A geographic position based on latitude, longitude, and altitude.
int CTRL_FLAGS
A type used to pass print control flags to functions.
static const char no_time_scale[]
int16_t ann_intv_max
log2 of maximum announce interval [s]
ALL_PORT_INFO_IDX pii
all serial port configuration settings
int snprintf_safe(char *s, size_t max_len, const char *fmt,...)
A portable, safe implementation of snprintf()
uint8_t n_prg_out
number of programmable pulse outputs
static int usage_line(const INDENTS *p_ind, const OPT_HANDLER_SPEC *p_opt, const char *cmd_parm, const char *cmd_comment_fmt,...)
static int ip4_check_parm(const char *s, IP4_INFO *p)
#define MBG_ERR_NOT_SUPP_BY_DEV
Command or feature not supported by device.
see POUT_BIT_SUPP_IF_SYNC_ONLY, POUT_IF_SYNC_ONLY
IP4_ADDR gateway
the default gateway
int16_t handshake
handshake mode, yet only HS_NONE supported
int mbg_get_all_ptp_cfg_info(MBG_DEV_HANDLE dh, ALL_PTP_CFG_INFO *p)
Read all PTP settings and supported configuration parameters.
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.
see POUT_BIT_SUPP_PULSE_SHIFT, POUT_DATA::pulse_shift
PTP_CLOCK_ID gm_clock_id
use clock ID of master port, or PTP_CLOCK_ID_WILDCARD
static const char ip4_name_nm[]
#define _get_pout_mode_name(_i)
static int check_get_receiver_port_cfg(MBG_DEV_HANDLE dh, RECEIVER_PORT_CFG *p_rpcfg, const PCPS_DEV *p_dev, RECEIVER_INFO *p_ri)
static const char no_tz[]
POUT_SETTINGS pout_settings
static int eval_pout(MBG_DEV_HANDLE dh, const char *s, int inst_num)
#define mbg_rc_is_error(_rc)
uint8_t min
minutes, 0..59
int SHOW_FNC(MBG_DEV_HANDLE, const struct OPT_HANDLER_SPEC_S *, const PCPS_DEV *, const char *)
PORT_SETTINGS port_settings
current configuration of the port
static int set_gps_tzdl(MBG_DEV_HANDLE dh, const TZDL *tzdl, const char *info)
int16_t ann_intv_min
log2 of minimum announce interval [s]
_MBG_API_ATTR int _MBG_API mbg_get_gps_enable_flags(MBG_DEV_HANDLE dh, ENABLE_FLAGS *p)
Read the ENABLE_FLAGS structure controlling when outputs are to be enabled.
static int check_cmd_line(int argc, char *argv[], MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev, RECEIVER_INFO *p_ri, RECEIVER_PORT_CFG *p_rpcfg)
int16_t range
scale factor for freq; 0..MAX_SYNTH_RANGE
static int set_ant_cable_len(MBG_DEV_HANDLE dh, const char *s)
static void err_msg(const PCPS_DEV *p_dev, const char *msg)
uint32_t supp_modes
bit mask of modes supp. by this output, see POUT_MODE_MASKS
_MBG_API_ATTR int _MBG_API mbg_set_gps_time(MBG_DEV_HANDLE dh, const TTM *p)
Set the time on a GPS receiver device.
static const char no_gps_cmd[]
static int chk_tbl_parm(const char *arg, const char *id, const char *tbl[], int n_entries, uint32_t supp_mask, const char *info)
Lookup a parameter in an argument list and check if the value string is valid.
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.
int str_to_ip4_addr(IP4_ADDR *p_addr, const char *s)
Convert a string to an IP4_ADDR.
static const char ptp_name_dom[]
uint32_t supp_scales
bit masks of supported scales, see MBG_TIME_SCALE_MASKS
int16_t delay_req_intv_max
log2 of maximum delay request interval [s]
static int show_tzdl_offs(MBG_DEV_HANDLE dh, const char *info)
uint16_t synth
EF_OFF or EF_SYNTH
static int show_enable_flags(MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev, const char *info)
#define _pcps_has_synth(_d)
the number of known framings
uint32_t flags
see OPT_FLAG_MASKS
#define MBG_FIRST_COPYRIGHT_YEAR
IP4_ADDR broad_addr
the broadcast address
uint32_t supp_nw_prot
a bit mask of supported network protocols, see PTP_NW_PROT_MASKS
int HELP_FNC(MBG_DEV_HANDLE, const PCPS_DEV *, const struct OPT_HANDLER_SPEC_S *, CTRL_FLAGS)
#define PTP_CLOCK_ID_WILDCARD
#define POUT_MODES_SUPP_IF_SYNC_ONLY
POUT modes which support POUT_SUPP_IF_SYNC_ONLY.
BAUD_RATE baud_rate
transmission speed, e.g. 19200L, see MBG_BAUD_RATES
static int usage_note(int indent, const char *fmt,...)
A structure used to identify a device type and supported features.
char MBG_DEV_FN[260]
A string that can take a device file name.
maximum message duration [s]
_MBG_API_ATTR int _MBG_API mbg_set_gps_ant_cable_len(MBG_DEV_HANDLE dh, const ANT_CABLE_LEN *p)
Write the GPS antenna cable length configuration to a device.
static int save_serial_settings(MBG_DEV_HANDLE dh, unsigned int port_num, const char *parm_str, const PCPS_DEV *p_dev, const RECEIVER_INFO *p_ri)
uint32_t check_valid_port_info(const PORT_INFO *p_pi, const STR_TYPE_INFO_IDX str_type_info_idx[], int n_str_type)
static int show_ant_cable_len(MBG_DEV_HANDLE dh, const char *info)
uint16_t message_duration
time period until master stops sending messages [s]
static const char pout_name_ois[]
static const char * time_scale_names[N_MBG_TIME_SCALE]
uint8_t month
month, 1..12
int16_t sync_intv
log2 of the sync interval [s]
static const char ptp_name_net[]
static int show_lan_intf(MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev, const char *info)
uint8_t sec
seconds, 0..59, or 60 if leap second
static const char * ptp_roles[]
int16_t sync_intv
sync interval [log2 s]
static const char * nw_prot[]
ALL_STR_TYPE_INFO_IDX stii
all supported serial string types
A structure controlling when output signals are enabled.
MBG_TIME_SCALE_SETTINGS settings
current settings
static const char ptp_name_gmip[]
static TZDL tzdl_cet_cest
All configuration parameters for all serial ports.