summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Burnicki <martin.burnicki@meinberg.de>2009-01-21 12:33:05 +0100
committerMartin Burnicki <martin.burnicki@meinberg.de>2009-01-21 12:33:05 +0100
commitbc05a63c992f2431b6858061e5e955aa928867e2 (patch)
tree07f6935b103b3c3cba24b0a4b1d7f9dd1622bbc9
parent9b7c44e15052fde65e6f21ec3c5044ef88368ec2 (diff)
parent1d905b5c3b290f4bf9abea97aeb203479e2120ec (diff)
downloadmbgsdk-win-bc05a63c992f2431b6858061e5e955aa928867e2.tar.gz
mbgsdk-win-bc05a63c992f2431b6858061e5e955aa928867e2.zip
Merge branch 'mbgdevio-demo-c'
-rw-r--r--c/demo/mbgdevio/bc/mbgdevio_hrtime.bpf7
-rw-r--r--c/demo/mbgdevio/bc/mbgdevio_hrtime.bpr109
-rw-r--r--c/demo/mbgdevio/bc/mbgdeviodemo.bpf7
-rw-r--r--c/demo/mbgdevio/bc/mbgdeviodemo.bpr110
-rw-r--r--c/demo/mbgdevio/hrtime.c254
-rw-r--r--c/demo/mbgdevio/mbgdevio_demo.c505
-rw-r--r--c/demo/mbgdevio/vc6/hrtime.dsp152
-rw-r--r--c/demo/mbgdevio/vc6/mbgdevio_demo.dsp156
-rw-r--r--c/mbglib/lib/bc/mbgdevio.libbin0 -> 23040 bytes
-rw-r--r--c/mbglib/lib/bc/mbgutil.libbin0 -> 6144 bytes
10 files changed, 1300 insertions, 0 deletions
diff --git a/c/demo/mbgdevio/bc/mbgdevio_hrtime.bpf b/c/demo/mbgdevio/bc/mbgdevio_hrtime.bpf
new file mode 100644
index 0000000..5a7675e
--- /dev/null
+++ b/c/demo/mbgdevio/bc/mbgdevio_hrtime.bpf
@@ -0,0 +1,7 @@
+USEUNIT("..\hrtime.c");
+USELIB("..\..\..\mbglib\lib\bc\mbgutil.lib");
+USELIB("..\..\..\mbglib\lib\bc\mbgdevio.lib");
+//---------------------------------------------------------------------------
+Diese Datei wird nur vom Projekt-Manager verwendet und sollte wie die Projektdatei behandelt werden
+
+ main \ No newline at end of file
diff --git a/c/demo/mbgdevio/bc/mbgdevio_hrtime.bpr b/c/demo/mbgdevio/bc/mbgdevio_hrtime.bpr
new file mode 100644
index 0000000..3164943
--- /dev/null
+++ b/c/demo/mbgdevio/bc/mbgdevio_hrtime.bpr
@@ -0,0 +1,109 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!-- C++Builder XML Project -->
+<PROJECT>
+ <MACROS>
+ <VERSION value="BCB.05.03"/>
+ <PROJECT value="mbgdevio_hrtime.exe"/>
+ <OBJFILES value="..\hrtime.obj"/>
+ <RESFILES value=""/>
+ <DEFFILE value=""/>
+ <RESDEPEN value="$(RESFILES)"/>
+ <LIBFILES value="..\..\..\mbglib\lib\bc\mbgutil.lib ..\..\..\mbglib\lib\bc\mbgdevio.lib"/>
+ <LIBRARIES value=""/>
+ <SPARELIBS value=""/>
+ <PACKAGES value="Vcl50.bpi Vclx50.bpi bcbsmp50.bpi Qrpt50.bpi Vcldb50.bpi Vclbde50.bpi
+ ibsmp50.bpi vcldbx50.bpi TeeUI50.bpi TeeDB50.bpi Tee50.bpi TeeQR50.bpi
+ VCLIB50.bpi bcbie50.bpi vclie50.bpi Inetdb50.bpi Inet50.bpi NMFast50.bpi
+ dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi"/>
+ <PATHCPP value=".;.."/>
+ <PATHPAS value=".;"/>
+ <PATHRC value=".;"/>
+ <PATHASM value=".;"/>
+ <DEBUGLIBPATH value="$(BCB)\lib\debug"/>
+ <RELEASELIBPATH value="$(BCB)\lib\release"/>
+ <LINKER value="tlink32"/>
+ <USERDEFINES value="_DEBUG"/>
+ <SYSDEFINES value="NO_STRICT;_NO_VCL;_RTLDLL"/>
+ <MAINSOURCE value="mbgdevio_hrtime.bpf"/>
+ <INCLUDEPATH value="..\;..;..\..\..\mbglib\include;$(BCB)\include;$(BCB)\include\vcl"/>
+ <LIBPATH value="..\;..;$(BCB)\lib\obj;$(BCB)\lib"/>
+ <WARNINGS value="-w-par"/>
+ </MACROS>
+ <OPTIONS>
+ <CFLAG1 value="-Od -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -tWC -tWM- -c"/>
+ <PFLAGS value="-$YD -$W -$O- -v -JPHNE -M"/>
+ <RFLAGS value=""/>
+ <AFLAGS value="/mx /w2 /zd"/>
+ <LFLAGS value="-D&quot;&quot; -ap -Tpe -x -Gn -v"/>
+ </OPTIONS>
+ <LINKER>
+ <ALLOBJ value="c0x32.obj $(OBJFILES)"/>
+ <ALLRES value="$(RESFILES)"/>
+ <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32i.lib"/>
+ </LINKER>
+ <IDEOPTIONS>
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1031
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+
+[HistoryLists\hlIncludePath]
+Count=2
+Item0=..\;..\..\..\mbglib\include;$(BCB)\include;$(BCB)\include\vcl
+Item1=..\;$(BCB)\include;$(BCB)\include\vcl
+
+[HistoryLists\hlLibraryPath]
+Count=1
+Item0=..\;$(BCB)\lib\obj;$(BCB)\lib
+
+[HistoryLists\hlDebugSourcePath]
+Count=1
+Item0=$(BCB)\source\vcl
+
+[HistoryLists\hlConditionals]
+Count=1
+Item0=_DEBUG
+
+[Debugging]
+DebugSourceDirs=$(BCB)\source\vcl
+
+[Parameters]
+RunParams=
+HostApplication=
+RemoteHost=
+RemotePath=
+RemoteDebug=0
+
+[Compiler]
+ShowInfoMsgs=0
+LinkDebugVcl=0
+LinkCGLIB=0
+
+[Language]
+ActiveLang=
+ProjectLang=
+RootDir=
+ </IDEOPTIONS>
+</PROJECT> \ No newline at end of file
diff --git a/c/demo/mbgdevio/bc/mbgdeviodemo.bpf b/c/demo/mbgdevio/bc/mbgdeviodemo.bpf
new file mode 100644
index 0000000..be1439b
--- /dev/null
+++ b/c/demo/mbgdevio/bc/mbgdeviodemo.bpf
@@ -0,0 +1,7 @@
+USEUNIT("..\mbgdevio_demo.c");
+USELIB("..\..\..\mbglib\lib\bc\mbgutil.lib");
+USELIB("..\..\..\mbglib\lib\bc\mbgdevio.lib");
+//---------------------------------------------------------------------------
+Diese Datei wird nur vom Projekt-Manager verwendet und sollte wie die Projektdatei behandelt werden
+
+ main \ No newline at end of file
diff --git a/c/demo/mbgdevio/bc/mbgdeviodemo.bpr b/c/demo/mbgdevio/bc/mbgdeviodemo.bpr
new file mode 100644
index 0000000..4e299f4
--- /dev/null
+++ b/c/demo/mbgdevio/bc/mbgdeviodemo.bpr
@@ -0,0 +1,110 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!-- C++Builder XML Project -->
+<PROJECT>
+ <MACROS>
+ <VERSION value="BCB.05.03"/>
+ <PROJECT value="mbgdeviodemo.exe"/>
+ <OBJFILES value="..\mbgdevio_demo.obj"/>
+ <RESFILES value=""/>
+ <DEFFILE value=""/>
+ <RESDEPEN value="$(RESFILES)"/>
+ <LIBFILES value="..\..\..\mbglib\lib\bc\mbgutil.lib ..\..\..\mbglib\lib\bc\mbgdevio.lib"/>
+ <LIBRARIES value=""/>
+ <SPARELIBS value=""/>
+ <PACKAGES value="Vcl50.bpi Vclx50.bpi bcbsmp50.bpi Qrpt50.bpi Vcldb50.bpi Vclbde50.bpi
+ ibsmp50.bpi vcldbx50.bpi TeeUI50.bpi TeeDB50.bpi Tee50.bpi TeeQR50.bpi
+ VCLIB50.bpi bcbie50.bpi vclie50.bpi Inetdb50.bpi Inet50.bpi NMFast50.bpi
+ dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi"/>
+ <PATHCPP value=".;.."/>
+ <PATHPAS value=".;"/>
+ <PATHRC value=".;"/>
+ <PATHASM value=".;"/>
+ <DEBUGLIBPATH value="$(BCB)\lib\debug"/>
+ <RELEASELIBPATH value="$(BCB)\lib\release"/>
+ <LINKER value="tlink32"/>
+ <USERDEFINES value="_DEBUG"/>
+ <SYSDEFINES value="NO_STRICT;_NO_VCL;_RTLDLL;USEPACKAGES"/>
+ <MAINSOURCE value="mbgdeviodemo.bpf"/>
+ <INCLUDEPATH value="..\;..;..\..\mbglib\include;$(BCB)\include;$(BCB)\include\vcl"/>
+ <LIBPATH value="..\;$(BCB)\Projects\Lib;..;$(BCB)\lib\obj;$(BCB)\lib"/>
+ <WARNINGS value="-w-par"/>
+ </MACROS>
+ <OPTIONS>
+ <CFLAG1 value="-Od -H=$(BCB)\lib\vcl50.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -tWC
+ -tWM- -c"/>
+ <PFLAGS value="-$YD -$W -$O- -v -JPHNE -M"/>
+ <RFLAGS value=""/>
+ <AFLAGS value="/mx /w2 /zd"/>
+ <LFLAGS value="-D&quot;&quot; -ap -Tpe -x -Gn -v"/>
+ </OPTIONS>
+ <LINKER>
+ <ALLOBJ value="c0x32.obj $(PACKAGES) $(OBJFILES)"/>
+ <ALLRES value="$(RESFILES)"/>
+ <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32i.lib"/>
+ </LINKER>
+ <IDEOPTIONS>
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1031
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+
+[HistoryLists\hlIncludePath]
+Count=2
+Item0=..\;..\..\mbglib\include;..;$(BCB)\include;$(BCB)\include\vcl
+Item1=..\;..;$(BCB)\include;$(BCB)\include\vcl
+
+[HistoryLists\hlLibraryPath]
+Count=1
+Item0=$(BCB)\Projects\Lib;..\;..;$(BCB)\lib\obj;$(BCB)\lib
+
+[HistoryLists\hlDebugSourcePath]
+Count=1
+Item0=$(BCB)\source\vcl
+
+[HistoryLists\hlConditionals]
+Count=1
+Item0=_DEBUG
+
+[Debugging]
+DebugSourceDirs=$(BCB)\source\vcl
+
+[Parameters]
+RunParams=
+HostApplication=
+RemoteHost=
+RemotePath=
+RemoteDebug=0
+
+[Compiler]
+ShowInfoMsgs=0
+LinkDebugVcl=0
+LinkCGLIB=0
+
+[Language]
+ActiveLang=
+ProjectLang=
+RootDir=
+ </IDEOPTIONS>
+</PROJECT> \ No newline at end of file
diff --git a/c/demo/mbgdevio/hrtime.c b/c/demo/mbgdevio/hrtime.c
new file mode 100644
index 0000000..d76846c
--- /dev/null
+++ b/c/demo/mbgdevio/hrtime.c
@@ -0,0 +1,254 @@
+
+/**************************************************************************
+ *
+ * $Id: hrtime.c 1.4 2009/01/07 15:22:36Z daniel TRASH $
+ * $Name: $
+ *
+ * Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
+ *
+ * -----------------------------------------------------------------------
+ * $Log: hrtime.c $
+ * Revision 1.4 2009/01/07 15:22:36Z daniel
+ * Cleaned up source code.
+ * Revision 1.3 2008/01/16 08:48:24Z daniel
+ * Revision 1.2 2007/11/30 12:14:52Z daniel
+ * Revision 1.1 2007/11/05 10:54:00Z daniel
+ * Initial revision
+ *
+ **************************************************************************/
+
+/**
+ \file
+ Example program to read the high resolution time from
+ Meinberg computer peripherals
+ using the mbgdevio (Meinberg Device I/O) DLL.
+
+ Build environment settings:
+
+ Add "mbglib\include" directory to the include search path.
+ Link the main file plus the required import libraries,
+ in this case mbgdevio.lib and mbgutil.lib.
+
+ The import libraries are located:<br>
+ <B>"mbglib\lib\msc"</B> for Microsoft C compilers<br>
+ <B>"mbglib\lib\bc"</B> for Inprise/Borland compilers
+ */
+
+
+#include <mbgdevio.h>
+#include <mbgutil.h>
+
+#include <stdio.h>
+
+
+static int n_sec_change = 0;
+
+
+static /*HDR*/
+void err_msg( const char *msg )
+{
+ fprintf( stderr, "** %s: %i\n", msg, GetLastError() );
+
+} // err_msg
+
+
+
+static /*HDR*/
+void print_drvr_info( void )
+{
+ int rc;
+ PCPS_DRVR_INFO drvr_info;
+ MBG_DEV_HANDLE dh = mbg_open_device( 0 );
+
+ if ( dh == MBG_INVALID_DEV_HANDLE )
+ {
+ err_msg( "Unable to open device" );
+ exit( 1 );
+ }
+
+
+ rc = mbg_get_drvr_info( dh, &drvr_info );
+
+ mbg_close_device( &dh );
+
+
+ if ( rc != PCPS_SUCCESS )
+ {
+ err_msg( "Failed to read driver info" );
+ exit( 1 );
+ }
+
+ printf( "Kernel driver: %s v%i.%02i, %i device%s\n\n",
+ drvr_info.id_str,
+ drvr_info.ver_num / 100,
+ drvr_info.ver_num % 100,
+ drvr_info.n_devs,
+ ( drvr_info.n_devs == 1 ) ? "" : "s"
+ );
+
+} // print_drvr_info
+
+
+
+static /*HDR*/
+void print_dev_info( MBG_DEV_HANDLE dh,
+ PCPS_DEV *p_dev )
+{
+ int rc;
+
+ rc = mbg_get_device_info( dh, p_dev );
+
+ if ( rc == PCPS_SUCCESS )
+ {
+ _pcps_port_base( p_dev, 0 ) ?
+ printf( " %s at port %03Xh\n",
+ _pcps_fw_id( p_dev ),
+ _pcps_port_base( p_dev, 0 )
+ ) :
+ printf( " %s\n",
+ _pcps_fw_id( p_dev )
+ );
+ }
+ else
+ err_msg( "Failed to read device info" );
+
+} // print_dev_info
+
+
+
+int main( int argc, char* argv[] )
+{
+ int i;
+ int rc = 0;
+ int devices_found;
+
+ if ( mbgdevio_check_version( MBGDEVIO_VERSION ) != PCPS_SUCCESS )
+ {
+ printf( "The MBGDEVIO DLL API version %X which is installed is not compatible\n"
+ "with API version %X required by this program.\n",
+ mbgdevio_get_version(),
+ MBGDEVIO_VERSION
+ );
+ exit( 1 );
+ }
+
+ devices_found = mbg_find_devices();
+
+ if ( devices_found == 0 )
+ {
+ printf( "No radio clock found.\n" );
+ return 1;
+ }
+
+
+ printf( "Found %i radio clock%s\n",
+ devices_found,
+ ( devices_found == 1 ) ? "" : "s"
+ );
+
+
+ print_drvr_info();
+
+
+ // There may be several radio clock devices installed.
+ // Try to get information from each of the devices.
+ for ( i = 0; i < devices_found; i++ )
+ {
+ static PCPS_DEV dev;
+
+ MBG_DEV_HANDLE dh;
+
+
+ printf( "Radio clock %i:\n", i );
+
+ dh = mbg_open_device( i );
+
+ if ( dh == MBG_INVALID_DEV_HANDLE )
+ {
+ err_msg( "Unable to open device" );
+ continue;
+ }
+
+
+ print_dev_info( dh, &dev );
+ printf( "\n" );
+
+
+ // Some clocks (mainly GPS receivers and IRIG decoders)
+ // support a high resolution time. If supported, read and
+ // display the HR time.
+ if ( _pcps_has_hr_time( &dev ) )
+ {
+ char ws[100];
+ char offs[20];
+
+ PCPS_HR_TIME hr_t;
+ int32_t latency = 0;
+ int rc;
+
+ // Read a high resolution time stamp with compensated latency.
+ // The function mbg_get_hr_time_comp() has been introduced in
+ // mbgdevio DLL v2.1.2 and compensates the execution time (latency)
+ // required to acces the hardware from inside the kernel driver.
+
+ #if 1 // use with mbgdevio DLL v2.1.2 or greater
+
+
+ // The latency value can optionally be returned by this function.
+ // If the latency value is not required, a NULL pointer can be
+ // passed instead. The latency value is in hectonanoseconds [hns],
+ // i.e. 100 nanosecond units.
+
+ rc = mbg_get_hr_time_comp( dh, &hr_t, &latency );
+
+ #else // the code below can be used with mbgdevio DLL < v2.1.2.
+
+ rc = mbg_get_hr_time( dh, &hr_t );
+
+ #endif
+
+ if ( rc == PCPS_SUCCESS )
+ {
+ char latency_fmt[50];
+
+ if ( latency )
+ sprintf( latency_fmt,", latency: %i hns", latency);
+ else
+ strcpy(latency_fmt,"");
+
+ // The format functions below are taken from mbgutil.dll.
+
+ // Display PCPS_HR_TIME as raw data in hex format.
+ mbg_str_pcps_hr_time_raw( ws, sizeof( ws ), &hr_t );
+ printf( " HR time (raw): %s %s\n\n", ws, latency_fmt );
+
+ // Convert PCPS_HR_TIME into a readable timestamp with fractions as local time.
+ mbg_str_pcps_hr_tstamp_loc( ws, sizeof( ws ), &hr_t );
+ printf( " HR timestamp (loc): %s%s\n", ws, latency_fmt);
+
+ // Convert PCPS_HR_TIME into a readable timestamp with fractions as UTC time.
+ mbg_str_pcps_hr_tstamp_utc( ws, sizeof( ws ), &hr_t );
+ printf( " HR timestamp (utc): %s %s\n", ws, latency_fmt);
+
+ // Convert PCPS_HR_TIME into a readable date/time format as local time.
+ mbg_str_pcps_hr_date_time_loc( ws, sizeof( ws ), &hr_t );
+ mbg_str_pcps_hr_time_offs( offs, sizeof( offs ), &hr_t, "UTC" );
+ printf( " HR date/time (loc): %s %s%s\n", ws, offs, latency_fmt );
+
+ // Convert PCPS_HR_TIME into a readable date/time format as UTC time.
+ mbg_str_pcps_hr_date_time_utc( ws, sizeof( ws ), &hr_t );
+ printf( " HR date/time (utc): %s %s\n", ws, latency_fmt );
+ }
+ else
+ err_msg( "Failed to read High Resolution Time" );
+ }
+
+ mbg_close_device( &dh );
+
+ printf( "\n" );
+ }
+
+ printf ( "\n" );
+
+ return rc;
+}
diff --git a/c/demo/mbgdevio/mbgdevio_demo.c b/c/demo/mbgdevio/mbgdevio_demo.c
new file mode 100644
index 0000000..7039f6b
--- /dev/null
+++ b/c/demo/mbgdevio/mbgdevio_demo.c
@@ -0,0 +1,505 @@
+
+/**************************************************************************
+ *
+ * $Id: mbgdevio_demo.c 1.5 2009/01/08 07:52:59Z daniel TRASH $
+ * $Name: $
+ *
+ * Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
+ *
+ * Description:
+ * Example program to access Meinberg computer peripherals
+ * using the mbgdevio (Meinberg Device I/O) DLL.
+ *
+ * Build environment settings:
+ * Add "mbglib\include" directory to the include search path.
+ * Link the main file plus the required import libraries,
+ * in this case mbgdevio.lib and mbgutil.lib.
+ * The import libraries are located:
+ * in mbglib\lib\msc for Microsoft C compilers
+ * in mbglib\lib\bc for Inprise/Borland compilers
+ *
+ * -----------------------------------------------------------------------
+ * $Log: mbgdevio_demo.c $
+ * Revision 1.5 2009/01/08 07:52:59Z daniel
+ * Code cleanup
+ * Revision 1.4 2008/12/04 13:39:04Z daniel
+ * Revision 1.3 2008/02/07 08:29:08Z daniel
+ * Use function mbg_mm_get_hr_timestamp_comp().
+ * Revision 1.2 2008/01/31 08:06:41Z daniel
+ * Include demonstration of mapped memory support.
+ * Revision 1.1 2007/11/02 11:13:24Z daniel
+ * Initial revision
+ *
+ **************************************************************************/
+
+#include <mbgdevio.h>
+#include <mbgutil.h>
+
+#include <stdio.h>
+
+
+static int n_sec_change = 10;
+
+#define MAX_MEM_MAPPED_CNT 20
+
+static /*HDR*/
+void err_msg( const char *msg )
+{
+ fprintf( stderr, "** %s: %i\n", msg, GetLastError() );
+
+} // err_msg
+
+
+
+static /*HDR*/
+void print_drvr_info( void )
+{
+ int rc;
+ PCPS_DRVR_INFO drvr_info;
+ MBG_DEV_HANDLE dh = mbg_open_device( 0 );
+
+ if ( dh == MBG_INVALID_DEV_HANDLE )
+ {
+ err_msg( "Unable to open device" );
+ exit( 1 );
+ }
+
+
+ rc = mbg_get_drvr_info( dh, &drvr_info );
+
+ mbg_close_device( &dh );
+
+
+ if ( rc != PCPS_SUCCESS )
+ {
+ err_msg( "Failed to read driver info" );
+ exit( 1 );
+ }
+
+ printf( "Kernel driver: %s v%i.%02i, %i device%s\n\n",
+ drvr_info.id_str,
+ drvr_info.ver_num / 100,
+ drvr_info.ver_num % 100,
+ drvr_info.n_devs,
+ ( drvr_info.n_devs == 1 ) ? "" : "s"
+ );
+
+} // print_drvr_info
+
+
+
+static /*HDR*/
+void print_dev_info( MBG_DEV_HANDLE dh,
+ PCPS_DEV *p_dev )
+{
+ int rc;
+
+ rc = mbg_get_device_info( dh, p_dev );
+
+ if ( rc == PCPS_SUCCESS )
+ {
+ printf( " %s at port %03Xh\n",
+ _pcps_type_name( p_dev ),
+ _pcps_port_base( p_dev, 0 )
+ );
+ }
+ else
+ err_msg( "Failed to read device info" );
+
+} // print_dev_info
+
+
+
+static /*HDR*/
+void print_date_time( PCPS_TIME *tp, const char *label )
+{
+ if ( label )
+ printf( label );
+
+ printf( "%02u.%02u.%02u %02u:%02u:%02u.%02u (UTC%+dh)\n",
+ tp->mday, tp->month, tp->year,
+ tp->hour, tp->min, tp->sec, tp->sec100,
+ tp->offs_utc
+ );
+
+} // print_date_time
+
+
+
+static /*HDR*/
+void print_date_time_status( MBG_DEV_HANDLE dh )
+{
+ PCPS_TIME t;
+
+
+ if ( PCPS_SUCCESS == mbg_get_time( dh, &t ) )
+ {
+ print_date_time( &t, " " );
+
+ printf( " %s\n",
+ ( t.status & PCPS_FREER ) ?
+ "free running" :
+ "synchronized" );
+
+ printf( " %s\n",
+ ( t.status & PCPS_SYNCD ) ?
+ "synchronized after last RESET" :
+ "not synchronized after last RESET" );
+ }
+ else
+ err_msg( "Failed to read date/time/status" );
+
+} // print_date_time_status
+
+
+
+static /*HDR*/
+char *sprint_hr_time( char *s, const PCPS_HR_TIME *t )
+{
+ sprintf( s, "%08lX.%08lX UTC%+ldsec, st: %04X",
+ t->tstamp.sec,
+ t->tstamp.frac,
+ t->utc_offs,
+ t->status
+ );
+
+ return s;
+
+} // sprint_hr_time
+
+
+
+static /*HDR*/
+void print_hr_time( MBG_DEV_HANDLE dh )
+{
+ PCPS_HR_TIME hr_t;
+
+ // Read a high resolution time stamp with compensated latency.
+ // The function mbg_get_hr_time_comp() has been introduced in
+ // mbgdevio DLL v2.1.2 and compensates the execution time (latency)
+ // required to acces the hardware from inside the kernel driver.
+
+ #if 1 // use with mbgdevio DLL v2.1.2 or greater
+
+ int32_t latency;
+
+ // The latency value can optionally be returned by this function.
+ // If the latency value is not required, a NULL pointer can be
+ // passed instead. The latency value is in hectonanoseconds [hns],
+ // i.e. 100 nanosecond units.
+
+ if ( PCPS_SUCCESS == mbg_get_hr_time_comp( dh, &hr_t, &latency ) )
+ {
+ char ws[200];
+
+ printf( " HR time (raw): %s, latency: %i hns\n", sprint_hr_time( ws, &hr_t ), latency );
+
+ mbg_str_pcps_hr_tstamp_utc( ws, sizeof( ws ), &hr_t );
+ printf( " HR time (utc): %s, latency=%i hns\n", ws, latency );
+ }
+ else
+ err_msg( "Failed to read High Resolution Time" );
+
+ #else // the code below can be used with mbgdevio DLL < v2.1.2.
+
+ if ( PCPS_SUCCESS == mbg_get_hr_time( dh, &hr_t ) )
+ printf( " HR time: %s\n", sprint_hr_time( ws, &hr_t ) );
+ else
+ err_msg( "Failed to read High Resolution Time" );
+
+ #endif
+
+} // print_hr_time
+
+
+
+static /*HDR*/
+void print_sec_changes( MBG_DEV_HANDLE dh )
+{
+ int i = 0;
+
+ for (;;)
+ {
+ PCPS_TIME t;
+ BOOL rc;
+
+ rc = mbg_get_time_sec_change( dh, &t );
+
+ if ( rc == PCPS_SUCCESS )
+ {
+ print_date_time( &t, " New sec: " );
+ print_hr_time( dh );
+ }
+ else
+ err_msg( "Failed to get time at second change." );
+
+ // Wait for specified number of second changes.
+ // If number is 0, wait forever.
+ if ( n_sec_change )
+ if ( ++i >= n_sec_change )
+ break;
+ }
+
+} // print_sec_changes
+
+
+
+static /*HDR*/
+void print_receiver_position( MBG_DEV_HANDLE dh )
+{
+ POS pos;
+ char ws[256];
+
+
+ if ( PCPS_SUCCESS == mbg_get_gps_pos( dh, &pos ) )
+ {
+ mbg_str_pos( ws, sizeof( ws ), &pos, 4 );
+ printf( " Receiver position: %s\n", ws );
+ }
+ else
+ err_msg( "Failed to read receiver position" );
+
+} // print_receiver_position
+
+
+
+static /*HDR*/
+void print_sv_info( MBG_DEV_HANDLE dh )
+{
+ STAT_INFO stat_info;
+
+
+ if ( PCPS_SUCCESS == mbg_get_gps_stat_info( dh, &stat_info ) )
+ {
+ printf( " Satellites: %u in view, %u good\n",
+ stat_info.svs_in_view,
+ stat_info.good_svs
+ );
+ }
+ else
+ err_msg( "Failed to read GPS status info" );
+
+} // print_sv_info
+
+
+
+static /*HDR*/
+void check_user_captures( MBG_DEV_HANDLE dh, PCPS_DEV *pdev )
+{
+ unsigned int ucaps_read = 0;
+
+ if ( _pcps_has_ucap( pdev ) )
+ {
+ PCPS_UCAP_ENTRIES ucap_entries;
+ PCPS_HR_TIME ucap_event;
+ char ws[100];
+
+ for (;;) // read all entries from capture buffer
+ {
+ if ( PCPS_SUCCESS != mbg_get_ucap_entries( dh, &ucap_entries ) )
+ {
+ err_msg( "Failed to read user capture buffer entries." );
+ break;
+ }
+
+ if ( PCPS_SUCCESS != mbg_get_ucap_event( dh, &ucap_event ) )
+ {
+ err_msg( "Failed to read user capture event." );
+ break;
+ }
+
+
+ // If a user capture event has been read
+ // then it it removed from the clock's buffer.
+
+ // If no new capture event is available, the ucap.tstamp structure
+ // is set to 0.
+ // Alternatively, PCPS_UCAP_ENTRIES.used can be checked for the
+ // number of events pending in the buffer.
+
+ if ( ucap_event.tstamp.sec == 0 ) // no new user capture event
+ break;
+
+
+ printf( " New capture: CH%i: %s (%i/%i)\n",
+ ucap_event.signal, // this is the channel number
+ sprint_hr_time( ws, &ucap_event ),
+ ucap_entries.used,
+ ucap_entries.max
+ );
+
+ ucaps_read++;
+ }
+ }
+ else
+ {
+ TTM ucap;
+
+ for (;;) // read all entries from capture buffer
+ {
+ if ( PCPS_SUCCESS != mbg_get_gps_ucap( dh, &ucap ) )
+ {
+ err_msg( "Failed to read user captures" );
+ break;
+ }
+
+
+ // If a user capture event has been read
+ // then it it removed from the clock's buffer.
+
+ // If no new capture is available, the ucap.tm structure
+ // is set to "unread".
+ if ( !_pcps_time_is_read( &ucap.tm ) ) // no new user capture entry
+ break;
+
+ printf( " New capture: CH%i: %02i.%02i.%02i %2i:%02i:%02i.%07li\n",
+ ucap.channel,
+ ucap.tm.mday,
+ ucap.tm.month,
+ ucap.tm.year % 100,
+ ucap.tm.hour,
+ ucap.tm.min,
+ ucap.tm.sec,
+ ucap.tm.frac
+ );
+
+ ucaps_read++;
+ }
+ }
+
+
+ if ( ucaps_read )
+ printf( " User captures read: %u\n", ucaps_read );
+ else
+ printf( " No user captures to be read.\n" );
+
+
+ if ( _pcps_can_clr_ucap_buff( pdev ) )
+ {
+ if ( PCPS_SUCCESS == mbg_clr_ucap_buff( dh ) )
+ printf( " Capture buffer cleared.\n" );
+ else
+ err_msg( " Failed to clear capture buffer" );
+ }
+ else
+ printf( " Clearing capture buffer not supported.\n" );
+
+} // check_user_captures
+
+
+
+int main( int argc, char* argv[] )
+{
+ int i,j;
+ int rc = 0;
+ int devices_found;
+
+ if ( mbgdevio_check_version( MBGDEVIO_VERSION ) != PCPS_SUCCESS )
+ {
+ printf( "The MBGDEVIO DLL API version %X which is installed is not compatible\n"
+ "with API version %X required by this program.\n",
+ mbgdevio_get_version(),
+ MBGDEVIO_VERSION
+ );
+ exit( 1 );
+ }
+
+ devices_found = mbg_find_devices();
+
+ if ( devices_found == 0 )
+ {
+ printf( "No radio clock found.\n" );
+ return 1;
+ }
+
+
+ printf( "Found %i radio clock%s\n",
+ devices_found,
+ ( devices_found == 1 ) ? "" : "s"
+ );
+
+
+ print_drvr_info();
+
+
+ // There may be several radio clock devices installed.
+ // Try to get information from each of the devices.
+ for ( i = 0; i < devices_found; i++ )
+ {
+ static PCPS_DEV dev;
+
+ MBG_DEV_HANDLE dh;
+
+ printf( "Radio clock %i:\n", i );
+
+ dh = mbg_open_device( i );
+
+ if ( dh == MBG_INVALID_DEV_HANDLE )
+ {
+ err_msg( "Unable to open device" );
+ continue;
+ }
+
+
+ print_dev_info( dh, &dev );
+
+ // Read the current date, time, and status.
+ print_date_time_status( dh );
+
+ // Some clocks (mainly GPS receivers and IRIG decoders)
+ // support a high resolution time. If supported, read and
+ // display the HR time.
+ if ( _pcps_has_hr_time( &dev ) )
+ print_hr_time( dh );
+
+
+ // Print some GPS clock specific info
+ if ( _pcps_is_gps( &dev ) )
+ {
+ print_receiver_position( dh );
+ print_sv_info( dh );
+ check_user_captures( dh, &dev );
+ }
+
+ //***********
+ // Loop some seconds to wait for second changes
+ // Uncomment the line below if required:
+
+ // print_sec_changes( dh );
+
+ //***********
+
+ // Check if device has memory mapped I/O support
+ // and read fast HR timestamps.
+ if ( _pcps_has_asic_version( &dev ) )
+ {
+ PCI_ASIC_FEATURES asic_features;
+
+ rc = mbg_get_asic_features( dh, &asic_features );
+
+ if ( rc == PCPS_SUCCESS && asic_features >= 1 )
+ {
+ PCPS_HR_TIME hrtime[MAX_MEM_MAPPED_CNT] = { 0 };
+ uint32_t latency[MAX_MEM_MAPPED_CNT];
+
+ for(j = 0; j < MAX_MEM_MAPPED_CNT; j++)
+ mbg_get_fast_hr_timestamp_comp( dh, &hrtime[j].tstamp, &latency[j] );
+
+ for(j = 0; j < MAX_MEM_MAPPED_CNT; j++)
+ {
+ char ws[200];
+
+ mbg_str_pcps_hr_tstamp_utc( ws, sizeof( ws ), &hrtime[j] );
+ printf( " HR timestamp (MEM): %s latency=%u hns\n", ws, latency[j] );
+ }
+ }
+ }
+
+ mbg_close_device( &dh );
+ printf( "\n" );
+ }
+
+ printf ( "\n" );
+
+ return rc;
+}
diff --git a/c/demo/mbgdevio/vc6/hrtime.dsp b/c/demo/mbgdevio/vc6/hrtime.dsp
new file mode 100644
index 0000000..00b900a
--- /dev/null
+++ b/c/demo/mbgdevio/vc6/hrtime.dsp
@@ -0,0 +1,152 @@
+# Microsoft Developer Studio Project File - Name="hrtime" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=hrtime - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "hrtime.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "hrtime.mak" CFG="hrtime - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "hrtime - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "hrtime - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "hrtime - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "hrtime___Win32_Release"
+# PROP BASE Intermediate_Dir "hrtime___Win32_Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "hrtime___Win32_Release"
+# PROP Intermediate_Dir "hrtime___Win32_Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\mbglib\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x407 /d "NDEBUG"
+# ADD RSC /l 0x407 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "hrtime - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "hrtime___Win32_Debug"
+# PROP BASE Intermediate_Dir "hrtime___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "hrtime___Win32_Debug"
+# PROP Intermediate_Dir "hrtime___Win32_Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\mbglib\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x407 /d "_DEBUG"
+# ADD RSC /l 0x407 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "hrtime - Win32 Release"
+# Name "hrtime - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\hrtime.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\..\..\mbglib\include\gpsdefs.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\mbglib\include\mbg_tgt.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\mbglib\include\mbgdevio.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\mbglib\include\mbggeo.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\mbglib\include\mbgutil.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\mbglib\include\pcpsdefs.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\mbglib\include\pcpsdev.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\mbglib\include\usbdefs.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\mbglib\include\use_pack.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\mbglib\include\words.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# Begin Group "Mbglib Import Libraries"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\..\mbglib\lib\msc\mbgdevio.lib
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\mbglib\lib\msc\mbgutil.lib
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/c/demo/mbgdevio/vc6/mbgdevio_demo.dsp b/c/demo/mbgdevio/vc6/mbgdevio_demo.dsp
new file mode 100644
index 0000000..bc893a7
--- /dev/null
+++ b/c/demo/mbgdevio/vc6/mbgdevio_demo.dsp
@@ -0,0 +1,156 @@
+# Microsoft Developer Studio Project File - Name="mbgdevio_demo" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=mbgdevio_demo - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "mbgdevio_demo.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "mbgdevio_demo.mak" CFG="mbgdevio_demo - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "mbgdevio_demo - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "mbgdevio_demo - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "mbgdevio_demo - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\mbglib\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
+# ADD BASE RSC /l 0x407 /d "NDEBUG"
+# ADD RSC /l 0x407 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "mbgdevio_demo - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\mbglib\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x407 /d "_DEBUG"
+# ADD RSC /l 0x407 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "mbgdevio_demo - Win32 Release"
+# Name "mbgdevio_demo - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\mbgdevio_demo.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\..\..\mbglib\include\gpsdefs.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\mbglib\include\gpsutils.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\mbglib\include\mbg_tgt.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\mbglib\include\mbgdevio.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\mbglib\include\mbggeo.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\mbglib\include\mbgutil.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\mbglib\include\pcpsdefs.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\mbglib\include\pcpsdev.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\mbglib\include\usbdefs.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\mbglib\include\use_pack.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\mbglib\include\words.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# Begin Group "Mbglib Import Libraries"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\..\mbglib\lib\msc\mbgutil.lib
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\mbglib\lib\msc\mbgdevio.lib
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/c/mbglib/lib/bc/mbgdevio.lib b/c/mbglib/lib/bc/mbgdevio.lib
new file mode 100644
index 0000000..9a7b010
--- /dev/null
+++ b/c/mbglib/lib/bc/mbgdevio.lib
Binary files differ
diff --git a/c/mbglib/lib/bc/mbgutil.lib b/c/mbglib/lib/bc/mbgutil.lib
new file mode 100644
index 0000000..6ca105d
--- /dev/null
+++ b/c/mbglib/lib/bc/mbgutil.lib
Binary files differ