227 #define MBGDEVIO_VERSION 0x0308 229 #define MBGDEVIO_COMPAT_VERSION 0x0210 232 #if defined( MBG_TGT_WIN32 ) 234 #if !defined( MBGDEVIO_XHRT_API ) 235 #define MBGDEVIO_XHRT_API 1 238 #if !defined( MBGDEVIO_USE_THREAD_API ) 239 #define MBGDEVIO_USE_THREAD_API 1 242 #if !defined( MBGDEVIO_HAVE_THREAD_AFFINITY ) 243 #define MBGDEVIO_HAVE_THREAD_AFFINITY 1 246 #define MBGDEVIO_RET_VAL DWORD 248 #elif defined( MBG_TGT_LINUX ) 250 #if !defined( MBGDEVIO_XHRT_API ) 251 #define MBGDEVIO_XHRT_API 1 261 #include <sys/ioctl.h> 265 #if MBGDEVIO_USE_THREAD_API 269 #elif defined( MBG_TGT_BSD ) 271 #include <sys/ioctl.h> 274 #elif defined( MBG_TGT_OS2 ) 276 #elif defined( MBG_TGT_QNX_NTO ) 278 #include <sys/types.h> 279 #include <sys/stat.h> 284 #elif defined( MBG_TGT_DOS ) 286 #if !defined( MBG_USE_DOS_TSR ) 287 #define MBG_USE_DOS_TSR 1 292 #else // other target OSs which access the hardware directly 299 #if MBG_TGT_USE_IOCTL 309 #if !defined( MBGDEVIO_XHRT_API ) 310 #define MBGDEVIO_XHRT_API 0 313 #if !defined( MBGDEVIO_USE_THREAD_API ) 314 #define MBGDEVIO_USE_THREAD_API 0 317 #if !defined( MBGDEVIO_HAVE_THREAD_AFFINITY ) 318 #define MBGDEVIO_HAVE_THREAD_AFFINITY 0 321 #if ( 0 && defined( DEBUG ) ) 322 #define DEBUG_IOCTL_CALLS 1 324 #define DEBUG_IOCTL_CALLS 0 338 #if defined( _USE_PACK ) 339 #pragma pack( 1 ) // set byte alignment 340 #define _USING_BYTE_ALIGNMENT 348 #if MBG_TGT_USE_IOCTL // TODO should we use a different symbol to control this? 352 #define MBG_INVALID_DEV_HANDLE MBG_INVALID_HANDLE 354 #else // other target OSs which access the hardware directly 358 #define MBG_INVALID_DEV_HANDLE NULL 363 #if !defined( MBGDEVIO_RET_VAL ) 364 #define MBGDEVIO_RET_VAL int 368 #if !defined( _mbgdevio_cnv_ret_val ) 369 #define _mbgdevio_cnv_ret_val( _v ) (_v) 390 #if MBG_TGT_HAS_DEV_FN_BASE 392 #define MBGCLOCK_DEV_FN_BASE "/dev/mbgclock" 393 #define MBGCLOCK_DEV_FN_FMT MBGCLOCK_DEV_FN_BASE "%i" 413 #if defined( MBG_TGT_LINUX ) 415 #define MBG_PROCESS_ID pid_t 416 #define _mbg_get_current_process() 0 422 #if defined( __cpu_set_t_defined ) || defined( CPU_SETSIZE ) 423 #define MBG_CPU_SET cpu_set_t 424 #define MBG_CPU_SET_SIZE CPU_SETSIZE 425 #define _mbg_cpu_clear( _ps ) CPU_ZERO( (_ps) ) 426 #define _mbg_cpu_set( _i, _ps ) CPU_SET( (_i), (_ps) ) 427 #define _mbg_cpu_isset( _i, _ps ) CPU_ISSET( (_i), (_ps) ) 430 #if MBGDEVIO_USE_THREAD_API 431 #define MBG_THREAD_ID pthread_t 432 #define _mbg_get_current_thread() 0 433 #define MBG_THREAD_FNC_ATTR // empty 434 #define MBG_THREAD_FNC_RET_VAL void * 435 #define _mbg_thread_exit( _v ) return (void *) (_v) 438 #elif defined( MBG_TGT_WIN32 ) 440 #define MBG_PROCESS_ID HANDLE 441 #define _mbg_get_current_process() GetCurrentProcess() 443 #define MBG_CPU_SET DWORD_PTR // Attention: this is not used as pointer! 444 #define MBG_CPU_SET_SIZE ( sizeof( MBG_CPU_SET ) * 8 ) 446 #define MBG_THREAD_ID HANDLE 447 #define _mbg_get_current_thread() GetCurrentThread() 448 #define MBG_THREAD_FNC_ATTR WINAPI 449 #define MBG_THREAD_FNC_RET_VAL DWORD 450 #define _mbg_thread_exit( _v ) ExitThread( _v ); return (_v) 452 #endif // target specific 455 #if !defined( MBG_TGT_WIN32 ) 456 #define FILETIME int // just a dummy to avoid build errors 459 #if !defined( MBG_PROCESS_ID ) 460 #define MBG_PROCESS_ID int 463 #if !defined( _mbg_get_current_process ) 464 #define _mbg_get_current_process() 0 467 #if !defined( MBG_CPU_SET ) 468 #define MBG_CPU_SET int 471 #if !defined( MBG_CPU_SET_SIZE ) 472 #define MBG_CPU_SET_SIZE ( sizeof( MBG_CPU_SET ) * 8 ) 475 #if !defined( _mbg_cpu_clear ) 476 #define _mbg_cpu_clear( _ps ) ( *(_ps) = 0 ) 479 #if !defined( _mbg_cpu_set ) 480 #define _mbg_cpu_set( _i, _ps ) ( *(_ps) |= ( (MBG_CPU_SET) 1UL << (_i) ) ) 483 #if !defined( _mbg_cpu_isset ) 484 #define _mbg_cpu_isset( _i, _ps ) ( *(_ps) & ( 1UL << (_i) ) ) 488 #if !defined( MBG_THREAD_ID ) 489 #define MBG_THREAD_ID int 492 #if !defined( _mbg_get_current_thread ) 493 #define _mbg_get_current_thread() 0 496 #if !defined( MBG_THREAD_FNC_ATTR ) 497 #define MBG_THREAD_FNC_ATTR // empty 500 #if !defined( MBG_THREAD_FNC_RET_VAL ) 501 #define MBG_THREAD_FNC_RET_VAL void 504 #if !defined( _mbg_thread_exit ) 505 #define _mbg_thread_exit( _v ) _nop_macro_fnc() 516 #if defined( MBG_TGT_WIN32 ) 5426 #if defined( MBG_TGT_WIN32 ) 5430 const void *in_p,
int in_sz,
void *out_p,
int out_sz )
5432 DWORD ReturnedLength = 0;
5434 if ( !DeviceIoControl( dh, ioctl_code,
5435 (LPVOID) in_p, in_sz, out_p, out_sz,
5440 DWORD last_error = GetLastError();
5443 #if 0 //### TODO FIXME 5450 if ( rc != MBG_ERR_USB_ACCESS )
5451 mbgsvctl_log_mbgdevio_error( ioctl_code, rc );
5461 #define _do_mbg_ioctl( _dh, _ioctl, _p, _in_sz, _out_sz ) \ 5462 do_mbg_ioctl( _dh, _ioctl, (LPVOID) _p, _in_sz, (LPVOID) _p, _out_sz ) 5464 #elif defined( MBG_HAS_POSIX_IOCTL ) 5470 MBGDEVIO_RET_VAL do_mbg_ioctl( MBG_DEV_HANDLE dh,
unsigned long ioctl_code,
const void *p )
5472 int sys_rc = ioctl( dh, ioctl_code, (
void *) p );
5476 int sys_errno = errno;
5479 #if DEBUG_IOCTL_CALLS 5480 fprintf( stderr,
"IOCTL %s (0x%08lX) error: %s (errno: %i) --> %s (rc: %i)\n",
5482 strerror( sys_errno ), sys_errno,
5492 #define _do_mbg_ioctl( _dh, _ioctl, _p, _in_sz, _out_sz ) \ 5493 do_mbg_ioctl( _dh, _ioctl, _p ) 5502 #if MBG_TGT_USE_IOCTL 5524 int mbgdevio_do_gen_io( MBG_DEV_HANDLE dh,
int info,
unsigned int ioctl_code,
5525 const void *in_p,
int in_sz,
5526 void *out_p,
int out_sz )
5537 #if USE_IOCTL_GENERIC_REQ 5541 req.
in_p = (uintptr_t) in_p;
5542 req.
out_p = (uintptr_t) out_p;
5547 #if DEBUG_IOCTL_CALLS 5548 printf(
"inp: %p --> 0x%" PRIx64
" (%lu)\n", in_p, req.
in_p, (
ulong) req.
in_sz );
5549 printf(
"outp: %p --> 0x%" PRIx64
" (%lu)\n", out_p, req.
out_p, (
ulong) req.
out_sz );
5552 rc = _do_mbg_ioctl( dh, ioctl_code, &req,
sizeof( req ), 0 );
5556 IOCTL_GENERIC_BUFFER *p_buff;
5557 int buff_size =
sizeof( p_buff->ctl )
5558 + ( ( in_sz > out_sz ) ? in_sz : out_sz );
5560 p_buff = (IOCTL_GENERIC_BUFFER *) malloc( buff_size );
5562 if ( p_buff == NULL )
5565 p_buff->ctl.info = info;
5566 p_buff->ctl.data_size_in = in_sz;
5567 p_buff->ctl.data_size_out = out_sz;
5570 memcpy( p_buff->data, in_p, in_sz );
5572 rc = _do_mbg_ioctl( dh, ioctl_code, p_buff,
5573 sizeof( IOCTL_GENERIC_CTL ) + in_sz,
5574 sizeof( IOCTL_GENERIC_CTL ) + out_sz );
5577 memcpy( out_p, p_buff->data, out_sz );
5589 #define _do_mbgdevio_read( _dh, _cmd, _ioctl, _p, _sz ) \ 5590 _do_mbg_ioctl( _dh, _ioctl, _p, 0, _sz ) 5592 #define _do_mbgdevio_write( _dh, _cmd, _ioctl, _p, _sz ) \ 5593 _do_mbg_ioctl( _dh, _ioctl, _p, _sz, 0 ) 5595 #define _do_mbgdevio_read_gps _do_mbgdevio_read 5597 #define _do_mbgdevio_write_gps _do_mbgdevio_write 5601 #define _mbgdevio_read_var( _dh, _cmd, _ioctl, _p ) \ 5602 _do_mbgdevio_read( _dh, _cmd, _ioctl, _p, sizeof( *(_p) ) ) 5604 #define _mbgdevio_write_var( _dh, _cmd, _ioctl, _p ) \ 5605 _do_mbgdevio_write( _dh, _cmd, _ioctl, _p, sizeof( *(_p) ) ) 5607 #define _mbgdevio_write_cmd( _dh, _cmd, _ioctl ) \ 5608 _do_mbgdevio_write( _dh, _cmd, _ioctl, NULL, 0 ) 5610 #define _mbgdevio_read_gps _do_mbgdevio_read 5611 #define _mbgdevio_read_gps_var _mbgdevio_read_var 5613 #define _mbgdevio_write_gps _do_mbgdevio_write 5614 #define _mbgdevio_write_gps_var _mbgdevio_write_var 5617 #define _mbgdevio_gen_read( _dh, _cmd, _p, _sz ) \ 5618 mbgdevio_do_gen_io( _dh, _cmd, IOCTL_PCPS_GENERIC_READ, NULL, 0, _p, _sz ) 5620 #define _mbgdevio_gen_write( _dh, _cmd, _p, _sz ) \ 5621 mbgdevio_do_gen_io( _dh, _cmd, IOCTL_PCPS_GENERIC_WRITE, _p, _sz, NULL, 0 ) 5623 #define _mbgdevio_gen_io( _dh, _type, _in_p, _in_sz, _out_p, _out_sz ) \ 5624 mbgdevio_do_gen_io( _dh, _type, IOCTL_PCPS_GENERIC_IO, _in_p, _in_sz, _out_p, _out_sz ) 5626 #define _mbgdevio_gen_read_gps( _dh, _cmd, _p, _sz ) \ 5627 mbgdevio_do_gen_io( _dh, _cmd, IOCTL_PCPS_GENERIC_READ_GPS, NULL, 0, _p, _sz ) 5629 #define _mbgdevio_gen_write_gps( _dh, _cmd, _p, _sz ) \ 5630 mbgdevio_do_gen_io( _dh, _cmd, IOCTL_PCPS_GENERIC_WRITE_GPS, _p, _sz, NULL, 0 ) 5633 #else // !MBG_TGT_USE_IOCTL, accessing hardware device directly 5635 #define _mbgdevio_chk_cond( _cond ) \ 5638 return MBG_ERR_NOT_SUPP_BY_DEV; \ 5641 #define _mbgdevio_read( _dh, _cmd, _ioctl, _p, _sz ) \ 5642 pcps_read_safe( _dh, _cmd, _p, _sz ) 5644 #define _mbgdevio_write( _dh, _cmd, _ioctl, _p, _sz ) \ 5645 pcps_write_safe( _dh, _cmd, _p, _sz ) 5647 #define _do_mbgdevio_read_gps( _dh, _cmd, _ioctl, _p, _sz ) \ 5648 pcps_read_gps_safe( _dh, _cmd, _p, _sz ) 5650 #define _mbgdevio_write_gps( _dh, _cmd, _ioctl, _p, _sz ) \ 5651 pcps_write_gps_safe( _dh, _cmd, _p, _sz ) 5656 #define _mbgdevio_read_var( _dh, _cmd, _ioctl, _p ) \ 5657 _pcps_read_var_safe( _dh, _cmd, *(_p) ) 5659 #define _mbgdevio_write_var( _dh, _cmd, _ioctl, _p ) \ 5660 _pcps_write_var_safe( _dh, _cmd, *(_p) ) 5662 #define _mbgdevio_write_cmd( _dh, _cmd, _ioctl ) \ 5663 _pcps_write_byte_safe( _dh, _cmd ); 5665 #define _mbgdevio_read_gps_var( _dh, _cmd, _ioctl, _p ) \ 5666 _pcps_read_gps_var_safe( _dh, _cmd, *(_p) ) 5668 #define _mbgdevio_write_gps_var( _dh, _cmd, _ioctl, _p ) \ 5669 _pcps_write_gps_var_safe( _dh, _cmd, *(_p) ) 5672 #define _mbgdevio_gen_read( _dh, _cmd, _p, _sz ) \ 5673 _mbgdevio_read( _dh, _cmd, -1, _p, _sz ) 5675 #define _mbgdevio_gen_write( _dh, _cmd, _p, _sz ) \ 5676 _mbgdevio_write( _dh, _cmd, -1, _p, _sz ) 5678 #define _mbgdevio_gen_io( _dh, _type, _in_p, _in_sz, _out_p, _out_sz ) \ 5679 pcps_generic_io( _dh, _type, _in_p, _in_sz, _out_p, _out_sz ); 5681 #define _mbgdevio_gen_read_gps( _dh, _cmd, _p, _sz ) \ 5682 _do_mbgdevio_read_gps( _dh, _cmd, -1, _p, _sz ) 5684 #define _mbgdevio_gen_write_gps( _dh, _cmd, _p, _sz ) \ 5685 _mbgdevio_write_gps( _dh, _cmd, -1, _p, _sz ) 5687 #endif // !MBG_TGT_USE_IOCTL 5691 #define _mbg_generic_read_var( _dh, _cmd, _s ) \ 5692 mbg_generic_read( _dh, _cmd, &(_s), sizeof( (_s) ) ) 5694 #define _mbg_generic_write_var( _dh, _cmd, _s ) \ 5695 mbg_generic_write( _dh, _cmd, &(_s), sizeof( (_s) ) ) 5697 #define _mbg_generic_read_gps_var( _dh, _cmd, _s ) \ 5698 mbg_generic_read_gps( _dh, _cmd, &(_s), sizeof( (_s) ) ) 5700 #define _mbg_generic_write_gps_var( _dh, _cmd, _s ) \ 5701 mbg_generic_write_gps( _dh, _cmd, &(_s), sizeof( (_s) ) ) 5705 #define _mbgdevio_gen_read_var( _dh, _cmd, _s ) \ 5706 _mbgdevio_gen_read( _dh, _cmd, &(_s), sizeof( (_s) ) ) 5708 #define _mbgdevio_gen_write_var( _dh, _cmd, _s ) \ 5709 _mbgdevio_gen_write( _dh, _cmd, &(_s), sizeof( (_s) ) ) 5711 #define _mbgdevio_gen_read_gps_var( _dh, _cmd, _s ) \ 5712 _mbgdevio_gen_read_gps( _dh, _cmd, &(_s), sizeof( (_s) ) ) 5714 #define _mbgdevio_gen_write_gps_var( _dh, _cmd, _s ) \ 5715 _mbgdevio_gen_write_gps( _dh, _cmd, &(_s), sizeof( (_s) ) ) 5719 #if defined( MBG_TGT_WIN32 ) || defined( MBG_TGT_POSIX ) 5727 #if !defined( __BORLANDC__ ) 5734 struct tm tm = { 0 };
5735 time_t t =
cvt_to_time_t( (uint32_t) ( (*tstamp64) >> 32 ) );
5741 if ( tm.tm_hour == 0 && tm.tm_min == 0 && tm.tm_sec == 0 )
5746 *status &= ~PCPS_LS_ANN;
5762 #endif // !defined( __BORLANDC__ ) 5764 #endif // defined( MBG_TGT_WIN32 ) || defined( MBG_TGT_POSIX ) 5778 #if MBG_TGT_HAS_64BIT_TYPES 5792 ts->
sec = (uint32_t) ( n >> 32 );
5793 ts->
frac = (uint32_t) ( n & 0xFFFFFFFFUL );
5804 #if defined( _USING_BYTE_ALIGNMENT ) 5805 #pragma pack() // set default alignment 5806 #undef _USING_BYTE_ALIGNMENT
int mbg_set_event_time(MBG_DEV_HANDLE dh, const PCPS_TIME_STAMP *p)
A generic thread info structure.
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.
A structure to used to read the status of the PTP protocol stack.
uint16_t TR_DISTANCE
Receiver distance from transmitter [km].
_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.
Configuration settings for a specific PTP unicast master.
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.
MBG_PC_CYCLES_FREQUENCY mbg_get_default_cycles_frequency(void)
Retrieve the system's default cycles counter frequency.
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.
Number of event log entries that can be stored and yet have been saved.
uint8_t PCPS_TZCODE
Type of variable to hold a TZ code.
Configuration settings of a specific serial port.
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.
High resolution device time, system time, and associated cycles counts.
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.
_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.
uint32_t info
E.g. cmd code for the device.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_cab_len
Check if a device supports configuration of antenna cable length.
MBG_CHK_SUPP_FNC mbg_chk_dev_is_msf
Check if a device is a MSF receiver.
int mbg_get_debug_status(MBG_DEV_HANDLE dh, MBG_DEBUG_STATUS *p)
Read a debug status word from a device.
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.
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.
const char * mbgioctl_get_name(long code)
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.
int mbg_thread_create(MBG_THREAD_INFO *p_ti, MBG_THREAD_FNC fnc, void *arg)
Create a new execution thread for the current process.
int mbgdevio_check_version(int header_version)
Check if the DLL/shared library is compatible with a given version.
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.
uint64_t pcps_hr_tstamp64
Time stamp read from a device.
int mbg_get_synth_state(MBG_DEV_HANDLE dh, SYNTH_STATE *p)
Read the current status of the on-board frequency synthesizer.
int mbg_get_sync_time(MBG_DEV_HANDLE dh, PCPS_TIME *p)
Read the time when the device has last recently synchronized.
int mbg_get_gpio_cfg_limits(MBG_DEV_HANDLE dh, MBG_GPIO_CFG_LIMITS *p)
Read common GPIO configuration limits.
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.
uint32_t in_sz
Size of the input buffer.
Settings of an IPv4-only network interface.
int mbg_thread_set_affinity(MBG_THREAD_INFO *p_ti, int *p)
Set the CPU affinity of a single thread.
GPS UTC correction parameters.
MBG_CHK_SUPP_FNC mbg_chk_dev_is_mca
Check if the device is connected via the MCA bus.
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.
A structure used to configure a PTP port.
static __mbg_inline void mbg_chk_tstamp64_leap_sec(uint64_t *tstamp64, PCPS_TIME_STATUS_X *status)
int mbg_clr_ucap_buff(MBG_DEV_HANDLE dh)
Clear a device's on-board time capture FIFO buffer.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_tzdl
Check if a device supports timezone configuration using the TZDL structure.
The structure behind the MBG_DEV_NAME_LIST_ENTRY type.
A The structure used to store the configuration of two serial ports.
Time scale configuration settings plus capabilities.
uint64_t in_p
Address of the input buffer.
int mbg_get_tr_distance(MBG_DEV_HANDLE dh, TR_DISTANCE *p)
Read configurable "distance from transmitter" parameter from a device.
int mbg_get_gps_receiver_info(MBG_DEV_HANDLE dh, RECEIVER_INFO *p)
Read the RECEIVER_INFO structure from a device.
_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.
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.
Status information on a ref time source at a specific priority level.
int mbg_get_gps_ant_cable_len(MBG_DEV_HANDLE dh, ANT_CABLE_LEN *p)
Read the configured antenna cable length from a device.
A structure used to control a poll thread function.
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.
int mbg_generic_write_gps(MBG_DEV_HANDLE dh, int cmd, const void *p, int size)
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.
use the next device available on the system
Current IRIG settings and supported codes.
PCPS_DDEV * MBG_DEV_HANDLE
Configuration settings of a serial 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.
A structure used to configure optional settings.
PCPS_SECONDS sec
seconds since 1970, usually UTC scale
_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.
_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.
#define MBGCLOCK_DEV_FN_FMT
_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.
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.
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.
_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.
_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.
#define MBG_THREAD_FNC_RET_VAL
uint8_t PCPS_STATUS_PORT
Type of the status register port.
_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.
_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.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_ptp
Check if a device supports PTP configuration/status calls.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_irig
Check if a device provides either an IRIG input or output.
_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.
Current settings and general capabilities of a specific unicast master.
int mbg_get_device_info(MBG_DEV_HANDLE dh, PCPS_DEV *p)
Read detailed device information.
_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.
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.
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.
int mbg_set_opt_settings(MBG_DEV_HANDLE dh, const MBG_OPT_SETTINGS *p)
Write a MBG_OPT_SETTINGS structure containing optional device settings.
int mbg_find_devices(void)
Get the number of devices installed on the computer.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_asic_features
Check if a device supports the mbg_get_asic_features call.
int mbg_set_ip4_settings(MBG_DEV_HANDLE dh, const IP4_SETTINGS *p)
Write LAN IPv4 settings to a device.
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.
#define mbg_rc_is_success(_rc)
MBG_CHK_SUPP_FNC mbg_chk_dev_has_gpio
Check if a device provides GPIO signal inputs and/or outputs.
_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.
uint8_t PCPS_SERIAL
Legacy definitions used to configure a device's serial port.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_ptp_unicast
Check if a device supports PTP unicast feature/configuration.
uint16_t GPS_CMD
The type of a GPS command code.
MBG_CHK_SUPP_FNC mbg_chk_dev_is_gps
Check if a device is a GPS receiver.
int mbg_set_utc_parm(MBG_DEV_HANDLE dh, const UTC *p)
Write a UTC parameter structure to a device.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_ucap
Check if a device supports the mbg_get_ucap_entries and mbg_get_ucap_event calls. ...
_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.
MBG_CHK_SUPP_FNC mbg_chk_dev_is_pci
Check if the device is connected via the PCI bus.
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.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_hr_time
Check if a device supports the mbg_get_hr_time... functions.
General GPIO config info to be read from a device.
Time read from a device plus associated system cycles count.
int mbg_get_tzcode(MBG_DEV_HANDLE dh, PCPS_TZCODE *p)
Read time zone/daylight saving configuration code from a device.
int mbg_get_drvr_info(MBG_DEV_HANDLE dh, PCPS_DRVR_INFO *p)
Read information about the driver handling a given device.
_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.
int mbg_dev_has_serial_hs(MBG_DEV_HANDLE dh, int *p)
_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.
High resolution time stamp plus associated system cycles count.
Status of the time capture FIFO buffer.
MBG_MATCH_MODES
Device matching modes.
Configuration settings for a single programmable pulse output.
int mbg_set_gps_pos_xyz(MBG_DEV_HANDLE dh, const XYZ p)
Set the GPS receiver position using XYZ coordinates.
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.
_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.
uint16_t BVAR_STAT
Status flags of battery buffered data.
_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.
_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. ...
MBG_CHK_SUPP_FNC mbg_chk_dev_is_gnss
Check if a device supports GNSS configuration.
int mbg_get_xmr_instances(MBG_DEV_HANDLE dh, XMULTI_REF_INSTANCES *p)
Read XMULTI_REF_INSTANCES.
int mbg_get_irq_stat_info(MBG_DEV_HANDLE dh, PCPS_IRQ_STAT_INFO *p)
Read a device's IRQ status information.
Time scale configuration settings.
_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.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_utc_parm
Check if a device support reading/writing of UTC parameters.
_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.
Specification of a local time zone.
int mbg_posix_errno_to_mbg(int posix_errno, const char *info)
Translate a POSIX errno error code to one of the MBG_ERROR_CODES.
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.
_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.
A structure used to pass generic IOCTL requests to the kernel driver.
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.
_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. ...
A structure holding a time stamp / cycles count pair.
A GPIO port's current settings and limits, plus port index.
static __mbg_inline time_t cvt_to_time_t(mbg_time_t t)
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.
current second is leap second
MBG_CHK_SUPP_FNC mbg_chk_dev_has_corr_info
Check if a device supports reading correlation info.
Information on a specific supported string format.
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.
Reference source configuration for a specific priority level.
_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.
uint64_t out_p
Address of the output buffer.
int mbg_get_gps_sw_rev(MBG_DEV_HANDLE dh, SW_REV *p)
Retrieve the software revision of a GPS receiver.
Date time and status used with the PCPS_SET_TIME command.
_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.
use the next available device of the same type
MBG_CHK_SUPP_FNC mbg_chk_dev_has_tr_distance
Check if a device supports configurable distance from transmitter.
use only exactly the excat matching device, otherwise fail
MBG_CHK_SUPP_FNC mbg_chk_dev_is_tcr
Check if a device provides a configurable IRIG input.
_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.
int mbg_clr_evt_log(MBG_DEV_HANDLE dh)
Clear the device's on-board event log.
MBG_DEV_NAME_LIST_ENTRY * next
A status structure provided by the time polling thread function.
uint16_t ANT_CABLE_LEN
A data type used to configure the length of an antenna cable [m].
_MBG_API_ATTR MBG_DEV_HANDLE _MBG_API mbg_open_device(int dev_idx)
Open a device by index number.
A structure to used to query the current configuration and capabilities of a PTP port.
_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.
double XYZ[N_XYZ]
A position in cartesian coordinates.
_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.
_MBG_API_ATTR int _MBG_API mbg_chk_dev_is_wwvb(MBG_DEV_HANDLE dh)
Check if a device is a WWVB receiver.
A structure used to report the synthesizer state.
MBG_CHK_SUPP_FNC mbg_chk_dev_is_isa
Check if the device is connected via the ISA bus.
High resolution device time stamp, system time, and associated cycles counts.
A structure used to transmit information on date and time.
_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.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_irig_time
Check if a device supports the mbg_get_irig_time call.
int mbg_generic_read(MBG_DEV_HANDLE dh, int cmd, void *p, int size)
MBG_CHK_SUPP_FNC mbg_chk_dev_has_ref_offs
Check if a device provides a configurable ref time offset.
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.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_lan_intf
Check if a device supports simple LAN interface API calls.
A GPIO port's current settings, plus port index.
PCPS_FRAC_32 frac
binary fractions of second, see PCPS_FRAC_32
_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.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_pcps_tzdl
Check if a device supports timezone configuration using the PCPS_TZDL structure.
int mbgdevio_get_version(void)
Get the version number of the precompiled DLL/shared object library.
_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.
Limits to be considered when specifying PTP unicast masters.
The structure behind the MBG_DEV_FN_LIST_ENTRY type.
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.
uint32_t PCI_ASIC_FEATURES
A data type to hold the PCI ASIC feature flags mask.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_gps_data
Check if a device supports large configuration data structures.
int MBG_CHK_SUPP_FNC(MBG_DEV_HANDLE dh)
The type of functions to check if a feature is supported.
int mbg_get_ptp_state(MBG_DEV_HANDLE dh, PTP_STATE *p)
Read PTP/IEEE1588 status from a device.
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.
Configuration settings for a specific programmable pulse output.
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.
void mbg_close_device(MBG_DEV_HANDLE *dev_handle)
Close a device handle and set the handle value to MBG_INVALID_DEV_HANDLE.
A structure used to configure optional settings.
_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.
int16_t MBG_REF_OFFS
A data type used to configure the ref offset.
int mbg_generic_read_gps(MBG_DEV_HANDLE dh, int cmd, void *p, int size)
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.
_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.
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.
int mbg_set_ptp_cfg_settings(MBG_DEV_HANDLE dh, const PTP_CFG_SETTINGS *p)
Write PTP/IEEE1588 configuration settings to a device.
int mbg_thread_stop(MBG_THREAD_INFO *p_ti)
Stop a thread which has been created by mbg_thread_create.
int mbg_set_process_affinity(pid_t pid, int *p)
Set the CPU affinity of a process.
General info on supported XMR sources and instances.
_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.
char MBG_DEV_NAME[10+(16+1)+1]
A string buffer for a unique device ID.
int mbg_set_tr_distance(MBG_DEV_HANDLE dh, const TR_DISTANCE *p)
Write configurable "distance from transmitter" parameter to a device.
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.
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.
int mbg_get_irig_rx_info(MBG_DEV_HANDLE dh, IRIG_INFO *p)
Read the current IRIG input settings plus capabilities.
_MBG_API_ATTR int _MBG_API mbg_dev_is_dcf(MBG_DEV_HANDLE dh, int *p)
Check if a device is a DCF77 receiver.
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.
int mbg_get_synth(MBG_DEV_HANDLE dh, SYNTH *p)
Read the current frequency synthesizer settings from a device.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_debug_status
Check if a device provides a debug status word to be read.
MBG_CHK_SUPP_FNC mbg_chk_dev_can_clr_ucap_buff
Check if a device supports the mbg_clr_ucap_buff call.
int mbg_chk_dev_has_event_time(MBG_DEV_HANDLE dh)
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.
_MBG_API_ATTR int _MBG_API mbg_dev_is_wwvb(MBG_DEV_HANDLE dh, int *p)
Check if a device is a WWVB receiver.
#define MBG_ERR_NO_MEM
Failed to allocate memory.
int mbg_get_raw_irig_data(MBG_DEV_HANDLE dh, MBG_RAW_IRIG_DATA *p)
Read raw IRIG data from an IRIG receiver.
int mbg_set_tzcode(MBG_DEV_HANDLE dh, const PCPS_TZCODE *p)
Write time zone/daylight saving configuration code to a device.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_raw_irig_data
Check if a device supports the mbg_get_raw_irig_data call.
One of several sets of satellite information for a particular GNSS type.
Time zone / daylight saving parameters.
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.
#define MBG_FRAC32_UNITS_PER_SEC
Constant used to convert e.g. PCPS_TIME_STAMP::frac values.
#define MBG_SUCCESS
Error codes used with Meinberg devices and drivers.
int mbg_set_serial(MBG_DEV_HANDLE dh, const PCPS_SERIAL *p)
Write the serial port configuration to an old type of device.
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.
uint32_t PCPS_IRQ_STAT_INFO
Synthesizer configuration parameters.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_irig_tx
Check if a device provides a configurable IRIG output.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_fast_hr_timestamp
Check if a device supports the mbg_get_fast_hr_timestamp... calls.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_mod
Check if a device provides a modulation signal.
Reference source capabilities and current configuration for a specific priority level.
int mbg_thread_sleep_interruptible(MBG_THREAD_INFO *p_ti, ulong sleep_ms)
Let the current thread sleep for a certain interval.
_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.
static __mbg_inline int mbg_gmtime(struct tm *p_tm, const time_t *p_time)
int mbg_get_asic_features(MBG_DEV_HANDLE dh, PCI_ASIC_FEATURES *p)
Read the features of the on-board PCI/PCIe interface ASIC.
A geographic position represented in different formats.
_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.
void MBG_THREAD_FNC(void *)
A generic type of a thread function.
A buffer used to read raw IRIG data bits from an IRIG receiver.
Status information on a specific GPIO port.
_MBG_API_ATTR int _MBG_API mbg_dev_has_mod(MBG_DEV_HANDLE dh, int *p)
Check if a device provides a modulation signal.
_MBG_API_ATTR int _MBG_API mbg_dev_is_msf(MBG_DEV_HANDLE dh, int *p)
Check if a device is a MSF receiver.
int mbg_get_gps_pos(MBG_DEV_HANDLE dh, POS *p)
Read the current geographic position from a GPS device.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_xmr
Check if a device provides eXtended Multi Ref (XMR) inputs.
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.
MBG_CHK_SUPP_FNC mbg_chk_dev_is_usb
Check if the device is connected via the USB bus.
const char mbg_dev_fn_fmt[]
MBG_CHK_SUPP_FNC mbg_chk_dev_has_time_scale
Check if a device supports configurable time scales.
uint64_t MBG_PC_CYCLES_FREQUENCY
MBG_CHK_SUPP_FNC mbg_chk_dev_is_pci_express
Check if the device is connected via the PCI Express bus.
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.
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.
int mbg_win32_sys_err_to_mbg(DWORD win32_sys_rc, const char *info)
Translate a Windows non-socket API return code to one of the MBG_RETURN_CODES.
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.
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.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_receiver_info
Check if a device supports the RECEIVER_INFO structure and related calls.
PZF correlation status info.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_opt_flags
Check if a device supports the MBG_OPT_INFO/MBG_OPT_SETTINGS.
_MBG_API_ATTR int _MBG_API mbg_dev_is_gps(MBG_DEV_HANDLE dh, int *p)
Check if a device is a GPS receiver.
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.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_signal
Check if a device provides the level of its inputs signal.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_tz
Check if a device supports any kind of timezone configuration.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_generic_io
Check if a device supports the mbg_generic_io API call.
_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.
MBG_CHK_SUPP_FNC mbg_chk_dev_is_lwr
Check if a device is any long wave signal receiver.
_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.
#define _mbgdevio_cnv_ret_val(_v)
High resolution time including status and local time offset.
const char mbg_dev_fn_base[]
High resolution time plus associated system cycles count.
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.
int mbg_get_ucap_entries(MBG_DEV_HANDLE dh, PCPS_UCAP_ENTRIES *p)
Read information on a device's event capture buffer.
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.
int mbg_get_corr_info(MBG_DEV_HANDLE dh, CORR_INFO *p)
Read PZF correlation info from a device.
Satellite receiver status information.
int mbg_set_gps_time(MBG_DEV_HANDLE dh, const TTM *p)
Set the time on a GPS receiver device.
_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.
_MBG_API_ATTR int _MBG_API mbg_dev_is_gnss(MBG_DEV_HANDLE dh, int *p)
Check if a device supports GNSS configuration.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_irig_ctrl_bits
Check if a device supports the mbg_get_irig_ctrl_bits call.
Software revision information.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_asic_version
Check if a device supports the mbg_get_asic_version API call.
Current settings and general capabilities of a specific serial port.
uint32_t PCI_ASIC_VERSION
A data type to hold the PCI ASIC version code.
_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.
#define MBGCLOCK_DEV_FN_BASE
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.
int mbg_set_gps_tzdl(MBG_DEV_HANDLE dh, const TZDL *p)
Write the card's time zone/daylight saving parameters.
int mbg_get_lan_if_info(MBG_DEV_HANDLE dh, LAN_IF_INFO *p)
Read LAN interface information from a device.
int mbg_get_pcps_tzdl(MBG_DEV_HANDLE dh, PCPS_TZDL *p)
Read time zone/daylight saving parameters from a device.
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.
Local calendar date and time, plus sync status.
_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.
uint16_t PCPS_TIME_STATUS_X
Extended status code.
_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.
A high resolution time stamp.
double LLA[N_LLA]
A geographic position based on latitude, longitude, and altitude.
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.
Configuration settings of an IRIG input or output.
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.
int mbg_chk_dev_has_serial_hs(MBG_DEV_HANDLE dh)
int mbg_get_irig_tx_info(MBG_DEV_HANDLE dh, IRIG_INFO *p)
Read the current IRIG output settings plus the supported settings.
MBG_DEV_FN_LIST_ENTRY * next
int mbg_get_ip4_state(MBG_DEV_HANDLE dh, IP4_SETTINGS *p)
Read LAN IPv4 state from a device.
int mbg_get_xhrt_time_as_filetime(MBG_XHRT_INFO *p, int *p_ft)
Retrieve an extrapolated time stamp in FILETIME format.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_dac_ctrl
Check if a device supports bus level DAC control commands.
int mbg_get_gps_bvar_stat(MBG_DEV_HANDLE dh, BVAR_STAT *p)
Retrieve the status of the battery buffered GPS variables.
int mbg_get_gps_tzdl(MBG_DEV_HANDLE dh, TZDL *p)
Read the card's time zone/daylight saving parameters.
uint32_t out_sz
Size of the output buffer.
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.
uint32_t MBG_IRIG_CTRL_BITS
Bit coded return type for PCPS_GET_IRIG_CTRL_BITS.
int mbg_generic_write(MBG_DEV_HANDLE dh, int cmd, const void *p, int size)
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.
int mbg_xhrt_poll_thread_stop(MBG_POLL_THREAD_INFO *p_pti)
Stop a polling thread started by mbg_xhrt_poll_thread_create.
int mbg_set_gps_pos_lla(MBG_DEV_HANDLE dh, const LLA p)
Set the GPS receiver position using LLA coordinates.
_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.
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.
const char * mbg_strerror(int mbg_errno)
Return an error string associated with the MBG_ERROR_CODES.
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.
Device driver information.
MBG_CHK_SUPP_FNC mbg_chk_dev_is_dcf
Check if a device is a DCF77 receiver.
Antenna status and error at reconnect information.
int mbg_get_gps_time(MBG_DEV_HANDLE dh, TTM *p)
Read the current board time using a TTM structure.
int mbg_set_pcps_tzdl(MBG_DEV_HANDLE dh, const PCPS_TZDL *p)
Write time zone/daylight saving parameters to a device.
unsigned __int64 uint64_t
MBG_PC_CYCLES_FREQUENCY freq_hz
MBG_CHK_SUPP_FNC mbg_chk_dev_has_tzcode
Check if a device supports timezone configuration using the PCPS_TZCODE type.
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.
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.
int mbg_get_serial(MBG_DEV_HANDLE dh, PCPS_SERIAL *p)
Read the serial port configuration from an old type of device.
int mbg_get_gps_stat_info(MBG_DEV_HANDLE dh, STAT_INFO *p)
Read the extended GPS receiver status from a device.
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.
_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.
_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.
int mbg_set_synth(MBG_DEV_HANDLE dh, const SYNTH *p)
Write frequency synthesizer configuration settings to a device.
int mbg_get_process_affinity(pid_t pid, int *p)
Read the CPU affinity of a process.
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.
_MBG_API_ATTR int _MBG_API mbg_chk_dev_is_jjy(MBG_DEV_HANDLE dh)
Check if a device is a JJY receiver.
_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.
int mbg_generic_io(MBG_DEV_HANDLE dh, int type, const void *in_p, int in_sz, void *out_p, int out_sz)
int mbg_get_ip4_settings(MBG_DEV_HANDLE dh, IP4_SETTINGS *p)
Read LAN IPv4 settings from a device.
int mbg_get_utc_parm(MBG_DEV_HANDLE dh, UTC *p)
Read a UTC parameter structure from a device.
A structure used to identify a device type and supported features.
PCPS_HR_TIME_CYCLES htc
Cycles count associated with the time stamp.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_synth
Check if a device provides a programmable frequency synthesizer.
char MBG_DEV_FN[260]
A string that can take a device file name.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_pzf
Check if a device supports demodulation of the DCF77 PZF code.
int mbg_dev_can_clr_ucap_buff(MBG_DEV_HANDLE dh, int *p)
Check if a device supports the mbg_clr_ucap_buff call.
int mbg_set_current_process_affinity_to_cpu(int cpu_num)
Set the CPU affinity of a process for a single CPU only.
MBG_CHK_SUPP_FNC mbg_chk_dev_has_evt_log
Check if a device provides an on-board event log.
uint32_t MBG_DEBUG_STATUS
A data type used to read the board's debug status.
_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.
Simple LAN interface information.
int mbg_set_time_scale_settings(MBG_DEV_HANDLE dh, const MBG_TIME_SCALE_SETTINGS *p)
Write the time scale configuration to a device.
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.
_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.
leap second announced, for very old clocks see REV_PCPS_LS_ANN_PC31PS31
A structure controlling when output signals are enabled.
Current settings and general capabilities of a specific programmable pulse output.
static __mbg_inline void mbg_init_pc_cycles_frequency(MBG_DEV_HANDLE dh, MBG_PC_CYCLES_FREQUENCY *p)