mbgtools-lx  4.2.8
mbgctrl.c File Reference
#include <mbgdevio.h>
#include <deviohlp.h>
#include <pcpsmktm.h>
#include <pcpsutil.h>
#include <cfg_hlp.h>
#include <myutil.h>
#include <gpsutils.h>
#include <cnv_wday.h>
#include <toolutil.h>
#include <ptp_util.h>
#include <lan_util.h>
#include <str_util.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <ctype.h>

Go to the source code of this file.

Data Structures

struct  OPT_HANDLER_SPEC_S
 
struct  INDENTS
 
struct  EF_INFO
 
struct  IP4_INFO
 

Macros

#define MBG_FIRST_COPYRIGHT_YEAR   2001
 
#define MBG_LAST_COPYRIGHT_YEAR   0
 
#define RC_USAGE   1
 
#define _get_time_scale_name(_i)   ( ( (_i) < N_MBG_TIME_SCALE ) ? time_scale_names[_i] : str_unknown )
 
#define _get_pout_mode_name(_i)   ( ( (_i) < N_POUT_MODES ) ? pout_mode_names_eng[_i] : str_unknown )
 
#define SHOW_INDENT_1   " "
 
#define SHOW_INDENT_2   " "
 
#define N_EF_INFO   3
 
#define N_IP4_INFO   4
 
#define _ptp_role_name(_i)   ( ( (_i) < N_PTP_ROLES ) ? ptp_roles[_i] : str_unknown )
 
#define _ptp_role_name_short(_i)   ( ( (_i) < N_PTP_ROLES ) ? ptp_roles_short[_i] : str_unknown )
 

Typedefs

typedef int CTRL_FLAGS
 A type used to pass print control flags to functions. More...
 
typedef int HELP_FNC(MBG_DEV_HANDLE, const PCPS_DEV *, const struct OPT_HANDLER_SPEC_S *, CTRL_FLAGS)
 
typedef int SET_FNC(MBG_DEV_HANDLE, const char *, int)
 
typedef int SHOW_FNC(MBG_DEV_HANDLE, const struct OPT_HANDLER_SPEC_S *, const PCPS_DEV *, const char *)
 
typedef struct OPT_HANDLER_SPEC_S OPT_HANDLER_SPEC
 
typedef const char *() STR_FNC(int idx)
 

Enumerations

enum  CTRL_FLAG_MASKS {
  CTRL_PRINT_ALL = 0x01, CTRL_PRINT_NEWLINES = 0x02, CTRL_PRINT_IDX = 0x04, CTRL_PRINT_ERR = 0x08,
  CTRL_PRINT_PLUS = 0x10, CTRL_NOT_SUPP = 0x20
}
 flag masks used with CTRL_FLAGS More...
 
enum  OPT_FLAG_BITS { OPT_SUPP_CMD_IDX_BIT, N_OPT_FLAG_BITS }
 
enum  OPT_FLAG_MASKS { OPT_SUPP_CMD_IDX = ( 1UL << OPT_SUPP_CMD_IDX_BIT ) }
 

Functions

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 print_indent (int i)
 
static int usage_note (int indent, const char *fmt,...)
 
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)
 
static void err_msg (const PCPS_DEV *p_dev, const char *msg)
 
static int set_tz_code (MBG_DEV_HANDLE dh, PCPS_TZCODE tzcode, const char *s)
 
static int set_gps_tzdl (MBG_DEV_HANDLE dh, const TZDL *tzdl, const char *info)
 
static int set_timezone (MBG_DEV_HANDLE dh, const char *tz_name, const PCPS_DEV *p_dev)
 
static int show_tzdl_offs (MBG_DEV_HANDLE dh, const char *info)
 
static int set_tzdl_offs (MBG_DEV_HANDLE dh, const char *s)
 
static int show_synth (MBG_DEV_HANDLE dh, const char *info)
 
static int set_synth (MBG_DEV_HANDLE dh, const char *s)
 
static int show_lan_intf (MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev, const char *info)
 
static const char * intv_str (int i)
 
static int show_ptp_cfg (MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev, const char *info)
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
static int set_ptp_cfg (MBG_DEV_HANDLE dh, const char *arg, const PCPS_DEV *p_dev)
 
static int ip4_check_parm (const char *s, IP4_INFO *p)
 
static int set_lan_intf (MBG_DEV_HANDLE dh, const char *arg, const PCPS_DEV *p_dev)
 
static int set_gps_pos (MBG_DEV_HANDLE dh, const char *gp)
 
static int set_date_time (MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev, const char *sdate, const char *stime)
 
static int check_setup_receiver_info (MBG_DEV_HANDLE dh, RECEIVER_INFO *p_ri)
 
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 int snprint_port_cfg (char *s, int sz, unsigned int port_num, const RECEIVER_PORT_CFG *p_rpcfg)
 
static void show_serial_settings (MBG_DEV_HANDLE dh, const RECEIVER_PORT_CFG *p_rpcfg, const RECEIVER_INFO *p_ri)
 
static void print_port_info_errors (const char *port_name, unsigned int port_num, int flags, const RECEIVER_PORT_CFG *p_rpcfg)
 
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)
 
static int check_get_pout_cfg (MBG_DEV_HANDLE dh, ALL_POUT_INFO_IDX api, RECEIVER_INFO *p_ri)
 
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 eval_pout (MBG_DEV_HANDLE dh, const char *s, int inst_num)
 
static int show_pout (MBG_DEV_HANDLE dh, const OPT_HANDLER_SPEC *p_opt, const PCPS_DEV *p_devx, const char *cmd_info)
 
static void printf_ef (uint16_t flag, const char *info)
 
static int show_enable_flags (MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev, const char *info)
 
static int ef_check_parm (const char *s, EF_INFO *p)
 
static int set_enable_flags (MBG_DEV_HANDLE dh, const char *arg, const PCPS_DEV *p_dev)
 
static int send_gps_cmd (MBG_DEV_HANDLE dh, ushort cmd)
 
static int show_ant_cable_len (MBG_DEV_HANDLE dh, const char *info)
 
static int set_ant_cable_len (MBG_DEV_HANDLE dh, const char *s)
 
static int set_event_time (MBG_DEV_HANDLE dh, const char *s)
 
static int get_n_time_scale (MBG_DEV_HANDLE dh, MBG_TIME_SCALE_INFO *p_tsci)
 
static int show_time_scale (MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev, const char *info)
 
static int set_time_scale (MBG_DEV_HANDLE dh, const char *arg, const PCPS_DEV *p_dev)
 
static void usage (MBG_DEV_HANDLE dh, PCPS_DEV *p_dev, RECEIVER_INFO *p_ri, RECEIVER_PORT_CFG *p_rpcfg)
 
static const char * str_parm_p (const char *s, const char *keyword)
 
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)
 
int main (int argc, char *argv[])
 

Variables

static const char * pname = "mbgctrl"
 
static char * dev_name
 
static int err_unicast_nsupp
 
static const char str_spc_not [] = " not"
 
static const char str_spc_not_supp [] = " (not supported)"
 
static const char str_spc_wildcard [] = " (wildcard)"
 
static TZDL tzdl_utc = DEFAULT_TZDL_UTC
 
static TZDL tzdl_cet_cest = DEFAULT_TZDL_CET_CEST_EN
 
static TZDL tzdl_eet_eest = DEFAULT_TZDL_EET_EEST_EN
 
static long max_tzdl_offs = 0x7FFFFFFFL
 
static const char tz_info_utc [] = TZ_INFO_UTC
 
static const char tz_info_cet_cest [] = TZ_INFO_CET_CEST_EN
 
static const char tz_info_eet_eest [] = TZ_INFO_EET_EEST_EN
 
static const char * mode_names [N_STR_MODE] = DEFAULT_ENG_MODE_NAMES
 
static const char * time_scale_names [N_MBG_TIME_SCALE] = MBG_TIME_SCALE_STRS
 
static const char *const pout_mode_names_eng [N_POUT_MODES] = DEFAULT_ENG_POUT_NAMES
 
static const char no_gps_cmd [] = "does not support GPS commands"
 
static const char no_tzdl [] = "does not support configurable time zone"
 
static const char no_tz [] = "does not support time zones"
 
static const char no_synth [] = "has no synthesizer output"
 
static const char no_event_time [] = "does not support event times"
 
static const char no_enable_flags [] = "does not support enable flags"
 
static const char no_time_scale [] = "does not support a configurable time scale"
 
static const char no_lan_intf [] = "has no LAN interface"
 
static const char no_ptp [] = "does not provide PTP"
 
static const char no_cab_len [] = "does not support antenna signal delay compensation"
 
OPT_HANDLER_SPEC ohs_pout
 
const INDENTS usage_indents = { 2, 4, 6, 30 }
 
const INDENTS usage_indents_detailed = { 4, 6, 8, 30 }
 
const INDENTS show_indents = { 2, 4, 0, 0 }
 
static const char ef_name_serial [] = "SERIAL"
 
static const char ef_name_pulses [] = "PULSES"
 
static const char ef_name_synth [] = "SYNTH"
 
static const char ip4_name_ip [] = "IP"
 
static const char ip4_name_nm [] = "NM"
 
static const char ip4_name_ba [] = "BA"
 
static const char ip4_name_gw [] = "GW"
 
static const char ptp_name_net [] = "NP"
 
static const char ptp_name_del [] = "DM"
 
static const char ptp_name_dom [] = "DO"
 
static const char ptp_name_v1 [] = "HW"
 
static const char ptp_name_role [] = "ROLE"
 
static const char ptp_name_gmip [] = "GMIP"
 
static const char ptp_name_gmid [] = "GMID"
 
static const char ptp_name_pid [] = "PID"
 
static const char ptp_name_smi [] = "SMI"
 
static const char ptp_name_ami [] = "AMI"
 
static const char ptp_name_dri [] = "DRI"
 
static const char ptp_name_dur [] = "DUR"
 
static const char * delay_mech [] = PTP_DELAY_MECH_NAMES
 
static const char * nw_prot [] = PTP_NW_PROT_STRS
 
static const char * nw_prot_short [] = PTP_NW_PROT_STRS_SHORT
 
static const char * ptp_roles [] = PTP_ROLE_STRS
 
static const char * ptp_roles_short [] = PTP_ROLE_STRS_SHORT
 
static const PTP_CLOCK_ID clock_id_wildcard = PTP_CLOCK_ID_WILDCARD
 
static const char pout_name_mode [] = "MODE"
 
static const char pout_name_len [] = "LEN"
 
static const char pout_name_inv [] = "INV"
 
static const char pout_name_ois [] = "OIS"
 
static const char pout_name_shift [] = "SHIFT"
 

Macro Definition Documentation

◆ _get_pout_mode_name

#define _get_pout_mode_name (   _i)    ( ( (_i) < N_POUT_MODES ) ? pout_mode_names_eng[_i] : str_unknown )

Definition at line 157 of file mbgctrl.c.

Referenced by eval_pout(), and show_pout().

◆ _get_time_scale_name

#define _get_time_scale_name (   _i)    ( ( (_i) < N_MBG_TIME_SCALE ) ? time_scale_names[_i] : str_unknown )

Definition at line 152 of file mbgctrl.c.

Referenced by show_time_scale(), and usage().

◆ _ptp_role_name

#define _ptp_role_name (   _i)    ( ( (_i) < N_PTP_ROLES ) ? ptp_roles[_i] : str_unknown )

Definition at line 316 of file mbgctrl.c.

Referenced by show_ptp_cfg().

◆ _ptp_role_name_short

#define _ptp_role_name_short (   _i)    ( ( (_i) < N_PTP_ROLES ) ? ptp_roles_short[_i] : str_unknown )

Definition at line 319 of file mbgctrl.c.

Referenced by show_ptp_cfg().

◆ MBG_FIRST_COPYRIGHT_YEAR

#define MBG_FIRST_COPYRIGHT_YEAR   2001

Definition at line 124 of file mbgctrl.c.

Referenced by main().

◆ MBG_LAST_COPYRIGHT_YEAR

#define MBG_LAST_COPYRIGHT_YEAR   0

Definition at line 125 of file mbgctrl.c.

Referenced by main().

◆ N_EF_INFO

#define N_EF_INFO   3

Definition at line 268 of file mbgctrl.c.

Referenced by set_enable_flags().

◆ N_IP4_INFO

#define N_IP4_INFO   4

Definition at line 281 of file mbgctrl.c.

Referenced by set_lan_intf().

◆ RC_USAGE

#define RC_USAGE   1

Definition at line 127 of file mbgctrl.c.

Referenced by check_cmd_line(), and set_timezone().

◆ SHOW_INDENT_1

#define SHOW_INDENT_1   " "

Definition at line 256 of file mbgctrl.c.

◆ SHOW_INDENT_2

#define SHOW_INDENT_2   " "

Definition at line 257 of file mbgctrl.c.

Typedef Documentation

◆ CTRL_FLAGS

typedef int CTRL_FLAGS

A type used to pass print control flags to functions.

See also
CTRL_FLAG_MASKS

Definition at line 179 of file mbgctrl.c.

◆ HELP_FNC

typedef int HELP_FNC(MBG_DEV_HANDLE, const PCPS_DEV *, const struct OPT_HANDLER_SPEC_S *, CTRL_FLAGS)

Definition at line 200 of file mbgctrl.c.

◆ OPT_HANDLER_SPEC

◆ SET_FNC

typedef int SET_FNC(MBG_DEV_HANDLE, const char *, int)

Definition at line 201 of file mbgctrl.c.

◆ SHOW_FNC

typedef int SHOW_FNC(MBG_DEV_HANDLE, const struct OPT_HANDLER_SPEC_S *, const PCPS_DEV *, const char *)

Definition at line 202 of file mbgctrl.c.

◆ STR_FNC

typedef const char*() STR_FNC(int idx)

Definition at line 421 of file mbgctrl.c.

Enumeration Type Documentation

◆ CTRL_FLAG_MASKS

flag masks used with CTRL_FLAGS

See also
CTRL_FLAGS
Enumerator
CTRL_PRINT_ALL 
CTRL_PRINT_NEWLINES 
CTRL_PRINT_IDX 
CTRL_PRINT_ERR 
CTRL_PRINT_PLUS 
CTRL_NOT_SUPP 

Definition at line 187 of file mbgctrl.c.

◆ OPT_FLAG_BITS

Enumerator
OPT_SUPP_CMD_IDX_BIT 

e.g. COM0=, COM1=, etc. vs. TZ=

N_OPT_FLAG_BITS 

Definition at line 218 of file mbgctrl.c.

◆ OPT_FLAG_MASKS

Enumerator
OPT_SUPP_CMD_IDX 

see OPT_SUPP_CMD_IDX_BIT

Definition at line 224 of file mbgctrl.c.

Function Documentation

◆ check_cmd_line()

◆ check_get_pout_cfg()

static int check_get_pout_cfg ( MBG_DEV_HANDLE  dh,
ALL_POUT_INFO_IDX  api,
RECEIVER_INFO p_ri 
)
static

◆ check_get_receiver_port_cfg()

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

◆ check_setup_receiver_info()

static int check_setup_receiver_info ( MBG_DEV_HANDLE  dh,
RECEIVER_INFO p_ri 
)
static

◆ chk_int16_parm()

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 
)
static

Lookup an int16_t parameter in an argument list.

Check and save the numeric parameter if in a valid range.

Parameters
argAn argument list of the form: "name:val,name:val,..."
idThe name of the argument to be checked.
pA pointer to a variable where the parameter value is saved if valid
range_minThe minimum allowed value for the parameter
range_maxThe maximum allowed value for the parameter
is_supportedA flag indicating if the parameter is actually supported
infoA descriptive name of the parameter
Returns
>=0 A valid, supported table index -1 Parameter not found, or out of range

Definition at line 969 of file mbgctrl.c.

References chk_parm_name(), err_unicast_nsupp, MBG_ERR_RANGE, and mbg_rc_is_error.

Referenced by set_ptp_cfg().

◆ chk_parm_name()

static int chk_parm_name ( const char *  arg,
const char *  id,
char **  p 
)
static

Lookup a parameter in an argument list and check if a colon is appended.

Parameters
argAn argument list of the form: "name:val,name:val,..."
idA parameter name searched for in the argument list
pA pointer to a (char *) which is set to the beginning of the value part of a parameter string
Returns
MBG_SUCCESS on success. If parameter has been found then *p is set to the parameter value, else to NULL. MBG_ERR_PARM_FMT if syntax error, i.e. missing colon.

Definition at line 884 of file mbgctrl.c.

References MBG_ERR_PARM_FMT, and MBG_SUCCESS.

Referenced by chk_int16_parm(), chk_tbl_parm(), eval_pout(), and set_ptp_cfg().

◆ chk_tbl_parm()

static int chk_tbl_parm ( const char *  arg,
const char *  id,
const char *  tbl[],
int  n_entries,
uint32_t  supp_mask,
const char *  info 
)
static

Lookup a parameter in an argument list and check if the value string is valid.

This function expects that the parameter value is a known string which can be found in a table of known strings. A bit mask indicates if a string with a given table index is supported, or not.

Parameters
argAn argument list of the form: "name:val,name:val,..."
idThe name of the argument to be checked.
tblA table of strings with predefined parameter values
n_entriesThe number of strings in the string table
supp_maskA string with a given index is only supported if the corresponding bit is set in this mask.
infoA descriptive name of the parameter which is to be set to the index of the searched string
Returns
>=0 A valid, supported table index -1 Parameter not found -2 Unknown or unsupported parameter, or syntax error

Definition at line 928 of file mbgctrl.c.

References chk_parm_name(), and get_chk_str_table_idx().

Referenced by set_ptp_cfg().

◆ ef_check_parm()

static int ef_check_parm ( const char *  s,
EF_INFO p 
)
static

Definition at line 2427 of file mbgctrl.c.

References _int_from_size_t, EF_OFF, EF_INFO::flags, MBG_ERR_CFG, EF_INFO::name, and EF_INFO::on_flags.

Referenced by set_enable_flags().

◆ err_msg()

static void err_msg ( const PCPS_DEV p_dev,
const char *  msg 
)
static

Definition at line 514 of file mbgctrl.c.

Referenced by check_cmd_line(), and set_timezone().

◆ eval_pout()

◆ get_chk_str_table_idx()

static int get_chk_str_table_idx ( const char *  s,
const char *  tbl[],
int  n_entries,
uint32_t  supp_mask,
const char *  info 
)
static

Lookup a string in a string table and return the table index.

Parameters
sThe string to be searched for in the string table
tblA table of strings to be searched
n_entriesThe number of strings in the string table
supp_maskA string with a given index is only supported if the corresponding bit is set in this mask.
infoA descriptive name of the parameter which is to be set to the index of the searched string
Returns
>=0 A valid, supported table index <0 Unknown or unsupported parameter

Definition at line 846 of file mbgctrl.c.

Referenced by chk_tbl_parm().

◆ get_n_time_scale()

◆ help_pout_arg()

◆ intv_str()

static const char* intv_str ( int  i)
static

Definition at line 735 of file mbgctrl.c.

References snprintf_safe(), and str_empty.

Referenced by show_ptp_cfg().

◆ ip4_check_parm()

static int ip4_check_parm ( const char *  s,
IP4_INFO p 
)
static

Definition at line 1314 of file mbgctrl.c.

References _int_from_size_t, IP4_INFO::addr, MBG_ERR_CFG, IP4_INFO::name, and str_to_ip4_addr().

Referenced by set_lan_intf().

◆ main()

◆ print_bit_mask_list()

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 
)
static

◆ print_indent()

static int print_indent ( int  i)
static

Definition at line 388 of file mbgctrl.c.

References str_empty.

Referenced by print_bit_mask_list(), show_pout(), and usage_note().

◆ print_port_info_errors()

◆ printf_ef()

static void printf_ef ( uint16_t  flag,
const char *  info 
)
static

Definition at line 2388 of file mbgctrl.c.

References EF_OFF.

Referenced by show_enable_flags().

◆ save_serial_settings()

◆ send_gps_cmd()

static int send_gps_cmd ( MBG_DEV_HANDLE  dh,
ushort  cmd 
)
static

Definition at line 2515 of file mbgctrl.c.

References mbg_cond_err_msg(), mbg_set_gps_cmd(), and MBG_SUCCESS.

Referenced by check_cmd_line().

◆ set_ant_cable_len()

static int set_ant_cable_len ( MBG_DEV_HANDLE  dh,
const char *  s 
)
static

Definition at line 2548 of file mbgctrl.c.

References mbg_cond_err_msg(), mbg_set_gps_ant_cable_len(), and MBG_SUCCESS.

Referenced by check_cmd_line().

◆ set_date_time()

◆ set_enable_flags()

◆ set_event_time()

static int set_event_time ( MBG_DEV_HANDLE  dh,
const char *  s 
)
static

◆ set_gps_pos()

static int set_gps_pos ( MBG_DEV_HANDLE  dh,
const char *  gp 
)
static

Definition at line 1459 of file mbgctrl.c.

References ALT, LAT, LON, mbg_cond_err_msg(), MBG_ERR_CFG, mbg_set_gps_pos_lla(), PI, and r2d.

Referenced by check_cmd_line().

◆ set_gps_tzdl()

static int set_gps_tzdl ( MBG_DEV_HANDLE  dh,
const TZDL tzdl,
const char *  info 
)
static

Definition at line 539 of file mbgctrl.c.

References mbg_cond_err_msg(), mbg_set_gps_tzdl(), and MBG_SUCCESS.

Referenced by set_timezone(), and set_tzdl_offs().

◆ set_lan_intf()

◆ set_ptp_cfg()

static int set_ptp_cfg ( MBG_DEV_HANDLE  dh,
const char *  arg,
const PCPS_DEV p_dev 
)
static

Definition at line 1004 of file mbgctrl.c.

References ALL_PTP_CFG_INFO::all_ptp_uc_master_info_idx, PTP_CFG_SETTINGS::ann_intv, PTP_UC_MASTER_SETTINGS::ann_intv, PTP_UC_MASTER_CFG_LIMITS::ann_intv_max, PTP_UC_MASTER_CFG_LIMITS::ann_intv_min, PTP_CLOCK_ID::b, chk_int16_parm(), chk_parm_name(), chk_tbl_parm(), clock_id_wildcard, delay_mech, PTP_CFG_SETTINGS::delay_mech, PTP_CFG_SETTINGS::delay_req_intv, PTP_UC_MASTER_SETTINGS::delay_req_intv, PTP_UC_MASTER_CFG_LIMITS::delay_req_intv_max, PTP_UC_MASTER_CFG_LIMITS::delay_req_intv_min, PTP_CFG_SETTINGS::domain_number, err_unicast_nsupp, PTP_CFG_SETTINGS::flags, get_supp_ptp_role_mask(), PTP_UC_MASTER_SETTINGS::gm_clock_id, PTP_UC_MASTER_SETTINGS::gm_host, PTP_UC_MASTER_SETTINGS::gm_port_id, MAC_SEP_CHAR, mbg_cond_err_msg(), MBG_ERR_CFG, mbg_get_all_ptp_cfg_info(), mbg_rc_is_error, mbg_save_all_ptp_cfg_info(), MBG_SUCCESS, PTP_UC_MASTER_SETTINGS::message_duration, N_PTP_DELAY_MECH, N_PTP_NW_PROT, N_PTP_ROLES, PTP_CFG_SETTINGS::nw_prot, nw_prot_short, ALL_PTP_CFG_INFO::ptp_cfg_info, PTP_CFG_MSK_SUPPORT_PTP_UNICAST, PTP_CFG_MSK_V1_HW_COMPAT, ptp_name_ami, ptp_name_del, ptp_name_dom, ptp_name_dri, ptp_name_dur, ptp_name_gmid, ptp_name_gmip, ptp_name_net, ptp_name_pid, ptp_name_role, ptp_name_smi, ptp_name_v1, PTP_PORT_ID_WILDCARD, PTP_CFG_SETTINGS::ptp_role, PTP_ROLE_MULTICAST_SLAVE, ptp_roles_short, ALL_PTP_CFG_INFO::ptp_uc_master_cfg_limits, PTP_UC_MSG_DURATION_MAX, PTP_UC_MSG_DURATION_MIN, PTP_CFG_INFO::settings, PTP_UC_MASTER_INFO::settings, snprint_ip4_addr(), snprint_octets(), str_empty, str_spc_wildcard, str_to_ip4_addr(), str_to_octets(), PTP_CFG_INFO::supp_delay_mech, PTP_CFG_INFO::supp_flags, PTP_CFG_INFO::supp_nw_prot, PTP_CFG_SETTINGS::sync_intv, PTP_UC_MASTER_SETTINGS::sync_intv, PTP_UC_MASTER_CFG_LIMITS::sync_intv_max, and PTP_UC_MASTER_CFG_LIMITS::sync_intv_min.

Referenced by check_cmd_line().

◆ set_synth()

static int set_synth ( MBG_DEV_HANDLE  dh,
const char *  s 
)
static

Definition at line 667 of file mbgctrl.c.

References SYNTH::freq, MBG_ERR_INV_PARM, mbg_set_synth(), SYNTH::phase, and SYNTH::range.

Referenced by check_cmd_line().

◆ set_time_scale()

◆ set_timezone()

static int set_timezone ( MBG_DEV_HANDLE  dh,
const char *  tz_name,
const PCPS_DEV p_dev 
)
static

◆ set_tz_code()

static int set_tz_code ( MBG_DEV_HANDLE  dh,
PCPS_TZCODE  tzcode,
const char *  s 
)
static

Definition at line 523 of file mbgctrl.c.

References mbg_cond_err_msg(), mbg_set_tzcode(), and MBG_SUCCESS.

Referenced by set_timezone().

◆ set_tzdl_offs()

static int set_tzdl_offs ( MBG_DEV_HANDLE  dh,
const char *  s 
)
static

Definition at line 622 of file mbgctrl.c.

References max_tzdl_offs, MBG_ERR_CFG, TZDL::offs, set_gps_tzdl(), and tzdl_utc.

Referenced by check_cmd_line().

◆ show_ant_cable_len()

static int show_ant_cable_len ( MBG_DEV_HANDLE  dh,
const char *  info 
)
static

Definition at line 2531 of file mbgctrl.c.

References mbg_cond_err_msg(), mbg_get_gps_ant_cable_len(), and MBG_SUCCESS.

Referenced by check_cmd_line().

◆ show_enable_flags()

static int show_enable_flags ( MBG_DEV_HANDLE  dh,
const PCPS_DEV p_dev,
const char *  info 
)
static

◆ show_lan_intf()

static int show_lan_intf ( MBG_DEV_HANDLE  dh,
const PCPS_DEV p_dev,
const char *  info 
)
static

◆ show_pout()

◆ show_ptp_cfg()

◆ show_serial_settings()

static void show_serial_settings ( MBG_DEV_HANDLE  dh,
const RECEIVER_PORT_CFG p_rpcfg,
const RECEIVER_INFO p_ri 
)
static

Definition at line 1736 of file mbgctrl.c.

References RECEIVER_INFO::n_com_ports, and snprint_port_cfg().

Referenced by check_cmd_line().

◆ show_synth()

static int show_synth ( MBG_DEV_HANDLE  dh,
const char *  info 
)
static

Definition at line 643 of file mbgctrl.c.

References SYNTH::freq, mbg_cond_err_msg(), mbg_get_synth(), MBG_SUCCESS, SYNTH::phase, and SYNTH::range.

Referenced by check_cmd_line().

◆ show_time_scale()

static int show_time_scale ( MBG_DEV_HANDLE  dh,
const PCPS_DEV p_dev,
const char *  info 
)
static

◆ show_tzdl_offs()

static int show_tzdl_offs ( MBG_DEV_HANDLE  dh,
const char *  info 
)
static

Definition at line 605 of file mbgctrl.c.

References mbg_cond_err_msg(), mbg_get_gps_tzdl(), MBG_SUCCESS, and TZDL::offs.

Referenced by check_cmd_line().

◆ snprint_port_cfg()

static int snprint_port_cfg ( char *  s,
int  sz,
unsigned int  port_num,
const RECEIVER_PORT_CFG p_rpcfg 
)
static

◆ str_parm_p()

static const char* str_parm_p ( const char *  s,
const char *  keyword 
)
static

Definition at line 2876 of file mbgctrl.c.

Referenced by check_cmd_line().

◆ usage()

◆ usage_line()

static int usage_line ( const INDENTS p_ind,
const OPT_HANDLER_SPEC p_opt,
const char *  cmd_parm,
const char *  cmd_comment_fmt,
  ... 
)
static

Definition at line 335 of file mbgctrl.c.

References OPT_SUPP_CMD_IDX, and str_empty.

Referenced by help_pout_arg().

◆ usage_note()

static int usage_note ( int  indent,
const char *  fmt,
  ... 
)
static

Definition at line 400 of file mbgctrl.c.

References print_indent().

Referenced by help_pout_arg().

Variable Documentation

◆ clock_id_wildcard

const PTP_CLOCK_ID clock_id_wildcard = PTP_CLOCK_ID_WILDCARD
static

Definition at line 311 of file mbgctrl.c.

Referenced by set_ptp_cfg().

◆ delay_mech

const char* delay_mech[] = PTP_DELAY_MECH_NAMES
static

Definition at line 304 of file mbgctrl.c.

Referenced by set_ptp_cfg(), and show_ptp_cfg().

◆ dev_name

char* dev_name
static

Definition at line 131 of file mbgctrl.c.

Referenced by check_cmd_line(), main(), mbg_split_dev_name(), and mbg_str_dev_name().

◆ ef_name_pulses

const char ef_name_pulses[] = "PULSES"
static

Definition at line 271 of file mbgctrl.c.

Referenced by set_enable_flags(), and show_enable_flags().

◆ ef_name_serial

const char ef_name_serial[] = "SERIAL"
static

Definition at line 270 of file mbgctrl.c.

Referenced by set_enable_flags(), and show_enable_flags().

◆ ef_name_synth

const char ef_name_synth[] = "SYNTH"
static

Definition at line 272 of file mbgctrl.c.

Referenced by set_enable_flags(), and show_enable_flags().

◆ err_unicast_nsupp

int err_unicast_nsupp
static

Definition at line 133 of file mbgctrl.c.

Referenced by chk_int16_parm(), and set_ptp_cfg().

◆ ip4_name_ba

const char ip4_name_ba[] = "BA"
static

Definition at line 285 of file mbgctrl.c.

Referenced by set_lan_intf().

◆ ip4_name_gw

const char ip4_name_gw[] = "GW"
static

Definition at line 286 of file mbgctrl.c.

Referenced by set_lan_intf().

◆ ip4_name_ip

const char ip4_name_ip[] = "IP"
static

Definition at line 283 of file mbgctrl.c.

Referenced by set_lan_intf().

◆ ip4_name_nm

const char ip4_name_nm[] = "NM"
static

Definition at line 284 of file mbgctrl.c.

Referenced by set_lan_intf().

◆ max_tzdl_offs

long max_tzdl_offs = 0x7FFFFFFFL
static

Definition at line 142 of file mbgctrl.c.

Referenced by set_tzdl_offs().

◆ mode_names

const char* mode_names[N_STR_MODE] = DEFAULT_ENG_MODE_NAMES
static

Definition at line 148 of file mbgctrl.c.

Referenced by print_port_info_errors(), snprint_port_cfg(), and usage().

◆ no_cab_len

const char no_cab_len[] = "does not support antenna signal delay compensation"
static

Definition at line 170 of file mbgctrl.c.

Referenced by check_cmd_line().

◆ no_enable_flags

const char no_enable_flags[] = "does not support enable flags"
static

Definition at line 166 of file mbgctrl.c.

Referenced by check_cmd_line().

◆ no_event_time

const char no_event_time[] = "does not support event times"
static

Definition at line 165 of file mbgctrl.c.

Referenced by check_cmd_line().

◆ no_gps_cmd

const char no_gps_cmd[] = "does not support GPS commands"
static

Definition at line 161 of file mbgctrl.c.

Referenced by check_cmd_line().

◆ no_lan_intf

const char no_lan_intf[] = "has no LAN interface"
static

Definition at line 168 of file mbgctrl.c.

Referenced by check_cmd_line().

◆ no_ptp

const char no_ptp[] = "does not provide PTP"
static

Definition at line 169 of file mbgctrl.c.

Referenced by check_cmd_line().

◆ no_synth

const char no_synth[] = "has no synthesizer output"
static

Definition at line 164 of file mbgctrl.c.

Referenced by check_cmd_line().

◆ no_time_scale

const char no_time_scale[] = "does not support a configurable time scale"
static

Definition at line 167 of file mbgctrl.c.

Referenced by check_cmd_line().

◆ no_tz

const char no_tz[] = "does not support time zones"
static

Definition at line 163 of file mbgctrl.c.

Referenced by set_timezone().

◆ no_tzdl

const char no_tzdl[] = "does not support configurable time zone"
static

Definition at line 162 of file mbgctrl.c.

Referenced by check_cmd_line().

◆ nw_prot

const char* nw_prot[] = PTP_NW_PROT_STRS
static

Definition at line 305 of file mbgctrl.c.

Referenced by show_ptp_cfg().

◆ nw_prot_short

const char* nw_prot_short[] = PTP_NW_PROT_STRS_SHORT
static

Definition at line 306 of file mbgctrl.c.

Referenced by set_ptp_cfg(), and show_ptp_cfg().

◆ ohs_pout

OPT_HANDLER_SPEC ohs_pout
Initial value:
=
{
"POUT",
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
}
see OPT_SUPP_CMD_IDX_BIT
Definition: mbgctrl.c:226

Definition at line 229 of file mbgctrl.c.

◆ pname

const char* pname = "mbgctrl"
static

Definition at line 129 of file mbgctrl.c.

Referenced by main(), and usage().

◆ pout_mode_names_eng

const char* const pout_mode_names_eng[N_POUT_MODES] = DEFAULT_ENG_POUT_NAMES
static

Definition at line 155 of file mbgctrl.c.

Referenced by help_pout_arg().

◆ pout_name_inv

const char pout_name_inv[] = "INV"
static

Definition at line 325 of file mbgctrl.c.

Referenced by eval_pout().

◆ pout_name_len

const char pout_name_len[] = "LEN"
static

Definition at line 324 of file mbgctrl.c.

Referenced by eval_pout().

◆ pout_name_mode

const char pout_name_mode[] = "MODE"
static

Definition at line 323 of file mbgctrl.c.

Referenced by eval_pout().

◆ pout_name_ois

const char pout_name_ois[] = "OIS"
static

Definition at line 326 of file mbgctrl.c.

Referenced by eval_pout().

◆ pout_name_shift

const char pout_name_shift[] = "SHIFT"
static

Definition at line 327 of file mbgctrl.c.

Referenced by eval_pout().

◆ ptp_name_ami

const char ptp_name_ami[] = "AMI"
static

Definition at line 299 of file mbgctrl.c.

Referenced by set_ptp_cfg().

◆ ptp_name_del

const char ptp_name_del[] = "DM"
static

Definition at line 289 of file mbgctrl.c.

Referenced by set_ptp_cfg().

◆ ptp_name_dom

const char ptp_name_dom[] = "DO"
static

Definition at line 290 of file mbgctrl.c.

Referenced by set_ptp_cfg().

◆ ptp_name_dri

const char ptp_name_dri[] = "DRI"
static

Definition at line 300 of file mbgctrl.c.

Referenced by set_ptp_cfg().

◆ ptp_name_dur

const char ptp_name_dur[] = "DUR"
static

Definition at line 301 of file mbgctrl.c.

Referenced by set_ptp_cfg().

◆ ptp_name_gmid

const char ptp_name_gmid[] = "GMID"
static

Definition at line 296 of file mbgctrl.c.

Referenced by set_ptp_cfg().

◆ ptp_name_gmip

const char ptp_name_gmip[] = "GMIP"
static

Definition at line 295 of file mbgctrl.c.

Referenced by set_ptp_cfg().

◆ ptp_name_net

const char ptp_name_net[] = "NP"
static

Definition at line 288 of file mbgctrl.c.

Referenced by set_ptp_cfg().

◆ ptp_name_pid

const char ptp_name_pid[] = "PID"
static

Definition at line 297 of file mbgctrl.c.

Referenced by set_ptp_cfg().

◆ ptp_name_role

const char ptp_name_role[] = "ROLE"
static

Definition at line 293 of file mbgctrl.c.

Referenced by set_ptp_cfg().

◆ ptp_name_smi

const char ptp_name_smi[] = "SMI"
static

Definition at line 298 of file mbgctrl.c.

Referenced by set_ptp_cfg().

◆ ptp_name_v1

const char ptp_name_v1[] = "HW"
static

Definition at line 291 of file mbgctrl.c.

Referenced by set_ptp_cfg().

◆ ptp_roles

const char* ptp_roles[] = PTP_ROLE_STRS
static

Definition at line 308 of file mbgctrl.c.

◆ ptp_roles_short

const char* ptp_roles_short[] = PTP_ROLE_STRS_SHORT
static

Definition at line 309 of file mbgctrl.c.

Referenced by set_ptp_cfg().

◆ show_indents

const INDENTS show_indents = { 2, 4, 0, 0 }

Definition at line 253 of file mbgctrl.c.

Referenced by show_pout().

◆ str_spc_not

const char str_spc_not[] = " not"
static

Definition at line 135 of file mbgctrl.c.

Referenced by eval_pout(), and help_pout_arg().

◆ str_spc_not_supp

const char str_spc_not_supp[] = " (not supported)"
static

Definition at line 136 of file mbgctrl.c.

Referenced by show_pout().

◆ str_spc_wildcard

const char str_spc_wildcard[] = " (wildcard)"
static

Definition at line 137 of file mbgctrl.c.

Referenced by set_ptp_cfg(), and show_ptp_cfg().

◆ time_scale_names

const char* time_scale_names[N_MBG_TIME_SCALE] = MBG_TIME_SCALE_STRS
static

Definition at line 150 of file mbgctrl.c.

Referenced by help_pout_arg().

◆ tz_info_cet_cest

const char tz_info_cet_cest[] = TZ_INFO_CET_CEST_EN
static

Definition at line 145 of file mbgctrl.c.

Referenced by set_timezone(), and usage().

◆ tz_info_eet_eest

const char tz_info_eet_eest[] = TZ_INFO_EET_EEST_EN
static

Definition at line 146 of file mbgctrl.c.

Referenced by set_timezone(), and usage().

◆ tz_info_utc

const char tz_info_utc[] = TZ_INFO_UTC
static

Definition at line 144 of file mbgctrl.c.

Referenced by set_timezone(), and usage().

◆ tzdl_cet_cest

TZDL tzdl_cet_cest = DEFAULT_TZDL_CET_CEST_EN
static

Definition at line 140 of file mbgctrl.c.

Referenced by set_timezone().

◆ tzdl_eet_eest

TZDL tzdl_eet_eest = DEFAULT_TZDL_EET_EEST_EN
static

Definition at line 141 of file mbgctrl.c.

Referenced by set_timezone().

◆ tzdl_utc

TZDL tzdl_utc = DEFAULT_TZDL_UTC
static

Definition at line 139 of file mbgctrl.c.

Referenced by set_timezone(), and set_tzdl_offs().

◆ usage_indents

const INDENTS usage_indents = { 2, 4, 6, 30 }

Definition at line 251 of file mbgctrl.c.

Referenced by help_pout_arg().

◆ usage_indents_detailed

const INDENTS usage_indents_detailed = { 4, 6, 8, 30 }

Definition at line 252 of file mbgctrl.c.

Referenced by help_pout_arg().