mbgtools-lx  4.2.8
mbgdevio.h File Reference
#include <mbg_tgt.h>
#include <mbg_arch.h>
#include <cfg_hlp.h>
#include <timeutil.h>
#include <mbgmutex.h>
#include <mbgerror.h>
#include <mbggeo.h>
#include <pcpsdev.h>
#include <pci_asic.h>
#include <use_pack.h>
#include <time.h>
#include <stdio.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <sched.h>

Go to the source code of this file.

Data Structures

struct  MBG_THREAD_INFO
 A generic thread info structure. More...
 
struct  MBG_XHRT_VARS
 A structure holding a time stamp / cycles count pair. More...
 
struct  MBG_XHRT_INFO
 A status structure provided by the time polling thread function. More...
 
struct  MBG_POLL_THREAD_INFO
 A structure used to control a poll thread function. More...
 
struct  _MBG_DEV_FN_LIST_ENTRY
 The structure behind the MBG_DEV_FN_LIST_ENTRY type. More...
 
struct  _MBG_DEV_NAME_LIST_ENTRY
 The structure behind the MBG_DEV_NAME_LIST_ENTRY type. More...
 

Macros

#define MBGDEVIO_VERSION   0x0308
 
#define MBGDEVIO_COMPAT_VERSION   0x0210
 
#define MBGDEVIO_XHRT_API   1
 
#define MBGDEVIO_USE_THREAD_API   0
 
#define MBGDEVIO_HAVE_THREAD_AFFINITY   0
 
#define DEBUG_IOCTL_CALLS   0
 
#define _ext   extern
 
#define MBG_INVALID_DEV_HANDLE   NULL
 
#define MBGDEVIO_RET_VAL   int
 
#define _mbgdevio_cnv_ret_val(_v)   (_v)
 
#define MBGCLOCK_DEV_FN_BASE   "/dev/mbgclock"
 
#define MBGCLOCK_DEV_FN_FMT   MBGCLOCK_DEV_FN_BASE "%i"
 
#define MBG_PROCESS_ID   pid_t
 
#define _mbg_get_current_process()   0
 
#define FILETIME   int
 
#define MBG_CPU_SET   int
 
#define MBG_CPU_SET_SIZE   ( sizeof( MBG_CPU_SET ) * 8 )
 
#define _mbg_cpu_clear(_ps)   ( *(_ps) = 0 )
 
#define _mbg_cpu_set(_i, _ps)   ( *(_ps) |= ( (MBG_CPU_SET) 1UL << (_i) ) )
 
#define _mbg_cpu_isset(_i, _ps)   ( *(_ps) & ( 1UL << (_i) ) )
 
#define MBG_THREAD_ID   int
 
#define _mbg_get_current_thread()   0
 
#define MBG_THREAD_FNC_RET_VAL   void
 
#define _mbg_thread_exit(_v)   _nop_macro_fnc()
 
#define _mbgdevio_chk_cond(_cond)
 
#define _mbgdevio_read(_dh, _cmd, _ioctl, _p, _sz)   pcps_read_safe( _dh, _cmd, _p, _sz )
 
#define _mbgdevio_write(_dh, _cmd, _ioctl, _p, _sz)   pcps_write_safe( _dh, _cmd, _p, _sz )
 
#define _do_mbgdevio_read_gps(_dh, _cmd, _ioctl, _p, _sz)   pcps_read_gps_safe( _dh, _cmd, _p, _sz )
 
#define _mbgdevio_write_gps(_dh, _cmd, _ioctl, _p, _sz)   pcps_write_gps_safe( _dh, _cmd, _p, _sz )
 
#define _mbgdevio_read_var(_dh, _cmd, _ioctl, _p)   _pcps_read_var_safe( _dh, _cmd, *(_p) )
 
#define _mbgdevio_write_var(_dh, _cmd, _ioctl, _p)   _pcps_write_var_safe( _dh, _cmd, *(_p) )
 
#define _mbgdevio_write_cmd(_dh, _cmd, _ioctl)   _pcps_write_byte_safe( _dh, _cmd );
 
#define _mbgdevio_read_gps_var(_dh, _cmd, _ioctl, _p)   _pcps_read_gps_var_safe( _dh, _cmd, *(_p) )
 
#define _mbgdevio_write_gps_var(_dh, _cmd, _ioctl, _p)   _pcps_write_gps_var_safe( _dh, _cmd, *(_p) )
 
#define _mbgdevio_gen_read(_dh, _cmd, _p, _sz)   _mbgdevio_read( _dh, _cmd, -1, _p, _sz )
 
#define _mbgdevio_gen_write(_dh, _cmd, _p, _sz)   _mbgdevio_write( _dh, _cmd, -1, _p, _sz )
 
#define _mbgdevio_gen_io(_dh, _type, _in_p, _in_sz, _out_p, _out_sz)   pcps_generic_io( _dh, _type, _in_p, _in_sz, _out_p, _out_sz );
 
#define _mbgdevio_gen_read_gps(_dh, _cmd, _p, _sz)   _do_mbgdevio_read_gps( _dh, _cmd, -1, _p, _sz )
 
#define _mbgdevio_gen_write_gps(_dh, _cmd, _p, _sz)   _mbgdevio_write_gps( _dh, _cmd, -1, _p, _sz )
 
#define _mbg_generic_read_var(_dh, _cmd, _s)   mbg_generic_read( _dh, _cmd, &(_s), sizeof( (_s) ) )
 
#define _mbg_generic_write_var(_dh, _cmd, _s)   mbg_generic_write( _dh, _cmd, &(_s), sizeof( (_s) ) )
 
#define _mbg_generic_read_gps_var(_dh, _cmd, _s)   mbg_generic_read_gps( _dh, _cmd, &(_s), sizeof( (_s) ) )
 
#define _mbg_generic_write_gps_var(_dh, _cmd, _s)   mbg_generic_write_gps( _dh, _cmd, &(_s), sizeof( (_s) ) )
 
#define _mbgdevio_gen_read_var(_dh, _cmd, _s)   _mbgdevio_gen_read( _dh, _cmd, &(_s), sizeof( (_s) ) )
 
#define _mbgdevio_gen_write_var(_dh, _cmd, _s)   _mbgdevio_gen_write( _dh, _cmd, &(_s), sizeof( (_s) ) )
 
#define _mbgdevio_gen_read_gps_var(_dh, _cmd, _s)   _mbgdevio_gen_read_gps( _dh, _cmd, &(_s), sizeof( (_s) ) )
 
#define _mbgdevio_gen_write_gps_var(_dh, _cmd, _s)   _mbgdevio_gen_write_gps( _dh, _cmd, &(_s), sizeof( (_s) ) )
 

Typedefs

typedef PCPS_DDEVMBG_DEV_HANDLE
 
typedef char MBG_DEV_FN[260]
 A string that can take a device file name. More...
 
typedef void MBG_THREAD_FNC(void *)
 A generic type of a thread function. More...
 
typedef struct _MBG_DEV_FN_LIST_ENTRY MBG_DEV_FN_LIST_ENTRY
 An entry for a list of device file names. More...
 
typedef struct _MBG_DEV_NAME_LIST_ENTRY MBG_DEV_NAME_LIST_ENTRY
 An entry for a list of device names. More...
 
typedef int MBG_CHK_SUPP_FNC(MBG_DEV_HANDLE dh)
 The type of functions to check if a feature is supported. More...
 

Enumerations

enum  MBG_MATCH_MODES { MBG_MATCH_ANY, MBG_MATCH_MODEL, MBG_MATCH_EXACTLY, N_MBG_MATCH_MODES }
 Device matching modes. More...
 

Functions

int mbgdevio_get_version (void)
 Get the version number of the precompiled DLL/shared object library. More...
 
int mbgdevio_check_version (int header_version)
 Check if the DLL/shared library is compatible with a given version. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_receiver_info (MBG_DEV_HANDLE dh)
 Check if a device supports the RECEIVER_INFO structure and related calls. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_gps_data (MBG_DEV_HANDLE dh)
 Check if a device supports large configuration data structures. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_generic_io (MBG_DEV_HANDLE dh)
 Check if a device supports the mbg_generic_io API call. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_asic_version (MBG_DEV_HANDLE dh)
 Check if a device supports the mbg_get_asic_version API call. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_asic_features (MBG_DEV_HANDLE dh)
 Check if a device supports the mbg_get_asic_features call. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_xmr (MBG_DEV_HANDLE dh)
 Check if a device provides eXtended Multi Ref (XMR) inputs. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_is_isa (MBG_DEV_HANDLE dh)
 Check if the device is connected via the ISA bus. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_is_mca (MBG_DEV_HANDLE dh)
 Check if the device is connected via the MCA bus. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_is_pci (MBG_DEV_HANDLE dh)
 Check if the device is connected via the PCI bus. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_is_pci_express (MBG_DEV_HANDLE dh)
 Check if the device is connected via the PCI Express bus. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_is_usb (MBG_DEV_HANDLE dh)
 Check if the device is connected via the USB bus. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_is_gnss (MBG_DEV_HANDLE dh)
 Check if a device supports GNSS configuration. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_is_gps (MBG_DEV_HANDLE dh)
 Check if a device is a GPS receiver. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_is_dcf (MBG_DEV_HANDLE dh)
 Check if a device is a DCF77 receiver. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_pzf (MBG_DEV_HANDLE dh)
 Check if a device supports demodulation of the DCF77 PZF code. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_is_msf (MBG_DEV_HANDLE dh)
 Check if a device is a MSF receiver. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_is_wwvb (MBG_DEV_HANDLE dh)
 Check if a device is a WWVB receiver. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_is_jjy (MBG_DEV_HANDLE dh)
 Check if a device is a JJY receiver. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_is_lwr (MBG_DEV_HANDLE dh)
 Check if a device is any long wave signal receiver. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_is_tcr (MBG_DEV_HANDLE dh)
 Check if a device provides a configurable IRIG input. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_lan_intf (MBG_DEV_HANDLE dh)
 Check if a device supports simple LAN interface API calls. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_ptp (MBG_DEV_HANDLE dh)
 Check if a device supports PTP configuration/status calls. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_ptp_unicast (MBG_DEV_HANDLE dh)
 Check if a device supports PTP unicast feature/configuration. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_hr_time (MBG_DEV_HANDLE dh)
 Check if a device supports the mbg_get_hr_time... functions. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_fast_hr_timestamp (MBG_DEV_HANDLE dh)
 Check if a device supports the mbg_get_fast_hr_timestamp... calls. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_time_scale (MBG_DEV_HANDLE dh)
 Check if a device supports configurable time scales. More...
 
int mbg_chk_dev_has_event_time (MBG_DEV_HANDLE dh)
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_ucap (MBG_DEV_HANDLE dh)
 Check if a device supports the mbg_get_ucap_entries and mbg_get_ucap_event calls. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_can_clr_ucap_buff (MBG_DEV_HANDLE dh)
 Check if a device supports the mbg_clr_ucap_buff call. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_tzdl (MBG_DEV_HANDLE dh)
 Check if a device supports timezone configuration using the TZDL structure. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_pcps_tzdl (MBG_DEV_HANDLE dh)
 Check if a device supports timezone configuration using the PCPS_TZDL structure. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_tzcode (MBG_DEV_HANDLE dh)
 Check if a device supports timezone configuration using the PCPS_TZCODE type. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_tz (MBG_DEV_HANDLE dh)
 Check if a device supports any kind of timezone configuration. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_irig (MBG_DEV_HANDLE dh)
 Check if a device provides either an IRIG input or output. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_irig_tx (MBG_DEV_HANDLE dh)
 Check if a device provides a configurable IRIG output. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_irig_ctrl_bits (MBG_DEV_HANDLE dh)
 Check if a device supports the mbg_get_irig_ctrl_bits call. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_raw_irig_data (MBG_DEV_HANDLE dh)
 Check if a device supports the mbg_get_raw_irig_data call. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_irig_time (MBG_DEV_HANDLE dh)
 Check if a device supports the mbg_get_irig_time call. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_signal (MBG_DEV_HANDLE dh)
 Check if a device provides the level of its inputs signal. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_mod (MBG_DEV_HANDLE dh)
 Check if a device provides a modulation signal. More...
 
int mbg_chk_dev_has_serial_hs (MBG_DEV_HANDLE dh)
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_synth (MBG_DEV_HANDLE dh)
 Check if a device provides a programmable frequency synthesizer. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_gpio (MBG_DEV_HANDLE dh)
 Check if a device provides GPIO signal inputs and/or outputs. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_cab_len (MBG_DEV_HANDLE dh)
 Check if a device supports configuration of antenna cable length. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_ref_offs (MBG_DEV_HANDLE dh)
 Check if a device provides a configurable ref time offset. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_opt_flags (MBG_DEV_HANDLE dh)
 Check if a device supports the MBG_OPT_INFO/MBG_OPT_SETTINGS. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_utc_parm (MBG_DEV_HANDLE dh)
 Check if a device support reading/writing of UTC parameters. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_corr_info (MBG_DEV_HANDLE dh)
 Check if a device supports reading correlation info. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_tr_distance (MBG_DEV_HANDLE dh)
 Check if a device supports configurable distance from transmitter. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_debug_status (MBG_DEV_HANDLE dh)
 Check if a device provides a debug status word to be read. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_evt_log (MBG_DEV_HANDLE dh)
 Check if a device provides an on-board event log. More...
 
_MBG_API_ATTR int _MBG_API mbg_chk_dev_has_dac_ctrl (MBG_DEV_HANDLE dh)
 Check if a device supports bus level DAC control commands. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_receiver_info (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports the RECEIVER_INFO structure and related calls. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_gps_data (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports large configuration data structures. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_generic_io (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports the mbg_generic_io API call. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_asic_version (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports the mbg_get_asic_version call. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_asic_features (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports the mbg_get_asic_features call. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_xmr (MBG_DEV_HANDLE dh, int *p)
 Check if a device provides extended multi ref (XMR) inputs. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_is_gnss (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports GNSS configuration. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_is_gps (MBG_DEV_HANDLE dh, int *p)
 Check if a device is a GPS receiver. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_is_dcf (MBG_DEV_HANDLE dh, int *p)
 Check if a device is a DCF77 receiver. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_pzf (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports demodulation of the DCF77 PZF code. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_is_msf (MBG_DEV_HANDLE dh, int *p)
 Check if a device is a MSF receiver. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_is_wwvb (MBG_DEV_HANDLE dh, int *p)
 Check if a device is a WWVB receiver. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_is_lwr (MBG_DEV_HANDLE dh, int *p)
 Check if a device is any long wave signal receiver. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_is_irig_rx (MBG_DEV_HANDLE dh, int *p)
 Check if a device provides a configurable IRIG input. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_lan_intf (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports simple LAN interface API calls. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_ptp (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports PTP configuration/status calls. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_ptp_unicast (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports PTP unicast feature/configuration. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_hr_time (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports the HR_TIME functions. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_fast_hr_timestamp (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports the mbg_get_fast_hr_timestamp_...() calls. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_time_scale (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports configurable time scales. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_event_time (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports setting an event time. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_ucap (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports the mbg_get_ucap_entries and mbg_get_ucap_event calls. More...
 
int mbg_dev_can_clr_ucap_buff (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports the mbg_clr_ucap_buff call. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_tzdl (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports timezone configuration using the TZDL structure. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_pcps_tzdl (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports timezone configuration using the PCPS_TZDL structure. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_tzcode (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports timezone configuration using the PCPS_TZCODE type. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_tz (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports any kind of timezone configuration. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_irig (MBG_DEV_HANDLE dh, int *p)
 Check if a device provides either an IRIG input or output. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_irig_tx (MBG_DEV_HANDLE dh, int *p)
 Check if a device provides a configurable IRIG output. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_irig_ctrl_bits (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports the mbg_get_irig_ctrl_bits call. More...
 
int mbg_dev_has_raw_irig_data (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports the mbg_get_raw_irig_data call. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_irig_time (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports the mbg_get_irig_time call. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_signal (MBG_DEV_HANDLE dh, int *p)
 Check if a device provides the level of its inputs signal. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_mod (MBG_DEV_HANDLE dh, int *p)
 Check if a device provides a modulation signal. More...
 
int mbg_dev_has_serial_hs (MBG_DEV_HANDLE dh, int *p)
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_synth (MBG_DEV_HANDLE dh, int *p)
 Check if a device provides a programmable frequency synthesizer. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_gpio (MBG_DEV_HANDLE dh, int *p)
 Check if a device provides GPIO signal inputs and/or outputs. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_cab_len (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports configuration of antenna cable length. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_ref_offs (MBG_DEV_HANDLE dh, int *p)
 Check if a device provides a configurable ref time offset. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_opt_flags (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports the MBG_OPT_INFO/MBG_OPT_SETTINGS. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_utc_parm (MBG_DEV_HANDLE dh, int *p)
 Check if a device support reading/writing of UTC parameters. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_corr_info (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports reading correlation info. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_tr_distance (MBG_DEV_HANDLE dh, int *p)
 Check if a device supports configurable distance from transmitter. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_debug_status (MBG_DEV_HANDLE dh, int *p)
 Check if a device provides a debug status word to be read. More...
 
_MBG_API_ATTR int _MBG_API mbg_dev_has_evt_log (MBG_DEV_HANDLE dh, int *p)
 Check if a device provides an on-board event log. More...
 
int mbg_dev_fn_from_dev_idx (char *s, int max_len, int dev_idx)
 Create a device file name associated with an index number. More...
 
_MBG_API_ATTR MBG_DEV_HANDLE _MBG_API mbg_open_device (int dev_idx)
 Open a device by index number. More...
 
_MBG_API_ATTR MBG_DEV_HANDLE _MBG_API mbg_open_device_by_dev_fn (const char *dev_fn)
 Open a device specified by a device file name. More...
 
_MBG_API_ATTR MBG_DEV_HANDLE _MBG_API mbg_open_device_by_hw_id (const char *dev_fn)
 Open a device specified by a device file name. More...
 
int mbg_find_devices (void)
 Get the number of devices installed on the computer. More...
 
int 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. More...
 
void 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. More...
 
void mbg_split_dev_name (const MBG_DEV_NAME dev_name, char *type_name, size_t type_name_size, char *sernum, size_t sernum_size)
 Split an MBG_DEV_NAME into the 'type name' and 'serial number' components. More...
 
_MBG_API_ATTR MBG_DEV_HANDLE _MBG_API mbg_open_device_by_name (const MBG_DEV_NAME srch_name, int selection_mode)
 Return a handle to a device with a particular device name. More...
 
void mbg_close_device (MBG_DEV_HANDLE *dev_handle)
 Close a device handle and set the handle value to MBG_INVALID_DEV_HANDLE. More...
 
int mbg_get_drvr_info (MBG_DEV_HANDLE dh, PCPS_DRVR_INFO *p)
 Read information about the driver handling a given device. More...
 
int mbg_get_device_info (MBG_DEV_HANDLE dh, PCPS_DEV *p)
 Read detailed device information. More...
 
int mbg_get_status_port (MBG_DEV_HANDLE dh, PCPS_STATUS_PORT *p)
 Read the current state of the on-board PCPS_STATUS_PORT. More...
 
int mbg_generic_read (MBG_DEV_HANDLE dh, int cmd, void *p, int size)
 
int mbg_generic_read_gps (MBG_DEV_HANDLE dh, int cmd, void *p, int size)
 
int mbg_generic_write (MBG_DEV_HANDLE dh, int cmd, const void *p, int size)
 
int mbg_generic_write_gps (MBG_DEV_HANDLE dh, int cmd, const void *p, int size)
 
int mbg_generic_io (MBG_DEV_HANDLE dh, int type, const void *in_p, int in_sz, void *out_p, int out_sz)
 
_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. More...
 
int mbg_set_time (MBG_DEV_HANDLE dh, const PCPS_STIME *p)
 Set the device's on-board clock to a given date and time. More...
 
int mbg_get_sync_time (MBG_DEV_HANDLE dh, PCPS_TIME *p)
 Read the time when the device has last recently synchronized. More...
 
_MBG_API_ATTR int _MBG_API mbg_get_time_sec_change (MBG_DEV_HANDLE dh, PCPS_TIME *p)
 Wait until the next second change, then return current time. More...
 
_MBG_API_ATTR int _MBG_API mbg_get_hr_time (MBG_DEV_HANDLE dh, PCPS_HR_TIME *p)
 Read the card's current time with high resolution, including status. More...
 
int mbg_set_event_time (MBG_DEV_HANDLE dh, const PCPS_TIME_STAMP *p)
 
int mbg_get_serial (MBG_DEV_HANDLE dh, PCPS_SERIAL *p)
 Read the serial port configuration from an old type of device. More...
 
int mbg_set_serial (MBG_DEV_HANDLE dh, const PCPS_SERIAL *p)
 Write the serial port configuration to an old type of device. More...
 
int mbg_get_tzcode (MBG_DEV_HANDLE dh, PCPS_TZCODE *p)
 Read time zone/daylight saving configuration code from a device. More...
 
int mbg_set_tzcode (MBG_DEV_HANDLE dh, const PCPS_TZCODE *p)
 Write time zone/daylight saving configuration code to a device. More...
 
int mbg_get_pcps_tzdl (MBG_DEV_HANDLE dh, PCPS_TZDL *p)
 Read time zone/daylight saving parameters from a device. More...
 
int mbg_set_pcps_tzdl (MBG_DEV_HANDLE dh, const PCPS_TZDL *p)
 Write time zone/daylight saving parameters to a device. More...
 
int mbg_get_ref_offs (MBG_DEV_HANDLE dh, MBG_REF_OFFS *p)
 Read the UTC offset configuration of the reference time from a device. More...
 
int mbg_set_ref_offs (MBG_DEV_HANDLE dh, const MBG_REF_OFFS *p)
 Write the UTC offset configuration of the reference time to a device. More...
 
int mbg_get_opt_info (MBG_DEV_HANDLE dh, MBG_OPT_INFO *p)
 Read a MBG_OPT_INFO structure containing optional settings, controlled by flags. More...
 
int mbg_set_opt_settings (MBG_DEV_HANDLE dh, const MBG_OPT_SETTINGS *p)
 Write a MBG_OPT_SETTINGS structure containing optional device settings. More...
 
int mbg_get_irig_rx_info (MBG_DEV_HANDLE dh, IRIG_INFO *p)
 Read the current IRIG input settings plus capabilities. More...
 
int mbg_set_irig_rx_settings (MBG_DEV_HANDLE dh, const IRIG_SETTINGS *p)
 Write an IRIG_SETTINGS structure to a device to configure an IRIG input. More...
 
int mbg_get_all_irig_rx_info (MBG_DEV_HANDLE dh, const PCPS_DEV *pdev, IRIG_INFO *p_irig_info, MBG_REF_OFFS *p_ref_offs, MBG_OPT_INFO *p_opt_info)
 Read all IRIG input configuration information from a device. More...
 
int mbg_save_all_irig_rx_settings (MBG_DEV_HANDLE dh, const PCPS_DEV *pdev, const IRIG_SETTINGS *p_irig_settings, const MBG_REF_OFFS *p_ref_offs, const MBG_OPT_SETTINGS *p_opt_settings)
 Write all IRIG input configuration settings to a device. More...
 
int 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. More...
 
int mbg_get_raw_irig_data (MBG_DEV_HANDLE dh, MBG_RAW_IRIG_DATA *p)
 Read raw IRIG data from an IRIG receiver. More...
 
int mbg_get_raw_irig_data_on_sec_change (MBG_DEV_HANDLE dh, MBG_RAW_IRIG_DATA *p)
 Wait for second changeover then read raw IRIG data from an IRIG receiver. More...
 
int 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. More...
 
int mbg_clr_ucap_buff (MBG_DEV_HANDLE dh)
 Clear a device's on-board time capture FIFO buffer. More...
 
int mbg_get_ucap_entries (MBG_DEV_HANDLE dh, PCPS_UCAP_ENTRIES *p)
 Read information on a device's event capture buffer. More...
 
int mbg_get_ucap_event (MBG_DEV_HANDLE dh, PCPS_HR_TIME *p)
 Retrieve a single time capture event from the on-board FIFO buffer. More...
 
int mbg_get_gps_tzdl (MBG_DEV_HANDLE dh, TZDL *p)
 Read the card's time zone/daylight saving parameters. More...
 
int mbg_set_gps_tzdl (MBG_DEV_HANDLE dh, const TZDL *p)
 Write the card's time zone/daylight saving parameters. More...
 
int mbg_get_gps_sw_rev (MBG_DEV_HANDLE dh, SW_REV *p)
 Retrieve the software revision of a GPS receiver. More...
 
int mbg_get_gps_bvar_stat (MBG_DEV_HANDLE dh, BVAR_STAT *p)
 Retrieve the status of the battery buffered GPS variables. More...
 
int mbg_get_gps_time (MBG_DEV_HANDLE dh, TTM *p)
 Read the current board time using a TTM structure. More...
 
int mbg_set_gps_time (MBG_DEV_HANDLE dh, const TTM *p)
 Set the time on a GPS receiver device. More...
 
int mbg_get_gps_port_parm (MBG_DEV_HANDLE dh, PORT_PARM *p)
 Read a PORT_PARM structure with a device's serial port configuration. More...
 
int mbg_set_gps_port_parm (MBG_DEV_HANDLE dh, const PORT_PARM *p)
 Write a PORT_PARM structure to configure the on-board serial ports. More...
 
int mbg_get_gps_ant_info (MBG_DEV_HANDLE dh, ANT_INFO *p)
 Read an ANT_INFO structure to retrieve an extended GPS antenna status. More...
 
int mbg_get_gps_ucap (MBG_DEV_HANDLE dh, TTM *p)
 Read a time capture event from the on-board FIFO buffer using a TTM structure. More...
 
int mbg_get_gps_enable_flags (MBG_DEV_HANDLE dh, ENABLE_FLAGS *p)
 Read the ENABLE_FLAGS structure controlling when outputs are to be enabled. More...
 
int 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. More...
 
int mbg_get_gps_stat_info (MBG_DEV_HANDLE dh, STAT_INFO *p)
 Read the extended GPS receiver status from a device. More...
 
int mbg_set_gps_cmd (MBG_DEV_HANDLE dh, const GPS_CMD *p)
 Send one of the PC_GPS_COMMANDS to a GPS receiver device. More...
 
int mbg_get_gps_pos (MBG_DEV_HANDLE dh, POS *p)
 Read the current geographic position from a GPS device. More...
 
int mbg_set_gps_pos_xyz (MBG_DEV_HANDLE dh, const XYZ p)
 Set the GPS receiver position using XYZ coordinates. More...
 
int mbg_set_gps_pos_lla (MBG_DEV_HANDLE dh, const LLA p)
 Set the GPS receiver position using LLA coordinates. More...
 
int mbg_get_gps_ant_cable_len (MBG_DEV_HANDLE dh, ANT_CABLE_LEN *p)
 Read the configured antenna cable length from a device. More...
 
int 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. More...
 
int mbg_get_gps_receiver_info (MBG_DEV_HANDLE dh, RECEIVER_INFO *p)
 Read the RECEIVER_INFO structure from a device. More...
 
int mbg_get_gps_all_str_type_info (MBG_DEV_HANDLE dh, STR_TYPE_INFO_IDX stii[], const RECEIVER_INFO *p_ri)
 Read a STR_TYPE_INFO_IDX array of supported string types. More...
 
int mbg_get_gps_all_port_info (MBG_DEV_HANDLE dh, PORT_INFO_IDX pii[], const RECEIVER_INFO *p_ri)
 Read a PORT_INFO_IDX array of supported serial port configurations. More...
 
int mbg_set_gps_port_settings_idx (MBG_DEV_HANDLE dh, const PORT_SETTINGS_IDX *p)
 Write the configuration for a single serial port to a device. More...
 
int mbg_set_gps_port_settings (MBG_DEV_HANDLE dh, const PORT_SETTINGS *p, int idx)
 Write the configuration for a single serial port to a device. More...
 
int 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. More...
 
int mbg_get_asic_version (MBG_DEV_HANDLE dh, PCI_ASIC_VERSION *p)
 Read the version code of the on-board PCI/PCIe interface ASIC. More...
 
int mbg_get_asic_features (MBG_DEV_HANDLE dh, PCI_ASIC_FEATURES *p)
 Read the features of the on-board PCI/PCIe interface ASIC. More...
 
int 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. More...
 
int mbg_set_time_scale_settings (MBG_DEV_HANDLE dh, const MBG_TIME_SCALE_SETTINGS *p)
 Write the time scale configuration to a device. More...
 
int mbg_get_utc_parm (MBG_DEV_HANDLE dh, UTC *p)
 Read a UTC parameter structure from a device. More...
 
int mbg_set_utc_parm (MBG_DEV_HANDLE dh, const UTC *p)
 Write a UTC parameter structure to a device. More...
 
_MBG_API_ATTR int _MBG_API mbg_get_time_cycles (MBG_DEV_HANDLE dh, PCPS_TIME_CYCLES *p)
 Read the current time plus the associated PC cycles from a device. More...
 
_MBG_API_ATTR int _MBG_API mbg_get_hr_time_cycles (MBG_DEV_HANDLE dh, PCPS_HR_TIME_CYCLES *p)
 Read the current high resolution time plus the associated PC cycles from a device. More...
 
_MBG_API_ATTR int _MBG_API mbg_get_hr_time_comp (MBG_DEV_HANDLE dh, PCPS_HR_TIME *p, int32_t *hns_latency)
 Read the current high resolution time, and compensate the call's latency. More...
 
int mbg_get_irig_tx_info (MBG_DEV_HANDLE dh, IRIG_INFO *p)
 Read the current IRIG output settings plus the supported settings. More...
 
int mbg_set_irig_tx_settings (MBG_DEV_HANDLE dh, const IRIG_SETTINGS *p)
 Write an IRIG_SETTINGS structure to a device to configure the IRIG output. More...
 
int mbg_get_synth (MBG_DEV_HANDLE dh, SYNTH *p)
 Read the current frequency synthesizer settings from a device. More...
 
int mbg_set_synth (MBG_DEV_HANDLE dh, const SYNTH *p)
 Write frequency synthesizer configuration settings to a device. More...
 
int mbg_get_synth_state (MBG_DEV_HANDLE dh, SYNTH_STATE *p)
 Read the current status of the on-board frequency synthesizer. More...
 
_MBG_API_ATTR int _MBG_API mbg_get_fast_hr_timestamp_cycles (MBG_DEV_HANDLE dh, PCPS_TIME_STAMP_CYCLES *p)
 Read a high resolution PCPS_TIME_STAMP_CYCLES structure via memory mapped access. More...
 
_MBG_API_ATTR int _MBG_API mbg_get_fast_hr_timestamp_comp (MBG_DEV_HANDLE dh, PCPS_TIME_STAMP *p, int32_t *hns_latency)
 Read a high resolution timestamp and compensate the latency of the call. More...
 
_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. More...
 
int 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. More...
 
int mbg_set_gps_pout_settings_idx (MBG_DEV_HANDLE dh, const POUT_SETTINGS_IDX *p)
 Write the configuration for a single programmable pulse output. More...
 
int mbg_set_gps_pout_settings (MBG_DEV_HANDLE dh, const POUT_SETTINGS *p, int idx)
 Write the configuration for a single programmable pulse output. More...
 
int mbg_get_irq_stat_info (MBG_DEV_HANDLE dh, PCPS_IRQ_STAT_INFO *p)
 Read a device's IRQ status information. More...
 
int mbg_get_lan_if_info (MBG_DEV_HANDLE dh, LAN_IF_INFO *p)
 Read LAN interface information from a device. More...
 
int mbg_get_ip4_state (MBG_DEV_HANDLE dh, IP4_SETTINGS *p)
 Read LAN IPv4 state from a device. More...
 
int mbg_get_ip4_settings (MBG_DEV_HANDLE dh, IP4_SETTINGS *p)
 Read LAN IPv4 settings from a device. More...
 
int mbg_set_ip4_settings (MBG_DEV_HANDLE dh, const IP4_SETTINGS *p)
 Write LAN IPv4 settings to a device. More...
 
int mbg_get_ptp_state (MBG_DEV_HANDLE dh, PTP_STATE *p)
 Read PTP/IEEE1588 status from a device. More...
 
int mbg_get_ptp_cfg_info (MBG_DEV_HANDLE dh, PTP_CFG_INFO *p)
 Read PTP/IEEE1588 config info and current settings from a device. More...
 
int mbg_set_ptp_cfg_settings (MBG_DEV_HANDLE dh, const PTP_CFG_SETTINGS *p)
 Write PTP/IEEE1588 configuration settings to a device. More...
 
int mbg_get_ptp_uc_master_cfg_limits (MBG_DEV_HANDLE dh, PTP_UC_MASTER_CFG_LIMITS *p)
 Read PTP/IEEE1588 unicast master configuration limits from a device. More...
 
int mbg_get_all_ptp_uc_master_info (MBG_DEV_HANDLE dh, PTP_UC_MASTER_INFO_IDX pii[], const PTP_UC_MASTER_CFG_LIMITS *p_umsl)
 Read PTP Unicast master settings and configuration options. More...
 
int mbg_set_ptp_uc_master_settings_idx (MBG_DEV_HANDLE dh, const PTP_UC_MASTER_SETTINGS_IDX *p)
 Write PTP/IEEE1588 unicast configuration settings to a device. More...
 
int mbg_get_time_info_hrt (MBG_DEV_HANDLE dh, MBG_TIME_INFO_HRT *p)
 Read both system time and associated device time from the kernel driver. More...
 
int mbg_get_time_info_tstamp (MBG_DEV_HANDLE dh, MBG_TIME_INFO_TSTAMP *p)
 Read both system time and associated device timestamp from the kernel driver. More...
 
int mbg_get_corr_info (MBG_DEV_HANDLE dh, CORR_INFO *p)
 Read PZF correlation info from a device. More...
 
int mbg_get_tr_distance (MBG_DEV_HANDLE dh, TR_DISTANCE *p)
 Read configurable "distance from transmitter" parameter from a device. More...
 
int mbg_set_tr_distance (MBG_DEV_HANDLE dh, const TR_DISTANCE *p)
 Write configurable "distance from transmitter" parameter to a device. More...
 
int mbg_get_debug_status (MBG_DEV_HANDLE dh, MBG_DEBUG_STATUS *p)
 Read a debug status word from a device. More...
 
int mbg_clr_evt_log (MBG_DEV_HANDLE dh)
 Clear the device's on-board event log. More...
 
int mbg_get_num_evt_log_entries (MBG_DEV_HANDLE dh, MBG_NUM_EVT_LOG_ENTRIES *p)
 Read details about a device's on-board event log buffer. More...
 
int mbg_get_first_evt_log_entry (MBG_DEV_HANDLE dh, MBG_EVT_LOG_ENTRY *p)
 Read the first (oldest) event log entry from a device. More...
 
int mbg_get_next_evt_log_entry (MBG_DEV_HANDLE dh, MBG_EVT_LOG_ENTRY *p)
 Read the next event log entry from a device. More...
 
int mbg_get_gps_gnss_mode_info (MBG_DEV_HANDLE dh, MBG_GNSS_MODE_INFO *p_mi)
 Read the current GNSS mode info including current settings. More...
 
int mbg_set_gps_gnss_mode_settings (MBG_DEV_HANDLE dh, const MBG_GNSS_MODE_SETTINGS *p_ms)
 Write the GNSS mode configuration to a device. More...
 
int mbg_get_gps_all_gnss_sat_info (MBG_DEV_HANDLE dh, GNSS_SAT_INFO_IDX gsii[], const MBG_GNSS_MODE_INFO *p_mi)
 Read a GNSS_SAT_INFO_IDX array of satellite status information. More...
 
int mbg_get_gpio_cfg_limits (MBG_DEV_HANDLE dh, MBG_GPIO_CFG_LIMITS *p)
 Read common GPIO configuration limits. More...
 
int mbg_get_gps_all_gpio_info (MBG_DEV_HANDLE dh, MBG_GPIO_INFO_IDX gii[], const MBG_GPIO_CFG_LIMITS *p_gcl)
 Get all GPIO settings and capabilities. More...
 
int mbg_set_gps_gpio_settings_idx (MBG_DEV_HANDLE dh, const MBG_GPIO_SETTINGS_IDX *p)
 Write the configuration for a single GPIO port to a device. More...
 
int mbg_get_gps_all_gpio_status (MBG_DEV_HANDLE dh, MBG_GPIO_STATUS_IDX gsi[], const MBG_GPIO_CFG_LIMITS *p_gcl)
 Read the status of all GPIO signal ports. More...
 
int mbg_get_xmr_instances (MBG_DEV_HANDLE dh, XMULTI_REF_INSTANCES *p)
 Read XMULTI_REF_INSTANCES. More...
 
int mbg_get_gps_all_xmr_status (MBG_DEV_HANDLE dh, XMULTI_REF_STATUS_IDX xmrsi[], const XMULTI_REF_INSTANCES *p_xmri)
 Read the status of all XMR sources. More...
 
int mbg_get_gps_all_xmr_info (MBG_DEV_HANDLE dh, XMULTI_REF_INFO_IDX xmrii[], const XMULTI_REF_INSTANCES *p_xmri)
 Read all XMR settings and capabilities. More...
 
int mbg_set_gps_xmr_settings_idx (MBG_DEV_HANDLE dh, const XMULTI_REF_SETTINGS_IDX *p)
 Write a single XMR setting to a device. More...
 
int mbg_get_xmr_holdover_status (MBG_DEV_HANDLE dh, XMR_HOLDOVER_STATUS *p, const XMULTI_REF_INSTANCES *p_xmri)
 Read the current XMR holdover interval from a device. More...
 
int mbg_get_process_affinity (pid_t pid, int *p)
 Read the CPU affinity of a process. More...
 
int mbg_set_process_affinity (pid_t pid, int *p)
 Set the CPU affinity of a process. More...
 
int mbg_set_current_process_affinity_to_cpu (int cpu_num)
 Set the CPU affinity of a process for a single CPU only. More...
 
int mbg_thread_create (MBG_THREAD_INFO *p_ti, MBG_THREAD_FNC fnc, void *arg)
 Create a new execution thread for the current process. More...
 
int mbg_thread_stop (MBG_THREAD_INFO *p_ti)
 Stop a thread which has been created by mbg_thread_create. More...
 
int mbg_thread_sleep_interruptible (MBG_THREAD_INFO *p_ti, ulong sleep_ms)
 Let the current thread sleep for a certain interval. More...
 
int mbg_thread_set_affinity (MBG_THREAD_INFO *p_ti, int *p)
 Set the CPU affinity of a single thread. More...
 
int mbg_xhrt_poll_thread_create (MBG_POLL_THREAD_INFO *p_pti, MBG_DEV_HANDLE dh, MBG_PC_CYCLES_FREQUENCY freq_hz, int sleep_ms)
 Set up a MBG_POLL_THREAD_INFO structure and start a new thread. More...
 
int mbg_xhrt_poll_thread_stop (MBG_POLL_THREAD_INFO *p_pti)
 Stop a polling thread started by mbg_xhrt_poll_thread_create. More...
 
int mbg_get_xhrt_time_as_pcps_hr_time (MBG_XHRT_INFO *p, PCPS_HR_TIME *p_hrt)
 Retrieve an extrapolated time stamp in PCPS_HR_TIME format. More...
 
int mbg_get_xhrt_time_as_filetime (MBG_XHRT_INFO *p, int *p_ft)
 Retrieve an extrapolated time stamp in FILETIME format. More...
 
int mbg_get_xhrt_cycles_frequency (MBG_XHRT_INFO *p, MBG_PC_CYCLES_FREQUENCY *p_freq_hz)
 Retrieve the frequency of the system's cycles counter. More...
 
int mbg_get_default_cycles_frequency_from_dev (MBG_DEV_HANDLE dh, MBG_PC_CYCLES_FREQUENCY *p)
 Retrieve the system's default cycles counter frequency from the kernel driver. More...
 
MBG_PC_CYCLES_FREQUENCY mbg_get_default_cycles_frequency (void)
 Retrieve the system's default cycles counter frequency. More...
 
static __mbg_inline void mbg_chk_tstamp64_leap_sec (uint64_t *tstamp64, PCPS_TIME_STATUS_X *status)
 
static __mbg_inline void mbg_init_pc_cycles_frequency (MBG_DEV_HANDLE dh, MBG_PC_CYCLES_FREQUENCY *p)
 

Variables

const char mbg_dev_fn_base []
 
const char mbg_dev_fn_fmt []
 

Macro Definition Documentation

◆ _do_mbgdevio_read_gps

#define _do_mbgdevio_read_gps (   _dh,
  _cmd,
  _ioctl,
  _p,
  _sz 
)    pcps_read_gps_safe( _dh, _cmd, _p, _sz )

Definition at line 5647 of file mbgdevio.h.

◆ _ext

#define _ext   extern

Definition at line 332 of file mbgdevio.h.

◆ _mbg_cpu_clear

#define _mbg_cpu_clear (   _ps)    ( *(_ps) = 0 )

◆ _mbg_cpu_isset

#define _mbg_cpu_isset (   _i,
  _ps 
)    ( *(_ps) & ( 1UL << (_i) ) )

Definition at line 484 of file mbgdevio.h.

Referenced by print_cpu_set().

◆ _mbg_cpu_set

#define _mbg_cpu_set (   _i,
  _ps 
)    ( *(_ps) |= ( (MBG_CPU_SET) 1UL << (_i) ) )

◆ _mbg_generic_read_gps_var

#define _mbg_generic_read_gps_var (   _dh,
  _cmd,
  _s 
)    mbg_generic_read_gps( _dh, _cmd, &(_s), sizeof( (_s) ) )

Definition at line 5697 of file mbgdevio.h.

◆ _mbg_generic_read_var

#define _mbg_generic_read_var (   _dh,
  _cmd,
  _s 
)    mbg_generic_read( _dh, _cmd, &(_s), sizeof( (_s) ) )

Definition at line 5691 of file mbgdevio.h.

◆ _mbg_generic_write_gps_var

#define _mbg_generic_write_gps_var (   _dh,
  _cmd,
  _s 
)    mbg_generic_write_gps( _dh, _cmd, &(_s), sizeof( (_s) ) )

Definition at line 5700 of file mbgdevio.h.

◆ _mbg_generic_write_var

#define _mbg_generic_write_var (   _dh,
  _cmd,
  _s 
)    mbg_generic_write( _dh, _cmd, &(_s), sizeof( (_s) ) )

Definition at line 5694 of file mbgdevio.h.

◆ _mbg_get_current_process

#define _mbg_get_current_process ( )    0

Definition at line 416 of file mbgdevio.h.

Referenced by main(), and mbg_set_current_process_affinity_to_cpu().

◆ _mbg_get_current_thread

#define _mbg_get_current_thread ( )    0

Definition at line 493 of file mbgdevio.h.

◆ _mbg_thread_exit

#define _mbg_thread_exit (   _v)    _nop_macro_fnc()

Definition at line 505 of file mbgdevio.h.

Referenced by mbg_set_current_process_affinity_to_cpu().

◆ _mbgdevio_chk_cond

#define _mbgdevio_chk_cond (   _cond)
Value:
{ \
if ( !(_cond) ) \
}
#define MBG_ERR_NOT_SUPP_BY_DEV
Command or feature not supported by device.
Definition: mbgerror.h:286

Definition at line 5635 of file mbgdevio.h.

◆ _mbgdevio_cnv_ret_val

#define _mbgdevio_cnv_ret_val (   _v)    (_v)

Definition at line 369 of file mbgdevio.h.

Referenced by do_chk_dev_feat(), do_chk_dev_feat_deprecated(), mbg_clr_evt_log(), mbg_clr_ucap_buff(), mbg_generic_io(), mbg_generic_read(), mbg_generic_read_gps(), mbg_generic_write(), mbg_generic_write_gps(), mbg_get_all_ptp_uc_master_info(), mbg_get_asic_features(), mbg_get_asic_version(), mbg_get_corr_info(), mbg_get_debug_status(), mbg_get_default_cycles_frequency_from_dev(), mbg_get_device_info(), mbg_get_drvr_info(), mbg_get_fast_hr_timestamp(), mbg_get_fast_hr_timestamp_cycles(), mbg_get_first_evt_log_entry(), mbg_get_gpio_cfg_limits(), mbg_get_gps_all_gnss_sat_info(), mbg_get_gps_all_gpio_info(), mbg_get_gps_all_gpio_status(), mbg_get_gps_all_port_info(), mbg_get_gps_all_pout_info(), mbg_get_gps_all_str_type_info(), mbg_get_gps_all_xmr_info(), mbg_get_gps_all_xmr_status(), mbg_get_gps_ant_cable_len(), mbg_get_gps_ant_info(), mbg_get_gps_bvar_stat(), mbg_get_gps_enable_flags(), mbg_get_gps_gnss_mode_info(), mbg_get_gps_port_parm(), mbg_get_gps_pos(), mbg_get_gps_receiver_info(), mbg_get_gps_stat_info(), mbg_get_gps_sw_rev(), mbg_get_gps_time(), mbg_get_gps_tzdl(), mbg_get_gps_ucap(), mbg_get_hr_time(), mbg_get_hr_time_cycles(), mbg_get_ip4_settings(), mbg_get_ip4_state(), mbg_get_irig_ctrl_bits(), mbg_get_irig_rx_info(), mbg_get_irig_time(), mbg_get_irig_tx_info(), mbg_get_irq_stat_info(), mbg_get_lan_if_info(), mbg_get_next_evt_log_entry(), mbg_get_num_evt_log_entries(), mbg_get_opt_info(), mbg_get_pcps_tzdl(), mbg_get_ptp_cfg_info(), mbg_get_ptp_state(), mbg_get_ptp_uc_master_cfg_limits(), mbg_get_raw_irig_data(), mbg_get_raw_irig_data_on_sec_change(), mbg_get_ref_offs(), mbg_get_serial(), mbg_get_status_port(), mbg_get_sync_time(), mbg_get_synth(), mbg_get_synth_state(), mbg_get_time(), mbg_get_time_cycles(), mbg_get_time_info_hrt(), mbg_get_time_info_tstamp(), mbg_get_time_scale_info(), mbg_get_time_sec_change(), mbg_get_tr_distance(), mbg_get_tzcode(), mbg_get_ucap_entries(), mbg_get_ucap_event(), mbg_get_utc_parm(), mbg_get_xmr_holdover_status(), mbg_get_xmr_instances(), mbg_set_event_time(), mbg_set_gps_ant_cable_len(), mbg_set_gps_cmd(), mbg_set_gps_enable_flags(), mbg_set_gps_gnss_mode_settings(), mbg_set_gps_gpio_settings_idx(), mbg_set_gps_port_parm(), mbg_set_gps_port_settings_idx(), mbg_set_gps_pos_lla(), mbg_set_gps_pos_xyz(), mbg_set_gps_pout_settings_idx(), mbg_set_gps_time(), mbg_set_gps_tzdl(), mbg_set_gps_xmr_settings_idx(), mbg_set_ip4_settings(), mbg_set_irig_rx_settings(), mbg_set_irig_tx_settings(), mbg_set_opt_settings(), mbg_set_pcps_tzdl(), mbg_set_ptp_cfg_settings(), mbg_set_ptp_uc_master_settings_idx(), mbg_set_ref_offs(), mbg_set_serial(), mbg_set_synth(), mbg_set_time(), mbg_set_time_scale_settings(), mbg_set_tr_distance(), mbg_set_tzcode(), and mbg_set_utc_parm().

◆ _mbgdevio_gen_io

#define _mbgdevio_gen_io (   _dh,
  _type,
  _in_p,
  _in_sz,
  _out_p,
  _out_sz 
)    pcps_generic_io( _dh, _type, _in_p, _in_sz, _out_p, _out_sz );

Definition at line 5678 of file mbgdevio.h.

Referenced by mbg_generic_io().

◆ _mbgdevio_gen_read

#define _mbgdevio_gen_read (   _dh,
  _cmd,
  _p,
  _sz 
)    _mbgdevio_read( _dh, _cmd, -1, _p, _sz )

Definition at line 5672 of file mbgdevio.h.

Referenced by mbg_generic_read().

◆ _mbgdevio_gen_read_gps

◆ _mbgdevio_gen_read_gps_var

#define _mbgdevio_gen_read_gps_var (   _dh,
  _cmd,
  _s 
)    _mbgdevio_gen_read_gps( _dh, _cmd, &(_s), sizeof( (_s) ) )

Definition at line 5711 of file mbgdevio.h.

◆ _mbgdevio_gen_read_var

#define _mbgdevio_gen_read_var (   _dh,
  _cmd,
  _s 
)    _mbgdevio_gen_read( _dh, _cmd, &(_s), sizeof( (_s) ) )

Definition at line 5705 of file mbgdevio.h.

◆ _mbgdevio_gen_write

#define _mbgdevio_gen_write (   _dh,
  _cmd,
  _p,
  _sz 
)    _mbgdevio_write( _dh, _cmd, -1, _p, _sz )

Definition at line 5675 of file mbgdevio.h.

Referenced by mbg_generic_write().

◆ _mbgdevio_gen_write_gps

#define _mbgdevio_gen_write_gps (   _dh,
  _cmd,
  _p,
  _sz 
)    _mbgdevio_write_gps( _dh, _cmd, -1, _p, _sz )

Definition at line 5684 of file mbgdevio.h.

Referenced by mbg_generic_write_gps().

◆ _mbgdevio_gen_write_gps_var

#define _mbgdevio_gen_write_gps_var (   _dh,
  _cmd,
  _s 
)    _mbgdevio_gen_write_gps( _dh, _cmd, &(_s), sizeof( (_s) ) )

Definition at line 5714 of file mbgdevio.h.

◆ _mbgdevio_gen_write_var

#define _mbgdevio_gen_write_var (   _dh,
  _cmd,
  _s 
)    _mbgdevio_gen_write( _dh, _cmd, &(_s), sizeof( (_s) ) )

Definition at line 5708 of file mbgdevio.h.

◆ _mbgdevio_read

#define _mbgdevio_read (   _dh,
  _cmd,
  _ioctl,
  _p,
  _sz 
)    pcps_read_safe( _dh, _cmd, _p, _sz )

Definition at line 5641 of file mbgdevio.h.

◆ _mbgdevio_read_gps_var

#define _mbgdevio_read_gps_var (   _dh,
  _cmd,
  _ioctl,
  _p 
)    _pcps_read_gps_var_safe( _dh, _cmd, *(_p) )

◆ _mbgdevio_read_var

◆ _mbgdevio_write

#define _mbgdevio_write (   _dh,
  _cmd,
  _ioctl,
  _p,
  _sz 
)    pcps_write_safe( _dh, _cmd, _p, _sz )

Definition at line 5644 of file mbgdevio.h.

◆ _mbgdevio_write_cmd

#define _mbgdevio_write_cmd (   _dh,
  _cmd,
  _ioctl 
)    _pcps_write_byte_safe( _dh, _cmd );

Definition at line 5662 of file mbgdevio.h.

◆ _mbgdevio_write_gps

#define _mbgdevio_write_gps (   _dh,
  _cmd,
  _ioctl,
  _p,
  _sz 
)    pcps_write_gps_safe( _dh, _cmd, _p, _sz )

Definition at line 5650 of file mbgdevio.h.

Referenced by mbg_set_gps_pos_lla(), and mbg_set_gps_pos_xyz().

◆ _mbgdevio_write_gps_var

#define _mbgdevio_write_gps_var (   _dh,
  _cmd,
  _ioctl,
  _p 
)    _pcps_write_gps_var_safe( _dh, _cmd, *(_p) )

◆ _mbgdevio_write_var

#define _mbgdevio_write_var (   _dh,
  _cmd,
  _ioctl,
  _p 
)    _pcps_write_var_safe( _dh, _cmd, *(_p) )

Definition at line 5659 of file mbgdevio.h.

Referenced by mbg_set_serial().

◆ DEBUG_IOCTL_CALLS

#define DEBUG_IOCTL_CALLS   0

Definition at line 324 of file mbgdevio.h.

◆ FILETIME

◆ MBG_CPU_SET

#define MBG_CPU_SET   int

◆ MBG_CPU_SET_SIZE

#define MBG_CPU_SET_SIZE   ( sizeof( MBG_CPU_SET ) * 8 )

Definition at line 472 of file mbgdevio.h.

Referenced by print_cpu_set().

◆ MBG_INVALID_DEV_HANDLE

◆ MBG_PROCESS_ID

#define MBG_PROCESS_ID   pid_t

Definition at line 415 of file mbgdevio.h.

◆ MBG_THREAD_FNC_RET_VAL

#define MBG_THREAD_FNC_RET_VAL   void

Definition at line 501 of file mbgdevio.h.

Referenced by mbg_set_current_process_affinity_to_cpu().

◆ MBG_THREAD_ID

#define MBG_THREAD_ID   int

Definition at line 489 of file mbgdevio.h.

◆ MBGCLOCK_DEV_FN_BASE

#define MBGCLOCK_DEV_FN_BASE   "/dev/mbgclock"

Definition at line 392 of file mbgdevio.h.

◆ MBGCLOCK_DEV_FN_FMT

#define MBGCLOCK_DEV_FN_FMT   MBGCLOCK_DEV_FN_BASE "%i"

Definition at line 393 of file mbgdevio.h.

◆ MBGDEVIO_COMPAT_VERSION

#define MBGDEVIO_COMPAT_VERSION   0x0210

Definition at line 229 of file mbgdevio.h.

Referenced by mbgdevio_check_version().

◆ MBGDEVIO_HAVE_THREAD_AFFINITY

#define MBGDEVIO_HAVE_THREAD_AFFINITY   0

Definition at line 318 of file mbgdevio.h.

◆ MBGDEVIO_RET_VAL

#define MBGDEVIO_RET_VAL   int

Definition at line 364 of file mbgdevio.h.

Referenced by do_chk_dev_feat(), do_chk_dev_feat_deprecated(), mbg_clr_evt_log(), mbg_clr_ucap_buff(), mbg_generic_io(), mbg_generic_read(), mbg_generic_read_gps(), mbg_generic_write(), mbg_generic_write_gps(), mbg_get_all_ptp_uc_master_info(), mbg_get_asic_features(), mbg_get_asic_version(), mbg_get_corr_info(), mbg_get_debug_status(), mbg_get_default_cycles_frequency_from_dev(), mbg_get_device_info(), mbg_get_drvr_info(), mbg_get_fast_hr_timestamp(), mbg_get_fast_hr_timestamp_cycles(), mbg_get_first_evt_log_entry(), mbg_get_gpio_cfg_limits(), mbg_get_gps_all_gnss_sat_info(), mbg_get_gps_all_gpio_info(), mbg_get_gps_all_gpio_status(), mbg_get_gps_all_port_info(), mbg_get_gps_all_pout_info(), mbg_get_gps_all_str_type_info(), mbg_get_gps_all_xmr_info(), mbg_get_gps_all_xmr_status(), mbg_get_gps_ant_cable_len(), mbg_get_gps_ant_info(), mbg_get_gps_bvar_stat(), mbg_get_gps_enable_flags(), mbg_get_gps_gnss_mode_info(), mbg_get_gps_port_parm(), mbg_get_gps_pos(), mbg_get_gps_receiver_info(), mbg_get_gps_stat_info(), mbg_get_gps_sw_rev(), mbg_get_gps_time(), mbg_get_gps_tzdl(), mbg_get_gps_ucap(), mbg_get_hr_time(), mbg_get_hr_time_cycles(), mbg_get_ip4_settings(), mbg_get_ip4_state(), mbg_get_irig_ctrl_bits(), mbg_get_irig_rx_info(), mbg_get_irig_time(), mbg_get_irig_tx_info(), mbg_get_irq_stat_info(), mbg_get_lan_if_info(), mbg_get_next_evt_log_entry(), mbg_get_num_evt_log_entries(), mbg_get_opt_info(), mbg_get_pcps_tzdl(), mbg_get_ptp_cfg_info(), mbg_get_ptp_state(), mbg_get_ptp_uc_master_cfg_limits(), mbg_get_raw_irig_data(), mbg_get_raw_irig_data_on_sec_change(), mbg_get_ref_offs(), mbg_get_serial(), mbg_get_status_port(), mbg_get_sync_time(), mbg_get_synth(), mbg_get_synth_state(), mbg_get_time(), mbg_get_time_cycles(), mbg_get_time_info_hrt(), mbg_get_time_info_tstamp(), mbg_get_time_scale_info(), mbg_get_time_sec_change(), mbg_get_tr_distance(), mbg_get_tzcode(), mbg_get_ucap_entries(), mbg_get_ucap_event(), mbg_get_utc_parm(), mbg_get_xmr_holdover_status(), mbg_get_xmr_instances(), mbg_set_event_time(), mbg_set_gps_ant_cable_len(), mbg_set_gps_cmd(), mbg_set_gps_enable_flags(), mbg_set_gps_gnss_mode_settings(), mbg_set_gps_gpio_settings_idx(), mbg_set_gps_port_parm(), mbg_set_gps_port_settings_idx(), mbg_set_gps_pos_lla(), mbg_set_gps_pos_xyz(), mbg_set_gps_pout_settings_idx(), mbg_set_gps_time(), mbg_set_gps_tzdl(), mbg_set_gps_xmr_settings_idx(), mbg_set_ip4_settings(), mbg_set_irig_rx_settings(), mbg_set_irig_tx_settings(), mbg_set_opt_settings(), mbg_set_pcps_tzdl(), mbg_set_ptp_cfg_settings(), mbg_set_ptp_uc_master_settings_idx(), mbg_set_ref_offs(), mbg_set_serial(), mbg_set_synth(), mbg_set_time(), mbg_set_time_scale_settings(), mbg_set_tr_distance(), mbg_set_tzcode(), and mbg_set_utc_parm().

◆ MBGDEVIO_USE_THREAD_API

#define MBGDEVIO_USE_THREAD_API   0

Definition at line 314 of file mbgdevio.h.

◆ MBGDEVIO_VERSION

#define MBGDEVIO_VERSION   0x0308

Definition at line 227 of file mbgdevio.h.

Referenced by mbgdevio_get_version().

◆ MBGDEVIO_XHRT_API

#define MBGDEVIO_XHRT_API   1

Definition at line 251 of file mbgdevio.h.

Typedef Documentation

◆ MBG_DEV_FN

typedef char MBG_DEV_FN[260]

A string that can take a device file name.

The format of the device file name depends on the type of operating system.

On Linux and similar systems this is something like a regular file name with an index number appended, e.g. "/dev/mbgclock0". See MBGCLOCK_DEV_FN_BASE.

Under Windows this is a complex string composed of GUIDs, bus-specific vendor and device ID numbers, etc., which can't easily be handled manually.

Definition at line 387 of file mbgdevio.h.

◆ MBG_DEV_FN_LIST_ENTRY

An entry for a list of device file names.

Applications should consider this type as opaque, and must not rely on the type, number, and order of the structure members.

Definition at line 615 of file mbgdevio.h.

◆ MBG_DEV_HANDLE

Definition at line 356 of file mbgdevio.h.

◆ MBG_DEV_NAME_LIST_ENTRY

An entry for a list of device names.

Applications should consider this type as opaque, and must not rely on the type, number, and order of the structure members.

See also
mbg_find_devices_with_names
mbg_free_device_name_list

Definition at line 647 of file mbgdevio.h.

◆ MBG_THREAD_FNC

typedef void MBG_THREAD_FNC(void *)

A generic type of a thread function.

Definition at line 527 of file mbgdevio.h.

Enumeration Type Documentation

◆ MBG_MATCH_MODES

Device matching modes.

Match modes to determine how to proceed if a device with particular model type and serial number has not been detected.

Enumerator
MBG_MATCH_ANY 

use the next device available on the system

MBG_MATCH_MODEL 

use the next available device of the same type

MBG_MATCH_EXACTLY 

use only exactly the excat matching device, otherwise fail

N_MBG_MATCH_MODES 

number of known modes

Definition at line 598 of file mbgdevio.h.

Function Documentation

◆ mbg_chk_dev_has_event_time()

int mbg_chk_dev_has_event_time ( MBG_DEV_HANDLE  dh)

Definition at line 1438 of file mbgdevio.c.

References _do_query_cond, _pcps_ddev_has_event_time, and IOCTL_DEV_HAS_EVENT_TIME.

◆ mbg_chk_dev_has_serial_hs()

int mbg_chk_dev_has_serial_hs ( MBG_DEV_HANDLE  dh)

Definition at line 1823 of file mbgdevio.c.

References _do_query_cond, _pcps_ddev_has_serial_hs, and IOCTL_DEV_HAS_SERIAL_HS.

◆ mbg_chk_tstamp64_leap_sec()

static __mbg_inline void mbg_chk_tstamp64_leap_sec ( uint64_t tstamp64,
PCPS_TIME_STATUS_X status 
)
static

◆ mbg_close_device()

void mbg_close_device ( MBG_DEV_HANDLE dev_handle)

Close a device handle and set the handle value to MBG_INVALID_DEV_HANDLE.

Parameters
[in,out]dev_handlePointer to a Meinberg device handle
See also
API functions that can be used to open a device

Definition at line 4190 of file mbgdevio.c.

References MBG_INVALID_DEV_HANDLE.

Referenced by do_mbgsvctasks(), do_mbgtcrcal(), get_dev_info_for_dev_fn(), main(), mbg_find_devices(), mbg_handle_device(), and setup_dev_fn_list().

◆ mbg_clr_evt_log()

int mbg_clr_evt_log ( MBG_DEV_HANDLE  dh)

Clear the device's on-board event log.

The API call mbg_chk_dev_has_evt_log checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_evt_log
mbg_get_num_evt_log_entries
mbg_get_first_evt_log_entry
mbg_get_next_evt_log_entry

Definition at line 7819 of file mbgdevio.c.

References _mbgdevio_cnv_ret_val, _mbgdevio_write_cmd_chk, _pcps_ddev_has_evt_log, IOCTL_CLR_EVT_LOG, MBGDEVIO_RET_VAL, and PCPS_CLR_EVT_LOG.

◆ mbg_clr_ucap_buff()

int mbg_clr_ucap_buff ( MBG_DEV_HANDLE  dh)

Clear a device's on-board time capture FIFO buffer.

The API call mbg_chk_dev_can_clr_ucap_buff checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_can_clr_ucap_buff
mbg_get_ucap_entries
mbg_get_ucap_event

Definition at line 5331 of file mbgdevio.c.

References _mbgdevio_cnv_ret_val, _mbgdevio_write_cmd_chk, _pcps_ddev_can_clr_ucap_buff, IOCTL_PCPS_CLR_UCAP_BUFF, MBGDEVIO_RET_VAL, and PCPS_CLR_UCAP_BUFF.

Referenced by do_mbggpscap().

◆ mbg_dev_can_clr_ucap_buff()

int mbg_dev_can_clr_ucap_buff ( MBG_DEV_HANDLE  dh,
int *  p 
)

Check if a device supports the mbg_clr_ucap_buff call.

Deprecated:
This function is deprecated, use mbg_chk_dev_can_clr_ucap_buff preferably.
Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to an int which is updated if the API call succeeds. The flag is set != 0 if the requested feature is supported, else 0.
Returns
MBG_SUCCESS on success, if *p has been updated, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_can_clr_ucap_buff
Deprecated:
This function is deprecated, use mbg_chk_dev_can_clr_ucap_buff preferably.
Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to an int which is updated if the API call succeeds. The flag is set != 0 if the requested feature is supported, else 0.
Returns
MBG_SUCCESS on success, if *p has been updated, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_can_clr_ucap_buff

Definition at line 2668 of file mbgdevio.c.

References do_chk_dev_feat_deprecated(), and mbg_chk_dev_can_clr_ucap_buff.

◆ mbg_dev_fn_from_dev_idx()

int mbg_dev_fn_from_dev_idx ( char *  s,
int  max_len,
int  dev_idx 
)

Create a device file name associated with an index number.

Create a system-specific device file name string, e.g. "/dev/mbgclock0" under Linux and similar systems, which can be used with the open() call on systems which support this, and is also appropriate for informational messages, e.g.when referring to a specific device.

Under Windows a hardware ID string is required to open the device, and the Windows-specific function mbg_svc_get_device_path can be used get the hardware ID string associated with a specific device index for that purpose.

However, the Windows hardware ID string is not appropriate for informational messages referring to a device, so this function can be used under Windows and other target systems that don't support simple device file names to create a generic string like "device #0".

Parameters
[out]sPointer to the output buffer.
[in]max_lenSize of the output buffer.
[in]dev_idxThe device index number.
See also
mbg_svc_get_device_path under Windows

Definition at line 3319 of file mbgdevio.c.

References mbg_dev_fn_fmt, and snprintf_safe().

Referenced by mbg_open_device(), mbg_open_device_by_param(), and setup_dev_fn_list().

◆ mbg_dev_has_raw_irig_data()

int mbg_dev_has_raw_irig_data ( MBG_DEV_HANDLE  dh,
int *  p 
)

Check if a device supports the mbg_get_raw_irig_data call.

Deprecated:
This function is deprecated, use mbg_chk_dev_has_raw_irig_data preferably.
Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to an int which is updated if the API call succeeds. The flag is set != 0 if the requested feature is supported, else 0.
Returns
MBG_SUCCESS on success, if *p has been updated, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_raw_irig_data
Deprecated:
This function is deprecated, use mbg_chk_dev_has_raw_irig_data preferably.
Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to an int which is updated if the API call succeeds. The flag is set != 0 if the requested feature is supported, else 0.
Returns
MBG_SUCCESS on success, if *p has been updated, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_raw_irig_data

Definition at line 2851 of file mbgdevio.c.

References do_chk_dev_feat_deprecated(), and mbg_chk_dev_has_raw_irig_data.

◆ mbg_dev_has_serial_hs()

int mbg_dev_has_serial_hs ( MBG_DEV_HANDLE  dh,
int *  p 
)

Definition at line 2947 of file mbgdevio.c.

References do_chk_dev_feat_deprecated(), and mbg_chk_dev_has_serial_hs.

◆ mbg_find_devices()

int mbg_find_devices ( void  )

Get the number of devices installed on the computer.

The function mbg_find_devices_with_names should eventually be used preferafly. See API functions that can be used to open a device.

Returns
The number of devices found
See also
mbg_find_devices_with_names
mbg_open_device
API functions that can be used to open a device

Definition at line 3503 of file mbgdevio.c.

References mbg_close_device(), MBG_INVALID_DEV_HANDLE, mbg_open_device(), n_ddevs, N_SUPP_DEV_BUS, pcps_detect_devices(), and pcps_isa_ports.

Referenced by chk_get_num_devices(), do_mbgsvctasks(), and mbg_open_device_by_name().

◆ mbg_find_devices_with_names()

int 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.

Allocate and fill a list with the names of Meinberg devices currently present in the system.

This can be used e.g. to populate a device selection dialog in a configuration program.

When the list is not used anymore it can be freed by calling mbg_free_device_name_list.

Parameters
[in]p_listPointer to a linked list to be allocated.
[in]max_devicesMaximum number of devices to be searched for (must not exceed N_SUPP_DEV_BUS).
Returns
The number of present devices
See also
mbg_free_device_name_list
mbg_find_devices
MBG_DEV_NAME

Definition at line 3897 of file mbgdevio.c.

References _MBG_DEV_FN_LIST_ENTRY::dev_fn_ptr, _MBG_DEV_NAME_LIST_ENTRY::dev_name, free_dev_fn_list(), get_dev_info_for_dev_fn(), mbg_free_device_name_list(), mbg_rc_is_success, _MBG_DEV_FN_LIST_ENTRY::next, _MBG_DEV_NAME_LIST_ENTRY::next, setup_dev_fn_list(), and snprint_dev_name().

Referenced by main().

◆ mbg_free_device_name_list()

void 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.

The list may have been set up and allocated before by mbg_find_devices_with_names.

Parameters
[in,out]listLinked list of MBG_DEV_NAME_LIST_ENTRY entries.
See also
mbg_find_devices_with_names

Definition at line 3981 of file mbgdevio.c.

References _MBG_DEV_NAME_LIST_ENTRY::next.

Referenced by main(), and mbg_find_devices_with_names().

◆ mbg_generic_io()

int mbg_generic_io ( MBG_DEV_HANDLE  dh,
int  type,
const void *  in_p,
int  in_sz,
void *  out_p,
int  out_sz 
)

◆ mbg_generic_read()

int mbg_generic_read ( MBG_DEV_HANDLE  dh,
int  cmd,
void *  p,
int  size 
)

Definition at line 4311 of file mbgdevio.c.

References _mbgdevio_cnv_ret_val, _mbgdevio_gen_read, and MBGDEVIO_RET_VAL.

◆ mbg_generic_read_gps()

int mbg_generic_read_gps ( MBG_DEV_HANDLE  dh,
int  cmd,
void *  p,
int  size 
)

Definition at line 4348 of file mbgdevio.c.

References _mbgdevio_cnv_ret_val, _mbgdevio_gen_read_gps, and MBGDEVIO_RET_VAL.

◆ mbg_generic_write()

int mbg_generic_write ( MBG_DEV_HANDLE  dh,
int  cmd,
const void *  p,
int  size 
)

Definition at line 4382 of file mbgdevio.c.

References _mbgdevio_cnv_ret_val, _mbgdevio_gen_write, and MBGDEVIO_RET_VAL.

◆ mbg_generic_write_gps()

int mbg_generic_write_gps ( MBG_DEV_HANDLE  dh,
int  cmd,
const void *  p,
int  size 
)

Definition at line 4419 of file mbgdevio.c.

References _mbgdevio_cnv_ret_val, _mbgdevio_gen_write_gps, and MBGDEVIO_RET_VAL.

◆ mbg_get_all_irig_rx_info()

int mbg_get_all_irig_rx_info ( MBG_DEV_HANDLE  dh,
const PCPS_DEV pdev,
IRIG_INFO p_irig_info,
MBG_REF_OFFS p_ref_offs,
MBG_OPT_INFO p_opt_info 
)

Read all IRIG input configuration information from a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pdevPointer to the device's PCPS_DEV structure //### TODO Make this obsolete
[in]p_irig_infoPointer to a IRIG_SETTINGS structure to be written
[in]p_ref_offsPointer to a MBG_REF_OFFS structure to be written
[in]p_opt_infoPointer to a MBG_OPT_SETTINGS structure to be written
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_save_all_irig_rx_settings
mbg_set_irig_rx_settings
mbg_set_ref_offs
mbg_set_opt_settings

Definition at line 5099 of file mbgdevio.c.

References _pcps_has_opt_flags, _pcps_has_ref_offs, _pcps_is_irig_rx, MBG_ERR_NOT_SUPP_BY_DEV, mbg_get_irig_rx_info(), mbg_get_opt_info(), mbg_get_ref_offs(), and mbg_rc_is_success.

Referenced by do_mbgirigcfg().

◆ mbg_get_all_ptp_uc_master_info()

int mbg_get_all_ptp_uc_master_info ( MBG_DEV_HANDLE  dh,
PTP_UC_MASTER_INFO_IDX  pii[],
const PTP_UC_MASTER_CFG_LIMITS p_umsl 
)

Read PTP Unicast master settings and configuration options.

The array passed to this function to receive the returned data must be able to hold at least PTP_UC_MASTER_CFG_LIMITS::n_supp_master elements.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]piiPointer to a an array of PTP_UC_MASTER_INFO_IDX structures to be filled up.
[in]p_umslPointer to a PTP_UC_MASTER_CFG_LIMITS structure returned by mbg_get_ptp_uc_master_cfg_limits
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_ptp_unicast
mbg_get_all_ptp_cfg_info
mbg_get_ptp_uc_master_cfg_limits
mbg_set_ptp_uc_master_settings_idx
mbg_get_ptp_state

Definition at line 7527 of file mbgdevio.c.

References _mbg_swab_ptp_uc_master_info_idx, _mbgdevio_cnv_ret_val, _mbgdevio_gen_read_gps, _mbgdevio_read_gps_chk, _pcps_ddev_has_ptp_unicast, IOCTL_GET_ALL_PTP_UC_MASTER_INFO, MBG_ERR_NOT_SUPP_BY_DEV, mbg_rc_is_success, MBGDEVIO_RET_VAL, PTP_UC_MASTER_CFG_LIMITS::n_supp_master, and PC_GPS_ALL_PTP_UC_MASTER_INFO.

Referenced by mbg_get_all_ptp_cfg_info().

◆ mbg_get_asic_features()

int mbg_get_asic_features ( MBG_DEV_HANDLE  dh,
PCI_ASIC_FEATURES p 
)

Read the features of the on-board PCI/PCIe interface ASIC.

The API call mbg_chk_dev_has_asic_features checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a PCI_ASIC_FEATURES type to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_asic_features

Definition at line 6420 of file mbgdevio.c.

References _mbg_inp32_to_cpu, _mbgdevio_cnv_ret_val, _mbgdevio_read_var, _pcps_ddev_has_asic_features, _pcps_ddev_io_base_mapped, IOCTL_GET_PCI_ASIC_FEATURES, MBG_ERR_NOT_SUPP_BY_DEV, MBG_SUCCESS, and MBGDEVIO_RET_VAL.

Referenced by setup_asic_features().

◆ mbg_get_asic_version()

int mbg_get_asic_version ( MBG_DEV_HANDLE  dh,
PCI_ASIC_VERSION p 
)

Read the version code of the on-board PCI/PCIe interface ASIC.

The API call mbg_chk_dev_has_asic_version checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a PCI_ASIC_VERSION type to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_asic_version

Definition at line 6385 of file mbgdevio.c.

References _mbg_inp32_to_cpu, _mbgdevio_cnv_ret_val, _mbgdevio_read_var, _pcps_ddev_has_asic_version, _pcps_ddev_io_base_mapped, IOCTL_GET_PCI_ASIC_VERSION, MBG_ERR_NOT_SUPP_BY_DEV, MBG_SUCCESS, and MBGDEVIO_RET_VAL.

Referenced by mbg_get_show_dev_info(), and setup_device_type_name().

◆ mbg_get_corr_info()

int mbg_get_corr_info ( MBG_DEV_HANDLE  dh,
CORR_INFO p 
)

Read PZF correlation info from a device.

The API call mbg_chk_dev_has_corr_info checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a CORR_INFO structure to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_pzf
mbg_chk_dev_has_corr_info

Definition at line 7690 of file mbgdevio.c.

References _mbg_swab_corr_info, _mbgdevio_cnv_ret_val, _mbgdevio_read_var_chk, _pcps_ddev_has_corr_info, IOCTL_GET_CORR_INFO, MBGDEVIO_RET_VAL, and PCPS_GET_CORR_INFO.

Referenced by mbg_show_pzf_corr_info().

◆ mbg_get_debug_status()

int mbg_get_debug_status ( MBG_DEV_HANDLE  dh,
MBG_DEBUG_STATUS p 
)

Read a debug status word from a device.

This is mainly supported by IRIG timecode receiver cards, and the status word is intended to provide more detailed information why a card might not synchronize to the incoming timecode signal.

See MBG_DEBUG_STATUS and related definitions for details.

The API call mbg_chk_dev_has_debug_status checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a MBG_DEBUG_STATUS variable to be filled up
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_debug_status

Definition at line 7790 of file mbgdevio.c.

References _mbg_swab_debug_status, _mbgdevio_cnv_ret_val, _mbgdevio_read_var_chk, _pcps_ddev_has_debug_status, IOCTL_GET_DEBUG_STATUS, MBGDEVIO_RET_VAL, and PCPS_GET_DEBUG_STATUS.

Referenced by show_irig_debug_status().

◆ mbg_get_default_cycles_frequency()

MBG_PC_CYCLES_FREQUENCY mbg_get_default_cycles_frequency ( void  )

Retrieve the system's default cycles counter frequency.

Note
This may not be supported on all target platforms, in which case the returned frequency is 0 and the mbg_get_default_cycles_frequency_from_dev call should be used instead.
Returns
the default cycles counter frequency in Hz, or 0 if the value is not available.
See also
mbg_get_default_cycles_frequency_from_dev

Definition at line 9229 of file mbgdevio.c.

References mbg_get_pc_cycles_frequency(), and pc_cycles_frequency.

◆ mbg_get_default_cycles_frequency_from_dev()

int mbg_get_default_cycles_frequency_from_dev ( MBG_DEV_HANDLE  dh,
MBG_PC_CYCLES_FREQUENCY p 
)

Retrieve the system's default cycles counter frequency from the kernel driver.

This API call can be used on systems which don't provide this information in user space.

Parameters
[in]dhHandle of the device to which the IOCTL call is sent.
[out]pPointer of a MBG_PC_CYCLES_FREQUENCY variable to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_get_default_cycles_frequency

Definition at line 9161 of file mbgdevio.c.

References _mbgdevio_cnv_ret_val, _mbgdevio_read_var, PCPS_HR_TIME_CYCLES::cycles, IOCTL_GET_CYCLES_FREQUENCY, mbg_chk_dev_has_hr_time, mbg_delta_pc_cycles(), MBG_ERR_NOT_SUPP_ON_OS, MBG_FRAC32_UNITS_PER_SEC, mbg_get_hr_time_cycles(), mbg_rc_is_error, mbg_rc_is_success, MBGDEVIO_RET_VAL, PCPS_HR_TIME_CYCLES::t, and PCPS_HR_TIME::tstamp.

Referenced by do_mbgcmptime(), do_mbgsvctasks(), do_mbgxhrtime(), and mbg_init_pc_cycles_frequency().

◆ mbg_get_device_info()

int mbg_get_device_info ( MBG_DEV_HANDLE  dh,
PCPS_DEV p 
)

Read detailed device information.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]*pA PCPS_DEV structure to be filled up
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES

Definition at line 4242 of file mbgdevio.c.

References _mbgdevio_cnv_ret_val, _mbgdevio_read_var, PCPS_DDEV_s::dev, IOCTL_GET_PCPS_DEV, MBG_SUCCESS, and MBGDEVIO_RET_VAL.

Referenced by chk_bus_flags(), do_mbgsvctasks(), get_dev_info_for_dev_fn(), main(), mbg_chk_dev_is_pci_express(), mbg_get_show_dev_info(), and mbg_setup_receiver_info().

◆ mbg_get_drvr_info()

int mbg_get_drvr_info ( MBG_DEV_HANDLE  dh,
PCPS_DRVR_INFO p 
)

Read information about the driver handling a given device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pA PCPS_DRVR_INFO structure to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES

Definition at line 4216 of file mbgdevio.c.

References _mbgdevio_cnv_ret_val, _mbgdevio_read_var, drvr_info, IOCTL_GET_PCPS_DRVR_INFO, MBG_SUCCESS, MBGDEVIO_RET_VAL, n_ddevs, and PCPS_DRVR_INFO::n_devs.

◆ mbg_get_first_evt_log_entry()

int mbg_get_first_evt_log_entry ( MBG_DEV_HANDLE  dh,
MBG_EVT_LOG_ENTRY p 
)

Read the first (oldest) event log entry from a device.

Note
Subsequent reads should be made using mbg_get_next_evt_log_entry.

The API call mbg_chk_dev_has_evt_log checks whether this call is supported by a device.

If no (more) event log entry is available on the device then the returned MBG_EVT_LOG_ENTRY::code is MBG_EVT_ID_NONE.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a MBG_EVT_LOG_ENTRY variable to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_evt_log
mbg_clr_evt_log
mbg_get_num_evt_log_entries
mbg_get_next_evt_log_entry

Definition at line 7886 of file mbgdevio.c.

References _mbg_swab_mbg_evt_log_entry, _mbgdevio_cnv_ret_val, _mbgdevio_read_var_chk, _pcps_ddev_has_evt_log, IOCTL_GET_FIRST_EVT_LOG_ENTRY, MBGDEVIO_RET_VAL, and PCPS_FIRST_EVT_LOG_ENTRY.

◆ mbg_get_gpio_cfg_limits()

int mbg_get_gpio_cfg_limits ( MBG_DEV_HANDLE  dh,
MBG_GPIO_CFG_LIMITS p 
)

Read common GPIO configuration limits.

The API call mbg_chk_dev_has_gpio checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pA MBG_GPIO_CFG_LIMITS structure to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_gpio
mbg_get_gpio_cfg_limits
mbg_get_gps_all_gpio_info
mbg_set_gps_gpio_settings_idx
mbg_get_gps_all_gpio_status

Definition at line 8082 of file mbgdevio.c.

References _mbg_swab_mbg_gpio_cfg_limits, _mbgdevio_cnv_ret_val, _mbgdevio_read_gps_var_chk, _pcps_ddev_has_gpio, IOCTL_GET_GPIO_CFG_LIMITS, MBGDEVIO_RET_VAL, and PC_GPS_GPIO_CFG_LIMITS.

Referenced by mbg_get_all_ucap_info().

◆ mbg_get_gps_all_gnss_sat_info()

int mbg_get_gps_all_gnss_sat_info ( MBG_DEV_HANDLE  dh,
GNSS_SAT_INFO_IDX  gsii[],
const MBG_GNSS_MODE_INFO p_mi 
)

Read a GNSS_SAT_INFO_IDX array of satellite status information.

The function mbg_get_gps_gnss_mode_info must have been called before, and the returned MBG_GNSS_MODE_INFO structure be passed to this function.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]gsiiPointer to a an array of satellite info structures to be filled up.
[in]p_miPointer to a MBG_GNSS_MODE_INFO structure returned by mbg_get_gps_gnss_mode_info.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_get_gps_gnss_mode_info
mbg_set_gps_gnss_mode_settings
mbg_chk_dev_is_gnss

Definition at line 8028 of file mbgdevio.c.

References _mbg_swab_gnss_sat_info_idx, _mbgdevio_cnv_ret_val, _mbgdevio_gen_read_gps, _mbgdevio_read_gps_chk, _pcps_ddev_is_gnss, IOCTL_GET_ALL_GNSS_SAT_INFO, mbg_rc_is_success, MBGDEVIO_RET_VAL, num_bits_set(), PC_GPS_ALL_GNSS_SAT_INFO, and MBG_GNSS_MODE_INFO::supp_gnss_types.

Referenced by mbg_chk_get_all_gnss_info().

◆ mbg_get_gps_all_gpio_info()

int mbg_get_gps_all_gpio_info ( MBG_DEV_HANDLE  dh,
MBG_GPIO_INFO_IDX  gii[],
const MBG_GPIO_CFG_LIMITS p_gcl 
)

Get all GPIO settings and capabilities.

The API call mbg_chk_dev_has_gpio checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]giiAn array of MBG_GPIO_STATUS_IDX structures to be filled up.
[in]p_gclPointer to a MBG_GPIO_CFG_LIMITS structure read before.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_gpio
mbg_get_gpio_cfg_limits
mbg_get_gps_all_gpio_info
mbg_set_gps_gpio_settings_idx
mbg_get_gps_all_gpio_status

Definition at line 8115 of file mbgdevio.c.

References _mbg_swab_mbg_gpio_info_idx, _mbgdevio_cnv_ret_val, _mbgdevio_gen_read_gps, _mbgdevio_read_gps_chk, _pcps_ddev_has_gpio, IOCTL_GET_ALL_GPIO_INFO, mbg_rc_is_success, MBGDEVIO_RET_VAL, MBG_GPIO_CFG_LIMITS::num_io, and PC_GPS_ALL_GPIO_INFO.

Referenced by mbg_get_all_ucap_info().

◆ mbg_get_gps_all_gpio_status()

int mbg_get_gps_all_gpio_status ( MBG_DEV_HANDLE  dh,
MBG_GPIO_STATUS_IDX  gsi[],
const MBG_GPIO_CFG_LIMITS p_gcl 
)

◆ mbg_get_gps_all_port_info()

int mbg_get_gps_all_port_info ( MBG_DEV_HANDLE  dh,
PORT_INFO_IDX  pii[],
const RECEIVER_INFO p_ri 
)

Read a PORT_INFO_IDX array of supported serial port configurations.

A valid RECEIVER_INFO associated with the device has to be passed to this function.

Note: The function mbg_get_serial_settings should be used preferably to get retrieve the current port settings and configuration options.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]piiPointer to a an array of port configuration information to be filled up.
[in]p_riPointer to the RECEIVER_INFO associated with the device //### TODO Make this obsolete
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_get_serial_settings
mbg_get_gps_all_str_type_info
mbg_setup_receiver_info

Definition at line 6185 of file mbgdevio.c.

References _mbg_swab_port_info_idx, _mbgdevio_cnv_ret_val, _mbgdevio_gen_read_gps, _mbgdevio_read_gps_chk, _pcps_ddev_has_receiver_info, GPS_MODEL_UNKNOWN, IOCTL_GET_GPS_ALL_PORT_INFO, MBG_ERR_NOT_SUPP_BY_DEV, mbg_rc_is_success, MBGDEVIO_RET_VAL, RECEIVER_INFO::model_code, RECEIVER_INFO::n_com_ports, and PC_GPS_ALL_PORT_INFO.

Referenced by mbg_get_serial_settings().

◆ mbg_get_gps_all_pout_info()

int 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.

Read a POUT_INFO_IDX array of current settings and configuration options of the device's programmable pulse outputs.

A valid RECEIVER_INFO associated with the device has to be passed to this function.

The function should only be called if the RECEIVER_INFO::n_prg_out field (i.e. the number of programmable outputs on the board) is not 0.

The array passed to this function to receive the returned data must be able to hold at least RECEIVER_INFO::n_prg_out elements.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]piiPointer to a an array of POUT_INFO_IDX structures to be filled up
[in]p_riPointer to the RECEIVER_INFO associated with the device //### TODO Make this obsolete
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_set_gps_pout_settings_idx
mbg_set_gps_pout_settings
mbg_setup_receiver_info

Definition at line 7109 of file mbgdevio.c.

References _mbg_swab_pout_info_idx_on_get, _mbgdevio_cnv_ret_val, _mbgdevio_gen_read_gps, _mbgdevio_read_gps_chk, _pcps_ddev_has_receiver_info, GPS_MODEL_UNKNOWN, IOCTL_GET_GPS_ALL_POUT_INFO, MBG_ERR_NOT_SUPP_BY_DEV, mbg_rc_is_success, MBGDEVIO_RET_VAL, RECEIVER_INFO::model_code, RECEIVER_INFO::n_prg_out, and PC_GPS_ALL_POUT_INFO.

Referenced by check_get_pout_cfg().

◆ mbg_get_gps_all_str_type_info()

int mbg_get_gps_all_str_type_info ( MBG_DEV_HANDLE  dh,
STR_TYPE_INFO_IDX  stii[],
const RECEIVER_INFO p_ri 
)

Read a STR_TYPE_INFO_IDX array of supported string types.

A valid RECEIVER_INFO associated with the device has to be passed to this function.

Note: The function mbg_get_serial_settings should be used preferably to get retrieve the current port settings and configuration options.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]stiiPointer to a an array of string type information to be filled up.
[in]p_riPointer to the RECEIVER_INFO associated with the device //### TODO Make this obsolete
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_get_serial_settings
mbg_get_gps_all_port_info
mbg_setup_receiver_info

Definition at line 6125 of file mbgdevio.c.

References _mbg_swab_str_type_info_idx, _mbgdevio_cnv_ret_val, _mbgdevio_gen_read_gps, _mbgdevio_read_gps_chk, _pcps_ddev_has_receiver_info, GPS_MODEL_UNKNOWN, IOCTL_GET_GPS_ALL_STR_TYPE_INFO, MBG_ERR_NOT_SUPP_BY_DEV, mbg_rc_is_success, MBGDEVIO_RET_VAL, RECEIVER_INFO::model_code, RECEIVER_INFO::n_str_type, and PC_GPS_ALL_STR_TYPE_INFO.

Referenced by mbg_get_serial_settings().

◆ mbg_get_gps_all_xmr_info()

int mbg_get_gps_all_xmr_info ( MBG_DEV_HANDLE  dh,
XMULTI_REF_INFO_IDX  xmrii[],
const XMULTI_REF_INSTANCES p_xmri 
)

Read all XMR settings and capabilities.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]xmriiAn array of XMULTI_REF_INFO_IDX structures to be filled up.
[in]p_xmriPointer to a XMULTI_REF_INSTANCES structure read before.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_xmr
mbg_get_xmr_instances
mbg_get_gps_all_xmr_status
mbg_set_gps_xmr_settings_idx
mbg_get_xmr_holdover_status

Definition at line 8342 of file mbgdevio.c.

References _mbg_swab_xmulti_ref_info_idx, _mbgdevio_cnv_ret_val, _mbgdevio_gen_read_gps, _mbgdevio_read_gps_chk, _pcps_ddev_has_xmr, IOCTL_GET_ALL_XMR_INFO, mbg_rc_is_success, MBGDEVIO_RET_VAL, XMULTI_REF_INSTANCES::n_xmr_settings, and PC_GPS_ALL_XMR_INFO.

Referenced by mbg_get_all_ucap_info(), and mbg_get_all_xmulti_ref_info().

◆ mbg_get_gps_all_xmr_status()

int mbg_get_gps_all_xmr_status ( MBG_DEV_HANDLE  dh,
XMULTI_REF_STATUS_IDX  xmrsi[],
const XMULTI_REF_INSTANCES p_xmri 
)

◆ mbg_get_gps_ant_cable_len()

int mbg_get_gps_ant_cable_len ( MBG_DEV_HANDLE  dh,
ANT_CABLE_LEN p 
)

Read the configured antenna cable length from a device.

The antenna cable length parameter is used by GPS/GNSS receivers to compensate the propagation delay of the RF signal over the antenna cable, which is about 5 ns/m.

The API call mbg_chk_dev_has_cab_len checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to an ANT_CABLE_LEN structure to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_cab_len
mbg_set_gps_ant_cable_len

Definition at line 6018 of file mbgdevio.c.

References _mbg_swab_ant_cable_len, _mbgdevio_cnv_ret_val, _mbgdevio_read_gps_var_chk, _pcps_ddev_has_cab_len, IOCTL_GET_GPS_ANT_CABLE_LEN, MBGDEVIO_RET_VAL, and PC_GPS_ANT_CABLE_LEN.

Referenced by show_ant_cable_len().

◆ mbg_get_gps_ant_info()

int mbg_get_gps_ant_info ( MBG_DEV_HANDLE  dh,
ANT_INFO p 
)

Read an ANT_INFO structure to retrieve an extended GPS antenna status.

The API call mbg_chk_dev_is_gps checks whether this call is supported by a device.

Note: Normally the current antenna connection status can also be determined by evaluation of the PCPS_TIME::signal or PCPS_HR_TIME::signal fields. The "disconnected" status reported by ANT_INFO disappears only if the antenna has been reconnected and the receiver has synchronized to the GPS satellites again.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a ANT_INFO structure to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES

Definition at line 5709 of file mbgdevio.c.

References _mbg_swab_ant_info, _mbgdevio_cnv_ret_val, _mbgdevio_read_gps_var, IOCTL_GET_GPS_ANT_INFO, MBGDEVIO_RET_VAL, and PC_GPS_ANT_INFO.

◆ mbg_get_gps_bvar_stat()

int mbg_get_gps_bvar_stat ( MBG_DEV_HANDLE  dh,
BVAR_STAT p 
)

Retrieve the status of the battery buffered GPS variables.

GPS receivers require some navigational data set to be available to be able to decode position and time accurately. This data set is transmitted periodically by the satellites, so it can simply be collected if it's not available.

The BVAR_STAT type reports which parts of the data set are available in the receiver, and which are not.

If the available data set is not complete then the receiver stays in COLD BOOT mode until all data have been received and thus all data sets are valid.

The API call mbg_chk_dev_is_gps checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a BVAR_STAT structure to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_is_gps
BVAR_FLAGS

Definition at line 5551 of file mbgdevio.c.

References _mbg_swab_bvar_stat, _mbgdevio_cnv_ret_val, _mbgdevio_read_gps_var, IOCTL_GET_GPS_BVAR_STAT, MBGDEVIO_RET_VAL, and PC_GPS_BVAR_STAT.

◆ mbg_get_gps_enable_flags()

int mbg_get_gps_enable_flags ( MBG_DEV_HANDLE  dh,
ENABLE_FLAGS p 
)

Read the ENABLE_FLAGS structure controlling when outputs are to be enabled.

The ENABLE_FLAGS structure controls whether certain signal outputs are to be enabled immediately after the device's power-up, or only after the device has synchronized to its input signal.

The function mbg_chk_dev_has_gps_data can be used to check whether this call is supported by a device.

Note: Not all of the input signals specified for the ENABLE_FLAGS structure can be modified individually. See ENABLE_FLAGS_CODES.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a ENABLE_FLAGS structure to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
ENABLE_FLAGS
ENABLE_FLAGS_CODES
mbg_set_gps_enable_flags

Definition at line 5776 of file mbgdevio.c.

References _mbg_swab_enable_flags, _mbgdevio_cnv_ret_val, _mbgdevio_read_gps_var, IOCTL_GET_GPS_ENABLE_FLAGS, MBGDEVIO_RET_VAL, and PC_GPS_ENABLE_FLAGS.

Referenced by set_enable_flags(), and show_enable_flags().

◆ mbg_get_gps_gnss_mode_info()

int mbg_get_gps_gnss_mode_info ( MBG_DEV_HANDLE  dh,
MBG_GNSS_MODE_INFO p_mi 
)

Read the current GNSS mode info including current settings.

The MBG_GNSS_MODE_INFO structure tells which GNSS systems are supported by a device, and also includes the settings currently in effect.

The API call mbg_chk_dev_is_gnss can be used to check whether this call is supported by a device.

See also the notes for mbg_chk_dev_is_gnss.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]p_miPointer to a MBG_GNSS_MODE_INFO structure to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_set_gps_gnss_mode_settings
mbg_get_gps_all_gnss_sat_info
mbg_chk_dev_is_gnss

Definition at line 7956 of file mbgdevio.c.

References _mbg_swab_mbg_gnss_mode_info, _mbgdevio_cnv_ret_val, _mbgdevio_read_gps_var_chk, _pcps_ddev_is_gnss, IOCTL_GET_GNSS_MODE_INFO, MBGDEVIO_RET_VAL, and PC_GPS_GNSS_MODE.

Referenced by mbg_chk_get_all_gnss_info(), and mbg_get_gps_gnss_mode_info_chk().

◆ mbg_get_gps_port_parm()

int mbg_get_gps_port_parm ( MBG_DEV_HANDLE  dh,
PORT_PARM p 
)

Read a PORT_PARM structure with a device's serial port configuration.

Deprecated:
This function is deprecated, use mbg_get_serial_settings preferably.

The API call mbg_chk_dev_is_gps checks whether this call is supported by a device.

Note: This function is deprecated since it is only supported by a certain class of devices and can handle only up to 2 serial ports. The generic function mbg_get_serial_settings should be used instead.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a PORT_PARM structure to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_get_serial_settings
Deprecated:
This function is deprecated, use mbg_get_serial_settings preferably.

The API call mbg_chk_dev_is_gps checks whether this call is supported by a device.

Note: This function is deprecated since it is only supported by a certain class of devices and can handle only up to 2 serial ports. The generic function mbg_get_serial_settings should be used instead.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a PORT_PARM structure to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_get_serial_settings

Definition at line 5644 of file mbgdevio.c.

References _mbg_swab_port_parm, _mbgdevio_cnv_ret_val, _mbgdevio_read_gps_var, IOCTL_GET_GPS_PORT_PARM, MBGDEVIO_RET_VAL, and PC_GPS_PORT_PARM.

Referenced by mbg_get_serial_settings().

◆ mbg_get_gps_pos()

int mbg_get_gps_pos ( MBG_DEV_HANDLE  dh,
POS p 
)

Read the current geographic position from a GPS device.

The returned POS structure contains the current position in ECEF (Earth Centered, Earth Fixed) kartesian coordinates, and in geographic coordinates with different formats, using the WGS84 geographic datum.

The API call mbg_chk_dev_is_gps checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a POS structure to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_set_gps_pos_xyz
mbg_set_gps_pos_lla

Definition at line 5905 of file mbgdevio.c.

References _mbg_swab_pos, _mbgdevio_cnv_ret_val, _mbgdevio_read_gps_var, IOCTL_GET_GPS_POS, MBGDEVIO_RET_VAL, PC_GPS_POS, and swap_pos_doubles().

Referenced by show_gps_pos().

◆ mbg_get_gps_receiver_info()

int mbg_get_gps_receiver_info ( MBG_DEV_HANDLE  dh,
RECEIVER_INFO p 
)

Read the RECEIVER_INFO structure from a device.

The API call mbg_chk_dev_has_receiver_info checks whether this call is supported by a device.

Note: Applications should call mbg_setup_receiver_info preferably, which also sets up a basic RECEIVER_INFO structure for devices which don't provide that structure by themselves.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a RECEIVER_INFO structure to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_setup_receiver_info
mbg_chk_dev_has_receiver_info

Definition at line 6091 of file mbgdevio.c.

References _mbg_swab_receiver_info, _mbgdevio_cnv_ret_val, _mbgdevio_read_gps_var_chk, _pcps_ddev_has_receiver_info, IOCTL_GET_GPS_RECEIVER_INFO, MBGDEVIO_RET_VAL, and PC_GPS_RECEIVER_INFO.

Referenced by mbg_setup_receiver_info().

◆ mbg_get_gps_stat_info()

int mbg_get_gps_stat_info ( MBG_DEV_HANDLE  dh,
STAT_INFO p 
)

Read the extended GPS receiver status from a device.

The STAT_INFO structure reports the status of the GPS receiver, including mode of operation and number of visible/usable satellites.

The API call mbg_chk_dev_is_gps checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a STAT_INFO structure to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
STAT_INFO

Definition at line 5846 of file mbgdevio.c.

References _mbg_swab_stat_info, _mbgdevio_cnv_ret_val, _mbgdevio_read_gps_var, IOCTL_GET_GPS_STAT_INFO, MBGDEVIO_RET_VAL, and PC_GPS_STAT_INFO.

Referenced by mbg_chk_get_all_gnss_info().

◆ mbg_get_gps_sw_rev()

int mbg_get_gps_sw_rev ( MBG_DEV_HANDLE  dh,
SW_REV p 
)

Retrieve the software revision of a GPS receiver.

Deprecated:
This function is deprecated.

This function is deprecated, but still supported for compatibility with older GPS cards. Normally the software revision is part of the RECEIVER_INFO structure. See mbg_setup_receiver_info which takes care of the different options.

The API call mbg_chk_dev_is_gps checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a SW_REV structure to be filled up
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_setup_receiver_info
mbg_chk_dev_is_gps
Deprecated:
This function is deprecated.

This function is deprecated, but still supported for compatibility with older GPS cards. Normally the software revision is part of the RECEIVER_INFO structure. See mbg_setup_receiver_info which takes care of the different options.

The API call mbg_chk_dev_is_gps checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a SW_REV structure to be filled up
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_setup_receiver_info
mbg_chk_dev_is_gps

Definition at line 5513 of file mbgdevio.c.

References _mbg_swab_sw_rev, _mbgdevio_cnv_ret_val, _mbgdevio_read_gps_var, IOCTL_GET_GPS_SW_REV, MBGDEVIO_RET_VAL, and PC_GPS_SW_REV.

◆ mbg_get_gps_time()

int mbg_get_gps_time ( MBG_DEV_HANDLE  dh,
TTM p 
)

Read the current board time using a TTM structure.

The API call mbg_chk_dev_is_gps checks whether this call is supported by a device.

Note: This API call is pretty slow, so mbg_get_hr_time or mbg_get_fast_hr_timestamp or associated calls should be used preferably.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a TTM structure to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_get_hr_time
mbg_get_fast_hr_timestamp

Definition at line 5580 of file mbgdevio.c.

References _mbg_swab_ttm, _mbgdevio_cnv_ret_val, _mbgdevio_read_gps_var, IOCTL_GET_GPS_TIME, MBGDEVIO_RET_VAL, and PC_GPS_TIME.

Referenced by show_time_and_status().

◆ mbg_get_gps_tzdl()

int mbg_get_gps_tzdl ( MBG_DEV_HANDLE  dh,
TZDL p 
)

Read the card's time zone/daylight saving parameters.

This function returns the time zone/daylight saving parameters in a TZDL structure.

The API call mbg_chk_dev_has_tzdl checks whether this call is supported by a device.

Note: In spite of the function name this call may also be supported by non-GPS cards. Other cards may support the mbg_get_tzcode or mbg_get_pcps_tzdl calls instead.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a TZDL structure to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_tzdl
mbg_set_gps_tzdl
mbg_get_tzcode
mbg_get_pcps_tzdl
Time zone / daylight saving parameters

Definition at line 5439 of file mbgdevio.c.

References _mbg_swab_tzdl, _mbgdevio_cnv_ret_val, _mbgdevio_read_gps_var, IOCTL_GET_GPS_TZDL, MBGDEVIO_RET_VAL, and PC_GPS_TZDL.

Referenced by show_tzdl_offs().

◆ mbg_get_gps_ucap()

int mbg_get_gps_ucap ( MBG_DEV_HANDLE  dh,
TTM p 
)

Read a time capture event from the on-board FIFO buffer using a TTM structure.

The API call mbg_chk_dev_is_gps checks whether this call is supported by a device.

Note: This call is pretty slow and has been obsoleted by mbg_get_ucap_event which should be used preferably, if supported by the device. Anyway, this call is still supported for compatibility with older devices which don't support mbg_get_ucap_event.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a TTM structure to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_get_ucap_entries
mbg_get_ucap_event
mbg_clr_ucap_buff

Definition at line 5741 of file mbgdevio.c.

References _mbg_swab_ttm, _mbgdevio_cnv_ret_val, _mbgdevio_read_gps_var, IOCTL_GET_GPS_UCAP, MBGDEVIO_RET_VAL, and PC_GPS_UCAP.

Referenced by do_mbggpscap(), and mbg_get_all_ucap_info().

◆ mbg_get_ip4_settings()

int mbg_get_ip4_settings ( MBG_DEV_HANDLE  dh,
IP4_SETTINGS p 
)

Read LAN IPv4 settings from a device.

The API call mbg_chk_dev_has_lan_intf checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a IP4_SETTINGS variable to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_lan_intf
mbg_get_lan_if_info
mbg_get_ip4_state
mbg_set_ip4_settings

Definition at line 7331 of file mbgdevio.c.

References _mbg_swab_ip4_settings, _mbgdevio_cnv_ret_val, _mbgdevio_read_gps_var_chk, _pcps_ddev_has_lan_intf, IOCTL_GET_IP4_SETTINGS, MBGDEVIO_RET_VAL, and PC_GPS_IP4_SETTINGS.

Referenced by mbg_get_all_net_cfg_info(), set_lan_intf(), and show_lan_intf().

◆ mbg_get_ip4_state()

int mbg_get_ip4_state ( MBG_DEV_HANDLE  dh,
IP4_SETTINGS p 
)

Read LAN IPv4 state from a device.

The API call mbg_chk_dev_has_lan_intf checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a IP4_SETTINGS variable to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_lan_intf
mbg_get_lan_if_info
mbg_get_ip4_settings
mbg_set_ip4_settings

Definition at line 7301 of file mbgdevio.c.

References _mbg_swab_ip4_settings, _mbgdevio_cnv_ret_val, _mbgdevio_read_gps_var_chk, _pcps_ddev_has_lan_intf, IOCTL_GET_IP4_STATE, MBGDEVIO_RET_VAL, and PC_GPS_IP4_STATE.

Referenced by mbg_get_all_net_status_info(), and show_lan_intf_state().

◆ mbg_get_irig_ctrl_bits()

int 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.

This function fills an MBG_IRIG_CTRL_BITS structure with the control function bits decoded from the incoming IRIG signal.

The meaning of these bits depends on the type of IRIG code frame format.

In some IRIG formats these bits provide some well-known information which can also be evaluated by the device. For example, in IEEE 1344 or IEEE C37.118 code the control function bits are used to provide the year number, UTC offset, DST status, leap second warning, etc.

For most IRIG code formats, however, these bits are reserved, i.e. not used at all, or application defined, depending on the configuration of the IRIG generator providing the IRIG signal.

In the latter case the application has to evaluate the received control function bits and can use this function to retrieve these bits from the receiver device.

The API call mbg_chk_dev_has_irig_ctrl_bits checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a MBG_IRIG_CTRL_BITS type to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_irig_ctrl_bits

Definition at line 5202 of file mbgdevio.c.

References _mbg_swab_irig_ctrl_bits, _mbgdevio_cnv_ret_val, _mbgdevio_read_var, IOCTL_GET_IRIG_CTRL_BITS, MBGDEVIO_RET_VAL, and PCPS_GET_IRIG_CTRL_BITS.

Referenced by show_irig_ctrl_bits().

◆ mbg_get_irig_rx_info()

int mbg_get_irig_rx_info ( MBG_DEV_HANDLE  dh,
IRIG_INFO p 
)

Read the current IRIG input settings plus capabilities.

Deprecated:
Calling this function directly is deprecated. The function mbg_get_all_irig_rx_info should be used instead which also reads some other associated parameters affecting the behaviour of the IRIG input.

The API call mbg_chk_dev_is_tcr checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]*pAn IRIG_INFO structure to be filled up
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_get_all_irig_rx_info
mbg_set_irig_rx_settings
mbg_chk_dev_is_tcr
mbg_chk_dev_has_irig_tx
mbg_chk_dev_has_irig
IRIG time codes
Deprecated:
Calling this function directly is deprecated. The function mbg_get_all_irig_rx_info should be used instead which also reads some other associated parameters affecting the behaviour of the IRIG input.

The API call mbg_chk_dev_is_tcr checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]*pAn IRIG_INFO structure to be filled up
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_get_all_irig_rx_info
mbg_set_irig_rx_settings
mbg_chk_dev_is_tcr
mbg_chk_dev_has_irig_tx
mbg_chk_dev_has_irig
IRIG time codes

Definition at line 5028 of file mbgdevio.c.

References _mbg_swab_irig_info, _mbgdevio_cnv_ret_val, _mbgdevio_read_var_chk, _pcps_ddev_is_irig_rx, IOCTL_GET_PCPS_IRIG_RX_INFO, MBGDEVIO_RET_VAL, and PCPS_GET_IRIG_RX_INFO.

Referenced by do_mbgtcrcal(), mbg_get_all_irig_rx_info(), and show_signal().

◆ mbg_get_irig_time()

int 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.

Reads a PCPS_IRIG_TIME structure with the raw IRIG day-of-year number and time decoded from the latest IRIG input frame. If the configured IRIG code also contains the year number then the year number is also returned, otherwise the returned year number is 0xFF.

The API call mbg_chk_dev_has_irig_time checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a PCPS_IRIG_TIME type to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_irig_time

Definition at line 5304 of file mbgdevio.c.

References _mbg_swab_pcps_irig_time, _mbgdevio_cnv_ret_val, _mbgdevio_read_var, IOCTL_GET_IRIG_TIME, MBGDEVIO_RET_VAL, and PCPS_GIVE_IRIG_TIME.

Referenced by show_time_and_status().

◆ mbg_get_irig_tx_info()

int mbg_get_irig_tx_info ( MBG_DEV_HANDLE  dh,
IRIG_INFO p 
)

Read the current IRIG output settings plus the supported settings.

The returned IRIG_INFO structure contains the configuration of an IRIG output plus the possible settings supported by that output.

The API call mbg_chk_dev_has_irig_tx checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to an IRIG_INFO structure to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_set_irig_tx_settings
mbg_chk_dev_has_irig_tx
mbg_chk_dev_is_tcr
mbg_chk_dev_has_irig
IRIG time codes

Definition at line 6787 of file mbgdevio.c.

References _mbg_swab_irig_info, _mbgdevio_cnv_ret_val, _mbgdevio_read_var_chk, _PCPS_CMD, _pcps_ddev_has_irig_tx, _pcps_ddev_requires_irig_workaround, IOCTL_GET_PCPS_IRIG_TX_INFO, MBGDEVIO_RET_VAL, PCPS_GET_IRIG_RX_INFO, and PCPS_GET_IRIG_TX_INFO.

Referenced by do_mbgirigcfg().

◆ mbg_get_irq_stat_info()

int mbg_get_irq_stat_info ( MBG_DEV_HANDLE  dh,
PCPS_IRQ_STAT_INFO p 
)

Read a device's IRQ status information.

IRQ status information includes flags indicating whether IRQs are actually enabled, and whether IRQ support by a card is possibly unsafe due to the firmware and interface chip version.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a PCPS_IRQ_STAT_INFO variable to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
PCPS_IRQ_STAT_INFO_DEFS

Definition at line 7238 of file mbgdevio.c.

References _mbgdevio_cnv_ret_val, _mbgdevio_read_var, IOCTL_GET_IRQ_STAT_INFO, PCPS_DDEV_s::irq_stat_info, MBG_SUCCESS, and MBGDEVIO_RET_VAL.

Referenced by check_irq_unsafe().

◆ mbg_get_lan_if_info()

int mbg_get_lan_if_info ( MBG_DEV_HANDLE  dh,
LAN_IF_INFO p 
)

Read LAN interface information from a device.

The API call mbg_chk_dev_has_lan_intf checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a LAN_IF_INFO variable to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_lan_intf
mbg_get_ip4_state
mbg_get_ip4_settings
mbg_set_ip4_settings

Definition at line 7271 of file mbgdevio.c.

References _mbg_swab_lan_if_info, _mbgdevio_cnv_ret_val, _mbgdevio_read_gps_var_chk, _pcps_ddev_has_lan_intf, IOCTL_GET_LAN_IF_INFO, MBGDEVIO_RET_VAL, and PC_GPS_LAN_IF_INFO.

Referenced by mbg_get_all_net_cfg_info(), mbg_get_all_net_status_info(), and show_lan_intf_state().

◆ mbg_get_next_evt_log_entry()

int mbg_get_next_evt_log_entry ( MBG_DEV_HANDLE  dh,
MBG_EVT_LOG_ENTRY p 
)

Read the next event log entry from a device.

Note
The first read should be made using mbg_get_first_evt_log_entry to set the on-board read index to the oldest entry.

The API call mbg_chk_dev_has_evt_log checks whether this call is supported by a device.

If no (more) event log entry is available on the device then the returned MBG_EVT_LOG_ENTRY::code is MBG_EVT_ID_NONE.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a MBG_EVT_LOG_ENTRY variable to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_evt_log
mbg_clr_evt_log
mbg_get_num_evt_log_entries
mbg_get_first_evt_log_entry

Definition at line 7922 of file mbgdevio.c.

References _mbg_swab_mbg_evt_log_entry, _mbgdevio_cnv_ret_val, _mbgdevio_read_var_chk, _pcps_ddev_has_evt_log, IOCTL_GET_NEXT_EVT_LOG_ENTRY, MBGDEVIO_RET_VAL, and PCPS_NEXT_EVT_LOG_ENTRY.

◆ mbg_get_num_evt_log_entries()

int mbg_get_num_evt_log_entries ( MBG_DEV_HANDLE  dh,
MBG_NUM_EVT_LOG_ENTRIES p 
)

Read details about a device's on-board event log buffer.

The returned MBG_NUM_EVT_LOG_ENTRIES structure tells how many event log entries can be saved on the board, and how many entries actually have been saved.

The API call mbg_chk_dev_has_evt_log checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a MBG_NUM_EVT_LOG_ENTRIES variable to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_evt_log
mbg_clr_evt_log
mbg_get_first_evt_log_entry
mbg_get_next_evt_log_entry

Definition at line 7851 of file mbgdevio.c.

References _mbg_swab_mbg_num_evt_log_entries, _mbgdevio_cnv_ret_val, _mbgdevio_read_var_chk, _pcps_ddev_has_evt_log, IOCTL_GET_NUM_EVT_LOG_ENTRIES, MBGDEVIO_RET_VAL, and PCPS_NUM_EVT_LOG_ENTRIES.

◆ mbg_get_opt_info()

int mbg_get_opt_info ( MBG_DEV_HANDLE  dh,
MBG_OPT_INFO p 
)

Read a MBG_OPT_INFO structure containing optional settings, controlled by flags.

The MBG_OPT_INFO structure contains a mask of supported flags plus the current settings of those flags.

The API call mbg_chk_dev_has_opt_flags checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a MBG_OPT_INFO structure to be filled up
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_opt_flags
mbg_set_opt_settings

Definition at line 4958 of file mbgdevio.c.

References _mbg_swab_mbg_opt_info, _mbgdevio_cnv_ret_val, _mbgdevio_read_var_chk, _pcps_ddev_has_opt_flags, IOCTL_GET_MBG_OPT_INFO, MBGDEVIO_RET_VAL, and PCPS_GET_OPT_INFO.

Referenced by mbg_get_all_irig_rx_info().

◆ mbg_get_pcps_tzdl()

int mbg_get_pcps_tzdl ( MBG_DEV_HANDLE  dh,
PCPS_TZDL p 
)

Read time zone/daylight saving parameters from a device.

This function fills up a PCPS_TZDL structure which supports a more detailed configuration of time zone and daylight saving than the TZCODE structure.

The API call mbg_chk_dev_has_pcps_tzdl checks whether this call is supported by a device.

Other devices may support the mbg_get_tzcode or mbg_get_gps_tzdl calls instead.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a PCPS_TZDL structure to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_pcps_tzdl
mbg_set_pcps_tzdl
mbg_get_tzcode
mbg_get_gps_tzdl

Definition at line 4823 of file mbgdevio.c.

References _mbg_swab_pcps_tzdl, _mbgdevio_cnv_ret_val, _mbgdevio_read_var_chk, _pcps_ddev_has_pcps_tzdl, IOCTL_GET_PCPS_TZDL, MBGDEVIO_RET_VAL, and PCPS_GET_PCPS_TZDL.

◆ mbg_get_process_affinity()

int mbg_get_process_affinity ( pid_t  pid,
int *  p 
)

Read the CPU affinity of a process.

This means on which of the available CPUs or CPU cores a process may be executed.

Parameters
[in]pidThe process ID.
[out]pPointer to a MBG_CPU_SET variable which contains a mask of CPUs.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_set_process_affinity
mbg_set_current_process_affinity_to_cpu

◆ mbg_get_ptp_cfg_info()

int mbg_get_ptp_cfg_info ( MBG_DEV_HANDLE  dh,
PTP_CFG_INFO p 
)

Read PTP/IEEE1588 config info and current settings from a device.

The API call mbg_chk_dev_has_ptp checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a PTP_CFG_INFO variable to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_ptp
mbg_get_all_ptp_cfg_info
mbg_get_ptp_state
mbg_set_ptp_cfg_settings
mbg_chk_dev_has_ptp_unicast

Definition at line 7427 of file mbgdevio.c.

References _mbg_swab_ptp_cfg_info, _mbgdevio_cnv_ret_val, _mbgdevio_read_gps_var_chk, _pcps_ddev_has_ptp, IOCTL_GET_PTP_CFG_INFO, MBGDEVIO_RET_VAL, and PC_GPS_PTP_CFG.

Referenced by mbg_get_all_ptp_cfg_info(), and show_ptp_state().

◆ mbg_get_ptp_state()

int mbg_get_ptp_state ( MBG_DEV_HANDLE  dh,
PTP_STATE p 
)

Read PTP/IEEE1588 status from a device.

The API call mbg_chk_dev_has_ptp checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a PTP_STATE variable to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_ptp
mbg_get_all_ptp_cfg_info
mbg_get_ptp_cfg_info
mbg_set_ptp_cfg_settings
mbg_chk_dev_has_ptp_unicast

Definition at line 7396 of file mbgdevio.c.

References _mbg_swab_ptp_state, _mbgdevio_cnv_ret_val, _mbgdevio_read_gps_var_chk, _pcps_ddev_has_ptp, IOCTL_GET_PTP_STATE, MBGDEVIO_RET_VAL, and PC_GPS_PTP_STATE.

Referenced by show_ptp_state().

◆ mbg_get_ptp_uc_master_cfg_limits()

int mbg_get_ptp_uc_master_cfg_limits ( MBG_DEV_HANDLE  dh,
PTP_UC_MASTER_CFG_LIMITS p 
)

Read PTP/IEEE1588 unicast master configuration limits from a device.

The API call mbg_chk_dev_has_ptp_unicast checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a PTP_UC_MASTER_CFG_LIMITS variable to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_ptp_unicast
mbg_get_all_ptp_cfg_info
mbg_get_all_ptp_uc_master_info
mbg_set_ptp_uc_master_settings_idx
mbg_get_ptp_state

Definition at line 7494 of file mbgdevio.c.

References _mbg_swab_ptp_uc_master_cfg_limits, _mbgdevio_cnv_ret_val, _mbgdevio_read_gps_var_chk, _pcps_has_ri_ptp_unicast, _ri_addr, IOCTL_PTP_UC_MASTER_CFG_LIMITS, MBGDEVIO_RET_VAL, and PC_GPS_PTP_UC_MASTER_CFG_LIMITS.

Referenced by mbg_get_all_ptp_cfg_info().

◆ mbg_get_raw_irig_data()

int mbg_get_raw_irig_data ( MBG_DEV_HANDLE  dh,
MBG_RAW_IRIG_DATA p 
)

Read raw IRIG data from an IRIG receiver.

This function reads an MBG_RAW_IRIG_DATA structure with the raw data bits received from the incoming IRIG signal. This enables an application itself to decode the information provided by the IRIG signal.

The API call mbg_chk_dev_has_raw_irig_data checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a MBG_RAW_IRIG_DATA type to be filled up
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_raw_irig_data
mbg_get_raw_irig_data_on_sec_change

Definition at line 5233 of file mbgdevio.c.

References _mbgdevio_cnv_ret_val, _mbgdevio_read_var, IOCTL_GET_RAW_IRIG_DATA, MBGDEVIO_RET_VAL, and PCPS_GET_RAW_IRIG_DATA.

Referenced by mbg_get_raw_irig_data_on_sec_change(), and show_raw_irig_data().

◆ mbg_get_raw_irig_data_on_sec_change()

int mbg_get_raw_irig_data_on_sec_change ( MBG_DEV_HANDLE  dh,
MBG_RAW_IRIG_DATA p 
)

Wait for second changeover then read raw IRIG data from an IRIG receiver.

This function waits until the second of the device's on-board time rolls over, and then reads the last recent raw IRIG data from the device.

The API call mbg_chk_dev_has_raw_irig_data checks whether this call is supported by a device.

Note: The mbg_get_time_sec_change function called by this function is supported under Windows only, so this function can also be used under Windows only.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a MBG_RAW_IRIG_DATA type to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_raw_irig_data
mbg_get_raw_irig_data
mbg_get_time_sec_change

Definition at line 5268 of file mbgdevio.c.

References _mbgdevio_cnv_ret_val, mbg_get_raw_irig_data(), mbg_get_time_sec_change(), mbg_rc_is_success, and MBGDEVIO_RET_VAL.

◆ mbg_get_ref_offs()

int mbg_get_ref_offs ( MBG_DEV_HANDLE  dh,
MBG_REF_OFFS p 
)

Read the UTC offset configuration of the reference time from a device.

This parameter is used to specify the UTC offset of an incoming reference time signal if a kind of time signal e.g. an IRIG input signal) does not provide this information.

The API call mbg_chk_dev_has_ref_offs checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a MBG_REF_OFFS value to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_ref_offs
mbg_set_ref_offs

Definition at line 4893 of file mbgdevio.c.

References _mbg_swab_mbg_ref_offs, _mbgdevio_cnv_ret_val, _mbgdevio_read_var_chk, _pcps_ddev_has_ref_offs, IOCTL_GET_REF_OFFS, MBGDEVIO_RET_VAL, and PCPS_GET_REF_OFFS.

Referenced by mbg_get_all_irig_rx_info(), show_signal(), and show_time_and_status().

◆ mbg_get_serial()

int mbg_get_serial ( MBG_DEV_HANDLE  dh,
PCPS_SERIAL p 
)

Read the serial port configuration from an old type of device.

Deprecated:
Direct usage of this function is deprecated. The generic API function mbg_get_serial_settings should be used instead which fully supports the capabilities of current devices.

The macro _pcps_has_serial checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a PCPS_SERIAL structure to be filled up
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_get_serial_settings
Deprecated:
Direct usage of this function is deprecated. The generic API function mbg_get_serial_settings should be used instead which fully supports the capabilities of current devices.

The macro _pcps_has_serial checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a PCPS_SERIAL structure to be filled up
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_get_serial_settings

Definition at line 4687 of file mbgdevio.c.

References _mbgdevio_cnv_ret_val, _mbgdevio_read_var, IOCTL_GET_PCPS_SERIAL, MBGDEVIO_RET_VAL, and PCPS_GET_SERIAL.

Referenced by mbg_get_serial_settings().

◆ mbg_get_status_port()

int mbg_get_status_port ( MBG_DEV_HANDLE  dh,
PCPS_STATUS_PORT p 
)

Read the current state of the on-board PCPS_STATUS_PORT.

This function is useful to read the device's status port which also includes the PCPS_ST_MOD bit reflecting the time code modulation of long wave receivers.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pA PCPS_STATUS_PORT value to be filled up
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
bitmask //### TODO check syntax

Definition at line 4273 of file mbgdevio.c.

References _mbgdevio_cnv_ret_val, _mbgdevio_read_var, _pcps_ddev_read_status_port(), IOCTL_GET_PCPS_STATUS_PORT, MBG_SUCCESS, and MBGDEVIO_RET_VAL.

Referenced by show_modulation().

◆ mbg_get_sync_time()

int mbg_get_sync_time ( MBG_DEV_HANDLE  dh,
PCPS_TIME p 
)

Read the time when the device has last recently synchronized.

Fills a PCPS_TIME structure with the date/time/status reporting when the device was synchronized the last time to its time source, e.g. the DCF77 signal, the GPS satellites, or similar.

The macro _pcps_has_sync_time checks whether this call is supported by a device.

Note: If that information is not available on the board then the value of the returned PCPS_TIME::sec field is set to 0xFF. The macro _pcps_time_is_read can be used to check whether the returned information is valid, or "not set".

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a PCPS_TIME structure to be filled up
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_get_time

Fills a PCPS_TIME structure with the date/time/status reporting when the device was synchronized the last time to its time source, e.g. the DCF77 signal, the GPS satellites, or similar.

The macro _pcps_has_sync_time checks whether this call is supported by a device.

Note: If that information is not available on the board then the value of the returned PCPS_TIME::sec field is set to 0xFF. The macro _pcps_time_is_read can be used to check whether the returned information is valid, or "not set".

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a PCPS_TIME structure to be filled up
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_get_time

Definition at line 4555 of file mbgdevio.c.

References _mbgdevio_cnv_ret_val, _mbgdevio_read_var_chk, _pcps_ddev_has_sync_time, IOCTL_GET_PCPS_SYNC_TIME, MBGDEVIO_RET_VAL, and PCPS_GIVE_SYNC_TIME.

Referenced by show_sync_time().

◆ mbg_get_synth()

int mbg_get_synth ( MBG_DEV_HANDLE  dh,
SYNTH p 
)

Read the current frequency synthesizer settings from a device.

Read a SYNTH structure containing the configuration of an optional on-board programmable frequency synthesizer.

The API call mbg_chk_dev_has_synth checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a SYNTH structure to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_synth
mbg_set_synth
mbg_get_synth_state
Synthesizer parameters

Definition at line 6889 of file mbgdevio.c.

References _mbg_swab_synth, _mbgdevio_cnv_ret_val, _mbgdevio_read_var_chk, _pcps_ddev_has_synth, IOCTL_GET_SYNTH, MBGDEVIO_RET_VAL, and PCPS_GET_SYNTH.

Referenced by show_synth().

◆ mbg_get_synth_state()

int mbg_get_synth_state ( MBG_DEV_HANDLE  dh,
SYNTH_STATE p 
)

Read the current status of the on-board frequency synthesizer.

The API call mbg_chk_dev_has_synth checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a SYNTH_STATE structure to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_synth
mbg_get_synth
mbg_set_synth
Synthesizer parameters

Definition at line 6954 of file mbgdevio.c.

References _mbg_swab_synth_state, _mbgdevio_cnv_ret_val, _mbgdevio_read_var_chk, _pcps_ddev_has_synth, IOCTL_GET_SYNTH_STATE, MBGDEVIO_RET_VAL, and PCPS_GET_SYNTH_STATE.

◆ mbg_get_time_info_hrt()

int mbg_get_time_info_hrt ( MBG_DEV_HANDLE  dh,
MBG_TIME_INFO_HRT p 
)

Read both system time and associated device time from the kernel driver.

The kernel driver reads the current system time plus a HR time structure from a card immediately after each other. The returned info structure also contains some cycles counts to be able to determine the execution times required to read those time stamps.

The advantage of this call compared to mbg_get_time_info_tstamp is that this call also returns the card's status. On the other hand, reading the HR time from the card may block e.g. if another application accesses the board.

This call makes a mbg_get_hr_time_cycles call internally so the API call mbg_chk_dev_has_hr_time can be used to check whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a MBG_TIME_INFO_HRT structure to be filled up
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_hr_time
mbg_get_time_info_tstamp

Definition at line 7626 of file mbgdevio.c.

References _mbg_swab_mbg_time_info_hrt, _mbgdevio_cnv_ret_val, _mbgdevio_read_var_chk, _pcps_ddev_has_hr_time, IOCTL_GET_TIME_INFO_HRT, MBG_ERR_NOT_SUPP_ON_OS, and MBGDEVIO_RET_VAL.

Referenced by mbg_chk_time_info().

◆ mbg_get_time_info_tstamp()

int mbg_get_time_info_tstamp ( MBG_DEV_HANDLE  dh,
MBG_TIME_INFO_TSTAMP p 
)

Read both system time and associated device timestamp from the kernel driver.

This call is similar to mbg_get_time_info_hrt except that a mbg_get_fast_hr_timestamp_cycles call is made internally, so the API call mbg_chk_dev_has_fast_hr_timestamp can be used to check whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a MBG_TIME_INFO_TSTAMP structure to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_fast_hr_timestamp
mbg_get_time_info_hrt

Definition at line 7659 of file mbgdevio.c.

References _mbg_swab_mbg_time_info_tstamp, _mbgdevio_cnv_ret_val, _mbgdevio_read_var_chk, _pcps_ddev_has_fast_hr_timestamp, IOCTL_GET_TIME_INFO_TSTAMP, MBG_ERR_NOT_SUPP_ON_OS, and MBGDEVIO_RET_VAL.

Referenced by mbg_chk_time_info().

◆ mbg_get_time_scale_info()

int 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.

The MBG_TIME_SCALE_INFO structure tells which time scale settings are supported by a device, and which time scale is currently configured.

The API call mbg_chk_dev_has_time_scale checks whether this call is supported by a device.

See also the notes for mbg_chk_dev_has_time_scale.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a MBG_TIME_SCALE_INFO structure to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_set_time_scale_settings
mbg_chk_dev_has_time_scale

Definition at line 6466 of file mbgdevio.c.

References _mbg_swab_mbg_time_scale_info, _mbgdevio_cnv_ret_val, _mbgdevio_read_gps_var_chk, _pcps_ddev_has_time_scale, IOCTL_GET_GPS_TIME_SCALE_INFO, MBGDEVIO_RET_VAL, and PC_GPS_TIME_SCALE.

Referenced by get_n_time_scale(), set_time_scale(), and show_time_scale().

◆ mbg_get_tr_distance()

int mbg_get_tr_distance ( MBG_DEV_HANDLE  dh,
TR_DISTANCE p 
)

Read configurable "distance from transmitter" parameter from a device.

The distance from transmitter parameter is used to compensate the RF propagation delay, mostly with long wave receivers.

The API call mbg_chk_dev_has_tr_distance checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a TR_DISTANCE variable to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_pzf
mbg_chk_dev_has_tr_distance
mbg_set_tr_distance

Definition at line 7722 of file mbgdevio.c.

References _mbg_swab_tr_distance, _mbgdevio_cnv_ret_val, _mbgdevio_read_var_chk, _pcps_ddev_has_tr_distance, IOCTL_GET_TR_DISTANCE, MBGDEVIO_RET_VAL, and PCPS_GET_TR_DISTANCE.

◆ mbg_get_tzcode()

int mbg_get_tzcode ( MBG_DEV_HANDLE  dh,
PCPS_TZCODE p 
)

Read time zone/daylight saving configuration code from a device.

The APIs using TZCODE are only supported by some simpler cards and allow just a very basic configuration.

The API call mbg_chk_dev_has_tzcode checks whether this call is supported by a device.

Other devices may support the mbg_get_pcps_tzdl or mbg_get_gps_tzdl calls instead which allow for a more detailed configuration of the time zone and daylight saving settings.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a PCPS_TZCODE structure to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_tzcode
mbg_set_tzcode
mbg_get_pcps_tzdl
mbg_get_gps_tzdl

Definition at line 4751 of file mbgdevio.c.

References _mbgdevio_cnv_ret_val, _mbgdevio_read_var_chk, _pcps_ddev_has_tzcode, IOCTL_GET_PCPS_TZCODE, MBGDEVIO_RET_VAL, and PCPS_GET_TZCODE.

◆ mbg_get_ucap_entries()

int mbg_get_ucap_entries ( MBG_DEV_HANDLE  dh,
PCPS_UCAP_ENTRIES p 
)

Read information on a device's event capture buffer.

Reads a PCPS_UCAP_ENTRIES structure with the number of user capture events actually stored in the FIFO buffer, and the maximum number of events that can be held by the buffer.

The API call mbg_chk_dev_has_ucap checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a PCPS_UCAP_ENTRIES structure to be filled up
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_ucap
mbg_get_ucap_entries
mbg_get_ucap_event

Definition at line 5362 of file mbgdevio.c.

References _mbg_swab_pcps_ucap_entries, _mbgdevio_cnv_ret_val, _mbgdevio_read_var_chk, _pcps_ddev_has_ucap, IOCTL_GET_PCPS_UCAP_ENTRIES, MBGDEVIO_RET_VAL, and PCPS_GIVE_UCAP_ENTRIES.

Referenced by do_mbggpscap().

◆ mbg_get_ucap_event()

int mbg_get_ucap_event ( MBG_DEV_HANDLE  dh,
PCPS_HR_TIME p 
)

Retrieve a single time capture event from the on-board FIFO buffer.

The capture event is returned in a PCPS_HR_TIME structure. The oldest entry in the FIFO is retrieved and then removed from the FIFO.

If no capture event is available in the FIFO buffer then both the seconds and the fractions of the returned timestamp are 0.

The API call mbg_chk_dev_has_ucap checks whether this call is supported by a device.

Note: This call is very much faster than the older mbg_get_gps_ucap call which is obsolete but still supported for compatibility with older cards.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a PCPS_HR_TIME structure to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_ucap
mbg_get_ucap_entries
mbg_clr_ucap_buff

Definition at line 5401 of file mbgdevio.c.

References _mbg_swab_pcps_hr_time, _mbgdevio_cnv_ret_val, _mbgdevio_read_var_chk, _pcps_ddev_has_ucap, IOCTL_GET_PCPS_UCAP_EVENT, MBGDEVIO_RET_VAL, and PCPS_GIVE_UCAP_EVENT.

Referenced by do_mbggpscap().

◆ mbg_get_utc_parm()

int mbg_get_utc_parm ( MBG_DEV_HANDLE  dh,
UTC p 
)

Read a UTC parameter structure from a device.

The API call mbg_chk_dev_has_utc_parm checks whether this call is supported by a device.

See also the notes for mbg_chk_dev_has_utc_parm.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a UTC structure to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_utc_parm
mbg_set_utc_parm

Definition at line 6536 of file mbgdevio.c.

References _mbg_swab_utc_parm, _mbgdevio_cnv_ret_val, _mbgdevio_read_gps_var_chk, _pcps_ddev_has_utc_parm, UTC::A0, UTC::A1, IOCTL_GET_GPS_UTC_PARM, MBGDEVIO_RET_VAL, PC_GPS_UTC, and swap_double().

Referenced by show_utc_info().

◆ mbg_get_xmr_holdover_status()

int mbg_get_xmr_holdover_status ( MBG_DEV_HANDLE  dh,
XMR_HOLDOVER_STATUS p,
const XMULTI_REF_INSTANCES p_xmri 
)

Read the current XMR holdover interval from a device.

The API call mbg_chk_dev_has_xmr checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a XMR_HOLDOVER_INTV structure to be filled up.
[in]p_xmriPointer to a XMULTI_REF_INSTANCES structure read before.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_xmr
mbg_get_xmr_instances
mbg_get_gps_all_xmr_status
mbg_get_gps_all_xmr_info
mbg_set_gps_xmr_settings_idx

Definition at line 8436 of file mbgdevio.c.

References _mbg_swab_xmr_holdover_status, _mbgdevio_cnv_ret_val, _mbgdevio_read_gps_var_chk, _pcps_ddev_has_xmr, XMULTI_REF_INSTANCES::flags, IOCTL_GET_XMR_HOLDOVER_STATUS, MBG_ERR_NOT_SUPP_BY_DEV, MBGDEVIO_RET_VAL, PC_GPS_XMR_HOLDOVER_STATUS, and XMRIF_MSK_HOLDOVER_STATUS_SUPP.

Referenced by mbg_get_all_ucap_info().

◆ mbg_get_xmr_instances()

◆ mbg_init_pc_cycles_frequency()

static __mbg_inline void mbg_init_pc_cycles_frequency ( MBG_DEV_HANDLE  dh,
MBG_PC_CYCLES_FREQUENCY p 
)
static

◆ mbg_save_all_irig_rx_settings()

int mbg_save_all_irig_rx_settings ( MBG_DEV_HANDLE  dh,
const PCPS_DEV pdev,
const IRIG_SETTINGS p_irig_settings,
const MBG_REF_OFFS p_ref_offs,
const MBG_OPT_SETTINGS p_opt_settings 
)

Write all IRIG input configuration settings to a device.

The API call mbg_chk_dev_is_tcr checks whether this call is supported by a device. mbg_get_all_irig_rx_info should be called before to determine the possible settings supported by the IRIG input.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pdevPointer to the device's PCPS_DEV structure //### TODO Make this obsolete
[out]p_irig_settingsPointer to a IRIG_SETTINGS structure to be written
[out]p_ref_offsPointer to a MBG_REF_OFFS structure to be written
[out]p_opt_settingsPointer to a MBG_OPT_SETTINGS structure to be written
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_get_all_irig_rx_info
mbg_set_irig_rx_settings
mbg_set_ref_offs
mbg_set_opt_settings

Definition at line 5146 of file mbgdevio.c.

References _pcps_has_opt_flags, _pcps_has_ref_offs, _pcps_is_irig_rx, MBG_ERR_NOT_SUPP_BY_DEV, mbg_rc_is_success, mbg_set_irig_rx_settings(), mbg_set_opt_settings(), and mbg_set_ref_offs().

Referenced by do_mbgirigcfg().

◆ mbg_set_current_process_affinity_to_cpu()

int mbg_set_current_process_affinity_to_cpu ( int  cpu_num)

Set the CPU affinity of a process for a single CPU only.

This means the process may only be executed on that single CPU.

Parameters
[in]cpu_numThe number of the CPU.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_get_process_affinity
mbg_set_process_affinity

Definition at line 8552 of file mbgdevio.c.

References _MBG_API, _MBG_API_ATTR, _mbg_cpu_clear, _mbg_cpu_set, _mbg_crit_sect_destroy, _mbg_crit_sect_enter, _mbg_crit_sect_init, _mbg_crit_sect_leave, _mbg_get_current_process, _mbg_thread_exit, MBG_XHRT_INFO::crit_sect, PCPS_HR_TIME_CYCLES::cycles, MBG_XHRT_INFO::dh, FILETIME, MBG_XHRT_INFO::freq_hz, MBG_XHRT_VARS::htc, MBG_XHRT_INFO::ioctl_status, mbg_chk_dev_has_hr_time, mbg_chk_tstamp64_leap_sec(), MBG_CPU_SET, mbg_delta_pc_cycles(), MBG_ERR_INTR, MBG_ERR_NOT_SUPP_ON_OS, MBG_FRAC32_UNITS_PER_SEC, mbg_get_hr_time_cycles(), mbg_get_last_error(), mbg_get_pc_cycles(), mbg_get_xhrt_cycles_frequency(), mbg_get_xhrt_time_as_filetime(), mbg_get_xhrt_time_as_pcps_hr_time(), mbg_rc_is_error, mbg_rc_is_success, mbg_set_process_affinity(), MBG_SUCCESS, mbg_thread_create(), MBG_THREAD_FNC_RET_VAL, mbg_thread_set_affinity(), mbg_thread_sleep_interruptible(), mbg_thread_stop(), mbg_xhrt_poll_thread_create(), mbg_xhrt_poll_thread_stop(), MBG_XHRT_VARS::pcps_hr_tstamp64, PCPS_LS_ENB, MBG_XHRT_INFO::prv_vars, PCPS_HR_TIME::signal, MBG_XHRT_INFO::sleep_ms, PCPS_HR_TIME::status, PCPS_HR_TIME_CYCLES::t, MBG_THREAD_INFO::thread_id, MBG_POLL_THREAD_INFO::ti, PCPS_HR_TIME::tstamp, PCPS_HR_TIME::utc_offs, MBG_XHRT_INFO::vars, and MBG_POLL_THREAD_INFO::xhrt_info.

◆ mbg_set_event_time()

◆ mbg_set_gps_ant_cable_len()

int 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.

The antenna cable length parameter is used by GPS/GNSS receivers to compensate the propagation delay of the RF signal over the antenna cable, which is about 5 ns/m.

The API call mbg_chk_dev_has_cab_len checks whether this call is supported by a device.

Note
Different devices may accept different maximum values, so the written value should be re-read using mbg_get_gps_ant_cable_len to check if the parameter has been accepted.
Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to an ANT_CABLE_LEN structure to be written.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_cab_len
mbg_get_gps_ant_cable_len

Definition at line 6054 of file mbgdevio.c.

References _mbg_swab_ant_cable_len, _mbgdevio_cnv_ret_val, _mbgdevio_write_gps_var_chk, _pcps_ddev_has_cab_len, IOCTL_SET_GPS_ANT_CABLE_LEN, MBGDEVIO_RET_VAL, and PC_GPS_ANT_CABLE_LEN.

Referenced by set_ant_cable_len().

◆ mbg_set_gps_cmd()

int mbg_set_gps_cmd ( MBG_DEV_HANDLE  dh,
const GPS_CMD p 
)

Send one of the PC_GPS_COMMANDS to a GPS receiver device.

The API call mbg_chk_dev_is_gps checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPointer to a GPS_CMD
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
PC_GPS_COMMANDS

Definition at line 5871 of file mbgdevio.c.

References _mbg_swab_gps_cmd, _mbgdevio_cnv_ret_val, _mbgdevio_write_gps_var, IOCTL_SET_GPS_CMD, MBGDEVIO_RET_VAL, and PC_GPS_CMD.

Referenced by send_gps_cmd().

◆ mbg_set_gps_enable_flags()

int 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.

The ENABLE_FLAGS structure controls whether certain signal outputs are to be enabled immediately after the device's power-up, or only after the device has synchronized to its input signal.

The function mbg_chk_dev_has_gps_data can be used to check whether this call is supported by a device.

Note: Not all of the input signals specified for the ENABLE_FLAGS structure can be modified individually. See ENABLE_FLAGS_CODES.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPointer to a ENABLE_FLAGS structure to be written.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
ENABLE_FLAGS
ENABLE_FLAGS_CODES
mbg_get_gps_enable_flags

Definition at line 5812 of file mbgdevio.c.

References _mbg_swab_enable_flags, _mbgdevio_cnv_ret_val, _mbgdevio_write_gps_var, IOCTL_SET_GPS_ENABLE_FLAGS, MBGDEVIO_RET_VAL, and PC_GPS_ENABLE_FLAGS.

Referenced by set_enable_flags().

◆ mbg_set_gps_gnss_mode_settings()

int mbg_set_gps_gnss_mode_settings ( MBG_DEV_HANDLE  dh,
const MBG_GNSS_MODE_SETTINGS p_ms 
)

Write the GNSS mode configuration to a device.

The MBG_GNSS_MODE_SETTINGS structure determines the GNSS settings for a device, e.g. which satellite systems have to be used.

The function mbg_get_gps_gnss_mode_info should have been called before to determine which GNSS settings are supported by the device.

The API call mbg_chk_dev_is_gnss can be used to check whether this call is supported by a device.

See also the notes for mbg_chk_dev_is_gnss.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]p_msPointer to a MBG_GNSS_MODE_SETTINGS structure to be written.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_get_gps_gnss_mode_info
mbg_get_gps_all_gnss_sat_info
mbg_chk_dev_is_gnss

Definition at line 7993 of file mbgdevio.c.

References _mbg_swab_mbg_gnss_mode_settings, _mbgdevio_cnv_ret_val, _mbgdevio_write_gps_var_chk, _pcps_ddev_is_gnss, IOCTL_SET_GNSS_MODE_SETTINGS, MBGDEVIO_RET_VAL, and PC_GPS_GNSS_MODE.

◆ mbg_set_gps_gpio_settings_idx()

int mbg_set_gps_gpio_settings_idx ( MBG_DEV_HANDLE  dh,
const MBG_GPIO_SETTINGS_IDX p 
)

Write the configuration for a single GPIO port to a device.

The MBG_GPIO_SETTINGS_IDX structure contains both the MBG_GPIO_SETTINGS and the port index value.

The API call mbg_chk_dev_has_gpio checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a MBG_GPIO_SETTINGS_IDX structure to be written.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_gpio
mbg_get_gpio_cfg_limits
mbg_get_gps_all_gpio_info
mbg_set_gps_gpio_settings_idx
mbg_get_gps_all_gpio_status

Definition at line 8172 of file mbgdevio.c.

References _mbg_swab_mbg_gpio_settings_idx, _mbgdevio_cnv_ret_val, _mbgdevio_write_gps_var_chk, _pcps_ddev_has_gpio, IOCTL_SET_GPIO_SETTINGS_IDX, MBGDEVIO_RET_VAL, and PC_GPS_GPIO_SETTINGS_IDX.

Referenced by mbg_get_all_ucap_info().

◆ mbg_set_gps_port_parm()

int mbg_set_gps_port_parm ( MBG_DEV_HANDLE  dh,
const PORT_PARM p 
)

Write a PORT_PARM structure to configure the on-board serial ports.

Deprecated:
This function is deprecated, use mbg_save_serial_settings preferably.

The API call mbg_chk_dev_is_gps checks whether this call is supported by a device.

Note: This function is deprecated since it is only supported by a certain class of devices and can handle only up to 2 ports. The generic function mbg_save_serial_settings should be used instead.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPointer to a PORT_PARM structure to be written.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_save_serial_settings
Deprecated:
This function is deprecated, use mbg_save_serial_settings preferably.

The API call mbg_chk_dev_is_gps checks whether this call is supported by a device.

Note: This function is deprecated since it is only supported by a certain class of devices and can handle only up to 2 ports. The generic function mbg_save_serial_settings should be used instead.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPointer to a PORT_PARM structure to be written.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_save_serial_settings

Definition at line 5676 of file mbgdevio.c.

References _mbg_swab_port_parm, _mbgdevio_cnv_ret_val, _mbgdevio_write_gps_var, IOCTL_SET_GPS_PORT_PARM, MBGDEVIO_RET_VAL, and PC_GPS_PORT_PARM.

Referenced by mbg_save_serial_settings().

◆ mbg_set_gps_port_settings()

int mbg_set_gps_port_settings ( MBG_DEV_HANDLE  dh,
const PORT_SETTINGS p,
int  idx 
)

Write the configuration for a single serial port to a device.

The PORT_SETTINGS structure does not contain the port index, so the the port index must be given separately. Except for the parameter types this call is equivalent to mbg_set_gps_port_settings_idx.

The API call mbg_chk_dev_has_receiver_info checks whether this call is supported by a device.

Note: The function mbg_save_serial_settings should be used preferably to write new port configuration to the board.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPointer to a PORT_SETTINGS structure to be written.
[in]idxIndex of the serial port to be configured (starting from 0).
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_save_serial_settings
mbg_set_gps_port_settings_idx
mbg_chk_dev_has_receiver_info

Definition at line 6290 of file mbgdevio.c.

References _mbg_swab_port_settings_idx, PORT_SETTINGS_IDX::idx, mbg_set_gps_port_settings_idx(), and PORT_SETTINGS_IDX::port_settings.

Referenced by mbg_save_serial_settings().

◆ mbg_set_gps_port_settings_idx()

int mbg_set_gps_port_settings_idx ( MBG_DEV_HANDLE  dh,
const PORT_SETTINGS_IDX p 
)

Write the configuration for a single serial port to a device.

The PORT_SETTINGS_IDX structure contains both the PORT_SETTINGS and the port index value. Except for the parameter types this call is equivalent to mbg_set_gps_port_settings.

The API call mbg_chk_dev_has_receiver_info checks whether this call is supported by a device.

Note: The function mbg_save_serial_settings should be used preferably to write new port configuration to the board.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPointer to a PORT_SETTINGS_IDX structure to be written
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_save_serial_settings
mbg_set_gps_port_settings
mbg_chk_dev_has_receiver_info

Definition at line 6248 of file mbgdevio.c.

References _mbg_swab_port_settings_idx, _mbgdevio_cnv_ret_val, _mbgdevio_write_gps_var_chk, _pcps_ddev_has_receiver_info, IOCTL_SET_GPS_PORT_SETTINGS_IDX, MBGDEVIO_RET_VAL, and PC_GPS_PORT_SETTINGS_IDX.

Referenced by mbg_set_gps_port_settings().

◆ mbg_set_gps_pos_lla()

int mbg_set_gps_pos_lla ( MBG_DEV_HANDLE  dh,
const LLA  p 
)

Set the GPS receiver position using LLA coordinates.

The structure LLA must specify the new position as longitude, latitude, and altitude, using the WGS84 geographic datum.

The API call mbg_chk_dev_is_gps checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPosition in LLA format to be written.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_set_gps_pos_xyz
mbg_get_gps_pos

Definition at line 5976 of file mbgdevio.c.

References _mbg_swab_double, _mbgdevio_cnv_ret_val, _mbgdevio_write_gps, IOCTL_SET_GPS_POS_LLA, MBGDEVIO_RET_VAL, N_LLA, PC_GPS_POS_LLA, and swap_double().

Referenced by set_gps_pos().

◆ mbg_set_gps_pos_xyz()

int mbg_set_gps_pos_xyz ( MBG_DEV_HANDLE  dh,
const XYZ  p 
)

Set the GPS receiver position using XYZ coordinates.

The structure XYZ must specify the new position in ECEF (Earth Centered, Earth Fixed) kartesian coordinates.

The API call mbg_chk_dev_is_gps checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPosition in XYZ format to be written
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_set_gps_pos_lla
mbg_get_gps_pos

Definition at line 5935 of file mbgdevio.c.

References _mbg_swab_double, _mbgdevio_cnv_ret_val, _mbgdevio_write_gps, IOCTL_SET_GPS_POS_XYZ, MBGDEVIO_RET_VAL, N_XYZ, PC_GPS_POS_XYZ, and swap_double().

◆ mbg_set_gps_pout_settings()

int mbg_set_gps_pout_settings ( MBG_DEV_HANDLE  dh,
const POUT_SETTINGS p,
int  idx 
)

Write the configuration for a single programmable pulse output.

The POUT_SETTINGS structure does not contain the index of the programmable output to be configured, so the index must explicitly be passed to this function. Except for the parameter types this call is equivalent to mbg_set_gps_pout_settings_idx.

The function should only be called if the RECEIVER_INFO::n_prg_out field (i.e. the number of programmable outputs on the board) is not 0, and the output index value must be in the range 0..RECEIVER_INFO::n_prg_out.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPointer to a POUT_SETTINGS structure to be written.
[in]idxIndex of the programmable pulse output to be configured (starting from 0 ).
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_get_gps_all_pout_info
mbg_set_gps_pout_settings_idx

Definition at line 7209 of file mbgdevio.c.

References POUT_SETTINGS_IDX::idx, mbg_set_gps_pout_settings_idx(), and POUT_SETTINGS_IDX::pout_settings.

Referenced by eval_pout().

◆ mbg_set_gps_pout_settings_idx()

int mbg_set_gps_pout_settings_idx ( MBG_DEV_HANDLE  dh,
const POUT_SETTINGS_IDX p 
)

Write the configuration for a single programmable pulse output.

The POUT_SETTINGS_IDX structure contains both the POUT_SETTINGS and the output index value. Except for the parameter types this call is equivalent to mbg_set_gps_pout_settings.

The function should only be called if the RECEIVER_INFO::n_prg_out field (i.e. the number of programmable outputs on the board) is not 0, and the output index value must be in the range 0..RECEIVER_INFO::n_prg_out.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPointer to a POUT_SETTINGS_IDX structure to be written.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_get_gps_all_pout_info
mbg_set_gps_pout_settings

Definition at line 7169 of file mbgdevio.c.

References _mbg_swab_pout_settings_idx_on_set, _mbgdevio_cnv_ret_val, _mbgdevio_write_gps_var_chk, _pcps_ddev_has_receiver_info, IOCTL_SET_GPS_POUT_SETTINGS_IDX, MBGDEVIO_RET_VAL, and PC_GPS_POUT_SETTINGS_IDX.

Referenced by mbg_set_gps_pout_settings().

◆ mbg_set_gps_time()

int mbg_set_gps_time ( MBG_DEV_HANDLE  dh,
const TTM p 
)

Set the time on a GPS receiver device.

Write a TTM structure to a GPS receiver in order to set the on-board date and time. Date and time must be local time according to the device's on-board time zone configuration (TZDL).

The API call mbg_chk_dev_is_gps checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPointer to a TTM structure to be written
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES

Definition at line 5608 of file mbgdevio.c.

References _mbg_swab_ttm, _mbgdevio_cnv_ret_val, _mbgdevio_write_gps_var, IOCTL_SET_GPS_TIME, MBGDEVIO_RET_VAL, and PC_GPS_TIME.

Referenced by set_date_time().

◆ mbg_set_gps_tzdl()

int mbg_set_gps_tzdl ( MBG_DEV_HANDLE  dh,
const TZDL p 
)

Write the card's time zone/daylight saving parameters.

This function writes the time zone/daylight saving parameters in a TZDL structure to a device.

The API call mbg_chk_dev_has_tzdl checks whether this call is supported by a device.

Note: In spite of the function name this call may also be supported by non-GPS cards. Other cards may support the mbg_set_tzcode or mbg_set_pcps_tzdl calls instead.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPointer to a TZDL structure to be written.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_tzdl
mbg_get_gps_tzdl
mbg_set_tzcode
mbg_set_pcps_tzdl
Time zone / daylight saving parameters

Definition at line 5475 of file mbgdevio.c.

References _mbg_swab_tzdl, _mbgdevio_cnv_ret_val, _mbgdevio_write_gps_var, IOCTL_SET_GPS_TZDL, MBGDEVIO_RET_VAL, and PC_GPS_TZDL.

Referenced by set_gps_tzdl().

◆ mbg_set_gps_xmr_settings_idx()

int mbg_set_gps_xmr_settings_idx ( MBG_DEV_HANDLE  dh,
const XMULTI_REF_SETTINGS_IDX p 
)

Write a single XMR setting to a device.

The XMULTI_REF_SETTINGS_IDX structure contains both the XMULTI_REF_SETTINGS and the index value.

The API call mbg_chk_dev_has_xmr checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPointer to a XMULTI_REF_SETTINGS_IDX structure to be written.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_xmr
mbg_get_xmr_instances
mbg_get_gps_all_xmr_status
mbg_get_gps_all_xmr_info
mbg_get_xmr_holdover_status

Definition at line 8399 of file mbgdevio.c.

References _mbg_swab_xmulti_ref_settings_idx, _mbgdevio_cnv_ret_val, _mbgdevio_write_gps_var_chk, _pcps_ddev_has_xmr, IOCTL_SET_XMR_SETTINGS_IDX, MBGDEVIO_RET_VAL, and PC_GPS_XMR_SETTINGS_IDX.

Referenced by mbg_get_all_ucap_info(), and mbg_save_all_xmulti_ref_info().

◆ mbg_set_ip4_settings()

int mbg_set_ip4_settings ( MBG_DEV_HANDLE  dh,
const IP4_SETTINGS p 
)

Write LAN IPv4 settings to a device.

The API call mbg_chk_dev_has_lan_intf checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pIP4_SETTINGS structure to be written.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_lan_intf
mbg_get_lan_if_info
mbg_get_ip4_settings

Definition at line 7360 of file mbgdevio.c.

References _mbg_swab_ip4_settings, _mbgdevio_cnv_ret_val, _mbgdevio_write_gps_var_chk, _pcps_ddev_has_lan_intf, IOCTL_SET_IP4_SETTINGS, MBGDEVIO_RET_VAL, and PC_GPS_IP4_SETTINGS.

Referenced by mbg_save_all_net_cfg_info(), and set_lan_intf().

◆ mbg_set_irig_rx_settings()

int mbg_set_irig_rx_settings ( MBG_DEV_HANDLE  dh,
const IRIG_SETTINGS p 
)

Write an IRIG_SETTINGS structure to a device to configure an IRIG input.

Deprecated:
Calling this function directly is deprecated. The function mbg_save_all_irig_rx_settings should be used instead which also writes some other associated parameters affecting the behaviour of the IRIG input.

The API call mbg_chk_dev_is_tcr checks whether this call is supported by a device. mbg_get_irig_rx_info should be called first to determine the possible settings supported by the device's IRIG input.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPointer to a IRIG_SETTINGS structure to be written.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_save_all_irig_rx_settings
mbg_get_irig_rx_info
mbg_chk_dev_is_tcr
mbg_chk_dev_has_irig_tx
mbg_chk_dev_has_irig
IRIG time codes
Deprecated:
Calling this function directly is deprecated. The function mbg_save_all_irig_rx_settings should be used instead which also writes some other associated parameters affecting the behaviour of the IRIG input.

The API call mbg_chk_dev_is_tcr checks whether this call is supported by a device. mbg_get_irig_rx_info should be called first to determine the possible settings supported by the device's IRIG input.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPointer to a IRIG_SETTINGS structure to be written.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_save_all_irig_rx_settings
mbg_get_irig_rx_info
mbg_chk_dev_is_tcr
mbg_chk_dev_has_irig_tx
mbg_chk_dev_has_irig
IRIG time codes

Definition at line 5065 of file mbgdevio.c.

References _mbg_swab_irig_settings, _mbgdevio_cnv_ret_val, _mbgdevio_write_var_chk, _pcps_ddev_is_irig_rx, IOCTL_SET_PCPS_IRIG_RX_SETTINGS, MBGDEVIO_RET_VAL, and PCPS_SET_IRIG_RX_SETTINGS.

Referenced by mbg_save_all_irig_rx_settings().

◆ mbg_set_irig_tx_settings()

int mbg_set_irig_tx_settings ( MBG_DEV_HANDLE  dh,
const IRIG_SETTINGS p 
)

Write an IRIG_SETTINGS structure to a device to configure the IRIG output.

The API call mbg_chk_dev_has_irig_tx checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPointer to an IRIG_INFO structure to be written.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_get_irig_tx_info
mbg_chk_dev_has_irig_tx
mbg_chk_dev_is_tcr
mbg_chk_dev_has_irig
IRIG time codes

Definition at line 6833 of file mbgdevio.c.

References _mbg_swab_irig_settings, _mbgdevio_cnv_ret_val, _mbgdevio_write_var_chk, _PCPS_CMD, _pcps_ddev_has_irig_tx, _pcps_ddev_requires_irig_workaround, IOCTL_SET_PCPS_IRIG_TX_SETTINGS, MBGDEVIO_RET_VAL, PCPS_SET_IRIG_RX_SETTINGS, and PCPS_SET_IRIG_TX_SETTINGS.

Referenced by do_mbgirigcfg().

◆ mbg_set_opt_settings()

int mbg_set_opt_settings ( MBG_DEV_HANDLE  dh,
const MBG_OPT_SETTINGS p 
)

Write a MBG_OPT_SETTINGS structure containing optional device settings.

The API call mbg_chk_dev_has_opt_flags checks whether this call is supported by a device.

mbg_get_opt_info should be called first to check which of the specified flags is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a MBG_OPT_SETTINGS structure to be written.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_opt_flags
mbg_get_opt_info

Definition at line 4988 of file mbgdevio.c.

References _mbg_swab_mbg_opt_settings, _mbgdevio_cnv_ret_val, _mbgdevio_write_var_chk, _pcps_ddev_has_opt_flags, IOCTL_SET_MBG_OPT_SETTINGS, MBGDEVIO_RET_VAL, and PCPS_SET_OPT_SETTINGS.

Referenced by mbg_save_all_irig_rx_settings().

◆ mbg_set_pcps_tzdl()

int mbg_set_pcps_tzdl ( MBG_DEV_HANDLE  dh,
const PCPS_TZDL p 
)

Write time zone/daylight saving parameters to a device.

This function passes a PCPS_TZDL structure to a device which supports a more detailed configuration of time zone and daylight saving than the TZCODE structure.

The API call mbg_chk_dev_has_pcps_tzdl checks whether this call is supported by a device. Other cards may support the mbg_set_tzcode or mbg_set_gps_tzdl calls instead.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPointer to a PCPS_TZDL structure to be written.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_pcps_tzdl
mbg_get_pcps_tzdl
mbg_set_tzcode
mbg_set_gps_tzdl

Definition at line 4858 of file mbgdevio.c.

References _mbg_swab_pcps_tzdl, _mbgdevio_cnv_ret_val, _mbgdevio_write_var_chk, _pcps_ddev_has_pcps_tzdl, IOCTL_SET_PCPS_TZDL, MBGDEVIO_RET_VAL, and PCPS_SET_PCPS_TZDL.

◆ mbg_set_process_affinity()

int mbg_set_process_affinity ( pid_t  pid,
int *  p 
)

Set the CPU affinity of a process.

This determines on which of the available CPUs or CPU cores the process is allowed to be executed.

Parameters
[in]pidThe process ID.
[out]pPointer to a MBG_CPU_SET variable which contains a mask of CPUs.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_get_process_affinity
mbg_set_current_process_affinity_to_cpu

◆ mbg_set_ptp_cfg_settings()

int mbg_set_ptp_cfg_settings ( MBG_DEV_HANDLE  dh,
const PTP_CFG_SETTINGS p 
)

Write PTP/IEEE1588 configuration settings to a device.

The API call mbg_chk_dev_has_ptp checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPTP_CFG_SETTINGS structure to be written.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_ptp
mbg_get_all_ptp_cfg_info
mbg_get_ptp_state
mbg_get_ptp_cfg_info
mbg_chk_dev_has_ptp_unicast

Definition at line 7458 of file mbgdevio.c.

References _mbg_swab_ptp_cfg_settings, _mbgdevio_cnv_ret_val, _mbgdevio_write_gps_var_chk, _pcps_ddev_has_ptp, IOCTL_SET_PTP_CFG_SETTINGS, MBGDEVIO_RET_VAL, and PC_GPS_PTP_CFG.

Referenced by mbg_save_all_ptp_cfg_info().

◆ mbg_set_ptp_uc_master_settings_idx()

int mbg_set_ptp_uc_master_settings_idx ( MBG_DEV_HANDLE  dh,
const PTP_UC_MASTER_SETTINGS_IDX p 
)

Write PTP/IEEE1588 unicast configuration settings to a device.

The API call mbg_chk_dev_has_ptp_unicast checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPTP_UC_MASTER_SETTINGS_IDX structure to be written.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_ptp_unicast
mbg_get_all_ptp_cfg_info
mbg_get_ptp_uc_master_cfg_limits
mbg_get_all_ptp_uc_master_info
mbg_get_ptp_state

Definition at line 7582 of file mbgdevio.c.

References _mbg_swab_ptp_uc_master_settings_idx, _mbgdevio_cnv_ret_val, _mbgdevio_write_gps_var_chk, _pcps_ddev_has_ptp_unicast, IOCTL_SET_PTP_UC_MASTER_SETTINGS_IDX, MBGDEVIO_RET_VAL, and PC_GPS_PTP_UC_MASTER_SETTINGS_IDX.

Referenced by mbg_save_all_ptp_cfg_info().

◆ mbg_set_ref_offs()

int mbg_set_ref_offs ( MBG_DEV_HANDLE  dh,
const MBG_REF_OFFS p 
)

Write the UTC offset configuration of the reference time to a device.

This parameter is used to specify the UTC offset of an incoming reference time signal if a kind of time signal e.g. an IRIG input signal) does not provide this information.

The API call mbg_chk_dev_has_ref_offs checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPointer to a MBG_REF_OFFS value to be written.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_ref_offs
mbg_get_ref_offs

Definition at line 4924 of file mbgdevio.c.

References _mbg_swab_mbg_ref_offs, _mbgdevio_cnv_ret_val, _mbgdevio_write_var_chk, _pcps_ddev_has_ref_offs, IOCTL_SET_REF_OFFS, MBGDEVIO_RET_VAL, and PCPS_SET_REF_OFFS.

Referenced by mbg_save_all_irig_rx_settings().

◆ mbg_set_serial()

int mbg_set_serial ( MBG_DEV_HANDLE  dh,
const PCPS_SERIAL p 
)

Write the serial port configuration to an old type of device.

Deprecated:
Direct usage of this function is deprecated. The generic API function mbg_save_serial_settings should be used instead which fully supports the capabilities of current devices.

The macro _pcps_has_serial checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPointer to a PCPS_SERIAL structure to be written
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_save_serial_settings
Deprecated:
Direct usage of this function is deprecated. The generic API function mbg_save_serial_settings should be used instead which fully supports the capabilities of current devices.

The macro _pcps_has_serial checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPointer to a PCPS_SERIAL structure to be written
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_save_serial_settings

Definition at line 4716 of file mbgdevio.c.

References _mbgdevio_cnv_ret_val, _mbgdevio_write_var, IOCTL_SET_PCPS_SERIAL, MBGDEVIO_RET_VAL, and PCPS_SET_SERIAL.

Referenced by mbg_save_serial_settings().

◆ mbg_set_synth()

int mbg_set_synth ( MBG_DEV_HANDLE  dh,
const SYNTH p 
)

Write frequency synthesizer configuration settings to a device.

Write a SYNTH structure containing the configuration of an optional on-board programmable frequency synthesizer.

The API call mbg_chk_dev_has_synth checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPointer to a SYNTH structure to be written.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_synth
mbg_get_synth
mbg_get_synth_state
Synthesizer parameters

Definition at line 6921 of file mbgdevio.c.

References _mbg_swab_synth, _mbgdevio_cnv_ret_val, _mbgdevio_write_var_chk, _pcps_ddev_has_synth, IOCTL_SET_SYNTH, MBGDEVIO_RET_VAL, and PCPS_SET_SYNTH.

Referenced by set_synth().

◆ mbg_set_time()

int mbg_set_time ( MBG_DEV_HANDLE  dh,
const PCPS_STIME p 
)

Set the device's on-board clock to a given date and time.

The macro _pcps_can_set_time checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPointer to a PCPS_STIME structure to be written
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_get_time

The macro _pcps_can_set_time checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPointer to a PCPS_STIME structure to be written
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_get_time

Definition at line 4518 of file mbgdevio.c.

References _mbgdevio_cnv_ret_val, _mbgdevio_write_var_chk, _pcps_ddev_can_set_time, IOCTL_SET_PCPS_TIME, MBGDEVIO_RET_VAL, and PCPS_SET_TIME.

Referenced by set_date_time().

◆ mbg_set_time_scale_settings()

int mbg_set_time_scale_settings ( MBG_DEV_HANDLE  dh,
const MBG_TIME_SCALE_SETTINGS p 
)

Write the time scale configuration to a device.

The MBG_TIME_SCALE_SETTINGS structure determines which time scale is to be used for the time stamps which can be read from a device.

The API call mbg_chk_dev_has_time_scale checks whether this call is supported by a device.

See also the notes for mbg_chk_dev_has_time_scale.

The function mbg_get_time_scale_info should have been called before in order to determine which time scales are supported by the card.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPointer to a MBG_TIME_SCALE_SETTINGS structure to be written.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_get_time_scale_info
mbg_chk_dev_has_time_scale

Definition at line 6502 of file mbgdevio.c.

References _mbg_swab_mbg_time_scale_settings, _mbgdevio_cnv_ret_val, _mbgdevio_write_gps_var_chk, _pcps_ddev_has_time_scale, IOCTL_SET_GPS_TIME_SCALE_SETTINGS, MBGDEVIO_RET_VAL, and PC_GPS_TIME_SCALE.

Referenced by set_time_scale().

◆ mbg_set_tr_distance()

int mbg_set_tr_distance ( MBG_DEV_HANDLE  dh,
const TR_DISTANCE p 
)

Write configurable "distance from transmitter" parameter to a device.

The distance from transmitter parameter is used to compensate the RF propagation delay, mostly with long wave receivers.

The API call mbg_chk_dev_has_tr_distance checks whether this call is supported by a device.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPointer to a TR_DISTANCE variable to be written.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_pzf
mbg_chk_dev_has_tr_distance
mbg_get_tr_distance

Definition at line 7754 of file mbgdevio.c.

References _mbg_swab_tr_distance, _mbgdevio_cnv_ret_val, _mbgdevio_write_var_chk, _pcps_ddev_has_tr_distance, IOCTL_SET_TR_DISTANCE, MBGDEVIO_RET_VAL, and PCPS_SET_TR_DISTANCE.

◆ mbg_set_tzcode()

int mbg_set_tzcode ( MBG_DEV_HANDLE  dh,
const PCPS_TZCODE p 
)

Write time zone/daylight saving configuration code to a device.

The APIs using TZCODE are only supported by some simpler cards and allow just a very basic configuration.

The API call mbg_chk_dev_has_tzcode checks whether this call is supported by a device.

Other devices may support the mbg_set_pcps_tzdl or mbg_set_gps_tzdl calls instead which allow for a more detailed configuration of the time zone and daylight saving settings.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPointer to a PCPS_TZCODE structure to be written.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_tzcode
mbg_get_tzcode
mbg_set_pcps_tzdl
mbg_set_gps_tzdl

Definition at line 4787 of file mbgdevio.c.

References _mbgdevio_cnv_ret_val, _mbgdevio_write_var_chk, _pcps_ddev_has_tzcode, IOCTL_SET_PCPS_TZCODE, MBGDEVIO_RET_VAL, and PCPS_SET_TZCODE.

Referenced by set_tz_code().

◆ mbg_set_utc_parm()

int mbg_set_utc_parm ( MBG_DEV_HANDLE  dh,
const UTC p 
)

Write a UTC parameter structure to a device.

This should only be done for testing, or if a card is operated in freewheeling mode. If the receiver is tracking any satellites then the settings written to the device are overwritten by the parameters broadcast by the satellites.

The API call mbg_chk_dev_has_utc_parm checks whether this call is supported by a device.

See also the notes for mbg_chk_dev_has_utc_parm.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]pPointer to a valid UTC structure to be written.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_chk_dev_has_utc_parm
mbg_get_utc_parm

Definition at line 6573 of file mbgdevio.c.

References _mbg_swab_utc_parm, _mbgdevio_cnv_ret_val, _mbgdevio_write_gps_var_chk, _pcps_ddev_has_utc_parm, UTC::A0, UTC::A1, IOCTL_SET_GPS_UTC_PARM, MBGDEVIO_RET_VAL, PC_GPS_UTC, and swap_double().

◆ mbg_setup_receiver_info()

int 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.

If the device supports the RECEIVER_INFO structure then the structure is read from the device, otherwise a structure is set up using default values depending on the device type.

Optionally, the function mbg_get_device_info may have been called before, and the returned PCPS_DEV structure can be passed to this function.

If a NULL pointer is passed instead, the device info is retrieved directly from the device, using the device handle.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[in]p_devOptional pointer to a PCPS_DEV structure, may be NULL.
[out]pPointer to a RECEIVER_INFO structure to be filled up.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_get_device_info
mbg_chk_dev_has_receiver_info

Definition at line 6329 of file mbgdevio.c.

References _pcps_has_receiver_info, _pcps_is_gps, _setup_default_receiver_info_dcf, _setup_default_receiver_info_gps, chk_dev_receiver_info(), mbg_get_device_info(), mbg_get_gps_receiver_info(), and mbg_rc_is_error.

Referenced by check_serial_mode(), check_setup_receiver_info(), mbg_get_show_dev_info(), and show_ext_stat_info().

◆ mbg_split_dev_name()

void mbg_split_dev_name ( const MBG_DEV_NAME  dev_name,
char *  type_name,
size_t  type_name_size,
char *  sernum,
size_t  sernum_size 
)

Split an MBG_DEV_NAME into the 'type name' and 'serial number' components.

See MBG_DEV_NAME for the possible formats of a device name. If no dev_name is passed then the destination buffers are set to empty strings.

The complementary function snprint_dev_name can be used to generate a device name string.

Parameters
[in]dev_nameThe MBG_DEV_NAME string to be split up
[out]type_nameOutput buffer for the type name part, e.g. a PCPS_CLOCK_NAME
[in]type_name_sizeSize of the output buffer for the type name string
[out]sernumOutput buffer for the sernum part, e.g. a PCPS_SN_STR
[in]sernum_sizeSize of the output buffer for the sernum string
See also
snprint_dev_name
MBG_DEV_NAME
MBG_DEV_NAME_FMT

Definition at line 4016 of file mbgdevio.c.

References dev_name.

Referenced by mbg_open_device_by_name().

◆ mbg_thread_create()

int mbg_thread_create ( MBG_THREAD_INFO p_ti,
MBG_THREAD_FNC  fnc,
void *  arg 
)

Create a new execution thread for the current process.

This function is only implemented for targets that support threads.

Parameters
[in]p_tiPointer to a MBG_THREAD_INFO structure to be filled up.
[in]fncThe name of the thread function to be started.
[in]argA generic argument passed to the thread function.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_thread_stop
mbg_thread_sleep_interruptible
mbg_thread_set_affinity

Referenced by mbg_set_current_process_affinity_to_cpu().

◆ mbg_thread_set_affinity()

int mbg_thread_set_affinity ( MBG_THREAD_INFO p_ti,
int *  p 
)

Set the CPU affinity of a single thread.

This determines on which of the available CPUs the thread is allowed to be executed.

This function is only implemented for targets that support thread affinity.

Parameters
[in,out]p_tiPointer to a MBG_THREAD_INFO structure associated with the thread.
[in]pPointer to a MBG_CPU_SET variable which contains a mask of CPUs.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_thread_create
mbg_thread_stop
mbg_thread_sleep_interruptible

Referenced by mbg_set_current_process_affinity_to_cpu().

◆ mbg_thread_sleep_interruptible()

int mbg_thread_sleep_interruptible ( MBG_THREAD_INFO p_ti,
ulong  sleep_ms 
)

Let the current thread sleep for a certain interval.

The sleep is interrupted if a signal is received indicating the thread should terminate.

This function is only implemented for targets that support threads.

Parameters
[in,out]p_tiPointer to a MBG_THREAD_INFO structure associated with the thread.
[in]sleep_msThe number of milliseconds to sleep
Returns
MBG_SUCCESS if the sleep interval has expired normally, MBG_ERR_INTR if a signal to terminate has been received, or one of the other MBG_ERROR_CODES
See also
mbg_thread_create
mbg_thread_stop
mbg_thread_set_affinity

Referenced by mbg_set_current_process_affinity_to_cpu().

◆ mbg_thread_stop()

int mbg_thread_stop ( MBG_THREAD_INFO p_ti)

Stop a thread which has been created by mbg_thread_create.

Wait until the thread has finished and release all resources.

This function is only implemented for targets that support threads.

Parameters
[in,out]p_tiPointer to a MBG_THREAD_INFO structure associated with the thread.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
mbg_thread_create
mbg_thread_sleep_interruptible
mbg_thread_set_affinity

Referenced by mbg_set_current_process_affinity_to_cpu().

◆ mbg_xhrt_poll_thread_create()

int mbg_xhrt_poll_thread_create ( MBG_POLL_THREAD_INFO p_pti,
MBG_DEV_HANDLE  dh,
MBG_PC_CYCLES_FREQUENCY  freq_hz,
int  sleep_ms 
)

Set up a MBG_POLL_THREAD_INFO structure and start a new thread.

The new thread runs a function which periodically reads a time stamp / cycles pair from a device.

This function is only implemented for targets that support threads.

Parameters
[in,out]p_ptiPointer to a MBG_POLL_THREAD_INFO structure.
[in]dhthe Handle of the device to be polled.
[in]freq_hzThe initial cycles frequency, if known, in Hz.
[in]sleep_msthe sleep interval for the poll thread function in ms. If this parameter is 0 then the default sleep interval is used.
Returns
MBG_SUCCESS on success, MBG_ERR_NOT_SUPP_BY_DEV if the device to poll does not support HR time else the result of mbg_thread_create.
See also
mbg_xhrt_poll_thread_stop
mbg_get_xhrt_time_as_pcps_hr_time
mbg_get_xhrt_time_as_filetime
mbg_get_xhrt_cycles_frequency

Referenced by do_mbgxhrtime(), and mbg_set_current_process_affinity_to_cpu().

◆ mbg_xhrt_poll_thread_stop()

int mbg_xhrt_poll_thread_stop ( MBG_POLL_THREAD_INFO p_pti)

Stop a polling thread started by mbg_xhrt_poll_thread_create.

This call also releases all associated resources.

Parameters
[in,out]p_ptiPointer to a MBG_POLL_THREAD_INFO structure.
Returns
The result of mbg_thread_stop.
See also
mbg_xhrt_poll_thread_create
mbg_get_xhrt_time_as_pcps_hr_time
mbg_get_xhrt_time_as_filetime
mbg_get_xhrt_cycles_frequency

Referenced by do_mbgxhrtime(), and mbg_set_current_process_affinity_to_cpu().

◆ mbgdevio_check_version()

int mbgdevio_check_version ( int  header_version)

Check if the DLL/shared library is compatible with a given version.

If this library is used as a DLL/shared object library then the version number can be checked to see if the header files which are actually used to build an application are compatible with the header files which have been used to build the library, and thus the API functions are called in the correct way.

Parameters
[in]header_versionVersion number to be checked, should be MBGDEVIO_VERSION from the mbgdevio.h file version used to build the application
Returns
MBG_SUCCESS if compatible, else MBG_ERR_LIB_NOT_COMPATIBLE
See also
mbgdevio_get_version
MBGDEVIO_VERSION defined in mbgdevio.h

Definition at line 641 of file mbgdevio.c.

References MBG_ERR_LIB_NOT_COMPATIBLE, MBG_SUCCESS, and MBGDEVIO_COMPAT_VERSION.

◆ mbgdevio_get_version()

int mbgdevio_get_version ( void  )

Get the version number of the precompiled DLL/shared object library.

If this library is used as a DLL/shared object library then the version number can be checked to see if the header files which are actually used to build an application are compatible with the header files which have been used to build the library, and thus the API function are called in the correct way.

Returns
The version number
See also
mbgdevio_check_version
MBGDEVIO_VERSION defined in mbgdevio.h

Definition at line 615 of file mbgdevio.c.

References MBGDEVIO_VERSION.

Variable Documentation

◆ mbg_dev_fn_base

const char mbg_dev_fn_base[]

◆ mbg_dev_fn_fmt

const char mbg_dev_fn_fmt[]

Referenced by mbg_dev_fn_from_dev_idx().