373 #if defined( MBG_TGT_WIN32_PNP ) 378 #elif defined( MBG_TGT_WIN32 ) 379 #include <pcps_ioc.h> 381 #elif defined( MBG_TGT_DOS ) 385 #if defined( MBG_TGT_DOS ) 389 #if defined( MBG_TGT_FREEBSD ) 390 #include <sys/rman.h> 402 #define MBGUSB_MIN_ENDPOINTS_REQUIRED 3 407 #if !defined( REPORT_CFG ) 409 #define REPORT_CFG 10 415 #if !defined( REPORT_CFG_DETAILS ) 416 #if ( REPORT_CFG > 1 ) 417 #define REPORT_CFG_DETAILS 1 419 #define REPORT_CFG_DETAILS 0 423 #define REPORT_CFG_LOG_LVL MBG_LOG_INFO 425 #if !defined( TEST_CFG_DETAILS ) 426 #define TEST_CFG_DETAILS 0 429 #if !defined( USE_CMD_PTR ) 430 #define USE_CMD_PTR 1 433 #if !defined( DEBUG_ACCESS_TIMING ) 435 #if ( defined( DEBUG ) && ( DEBUG >= 10 ) && !defined( MBG_TGT_DOS) ) 436 #define DEBUG_ACCESS_TIMING 0 438 #define DEBUG_ACCESS_TIMING 0 442 #if !defined( DEBUG_IO_TIMING ) 444 #if ( defined( DEBUG ) && ( DEBUG >= 10 ) && !defined( MBG_TGT_DOS) ) 445 #define DEBUG_IO_TIMING 0 // TODO 447 #define DEBUG_IO_TIMING 0 451 #if !defined( DEBUG_IO ) 453 #if ( defined( DEBUG ) && !defined( MBG_TGT_DOS ) ) 460 #if !defined( DEBUG_PORTS ) 462 #define DEBUG_PORTS 1 464 #define DEBUG_PORTS 0 468 #if !defined( DEBUG_SERNUM ) 470 #define DEBUG_SERNUM 1 472 #define DEBUG_SERNUM 0 476 #if !defined( USE_USB_MICRO_FRAMES ) 477 #define USE_USB_MICRO_FRAMES 0 481 #if DEBUG_ACCESS_TIMING > 1 482 #define TEST_PORT_ACCESS 1 484 #define TEST_PORT_ACCESS 0 488 #if REPORT_CFG || defined( DEBUG ) 489 #define MUST_REPORT_PROBE_DEVICE_DETAILS 1 491 #define MUST_REPORT_PROBE_DEVICE_DETAILS 0 494 #if REPORT_CFG || DEBUG_RSRC || DEBUG_IO 495 #define MUST_REPORT_ACCESS_MODE 1 497 #define MUST_REPORT_ACCESS_MODE 0 501 #if defined( MBG_TGT_KERNEL ) || DEBUG_DEV_INIT 502 #define PCPS_LOG_STD_MSGS 1 504 #define PCPS_LOG_STD_MSGS 0 513 #if defined ( MBG_TGT_LINUX ) && defined( MBG_TGT_KERNEL ) 514 #define _do_div( _x, _y ) do_div( _x, _y ) 516 #define _do_div( _x, _y ) do { _x /= _y; } while ( 0 ) 543 #define MAX_BOOT_TIME_PTP270PEX 27 // [s] 546 #if defined( MBG_TGT_BSD ) 549 #define AVOID_REDUNDANT_REDECLARATION 1 557 #if !defined( MBG_TGT_DOS ) && !defined( MBG_TGT_OS2 ) 558 #define _fmemcpy( _d, _s, _n ) memcpy( _d, _s, _n ) 559 #define _fstrlen( _s ) strlen( _s ) 560 #define _fstrncmp( _s1, _s2, _n ) strncmp( (_s1), (_s2), (_n) ) 563 #if defined( MBG_TGT_OS2 ) 564 #define _fstrncmp( _s1, _s2, _n ) _fmemcmp( (_s1), (_s2), (_n) ) 568 #define static_wc static 573 #define FMT_03X "%03X" 574 #define FMT_08X "%08lX" 577 #if defined( MBG_TGT_LINUX ) 584 #if defined( MBG_TGT_LINUX ) 586 #define _pcps_irq_flags \ 587 unsigned long irq_flags; 589 #define _pcps_disb_local_irq_save() \ 590 local_irq_save( irq_flags ) 592 #define _pcps_local_irq_restore() \ 593 local_irq_restore( irq_flags ) 595 #elif defined( MBG_TGT_WIN32 ) 597 #define _pcps_irq_flags \ 600 #define _pcps_disb_local_irq_save() \ 601 KeRaiseIrql( HIGH_LEVEL, &old_irq_lvl ) 603 #define _pcps_local_irq_restore() \ 604 KeLowerIrql( old_irq_lvl ) 612 #if !defined( _pcps_irq_flags ) && \ 613 !defined( _pcps_disb_local_irq_save ) && \ 614 !defined( _pcps_local_irq_restore) 615 #define _pcps_irq_flags 616 #define _pcps_disb_local_irq_save(); 617 #define _pcps_local_irq_restore(); 621 #if defined( MBG_TGT_LINUX ) && defined( time_after ) 622 #define _pcps_time_after( _curr, _tmo ) \ 623 time_after( (unsigned long) _curr, (unsigned long) _tmo ) 625 #define _pcps_time_after( _curr, _tmo ) ( _curr >= _tmo ) 629 #if defined( MBG_TGT_DOS ) || \ 630 defined( MBG_TGT_QNX ) 631 #define MBG_TGT_HAS_UPTIME 0 632 #elif defined( MBG_TGT_FREEBSD ) 636 #define MBG_TGT_HAS_UPTIME 0 638 #define MBG_TGT_HAS_UPTIME 1 728 #if REPORT_CFG || REPORT_CFG_DETAILS 735 #endif // REPORT_CFG || REPORT_CFG_DETAILS 750 #if ( _PCPS_USE_USB || DEBUG_ACCESS_TIMING || DEBUG_IO_TIMING ) 752 static const char str_spc_cyc[] =
" cyc";
753 static const char str_spc_ns[] =
" ns";
774 #endif // ( _PCPS_USE_USB || DEBUG_ACCESS_TIMING || DEBUG_IO_TIMING ) 792 #if defined( MBG_TGT_LINUX ) 814 pci_rc = pci_read_config_dword( pNode, reg, pval );
818 uint32_t mcr_idx_sav = (uint32_t) -1;
879 uint32_t reg_val = (uint32_t) -1;
882 #if defined( MBG_TGT_LINUX ) 884 struct pci_dev *bridge = NULL;
887 while ( ( bridge = pci_get_device( PCI_VENDOR_ID_PLX,
894 pci_name( bridge ) );
898 pci_rc = pci_read_config_byte( bridge, 0x19, &uc );
923 pci_dev_put( bridge );
926 #elif defined( MBG_TGT_WIN32 ) 936 #elif defined( MBG_TGT_DOS ) 938 PLX_DEVICE_NODE dn_bridge = { 0 };
940 pci_rc = mbg_find_plx8311_bridge( pddev->
dev.
cfg.
bus_num, &dn_bridge );
998 #if MBG_TGT_HAS_UPTIME 1013 #if defined( MBG_TGT_WIN32 ) 1019 int l =
sizeof( ws );
1022 n += snprintf( &ws[n], l - n,
"System uptime " );
1024 #if defined( MBG_TGT_LINUX ) 1025 n += snprintf( &ws[n], l - n,
"%llu jiffies -> ",
1026 (
unsigned long long) ( get_jiffies_64() - INITIAL_JIFFIES ) );
1029 n += snprintf( &ws[n], l - n,
"%llu", (
unsigned long long) *p_uptime );
1035 n += snprintf( &ws[n], l - n,
", waiting %i s", waiting );
1038 n += snprintf( &ws[n], l - n,
", OK." );
1046 #endif // MBG_TGT_HAS_UPTIME 1071 bool can_flag_ready;
1085 #if MBG_TGT_HAS_UPTIME 1086 #if !defined( DEBUG ) 1092 if ( can_flag_ready )
1104 if ( uptime == 0 || uptime == -1 )
1130 dt / 1000, ( ( dt < 0 ) ? -dt : dt ) % 1000 );
1157 req_asic_ver_major, req_asic_ver_minor );
1216 #if defined( DEBUG ) 1227 const char *cp = (
const char *) p;
1232 for ( j = 0; j < 4; )
1247 ( ( *cp >=
' ' ) && ( *cp < 0x7F ) ) ? *cp :
'#' );
1259 #endif // defined( DEBUG ) 1277 #if DEBUG_ACCESS_TIMING 1279 static uint32_t debug_dummy_var;
1293 void report_access_timing(
const PCPS_DDEV *pddev,
const char *info,
1296 #define _FMT "%s %s: %" PRIi64 "/%" PRIi64 "%s" 1299 int64_t delta_cyc_read = t_after_reread ? ( t_after_reread - t_after_cmd ) : 0;
1302 info, delta_cyc_write, delta_cyc_read, str_spc_cyc );
1312 info, delta_t_write, delta_t_read, str_spc_ns );
1321 #if TEST_PORT_ACCESS 1335 #define _FMT "%s: %" PRIi64 "%s" 1358 volatile uint32_t dummy_u32;
1366 void test_port_access(
const PCPS_DDEV *pddev )
1395 dummy_u16 = _mbg_inp16( pddev, 0, pddev->
status_port );
1398 report_delta_time(
"16 bit read I/O status port", t1, t2 );
1404 report_delta_time(
"32 bit read I/O status port", t1, t2 );
1407 #if MBG_TGT_SUPP_MEM_ACC 1409 if ( has_mapped_sys_virtual_address( pddev ) )
1423 report_delta_time(
"8 bit read MM status port", t1, t2 );
1429 report_delta_time(
"16 bit read MM status port", t1, t2 );
1435 report_delta_time(
"32 bit read MM status port", t1, t2 );
1446 #endif // TEST_PORT_ACCESS 1448 #endif // DEBUG_ACCESS_TIMING 1468 void report_io_timing(
const PCPS_DDEV *pddev,
const char *info,
1472 #define _FMT_1 "%s %s cmd: 0x%02X (%u bytes)" 1473 #define _FMT_2 "write %" PRIi64 "%s, busy: %" PRIi64 "%s, read: %" PRIi64 "/%" PRIi64 "%s" 1476 int64_t busy_cycles = t_after_busy - t_after_cmd;
1477 int64_t read_cycles = t_done - t_after_busy;
1482 cycles_per_read = read_cycles;
1483 _do_div( cycles_per_read, count );
1490 str_spc_cyc, read_cycles, cycles_per_read, str_spc_cyc );
1503 time_per_read = read_time;
1504 _do_div( time_per_read, count );
1508 str_spc_ns, read_time, cycles_per_read, str_spc_ns );
1511 #if 0 && defined( MBG_TGT_LINUX ) // ### 1513 (
long long) t_after_cmd,
1514 (
long long) t_after_busy,
1515 (
long long) t_done );
1523 #endif // DEBUG_IO_TIMING 1527 #if defined( DEBUG ) 1549 #endif // defined( DEBUG ) 1563 int check_usb_timing(
PCPS_DDEV *pddev )
1569 #if USE_LOCAL_IO_BUFFER 1576 #define _FMT "USB access: %" PRIi64 "%s" 1581 #if defined( DEBUG ) 1596 #if defined( DEBUG ) 1607 pddev->usb_20_mode = delta_t_ns < 1000000
UL;
1609 #if defined( DEBUG ) 1614 #if MUST_REPORT_PROBE_DEVICE_DETAILS 1616 pddev->usb_20_mode ?
str_empty :
" NOT" );
1649 void FAR *buffer,
uint16_t count,
bool is_gps_data )
1654 #if defined( MBG_TGT_WIN32_PNP ) 1655 int this_frame_num_1;
1656 int this_frame_num_2;
1657 LARGE_INTEGER UsbPreCount;
1658 LARGE_INTEGER UsbPostCount;
1661 #if DEBUG_ACCESS_TIMING || DEBUG_IO_TIMING 1686 rc = pcps_direct_usb_write( pddev, &pddev->
cmd_info, transfer_size );
1688 #if DEBUG_ACCESS_TIMING || DEBUG_IO_TIMING 1693 t_after_busy = t_after_cmd;
1698 #if defined( DEBUG ) 1721 if ( buffer == NULL || count == 0 )
1731 #if defined( MBG_TGT_WIN32_PNP ) 1732 #if USE_USB_MICRO_FRAMES 1733 this_frame_num_1 = micro_frame_num_1 ? micro_frame_num_1 : frame_num_1;
1734 this_frame_num_2 = micro_frame_num_2 ? micro_frame_num_2 : frame_num_2;
1736 this_frame_num_1 = frame_num_1;
1737 this_frame_num_2 = frame_num_2;
1740 UsbPreCount = Count1;
1741 UsbPostCount = Count2;
1744 rc = pcps_direct_usb_read( pddev, buffer, count );
1748 #if defined( DEBUG ) 1777 __func__, rc, count );
1783 #if defined( MBG_TGT_WIN32_PNP ) 1787 ULONGLONG usb_latency_cycles;
1788 ULONGLONG cycles_diff;
1789 ULONGLONG time_diff;
1790 ULONGLONG frame_length_cycles;
1791 int FrameNumberDiff;
1793 #if !USE_USB_MICRO_FRAMES 1794 if ( pddev->usb_20_mode )
1799 usb_latency_cycles = ( (ULONGLONG) PerfFreq.QuadPart ) / 20000
UL;
1807 if ( ( this_frame_num_2 - this_frame_num_1 ) < 0 )
1808 FrameNumberDiff = 2;
1810 FrameNumberDiff = this_frame_num_2 - this_frame_num_1;
1812 cycles_diff = (ULONGLONG) ( UsbPostCount.QuadPart - UsbPreCount.QuadPart );
1814 #if USE_USB_MICRO_FRAMES 1815 if ( micro_frame_num_1 > 0 || micro_frame_num_2 > 0 )
1816 frame_length_cycles = (ULONGLONG) ( (ULONGLONG) PerfFreq.QuadPart ) / 8000
UL;
1818 frame_length_cycles = (ULONGLONG) ( (ULONGLONG) PerfFreq.QuadPart ) / 1000
UL;
1820 frame_length_cycles = (ULONGLONG) ( (ULONGLONG) PerfFreq.QuadPart ) / 1000
UL;
1823 if ( ( this_frame_num_1 == 0 ) && ( this_frame_num_2 == 0 ) )
1825 if ( cycles_diff > frame_length_cycles )
1826 usb_latency_cycles = cycles_diff - frame_length_cycles;
1828 usb_latency_cycles = frame_length_cycles - cycles_diff;
1831 usb_latency_cycles = cycles_diff - ( ( FrameNumberDiff - 1 ) * frame_length_cycles );
1833 #if defined( DEBUG ) 1835 cycles_diff, usb_latency_cycles, frame_length_cycles );
1841 #endif // defined( MBG_TGT_WIN32_PNP ) 1846 report_io_timing( pddev, is_gps_data ?
"USB GPS" :
"USB", cmd, count, t_after_cmd, t_after_busy, t_done );
1849 #if DEBUG_ACCESS_TIMING 1850 report_access_timing( pddev,
"USB wr/rd", t_after_cmd, 0 );
1853 #if defined( DEBUG ) 1882 const void FAR *buffer,
uint16_t count,
bool is_gps_data )
1885 int buf_size = ( 2 *
sizeof( cmd ) ) + count;
1921 memcpy( pb, buffer, count );
1922 transfer_bytes += count;
1924 rc = pcps_direct_usb_write( pddev, p, transfer_bytes );
1934 rc = pcps_direct_usb_read( pddev, p, 1 );
1950 #if defined( DEBUG ) 1958 #endif // _PCPS_USE_USB 1962 #if defined( __GNUC__ ) 1985 #if defined( MBG_TGT_BSD ) 1986 struct timeval tv_start;
1988 getmicrouptime( &tv_start );
1992 struct timeval tv_now;
1995 getmicrouptime( &tv_now );
1996 delta_ms = ( ( tv_now.tv_sec - tv_start.tv_sec ) * 1000 )
1997 + ( ( tv_now.tv_usec - tv_start.tv_usec ) / 1000 );
2001 #elif _PCPS_USE_CLOCK_TICK 2072 #if !defined( AVOID_REDUNDANT_REDECLARATION ) 2100 #if DEBUG_ACCESS_TIMING || DEBUG_IO_TIMING 2104 #if DEBUG_ACCESS_TIMING 2124 #if DEBUG_ACCESS_TIMING || DEBUG_IO_TIMING 2128 #if DEBUG_ACCESS_TIMING 2149 for ( i = 0; i < count; i++ )
2164 report_io_timing( pddev,
"STD", cmd, count, t_after_cmd, t_after_busy, t_done );
2167 #if DEBUG_ACCESS_TIMING 2168 report_access_timing( pddev,
"STD wr/rd", t_after_cmd, t_after_reread );
2171 #if defined( DEBUG ) 2179 #if !defined( AVOID_REDUNDANT_REDECLARATION ) 2210 #if DEBUG_ACCESS_TIMING || DEBUG_IO_TIMING 2214 #if DEBUG_ACCESS_TIMING 2240 #if defined( MBG_ARCH_SPARC ) 2244 #if DEBUG_ACCESS_TIMING || DEBUG_IO_TIMING 2248 #if DEBUG_ACCESS_TIMING 2269 for ( i = 0; i < count; i++ )
2285 report_io_timing( pddev,
"S5933", cmd, count, t_after_cmd, t_after_busy, t_done );
2288 #if DEBUG_ACCESS_TIMING 2289 report_access_timing( pddev,
"S5933 wr/rd", t_after_cmd, t_after_reread );
2292 #if defined( DEBUG ) 2300 #if !defined( AVOID_REDUNDANT_REDECLARATION ) 2335 #if DEBUG_ACCESS_TIMING || DEBUG_IO_TIMING 2339 #if DEBUG_ACCESS_TIMING 2358 #if defined( MBG_ARCH_SPARC ) 2362 #if DEBUG_ACCESS_TIMING || DEBUG_IO_TIMING 2366 #if DEBUG_ACCESS_TIMING 2374 dt_quot = count / 4;
2398 for ( i = 0; i < dt_quot; i++ )
2413 for ( i = 0; i < dt_rem; i++ )
2429 report_io_timing( pddev,
"S5920", cmd, count, t_after_cmd, t_after_busy, t_done );
2432 #if DEBUG_ACCESS_TIMING 2433 report_access_timing( pddev,
"S5920 wr/rd", t_after_cmd, t_after_reread );
2436 #if defined( DEBUG ) 2444 #if !defined( AVOID_REDUNDANT_REDECLARATION ) 2482 #if DEBUG_ACCESS_TIMING || DEBUG_IO_TIMING 2486 #if DEBUG_ACCESS_TIMING 2505 + offsetof(
PCI_ASIC, pci_data ), cmd );
2507 #if DEBUG_ACCESS_TIMING || DEBUG_IO_TIMING 2511 #if DEBUG_ACCESS_TIMING 2513 + offsetof(
PCI_ASIC, addon_data ) );
2521 + offsetof(
PCI_ASIC, addon_data );
2522 dt_quot = count / 4;
2540 for ( i = 0; i < dt_quot; i++ )
2547 p +=
sizeof( ar.
ul );
2548 data_port +=
sizeof( ar.
ul );
2556 for ( i = 0; i < dt_rem; i++ )
2569 report_io_timing( pddev,
"ASIC", cmd, count, t_after_cmd, t_after_busy, t_done );
2572 #if DEBUG_ACCESS_TIMING 2573 report_access_timing( pddev,
"ASIC wr/rd", t_after_cmd, t_after_reread );
2576 #if defined( DEBUG ) 2584 #if !defined( AVOID_REDUNDANT_REDECLARATION ) 2622 #if DEBUG_ACCESS_TIMING || DEBUG_IO_TIMING 2626 #if DEBUG_ACCESS_TIMING 2639 #if defined( MBG_ARCH_SPARC ) 2658 #if DEBUG_ACCESS_TIMING || DEBUG_IO_TIMING 2662 #if DEBUG_ACCESS_TIMING 2671 dt_quot = count / 4;
2689 for ( i = 0; i < dt_quot; i++ )
2696 p +=
sizeof( ar.
ul );
2705 for ( i = 0; i < dt_rem; i++ )
2718 report_io_timing( pddev,
"ASIC MM", cmd, count, t_after_cmd, t_after_busy, t_done );
2721 #if DEBUG_ACCESS_TIMING 2722 report_access_timing( pddev,
"ASIC MM wr/rd", t_after_cmd, t_after_reread );
2725 #if defined( DEBUG ) 2733 #if !defined( AVOID_REDUNDANT_REDECLARATION ) 2771 #if DEBUG_ACCESS_TIMING || DEBUG_IO_TIMING 2775 #if DEBUG_ACCESS_TIMING 2803 #if DEBUG_ACCESS_TIMING || DEBUG_IO_TIMING 2807 #if DEBUG_ACCESS_TIMING 2816 dt_quot = count / 2;
2834 for ( i = 0; i < dt_quot; i++ )
2841 p +=
sizeof( ar.
us[0] );
2850 for ( i = 0; i < dt_rem; i++ )
2863 report_io_timing( pddev,
"ASIC MM ww", cmd, count, t_after_cmd, t_after_busy, t_done );
2866 #if DEBUG_ACCESS_TIMING 2867 report_access_timing( pddev,
"ASIC MM ww wr/rd", t_after_cmd, t_after_reread );
2870 #if defined( DEBUG ) 2878 #if !defined( AVOID_REDUNDANT_REDECLARATION ) 2882 #endif // _PCPS_USE_MM_IO 2884 #endif // _PCPS_USE_PCI 2913 rc = pcps_read_usb_generic( pddev, cmd, buffer, count,
false );
2919 #if !defined( AVOID_REDUNDANT_REDECLARATION ) 2923 #endif // _PCPS_USE_USB 2954 rc = pcps_write_usb_generic( pddev, cmd, buffer, count,
false );
2956 #endif // _PCPS_USE_USB 2969 cmd, count, bytes_expected, rc );
2977 if ( bytes_expected != count )
2987 for ( i = 0; i < bytes_expected; i++ )
3011 #if defined( DEBUG ) 3019 #if !defined( AVOID_REDUNDANT_REDECLARATION ) 3057 #if defined( MBG_TGT_DOS ) 3058 #define FP_FMT "%Fp" 3063 " (%u), out_buf " FP_FMT " (%u)",
3064 type, in_buff, in_cnt, out_buff, out_cnt );
3076 if ( tmp_byte != 3 )
3082 type, in_cnt, out_cnt );
3114 tmp_byte = in_cnt - 1;
3116 for ( i = 0; i < tmp_byte; i++ )
3128 bytes_to_read = 2 + out_cnt;
3130 if ( bytes_to_read >
sizeof( data_read ) )
3131 bytes_to_read =
sizeof( data_read );
3135 rc =
_pcps_read( pddev, tmp_byte, data_read, bytes_to_read );
3140 _fmemcpy( out_buff, &data_read[2], out_cnt );
3150 #if defined( DEBUG ) 3186 #if defined( DEBUG ) 3188 "%s: buffer size > 255, but gps_data_16 not supp.", info );
3223 #if defined( DEBUG ) 3225 "%s: failed to read 1 byte after writing cmd code %02X",
3235 if ( pddev->
uc != 1 )
3237 if ( pddev->
uc == 0 )
3243 #if defined( DEBUG ) 3253 #if defined( DEBUG ) 3270 #if defined( DEBUG ) 3278 #if defined( MBG_ARCH_BIG_ENDIAN ) 3288 #if defined( DEBUG ) 3297 if ( pddev->
n_bytes != count )
3301 #if defined( DEBUG ) 3303 info, pddev->
n_bytes, count );
3312 info, pddev->
n_bytes, count );
3356 "pcps_read_gps_block: cmd 0x%02X, block %u (%u), size_n_bytes = %u",
3357 data_type, block_num, block_size, pddev->
size_n_bytes );
3361 count,
"pcps_read_gps_block" );
3368 rc =
_pcps_read( pddev, block_num, buffer, block_size );
3371 #if defined( DEBUG ) 3420 data_type, buffer, count );
3426 rc = pcps_read_usb_generic( pddev, data_type, buffer, count,
true );
3429 #endif // _PCPS_USE_USB 3440 for ( block_num = 0; block_num < dt_quot; block_num++ )
3459 #if defined( DEBUG ) 3467 #if !defined( AVOID_REDUNDANT_REDECLARATION ) 3496 const void FAR *buffer,
3505 data_type, buffer, count );
3511 rc = pcps_write_usb_generic( pddev, data_type, buffer, count,
true );
3514 #endif // _PCPS_USE_USB 3529 count,
"pcps_write_gps" );
3541 for ( i = 0; i < count; i++ )
3564 #if defined( DEBUG ) 3572 #if !defined( AVOID_REDUNDANT_REDECLARATION ) 3595 #if USE_LOCAL_IO_BUFFER 3597 char *cp = tmp_fw_id;
3605 #if !USE_LOCAL_IO_BUFFER 3681 for ( i = 0; i < len; i++ )
3683 if ( idstr[i + 1] ==
'.' )
3685 uint8_t rev_num_hi = idstr[i] & 0x0F;
3686 uint8_t rev_num_lo = ( idstr[i + 2] & 0x0F ) << 4;
3691 char c = idstr[i + 3];
3693 if ( c >=
'0' && c <=
'9' )
3694 rev_num_lo |= c & 0x0F;
3696 return ( rev_num_hi << 8 ) | rev_num_lo;
3720 bool removed =
false;
3722 for ( i = 0, cp = s; i < max_len; i++, cp++ )
3724 if ( ( *cp < 0x20 ) || ( *cp >= 0x7F ) )
3758 for ( i = max_len; ; )
3768 if ( ( *cp >
' ' ) && ( *cp !=
'F' ) )
3780 if ( ( *cp <
'0' ) || ( *cp >
'9' ) )
3794 if ( max_len && ( s[0] == 0 ) )
3796 size_t unkn_len = 8;
3798 if ( max_len > unkn_len )
3801 memset( s,
'?', max_len );
3809 #if MUST_REPORT_PROBE_DEVICE_DETAILS 3856 #endif // MUST_REPORT_PROBE_DEVICE_DETAILS 3877 if ( ( 1
UL << i ) == flag_mask )
3884 #endif // REPORT_CFG 3888 #if REPORT_CFG_DETAILS 3984 #endif // REPORT_CFG_DETAILS 4036 for ( gps_feat_bit = 0; gps_feat_bit <
N_GPS_FEATURE; gps_feat_bit++ )
4038 int supported = ( p_ri->
features & ( 1
UL << gps_feat_bit ) ) != 0;
4051 for ( i = 0; i < 8 *
sizeof( pcps_flags ); i++ )
4052 if ( pcps_flags & ( 1
UL << i ) )
4073 #if REPORT_CFG_DETAILS 4132 memset( p_ri, 0,
sizeof( *p_ri ) );
4187 memset( &ident, 0,
sizeof( ident ) );
4189 #if defined( MBG_TGT_DOS ) 4190 assert(
sizeof( ident ) <
sizeof( pddev->
dev.
cfg.
sernum ) );
4213 for ( i = 0; i <
sizeof( ident ); i += 4 )
4215 (
unsigned) i, ident.
c[i], ident.
c[i+1], ident.
c[i+2], ident.
c[i+3] );
4229 if ( ( *cp <
'0' ) || ( *cp >
'9' ) )
4285 #if REPORT_CFG_DETAILS 4321 #if !defined( MBG_TGT_OS2 ) && !defined( MBG_TGT_BSD ) // TODO 4349 #if REPORT_CFG_DETAILS 4355 #if TEST_CFG_DETAILS 4386 #if REPORT_CFG_DETAILS 4392 #if TEST_CFG_DETAILS 4436 #if _PCPS_USE_RSRCMGR 4464 #if _PCPS_USE_RSRCMGR 4467 #endif // _PCPS_USE_RSRCMGR 4477 #if _PCPS_USE_RSRCMGR 4479 #if defined( MBG_TGT_OS2 ) 4487 void pcps_rsrc_register_device(
PCPS_DDEV *pddev )
4489 #define RSRC_BASE_NAME "RADIOCLK_# Meinberg Radio Clock " 4490 static const char rsrc_type_dcf77[] = RSRC_BASE_NAME
"(DCF77)";
4491 static const char rsrc_type_gps[] = RSRC_BASE_NAME
"(GPS)";
4492 static const char rsrc_type_irig[] = RSRC_BASE_NAME
"(IRIG)";
4499 #error USB not supported for this target environment! 4511 cp = rsrc_type_irig;
4516 cp = rsrc_type_dcf77;
4518 rc = rsrc_register_device( &pddev->hDev, &pddev->rsrc,
n_ddevs - 1, cp, bus_type );
4522 #endif // defined( MBG_TGT_OS2 ) 4524 #endif // _PCPS_USE_RSRCMGR 4561 uint16_t us = ( ( pos & 0x007E ) << 8 ) | 0x0100;
4585 uc = *( ( (
uchar *) (&port) ) + 1 ) & 0x7E;
4587 if ( port & 0x0010 )
4607 rc = mca_fnc_init();
4609 if ( rc != MCA_SUCCESS )
4628 rc = mca_find_adapter( p->
dev_id, &slot_num, &pos_data );
4630 if ( rc != MCA_SUCCESS )
4635 pddev = ddev_init_fnc();
4683 if ( p->
dev_id == dev_id )
4714 #if !_PCPS_STATIC_DEV_LIST 4717 memset( pddev, 0,
sizeof( *pddev ) );
4751 #if !_PCPS_STATIC_DEV_LIST 4762 "Unable to add new device: max count reached" );
4770 memset( pddev, 0,
sizeof( *pddev ) );
4807 #if defined( _mbg_mutex_destroy ) || defined( _mbg_spin_lock_destroy ) 4819 #if defined( _mbg_mutex_destroy ) 4822 #if defined( _mbg_spin_lock_destroy ) 4851 #if defined( _mbg_mutex_destroy ) 4855 #if defined( _mbg_spin_lock_destroy ) 4856 _mbg_spin_lock_destroy( &pddev->tstamp_lock );
4857 _mbg_spin_lock_destroy( &pddev->irq_lock );
4906 #if _PCPS_USE_RSRCMGR 4919 #endif // _PCPS_USE_RSRCMGR 4968 #if _PCPS_USE_RSRCMGR 4981 #endif // _PCPS_USE_RSRCMGR 5027 prsrci->
irq.
num = irq_num;
5080 dev_id, pdt->
name );
5088 #endif // _PCPS_USE_PNP 5116 #if defined( DEBUG ) 5117 const char *cp = NULL;
5127 switch ( feat_type )
5130 #if defined( DEBUG ) 5131 cp =
"builtin_feat";
5143 #if defined( DEBUG ) 5144 cp =
"builtin_feat";
5156 #if defined( DEBUG ) 5169 #if defined( DEBUG ) 5182 #if defined( DEBUG ) 5196 #if defined( DEBUG ) 5210 #if defined( DEBUG ) 5211 cp =
"*invalid* request";
5232 #if _PCPS_USE_USB && !defined( MBG_TGT_WIN32 ) 5254 #if defined( MBG_TGT_LINUX ) 5256 int usb_rc = usb_set_interface( pddev->udev, 0, 0 );
5267 struct usb_host_interface *iface_desc = pddev->intf->cur_altsetting;
5270 pddev->n_usb_ep = 0;
5272 for ( i = 0; i < iface_desc->desc.bNumEndpoints; i++ )
5274 struct usb_endpoint_descriptor *endpoint = &iface_desc->endpoint[i].desc;
5275 PCPS_USB_EP *p_ep = &pddev->ep[i];
5276 p_ep->addr = endpoint->bEndpointAddress;
5277 p_ep->attrib = endpoint->bmAttributes;
5278 p_ep->max_packet_size = le16_to_cpu( endpoint->wMaxPacketSize );
5280 i, p_ep->addr, p_ep->max_packet_size, p_ep->attrib );
5289 #error USB endpoint configuration can not be determined for this target. 5297 #endif // _PCPS_USE_USB && !defined( MBG_TGT_WIN32 ) 5306 pddev->
read = read_fnc;
5317 const char *str_access_mode;
5321 #if MUST_REPORT_ACCESS_MODE 5350 #if PCPS_LOG_STD_MSGS 5353 void report_device_info(
const PCPS_DDEV *pddev )
5378 " has a 20 ms timing bug. Please upgrade the firmware!",
5385 #endif // PCPS_LOG_STD_MSGS 5415 static bool pc_cycles_frequency_read;
5418 int port_ranges_expected = 0;
5419 int mem_ranges_expected = 0;
5426 #if !defined( MBG_TGT_DOS ) 5428 if ( !pc_cycles_frequency_read )
5434 pc_cycles_frequency_read =
true;
5439 #if defined( FORCE_IO_ACCESS ) 5443 #if defined( FORCE_MM16_ACCESS ) 5451 #if MUST_REPORT_PROBE_DEVICE_DETAILS 5463 goto out_fail_generic;
5476 #if !defined( _mbg_mutex_destroy ) 5477 #if defined( _mbg_mutex_init ) 5481 #if !defined( _mbg_spin_lock_destroy ) 5482 #if defined( _mbg_spin_lock_init ) 5497 #if defined( MBG_TGT_LINUX ) && USE_LOCAL_IO_BUFFER 5505 rc = pcps_usb_init( pddev );
5513 if ( pddev->n_usb_ep < MBGUSB_MIN_ENDPOINTS_REQUIRED )
5517 MBGUSB_MIN_ENDPOINTS_REQUIRED );
5519 goto out_fail_generic;
5523 #endif // _PCPS_USE_USB 5527 port_rsrc_len[0] =
sizeof(
PCI_ASIC );
5528 port_ranges_expected = 1;
5529 mem_ranges_expected = 1;
5547 port_rsrc_len[0] = 0;
5548 port_rsrc_len[1] =
sizeof(
PCI_ASIC );
5549 port_ranges_expected = 2;
5565 port_rsrc_len[0] =
sizeof(
PCI_ASIC );
5566 port_ranges_expected = 1;
5575 port_rsrc_len[1] = 16;
5576 port_ranges_expected = 2;
5585 port_ranges_expected = 1;
5595 port_ranges_expected = 1;
5605 goto out_fail_generic;
5618 goto out_fail_generic;
5630 goto out_fail_generic;
5640 + offsetof(
PCI_ASIC, control_status );
5646 goto chip_setup_done;
5698 goto chip_setup_done;
5704 + offsetof(
PCI_ASIC, control_status );
5710 goto chip_setup_done;
5725 goto chip_setup_done;
5746 if ( i >= port_ranges_expected )
5753 if ( prsrc->
num == 0 )
5754 prsrc->
num = port_rsrc_len[i];
5790 goto fail_with_cleanup;
5793 #if 0 && DEBUG //### TODO testing only 5808 #if TEST_PORT_ACCESS 5809 test_port_access( pddev );
5810 #endif // TEST_PORT_ACCESS 5835 goto fail_with_cleanup;
5862 goto fail_with_cleanup;
5869 #if defined( MBG_TGT_OS2 ) 5870 pcps_rsrc_register_device( pddev );
5886 #endif // _PCPS_USE_MM_IO 5889 + offsetof(
PCI_ASIC, raw_version ) );
5895 #if DEBUG_IO || DEBUG_RSRC || REPORT_CFG 6127 goto fail_with_cleanup;
6134 #if PCPS_LOG_STD_MSGS 6135 report_device_info( pddev );
6139 goto fail_with_cleanup;
6152 #endif // _PCPS_USE_MM_IO 6155 + offsetof(
PCI_ASIC, features ) );
6159 #if DEBUG_IO || DEBUG_RSRC || REPORT_CFG 6180 rc = check_usb_timing( pddev );
6185 goto fail_with_cleanup;
6188 #endif // _PCPS_USE_USB 6191 #if DEBUG_IO && defined( MBG_TGT_LINUX ) 6193 #if USE_LOCAL_IO_BUFFER 6200 int sz =
sizeof( *p_t );
6202 memset( p_t, 0, sz );
6251 #if _PCPS_USE_RSRCMGR 6259 #if _PCPS_USE_PCI_BIOS 6303 if ( dw & 0xFFFF0000UL )
6372 if ( new_pci_command != pci_command )
6381 "PCI enable device returned %d", pci_rc );
6405 err_flags = pcps_read_pci_rsrc( bus_num, dev_fnc_num, pddev );
6410 err_flags = pcps_enable_pci_dev( bus_num, dev_fnc_num,
6438 #if defined( MBG_TGT_QNX ) 6439 #if defined( MBG_TGT_QNX_NTO ) 6440 unsigned int pci_handle;
6442 unsigned int pci_hardware_mechanism;
6443 unsigned int pci_last_bus_number;
6444 unsigned int pci_interface_level_version;
6445 #elif defined( MBG_TGT_LINUX ) 6448 uchar pci_hardware_mechanism;
6449 uchar pci_last_bus_number;
6450 ushort pci_interface_level_version;
6456 #ifdef _mbg_pci_fnc_init 6457 rc = _mbg_pci_fnc_init();
6466 &pci_interface_level_version,
6467 &pci_last_bus_number
6474 for ( type_idx = 0; type_idx < n_dev_types; type_idx++ )
6483 for ( dev_idx = 0; ; dev_idx++ )
6486 #if defined( MBG_TGT_QNX ) 6488 unsigned dev_fnc_num;
6495 dev_idx, &bus_num, &dev_fnc_num );
6505 rc = ddev_init_fnc( &pddev );
6509 #if _PCPS_USE_PCI_PNP //##++ 6519 #if !_ACCEPT_UNINITD_CLOCKS 6523 "Remove PCI device: err_flags " FMT_08X "h",
6526 if ( ddev_cleanup_fnc )
6527 ddev_cleanup_fnc( pddev );
6530 (void) ddev_cleanup_fnc;
6537 #ifdef _mbg_pci_fnc_deinit 6538 _mbg_pci_fnc_deinit();
6543 #endif // _PCPS_USE_PCI_BIOS 6547 #if !_PCPS_USE_ISA_PNP 6563 int isa_irqs[PCPS_MAX_ISA_CARDS] )
6565 int *p_port = isa_ports;
6566 int *p_irq = isa_irqs;
6571 if ( p_port == NULL )
6576 i++, p_port++, p_irq ? ( p_irq++ ) : p_irq )
6583 irq_num = p_irq ? *p_irq : -1;
6586 "Check ISA device at port " FMT_03X "h, irq %d",
6591 rc = ddev_init_fnc( &pddev );
6600 if ( irq_num != -1 )
6613 "ISA device not found: err_flags " FMT_08X "h",
6615 if ( ddev_cleanup_fnc )
6616 ddev_cleanup_fnc( pddev );
6622 if ( ddev_register_fnc )
6623 ddev_register_fnc( pddev );
6650 int isa_irqs[PCPS_MAX_ISA_CARDS] )
6652 #if defined( MBG_TGT_OS2 ) 6653 rsrc_register_driver();
6656 #if _PCPS_USE_PCI_BIOS 6662 pcps_detect_mca_devices( ddev_init_fnc );
6665 #if !_PCPS_USE_ISA_PNP 6684 int isa_irqs[PCPS_MAX_ISA_CARDS] )
6690 #endif // !_PCPS_USE_PNP #define N_PCPS_MEM_RSRC
The max number of bus memory resources used by a device.
PCPS_DEV_ID dev_id
see MEINBERG_PCI_DEVICE_IDS and MBG_USB_DEVICE_IDS
#define PCPS_CAN_CLR_UCAP_BUFF
see PCPS_BIT_CAN_CLR_UCAP_BUFF
#define _pcps_ddev_short_port_base(_p, _n)
#define MBG_TLV_FEAT_TYPE_NAMES
Names of TLV API features.
static int pcps_init_gps_transfer(PCPS_DDEV *pddev, uint8_t cmd, uint8_t data_type, uint16_t count, const char *info)
Initialize GPS data transfer.
uint16_t flags
additional information, see RECEIVER_INFO_FLAG_MASKS
#define _pcps_ddev_sernum(_p)
#define BUILTIN_FEAT_GPS180AMC
PCPS_RSRC_INFO rsrc_info
Summary of resources used by the device.
uint8_t n_str_type
max num of string types supported by any port
uint8_t year
year of the century, 0..99
General Purpose I/O control.
uint32_t irq_disb_mask
Bit mask to be cleared to disable IRQs.
#define _pcps_ddev_io_base_raw(_p, _n)
(r/-) IDENT, serial number, deprecated by PC_GPS_RECEIVER_INFO
#define _pcps_fw_rev_num_minor(_v)
MBG_TLV_FEAT_BUFFER supp_tlv_feat
A byte array of supported TLV feature bits, see MBG_TLV_FEAT_TYPES.
#define _mbg_pci_find_device
#define _pcps_ddev_is_mca(_p)
static int setup_mm_addr(PCPS_DDEV *pddev)
Setup the memory mapped addresses depending on the device type.
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 _pcps_fw_rev_num_major(_v)
#define _pcps_ddev_fw_id(_p)
static const char * gps_ri_feature_names[N_GPS_FEATURE]
A table of name strings associated with GPS_FEATURE_BITS.
#define _mbgddmsg_fnc_entry()
#define _mbg_kdd_msg_4(_lvl, _fmt, _p1, _p2, _p3, _p4)
#define _pcps_ddev_is_usb(_p)
#define MAX_PCPS_RSRC
The max number of bus memory and I/O resources used by a device.
int PCPS_WRITE_FNC(PCPS_DDEV *pddev, uint8_t cmd, const void *buffer, uint16_t count)
uint8_t cmd
In case of small data we just need one of the PCPS_CMD_CODES.
#define PCPS_FEAT_MSF51USB
#define _pcps_ddev_has_asic_features(_p)
int mbg_kdd_snprintf(char *buf, size_t size, const char *fmt,...)
uint8_t mday
day of month, 0..31
#define PCPS_IRQ_STAT_UNSAFE
uint8_t sec100
hundredths of seconds, 0..99, 10 ms resolution
#define PCPS_HAS_UCAP
see PCPS_BIT_HAS_UCAP
#define PLX_PECS_GPIOCTL_GPIO3_DATA
#define _pcps_asic_version_major(_v)
Extract the major part of an ASIC version number.
#define _mbg_outp8(_dev, _rsrc_idx, _port_addr, _val)
#define _mbgddmsg_3(_f, _lvl, _fmt, _p1, _p2, _p3)
#define BUILTIN_FEAT_GPS170PCI
static void check_feature(PCPS_DDEV *pddev, ushort req_rev_num, PCPS_FEATURES flag_mask)
Check the firmware to see if a specific feature is supported.
int16_t range
an optional base 10 exponent
#define PCPS_HAS_GPS_DATA_16
see PCPS_BIT_HAS_GPS_DATA_16
static uint32_t ri_feat_tbl[N_GPS_FEATURE]
A table used to map RECEIVER_INFO::features to PCPS_DEV_CFG::features.
#define PCPS_HAS_UTC_PARM
see PCPS_BIT_HAS_UTC_PARM
#define BUILTIN_FEAT_GPS169PCI
MBG_IOPORT_ADDR_RAW base_raw
A raw port base address.
PCPS_ERR_FLAGS err_flags
See PCPS_ERR_FLAG_MASKS.
#define PCPS_HAS_SYNTH
see PCPS_BIT_HAS_SYNTH
#define MAX_PARM_POUT
The max number of programmable pulse outputs supported by configuration programs. ...
void pcps_release_rsrcs(PCPS_DDEV *pddev)
Release I/O port and memory resource that have been claimed before.
PCPS_IRQ_STAT_INFO irq_stat_info
#define REV_HAS_CABLE_LEN_GPS167PCI
#define REV_HAS_IRQ_FIX_MINOR_GPS170PEX
#define _pcps_time_after(_curr, _tmo)
PCPS_BUS_FLAGS bus_flags
see PCPS_BUS_FLAG_MASKS
feat_num field contains one of the GPS_FEATURE_BITS
void rsrc_dealloc_mem(ulong start, ulong len)
Release a memory resource range which has been allocated before.
#define MBG_ERR_NO_DATA
The device's data output data buffer is empty, though it shouldn't be.
(r/-) MBG_TLV_INFO, only if MBG_XFEATURE_TLV_API
#define REV_HAS_UCAP_GPS167PCI
#define PCPS_FEAT_GPS169PCI
#define PCPS_FEAT_FRC511PEX
char epld_name[(8+1)]
ASCIIZ, file name of EPLD image (optional)
Number of defined extended features.
uint32_t flags
Future use.
A timestamp with nanosecond resolution, but 64 bit size.
char name[(16+1)]
Optional string identifying a customized firmware version, should be empty in standard versions...
#define MBG_ERR_INV_PARM
Invalid parameter.
#define BUILTIN_FEAT_TCR170PEX
static void report_access_mode(const PCPS_DDEV *pddev)
#define REV_HAS_IRQ_FIX_MINOR_TCR511PEX
ulong MBG_IOPORT_ADDR_MAPPED
PCPS_READ_FNC pcps_read_null
#define _mbg_pci_write_cfg_word
uint32_t ticks_per_sec
resolution of fractions of seconds, see GPS_TICKS_PER_SEC
#define _mbgddmsg_fnc_exit_err()
static bool str_remove_unprintables(char *s, size_t max_len)
Remove unprintable characters from a string.
#define PCPS_FEAT_GPS180AMC
#define PCI_VENDOR_MEINBERG
#define _pcps_ddev_io_base_mapped(_p, _n)
Supports the GPS_SAVE_CFG command.
uint32_t reserved
Future use.
static __mbg_inline void mbg_get_pc_cycles(MBG_PC_CYCLES *p)
#define MAX_PARM_PORT
The max number of serial ports supported by configuration programs.
int rsrc_alloc_mem(ulong start, ulong len)
Try to allocate a memory resource range.
#define _pcps_ddev_ref_type(_p)
#define MBG_DEV_NAME_FMT
A string format specifier for MBG_DEV_NAME.
uint8_t n_channels
number of satellites which can be tracked simultaneously
#define _mbg_kdd_msg_3(_lvl, _fmt, _p1, _p2, _p3)
uint32_t irq_flag_mask
Bit mask used to check if device has generated an IRQ.
#define PCPS_FEAT_GPS170PCI
#define _pcps_ddev_is_pci(_p)
PCPS_WRITE_FNC pcps_write
Write data to a device.
#define _pcps_ddev_type_num(_p)
#define PCPS_FEAT_TCR510PCI
Resource info summary for a device.
#define _mbgddmsg_fnc_exit_success()
#define _MBG_INIT_CODE_ATTR
#define PCI_CMD_ENB_MEM_ACC
#define PCI_CS_INTERRUPT_LINE
MBG_IOPORT_ADDR_MAPPED irq_ack_port
Address of the register to acknowledge an IRQ.
static __mbg_inline void mbg_get_sys_uptime(MBG_SYS_UPTIME *p)
#define PCPS_GIVE_FW_ID_1
(r-) Read first PCPS_FIFO_SIZE chars of firmware ID
feat_num field contains one of the PCPS_FEATURE_BITS
static __mbg_inline void mbg_get_sys_time(MBG_SYS_TIME *p)
#define PCPS_HAS_HR_TIME
see PCPS_BIT_HAS_HR_TIME
static bool pcps_check_pex_irq_unsafe(PCPS_DDEV *pddev, uint16_t req_fw_ver, uint8_t req_asic_ver_major, uint8_t req_asic_ver_minor)
Check if IRQ usage with a device is unsafe.
#define _pcps_ddev_is_pci_asic(_p)
void pcps_cleanup_ddev(PCPS_DDEV *pddev)
Clean up and free a previously initialized device info structure.
#define PCPS_CAN_SET_TIME
Feature bit masks for bus-level devices.
static __mbg_inline void mbg_unmap_ioport_rsrc(MBG_IOPORT_RSRC *p)
Unmap an I/O port resource to release the virtual address.
#define _pcps_ddev_access_mode_io(_p)
#define MBG_ERR_GENERIC
Generic error.
#define _mbgddmsg_0(_f, _lvl, _fmt)
RI_FEATURES features
optional features, see GPS_FEATURE_MASKS
int pcps_init_ddev(PCPS_DDEV **ppddev)
Allocate and initialize a device info structure.
#define mbg_rc_is_success(_rc)
#define BUILTIN_FEAT_WWVB511
#define _pcps_ddev_pci_fnc_num(_p)
PCPS_READ_FNC pcps_read_gps
Read a large data structure from a device.
#define _pcps_ddev_fw_rev_num(_p)
feat_num field contains one of the GPS_BUILTIN_FEATURE_BITS
#define _pcps_ddev_features(_p)
static void report_probe_device(const PCPS_DDEV *pddev)
#define PCI_ASIC_FIX_IRQ_MINOR_TCR511PEX
#define MBG_ERR_NOT_READY
Bus-level device is temp. unable to respond e.g. during init. after RESET.
MBG_IOMEM_ADDR_MAPPED start_mapped
A mapped I/O memory start address.
#define PCPS_WRITE_GPS_DATA
(-w) Write large data structure, see PC_GPS_CMD_CODES
#define PCPS_FEAT_GPS180PEX
IRIG TX only supp. if GPS_HAS_IRIG_TX.
#define PCPS_FEAT_MSF600USB
uint8_t n_com_ports
number of on-board serial ports
PCI_ASIC_ADDON_DATA addon_data
Register set used to return data from add-on to PCI bus.
feat_num field contains one of the MBG_TLV_FEAT_TYPES
A structure used to store extended device features.
#define PCPS_HAS_CABLE_LEN
see PCPS_BIT_HAS_CABLE_LEN
Memory layout of Meinberg PCI interface register.
#define _pcps_ddev_is_irig_rx(_p)
#define _mbg_spin_lock_init(_spl, _n)
#define PCPS_ID_SIZE
The maximum length of an ID string, including terminating 0.
#define PCPS_EF_IO_INIT
I/O interface not initialized.
PCPS_DEV_TYPE pcps_dev_type[N_PCPS_DEV_TYPE]
#define _mbgddmsg_5(_f, _lvl, _fmt, _p1, _p2, _p3, _p4, _p5)
uint32_t PCPS_FEATURES
see PCPS_FEATURE_MASKS
#define PCPS_EF_TIMEOUT
Possible device initialization error flags.
#define PCI_ASIC_HR_TIME_MINOR_PEX511
ulong num
Number of addresses in this range.
static void dump_tlv_info(const PCPS_DDEV *pddev)
int pcps_add_rsrc_mem(PCPS_DDEV *pddev, MBG_IOMEM_ADDR_RAW start, ulong len)
Add a memory address range resource to the device structure.
static void dump_receiver_info(const PCPS_DDEV *pddev)
#define _pcps_ddev_fw_has_20ms_bug(_p)
int num_rsrc_io
Number of actually assigned I/O address ranges.
PCI_ASIC_FEATURES features
PCI ASIC feature mask, see PCI_ASIC_FEATURE_MASKS.
#define BUILTIN_FEAT_GPS180PEX
#define PCPS_EF_IO_ENB
I/O interface not enabled.
#define PCPS_HAS_LAN_INTF
see PCPS_BIT_HAS_LAN_INTF
#define PCPS_ACCESS_MODE_STRS
Device access mode info strings.
static bool ptp270pex_can_flag_ready(const PCPS_DDEV *pddev)
Check if a PTP270PEX card can indicate when it's ready.
static void set_access_mode(PCPS_DDEV *pddev, uint mode, bool forced, PCPS_READ_FNC *read_fnc)
static int pcps_check_id(PCPS_DDEV *pddev, const char FAR *ref)
Check an ASCIIZ string for a valid signature.
#define _mbg_inp32_native(_dev, _rsrc_idx, _port_addr)
PCPS_FEATURES features
See PCPS_FEATURE_MASKS.
#define PCPS_NUM_PORTS_MCA
The total number of ports acquired by an MCA device.
#define PCPS_FEAT_PC31PS31
#define PLX_LCS_INTCSR_INT_FLAG
#define _pcps_ddev_set_err_flags(_p, _msk)
#define _pcps_local_irq_restore()
number of defined ref time sources
#define _pcps_ddev_access_mode_mm(_p)
PCPS_FW_REV_NUM fw_rev_num
static void report_ret_val(int rc, const char *info)
Report the return code to be returned by a function.
#define PCPS_HAS_SERIAL
see PCPS_BIT_HAS_SERIAL
#define PCI_CS_BASE_ADDRESS_0
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 num_rsrc_irq
Number of actually assigned IRQ numbers.
#define PCPS_GENERIC_IO
(rw) See pcps_generic_io or _mbgdevio_gen_io
#define AMCC_OP_REG_RANGE_S5933
#define REV_HAS_IRIG_TIME_TCR511PEX
#define _mbg_kdd_msg_1(_lvl, _fmt, _p1)
#define _mbgddmsg_1(_f, _lvl, _fmt, _p1)
MBG_XDEV_FEATURES xdev_features
Receiver info plus extended device features.
uint16_t model_code
identifier for receiver model, see GPS_MODEL_CODES
A PCI ASIC register as 32, 16, or 8 bit accessible union.
char sernum[(16+1)]
ASCIIZ, serial number.
static void dump_xfeature_buffer(const PCPS_DDEV *pddev)
#define PCI_DEVICE_ID_PLX_8111
PCPS_READ_FNC * read
Pointer to the read function depending on the access mode.
MBG_PC_CYCLES acc_cycles
Cycles count taken when device was accessed last time.
#define MAX_XFEATURE_BITS
The maximum number of feature bits supported by the MBG_XFEATURE API.
32 bit memory mapped access
#define _check_feat_supp_bit(_supp_msk, _bit_num)
Check if a bits with a specific number is set in an integer bit mask.
#define _mbg_mutex_destroy(_pm)
No real I/O, dummy routine used.
#define MBG_ERR_INV_TYPE
Bus-level device didn't recognize data type.
#define REV_HAS_IRQ_FIX_MINOR_PEX511
#define PCPS_FIFO_SIZE
The size of a bus level device's command/data FIFO.
Register layout of a PCI ASIC.
#define _setup_default_receiver_info_dcf(_p, _pdev)
Initialize a RECEIVER_INFO structure for legacy DCF77 receivers.
#define AMCC_OP_REG_INTCSR
#define MBG_ERR_TIMEOUT
Timeout accessing the device.
A structure used to query current TLV capabilities.
MBG_IOMEM_RSRC mem[2]
Info on actually assigned memory ranges.
#define PCPS_HAS_FAST_HR_TSTAMP
see PCPS_BIT_HAS_FAST_HR_TSTAMP
int rsrc_alloc_ports(ulong port, ulong n)
Try to allocate an I/O port resource range.
PCI_ASIC_VERSION asic_version
ASIC version.
uint64_t MBG_IOMEM_ADDR_RAW
MBG_XFEATURE_BUFFER xfeature_buffer
Extended features provided by the device.
#define PCPS_GIVE_SERNUM
(r-) Read serial number as PCPS_SN_STR, only if _pcps_has_sernum
#define PCPS_HAS_TIME_SCALE
see PCPS_BIT_HAS_TIME_SCALE
#define PCPS_HAS_SYNC_TIME
see PCPS_BIT_HAS_SYNC_TIME
#define _fstrncmp(_s1, _s2, _n)
#define _set_xfeature_bit(_xf_bit, _xf_buffp)
Set an extended feature bit in a MBG_XFEATURE_BUFFER.
#define PCPS_NUM_PORTS_ISA
The total number of I/O ports used by an ISA bus device.
#define _pcps_read_var(_pddev, _cmd, _s)
uint32_t irq_enb_mask
Bit mask to be set to enable IRQs.
static __mbg_inline long mbg_delta_sys_time_ms(const MBG_SYS_TIME *t2, const MBG_SYS_TIME *t1)
Compute delta between two MBG_SYS_TIME times, in milliseconds.
#define PCPS_FEAT_GPS170PEX
#define PCI_ASIC_FIX_IRQ_MINOR_PEX511
#define _mbg_kdd_msg_5(_lvl, _fmt, _p1, _p2, _p3, _p4, _p5)
static const char str_unkn_braced[]
#define REV_HAS_SYNC_TIME_PC31PS31
#define _mbgddmsg_fnc_exit()
#define _mbg_pci_find_bios
MBG_TLV_INFO tlv_info
TLV info provided by a device.
static int pcps_get_fw_id(PCPS_DDEV *pddev, PCPS_ID_STR FAR fw_id)
Read the firmware ID from a device.
uint8_t n_ucaps
number of user time capture inputs
#define _pcps_ddev_chk_err_flags(_p, _msk)
int PCPS_READ_FNC(PCPS_DDEV *pddev, uint8_t cmd, void *buffer, uint16_t count)
#define PCPS_BUS_ISA
IBM compatible PC/AT ISA bus.
static int irq[PCPS_MAX_ISA_CARDS]
#define _pcps_ddev_has_hr_time(_p)
Main Control Register index.
static const char * pcps_feature_names[N_PCPS_FEATURE_BITS]
A table of name strings associated with PCPS_FEATURE_BITS.
#define PCPS_GIVE_TIME
Command codes used to communicate with bus level devices.
#define _pcps_ddev_is_isa(_p)
#define PCPS_BUS_PCI_S5933
Interrupt control / status.
void pcps_cleanup_device(PCPS_DDEV *pddev)
Clean up function called by pcps_probe_device on error.
#define PCPS_FEAT_GPS168PCI
bool access_mode_forced
Flag indicating that the access mode was forced.
#define REV_HAS_UTC_OFFS_PC31PS31
#define REV_HAS_UCAP_GPS168PCI
static void check_ri_features(PCPS_DDEV *pddev)
Check the receiver info features to see if a specific feature is supported.
#define _pcps_asic_version_greater_equal(_v, _v_major, _v_minor)
Check whether a version number is correct and matches a required minimum version. ...
#define AMCC_OP_REG_RANGE_S5920
void pcps_dump_data(const void *buffer, size_t count, const char *info)
#define BUILTIN_FEAT_TCR167PCI
#define PCPS_HAS_RAW_IRIG_DATA
see PCPS_BIT_HAS_RAW_IRIG_DATA
#define _pcps_ddev_pci_slot_num(_p)
static bool ptp270pex_has_flagged_ready(const PCPS_DDEV *pddev)
Check if a PTP270PEX card indicates it is ready.
PCI_ASIC_VERSION raw_asic_version
Raw ASIC version.
#define PCPS_FEAT_WVB600USB
PCI_ASIC volatile __iomem * mm_asic_addr
#define _pcps_ddev_has_ident(_p)
#define PCPS_FEAT_TCR511PEX
#define PCPS_FEAT_TCR170PEX
#define N_PCPS_PORT_RSRC
The max. number of I/O port resources used by a clock.
PCPS_TIME_STAMP volatile __iomem * mm_tstamp_addr
#define BUILTIN_FEAT_GPS167PC
#define PCPS_FEAT_TCR167PCI
uint16_t num
The IRQ number.
#define _mbg_inp8(_dev, _rsrc_idx, _port_addr)
#define _pcps_ddev_slot_num(_p)
#define MAX_MBG_TLV_FEAT_TYPES
The maximum number of TLV feature types.
#define PCPS_FEAT_GLN180PEX
#define _pcps_ddev_is_pci_amcc(_p)
PCPS_DEV_TYPE * pcps_get_dev_type_table_entry(PCPS_BUS_FLAGS bus_mask, PCPS_DEV_ID dev_id)
Lookup a specific device in the device table.
support eXtended features, see Extended feature definitions
#define BUILTIN_FEAT_PZF180PEX
int num_rsrc_mem
Number of actually assigned memory address ranges.
#define _pcps_ddev_irq_num(_p)
int PCPS_DDEV_REGISTER_FNC(PCPS_DDEV *pddev)
MBG_IOPORT_RSRC port[2]
Info on actually assigned port ranges.
MBG_IOPORT_ADDR_MAPPED status_port_offs
char PCPS_ID_STR[(2 *16+1)]
A buffer for an ID string, including terminating 0.
#define PCPS_HAS_EVENT_TIME
see PCPS_BIT_HAS_EVENT_TIME
#define PCPS_BUS_PCI_MBGPEX
MBG_IOPORT_ADDR_MAPPED base_mapped
A mapped port base address.
void pcps_detect_pci_devices(PCPS_DDEV_INIT_FNC *ddev_init_fnc, PCPS_DDEV_CLEANUP_FNC *ddev_cleanup_fnc, ushort vendor_id, PCPS_DEV_TYPE dev_type[], int n_dev_types)
Detect and initialize PCI devices in a non-PnP system.
#define _mbg_mmrd32_native(_iomem_addr)
#define PCPS_HAS_PTP
see PCPS_BIT_HAS_PTP
uint8_t osc_type
type of installed oscillator, see GPS_OSC_TYPES
#define _pcps_ddev_mem_rsrc(_p, _n)
int8_t offs_utc
[hours], 0 if not _pcps_has_utc_offs
An I/O port resource used by a device.
static int pcps_alloc_ddev_struc(PCPS_DDEV **ppddev)
Allocate a device info structure for a device.
#define BUILTIN_FEAT_UNDEFINED
Feature mask used for legacy devices.
#define REV_HAS_IRIG_CTRL_BITS_TCR51USB
#define _mbgddmsg_fnc_exit_chk_mbg_rc(_rc)
BUILTIN_FEATURE_MASK builtin_features
Mask of builtin features, depending on device type.
PCI_ASIC_REG status_port
The status port register.
#define MBG_ERR_NO_MEM
Failed to allocate memory.
void mbg_gps_ident_decode(char *s, const IDENT *p_id)
#define PCPS_FEAT_USB5131
PCPS_READ_FNC pcps_read_asic
#define PCPS_EF_IO_RSRC_MEM
Memory resource not registered with resource manager.
#define _pcps_kmalloc(_sz)
static __mbg_inline int pcps_ddev_is_ptp270pex(const PCPS_DDEV *pddev)
Check if a device is a PTP270PEX card.
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 REV_HAS_RAW_IRIG_DATA_TCR511PCI
(r/-) RECEIVER_INFO, rcvr model info, only if PCPS_HAS_RECEIVER_INFO
#define PCPS_GIVE_FW_ID_2
(r-) Read last PCPS_FIFO_SIZE chars of firmware ID
FIXED_FREQ_INFO fixed_freq
optional non-standard fixed frequency, may be 0 if not supported
#define _pcps_ddev_asic_version(_p)
#define _pcps_ddev_err_flags(_p)
uint8_t osc_flags
oscillator flags, actually not used and always 0
#define PCI_BAD_REGISTER_NUMB
#define MBG_SUCCESS
Error codes used with Meinberg devices and drivers.
#define _mbgddmsg_4(_f, _lvl, _fmt, _p1, _p2, _p3, _p4)
#define REV_HAS_HR_TIME_TCR510PCI
static __mbg_inline int mbg_map_ioport_rsrc(MBG_IOPORT_RSRC *p)
Map an I/O port resource to get a virtual address.
#define PCI_CMD_ENB_IO_ACC
#define PCPS_FEAT_GNS181PEX
PCI_ASIC_FEATURES asic_features
ASIC feature mask.
#define PCPS_HAS_IRIG_TX
see PCPS_BIT_HAS_IRIG_TX
#define _mbg_mmrd32_to_cpu(_iomem_addr)
static void rsrc_port_to_cfg_port(PCPS_SHORT_PORT_RSRC *p_short_port_rsrc, const MBG_IOPORT_RSRC *p_io_rsrc)
Convert a raw I/O base address to a short format.
Supports generic TLV API, see Meinberg TLV API definitions.
#define _set_tlv_feat_bit(_tlv_feat_type, _tlv_feat_buffp)
Set a TLV context type bit in a MBG_TLV_FEAT_BUFFER.
#define _mbgddmsg_2(_f, _lvl, _fmt, _p1, _p2)
static int pcps_check_gps_data_size(PCPS_DDEV *pddev, uint16_t count, const char *info)
Determine which interface buffer size is supported.
#define PCPS_BUS_MCA
IBM PS/2 micro channel.
static void report_uptime(const MBG_SYS_UPTIME *p_uptime)
Report the system uptime.
PCPS_READ_FNC pcps_read_std
#define BUILTIN_FEAT_PTP270PEX
#define PCPS_FEATURE_NAMES
#define PCPS_FEAT_TCR51USB
PCPS_READ_FNC pcps_read_amcc_s5933
#define _mbg_mutex_init(_pm, _n)
#define _pcps_kfree(_p, _sz)
static MBG_PC_CYCLES_FREQUENCY pc_cycles_frequency
Clock frequency of the PC's cycles counter, in [Hz].
static const char * get_pcps_feature_name(PCPS_FEATURES flag_mask)
Get the name assigned to one of the PCPS_FEATURE_MASKS flags.
16 bit memory mapped access
void check_receiver_info_and_features(PCPS_DDEV *pddev)
Check the receiver info and features.
(r/-) MBG_XFEATURE_BUFFER, only if GPS_HAS_XFEATURE
#define _mbg_kdd_msg_7(_lvl, _fmt, _p1, _p2, _p3, _p4, _p5, _p6, _p7)
#define _pcps_read(_pddev, _cmd, _p, _n)
uint64_t MBG_PC_CYCLES_FREQUENCY
#define PLX_LCS_CNTRL_USERI
MBG_IOPORT_ADDR_MAPPED irq_enb_disb_port
Address of the IRQ control register.
#define BUILTIN_FEAT_FRC511PEX
#define REPORT_CFG_LOG_LVL
#define REV_HAS_CABLE_LEN_GPS167PC
#define _mbg_kdd_msg_0(_lvl, _fmt)
#define PCPS_FEAT_PZF180PEX
#define REV_HAS_HR_TIME_PEX511
uint access_mode
Access mode used for the device, depending on interface type. See PCPS_ACCESS_MODES.
#define _pcps_ddev_type_name(_p)
static int mbg_plx_read_pecs_reg(struct pci_dev *pNode, uint16_t reg, uint32_t *pval)
Read a dword from a PLX PECS register.
static __mbg_inline MBG_PC_CYCLES mbg_delta_pc_cycles(const MBG_PC_CYCLES *p1, const MBG_PC_CYCLES *p2)
#define _mbg_inp32_to_cpu(_dev, _rsrc_idx, _port_addr)
#define _mbg_mmwr32_to_mbg(_iomem_addr, _val)
#define _pcps_ddev_is_pci_pex8311(_p)
Device type specification.
#define _pcps_ddev_io_rsrc(_p, _n)
I/O port resource information for a device.
#define _pcps_ddev_bus_flags(_p)
static const char * get_bus_type_str(const PCPS_DDEV *pddev)
#define _pcps_pex_irq_is_safe(_curr_fw_ver, _req_fw_ver, _curr_asic_ver, _req_asic_ver_major, _req_asic_ver_minor)
#define _fmemcpy(_d, _s, _n)
static __mbg_inline uint8_t _pcps_ddev_read_status_port(const PCPS_DDEV *pddev)
#define _mbg_pci_read_cfg_byte
PCPS_READ_FNC pcps_read_amcc_s5920
ulong MBG_IOPORT_ADDR_RAW
#define BUILTIN_FEAT_TCR180USB
#define _setup_default_receiver_info_gps(_p)
Initialize a RECEIVER_INFO structure for legacy GPS receivers.
#define PCI_DEV_PTP270PEX
RECEIVER_INFO receiver_info
Receiver info provided by the device.
#define REV_CAN_CLR_UCAP_BUFF_GPS168PCI
#define REV_HAS_HR_TIME_PCI511
#define PCPS_BUS_PCI_S5920
#define REV_CAN_CLR_UCAP_BUFF_GPS167PCI
High resolution time including status and local time offset.
int pcps_probe_device(PCPS_DDEV *pddev, PCPS_BUS_NUM bus_num, PCPS_SLOT_NUM dev_fnc_num)
Probe if a device is supported, and allocate and setup the device structure.
#define REV_CAN_SET_TIME_PC31PS31
static __mbg_inline int mbg_map_iomem_rsrc(MBG_IOMEM_RSRC *p)
Map I/O memory resource to get a virtual address.
static PCPS_FW_REV_NUM pcps_get_rev_num(char FAR *idstr)
Retrieve a version number from a firmware ID string.
#define _pcps_ddev_has_asic_version(_p)
uint16_t code
Version number, e.g. 0x0120 means v1.20.
#define REV_HAS_RAW_IRIG_DATA_TCR511PEX
#define MBG_ERR_RSRC_ITEM
Too many resource items.
Main Control Register data.
#define REV_HAS_HR_TIME_GPS167PC
#define _pcps_write_byte(_pddev, _b)
#define REV_HAS_IRIG_CTRL_BITS_TCR511PEX
static int pcps_read_gps_block(PCPS_DDEV *pddev, uint8_t data_type, void FAR *buffer, uint16_t count, uint8_t block_num, uint8_t block_size)
Get a block of data from a GPS device.
#define MAX_BOOT_TIME_PTP270PEX
Max. time required for PTP270PEX v1 card to be ready after power-up.
#define _mbg16_to_cpu(_x)
#define PCI_ASIC_PCI_IRQF
PCI IRQ flag.
#define BUILTIN_FEAT_TCR180PEX
static void check_unknown_sernum(char *s, size_t max_len)
#define BUILTIN_FEAT_GNS181PEX
union PCPS_DDEV_s::@9 cmd_info
#define PCPS_FEAT_PTP270PEX
#define _pcps_ddev_sernum_size(_p)
#define REV_HAS_IRIG_CTRL_BITS_TCR511PCI
static const char str_spc_gps[]
int pcps_setup_ddev(PCPS_DDEV *pddev, PCPS_BUS_FLAGS bus_mask, PCPS_DEV_ID dev_id)
Initialize an allocated device structure for a specific device.
static __mbg_inline void mbg_unmap_iomem_rsrc(MBG_IOMEM_RSRC *p)
Unmap an I/O memory resource to release the virtual address.
PCPS_SIG_VAL signal
signal strength, see PCPS_SIG_VAL_DEFS
uint32_t PCPS_ERR_FLAGS
see PCPS_ERR_FLAG_MASKS
Local calendar date and time, plus sync status.
int pcps_add_rsrc_io(PCPS_DDEV *pddev, MBG_IOPORT_ADDR_RAW base, ulong num)
Add an I/O address range resource to the device structure.
#define _mbg_outp32_to_mbg(_dev, _rsrc_idx, _port_addr, _val)
#define REV_HAS_GPS_DATA_16_GPS169PCI
#define _pcps_ddev_dev_id(_p)
PCI_ASIC_VERSION raw_version
Raw version code.
#define _tlv_info_addr(_p)
#define _pcps_ddev_bus_num(_p)
static void report_io_cmd(uint8_t cmd, uint16_t count, const char *info)
static __mbg_inline void mbg_sleep_sec(long sec)
#define PCPS_HAS_EVT_LOG
see PCPS_BIT_HAS_EVT_LOG
feat_num field contains one of the MBG_XFEATURE_BITS
#define _tlv_feat_buffp(_p)
void _MBG_INIT_CODE_ATTR pcps_detect_devices(int isa_ports[PCPS_MAX_ISA_CARDS], int isa_irqs[PCPS_MAX_ISA_CARDS])
Detect all bus-level devices in a non-PnP system.
#define PCPS_HAS_IRIG_TIME
see PCPS_BIT_HAS_IRIG_TIME
struct PCPS_DDEV_s::@9::@10 gps_cmd_info
#define PCPS_ACCESS_MODE_STR_FRCD
String to append if access mode has been forced.
#define PCPS_BUS_PCI_ASIC
MBG_IOPORT_ADDR_MAPPED status_port
Address of the status port register.
#define _pcps_ddev_has_sernum(_p)
uint8_t n_prg_out
number of programmable pulse outputs
static const char str_empty[]
ulong len
Number of addresses in this range.
#define PCPS_FEAT_WWVB51USB
#define _pcps_ddev_is_gps(_p)
#define MBG_ERR_NOT_SUPP_BY_DEV
Command or feature not supported by device.
#define PCPS_GIVE_HR_TIME
(r-) Read high res. time as PCPS_HR_TIME, only if _pcps_has_hr_time
static void _MBG_INIT_CODE_ATTR pcps_detect_devices_init(PCPS_DDEV_INIT_FNC *ddev_init_fnc, PCPS_DDEV_CLEANUP_FNC *ddev_cleanup_fnc, int isa_ports[PCPS_MAX_ISA_CARDS], int isa_irqs[PCPS_MAX_ISA_CARDS])
_PCPS_USE_ISA_PNP
#define _mbg_mmrd16_native(_iomem_addr)
#define _pcps_ddev_timeout_clk(_p)
__mbg_inline int pcps_wait_busy(PCPS_DDEV *pddev)
Wait as long as a device is busy, or until timeout.
#define PCI_ASIC_FIX_IRQ_MINOR_GPS170PEX
char model_name[(16+1)]
ASCIIZ, name of receiver model.
#define PCPS_HAS_UTC_OFFS
see PCPS_BIT_HAS_UTC_OFFS
feat_num field contains one of the PCPS_REF_TYPES
#define PCPS_MAX_ISA_CARDS
#define PLX_LCS_INTCSR_INT_ENB
#define _pcps_disb_local_irq_save()
uint32_t irq_ack_mask
Bit mask to be set to acknowledge an IRQ.
#define BUILTIN_FEAT_GPS170PEX
MBG_IOMEM_ADDR_RAW start_raw
A raw I/O memory start address.
#define mbg_rc_is_error(_rc)
uint8_t min
minutes, 0..59
#define _mbg_pci_read_cfg_word
#define _convert_asic_version_number(_n)
Version number conversion macro.
#define BUILTIN_FEAT_GPS167PCI
MBG_IRQ_RSRC irq
Info on actually assigned IRQ numbers.
void pcps_detect_isa_devices(PCPS_DDEV_INIT_FNC *ddev_init_fnc, PCPS_DDEV_CLEANUP_FNC *ddev_cleanup_fnc, PCPS_DDEV_REGISTER_FNC *ddev_register_fnc, int isa_ports[PCPS_MAX_ISA_CARDS], int isa_irqs[PCPS_MAX_ISA_CARDS])
Detect and initialize ISA devices in a non-PnP system.
const char * mbg_strerror(int mbg_errno)
Return an error string associated with the MBG_ERROR_CODES.
#define _pcps_ddev_status_busy(_d)
MBG_MUTEX dev_mutex
Mutex used for device access serialization.
int setup_sernum_and_receiver_info(PCPS_DDEV *pddev)
Read the serial number and receiver info from the device.
PCPS_SHORT_PORT_ADDR base
void rsrc_dealloc_ports(ulong port, ulong n)
Release an I/O port resource range which has been allocated before.
the number of known GPS_FEATURE_BITS, should now be at its limit, i.e. 32.
unsigned __int64 uint64_t
#define BUILTIN_FEAT_GLN180PEX
int PCPS_DDEV_INIT_FNC(PCPS_DDEV **ppddev)
SW_REV sw_rev
software revision and ID
#define _mbg_kdd_msg_2(_lvl, _fmt, _p1, _p2)
uint16_t PCPS_SHORT_PORT_ADDR
Legacy I/O address type, see PCPS_SHORT_PORT_RSRC.
#define _mbg_inp16_to_cpu(_dev, _rsrc_idx, _port_addr)
PCPS_DEV dev
Device info data that can be passed to user space.
int pcps_add_rsrc_irq(PCPS_DDEV *pddev, int16_t irq_num)
Add an IRQ number resource to the device structure.
PCPS_HR_TIME pcps_hr_time
#define PCPS_EF_INV_FW_ID
invalid firmware ID
static void wait_ptp270pex_ready(const PCPS_DDEV *pddev)
Wait until a PTP270PEX card is ready after power-up.
#define _pcps_ddev_pci_cfg_err(_p)
int64_t MBG_PC_CYCLES
Generic types to hold PC cycle counter values.
uint16_t PCPS_FW_REV_NUM
firmware revision number, MSB major, LSB minor version
#define REV_HAS_IRIG_TIME_TCR511PCI
#define MBG_ERR_NOT_SUPP_ON_OS
Function is not supported on this operating system.
#define MBG_ERR_FW_ID
Invalid firmware ID.
#define _mbg_swab_receiver_info(_p)
static __mbg_inline int check_feat_supp_byte_array(int bit_num, const uint8_t *p, int max_bytes)
Check if a specific bit is set in a byte array.
MBG_IOPORT_ADDR_MAPPED irq_flag_port
Address of the IRQ status register.
#define DEFAULT_GPS_FEATURE_NAMES
Names of device features.
#define PCPS_FEAT_TCR511PCI
#define PCPS_EF_IO_RSRC_IO
I/O resource not registered with resource manager.
#define _cpu_to_mbg32(_x)
#define MBG_ERR_NBYTES
match the number of bytes expected by the device.
#define _pcps_ddev_is_pci_mbgpex(_p)
Bus memory resource information for a device.
#define _pcps_read_gps_var(_pddev, _cmd, _s)
#define _mbg_pci_read_cfg_dword
int pcps_setup_and_start_pci_dev(PCPS_DDEV *pddev, PCPS_BUS_NUM bus_num, PCPS_SLOT_NUM dev_fnc_num)
Setup and start a PCI device in a non-PnP system.
uint16_t khz_val
the base frequency in [kHz]
#define PCPS_BUS_PCI_PEX8311
PCPS_SHORT_PORT_ADDR short_status_port
A structure used to identify a device type and supported features.
#define PCPS_FEAT_TCR180USB
IRIG TX only supp. if GPS_HAS_IRIG_TX.
#define MBG_XFEATURE_NAMES
Names of extended device features.
#define _pcps_ddev_is_pci_s5920(_p)
#define PCI_ASIC_HAS_MM_IO
Bit masks used with PCI_ASIC_FEATURES.
#define REV_HAS_RAW_IRIG_DATA_TCR51USB
PCPS_SHORT_PORT_RSRC port[2]
void PCPS_DDEV_CLEANUP_FNC(PCPS_DDEV *pddev)
#define PCPS_READ_GPS_DATA
(r-) Read large data structure, see PC_GPS_CMD_CODES
#define MBG_ERR_DEV_NOT_SUPP
Device type not supported by driver.
PCI_ASIC_REG pci_data
Register used to pass byte from PCI bus to add-on side.
A structure used to store a bit mask of supported TLV context types.
#define REV_HAS_IRIG_TIME_TCR51USB
#define _pcps_ddev_has_receiver_info(_p)
USB I/O, no direct port access.
#define PCPS_FEAT_GPS167PC
static void pcps_free_ddev_struc(PCPS_DDEV **ppddev)
Free a previously allocated device info structure.
static __mbg_inline void mbg_get_pc_cycles_frequency(MBG_PC_CYCLES_FREQUENCY *p)
#define _mbg_put_unaligned(_v, _p)
#define MAX_PARM_STR_TYPE
The max number of serial string types supported by configuration programs.
#define PCPS_FEAT_TCR180PEX
IRIG TX only supp. if GPS_HAS_IRIG_TX.
#define BUILTIN_FEAT_GPS168PCI
uint8_t month
month, 1..12
#define _pcps_ddev_has_gps_data_16(_p)
PCPS_TIME_STATUS status
status bits, see PCPS_TIME_STATUS_FLAGS_COMMON
uint8_t sec
seconds, 0..59, or 60 if leap second
uint8_t wday
day of week, 1..7, 1 = Monday
#define PCPS_FEAT_DCF600USB
#define PCPS_FEAT_TCR600USB
#define REV_HAS_SERIAL_PC31PS31
#define PCPS_HAS_IRIG_CTRL_BITS
see PCPS_BIT_HAS_IRIG_CTRL_BITS
PCPS_WRITE_FNC pcps_write_gps
Write a large data structure to a device.
static void beautify_sernum(char *s, size_t max_len)
#define PCPS_FEAT_GPS167PCI