240 #if defined( MBG_TGT_LINUX ) 246 #define _debug_iob_ptr( _p, _sz, _info ) \ 247 _mbg_kdd_msg_4( MBG_LOG_INFO, "%s: 0x%llx --> %p (%lu)", \ 248 _info, ( (unsigned long long) (_p) ), \ 249 (void *) (_p), (ulong) (_sz) ) 251 #define _debug_iob_ptr( _p, _sz, _info ) _nop_macro_fnc() 255 #define _iob_to_pout( _piob, _pout, _size ) \ 258 _debug_iob_ptr( _pout, _size, "outp" ); \ 260 if ( copy_to_user( (void *) (uintptr_t) _pout, _piob, _size ) ) \ 261 rc = MBG_ERR_COPY_TO_USER; \ 265 #define _iob_from_pin( _piob, _pin, _size ) \ 268 _debug_iob_ptr( _pin, _size, "inp" ); \ 270 if ( copy_from_user( _piob, (void *) (uintptr_t) _pin, _size ) ) \ 271 rc = MBG_ERR_COPY_FROM_USER; \ 275 #define _io_wait_pcps_sec_change( _pddev, _cmd, _type, _pout ) \ 276 goto err_unsupp_ioctl // not supported under Linux 282 #define _io_get_mapped_mem_address( _pddev, _pout ) \ 285 p_tmp->mapped_mem.pfn_offset = ( pddev->rsrc_info.mem[0].start_raw & ~PAGE_MASK ) + sizeof( PCI_ASIC ); \ 286 p_tmp->mapped_mem.len = pddev->rsrc_info.mem[0].len - sizeof( PCI_ASIC ); \ 287 _iob_to_pout_var( p_tmp->mapped_mem, _pout ); \ 291 #define _io_unmap_mapped_mem_address( _pddev, _pin ) \ 294 #elif defined( MBG_TGT_BSD ) 296 #include <sys/malloc.h> 298 #define _iob_to_pout( _piob, _pout, _size ) \ 299 memcpy( _pout, _piob, _size ) 301 #define _iob_from_pin( _piob, _pin, _size ) \ 302 memcpy( _piob, _pin, _size ) 304 #define _frc_iob_to_pout( _piob, _pout, _size ) \ 305 copyout( _piob, _pout, _size ) 307 #define _frc_iob_from_pin( _piob, _pin, _size ) \ 308 copyin( _pin, _piob, _size ) 310 #define _io_wait_pcps_sec_change( _pddev, _cmd, _type, _pout ) \ 311 goto err_unsupp_ioctl // not supported under *BSD 313 #define _io_get_mapped_mem_address( _pddev, _pout ) \ 314 goto err_unsupp_ioctl // not supported under *BSD 316 #define _io_unmap_mapped_mem_address( _pddev, _pin ) \ 317 goto err_unsupp_ioctl // not supported under *BSD 319 #elif defined( MBG_TGT_WIN32 ) 323 #define _iob_to_pout( _piob, _pout, _size ) \ 326 RtlCopyMemory( _pout, _piob, _size ); \ 331 #define _iob_from_pin( _piob, _pin, _size ) \ 332 RtlCopyMemory( _piob, _pin, _size ) 346 #if !defined( _frc_iob_to_pout ) 347 #define _frc_iob_to_pout _iob_to_pout 350 #if !defined( _frc_iob_from_pin ) 351 #define _frc_iob_from_pin _iob_from_pin 355 #define _iob_to_pout_var( _iob, _pout ) \ 356 _iob_to_pout( &(_iob), _pout, sizeof( _iob ) ) 358 #define _iob_from_pin_var( _iob, _pin ) \ 359 _iob_from_pin( &(_iob), _pin, sizeof( _iob ) ) 367 #define _pcps_access_is_unsafe( _pddev ) \ 368 ( ( (_pddev)->irq_stat_info & PCPS_IRQ_STATE_DANGER ) == PCPS_IRQ_STATE_DANGER ) 374 #if defined( MBG_TGT_WIN32 ) 378 #define _pcps_sem_inc_safe( _pddev ) \ 381 if ( _pcps_access_is_unsafe( _pddev ) ) \ 382 goto err_busy_irq_unsafe; \ 384 _pcps_sem_inc( _pddev ); \ 385 (_pddev)->p_irp = p_irp; \ 394 #define _pcps_sem_inc_safe_no_irp( _pddev ) \ 397 if ( _pcps_access_is_unsafe( _pddev ) ) \ 398 goto err_busy_irq_unsafe; \ 400 _pcps_sem_inc( _pddev ); \ 401 (_pddev)->p_irp = NULL; \ 409 #define _pcps_sem_inc_safe( _pddev ) \ 412 if ( _pcps_access_is_unsafe( _pddev ) ) \ 413 goto err_busy_irq_unsafe; \ 415 _pcps_sem_inc( _pddev ); \ 444 #define _io_chk_cond( _cond ) \ 448 goto err_not_supp_by_dev; \ 459 #define _io_read_var( _pddev, _cmd, _fld, _pout ) \ 462 _pcps_sem_inc_safe( _pddev ); \ 464 rc = _pcps_read_var( _pddev, _cmd, p_dev_iob->_fld ); \ 466 if ( mbg_rc_is_success( rc ) ) \ 467 _iob_to_pout_var( p_dev_iob->_fld, _pout ); \ 469 _pcps_sem_dec( _pddev ); \ 471 if ( mbg_rc_is_error( rc ) ) \ 472 goto err_dev_access; \ 483 #define _io_write_var( _pddev, _cmd, _fld, _pin ) \ 486 _pcps_sem_inc_safe( _pddev ); \ 487 _iob_from_pin_var( p_dev_iob->_fld, _pin ); \ 488 rc = _pcps_write_var( _pddev, _cmd, p_dev_iob->_fld ); \ 489 _pcps_sem_dec( _pddev ); \ 491 if ( mbg_rc_is_error( rc ) ) \ 492 goto err_dev_access; \ 505 #define _io_write_cmd( _pddev, _cmd ) \ 508 _pcps_sem_inc_safe( _pddev ); \ 509 rc = _pcps_write_byte( _pddev, _cmd ); \ 510 _pcps_sem_dec( _pddev ); \ 512 if ( mbg_rc_is_error( rc ) ) \ 513 goto err_dev_access; \ 526 #define _io_read_gps( _pddev, _cmd, _fld, _pout, _size ) \ 529 _io_chk_cond( _pcps_ddev_has_gps_data( _pddev ) ); \ 531 _pcps_sem_inc_safe( _pddev ); \ 533 rc = pcps_read_gps( _pddev, _cmd, (uchar FAR *) &p_dev_iob->_fld, _size ); \ 535 if ( mbg_rc_is_success( rc ) ) \ 536 _iob_to_pout( &p_dev_iob->_fld, _pout, _size ); \ 538 _pcps_sem_dec( _pddev ); \ 540 if ( mbg_rc_is_error( rc ) ) \ 541 goto err_dev_access; \ 554 #define _io_read_gps_var( _pddev, _cmd, _fld, _pout ) \ 557 _io_chk_cond( _pcps_ddev_has_gps_data( _pddev ) ); \ 559 _pcps_sem_inc_safe( _pddev ); \ 561 rc = _pcps_read_gps_var( _pddev, _cmd, p_dev_iob->_fld ); \ 563 if ( mbg_rc_is_success( rc ) ) \ 564 _iob_to_pout_var( p_dev_iob->_fld, _pout ); \ 566 _pcps_sem_dec( _pddev ); \ 568 if ( mbg_rc_is_error( rc ) ) \ 569 goto err_dev_access; \ 582 #define _io_write_gps_var( _pddev, _cmd, _fld, _pin ) \ 585 _io_chk_cond( _pcps_ddev_has_gps_data( _pddev ) ); \ 587 _pcps_sem_inc_safe( _pddev ); \ 588 _iob_from_pin_var( p_dev_iob->_fld, _pin ); \ 589 rc = _pcps_write_gps_var( _pddev, _cmd, p_dev_iob->_fld ); \ 590 _pcps_sem_dec( _pddev ); \ 592 if ( mbg_rc_is_error( rc ) ) \ 593 goto err_dev_access; \ 612 #define _io_read_var_chk( _pddev, _cmd, _fld, _pout, _cond ) \ 615 _io_chk_cond( _cond ); \ 616 _io_read_var( _pddev, _cmd, _fld, _pout ); \ 621 #define _io_write_var_chk( _pddev, _cmd, _fld, _pin, _cond ) \ 624 _io_chk_cond( _cond ); \ 625 _io_write_var( _pddev, _cmd, _fld, _pin ); \ 630 #define _io_write_cmd_chk( _pddev, _cmd, _cond ) \ 633 _io_chk_cond( _cond ); \ 634 _io_write_cmd( _pddev, _cmd ); \ 639 #define _io_read_gps_chk( _pddev, _cmd, _fld, _pout, _size, _cond ) \ 642 _io_chk_cond( _cond ); \ 644 if ( (size_t) _size > sizeof( p_dev_iob->_fld ) ) \ 645 goto err_inval_param; \ 647 _io_read_gps( _pddev, _cmd, _fld, _pout, _size ); \ 652 #define _io_read_gps_var_chk( _pddev, _cmd, _fld, _pout, _cond ) \ 655 _io_chk_cond( _cond ); \ 656 _io_read_gps_var( _pddev, _cmd, _fld, _pout ); \ 661 #define _io_write_gps_var_chk( _pddev, _cmd, _fld, _pin, _cond ) \ 664 _io_chk_cond( _cond ); \ 665 _io_write_gps_var( _pddev, _cmd, _fld, _pin ); \ 670 #define _report_cond( _cond, _pout ) \ 674 _iob_to_pout_var( p_tmp->i, _pout ); \ 682 #define _mbg_dbg_set_bit( _d, _v ) \ 685 mbg_dbg_data |= (_v); \ 686 _mbg_outp8( (_d), 0, mbg_dbg_port_mapped, mbg_dbg_data ); \ 691 #define _mbg_dbg_clr_bit( _d, _v ) \ 694 mbg_dbg_data &= ~(_v); \ 695 _mbg_outp8( (_d), 0, mbg_dbg_port_mapped, mbg_dbg_data ); \ 700 #define _mbg_dbg_clr_all( _d ) \ 704 _mbg_outp8( (_d), 0, mbg_dbg_port_mapped, mbg_dbg_data ); \ 710 #if ( 0 && defined( MBG_TGT_LINUX ) ) 711 #define TEST_MM_ACCESS_TIME 1 713 #define TEST_MM_ACCESS_TIME 0 716 #if TEST_MM_ACCESS_TIME 722 #if defined( __GNUC__ ) 731 uint32_t tmp = p_ts->
sec;
739 #if TEST_MM_ACCESS_TIME 741 #if defined( __GNUC__ ) 744 void test_mm_access_time(
PCPS_DDEV *pddev );
748 void test_mm_access_time(
PCPS_DDEV *pddev )
770 *( (
volatile uint64_t *) &tmp ) = *p64;
786 delta_frac = (long) ( tmp.
frac - p_ts->frac );
790 " %08lX.%08lX->%08lX.%08lX: %li (%u.%03u us)",
792 (
long) ( cyc_2 - cyc_1 ),
793 (
long) ( cyc_3 - cyc_2 ),
797 (
long) ( tmp.
frac - p_ts->frac ),
805 #endif // TEST_MM_ACCESS_TIME 809 #if defined( __GNUC__ ) 820 #if defined( MBG_TGT_WIN32 ) 837 #if defined( __GNUC__ ) 848 #if defined( MBG_TGT_WIN32 ) 870 #if defined( __GNUC__ ) 874 #
if defined( MBG_TGT_WIN32 )
875 IRP *p_irp,
int *ret_size,
uint16_t pout_size,
877 void *pin,
void *pout );
890 #if defined( MBG_TGT_WIN32 ) 905 #
if defined( MBG_TGT_WIN32 )
906 IRP *p_irp,
int *ret_size,
uint16_t pout_size,
908 void *pin,
void *pout )
917 #if USE_LOCAL_IO_BUFFER 942 #if USE_IOCTL_GENERIC_REQ 946 IOCTL_GENERIC_BUFFER *p_buff;
955 long cmd = ioctl_code;
957 const char *err_info = NULL;
964 switch ( ioctl_code )
1019 goto err_dev_access;
1050 goto err_dev_access;
1055 #if !defined( OMIT_STATUS_PORT ) 1107 goto err_dev_access;
1184 receiver_info, pout,
1280 #if _MBG_SUPP_VAR_ACC_SIZE // otherwise generic IOCTL functions are used instead 1531 goto err_not_supp_by_dev;
1533 goto err_inval_param;
1549 pcps_time_stamp, pin,
1703 #if USE_IOCTL_GENERIC_REQ 1708 if ( p_buff_out == NULL )
1730 goto err_dev_access;
1736 buffer_size =
sizeof( p_tmp->ctl ) + p_tmp->ctl.data_size_out;
1740 if ( p_buff == NULL )
1748 (
uint8_t) p_tmp->ctl.data_size_out );
1753 p_buff->ctl = p_tmp->ctl;
1760 goto err_dev_access;
1767 #if USE_IOCTL_GENERIC_REQ 1772 if ( p_buff_out == NULL )
1794 goto err_dev_access;
1800 buffer_size =
sizeof( p_tmp->ctl ) + p_tmp->ctl.data_size_out;
1804 if ( p_buff == NULL )
1812 (
uint16_t) p_tmp->ctl.data_size_out );
1817 p_buff->ctl = p_tmp->ctl;
1824 goto err_dev_access;
1830 #if _MBG_SUPP_VAR_ACC_SIZE 1883 #endif // _MBG_SUPP_VAR_ACC_SIZE 2015 ptp_uc_master_settings_idx, pin,
2088 #if USE_IOCTL_GENERIC_REQ 2094 if ( p_buff_in == NULL )
2115 goto err_dev_access;
2121 buffer_size =
sizeof( p_tmp->ctl ) + p_tmp->ctl.data_size_in;
2125 if ( p_buff == NULL )
2135 (
uint8_t) p_tmp->ctl.data_size_in );
2141 goto err_dev_access;
2148 #if USE_IOCTL_GENERIC_REQ 2154 if ( p_buff_in == NULL )
2175 goto err_dev_access;
2181 buffer_size =
sizeof( p_tmp->ctl ) + p_tmp->ctl.data_size_in;
2185 if ( p_buff == NULL )
2195 (
uint8_t) p_tmp->ctl.data_size_in );
2201 goto err_dev_access;
2208 #if USE_IOCTL_GENERIC_REQ 2217 if ( p_buff_in == NULL )
2237 if ( p_buff_out == NULL )
2274 goto err_dev_access;
2282 buffer_size =
sizeof( p_tmp->ctl ) +
2283 ( ( p_tmp->ctl.data_size_in > p_tmp->ctl.data_size_out ) ?
2284 p_tmp->ctl.data_size_in : p_tmp->ctl.data_size_out );
2288 if ( p_buff == NULL )
2291 _iob_from_pin( p_buff, pin,
sizeof( p_buff->ctl ) + p_tmp->ctl.data_size_in );
2298 p_buff->data, (
uint8_t) p_tmp->ctl.data_size_in,
2299 p_buff->data, (
uint8_t) p_tmp->ctl.data_size_out );
2304 p_buff->ctl = p_tmp->ctl;
2305 _iob_to_pout( p_buff, pout,
sizeof( p_buff->ctl ) + p_tmp->ctl.data_size_out );
2311 goto err_dev_access;
2344 mbg_dbg_port_mapped =
_mbg_ioremap( mbg_dbg_port,
sizeof( mbg_dbg_port ) );
2377 #endif // USE_DEBUG_PORT 2381 goto err_unsupp_ioctl;
2385 return IOCTL_RC_SUCCESS;
2389 #if defined( DEBUG ) 2390 err_info =
"unsupported IOCTL";
2392 sys_rc = IOCTL_RC_ERR_UNSUPP_IOCTL;
2397 #if defined( DEBUG ) 2398 err_info =
"invalid parameter";
2400 sys_rc = IOCTL_RC_ERR_INVAL_PARAM;
2403 err_not_supp_by_dev:
2404 #if defined( DEBUG ) 2405 err_info =
"not supported by device";
2407 sys_rc = IOCTL_RC_ERR_NOT_SUPP_BY_DEV;
2412 #if defined( DEBUG ) 2413 err_info =
"failed to allocate buffer";
2415 sys_rc = IOCTL_RC_ERR_NO_MEM;
2419 err_busy_irq_unsafe:
2420 #if defined( DEBUG ) 2421 err_info =
"busy since unsafe IRQ enabled";
2423 sys_rc = IOCTL_RC_ERR_BUSY_IRQ_UNSAFE;
2432 #if defined( MBG_TGT_LINUX ) 2434 #if defined( DEBUG ) 2435 err_info =
"failed to copy data to user space";
2437 sys_rc = IOCTL_RC_ERR_COPY_TO_USER;
2441 #if defined( DEBUG ) 2442 err_info =
"failed to copy data from user space";
2444 sys_rc = IOCTL_RC_ERR_COPY_FROM_USER;
2446 #endif // defined( MBG_TGT_LINUX ) 2449 #if defined( DEBUG ) 2450 err_info =
"device access failed";
2452 sys_rc = IOCTL_RC_ERR_DEV_ACCESS;
2459 #if defined( MBG_TGT_WIN32 ) 2461 ioctl_name, cmd, err_info, sys_rc );
#define IOCTL_GET_PCPS_TZCODE
#define IOCTL_DEV_HAS_RAW_IRIG_DATA
#define IOCTL_GET_FAST_HR_TIMESTAMP_CYCLES
#define IOCTL_DEV_HAS_PCI_ASIC_VERSION
#define IOCTL_DEV_CAN_CLR_UCAP_BUFF
#define _pcps_ddev_sernum(_p)
(r/w) UTC, UTC corr. param., only if PCPS_HAS_UTC_PARM
#define _io_read_gps_var(_pddev, _cmd, _fld, _pout)
Read a large data structure with fixed size from a device.
#define IOCTL_GET_GPS_ALL_PORT_INFO
#define IOCTL_DEV_HAS_LAN_INTF
(r/-) IDENT, serial number, deprecated by PC_GPS_RECEIVER_INFO
(-/w) POUT_SETTINGS_IDX, settings for one programmable output
#define PCPS_GET_SERIAL
(r-) Read serial settings as PCPS_SERIAL, deprecated by PC_GPS_ALL_PORT_INFO
#define _pcps_sem_dec(_pddev)
#define IOCTL_SET_GPS_POS_LLA
uint32_t info
E.g. cmd code for the device.
#define IOCTL_GET_MBG_OPT_INFO
MBG_SYS_TIME_CYCLES sys_time_cycles
system time stamp plus associated cycles
(r/w) TTM, current time, deprecated by PCPS_GIVE_HR_TIME
const char * mbgioctl_get_name(long code)
#define IOCTL_MBG_DBG_SET_BIT
int pcps_generic_io(PCPS_DDEV *pddev, uint8_t type, const void FAR *in_buff, uint8_t in_cnt, void FAR *out_buff, uint8_t out_cnt)
Generic I/O function.
#define IOCTL_DEV_HAS_SYNTH
(r/w) ENABLE_FLAGS, when to enable serial, pulses, and synth, only if GPS_MODEL_HAS_ENABLE_FLAGS ...
#define _pcps_ddev_is_usb(_p)
#define _pcps_ddev_has_asic_features(_p)
uint32_t in_sz
Size of the input buffer.
#define IOCTL_SET_GPS_POS_XYZ
(r/-) PTP_UC_MASTER_CFG_LIMITS, only if PTP_CFG_MSK_SUPPORT_PTP_UNICAST
#define IOCTL_SET_GPS_UTC_PARM
#define _io_read_var_chk(_pddev, _cmd, _fld, _pout, _cond)
#define _mbgddmsg_3(_f, _lvl, _fmt, _p1, _p2, _p3)
#define IOCTL_GET_GPS_POS
#define IOCTL_DEV_HAS_IRIG_TX
#define _pcps_ddev_has_sync_time(_p)
#define IOCTL_DEV_HAS_OPT_FLAGS
uint64_t in_p
Address of the input buffer.
PCPS_IRQ_STAT_INFO irq_stat_info
#define PCPS_CLR_UCAP_BUFF
(-w) No param., clear on-board capture FIFO, only if _pcps_has_ucap
#define IOCTL_DEV_HAS_FAST_HR_TIMESTAMP
#define IOCTL_SET_PCPS_TIME
#define IOCTL_GET_PCPS_UCAP_EVENT
#define IOCTL_SET_GPS_ENABLE_FLAGS
#define IOCTL_UNMAP_MAPPED_MEM
#define _pcps_ddev_has_cab_len(_p)
#define IOCTL_GET_PCPS_DEV
#define PCPS_GIVE_SYNC_TIME
(r-) Read last sync time as PCPS_TIME, only if _pcps_has_sync_time
(-/w) MBG_GPIO_SETTINGS_IDX, settings for a specific port, only if GPS_HAS_GPIO
#define IOCTL_GET_IRIG_CTRL_BITS
(r/-) XMR_HOLDOVER_STATUS, only if XMRIF_MSK_HOLDOVER_STATUS_SUPP
#define IOCTL_GET_PCPS_IRIG_RX_INFO
#define IOCTL_SET_GPS_CMD
#define IOCTL_DEV_HAS_HR_TIME
#define IOCTL_GET_FAST_HR_TIMESTAMP
#define IOCTL_GET_CYCLES_FREQUENCY
static __mbg_inline void mbg_get_pc_cycles(MBG_PC_CYCLES *p)
PCPS_SECONDS sec
seconds since 1970, usually UTC scale
#define MBG_DEV_NAME_FMT
A string format specifier for MBG_DEV_NAME.
MBG_CHK_SUPP_FNC _pcps_ddev_is_wwvb
#define _mbg_kdd_msg_3(_lvl, _fmt, _p1, _p2, _p3)
PCPS_WRITE_FNC pcps_write
Write data to a device.
#define IOCTL_GET_XMR_HOLDOVER_STATUS
#define _mbgddmsg_6(_f, _lvl, _fmt, _p1, _p2, _p3, _p4, _p5, _p6)
#define _pcps_ddev_requires_irig_workaround(_d)
#define IOCTL_DEV_HAS_GPS_DATA
#define _pcps_ddev_has_debug_status(_p)
#define _iob_to_pout_var(_iob, _pout)
#define IOCTL_GET_GPS_TZDL
uint8_t PCPS_STATUS_PORT
Type of the status register port.
#define IOCTL_SET_PCPS_IRIG_RX_SETTINGS
#define IOCTL_DEV_HAS_DEBUG_STATUS
static __mbg_inline void mbg_get_sys_time(MBG_SYS_TIME *p)
#define _mbgddmsg_0(_f, _lvl, _fmt)
#define MBG_ERR_COPY_TO_USER
Kernel driver failed to copy data from kernel to user space.
#define _io_get_mapped_mem_address(_pddev, _pout)
#define mbg_rc_is_success(_rc)
(-/w) PORT_SETTINGS_IDX, settings for specified serial port, only if RECEIVER_INFO::n_com_ports > 0 ...
#define IOCTL_DEV_IS_GNSS
#define PCPS_GET_SYNTH_STATE
(r-) Read SYNTH_STATE, only if _pcps_has_synth
#define _mbg_dbg_clr_bit(_d, _v)
#define IOCTL_GET_GPS_STAT_INFO
#define PCPS_SET_SERIAL
(-w) Write serial settings as PCPS_SERIAL, deprecated by PC_GPS_PORT_SETTINGS_IDX, returns MBG_ERR_CFG on error
PCPS_HR_TIME_CYCLES pcps_hr_time_cycles
#define IOCTL_GET_ALL_XMR_INFO
PCPS_READ_FNC pcps_read_gps
Read a large data structure from a device.
MBG_PC_CYCLES cyc_before
cycles count before sys time is read
#define IOCTL_SET_GPS_PORT_PARM
#define _pcps_ddev_has_gps_data(_p)
#define _pcps_ddev_has_generic_io(_p)
#define PCPS_SET_IRIG_RX_SETTINGS
(-w) Write IRIG_SETTINGS, only if _pcps_is_irig_rx, returns MBG_ERR_CFG on error
#define _pcps_ddev_has_pcps_tzdl(_p)
(r/-) n * MBG_GPIO_INFO_IDX, all GPIO info, only if GPS_HAS_GPIO
#define IOCTL_GET_PCPS_STATUS_PORT
#define _io_read_gps_var_chk(_pddev, _cmd, _fld, _pout, _cond)
#define _pcps_ddev_is_irig_rx(_p)
#define _pcps_ddev_has_pzf(_p)
#define IOCTL_SET_REF_OFFS
#define IOCTL_SET_IP4_SETTINGS
(-/w) XYZ, current position in ECEF coordinates, only if GPS_MODEL_HAS_POS_XYZ
#define IOCTL_GET_GPS_ANT_CABLE_LEN
High resolution time stamp plus associated system cycles count.
(r/w) TZDL, time zone / daylight saving, only if GPS_MODEL_HAS_TZDL
#define IOCTL_SET_GNSS_MODE_SETTINGS
(r/w) ANT_CABLE_LEN, length of antenna cable, only if GPS_MODEL_HAS_ANT_CABLE_LEN ...
#define IOCTL_CLR_EVT_LOG
PCPS_TIME_CYCLES pcps_time_cycles
(r/-) BVAR_STAT, status of buffered variables, only if GPS_MODEL_HAS_BVAR_STAT
MBG_TIME_INFO_HRT mbg_time_info_hrt
#define IOCTL_DEV_HAS_IRIG_TIME
#define IOCTL_DEV_HAS_EVT_LOG
static __mbg_inline void do_get_fast_hr_timestamp_safe(PCPS_DDEV *pddev, PCPS_TIME_STAMP *p_ts)
static __mbg_inline void do_get_fast_hr_timestamp_cycles_safe(PCPS_DDEV *pddev, PCPS_TIME_STAMP_CYCLES *p_ts_cyc)
#define PCPS_GIVE_TIME_NOCLEAR
(r-) Read current time in PCPS_TIME format, don't clear sec and min flags (deprecated) ...
MBG_SYS_TIME_CYCLES sys_time_cycles
system timestamp plus associated cycles
static __mbg_inline void swap_tstamp(PCPS_TIME_STAMP *p_ts)
(-/w) LLA, current position in geographic coordinates, only if GPS_MODEL_HAS_POS_LLA ...
#define IOCTL_CHK_DEV_FEAT
#define _report_cond(_cond, _pout)
PCPS_TIME_STAMP tstamp
High resolution time stamp (UTC)
#define PCPS_SET_TZCODE
(-w) Write PCPS_TZCODE, only if _pcps_has_tzcode, returns MBG_ERR_CFG on error
#define _io_write_gps_var(_pddev, _cmd, _fld, _pin)
Write a large data structure with fixed size to a device.
#define IOCTL_GET_DEBUG_STATUS
#define _pcps_ddev_has_ref_offs(_p)
#define PCPS_NUM_EVT_LOG_ENTRIES
(r-) Read MBG_NUM_EVT_LOG_ENTRIES, only if _pcps_has_evt_log
#define IOCTL_PCPS_GENERIC_READ
#define IOCTL_GET_PTP_CFG_INFO
static __mbg_inline int ioctl_switch(PCPS_DDEV *pddev, unsigned int ioctl_code, void *pin, void *pout)
Decode and handle IOCTL commands.
(r/-) IP4_SETTINGS, LAN interface state, only if PCPS_HAS_LAN_INTF
#define PCPS_GIVE_UCAP_ENTRIES
(r-) Read PCPS_UCAP_ENTRIES, only if _pcps_has_ucap
#define IOCTL_GET_ALL_GNSS_SAT_INFO
#define IOCTL_GET_PCPS_TIME_SEC_CHANGE
#define PCPS_FIRST_EVT_LOG_ENTRY
(r-) Read first (oldest) MBG_EVT_LOG_ENTRY, only if _pcps_has_evt_log
#define _pcps_sem_inc_safe(_pddev)
#define IOCTL_GET_GPS_ENABLE_FLAGS
#define _pcps_ddev_has_ptp_unicast(_p)
#define _io_write_var(_pddev, _cmd, _fld, _pin)
Write a standard data structure to a device.
#define IOCTL_SET_PCPS_SERIAL
#define IOCTL_GET_IRIG_TIME
MBG_PC_CYCLES acc_cycles
Cycles count taken when device was accessed last time.
#define _pcps_ddev_has_raw_irig_data(_p)
#define IOCTL_GET_TIME_INFO_TSTAMP
(-/w) GPS_CMD, send one of the PC_GPS_COMMANDS
#define IOCTL_PCPS_GENERIC_IO
uint64_t out_p
Address of the output buffer.
#define IOCTL_GET_GPS_ANT_INFO
#define IOCTL_SET_PTP_CFG_SETTINGS
#define IOCTL_DEV_HAS_UCAP
#define _mbg_dbg_set_bit(_d, _v)
#define _pcps_ddev_has_corr_info(_p)
#define IOCTL_GET_REF_OFFS
#define _pcps_read_var(_pddev, _cmd, _s)
#define IOCTL_PCPS_CLR_UCAP_BUFF
#define IOCTL_GET_CORR_INFO
#define IOCTL_GET_PCPS_UCAP_ENTRIES
#define IOCTL_DEV_IS_WWVB
(r/w) MBG_GNSS_MODE_INFO / MBG_GNSS_MODE_SETTINGS, only if PCPS_IS_GNSS
High resolution device time stamp, system time, and associated cycles counts.
#define IOCTL_GET_PCI_ASIC_VERSION
#define PCPS_GET_STATUS_PORT
(r-) Read PCPS_STATUS_PORT
(-/w) XMULTI_REF_SETTINGS_IDX, idx 0..XMULTI_REF_INSTANCES::n_xmr_settings-1, only if GPS_HAS_XMULTI_...
#define IOCTL_DEV_HAS_GPS_UTC_PARM
#define IOCTL_SET_GPS_TZDL
#define PCPS_SET_TR_DISTANCE
(-w) Write TR_DISTANCE, only if _pcps_has_tr_distance
#define _io_chk_cond(_cond)
Check if a condition is true.
#define _pcps_ddev_has_hr_time(_p)
(r/-) n * MBG_GPIO_STATUS_IDX, where n == MBG_GPIO_CFG_LIMITS::num_io, only if MBG_GPIO_CFG_LIMIT_FLA...
#define PCPS_GIVE_UCAP_EVENT
(r-) Return oldest event as PCPS_HR_TIME, only if _pcps_has_ucap
#define IOCTL_MBG_DBG_CLR_BIT
(r/-) XMULTI_REF_INSTANCES, only if GPS_HAS_XMULTI_REF and GPS_HAS_XMRS_MULT_INSTC ...
#define PCPS_GIVE_TIME
Command codes used to communicate with bus level devices.
PCPS_FRAC_32 frac
binary fractions of second, see PCPS_FRAC_32
#define PCPS_GET_TR_DISTANCE
(r-) Read TR_DISTANCE, only if _pcps_has_tr_distance
(r/w) PTP_CFG_SETTINGS / PTP_CFG_INFO, only if PCPS_HAS_PTP
#define IOCTL_GET_PCPS_SYNC_TIME
#define IOCTL_DEV_HAS_SIGNAL
#define IOCTL_DEV_HAS_IRIG
#define IOCTL_GET_GPIO_CFG_LIMITS
#define _pcps_ddev_has_xmr(_p)
#define _pcps_ddev_can_clr_ucap_buff(_p)
#define IOCTL_DEV_HAS_MOD
#define IOCTL_GET_GPS_BVAR_STAT
MBG_SYS_TIME sys_time
system time stamp
#define IOCTL_MBG_DBG_SET_PORT_ADDR
#define _pcps_ddev_has_irig_ctrl_bits(_p)
#define _io_unmap_mapped_mem_address(_pddev, _pin)
PCI_ASIC_VERSION raw_asic_version
Raw ASIC version.
(r/w) IP4_SETTINGS, LAN interface configuration, only if PCPS_HAS_LAN_INTF
#define IOCTL_GET_SYNTH_STATE
#define _io_read_gps_chk(_pddev, _cmd, _fld, _pout, _size, _cond)
#define PCPS_SET_SYNTH
(-w) Write SYNTH, only if _pcps_has_synth, returns MBG_ERR_CFG on error
PCPS_TIME_STAMP volatile __iomem * mm_tstamp_addr
PCPS_TIME_STAMP_CYCLES ref_tstamp_cycles
HR timestamp from the card, plus cycles.
#define _pcps_ddev_is_dcf(_p)
#define IOCTL_SET_GPS_POUT_SETTINGS_IDX
#define _pcps_ddev_is_gnss(_p)
#define _pcps_ddev_has_gpio(_p)
#define IOCTL_GET_ALL_PTP_UC_MASTER_INFO
#define IOCTL_DEV_HAS_CAB_LEN
#define IOCTL_GET_GNSS_MODE_INFO
(r/-) PTP_STATE, only if PCPS_HAS_PTP
#define _pcps_ddev_has_serial_hs(_p)
(r/-) n * PORT_INFO_IDX, settings and capabilities of all serial ports, only if RECEIVER_INFO::n_com_...
(r/-) POS, position XYZ, LLA, and DMS combined, only if GPS_MODEL_HAS_POS
(r/-) n * GNSS_SAT_INFO_IDX, satellite info, only if PCPS_IS_GNSS
#define _pcps_ddev_has_ucap(_p)
(r/-) MBG_GPIO_CFG_LIMITS, only if GPS_HAS_GPIO
#define _frc_iob_from_pin
#define MBG_ERR_COPY_FROM_USER
Kernel driver failed to copy data from use to kernel space.
#define IOCTL_GET_GPS_TIME
#define IOCTL_DEV_HAS_CORR_INFO
#define IOCTL_SET_GPIO_SETTINGS_IDX
#define PCPS_SET_OPT_SETTINGS
(-w) Write MBG_OPT_SETTINGS, only if _pcps_has_opt_flags, returns MBG_ERR_CFG on error ...
#define IOCTL_GET_PCI_ASIC_FEATURES
#define IOCTL_PCPS_GENERIC_READ_GPS
#define _pcps_kmalloc(_sz)
#define IOCTL_GET_GPS_IDENT
An I/O buffer for bus level devices.
#define PCPS_GET_REF_OFFS
(r-) Read MBG_REF_OFFS, only if _pcps_has_ref_offs
int pcps_chk_dev_feat(PCPS_DDEV *p_ddev, uint feat_type, uint feat_num)
Check if a specific feature of a specific feature type is supported.
#define IOCTL_GET_PCPS_IRIG_TX_INFO
#define PCPS_GIVE_IRIG_TIME
(r-) Read raw IRIG time as PCPS_IRIG_TIME, only if _pcps_has_irig_time
#define PCPS_SET_TIME
(-w) Set on-board time, see PCPS_STIME. Returns MBG_ERR_STIME on error.
(r/-) RECEIVER_INFO, rcvr model info, only if PCPS_HAS_RECEIVER_INFO
#define _pcps_ddev_has_irig(_p)
#define IOCTL_DEV_IS_IRIG_RX
(r/-) LAN_IF_INFO, LAN interface info, only if PCPS_HAS_LAN_INTF
#define MBG_SUCCESS
Error codes used with Meinberg devices and drivers.
#define PCPS_GET_IRIG_RX_INFO
(r-) Read IRIG_INFO, only if _pcps_is_irig_rx
#define _mbgddmsg_4(_f, _lvl, _fmt, _p1, _p2, _p3, _p4)
#define IOCTL_SET_PTP_UC_MASTER_SETTINGS_IDX
#define IOCTL_DEV_HAS_PTP
PCI_ASIC_FEATURES asic_features
ASIC feature mask.
#define _pcps_ddev_has_signal(_p)
#define IOCTL_DEV_HAS_GPIO
PCPS_HR_TIME_CYCLES ref_hr_time_cycles
HR time read from the card, plus cycles.
#define _mbg_mmrd32_to_cpu(_iomem_addr)
#define _pcps_ddev_has_fast_hr_timestamp(_p)
(r/w) MBG_TIME_SCALE_SETTINGS / MBG_TIME_SCALE_INFO, only if PCPS_HAS_TIME_SCALE
MBG_PC_CYCLES cyc_after
cycles count after sys time has been read
#define PCPS_GET_IRIG_TX_INFO
(r-) Read IRIG_INFO, only if _pcps_has_irig_tx
#define _pcps_ddev_has_synth(_p)
#define _pcps_ddev_has_tzcode(_p)
#define IOCTL_GET_ALL_GPIO_INFO
#define IOCTL_PCPS_GENERIC_WRITE_GPS
#define _pcps_kfree(_p, _sz)
#define IOCTL_SET_GPS_ANT_CABLE_LEN
#define IOCTL_DEV_HAS_REF_OFFS
#define _pcps_read(_pddev, _cmd, _p, _n)
(r/-) n * PTP_UC_MASTER_INFO_IDX, only if PTP_CFG_MSK_SUPPORT_PTP_UNICAST
uint64_t MBG_PC_CYCLES_FREQUENCY
#define IOCTL_GET_IP4_STATE
#define IOCTL_DEV_HAS_IRIG_CTRL_BITS
#define _pcps_ddev_type_name(_p)
#define _pcps_ddev_has_tz(_p)
#define IOCTL_DEV_HAS_PZF
#define IOCTL_GET_PCPS_HR_TIME
#define PCPS_GET_OPT_INFO
(r-) Read MBG_OPT_INFO, only if _pcps_has_opt_flags
#define IOCTL_GET_XMR_INSTANCES
static __mbg_inline uint8_t _pcps_ddev_read_status_port(const PCPS_DDEV *pddev)
static __mbg_inline uint32_t bin_frac_32_to_dec_frac(uint32_t bin, uint32_t scale)
Convert a 32 bit binary fraction to a scaled decimal.
#define IOCTL_SET_TR_DISTANCE
#define IOCTL_SET_GPS_TIME_SCALE_SETTINGS
#define PCPS_GET_RAW_IRIG_DATA
(r-) Read MBG_RAW_IRIG_DATA, only if _pcps_has_raw_irig_data
#define _pcps_ddev_can_set_time(_p)
(r/w) PORT_PARM, param. of the serial ports, deprecated by PC_GPS_ALL_PORT_INFO
#define _pcps_ddev_has_asic_version(_p)
#define IOCTL_DEV_HAS_PCPS_TZDL
#define IOCTL_SET_PCPS_TZCODE
#define PCPS_GET_SYNTH
(r-) Read SYNTH, only if _pcps_has_synth
#define IOCTL_GET_GPS_ALL_POUT_INFO
#define IOCTL_GET_GPS_RECEIVER_INFO
#define PCPS_SET_PCPS_TZDL
(-w) Write PCPS_TZDL, only if _pcps_has_pcps_tzdl, returns MBG_ERR_CFG on error
#define PCPS_GET_PCPS_TZDL
(r-) Read PCPS_TZDL, only if _pcps_has_pcps_tzdl
#define IOCTL_MBG_DBG_CLR_ALL
#define _pcps_ddev_has_tr_distance(_p)
(r/-) GPS_STAT_INFO, satellite info, mode of operation, and DAC info, only if GPS_MODEL_HAS_STAT_INFO...
#define IOCTL_DEV_HAS_TZCODE
#define IOCTL_GET_PCPS_TIME
Local calendar date and time, plus sync status.
#define IOCTL_DEV_HAS_GPS_TIME_SCALE
#define _pcps_ddev_dev_id(_p)
#define IOCTL_GET_IRQ_STAT_INFO
#define IOCTL_GET_IP4_SETTINGS
#define IOCTL_DEV_HAS_GENERIC_IO
#define IOCTL_SET_GPS_TIME
#define IOCTL_SET_XMR_SETTINGS_IDX
#define PCPS_CLR_EVT_LOG
(-w) Write clear on-board event log, only if _pcps_has_evt_log
A high resolution time stamp.
#define IOCTL_GET_GPS_UTC_PARM
#define _pcps_ddev_is_msf(_p)
#define _pcps_ddev_has_opt_flags(_p)
(r/-) n * XMULTI_REF_INFO_IDX, where n == XMULTI_REF_INSTANCES::n_xmr_settings, only if GPS_HAS_XMULT...
(-/w) PTP_UC_MASTER_SETTINGS_IDX, only if PTP_CFG_MSK_SUPPORT_PTP_UNICAST
#define IOCTL_GET_PCPS_TZDL
#define _pcps_ddev_has_irig_time(_p)
#define IOCTL_DEV_HAS_RECEIVER_INFO
#define _io_write_cmd_chk(_pddev, _cmd, _cond)
#define _io_write_gps_var_chk(_pddev, _cmd, _fld, _pin, _cond)
#define _pcps_ddev_has_mod(_p)
#define IOCTL_DEV_HAS_PTP_UNICAST
#define PCPS_GET_TZCODE
(r-) Read PCPS_TZCODE, only if _pcps_has_tzcode
#define IOCTL_DEV_HAS_XMR
#define _pcps_ddev_is_lwr(_p)
#define _mbg_dbg_clr_all(_d)
#define IOCTL_GET_TIME_INFO_HRT
#define _pcps_ddev_has_utc_parm(_p)
#define _pcps_ddev_is_gps(_p)
#define MBG_ERR_NOT_SUPP_BY_DEV
Command or feature not supported by device.
#define IOCTL_GET_ALL_GPIO_STATUS
#define IOCTL_GET_MAPPED_MEM_ADDR
#define PCPS_NEXT_EVT_LOG_ENTRY
(r-) Read next MBG_EVT_LOG_ENTRY, only if _pcps_has_evt_log
#define PCPS_GIVE_HR_TIME
(r-) Read high res. time as PCPS_HR_TIME, only if _pcps_has_hr_time
#define _pcps_ddev_has_event_time(_p)
#define _mbg_ioremap(_base, _num)
#define IOCTL_SET_GPS_PORT_SETTINGS_IDX
#define IOCTL_MBG_DBG_GET_PORT_ADDR
#define IOCTL_GET_GPS_PORT_PARM
(r/w) n * XMULTI_REF_STATUS_IDX, where n == XMULTI_REF_INSTANCES::n_xmr_settings, one structure on wr...
#define _pcps_ddev_has_lan_intf(_p)
uint32_t out_sz
Size of the output buffer.
#define IOCTL_PCPS_GENERIC_WRITE
(r/-) SW_REV, software revision, deprecated by PC_GPS_RECEIVER_INFO
#define mbg_rc_is_error(_rc)
#define IOCTL_DEV_HAS_TZDL
#define IOCTL_GET_NUM_EVT_LOG_ENTRIES
#define IOCTL_GET_ALL_XMR_STATUS
#define IOCTL_SET_PCPS_IRIG_TX_SETTINGS
#define IOCTL_GET_FIRST_EVT_LOG_ENTRY
#define IOCTL_GET_TR_DISTANCE
unsigned __int64 uint64_t
IOCTL_DEV_FEAT_REQ dev_feat_req
PCPS_DEV dev
Device info data that can be passed to user space.
#define IOCTL_GET_PCPS_DRVR_INFO
#define IOCTL_DEV_HAS_EVENT_TIME
#define _mbg_spin_lock_release(_spl)
(r/-) TTM, user capture events, deprecated by PCPS_GIVE_UCAP_EVENT
int64_t MBG_PC_CYCLES
Generic types to hold PC cycle counter values.
#define IOCTL_GET_GPS_TIME_SCALE_INFO
#define _pcps_ddev_is_ptp(_p)
#define PCPS_GET_DEBUG_STATUS
(r-) Read MBG_DEBUG_STATUS, only if _pcps_has_debug_status
#define _io_wait_pcps_sec_change(_pddev, _cmd, _type, _pout)
#define IOCTL_SET_MBG_OPT_SETTINGS
#define _pcps_ddev_has_time_scale(_p)
#define IOCTL_GET_GPS_ALL_STR_TYPE_INFO
(r/-) ANT_INFO, time diff at sync. after antenna had been disconn., only if GPS_MODEL_HAS_ANT_INFO ...
#define PCPS_GET_CORR_INFO
(r-) Read CORR_INFO structure, only if _pcps_has_pzf
#define IOCTL_GET_LAN_IF_INFO
#define _io_write_var_chk(_pddev, _cmd, _fld, _pin, _cond)
#define _iob_to_pout(_piob, _pout, _size)
#define PCPS_SET_IRIG_TX_SETTINGS
(-w) Write IRIG_SETTINGS, only if _pcps_has_irig_tx, returns MBG_ERR_CFG on error ...
#define PCPS_SET_EVENT_TIME
(-w) Write event time as PCPS_TIME_STAMP, only if _pcps_has_event_time
#define IOCTL_GET_PCPS_TIME_CYCLES
(r/-) n * POUT_INFO_IDX, all programmable output info
#define PCI_ASIC_HAS_MM_IO
Bit masks used with PCI_ASIC_FEATURES.
#define PCPS_GET_IRIG_CTRL_BITS
(r-) Read MBG_IRIG_CTRL_BITS, only if _pcps_has_irig_ctrl_bits
#define _pcps_ddev_has_ptp(_p)
#define _pcps_ddev_has_tzdl(_p)
#define IOCTL_GET_GPS_SW_REV
#define _mbg_spin_lock_acquire(_spl)
#define IOCTL_SET_PCPS_TZDL
#define _pcps_ddev_has_receiver_info(_p)
#define IOCTL_GET_RAW_IRIG_DATA
#define PCPS_SET_REF_OFFS
(-w) Write MBG_REF_OFFS, only if _pcps_has_ref_offs, returns MBG_ERR_CFG on error ...
uint32_t feat_num
Number and range depending on IOCTL_DEV_FEAT_REQ::feat_type value.
#define _pcps_ddev_has_irig_tx(_p)
static __mbg_inline void mbg_get_pc_cycles_frequency(MBG_PC_CYCLES_FREQUENCY *p)
#define _iob_from_pin_var(_iob, _pin)
#define IOCTL_DEV_HAS_TR_DISTANCE
#define _iob_from_pin(_piob, _pin, _size)
#define IOCTL_DEV_HAS_PCI_ASIC_FEATURES
#define _pcps_ddev_has_evt_log(_p)
#define IOCTL_GET_GPS_UCAP
#define IOCTL_PTP_UC_MASTER_CFG_LIMITS
#define IOCTL_GET_PCPS_SERIAL
#define IOCTL_GET_NEXT_EVT_LOG_ENTRY
#define _io_read_var(_pddev, _cmd, _fld, _pout)
Read a standard data structure from a device.
uint32_t feat_type
See DEV_FEAT_TYPES.
#define IOCTL_GET_PTP_STATE
(r/-) n * STR_TYPE_INFO_IDX, names and capabilities of all supp. string types, only if RECEIVER_INFO:...
PCPS_WRITE_FNC pcps_write_gps
Write a large data structure to a device.
#define IOCTL_GET_PCPS_HR_TIME_CYCLES
#define IOCTL_SET_PCPS_EVENT_TIME
#define IOCTL_DEV_HAS_SERIAL_HS