diff --git a/Cpp/Cpp.sln b/Cpp/Cpp.sln new file mode 100644 index 0000000000000000000000000000000000000000..fc0b9f6637682a85babf1a29664cc6795b4d7429 --- /dev/null +++ b/Cpp/Cpp.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.7.34024.191 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Cpp", "Cpp.vcxproj", "{1CCAB617-6DEE-4B9D-A6D1-F3929CE9E0C9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1CCAB617-6DEE-4B9D-A6D1-F3929CE9E0C9}.Debug|x64.ActiveCfg = Debug|x64 + {1CCAB617-6DEE-4B9D-A6D1-F3929CE9E0C9}.Debug|x64.Build.0 = Debug|x64 + {1CCAB617-6DEE-4B9D-A6D1-F3929CE9E0C9}.Debug|x86.ActiveCfg = Debug|Win32 + {1CCAB617-6DEE-4B9D-A6D1-F3929CE9E0C9}.Debug|x86.Build.0 = Debug|Win32 + {1CCAB617-6DEE-4B9D-A6D1-F3929CE9E0C9}.Release|x64.ActiveCfg = Release|x64 + {1CCAB617-6DEE-4B9D-A6D1-F3929CE9E0C9}.Release|x64.Build.0 = Release|x64 + {1CCAB617-6DEE-4B9D-A6D1-F3929CE9E0C9}.Release|x86.ActiveCfg = Release|Win32 + {1CCAB617-6DEE-4B9D-A6D1-F3929CE9E0C9}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B586227A-0AA5-4AC8-8081-A18EC4A283FC} + EndGlobalSection +EndGlobal diff --git a/Cpp/Cpp.vcxproj b/Cpp/Cpp.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..2a4f15c9992528bfbff9c94cf7024f35b9fbb18a --- /dev/null +++ b/Cpp/Cpp.vcxproj @@ -0,0 +1,149 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <VCProjectVersion>17.0</VCProjectVersion> + <Keyword>Win32Proj</Keyword> + <ProjectGuid>{1ccab617-6dee-4b9d-a6d1-f3929ce9e0c9}</ProjectGuid> + <RootNamespace>Cpp</RootNamespace> + <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v143</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v143</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v143</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v143</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="Shared"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <RunCodeAnalysis>true</RunCodeAnalysis> + <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <SDLCheck>true</SDLCheck> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <SDLCheck>true</SDLCheck> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <SDLCheck>true</SDLCheck> + <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ConformanceMode>true</ConformanceMode> + <EnablePREfast>true</EnablePREfast> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <SDLCheck>true</SDLCheck> + <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="lib\AWG.cpp" /> + <ClCompile Include="run.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="lib\AWG.h" /> + <ClInclude Include="lib\dlltyp.h" /> + <ClInclude Include="lib\errors.h" /> + <ClInclude Include="lib\regs.h" /> + <ClInclude Include="lib\spcerr.h" /> + <ClInclude Include="lib\spcm_drv.h" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/Cpp.vcxproj.filters b/Cpp/Cpp.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..61a75a94cd699cdb352036ea102559958aa57940 --- /dev/null +++ b/Cpp/Cpp.vcxproj.filters @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="run.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="lib\AWG.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="lib\AWG.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="lib\dlltyp.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="lib\errors.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="lib\regs.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="lib\spcerr.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="lib\spcm_drv.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/build_all_examples.bat b/Cpp/examples/c_cpp/build_all_examples.bat new file mode 100644 index 0000000000000000000000000000000000000000..a02ff2aa1b9db9bc3c8f5e5245d32c2155a22e5d --- /dev/null +++ b/Cpp/examples/c_cpp/build_all_examples.bat @@ -0,0 +1,82 @@ +@echo off + +rem This script checks all subdirectories for .vcproj files and tries to build +rem each project as 32bit and 64bit application, both debug and release. + +setlocal EnableDelayedExpansion + +set LIST= + +rem Konvertierung vcproj -> vcxproj: +rem devenv /Upgrade xyz.vcproj +rem danach gibt es Linkerfehler, weil die Libs falsch eingebunden sind. +rem dagegen hilft sed: +rem sed -i "s/CustomBuild/Library/" %%P +rem danach sind noch die Ausgabepfade Murks +rem wieder sed: +rem sed -i "/<Link>/{n;s/.*/ <OutputFile>$(TargetPath)<\/OutputFile>/ }" %%P + +rem ältere msbuild Versionen geben komische Fehler +set MSBUILD="C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" + +rem loop over all directories +FOR /F %%D in ('dir /A:D /B') DO ( + pushd %%D + + rem loop over all .vcproj files in directory + FOR /F %%P in ('dir /B *.vcxproj 2^>nul') DO ( + rem vcbuild /r /platform:Win32 %%P Debug + rem + %MSBUILD% /target:Rebuild /property:Configuration=Debug;Platform=x86 %%P + if ERRORLEVEL 1 ( + echo. + echo ERROR: %%D/%%P Win32 Debug FAILED + set LIST=!LIST! "%%D/%%P Win32 Debug" + ) + rem vcbuild /r /platform:Win32 %%P Release + rem sed -i "s/CustomBuild/Library/" %%P + rem sed -i "/<Link>/{n;s/.*/ <OutputFile>$(TargetPath)<\/OutputFile>/ }" %%P + %MSBUILD% /target:Rebuild /property:Configuration=Release;Platform=x86 %%P + if ERRORLEVEL 1 ( + echo. + echo ERROR: %%D/%%P Win32 Release FAILED + set LIST=!LIST! "%%D/%%P Win32 Release" + ) + rem vcbuild /r /platform:x64 %%P Debug + rem sed -i "s/CustomBuild/Library/" %%P + rem sed -i "/<Link>/{n;s/.*/ <OutputFile>$(TargetPath)<\/OutputFile>/ }" %%P + %MSBUILD% /target:Rebuild /property:Configuration=Debug;Platform=x64 %%P + if ERRORLEVEL 1 ( + echo. + echo ERROR: %%D/%%P x64 Debug FAILED + set LIST=!LIST! "%%D/%%P x64 Debug" + ) + rem vcbuild /r /platform:x64 %%P Release + rem sed -i "s/CustomBuild/Library/" %%P + rem sed -i "/<Link>/{n;s/.*/ <OutputFile>$(TargetPath)<\/OutputFile>/ }" %%P + %MSBUILD% /target:Rebuild /property:Configuration=Release;Platform=x64 %%P + if ERRORLEVEL 1 ( + echo. + echo ERROR: %%D/%%P x64 Release FAILED + set LIST=!LIST! "%%D/%%P x64 Release" + ) + ) + + popd +) + +echo. +echo ***************************************** +IF DEFINED LIST ( + echo The following examples failed to compile: + echo. + FOR %%a in (%LIST%) DO echo %%a + echo. + pause + exit /B 1 +) ELSE ( + echo All examples compiled successfully + echo. + exit /B 0 +) + diff --git a/Cpp/examples/c_cpp/build_all_examples.sh b/Cpp/examples/c_cpp/build_all_examples.sh new file mode 100644 index 0000000000000000000000000000000000000000..f75f82a2c20923bcc094cb98ad16ecaf1bad2a14 --- /dev/null +++ b/Cpp/examples/c_cpp/build_all_examples.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +LIST_OF_FAILED=() + +# ***** compile + error check ***** +compile_and_check() # (path, makefile-name) + { + echo + echo + echo "***** Compiling `pwd $1`/"$1 + make -f $1 clean + if [ $? != 0 ]; then + LIST_OF_FAILED[${#LIST_OF_FAILED[*]}]="$(pwd $1)/$1" + return 1 + fi + make -f $1 + if [ $? != 0 ]; then + LIST_OF_FAILED[${#LIST_OF_FAILED[*]}]="$(pwd $1)/$1" + return 1 + fi + make -f $1 clean + return $? + } + +# check C++ examples +for i in `find . -type d -not -iwholename '*.svn*' -not -iwholename '*cuda*'`; do + pushd $i + for j in `ls makefile*`; do + compile_and_check $j + done + popd +done + +echo +echo "##########################################################################" +echo Failed Builds: +if [ ${#LIST_OF_FAILED[*]} -gt 0 ]; then + echo $LIST_OF_FAILED +else + echo " None" +fi diff --git a/Cpp/examples/c_cpp/c_header/SpcStdNT.lib b/Cpp/examples/c_cpp/c_header/SpcStdNT.lib new file mode 100644 index 0000000000000000000000000000000000000000..50f6693e5246032570317a8b12db430d42499262 Binary files /dev/null and b/Cpp/examples/c_cpp/c_header/SpcStdNT.lib differ diff --git a/Cpp/examples/c_cpp/c_header/dlltyp.h b/Cpp/examples/c_cpp/c_header/dlltyp.h new file mode 100644 index 0000000000000000000000000000000000000000..f80693dc605bcca33193d004abdf8a6a44bbc4c0 --- /dev/null +++ b/Cpp/examples/c_cpp/c_header/dlltyp.h @@ -0,0 +1,397 @@ +#ifndef DLLTYP_H +#define DLLTYP_H + + + +/* +************************************************************************** + +dlltyp.h (c) Spectrum GmbH, 2006 + +************************************************************************** + +definitions common for all Spectrum drivers and card types. This header +tries to examine the type of compiler and then defines common data types +that have the same length under all compilers and operating systems. + +This header should be the first header to include in all C/C++ projects + +************************************************************************** + +Please do not change this file as it's continuously updated with new +driver versions. If you need other settings for your special compiler +type please add these settings in an extra header file + +************************************************************************** +*/ + +// ----- some global definitions for the drivers ----- +#define MAXBRD 64 +#define SPCM_MAXDEMO 100 + + + +/* +************************************************************************** +this part now tries to examine the compiler type and sets one of the +defines that is used later for the type definition +************************************************************************** +*/ + +// ----- Borland C+ compiler. If the version is > 0x410 it's the C++ Builder and the same types can be used as for Visual C++ ----- +#ifdef __BORLANDC__ +# if (__BCPLUSPLUS__>0x410) +# define VC_WINNT +# elif defined(_Windows) +# define BC_WIN31 +# else +# define BC_DOS +# endif +#endif + +// ----- Microsoft Visual C++ compiler, either as std_call or as c_call ----- +#ifdef _WINSTDCALL +# ifdef _MSC_VER +# ifdef _WINNT +# define VC_STDCALLNT +# else +# define VC_STDCALL95 +# endif +# endif +#elif defined(_MSC_VER) +# ifdef _WIN32 +# ifdef _WINNT +# define VC_WINNT +# else +# define VC_WIN95 +# endif +# else +# define VC_WIN31 +# endif +#endif +#if defined (_WIN32) || defined (_WIN64) +# define _WIN // analog to _LINUX +#endif + +// ----- GCC in various environments +#if defined (__GNUC__) +# if defined (__MINGW32__) +# define _GCCWIN +# elif defined (__CYGWIN__) +# define _GCCWIN +# elif defined (__QNX__) +# define _QNX +# elif !defined(__vxworks) +# define _LINUX +# endif +#endif + +// VxWorks +#ifdef __vxworks +# define _VXWORKS +#endif + + +// ----- LabWindows/CVI +#ifdef _CVI_ +# define _LWCVI +#endif + +// ----- 64 Bit Linux (in addition to _LINUX) ----- +#if defined (__x86_64__) || defined (__amd64__) || defined (__aarch64__) +# if defined (_LINUX) +# define _LINUX64 +# endif +#endif + + + +/* +************************************************************************** +now we hopefully know the compiler type and define all the types matching +this compiler and the platform +************************************************************************** +*/ + +// ----- Borland C++ for DOS (only used with older drivers) ----- +#ifdef BC_DOS +# define int16 int +# define uint16 unsigned int +# define int8 char +# define uint8 unsigned char +# define int32 long int +# define uint32 unsigned long int +# define dataptr void huge* +# define ptr8 char huge* +# define uptr8 unsigned char huge* +# define ptr16 int huge* +# define uptr16 unsigned int huge* +# define ptr32 long int huge* +# define uptr32 unsigned long int huge* +# define bool int8 +# define true 1 +# define false 0 +# define EXP extern "C" _export int16 +# define EXPC extern _export int16 +# define IMP extern "C" _import int16 +# define HEAD extern "C" int16 +#endif + +// ----- Borland C++ for Windows 3.1/3.11 (only used with older drivers) ----- +#ifdef BC_WIN31 +# define int16 int +# define uint16 unsigned int +# define int8 char +# define uint8 unsigned char +# define int32 long int +# define uint32 unsigned long int +# define dataptr void huge* +# define ptr8 char huge* +# define uptr8 unsigned char huge* +# define ptr16 int huge* +# define uptr16 unsigned int huge* +# define ptr32 long int huge* +# define uptr32 unsigned long int huge* +# ifdef _EasyWin +# define EXP extern "C" _export int16 +# define IMP extern "C" _import int16 +# define HEAD extern "C" int16 +# else +# define EXP extern "C" _export int16 FAR PASCAL +# define EXPC extern _export int16 FAR PASCAL +# define IMP extern "C" _import int16 FAR PASCAL +# define HEAD extern "C" int16 FAR PASCAL +# endif +#endif + +// ----- Visual C++ for Windows 3.1/3.11 (only used with older drivers) ----- +#ifdef VC_WIN31 +# define int8 char +# define uint8 unsigned char +# define int16 short int +# define uint16 unsigned short int +# define int32 long int +# define uint32 unsigned long int +# define dataptr void huge* +# define ptr8 char* +# define uptr8 unsigned char* +# define ptr16 short int* +# define uptr16 unsigned short int* +# define ptr32 long int* +# define uptr32 unsigned long int* +# define EXP extern "C" __declspec (dllexport) int16 +# define IMP extern "C" __declspec (dllimport) int16 +# define HEAD extern "C" __declspec (dllexport) int16 +#endif + +// ----- Visual C++ / Borland C++ Builder for Windows 32 bit starting with Windows 95 ----- +#if defined(VC_WIN95) || defined(VC_WINNT) +# ifndef NO_WTYPES_IN_DLLTYP +# include <wtypes.h> +# endif +# define int8 char +# define uint8 unsigned char +# define int16 short int +# define uint16 unsigned short int +# define int32 long int +# define uint32 unsigned long int +# define int64 __int64 +# define uint64 unsigned int64 +# define dataptr void* +# define ptr8 char* +# define uptr8 unsigned char* +# define ptr16 short int* +# define uptr16 unsigned short int* +# define ptr32 long int* +# define uptr32 unsigned long int* +# ifndef __cplusplus +# define bool int8 +# define true 1 +# define false 0 +# endif +# define drv_handle void* + +# ifdef __cplusplus +# define EXP extern "C" __declspec (dllexport) int16 +# define EXPC extern __declspec (dllexport) int16 +# define IMP extern "C" __declspec (dllimport) int16 +# define HEAD extern "C" __declspec (dllexport) int16 + +# define SPCM_EXPORT extern "C" __declspec (dllexport) +# define SPCM_IMPORT extern "C" __declspec (dllimport) +# else +# define EXP extern __declspec (dllexport) int16 +# define EXPC extern __declspec (dllexport) int16 +# define IMP extern __declspec (dllimport) int16 +# define HEAD extern __declspec (dllexport) int16 + +# define SPCM_EXPORT extern __declspec (dllexport) +# define SPCM_IMPORT extern __declspec (dllimport) +# endif +#endif + +// ----- Visual C++ using standard calls for all windows 32 bit platforms ----- +#if defined(VC_STDCALL95) || defined(VC_STDCALLNT) +# ifndef NO_WTYPES_IN_DLLTYP +# include <wtypes.h> +# endif +# define int8 char +# define uint8 unsigned char +# define int16 short int +# define uint16 unsigned short int +# define int32 long int +# define uint32 unsigned long int +# define int64 __int64 +# define uint64 unsigned __int64 +# define dataptr void* +# define ptr8 char* +# define uptr8 unsigned char* +# define ptr16 short int* +# define uptr16 unsigned short int* +# define ptr32 long int* +# define uptr32 unsigned long int* +# ifndef __cplusplus +# define bool int8 +# define true 1 +# define false 0 +# endif +# define drv_handle void* +# define EXP extern "C" __declspec (dllexport) int16 _stdcall +# define EXPC extern __declspec (dllexport) int16 _stdcall +# define IMP extern "C" __declspec (dllimport) int16 _stdcall +# define HEAD extern "C" __declspec (dllexport) int16 _stdcall + +# define SPCM_EXPORT extern "C" __declspec (dllexport) +# define SPCM_IMPORT extern "C" __declspec (dllimport) +#endif + +// ----- Linux ----- +#if defined (_LINUX) || defined (_QNX) +# if defined (__aarch64__) +# define int8 signed char // on Jetson "char" is unsigned +# else +# define int8 char +# endif +# define int16 short int +# define int32 int +# define int64 long long +# define uint8 unsigned char +# define uint16 unsigned short int +# define uint32 unsigned int +# define uint64 unsigned long long +# define dataptr void * +# define ptr8 int8* +# define ptr16 int16* +# define ptr32 int32* +# define uptr8 uint8* +# define uptr16 uint16* +# define uptr32 uint32* +# if !defined(bool) && !defined(__cplusplus) +# define bool int8 +# define true 1 +# define false 0 +# endif +# define drv_handle void* +# define EXPC int16 +# define HEAD int16 +# define SPEC_IOC_MAGIC 's' +# define SPEC_IOC_MAXNR 6 +# define GETPARAM _IOR(SPEC_IOC_MAGIC,1,int32[2]) +# define SETPARAM _IOW(SPEC_IOC_MAGIC,2,int32[2]) +# define GETCH _IOR(SPEC_IOC_MAGIC,3,int32[1]) +# define SETCH _IOW(SPEC_IOC_MAGIC,4,int32[1]) + typedef struct {int32 lReg; void* pvAdr;} _SETGETADR ; +# define SETADR _IOW(SPEC_IOC_MAGIC,5,_SETGETADR) +# define GETADR _IOR(SPEC_IOC_MAGIC,6,_SETGETADR) + +# ifdef __cplusplus +# define SPCM_IMPORT extern "C" +# if __GNUC__ >= 4 +# define SPCM_EXPORT extern "C" __attribute__ ((visibility ("default"))) +# else +# define SPCM_EXPORT extern "C" +# endif +# else +# define SPCM_IMPORT +# define SPCM_EXPORT extern "C" +# endif +# define _stdcall +#endif + +// ----- LabWindows/CVI ----- +#if defined(_LWCVI) +# define int8 char +# define uint8 unsigned char +# define int16 short int +# define uint16 unsigned short int +# define int32 long int +# define uint32 unsigned long int +# define int64 __int64 +# define uint64 unsigned int64 +# define dataptr void* +# define ptr8 char* +# define uptr8 unsigned char* +# define ptr16 short int* +# define uptr16 unsigned short int* +# define ptr32 long int* +# define uptr32 unsigned long int* +# define drv_handle void* +# define bool int8 +# define true 1 +# define false 0 +# define SPCM_EXPORT extern "C" __declspec (dllexport) +# define SPCM_IMPORT +# define _stdcall __stdcall +#endif + +// ----- Gnu C Windows ----- +#if defined (_GCCWIN) +typedef char int8; +typedef short int int16; +typedef int int32; +typedef long long int64; +typedef unsigned char uint8; +typedef unsigned short int uint16; +typedef unsigned long int uint32; +typedef unsigned long long uint64; +typedef void* dataptr; +typedef int8* ptr8; +typedef int16* ptr16; +typedef int32* ptr32; +typedef uint8* uptr8; +typedef uint16* uptr16; +typedef uint32* uptr32; +# if !defined(bool) && !defined(__cplusplus) + typedef int8 bool; +# define true 1 +# define false 0 +# endif +typedef void* drv_handle; +typedef int16 EXPC; +typedef int16 HEAD; +# ifdef __cplusplus +# define SPCM_IMPORT extern "C" +# if __GNUC__ >= 4 +# define SPCM_EXPORT extern "C" __attribute__ ((visibility ("default"))) +# else +# define SPCM_EXPORT extern "C" +# endif +# else +# define SPCM_IMPORT +# define SPCM_EXPORT extern "C" +# endif +#endif + +// --- define data structure for segment statistic mode +typedef struct + { + int64 llAvrg; + int16 nMin; + int16 nMax; + uint32 dwMinPos; + uint32 dwMaxPos; + uint32 _Unused; + uint64 qw_Timestamp; + } SPCM_SEGSTAT_STRUCT_CHx; + +#endif diff --git a/Cpp/examples/c_cpp/c_header/errors.h b/Cpp/examples/c_cpp/c_header/errors.h new file mode 100644 index 0000000000000000000000000000000000000000..6a733be4604357cc2d3351707f4fb20a0edd26fa --- /dev/null +++ b/Cpp/examples/c_cpp/c_header/errors.h @@ -0,0 +1,12 @@ +// *********************************************************************** +// errors.h: Old Spectrum error code header file. Has been changed in may +// 2004 to spcerr.h because errors.h has already been in use by +// windows. +// Please change the include section of your project to include +// spcerr.h directly. +// *********************************************************************** + + +#pragma message ("*** Please change include path from errors.h to spcerr.h ***") + +#include "spcerr.h" diff --git a/Cpp/examples/c_cpp/c_header/readme.txt b/Cpp/examples/c_cpp/c_header/readme.txt new file mode 100644 index 0000000000000000000000000000000000000000..0f2ebceb1bf87aa82ab71791e7b04b11e906c07d --- /dev/null +++ b/Cpp/examples/c_cpp/c_header/readme.txt @@ -0,0 +1,71 @@ +************************************************************************** +c_header directory (c) Spectrum GmbH +************************************************************************** + +The directory contains all header and library files for all Spectrum +drivers for ISA, PCI, PCI-X, PCIe, cPCI and PXI cards. + +************************************************************************** + + + +Common header files used by all drivers +--------------------------------------- + +dlltyp.h: definitions common for all Spectrum drivers and card types. This + header tries to examine the type of compiler and then defines common + data types that have the same length under all compilers and all + operating systems. + +regs.h: software register and constants definition for all Spectrum + drivers. + +spcerr.h: error codes of all Spectrum drivers. Until may 2004 this file was + errors.h. Name has been changed because errors.h has been already in + use by windows. + + + +Library and Header files of driver for ISA/PCI/MI/MC/MX cards +------------------------------------------------------------- + +spcioctl.inc: linux include file to access driver functions via kernel + calls. Is needed by all linux based programs that access one of the + ISA/PCI/MI/MC/MX Spectrum cards + +errors.h: former error file. Thsi file is just included because of + compatibility reasons with old projects. Please use spcerr.h + +spectrum.h: header file that contains all the prototypes of the driver + functions + +spectrum.lib: library file for Microsoft Visual C++ for the spectrum + driver DLL. Calling type is c-call. + +SpcStdNT.lib: library file for other compilers for the spectrum + driver DLL. Calling type is stdcall. + +spclib_bcc.lib: library for Borland C++ Builder for the spectrum + driver DLL. + + + +Library and Header files of driver for SPCM driver based cards +------------------------------------------------------------- + +spcm_drv.h: header file that contains all the prototypes of the + driver functions of the spcm driver + +spcm_win32_msvcpp.lib: library file for the Microsoft Visual C++ + compiler. Calling type is stdcall. + +spcm_win32_bcppb.lib: library file for the Borland C++ Builder + compiler + +spcm_win32_cvi.lib: library file for National Instruments + LabWindows/CVI compiler + +spectrum_comp.lib: library file of the compatibility DLL that + simulates MI cards when findng M2i cards. Please include + this file instead of spectrum.lib for all projects that + should use M2i cards with the MI software interface diff --git a/Cpp/examples/c_cpp/c_header/regs.h b/Cpp/examples/c_cpp/c_header/regs.h new file mode 100644 index 0000000000000000000000000000000000000000..0171a6d390bd9aa09709b29f25f6868f890115ca --- /dev/null +++ b/Cpp/examples/c_cpp/c_header/regs.h @@ -0,0 +1,3688 @@ +// *********************************************************************** +// +// regs.h (c) Spectrum GmbH, 2006 +// +// *********************************************************************** +// +// software register and constants definition for all Spectrum drivers. +// Please stick to the card manual to see which of the inhere defined +// registers are used on your hardware. +// +// *********************************************************************** + + + +// *********************************************************************** +// macros for kilo, Mega or Giga as standard version or binary (_B) (2^x) +// *********************************************************************** + +#define KILO(k) ((uint64) 1000 * (k)) +#define MEGA(m) ((uint64) 1000 * 1000 * (m)) +#define GIGA(g) ((uint64) 1000 * 1000 * 1000 * (g)) +#define KILO_B(k) ((uint64) 1024 * (k)) +#define MEGA_B(m) ((uint64) 1024 * 1024 * (m)) +#define GIGA_B(g) ((uint64) 1024 * 1024 * 1024 * (g)) + + + + +// *********************************************************************** +// card types +// *********************************************************************** + +#define TYP_PCIDEVICEID 0x00000000l + +// ***** Board Types *************** +#define TYP_EVAL 0x00000010l +#define TYP_RSDLGA 0x00000014l +#define TYP_GMG 0x00000018l +#define TYP_VAN8 0x00000020l +#define TYP_VAC 0x00000028l + +#define TYP_PCIAUTOINSTALL 0x000000FFl + +#define TYP_DAP116 0x00000100l +#define TYP_PAD82 0x00000200l +#define TYP_PAD82a 0x00000210l +#define TYP_PAD82b 0x00000220l +#define TYP_PCI212 0x00000300l +#define TYP_PAD1232a 0x00000400l +#define TYP_PAD1232b 0x00000410l +#define TYP_PAD1232c 0x00000420l +#define TYP_PAD1616a 0x00000500l +#define TYP_PAD1616b 0x00000510l +#define TYP_PAD1616c 0x00000520l +#define TYP_PAD1616d 0x00000530l +#define TYP_PAD52 0x00000600l +#define TYP_PAD242 0x00000700l +#define TYP_PCK400 0x00000800l +#define TYP_PAD164_2M 0x00000900l +#define TYP_PAD164_5M 0x00000910l +#define TYP_PCI208 0x00001000l +#define TYP_CPCI208 0x00001001l +#define TYP_PCI412 0x00001100l +#define TYP_PCIDIO32 0x00001200l +#define TYP_PCI248 0x00001300l +#define TYP_PADCO 0x00001400l +#define TYP_TRS582 0x00001500l +#define TYP_PCI258 0x00001600l + + +// ------ series and familiy identifiers ----- +#define TYP_SERIESMASK 0x00FF0000l // the series (= type of base card), e.g. MI.xxxx +#define TYP_VERSIONMASK 0x0000FFFFl // the version, e.g. XX.3012 +#define TYP_FAMILYMASK 0x0000FF00l // the family, e.g. XX.30xx +#define TYP_TYPEMASK 0x000000FFl // the type, e.g. XX.xx12 +#define TYP_SPEEDMASK 0x000000F0l // the speed grade, e.g. XX.xx1x +#define TYP_CHMASK 0x0000000Fl // the channel/modules, e.g. XX.xxx2 + +#define TYP_MISERIES 0x00000000l +#define TYP_MCSERIES 0x00010000l +#define TYP_MXSERIES 0x00020000l +#define TYP_M2ISERIES 0x00030000l +#define TYP_M2IEXPSERIES 0x00040000l +#define TYP_M3ISERIES 0x00050000l +#define TYP_M3IEXPSERIES 0x00060000l +#define TYP_M4IEXPSERIES 0x00070000l +#define TYP_M4XEXPSERIES 0x00080000l +#define TYP_M2PEXPSERIES 0x00090000l +#define TYP_M5IEXPSERIES 0x000A0000l + + + +// ----- MI.20xx, MC.20xx, MX.20xx ----- +#define TYP_MI2020 0x00002020l +#define TYP_MI2021 0x00002021l +#define TYP_MI2025 0x00002025l +#define TYP_MI2030 0x00002030l +#define TYP_MI2031 0x00002031l + +#define TYP_M2I2020 0x00032020l +#define TYP_M2I2021 0x00032021l +#define TYP_M2I2025 0x00032025l +#define TYP_M2I2030 0x00032030l +#define TYP_M2I2031 0x00032031l + +#define TYP_M2I2020EXP 0x00042020l +#define TYP_M2I2021EXP 0x00042021l +#define TYP_M2I2025EXP 0x00042025l +#define TYP_M2I2030EXP 0x00042030l +#define TYP_M2I2031EXP 0x00042031l + +#define TYP_MC2020 0x00012020l +#define TYP_MC2021 0x00012021l +#define TYP_MC2025 0x00012025l +#define TYP_MC2030 0x00012030l +#define TYP_MC2031 0x00012031l + +#define TYP_MX2020 0x00022020l +#define TYP_MX2025 0x00022025l +#define TYP_MX2030 0x00022030l + +// ----- M3i.21xx, M3i.21xx-Exp (8 bit A/D) ----- +#define TYP_M3I2120 0x00052120l // 1x500M +#define TYP_M3I2122 0x00052122l // 1x500M & 2x250M +#define TYP_M3I2130 0x00052130l // 1x1G +#define TYP_M3I2132 0x00052132l // 1x1G & 2x500M + +#define TYP_M3I2120EXP 0x00062120l // 1x500M +#define TYP_M3I2122EXP 0x00062122l // 1x500M & 2x250M +#define TYP_M3I2130EXP 0x00062130l // 1x1G +#define TYP_M3I2132EXP 0x00062132l // 1x1G & 2x500M + +// ----- M4i.22xx-x8 (8 bit A/D) ----- +#define TYP_M4I22XX_X8 0x00072200l +#define TYP_M4I2210_X8 0x00072210l // 1x1.25G +#define TYP_M4I2211_X8 0x00072211l // 2x1.25G +#define TYP_M4I2212_X8 0x00072212l // 4x1.25G +#define TYP_M4I2220_X8 0x00072220l // 1x2.5G +#define TYP_M4I2221_X8 0x00072221l // 2x2.5G +#define TYP_M4I2223_X8 0x00072223l // 1x2.5G & 2x1.25G +#define TYP_M4I2230_X8 0x00072230l // 1x5G +#define TYP_M4I2233_X8 0x00072233l // 1x5G & 2x2.5G +#define TYP_M4I2234_X8 0x00072234l // 1x5G & 2x2.5G & 4x1.25G +#define TYP_M4I2280_X8 0x00072280l // customer specific variant +#define TYP_M4I2281_X8 0x00072281l // customer specific variant +#define TYP_M4I2283_X8 0x00072283l // customer specific variant +#define TYP_M4I2290_X8 0x00072290l // customer specific variant +#define TYP_M4I2293_X8 0x00072293l // customer specific variant +#define TYP_M4I2294_X8 0x00072294l // customer specific variant + +// ----- M4x.22xx-x8 (8 bit A/D) ----- +#define TYP_M4X22XX_X4 0x00082200l +#define TYP_M4X2210_X4 0x00082210l // 1x1.25G +#define TYP_M4X2211_X4 0x00082211l // 2x1.25G +#define TYP_M4X2212_X4 0x00082212l // 4x1.25G +#define TYP_M4X2220_X4 0x00082220l // 1x2.5G +#define TYP_M4X2221_X4 0x00082221l // 2x2.5G +#define TYP_M4X2223_X4 0x00082223l // 1x2.5G & 2x1.25G +#define TYP_M4X2230_X4 0x00082230l // 1x5G +#define TYP_M4X2233_X4 0x00082233l // 1x5G & 2x2.5G +#define TYP_M4X2234_X4 0x00082234l // 1x5G & 2x2.5G & 4x1.25G + +// ----- M4i.23xx-x8 (7 bit A/D) ----- +#define TYP_M4I23XX_X8 0x00072300l +#define TYP_M4I2320_X8 0x00072320l // 1x2.5G +#define TYP_M4I2321_X8 0x00072321l // 2x2.5G +#define TYP_M4I2323_X8 0x00072323l // 1x2.5G & 2x1.25G +#define TYP_M4I2330_X8 0x00072330l // 1x5G +#define TYP_M4I2333_X8 0x00072333l // 1x5G & 2x2.5G +#define TYP_M4I2334_X8 0x00072334l // 1x5G & 2x2.5G & 4x1.25G + +// ----- MI.30xx, MC.30xx, MX.30xx ----- +#define TYP_MI3010 0x00003010l +#define TYP_MI3011 0x00003011l +#define TYP_MI3012 0x00003012l +#define TYP_MI3013 0x00003013l +#define TYP_MI3014 0x00003014l +#define TYP_MI3015 0x00003015l +#define TYP_MI3016 0x00003016l +#define TYP_MI3020 0x00003020l +#define TYP_MI3021 0x00003021l +#define TYP_MI3022 0x00003022l +#define TYP_MI3023 0x00003023l +#define TYP_MI3024 0x00003024l +#define TYP_MI3025 0x00003025l +#define TYP_MI3026 0x00003026l +#define TYP_MI3027 0x00003027l +#define TYP_MI3031 0x00003031l +#define TYP_MI3033 0x00003033l + +#define TYP_M2I3010 0x00033010l +#define TYP_M2I3011 0x00033011l +#define TYP_M2I3012 0x00033012l +#define TYP_M2I3013 0x00033013l +#define TYP_M2I3014 0x00033014l +#define TYP_M2I3015 0x00033015l +#define TYP_M2I3016 0x00033016l +#define TYP_M2I3020 0x00033020l +#define TYP_M2I3021 0x00033021l +#define TYP_M2I3022 0x00033022l +#define TYP_M2I3023 0x00033023l +#define TYP_M2I3024 0x00033024l +#define TYP_M2I3025 0x00033025l +#define TYP_M2I3026 0x00033026l +#define TYP_M2I3027 0x00033027l +#define TYP_M2I3031 0x00033031l +#define TYP_M2I3033 0x00033033l + +#define TYP_M2I3010EXP 0x00043010l +#define TYP_M2I3011EXP 0x00043011l +#define TYP_M2I3012EXP 0x00043012l +#define TYP_M2I3013EXP 0x00043013l +#define TYP_M2I3014EXP 0x00043014l +#define TYP_M2I3015EXP 0x00043015l +#define TYP_M2I3016EXP 0x00043016l +#define TYP_M2I3020EXP 0x00043020l +#define TYP_M2I3021EXP 0x00043021l +#define TYP_M2I3022EXP 0x00043022l +#define TYP_M2I3023EXP 0x00043023l +#define TYP_M2I3024EXP 0x00043024l +#define TYP_M2I3025EXP 0x00043025l +#define TYP_M2I3026EXP 0x00043026l +#define TYP_M2I3027EXP 0x00043027l +#define TYP_M2I3031EXP 0x00043031l +#define TYP_M2I3033EXP 0x00043033l + +#define TYP_MC3010 0x00013010l +#define TYP_MC3011 0x00013011l +#define TYP_MC3012 0x00013012l +#define TYP_MC3013 0x00013013l +#define TYP_MC3014 0x00013014l +#define TYP_MC3015 0x00013015l +#define TYP_MC3016 0x00013016l +#define TYP_MC3020 0x00013020l +#define TYP_MC3021 0x00013021l +#define TYP_MC3022 0x00013022l +#define TYP_MC3023 0x00013023l +#define TYP_MC3024 0x00013024l +#define TYP_MC3025 0x00013025l +#define TYP_MC3026 0x00013026l +#define TYP_MC3027 0x00013027l +#define TYP_MC3031 0x00013031l +#define TYP_MC3033 0x00013033l + +#define TYP_MX3010 0x00023010l +#define TYP_MX3011 0x00023011l +#define TYP_MX3012 0x00023012l +#define TYP_MX3020 0x00023020l +#define TYP_MX3021 0x00023021l +#define TYP_MX3022 0x00023022l +#define TYP_MX3031 0x00023031l + + + +// ----- MI.31xx, MC.31xx, MX.31xx ----- +#define TYP_MI3110 0x00003110l +#define TYP_MI3111 0x00003111l +#define TYP_MI3112 0x00003112l +#define TYP_MI3120 0x00003120l +#define TYP_MI3121 0x00003121l +#define TYP_MI3122 0x00003122l +#define TYP_MI3130 0x00003130l +#define TYP_MI3131 0x00003131l +#define TYP_MI3132 0x00003132l +#define TYP_MI3140 0x00003140l + +#define TYP_M2I3110 0x00033110l +#define TYP_M2I3111 0x00033111l +#define TYP_M2I3112 0x00033112l +#define TYP_M2I3120 0x00033120l +#define TYP_M2I3121 0x00033121l +#define TYP_M2I3122 0x00033122l +#define TYP_M2I3130 0x00033130l +#define TYP_M2I3131 0x00033131l +#define TYP_M2I3132 0x00033132l + +#define TYP_M2I3110EXP 0x00043110l +#define TYP_M2I3111EXP 0x00043111l +#define TYP_M2I3112EXP 0x00043112l +#define TYP_M2I3120EXP 0x00043120l +#define TYP_M2I3121EXP 0x00043121l +#define TYP_M2I3122EXP 0x00043122l +#define TYP_M2I3130EXP 0x00043130l +#define TYP_M2I3131EXP 0x00043131l +#define TYP_M2I3132EXP 0x00043132l + +#define TYP_MC3110 0x00013110l +#define TYP_MC3111 0x00013111l +#define TYP_MC3112 0x00013112l +#define TYP_MC3120 0x00013120l +#define TYP_MC3121 0x00013121l +#define TYP_MC3122 0x00013122l +#define TYP_MC3130 0x00013130l +#define TYP_MC3131 0x00013131l +#define TYP_MC3132 0x00013132l + +#define TYP_MX3110 0x00023110l +#define TYP_MX3111 0x00023111l +#define TYP_MX3120 0x00023120l +#define TYP_MX3121 0x00023121l +#define TYP_MX3130 0x00023130l +#define TYP_MX3131 0x00023131l + + + +// ----- M3i.32xx, M3i.32xx-Exp (12 bit A/D) ----- +#define TYP_M3I3220 0x00053220l // 1x250M +#define TYP_M3I3221 0x00053221l // 2x250M +#define TYP_M3I3240 0x00053240l // 1x500M +#define TYP_M3I3242 0x00053242l // 1x500M & 2x250M + +#define TYP_M3I3220EXP 0x00063220l // 1x250M +#define TYP_M3I3221EXP 0x00063221l // 2x250M +#define TYP_M3I3240EXP 0x00063240l // 1x500M +#define TYP_M3I3242EXP 0x00063242l // 1x500M & 2x250M + +// ----- M5i.33xx-x4 (12 bit A/D) ----- +#define TYP_M5I33XX_X16 0x000A3300 // generic +#define TYP_M5I3321_X16 0x000A3321 // 2x3.2G 12bit +#define TYP_M5I3330_X16 0x000A3330 // 1x6.4G 12bit +#define TYP_M5I3337_X16 0x000A3337 // 1x6.4G 2x3.2G 12bit +#define TYP_M5I3350_X16 0x000A3350 // 1x10G 12bit +#define TYP_M5I3357_X16 0x000A3357 // 1x10G 2x5G 12bit + +// ----- MI.40xx, MC.40xx, MX.40xx ----- +#define TYP_MI4020 0x00004020l +#define TYP_MI4021 0x00004021l +#define TYP_MI4022 0x00004022l +#define TYP_MI4030 0x00004030l +#define TYP_MI4031 0x00004031l +#define TYP_MI4032 0x00004032l + +#define TYP_M2I4020 0x00034020l +#define TYP_M2I4021 0x00034021l +#define TYP_M2I4022 0x00034022l +#define TYP_M2I4028 0x00034028l +#define TYP_M2I4030 0x00034030l +#define TYP_M2I4031 0x00034031l +#define TYP_M2I4032 0x00034032l +#define TYP_M2I4038 0x00034038l + +#define TYP_M2I4020EXP 0x00044020l +#define TYP_M2I4021EXP 0x00044021l +#define TYP_M2I4022EXP 0x00044022l +#define TYP_M2I4028EXP 0x00044028l +#define TYP_M2I4030EXP 0x00044030l +#define TYP_M2I4031EXP 0x00044031l +#define TYP_M2I4032EXP 0x00044032l +#define TYP_M2I4038EXP 0x00044038l + +#define TYP_MC4020 0x00014020l +#define TYP_MC4021 0x00014021l +#define TYP_MC4022 0x00014022l +#define TYP_MC4030 0x00014030l +#define TYP_MC4031 0x00014031l +#define TYP_MC4032 0x00014032l + +#define TYP_MX4020 0x00024020l +#define TYP_MX4021 0x00024021l +#define TYP_MX4030 0x00024030l +#define TYP_MX4031 0x00024031l + + + +// ----- M3i.41xx, M3i.41xx-Exp (14 bit A/D) ----- +#define TYP_M3I4110 0x00054110l // 1x100M +#define TYP_M3I4111 0x00054111l // 2x100M +#define TYP_M3I4120 0x00054120l // 1x250M +#define TYP_M3I4121 0x00054121l // 2x250M +#define TYP_M3I4140 0x00054140l // 1x400M +#define TYP_M3I4142 0x00054142l // 1x400M & 2x250M + +#define TYP_M3I4110EXP 0x00064110l // 1x100M +#define TYP_M3I4111EXP 0x00064111l // 2x100M +#define TYP_M3I4120EXP 0x00064120l // 1x250M +#define TYP_M3I4121EXP 0x00064121l // 2x250M +#define TYP_M3I4140EXP 0x00064140l // 1x400M +#define TYP_M3I4142EXP 0x00064142l // 1x400M & 2x250M + +// ----- M4i.44xx-x8 (generic) ----- +#define TYP_M4I44XX_X8 0x00074400 // + +#define TYP_M4I4410_X8 0x00074410 // 2x130M 16bit +#define TYP_M4I4411_X8 0x00074411 // 4x130M 16bit +#define TYP_M4I4420_X8 0x00074420 // 2x250M 16bit +#define TYP_M4I4421_X8 0x00074421 // 4x250M 16bit +#define TYP_M4I4450_X8 0x00074450 // 2x500M 14bit +#define TYP_M4I4451_X8 0x00074451 // 4x500M 14bit +#define TYP_M4I4470_X8 0x00074470 // 2x180M 16bit +#define TYP_M4I4471_X8 0x00074471 // 4x180M 16bit +#define TYP_M4I4480_X8 0x00074480 // 2x400M 14bit +#define TYP_M4I4481_X8 0x00074481 // 4x400M 14bit + +// ----- M4x.44xx-x4 (14/16 bit A/D) ----- +#define TYP_M4X44XX_X4 0x00084400 // generic +#define TYP_M4X4410_X4 0x00084410 // 2x130M 16bit +#define TYP_M4X4411_X4 0x00084411 // 4x130M 16bit +#define TYP_M4X4420_X4 0x00084420 // 2x250M 16bit +#define TYP_M4X4421_X4 0x00084421 // 4x250M 16bit +#define TYP_M4X4450_X4 0x00084450 // 2x500M 14bit +#define TYP_M4X4451_X4 0x00084451 // 4x500M 14bit +#define TYP_M4X4470_X4 0x00084470 // 2x180M 16bit +#define TYP_M4X4471_X4 0x00084471 // 4x180M 16bit +#define TYP_M4X4480_X4 0x00084480 // 2x400M 14bit +#define TYP_M4X4481_X4 0x00084481 // 4x400M 14bit + + +// ----- MI.45xx, MC.45xx, MX.45xx ----- +#define TYP_MI4520 0x00004520l +#define TYP_MI4521 0x00004521l +#define TYP_MI4530 0x00004530l +#define TYP_MI4531 0x00004531l +#define TYP_MI4540 0x00004540l +#define TYP_MI4541 0x00004541l + +#define TYP_M2I4520 0x00034520l +#define TYP_M2I4521 0x00034521l +#define TYP_M2I4530 0x00034530l +#define TYP_M2I4531 0x00034531l +#define TYP_M2I4540 0x00034540l +#define TYP_M2I4541 0x00034541l + +#define TYP_MC4520 0x00014520l +#define TYP_MC4521 0x00014521l +#define TYP_MC4530 0x00014530l +#define TYP_MC4531 0x00014531l +#define TYP_MC4540 0x00014540l +#define TYP_MC4541 0x00014541l + +#define TYP_MX4520 0x00024520l +#define TYP_MX4530 0x00024530l +#define TYP_MX4540 0x00024540l + + + +// ----- MI.46xx, MC.46xx, MX.46xx ----- +#define TYP_MI4620 0x00004620l +#define TYP_MI4621 0x00004621l +#define TYP_MI4622 0x00004622l +#define TYP_MI4630 0x00004630l +#define TYP_MI4631 0x00004631l +#define TYP_MI4632 0x00004632l +#define TYP_MI4640 0x00004640l +#define TYP_MI4641 0x00004641l +#define TYP_MI4642 0x00004642l +#define TYP_MI4650 0x00004650l +#define TYP_MI4651 0x00004651l +#define TYP_MI4652 0x00004652l + +#define TYP_M2I4620 0x00034620l +#define TYP_M2I4621 0x00034621l +#define TYP_M2I4622 0x00034622l +#define TYP_M2I4630 0x00034630l +#define TYP_M2I4631 0x00034631l +#define TYP_M2I4632 0x00034632l +#define TYP_M2I4640 0x00034640l +#define TYP_M2I4641 0x00034641l +#define TYP_M2I4642 0x00034642l +#define TYP_M2I4650 0x00034650l +#define TYP_M2I4651 0x00034651l +#define TYP_M2I4652 0x00034652l + +#define TYP_M2I4620EXP 0x00044620l +#define TYP_M2I4621EXP 0x00044621l +#define TYP_M2I4622EXP 0x00044622l +#define TYP_M2I4630EXP 0x00044630l +#define TYP_M2I4631EXP 0x00044631l +#define TYP_M2I4632EXP 0x00044632l +#define TYP_M2I4640EXP 0x00044640l +#define TYP_M2I4641EXP 0x00044641l +#define TYP_M2I4642EXP 0x00044642l +#define TYP_M2I4650EXP 0x00044650l +#define TYP_M2I4651EXP 0x00044651l +#define TYP_M2I4652EXP 0x00044652l + +#define TYP_MC4620 0x00014620l +#define TYP_MC4621 0x00014621l +#define TYP_MC4622 0x00014622l +#define TYP_MC4630 0x00014630l +#define TYP_MC4631 0x00014631l +#define TYP_MC4632 0x00014632l +#define TYP_MC4640 0x00014640l +#define TYP_MC4641 0x00014641l +#define TYP_MC4642 0x00014642l +#define TYP_MC4650 0x00014650l +#define TYP_MC4651 0x00014651l +#define TYP_MC4652 0x00014652l + +#define TYP_MX4620 0x00024620l +#define TYP_MX4621 0x00024621l +#define TYP_MX4630 0x00024630l +#define TYP_MX4631 0x00024631l +#define TYP_MX4640 0x00024640l +#define TYP_MX4641 0x00024641l +#define TYP_MX4650 0x00024650l +#define TYP_MX4651 0x00024651l + + + +// ----- MI.47xx, MC.47xx, MX.47xx ----- +#define TYP_MI4710 0x00004710l +#define TYP_MI4711 0x00004711l +#define TYP_MI4720 0x00004720l +#define TYP_MI4721 0x00004721l +#define TYP_MI4730 0x00004730l +#define TYP_MI4731 0x00004731l +#define TYP_MI4740 0x00004740l +#define TYP_MI4741 0x00004741l + +#define TYP_M2I4710 0x00034710l +#define TYP_M2I4711 0x00034711l +#define TYP_M2I4720 0x00034720l +#define TYP_M2I4721 0x00034721l +#define TYP_M2I4730 0x00034730l +#define TYP_M2I4731 0x00034731l +#define TYP_M2I4740 0x00034740l +#define TYP_M2I4741 0x00034741l + +#define TYP_M2I4710EXP 0x00044710l +#define TYP_M2I4711EXP 0x00044711l +#define TYP_M2I4720EXP 0x00044720l +#define TYP_M2I4721EXP 0x00044721l +#define TYP_M2I4730EXP 0x00044730l +#define TYP_M2I4731EXP 0x00044731l +#define TYP_M2I4740EXP 0x00044740l +#define TYP_M2I4741EXP 0x00044741l + +#define TYP_MC4710 0x00014710l +#define TYP_MC4711 0x00014711l +#define TYP_MC4720 0x00014720l +#define TYP_MC4721 0x00014721l +#define TYP_MC4730 0x00014730l +#define TYP_MC4731 0x00014731l + +#define TYP_MX4710 0x00024710l +#define TYP_MX4720 0x00024720l +#define TYP_MX4730 0x00024730l + + + +// ----- M3i.48xx, M3i.48xx-Exp (16 bit A/D) ----- +#define TYP_M3I4830 0x00054830l +#define TYP_M3I4831 0x00054831l +#define TYP_M3I4840 0x00054840l +#define TYP_M3I4841 0x00054841l +#define TYP_M3I4860 0x00054860l +#define TYP_M3I4861 0x00054861l + +#define TYP_M3I4830EXP 0x00064830l +#define TYP_M3I4831EXP 0x00064831l +#define TYP_M3I4840EXP 0x00064840l +#define TYP_M3I4841EXP 0x00064841l +#define TYP_M3I4860EXP 0x00064860l +#define TYP_M3I4861EXP 0x00064861l + + + +// ----- MI.46xx, MC.46xx, MX.46xx ----- +#define TYP_MI4911 0x00004911l +#define TYP_MI4912 0x00004912l +#define TYP_MI4931 0x00004931l +#define TYP_MI4932 0x00004932l +#define TYP_MI4960 0x00004960l +#define TYP_MI4961 0x00004961l +#define TYP_MI4963 0x00004963l +#define TYP_MI4964 0x00004964l + +#define TYP_MC4911 0x00014911l +#define TYP_MC4912 0x00014912l +#define TYP_MC4931 0x00014931l +#define TYP_MC4932 0x00014932l +#define TYP_MC4960 0x00014960l +#define TYP_MC4961 0x00014961l +#define TYP_MC4963 0x00014963l +#define TYP_MC4964 0x00014964l + +#define TYP_MX4911 0x00024911l +#define TYP_MX4931 0x00024931l +#define TYP_MX4960 0x00024960l +#define TYP_MX4963 0x00024963l + +#define TYP_M2I4911 0x00034911l +#define TYP_M2I4912 0x00034912l +#define TYP_M2I4931 0x00034931l +#define TYP_M2I4932 0x00034932l +#define TYP_M2I4960 0x00034960l +#define TYP_M2I4961 0x00034961l +#define TYP_M2I4963 0x00034963l +#define TYP_M2I4964 0x00034964l + +#define TYP_M2I4911EXP 0x00044911l +#define TYP_M2I4912EXP 0x00044912l +#define TYP_M2I4931EXP 0x00044931l +#define TYP_M2I4932EXP 0x00044932l +#define TYP_M2I4960EXP 0x00044960l +#define TYP_M2I4961EXP 0x00044961l +#define TYP_M2I4963EXP 0x00044963l +#define TYP_M2I4964EXP 0x00044964l + +// ----- M2p.59xx-x4 ----- +#define TYP_M2P59XX_X4 0x00095900l // generic +#define TYP_M2P5911_X4 0x00095911l +#define TYP_M2P5912_X4 0x00095912l +#define TYP_M2P5913_X4 0x00095913l +#define TYP_M2P5916_X4 0x00095916l +#define TYP_M2P5920_X4 0x00095920l +#define TYP_M2P5921_X4 0x00095921l +#define TYP_M2P5922_X4 0x00095922l +#define TYP_M2P5923_X4 0x00095923l +#define TYP_M2P5926_X4 0x00095926l +#define TYP_M2P5930_X4 0x00095930l +#define TYP_M2P5931_X4 0x00095931l +#define TYP_M2P5932_X4 0x00095932l +#define TYP_M2P5933_X4 0x00095933l +#define TYP_M2P5936_X4 0x00095936l +#define TYP_M2P5940_X4 0x00095940l +#define TYP_M2P5941_X4 0x00095941l +#define TYP_M2P5942_X4 0x00095942l +#define TYP_M2P5943_X4 0x00095943l +#define TYP_M2P5946_X4 0x00095946l +#define TYP_M2P5960_X4 0x00095960l +#define TYP_M2P5961_X4 0x00095961l +#define TYP_M2P5962_X4 0x00095962l +#define TYP_M2P5966_X4 0x00095966l +#define TYP_M2P5968_X4 0x00095968l + + +// ----- MI.60xx, MC.60xx, MX.60xx ----- +#define TYP_MI6010 0x00006010l +#define TYP_MI6011 0x00006011l +#define TYP_MI6012 0x00006012l +#define TYP_MI6021 0x00006021l +#define TYP_MI6022 0x00006022l +#define TYP_MI6030 0x00006030l +#define TYP_MI6031 0x00006031l +#define TYP_MI6033 0x00006033l +#define TYP_MI6034 0x00006034l + +#define TYP_M2I6010 0x00036010l +#define TYP_M2I6011 0x00036011l +#define TYP_M2I6012 0x00036012l +#define TYP_M2I6021 0x00036021l +#define TYP_M2I6022 0x00036022l +#define TYP_M2I6030 0x00036030l +#define TYP_M2I6031 0x00036031l +#define TYP_M2I6033 0x00036033l +#define TYP_M2I6034 0x00036034l + +#define TYP_M2I6010EXP 0x00046010l +#define TYP_M2I6011EXP 0x00046011l +#define TYP_M2I6012EXP 0x00046012l +#define TYP_M2I6021EXP 0x00046021l +#define TYP_M2I6022EXP 0x00046022l +#define TYP_M2I6030EXP 0x00046030l +#define TYP_M2I6031EXP 0x00046031l +#define TYP_M2I6033EXP 0x00046033l +#define TYP_M2I6034EXP 0x00046034l + +#define TYP_MC6010 0x00016010l +#define TYP_MC6011 0x00016011l +#define TYP_MC6012 0x00016012l +#define TYP_MC6021 0x00016021l +#define TYP_MC6022 0x00016022l +#define TYP_MC6030 0x00016030l +#define TYP_MC6031 0x00016031l +#define TYP_MC6033 0x00016033l +#define TYP_MC6034 0x00016034l + +#define TYP_MX6010 0x00026010l +#define TYP_MX6011 0x00026011l +#define TYP_MX6021 0x00026021l +#define TYP_MX6030 0x00026030l +#define TYP_MX6033 0x00026033l + + + +// ----- MI.61xx, MC.61xx, MX.61xx ----- +#define TYP_MI6105 0x00006105l +#define TYP_MI6110 0x00006110l +#define TYP_MI6111 0x00006111l + +#define TYP_M2I6105 0x00036105l +#define TYP_M2I6110 0x00036110l +#define TYP_M2I6111 0x00036111l + +#define TYP_M2I6105EXP 0x00046105l +#define TYP_M2I6110EXP 0x00046110l +#define TYP_M2I6111EXP 0x00046111l + +#define TYP_MC6110 0x00016110l +#define TYP_MC6111 0x00016111l + +#define TYP_MX6110 0x00026110l + +// ----- M2p.65xx-x4 ----- +#define TYP_M2P65XX_X4 0x00096500l // generic +#define TYP_M2P6522_X4 0x00096522l // 4 ch @ 40 MS/s (1x4) (low voltage) +#define TYP_M2P6523_X4 0x00096523l // 8 ch @ 40 MS/s (low voltage) +#define TYP_M2P6530_X4 0x00096530l // 1 ch @ 40 MS/s +#define TYP_M2P6531_X4 0x00096531l // 2 ch @ 40 MS/s +#define TYP_M2P6532_X4 0x00096532l // 4 ch @ 40 MS/s (1x4) +#define TYP_M2P6536_X4 0x00096536l // 4 ch @ 40 MS/s (2x2) +#define TYP_M2P6533_X4 0x00096533l // 8 ch @ 40 MS/s +#define TYP_M2P6540_X4 0x00096540l // 1 ch @ 40 MS/s (high voltage) +#define TYP_M2P6541_X4 0x00096541l // 2 ch @ 40 MS/s (high voltage) +#define TYP_M2P6546_X4 0x00096546l // 4 ch @ 40 MS/s (2x2) (high voltage) +#define TYP_M2P6560_X4 0x00096560l // 1 ch @ 125 MS/s +#define TYP_M2P6561_X4 0x00096561l // 2 ch @ 125 MS/s +#define TYP_M2P6562_X4 0x00096562l // 4 ch @ 125 MS/s (1x4) +#define TYP_M2P6566_X4 0x00096566l // 4 ch @ 125 MS/s (2x2) +#define TYP_M2P6568_X4 0x00096568l // 8 ch @ 125/80 MS/s +#define TYP_M2P6570_X4 0x00096570l // 1 ch @ 125 MS/s (high voltage) +#define TYP_M2P6571_X4 0x00096571l // 2 ch @ 125 MS/s (high voltage) +#define TYP_M2P6576_X4 0x00096576l // 4 ch @ 125 MS/s (2x2) (high voltage) + +// ----- M4i.66xx-x8 (16 bit D/A) ----- +// ----- M4i.66xx-x8 (generic) ----- +#define TYP_M4I66XX_X8 0x00076600 + +#define TYP_M4I6620_X8 0x00076620 // 1 ch @ 625 MS/s +#define TYP_M4I6621_X8 0x00076621 // 2 ch @ 625 MS/s +#define TYP_M4I6622_X8 0x00076622 // 4 ch @ 625 MS/s +#define TYP_M4I6630_X8 0x00076630 // 1 ch @ 1250 MS/s +#define TYP_M4I6631_X8 0x00076631 // 2 ch @ 1250 MS/s + +// ----- M4x.66xx-x8 (16 bit D/A) ----- +// ----- M4x.66xx-x8 (generic) ----- +#define TYP_M4X66XX_X4 0x00086600 + +#define TYP_M4X6620_X4 0x00086620 // 1 ch @ 625 MS/s +#define TYP_M4X6621_X4 0x00086621 // 2 ch @ 625 MS/s +#define TYP_M4X6622_X4 0x00086622 // 4 ch @ 625 MS/s +#define TYP_M4X6630_X4 0x00086630 // 1 ch @ 1250 MS/s +#define TYP_M4X6631_X4 0x00086631 // 2 ch @ 1250 MS/s + +// ----- MI.70xx, MC.70xx, MX.70xx ----- +#define TYP_MI7005 0x00007005l +#define TYP_MI7010 0x00007010l +#define TYP_MI7011 0x00007011l +#define TYP_MI7020 0x00007020l +#define TYP_MI7021 0x00007021l + +#define TYP_M2I7005 0x00037005l +#define TYP_M2I7010 0x00037010l +#define TYP_M2I7011 0x00037011l +#define TYP_M2I7020 0x00037020l +#define TYP_M2I7021 0x00037021l + +#define TYP_M2I7005EXP 0x00047005l +#define TYP_M2I7010EXP 0x00047010l +#define TYP_M2I7011EXP 0x00047011l +#define TYP_M2I7020EXP 0x00047020l +#define TYP_M2I7021EXP 0x00047021l + +#define TYP_MC7005 0x00017005l +#define TYP_MC7010 0x00017010l +#define TYP_MC7011 0x00017011l +#define TYP_MC7020 0x00017020l +#define TYP_MC7021 0x00017021l + +#define TYP_MX7005 0x00027005l +#define TYP_MX7010 0x00027010l +#define TYP_MX7011 0x00027011l + + + +// ----- MI.72xx, MC.72xx, MX.72xx ----- +#define TYP_MI7210 0x00007210l +#define TYP_MI7211 0x00007211l +#define TYP_MI7220 0x00007220l +#define TYP_MI7221 0x00007221l + +#define TYP_M2I7210 0x00037210l +#define TYP_M2I7211 0x00037211l +#define TYP_M2I7220 0x00037220l +#define TYP_M2I7221 0x00037221l + +#define TYP_M2I7210EXP 0x00047210l +#define TYP_M2I7211EXP 0x00047211l +#define TYP_M2I7220EXP 0x00047220l +#define TYP_M2I7221EXP 0x00047221l + +#define TYP_MC7210 0x00017210l +#define TYP_MC7211 0x00017211l +#define TYP_MC7220 0x00017220l +#define TYP_MC7221 0x00017221l + +#define TYP_MX7210 0x00027210l +#define TYP_MX7220 0x00027220l + +// ----- M2p.75xx-x4 ----- +#define TYP_M2P75XX_X4 0x00097500l // generic +#define TYP_M2P7515_X4 0x00097515l + +// ----- M4i.77xx-x8 ----- +#define TYP_M4I77XX_X8 0x00077700 // generic +#define TYP_M4I7710_X8 0x00077710 // single-ended +#define TYP_M4I7720_X8 0x00077720 // single-ended +#define TYP_M4I7730_X8 0x00077730 // single-ended +#define TYP_M4I7725_X8 0x00077725 // differential +#define TYP_M4I7735_X8 0x00077735 // differential + +// ----- M4x.77xx-x8 ----- +#define TYP_M4X77XX_X4 0x00087700 // generic +#define TYP_M4X7710_X4 0x00087710 // single-ended +#define TYP_M4X7720_X4 0x00087720 // single-ended +#define TYP_M4X7730_X4 0x00087730 // single-ended +#define TYP_M4X7725_X4 0x00087725 // differential +#define TYP_M4X7735_X4 0x00087735 // differential + +// ----- MX.90xx ----- +#define TYP_MX9010 0x00029010l + + + +// *********************************************************************** +// software registers +// *********************************************************************** + + +// ***** PCI Features Bits (MI/MC/MX and prior cards) ********* +#define PCIBIT_MULTI 0x00000001 +#define PCIBIT_DIGITAL 0x00000002 +#define PCIBIT_CH0DIGI 0x00000004 +#define PCIBIT_EXTSAM 0x00000008 +#define PCIBIT_3CHANNEL 0x00000010 +#define PCIBIT_GATE 0x00000020 +#define PCIBIT_SLAVE 0x00000040 +#define PCIBIT_MASTER 0x00000080 +#define PCIBIT_DOUBLEMEM 0x00000100 +#define PCIBIT_SYNC 0x00000200 +#define PCIBIT_TIMESTAMP 0x00000400 +#define PCIBIT_STARHUB 0x00000800 +#define PCIBIT_CA 0x00001000 +#define PCIBIT_XIO 0x00002000 +#define PCIBIT_AMPLIFIER 0x00004000 +#define PCIBIT_DIFFMODE 0x00008000 + +#define PCIBIT_ELISA 0x10000000 + + +// ***** PCI features starting with M2i card series ***** +#define SPCM_FEAT_MULTI 0x00000001 // multiple recording +#define SPCM_FEAT_GATE 0x00000002 // gated sampling +#define SPCM_FEAT_DIGITAL 0x00000004 // additional synchronous digital inputs or outputs +#define SPCM_FEAT_TIMESTAMP 0x00000008 // timestamp +#define SPCM_FEAT_STARHUB5 0x00000020 // starhub for 5 cards installed (M2i + M2i-Exp) +#define SPCM_FEAT_STARHUB4 0x00000020 // starhub for 4 cards installed (M3i + M3i-Exp) +#define SPCM_FEAT_STARHUB6_EXTM 0x00000020 // starhub for 6 cards installed as card extension or piggy back (M2p) +#define SPCM_FEAT_STARHUB8_EXTM 0x00000020 // starhub for 8 cards installed as card extension or piggy back (M4i-Exp) +#define SPCM_FEAT_STARHUB16 0x00000040 // starhub for 16 cards installed (M2i, M2i-exp) +#define SPCM_FEAT_STARHUB16_EXTM 0x00000040 // starhub for 16 cards installed as card extension or piggy back (M2p) +#define SPCM_FEAT_STARHUB8 0x00000040 // starhub for 8 cards installed (M3i + M3i-Exp, M5i) +#define SPCM_FEAT_STARHUBXX_MASK 0x00000060 // mask to detect one of the above installed starhub +#define SPCM_FEAT_ABA 0x00000080 // ABA mode installed +#define SPCM_FEAT_BASEXIO 0x00000100 // extra I/O on base card installed +#define SPCM_FEAT_AMPLIFIER_10V 0x00000200 // external amplifier for 60/61 +#define SPCM_FEAT_STARHUBSYSMASTER 0x00000400 // system starhub master installed +#define SPCM_FEAT_DIFFMODE 0x00000800 // Differential mode installed +#define SPCM_FEAT_SEQUENCE 0x00001000 // Sequence programming mode for generator cards +#define SPCM_FEAT_AMPMODULE_10V 0x00002000 // amplifier module for 60/61 +#define SPCM_FEAT_STARHUBSYSSLAVE 0x00004000 // system starhub slave installed +#define SPCM_FEAT_NETBOX 0x00008000 // card is part of netbox +#define SPCM_FEAT_REMOTESERVER 0x00010000 // remote server can be used with this card +#define SPCM_FEAT_SCAPP 0x00020000 // SCAPP option (CUDA RDMA) +#define SPCM_FEAT_DIG16_SMB 0x00040000 // M2p: 16 additional digital inputs or outputs (via SMB connectors) +#define SPCM_FEAT_DIG8_SMA 0x00040000 // M4i: 8 additional digital inputs or 6 additional outputs (via SMA connectors) +#define SPCM_FEAT_DIG16_FX2 0x00080000 // M2p: 16 additional digital inputs or outputs (via FX2 connector) +#define SPCM_FEAT_DIGITALBWFILTER 0x00100000 // Digital BW filter is available +#define SPCM_FEAT_CUSTOMMOD_MASK 0xF0000000 // mask for custom modification code, meaning of code depends on type and customer + + +// ***** Extended Features starting with M4i ***** +#define SPCM_FEAT_EXTFW_SEGSTAT 0x00000001 // segment (Multiple Recording, ABA) statistics like average, min/max +#define SPCM_FEAT_EXTFW_SEGAVERAGE 0x00000002 // average of multiple segments (Multiple Recording, ABA) +#define SPCM_FEAT_EXTFW_BOXCAR 0x00000004 // boxcar averaging (high-res mode) +#define SPCM_FEAT_EXTFW_PULSEGEN 0x00000008 // pulse generators on XIO lines available + + +// ***** Error Request ************* +#define ERRORTEXTLEN 200 +#define SPC_LASTERRORTEXT 999996l +#define SPC_LASTERRORVALUE 999997l +#define SPC_LASTERRORREG 999998l +#define SPC_LASTERRORCODE 999999l // Reading this reset the internal error-memory. + +// ***** constants to use with the various _ACDC registers ***** +#define COUPLING_DC 0 +#define COUPLING_AC 1 + + +// ***** Register and Command Structure +#define SPC_COMMAND 0l +#define SPC_RESET 0l +#define SPC_SOFTRESET 1l +#define SPC_WRITESETUP 2l +#define SPC_START 10l +#define SPC_STARTANDWAIT 11l +#define SPC_FIFOSTART 12l +#define SPC_FIFOWAIT 13l +#define SPC_FIFOSTARTNOWAIT 14l +#define SPC_FORCETRIGGER 16l +#define SPC_STOP 20l +#define SPC_FLUSHFIFOBUFFER 21l +#define SPC_POWERDOWN 30l +#define SPC_SYNCMASTER 100l +#define SPC_SYNCTRIGGERMASTER 101l +#define SPC_SYNCMASTERFIFO 102l +#define SPC_SYNCSLAVE 110l +#define SPC_SYNCTRIGGERSLAVE 111l +#define SPC_SYNCSLAVEFIFO 112l +#define SPC_NOSYNC 120l +#define SPC_SYNCSTART 130l +#define SPC_SYNCCALCMASTER 140l +#define SPC_SYNCCALCMASTERFIFO 141l +#define SPC_PXIDIVIDERRESET 150l +#define SPC_RELAISON 200l +#define SPC_RELAISOFF 210l +#define SPC_ADJUSTSTART 300l +#define SPC_FIFO_BUFREADY0 400l +#define SPC_FIFO_BUFREADY1 401l +#define SPC_FIFO_BUFREADY2 402l +#define SPC_FIFO_BUFREADY3 403l +#define SPC_FIFO_BUFREADY4 404l +#define SPC_FIFO_BUFREADY5 405l +#define SPC_FIFO_BUFREADY6 406l +#define SPC_FIFO_BUFREADY7 407l +#define SPC_FIFO_BUFREADY8 408l +#define SPC_FIFO_BUFREADY9 409l +#define SPC_FIFO_BUFREADY10 410l +#define SPC_FIFO_BUFREADY11 411l +#define SPC_FIFO_BUFREADY12 412l +#define SPC_FIFO_BUFREADY13 413l +#define SPC_FIFO_BUFREADY14 414l +#define SPC_FIFO_BUFREADY15 415l +#define SPC_FIFO_AUTOBUFSTART 500l +#define SPC_FIFO_AUTOBUFEND 510l + +#define SPC_STATUS 10l +#define SPC_RUN 0l +#define SPC_TRIGGER 10l +#define SPC_READY 20l + + + +// commands for M2 cards +#define SPC_M2CMD 100l // write a command +#define M2CMD_CARD_RESET 0x00000001l // hardware reset +#define M2CMD_CARD_WRITESETUP 0x00000002l // write setup only +#define M2CMD_CARD_START 0x00000004l // start of card (including writesetup) +#define M2CMD_CARD_ENABLETRIGGER 0x00000008l // enable trigger engine +#define M2CMD_CARD_FORCETRIGGER 0x00000010l // force trigger +#define M2CMD_CARD_DISABLETRIGGER 0x00000020l // disable trigger engine again (multi or gate) +#define M2CMD_CARD_STOP 0x00000040l // stop run +#define M2CMD_CARD_FLUSHFIFO 0x00000080l // flush fifos to memory +#define M2CMD_CARD_INVALIDATEDATA 0x00000100l // current data in memory is invalidated, next data transfer start will wait until new data is available +#define M2CMD_CARD_INTERNALRESET 0x00000200l // INTERNAL reset command + +#define M2CMD_ALL_STOP 0x00440060l // stops card and all running transfers + +#define M2CMD_CARD_WAITPREFULL 0x00001000l // wait until pretrigger is full +#define M2CMD_CARD_WAITTRIGGER 0x00002000l // wait for trigger recognition +#define M2CMD_CARD_WAITREADY 0x00004000l // wait for card ready + +#define M2CMD_DATA_STARTDMA 0x00010000l // start of DMA transfer for data +#define M2CMD_DATA_WAITDMA 0x00020000l // wait for end of data transfer / next block ready +#define M2CMD_DATA_STOPDMA 0x00040000l // abort the data transfer +#define M2CMD_DATA_POLL 0x00080000l // transfer data using single access and polling + +#define M2CMD_EXTRA_STARTDMA 0x00100000l // start of DMA transfer for extra (ABA + timestamp) data +#define M2CMD_EXTRA_WAITDMA 0x00200000l // wait for end of extra (ABA + timestamp) data transfer / next block ready +#define M2CMD_EXTRA_STOPDMA 0x00400000l // abort the extra (ABA + timestamp) data transfer +#define M2CMD_EXTRA_POLL 0x00800000l // transfer data using single access and polling + +#define M2CMD_DATA_SGFLUSH 0x01000000l // flush incomplete pages from sg list + + +// status for M2 cards (bitmask) +#define SPC_M2STATUS 110l // read the current status +#define M2STAT_NONE 0x00000000l // status empty +#define M2STAT_CARD_PRETRIGGER 0x00000001l // pretrigger area is full +#define M2STAT_CARD_TRIGGER 0x00000002l // trigger recognized +#define M2STAT_CARD_READY 0x00000004l // card is ready, run finished +#define M2STAT_CARD_SEGMENT_PRETRG 0x00000008l // since M4i: at muliple-recording: pretrigger area of a segment is full + +#define M2STAT_DATA_BLOCKREADY 0x00000100l // next data block is available +#define M2STAT_DATA_END 0x00000200l // data transfer has ended +#define M2STAT_DATA_OVERRUN 0x00000400l // FIFO overrun (record) or underrun (replay) +#define M2STAT_DATA_ERROR 0x00000800l // internal error + +#define M2STAT_EXTRA_BLOCKREADY 0x00001000l // next extra data (ABA and timestamp) block is available +#define M2STAT_EXTRA_END 0x00002000l // extra data (ABA and timestamp) transfer has ended +#define M2STAT_EXTRA_OVERRUN 0x00004000l // FIFO overrun +#define M2STAT_EXTRA_ERROR 0x00008000l // internal error + +#define M2STAT_TSCNT_OVERRUN 0x00010000l // timestamp counter overrun + +#define M2STAT_INTERNALMASK 0xff000000l // mask for internal status signals +#define M2STAT_INTERNAL_SYSLOCK 0x02000000l + + + +// buffer control registers for samples data +#define SPC_DATA_AVAIL_USER_LEN 200l // number of bytes available for user (valid data if READ, free buffer if WRITE) +#define SPC_DATA_AVAIL_USER_POS 201l // the current byte position where the available user data starts +#define SPC_DATA_AVAIL_CARD_LEN 202l // number of bytes available for card (free buffer if READ, filled data if WRITE) +#define SPC_DATA_OUTBUFSIZE 209l // output buffer size in bytes + +// buffer control registers for extra data (ABA slow data, timestamps) +#define SPC_ABA_AVAIL_USER_LEN 210l // number of bytes available for user (valid data if READ, free buffer if WRITE) +#define SPC_ABA_AVAIL_USER_POS 211l // the current byte position where the available user data starts +#define SPC_ABA_AVAIL_CARD_LEN 212l // number of bytes available for card (free buffer if READ, filled data if WRITE) + +#define SPC_TS_AVAIL_USER_LEN 220l // number of bytes available for user (valid data if READ, free buffer if WRITE) +#define SPC_TS_AVAIL_USER_POS 221l // the current byte position where the available user data starts +#define SPC_TS_AVAIL_CARD_LEN 222l // number of bytes available for card (free buffer if READ, filled data if WRITE) + + + +// Installation +#define SPC_VERSION 1000l +#define SPC_ISAADR 1010l +#define SPC_INSTMEM 1020l +#define SPC_INSTSAMPLERATE 1030l +#define SPC_BRDTYP 1040l + +// MI/MC/MX type information (internal use) +#define SPC_MIINST_MODULES 1100l +#define SPC_MIINST_CHPERMODULE 1110l +#define SPC_MIINST_BYTESPERSAMPLE 1120l +#define SPC_MIINST_BITSPERSAMPLE 1125l +#define SPC_MIINST_MAXADCVALUE 1126l +#define SPC_MIINST_MINADCLOCK 1130l +#define SPC_MIINST_MAXADCLOCK 1140l +#define SPC_MIINST_MINEXTCLOCK 1145l +#define SPC_MIINST_MAXEXTCLOCK 1146l +#define SPC_MIINST_MINSYNCCLOCK 1147l +#define SPC_MIINST_MINEXTREFCLOCK 1148l +#define SPC_MIINST_MAXEXTREFCLOCK 1149l +#define SPC_MIINST_QUARZ 1150l +#define SPC_MIINST_QUARZ2 1151l +#define SPC_MIINST_MINEXTCLOCK1 1152l +#define SPC_MIINST_FLAGS 1160l +#define SPC_MIINST_FIFOSUPPORT 1170l +#define SPC_MIINST_ISDEMOCARD 1175l + +// Driver information +#define SPC_GETDRVVERSION 1200l +#define SPC_GETKERNELVERSION 1210l +#define SPC_GETDRVTYPE 1220l +#define DRVTYP_DOS 0l +#define DRVTYP_LINUX32 1l +#define DRVTYP_VXD 2l +#define DRVTYP_NTLEGACY 3l +#define DRVTYP_WDM32 4l +#define DRVTYP_WDM64 5l +#define DRVTYP_WOW64 6l +#define DRVTYP_LINUX64 7l +#define DRVTYP_QNX32 8l +#define DRVTYP_QNX64 9l +#define SPC_GETCOMPATIBILITYVERSION 1230l +#define SPC_GETMINDRVVERSION 1240l + +// PCI, CompactPCI and PXI Installation Information +#define SPC_PCITYP 2000l + +// ***** available card function types ***** +#define SPC_FNCTYPE 2001l +#define SPCM_TYPE_AI 0x01 +#define SPCM_TYPE_AO 0x02 +#define SPCM_TYPE_DI 0x04 +#define SPCM_TYPE_DO 0x08 +#define SPCM_TYPE_DIO 0x10 + +#define SPC_PCIVERSION 2010l +#define SPC_PCIEXTVERSION 2011l +#define SPC_PCIMODULEVERSION 2012l +#define SPC_PCIMODULEBVERSION 2013l +#define SPC_BASEPCBVERSION 2014l +#define SPC_MODULEPCBVERSION 2015l +#define SPC_MODULEAPCBVERSION 2015l +#define SPC_MODULEBPCBVERSION 2016l +#define SPC_EXTPCBVERSION 2017l +#define SPC_PCIDIGVERSION 2018l +#define SPC_DIGPCBVERSION 2019l +#define SPC_PCIDATE 2020l +#define SPC_CALIBDATE 2025l +#define SPC_CALIBDATEONBOARD 2026l +#define SPC_PCISERIALNR 2030l +#define SPC_PCISERIALNO 2030l +#define SPC_PCIHWBUSNO 2040l +#define SPC_PCIHWDEVNO 2041l +#define SPC_PCIHWFNCNO 2042l +#define SPC_PCIHWSLOTNO 2043l +#define SPC_PCIEXPGENERATION 2050l +#define SPC_PCIEXPLANES 2051l +#define SPC_PCIEXPPAYLOAD 2052l +#define SPC_PCIEXPREADREQUESTSIZE 2053l +#define SPC_PCIEXPREADCOMPLBOUNDARY 2054l +#define SPC_PXIHWSLOTNO 2055l +#define SPC_PCISAMPLERATE 2100l +#define SPC_PCIMEMSIZE 2110l +#define SPC_PCIFEATURES 2120l +#define SPC_PCIEXTFEATURES 2121l +#define SPC_PCIINFOADR 2200l +#define SPC_PCIINTERRUPT 2300l +#define SPC_PCIBASEADR0 2400l +#define SPC_PCIBASEADR1 2401l +#define SPC_PCIREGION0 2410l +#define SPC_PCIREGION1 2411l +#define SPC_READTRGLVLCOUNT 2500l +#define SPC_READIRCOUNT 3000l +#define SPC_READUNIPOLAR0 3010l +#define SPC_READUNIPOLAR1 3020l +#define SPC_READUNIPOLAR2 3030l +#define SPC_READUNIPOLAR3 3040l +#define SPC_READMAXOFFSET 3100l + +#define SPC_READAIFEATURES 3101l +#define SPCM_AI_TERM 0x00000001 // input termination available +#define SPCM_AI_SE 0x00000002 // single-ended mode available +#define SPCM_AI_DIFF 0x00000004 // differential mode available +#define SPCM_AI_OFFSPERCENT 0x00000008 // offset programming is done in percent of input range +#define SPCM_AI_OFFSMV 0x00000010 // offset programming is done in mV absolut +#define SPCM_AI_OVERRANGEDETECT 0x00000020 // overrange detection is programmable +#define SPCM_AI_DCCOUPLING 0x00000040 // DC coupling available +#define SPCM_AI_ACCOUPLING 0x00000080 // AC coupling available +#define SPCM_AI_LOWPASS 0x00000100 // selectable low pass +#define SPCM_AI_ACDC_OFFS_COMP 0x00000200 // AC/DC offset compensation +#define SPCM_AI_DIFFMUX 0x00000400 // differential mode (two channels combined to one) available +#define SPCM_AI_GLOBALLOWPASS 0x00000800 // globally selectable low pass (all channels same setting) +#define SPCM_AI_AUTOCALOFFS 0x00001000 // automatic offset calibration in hardware +#define SPCM_AI_AUTOCALGAIN 0x00002000 // automatic gain calibration in hardware +#define SPCM_AI_AUTOCALOFFSNOIN 0x00004000 // automatic offset calibration with open inputs +#define SPCM_AI_HIGHIMP 0x00008000 // high impedance available +#define SPCM_AI_LOWIMP 0x00010000 // low impedance available (50 ohm) +#define SPCM_AI_DIGITALLOWPASS 0x00020000 // selectable digital low pass filter +#define SPCM_AI_INDIVPULSEWIDTH 0x00100000 // individual pulsewidth per channel available + +#define SPC_READAOFEATURES 3102l +#define SPCM_AO_SE 0x00000002 // single-ended mode available +#define SPCM_AO_DIFF 0x00000004 // differential mode available +#define SPCM_AO_PROGFILTER 0x00000008 // programmable filters available +#define SPCM_AO_PROGOFFSET 0x00000010 // programmable offset available +#define SPCM_AO_PROGGAIN 0x00000020 // programmable gain available +#define SPCM_AO_PROGSTOPLEVEL 0x00000040 // programmable stop level available +#define SPCM_AO_DOUBLEOUT 0x00000080 // double out mode available +#define SPCM_AO_ENABLEOUT 0x00000100 // outputs can be disabled/enabled + +#define SPC_READDIFEATURES 3103l +#define SPCM_DI_TERM 0x00000001 // input termination available +#define SPCM_DI_SE 0x00000002 // single-ended mode available +#define SPCM_DI_DIFF 0x00000004 // differential mode available +#define SPCM_DI_PROGTHRESHOLD 0x00000008 // programmable threshold available +#define SPCM_DI_HIGHIMP 0x00000010 // high impedance available +#define SPCM_DI_LOWIMP 0x00000020 // low impedance available +#define SPCM_DI_INDIVPULSEWIDTH 0x00100000 // individual pulsewidth per channel available +#define SPCM_DI_IOCHANNEL 0x00200000 // connected with DO channel + +#define SPC_READDOFEATURES 3104l +#define SPCM_DO_SE 0x00000002 // single-ended mode available +#define SPCM_DO_DIFF 0x00000004 // differential mode available +#define SPCM_DO_PROGSTOPLEVEL 0x00000008 // programmable stop level available +#define SPCM_DO_PROGOUTLEVELS 0x00000010 // programmable output levels (low + high) available +#define SPCM_DO_ENABLEMASK 0x00000020 // individual enable mask for each output channel +#define SPCM_DO_IOCHANNEL 0x00200000 // connected with DI channel + +#define SPC_READCHGROUPING 3110l +#define SPC_READAIPATHCOUNT 3120l // number of available analog input paths +#define SPC_READAIPATH 3121l // the current path for which all the settings are read + +#define SPCM_CUSTOMMOD 3130l +#define SPCM_CUSTOMMOD_BASE_MASK 0x000000FF +#define SPCM_CUSTOMMOD_MODULE_MASK 0x0000FF00 +#define SPCM_CUSTOMMOD_STARHUB_MASK 0x00FF0000 + +#define SPC_READRANGECH0_0 3200l +#define SPC_READRANGECH0_1 3201l +#define SPC_READRANGECH0_2 3202l +#define SPC_READRANGECH0_3 3203l +#define SPC_READRANGECH0_4 3204l +#define SPC_READRANGECH0_5 3205l +#define SPC_READRANGECH0_6 3206l +#define SPC_READRANGECH0_7 3207l +#define SPC_READRANGECH0_8 3208l +#define SPC_READRANGECH0_9 3209l +#define SPC_READRANGECH1_0 3300l +#define SPC_READRANGECH1_1 3301l +#define SPC_READRANGECH1_2 3302l +#define SPC_READRANGECH1_3 3303l +#define SPC_READRANGECH1_4 3304l +#define SPC_READRANGECH1_5 3305l +#define SPC_READRANGECH1_6 3306l +#define SPC_READRANGECH1_7 3307l +#define SPC_READRANGECH1_8 3308l +#define SPC_READRANGECH1_9 3309l +#define SPC_READRANGECH2_0 3400l +#define SPC_READRANGECH2_1 3401l +#define SPC_READRANGECH2_2 3402l +#define SPC_READRANGECH2_3 3403l +#define SPC_READRANGECH3_0 3500l +#define SPC_READRANGECH3_1 3501l +#define SPC_READRANGECH3_2 3502l +#define SPC_READRANGECH3_3 3503l + +#define SPC_READRANGEMIN0 4000l +#define SPC_READRANGEMIN99 4099l +#define SPC_READRANGEMAX0 4100l +#define SPC_READRANGEMAX99 4199l +#define SPC_READOFFSMIN0 4200l +#define SPC_READOFFSMIN99 4299l +#define SPC_READOFFSMAX0 4300l +#define SPC_READOFFSMAX99 4399l +#define SPC_PCICOUNTER 9000l +#define SPC_BUFFERPOS 9010l + +#define SPC_READAOGAINMIN 9100l +#define SPC_READAOGAINMAX 9110l +#define SPC_READAOOFFSETMIN 9120l +#define SPC_READAOOFFSETMAX 9130l + +#define SPC_CARDMODE 9500l // card modes as listed below +#define SPC_AVAILCARDMODES 9501l // list with available card modes + +// card modes +#define SPC_REC_STD_SINGLE 0x00000001 // singleshot recording to memory +#define SPC_REC_STD_MULTI 0x00000002 // multiple records to memory on each trigger event +#define SPC_REC_STD_GATE 0x00000004 // gated recording to memory on gate signal +#define SPC_REC_STD_ABA 0x00000008 // ABA: A slowly to extra FIFO, B to memory on each trigger event +#define SPC_REC_STD_SEGSTATS 0x00010000 // segment information stored on each trigger segment -> stored in on-board memory +#define SPC_REC_STD_AVERAGE 0x00020000 // multiple records summed to average memory on each trigger event -> stored in on-board memory +#define SPC_REC_STD_AVERAGE_16BIT 0x00080000 // multiple records summed to average memory on each trigger event -> stored in on-board memory +#define SPC_REC_STD_BOXCAR 0x00800000 // boxcar averaging + +#define SPC_REC_FIFO_SINGLE 0x00000010 // singleshot to FIFO on trigger event +#define SPC_REC_FIFO_MULTI 0x00000020 // multiple records to FIFO on each trigger event +#define SPC_REC_FIFO_GATE 0x00000040 // gated sampling to FIFO on gate signal +#define SPC_REC_FIFO_ABA 0x00000080 // ABA: A slowly to extra FIFO, B to FIFO on each trigger event +#define SPC_REC_FIFO_SEGSTATS 0x00100000 // segment information stored on each trigger segment -> streamed to host +#define SPC_REC_FIFO_AVERAGE 0x00200000 // multiple records summed to average memory on each trigger event -> streamed to host +#define SPC_REC_FIFO_AVERAGE_16BIT 0x00400000 // multiple records summed to average memory on each trigger event -> streamed to host +#define SPC_REC_FIFO_BOXCAR 0x01000000 // boxcar averaging FIFO mode +#define SPC_REC_FIFO_SINGLE_MONITOR 0x02000000 // like SPC_REC_FIFO_SINGLE but with additional slow A data stream for monitoring + +#define SPC_REP_STD_SINGLE 0x00000100 // single replay from memory on trigger event +#define SPC_REP_STD_MULTI 0x00000200 // multiple replay from memory on each trigger event +#define SPC_REP_STD_GATE 0x00000400 // gated replay from memory on gate signal + +#define SPC_REP_FIFO_SINGLE 0x00000800 // single replay from FIFO on trigger event +#define SPC_REP_FIFO_MULTI 0x00001000 // multiple replay from FIFO on each trigger event +#define SPC_REP_FIFO_GATE 0x00002000 // gated replay from FIFO on gate signal + +#define SPC_REP_STD_CONTINUOUS 0x00004000 // continuous replay started by one trigger event +#define SPC_REP_STD_SINGLERESTART 0x00008000 // single replays on every detected trigger event +#define SPC_REP_STD_SEQUENCE 0x00040000 // sequence mode replay + +// Waveforms for demo cards +#define SPC_DEMOWAVEFORM 9600l +#define SPC_AVAILDEMOWAVEFORMS 9601l +#define SPCM_DEMOWAVEFORM_SINE 0x00000001 +#define SPCM_DEMOWAVEFORM_RECT 0x00000002 +#define SPCM_DEMOWAVEFORM_TRIANGLE 0x00000004 + + +// Memory +#define SPC_MEMSIZE 10000l +#define SPC_SEGMENTSIZE 10010l +#define SPC_LOOPS 10020l +#define SPC_PRETRIGGER 10030l +#define SPC_ABADIVIDER 10040l +#define SPC_AVERAGES 10050l +#define SPC_BOX_AVERAGES 10060l +#define SPC_SEGSPLIT_START 10070l +#define SPC_SEGSPLIT_PAUSE 10071l +#define SPC_POSTTRIGGER 10100l +#define SPC_STARTOFFSET 10200l + +// Memory info (depends on mode and channelenable) +#define SPC_AVAILMEMSIZE_MIN 10201l +#define SPC_AVAILMEMSIZE_MAX 10202l +#define SPC_AVAILMEMSIZE_STEP 10203l +#define SPC_AVAILPOSTTRIGGER_MIN 10204l +#define SPC_AVAILPOSTTRIGGER_MAX 10205l +#define SPC_AVAILPOSTTRIGGER_STEP 10206l + +#define SPC_AVAILABADIVIDER_MIN 10207l +#define SPC_AVAILABADIVIDER_MAX 10208l +#define SPC_AVAILABADIVIDER_STEP 10209l + +#define SPC_AVAILLOOPS_MIN 10210l +#define SPC_AVAILLOOPS_MAX 10211l +#define SPC_AVAILLOOPS_STEP 10212l + +#define SPC_AVAILAVERAGES_MIN 10220l +#define SPC_AVAILAVERAGES_MAX 10221l +#define SPC_AVAILAVERAGES_STEP 10222l + +#define SPC_AVAILAVRGSEGSIZE_MIN 10223l +#define SPC_AVAILAVRGSEGSIZE_MAX 10224l +#define SPC_AVAILAVRGSEGSIZE_STEP 10225l + +#define SPC_AVAILAVERAGES16BIT_MIN 10226l +#define SPC_AVAILAVERAGES16BIT_MAX 10227l +#define SPC_AVAILAVERAGES16BIT_STEP 10228l + +#define SPC_AVAILAVRG16BITSEGSIZE_MIN 10229l +#define SPC_AVAILAVRG16BITSEGSIZE_MAX 10230l +#define SPC_AVAILAVRG16BITSEGSIZE_STEP 10231l + +#define SPC_AVAILBOXCARAVERAGES_MIN 10232l +#define SPC_AVAILBOXCARAVERAGES_MAX 10233l +#define SPC_AVAILBOXCARAVERAGES_STEPFACTOR 10234l + + +// Channels +#define SPC_CHENABLE 11000l +#define SPC_CHCOUNT 11001l +#define SPC_CHMODACOUNT 11100l +#define SPC_CHMODBCOUNT 11101l + + +// ----- channel enable flags for A/D and D/A boards (MI/MC/MX series) ----- +// and all cards on M2i series +#define CHANNEL0 0x00000001 +#define CHANNEL1 0x00000002 +#define CHANNEL2 0x00000004 +#define CHANNEL3 0x00000008 +#define CHANNEL4 0x00000010 +#define CHANNEL5 0x00000020 +#define CHANNEL6 0x00000040 +#define CHANNEL7 0x00000080 +#define CHANNEL8 0x00000100 +#define CHANNEL9 0x00000200 +#define CHANNEL10 0x00000400 +#define CHANNEL11 0x00000800 +#define CHANNEL12 0x00001000 +#define CHANNEL13 0x00002000 +#define CHANNEL14 0x00004000 +#define CHANNEL15 0x00008000 +#define CHANNEL16 0x00010000 +#define CHANNEL17 0x00020000 +#define CHANNEL18 0x00040000 +#define CHANNEL19 0x00080000 +#define CHANNEL20 0x00100000 +#define CHANNEL21 0x00200000 +#define CHANNEL22 0x00400000 +#define CHANNEL23 0x00800000 +#define CHANNEL24 0x01000000 +#define CHANNEL25 0x02000000 +#define CHANNEL26 0x04000000 +#define CHANNEL27 0x08000000 +#define CHANNEL28 0x10000000 +#define CHANNEL29 0x20000000 +#define CHANNEL30 0x40000000 +#define CHANNEL31 0x80000000 +// CHANNEL32 up to CHANNEL63 are placed in the upper 32 bit of a 64 bit word (M2i only) + + +// ----- old digital i/o settings for 16 bit implementation (MI/MC/MX series) ----- +#define CH0_8BITMODE 65536l // for MI.70xx only +#define CH0_16BIT 1l +#define CH0_32BIT 3l +#define CH1_16BIT 4l +#define CH1_32BIT 12l + +// ----- new digital i/o settings for 8 bit implementation (MI/MC/MX series) ----- +#define MOD0_8BIT 1l +#define MOD0_16BIT 3l +#define MOD0_32BIT 15l +#define MOD1_8BIT 16l +#define MOD1_16BIT 48l +#define MOD1_32BIT 240l + +#define SPC_CHROUTE0 11010l +#define SPC_CHROUTE1 11020l + +#define SPC_BITENABLE 11030l + + + +// ----- Clock Settings ----- +#define SPC_SAMPLERATE 20000l +#define SPC_SYNCCLOCK 20005l +#define SPC_SAMPLERATE2 20010l +#define SPC_SR2 20020l +#define SPC_PLL_ENABLE 20030l +#define SPC_PLL_ISLOCKED 20031l +#define SPC_CLOCKDIV 20040l +#define SPC_INTCLOCKDIV 20041l +#define SPC_PXICLOCKDIV 20042l +#define SPC_PLL_R 20060l +#define SPC_PLL_F 20061l +#define SPC_PLL_S 20062l +#define SPC_PLL_DIV 20063l +#define SPC_PXI_CLK_OUT 20090l +#define SPC_EXTERNALCLOCK 20100l +#define SPC_EXTERNOUT 20110l +#define SPC_CLOCKOUT 20110l +#define SPC_CLOCKOUTFREQUENCY 20111l +#define SPC_CLOCK50OHM 20120l +#define SPC_CLOCK110OHM 20120l +#define SPC_CLOCK75OHM 20120l +#define SPC_STROBE75OHM 20121l +#define SPC_EXTERNRANGE 20130l +#define SPC_EXTRANGESHDIRECT 20131l +#define EXRANGE_NONE 0l +#define EXRANGE_NOPLL 1l +#define EXRANGE_SINGLE 2l +#define EXRANGE_BURST_S 4l +#define EXRANGE_BURST_M 8l +#define EXRANGE_BURST_L 16l +#define EXRANGE_BURST_XL 32l +#define EXRANGE_LOW 64l +#define EXRANGE_HIGH 128l +#define EXRANGE_LOW_DPS 256l // digital phase synchronization +#define SPC_REFERENCECLOCK 20140l +#define REFCLOCK_PXI -1l + +// ----- new clock registers starting with M2i cards ----- +#define SPC_CLOCKMODE 20200l // clock mode as listed below +#define SPC_AVAILCLOCKMODES 20201l // returns all available clock modes +#define SPC_CM_INTPLL 0x00000001 // use internal PLL +#define SPC_CM_QUARTZ1 0x00000002 // use plain quartz1 (with divider) +#define SPC_CM_QUARTZ2 0x00000004 // use plain quartz2 (with divider) +#define SPC_CM_EXTERNAL 0x00000008 // use external clock directly +#define SPC_CM_EXTERNAL0 0x00000008 // use external clock0 directly (identical value to SPC_CM_EXTERNAL) +#define SPC_CM_EXTDIVIDER 0x00000010 // use external clock with programmed divider +#define SPC_CM_EXTREFCLOCK 0x00000020 // external reference clock fed in (defined with SPC_REFERENCECLOCK) +#define SPC_CM_PXIREFCLOCK 0x00000040 // PXI reference clock +#define SPC_CM_SHDIRECT 0x00000080 // Star-hub direct clock (not synchronised) +#define SPC_CM_QUARTZ2_DIRSYNC 0x00000100 // use plain quartz2 (with divider) and put the Q2 clock on the star-hub module +#define SPC_CM_QUARTZ1_DIRSYNC 0x00000200 // use plain quartz1 (with divider) and put the Q1 clock on the star-hub module +#define SPC_CM_EXTERNAL1 0x00000400 // use external clock1 directly +// ----- internal use only! ----- +#define SPC_CM_SYNCINT 0x01000000 +#define SPC_CM_SYNCEXT 0x02000000 + +#define SPC_CLOCK_READFEATURES 20205l +#define SPC_CLOCK_READFEATURES0 20205l +#define SPC_CLOCK_READFEATURES1 20206l +#define SPCM_CKFEAT_TERM 0x00000001 +#define SPCM_CKFEAT_HIGHIMP 0x00000002 +#define SPCM_CKFEAT_DCCOUPLING 0x00000004 +#define SPCM_CKFEAT_ACCOUPLING 0x00000008 +#define SPCM_CKFEAT_SE 0x00000010 +#define SPCM_CKFEAT_DIFF 0x00000020 +#define SPCM_CKFEAT_PROGEDGE 0x00000040 +#define SPCM_CKFEAT_LEVELPROG 0x00000100 +#define SPCM_CKFEAT_PROGTHRESHOLD 0x00000200 +#define SPCM_CKFEAT_PROGDELAY 0x00000400 + +#define SPC_BURSTSYSCLOCKMODE 20210l +#define SPC_SYNCMASTERSYSCLOCKMODE 20211l +#define SPC_CLOCK_SETUP_CHANGED 20212l + +// clock delay if available +#define SPC_CLOCK_AVAILDELAY_MIN 20220l +#define SPC_CLOCK_AVAILDELAY_MAX 20221l +#define SPC_CLOCK_AVAILDELAY_STEP 20222l +#define SPC_CLOCK_DELAY 20223l + +// clock edges +#define SPC_AVAILCLOCKEDGES 20224l +#define SPCM_EDGE_FALLING 0x00000001 // Originally SPCM_RISING_EDGE : name and value of constant intentionally changed with driver versions greater than V5.24. See hardware manual for details. +#define SPCM_EDGE_RISING 0x00000002 // Originally SPCM_FALLING_EDGE : name and value of constant intentionally changed with driver versions greater than V5.24. See hardware manual for details. +#define SPCM_BOTH_EDGES 0x00000004 +#define SPCM_EDGES_BOTH 0x00000004 //Just added for good measure to match naming scheme of above SPCM_EDGE_FALLING and SPCM_EDGE_RISING constants. +#define SPC_CLOCK_EDGE 20225l + +// mux definitions for channel routing +#define SPC_CHANNELMUXINFO 20300l +#define SPCM_MUX_NONE 0x00000000 // nothing is interlaced +#define SPCM_MUX_MUXONMOD 0x00000001 // data on module is multiplexed, only one channel can have full speed +#define SPCM_MUX_INVERTCLKONMOD 0x00000002 // two channels on one module run with inverted clock +#define SPCM_MUX_DLY 0x00000003 // delay cable between modules, one channel can have full interlace speed +#define SPCM_MUX_DLYANDMUXONMOD 0x00000004 // delay cable between modules and multplexing on module +#define SPCM_MUX_MUXBETWEENMODS 0x00000005 // multiplexed between modules (fastest sampling rate only with one module) +#define SPCM_MUX_MUXONMOD2CH 0x00000006 // data on module is multiplexed, only two channel can have full speed +#define SPCM_MUX_MAX4CH 0x00000007 // only four channels can have full speed, independent of distribution on modules + + +// ----- In/Out Range ----- +#define SPC_OFFS0 30000l +#define SPC_AMP0 30010l +#define SPC_ACDC0 30020l +#define SPC_ACDC_OFFS_COMPENSATION0 30021l +#define SPC_50OHM0 30030l +#define SPC_DIFF0 30040l +#define SPC_DOUBLEOUT0 30041l +#define SPC_DIGITAL0 30050l +#define SPC_110OHM0 30060l +#define SPC_110OHM0L 30060l +#define SPC_75OHM0 30060l +#define SPC_INOUT0 30070l +#define SPC_FILTER0 30080l +#define SPC_BANKSWITCH0 30081l +#define SPC_PATH0 30090l +#define SPC_ENABLEOUT0 30091l + +#define SPC_OFFS1 30100l +#define SPC_AMP1 30110l +#define SPC_ACDC1 30120l +#define SPC_ACDC_OFFS_COMPENSATION1 30121l +#define SPC_50OHM1 30130l +#define SPC_DIFF1 30140l +#define SPC_DOUBLEOUT1 30141l +#define SPC_DIGITAL1 30150l +#define SPC_110OHM1 30160l +#define SPC_110OHM0H 30160l +#define SPC_75OHM1 30160l +#define SPC_INOUT1 30170l +#define SPC_FILTER1 30180l +#define SPC_BANKSWITCH1 30181l +#define SPC_PATH1 30190l +#define SPC_ENABLEOUT1 30191l + +#define SPC_OFFS2 30200l +#define SPC_AMP2 30210l +#define SPC_ACDC2 30220l +#define SPC_ACDC_OFFS_COMPENSATION2 30221l +#define SPC_50OHM2 30230l +#define SPC_DIFF2 30240l +#define SPC_DOUBLEOUT2 30241l +#define SPC_110OHM2 30260l +#define SPC_110OHM1L 30260l +#define SPC_75OHM2 30260l +#define SPC_INOUT2 30270l +#define SPC_FILTER2 30280l +#define SPC_BANKSWITCH2 30281l +#define SPC_PATH2 30290l +#define SPC_ENABLEOUT2 30291l + +#define SPC_OFFS3 30300l +#define SPC_AMP3 30310l +#define SPC_ACDC3 30320l +#define SPC_ACDC_OFFS_COMPENSATION3 30321l +#define SPC_50OHM3 30330l +#define SPC_DIFF3 30340l +#define SPC_DOUBLEOUT3 30341l +#define SPC_110OHM3 30360l +#define SPC_110OHM1H 30360l +#define SPC_75OHM3 30360l +#define SPC_INOUT3 30370l +#define SPC_FILTER3 30380l +#define SPC_BANKSWITCH3 30381l +#define SPC_PATH3 30390l +#define SPC_ENABLEOUT3 30391l + +#define SPC_OFFS4 30400l +#define SPC_AMP4 30410l +#define SPC_ACDC4 30420l +#define SPC_50OHM4 30430l +#define SPC_DIFF4 30440l +#define SPC_DOUBLEOUT4 30441l +#define SPC_FILTER4 30480l +#define SPC_ENABLEOUT4 30491l +#define SPC_PATH4 30490l + +#define SPC_OFFS5 30500l +#define SPC_AMP5 30510l +#define SPC_ACDC5 30520l +#define SPC_50OHM5 30530l +#define SPC_DIFF5 30540l +#define SPC_DOUBLEOUT5 30541l +#define SPC_FILTER5 30580l +#define SPC_ENABLEOUT5 30591l +#define SPC_PATH5 30590l + +#define SPC_OFFS6 30600l +#define SPC_AMP6 30610l +#define SPC_ACDC6 30620l +#define SPC_50OHM6 30630l +#define SPC_DIFF6 30640l +#define SPC_DOUBLEOUT6 30641l +#define SPC_FILTER6 30680l +#define SPC_ENABLEOUT6 30691l +#define SPC_PATH6 30690l + +#define SPC_OFFS7 30700l +#define SPC_AMP7 30710l +#define SPC_ACDC7 30720l +#define SPC_50OHM7 30730l +#define SPC_DIFF7 30740l +#define SPC_DOUBLEOUT7 30741l +#define SPC_FILTER7 30780l +#define SPC_ENABLEOUT7 30791l +#define SPC_PATH7 30790l + +#define SPC_OFFS8 30800l +#define SPC_AMP8 30810l +#define SPC_ACDC8 30820l +#define SPC_50OHM8 30830l +#define SPC_DIFF8 30840l +#define SPC_PATH8 30890l + +#define SPC_OFFS9 30900l +#define SPC_AMP9 30910l +#define SPC_ACDC9 30920l +#define SPC_50OHM9 30930l +#define SPC_DIFF9 30940l +#define SPC_PATH9 30990l + +#define SPC_OFFS10 31000l +#define SPC_AMP10 31010l +#define SPC_ACDC10 31020l +#define SPC_50OHM10 31030l +#define SPC_DIFF10 31040l +#define SPC_PATH10 31090l + +#define SPC_OFFS11 31100l +#define SPC_AMP11 31110l +#define SPC_ACDC11 31120l +#define SPC_50OHM11 31130l +#define SPC_DIFF11 31140l +#define SPC_PATH11 31190l + +#define SPC_OFFS12 31200l +#define SPC_AMP12 31210l +#define SPC_ACDC12 31220l +#define SPC_50OHM12 31230l +#define SPC_DIFF12 31240l +#define SPC_PATH12 31290l + +#define SPC_OFFS13 31300l +#define SPC_AMP13 31310l +#define SPC_ACDC13 31320l +#define SPC_50OHM13 31330l +#define SPC_DIFF13 31340l +#define SPC_PATH13 31390l + +#define SPC_OFFS14 31400l +#define SPC_AMP14 31410l +#define SPC_ACDC14 31420l +#define SPC_50OHM14 31430l +#define SPC_DIFF14 31440l +#define SPC_PATH14 31490l + +#define SPC_OFFS15 31500l +#define SPC_AMP15 31510l +#define SPC_ACDC15 31520l +#define SPC_50OHM15 31530l +#define SPC_DIFF15 31540l +#define SPC_PATH15 31590l + +#define SPC_110OHMTRIGGER 30400l +#define SPC_110OHMCLOCK 30410l + + +#define AMP_BI200 200l +#define AMP_BI500 500l +#define AMP_BI1000 1000l +#define AMP_BI2000 2000l +#define AMP_BI2500 2500l +#define AMP_BI4000 4000l +#define AMP_BI5000 5000l +#define AMP_BI10000 10000l +#define AMP_UNI400 100400l +#define AMP_UNI1000 101000l +#define AMP_UNI2000 102000l + + +// ----- Trigger Settings ----- +#define SPC_TRIGGERMODE 40000l +#define SPC_TRIG_OUTPUT 40100l +#define SPC_TRIGGEROUT 40100l +#define SPC_TRIG_TERM 40110l +#define SPC_TRIG_TERM0 40110l +#define SPC_TRIGGER50OHM 40110l +#define SPC_TRIGGER110OHM0 40110l +#define SPC_TRIGGER75OHM0 40110l +#define SPC_TRIG_TERM1 40111l +#define SPC_TRIGGER110OHM1 40111l +#define SPC_TRIG_EXT0_ACDC 40120l +#define SPC_TRIG_EXT1_ACDC 40121l +#define SPC_TRIG_EXT2_ACDC 40122l + +#define SPC_TRIGGERMODE0 40200l +#define SPC_TRIGGERMODE1 40201l +#define SPC_TRIGGERMODE2 40202l +#define SPC_TRIGGERMODE3 40203l +#define SPC_TRIGGERMODE4 40204l +#define SPC_TRIGGERMODE5 40205l +#define SPC_TRIGGERMODE6 40206l +#define SPC_TRIGGERMODE7 40207l +#define SPC_TRIGGERMODE8 40208l +#define SPC_TRIGGERMODE9 40209l +#define SPC_TRIGGERMODE10 40210l +#define SPC_TRIGGERMODE11 40211l +#define SPC_TRIGGERMODE12 40212l +#define SPC_TRIGGERMODE13 40213l +#define SPC_TRIGGERMODE14 40214l +#define SPC_TRIGGERMODE15 40215l + +#define TM_SOFTWARE 0l +#define TM_NOTRIGGER 10l +#define TM_CHXPOS 10000l +#define TM_CHXPOS_LP 10001l +#define TM_CHXPOS_SP 10002l +#define TM_CHXPOS_GS 10003l +#define TM_CHXPOS_SS 10004l +#define TM_CHXNEG 10010l +#define TM_CHXNEG_LP 10011l +#define TM_CHXNEG_SP 10012l +#define TM_CHXNEG_GS 10013l +#define TM_CHXNEG_SS 10014l +#define TM_CHXOFF 10020l +#define TM_CHXBOTH 10030l +#define TM_CHXWINENTER 10040l +#define TM_CHXWINENTER_LP 10041l +#define TM_CHXWINENTER_SP 10042l +#define TM_CHXWINLEAVE 10050l +#define TM_CHXWINLEAVE_LP 10051l +#define TM_CHXWINLEAVE_SP 10052l +#define TM_CHXLOW 10060l +#define TM_CHXHIGH 10061l +#define TM_CHXINWIN 10062l +#define TM_CHXOUTWIN 10063l +#define TM_CHXSPIKE 10064l + + +#define TM_CH0POS 10000l +#define TM_CH0NEG 10010l +#define TM_CH0OFF 10020l +#define TM_CH0BOTH 10030l +#define TM_CH1POS 10100l +#define TM_CH1NEG 10110l +#define TM_CH1OFF 10120l +#define TM_CH1BOTH 10130l +#define TM_CH2POS 10200l +#define TM_CH2NEG 10210l +#define TM_CH2OFF 10220l +#define TM_CH2BOTH 10230l +#define TM_CH3POS 10300l +#define TM_CH3NEG 10310l +#define TM_CH3OFF 10320l +#define TM_CH3BOTH 10330l + +#define TM_TTLPOS 20000l +#define TM_TTLHIGH_LP 20001l +#define TM_TTLHIGH_SP 20002l +#define TM_TTLNEG 20010l +#define TM_TTLLOW_LP 20011l +#define TM_TTLLOW_SP 20012l +#define TM_TTL 20020l +#define TM_TTLBOTH 20030l +#define TM_TTLBOTH_LP 20031l +#define TM_TTLBOTH_SP 20032l +#define TM_CHANNEL 20040l +#define TM_TTLHIGH 20050l +#define TM_TTLLOW 20051l +#define TM_PATTERN 21000l +#define TM_PATTERN_LP 21001l +#define TM_PATTERN_SP 21002l +#define TM_PATTERNANDEDGE 22000l +#define TM_PATTERNANDEDGE_LP 22001l +#define TM_PATTERNANDEDGE_SP 22002l +#define TM_GATELOW 30000l +#define TM_GATEHIGH 30010l +#define TM_GATEPATTERN 30020l +#define TM_CHOR 35000l +#define TM_CHAND 35010l +#define TM_CHORTTLPOS 35020l +#define TM_CHORTTLNEG 35021l + +#define SPC_PXITRGOUT 40300l +#define PTO_OFF 0l +#define PTO_LINE0 1l +#define PTO_LINE1 2l +#define PTO_LINE2 3l +#define PTO_LINE3 4l +#define PTO_LINE4 5l +#define PTO_LINE5 6l +#define PTO_LINE6 7l +#define PTO_LINE7 8l +#define PTO_LINESTAR 9l +#define SPC_PXITRGOUT_AVAILABLE 40301l // bitmap register + +#define SPC_PXISTARTRG_DIVRST_OUT 40302l // bitmap register +#define SPC_PXISTARTRG_DIVRST_OUT_AVAILABLE 40303l +#define SPC_PXISTARTRG_OUT 40304l // bitmap register +#define PSTO_LINESTAR0 0x00000001 +#define PSTO_LINESTAR1 0x00000002 +#define PSTO_LINESTAR2 0x00000004 +#define PSTO_LINESTAR3 0x00000008 +#define PSTO_LINESTAR4 0x00000010 +#define PSTO_LINESTAR5 0x00000020 +#define PSTO_LINESTAR6 0x00000040 +#define PSTO_LINESTAR7 0x00000080 +#define PSTO_LINESTAR8 0x00000100 +#define PSTO_LINESTAR9 0x00000200 +#define PSTO_LINESTAR10 0x00000400 +#define PSTO_LINESTAR11 0x00000800 +#define PSTO_LINESTAR12 0x00001000 +#define PSTO_LINE0 0x00010000 +#define PSTO_LINE1 0x00020000 +#define PSTO_LINE2 0x00040000 +#define PSTO_LINE3 0x00080000 +#define PSTO_LINE4 0x00100000 +#define PSTO_LINE5 0x00200000 +#define PSTO_LINE6 0x00400000 +#define PSTO_LINE7 0x00800000 +#define SPC_PXISTARTRG_OUT_AVAILABLE 40305l + +#define SPC_PXITRGIN 40310l // bitmap register +#define PTI_OFF 0l +#define PTI_LINE0 1l +#define PTI_LINE1 2l +#define PTI_LINE2 4l +#define PTI_LINE3 8l +#define PTI_LINE4 16l +#define PTI_LINE5 32l +#define PTI_LINE6 64l +#define PTI_LINE7 128l +#define PTI_LINESTAR 256l +#define SPC_PXITRGIN_AVAILABLE 40311l // bitmap register +#define SPC_PXI_DIVIDER_RESET_IN 40320l +#define SPC_PXI_DIVIDER_RESET_IN_AVAILABLE 40321l + + +// new registers of M2i driver +#define SPC_TRIG_AVAILORMASK 40400l +#define SPC_TRIG_ORMASK 40410l +#define SPC_TRIG_AVAILANDMASK 40420l +#define SPC_TRIG_ANDMASK 40430l +#define SPC_TMASK_NONE 0x00000000 +#define SPC_TMASK_SOFTWARE 0x00000001 +#define SPC_TMASK_EXT0 0x00000002 +#define SPC_TMASK_EXT1 0x00000004 +#define SPC_TMASK_EXT2 0x00000008 +#define SPC_TMASK_EXT3 0x00000010 +#define SPC_TMASK_EXT4 0x00000020 +#define SPC_TMASK_XIO0 0x00000100 +#define SPC_TMASK_XIO1 0x00000200 +#define SPC_TMASK_XIO2 0x00000400 +#define SPC_TMASK_XIO3 0x00000800 +#define SPC_TMASK_XIO4 0x00001000 +#define SPC_TMASK_XIO5 0x00002000 +#define SPC_TMASK_XIO6 0x00004000 +#define SPC_TMASK_XIO7 0x00008000 +#define SPC_TMASK_PXI0 0x00100000 +#define SPC_TMASK_PXI1 0x00200000 +#define SPC_TMASK_PXI2 0x00400000 +#define SPC_TMASK_PXI3 0x00800000 +#define SPC_TMASK_PXI4 0x01000000 +#define SPC_TMASK_PXI5 0x02000000 +#define SPC_TMASK_PXI6 0x04000000 +#define SPC_TMASK_PXI7 0x08000000 +#define SPC_TMASK_PXISTAR 0x10000000 +#define SPC_TMASK_PXIDSTARB 0x20000000 + +#define SPC_TRIG_CH_AVAILORMASK0 40450l +#define SPC_TRIG_CH_AVAILORMASK1 40451l +#define SPC_TRIG_CH_ORMASK0 40460l +#define SPC_TRIG_CH_ORMASK1 40461l +#define SPC_TRIG_CH_AVAILANDMASK0 40470l +#define SPC_TRIG_CH_AVAILANDMASK1 40471l +#define SPC_TRIG_CH_ANDMASK0 40480l +#define SPC_TRIG_CH_ANDMASK1 40481l +#define SPC_TMASK0_NONE 0x00000000 +#define SPC_TMASK0_CH0 0x00000001 +#define SPC_TMASK0_CH1 0x00000002 +#define SPC_TMASK0_CH2 0x00000004 +#define SPC_TMASK0_CH3 0x00000008 +#define SPC_TMASK0_CH4 0x00000010 +#define SPC_TMASK0_CH5 0x00000020 +#define SPC_TMASK0_CH6 0x00000040 +#define SPC_TMASK0_CH7 0x00000080 +#define SPC_TMASK0_CH8 0x00000100 +#define SPC_TMASK0_CH9 0x00000200 +#define SPC_TMASK0_CH10 0x00000400 +#define SPC_TMASK0_CH11 0x00000800 +#define SPC_TMASK0_CH12 0x00001000 +#define SPC_TMASK0_CH13 0x00002000 +#define SPC_TMASK0_CH14 0x00004000 +#define SPC_TMASK0_CH15 0x00008000 +#define SPC_TMASK0_CH16 0x00010000 +#define SPC_TMASK0_CH17 0x00020000 +#define SPC_TMASK0_CH18 0x00040000 +#define SPC_TMASK0_CH19 0x00080000 +#define SPC_TMASK0_CH20 0x00100000 +#define SPC_TMASK0_CH21 0x00200000 +#define SPC_TMASK0_CH22 0x00400000 +#define SPC_TMASK0_CH23 0x00800000 +#define SPC_TMASK0_CH24 0x01000000 +#define SPC_TMASK0_CH25 0x02000000 +#define SPC_TMASK0_CH26 0x04000000 +#define SPC_TMASK0_CH27 0x08000000 +#define SPC_TMASK0_CH28 0x10000000 +#define SPC_TMASK0_CH29 0x20000000 +#define SPC_TMASK0_CH30 0x40000000 +#define SPC_TMASK0_CH31 0x80000000 + +#define SPC_TMASK1_NONE 0x00000000 +#define SPC_TMASK1_CH32 0x00000001 +#define SPC_TMASK1_CH33 0x00000002 +#define SPC_TMASK1_CH34 0x00000004 +#define SPC_TMASK1_CH35 0x00000008 +#define SPC_TMASK1_CH36 0x00000010 +#define SPC_TMASK1_CH37 0x00000020 +#define SPC_TMASK1_CH38 0x00000040 +#define SPC_TMASK1_CH39 0x00000080 +#define SPC_TMASK1_CH40 0x00000100 +#define SPC_TMASK1_CH41 0x00000200 +#define SPC_TMASK1_CH42 0x00000400 +#define SPC_TMASK1_CH43 0x00000800 +#define SPC_TMASK1_CH44 0x00001000 +#define SPC_TMASK1_CH45 0x00002000 +#define SPC_TMASK1_CH46 0x00004000 +#define SPC_TMASK1_CH47 0x00008000 +#define SPC_TMASK1_CH48 0x00010000 +#define SPC_TMASK1_CH49 0x00020000 +#define SPC_TMASK1_CH50 0x00040000 +#define SPC_TMASK1_CH51 0x00080000 +#define SPC_TMASK1_CH52 0x00100000 +#define SPC_TMASK1_CH53 0x00200000 +#define SPC_TMASK1_CH54 0x00400000 +#define SPC_TMASK1_CH55 0x00800000 +#define SPC_TMASK1_CH56 0x01000000 +#define SPC_TMASK1_CH57 0x02000000 +#define SPC_TMASK1_CH58 0x04000000 +#define SPC_TMASK1_CH59 0x08000000 +#define SPC_TMASK1_CH60 0x10000000 +#define SPC_TMASK1_CH61 0x20000000 +#define SPC_TMASK1_CH62 0x40000000 +#define SPC_TMASK1_CH63 0x80000000 + +#define SPC_TRIG_EXT_AVAILMODES 40500l +#define SPC_TRIG_EXT0_AVAILMODES 40500l +#define SPC_TRIG_EXT1_AVAILMODES 40501l +#define SPC_TRIG_EXT2_AVAILMODES 40502l +#define SPC_TRIG_EXT0_AVAILMODESOR 40503l +#define SPC_TRIG_EXT1_AVAILMODESOR 40504l +#define SPC_TRIG_EXT2_AVAILMODESOR 40505l +#define SPC_TRIG_EXT0_AVAILMODESAND 40506l +#define SPC_TRIG_EXT1_AVAILMODESAND 40507l +#define SPC_TRIG_EXT2_AVAILMODESAND 40508l +#define SPC_TRIG_EXT3_AVAILMODESAND 40509l +#define SPC_TRIG_EXT0_MODE 40510l +#define SPC_TRIG_EXT1_MODE 40511l +#define SPC_TRIG_EXT2_MODE 40512l +#define SPC_TRIG_EXT3_MODE 40513l +#define SPC_TRIG_EXT3_AVAILMODES 40514l +#define SPC_TRIG_EXT3_AVAILMODESOR 40515l +#define SPC_TRIG_EXT4_AVAILMODES 40516l +#define SPC_TRIG_EXT4_AVAILMODESOR 40517l +#define SPC_TRIG_EXT4_AVAILMODESAND 40518l +#define SPC_TRIG_EXT4_MODE 40519l + +#define SPC_TRIG_EXT0_READFEATURES 40520l +#define SPC_TRIG_EXT1_READFEATURES 40521l +#define SPC_TRIG_EXT2_READFEATURES 40522l +#define SPC_TRIG_EXT3_READFEATURES 40523l +#define SPC_TRIG_EXT4_READFEATURES 40524l +#define SPCM_TRFEAT_TERM 0x00000001 +#define SPCM_TRFEAT_HIGHIMP 0x00000002 +#define SPCM_TRFEAT_DCCOUPLING 0x00000004 +#define SPCM_TRFEAT_ACCOUPLING 0x00000008 +#define SPCM_TRFEAT_SE 0x00000010 +#define SPCM_TRFEAT_DIFF 0x00000020 +#define SPCM_TRFEAT_LEVELPROG 0x00000100 +#define SPCM_TRFEAT_PROGTHRESHOLD 0x00000200 + +// legacy constants: not enough contiguous constants possible for X4..X19 +#define SPC_LEGACY_X0_READFEATURES 40530l +#define SPC_LEGACY_X1_READFEATURES 40531l +#define SPC_LEGACY_X2_READFEATURES 40532l +#define SPC_LEGACY_X3_READFEATURES 40533l + +// legacy constants: not enough contiguous constants possible for X4..X19 +#define SPC_LEGACY_X0_TERM 40535l +#define SPC_LEGACY_X1_TERM 40536l +#define SPC_LEGACY_X2_TERM 40537l +#define SPC_LEGACY_X3_TERM 40538l + +#define SPC_TRIG_XIO_AVAILMODES 40550l +#define SPC_TRIG_XIO_AVAILMODESOR 40551l +#define SPC_TRIG_XIO_AVAILMODESAND 40552l +#define SPC_TRIG_XIO0_MODE 40560l +#define SPC_TRIG_XIO1_MODE 40561l +#define SPC_TM_MODEMASK 0x00FFFFFF +#define SPC_TM_NONE 0x00000000 +#define SPC_TM_POS 0x00000001 +#define SPC_TM_NEG 0x00000002 +#define SPC_TM_BOTH 0x00000004 +#define SPC_TM_HIGH 0x00000008 +#define SPC_TM_LOW 0x00000010 +#define SPC_TM_WINENTER 0x00000020 +#define SPC_TM_WINLEAVE 0x00000040 +#define SPC_TM_INWIN 0x00000080 +#define SPC_TM_OUTSIDEWIN 0x00000100 +#define SPC_TM_SPIKE 0x00000200 +#define SPC_TM_PATTERN 0x00000400 +#define SPC_TM_STEEPPOS 0x00000800 +#define SPC_TM_STEEPNEG 0x00001000 +#define SPC_TM_EXTRAMASK 0xFF000000 +#define SPC_TM_REARM 0x01000000 +#define SPC_TM_PW_SMALLER 0x02000000 +#define SPC_TM_PW_GREATER 0x04000000 +#define SPC_TM_DOUBLEEDGE 0x08000000 +#define SPC_TM_PULSESTRETCH 0x10000000 +#define SPC_TM_HYSTERESIS 0x20000000 + +#define SPC_TRIG_PATTERN_AVAILMODES 40580l +#define SPC_TRIG_PATTERN_MODE 40590l + +#define SPC_TRIG_CH_AVAILMODES 40600l +#define SPC_TRIG_CH_AVAILMODESOR 40601l +#define SPC_TRIG_CH_AVAILMODESAND 40602l +#define SPC_TRIG_CH0_MODE 40610l +#define SPC_TRIG_CH1_MODE 40611l +#define SPC_TRIG_CH2_MODE 40612l +#define SPC_TRIG_CH3_MODE 40613l +#define SPC_TRIG_CH4_MODE 40614l +#define SPC_TRIG_CH5_MODE 40615l +#define SPC_TRIG_CH6_MODE 40616l +#define SPC_TRIG_CH7_MODE 40617l +#define SPC_TRIG_CH8_MODE 40618l +#define SPC_TRIG_CH9_MODE 40619l +#define SPC_TRIG_CH10_MODE 40620l +#define SPC_TRIG_CH11_MODE 40621l +#define SPC_TRIG_CH12_MODE 40622l +#define SPC_TRIG_CH13_MODE 40623l +#define SPC_TRIG_CH14_MODE 40624l +#define SPC_TRIG_CH15_MODE 40625l +#define SPC_TRIG_CH16_MODE 40626l +#define SPC_TRIG_CH17_MODE 40627l +#define SPC_TRIG_CH18_MODE 40628l +#define SPC_TRIG_CH19_MODE 40629l +#define SPC_TRIG_CH20_MODE 40630l +#define SPC_TRIG_CH21_MODE 40631l +#define SPC_TRIG_CH22_MODE 40632l +#define SPC_TRIG_CH23_MODE 40633l +#define SPC_TRIG_CH24_MODE 40634l +#define SPC_TRIG_CH25_MODE 40635l +#define SPC_TRIG_CH26_MODE 40636l +#define SPC_TRIG_CH27_MODE 40637l +#define SPC_TRIG_CH28_MODE 40638l +#define SPC_TRIG_CH29_MODE 40639l +#define SPC_TRIG_CH30_MODE 40640l +#define SPC_TRIG_CH31_MODE 40641l + +#define SPC_TRIG_CH32_MODE 40642l +#define SPC_TRIG_CH33_MODE 40643l +#define SPC_TRIG_CH34_MODE 40644l +#define SPC_TRIG_CH35_MODE 40645l +#define SPC_TRIG_CH36_MODE 40646l +#define SPC_TRIG_CH37_MODE 40647l +#define SPC_TRIG_CH38_MODE 40648l +#define SPC_TRIG_CH39_MODE 40649l +#define SPC_TRIG_CH40_MODE 40650l +#define SPC_TRIG_CH41_MODE 40651l +#define SPC_TRIG_CH42_MODE 40652l +#define SPC_TRIG_CH43_MODE 40653l +#define SPC_TRIG_CH44_MODE 40654l +#define SPC_TRIG_CH45_MODE 40655l +#define SPC_TRIG_CH46_MODE 40656l +#define SPC_TRIG_CH47_MODE 40657l +#define SPC_TRIG_CH48_MODE 40658l +#define SPC_TRIG_CH49_MODE 40659l +#define SPC_TRIG_CH50_MODE 40660l +#define SPC_TRIG_CH51_MODE 40661l +#define SPC_TRIG_CH52_MODE 40662l +#define SPC_TRIG_CH53_MODE 40663l +#define SPC_TRIG_CH54_MODE 40664l +#define SPC_TRIG_CH55_MODE 40665l +#define SPC_TRIG_CH56_MODE 40666l +#define SPC_TRIG_CH57_MODE 40667l +#define SPC_TRIG_CH58_MODE 40668l +#define SPC_TRIG_CH59_MODE 40669l +#define SPC_TRIG_CH60_MODE 40670l +#define SPC_TRIG_CH61_MODE 40671l +#define SPC_TRIG_CH62_MODE 40672l +#define SPC_TRIG_CH63_MODE 40673l + + +#define SPC_TRIG_AVAILDELAY 40800l +#define SPC_TRIG_AVAILDELAY_STEP 40801l +#define SPC_TRIG_DELAY 40810l + +#define SPC_TRIG_AVAILHOLDOFF 40802l +#define SPC_TRIG_AVAILHOLDOFF_STEP 40803l +#define SPC_TRIG_HOLDOFF 40811l + +#define SPC_SINGLESHOT 41000l +#define SPC_OUTONTRIGGER 41100l +#define SPC_RESTARTCONT 41200l +#define SPC_SINGLERESTART 41300l + +#define SPC_TRIGGERLEVEL 42000l +#define SPC_TRIGGERLEVEL0 42000l +#define SPC_TRIGGERLEVEL1 42001l +#define SPC_TRIGGERLEVEL2 42002l +#define SPC_TRIGGERLEVEL3 42003l +#define SPC_TRIGGERLEVEL4 42004l +#define SPC_TRIGGERLEVEL5 42005l +#define SPC_TRIGGERLEVEL6 42006l +#define SPC_TRIGGERLEVEL7 42007l +#define SPC_TRIGGERLEVEL8 42008l +#define SPC_TRIGGERLEVEL9 42009l +#define SPC_TRIGGERLEVEL10 42010l +#define SPC_TRIGGERLEVEL11 42011l +#define SPC_TRIGGERLEVEL12 42012l +#define SPC_TRIGGERLEVEL13 42013l +#define SPC_TRIGGERLEVEL14 42014l +#define SPC_TRIGGERLEVEL15 42015l + +#define SPC_AVAILHIGHLEVEL_MIN 41997l +#define SPC_AVAILHIGHLEVEL_MAX 41998l +#define SPC_AVAILHIGHLEVEL_STEP 41999l + +#define SPC_HIGHLEVEL0 42000l +#define SPC_HIGHLEVEL1 42001l +#define SPC_HIGHLEVEL2 42002l +#define SPC_HIGHLEVEL3 42003l +#define SPC_HIGHLEVEL4 42004l +#define SPC_HIGHLEVEL5 42005l +#define SPC_HIGHLEVEL6 42006l +#define SPC_HIGHLEVEL7 42007l +#define SPC_HIGHLEVEL8 42008l +#define SPC_HIGHLEVEL9 42009l +#define SPC_HIGHLEVEL10 42010l +#define SPC_HIGHLEVEL11 42011l +#define SPC_HIGHLEVEL12 42012l +#define SPC_HIGHLEVEL13 42013l +#define SPC_HIGHLEVEL14 42014l +#define SPC_HIGHLEVEL15 42015l + +#define SPC_AVAILLOWLEVEL_MIN 42097l +#define SPC_AVAILLOWLEVEL_MAX 42098l +#define SPC_AVAILLOWLEVEL_STEP 42099l + +#define SPC_LOWLEVEL0 42100l +#define SPC_LOWLEVEL1 42101l +#define SPC_LOWLEVEL2 42102l +#define SPC_LOWLEVEL3 42103l +#define SPC_LOWLEVEL4 42104l +#define SPC_LOWLEVEL5 42105l +#define SPC_LOWLEVEL6 42106l +#define SPC_LOWLEVEL7 42107l +#define SPC_LOWLEVEL8 42108l +#define SPC_LOWLEVEL9 42109l +#define SPC_LOWLEVEL10 42110l +#define SPC_LOWLEVEL11 42111l +#define SPC_LOWLEVEL12 42112l +#define SPC_LOWLEVEL13 42113l +#define SPC_LOWLEVEL14 42114l +#define SPC_LOWLEVEL15 42115l + +#define SPC_TRIG_CH0_LEVEL0 42200l +#define SPC_TRIG_CH1_LEVEL0 42201l +#define SPC_TRIG_CH2_LEVEL0 42202l +#define SPC_TRIG_CH3_LEVEL0 42203l +#define SPC_TRIG_CH4_LEVEL0 42204l +#define SPC_TRIG_CH5_LEVEL0 42205l +#define SPC_TRIG_CH6_LEVEL0 42206l +#define SPC_TRIG_CH7_LEVEL0 42207l +#define SPC_TRIG_CH8_LEVEL0 42208l +#define SPC_TRIG_CH9_LEVEL0 42209l +#define SPC_TRIG_CH10_LEVEL0 42210l +#define SPC_TRIG_CH11_LEVEL0 42211l +#define SPC_TRIG_CH12_LEVEL0 42212l +#define SPC_TRIG_CH13_LEVEL0 42213l +#define SPC_TRIG_CH14_LEVEL0 42214l +#define SPC_TRIG_CH15_LEVEL0 42215l + +#define SPC_TRIG_CH0_LEVEL1 42300l +#define SPC_TRIG_CH1_LEVEL1 42301l +#define SPC_TRIG_CH2_LEVEL1 42302l +#define SPC_TRIG_CH3_LEVEL1 42303l +#define SPC_TRIG_CH4_LEVEL1 42304l +#define SPC_TRIG_CH5_LEVEL1 42305l +#define SPC_TRIG_CH6_LEVEL1 42306l +#define SPC_TRIG_CH7_LEVEL1 42307l +#define SPC_TRIG_CH8_LEVEL1 42308l +#define SPC_TRIG_CH9_LEVEL1 42309l +#define SPC_TRIG_CH10_LEVEL1 42310l +#define SPC_TRIG_CH11_LEVEL1 42311l +#define SPC_TRIG_CH12_LEVEL1 42312l +#define SPC_TRIG_CH13_LEVEL1 42313l +#define SPC_TRIG_CH14_LEVEL1 42314l +#define SPC_TRIG_CH15_LEVEL1 42315l + +#define SPC_TRIG_EXT0_LEVEL0 42320l +#define SPC_TRIG_EXT1_LEVEL0 42321l +#define SPC_TRIG_EXT2_LEVEL0 42322l + +#define SPC_TRIG_EXT0_LEVEL1 42330l +#define SPC_TRIG_EXT1_LEVEL1 42331l +#define SPC_TRIG_EXT2_LEVEL1 42332l + +#define SPC_TRIG_EXT_AVAIL0_MIN 42340l +#define SPC_TRIG_EXT_AVAIL0_MAX 42341l +#define SPC_TRIG_EXT_AVAIL0_STEP 42342l + +#define SPC_TRIG_EXT_AVAIL1_MIN 42345l +#define SPC_TRIG_EXT_AVAIL1_MAX 42346l +#define SPC_TRIG_EXT_AVAIL1_STEP 42347l + +// threshold levels (for 77xx) +#define SPC_THRESHOLD0 42400l // threshold level for channel group 0 +#define SPC_THRESHOLD1 42401l // threshold level for channel group 1 +#define SPC_THRESHOLD2 42402l // threshold level for channel group 2 +#define SPC_THRESHOLD3 42403l // threshold level for channel group 3 +#define SPC_CLOCK_THRESHOLD 42410l // threshold level for clock input +#define SPC_TRIG_THRESHOLD 42411l // threshold level for trigger input +#define SPC_X0X1_THRESHOLD 42412l // threshold level for X0/X1 input +#define SPC_STROBE_THRESHOLD 42413l // threshold level for strobe input + +#define SPC_AVAILTHRESHOLD_MIN 42420l +#define SPC_AVAILTHRESHOLD_MAX 42421l +#define SPC_AVAILTHRESHOLD_STEP 42422l + +#define SPC_AVAILAVRGMODES 42429l +#define SPC_AVRGMODE_CH0 42430l +#define SPC_AVRGMODE_CH1 42431l +#define SPC_AVRGMODE_CH2 42432l +#define SPC_AVRGMODE_CH3 42433l +#define AVRGMODE_NORMAL 0x0l // normal block averaging +#define AVRGMODE_TDA_HIGH 0x1l // threshold defined averaging: (samples > threshhold) will be used, others replaced +#define AVRGMODE_TDA_LOW 0x2l // threshold defined averaging: (samples <= threshhold) will be used, others replaced + +#define SPC_TDA_THRESHOLD_CH0 42440l // threshhold for threshold defined averaging in LSB of ADC +#define SPC_TDA_THRESHOLD_CH1 42441l +#define SPC_TDA_THRESHOLD_CH2 42442l +#define SPC_TDA_THRESHOLD_CH3 42443l + +#define SPC_TDA_REPLACEMENT_CH0 42450l // replacement sample value for threshold defined averaging in LSB of ADC +#define SPC_TDA_REPLACEMENT_CH1 42451l +#define SPC_TDA_REPLACEMENT_CH2 42452l +#define SPC_TDA_REPLACEMENT_CH3 42453l + +#define SPC_CLOCK_AVAILTHRESHOLD_MIN 42423l +#define SPC_CLOCK_AVAILTHRESHOLD_MAX 42424l +#define SPC_CLOCK_AVAILTHRESHOLD_STEP 42425l + +#define SPC_TRIG_AVAILTHRESHOLD_MIN 42426l +#define SPC_TRIG_AVAILTHRESHOLD_MAX 42427l +#define SPC_TRIG_AVAILTHRESHOLD_STEP 42428l + +#define SPC_TRIGGERPATTERN 43000l +#define SPC_TRIGGERPATTERN0 43000l +#define SPC_TRIGGERPATTERN1 43001l +#define SPC_TRIGGERMASK 43100l +#define SPC_TRIGGERMASK0 43100l +#define SPC_TRIGGERMASK1 43101l + +#define SPC_PULSEWIDTH 44000l +#define SPC_PULSEWIDTH0 44000l +#define SPC_PULSEWIDTH1 44001l + +#define SPC_TRIG_CH_AVAILPULSEWIDTH 44100l +#define SPC_TRIG_CH_PULSEWIDTH 44101l +#define SPC_TRIG_CH0_PULSEWIDTH 44101l +#define SPC_TRIG_CH1_PULSEWIDTH 44102l +#define SPC_TRIG_CH2_PULSEWIDTH 44103l +#define SPC_TRIG_CH3_PULSEWIDTH 44104l +#define SPC_TRIG_CH4_PULSEWIDTH 44105l +#define SPC_TRIG_CH5_PULSEWIDTH 44106l +#define SPC_TRIG_CH6_PULSEWIDTH 44107l +#define SPC_TRIG_CH7_PULSEWIDTH 44108l +#define SPC_TRIG_CH8_PULSEWIDTH 44109l +#define SPC_TRIG_CH9_PULSEWIDTH 44110l +#define SPC_TRIG_CH10_PULSEWIDTH 44111l +#define SPC_TRIG_CH11_PULSEWIDTH 44112l +#define SPC_TRIG_CH12_PULSEWIDTH 44113l +#define SPC_TRIG_CH13_PULSEWIDTH 44114l +#define SPC_TRIG_CH14_PULSEWIDTH 44115l +#define SPC_TRIG_CH15_PULSEWIDTH 44116l + +#define SPC_TRIG_EXT_AVAILPULSEWIDTH 44200l +#define SPC_TRIG_EXT0_PULSEWIDTH 44210l +#define SPC_TRIG_EXT1_PULSEWIDTH 44211l +#define SPC_TRIG_EXT2_PULSEWIDTH 44212l +#define SPC_TRIG_EXT3_PULSEWIDTH 44213l + +// available dividers for MICX +#define SPC_READCLOCKDIVCOUNT 44300l +#define SPC_CLOCKDIV0 44301l +#define SPC_CLOCKDIV1 44302l +#define SPC_CLOCKDIV2 44303l +#define SPC_CLOCKDIV3 44304l +#define SPC_CLOCKDIV4 44305l +#define SPC_CLOCKDIV5 44306l +#define SPC_CLOCKDIV6 44307l +#define SPC_CLOCKDIV7 44308l +#define SPC_CLOCKDIV8 44309l +#define SPC_CLOCKDIV9 44310l +#define SPC_CLOCKDIV10 44311l +#define SPC_CLOCKDIV11 44312l +#define SPC_CLOCKDIV12 44313l +#define SPC_CLOCKDIV13 44314l +#define SPC_CLOCKDIV14 44315l +#define SPC_CLOCKDIV15 44316l +#define SPC_CLOCKDIV16 44317l + +#define SPC_READTROFFSET 45000l +#define SPC_TRIGGEREDGE 46000l +#define SPC_TRIGGEREDGE0 46000l +#define SPC_TRIGGEREDGE1 46001l +#define TE_POS 10000l +#define TE_NEG 10010l +#define TE_BOTH 10020l +#define TE_NONE 10030l + + +// ----- Timestamp ----- +#define CH_TIMESTAMP 9999l + +#define SPC_TIMESTAMP_CMD 47000l +#define TS_RESET 0l +#define TS_MODE_DISABLE 10l +#define TS_MODE_STARTRESET 11l +#define TS_MODE_STANDARD 12l +#define TS_MODE_REFCLOCK 13l +#define TS_MODE_TEST5555 90l +#define TS_MODE_TESTAAAA 91l +#define TS_MODE_ZHTEST 92l + +// ----- modes for M2i, M3i, M4i, M4x, M2p hardware (bitmap) ----- +#define SPC_TIMESTAMP_AVAILMODES 47001l +#define SPC_TSMODE_DISABLE 0x00000000 +#define SPC_TS_RESET 0x00000001 +#define SPC_TSMODE_STANDARD 0x00000002 +#define SPC_TSMODE_STARTRESET 0x00000004 +#define SPC_TS_RESET_WAITREFCLK 0x00000008 +#define SPC_TSCNT_INTERNAL 0x00000100 +#define SPC_TSCNT_REFCLOCKPOS 0x00000200 +#define SPC_TSCNT_REFCLOCKNEG 0x00000400 +#define SPC_TSFEAT_NONE 0x00000000 +#define SPC_TSFEAT_STORE1STABA 0x00010000 +#define SPC_TSFEAT_INCRMODE 0x00020000 +#define SPC_TSFEAT_INCRMODE12 0x00040000 +#define SPC_TSFEAT_TRGSRC 0x00080000 + +#define SPC_TSXIOACQ_DISABLE 0x00000000 +#define SPC_TSXIOACQ_ENABLE 0x00001000 +#define SPC_TSXIOINC_ENABLE 0x00002000 +#define SPC_TSXIOINC12_ENABLE 0x00004000 + +#define SPC_TSMODE_MASK 0x000000FF +#define SPC_TSCNT_MASK 0x00000F00 +#define SPC_TSFEAT_MASK 0x000F0000 + +#define SPC_TRGSRC_MASK_CH0 0x00000001 +#define SPC_TRGSRC_MASK_CH1 0x00000002 +#define SPC_TRGSRC_MASK_CH2 0x00000004 +#define SPC_TRGSRC_MASK_CH3 0x00000008 +#define SPC_TRGSRC_MASK_CH4 0x00000010 +#define SPC_TRGSRC_MASK_CH5 0x00000020 +#define SPC_TRGSRC_MASK_CH6 0x00000040 +#define SPC_TRGSRC_MASK_CH7 0x00000080 +#define SPC_TRGSRC_MASK_EXT0 0x00000100 +#define SPC_TRGSRC_MASK_EXT1 0x00000200 +#define SPC_TRGSRC_MASK_FORCE 0x00000400 +// space for digital channels using TSXIOACQ_ENABLE of standard multi-purpose lines +#define SPC_TRGSRC_MASK_PXI0 0x00010000 +#define SPC_TRGSRC_MASK_PXI1 0x00020000 +#define SPC_TRGSRC_MASK_PXI2 0x00040000 +#define SPC_TRGSRC_MASK_PXI3 0x00080000 +#define SPC_TRGSRC_MASK_PXI4 0x00100000 +#define SPC_TRGSRC_MASK_PXI5 0x00200000 +#define SPC_TRGSRC_MASK_PXI6 0x00400000 +#define SPC_TRGSRC_MASK_PXI7 0x00800000 +#define SPC_TRGSRC_MASK_PXISTAR 0x01000000 +#define SPC_TRGSRC_MASK_PXIDSTARB 0x02000000 +#define SPC_TRGSRC_MASK_X0 0x10000000 +#define SPC_TRGSRC_MASK_X1 0x20000000 +#define SPC_TRGSRC_MASK_X2 0x40000000 +#define SPC_TRGSRC_MASK_X3 0x80000000 +// space for more digital channels using TSXIOACQ_ENABLE of additional multi-purpose lines (optional) + + +#define SPC_TIMESTAMP_STATUS 47010l +#define TS_FIFO_EMPTY 0l +#define TS_FIFO_LESSHALF 1l +#define TS_FIFO_MOREHALF 2l +#define TS_FIFO_OVERFLOW 3l + +#define SPC_TIMESTAMP_COUNT 47020l +#define SPC_TIMESTAMP_STARTTIME 47030l +#define SPC_TIMESTAMP_STARTDATE 47031l +#define SPC_TIMESTAMP_FIFO 47040l +#define SPC_TIMESTAMP_TIMEOUT 47045l + +#define SPC_TIMESTAMP_RESETMODE 47050l +#define TS_RESET_POS 10l +#define TS_RESET_NEG 20l + + + +// ----- Extra I/O module ----- +#define SPC_XIO_DIRECTION 47100l +#define XD_CH0_INPUT 0l +#define XD_CH0_OUTPUT 1l +#define XD_CH1_INPUT 0l +#define XD_CH1_OUTPUT 2l +#define XD_CH2_INPUT 0l +#define XD_CH2_OUTPUT 4l +#define SPC_XIO_DIGITALIO 47110l +#define SPC_XIO_ANALOGOUT0 47120l +#define SPC_XIO_ANALOGOUT1 47121l +#define SPC_XIO_ANALOGOUT2 47122l +#define SPC_XIO_ANALOGOUT3 47123l +#define SPC_XIO_WRITEDACS 47130l + + + +// ----- M3i multi purpose lines (X0, X1 ) +// ----- M4i + M4x multi purpose lines (X0, X1, X2 ) +// ----- M2p multi purpose lines (X0, X1, X2, X3) and with installed option also (X4 .. X19) + +// legacy constants: not enough contiguous constants possible for X4..X19, +// hence new constants for X-modes (SPCM_X0_MODE.. SPCM_X19_MODE) exist further below +#define SPCM_LEGACY_X0_MODE 47200l +#define SPCM_LEGACY_X1_MODE 47201l +#define SPCM_LEGACY_X2_MODE 47202l +#define SPCM_LEGACY_X3_MODE 47203l +#define SPCM_LEGACY_X0_AVAILMODES 47210l +#define SPCM_LEGACY_X1_AVAILMODES 47211l +#define SPCM_LEGACY_X2_AVAILMODES 47212l +#define SPCM_LEGACY_X3_AVAILMODES 47213l +#define SPCM_XMODE_DISABLE 0x00000000 +#define SPCM_XMODE_ASYNCIN 0x00000001 // used as asynchronous input +#define SPCM_XMODE_ASYNCOUT 0x00000002 // used as asynchronous output +#define SPCM_XMODE_DIGIN 0x00000004 // used as synchronous digital input +#define SPCM_XMODE_DIGOUT 0x00000008 // used as synchronous digital output +#define SPCM_XMODE_TRIGIN 0x00000010 // used as trigger input +#define SPCM_XMODE_TRIGOUT 0x00000020 // used as trigger output +#define SPCM_XMODE_OVROUT 0x00000040 // used as ADC overrange output +#define SPCM_XMODE_DIGIN2BIT 0x00000080 // used as synchronous digital input, 2bits per channel +#define SPCM_XMODE_RUNSTATE 0x00000100 // shows the run state of the card (high = run) +#define SPCM_XMODE_ARMSTATE 0x00000200 // shows the arm state (high = armed for trigger of one single card) +#define SPCM_XMODE_DIRECTTRIGOUT 0x00000400 // used as direct trigger output (safe mode) +#define SPCM_XMODE_DIRECTTRIGOUT_LR 0x00000800 // used as direct trigger output (low re-arm) +#define SPCM_XMODE_REFCLKOUT 0x00001000 // outputs internal or fed in external refclock +#define SPCM_XMODE_CONTOUTMARK 0x00002000 // outputs a half posttrigger long HIGH pulse on replay +#define SPCM_XMODE_SYSCLKOUT 0x00004000 // outputs internal system clock +#define SPCM_XMODE_CLKOUT 0x00008000 // clock output +#define SPCM_XMODE_SYNCARMSTATE 0x00010000 // shows the arm state (high = armed for trigger when all cards connected to a Star-Hub are armed) +#define SPCM_XMODE_OPTDIGIN2BIT 0x00020000 // used as synchronous digital input from digitaloption, 2bits per channel +#define SPCM_XMODE_OPTDIGIN4BIT 0x00040000 // used as synchronous digital input from digitaloption, 4bits per channel +#define SPCM_XMODE_PULSEGEN 0x00080000 // output of pulse generator +#define SPCM_XMODE_MODEMASK 0x000FFFFF + +// additional constants to be combined together with SPCM_XMODE_DIGOUT to select analog channel containing digital data +#define SPCM_XMODE_DIGOUTSRC_CH0 0x01000000 // Select Ch0 as source +#define SPCM_XMODE_DIGOUTSRC_CH1 0x02000000 // Select Ch1 as source +#define SPCM_XMODE_DIGOUTSRC_CH2 0x04000000 // Select Ch2 as source +#define SPCM_XMODE_DIGOUTSRC_CH3 0x08000000 // Select Ch3 as source +#define SPCM_XMODE_DIGOUTSRC_CH4 0x10000000 // Select Ch4 as source +#define SPCM_XMODE_DIGOUTSRC_CH5 0x20000000 // Select Ch5 as source +#define SPCM_XMODE_DIGOUTSRC_CH6 0x40000000 // Select Ch6 as source +#define SPCM_XMODE_DIGOUTSRC_CH7 0x80000000 // Select Ch7 as source +#define SPCM_XMODE_DIGOUTSRC_CHMASK 0xFF000000 + +// additional constants to be combined together with SPCM_XMODE_DIGOUT to select digital signal source +#define SPCM_XMODE_DIGOUTSRC_BIT15 0x00100000 // Use Bit15 (MSB ) of selected channel: channel resolution will be reduced to 15 bit +#define SPCM_XMODE_DIGOUTSRC_BIT14 0x00200000 // Use Bit14 (MSB - 1) of selected channel: channel resolution will be reduced to 14 bit +#define SPCM_XMODE_DIGOUTSRC_BIT13 0x00400000 // Use Bit13 (MSB - 2) of selected channel: channel resolution will be reduced to 13 bit +#define SPCM_XMODE_DIGOUTSRC_BIT12 0x00800000 // Use Bit12 (MSB - 3) of selected channel: channel resolution will be reduced to 12 bit +#define SPCM_XMODE_DIGOUTSRC_BITMASK 0x00F00000 +// special combinations for M2p.65xx cards with options SPCM_FEAT_DIG16_SMB or SPCM_FEAT_DIG16_FX2 +#define SPCM_XMODE_DIGOUTSRC_BIT15_downto_0 0x00F00000 // use all 16 bits of selected channel on (X19..X4) : channel will only contain digital data +#define SPCM_XMODE_DIGOUTSRC_BIT15_downto_8 0x00700000 // use upper 8 bits of selected channel for (X19..X12) or (X11..X4): channel resolution will be reduced to 8 bit + +#define SPCM_XX_ASYNCIO 47220l // asynchronous in/out register + +#define SPC_DIGMODE0 47250l +#define SPC_DIGMODE1 47251l +#define SPC_DIGMODE2 47252l +#define SPC_DIGMODE3 47253l +#define SPC_DIGMODE4 47254l +#define SPC_DIGMODE5 47255l +#define SPC_DIGMODE6 47256l +#define SPC_DIGMODE7 47257l +#define SPCM_DIGMODE_OFF 0x00000000 +#define SPCM_DIGMODE_X0 0x21084000 // (M2P_DIGMODE_X0 << (32 - 5)) | (M2P_DIGMODE_X0 << (32 - 10)) | (M2P_DIGMODE_X0 << (32 - 15)) | (M2P_DIGMODE_X0 << (32 - 20)) +#define SPCM_DIGMODE_X1 0x294A5000 // (M2P_DIGMODE_X1 << (32 - 5)) | (M2P_DIGMODE_X1 << (32 - 10)) | (M2P_DIGMODE_X1 << (32 - 15)) | (M2P_DIGMODE_X1 << (32 - 20)) +#define SPCM_DIGMODE_X2 0x318C6000 // (M2P_DIGMODE_X2 << (32 - 5)) | (M2P_DIGMODE_X2 << (32 - 10)) | (M2P_DIGMODE_X2 << (32 - 15)) | (M2P_DIGMODE_X2 << (32 - 20)) +#define SPCM_DIGMODE_X3 0x39CE7000 // (M2P_DIGMODE_X3 << (32 - 5)) | (M2P_DIGMODE_X3 << (32 - 10)) | (M2P_DIGMODE_X3 << (32 - 15)) | (M2P_DIGMODE_X3 << (32 - 20)) +#define SPCM_DIGMODE_X4 0x84210001 +#define SPCM_DIGMODE_X5 0x8c631002 +#define SPCM_DIGMODE_X6 0x94a52004 +#define SPCM_DIGMODE_X7 0x9ce73008 +#define SPCM_DIGMODE_X8 0xa5294010 +#define SPCM_DIGMODE_X9 0xad6b5020 +#define SPCM_DIGMODE_X10 0xb5ad6040 +#define SPCM_DIGMODE_X11 0xbdef7080 +#define SPCM_DIGMODE_X12 0xc6318100 +#define SPCM_DIGMODE_X13 0xce739200 +#define SPCM_DIGMODE_X14 0xd6b5a400 +#define SPCM_DIGMODE_X15 0xdef7b800 +#define SPCM_DIGMODE_X16 0xe739c000 +#define SPCM_DIGMODE_X17 0xef7bd000 +#define SPCM_DIGMODE_X18 0xf7bde000 +#define SPCM_DIGMODE_X19 0xfffff000 + +#define DIGMODEMASK_BIT15 0xF8000000 +#define DIGMODEMASK_BIT14 0x07C00000 +#define DIGMODEMASK_BIT13 0x003E0000 +#define DIGMODEMASK_BIT12 0x0001F000 +#define DIGMODEMASK_BIT11 0x00000800 // one bit only for bit 11 downto 0 +#define DIGMODEMASK_BIT10 0x00000400 +#define DIGMODEMASK_BIT9 0x00000200 +#define DIGMODEMASK_BIT8 0x00000100 +#define DIGMODEMASK_BIT7 0x00000080 +#define DIGMODEMASK_BIT6 0x00000040 +#define DIGMODEMASK_BIT5 0x00000020 +#define DIGMODEMASK_BIT4 0x00000010 +#define DIGMODEMASK_BIT3 0x00000008 +#define DIGMODEMASK_BIT2 0x00000004 +#define DIGMODEMASK_BIT1 0x00000002 +#define DIGMODEMASK_BIT0 0x00000001 + +// provided for convenience +#define SPCM_DIGMODE_CHREPLACE 0xFFBBCFFF +//#define SPCM_DIGMODE_CHREPLACE ( (DIGMODEMASK_BIT15 & SPCM_DIGMODE_X19) +// | (DIGMODEMASK_BIT14 & SPCM_DIGMODE_X18) +// | (DIGMODEMASK_BIT13 & SPCM_DIGMODE_X17) +// | (DIGMODEMASK_BIT12 & SPCM_DIGMODE_X16) +// | (DIGMODEMASK_BIT11 & SPCM_DIGMODE_X15) +// | (DIGMODEMASK_BIT10 & SPCM_DIGMODE_X14) +// | (DIGMODEMASK_BIT9 & SPCM_DIGMODE_X13) +// | (DIGMODEMASK_BIT8 & SPCM_DIGMODE_X12) +// | (DIGMODEMASK_BIT7 & SPCM_DIGMODE_X11) +// | (DIGMODEMASK_BIT6 & SPCM_DIGMODE_X10) +// | (DIGMODEMASK_BIT5 & SPCM_DIGMODE_X9 ) +// | (DIGMODEMASK_BIT4 & SPCM_DIGMODE_X8 ) +// | (DIGMODEMASK_BIT3 & SPCM_DIGMODE_X7 ) +// | (DIGMODEMASK_BIT2 & SPCM_DIGMODE_X6 ) +// | (DIGMODEMASK_BIT1 & SPCM_DIGMODE_X5 ) +// | (DIGMODEMASK_BIT0 & SPCM_DIGMODE_X4 ) ) +// + + +// ----- M4x PXI Trigger lines ----- +#define SPC_PXITRG0_MODE 47300l +#define SPC_PXITRG1_MODE 47301l +#define SPC_PXITRG2_MODE 47302l +#define SPC_PXITRG3_MODE 47303l +#define SPC_PXITRG4_MODE 47304l +#define SPC_PXITRG5_MODE 47305l +#define SPC_PXITRG6_MODE 47306l +#define SPC_PXITRG7_MODE 47307l +#define SPC_PXISTAR_MODE 47308l +#define SPC_PXIDSTARC_MODE 47309l +#define SPC_PXITRG0_AVAILMODES 47310l +#define SPC_PXITRG1_AVAILMODES 47311l +#define SPC_PXITRG2_AVAILMODES 47312l +#define SPC_PXITRG3_AVAILMODES 47313l +#define SPC_PXITRG4_AVAILMODES 47314l +#define SPC_PXITRG5_AVAILMODES 47315l +#define SPC_PXITRG6_AVAILMODES 47316l +#define SPC_PXITRG7_AVAILMODES 47317l +#define SPC_PXISTAR_AVAILMODES 47318l +#define SPC_PXIDSTARC_AVAILMODES 47319l +#define SPC_PXITRG_ASYNCIO 47320l // asynchronous in/out register +#define SPCM_PXITRGMODE_DISABLE 0x00000000 +#define SPCM_PXITRGMODE_IN 0x00000001 // used as input +#define SPCM_PXITRGMODE_ASYNCOUT 0x00000002 // used as asynchronous output +#define SPCM_PXITRGMODE_RUNSTATE 0x00000004 // shows the run state of the card (high = run) +#define SPCM_PXITRGMODE_ARMSTATE 0x00000008 // shows the arm state (high = armed for trigger) +#define SPCM_PXITRGMODE_TRIGOUT 0x00000010 // used as trigger output +#define SPCM_PXITRGMODE_REFCLKOUT 0x00000020 // outputs PXI refclock (10 MHz) +#define SPCM_PXITRGMODE_CONTOUTMARK 0x00000040 // outputs a half posttrigger long HIGH pulse on replay + + +// ----- Star-Hub ----- +// 48000 not usable + +#define SPC_STARHUB_STATUS 48010l + +#define SPC_STARHUB_ROUTE0 48100l // Routing Information for Test +#define SPC_STARHUB_ROUTE99 48199l // ... + + +// Spcm driver (M2i, M3i, M4i, M4x, M2p) sync setup registers +#define SPC_SYNC_READ_SYNCCOUNT 48990l // number of sync'd cards +#define SPC_SYNC_READ_NUMCONNECTORS 48991l // number of connectors on starhub + +#define SPC_SYNC_READ_CARDIDX0 49000l // read index of card at location 0 of sync +#define SPC_SYNC_READ_CARDIDX1 49001l // ... +#define SPC_SYNC_READ_CARDIDX2 49002l // ... +#define SPC_SYNC_READ_CARDIDX3 49003l // ... +#define SPC_SYNC_READ_CARDIDX4 49004l // ... +#define SPC_SYNC_READ_CARDIDX5 49005l // ... +#define SPC_SYNC_READ_CARDIDX6 49006l // ... +#define SPC_SYNC_READ_CARDIDX7 49007l // ... +#define SPC_SYNC_READ_CARDIDX8 49008l // ... +#define SPC_SYNC_READ_CARDIDX9 49009l // ... +#define SPC_SYNC_READ_CARDIDX10 49010l // ... +#define SPC_SYNC_READ_CARDIDX11 49011l // ... +#define SPC_SYNC_READ_CARDIDX12 49012l // ... +#define SPC_SYNC_READ_CARDIDX13 49013l // ... +#define SPC_SYNC_READ_CARDIDX14 49014l // ... +#define SPC_SYNC_READ_CARDIDX15 49015l // ... + +#define SPC_SYNC_READ_CABLECON0 49100l // read cable connection of card at location 0 of sync +#define SPC_SYNC_READ_CABLECON1 49101l // ... +#define SPC_SYNC_READ_CABLECON2 49102l // ... +#define SPC_SYNC_READ_CABLECON3 49103l // ... +#define SPC_SYNC_READ_CABLECON4 49104l // ... +#define SPC_SYNC_READ_CABLECON5 49105l // ... +#define SPC_SYNC_READ_CABLECON6 49106l // ... +#define SPC_SYNC_READ_CABLECON7 49107l // ... +#define SPC_SYNC_READ_CABLECON8 49108l // ... +#define SPC_SYNC_READ_CABLECON9 49109l // ... +#define SPC_SYNC_READ_CABLECON10 49110l // ... +#define SPC_SYNC_READ_CABLECON11 49111l // ... +#define SPC_SYNC_READ_CABLECON12 49112l // ... +#define SPC_SYNC_READ_CABLECON13 49113l // ... +#define SPC_SYNC_READ_CABLECON14 49114l // ... +#define SPC_SYNC_READ_CABLECON15 49115l // ... + +#define SPC_SYNC_ENABLEMASK 49200l // synchronisation enable (mask) +#define SPC_SYNC_NOTRIGSYNCMASK 49210l // trigger disabled for sync (mask) +#define SPC_SYNC_CLKMASK 49220l // clock master (mask) +#define SPC_SYNC_MODE 49230l // synchronization mode +#define SPC_AVAILSYNC_MODES 49231l // available synchronization modes +#define SPC_SYNC_STANDARD 0x00000001 // starhub uses its own clock and trigger sources +#define SPC_SYNC_SYSTEMCLOCK 0x00000002 // starhub uses own trigger sources and takes clock from system starhub +#define SPC_SYNC_SYSTEMCLOCKTRIG 0x00000004 // starhub takes clock and trigger from system starhub (trigger sampled on rising clock edge) +#define SPC_SYNC_SYSTEMCLOCKTRIGN 0x00000008 // starhub takes clock and trigger from system starhub (trigger sampled on falling clock edge) +#define SPC_SYNC_SYSTEM_TRIGADJUST 49240l // Delay value for adjusting trigger position using system starhub + + +// ----- Gain and Offset Adjust DAC's ----- +#define SPC_ADJ_START 50000l + +#define SPC_ADJ_LOAD 50000l +#define SPC_ADJ_SAVE 50010l +#define ADJ_DEFAULT 0l +#define ADJ_USER0 1l +#define ADJ_USER1 2l +#define ADJ_USER2 3l +#define ADJ_USER3 4l +#define ADJ_USER4 5l +#define ADJ_USER5 6l +#define ADJ_USER6 7l +#define ADJ_USER7 8l + +#define SPC_ADJ_AUTOADJ 50020l +#define ADJ_ALL 0l +#define ADJ_CURRENT 1l +#define ADJ_EXTERNAL 2l +#define ADJ_1MOHM 3l + +#define ADJ_CURRENT_CLOCK 4l +#define ADJ_CURRENT_IR 8l +#define ADJ_OFFSET_ONLY 16l +#define ADJ_SPECIAL_CLOCK 32l + +#define SPC_ADJ_SOURCE_CALLBACK 50021l +#define SPC_ADJ_PROGRESS_CALLBACK 50022l + +#define SPC_ADJ_SET 50030l +#define SPC_ADJ_FAILMASK 50040l + +#define SPC_ADJ_CALIBSOURCE 50050l +#define ADJ_CALSRC_GAIN 1l +#define ADJ_CALSRC_OFF 0l +#define ADJ_CALSRC_GND -1l +#define ADJ_CALSRC_GNDOFFS -2l +#define ADJ_CALSRC_AC 10l +#define ADJ_CALSRC_ADC 11l + +#define SPC_ADJ_CALIBVALUE0 50060l +#define SPC_ADJ_CALIBVALUE1 50061l +#define SPC_ADJ_CALIBVALUE2 50062l +#define SPC_ADJ_CALIBVALUE3 50063l +#define SPC_ADJ_CALIBVALUE4 50064l +#define SPC_ADJ_CALIBVALUE5 50065l +#define SPC_ADJ_CALIBVALUE6 50066l +#define SPC_ADJ_CALIBVALUE7 50067l + +#define SPC_ADJ_OFFSET_CH0 50900l +#define SPC_ADJ_OFFSET_CH1 50901l +#define SPC_ADJ_OFFSET_CH2 50902l +#define SPC_ADJ_OFFSET_CH3 50903l +#define SPC_ADJ_OFFSET_CH4 50904l +#define SPC_ADJ_OFFSET_CH5 50905l +#define SPC_ADJ_OFFSET_CH6 50906l +#define SPC_ADJ_OFFSET_CH7 50907l +#define SPC_ADJ_OFFSET_CH8 50908l +#define SPC_ADJ_OFFSET_CH9 50909l +#define SPC_ADJ_OFFSET_CH10 50910l +#define SPC_ADJ_OFFSET_CH11 50911l +#define SPC_ADJ_OFFSET_CH12 50912l +#define SPC_ADJ_OFFSET_CH13 50913l +#define SPC_ADJ_OFFSET_CH14 50914l +#define SPC_ADJ_OFFSET_CH15 50915l + +#define SPC_ADJ_GAIN_CH0 50916l +#define SPC_ADJ_GAIN_CH1 50917l +#define SPC_ADJ_GAIN_CH2 50918l +#define SPC_ADJ_GAIN_CH3 50919l +#define SPC_ADJ_GAIN_CH4 50920l +#define SPC_ADJ_GAIN_CH5 50921l +#define SPC_ADJ_GAIN_CH6 50922l +#define SPC_ADJ_GAIN_CH7 50923l +#define SPC_ADJ_GAIN_CH8 50924l +#define SPC_ADJ_GAIN_CH9 50925l +#define SPC_ADJ_GAIN_CH10 50926l +#define SPC_ADJ_GAIN_CH11 50927l +#define SPC_ADJ_GAIN_CH12 50928l +#define SPC_ADJ_GAIN_CH13 50929l +#define SPC_ADJ_GAIN_CH14 50930l +#define SPC_ADJ_GAIN_CH15 50931l + +#define SPC_ADJ_OFFSET0 51000l +#define SPC_ADJ_OFFSET999 51999l + +#define SPC_ADJ_GAIN0 52000l +#define SPC_ADJ_GAIN999 52999l + +#define SPC_ADJ_CORRECT0 53000l +#define SPC_ADJ_OFFS_CORRECT0 53000l +#define SPC_ADJ_CORRECT999 53999l +#define SPC_ADJ_OFFS_CORRECT999 53999l + +#define SPC_ADJ_XIOOFFS0 54000l +#define SPC_ADJ_XIOOFFS1 54001l +#define SPC_ADJ_XIOOFFS2 54002l +#define SPC_ADJ_XIOOFFS3 54003l + +#define SPC_ADJ_XIOGAIN0 54010l +#define SPC_ADJ_XIOGAIN1 54011l +#define SPC_ADJ_XIOGAIN2 54012l +#define SPC_ADJ_XIOGAIN3 54013l + +#define SPC_ADJ_GAIN_CORRECT0 55000l +#define SPC_ADJ_GAIN_CORRECT999 55999l + +#define SPC_ADJ_OFFSCALIBCORRECT0 56000l +#define SPC_ADJ_OFFSCALIBCORRECT999 56999l + +#define SPC_ADJ_GAINCALIBCORRECT0 57000l +#define SPC_ADJ_GAINCALIBCORRECT999 57999l + +#define SPC_ADJ_ANALOGTRIGGER0 58000l +#define SPC_ADJ_ANALOGTRIGGER99 58099l + +#define SPC_ADJ_CALIBSAMPLERATE0 58100l +#define SPC_ADJ_CALIBSAMPLERATE99 58199l + +#define SPC_ADJ_CALIBSAMPLERATE_GAIN0 58200l +#define SPC_ADJ_CALIBSAMPLERATE_GAIN99 58299l + +#define SPC_ADJ_REFCLOCK 58300l +#define SPC_ADJ_STARHUB_REFCLOCK 58301l + +#define SPC_ADJ_TIMING_CH0 58400l +#define SPC_ADJ_TIMING_CH1 58401l + +#define SPC_ADJ_END 59999l + + + +// ----- FIFO Control ----- +#define SPC_FIFO_BUFFERS 60000l // number of FIFO buffers +#define SPC_FIFO_BUFLEN 60010l // len of each FIFO buffer +#define SPC_FIFO_BUFCOUNT 60020l // number of FIFO buffers tranfered until now +#define SPC_FIFO_BUFMAXCNT 60030l // number of FIFO buffers to be transfered (0=continuous) +#define SPC_FIFO_BUFADRCNT 60040l // number of FIFO buffers allowed +#define SPC_FIFO_BUFREADY 60050l // fifo buffer ready register (same as SPC_COMMAND + SPC_FIFO_BUFREADY0...) +#define SPC_FIFO_BUFFILLCNT 60060l // number of currently filled buffers +#define SPC_FIFO_BUFADR0 60100l // adress of FIFO buffer no. 0 +#define SPC_FIFO_BUFADR1 60101l // ... +#define SPC_FIFO_BUFADR2 60102l // ... +#define SPC_FIFO_BUFADR3 60103l // ... +#define SPC_FIFO_BUFADR4 60104l // ... +#define SPC_FIFO_BUFADR5 60105l // ... +#define SPC_FIFO_BUFADR6 60106l // ... +#define SPC_FIFO_BUFADR7 60107l // ... +#define SPC_FIFO_BUFADR8 60108l // ... +#define SPC_FIFO_BUFADR9 60109l // ... +#define SPC_FIFO_BUFADR10 60110l // ... +#define SPC_FIFO_BUFADR11 60111l // ... +#define SPC_FIFO_BUFADR12 60112l // ... +#define SPC_FIFO_BUFADR13 60113l // ... +#define SPC_FIFO_BUFADR14 60114l // ... +#define SPC_FIFO_BUFADR15 60115l // ... +#define SPC_FIFO_BUFADR255 60355l // last + + + +// ----- Filter ----- +#define SPC_FILTER 100000l +#define SPC_READNUMFILTERS 100001l // number of programable filters +#define SPC_FILTERFREQUENCY0 100002l // frequency of filter 0 (bypass) +#define SPC_FILTERFREQUENCY1 100003l // frequency of filter 1 +#define SPC_FILTERFREQUENCY2 100004l // frequency of filter 2 +#define SPC_FILTERFREQUENCY3 100005l // frequency of filter 3 +#define SPC_DIGITALBWFILTER 100100l // enable/disable digital bandwith filter + + +// ----- Pattern ----- +#define SPC_PATTERNENABLE 110000l +#define SPC_READDIGITAL 110100l + +#define SPC_DIGITALMODE0 110200l +#define SPC_DIGITALMODE1 110201l +#define SPC_DIGITALMODE2 110202l +#define SPC_DIGITALMODE3 110203l +#define SPC_DIGITALMODE4 110204l +#define SPC_DIGITALMODE5 110205l +#define SPC_DIGITALMODE6 110206l +#define SPC_DIGITALMODE7 110207l +#define SPC_DIGITALMODE_OFF 0l +#define SPC_DIGITALMODE_2BIT 1l +#define SPC_DIGITALMODE_4BIT 2l +#define SPC_DIGITALMODE_CHREPLACE 3l + + +// ----- Miscellanous ----- +#define SPC_MISCDAC0 200000l +#define SPC_MISCDAC1 200010l +#define SPC_FACTORYMODE 200020l +#define SPC_DIRECTDAC 200030l +#define SPC_NOTRIGSYNC 200040l +#define SPC_DSPDIRECT 200100l +#define SPC_DMAPHYSICALADR 200110l +#define SPC_MICXCOMP_CLOSEBOARD 200119l +#define SPC_MICXCOMPATIBILITYMODE 200120l +#define SPC_TEST_FIFOSPEED 200121l +#define SPC_RELOADDEMO 200122l +#define SPC_OVERSAMPLINGFACTOR 200123l +#define SPC_ISMAPPEDCARD 200124l +#define SPCM_NOT_MAPPED 0l +#define SPCM_LOCAL_MAPPED 1l +#define SPCM_REMOTE_MAPPED 2l +#define SPC_GETTHREADHANDLE 200130l +#define SPC_GETKERNELHANDLE 200131l +#define SPC_XYZMODE 200200l +#define SPC_INVERTDATA 200300l +#define SPC_GATEMARKENABLE 200400l +#define SPC_GATE_LEN_ALIGNMENT 200401l +#define SPC_CONTOUTMARK 200450l +#define SPC_EXPANDINT32 200500l +#define SPC_NOPRETRIGGER 200600l +#define SPC_RELAISWAITTIME 200700l +#define SPC_DACWAITTIME 200710l +#define SPC_DELAY_US 200720l +#define SPC_ILAMODE 200800l +#define SPC_NMDGMODE 200810l +#define SPC_CKADHALF_OUTPUT 200820l +#define SPC_LONGTRIG_OUTPUT 200830l +#define SPC_STOREMODAENDOFSEGMENT 200840l +#define SPC_COUNTERMODE 200850l +#define SPC_CNTMOD_MASK 0x0000000F +#define SPC_CNTMOD_PARALLELDATA 0x00000000 +#define SPC_CNTMOD_8BITCNT 0x00000001 +#define SPC_CNTMOD_2x8BITCNT 0x00000002 +#define SPC_CNTMOD_16BITCNT 0x00000003 +#define SPC_CNT0_MASK 0x000000F0 +#define SPC_CNT0_CNTONPOSEDGE 0x00000000 +#define SPC_CNT0_CNTONNEGEDGE 0x00000010 +#define SPC_CNT0_RESETHIGHLVL 0x00000000 +#define SPC_CNT0_RESETLOWLVL 0x00000020 +#define SPC_CNT0_STOPATMAX 0x00000000 +#define SPC_CNT0_ROLLOVER 0x00000040 +#define SPC_CNT1_MASK 0x00000F00 +#define SPC_CNT1_CNTONPOSEDGE 0x00000000 +#define SPC_CNT1_CNTONNEGEDGE 0x00000100 +#define SPC_CNT1_RESETHIGHLVL 0x00000000 +#define SPC_CNT1_RESETLOWLVL 0x00000200 +#define SPC_CNT1_STOPATMAX 0x00000000 +#define SPC_CNT1_ROLLOVER 0x00000400 +#define SPC_CNTCMD_MASK 0x0000F000 +#define SPC_CNTCMD_RESETCNT0 0x00001000 +#define SPC_CNTCMD_RESETCNT1 0x00002000 +#define SPC_ENHANCEDSTATUS 200900l +#define SPC_ENHSTAT_OVERRANGE0 0x00000001 +#define SPC_ENHSTAT_OVERRANGE1 0x00000002 +#define SPC_ENHSTAT_OVERRANGE2 0x00000004 +#define SPC_ENHSTAT_OVERRANGE3 0x00000008 +#define SPC_ENHSTAT_OVERRANGE4 0x00000010 +#define SPC_ENHSTAT_OVERRANGE5 0x00000020 +#define SPC_ENHSTAT_OVERRANGE6 0x00000040 +#define SPC_ENHSTAT_OVERRANGE7 0x00000080 +#define SPC_ENHSTAT_COMPARATOR0 0x40000000 +#define SPC_ENHSTAT_COMPARATOR1 0x80000000 +#define SPC_ENHSTAT_COMPARATOR2 0x20000000 +#define SPC_ENHSTAT_TRGCOMPARATOR 0x40000000 +#define SPC_ENHSTAT_CLKCOMPARATOR 0x80000000 +#define SPC_TRIGGERCOUNTER 200905l +#define SPC_FILLSIZEPROMILLE 200910l +#define SPC_OVERRANGEBIT 201000l +#define SPC_2CH8BITMODE 201100l +#define SPC_12BITMODE 201200l +#define SPC_HOLDLASTSAMPLE 201300l + +#define SPC_DATACONVERSION 201400l +#define SPC_AVAILDATACONVERSION 201401l +#define SPCM_DC_NONE 0x00000000 +#define SPCM_DC_12BIT_TO_14BIT 0x00000001 +#define SPCM_DC_16BIT_TO_14BIT 0x00000002 +#define SPCM_DC_12BIT_TO_16BIT 0x00000004 +#define SPCM_DC_14BIT_TO_16BIT 0x00000008 +#define SPCM_DC_15BIT_TO_16BIT 0x00000010 +#define SPCM_DC_13BIT_TO_16BIT 0x00000020 +#define SPCM_DC_12BIT_TO_8BIT 0x00000080 +#define SPCM_DC_14BIT_TO_8BIT 0x00000100 +#define SPCM_DC_16BIT_TO_8BIT 0x00000200 +#define SPCM_DC_16BIT_TO_12BIT 0x00000400 +#define SPCM_DC_TO_OFFSETBINARY 0x00000800 + +#define SPC_CARDIDENTIFICATION 201500l + +#define SPC_HANDSHAKE 201600l + +#define SPC_CKSYNC0 202000l +#define SPC_CKSYNC1 202001l +#define SPC_DISABLEMOD0 203000l +#define SPC_DISABLEMOD1 203010l +#define SPC_ENABLEOVERRANGECHECK 204000l +#define SPC_OVERRANGESTATUS 204010l +#define SPC_BITMODE 205000l + +#define SPC_READBACK 206000l +#define SPC_AVAILSTOPLEVEL 206009l +#define SPC_STOPLEVEL1 206010l +#define SPC_STOPLEVEL0 206020l +#define SPC_CH0_STOPLEVEL 206020l +#define SPC_CH1_STOPLEVEL 206021l +#define SPC_CH2_STOPLEVEL 206022l +#define SPC_CH3_STOPLEVEL 206023l +#define SPC_CH4_STOPLEVEL 206024l +#define SPC_CH5_STOPLEVEL 206025l +#define SPC_CH6_STOPLEVEL 206026l +#define SPC_CH7_STOPLEVEL 206027l +#define SPCM_STOPLVL_TRISTATE 0x00000001 +#define SPCM_STOPLVL_LOW 0x00000002 +#define SPCM_STOPLVL_HIGH 0x00000004 +#define SPCM_STOPLVL_HOLDLAST 0x00000008 +#define SPCM_STOPLVL_ZERO 0x00000010 +#define SPCM_STOPLVL_CUSTOM 0x00000020 + +#define SPC_DIFFMODE 206030l +#define SPC_DACADJUST 206040l + +#define SPC_CH0_CUSTOM_STOP 206050l +#define SPC_CH1_CUSTOM_STOP 206051l +#define SPC_CH2_CUSTOM_STOP 206052l +#define SPC_CH3_CUSTOM_STOP 206053l +#define SPC_CH4_CUSTOM_STOP 206054l +#define SPC_CH5_CUSTOM_STOP 206055l +#define SPC_CH6_CUSTOM_STOP 206056l +#define SPC_CH7_CUSTOM_STOP 206057l + +#define SPC_AMP_MODE 207000l + +#define SPCM_FW_CTRL 210000l +#define SPCM_FW_CTRL_GOLDEN 210001l +#define SPCM_FW_CTRL_ACTIVE 210002l +#define SPCM_FW_CLOCK 210010l +#define SPCM_FW_CONFIG 210020l +#define SPCM_FW_MODULEA 210030l +#define SPCM_FW_MODULEB 210031l +#define SPCM_FW_MODULEA_ACTIVE 210032l +#define SPCM_FW_MODULEB_ACTIVE 210033l +#define SPCM_FW_MODEXTRA 210050l +#define SPCM_FW_MODEXTRA_ACTIVE 210052l +#define SPCM_FW_POWER 210060l +#define SPCM_FW_POWER_ACTIVE 210062l + +#define SPC_MULTI 220000l +#define SPC_DOUBLEMEM 220100l +#define SPC_MULTIMEMVALID 220200l +#define SPC_BANK 220300l +#define SPC_GATE 220400l +#define SPC_RELOAD 230000l +#define SPC_USEROUT 230010l +#define SPC_WRITEUSER0 230100l +#define SPC_WRITEUSER1 230110l +#define SPC_READUSER0 230200l +#define SPC_READUSER1 230210l +#define SPC_MUX 240000l +#define SPC_ADJADC 241000l +#define SPC_ADJOFFS0 242000l +#define SPC_ADJOFFS1 243000l +#define SPC_ADJGAIN0 244000l +#define SPC_ADJGAIN1 245000l +#define SPC_READEPROM 250000l +#define SPC_WRITEEPROM 250010l +#define SPC_DIRECTIO 260000l +#define SPC_DIRECT_MODA 260010l +#define SPC_DIRECT_MODB 260020l +#define SPC_DIRECT_EXT0 260030l +#define SPC_DIRECT_EXT1 260031l +#define SPC_DIRECT_EXT2 260032l +#define SPC_DIRECT_EXT3 260033l +#define SPC_DIRECT_EXT4 260034l +#define SPC_DIRECT_EXT5 260035l +#define SPC_DIRECT_EXT6 260036l +#define SPC_DIRECT_EXT7 260037l +#define SPC_MEMTEST 270000l +#define SPC_NODMA 275000l +#define SPC_NOCOUNTER 275010l +#define SPC_NOSCATTERGATHER 275020l +#define SPC_USER_RELAIS_OVERWRITE 275030l +#define SPCM_URO_ENABLE 0x80000000 +#define SPCM_URO_INVERT_10TO1REL 0x00000001 +#define SPC_RUNINTENABLE 290000l +#define SPC_XFERBUFSIZE 295000l +#define SPC_CHLX 295010l +#define SPC_SPECIALCLOCK 295100l +#define SPC_PLL0_ICP 295105l +#define SPCM_ICP0 0x00000000 +// ... +#define SPCM_ICP7 0x00000007 +#define SPC_STARTDELAY 295110l +#define SPC_BASISTTLTRIG 295120l +#define SPC_TIMEOUT 295130l +#define SPC_SWL_INFO 295140l +#define SPC_SWD_INFO 295141l +#define SPC_SWD_DOWN 295142l +#define SPC_SWL_EXTRAINFO 295143l +#define SPC_SPECIALCLOCK_ADJUST0 295150l +#define SPC_SPECIALCLOCK_ADJUST1 295151l +#define SPC_SPECIALCLOCK_ADJUST2 295152l +#define SPC_SPECIALCLOCK_ADJUST3 295153l +#define SPCM_SPECIALCLOCK_ADJUST_SHIFT 1000000 +#define SPC_REGACC_CONTMEM 299000l +#define SPC_REGACC_MEMORYUSAGE 299001l +#define SPC_REINITLOGSETTINGS 299998l +#define SPC_LOGDLLCALLS 299999l + + + + + + +// ----- PCK400 ----- +#define SPC_FREQUENCE 300000l +#define SPC_DELTAFREQUENCE 300010l +#define SPC_PINHIGH 300100l +#define SPC_PINLOW 300110l +#define SPC_PINDELTA 300120l +#define SPC_STOPLEVEL 300200l +#define SPC_PINRELAIS 300210l +#define SPC_EXTERNLEVEL 300300l + + + +// ----- PADCO ----- +#define SPC_COUNTER0 310000l +#define SPC_COUNTER1 310001l +#define SPC_COUNTER2 310002l +#define SPC_COUNTER3 310003l +#define SPC_COUNTER4 310004l +#define SPC_COUNTER5 310005l +#define SPC_MODE0 310100l +#define SPC_MODE1 310101l +#define SPC_MODE2 310102l +#define SPC_MODE3 310103l +#define SPC_MODE4 310104l +#define SPC_MODE5 310105l +#define CM_SINGLE 1l +#define CM_MULTI 2l +#define CM_POSEDGE 4l +#define CM_NEGEDGE 8l +#define CM_HIGHPULSE 16l +#define CM_LOWPULSE 32l + + + +// ----- PAD1616 ----- +#define SPC_SEQUENCERESET 320000l +#define SPC_SEQUENCEADD 320010l +#define SEQ_IR_10000MV 0l +#define SEQ_IR_5000MV 1l +#define SEQ_IR_2000MV 2l +#define SEQ_IR_1000MV 3l +#define SEQ_IR_500MV 4l +#define SEQ_CH0 0l +#define SEQ_CH1 8l +#define SEQ_CH2 16l +#define SEQ_CH3 24l +#define SEQ_CH4 32l +#define SEQ_CH5 40l +#define SEQ_CH6 48l +#define SEQ_CH7 56l +#define SEQ_CH8 64l +#define SEQ_CH9 72l +#define SEQ_CH10 80l +#define SEQ_CH11 88l +#define SEQ_CH12 96l +#define SEQ_CH13 104l +#define SEQ_CH14 112l +#define SEQ_CH15 120l +#define SEQ_TRIGGER 128l +#define SEQ_START 256l + + + +// ----- Option CA ----- +#define SPC_CA_MODE 330000l +#define CAMODE_OFF 0l +#define CAMODE_CDM 1l +#define CAMODE_KW 2l +#define CAMODE_OT 3l +#define CAMODE_CDMMUL 4l +#define SPC_CA_TRIGDELAY 330010l +#define SPC_CA_CKDIV 330020l +#define SPC_CA_PULS 330030l +#define SPC_CA_CKMUL 330040l +#define SPC_CA_DREHZAHLFORMAT 330050l +#define CADREH_4X4 0l +#define CADREH_1X16 1l +#define SPC_CA_KWINVERT 330060l +#define SPC_CA_OUTA 330100l +#define SPC_CA_OUTB 330110l +#define CAOUT_TRISTATE 0l +#define CAOUT_LOW 1l +#define CAOUT_HIGH 2l +#define CAOUT_CDM 3l +#define CAOUT_OT 4l +#define CAOUT_KW 5l +#define CAOUT_TRIG 6l +#define CAOUT_CLK 7l +#define CAOUT_KW60 8l +#define CAOUT_KWGAP 9l +#define CAOUT_TRDLY 10l +#define CAOUT_INVERT 16l + + +// ----- Option Sequence Mode (output cards) ----- +#define SPC_SEQMODE_STEPMEM0 340000l +// ... +#define SPC_SEQMODE_STEPMEM8191 348191l + +// low part of 64 bit entry +#define SPCSEQ_SEGMENTMASK 0x0000FFFF +#define SPCSEQ_NEXTSTEPMASK 0xFFFF0000 + +// high part of 64 bit entry +#define SPCSEQ_LOOPMASK 0x000FFFFF +#define SPCSEQ_ENDLOOPALWAYS 0x00000000 +#define SPCSEQ_ENDLOOPONTRIG 0x40000000 +#define SPCSEQ_END 0x80000000 + +#define SPC_SEQMODE_AVAILMAXSEGMENT 349900l +#define SPC_SEQMODE_AVAILMAXSTEPS 349901l +#define SPC_SEQMODE_AVAILMAXLOOP 349902l +#define SPC_SEQMODE_AVAILFEATURES 349903l + +#define SPC_SEQMODE_MAXSEGMENTS 349910l +#define SPC_SEQMODE_WRITESEGMENT 349920l +#define SPC_SEQMODE_STARTSTEP 349930l +#define SPC_SEQMODE_SEGMENTSIZE 349940l + +#define SPC_SEQMODE_STATUS 349950l +#define SEQSTAT_STEPCHANGE 0x80000000l + + +// ----- netbox registers ----- +#define SPC_NETBOX_TYPE 400000l +#define NETBOX_SERIES_MASK 0xFF000000 +#define NETBOX_FAMILY_MASK 0x00FF0000 +#define NETBOX_SPEED_MASK 0x0000FF00 +#define NETBOX_CHANNEL_MASK 0x000000FF + +#define NETBOX_SERIES_DN2 0x02000000 +#define NETBOX_SERIES_DN6 0x06000000 + +#define NETBOX_FAMILY_20 0x00200000 +#define NETBOX_FAMILY_22 0x00220000 +#define NETBOX_FAMILY_44 0x00440000 +#define NETBOX_FAMILY_46 0x00460000 +#define NETBOX_FAMILY_47 0x00470000 +#define NETBOX_FAMILY_48 0x00480000 +#define NETBOX_FAMILY_49 0x00490000 +#define NETBOX_FAMILY_59 0x00590000 +#define NETBOX_FAMILY_60 0x00600000 +#define NETBOX_FAMILY_65 0x00650000 +#define NETBOX_FAMILY_66 0x00660000 +#define NETBOX_FAMILY_8X 0x00800000 +#define NETBOX_FAMILY_80 0x00800000 +#define NETBOX_FAMILY_81 0x00810000 +#define NETBOX_FAMILY_82 0x00820000 +#define NETBOX_FAMILY_83 0x00830000 + +#define NETBOX_SPEED_1 0x00000100 +#define NETBOX_SPEED_2 0x00000200 +#define NETBOX_SPEED_3 0x00000300 +#define NETBOX_SPEED_4 0x00000400 +#define NETBOX_SPEED_5 0x00000500 +#define NETBOX_SPEED_6 0x00000600 +#define NETBOX_SPEED_7 0x00000700 +#define NETBOX_SPEED_8 0x00000800 + +#define NETBOX_CHANNELS_2 0x00000002 +#define NETBOX_CHANNELS_4 0x00000004 +#define NETBOX_CHANNELS_6 0x00000006 +#define NETBOX_CHANNELS_8 0x00000008 +#define NETBOX_CHANNELS_10 0x0000000A +#define NETBOX_CHANNELS_12 0x0000000C +#define NETBOX_CHANNELS_16 0x00000010 +#define NETBOX_CHANNELS_20 0x00000014 +#define NETBOX_CHANNELS_24 0x00000018 +#define NETBOX_CHANNELS_32 0x00000020 +#define NETBOX_CHANNELS_40 0x00000028 +#define NETBOX_CHANNELS_48 0x00000030 + +#define SPC_NETBOX_SERIALNO 400001l +#define SPC_NETBOX_PRODUCTIONDATE 400002l +#define SPC_NETBOX_HWVERSION 400003l +#define SPC_NETBOX_SWVERSION 400004l + +#define SPC_NETBOX_FEATURES 400005l +#define NETBOX_FEAT_DCPOWER 0x1 +#define NETBOX_FEAT_BOOTATPOWERON 0x2 +#define NETBOX_FEAT_EMBEDDEDSERVER 0x4 + +#define SPC_NETBOX_CUSTOM 400006l + +#define SPC_NETBOX_WAKEONLAN 400007l +#define SPC_NETBOX_MACADDRESS 400008l +#define SPC_NETBOX_LANIDFLASH 400009l +#define SPC_NETBOX_TEMPERATURE 400010l +#define SPC_NETBOX_SHUTDOWN 400011l +#define SPC_NETBOX_RESTART 400012l +#define SPC_NETBOX_FANSPEED0 400013l +#define SPC_NETBOX_FANSPEED1 400014l +#define SPC_NETBOX_TEMPERATURE_K 400010l // same SPC_NETBOX_TEMPERATURE +#define SPC_NETBOX_TEMPERATURE_C 400015l +#define SPC_NETBOX_TEMPERATURE_F 400016l +#define SPC_NETBOX_TEMPERATURE1_K 400017l +#define SPC_NETBOX_TEMPERATURE1_C 400018l +#define SPC_NETBOX_TEMPERATURE1_F 400019l +#define SPC_NETBOX_TEMPERATURE2_K 400020l +#define SPC_NETBOX_TEMPERATURE2_C 400021l +#define SPC_NETBOX_TEMPERATURE2_F 400022l + +// ----- hardware monitor registers ----- +#define SPC_MON_V_PCIE_BUS 500000l +#define SPC_MON_V_CONNECTOR 500001l +#define SPC_MON_CARD_PWRSOURCE 500002l +#define CARD_PWRSOURCE_BUS 0l +#define CARD_PWRSOURCE_CONNECTOR 1l +#define SPC_MON_V_CARD_IN 500003l +#define SPC_MON_I_CARD_IN 500004l +#define SPC_MON_P_CARD_IN 500005l +#define SPC_MON_V_3V3 500006l +#define SPC_MON_V_2V5 500007l +#define SPC_MON_V_CORE 500008l +#define SPC_MON_V_AVTT 500009l +#define SPC_MON_V_AVCC 500010l +#define SPC_MON_V_MEMVCC 500011l +#define SPC_MON_V_MEMVTT 500012l +#define SPC_MON_V_CP_POS 500013l +#define SPC_MON_V_CP_NEG 500014l + +#define SPC_MON_V_5VA 500015l +#define SPC_MON_V_ADCA 500016l +#define SPC_MON_V_ADCD 500017l +#define SPC_MON_V_OP_POS 500018l +#define SPC_MON_V_OP_NEG 500019l +#define SPC_MON_V_COMP_NEG 500020l +#define SPC_MON_V_COMP_POS 500021l + +// legacy temperature registers (Kelvin) +#define SPC_MON_T_BASE_CTRL 500022l +#define SPC_MON_T_MODULE_0 500023l +#define SPC_MON_T_MODULE_1 500024l + +// new temperature registers for Kelvin (TK), Celsius (TC) or Fahrenheit (TF) +#define SPC_MON_TK_BASE_CTRL 500022l +#define SPC_MON_TK_MODULE_0 500023l +#define SPC_MON_TK_MODULE_1 500024l + +#define SPC_MON_TC_BASE_CTRL 500025l +#define SPC_MON_TC_MODULE_0 500026l +#define SPC_MON_TC_MODULE_1 500027l + +#define SPC_MON_TF_BASE_CTRL 500028l +#define SPC_MON_TF_MODULE_0 500029l +#define SPC_MON_TF_MODULE_1 500030l + +// some more voltages (used on M2p) +#define SPC_MON_V_1V8_BASE 500031l +#define SPC_MON_V_1V8_MOD 500032l +#define SPC_MON_V_MODA_0 500033l +#define SPC_MON_V_MODA_1 500034l +#define SPC_MON_V_MODB_0 500035l +#define SPC_MON_V_MODB_1 500037l + +// some more voltages and temperatures (used on M2p.65xx-hv) +#define SPC_MON_TK_MODA_0 500023l // same as SPC_MON_TK_MODULE_0 +#define SPC_MON_TK_MODA_1 500038l +#define SPC_MON_TK_MODA_2 500039l +#define SPC_MON_TK_MODA_3 500040l +#define SPC_MON_TK_MODA_4 500041l +#define SPC_MON_TK_MODB_0 500024l // same as SPC_MON_TK_MODULE_1 +#define SPC_MON_TK_MODB_1 500042l +#define SPC_MON_TK_MODB_2 500043l +#define SPC_MON_TK_MODB_3 500044l +#define SPC_MON_TK_MODB_4 500045l + +#define SPC_MON_TC_MODA_0 500026l // same as SPC_MON_TC_MODULE_0 +#define SPC_MON_TC_MODA_1 500046l +#define SPC_MON_TC_MODA_2 500047l +#define SPC_MON_TC_MODA_3 500048l +#define SPC_MON_TC_MODA_4 500049l +#define SPC_MON_TC_MODB_0 500027l // same as SPC_MON_TC_MODULE_1 +#define SPC_MON_TC_MODB_1 500050l +#define SPC_MON_TC_MODB_2 500051l +#define SPC_MON_TC_MODB_3 500052l +#define SPC_MON_TC_MODB_4 500053l + +#define SPC_MON_TF_MODA_0 500029l // same as SPC_MON_TF_MODULE_0 +#define SPC_MON_TF_MODA_1 500054l +#define SPC_MON_TF_MODA_2 500055l +#define SPC_MON_TF_MODA_3 500056l +#define SPC_MON_TF_MODA_4 500057l +#define SPC_MON_TF_MODB_0 500030l // same as SPC_MON_TF_MODULE_1 +#define SPC_MON_TF_MODB_1 500058l +#define SPC_MON_TF_MODB_2 500059l +#define SPC_MON_TF_MODB_3 500060l +#define SPC_MON_TF_MODB_4 500061l + +#define SPC_MON_I_MODA_0 500062l +#define SPC_MON_I_MODA_1 500063l +#define SPC_MON_I_MODA_2 500064l +#define SPC_MON_I_MODA_3 500065l +#define SPC_MON_I_MODB_0 500066l +#define SPC_MON_I_MODB_1 500067l +#define SPC_MON_I_MODB_2 500068l +#define SPC_MON_I_MODB_3 500069l + +#define SPC_MON_MOD_FAULT 500070l +#define SPC_CLR_MOD_FAULT 500071l + +// power section temperature registers for Kelvin (TK), Celsius (TC) or Fahrenheit (TF) +#define SPC_MON_TK_MODA_5 500072l +#define SPC_MON_TK_MODB_5 500073l + +#define SPC_MON_TC_MODA_5 500074l +#define SPC_MON_TC_MODB_5 500075l + +#define SPC_MON_TF_MODA_5 500076l +#define SPC_MON_TF_MODB_5 500077l + +// even more monitors (used on M5i) +#define SPC_MON_V_MOD_0 500078l +#define SPC_MON_V_MOD_1 500079l +#define SPC_MON_V_MOD_2 500080l +#define SPC_MON_V_MOD_3 500081l +#define SPC_MON_V_MOD_4 500082l +#define SPC_MON_V_MOD_5 500083l +#define SPC_MON_V_MOD_6 500084l +#define SPC_MON_V_MOD_7 500085l +#define SPC_MON_V_MOD_8 500086l +#define SPC_MON_V_MOD_9 500087l +#define SPC_MON_V_MOD_10 500088l + +#define SPC_MON_TK_MODULE_2 500089l +#define SPC_MON_TC_MODULE_2 500090l +#define SPC_MON_TF_MODULE_2 500091l + +#define SPC_MON_RPM_FAN0 500092l +#define SPC_MON_RPM_FAN1 500093l + +#define SPC_MON_V_MEMVTTA 500094l +#define SPC_MON_V_MEMVTTB 500095l +#define SPC_MON_V_VCCAUX 500096l +#define SPC_MON_V_MEMAUXA 500097l +#define SPC_MON_V_MEMAUXB 500098l +#define SPC_MON_TK_BASE_0 500099l +#define SPC_MON_TC_BASE_0 500100l +#define SPC_MON_TF_BASE_0 500101l +#define SPC_MON_TK_BASE_1 500102l +#define SPC_MON_TC_BASE_1 500103l +#define SPC_MON_TF_BASE_1 500104l +#define SPC_MON_I_CORE 500105l +#define SPC_MON_V_CORE_REMOTE 500106l + + +// mask with available monitor registers +#define SPC_AVAILMONITORS 510000l +#define SPCM_MON_T_BASE_CTRL 0x0000000000000001ULL +#define SPCM_MON_T_MODULE_0 0x0000000000000002ULL +#define SPCM_MON_T_MODULE_1 0x0000000000000004ULL +#define SPCM_MON_T_MODULE_2 0x0000000000000008ULL + +#define SPCM_MON_V_PCIE_BUS 0x0000000000000010ULL +#define SPCM_MON_V_CONNECTOR 0x0000000000000020ULL +#define SPCM_MON_CARD_PWRSOURCE 0x0000000000000040ULL +#define SPCM_MON_V_CARD_IN 0x0000000000000080ULL +#define SPCM_MON_I_CARD_IN 0x0000000000000100ULL +#define SPCM_MON_P_CARD_IN 0x0000000000000200ULL +#define SPCM_MON_V_3V3 0x0000000000000400ULL +#define SPCM_MON_V_2V5 0x0000000000000800ULL +#define SPCM_MON_V_CORE 0x0000000000001000ULL +#define SPCM_MON_V_AVTT 0x0000000000002000ULL +#define SPCM_MON_V_AVCC 0x0000000000004000ULL +#define SPCM_MON_V_MEMVCC 0x0000000000008000ULL +#define SPCM_MON_V_MEMVTT 0x0000000000010000ULL +#define SPCM_MON_V_CP_POS 0x0000000000020000ULL +#define SPCM_MON_V_CP_NEG 0x0000000000040000ULL +#define SPCM_MON_V_5VA 0x0000000000080000ULL +#define SPCM_MON_V_ADCA 0x0000000000100000ULL +#define SPCM_MON_V_ADCD 0x0000000000200000ULL +#define SPCM_MON_V_OP_POS 0x0000000000400000ULL +#define SPCM_MON_V_OP_NEG 0x0000000000800000ULL +#define SPCM_MON_V_COMP_NEG 0x0000000001000000ULL +#define SPCM_MON_V_COMP_POS 0x0000000002000000ULL +#define SPCM_MON_V_1V8_BASE 0x0000000004000000ULL +#define SPCM_MON_V_1V8_MOD 0x0000000008000000ULL + +#define SPCM_MON_V_MODA_0 0x0000000010000000ULL +#define SPCM_MON_V_MODA_1 0x0000000020000000ULL +#define SPCM_MON_V_MODB_0 0x0000000040000000ULL +#define SPCM_MON_V_MODB_1 0x0000000080000000ULL + +#define SPCM_MON_T_MODA_0 0x0000000000000002ULL // same as SPCM_MON_T_MODULE_0 +#define SPCM_MON_T_MODA_1 0x0000000100000000ULL +#define SPCM_MON_T_MODA_2 0x0000000200000000ULL +#define SPCM_MON_T_MODA_3 0x0000000400000000ULL +#define SPCM_MON_T_MODA_4 0x0000000800000000ULL + +#define SPCM_MON_T_MODB_0 0x0000000000000004ULL // same as SPCM_MON_T_MODULE_1 +#define SPCM_MON_T_MODB_1 0x0000001000000000ULL +#define SPCM_MON_T_MODB_2 0x0000002000000000ULL +#define SPCM_MON_T_MODB_3 0x0000004000000000ULL +#define SPCM_MON_T_MODB_4 0x0000008000000000ULL + +#define SPCM_MON_I_MODA_0 0x0000010000000000ULL +#define SPCM_MON_I_MODA_1 0x0000020000000000ULL +#define SPCM_MON_I_MODA_2 0x0000040000000000ULL +#define SPCM_MON_I_MODA_3 0x0000080000000000ULL + +#define SPCM_MON_I_MODB_0 0x0000100000000000ULL +#define SPCM_MON_I_MODB_1 0x0000200000000000ULL +#define SPCM_MON_I_MODB_2 0x0000400000000000ULL +#define SPCM_MON_I_MODB_3 0x0000800000000000ULL + +#define SPCM_MON_T_MODA_5 0x0001000000000000ULL +#define SPCM_MON_T_MODB_5 0x0002000000000000ULL + +#define SPCM_MON_V_MEMVTTA 0x0004000000000000ULL +#define SPCM_MON_V_MEMVTTB 0x0008000000000000ULL +#define SPCM_MON_V_MEMAUXA 0x0010000000000000ULL +#define SPCM_MON_V_MEMAUXB 0x0020000000000000ULL +#define SPCM_MON_V_VCCAUX 0x0040000000000000ULL + +#define SPCM_MON_T_BASE_0 0x0080000000000000ULL +#define SPCM_MON_T_BASE_1 0x0100000000000000ULL +#define SPCM_MON_RPM_FAN0 0x0200000000000000ULL +#define SPCM_MON_RPM_FAN1 0x0400000000000000ULL + +#define SPCM_MON_I_CORE 0x0800000000000000ULL +#define SPCM_MON_V_CORE_REMOTE 0x1000000000000000ULL + + +#define SPC_AVAILMONITORS1 510001l +#define SPCM_MON_V_MOD_0 0x0000000000000001ULL +#define SPCM_MON_V_MOD_1 0x0000000000000002ULL +#define SPCM_MON_V_MOD_2 0x0000000000000004ULL +#define SPCM_MON_V_MOD_3 0x0000000000000008ULL +#define SPCM_MON_V_MOD_4 0x0000000000000010ULL +#define SPCM_MON_V_MOD_5 0x0000000000000020ULL +#define SPCM_MON_V_MOD_6 0x0000000000000040ULL +#define SPCM_MON_V_MOD_7 0x0000000000000080ULL +#define SPCM_MON_V_MOD_8 0x0000000000000100ULL +#define SPCM_MON_V_MOD_9 0x0000000000000200ULL +#define SPCM_MON_V_MOD_10 0x0000000000000400ULL + + + +// ----- re-located multi-purpose i/o related registers ----- +#define SPC_X0_READFEATURES 600000l +#define SPC_X1_READFEATURES 600001l +#define SPC_X2_READFEATURES 600002l +#define SPC_X3_READFEATURES 600003l +#define SPC_X4_READFEATURES 600004l +#define SPC_X5_READFEATURES 600005l +#define SPC_X6_READFEATURES 600006l +#define SPC_X7_READFEATURES 600007l +#define SPC_X8_READFEATURES 600008l +#define SPC_X9_READFEATURES 600009l +#define SPC_X10_READFEATURES 600010l +#define SPC_X11_READFEATURES 600011l +#define SPC_X12_READFEATURES 600012l +#define SPC_X13_READFEATURES 600013l +#define SPC_X14_READFEATURES 600014l +#define SPC_X15_READFEATURES 600015l +#define SPC_X16_READFEATURES 600016l +#define SPC_X17_READFEATURES 600017l +#define SPC_X18_READFEATURES 600018l +#define SPC_X19_READFEATURES 600019l +#define SPCM_XFEAT_TERM 0x00000001 +#define SPCM_XFEAT_HIGHIMP 0x00000002 +#define SPCM_XFEAT_DCCOUPLING 0x00000004 +#define SPCM_XFEAT_ACCOUPLING 0x00000008 +#define SPCM_XFEAT_SE 0x00000010 +#define SPCM_XFEAT_DIFF 0x00000020 +#define SPCM_XFEAT_PROGTHRESHOLD 0x00000040 + +#define SPC_X0_TERM 600100l +#define SPC_X1_TERM 600101l +#define SPC_X2_TERM 600102l +#define SPC_X3_TERM 600103l +#define SPC_X4_TERM 600104l +#define SPC_X5_TERM 600105l +#define SPC_X6_TERM 600106l +#define SPC_X7_TERM 600107l +#define SPC_X8_TERM 600108l +#define SPC_X9_TERM 600109l +#define SPC_X10_TERM 600110l +#define SPC_X11_TERM 600111l +#define SPC_X12_TERM 600112l +#define SPC_X13_TERM 600113l +#define SPC_X14_TERM 600114l +#define SPC_X15_TERM 600115l +#define SPC_X16_TERM 600116l +#define SPC_X17_TERM 600117l +#define SPC_X18_TERM 600118l +#define SPC_X19_TERM 600119l + +#define SPCM_X0_MODE 600200l +#define SPCM_X1_MODE 600201l +#define SPCM_X2_MODE 600202l +#define SPCM_X3_MODE 600203l +#define SPCM_X4_MODE 600204l +#define SPCM_X5_MODE 600205l +#define SPCM_X6_MODE 600206l +#define SPCM_X7_MODE 600207l +#define SPCM_X8_MODE 600208l +#define SPCM_X9_MODE 600209l +#define SPCM_X10_MODE 600210l +#define SPCM_X11_MODE 600211l +#define SPCM_X12_MODE 600212l +#define SPCM_X13_MODE 600213l +#define SPCM_X14_MODE 600214l +#define SPCM_X15_MODE 600215l +#define SPCM_X16_MODE 600216l +#define SPCM_X17_MODE 600217l +#define SPCM_X18_MODE 600218l +#define SPCM_X19_MODE 600219l + +#define SPCM_X0_AVAILMODES 600300l +#define SPCM_X1_AVAILMODES 600301l +#define SPCM_X2_AVAILMODES 600302l +#define SPCM_X3_AVAILMODES 600303l +#define SPCM_X4_AVAILMODES 600304l +#define SPCM_X5_AVAILMODES 600305l +#define SPCM_X6_AVAILMODES 600306l +#define SPCM_X7_AVAILMODES 600307l +#define SPCM_X8_AVAILMODES 600308l +#define SPCM_X9_AVAILMODES 600309l +#define SPCM_X10_AVAILMODES 600310l +#define SPCM_X11_AVAILMODES 600311l +#define SPCM_X12_AVAILMODES 600312l +#define SPCM_X13_AVAILMODES 600313l +#define SPCM_X14_AVAILMODES 600314l +#define SPCM_X15_AVAILMODES 600315l +#define SPCM_X16_AVAILMODES 600316l +#define SPCM_X17_AVAILMODES 600317l +#define SPCM_X18_AVAILMODES 600318l +#define SPCM_X19_AVAILMODES 600319l +// for definitions of the available modes see section at SPCM_LEGACY_X0_MODE above + +#define SPC_XIO_PULSEGEN0_MODE 601000l +#define SPC_XIO_PULSEGEN1_MODE 601100l +#define SPC_XIO_PULSEGEN2_MODE 601200l +#define SPC_XIO_PULSEGEN3_MODE 601300l +#define SPCM_PULSEGEN_MODE_GATED 1 +#define SPCM_PULSEGEN_MODE_TRIGGERED 2 +#define SPCM_PULSEGEN_MODE_SINGLESHOT 3 + +#define SPC_XIO_PULSEGEN0_LEN 601001l +#define SPC_XIO_PULSEGEN1_LEN 601101l +#define SPC_XIO_PULSEGEN2_LEN 601201l +#define SPC_XIO_PULSEGEN3_LEN 601301l + +#define SPC_XIO_PULSEGEN0_HIGH 601002l +#define SPC_XIO_PULSEGEN1_HIGH 601102l +#define SPC_XIO_PULSEGEN2_HIGH 601202l +#define SPC_XIO_PULSEGEN3_HIGH 601302l + +#define SPC_XIO_PULSEGEN0_DELAY 601003l +#define SPC_XIO_PULSEGEN1_DELAY 601103l +#define SPC_XIO_PULSEGEN2_DELAY 601203l +#define SPC_XIO_PULSEGEN3_DELAY 601303l + +#define SPC_XIO_PULSEGEN0_LOOPS 601004l +#define SPC_XIO_PULSEGEN1_LOOPS 601104l +#define SPC_XIO_PULSEGEN2_LOOPS 601204l +#define SPC_XIO_PULSEGEN3_LOOPS 601304l + +#define SPC_XIO_PULSEGEN0_MUX1_SRC 601005l +#define SPC_XIO_PULSEGEN1_MUX1_SRC 601105l +#define SPC_XIO_PULSEGEN2_MUX1_SRC 601205l +#define SPC_XIO_PULSEGEN3_MUX1_SRC 601305l +#define SPCM_PULSEGEN_MUX1_SRC_UNUSED 0 +#define SPCM_PULSEGEN_MUX1_SRC_RUN 1 +#define SPCM_PULSEGEN_MUX1_SRC_ARM 2 + +#define SPC_XIO_PULSEGEN0_MUX2_SRC 601006l +#define SPC_XIO_PULSEGEN1_MUX2_SRC 601106l +#define SPC_XIO_PULSEGEN2_MUX2_SRC 601206l +#define SPC_XIO_PULSEGEN3_MUX2_SRC 601306l +#define SPCM_PULSEGEN_MUX2_SRC_UNUSED 0 +#define SPCM_PULSEGEN_MUX2_SRC_SOFTWARE 1 +#define SPCM_PULSEGEN_MUX2_SRC_CARDTRIGGER 2 +#define SPCM_PULSEGEN_MUX2_SRC_PULSEGEN0 3 +#define SPCM_PULSEGEN_MUX2_SRC_PULSEGEN1 4 +#define SPCM_PULSEGEN_MUX2_SRC_PULSEGEN2 5 +#define SPCM_PULSEGEN_MUX2_SRC_PULSEGEN3 6 +#define SPCM_PULSEGEN_MUX2_SRC_XIO0 7 +#define SPCM_PULSEGEN_MUX2_SRC_XIO1 8 +#define SPCM_PULSEGEN_MUX2_SRC_XIO2 9 +#define SPCM_PULSEGEN_MUX2_SRC_XIO3 10 + +#define SPC_XIO_PULSEGEN0_CONFIG 601007l +#define SPC_XIO_PULSEGEN1_CONFIG 601107l +#define SPC_XIO_PULSEGEN2_CONFIG 601207l +#define SPC_XIO_PULSEGEN3_CONFIG 601307l +#define SPCM_PULSEGEN_CONFIG_MUX1_INVERT 0x1 +#define SPCM_PULSEGEN_CONFIG_MUX2_INVERT 0x2 +#define SPCM_PULSEGEN_CONFIG_INVERT 0x4 +#define SPCM_PULSEGEN_CONFIG_HIGH 0x8 + +#define SPC_XIO_PULSEGEN_ENABLE 601500l +#define SPCM_PULSEGEN_ENABLE0 0x01 +#define SPCM_PULSEGEN_ENABLE1 0x02 +#define SPCM_PULSEGEN_ENABLE2 0x04 +#define SPCM_PULSEGEN_ENABLE3 0x08 + +#define SPC_XIO_PULSEGEN_COMMAND 601501l +#define SPCM_PULSEGEN_CMD_FORCE 0x1 + +#define SPC_XIO_PULSEGEN_CLOCK 602000l +#define SPC_XIO_PULSEGEN_AVAILLEN_MIN 602001l +#define SPC_XIO_PULSEGEN_AVAILLEN_MAX 602002l +#define SPC_XIO_PULSEGEN_AVAILLEN_STEP 602003l +#define SPC_XIO_PULSEGEN_AVAILHIGH_MIN 602004l +#define SPC_XIO_PULSEGEN_AVAILHIGH_MAX 602005l +#define SPC_XIO_PULSEGEN_AVAILHIGH_STEP 602006l +#define SPC_XIO_PULSEGEN_AVAILDELAY_MIN 602007l +#define SPC_XIO_PULSEGEN_AVAILDELAY_MAX 602008l +#define SPC_XIO_PULSEGEN_AVAILDELAY_STEP 602009l +#define SPC_XIO_PULSEGEN_AVAILLOOPS_MIN 602010l +#define SPC_XIO_PULSEGEN_AVAILLOOPS_MAX 602011l +#define SPC_XIO_PULSEGEN_AVAILLOOPS_STEP 602012l + +// ----- Hardware registers (debug use only) ----- +#define SPC_REG0x00 900000l +#define SPC_REG0x02 900010l +#define SPC_REG0x04 900020l +#define SPC_REG0x06 900030l +#define SPC_REG0x08 900040l +#define SPC_REG0x0A 900050l +#define SPC_REG0x0C 900060l +#define SPC_REG0x0E 900070l + +#define SPC_DEBUGREG0 900100l +#define SPC_DEBUGREG15 900115l +#define SPC_DEBUGVALUE0 900200l +#define SPC_DEBUGVALUE15 900215l + +#define SPC_MI_ISP 901000l +#define ISP_TMS_0 0l +#define ISP_TMS_1 1l +#define ISP_TDO_0 0l +#define ISP_TDO_1 2l + + +#define SPC_EE_RWAUTH 901100l +#define SPC_EE_REG 901110l +#define SPC_EE_RESETCOUNTER 901120l + +// ----- Test Registers ----- +#define SPC_TEST_BASE 902000l +#define SPC_TEST_LOCAL_START 902100l +#define SPC_TEST_LOCAL_END 902356l +#define SPC_TEST_PLX_START 902400l +#define SPC_TEST_PLX_END 902656l + +// 9012xx not usable +// 901900 not usable +// 903000 not usable +// 91xxxx not usable + +// ----- used by GetErrorInfo to mark errors in other functions than SetParam/GetParam ----- +#define SPC_FUNCTION_DEFTRANSFER 100000000l diff --git a/Cpp/examples/c_cpp/c_header/spcerr.h b/Cpp/examples/c_cpp/c_header/spcerr.h new file mode 100644 index 0000000000000000000000000000000000000000..25ba925fb7fe8544741e712a2da8b6ef57f01d15 --- /dev/null +++ b/Cpp/examples/c_cpp/c_header/spcerr.h @@ -0,0 +1,104 @@ + +// *********************************************************************** +// +// SpcErr.h (c) Spectrum GmbH, 2006 +// +// *********************************************************************** +// +// error codes of the Spectrum drivers. Until may 2004 this file was +// errors.h. Name has been changed because errors.h has been already in +// use by windows. +// +// *********************************************************************** + +#define SPCM_ERROR_ORIGIN_MASK 0x80000000 // this bit marks the origin of the error +#define SPCM_ERROR_ORIGIN_LOCAL 0x00000000 // error occured on local system +#define SPCM_ERROR_ORIGIN_REMOTE 0x80000000 // error occured on remote system (netbox) + +#define ERR_OK 0x0000 // 0 No Error +#define ERR_INIT 0x0001 // 1 Initialisation error +#define ERR_NR 0x0002 // 2 Board number out of range +#define ERR_TYP 0x0003 // 3 Unknown board Typ +#define ERR_FNCNOTSUPPORTED 0x0004 // 4 This function is not supported by the hardware +#define ERR_BRDREMAP 0x0005 // 5 The Board Index Remap table is wrong +#define ERR_KERNELVERSION 0x0006 // 6 The kernel version and the dll version are mismatching +#define ERR_HWDRVVERSION 0x0007 // 7 The driver version doesn't match the minimum requirements of the board +#define ERR_ADRRANGE 0x0008 // 8 The address range is disabled (fatal error) +#define ERR_INVALIDHANDLE 0x0009 // 9 Handle not valid +#define ERR_BOARDNOTFOUND 0x000A // 10 Card with given name hasn't been found +#define ERR_BOARDINUSE 0x000B // 11 Card with given name is already in use by another application +#define ERR_EXPHW64BITADR 0x000C // 12 Express hardware version not able to handle 64 bit addressing -> update needed +#define ERR_FWVERSION 0x000D // 13 Firmware versions of synchronized cards or for this driver do not match -> update needed +#define ERR_SYNCPROTOCOL 0x000E // 14 Synchronization protocol of synchronized cards does not match -> update needed +#define ERR_KERNEL 0x000F // 15 Some error occurred in the kernel driver +#define ERR_LASTERR 0x0010 // 16 Old Error waiting to be read +#define ERR_ABORT 0x0020 // 32 Abort of wait function +#define ERR_BOARDLOCKED 0x0030 // 48 Board acess already locked by another process. it's not possible to acess one board through multiple processes +#define ERR_DEVICE_MAPPING 0x0032 // 50 Device is mapped to an invalid device +#define ERR_NETWORKSETUP 0x0040 // 64 Network setup failed +#define ERR_NETWORKTRANSFER 0x0041 // 65 Network data transfer failed +#define ERR_FWPOWERCYCLE 0x0042 // 66 Power cycle needed to update card's firmware (simple PC reboot not sufficient !) +#define ERR_NETWORKTIMEOUT 0x0043 // 67 Network timeout +#define ERR_BUFFERSIZE 0x0044 // 68 Buffer too small +#define ERR_RESTRICTEDACCESS 0x0045 // 69 access to card has been restricted +#define ERR_INVALIDPARAM 0x0046 // 70 invalid parameter for function +#define ERR_TEMPERATURE 0x0047 // 71 card temperature too high +#define ERR_FAN 0x0048 // 72 fan speed too low + +#define ERR_REG 0x0100 // 256 unknown Register for this Board +#define ERR_VALUE 0x0101 // 257 Not a possible value in this state +#define ERR_FEATURE 0x0102 // 258 Feature of the board not installed +#define ERR_SEQUENCE 0x0103 // 259 Channel sequence not allowed +#define ERR_READABORT 0x0104 // 260 Read not allowed after abort +#define ERR_NOACCESS 0x0105 // 261 Access to this register denied +#define ERR_POWERDOWN 0x0106 // 262 not allowed in Powerdown mode +#define ERR_TIMEOUT 0x0107 // 263 timeout occured while waiting for interrupt +#define ERR_CALLTYPE 0x0108 // 264 call type (int32 mux) is not allowed for this register +#define ERR_EXCEEDSINT32 0x0109 // 265 return value is int32 but software register exceeds the 32 bit integer range -> use 2x32 or 64 +#define ERR_NOWRITEALLOWED 0x010A // 266 register cannot be written, read only +#define ERR_SETUP 0x010B // 267 the setup isn't valid +#define ERR_CLOCKNOTLOCKED 0x010C // 268 clock section not locked: perhaps no external clock signal connected or not stable +#define ERR_MEMINIT 0x010D // 269 on-board memory initialization error +#define ERR_POWERSUPPLY 0x010E // 270 on-board power supply error +#define ERR_ADCCOMMUNICATION 0x010F // 271 communication with ADC failed +#define ERR_CHANNEL 0x0110 // 272 Wrong number of Channel to be read out +#define ERR_NOTIFYSIZE 0x0111 // 273 Notify block size isn't valid +#define ERR_RUNNING 0x0120 // 288 Board is running, changes not allowed +#define ERR_ADJUST 0x0130 // 304 Auto Adjust has an error +#define ERR_PRETRIGGERLEN 0x0140 // 320 pretrigger length exceeds allowed values +#define ERR_DIRMISMATCH 0x0141 // 321 direction of card and memory transfer mismatch +#define ERR_POSTEXCDSEGMENT 0x0142 // 322 posttrigger exceeds segment size in multiple recording mode +#define ERR_SEGMENTINMEM 0x0143 // 323 memsize is not a multiple of segmentsize, last segment hasn't full length +#define ERR_MULTIPLEPW 0x0144 // 324 multiple pulsewidth counters used but card only supports one at the time +#define ERR_NOCHANNELPWOR 0x0145 // 325 channel pulsewidth can't be OR'd +#define ERR_ANDORMASKOVRLAP 0x0146 // 326 AND mask and OR mask overlap in at least one channel -> not possible +#define ERR_ANDMASKEDGE 0x0147 // 327 AND mask together with edge trigger mode is not allowed +#define ERR_ORMASKLEVEL 0x0148 // 328 OR mask together with level trigger mode is not allowed +#define ERR_EDGEPERMOD 0x0149 // 329 All trigger edges must be simular on one module +#define ERR_DOLEVELMINDIFF 0x014A // 330 minimum difference between low output level and high output level not reached +#define ERR_STARHUBENABLE 0x014B // 331 card holding the star-hub must be active for sync +#define ERR_PATPWSMALLEDGE 0x014C // 332 Combination of pattern with pulsewidht smaller and edge is not allowed +#define ERR_XMODESETUP 0x014D // 333 The chosen setup for (SPCM_X0_MODE .. SPCM_X19_MODE) is not valid. See hardware manual for details. +#define ERR_AVRG_TDA 0x014E // 334 Setup for Average TDA Mode not valid. Check Threshold and Replacement values for chosen AVRGMODE. + +#define ERR_NOPCI 0x0200 // 512 No PCI bus found +#define ERR_PCIVERSION 0x0201 // 513 Wrong PCI bus version +#define ERR_PCINOBOARDS 0x0202 // 514 No Spectrum PCI boards found +#define ERR_PCICHECKSUM 0x0203 // 515 Checksum error on PCI board +#define ERR_DMALOCKED 0x0204 // 516 DMA buffer in use, try later +#define ERR_MEMALLOC 0x0205 // 517 Memory Allocation error +#define ERR_EEPROMLOAD 0x0206 // 518 EEProm load error +#define ERR_CARDNOSUPPORT 0x0207 // 519 no support for that card in the library +#define ERR_CONFIGACCESS 0x0208 // 520 error occured during config write or read + +#define ERR_FIFOBUFOVERRUN 0x0300 // 768 Buffer overrun in FIFO mode +#define ERR_FIFOHWOVERRUN 0x0301 // 769 hardware buffer overrun (acquisition) or underrun (replay) in FIFO mode +#define ERR_FIFOFINISHED 0x0302 // 770 FIFO transfer hs been finished. Number of buffers has been transferred +#define ERR_FIFOSETUP 0x0309 // 777 FIFO setup not possible, transfer rate to high (max 250 MB/s) + +#define ERR_TIMESTAMP_SYNC 0x0310 // 784 Synchronisation to ref clock failed +#define ERR_STARHUB 0x0320 // 800 Autorouting of Starhub failed + +#define ERR_INTERNAL_ERROR 0xFFFF // 65535 Internal hardware error detected, please check for update + + diff --git a/Cpp/examples/c_cpp/c_header/spcioctl.inc b/Cpp/examples/c_cpp/c_header/spcioctl.inc new file mode 100644 index 0000000000000000000000000000000000000000..cf7db32c93114894a7ce83b151179d60dfe3248f --- /dev/null +++ b/Cpp/examples/c_cpp/c_header/spcioctl.inc @@ -0,0 +1,93 @@ +// **************************************************************************** +// spcioctl.inc +// **************************************************************************** +// include source code for easy access of the ioctl and data transfer commands +// of the spectrum driver. +// **************************************************************************** + + + +// ----- ioctl_GetParam ----------------------------------- +int16 SpcGetParam (int hDrv, int32 lReg, int32 *plValue) + { + int32 lData[2]; + int16 nRet; + + lData[0] = lReg; + nRet = ioctl (hDrv, GETPARAM, lData); + *plValue = lData[1]; + + return nRet; + } + +// ----- ioctl_SetParam ----------------------------------- +int16 SpcSetParam (int hDrv, int32 lReg, int32 lValue) + { + int32 lData[2]; + + lData[0] = lReg; + lData[1] = lValue; + + return ioctl(hDrv, SETPARAM, lData); + } + + + +// ----- ioctl_GetAdr ----------------------------------- +int16 SpcGetAdr (int hDrv, int32 lReg, void** ppvAdr) + { + int16 nRet; + _SETGETADR stSetGetAdr; + + stSetGetAdr.lReg = lReg; + nRet = ioctl (hDrv, GETADR, &stSetGetAdr); + (*ppvAdr) = stSetGetAdr.pvAdr; + + return nRet; + } + +// ----- ioctl_SetAdr ----------------------------------- +int16 SpcSetAdr (int hDrv, int32 lReg, void* pvAdr) + { + int16 nRet; + _SETGETADR stSetGetAdr; + + stSetGetAdr.lReg = lReg; + stSetGetAdr.pvAdr = pvAdr; + nRet = ioctl (hDrv, SETADR, &stSetGetAdr); + + return nRet; + } + + + +// ----- ioctl_GetData ------------------------------------ +int32 SpcGetData (int hDrv, int32 lCh, int32 lStart, int32 lLen, int16 nBytesPerSample, dataptr pvData) + { + int32 lRet; + int32 lData[1]; + lData[0] = lCh; + + ioctl (hDrv, SETCH, lData); + + lseek (hDrv, lStart * nBytesPerSample, SEEK_SET); + lRet = read (hDrv, pvData, nBytesPerSample * lLen); + + return lRet; + } + +// ----- ioctl_SetData ------------------------------------ +int32 SpcSetData (int hDrv, int32 lCh, int32 lStart, int32 lLen, int16 nBytesPerSample, dataptr pvData) + { + int32 lRet; + int32 lData[1]; + + lData[0] = lCh; + + ioctl (hDrv, SETCH, lData); + + lseek (hDrv, lStart * nBytesPerSample, SEEK_SET); + lRet = write (hDrv, pvData, nBytesPerSample * lLen); + + return lRet; + } diff --git a/Cpp/examples/c_cpp/c_header/spclib_bcc.lib b/Cpp/examples/c_cpp/c_header/spclib_bcc.lib new file mode 100644 index 0000000000000000000000000000000000000000..fe98a9d8b0a8f32f9a7d839251502e2fb362778a Binary files /dev/null and b/Cpp/examples/c_cpp/c_header/spclib_bcc.lib differ diff --git a/Cpp/examples/c_cpp/c_header/spcm_drv.h b/Cpp/examples/c_cpp/c_header/spcm_drv.h new file mode 100644 index 0000000000000000000000000000000000000000..a7e17a9e319b22f37766cf77efeeeffce2eb7561 --- /dev/null +++ b/Cpp/examples/c_cpp/c_header/spcm_drv.h @@ -0,0 +1,276 @@ +/* +************************************************************************** + +spcm_interface.h (c) Spectrum GmbH , 08/2005 + +************************************************************************** + +Interface of the spectrum driver for all M2I cards. + +************************************************************************** +*/ + + + +/* +************************************************************************** + +open/close: +opens and closes the specified board. The returned handle is used by all +function calls. The device name is operating system specific. Under +linux it's normally "/dev/spcm0" for card#0 and under windows it's "spc0" +In a synchronized system the starhub has it's own handle, received under +the device name "starhub" + +*************************************************************************** +*/ + +// tries to open the device and returns handle or error code +SPCM_IMPORT drv_handle _stdcall spcm_hOpen ( + const char* szDeviceName); // name of the device to be opened + +//************************************************************************* + +// closes the device +SPCM_IMPORT void _stdcall spcm_vClose ( + drv_handle hDevice); // handle to an already opened device + + + + + +/* +************************************************************************** + +SetParam and GetParam: +handles the register based access to the driver. Each functionality is +programmed by accessing one of the software registers of the driver + +Functions are declared as i32 for single 32 bit integer access, i64 for +single 64 bit integer access or 64m for multiplexed 64 bit integer access +consisting one 32 bit integer high-part and one 32 bit unsigned integer +low part. + +Most software registers are only handled by the i32 or i64 function and +are then not allowed to be accessed by i64m functions. Some registers +can be more than 32 bit wide. They can be accessed by any of the +functions. If accessed by the i32 function the value is limited to the +32 bit signed integer area. + +*************************************************************************** +*/ + +// Sets a software register using 1 x 32 bit integer value. Return value is an error code +SPCM_IMPORT uint32 _stdcall spcm_dwSetParam_i32 ( + drv_handle hDevice, // handle to an already opened device + int32 lRegister, // software register to be modified + int32 lValue); // the value to be set + +//************************************************************************* + +// Sets a software register using 2 x 32 bit integer value. Return value is an error code +SPCM_IMPORT uint32 _stdcall spcm_dwSetParam_i64m ( + drv_handle hDevice, // handle to an already opened device + int32 lRegister, // software register to be modified + int32 lValueHigh, // upper 32 bit of the value. Containing the sign bit ! + uint32 dwValueLow); // lower 32 bit of the value. + +//************************************************************************* + +// Sets a software register using 1 x 64 bit integer value. Return value is an error code +SPCM_IMPORT uint32 _stdcall spcm_dwSetParam_i64 ( + drv_handle hDevice, // handle to an already opened device + int32 lRegister, // software register to be modified + int64 llValue); // the value to be set + + + +//************************************************************************* +//************************************************************************* + +// Reads out a software register using 1 x 32 bit integer value. Return value is an error code +SPCM_IMPORT uint32 _stdcall spcm_dwGetParam_i32 ( + drv_handle hDevice, // handle to an already opened device + int32 lRegister, // software register to be read out + int32* plValue); // pointer for the return value + +//************************************************************************* + +// Reads out a software register using 2 x 32 bit integer value. Return value is an error code +SPCM_IMPORT uint32 _stdcall spcm_dwGetParam_i64m ( + drv_handle hDevice, // handle to an already opened device + int32 lRegister, // software register to be read out + int32* plValueHigh, // pointer for the upper part of the return value + uint32* pdwValueLow); // pointer for the lower part of the return value + +//************************************************************************* + +// Reads out a software register using 1 x 64 bit integer value. Return value is an error code +SPCM_IMPORT uint32 _stdcall spcm_dwGetParam_i64 ( + drv_handle hDevice, // handle to an already opened device + int32 lRegister, // software register to be read out + int64* pllValue); // pointer for the return value + + + + +/* +************************************************************************** + +DefTransfer: +sets up all needed information for the next data transfer. Data transfer +itself is started by an extra register command. + +The function needs 64 bit unsigned integer values. Therefore it is +available as an i64m type, consisting of one upper 32 bit uint and one +lower 32 bit uint value. And it is availabl as a true 64 bit version. + +Offset and length are both given in samples. As data is multiplexed the +transfer buffer in PC memory must be large enough to handle +[length x channels] entries + +*************************************************************************** +*/ + +// defintions of the transfer direction +#define SPCM_DIR_PCTOCARD 0 // transfer from PC memory to card memory +#define SPCM_DIR_CARDTOPC 1 // transfer from card memory to PC memory +#define SPCM_DIR_CARDTOGPU 2 // RDMA transfer from card memory to GPU memory +#define SPCM_DIR_GPUTOCARD 3 // RDMA transfer from GPU memory to card memory + +// defintions of the different data buffers +#define SPCM_BUF_DATA 1000 // main data buffer for acquired or generated samples +#define SPCM_BUF_ABA 2000 // buffer for ABA data, holds the A-DATA (slow samples) +#define SPCM_BUF_TIMESTAMP 3000 // buffer for timestamps +#define SPCM_BUF_LOG 4000 // write content of buffer to log file + +//************************************************************************* + +// Defines the transer buffer by using 2 x 32 bit unsigned integer values for each 64 bit value +SPCM_IMPORT uint32 _stdcall spcm_dwDefTransfer_i64m( + drv_handle hDevice, // handle to an already opened device + uint32 dwBufType, // type of the buffer to define as listed above under SPCM_BUF_XXXX + uint32 dwDirection, // the transfer direction as defined above + uint32 dwNotifySize, // amount of bytes after which i want do receive an event (0=end of transfer) + void* pvDataBuffer, // pointer to the data buffer + uint32 dwBrdOffsH, // high part of offset in board memory + uint32 dwBrdOffsL, // low part of offset in board memory + uint32 dwTransferLenH, // high part of transfer buffer length + uint32 dwTransferLenL); // low part of transfer buffer length + +//************************************************************************* + +// Defines the transer buffer by using 64 bit unsigned integer values +SPCM_IMPORT uint32 _stdcall spcm_dwDefTransfer_i64 ( + drv_handle hDevice, // handle to an already opened device + uint32 dwBufType, // type of the buffer to define as listed above under SPCM_BUF_XXXX + uint32 dwDirection, // the transfer direction as defined above + uint32 dwNotifySize, // amount of bytes after which i want do receive an event (0=end of transfer) + void* pvDataBuffer, // pointer to the data buffer + uint64 qwBrdOffs, // offset for transfer in board memory + uint64 qwTransferLen); // buffer length + +//************************************************************************* + +// invalidate the transfer buffer (is automatically performed if new transfer buffer is defined with DefTransfer) +SPCM_IMPORT uint32 _stdcall spcm_dwInvalidateBuf ( + drv_handle hDevice, // handle to an already opened device + uint32 dwBufType); // type of the buffer to invalidate as listed above under SPCM_BUF_XXXX + + + +/* +************************************************************************** + +GetContBuf +reads out the internal continuous memory buffer if one has been allocated +this continuous buffer allows faster data transfer especially on Express cards + +*************************************************************************** +*/ + +SPCM_IMPORT uint32 _stdcall spcm_dwGetContBuf_i64 ( + drv_handle hDevice, // handle to an already opened device + uint32 dwBufType, // type of the buffer to read as listed above under SPCM_BUF_XXXX + void** ppvDataBuffer, // address of available data buffer + uint64* pqwContBufLen); // length of available continuous buffer + +//************************************************************************* + +SPCM_IMPORT uint32 _stdcall spcm_dwGetContBuf_i64m ( + drv_handle hDevice, // handle to an already opened device + uint32 dwBufType, // type of the buffer to read as listed above under SPCM_BUF_XXXX + void** ppvDataBuffer, // address of available data buffer + uint32* pdwContBufLenH, // high part of length of available continuous buffer + uint32* pdwContBufLenL); // low part of length of available continuous buffer + + + +/* +************************************************************************** + +GetErrorInfo: +reads out the complete error information that is stored in the driver. +internal error locking is afterwards reset. +If hDevice is zero the last open error is returned. + +*************************************************************************** +*/ + +SPCM_IMPORT uint32 _stdcall spcm_dwGetErrorInfo_i32 ( + drv_handle hDevice, // handle to an already opened device + uint32* pdwErrorReg, // adress of the error register (can zero if not of interest) + int32* plErrorValue, // adress of the error value (can zero if not of interest) + char pszErrorTextBuffer[ERRORTEXTLEN]); // text buffer for text error + + + +/* +************************************************************************** + +StartEBox: +starts the ethernet box by instanciate the kernelhandle_lan_ebox. +The ethernet box is the server with a card with is waiting for +request by lan-client (host pc). + +*************************************************************************** +*/ + +SPCM_IMPORT uint32 _stdcall spcm_dwStartEBox (); + + + +/* +************************************************************************** + +dwDiscovery: +the lan-client (host pc) starts a broadcast request and wait for a answer +with the VISA string. +A VISA string contains the ip address of the ethernet box. + +*************************************************************************** +*/ + +SPCM_IMPORT uint32 _stdcall spcm_dwDiscovery ( + char** pszVisaString, // user-allocated array of C-strings to return the VISA strings + uint32 dwMaxNoOfDevices, // the maximum number of devices to be returned + uint32 dwMaxVisaLen, // maximum length of one entry in pszVisaString + uint32 dwTimeout); // time in milli seconds that the function will wait until each device has answered. + + + +/* +************************************************************************** + +dwWriteIDNRequest: +the lan-client (host pc) sends a "IDN" request to the ethernet box. +So the ethernet box will send a message which contains the manufacturer, +the model, the serial number and the firmware version + +*************************************************************************** +*/ + +SPCM_IMPORT uint32 _stdcall spcm_dwSendIDNRequest ( + char** szIdnString, //the IDN string looks like that: <manufacturer>,<model>,<serial number>,<firmware version> + uint32 dwNoOfDevices, + uint32 dwIdnStringLen); //string which contains manufacturer, the model, the serial number and the firmware version diff --git a/Cpp/examples/c_cpp/c_header/spcm_win32_bcppb.lib b/Cpp/examples/c_cpp/c_header/spcm_win32_bcppb.lib new file mode 100644 index 0000000000000000000000000000000000000000..2f022cdce6c5c1bb719ffbe9b8aca3821eba47f1 Binary files /dev/null and b/Cpp/examples/c_cpp/c_header/spcm_win32_bcppb.lib differ diff --git a/Cpp/examples/c_cpp/c_header/spcm_win32_cvi.lib b/Cpp/examples/c_cpp/c_header/spcm_win32_cvi.lib new file mode 100644 index 0000000000000000000000000000000000000000..db3b2cd1fdaba87b14e2229f07063d7f8f34600b Binary files /dev/null and b/Cpp/examples/c_cpp/c_header/spcm_win32_cvi.lib differ diff --git a/Cpp/examples/c_cpp/c_header/spcm_win32_msvcpp.lib b/Cpp/examples/c_cpp/c_header/spcm_win32_msvcpp.lib new file mode 100644 index 0000000000000000000000000000000000000000..33b1f5db3cf4072985782304eaf0e473598e706a Binary files /dev/null and b/Cpp/examples/c_cpp/c_header/spcm_win32_msvcpp.lib differ diff --git a/Cpp/examples/c_cpp/c_header/spcm_win64_msvcpp.lib b/Cpp/examples/c_cpp/c_header/spcm_win64_msvcpp.lib new file mode 100644 index 0000000000000000000000000000000000000000..07dee37fde851192cad0f13cb88f61af9a7d26bd Binary files /dev/null and b/Cpp/examples/c_cpp/c_header/spcm_win64_msvcpp.lib differ diff --git a/Cpp/examples/c_cpp/c_header/spectrum.h b/Cpp/examples/c_cpp/c_header/spectrum.h new file mode 100644 index 0000000000000000000000000000000000000000..77ca4fb47d8439b1b7707cd8010388c578b66b90 --- /dev/null +++ b/Cpp/examples/c_cpp/c_header/spectrum.h @@ -0,0 +1,11 @@ +HEAD SpcInitPCIBoards (int16 *pnCount, int16 *pnPCIVersion); +HEAD SpcInitBoard (int16 nNr, int16 nTyp); +HEAD SpcSetParam (int16 nNr, int32 lReg, int32 lValue); +HEAD SpcGetParam (int16 nNr, int32 lReg, int32 *plValue); +HEAD SpcGetData (int16 nNr, int16 nCh, int32 lStart, int32 lLen, dataptr pvData); +HEAD SpcSetData (int16 nNr, int16 nCh, int32 lStart, int32 lLen, dataptr pvData); +HEAD SpcGetVersionInfo (char *pszBuffer, int nBufferLen); + +// these functions are only needed under 64 bit Linux to set FIFO adresses +HEAD SpcSetAdr (int16 nNr, int32 lReg, void* pvAdr); +HEAD SpcGetAdr (int16 nNr, int32 lReg, void** ppvAdr); diff --git a/Cpp/examples/c_cpp/c_header/spectrum.lib b/Cpp/examples/c_cpp/c_header/spectrum.lib new file mode 100644 index 0000000000000000000000000000000000000000..ac4873d485442d2a30c930fb1f86c29d5eae0528 Binary files /dev/null and b/Cpp/examples/c_cpp/c_header/spectrum.lib differ diff --git a/Cpp/examples/c_cpp/c_header/spectrum_comp.lib b/Cpp/examples/c_cpp/c_header/spectrum_comp.lib new file mode 100644 index 0000000000000000000000000000000000000000..881e1c83ab1b5879c5d1de215b399b95a46c322b Binary files /dev/null and b/Cpp/examples/c_cpp/c_header/spectrum_comp.lib differ diff --git a/Cpp/examples/c_cpp/common/ostools/spcm_md5.cpp b/Cpp/examples/c_cpp/common/ostools/spcm_md5.cpp new file mode 100644 index 0000000000000000000000000000000000000000..59696a0f095678836d1e4de57b0bdcb5135b4385 --- /dev/null +++ b/Cpp/examples/c_cpp/common/ostools/spcm_md5.cpp @@ -0,0 +1,265 @@ +#include "spcm_md5.h" + +#include <math.h> + + +#define PUINT8_TO_UINT32(dwOut, pcIn) (dwOut = (pcIn[3] << 24) | (pcIn[2] << 16) | (pcIn[1] << 8) | pcIn[0]) + +#define UINT32_TO_PUINT8(pcOut, dwIn) { \ + pcOut[0] = (uint8) ((dwIn >> 0) & 0x000000ff); \ + pcOut[1] = (uint8) ((dwIn >> 8) & 0x000000ff); \ + pcOut[2] = (uint8) ((dwIn >> 16) & 0x000000ff); \ + pcOut[3] = (uint8) ((dwIn >> 24) & 0x000000ff); \ +} + +#define SIZEOF_UINT32 sizeof (uint32) +#define SIZEOF_ORIGIN_MSG_LEN 8 //always 64 Bit->8Bytes +#define SHIFT3 3 +#define MASK_63BIT 0x3F +#define SMALLEST_RESULT_MSG 64 //after padding with the message len, the result ist a multiple of SMALLEST_RESULT_MSG (in Bytes) +#define MSG_WITHOUT_MSGLEN SMALLEST_RESULT_MSG - SIZEOF_ORIGIN_MSG_LEN + +//max 64 Bytes = 512 Bits, in any case there will be pad the 1 +//the message is padding while the message len % 512 (bits) is 64 (bits). +//The 64 bit will be used for the len of the origin message +static uint8 PADDING_BYTES_TO_MESSAGE [64] = + { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }; + +//this values are given by the algorithm +static uint32 r [64] = + { + 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, //round 1 + 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, //round 2 + 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, //round 3 + 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21 //round 4 + }; + +//hard coded sin values - this is for timing +static uint32 k [64] = + { + 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, //sin table entries for round 1 + 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821, + 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa, 0xd62f105d, 0x2441453, 0xd8a1e681, 0xe7d3fbc8, //sin table entries for round 2 + 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed, 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a, + 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70, //sin table entries for round 3 + 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x4881d05, 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665, + 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1, //sin table entries for round 4 + 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1, 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 + }; + + + +//the four functions for the MD5 algorithm +#define CALC_F1(dwState1, dwState2, dwState3) (((dwState1) & (dwState2)) | ((~dwState1) & (dwState3))) +#define CALC_F2(dwState1, dwState2, dwState3) (((dwState1) & (dwState3)) | ((dwState2) & (~dwState3))) +#define CALC_F3(dwState1, dwState2, dwState3) ((dwState1) ^ (dwState2) ^ (dwState3)) +#define CALC_F4(dwState1, dwState2, dwState3) ((dwState2) ^ ((dwState1) | (~dwState3))) + +//every bit will be shift. if the bit would fall out of the integer it will be set as lsb +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) + +// functions for round 1-4 +#define CALC_STATE_ROUND1(dwState0, dwState1, dwState2, dwState3, x, s, ac) { \ +(dwState0) = ROTATE_LEFT (((dwState0) + CALC_F1 ((dwState1), (dwState2), (dwState3)) + (x) + (uint32)(ac)), (s)) + (dwState1); \ +} +#define CALC_STATE_ROUND2(dwState0, dwState1, dwState2, dwState3, x, s, ac) { \ +(dwState0) = ROTATE_LEFT (((dwState0) + CALC_F2 ((dwState1), (dwState2), (dwState3)) + (x) + (uint32)(ac)), (s)) + (dwState1); \ +} +#define CALC_STATE_ROUND3(dwState0, dwState1, dwState2, dwState3, x, s, ac) { \ +(dwState0) = ROTATE_LEFT (((dwState0) + CALC_F3 ((dwState1), (dwState2), (dwState3)) + (x) + (uint32)(ac)), (s)) + (dwState1); \ +} +#define CALC_STATE_ROUND4(dwState0, dwState1, dwState2, dwState3, x, s, ac) { \ +(dwState0) = ROTATE_LEFT (((dwState0) + CALC_F4 ((dwState1), (dwState2), (dwState3)) + (x) + (uint32)(ac)), (s)) + (dwState1); \ +} + + + +//makes the padding of the message. On a message will pad a '1' and so much '0' until the length of the message modulo 512 (bits) is 448 (512-64 bits). +//The last 64 bit are for the origin len of the message. +//Here the calculation of the algorith is done too. +void vMD5_Calculation (uint8 pbyCheckSum [16], MD5_STATES* pstStates, MD5_COUNTS* pstCounts, MD5_BUF* pstBuf) + { + uint32 i = 0; + uint8 pcBits[8]; + uint8 pcOut[4]; + uint32 dwIn = 0; + uint32 dwIndex = 0; + uint32 dwPaddingLen = 0; + uint32 dwPartLen = 0; + + + // Save number of bits + dwIn = pstCounts->dwCount0; + UINT32_TO_PUINT8 (pcOut, dwIn); + memcpy (pcBits, pcOut, SIZEOF_UINT32); + dwIn = pstCounts->dwCount1; + UINT32_TO_PUINT8 (pcOut, dwIn); + memcpy (pcBits+4, pcOut, SIZEOF_UINT32); + + + // Pad out to 56 mod 64. + dwIndex = (uint32)((pstCounts->dwCount0 >> SHIFT3) &MASK_63BIT); //runterrechnung auf bytes + dwPaddingLen = (dwIndex < MSG_WITHOUT_MSGLEN) ? (MSG_WITHOUT_MSGLEN - dwIndex) : ((MSG_WITHOUT_MSGLEN + SMALLEST_RESULT_MSG) - dwIndex); //länge die erweitert werden soll + + + //Update number of bits + pstCounts->dwCount0 += ((uint32)dwPaddingLen << SHIFT3); + dwPartLen = SMALLEST_RESULT_MSG - dwIndex; + + //Transform as many times as possible. + if (dwPaddingLen >= dwPartLen) + { + memcpy ((uint8*)&pstBuf->pcBuffer[dwIndex], (uint8*)PADDING_BYTES_TO_MESSAGE, dwPartLen); + vStartCalc (pstStates, pstBuf->pcBuffer); + for (i = dwPartLen; i + (SMALLEST_RESULT_MSG - 1) < dwPaddingLen; i += SMALLEST_RESULT_MSG) + vStartCalc (pstStates, &PADDING_BYTES_TO_MESSAGE[i]); + dwIndex = 0; + } + else + i = 0; + + //pad the bits (1 [0 ... 0]) + memcpy ((uint8*)&pstBuf->pcBuffer[dwIndex], (uint8*)&PADDING_BYTES_TO_MESSAGE[i], dwPaddingLen-i); + + //recalculate the Index and the count values + dwIndex = (uint8)((pstCounts->dwCount0 >> SHIFT3) & MASK_63BIT); + + if ((pstCounts->dwCount0 += ((uint32)SIZEOF_ORIGIN_MSG_LEN << SHIFT3)) < ((uint32)8 << SHIFT3)) + pstCounts->dwCount1++; + pstCounts->dwCount1 += ((uint32)SIZEOF_ORIGIN_MSG_LEN >> 29); + dwPartLen = 64 - dwIndex; + + memcpy ((uint8*)&pstBuf->pcBuffer[dwIndex], (uint8*)pcBits, dwPartLen); + vStartCalc (pstStates, pstBuf->pcBuffer); + for (i = dwPartLen; i + (SMALLEST_RESULT_MSG - 1) < SIZEOF_ORIGIN_MSG_LEN; i += SMALLEST_RESULT_MSG) + vStartCalc (pstStates, &pcBits[i]); + dwIndex = 0; + + memcpy ((uint8*)&pstBuf->pcBuffer[dwIndex], (uint8*)&pcBits[i], SIZEOF_ORIGIN_MSG_LEN); + + dwIn = pstStates->dwState0; + UINT32_TO_PUINT8 (pcOut, dwIn); + memcpy (pbyCheckSum, pcOut, SIZEOF_UINT32); + dwIn = pstStates->dwState1; + UINT32_TO_PUINT8 (pcOut, dwIn); + memcpy (pbyCheckSum+4, pcOut, SIZEOF_UINT32); + dwIn = pstStates->dwState2; + UINT32_TO_PUINT8 (pcOut, dwIn); + memcpy (pbyCheckSum+8, pcOut, SIZEOF_UINT32); + dwIn = pstStates->dwState3; + UINT32_TO_PUINT8 (pcOut, dwIn); + memcpy (pbyCheckSum+12, pcOut, SIZEOF_UINT32); + + //reset structs + dwPartLen = sizeof (*pstStates); + memset ((uint8*)pstStates, 0, dwPartLen); + dwPartLen = sizeof (*pstCounts); + memset ((uint8*)pstCounts, 0, dwPartLen); + dwPartLen = sizeof (*pstBuf); + memset ((uint8*)pstBuf, 0, dwPartLen); + } + +//main calculation of this algorithm +void vStartCalc (MD5_STATES* pstStates, uint8 pcBuf[64]) + { + uint32 dwState0 = pstStates->dwState0; + uint32 dwState1 = pstStates->dwState1; + uint32 dwState2 = pstStates->dwState2; + uint32 dwState3 = pstStates->dwState3; + uint32 x[16]; + uint32 i = 0; + uint8 pcIn[4]; + uint32 dwOut = 0; + + + for (i = 0; i < 16; i++) + { + memcpy (pcIn, pcBuf + i*SIZEOF_UINT32, SIZEOF_UINT32); + PUINT8_TO_UINT32 (dwOut, pcIn); + x[i] = dwOut; + } + + CALC_STATE_ROUND1 (dwState0, dwState1, dwState2, dwState3, x[ 0], r[ 0], k[ 0]); + CALC_STATE_ROUND1 (dwState3, dwState0, dwState1, dwState2, x[ 1], r[ 1], k[ 1]); + CALC_STATE_ROUND1 (dwState2, dwState3, dwState0, dwState1, x[ 2], r[ 2], k[ 2]); + CALC_STATE_ROUND1 (dwState1, dwState2, dwState3, dwState0, x[ 3], r[ 3], k[ 3]); + CALC_STATE_ROUND1 (dwState0, dwState1, dwState2, dwState3, x[ 4], r[ 4], k[ 4]); + CALC_STATE_ROUND1 (dwState3, dwState0, dwState1, dwState2, x[ 5], r[ 5], k[ 5]); + CALC_STATE_ROUND1 (dwState2, dwState3, dwState0, dwState1, x[ 6], r[ 6], k[ 6]); + CALC_STATE_ROUND1 (dwState1, dwState2, dwState3, dwState0, x[ 7], r[ 7], k[ 7]); + CALC_STATE_ROUND1 (dwState0, dwState1, dwState2, dwState3, x[ 8], r[ 8], k[ 8]); + CALC_STATE_ROUND1 (dwState3, dwState0, dwState1, dwState2, x[ 9], r[ 9], k[ 9]); + CALC_STATE_ROUND1 (dwState2, dwState3, dwState0, dwState1, x[10], r[10], k[10]); + CALC_STATE_ROUND1 (dwState1, dwState2, dwState3, dwState0, x[11], r[11], k[11]); + CALC_STATE_ROUND1 (dwState0, dwState1, dwState2, dwState3, x[12], r[12], k[12]); + CALC_STATE_ROUND1 (dwState3, dwState0, dwState1, dwState2, x[13], r[13], k[13]); + CALC_STATE_ROUND1 (dwState2, dwState3, dwState0, dwState1, x[14], r[14], k[14]); + CALC_STATE_ROUND1 (dwState1, dwState2, dwState3, dwState0, x[15], r[15], k[15]); + + //2nd round + CALC_STATE_ROUND2 (dwState0, dwState1, dwState2, dwState3, x[ 1], r[16], k[16]); + CALC_STATE_ROUND2 (dwState3, dwState0, dwState1, dwState2, x[ 6], r[17], k[17]); + CALC_STATE_ROUND2 (dwState2, dwState3, dwState0, dwState1, x[11], r[18], k[18]); + CALC_STATE_ROUND2 (dwState1, dwState2, dwState3, dwState0, x[ 0], r[19], k[19]); + CALC_STATE_ROUND2 (dwState0, dwState1, dwState2, dwState3, x[ 5], r[20], k[20]); + CALC_STATE_ROUND2 (dwState3, dwState0, dwState1, dwState2, x[10], r[21], k[21]); + CALC_STATE_ROUND2 (dwState2, dwState3, dwState0, dwState1, x[15], r[22], k[22]); + CALC_STATE_ROUND2 (dwState1, dwState2, dwState3, dwState0, x[ 4], r[23], k[23]); + CALC_STATE_ROUND2 (dwState0, dwState1, dwState2, dwState3, x[ 9], r[24], k[24]); + CALC_STATE_ROUND2 (dwState3, dwState0, dwState1, dwState2, x[14], r[25], k[25]); + CALC_STATE_ROUND2 (dwState2, dwState3, dwState0, dwState1, x[ 3], r[26], k[26]); + CALC_STATE_ROUND2 (dwState1, dwState2, dwState3, dwState0, x[ 8], r[27], k[27]); + CALC_STATE_ROUND2 (dwState0, dwState1, dwState2, dwState3, x[13], r[28], k[28]); + CALC_STATE_ROUND2 (dwState3, dwState0, dwState1, dwState2, x[ 2], r[29], k[29]); + CALC_STATE_ROUND2 (dwState2, dwState3, dwState0, dwState1, x[ 7], r[30], k[30]); + CALC_STATE_ROUND2 (dwState1, dwState2, dwState3, dwState0, x[12], r[31], k[31]); + + //3rd round + CALC_STATE_ROUND3 (dwState0, dwState1, dwState2, dwState3, x[ 5], r[32], k[32]); + CALC_STATE_ROUND3 (dwState3, dwState0, dwState1, dwState2, x[ 8], r[33], k[33]); + CALC_STATE_ROUND3 (dwState2, dwState3, dwState0, dwState1, x[11], r[34], k[34]); + CALC_STATE_ROUND3 (dwState1, dwState2, dwState3, dwState0, x[14], r[35], k[35]); + CALC_STATE_ROUND3 (dwState0, dwState1, dwState2, dwState3, x[ 1], r[36], k[36]); + CALC_STATE_ROUND3 (dwState3, dwState0, dwState1, dwState2, x[ 4], r[37], k[37]); + CALC_STATE_ROUND3 (dwState2, dwState3, dwState0, dwState1, x[ 7], r[38], k[38]); + CALC_STATE_ROUND3 (dwState1, dwState2, dwState3, dwState0, x[10], r[39], k[39]); + CALC_STATE_ROUND3 (dwState0, dwState1, dwState2, dwState3, x[13], r[40], k[40]); + CALC_STATE_ROUND3 (dwState3, dwState0, dwState1, dwState2, x[ 0], r[41], k[41]); + CALC_STATE_ROUND3 (dwState2, dwState3, dwState0, dwState1, x[ 3], r[42], k[42]); + CALC_STATE_ROUND3 (dwState1, dwState2, dwState3, dwState0, x[ 6], r[43], k[43]); + CALC_STATE_ROUND3 (dwState0, dwState1, dwState2, dwState3, x[ 9], r[44], k[44]); + CALC_STATE_ROUND3 (dwState3, dwState0, dwState1, dwState2, x[12], r[45], k[45]); + CALC_STATE_ROUND3 (dwState2, dwState3, dwState0, dwState1, x[15], r[46], k[46]); + CALC_STATE_ROUND3 (dwState1, dwState2, dwState3, dwState0, x[ 2], r[47], k[47]); + + //4th round + CALC_STATE_ROUND4 (dwState0, dwState1, dwState2, dwState3, x[ 0], r[48], k[48]); + CALC_STATE_ROUND4 (dwState3, dwState0, dwState1, dwState2, x[ 7], r[49], k[49]); + CALC_STATE_ROUND4 (dwState2, dwState3, dwState0, dwState1, x[14], r[50], k[50]); + CALC_STATE_ROUND4 (dwState1, dwState2, dwState3, dwState0, x[ 5], r[51], k[51]); + CALC_STATE_ROUND4 (dwState0, dwState1, dwState2, dwState3, x[12], r[52], k[52]); + CALC_STATE_ROUND4 (dwState3, dwState0, dwState1, dwState2, x[ 3], r[53], k[53]); + CALC_STATE_ROUND4 (dwState2, dwState3, dwState0, dwState1, x[10], r[54], k[54]); + CALC_STATE_ROUND4 (dwState1, dwState2, dwState3, dwState0, x[ 1], r[55], k[55]); + CALC_STATE_ROUND4 (dwState0, dwState1, dwState2, dwState3, x[ 8], r[56], k[56]); + CALC_STATE_ROUND4 (dwState3, dwState0, dwState1, dwState2, x[15], r[57], k[57]); + CALC_STATE_ROUND4 (dwState2, dwState3, dwState0, dwState1, x[ 6], r[58], k[58]); + CALC_STATE_ROUND4 (dwState1, dwState2, dwState3, dwState0, x[13], r[59], k[59]); + CALC_STATE_ROUND4 (dwState0, dwState1, dwState2, dwState3, x[ 4], r[60], k[60]); + CALC_STATE_ROUND4 (dwState3, dwState0, dwState1, dwState2, x[11], r[61], k[61]); + CALC_STATE_ROUND4 (dwState2, dwState3, dwState0, dwState1, x[ 2], r[62], k[62]); + CALC_STATE_ROUND4 (dwState1, dwState2, dwState3, dwState0, x[ 9], r[63], k[63]); + + //save calculated states + pstStates->dwState0 += dwState0; + pstStates->dwState1 += dwState1; + pstStates->dwState2 += dwState2; + pstStates->dwState3 += dwState3; + + } + diff --git a/Cpp/examples/c_cpp/common/ostools/spcm_md5.h b/Cpp/examples/c_cpp/common/ostools/spcm_md5.h new file mode 100644 index 0000000000000000000000000000000000000000..542d06df7782a5305cdbb8cb78a3e1c6a1e60af0 --- /dev/null +++ b/Cpp/examples/c_cpp/common/ostools/spcm_md5.h @@ -0,0 +1,32 @@ +#ifndef MD5_H +#define MD5_H +#include "../../c_header/dlltyp.h" +#include "../../c_header/regs.h" +#include "../../c_header/spcerr.h" + + +typedef struct + { + uint32 dwState0; + uint32 dwState1; + uint32 dwState2; + uint32 dwState3; + } MD5_STATES; + +typedef struct + { + uint32 dwCount0; + uint32 dwCount1; + } MD5_COUNTS; + +typedef struct + { + uint8 pcBuffer[64]; + } MD5_BUF; + + + +void vMD5_Calculation (uint8 pbyCheckSum [16], MD5_STATES* pstStates, MD5_COUNTS* pstCounts, MD5_BUF* pstBuf); +void vStartCalc (MD5_STATES* pstStates, uint8 pcBuf[64]); + +#endif diff --git a/Cpp/examples/c_cpp/common/ostools/spcm_network_winLin.cpp b/Cpp/examples/c_cpp/common/ostools/spcm_network_winLin.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f46a971631d6c17fa3bee2b47b641381146a4011 --- /dev/null +++ b/Cpp/examples/c_cpp/common/ostools/spcm_network_winLin.cpp @@ -0,0 +1,771 @@ +/******************************************************************************/ +/* File name : spcm_network_winLin.cpp */ +/* Description: API for windows and linux */ +/* This file contains the most needed function for using network */ +/******************************************************************************/ +#include "spcm_network_winLin.h" +#include <algorithm> +#include <cstdio> +#include <cstdlib> + +#ifdef WIN32 +# undef max +# undef min +#else // Linux, QNX +# include <errno.h> +# include <fcntl.h> +#endif + +#define SPCM_MAX_BYTES_TO_COPY (1024*1024)/*64*1024*/ + +// we're using this namespace in our program +namespace SPCM_NAMESPACE { + +/* + Initialize network. +*/ +uint32 dwInitNetwork () + { +#ifdef WIN32 + WSADATA wsa; + if (WSAStartup (MAKEWORD (2,0), &wsa) != 0) + { + return WSANOTINITIALISED; + } +#else + // nothing +#endif + return ERR_OK; + } + +void vShutdownNetwork () + { +#ifdef WIN32 + WSACleanup (); +#else + // nothing +#endif + } + + +/* + Create a socket. + lDomain = An address format specification. The only format currently supported is PF_INET, which is the ARPA Internet address format. + lType = A type specification for the new socket. + lProtocol = A particular protocol to be used with the socket, or 0 if the caller does not wish to specify a protocol. +*/ +SOCKET lSocket (int32 lDomain, int32 lType, int32 lProtocol) + { + return socket (lDomain, lType, lProtocol); + } + + +/* + Close a socket. + lSockfd = A (file) descriptor identifying a socket. +*/ +int32 lClose (SOCKET lSockfd) + { +#ifdef WIN32 + return closesocket (lSockfd); +#else + return close (lSockfd); +#endif + } + +/* + Establish a connection to a peer. + lSockfd = A socket (file) descriptor identifying an unconnected socket. + pstAddr = The address to assign to the socket. The address have to be casted to "struct sockaddr *". + lAddrlen = The length of the name. +*/ +int32 lConnect (SOCKET lSockfd, const struct sockaddr* pstAddr, socklen_t lAddrlen) + { + return connect (lSockfd, pstAddr, lAddrlen); + } + +/* + Read data from a socket. + lSockfd = A socket (file) descriptor identifying a connected socket. + pvBuf = A buffer for the incoming data. + lLen = The length of buf. +*/ +ssize_t dwRead (SOCKET lSockfd, void* pvBuf, size_t dwLen) + { +#ifdef WIN32 + return recv (lSockfd, (char*)pvBuf, (int)dwLen, 0); +#else + return read (lSockfd, pvBuf, dwLen); +#endif + } + +/* + Receive data from a socket. + lSockfd = A socket (file) descriptor identifying a connected socket. + pvBuf = A buffer for the incoming data. + lLen = The length of buf. + lFlags = Specifies the way in which the call is made. +*/ +ssize_t dwRecv (SOCKET lSockfd, void* pvBuf, size_t dwLen, int32 lFlags) + { +#ifdef WIN32 + return recv (lSockfd, (char*)pvBuf, (int)dwLen, lFlags); +#else + return recv (lSockfd, (char*)pvBuf, dwLen, lFlags); +#endif + } + +/* + Receive a datagram and store the source address. + lSockfd = A socket (file) descriptor identifying a bound socket. + pvBuf = A buffer for the incoming data. + lLen = The length of buf. + lFlags = Specifies the way in which the call is made. + pstSrc_addr = An optional pointer to a buffer which will hold the source address upon return. + plAddrlen = An optional pointer to the size of the from buffer. +*/ +ssize_t dwRecvfrom (SOCKET lSockfd, void* pvBuf, size_t dwLen, int32 lFlags, struct sockaddr *pstSrc_addr, socklen_t* plAddrlen) + { +#ifdef WIN32 + return recvfrom (lSockfd, (char*)pvBuf, (int)dwLen, lFlags, pstSrc_addr, plAddrlen); +#else + return recvfrom (lSockfd, (char*)pvBuf, dwLen, lFlags, pstSrc_addr, plAddrlen); +#endif + } + +/* + Send data on a connected socket. + lSockfd = A socket (file) descriptor identifying a connected socket. + pvBuf = A buffer containing the data to be transmitted. + lLen = The length of the data in buf. +*/ +ssize_t dwWrite (SOCKET lSockfd, const void* pvBuf, size_t dwLen) + { +#ifdef WIN32 + return send (lSockfd, (char*)pvBuf, (int)dwLen, 0); +#else + return write (lSockfd, pvBuf, dwLen); +#endif + } + +/* + Send data on a connected socket. + lSockfd = A socket (file) descriptor identifying a connected socket. + pvBuf = A buffer containing the data to be transmitted. + lLen = The length of the data in buf. + lFlags = Specifies the way in which the call is made. +*/ +ssize_t dwSend (SOCKET lSockfd, const void* pvBuf, size_t dwLen, int32 lFlags) + { +#ifdef WIN32 + return send (lSockfd, (char*)pvBuf, (int)dwLen, lFlags); +#else + return send (lSockfd, (char*)pvBuf, dwLen, lFlags); +#endif + } + + +/* + Send data to a specific destination. + lSockfd = A socket (file) descriptor identifying a socket. + pvBuf = A buffer containing the data to be transmitted. + lLen = The length of the data in buf. + lFlags = Specifies the way in which the call is made. + pstDest_addr = A optional pointer to the address of the target socket. + lAddrlen = The size of the address in to. +*/ +ssize_t dwSendto (SOCKET lSockfd, const void* pvBuf, size_t dwLen, int32 lFlags, const struct sockaddr* pstDest_addr, socklen_t lAddrlen) + { +#ifdef WIN32 + return sendto (lSockfd, (char*)pvBuf, (int)dwLen, lFlags, pstDest_addr, lAddrlen); +#else + return sendto (lSockfd, (char*)pvBuf, dwLen, lFlags, pstDest_addr, lAddrlen); +#endif + } + +int lSelect (SOCKET lSockfd, fd_set* pstReadFds, fd_set* pstWriteFds, fd_set* pstExceptFds, struct timeval* pstTimeout) + { +#ifdef WIN32 + return select (0/*unused*/, pstReadFds, pstWriteFds, pstExceptFds, pstTimeout); +#else + return select (lSockfd, pstReadFds, pstWriteFds, pstExceptFds, pstTimeout); +#endif + } + +/* + Accept a connection on a socket + lSockfd = A socket (file) descriptor identifying a socket which is listening for connections after a listen(). + pstAddr = An optional pointer to a buffer which receives the address of the connecting entity, as known to the communications layer. + The exact format of the addr argument is determined by the address family established when the socket was created. + plAddrlen = A optional pointer to an integer which contains the length of the address addr. +*/ + +SOCKET lAccept (SOCKET lSockfd, struct sockaddr* pstAddr, socklen_t* plAddrlen) + { + return accept (lSockfd, pstAddr, plAddrlen); + } + + +/* + Associate a local address with a socket. + lSockfd = A socket (file) descriptor identifying an unbound socket. + pstAddr = The address to assign to the socket. The address have to be casted to "struct sockaddr *". + lAddrlen = The length of the name. +*/ +int32 lBind (SOCKET lSockfd, const struct sockaddr* pstAddr, socklen_t lAddrlen) + { + return bind (lSockfd, pstAddr, lAddrlen); + } + + +/* + Establish a socket to listen for incoming connection. + lSockfd = A socket (file) descriptor identifying a bound, unconnected socket. + lBacklog = The maximum length to which the queue of pending connections may grow. +*/ +int32 lListen (SOCKET lSockfd, int32 lBacklog) + { + return listen (lSockfd, lBacklog); + } + +/* + Set options on sockets. + lSockfd = A socket (file) descriptor identifying a bound, unconnected socket. + lLevel = The level at which the option is defined (for example, SOL_SOCKET). + lOptname = The socket option for which the value is to be set (for example, SO_BROADCAST). + The optname parameter must be a socket option defined within the specified level, or behavior is undefined. + pvOptval = A pointer to the buffer in which the value for the requested option is specified. + lOptlen = The size, in bytes, of the buffer pointed to by the optval parameter. +*/ +int32 lSetsockopt (SOCKET lSockfd, int32 lLevel, int32 lOptname, const void* pvOptval, socklen_t lOptlen) + { +#ifdef WIN32 + return setsockopt (lSockfd, lLevel, lOptname, (const char*) pvOptval, lOptlen); +#else + return setsockopt (lSockfd, lLevel, lOptname, pvOptval, lOptlen); +#endif + } + +/* + provides protocol-independent translation from an ANSI host name to an address. + cpNode = A pointer to a NULL-terminated ANSI string that contains a host (node) name or a numeric host address string. + For the Internet protocol, the numeric host address string is a dotted-decimal IPv4 address or an IPv6 hex address. + cpService = A pointer to a NULL-terminated ANSI string that contains either a service name or port number represented as a string. + A service name is a string alias for a port number. + pstHints = A pointer to an addrinfo structure that provides hints about the type of socket the caller supports. + ppstRes = A pointer to a linked list of one or more addrinfo structures that contains repstonse information about the host. +*/ + +int32 lGetaddrinfo (const char* pcNode, const char* pcService, const struct addrinfo* pstHints, struct addrinfo** ppstRes) + { + return getaddrinfo (pcNode, pcService, pstHints, ppstRes); + } + +/* + retrieves the address of the peer to which a socket is connected. + dwSockfd = A descriptor identifying a connected socket. + sAddr = The SOCKADDR structure that receives the address of the peer. + lAddrlen = A pointer to the size, in bytes, of the name parameter. +*/ +int32 lGetpeername (SOCKET lSockfd, struct sockaddr* pstAddr, socklen_t* plAddrlen) + { + return getpeername (lSockfd, pstAddr, plAddrlen); + } + +/* + address-to-name translation in protocol-independent manner + pstSa = A pointer to a socket address structure that contains the address and port number of the socket. + For IPv4, the sa parameter points to a sockaddr_in structure. For IPv6, the sa parameter points to a sockaddr_in6 structure. + lSaLen = The length, in bytes, of the structure pointed to by the sa parameter. + pcHost = A pointer to an ANSI string used to hold the host name. + On success, the host name is returned as a Fully Qualified Domain Name (FQDN) by default. + If the host parameter is NULL, this indicates the caller does not want to receive a host name string. + sHostlen = The length, in bytes, of the buffer pointed to by the pcHost parameter. + The caller must provide a buffer large enough to hold the host name, including the terminating NULL character. + pcServ = A pointer to an ANSI string to hold the service name. + On success, an ANSI string that represents the service name associated with the port number is returned. + If the serv parameter is NULL, this indicates the caller does not want to receive a service name string. + lServLen = The length, in bytes, of the buffer pointed to by the pcServ parameter. + The caller must provide a buffer large enough to hold the service name, including the terminating NULL character. + lFlags = A value used to customize processing of the getnameinfo function. See the Remarks section. +*/ +int32 lGetnameinfo (const struct sockaddr* pstSa, socklen_t lSaLen, char* pcHost, size_t dwHostlen, char* pcServ, size_t dwServLen, int32 lFlags) + { +#ifdef WIN32 + return getnameinfo (pstSa, lSaLen, pcHost, static_cast < DWORD > (dwHostlen), pcServ, static_cast < DWORD > (dwServLen), lFlags); +#else + return getnameinfo (pstSa, lSaLen, pcHost, dwHostlen, pcServ, dwServLen, lFlags); +#endif + } + + +// **************************************************************************** +// ***** set blocking mode of socket +// **************************************************************************** +int32 lSetSocketBlocking (SOCKET lSockfd, bool bBlock) + { +#ifdef WIN32 + uint32 dwNonblockMode = (bBlock? 0 : 1); + return ioctlsocket (lSockfd, FIONBIO, &dwNonblockMode); +#else + int lArg = fcntl (lSockfd, F_GETFL, NULL); + if (lArg == -1) + return SOCKET_ERROR; + if (bBlock) + lArg &= ~O_NONBLOCK; + else + lArg |= O_NONBLOCK; + if (fcntl (lSockfd, F_SETFL, lArg) == -1) + return SOCKET_ERROR; + return 0; +#endif + } + +// ----- get the number of available network interfaces from the system ----- +uint32 dwGetNumNICs () + { +#ifdef WIN32 + uint32 dwBufLen = 0; + GetInterfaceInfo (NULL, &dwBufLen); // get necessary buffer length + char* acBuf = new char[dwBufLen]; + IP_INTERFACE_INFO* pstIPInterfaceInfo = reinterpret_cast < IP_INTERFACE_INFO* > (acBuf); + GetInterfaceInfo (pstIPInterfaceInfo, &dwBufLen); // get infos + + uint32 dwNumNICs = pstIPInterfaceInfo->NumAdapters; + delete [] acBuf; + return dwNumNICs; +#else + + // ----- create temp socket for request ----- + int32 lTmpSock = socket (AF_INET, SOCK_STREAM, 0); + if (lTmpSock == SOCKET_ERROR) + return 0; + + // ----- point ifconf's ifc_buf to our array of interface ifreqs ----- + struct ifconf stIfconf; + struct ifreq astIfreq[20]; // random maximum of interfaces + stIfconf.ifc_buf = (char *) astIfreq; + + // Set ifconf's ifc_len to the length of our array of interface ifreqs. + stIfconf.ifc_len = sizeof (astIfreq); + + // Populate ifconf.ifc_buf (ifreq) with a list of interface names and addresses. + if (ioctl (lTmpSock, SIOCGIFCONF, &stIfconf) == -1) + return 0; + + close (lTmpSock); + + // Divide the length of the interface list by the size of each entry. + // This gives us the number of interfaces on the system. + return stIfconf.ifc_len / sizeof (struct ifreq); +#endif + } + +uint32 dwFindOwnIpAdr (int32 lNICIdx, SOCKET lSockfd, char* szOwnIpAddress) + { +#ifdef WIN32 + char szBuf[255]; + if (gethostname (szBuf, 255) != SOCKET_ERROR) + { +# if defined(_MSC_VER) && (_MSC_VER < 1900) // 1900 = VS2015 + struct hostent* pstHostend = gethostbyname (szBuf); + if (pstHostend != NULL) + { + for (int32 lCnt = 0; lCnt < lNICIdx + 1; ++lCnt) + { + if (pstHostend->h_addr_list[lCnt] == NULL) + { + return ERR_ABORT; // no valid address found + } + } + + if (pstHostend->h_addr_list[lNICIdx]) + { + struct in_addr* pstAddr = reinterpret_cast < struct in_addr* > (pstHostend->h_addr_list[lNICIdx]); + + char* szIP = inet_ntoa (*pstAddr); + if (szIP == NULL) + return ERR_ABORT; + + memcpy (szOwnIpAddress, szIP, SIZEOF_IPADDR); + } + } +# else + struct addrinfo stHints; + memset (&stHints, 0, sizeof (stHints)); + stHints.ai_family = AF_INET; // do not show IPv6 for now + + struct addrinfo* pstAddrInfo = NULL; + getaddrinfo (szBuf, NULL, &stHints, &pstAddrInfo); + struct addrinfo* pstCurAddrInfo = pstAddrInfo; + + // ----- find struct for NIC ----- + for (int32 lCnt = 0; lCnt < lNICIdx && pstCurAddrInfo; ++lCnt) + { + if (pstCurAddrInfo->ai_next == NULL) + return ERR_ABORT; + pstCurAddrInfo = pstCurAddrInfo->ai_next; + } + + // ----- convert binary IP to string ----- + switch (pstCurAddrInfo->ai_family) + { + case AF_INET: + InetNtopA (AF_INET, &((struct sockaddr_in*)pstCurAddrInfo->ai_addr)->sin_addr, szOwnIpAddress, SIZEOF_IPADDR); + break; + case AF_INET6: + InetNtopA (AF_INET6, &((struct sockaddr_in6*)pstCurAddrInfo->ai_addr)->sin6_addr, szOwnIpAddress, SIZEOF_IPADDR6); // should not happen with stHints set above + break; + } + freeaddrinfo (pstAddrInfo); +# endif + } + +#else + // ----- request info structure from kernel ----- + struct ifconf stIfconf; + struct ifreq astIfreq[20]; // random maximum of interfaces + stIfconf.ifc_buf = (char *) astIfreq; + stIfconf.ifc_len = sizeof (astIfreq); + if (ioctl (lSockfd, SIOCGIFCONF, &stIfconf) == -1) + return ERR_ABORT; + + const uint32 dwNumInterfaces = stIfconf.ifc_len / sizeof (struct ifreq); + if (static_cast < uint32 > (lNICIdx) >= dwNumInterfaces) + return ERR_ABORT; + + struct sockaddr_in *pstAddress = (struct sockaddr_in *) &astIfreq[lNICIdx].ifr_addr; + if (pstAddress == NULL) + return ERR_ABORT; + + // Convert the binary IP address into a readable string. + if (inet_ntop (AF_INET, &pstAddress->sin_addr, szOwnIpAddress, SIZEOF_IPADDR) == NULL) + return ERR_ABORT; +#endif + + return ERR_OK; + } + +void vGetIPAndSubnetMask (int32 lNICIdx, SOCKET lSockfd, char* szIPAddress, char* szSubNetMask) + { + if (szIPAddress != NULL) + memset (szIPAddress, 0, SIZEOF_IPADDR); + if (szSubNetMask != NULL) + memset (szSubNetMask, 0, SIZEOF_IPADDR); + + #ifdef WIN32 + + // get list of network adapters + IP_ADAPTER_INFO* pstFirstAdapterInfo = NULL; + bool bDelete = false; + ULONG dwLen = 0; + DWORD dwErr = GetAdaptersInfo (pstFirstAdapterInfo, &dwLen); + if (dwErr == ERROR_BUFFER_OVERFLOW) + { + pstFirstAdapterInfo = (IP_ADAPTER_INFO*)malloc (dwLen); // use malloc because of heap corruption when using new + dwErr = GetAdaptersInfo (pstFirstAdapterInfo, &dwLen); + bDelete = true; + } + if (dwErr != ERROR_SUCCESS) + { + if (bDelete) + free (pstFirstAdapterInfo); + return; + } + + // find the requested adapter + IP_ADAPTER_INFO* pstCurrAdapterInfo = pstFirstAdapterInfo; + for (uint32 dwIdx = 0; dwIdx < static_cast < uint32 > (lNICIdx) && pstCurrAdapterInfo->Next; ++dwIdx) + { + pstCurrAdapterInfo = pstCurrAdapterInfo->Next; + } + + if (szIPAddress != NULL) + memcpy (szIPAddress, &pstCurrAdapterInfo->IpAddressList.IpAddress, SIZEOF_IPADDR); + if (szSubNetMask != NULL) + memcpy (szSubNetMask, &pstCurrAdapterInfo->IpAddressList.IpMask, SIZEOF_IPADDR); + + free (pstFirstAdapterInfo); + + #else + // using getifaddrs to get subnet mask did not work for unknown reasons, so we use ioctl calls + + // ----- request info structure from kernel ----- + struct ifconf stIfconf; + struct ifreq astIfreq[20]; // random maximum of interfaces + stIfconf.ifc_buf = (char *) astIfreq; + stIfconf.ifc_len = sizeof (astIfreq); + if (ioctl (lSockfd, SIOCGIFCONF, &stIfconf) == -1) + return; + + const uint32 dwNumInterfaces = stIfconf.ifc_len / sizeof (struct ifreq); + if (static_cast < uint32 > (lNICIdx) >= dwNumInterfaces) + return; + + struct sockaddr_in* pstAddress = (struct sockaddr_in *) &astIfreq[lNICIdx].ifr_addr; + if (pstAddress == NULL) + return; + + // Convert the binary IP address into a readable string. + if (inet_ntop (AF_INET, &pstAddress->sin_addr, szIPAddress, SIZEOF_IPADDR) == NULL) + return; + + // ----- Subnetmask ----- + if (ioctl (lSockfd, SIOCGIFNETMASK, astIfreq + lNICIdx) == -1) + return; + + pstAddress = (struct sockaddr_in *) &astIfreq[lNICIdx].ifr_addr; + + // Convert the binary subnet mask into a readable string. + if (inet_ntop (AF_INET, &pstAddress->sin_addr, szSubNetMask, SIZEOF_IPADDR) == NULL) + return; + + #endif + } + +std::string sGetAdapterName (uint32 dwNICIdx) + { + std::string sName; +#ifdef WIN32 + IP_ADAPTER_INFO* pstFirstAdapterInfo = NULL; + IP_ADAPTER_INFO* pstCurrAdapterInfo = NULL; + bool bDelete = false; + ULONG dwLen = 0; + DWORD dwErr = GetAdaptersInfo (pstFirstAdapterInfo, &dwLen); + if (dwErr == ERROR_BUFFER_OVERFLOW) + { + pstFirstAdapterInfo = (IP_ADAPTER_INFO*)malloc (dwLen); // use malloc because of heap corruption when using new + dwErr = GetAdaptersInfo (pstFirstAdapterInfo, &dwLen); + bDelete = true; + } + if (dwErr != ERROR_SUCCESS) + { + if (bDelete) + free (pstFirstAdapterInfo); + return ""; + } + + pstCurrAdapterInfo = pstFirstAdapterInfo; + for (uint32 dwIdx = 0; dwIdx < dwNICIdx && pstCurrAdapterInfo->Next; ++dwIdx) + { + pstCurrAdapterInfo = pstCurrAdapterInfo->Next; + } + + sName = pstCurrAdapterInfo->Description; + + if (bDelete) + free (pstFirstAdapterInfo); +#else + // ----- create temp socket for request ----- + int32 lTmpSock = socket (AF_INET, SOCK_STREAM, 0); + if (lTmpSock == SOCKET_ERROR) + return ""; + + // ----- point ifconf's ifc_buf to our array of interface ifreqs ----- + struct ifconf stIfconf; + struct ifreq astIfreq[20]; // random maximum of interfaces + stIfconf.ifc_buf = (char *) astIfreq; + + // Set ifconf's ifc_len to the length of our array of interface ifreqs. + stIfconf.ifc_len = sizeof (astIfreq); + + // Populate ifconf.ifc_buf (ifreq) with a list of interface names and addresses. + if (ioctl (lTmpSock, SIOCGIFCONF, &stIfconf) == -1) + return ""; + + close (lTmpSock); + + const uint32 dwNumAdapters = stIfconf.ifc_len / sizeof (struct ifreq); + if (dwNICIdx >= dwNumAdapters) + return ""; + + sName = stIfconf.ifc_req[dwNICIdx].ifr_name; +#endif + return sName; + } + + +int32 lGetMacAddress (uint64* pqwMacAddress) + { + *pqwMacAddress = 0; + +#ifdef WIN32 + /* Declare and initialize variables */ + uint32 dwError = 0; + + // Set the flags to pass to GetAdaptersAddresses + uint32 dwFlags = GAA_FLAG_INCLUDE_PREFIX; + + // default to unspecified address family (both) + uint32 dwFamily = AF_UNSPEC; + PIP_ADAPTER_ADDRESSES pstAddresses = NULL; + uint32 dwBufLen = 0; + + dwFamily = AF_INET; + + dwBufLen = sizeof (IP_ADAPTER_ADDRESSES); + pstAddresses = (IP_ADAPTER_ADDRESSES *) MALLOC (dwBufLen); + + // Make an initial call to GetAdaptersAddresses to get the + // size needed into the outBufLen variable + if (GetAdaptersAddresses (dwFamily, dwFlags, NULL, pstAddresses, &dwBufLen) == ERROR_BUFFER_OVERFLOW) + { + FREE (pstAddresses); + pstAddresses = (IP_ADAPTER_ADDRESSES *) MALLOC (dwBufLen); + } + + if (pstAddresses == NULL) + { + printf("Memory allocation failed for IP_ADAPTER_ADDRESSES struct\n"); + exit(1); + } + + // Make a second call to GetAdapters Addresses to get the + // actual data we want + dwError = GetAdaptersAddresses (dwFamily, dwFlags, NULL, pstAddresses, &dwBufLen); + + // take first adapter + memcpy (pqwMacAddress, pstAddresses->PhysicalAddress, SIZEOF_MACADDR - 1); + FREE(pstAddresses); + +#else + FILE* pFile = fopen ("/sys/class/net/eth0/address", "r"); + + char szMAC[18]; // 00:03:2D:21:AE:AE\0 + char* szTmp __attribute__((unused)) = fgets (szMAC, sizeof (szMAC), pFile); + fclose (pFile); + + char* pcPos = szMAC; + uint32 dwShift = 40; + for (int lIdx = 0; lIdx < 6; ++lIdx) + { + *pqwMacAddress |= static_cast < uint64 > (strtoul (pcPos, NULL, 16)) << dwShift; + dwShift -= 8; + pcPos += 3; + } +#endif + + return ERR_OK; + } + +int32 lGetMacAddress (char* szMacAddress) + { + uint64 qwMacAddress = 0; + lGetMacAddress (&qwMacAddress); + +#ifdef WIN32 + sprintf (szMacAddress, "%2lX:%2lX:%2lX:%2lX:%2lX:%2lX", +#else + sprintf (szMacAddress, "%2X:%2X:%2X:%2X:%2X:%2X", +#endif + static_cast < uint32 > ((qwMacAddress >> 40) & 0xFF), + static_cast < uint32 > ((qwMacAddress >> 32) & 0xFF), + static_cast < uint32 > ((qwMacAddress >> 24) & 0xFF), + static_cast < uint32 > ((qwMacAddress >> 16) & 0xFF), + static_cast < uint32 > ((qwMacAddress >> 8) & 0xFF), + static_cast < uint32 > ((qwMacAddress >> 0) & 0xFF)); + + return ERR_OK; + } + + + +int32 lGetNetworkErrorCode () + { +#ifdef WIN32 + return WSAGetLastError (); +#else + return errno; +#endif + } + + +// ----- Returns a string with the last network error message ----- +char* szNetworkErrorMessage (int32 lErrorCode) + { +#ifdef WIN32 + static char s_szErrMsgBuffer[200]; + + LPSTR szErrorText = NULL; + FormatMessageA (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, lErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), (LPSTR)&szErrorText, 0, NULL); + + // convert to char* + _snprintf_s (s_szErrMsgBuffer, 100, _TRUNCATE, "%s", szErrorText); + + // release memory allocated by FormatMessage() + LocalFree (szErrorText); + + return s_szErrMsgBuffer; +#else + return strerror (lErrorCode); +#endif + } + + +// ----- converts an IP representation to string ----- +const char* szIPFromSockAddr (const struct sockaddr_in* pstIP) + { + static char s_szIPBuffer[16]; + +#ifdef WIN32 + sprintf (s_szIPBuffer, "%u.%u.%u.%u", pstIP->sin_addr.S_un.S_un_b.s_b1, pstIP->sin_addr.S_un.S_un_b.s_b2, pstIP->sin_addr.S_un.S_un_b.s_b3, pstIP->sin_addr.S_un.S_un_b.s_b4); +#else + uint32 dwIP = ntohl (pstIP->sin_addr.s_addr); + sprintf (s_szIPBuffer, "%u.%u.%u.%u", (dwIP & 0xFF000000)>>24, (dwIP & 0xFF0000)>>16, (dwIP & 0xFF00)>>8, (dwIP & 0xFF)); +#endif + return s_szIPBuffer; + } + +char* szIPFromName (const char* szName) + { + static char szIPBuffer[16]; //123.123.123.123\0 + + struct addrinfo* pstResult = NULL; + + int lErr = getaddrinfo (szName, NULL, NULL, &pstResult); + if (lErr != 0) + { + szIPBuffer[0] = '\0'; + return szIPBuffer; + } + + struct sockaddr_in *ipv = (struct sockaddr_in *)pstResult->ai_addr; + + // Convert the binary IP address into a readable string. + if (lInet_ntop (ipv, szIPBuffer) == SOCKET_ERROR) + { + freeaddrinfo (pstResult); + return NULL; + } + freeaddrinfo (pstResult); + + return szIPBuffer; + } + +int lInet_pton (const char* szHostname, struct sockaddr_in* pstSockAddr) + { +#if defined(_MSC_VER) && (_MSC_VER < 1900) // for compilation with older VS. 1900 = VS2015 + pstSockAddr->sin_addr.s_addr = inet_addr (szHostname); +#else + if (inet_pton (AF_INET, szIPFromName (szHostname), &(pstSockAddr->sin_addr)) <= 0) + { + return SOCKET_ERROR; + } +#endif + return 0; + } + +int lInet_ntop (const struct sockaddr_in* pstSockAddr, char* szIP) + { +#if defined(_MSC_VER) && (_MSC_VER < 1900) // for compilation with older VS. 1900 = VS2015 + strncpy (szIP, inet_ntoa (pstSockAddr->sin_addr), SIZEOF_IPADDR); +#else + if (inet_ntop (AF_INET, &(const_cast < struct sockaddr_in* > (pstSockAddr)->sin_addr), szIP, SIZEOF_IPADDR) == NULL) + { + return SOCKET_ERROR; + } +#endif + return 0; + } + +} // /SPCM_NAMESPACE diff --git a/Cpp/examples/c_cpp/common/ostools/spcm_network_winLin.h b/Cpp/examples/c_cpp/common/ostools/spcm_network_winLin.h new file mode 100644 index 0000000000000000000000000000000000000000..4220db88d0ff76e4bd70b07c4e13546d0e938099 --- /dev/null +++ b/Cpp/examples/c_cpp/common/ostools/spcm_network_winLin.h @@ -0,0 +1,109 @@ +/******************************************************************************/ +/* File name : socketAPI.c */ +/* Description: API for windows and linux */ +/* This file contains the most needed function for using network */ +/******************************************************************************/ +#ifndef NETWORKWINLIN_H +#define NETWORKWINLIN_H + +#if defined(WIN32) || defined (WIN64) +# include <Winsock2.h> +# include <ws2tcpip.h> +# include <windows.h> +# include <iphlpapi.h> + +# pragma comment(lib, "IPHLPAPI.lib") +# define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x)) +# define FREE(x) HeapFree(GetProcessHeap(), 0, (x)) + +typedef int ssize_t; +#else +# include <netinet/in.h> +# include <netinet/tcp.h> +# include <arpa/inet.h> +# include <sys/types.h> +# include <sys/socket.h> +# include <unistd.h> +# include <netdb.h> +# include <string.h> +# include <sys/ioctl.h> +# include <net/if.h> +# include <ctype.h> + +typedef int SOCKET; +# define SOCKET_ERROR -1 +# define INVALID_SOCKET -1 + +#endif + +#define MAX_CONN 16 // TODO: 16 guter Wert? + +#define SIZEOF_IPADDR 16 //xxx.xxx.xxx.xxx +#define SIZEOF_IPADDR6 46 //xxx.xxx.xxx.xxx +#define SIZEOF_MACADDR 7 //xx xx xx xx + +// ----- driver dll includes ----- +#include "../../c_header/dlltyp.h" +#include "../../c_header/regs.h" +#include "../../c_header/spcerr.h" + +#include <cstdio> +#include <cstdlib> +#include <string> + +// our own namespace +namespace SPCM_NAMESPACE { + +uint32 dwInitNetwork (); +void vShutdownNetwork (); + +// ----- functions for connecting ----- +SOCKET lSocket (int32 lDomain, int32 lType, int32 lProtocol); +int32 lBind (SOCKET lSockfd, const struct sockaddr* pstAddr, socklen_t plAddrlen); +int32 lListen (SOCKET lSockfd, int32 lBacklog); +int32 lConnect (SOCKET lSockfd, const struct sockaddr* pstAddr, socklen_t plAddrlen); +SOCKET lAccept (SOCKET lSockfd, struct sockaddr* pstAddr, socklen_t* plAddrlen); +int32 lClose (SOCKET lSockfd); + +//receiving data +ssize_t dwRead (SOCKET lSockfd, void* pvBuf, size_t dwLen); +ssize_t dwRecv (SOCKET lSockfd, void* pvBuf, size_t dwLen, int32 lFlags); +ssize_t dwRecvfrom (SOCKET lSockfd, void* pvBuf, size_t dwLen, int32 lFlags, struct sockaddr* pstSrcAddr, socklen_t* plAddrlen); + +//sending data +ssize_t dwWrite (SOCKET lSockfd, const void* pvBuf, size_t dwLen); +ssize_t dwSend (SOCKET lSockfd, const void* pvBuf, size_t dwLen, int32 lFlags); +ssize_t dwSendto (SOCKET lSockfd, const void* pvBuf, size_t dwLen, int32 lFlags, const struct sockaddr* pstDestAddr, socklen_t lAddrlen); + +int lSelect (SOCKET lSockfd, fd_set* pstReadFds, fd_set* pstWriteFds, fd_set* pstExceptFds, struct timeval* pstTimeout); + +//info functions +int32 lSetsockopt (SOCKET lSockfd, int32 lLevel, int32 lOptname, const void* pvOptval, socklen_t lOptlen); +int32 lGetaddrinfo (const char* pcNode, const char* pcService, const struct addrinfo* pstHints, struct addrinfo** ppstRes); +int32 lGetpeername (SOCKET lSockfd, struct sockaddr* pstAddr, socklen_t* plAddrlen ); +int32 lGetnameinfo (const struct sockaddr* pstSa, socklen_t lSalen, char* pcHost, size_t lHostlen, char* pcServ, size_t lServlen, int32 lFlags); +int32 lSetSocketBlocking (SOCKET lSockfd, bool bBlock); +const char* pcInet_ntop (int32 lAf, const void* pvSrc, char* pcDst, socklen_t lSize); +int lInet_pton (const char* szHostname, struct sockaddr_in* pstSockAddr); +int lInet_ntop (const struct sockaddr_in* pstSockAddr, char* szIP); + +uint32 dwGetNumNICs (); +uint32 dwFindOwnIpAdr (int32 lNICIdx, SOCKET lSockfd, char* szOwnIpAddress); +void vGetIPAndSubnetMask (int32 lNICIdx, SOCKET lSockfd, char* szIPAddress, char* szSubNetMask); + +std::string sGetAdapterName (uint32 dwNICIdx); +int32 lGetMacAddress (char* szMacAddress); +int32 lGetMacAddress (uint64* pqwMacAddress); + +int32 lGetNetworkErrorCode (); +char* szNetworkErrorMessage (int32 lErrorCode); + +char* szIPFromName (const char* szName); + +// used by netbox state monitor +const char* szIPFromSockAddr (const struct sockaddr_in* pstIP); +uint32 dwGetNetboxState (const char* szIP, uint32 dwTimeout_ms, char* szNetboxType, uint32* pdwState); + +} // /SPCM_NAMESPACE + +#endif //NETWORKWINLIN_H diff --git a/Cpp/examples/c_cpp/common/ostools/spcm_ostools.h b/Cpp/examples/c_cpp/common/ostools/spcm_ostools.h new file mode 100644 index 0000000000000000000000000000000000000000..1672ec66cbfc42a69e0acca5a24e9492f7a09f18 --- /dev/null +++ b/Cpp/examples/c_cpp/common/ostools/spcm_ostools.h @@ -0,0 +1,181 @@ +/* +************************************************************************** + +spcm_ostools.h (c) Spectrum GmbH , 09/2005 + +************************************************************************** + +tools functions that differ from OS to OS: +- min/max macros +- Keyboard +- Threads +- Events +- Mutex +- Page aligned memory allocation + +************************************************************************** +*/ + + +#ifndef SPCM_OSTOOLS_H +#define SPCM_OSTOOLS_H + +#include "../../c_header/dlltyp.h" +#include "spcm_oswrap.h" + + +/* +************************************************************************** +define our own namespace if it isn't defined yet. This is necessary to +avoid name conflicts as this file is also used inside the driver +************************************************************************** +*/ + +#ifndef SPCM_NAMESPACE +# define SPCM_NAMESPACE spcmdrv +#endif + +namespace SPCM_NAMESPACE { + +/* +************************************************************************** +misc helper functions +************************************************************************** +*/ +uint32 dwGetTickCount(); + +void vSleep_ms (unsigned int dwMS); +uint32 dwSleep_ms (unsigned int dwMS); + + +/* +************************************************************************** +Keyboard functions +************************************************************************** +*/ + +// check for key pressed +int bKbhit(void); + +// get one character from keyboard +int cGetch(); + + + +/* +************************************************************************** +thread functions +************************************************************************** +*/ + +// define the thread function +typedef SPCM_THREAD_RETURN (SPCM_THREAD_CALLTYPE SPCM_THREADFUNCTION) (void* pvArguments); + +// define the thread priority settings +enum SPCM_THREADPRIO {ePrioMin, ePrioNormal, ePrioMax}; + + + +// creates a thread with the given function name, returns false if creation failed +bool spcm_bCreateThread (SPCM_THREADFUNCTION* pfnThread, SPCM_THREAD_HANDLE* phThread, void* pvArguments); + +// joins (waits for termination) +void spcm_vJoinThread (SPCM_THREAD_HANDLE* phThread, uint32 dwTimeout_ms); + +// closes the thread handle +void spcm_vCloseThread (SPCM_THREAD_HANDLE* phThread); + +// suspend the thread for xx milli seconds +void spcm_vSuspendThread (uint32 dwMS); + +// sets the priority of the thread +void spcm_vSetThreadPriority (SPCM_THREAD_HANDLE* phThread, SPCM_THREADPRIO ePriority); + + + +/* +************************************************************************** +event (linux: condition) functions +************************************************************************** +*/ + +// create an event +bool spcm_bCreateEvent (SPCM_EVENT_HANDLE* phEvent); + +// close an event +void spcm_vCloseEvent (SPCM_EVENT_HANDLE* phEvent); + +// wait for one event with timeout, true if event was received, false if timeout occurs, timeout zero means that we wait forever +bool spcm_bWaitEventWithMutex (SPCM_EVENT_HANDLE* phEvent, SPCM_MUTEX_HANDLE* phMutex, uint32 dwTimeoutMS = 0); + +// wait for one event without timeout and mutex +void spcm_vWaitEvent (SPCM_EVENT_HANDLE* phEvent); + +// signal an event +void spcm_vSignalEvent (SPCM_EVENT_HANDLE* phEvent); + + + +/* +************************************************************************** +mutex functions +************************************************************************** +*/ + +// create a mutex +bool spcm_bCreateMutex (SPCM_MUTEX_HANDLE* phMutex); + +// close the mutex +void spcm_vCloseMutex (SPCM_MUTEX_HANDLE* phMutex); + +// get the mutex +void spcm_vGetMutex (SPCM_MUTEX_HANDLE* phMutex); + +// release the mutex +void spcm_vReleaseMutex (SPCM_MUTEX_HANDLE* phMutex); + + + +/* +************************************************************************** +memory allocation functions for page aligned allocation +************************************************************************** +*/ + +// allocate a memory region of the given size in bytes, data is page aligned +void* pvAllocMemPageAligned (uint64 qwBytes); + +// free this data +void vFreeMemPageAligned (void* pvMemory, uint64 qwBytes); + + + +/* +************************************************************************** +system information functions +It is not possible to compile this function with the default SDK of +Visual Studio 6.0. +************************************************************************** +*/ + +#if (defined (_MSC_VER) && (_MSC_VER >= 1300)) || defined (__GNUC__) + uint64 qwGetTotalPhysicalMemory (); + uint64 qwGetTotalVirtualMemory (); +#endif + + +/* +************************************************************************** +clipboard handling +************************************************************************** +*/ +void vCopyToClipboard (const char* szText, size_t dwLen); + +} // end of namespace SPCM_NAMESPACE + + +// our namespace that we use inside the ostools functions +using namespace SPCM_NAMESPACE; + + +#endif diff --git a/Cpp/examples/c_cpp/common/ostools/spcm_ostools_linux.cpp b/Cpp/examples/c_cpp/common/ostools/spcm_ostools_linux.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3380bef6ad19b5724db16d7ce348aa32335ba182 --- /dev/null +++ b/Cpp/examples/c_cpp/common/ostools/spcm_ostools_linux.cpp @@ -0,0 +1,375 @@ +/* +************************************************************************** + +spcm_ostools.cpp (c) Spectrum GmbH + +************************************************************************** + +toosl functions that differ from OS to OS: +- Threads +- Events + +************************************************************************** +*/ + +#include "../../c_header/dlltyp.h" + +#include "spcm_oswrap.h" +#include "spcm_ostools.h" + +#include <pthread.h> +#include <sys/time.h> +#include <fcntl.h> +#include <sys/mman.h> +#include <sys/sysinfo.h> +#include <unistd.h> + +#include <termios.h> +#include <string.h> +#include <stdio.h> + + +// we're using this namespace in our program +namespace SPCM_NAMESPACE { + + +/* +************************************************************************** +dwGetTickCount: fake windows GetTickCount function for linux +************************************************************************** +*/ + +uint32 dwGetTickCount () + { + struct timespec ts; + clock_gettime (0, &ts); + return (uint32) 1000 * ts.tv_sec + ts.tv_nsec / 1000000; + } + + +/* +************************************************************************** +Sleep: suspend the thread for the number of ms + On some systems is the usleep parameter limited to 1000000. +************************************************************************** +*/ + +void vSleep_ms (uint32 dwMS) + { + uint32 dwRest_us, dwActual_us; + + dwRest_us = dwMS * 1000; + + // do/while construct to call usleep with zero delay too + do + { + dwActual_us = dwRest_us; + if (dwActual_us > 500000) + dwActual_us = 500000; + + dwRest_us -= dwActual_us; + + usleep (dwActual_us); + } + while (dwRest_us); + } + + +/* +************************************************************************** +Keyboard workaround functions +************************************************************************** +*/ + + + int cGetch() + { + static int ch = -1, fd = 0; + struct termios stTerm, stOldTerm; + + fd = fileno(stdin); + tcgetattr(fd, &stOldTerm); + stTerm = stOldTerm; + stTerm.c_lflag &= ~(ICANON|ECHO); + tcsetattr(fd, TCSANOW, &stTerm); + ch = getchar(); + tcsetattr(fd, TCSANOW, &stOldTerm); + + return ch; + } + +// *********************************************************************** + +int bKbhit(void) + { + struct termios stTerm, stOldTerm; + int fd = 0; + int c = 0; + + tcgetattr(fd, &stOldTerm); + memcpy(&stTerm, &stOldTerm, sizeof (stOldTerm)); + stTerm.c_lflag = stTerm.c_lflag & (!ICANON); + stTerm.c_cc[VMIN] = 0; + stTerm.c_cc[VTIME] = 1; + tcsetattr(fd, TCSANOW, &stTerm); + c = getchar(); + tcsetattr(fd, TCSANOW, &stOldTerm); + if (c != -1) + ungetc (c, stdin); + + return ((c != -1) ? 1 : 0); + } + + + +/* +************************************************************************** +memory allocation (page aligned) +************************************************************************** +*/ + +void* pvAllocMemPageAligned (uint64 qwBytes) + { + void* pvTmp; + int fd = open ("/dev/zero", O_RDONLY); + pvTmp = (void*) mmap (NULL, qwBytes, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); + + // set everything to zero to get memory allocated in physical mem + if (pvTmp != MAP_FAILED) + memset (pvTmp, 0, qwBytes); + else + pvTmp = NULL; + + close (fd); + return (pvTmp); + } + +// *********************************************************************** + +void vFreeMemPageAligned (void* pvAdr, uint64 qwBytes) + { + munmap (pvAdr, qwBytes); + } + + + +/* +************************************************************************** +Thread functions +************************************************************************** +*/ + +bool spcm_bCreateThread (SPCM_THREADFUNCTION* pfnThread, SPCM_THREAD_HANDLE* phThread, void* pvArguments) + { + pthread_create (phThread, NULL, pfnThread, pvArguments); + + return ((*phThread) != 0); + } + +// *********************************************************************** + +void spcm_vCloseThread (SPCM_THREAD_HANDLE* phThread) + { + pthread_detach (*phThread); + } + +// *********************************************************************** + +void spcm_vSetThreadPriority (SPCM_THREAD_HANDLE* phThread, SPCM_THREADPRIO ePriority) + { + struct sched_param stSchedParams; + int32 lPolicy; + pthread_getschedparam (*phThread, &lPolicy, &stSchedParams); + if (lPolicy == SCHED_OTHER) + { + switch (ePriority) + { + case ePrioMin: + stSchedParams.sched_priority = 5; // we are nice + break; + case ePrioNormal: + stSchedParams.sched_priority = 0; // we are normally nice + break; + case ePrioMax: + stSchedParams.sched_priority = -5; // we are not so nice + break; + } + } + else + { + int lPrioMin = sched_get_priority_min (lPolicy); + int lPrioMax = sched_get_priority_max (lPolicy); + switch (ePriority) + { + case ePrioMin: + stSchedParams.sched_priority = (lPrioMax - lPrioMin) / 4; + break; + case ePrioNormal: + stSchedParams.sched_priority = (lPrioMax - lPrioMin) / 2; + break; + case ePrioMax: + stSchedParams.sched_priority = 3 * (lPrioMax - lPrioMin) / 4; + break; + } + } + + pthread_setschedparam (*phThread, lPolicy, &stSchedParams); + } + +// *********************************************************************** + +void spcm_vJoinThread (SPCM_THREAD_HANDLE* phThread, uint32 /*dwTimeout_ms*/) + { + pthread_join (*phThread, NULL); + } + +// *********************************************************************** + +void spcm_vSuspendThread (uint32) + { + sched_yield(); + } + + + +/* +************************************************************************** +Event functions +************************************************************************** +*/ + +bool spcm_bCreateEvent (SPCM_EVENT_HANDLE* phEvent) + { + return (pthread_cond_init (phEvent, NULL) == 0); + } + +// *********************************************************************** + +void spcm_vCloseEvent (SPCM_EVENT_HANDLE* phEvent) + { + pthread_cond_destroy (phEvent); + } + +// *********************************************************************** + +bool spcm_bWaitEventWithMutex (SPCM_EVENT_HANDLE* phEvent, SPCM_MUTEX_HANDLE* phMutex, uint32 dwTimeoutMS) + { + struct timespec ts; + struct timeval tp; + bool bRet; + + // get the current time and convert from timeval to timespec + if (dwTimeoutMS) + { + gettimeofday(&tp, NULL); + ts.tv_sec = tp.tv_sec; + ts.tv_nsec = tp.tv_usec * 1000; + + // add my wait time + ts.tv_sec += ((ts.tv_nsec / 1000 / 1000) + dwTimeoutMS) / 1000; + ts.tv_nsec = (((ts.tv_nsec / 1000 / 1000) + dwTimeoutMS) % 1000) * 1000 * 1000; + + bRet = (pthread_cond_timedwait (phEvent, phMutex, &ts) == 0); + } + + // no timeout specified, we wait forever + else + bRet = (pthread_cond_wait (phEvent, phMutex) == 0); + + return bRet; + } + +// *********************************************************************** + +void spcm_vWaitEvent (SPCM_EVENT_HANDLE* phEvent) + { + pthread_mutex_t hTmpMutex; + + pthread_mutex_init (&hTmpMutex, NULL); + pthread_mutex_lock (&hTmpMutex); + pthread_cond_wait (phEvent, &hTmpMutex); + pthread_mutex_destroy (&hTmpMutex); + } + +// *********************************************************************** + +void spcm_vSignalEvent (SPCM_EVENT_HANDLE* phEvent) + { + pthread_cond_signal (phEvent); + } + + + +/* +************************************************************************** +mutex functions +************************************************************************** +*/ + +bool spcm_bCreateMutex (SPCM_MUTEX_HANDLE* phMutex) + { + // as default Mutexes are recursive on Windows, but not on Linux, + // so to avoid different behaviour we also use recursive mutexes here + pthread_mutexattr_t ma; + pthread_mutexattr_init (&ma); + pthread_mutexattr_settype (&ma, PTHREAD_MUTEX_RECURSIVE); + return (pthread_mutex_init (phMutex, &ma) == 0); + } + +// *********************************************************************** + +void spcm_vCloseMutex (SPCM_MUTEX_HANDLE* phMutex) + { + pthread_mutex_destroy (phMutex); + } + +// *********************************************************************** + +void spcm_vGetMutex (SPCM_MUTEX_HANDLE* phMutex) + { + pthread_mutex_lock (phMutex); + } + +// *********************************************************************** + +void spcm_vReleaseMutex (SPCM_MUTEX_HANDLE* phMutex) + { + pthread_mutex_unlock (phMutex); + } + + + +/* +************************************************************************** +system information functions +************************************************************************** +*/ + +uint64 qwGetTotalPhysicalMemory () + { + struct sysinfo stSysInfo; + sysinfo (&stSysInfo); + return ((uint64)stSysInfo.totalram) * stSysInfo.mem_unit; + } + +uint64 qwGetTotalVirtualMemory () + { +#ifdef _LINUX64 + return (uint64)8 * 1024 * 1024 * 1024 * 1024; // 8TB, value taken from 64-Bit Windows +#else // 32 bit + return (uint64)3 * 1024 * 1024 * 1024; // 3GB for user-space in linux systems +#endif + } + + +/* +************************************************************************** +Copy data to clipboard +************************************************************************** +*/ +void vCopyToClipboard (const char* /*szText*/, size_t /*dwLen*/) + { + // not yet implemented + } + +} // end of SPCM_NAMESPACE diff --git a/Cpp/examples/c_cpp/common/ostools/spcm_ostools_qnx.cpp b/Cpp/examples/c_cpp/common/ostools/spcm_ostools_qnx.cpp new file mode 100644 index 0000000000000000000000000000000000000000..47383fa10ba5e16b7a882fdd97588cf2e0e99114 --- /dev/null +++ b/Cpp/examples/c_cpp/common/ostools/spcm_ostools_qnx.cpp @@ -0,0 +1,387 @@ +/* +************************************************************************** + +spcm_ostools_qnx.cpp (c) Spectrum GmbH + +************************************************************************** + +toosl functions that differ from OS to OS: +- Threads +- Events + +************************************************************************** +*/ + +#include "../../c_header/dlltyp.h" + +#include "spcm_oswrap.h" +#include "spcm_ostools.h" + +#include "../kernel/spcm_kernel.h" + +#include <fcntl.h> +#include <sys/mman.h> +#include <sys/time.h> +#include <sys/syspage.h> + +#include <pthread.h> +#include <cstring> +#include <cstdio> +#include <termios.h> +#include <ctime> +#include <unistd.h> + +#include <cerrno> + +// we're using this namespace in our program +namespace SPCM_NAMESPACE { + +using namespace std; + +/* +************************************************************************** +GetTickCount: fake windows GetTickCount function for QNX +************************************************************************** +*/ + +uint32 dwGetTickCount () + { + struct timespec ts; + clock_gettime (0, &ts); + return (uint32) 1000 * ts.tv_sec + ts.tv_nsec / 1000000; + } + + +/* +************************************************************************** +Sleep: suspend the thread for the number of ms + On some systems is the usleep parameter limited to 1000000. +************************************************************************** +*/ + +void Sleep (uint32 dwMS) + { + uint32 dwRest_us, dwActual_us; + + dwRest_us = dwMS * 1000; + + // do/while construct to call usleep with zero delay too + do + { + dwActual_us = dwRest_us; + if (dwActual_us > 500000) + dwActual_us = 500000; + + dwRest_us -= dwActual_us; + + usleep (dwActual_us); + } + while (dwRest_us); + } + + +/* +************************************************************************** +Keyboard workaround functions +************************************************************************** +*/ + + + int cGetch () + { + static int ch = -1, fd = 0; + struct termios stTerm, stOldTerm; + + fd = fileno(stdin); + tcgetattr(fd, &stOldTerm); + stTerm = stOldTerm; + stTerm.c_lflag &= ~(ICANON|ECHO); + tcsetattr(fd, TCSANOW, &stTerm); + ch = getchar(); + tcsetattr(fd, TCSANOW, &stOldTerm); + + return ch; + } + +// *********************************************************************** + +int bKbhit () + { + struct termios stTerm, stOldTerm; + int fd = 0; + int c = 0; + + tcgetattr(fd, &stOldTerm); + memcpy(&stTerm, &stOldTerm, sizeof (stOldTerm)); + stTerm.c_lflag = stTerm.c_lflag & (!ICANON); + stTerm.c_cc[VMIN] = 0; + stTerm.c_cc[VTIME] = 1; + tcsetattr(fd, TCSANOW, &stTerm); + c = getchar(); + tcsetattr(fd, TCSANOW, &stOldTerm); + if (c != -1) + ungetc (c, stdin); + + return ((c != -1) ? 1 : 0); + } + + + +/* +************************************************************************** +memory allocation (page aligned) +************************************************************************** +*/ + +void* pvAllocMemPageAligned (uint64 qwBytes) + { + void* pvTmp; + int fd = open ("/dev/zero", O_RDONLY); + pvTmp = (void*) mmap (NULL, qwBytes, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); + + // set everything to zero to get memory allocated in physical mem + if (pvTmp != MAP_FAILED) + memset (pvTmp, 0, qwBytes); + else + pvTmp = NULL; + + close (fd); + return (pvTmp); + } + +// *********************************************************************** + +void vFreeMemPageAligned (void* pvAdr, uint64 qwBytes) + { + munmap (pvAdr, qwBytes); + } + + + +/* +************************************************************************** +Thread functions +************************************************************************** +*/ + +bool spcm_bCreateThread (SPCM_THREADFUNCTION* pfnThread, SPCM_THREAD_HANDLE* phThread, void* pvArguments) + { + return (pthread_create (phThread, NULL, pfnThread, pvArguments) == EOK); + } + +// *********************************************************************** + +void spcm_vCloseThread (SPCM_THREAD_HANDLE* phThread) + { + pthread_detach (*phThread); + } + +// *********************************************************************** + +void spcm_vSetThreadPriority (SPCM_THREAD_HANDLE* phThread, SPCM_THREADPRIO ePriority) + { + struct sched_param stSchedParams; + int32 lPolicy; + pthread_getschedparam (*phThread, &lPolicy, &stSchedParams); + if (lPolicy == SCHED_OTHER) + { + switch (ePriority) + { + case ePrioMin: + stSchedParams.sched_priority = 5; // we are nice + break; + case ePrioNormal: + stSchedParams.sched_priority = 0; // we are normally nice + break; + case ePrioMax: + stSchedParams.sched_priority = -5; // we are not so nice + break; + } + } + else + { + int lPrioMin = sched_get_priority_min (lPolicy); + int lPrioMax = sched_get_priority_max (lPolicy); + switch (ePriority) + { + case ePrioMin: + stSchedParams.sched_priority = (lPrioMax - lPrioMin) / 4; + break; + case ePrioNormal: + stSchedParams.sched_priority = (lPrioMax - lPrioMin) / 2; + break; + case ePrioMax: + stSchedParams.sched_priority = 3 * (lPrioMax - lPrioMin) / 4; + break; + } + } + + pthread_setschedparam (*phThread, lPolicy, &stSchedParams); + } + +// *********************************************************************** + +void spcm_vJoinThread (SPCM_THREAD_HANDLE* phThread, uint32 /*dwTimeout_ms*/) + { + pthread_join (*phThread, NULL); + } + +// *********************************************************************** + +void spcm_vSuspendThread (uint32) + { + //pthread_yield (); + sched_yield (); // TODO: guter Ersatz? + } + + + +/* +************************************************************************** +Event functions +************************************************************************** +*/ + +bool spcm_bCreateEvent (SPCM_EVENT_HANDLE* phEvent) + { + // Set up the condvar attributes to use CLOCK_MONOTONIC + pthread_condattr_t attr; + pthread_condattr_init( &attr); + pthread_condattr_setclock( &attr, CLOCK_MONOTONIC); + + return (pthread_cond_init (phEvent, &attr) == EOK); + } + +// *********************************************************************** + +void spcm_vCloseEvent (SPCM_EVENT_HANDLE* phEvent) + { + pthread_cond_destroy (phEvent); + } + +// *********************************************************************** + +bool spcm_bWaitEventWithMutex (SPCM_EVENT_HANDLE* phEvent, SPCM_MUTEX_HANDLE* phMutex, uint32 dwTimeoutMS) + { + bool bRet; + + if (dwTimeoutMS) + { + struct timespec stTimeSpec; + clock_gettime (CLOCK_MONOTONIC, &stTimeSpec); + + // add my wait time + stTimeSpec.tv_sec += ((stTimeSpec.tv_sec) + dwTimeoutMS) / 1000; + stTimeSpec.tv_nsec = (((stTimeSpec.tv_nsec / 1000 / 1000) + dwTimeoutMS) % 1000) * 1000 * 1000; + + bRet = (pthread_cond_timedwait (phEvent, phMutex, &stTimeSpec) == 0); + } + + // no timeout specified, we wait forever + else + bRet = (pthread_cond_wait (phEvent, phMutex) == 0); + + return bRet; + } + +// *********************************************************************** + +void spcm_vWaitEvent (SPCM_EVENT_HANDLE* phEvent) + { + pthread_mutex_t hTmpMutex; + + pthread_mutex_init (&hTmpMutex, NULL); + pthread_mutex_lock (&hTmpMutex); + pthread_cond_wait (phEvent, &hTmpMutex); + pthread_mutex_destroy (&hTmpMutex); + } + +// *********************************************************************** + +void spcm_vSignalEvent (SPCM_EVENT_HANDLE* phEvent) + { + pthread_cond_signal (phEvent); + } + + + +/* +************************************************************************** +mutex functions +************************************************************************** +*/ + +bool spcm_bCreateMutex (SPCM_MUTEX_HANDLE* phMutex) + { + return (pthread_mutex_init (phMutex, NULL) == EOK); + } + +// *********************************************************************** + +void spcm_vCloseMutex (SPCM_MUTEX_HANDLE* phMutex) + { + pthread_mutex_destroy (phMutex); + } + +// *********************************************************************** + +void spcm_vGetMutex (SPCM_MUTEX_HANDLE* phMutex) + { + pthread_mutex_lock (phMutex); + } + +// *********************************************************************** + +void spcm_vReleaseMutex (SPCM_MUTEX_HANDLE* phMutex) + { + pthread_mutex_unlock (phMutex); + } + + + +/* +************************************************************************** +system information functions +************************************************************************** +*/ + +uint64 qwGetTotalPhysicalMemory () + { + struct asinfo_entry* pstEntries = SYSPAGE_ENTRY(asinfo); + size_t count = SYSPAGE_ENTRY_SIZE(asinfo) / sizeof(struct asinfo_entry); + char* szStrings = SYSPAGE_ENTRY(strings)->data; + + uint64 qwTotal = 0; + for (size_t i = 0; i < count; i++) + { + struct asinfo_entry* pstEntry = &pstEntries[i]; + if (strcmp (szStrings + pstEntry->name, "ram") == 0) + { + qwTotal += pstEntry->end - pstEntry->start + 1; + } + } + + return qwTotal; + } + +uint64 qwGetTotalVirtualMemory () + { +#ifdef _LINUX64 + return (uint64)8 * 1024 * 1024 * 1024 * 1024; // 8TB, value taken from 64-Bit Windows +#else // 32 bit + return (uint64)3 * 1024 * 1024 * 1024; // 3GB for user-space in QNX systems +#endif + } + + +/* +************************************************************************** +Copy data to clipboard +************************************************************************** +*/ +void vCopyToClipboard (const char* szText, size_t dwLen) + { + // not yet implemented + } + +} // end of SPCM_NAMESPACE diff --git a/Cpp/examples/c_cpp/common/ostools/spcm_ostools_win.cpp b/Cpp/examples/c_cpp/common/ostools/spcm_ostools_win.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9b5740f81cd941b714645dbb417973c1df9c0580 --- /dev/null +++ b/Cpp/examples/c_cpp/common/ostools/spcm_ostools_win.cpp @@ -0,0 +1,299 @@ +/* +************************************************************************** + +spcm_ostools.cpp (c) Spectrum GmbH + +************************************************************************** + +toosl functions that differ from OS to OS: +- Threads +- Events + +************************************************************************** +*/ + +#include "../../c_header/dlltyp.h" + +#include "spcm_oswrap.h" +#include "spcm_ostools.h" + +#include <conio.h> + + +// we're using this namespace in our program +namespace SPCM_NAMESPACE { + + +uint32 dwGetTickCount () + { + return ::GetTickCount (); + } + +void vSleep_ms (unsigned int dwMS) + { + ::Sleep (dwMS); + } + +// For easy (one-liner) debugging purpose (scope measurements) like: +// while (dwSleep_ms (123)) +// FunctionToRepeatedlyTestWithDelay (); +uint32 dwSleep_ms (unsigned int dwMS) + { + vSleep_ms (dwMS); + return dwMS; + } + +/* +************************************************************************** +Keyboard functions (wrapped for combined linux/windows use) +************************************************************************** +*/ + +int bKbhit(void) + { + return _kbhit(); + } + +// *********************************************************************** + +int cGetch() + { + return _getch(); + } + + + +/* +************************************************************************** +Thread functions +************************************************************************** +*/ + +bool spcm_bCreateThread (SPCM_THREADFUNCTION* pfnThread, SPCM_THREAD_HANDLE* phThread, void* pvArguments) + { + uint32 dwThreadId; + + (*phThread) = CreateThread (NULL, 0, pfnThread, pvArguments, 0, &dwThreadId); + + return ((*phThread) != NULL); + } + +// *********************************************************************** + +void spcm_vCloseThread (SPCM_THREAD_HANDLE* phThread) + { + if (*phThread) + CloseHandle (*phThread); + } + +// *********************************************************************** + +void spcm_vJoinThread (SPCM_THREAD_HANDLE* phThread, uint32 dwTimeout_ms) + { + WaitForSingleObject (*phThread, dwTimeout_ms ? dwTimeout_ms : INFINITE); + } + +// *********************************************************************** + +void spcm_vSetThreadPriority (SPCM_THREAD_HANDLE* phThread, SPCM_THREADPRIO ePriority) + { + switch (ePriority) + { + case ePrioMin: + SetThreadPriority (*phThread, THREAD_PRIORITY_BELOW_NORMAL); + break; + case ePrioNormal: + SetThreadPriority (*phThread, THREAD_PRIORITY_NORMAL); + break; + case ePrioMax: + SetThreadPriority (*phThread, THREAD_PRIORITY_ABOVE_NORMAL); + break; + } + } + +// *********************************************************************** + +void spcm_vSuspendThread (uint32 dwMS) + { + Sleep (dwMS); + } + + +/* +************************************************************************** +Event functions +************************************************************************** +*/ + +bool spcm_bCreateEvent (SPCM_EVENT_HANDLE* phEvent) + { + (*phEvent) = CreateEvent (NULL, false, false, NULL); + return ((*phEvent) != NULL); + } + +// *********************************************************************** + +void spcm_vCloseEvent (SPCM_EVENT_HANDLE* phEvent) + { + if (*phEvent) + CloseHandle (*phEvent); + } + +// *********************************************************************** + +bool spcm_bWaitEventWithMutex (SPCM_EVENT_HANDLE* phEvent, SPCM_MUTEX_HANDLE* phMutex, uint32 dwTimeoutMS) + { + uint32 dwReturn; + + // release the mutex, wait for the event and get the mutex again + LeaveCriticalSection (phMutex); + dwReturn = WaitForSingleObject ((*phEvent), dwTimeoutMS ? dwTimeoutMS : INFINITE); + EnterCriticalSection (phMutex); + + return (dwReturn != WAIT_TIMEOUT); + } + +// *********************************************************************** + +void spcm_vWaitEvent (SPCM_EVENT_HANDLE* phEvent) + { + WaitForSingleObject ((*phEvent), INFINITE); + } + +// *********************************************************************** + +void spcm_vSignalEvent (SPCM_EVENT_HANDLE* phEvent) + { + SetEvent (*phEvent); + } + + + +/* +************************************************************************** +Mutex functions (we use CriticalSection here to speed it up!) +************************************************************************** +*/ + +bool spcm_bCreateMutex (SPCM_MUTEX_HANDLE* phMutex) + { + InitializeCriticalSection (phMutex); + return true; + } + +// *********************************************************************** + +void spcm_vCloseMutex (SPCM_MUTEX_HANDLE* phMutex) + { + if (phMutex) + DeleteCriticalSection (phMutex); + } + +// *********************************************************************** + +void spcm_vGetMutex (SPCM_MUTEX_HANDLE* phMutex) + { + EnterCriticalSection (phMutex); + } + +// *********************************************************************** + +void spcm_vReleaseMutex (SPCM_MUTEX_HANDLE* phMutex) + { + LeaveCriticalSection (phMutex); + } + + + +/* +************************************************************************** +Data allocation functions +************************************************************************** +*/ + +void* pvAllocMemPageAligned (uint64 qwBytes) + { + // for unknown reasons VirtualAlloc/VirtualFree leaks memory if qwBytes < 4096 (page size) + // therefore use _aligned_malloc () to get small amounts of page aligned memory + if (qwBytes >= 4096) + return VirtualAlloc (NULL, (size_t) qwBytes, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); + else + { + void* pvMem = _aligned_malloc ((size_t) qwBytes, 4096); + if (pvMem == NULL) + return NULL; + memset (pvMem, 0, (size_t) qwBytes); + return pvMem; + } + } + +// *********************************************************************** + +void vFreeMemPageAligned (void* pvMemory, uint64 qwBytes) + { + // for unknown reasons VirtualAlloc/VirtualFree leaks memory if qwBytes < 4096 (page size) + // therefore use _aligned_malloc () to get small amounts of page aligned memory + if (qwBytes >= 4096) + VirtualFree (pvMemory, 0, MEM_RELEASE); + else + _aligned_free (pvMemory); + } + +/* +************************************************************************** +System information functions +It is not possible to compile this function with the default SDK of +Visual Studio 6.0. +************************************************************************** +*/ + +#if defined (_MSC_VER) && (_MSC_VER >= 1300) + uint64 qwGetTotalPhysicalMemory () + { + MEMORYSTATUSEX stMemoryStatus; + stMemoryStatus.dwLength = sizeof (stMemoryStatus); + GlobalMemoryStatusEx (&stMemoryStatus); + return stMemoryStatus.ullTotalPhys; + } + + uint64 qwGetTotalVirtualMemory () + { + MEMORYSTATUSEX stMemoryStatus; + stMemoryStatus.dwLength = sizeof (stMemoryStatus); + GlobalMemoryStatusEx (&stMemoryStatus); + return stMemoryStatus.ullTotalVirtual; + } +#endif + + +/* +************************************************************************** +Copy data to clipboard +************************************************************************** +*/ +void vCopyToClipboard (const char* szText, size_t dwLen) + { + HGLOBAL hMemory = GlobalAlloc (GMEM_MOVEABLE, dwLen + 1); + if (!hMemory) + return; + + LPVOID pvLockedMem = GlobalLock (hMemory); + if (!pvLockedMem) + { + GlobalFree (hMemory); + return; + } + + memcpy (pvLockedMem, szText, dwLen + 1); + GlobalUnlock (hMemory); + if (OpenClipboard (NULL)) + { + if (EmptyClipboard ()) + { + SetClipboardData (CF_TEXT, hMemory); // system takes ownership of hMemory! + CloseClipboard (); + } + } + } + +} // end of namespace SPCM_NAMESPACE diff --git a/Cpp/examples/c_cpp/common/ostools/spcm_oswrap.h b/Cpp/examples/c_cpp/common/ostools/spcm_oswrap.h new file mode 100644 index 0000000000000000000000000000000000000000..c9e0e1baba0c5acd8e0ac6e13db8748752c399e5 --- /dev/null +++ b/Cpp/examples/c_cpp/common/ostools/spcm_oswrap.h @@ -0,0 +1,73 @@ +#ifndef SPCM_OSWRAP_H +#define SPCM_OSWRAP_H + + + +/* +************************************************************************** + +spcm_oswrap.h (c) Spectrum GmbH , 08/2005 + +************************************************************************** + +Contains some wrapper functions, OS specific defines and OS specific +includes to make the source compilable independant of the operating +system + +************************************************************************** +*/ + + + + + +/* +************************************************************************** +Windows +************************************************************************** +*/ + +#ifdef WIN32 + +// ----- Windows specific includes ----- +# include <wtypes.h> + +// ----- Windows specific defines +# define NULL_HANDLE NULL +# define SPCM_THREAD_RETURN uint32 +# define SPCM_THREAD_CALLTYPE _stdcall + +// ----- handles ----- +# define SPCM_THREAD_HANDLE HANDLE +# define SPCM_EVENT_HANDLE HANDLE +# define SPCM_MUTEX_HANDLE CRITICAL_SECTION + +# ifdef _MSC_VER +# if (_MSC_VER < 1900) // 1900 = VS2015 +# define snprintf _snprintf +# endif +# endif + + +/* +************************************************************************** +Linux +************************************************************************** +*/ +#else +# include <unistd.h> +# include <pthread.h> + +// ----- Linux specific defines ----- +# define NULL_HANDLE 0 +# define _stdcall +# define SPCM_THREAD_RETURN void* +# define SPCM_THREAD_CALLTYPE + +// ----- handles ----- +# define SPCM_THREAD_HANDLE pthread_t +# define SPCM_EVENT_HANDLE pthread_cond_t +# define SPCM_MUTEX_HANDLE pthread_mutex_t +#endif + +#endif //#ifndef SPCM_OSWRAP_H diff --git a/Cpp/examples/c_cpp/common/spcm_lib_card.cpp b/Cpp/examples/c_cpp/common/spcm_lib_card.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e543de8932d41cf830c55ab84c3e63c18f25ef50 --- /dev/null +++ b/Cpp/examples/c_cpp/common/spcm_lib_card.cpp @@ -0,0 +1,1818 @@ +/* +************************************************************************** + +spcm_lib_card.cpp (c) Spectrum GmbH + +************************************************************************** + +Supplies different common functions for C/C++ programs accessing the +SpcM driver interface. Feel free to use this source for own projects and +modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_card.h" + +// ----- standard c include files ----- +#include <cstdio> +#include <cstring> +#include <cstdlib> + + + +/* +************************************************************************** +************************************************************************** +************************************************************************** + Initialisation and error handling +************************************************************************** +************************************************************************** +************************************************************************** +*/ + + + +/* +************************************************************************** +bSpcMInitCardByIdx: + +opens the driver with the given indes, reads out card information and +fills the CARDINFO structure +************************************************************************** +*/ + +bool bSpcMInitCardByName (ST_SPCM_CARDINFO *pstCardInfo, char* szDrvName); + +bool bSpcMInitCardByIdx (ST_SPCM_CARDINFO *pstCardInfo, int32 lCardIdx) + { + if (!pstCardInfo) + return false; + + // open the driver for card. We can use the linux notation here as the windows driver + // only looks for the ending number. Change this line if the linux drivers are named + // different than default + char szDrvName[20]; + sprintf (szDrvName, "/dev/spcm%d", lCardIdx); + return bSpcMInitCardByName (pstCardInfo, szDrvName); + } + +bool bSpcMInitCardByIdx (ST_SPCM_CARDINFO *pstCardInfo, const char* szIP, int32 lCardIdx) + { + if (!pstCardInfo) + return false; + + char szVISA[50]; + sprintf (szVISA, "TCPIP::%s::inst%d::INSTR", szIP, lCardIdx); + return bSpcMInitCardByName (pstCardInfo, szVISA); + } + +bool bSpcMInitCardByName (ST_SPCM_CARDINFO *pstCardInfo, char* szDrvName) + { + int32 lTmp; + + // clear the card info to have defined values + memset ((void*) pstCardInfo, 0, sizeof(ST_SPCM_CARDINFO)); + pstCardInfo->lSetChannels = 1; + pstCardInfo->llSetSamplerate = 1; + + + pstCardInfo->hDrv = spcm_hOpen (szDrvName); + if (!pstCardInfo->hDrv) + { + pstCardInfo->lErrorCode = spcm_dwGetErrorInfo_i32 (pstCardInfo->hDrv, NULL, NULL, pstCardInfo->szError); + + // card might be just "in use", and we can display some more info then + spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_PCITYP, &pstCardInfo->lCardType); + spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_PCISERIALNO, &pstCardInfo->lSerialNumber); + + return false; + } + + // ----- get index of card from name ----- + if (strncmp (szDrvName, "TCPIP", 5) == 0) + { + // if VISA-String contains instX, we extract the number + // otherwise we default to zero + char* szInst = strstr (szDrvName, "inst"); + if (szInst != NULL) + pstCardInfo->lCardIdx = atoi (strpbrk (szInst, "0123456789")); + else + pstCardInfo->lCardIdx = 0; + + pstCardInfo->bRemote = true; + } + else + { + // name should be /dev/spcmX or just a number, so we locate first number in string + // and convert it to integer + pstCardInfo->lCardIdx = atoi (strpbrk (szDrvName, "0123456789")); + } + + // read out card information and store it in the card info structure + spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_PCITYP, &pstCardInfo->lCardType); + spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_PCISERIALNO, &pstCardInfo->lSerialNumber); + spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_PCIFEATURES, &pstCardInfo->lFeatureMap); + spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_PCIEXTFEATURES, &pstCardInfo->lExtFeatureMap); + spcm_dwGetParam_i64 (pstCardInfo->hDrv, SPC_PCIMEMSIZE, &pstCardInfo->llInstMemBytes); + spcm_dwGetParam_i64 (pstCardInfo->hDrv, SPC_MIINST_MINADCLOCK, &pstCardInfo->llMinSamplerate); + spcm_dwGetParam_i64 (pstCardInfo->hDrv, SPC_MIINST_MAXADCLOCK, &pstCardInfo->llMaxSamplerate); + spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_MIINST_MODULES, &pstCardInfo->lModulesCount); + spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_MIINST_CHPERMODULE, &pstCardInfo->lMaxChannels); + spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_MIINST_BYTESPERSAMPLE, &pstCardInfo->lBytesPerSample); + spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_GETDRVVERSION, &pstCardInfo->lLibVersion); + spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_GETKERNELVERSION, &pstCardInfo->lKernelVersion); + + + // fill in the examples flags + pstCardInfo->bM2i = false; + pstCardInfo->bM3i = false; + pstCardInfo->bM4i = false; + pstCardInfo->bM2p = false; + pstCardInfo->bM5i = false; + switch (pstCardInfo->lCardType & TYP_SERIESMASK) + { + case TYP_M2ISERIES: pstCardInfo->bM2i = true; break; + case TYP_M2IEXPSERIES: pstCardInfo->bM2i = true; break; + case TYP_M3ISERIES: pstCardInfo->bM3i = true; break; + case TYP_M3IEXPSERIES: pstCardInfo->bM3i = true; break; + case TYP_M4IEXPSERIES: pstCardInfo->bM4i = true; break; + case TYP_M4XEXPSERIES: pstCardInfo->bM4i = true; break; + case TYP_M2PEXPSERIES: pstCardInfo->bM2p = true; break; + case TYP_M5IEXPSERIES: pstCardInfo->bM5i = true; break; + default: break; + } + + spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_PCIVERSION, &lTmp); + pstCardInfo->lBaseHwVersion = (lTmp >> 16) & 0xffff; + pstCardInfo->lCtrlFwVersion = lTmp & 0xffff; + + spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_PCIMODULEVERSION, &lTmp); + pstCardInfo->lModHwVersion = (lTmp >> 16) & 0xffff; + pstCardInfo->lModFwVersion = lTmp & 0xffff; + + // we need to recalculate the channels value as the driver returns channels per module + pstCardInfo->lMaxChannels *= pstCardInfo->lModulesCount; + + // examin the type of driver + int32 lFncType; + spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_FNCTYPE, &lFncType); + + switch (lFncType) + { + case SPCM_TYPE_AI: pstCardInfo->eCardFunction = AnalogIn; break; + case SPCM_TYPE_AO: pstCardInfo->eCardFunction = AnalogOut; break; + case SPCM_TYPE_DI: pstCardInfo->eCardFunction = DigitalIn; break; + case SPCM_TYPE_DO: pstCardInfo->eCardFunction = DigitalOut; break; + case SPCM_TYPE_DIO: pstCardInfo->eCardFunction = DigitalIO; break; + } + + // loading the function dependant part of the CardInfo structure + switch (pstCardInfo->eCardFunction) + { + case AnalogIn: + { + int i; + int32 lAIFeatures; + + spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_MIINST_BITSPERSAMPLE, &pstCardInfo->uCfg.stAI.lResolution); + spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_READAIPATHCOUNT, &pstCardInfo->uCfg.stAI.lPathCount); + for (int32 lPath = 0; lPath < pstCardInfo->uCfg.stAI.lPathCount; ++lPath) + { + spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_READAIPATH, lPath); + + spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_READIRCOUNT, &pstCardInfo->uCfg.stAI.astPath[lPath].lRangeCount); + for (i=0; (i<pstCardInfo->uCfg.stAI.astPath[lPath].lRangeCount) && (i<SPCM_MAX_AIRANGE); i++) + { + spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_READRANGEMIN0 + i, &pstCardInfo->uCfg.stAI.astPath[lPath].lRangeMin[i]); + spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_READRANGEMAX0 + i, &pstCardInfo->uCfg.stAI.astPath[lPath].lRangeMax[i]); + } + spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_READAIFEATURES, &lAIFeatures); + + pstCardInfo->uCfg.stAI.astPath[lPath].bInputTermAvailable = (lAIFeatures & SPCM_AI_TERM) != 0; + pstCardInfo->uCfg.stAI.astPath[lPath].bDiffModeAvailable = (lAIFeatures & SPCM_AI_DIFF) != 0; + pstCardInfo->uCfg.stAI.astPath[lPath].bACCouplingAvailable =(lAIFeatures & SPCM_AI_ACCOUPLING) != 0; + pstCardInfo->uCfg.stAI.astPath[lPath].bBWLimitAvailable = (lAIFeatures & SPCM_AI_LOWPASS) != 0; + pstCardInfo->uCfg.stAI.astPath[lPath].bOffsPercentMode = (lAIFeatures & SPCM_AI_OFFSPERCENT) != 0; + } + + // SPC_MIINST_MAXADCVALUE added with driver version 1.34, otherwise we have to calc it from the resolution + if (ERR_OK != spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_MIINST_MAXADCVALUE, &pstCardInfo->uCfg.stAI.lMaxADCValue)) + { + spcm_dwGetErrorInfo_i32 (pstCardInfo->hDrv, NULL, NULL, NULL); + switch (pstCardInfo->uCfg.stAI.lResolution) + { + case 8: pstCardInfo->uCfg.stAI.lMaxADCValue = 128; break; + case 12: pstCardInfo->uCfg.stAI.lMaxADCValue = 2048; break; + case 14: pstCardInfo->uCfg.stAI.lMaxADCValue = 8192; break; + default: + case 16: pstCardInfo->uCfg.stAI.lMaxADCValue = 32768; break; + } + } + + break; + } + + case AnalogOut: + { + int32 lAOFeatures; + + spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_READAOFEATURES, &lAOFeatures); + spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_MIINST_BITSPERSAMPLE, &pstCardInfo->uCfg.stAO.lResolution); + + pstCardInfo->uCfg.stAO.bGainProgrammable = (lAOFeatures & SPCM_AO_PROGGAIN) != 0; + pstCardInfo->uCfg.stAO.bOffsetProgrammable = (lAOFeatures & SPCM_AO_PROGOFFSET) != 0; + pstCardInfo->uCfg.stAO.bFilterAvailable = (lAOFeatures & SPCM_AO_PROGFILTER) != 0; + pstCardInfo->uCfg.stAO.bStopLevelProgrammable = (lAOFeatures & SPCM_AO_PROGSTOPLEVEL) != 0; + pstCardInfo->uCfg.stAO.bDiffModeAvailable = (lAOFeatures & SPCM_AO_DIFF) != 0; + + // SPC_MIINST_MAXADCVALUE added with driver version 1.34, otherwise we have to calc it from the resolution + if (ERR_OK != spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_MIINST_MAXADCVALUE, &pstCardInfo->uCfg.stAO.lMaxDACValue)) + { + spcm_dwGetErrorInfo_i32 (pstCardInfo->hDrv, NULL, NULL, NULL); + switch (pstCardInfo->uCfg.stAO.lResolution) + { + case 8: pstCardInfo->uCfg.stAO.lMaxDACValue = 127; break; + case 12: pstCardInfo->uCfg.stAO.lMaxDACValue = 2047; break; + case 14: pstCardInfo->uCfg.stAO.lMaxDACValue = 8191; break; + default: + case 16: pstCardInfo->uCfg.stAO.lMaxDACValue = 32767; break; + } + } + else + { + // since driver version build 3738 is the value incremented + if ((pstCardInfo->lLibVersion & 0xffff) >= 3738) + pstCardInfo->uCfg.stAO.lMaxDACValue--; + } + + break; + } + + case DigitalIn: + case DigitalOut: + case DigitalIO: + { + if ((pstCardInfo->eCardFunction == DigitalIn) || (pstCardInfo->eCardFunction == DigitalIO)) + { + int32 lDIFeatures; + spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_READDIFEATURES, &lDIFeatures); + + pstCardInfo->uCfg.stDIO.bInputTermAvailable = (lDIFeatures & SPCM_DI_TERM) != 0; + pstCardInfo->uCfg.stDIO.bDiffModeAvailable = (lDIFeatures & SPCM_DI_DIFF) != 0; + } + + if ((pstCardInfo->eCardFunction == DigitalOut) || (pstCardInfo->eCardFunction == DigitalIO)) + { + int32 lDOFeatures; + spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_READDOFEATURES, &lDOFeatures); + + pstCardInfo->uCfg.stDIO.bDiffModeAvailable = (lDOFeatures & SPCM_DO_DIFF) != 0; + pstCardInfo->uCfg.stDIO.bStopLevelProgrammable = (lDOFeatures & SPCM_DO_PROGSTOPLEVEL) != 0; + pstCardInfo->uCfg.stDIO.bOutputLevelProgrammable = (lDOFeatures & SPCM_DO_PROGOUTLEVELS) != 0; + } + + // grouping is the number of channels in one group, we recalculate this to the number of groups + spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_READCHGROUPING, &pstCardInfo->uCfg.stDIO.lGroups); + pstCardInfo->uCfg.stDIO.lGroups = pstCardInfo->lMaxChannels / pstCardInfo->uCfg.stDIO.lGroups; + + break; + } + + default: + break; + } + return true; + } + + + +/* +************************************************************************** +vSpcMCloseCard: + +closes the driver +************************************************************************** +*/ + +void vSpcMCloseCard (ST_SPCM_CARDINFO *pstCardInfo) + { + if (!pstCardInfo) + return; + + if (pstCardInfo->hDrv) + { + spcm_vClose (pstCardInfo->hDrv); + pstCardInfo->hDrv = NULL; + } + + } + + + +/* +************************************************************************** +nSpcMErrorMessageStdOut: + +prints the error message to std out and ends the driver if it's active +program can be left with this function +************************************************************************** +*/ + +int nSpcMErrorMessageStdOut (ST_SPCM_CARDINFO *pstCardInfo, const char* pszMessage, bool bPrintCardErr) + { + if (!pstCardInfo) + return -2; + + printf ("%s", pszMessage); + + if (bPrintCardErr) + printf ("%s", pstCardInfo->szError); + + if (pstCardInfo->hDrv) + vSpcMCloseCard (pstCardInfo); + pstCardInfo->hDrv = NULL; + + return -1; + } + + + +/* +************************************************************************** +pszSpcMTranslateRuntimeError: translates a runtime error code and prints + it to a given buffer +************************************************************************** +*/ + +char* pszSpcMTranslateRuntimeError (uint32 dwErrorCode, char* pszBuffer) + { + if (!pszBuffer) + return NULL; + + switch (dwErrorCode) + { + case ERR_OK: sprintf (pszBuffer, "No Error"); break; + case ERR_ABORT: sprintf (pszBuffer, "Abort of Wait Function by Stop Command"); break; + case ERR_TIMEOUT: sprintf (pszBuffer, "Timeout"); break; + case ERR_FIFOBUFOVERRUN: sprintf (pszBuffer, "FIFO SW Buffer Overrun (acquisition) or Underrun (replay)"); break; + case ERR_FIFOHWOVERRUN: sprintf (pszBuffer, "FIFO HW Buffer Overrun (acquisition) or Underrun (replay)"); break; + case ERR_FIFOFINISHED: sprintf (pszBuffer, "FIFO Mode finished"); break; + default: sprintf (pszBuffer, "Unknown Error Code %d", dwErrorCode); break; + } + + return pszBuffer; + } + + + +/* +************************************************************************** +pszSpcMPrintCardInfo: prints the card information to a string for display. +************************************************************************** +*/ + +void vStrCatWithLen (char* pszDest, char* pszSource, int32 lStrLen) + { + int nPos = 0; + + while ((nPos++ < lStrLen) && (*pszDest)) + pszDest++; + + while (nPos < lStrLen) + { + *pszDest++ = *pszSource++; + if (!(*pszSource)) + { + (*pszDest) = 0; + return; + } + } + } + +// ************************************************************************* + +char* pszSpcMPrintCardInfo (ST_SPCM_CARDINFO *pstCardInfo, char* pszBuffer, int32 lStrLen, bool bExtended) + { + char szTmp[100]; + + if (!pstCardInfo || !pszBuffer) + return NULL; + + memset (pszBuffer, 0, lStrLen); + + // the card type + serial number + switch (pstCardInfo->lCardType & TYP_SERIESMASK) + { + case TYP_M2ISERIES: sprintf (szTmp, "M2i.%04x sn %05d\n", (unsigned)(pstCardInfo->lCardType & TYP_VERSIONMASK), pstCardInfo->lSerialNumber); break; + case TYP_M2IEXPSERIES: sprintf (szTmp, "M2i.%04x-Exp sn %05d\n", (unsigned)(pstCardInfo->lCardType & TYP_VERSIONMASK), pstCardInfo->lSerialNumber); break; + case TYP_M3ISERIES: sprintf (szTmp, "M3i.%04x sn %05d\n", (unsigned)(pstCardInfo->lCardType & TYP_VERSIONMASK), pstCardInfo->lSerialNumber); break; + case TYP_M3IEXPSERIES: sprintf (szTmp, "M3i.%04x-Exp sn %05d\n", (unsigned)(pstCardInfo->lCardType & TYP_VERSIONMASK), pstCardInfo->lSerialNumber); break; + case TYP_M4IEXPSERIES: sprintf (szTmp, "M4i.%04x-x8 sn %05d\n", (unsigned)(pstCardInfo->lCardType & TYP_VERSIONMASK), pstCardInfo->lSerialNumber); break; + case TYP_M4XEXPSERIES: sprintf (szTmp, "M4x.%04x-x4 sn %05d\n", (unsigned)(pstCardInfo->lCardType & TYP_VERSIONMASK), pstCardInfo->lSerialNumber); break; + case TYP_M2PEXPSERIES: sprintf (szTmp, "M2p.%04x-x4 sn %05d\n", (unsigned)(pstCardInfo->lCardType & TYP_VERSIONMASK), pstCardInfo->lSerialNumber); break; + case TYP_M5IEXPSERIES: sprintf (szTmp, "M5i.%04x-x16 sn %05d\n", (unsigned)(pstCardInfo->lCardType & TYP_VERSIONMASK), pstCardInfo->lSerialNumber); break; + default: sprintf (szTmp, "Typ: %x not supported so far\n", (unsigned)pstCardInfo->lCardType); break; + } + vStrCatWithLen (pszBuffer, szTmp, lStrLen); + + // standard details of card + if (bExtended) + { + sprintf (szTmp, " Installed memory: %lld MByte\n", pstCardInfo->llInstMemBytes / 1024 / 1024); + vStrCatWithLen (pszBuffer, szTmp, lStrLen); + sprintf (szTmp, " Max sampling rate: %.1f MS/s\n", (double) pstCardInfo->llMaxSamplerate / 1000000); + vStrCatWithLen (pszBuffer, szTmp, lStrLen); + sprintf (szTmp, " Channels: %d\n", pstCardInfo->lMaxChannels); + vStrCatWithLen (pszBuffer, szTmp, lStrLen); + sprintf (szTmp, " Kernel Version: %d.%02d build %d\n", pstCardInfo->lKernelVersion >> 24, (pstCardInfo->lKernelVersion >> 16) & 0xff, pstCardInfo->lKernelVersion & 0xffff); + vStrCatWithLen (pszBuffer, szTmp, lStrLen); + sprintf (szTmp, " Library Version %d.%02d build %d\n", pstCardInfo->lLibVersion >> 24, (pstCardInfo->lLibVersion >> 16) & 0xff, pstCardInfo->lLibVersion & 0xffff); + vStrCatWithLen (pszBuffer, szTmp, lStrLen); + } + + return pszBuffer; + } + +/* +************************************************************************** +pszSpcMPrintDocumentationLink: builds a link to the download area for the specific card +************************************************************************** +*/ + +char* pszSpcMPrintDocumentationLink (const ST_SPCM_CARDINFO* pstCardInfo, char* pszBuffer, int32 lStrLen) + { + if (!pstCardInfo || !pszBuffer) + return NULL; + + memset (pszBuffer, 0, lStrLen); + + const char* szSeries = NULL; + if (pstCardInfo->bRemote) + szSeries = "DN2"; + else + { + switch (pstCardInfo->lCardType & TYP_SERIESMASK) + { + case TYP_M2ISERIES: szSeries = "M2i"; break; + case TYP_M2IEXPSERIES: szSeries = "\"M2i Express\""; break; + case TYP_M3ISERIES: szSeries = "M3i"; break; + case TYP_M3IEXPSERIES: szSeries = "\"M3i Express\""; break; + case TYP_M4IEXPSERIES: szSeries = "M4i"; break; + case TYP_M4XEXPSERIES: szSeries = "M4x"; break; + case TYP_M2PEXPSERIES: szSeries = "M2p"; break; + case TYP_M5IEXPSERIES: szSeries = "M5i"; break; + } + } + int lOffset = sprintf (pszBuffer, "A detailed description of the API as well as the hardware can be found in the manual:\n"); + lOffset += sprintf (pszBuffer + lOffset, "https://www.spectrum-instrumentation.com/en/downloads/drivers?Series=%s&Families=%xxx&Tab=Documents\n\n", szSeries, (unsigned)((pstCardInfo->lCardType & TYP_FAMILYMASK) >> 8)); + + lOffset += sprintf (pszBuffer + lOffset, "Further information can be found online in the Knowledge Base:\n"); + lOffset += sprintf (pszBuffer + lOffset, "https://www.spectrum-instrumentation.com/en/knowledge-base-overview\n\n"); + + return pszBuffer; + } + +/* +************************************************************************** +bSpcMCheckSetError: checks for error code and reads out error information +************************************************************************** +*/ + +bool bSpcMCheckSetError (uint32 dwError, ST_SPCM_CARDINFO *pstCardInfo) + { + if (dwError) + { + pstCardInfo->bSetError = true; + spcm_dwGetErrorInfo_i32 (pstCardInfo->hDrv, NULL, NULL, pstCardInfo->szError); + return false; + } + return true; + } + + + + +/* +************************************************************************** +************************************************************************** +************************************************************************** + Mode setup +************************************************************************** +************************************************************************** +************************************************************************** +*/ + + + +/* +************************************************************************** +bSpcMSetupModeRecStdSingle: record standard mode single +************************************************************************** +*/ + +bool bSpcMSetupModeRecStdSingle (ST_SPCM_CARDINFO *pstCardInfo, uint64 qwChEnable, int64 llMemSamples, int64 llPostSamples) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + + // setup the mode + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CARDMODE, SPC_REC_STD_SINGLE); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_CHENABLE, qwChEnable); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_MEMSIZE, llMemSamples); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_POSTTRIGGER, llPostSamples); + + // store some information in the structure + pstCardInfo->llSetMemsize = llMemSamples; + pstCardInfo->qwSetChEnableMap = qwChEnable; + if (!dwError) dwError = spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_CHCOUNT, &pstCardInfo->lSetChannels); + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +bSpcMSetupModeRecFIFOSingle: record FIFO mode single run +************************************************************************** +*/ + +bool bSpcMSetupModeRecFIFOSingle (ST_SPCM_CARDINFO *pstCardInfo, uint64 qwChEnable, int64 llPreSamples, int64 llBlockToRec, int64 llLoopToRec) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + + // check for invalid block/loop combinations + if ((llBlockToRec && !llLoopToRec) || (!llBlockToRec && llLoopToRec)) + { + sprintf (pstCardInfo->szError, "bSpcMSetupModeRecFIFOSingle: Loop and Blocks must be either both zero or both defined to non-zero\n"); + return false; + } + + // segment size can't be zero, we adjust it here + if (!llBlockToRec && !llLoopToRec) + llBlockToRec = 1024; + + // setup the mode + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CARDMODE, SPC_REC_FIFO_SINGLE); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_CHENABLE, qwChEnable); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_PRETRIGGER, llPreSamples); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_SEGMENTSIZE, llBlockToRec); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_LOOPS, llLoopToRec); + + // store some information in the structure + pstCardInfo->llSetMemsize = 0; + pstCardInfo->qwSetChEnableMap = qwChEnable; + if (!dwError) dwError = spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_CHCOUNT, &pstCardInfo->lSetChannels); + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + +/* +************************************************************************** +bSpcMSetupModeRecStdAverage: record standard mode Average +************************************************************************** +*/ + +bool bSpcMSetupModeRecStdAverage (ST_SPCM_CARDINFO *pstCardInfo, uint64 qwChEnable, int64 llMemSamples, int64 llSegmentSize, int64 llPostSamples, int32 lAverages) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + + // setup the mode + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CARDMODE, SPC_REC_STD_AVERAGE); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_CHENABLE, qwChEnable); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_MEMSIZE, llMemSamples); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_SEGMENTSIZE, llSegmentSize); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_POSTTRIGGER, llPostSamples); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_AVERAGES, lAverages); + + // store some information in the structure + pstCardInfo->llSetMemsize = llMemSamples; + pstCardInfo->qwSetChEnableMap = qwChEnable; + if (!dwError) dwError = spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_CHCOUNT, &pstCardInfo->lSetChannels); + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +bSpcMSetupModeRecStdMulti: record standard mode Multiple Recording +************************************************************************** +*/ + +bool bSpcMSetupModeRecStdMulti (ST_SPCM_CARDINFO *pstCardInfo, uint64 qwChEnable, int64 llMemSamples, int64 llSegmentSize, int64 llPostSamples) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + + // setup the mode + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CARDMODE, SPC_REC_STD_MULTI); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_CHENABLE, qwChEnable); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_MEMSIZE, llMemSamples); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_SEGMENTSIZE, llSegmentSize); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_POSTTRIGGER, llPostSamples); + + // store some information in the structure + pstCardInfo->llSetMemsize = llMemSamples; + pstCardInfo->qwSetChEnableMap = qwChEnable; + if (!dwError) dwError = spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_CHCOUNT, &pstCardInfo->lSetChannels); + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +bSpcMSetupModeRecStdABA: record standard mode ABA +************************************************************************** +*/ + +bool bSpcMSetupModeRecStdABA (ST_SPCM_CARDINFO *pstCardInfo, uint64 qwChEnable, int64 llMemSamples, int64 llSegmentSize, int64 llPostSamples, int32 lABADivider) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + + // setup the mode + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CARDMODE, SPC_REC_STD_ABA); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_CHENABLE, qwChEnable); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_MEMSIZE, llMemSamples); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_SEGMENTSIZE, llSegmentSize); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_POSTTRIGGER, llPostSamples); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_ABADIVIDER, lABADivider); + + // store some information in the structure + pstCardInfo->llSetMemsize = llMemSamples; + pstCardInfo->qwSetChEnableMap = qwChEnable; + if (!dwError) dwError = spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_CHCOUNT, &pstCardInfo->lSetChannels); + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + +/* +************************************************************************** +bSpcMSetupModeRecFIFOAverage: record FIFO mode Average +************************************************************************** +*/ + +bool bSpcMSetupModeRecFIFOAverage (ST_SPCM_CARDINFO *pstCardInfo, uint64 qwChEnable, int64 llSegmentSize, int64 llPostSamples, int32 lAverages, int64 llSegmentsToRec) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + + // setup the mode + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CARDMODE, SPC_REC_FIFO_AVERAGE); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_CHENABLE, qwChEnable); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_SEGMENTSIZE, llSegmentSize); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_POSTTRIGGER, llPostSamples); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_LOOPS, llSegmentsToRec); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_AVERAGES, lAverages); + + // store some information in the structure + pstCardInfo->llSetMemsize = 0; + pstCardInfo->qwSetChEnableMap = qwChEnable; + if (!dwError) dwError = spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_CHCOUNT, &pstCardInfo->lSetChannels); + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + +/* +************************************************************************** +bSpcMSetupModeRecFIFOMulti: record FIFO mode Multi +************************************************************************** +*/ + +bool bSpcMSetupModeRecFIFOMulti (ST_SPCM_CARDINFO *pstCardInfo, uint64 qwChEnable, int64 llSegmentSize, int64 llPostSamples, int64 llSegmentsToRec) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + + // setup the mode + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CARDMODE, SPC_REC_FIFO_MULTI); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_CHENABLE, qwChEnable); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_SEGMENTSIZE, llSegmentSize); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_POSTTRIGGER, llPostSamples); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_LOOPS, llSegmentsToRec); + + // store some information in the structure + pstCardInfo->llSetMemsize = 0; + pstCardInfo->qwSetChEnableMap = qwChEnable; + if (!dwError) dwError = spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_CHCOUNT, &pstCardInfo->lSetChannels); + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +bSpcMSetupModeRecFIFOABA: record FIFO mode ABA +************************************************************************** +*/ + +bool bSpcMSetupModeRecFIFOABA (ST_SPCM_CARDINFO *pstCardInfo, uint64 qwChEnable, int64 llSegmentSize, int64 llPostSamples, int32 lABADivider, int64 llSegmentsToRec) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + + // setup the mode + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CARDMODE, SPC_REC_FIFO_ABA); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_CHENABLE, qwChEnable); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_SEGMENTSIZE, llSegmentSize); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_POSTTRIGGER, llPostSamples); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_LOOPS, llSegmentsToRec); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_ABADIVIDER, lABADivider); + + // store some information in the structure + pstCardInfo->llSetMemsize = 0; + pstCardInfo->qwSetChEnableMap = qwChEnable; + if (!dwError) dwError = spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_CHCOUNT, &pstCardInfo->lSetChannels); + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +pvGetSegmentDataPointer: recalculates the segment start address for + Multiple Recording +************************************************************************** +*/ + +void* pvGetSegmentDataPointer (ST_SPCM_CARDINFO *pstCardInfo, void* pvDataBuffer, int32 lSegmentsize, int32 lSegmentIdx, int32 lBytesPerSample) + { + uint8* pcByteAdr = (uint8*) pvDataBuffer; + return (void*) &pcByteAdr[lSegmentIdx * lSegmentsize * pstCardInfo->lSetChannels * lBytesPerSample]; + } + + + +/* +************************************************************************** +bSpcMSetupModeRecStdGate: record standard mode gated sampling +************************************************************************** +*/ + +bool bSpcMSetupModeRecStdGate (ST_SPCM_CARDINFO *pstCardInfo, uint64 qwChEnable, int64 llMemSamples, int64 llPreSamples, int64 llPostSamples) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + + // setup the mode + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CARDMODE, SPC_REC_STD_GATE); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_CHENABLE, qwChEnable); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_MEMSIZE, llMemSamples); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_PRETRIGGER, llPreSamples); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_POSTTRIGGER, llPostSamples); + + // store some information in the structure + pstCardInfo->llSetMemsize = llMemSamples; + pstCardInfo->qwSetChEnableMap = qwChEnable; + if (!dwError) dwError = spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_CHCOUNT, &pstCardInfo->lSetChannels); + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +bSpcMSetupModeRecFIFOGate: record FIFO mode gated sampling +************************************************************************** +*/ + +bool bSpcMSetupModeRecFIFOGate (ST_SPCM_CARDINFO *pstCardInfo, uint64 qwChEnable, int64 llPreSamples, int64 llPostSamples, int64 llGatesToRec) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + + // setup the mode + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CARDMODE, SPC_REC_FIFO_GATE); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_CHENABLE, qwChEnable); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_PRETRIGGER, llPreSamples); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_POSTTRIGGER, llPostSamples); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_LOOPS, llGatesToRec); + + // store some information in the structure + pstCardInfo->llSetMemsize = 0; + pstCardInfo->qwSetChEnableMap = qwChEnable; + if (!dwError) dwError = spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_CHCOUNT, &pstCardInfo->lSetChannels); + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +bSpcMSetupModeRepStdSingle: replay standard mode single +************************************************************************** +*/ + +bool bSpcMSetupModeRepStdSingle (ST_SPCM_CARDINFO *pstCardInfo, uint64 qwChEnable, int64 llMemSamples) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + + // setup the mode + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CARDMODE, SPC_REP_STD_SINGLE); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_CHENABLE, qwChEnable); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_MEMSIZE, llMemSamples); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_LOOPS, 1); + + // store some information in the structure + pstCardInfo->llSetMemsize = llMemSamples; + pstCardInfo->qwSetChEnableMap = qwChEnable; + if (!dwError) dwError = spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_CHCOUNT, &pstCardInfo->lSetChannels); + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +bSpcMSetupModeRepStdLoops: replay standard mode looped +************************************************************************** +*/ + +bool bSpcMSetupModeRepStdLoops (ST_SPCM_CARDINFO *pstCardInfo, uint64 qwChEnable, int64 llMemSamples, int64 llLoops) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + + // setup the mode + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CARDMODE, SPC_REP_STD_SINGLE); // with SPC_LOOPS == 0 this will loop continuously + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_LOOPS, llLoops); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_CHENABLE, qwChEnable); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_MEMSIZE, llMemSamples); + + // store some information in the structure + pstCardInfo->llSetMemsize = llMemSamples; + pstCardInfo->qwSetChEnableMap = qwChEnable; + if (!dwError) dwError = spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_CHCOUNT, &pstCardInfo->lSetChannels); + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +bSpcMSetupModeRepStdSingleRestart: replay standard mode Single Restart +************************************************************************** +*/ + +bool bSpcMSetupModeRepStdSingleRestart (ST_SPCM_CARDINFO *pstCardInfo, uint64 qwChEnable, int64 llMemSamples, int64 llLoops) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + + // setup the mode + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CARDMODE, SPC_REP_STD_SINGLERESTART); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_CHENABLE, qwChEnable); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_MEMSIZE, llMemSamples); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_LOOPS, llLoops); + + // store some information in the structure + pstCardInfo->llSetMemsize = llMemSamples; + pstCardInfo->qwSetChEnableMap = qwChEnable; + if (!dwError) dwError = spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_CHCOUNT, &pstCardInfo->lSetChannels); + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +bSpcMSetupModeRepFIFOSingle: replay FIFO mode single run +************************************************************************** +*/ + +bool bSpcMSetupModeRepFIFOSingle (ST_SPCM_CARDINFO *pstCardInfo, uint64 qwChEnable, int64 llBlockToRep, int64 llLoopToRep) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + + // check for invalid block/loop combinations + if ((llBlockToRep && !llLoopToRep) || (!llBlockToRep && llLoopToRep)) + { + sprintf (pstCardInfo->szError, "bSpcMSetupModeRepFIFOSingle: Loop and Blocks must be either both zero or both defined to non-zero\n"); + return false; + } + + // segment size can't be zero, we adjust it here + if (!llBlockToRep && !llLoopToRep) + llBlockToRep = 1024; + + // setup the mode + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CARDMODE, SPC_REP_FIFO_SINGLE); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_CHENABLE, qwChEnable); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_SEGMENTSIZE, llBlockToRep); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_LOOPS, llLoopToRep); + + // store some information in the structure + pstCardInfo->llSetMemsize = 0; + pstCardInfo->qwSetChEnableMap = qwChEnable; + if (!dwError) dwError = spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_CHCOUNT, &pstCardInfo->lSetChannels); + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +bSpcMSetupModeRepStdMulti: replay standard mode Multiple Replay +************************************************************************** +*/ + +bool bSpcMSetupModeRepStdMulti (ST_SPCM_CARDINFO *pstCardInfo, uint64 qwChEnable, int64 llMemSamples, int64 llSegmentSize, int64 llSegmentsToRep) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + + // setup the mode + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CARDMODE, SPC_REP_STD_MULTI); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_CHENABLE, qwChEnable); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_MEMSIZE, llMemSamples); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_SEGMENTSIZE, llSegmentSize); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_LOOPS, llSegmentsToRep); + + // store some information in the structure + pstCardInfo->llSetMemsize = llMemSamples; + pstCardInfo->qwSetChEnableMap = qwChEnable; + if (!dwError) dwError = spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_CHCOUNT, &pstCardInfo->lSetChannels); + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +bSpcMSetupModeRepFIFOMulti: replay FIFO mode Multiple Replay +************************************************************************** +*/ + +bool bSpcMSetupModeRepFIFOMulti (ST_SPCM_CARDINFO *pstCardInfo, uint64 qwChEnable, int64 llSegmentSize, int64 llSegmentsToRep) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + + // setup the mode + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CARDMODE, SPC_REP_FIFO_MULTI); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_CHENABLE, qwChEnable); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_SEGMENTSIZE, llSegmentSize); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_LOOPS, llSegmentsToRep); + + // store some information in the structure + pstCardInfo->llSetMemsize = 0; + pstCardInfo->qwSetChEnableMap = qwChEnable; + if (!dwError) dwError = spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_CHCOUNT, &pstCardInfo->lSetChannels); + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +bSpcMSetupModeRepStdGate: replay standard mode Gated Replay +************************************************************************** +*/ + +bool bSpcMSetupModeRepStdGate (ST_SPCM_CARDINFO *pstCardInfo, uint64 qwChEnable, int64 llMemSamples, int64 llGatesToRep) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + + // setup the mode + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CARDMODE, SPC_REP_STD_GATE); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_CHENABLE, qwChEnable); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_MEMSIZE, llMemSamples); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_LOOPS, llGatesToRep); + + // store some information in the structure + pstCardInfo->llSetMemsize = llMemSamples; + pstCardInfo->qwSetChEnableMap = qwChEnable; + if (!dwError) dwError = spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_CHCOUNT, &pstCardInfo->lSetChannels); + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +bSpcMSetupModeRepFIFOGate: replay FIFO mode Gated Replay +************************************************************************** +*/ + +bool bSpcMSetupModeRepFIFOGate (ST_SPCM_CARDINFO *pstCardInfo, uint64 qwChEnable, int64 llGatesToRep) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + + // setup the mode + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CARDMODE, SPC_REP_FIFO_GATE); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_CHENABLE, qwChEnable); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_LOOPS, llGatesToRep); + + // store some information in the structure + pstCardInfo->llSetMemsize = 0; + pstCardInfo->qwSetChEnableMap = qwChEnable; + if (!dwError) dwError = spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_CHCOUNT, &pstCardInfo->lSetChannels); + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +bSpcMSetupModeRepSequence: replay sequence mode +************************************************************************** +*/ + +bool bSpcMSetupModeRepSequence (ST_SPCM_CARDINFO *pstCardInfo, uint64 qwChEnable, uint32 dwMaxSegments) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + + // setup the mode + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CARDMODE, SPC_REP_STD_SEQUENCE); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_CHENABLE, qwChEnable); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_SEQMODE_MAXSEGMENTS, dwMaxSegments); + + // store some information in the structure + pstCardInfo->llSetMemsize = 0; + pstCardInfo->qwSetChEnableMap = qwChEnable; + if (!dwError) dwError = spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_CHCOUNT, &pstCardInfo->lSetChannels); + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +************************************************************************** +************************************************************************** + Clock setup +************************************************************************** +************************************************************************** +************************************************************************** +*/ + + + +/* +************************************************************************** +bSpcMSetupClockPLL: internal clock using PLL +************************************************************************** +*/ + +bool bSpcMSetupClockPLL (ST_SPCM_CARDINFO *pstCardInfo, int64 llSamplerate, bool bClockOut) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + + // check for borders + if (llSamplerate > pstCardInfo->llMaxSamplerate) + llSamplerate = pstCardInfo->llMaxSamplerate; + if (llSamplerate < pstCardInfo->llMinSamplerate) + llSamplerate = pstCardInfo->llMinSamplerate; + + // setup the clock mode + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CLOCKMODE, SPC_CM_INTPLL); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_SAMPLERATE, llSamplerate); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CLOCKOUT, bClockOut ? 1 : 0); + if (!dwError) dwError = spcm_dwGetParam_i64 (pstCardInfo->hDrv, SPC_SAMPLERATE, &pstCardInfo->llSetSamplerate); + if (!dwError) dwError = spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_OVERSAMPLINGFACTOR, &pstCardInfo->lOversampling); + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +bSpcMSetupClockQuarz: internal clock using high precision quartz +************************************************************************** +*/ + +bool bSpcMSetupClockQuartz (ST_SPCM_CARDINFO *pstCardInfo, int64 llSamplerate, bool bClockOut) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + + // check for borders + if (llSamplerate > pstCardInfo->llMaxSamplerate) + llSamplerate = pstCardInfo->llMaxSamplerate; + if (llSamplerate < pstCardInfo->llMinSamplerate) + llSamplerate = pstCardInfo->llMinSamplerate; + + // setup the clock mode + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CLOCKMODE, SPC_CM_QUARTZ1); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_SAMPLERATE, llSamplerate); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CLOCKOUT, bClockOut ? 1 : 0); + if (!dwError) dwError = spcm_dwGetParam_i64 (pstCardInfo->hDrv, SPC_SAMPLERATE, &pstCardInfo->llSetSamplerate); + if (!dwError) dwError = spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_OVERSAMPLINGFACTOR, &pstCardInfo->lOversampling); + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +bSpcMSetupClockExternal: external clock +************************************************************************** +*/ + +bool bSpcMSetupClockExternal (ST_SPCM_CARDINFO *pstCardInfo, int32 lExtRange, bool bClockTerm, int32 lDivider) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + + if (lDivider > 1) + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CLOCKMODE, SPC_CM_EXTDIVIDER); + else + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CLOCKMODE, SPC_CM_EXTERNAL); + + // M2i needs the info on range of external clock + if (((pstCardInfo->lCardType & TYP_SERIESMASK) == TYP_M2ISERIES) || ((pstCardInfo->lCardType & TYP_SERIESMASK) == TYP_M2IEXPSERIES)) + { + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_EXTERNRANGE, lExtRange); + } + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CLOCKDIV, lDivider); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CLOCK50OHM, bClockTerm ? 1 : 0); + + pstCardInfo->llSetSamplerate = 1; + pstCardInfo->lOversampling = 1; + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +bSpcMSetupClockRefClock: reference clock +************************************************************************** +*/ + +bool bSpcMSetupClockRefClock (ST_SPCM_CARDINFO *pstCardInfo, int32 lRefClock, int64 llSamplerate, bool bClockTerm) + { + if (!pstCardInfo) + return false; + + // check for borders + if (llSamplerate > pstCardInfo->llMaxSamplerate) + llSamplerate = pstCardInfo->llMaxSamplerate; + if (llSamplerate < pstCardInfo->llMinSamplerate) + llSamplerate = pstCardInfo->llMinSamplerate; + + uint32 dwError = ERR_OK; + + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CLOCKMODE, SPC_CM_EXTREFCLOCK); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_REFERENCECLOCK, lRefClock); + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCardInfo->hDrv, SPC_SAMPLERATE, llSamplerate); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CLOCK50OHM, bClockTerm ? 1 : 0); + if (!dwError) dwError = spcm_dwGetParam_i64 (pstCardInfo->hDrv, SPC_SAMPLERATE, &pstCardInfo->llSetSamplerate); + if (!dwError) dwError = spcm_dwGetParam_i32 (pstCardInfo->hDrv, SPC_OVERSAMPLINGFACTOR, &pstCardInfo->lOversampling); + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +************************************************************************** +************************************************************************** + Trigger setup +************************************************************************** +************************************************************************** +************************************************************************** +*/ + + +/* +************************************************************************** +bSpcMSetupTrigSoftware: software trigger +************************************************************************** +*/ + +bool bSpcMSetupTrigSoftware (ST_SPCM_CARDINFO *pstCardInfo, bool bTrigOut) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + + // setup the trigger mode + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_ORMASK, SPC_TMASK_SOFTWARE); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_ANDMASK, 0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH_ORMASK0, 0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH_ORMASK1, 0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH_ANDMASK0, 0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH_ANDMASK1, 0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIGGEROUT, bTrigOut ? 1 : 0); + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +bSpcMSetupTrigExternal: external trigger + If levels are programmable they'll be set to LVTTL +************************************************************************** +*/ + +bool bSpcMSetupTrigExternal (ST_SPCM_CARDINFO *pstCardInfo, int32 lExtMode, bool bTrigTerm, int32 lPulsewidth, bool bSingleSrc, int32 lExtLine) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + + // setup the external trigger mode + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_EXT0_MODE + lExtLine, lExtMode); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_TERM, bTrigTerm ? 1 : 0); + + // we only use trigout on M2i cards as we otherwise would override the multi purpose i/o lines of M3i, M4i, M4x and M2p + if (((pstCardInfo->lCardType & TYP_SERIESMASK) == TYP_M2ISERIES) || ((pstCardInfo->lCardType & TYP_SERIESMASK) == TYP_M2IEXPSERIES)) + { + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_OUTPUT, 0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_EXT0_PULSEWIDTH + lExtLine, lPulsewidth); + } + + // on bSingleSrc flag no other trigger source is used + if (bSingleSrc) + { + switch (lExtLine) + { + case 0 : if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_ORMASK, SPC_TMASK_EXT0); break; + case 1 : if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_ORMASK, SPC_TMASK_EXT1); break; + case 2 : if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_ORMASK, SPC_TMASK_EXT2); break; + case 3 : if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_ORMASK, SPC_TMASK_EXT3); break; // X3 on M2p + } + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_ANDMASK, 0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH_ORMASK0, 0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH_ORMASK1, 0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH_ANDMASK0, 0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH_ANDMASK1, 0); + } + + switch (pstCardInfo->lCardType & TYP_SERIESMASK) + { + // M3i cards need trigger level to be programmed for Ext0 = analog trigger + case TYP_M3ISERIES: + case TYP_M3IEXPSERIES: + { + if (lExtLine == 0) + { + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_EXT0_LEVEL0, 1500); // 1500 mV + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_EXT0_LEVEL1, 800); // 800 mV (rearm) + } + break; + } + // M4i/M4x cards need trigger level to be programmed for Ext0 or Ext1 + case TYP_M4IEXPSERIES: + case TYP_M4XEXPSERIES: + { + if (lExtLine == 0) + { + if ((pstCardInfo->lCardType & (TYP_FAMILYMASK | TYP_CHMASK)) == 0x7700) // single ended 77x0 + { + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_THRESHOLD, 1500); // 1500 mV + } + else + { + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_EXT0_LEVEL0, 1500); // 1500 mV + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_EXT0_LEVEL1, 800); // 800 mV (rearm) + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_EXT0_ACDC, COUPLING_DC); // DC coupling + } + } + else if (lExtLine == 1) + { + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_EXT1_LEVEL0, 1500); // 1500 mV + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_EXT1_ACDC, COUPLING_DC); // DC coupling + } + break; + } + // M2p/M5i have a single level on Ext0 + case TYP_M2PEXPSERIES: + case TYP_M5IEXPSERIES: + { + if (lExtLine == 0) + { + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_EXT0_LEVEL0, 1500); // 1500 mV + } + break; + } + } + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + +/* +************************************************************************** +bSpcMSetupTrigExternalLevel: external analog trigger with programmable levels +************************************************************************** +*/ + +bool bSpcMSetupTrigExternalLevel (ST_SPCM_CARDINFO *pstCardInfo, int32 lExtMode, int32 lLevel0, int32 lLevel1, bool bTrigTerm, bool bACCoupling, int32 lPulsewidth, bool bSingleSrc, int32 lExtLine) + { + if (!pstCardInfo) + return false; + + // not supported by M2i and M2i Express cards as they have plain TTL trigger + if (((pstCardInfo->lCardType & TYP_SERIESMASK) == TYP_M2ISERIES) || ((pstCardInfo->lCardType & TYP_SERIESMASK) == TYP_M2IEXPSERIES)) + return false; + + uint32 dwError = ERR_OK; + + // setup the external trigger mode + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_EXT0_MODE + lExtLine, lExtMode); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_TERM, bTrigTerm ? 1 : 0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_EXT0_ACDC + lExtLine, bACCoupling ? COUPLING_AC : COUPLING_DC); + + // on bSingleSrc flag no other trigger source is used + if (bSingleSrc) + { + switch (lExtLine) + { + case 0 : if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_ORMASK, SPC_TMASK_EXT0); break; + case 1 : if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_ORMASK, SPC_TMASK_EXT1); break; + case 2 : if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_ORMASK, SPC_TMASK_EXT2); break; + } + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_ANDMASK, 0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH_ORMASK0, 0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH_ORMASK1, 0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH_ANDMASK0, 0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH_ANDMASK1, 0); + } + + // M3i cards need trigger level to be programmed for Ext0 = analog trigger + // M4i/M4x cards need trigger level to be programmed for Ext0 or Ext1 + switch (pstCardInfo->lCardType & TYP_SERIESMASK) + { + case TYP_M3ISERIES: + case TYP_M3IEXPSERIES: + case TYP_M4IEXPSERIES: + case TYP_M4XEXPSERIES: + { + if (lExtLine == 0) + { + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_EXT0_LEVEL0, lLevel0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_EXT0_LEVEL1, lLevel1); + } + else if (lExtLine == 1) + { + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_EXT1_LEVEL0, lLevel0); + } + break; + } + case TYP_M2PEXPSERIES: + case TYP_M5IEXPSERIES: + { + if (lExtLine == 0) + { + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_EXT0_LEVEL0, lLevel0); + } + break; + } + } + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + +/* +************************************************************************** +bSpcMSetupTrigXIO: additional BaseXIO trigger, needs option installed +************************************************************************** +*/ + +bool bSpcMSetupTrigXIO (ST_SPCM_CARDINFO *pstCardInfo, int32 lXIOMode, bool bSingleSrc, int32 lXIOLine) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + + // setup the external trigger mode + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_XIO0_MODE + lXIOLine, lXIOMode); + + // on bSingleSrc flag no other trigger source is used + if (bSingleSrc) + { + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_ORMASK, lXIOLine == 0 ? SPC_TMASK_XIO0 : SPC_TMASK_XIO1); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_ANDMASK, 0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH_ORMASK0, 0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH_ORMASK1, 0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH_ANDMASK0, 0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH_ANDMASK1, 0); + } + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +bSpcMSetupTrigChannel: channel trigger is set for each channel separately +************************************************************************** +*/ + +bool bSpcMSetupTrigChannel (ST_SPCM_CARDINFO *pstCardInfo, int32 lChannel, int32 lTrigMode, int32 lTrigLevel0, int32 lTrigLevel1, int32 lPulsewidth, bool bTrigOut, bool bSingleSrc) + { + if (!pstCardInfo) + return false; + + if ((lChannel < 0) || (lChannel >= pstCardInfo->lMaxChannels)) + { + sprintf (pstCardInfo->szError, "bSpcMSetupTrigChannel: channel number %d not valid. Channels range from 0 to %d\n", lChannel, pstCardInfo->lMaxChannels); + return false; + } + + uint32 dwError = ERR_OK; + + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH0_MODE + lChannel, lTrigMode); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH0_PULSEWIDTH + lChannel, lPulsewidth); + + if (pstCardInfo->eCardFunction == AnalogIn) + { + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH0_LEVEL0 + lChannel, lTrigLevel0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH0_LEVEL1 + lChannel, lTrigLevel1); + } + + // we only use trigout on M2i cards as we otherwise would override the multi purpose i/o lines of M3i + if (((pstCardInfo->lCardType & TYP_SERIESMASK) == TYP_M2ISERIES) || ((pstCardInfo->lCardType & TYP_SERIESMASK) == TYP_M2IEXPSERIES)) + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_OUTPUT, bTrigOut ? 1 : 0); + + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_TERM, 0); + + // on bSingleSrc flag no other trigger source is used + if (bSingleSrc) + { + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_ORMASK, 0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_ANDMASK, 0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH_ORMASK1, 0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH_ANDMASK1, 0); + + // some cards need the and mask to use on pulsewidth mode -> to be sure we set the AND mask for all pulsewidth cards + if ((lTrigMode & SPC_TM_PW_GREATER) || (lTrigMode & SPC_TM_PW_SMALLER)) + { + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH_ORMASK0, 0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH_ANDMASK0, 1 << lChannel); + } + else + { + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH_ORMASK0, 1 << lChannel); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH_ANDMASK0, 0); + } + } + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +bSpcMSetupTrigMask: this function sets the trigger masks (bSingleSrc +of other commands must be false to use this) +************************************************************************** +*/ + +bool bSpcMSetupTrigMask (ST_SPCM_CARDINFO *pstCardInfo, uint32 dwChannelOrMask0, uint32 dwChannelOrMask1, uint32 dwChannelAndMask0, uint32 dwChannelAndMask1, uint32 dwTrigOrMask, uint32 dwTrigAndMask) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_ORMASK, dwTrigOrMask); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_ANDMASK, dwTrigAndMask); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH_ORMASK0, dwChannelOrMask0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH_ORMASK1, dwChannelOrMask1); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH_ANDMASK0, dwChannelAndMask0); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TRIG_CH_ANDMASK1, dwChannelAndMask1); + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +************************************************************************** +************************************************************************** + Input + Output channel setup +************************************************************************** +************************************************************************** +************************************************************************** +*/ + +/* +************************************************************************** +bSpcMSetupInputChannel: allows all input channel related settings +************************************************************************** +*/ + +bool bSpcMSetupInputChannel (ST_SPCM_CARDINFO *pstCardInfo, int32 lChannel, int32 lInputRange, bool bTerm, int32 lInputOffset, bool bDiffInput) + { + if (!pstCardInfo) + return false; + + if ((lChannel < 0) || (lChannel >= pstCardInfo->lMaxChannels)) + { + sprintf (pstCardInfo->szError, "SpcMSetupInputChannel: channel number %d not valid. Channels range from 0 to %d\n", lChannel, pstCardInfo->lMaxChannels); + return false; + } + + uint32 dwError = ERR_OK; + + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_AMP0 + lChannel * (SPC_AMP1 - SPC_AMP0), lInputRange); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_OFFS0 + lChannel * (SPC_OFFS1 - SPC_OFFS0), lInputOffset); + if (pstCardInfo->uCfg.stAI.astPath[0].bInputTermAvailable) + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_50OHM0 + lChannel * (SPC_50OHM1 - SPC_50OHM0), bTerm ? 1 : 0); + if (pstCardInfo->uCfg.stAI.astPath[0].bDiffModeAvailable) + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_DIFF0 + lChannel * (SPC_DIFF1 - SPC_DIFF0), bDiffInput ? 1 : 0); + + // store some information in the structure + pstCardInfo->uCfg.stAI.lSetPath[lChannel] = 0; + pstCardInfo->uCfg.stAI.lSetRange[lChannel] = lInputRange; + pstCardInfo->uCfg.stAI.lSetOffset[lChannel] = lInputOffset; + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + +/* +************************************************************************** +bSpcMSetupPathInputCh: M3i version with different settings +************************************************************************** +*/ + +bool bSpcMSetupPathInputCh (ST_SPCM_CARDINFO *pstCardInfo, int32 lChannel, int32 lPath, int32 lInputRange, int32 lOffset_percent, bool bTerm, bool bACCoupling, bool bBWLimit, bool bDiffInput) + { + if (!pstCardInfo) + return false; + + if ((lChannel < 0) || (lChannel >= pstCardInfo->lMaxChannels)) + { + sprintf (pstCardInfo->szError, "SpcMSetupInputChannel: channel number %d not valid. Channels range from 0 to %d\n", lChannel, pstCardInfo->lMaxChannels); + return false; + } + + uint32 dwError = ERR_OK; + + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_PATH0 + lChannel * (SPC_PATH1 - SPC_PATH0), lPath); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_AMP0 + lChannel * (SPC_AMP1 - SPC_AMP0), lInputRange); + if (pstCardInfo->uCfg.stAI.astPath[lPath].bOffsPercentMode) + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_OFFS0 + lChannel * (SPC_OFFS1 - SPC_OFFS0), lOffset_percent); + if (pstCardInfo->uCfg.stAI.astPath[lPath].bInputTermAvailable) + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_50OHM0 + lChannel * (SPC_50OHM1 - SPC_50OHM0), bTerm ? 1 : 0); + if (pstCardInfo->uCfg.stAI.astPath[lPath].bDiffModeAvailable) + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_DIFF0 + lChannel * (SPC_DIFF1 - SPC_DIFF0), bDiffInput ? 1 : 0); + if (pstCardInfo->uCfg.stAI.astPath[lPath].bACCouplingAvailable) + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_ACDC0 + lChannel * (SPC_ACDC1 - SPC_ACDC0), bACCoupling ? COUPLING_AC : COUPLING_DC); + if (pstCardInfo->uCfg.stAI.astPath[lPath].bBWLimitAvailable) + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_FILTER0 + lChannel * (SPC_FILTER1 - SPC_FILTER0), bBWLimit ? 1 : 0); + + // store some information in the structure + pstCardInfo->uCfg.stAI.lSetPath[lChannel] = lPath; + pstCardInfo->uCfg.stAI.lSetRange[lChannel] = lInputRange; + pstCardInfo->uCfg.stAI.lSetOffset[lChannel] = 0; + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + +/* +************************************************************************** +bSpcMSetupAnalogOutputChannel: allows all output channel related settings +************************************************************************** +*/ + +bool bSpcMSetupAnalogOutputChannel (ST_SPCM_CARDINFO *pstCardInfo, int32 lChannel, int32 lAmplitude, int32 lOutputOffset, int32 lFilter, int32 lStopMode, bool bDoubleOut, bool bDifferential) + { + if (!pstCardInfo) + return false; + + if ((lChannel < 0) || (lChannel >= pstCardInfo->lMaxChannels)) + { + sprintf (pstCardInfo->szError, "SpcMSetupAnalogOutputChannel: channel number %d not valid. Channels range from 0 to %d\n", lChannel, pstCardInfo->lMaxChannels); + return false; + } + + // Enable output (since M4i). + uint32 dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_ENABLEOUT0 + lChannel * (SPC_ENABLEOUT1 - SPC_ENABLEOUT0), 1); + + // Check for programmable gain + if (pstCardInfo->uCfg.stAO.bGainProgrammable) + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_AMP0 + lChannel * (SPC_AMP1 - SPC_AMP0), lAmplitude); + + // Check for programmable offset + if (pstCardInfo->uCfg.stAO.bOffsetProgrammable) + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_OFFS0 + lChannel * (SPC_OFFS1 - SPC_OFFS0), lOutputOffset); + + // Check for programmable filters + if (pstCardInfo->uCfg.stAO.bFilterAvailable) + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_FILTER0 + lChannel * (SPC_FILTER1 - SPC_FILTER0), lFilter); + + // Check for programmable stop levels + if (pstCardInfo->uCfg.stAO.bStopLevelProgrammable) + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CH0_STOPLEVEL + lChannel * (SPC_CH1_STOPLEVEL - SPC_CH0_STOPLEVEL), lStopMode); + + // Check for programmable diffmodes + if (pstCardInfo->uCfg.stAO.bDiffModeAvailable && !bDoubleOut) + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_DIFF0 + lChannel * (SPC_DIFF1 - SPC_DIFF0), bDifferential ? 1 : 0); + + // Check for programmable doublemodes + if (pstCardInfo->uCfg.stAO.bDiffModeAvailable && !bDifferential) + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_DOUBLEOUT0 + lChannel * (SPC_DOUBLEOUT1 - SPC_DOUBLEOUT0), bDoubleOut ? 1 : 0); + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +bSpcMSetupDigitalOutput: digital output settings for one group +************************************************************************** +*/ + +bool bSpcMSetupDigitalOutput (ST_SPCM_CARDINFO *pstCardInfo, int32 lGroup, int32 lStopMode, int32 lLowLevel, int32 lHighLevel, bool bDiffMode) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + int32 lStopLvlMod = (lGroup * (pstCardInfo->lMaxChannels / pstCardInfo->uCfg.stDIO.lGroups)) >= (pstCardInfo->lMaxChannels / pstCardInfo->lModulesCount) ? 1 : 0; + + if (pstCardInfo->uCfg.stDIO.bStopLevelProgrammable) + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_CH0_STOPLEVEL + lStopLvlMod * (SPC_CH1_STOPLEVEL - SPC_CH0_STOPLEVEL), lStopMode); + + if (pstCardInfo->uCfg.stDIO.bOutputLevelProgrammable) + { + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_LOWLEVEL0 + lGroup * (SPC_LOWLEVEL1 - SPC_LOWLEVEL0), lLowLevel); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_HIGHLEVEL0 + lGroup * (SPC_HIGHLEVEL1 - SPC_HIGHLEVEL0), lHighLevel); + } + + if (pstCardInfo->uCfg.stDIO.bDiffModeAvailable) + {} // to be done + + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +bSpcMSetupDigitalInput: digital input settings for one group +************************************************************************** +*/ + +bool bSpcMSetupDigitalInput (ST_SPCM_CARDINFO *pstCardInfo, int32 lGroup, bool bTerm) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + + if (pstCardInfo->uCfg.stDIO.bInputTermAvailable) + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_110OHM0 + lGroup * (SPC_110OHM1 - SPC_110OHM0), bTerm ? 1 : 0); + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + + + +/* +************************************************************************** +************************************************************************** +************************************************************************** + Miscellaneous setup +************************************************************************** +************************************************************************** +************************************************************************** +*/ + + + +/* +************************************************************************** +bSpcMSetupTimestamp: set up the timestamp mode and performs a +synchronisation with reference clock if that mode is activated. Checks for +BASEXIO option if one wants to use reference clock mode +************************************************************************** +*/ + +bool bSpcMSetupTimestamp (ST_SPCM_CARDINFO *pstCardInfo, int32 lMode, uint32 dwRefTimeoutMS) + { + if (!pstCardInfo) + return false; + + uint32 dwError = ERR_OK; + bool bRefClockMode = ((lMode & (SPC_TSCNT_REFCLOCKPOS | SPC_TSCNT_REFCLOCKNEG)) != 0); + + // if ref clock is activated for M2i/M3i cards we check for the installation of base xio as this contains the ref clock input + if (bRefClockMode && ((pstCardInfo->lFeatureMap & SPCM_FEAT_BASEXIO) == 0) && ((pstCardInfo->bM2i) || (pstCardInfo->bM3i))) + { + sprintf (pstCardInfo->szError, "Timestamp ref clock mode requires an installed BASEXIO feature!\n"); + return false; + } + + // set the timestamp mode + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TIMESTAMP_CMD, lMode); + + // in ref clock mode we now try the synchronisation with external clock + if (bRefClockMode && !dwError) + { + dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TIMESTAMP_TIMEOUT, dwRefTimeoutMS); + if (!dwError) + dwError = spcm_dwSetParam_i32 (pstCardInfo->hDrv, SPC_TIMESTAMP_CMD, SPC_TS_RESET); + + // error = synchronisation failed + if (dwError) + { + sprintf (pstCardInfo->szError, "Timestamp reset: synchronisation with external ref clock failed. Check cabeling and check timeout value\n"); + return false; + } + } + + return bSpcMCheckSetError (dwError, pstCardInfo); + } + diff --git a/Cpp/examples/c_cpp/common/spcm_lib_card.h b/Cpp/examples/c_cpp/common/spcm_lib_card.h new file mode 100644 index 0000000000000000000000000000000000000000..d6ab78297b2627c0fc564573cff6fec021bd3a3a --- /dev/null +++ b/Cpp/examples/c_cpp/common/spcm_lib_card.h @@ -0,0 +1,597 @@ +/* +************************************************************************** + +spcm_lib_card.h (c) Spectrum GmbH , 01/2006 + +************************************************************************** + +defines the library functions as external to use them with projects where +the lib is directly included (like dll) and where the lib has to be loaded +separately (like LabWindows or unsupported C compiler) + +************************************************************************** +*/ + +#ifndef SPCM_LIB_CARD_H +#define SPCM_LIB_CARD_H + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + + + +#define SPCM_MAX_AIRANGE 8 +#define SPCM_MAX_AICHANNEL 16 +#define SPCM_MAX_AIPATH 2 +#define SPCM_MAX_AOCHANNEL 8 +#define SPCM_MAX_DIOCHANNEL 64 + + +/* +************************************************************************** +structure with different card information and setup information that is +used by the setup and data processing routines +************************************************************************** +*/ + +// different card functionalities +typedef enum E_SPCM_CARDFNC {AnalogIn, AnalogOut, DigitalOut, DigitalIn, DigitalIO} E_SPCM_CARDFNC; + +// card information structure +typedef struct + { + + // information from the card + drv_handle hDrv; // handle to opened card driver + int32 lCardIdx; // index of card (from open), just for display + int32 lCardType; // card type as listed in the manual + E_SPCM_CARDFNC eCardFunction; // function of the card + int32 lSerialNumber; // serial number of card + int64 llInstMemBytes; // installed on-board memory in bytes + int32 lFeatureMap; // bitmap with installed card features + int32 lExtFeatureMap; // bitmap with installed extended features + int32 lMaxChannels; // number of channels (analog or digital) + int32 lModulesCount; // number of installed modules for data sorting algorithm + int32 lBytesPerSample; // number of bytes for each sample (analog data) + int64 llMinSamplerate; // minimum sampling rate + int64 llMaxSamplerate; // maximum sampling rate + + int32 lLibVersion; // version of the library + int32 lKernelVersion; // version of the kernel driver + + int32 lCtrlFwVersion; // version of main control firmware + int32 lBaseHwVersion; // version of base hardware + int32 lModHwVersion; // version of module hardware + int32 lModFwVersion; // version of module firmware + + // current settings + bool bSetError; // one of the functions generated an error + int32 lErrorCode; // error code + char szError[ERRORTEXTLEN]; // space for the error text + uint64 qwSetChEnableMap; // current channel enable map + int64 llSetMemsize; // programmed memory size + int32 lSetChannels; // number of used channels for this run + int64 llSetSamplerate; // current selected sampling rate (1 for external) + int32 lOversampling; // currently active oversampling factor + + // flags for the examples to determine card family + bool bM2i; // M2i.xxxx or M2i.xxxx-exp + bool bM3i; // M3i.xxxx or M3i.xxxx-exp + bool bM4i; // M4i.xxxx-x8 or M4x.xxxx-x4 + bool bM2p; // M2p.xxxx-x4 + bool bM5i; // M5i.xxxx-x16 + bool bRemote; // Netbox or Remote Server + + // card function dependant details + union + { + + // analog input cards + struct ST_SPCM_AI + { + int32 lResolution; // resolution of analog channels + int32 lMaxADCValue; // maximum range, normally 2^(Resolution-1) but can be limited + int32 lPathCount; // number of input paths + struct ST_SPCM_AI_PATH // the different paths may have different features + { + int32 lRangeCount; // number of analog input ranges + int32 lRangeMin[SPCM_MAX_AIRANGE]; // analog input ranges + int32 lRangeMax[SPCM_MAX_AIRANGE]; // ... + bool bInputTermAvailable; // input termination available + bool bDiffModeAvailable; // differential mode available + bool bACCouplingAvailable; // AC/DC coupling softwar selectable + bool bBWLimitAvailable; // bandwidth limit available + bool bOffsPercentMode; // offset programmed in percent of range + } astPath[SPCM_MAX_AIPATH]; + + int32 lSetPath[SPCM_MAX_AICHANNEL]; + int32 lSetRange[SPCM_MAX_AICHANNEL]; // current used input range for each channel + int32 lSetOffset[SPCM_MAX_AICHANNEL]; // current set input offset + } stAI; + + // analog output cards + struct ST_SPCM_AO + { + int32 lResolution; // resolution of analog channels + int32 lMaxDACValue; // maximum range, normally 2^(Resolution-1) but can be limited + bool bGainProgrammable; // programmable gain available + bool bOffsetProgrammable; // programmable offset available + bool bFilterAvailable; // programmable filters available + bool bStopLevelProgrammable; // programmable stop level available + bool bDiffModeAvailable; // differential mode available + } stAO; + + // digital input, outputs or i/o cards + struct ST_SPCM_DIO + { + int32 lGroups; // number of channel groups that have individual setup + bool bInputTermAvailable; // input termination available + bool bDiffModeAvailable; // differential mode available + bool bStopLevelProgrammable; // programmable stop level available + bool bOutputLevelProgrammable; // low and high output level is programmable + } stDIO; + + } uCfg; + } ST_SPCM_CARDINFO; + + + + + +/* +************************************************************************** +bSpcMInitCardByIdx: + +opens the driver with the given indes, reads out card information and +fills the CARDINFO structure +************************************************************************** +*/ + +bool bSpcMInitCardByIdx ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to an allocated and empty card info structure + int32 lCardIdx); // index of card to open, index starts with zero + +bool bSpcMInitCardByIdx ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to an allocated and empty card info structure + const char* szDrvName, // name of card like /dev/spcm0 (local) or 123.123.123.123 (for digitizerNETBOX only) + int32 lCardIdx); // index of card to open, index starts with zero + + +/* +************************************************************************** +nErrorMessageStdOut: + +prints the error message to std out and ends the driver if it's active +program can be left with this function +************************************************************************** +*/ + +int nSpcMErrorMessageStdOut ( // returns -1 + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + const char* pszMessage, // user error message, + bool bPrintCardErr = true); // add card error message + + + +/* +************************************************************************** +pszSpcMTranslateRuntimeError + +translation of a runtime error code into a text message. The buffer need +to be at least ERRORTEXTLEN long to cover any current or future messages +************************************************************************** +*/ + +char* pszSpcMTranslateRuntimeError ( + uint32 dwErrorCode, + char* pszBuffer); + + +/* +************************************************************************** +vSpcMCloseCard + +closes the driver +************************************************************************** +*/ + +void vSpcMCloseCard ( + ST_SPCM_CARDINFO *pstCardInfo); // pointer to a filled card info structure + + + +/* +************************************************************************** +pszSpcMPrintCardInfo + +prints the card information to a string for display. +************************************************************************** +*/ + +char* pszSpcMPrintCardInfo ( // returns the pointer to the printed string + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + char* pszBuffer, // buffer for printing + int32 lStrLen, // length of the buffer + bool bExtended = true); // extended info, if false only name+sn + +char* pszSpcMPrintDocumentationLink ( + const ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + char* pszBuffer, // buffer for printing + int32 lStrLen); // length of the buffer + + +/* +************************************************************************** +bSpcMSetupModeXXX + +setup one of the card modes +************************************************************************** +*/ + +// record standard mode single +bool bSpcMSetupModeRecStdSingle ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + uint64 qwChEnable, // channel enable mask for the next acquisition + int64 llMemSamples, // recording length in samples per channel + int64 llPostSamples); // samples to record after trigger event + +// record FIFO mode single +bool bSpcMSetupModeRecFIFOSingle ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + uint64 qwChEnable, // channel enable mask for the next acquisition + int64 llPreSamples, // number of samples to be stored before the trigger event + int64 llBlockToRec = 0, // blocks and loops can define the maximum recording length + int64 llLoopToRec = 0); // in FIFO mode as Block * Loop. If zero we run continuously + +// *********************************************************************** + + +// record standard mode average +bool bSpcMSetupModeRecStdAverage ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + uint64 qwChEnable, // channel enable mask for the next acquisition + int64 llMemSamples, // recording length in samples per channel + int64 llSegmentSize, // size of each multiple recording segment + int64 llPostSamples, // samples to record after trigger event for each segment + int32 lAverages // number of triggered segments to average + ); + +// record standard mode multiple recording +bool bSpcMSetupModeRecStdMulti ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + uint64 qwChEnable, // channel enable mask for the next acquisition + int64 llMemSamples, // recording length in samples per channel + int64 llSegmentSize, // size of each multiple recording segment + int64 llPostSamples); // samples to record after trigger event for each segment + +// record standard mode ABA +bool bSpcMSetupModeRecStdABA ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + uint64 qwChEnable, // channel enable mask for the next acquisition + int64 llMemSamples, // recording length in samples per channel + int64 llSegmentSize, // size of each multiple recording segment + int64 llPostSamples, // samples to record after trigger event for each segment + int32 lABADivider); // divider for ABA mode slow samples + +// record FIFO mode average +bool bSpcMSetupModeRecFIFOAverage ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + uint64 qwChEnable, // channel enable mask for the next acquisition + int64 llSegmentSize, // size of each multiple recording segment + int64 llPostSamples, // samples to record after trigger event for each segment + int32 lAverages, + int64 llSegmentsToRec = 0); // number of segments to record in total. If zero we reun continuously + +// record FIFO mode multiple recording +bool bSpcMSetupModeRecFIFOMulti ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + uint64 qwChEnable, // channel enable mask for the next acquisition + int64 llSegmentSize, // size of each multiple recording segment + int64 llPostSamples, // samples to record after trigger event for each segment + int64 llSegmentsToRec = 0); // numbe of segments to record in total. If zero we reun continuously + +// record FIFO mode ABA +bool bSpcMSetupModeRecFIFOABA ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + uint64 qwChEnable, // channel enable mask for the next acquisition + int64 llSegmentSize, // size of each multiple recording segment + int64 llPostSamples, // samples to record after trigger event for each segment + int32 lABADivider, // divider for ABA mode slow samples + int64 llSegmentsToRec = 0); // numbe of segments to record in total. If zero we reun continuously + +// recalculates the data start address of segment no. idx +void* pvGetSegmentDataPointer ( // returns an pointer to the segment start address + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + void* pvDataBuffer, // pointer to the data array that holds all segments + int32 lSegmentsize, // size of one segment + int32 lSegmentIdx, // index of the segment of which we wish to get the pointer + int32 lBytesPerSample); // number of bytes per sample + +// *********************************************************************** + +// record standard mode gated sampling +bool bSpcMSetupModeRecStdGate ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + uint64 qwChEnable, // channel enable mask for the next acquisition + int64 llMemSamples, // recording length in samples per channel + int64 llPreSamples, // number of samples to record before gate starts + int64 llPostSamples); // number of samples to record after gate ends + +// record FIFO mode gated sampling +bool bSpcMSetupModeRecFIFOGate ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + uint64 qwChEnable, // channel enable mask for the next acquisition + int64 llPreSamples, // number of samples to record before gate starts + int64 llPostSamples, // number of samples to record after gate ends + int64 llGatesToRec = 0); // number of gates to record + + +// *********************************************************************** + +// replay standard mode single +bool bSpcMSetupModeRepStdSingle ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + uint64 qwChEnable, // channel enable mask for the next generation + int64 llMemSamples); // samples to replay after trigger event + +// replay standard mode looped +bool bSpcMSetupModeRepStdLoops ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + uint64 qwChEnable, // channel enable mask for the next generation + int64 llMemSamples, // samples to replay after trigger event + int64 llLoops = 0); // loops to replay (0 --> infinite continuous replay) + +// replay standard mode single restart +bool bSpcMSetupModeRepStdSingleRestart ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + uint64 qwChEnable, // channel enable mask for the next generation + int64 llMemSamples, // samples to replay after trigger event + int64 llLoops = 0); // loops to replay (0 --> infinite continuous replay) + +// replay FIFO mode single +bool bSpcMSetupModeRepFIFOSingle ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + uint64 qwChEnable, // channel enable mask for the next acquisition + int64 llBlockToRep = 0, // blocks and loops can define the maximum replay length + int64 llLoopToRep = 0); // in FIFO mode as Block * Loop. If zero we run continuously + +// *********************************************************************** + +// standard mode multiple replay +bool bSpcMSetupModeRepStdMulti ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + uint64 qwChEnable, // channel enable mask for the next generation + int64 llMemSamples, // replay length in samples per channel + int64 llSegmentSize, // size of each segment + int64 llSegmentsToRep = 1); // segments to replay (0 = infinite, 1 = memsize once, N = number of segments) + +// FIFO mode multiple replay +bool bSpcMSetupModeRepFIFOMulti ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + uint64 qwChEnable, // channel enable mask for the next generation + int64 llSegmentSize, // size of each segment + int64 llSegmentsToRep = 0); // segments to replay (0 = infinite, N = number of segments) + +// *********************************************************************** + +// standard mode gated replay +bool bSpcMSetupModeRepStdGate ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + uint64 qwChEnable, // channel enable mask for the next generation + int64 llMemSamples, // recording length in samples per channel + int64 llGatesToRep = 1); // gates to replay (0 = infinte, 1 = memsize once, N = number of gates) + +// FIFO mode gated replay +bool bSpcMSetupModeRepFIFOGate ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + uint64 qwChEnable, // channel enable mask for the next generation + int64 llGatesToRep = 0); // gates to replay (0 = infinte, N = number of gates) + +// *********************************************************************** + +bool bSpcMSetupModeRepSequence ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + uint64 qwChEnable, // channel enable mask for the next generation + uint32 dwMaxSegments); // count of divided main sample memory segments + +// *********************************************************************** + + + +/* +************************************************************************** +bSpcMSetupClockXXX + +setup the clock engine for different modes +************************************************************************** +*/ + +// internal clock using PLL +bool bSpcMSetupClockPLL ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + int64 llSamplerate, // desired sampling rate + bool bClockOut = false); // clock output enable + +// internal clock using high precision quartz +bool bSpcMSetupClockQuartz ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + int64 llSamplerate, // sampling rate if internal clock mode + bool bClockOut = false); // clock output enable + +// external clock +bool bSpcMSetupClockExternal ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + int32 lExtRange = EXRANGE_LOW,// external clock range if external clock mode is used (M2i only) + bool bClockTerm = true, // enable clock termination (50 ohm) + int32 lDivider = 1); // clock divider + +// reference clock +bool bSpcMSetupClockRefClock ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + int32 lRefClock, // reference clock speed if using ref clock mode + int64 llSamplerate, // desired sampling rate + bool bClockTerm = true); // enable clock termination (50 ohm) + + + +/* +************************************************************************** +bSpcMSetupTriggerXXX + +setup the trigger engine for different modes +************************************************************************** +*/ + +// software trigger +bool bSpcMSetupTrigSoftware ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + bool bTrigOut = false); // enable trigger output + +// external trigger (if input is using comparators the levels are set to TTL) +bool bSpcMSetupTrigExternal ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + int32 lExtMode, // external trigger mode + bool bTrigTerm = true, // trigger termination active + int32 lPulsewidth = 0, // programmable pulsewidth for all external + pulsewidth modes + bool bSingleSrc = true, // acts as single trigger source, all other masks cleared + int32 lExtLine = 0); // standard external trigger is line 0 + +// external analog trigger with programmable levels +bool bSpcMSetupTrigExternalLevel ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + int32 lExtMode, // external trigger mode + int32 lLevel0 = 1500, // trigger level 0 (mV) + int32 lLevel1 = 800, // trigger level 1 (mV) + bool bTrigTerm = true, // trigger termination active + bool bACCoupling = false, // programmable AC coupling + int32 lPulsewidth = 0, // programmable pulsewidth for all external + pulsewidth modes + bool bSingleSrc = true, // acts as single trigger source, all other masks cleared + int32 lExtLine = 0); // standard external trigger is line 0 + +// additional BaseXIO trigger +bool bSpcMSetupTrigXIO ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + int32 lXIOMode, // external trigger mode + bool bSingleSrc = true, // acts as single trigger source, all other masks cleared + int32 lXIOLine = 0); // standard XIO trigger is line 0 + +// channel trigger is set for each channel separately +bool bSpcMSetupTrigChannel ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + int32 lChannel, // channel to modify + int32 lTrigMode, // channel trigger mode + int32 lTrigLevel0 = 0, // level 0 + int32 lTrigLevel1 = 0, // level 1 + int32 lPulsewidth = 0, // programmable pulsewidth for channel + bool bTrigOut = false, // trigger output + bool bSingleSrc = true); // acts as single trigger source, all other masks cleared + +// this function sets the trigger masks (bSingleSrc of other commands must be false to use this) +bool bSpcMSetupTrigMask ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + uint32 dwChannelOrMask0, // or mask of all available channels + uint32 dwChannelOrMask1 = 0, // ... + uint32 dwChannelAndMask0 = 0, // and mask of all available channels + uint32 dwChannelAndMask1 = 0, // ... + uint32 dwTrigOrMask = 0, // trigger or mask (software external, basexio) + uint32 dwTrigAndMask = 0); // trigger and mask (software external, basexio) + + + +/* +************************************************************************** +bSpcMSetupInputChannel + +allows all input channel related settings. if one of the setup like +termination or differential inputs is not available on the card the +setting is simply ignored +************************************************************************** +*/ + +bool bSpcMSetupInputChannel ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + int32 lChannel, // channel to change + int32 lInputRange, // input range in mV = (max-min)/2, =1000 for +/-1V range + bool bTerm = true, // set input termination (50 ohm) if available + int32 lInputOffset = 0, // programmable input offset as listed in the manual + bool bDiffInput = false); // set differential input if available + +// *********************************************************************** +// suitable for M3i series with enhanced inputs + +bool bSpcMSetupPathInputCh ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + int32 lChannel, // channel to change + int32 lPath, // input path + int32 lInputRange, // input range in mV = (max-min)/2, =1000 for +/-1V range + int32 lOffset_percent = 0, // offset in percent, if available + bool bTerm = true, // set input termination (50 ohm) if available + bool bACCoupling = false, // AC coupling activated + bool bBWLimit = false, // bandwidth limit activated + bool bDiffInput = false); // set differential input if available + + +/* +************************************************************************** +bSpcMSetupAnalogOutputChannel + +allows all analog output channel related settings. if one of the setup like +DoubleOut is not available on the card the setting is simply ignored +************************************************************************** +*/ + +bool bSpcMSetupAnalogOutputChannel ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + int32 lChannel, // channel to change + int32 lAmplitude, // output amplitude in mV = (max-min)/2, =1000 for +/-1V range + int32 lOutputOffset = 0, // programmable output offset as listed in the manual + int32 lFilter = 0, // programmable output filter as listed in the manual + int32 lStopMode = SPCM_STOPLVL_ZERO, // defines the behavior after replay or while replay is pausing + bool bDoubleOut = false, // enables identical output on two channels of one module (if available) + bool bDifferential = false); // enables differential output on two channels of one module (if available) + + + +/* +************************************************************************** +bSpcMSetupDigitalXXXModul + +allows all input and output channel related settings for one group of +channels. If one of the setups like the programmable output levels is not +available this setup is simply ignored +************************************************************************** +*/ + +bool bSpcMSetupDigitalOutput ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + int32 lGroup, // module/group of channels to change + int32 lStopMode = SPCM_STOPLVL_LOW, // defines the behavior after replay or while replay is pausing + int32 lLowLevel = 0, // low level in mV if output is programmable + int32 lHighLevel = 3300, // high level in mV if output levels are programmable + bool bDiffMode = false); // hardware differential mode if available + +bool bSpcMSetupDigitalInput ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + int32 lGroup, // module/group of channels to change + bool bTerm = true); // input termination + + + +/* +************************************************************************** +bSpcMSetupTimestamp + +set up the timestamp mode and performs a synchronisation with refernce +clock if that mode is activated +************************************************************************** +*/ + +bool bSpcMSetupTimestamp ( // returns false if error occured, otherwise true + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + int32 lMode, // mode for timestamp + uint32 dwRefTimeoutMS); // timeout in milli seconds for synchronisation with reference clock + +#endif diff --git a/Cpp/examples/c_cpp/common/spcm_lib_data.cpp b/Cpp/examples/c_cpp/common/spcm_lib_data.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6d33ebb86f9de50518b284c5c67bc286abe50c9b --- /dev/null +++ b/Cpp/examples/c_cpp/common/spcm_lib_data.cpp @@ -0,0 +1,679 @@ +/* +************************************************************************** + +spcm_lib_data.cpp (c) Spectrum GmbH + +************************************************************************** + +Offers simple data manipulation routines for the SpcMDrv data format. +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_data.h" + + +// ----- standard c include files ----- +#include <stdio.h> +#include <string.h> + +#define _USE_MATH_DEFINES +#include <math.h> + + +/* +************************************************************************** +bSpcMDemuxDigitalInputData + +demultiplexes the digital input data to seperate arrays. +The data buffers for the demultiplexed data must be allocated by the +caller. Each buffer must be of the size (LenInSamples) +************************************************************************** +*/ + +bool bSpcMDemuxDigitalInputDataToUInt8 (ST_SPCM_CARDINFO *pstCardInfo, void *pvMuxData, uint32 dwLenInSamples, uint8 **ppbyData) + { + uint32 dwSample; + int32 lCh; + uint8* ppbyChPtr[SPCM_MAX_AICHANNEL]; + + if (!pstCardInfo || !pvMuxData) + return false; + + // set the sorting table for the channels + for (lCh=0; lCh < pstCardInfo->lSetChannels; lCh++) + ppbyChPtr[lCh] = ppbyData[lCh]; + + // if two modules are active data is sorted mod0ch0, mod1ch0, mod0ch1, ... + if (pstCardInfo->qwSetChEnableMap & ~((1 << (pstCardInfo->lMaxChannels / pstCardInfo->lModulesCount)) - 1)) + for (lCh=0; lCh < (pstCardInfo->lSetChannels >> 1); lCh++) + { + ppbyChPtr[2 * lCh + 0] = ppbyData[lCh]; + ppbyChPtr[2 * lCh + 1] = ppbyData[(pstCardInfo->lSetChannels >> 1) + lCh]; + } + + uint8* pbyMuxBuf = (uint8*) pvMuxData; + + for (dwSample = 0; dwSample < dwLenInSamples; dwSample++) + for (lCh = 0; lCh < pstCardInfo->lSetChannels; lCh++) + *ppbyChPtr[lCh]++ = *pbyMuxBuf++; + + return true; + } + + +/* +************************************************************************** +bSpcMDemuxDigitalDataToInt8 + +demultiplexes the digital channel data to seperate arrays. At 64 bit are +the both inner words swapped to compensate the hardware-order. +The data buffers for the demultiplexed data must be allocated by the +caller. +************************************************************************** +*/ + +bool bSpcMDemuxDigitalDataToInt8 (ST_SPCM_CARDINFO *pstCardInfo, void *pvMuxData, uint32 dwLenInSamples, int8 **ppbyData) + { + int16 nGroupSample; + int8 bySample; + int32 lIdxOffset, lChIdx, lSampleIdx; + uint32 dwGroupIdx; + int16* ppnBuf; + + ppnBuf = (int16*)pvMuxData; + lSampleIdx = -1; + + // split data + for (dwGroupIdx=0; dwGroupIdx < (dwLenInSamples * pstCardInfo->lSetChannels) / 16; dwGroupIdx++) + { + + nGroupSample = ppnBuf[dwGroupIdx]; + + switch (pstCardInfo->lSetChannels) + { + // 1, 2, 4, 8 channels + case 1: + case 2: + case 4: + case 8: + for (lChIdx=0; lChIdx < 16; lChIdx++) + { + + if (!(lChIdx%pstCardInfo->lSetChannels)) + lSampleIdx++; + + bySample = (int8)(nGroupSample & 0x0001); + nGroupSample = nGroupSample >> 1; + + ppbyData[lChIdx%pstCardInfo->lSetChannels][lSampleIdx] = bySample; + } + + break; + + // 16 channels + case 16 : + for (lChIdx=0; lChIdx < 16; lChIdx++) + { + bySample = (int8)(nGroupSample & 0x0001); + nGroupSample = nGroupSample >> 1; + + ppbyData[lChIdx][dwGroupIdx] = bySample; + } + + break; + + // 32 channels + case 32 : + if (!(dwGroupIdx%2)) + { + lIdxOffset = 0; + lSampleIdx++; + } + else + lIdxOffset = 16; + + for (lChIdx=0; lChIdx < 16; lChIdx++) + { + bySample = (int8)(nGroupSample & 0x0001); + nGroupSample = nGroupSample >> 1; + + ppbyData[lChIdx + lIdxOffset][lSampleIdx] = bySample; + } + + break; + + // 64 channels + case 64 : + switch (dwGroupIdx%4) + { + case 0 : + lIdxOffset = 0; + lSampleIdx++; + break; + case 1 : + lIdxOffset = 32; + break; + case 2 : + lIdxOffset = 16; + break; + case 3 : + lIdxOffset = 48; + break; + } + + for (lChIdx=0; lChIdx < 16; lChIdx++) + { + bySample = (int8)(nGroupSample & 0x0001); + nGroupSample = nGroupSample >> 1; + + ppbyData[lChIdx + lIdxOffset][lSampleIdx] = bySample; + } + + break; + + default: + return false; + } + } + + return true; + } + + +/* +************************************************************************** +dSpcMIntToVoltage: recalculates an integer value to a voltage value taking +selected range and selected offset into account +************************************************************************** +*/ + +double dSpcMIntToVoltage (ST_SPCM_CARDINFO *pstCardInfo, int32 lChannel, double dValue) + { + if (!pstCardInfo) + return 0; + + if ((lChannel < 0) || (lChannel >= pstCardInfo->lMaxChannels)) + { + sprintf (pstCardInfo->szError, "SpcMIntToVoltage: channel number %d not valid. Channels range from 0 to %d\n", lChannel, pstCardInfo->lMaxChannels); + return 0; + } + + double dVoltage_mv; + + // recalculate with input range + dVoltage_mv = pstCardInfo->uCfg.stAI.lSetRange[lChannel] * dValue / pstCardInfo->uCfg.stAI.lMaxADCValue; + + // add the signal offset + if (pstCardInfo->uCfg.stAI.astPath[pstCardInfo->uCfg.stAI.lSetPath[lChannel]].bOffsPercentMode) + dVoltage_mv -= pstCardInfo->uCfg.stAI.lSetRange[lChannel] * pstCardInfo->uCfg.stAI.lSetOffset[lChannel] / 100; + else + dVoltage_mv -= pstCardInfo->uCfg.stAI.lSetOffset[lChannel]; + + return (dVoltage_mv / 1000.0); + } + + + +/* +************************************************************************** +bSpcMDemuxAnalogDataToVoltage + +demultiplexes the analog channel data to seperate arrays. +The data buffers for the demultiplexed data must be allocated by the +caller. Each buffer must be of the size (LenInSamples * sizeof(float)) + +Recalculates the plain data to voltage levels taking resolution, offset +and range into account. +************************************************************************** +*/ + +bool bSpcMDemuxAnalogDataToVoltage (ST_SPCM_CARDINFO *pstCardInfo, void *pvMuxData, uint32 dwLenInSamples, float **ppfData) + { + uint32 dwSample; + int32 lCh; + float* ppfChPtr[SPCM_MAX_AICHANNEL]; + double dOffset[SPCM_MAX_AICHANNEL], dFactor[SPCM_MAX_AICHANNEL]; + + if (!pstCardInfo || !pvMuxData) + return false; + + // set the sorting table for the channels + for (lCh=0; lCh < pstCardInfo->lSetChannels; lCh++) + ppfChPtr[lCh] = ppfData[lCh]; + + // if two modules are active data is sorted mod0ch0, mod1ch0, mod0ch1, ... + if (pstCardInfo->qwSetChEnableMap & ~((1 << (pstCardInfo->lMaxChannels / pstCardInfo->lModulesCount)) - 1)) + for (lCh=0; lCh < (pstCardInfo->lSetChannels >> 1); lCh++) + { + ppfChPtr[2 * lCh + 0] = ppfData[lCh]; + ppfChPtr[2 * lCh + 1] = ppfData[(pstCardInfo->lSetChannels >> 1) + lCh]; + } + + // calculate offset and factor for re-calculation to voltage + for (lCh=0; lCh < pstCardInfo->lSetChannels; lCh++) + { + dFactor[lCh] = (double) pstCardInfo->uCfg.stAI.lSetRange[lCh] / pstCardInfo->uCfg.stAI.lMaxADCValue / 1000.0; + + // add the signal offset + if (pstCardInfo->uCfg.stAI.astPath[pstCardInfo->uCfg.stAI.lSetPath[lCh]].bOffsPercentMode) + dOffset[lCh] = -(double) pstCardInfo->uCfg.stAI.lSetRange[lCh] * pstCardInfo->uCfg.stAI.lSetOffset[lCh] / 100.0 / 1000.0; + else + dOffset[lCh] = -(double) pstCardInfo->uCfg.stAI.lSetOffset[lCh] / 1000.0; + } + + // split word data + if (pstCardInfo->lBytesPerSample > 1) + { + int16* pnMuxBuf = (int16*) pvMuxData; + + for (dwSample = 0; dwSample < dwLenInSamples; dwSample++) + for (lCh = 0; lCh < pstCardInfo->lSetChannels; lCh++) + *ppfChPtr[lCh]++ = (float) (dOffset[lCh] + dFactor[lCh] * *pnMuxBuf++); + } + + // split byte data + else + { + int8* pbyMuxBuf = (int8*) pvMuxData; + + for (dwSample = 0; dwSample < dwLenInSamples; dwSample++) + for (lCh = 0; lCh < pstCardInfo->lSetChannels; lCh++) + *ppfChPtr[lCh]++ = (float) (dOffset[lCh] + dFactor[lCh] * *pbyMuxBuf++); + } + + return true; + } + + + +/* +************************************************************************** +bMMuxData + +multiplexes a series of channels into one buffer. The function retains +the information how much bytes one sample has from the CardInfo structure. +The source buffers must be same format and the destination buffer must be +lSetChannels * llMemsize for all the data +************************************************************************** +*/ + +bool bSpcMMuxData (ST_SPCM_CARDINFO *pstCardInfo, void *pvMuxData, uint32 dwLenInSamples, void **ppvData) + { + int32 lCh; + void* ppvChPtr[SPCM_MAX_AOCHANNEL]; + uint32 dwSample; + + if (!pstCardInfo || !pvMuxData) + return false; + + // set the sorting table for the channels + for (lCh = 0; lCh < pstCardInfo->lSetChannels; lCh++) + ppvChPtr[lCh] = ppvData[lCh]; + + // M2i does not use linear sorting if two modules are active + if (pstCardInfo->bM2i) + { + // if two modules are active data is sorted mod0ch0, mod1ch0, mod0ch1, ... + if (pstCardInfo->qwSetChEnableMap & ~((1 << (pstCardInfo->lMaxChannels / pstCardInfo->lModulesCount)) - 1)) + { + for (lCh=0; lCh < (pstCardInfo->lSetChannels >> 1); lCh++) + { + ppvChPtr[2 * lCh + 0] = ppvData[lCh]; + ppvChPtr[2 * lCh + 1] = ppvData[(pstCardInfo->lSetChannels >> 1) + lCh]; + } + } + } + + // now start the mux loop + uint32 dwBytesPerSumSample = (uint32) (pstCardInfo->lSetChannels * pstCardInfo->lBytesPerSample); + uint32 dwBytesPerSample = pstCardInfo->lBytesPerSample; + + for (dwSample = 0; dwSample < dwLenInSamples; dwSample++) + for (lCh = 0; lCh < pstCardInfo->lSetChannels; lCh++) + memcpy (((uint8*) pvMuxData) + dwSample * dwBytesPerSumSample + lCh * dwBytesPerSample, ((uint8*) ppvChPtr[lCh]) + dwSample * dwBytesPerSample, dwBytesPerSample); + + return true; + } + + + +/* +************************************************************************** +bSpcMSplitAnalogAndDigitalData + +If synchronous digital inputs have been used with analog data acquisition, +analog and digital data are stored in combined samples, the digital data +using the upper bits of the analog word. + +This function splits analog and digital data into separate arrays. Analog +data is sign extended to int16 again to use it with any calculation +routine. Digital data + +The caller is responsible to allocate buffer data for the split data. The +analog data buffer must be of the size (LenInSamples * Channels * 2), the +digital data needs (LenInSamples * Channels) +************************************************************************** +*/ + +bool bSpcMSplitAnalogAndDigitalData (ST_SPCM_CARDINFO *pstCardInfo, void *pvMergedData, uint32 dwLenInSamples, void *pvAnalogData, void *pvDigitalData) + { + int16 nSample, nAnalogVal, nDigMask; + uint32 i; + + if (!pstCardInfo || !pvMergedData) + return false; + + int16 *pnMergedData = (int16*)pvMergedData; + int16 *pnAnalogData = (int16*)pvAnalogData; + uint8 *pbyDigitalData = (uint8*)pvDigitalData; + + // split analog and digital part + for (i = 0; i < dwLenInSamples; i++) + { + nSample = pnMergedData[i]; + + if (pstCardInfo->uCfg.stAI.lResolution == 12) + { + + // card resolution = 12 bit -> 4 digital channels + nDigMask = nSample >> 12; + nDigMask &= 0x000f; + + if (nSample & 0x800) + nAnalogVal = nSample | 0xf000; + else + nAnalogVal = nSample & 0x0fff; + } + else + { + + // card resolution = 14 bit -> 2 digital channels + nDigMask = nSample >> 14; + nDigMask &= 0x0003; + + if (nSample & 0x2000) + nAnalogVal = nSample | 0xc000; + else + nAnalogVal = nSample & 0x3fff; + } + + pbyDigitalData[i] = (uint8)nDigMask; + pnAnalogData[i] = nAnalogVal; + } + + return true; + } + + +/* +************************************************************************** +bFillSB5Header + +Fills a SBench5 file header structure with the current setup of pstCard +************************************************************************** +*/ + +bool bFillSB5Header (ST_SPCM_CARDINFO *pstCard, ST_SB5HEAD *pstHeader, const char* pszName) + { + char szSource[25]; + int i; + + if (!pstCard || !pstHeader) + return false; + + // check the arrays that we need + if (!pstHeader->pdSourceFS || !pstHeader->pdYOffset || !pstHeader->pdYScale || !pstHeader->plMuxIdx) + return false; + + // signal type + switch (pstCard->eCardFunction) + { + case AnalogIn: + if (pstCard->lSetChannels == 1) + pstHeader->lSignalType = SIGNAL_TYP_ANALOGTIME; + else + pstHeader->lSignalType = SIGNAL_TYP_ANALOGSTREAM; + switch (pstCard->uCfg.stAI.lResolution) + { + case 8: pstHeader->lSignalType |= SIGNAL_TYP_8BIT | SIGNAL_TYP_1BYTE; break; + case 12: pstHeader->lSignalType |= SIGNAL_TYP_12BIT | SIGNAL_TYP_2BYTE; break; + case 14: pstHeader->lSignalType |= SIGNAL_TYP_14BIT | SIGNAL_TYP_2BYTE; break; + case 16: pstHeader->lSignalType |= SIGNAL_TYP_16BIT | SIGNAL_TYP_2BYTE; break; + default: break; + } + + break; + + case DigitalIn: + case DigitalIO: + if (pstCard->lSetChannels == 1) + pstHeader->lSignalType = SIGNAL_TYP_DIGITALTIME; + else + pstHeader->lSignalType = SIGNAL_TYP_DIGITALSTREAM; + break; + + default: + return false; + } + + // signal name + pstHeader->pszSignalName = new char[strlen(pszName) + 1]; + strcpy (pstHeader->pszSignalName, pszName); + + + // source is card name + sn + switch (pstCard->lCardType & TYP_SERIESMASK) + { + case TYP_M2ISERIES: sprintf (szSource, "M2i.%04x sn %05d", (unsigned)(pstCard->lCardType & TYP_VERSIONMASK), pstCard->lSerialNumber); break; + case TYP_M2IEXPSERIES: sprintf (szSource, "M2i.%04x-Exp sn %05d", (unsigned)(pstCard->lCardType & TYP_VERSIONMASK), pstCard->lSerialNumber); break; + default: sprintf (szSource, "Unknown %04x sn %05d", (unsigned)(pstCard->lCardType & TYP_VERSIONMASK), pstCard->lSerialNumber); break; + } + pstHeader->pszSource = new char[strlen(szSource) + 1]; + strcpy (pstHeader->pszSource, szSource); + + + // fill in the single information + pstHeader->lSumSamples = (int32) pstCard->llSetMemsize * pstCard->lSetChannels; + pstHeader->dXScale = 1.0 / pstCard->llSetSamplerate; + pstHeader->lChannels = pstCard->lSetChannels; + + + // channel information to be stored + switch (pstCard->eCardFunction) + { + case AnalogIn: + for (i=0; i<pstCard->lSetChannels; i++) + { + pstHeader->pdSourceFS[i] = pstCard->uCfg.stAI.lSetRange[i]; + pstHeader->pdYOffset[i] = - (double) pstCard->uCfg.stAI.lSetOffset[i] / 100 * pstCard->uCfg.stAI.lSetRange[i]; + pstHeader->pdYScale[i] = (double) pstCard->uCfg.stAI.lSetRange[i] / pstCard->uCfg.stAI.lMaxADCValue / 1000.0; + } + + // if two modules are active data is sorted mod0ch0, mod1ch0, mod0ch1, ... + if (pstCard->qwSetChEnableMap & ~((1 << (pstCard->lMaxChannels / pstCard->lModulesCount)) - 1)) + for (i=0; i < (pstCard->lSetChannels >> 1); i++) + { + pstHeader->plMuxIdx[2 * i + 0] = i; + pstHeader->plMuxIdx[2 * i + 1] = (pstCard->lSetChannels >> 1) + i; + } + + // all channels on one module + else + for (i=0; i < pstCard->lSetChannels; i++) + pstHeader->plMuxIdx[i] = i; + + break; + } + + return true; + } + + + +/* +************************************************************************** +bCalcSignal: calculates simple signal shapes for output card test +************************************************************************** +*/ + +bool bSpcMCalcSignal (ST_SPCM_CARDINFO *pstCardInfo, void *pvData, uint32 dwLenInSamples, uint32 dwByteWidth, E_SPCM_SIGSHAPE eShape, uint32 dwLoops, uint32 dwGainP, uint32 dwPhase_degree) + { + int64 llMinFS, llMaxFS, llValue; + uint32 i; + int32 lResolution; + double dScale; + int8* pbyData = (int8*) pvData; + int16* pnData = (int16*) pvData; + int32* plData = (int32*) pvData; + int64* pllData = (int64*) pvData; + + if (!pstCardInfo || !pvData || !dwLenInSamples) + return false; + + + // examine the resolution, bytewidth and min/max values + switch (pstCardInfo->eCardFunction) + { + case AnalogIn: + case AnalogOut: + if (pstCardInfo->eCardFunction == AnalogIn) + lResolution = pstCardInfo->uCfg.stAI.lResolution; + else + lResolution = pstCardInfo->uCfg.stAO.lResolution; + + switch (lResolution) + { + default: + case 7: + case 8: + dwByteWidth = 1; + break; + + case 12: + case 14: + case 16: + dwByteWidth = 2; + break; + } + + llMinFS = -pstCardInfo->uCfg.stAO.lMaxDACValue - 1; + llMaxFS = pstCardInfo->uCfg.stAO.lMaxDACValue; + dScale = (double) pstCardInfo->uCfg.stAO.lMaxDACValue * dwGainP / 100.0; + + break; + + case DigitalIn: + case DigitalOut: + case DigitalIO: + if (dwByteWidth == 0) + { + sprintf (pstCardInfo->szError, "ByteWidth can't be zero for digital cards as we didn't know how much channels are activated\n"); + return false; + } + // two complement numbers + llMaxFS = (((uint64) 1 << (8 * dwByteWidth - 1)) - 1); + llMinFS = -llMaxFS - 1; + dScale = ((double) llMaxFS) * dwGainP / 100.0; + break; + } + + + // calculation of different signal shapes + double dSineXScale = 2.0 * M_PI / dwLenInSamples * dwLoops; + uint32 dwBlockLen = dwLenInSamples / dwLoops; + uint32 dwBlockHalf = dwBlockLen / 2; + uint32 dwPosInBlock; + double dSpan = (double) ((uint64) (llMaxFS - llMinFS)); + double dPhase_rad = 2.*M_PI * dwPhase_degree / 360.; + uint32 dwPhase_samples = (uint32)((double)(dwBlockLen * dwPhase_degree) / 360.); + for (i = 0; i < dwLenInSamples; i++) + { + + dwPosInBlock = (i % dwBlockLen); + + // calculation of value + switch (eShape) + { + + // DC level + case eDCZero: llValue = 0; break; + case eDCPlusFS: llValue = llMaxFS; break; + case eDCMinusFS: llValue = llMinFS; break; + + // sine + case eSine: + case eInvertedSine: + llValue = (int64) (dScale * sin (dSineXScale * i + dPhase_rad)); + break; + + // rectangle + case eRectangle: + case eInvertedRectangle: + if (((dwPosInBlock + dwPhase_samples) % dwBlockLen) < dwBlockHalf) + llValue = llMinFS; + else + llValue = llMaxFS; + break; + + // triangle + case eTriangle: + case eInvertedTriangle: + if (((dwPosInBlock - dwPhase_samples) % dwBlockLen) < dwBlockHalf) + llValue = (int64) (llMinFS + ((dwPosInBlock - dwPhase_samples) % dwBlockLen) * dSpan / dwBlockHalf); + else + llValue = (int64) (llMaxFS - (((dwPosInBlock - dwPhase_samples) % dwBlockLen) - dwBlockHalf) * dSpan / dwBlockHalf); + break; + + // sawtooth + case eSawtooth: + case eInvertedSawtooth: + llValue = (int64) (llMinFS + ((dwPosInBlock - dwPhase_samples) % dwBlockLen) * dSpan / dwBlockLen); + break; + + default: + sprintf (pstCardInfo->szError, "Unknown signal shape selected\n"); + return false; + } + + switch (eShape) + { + // invert sign for inverted waveforms + case eInvertedSine: + case eInvertedTriangle: + case eInvertedSawtooth: + case eInvertedRectangle: + llValue *= -1; + break; + default: + // nothing + break; + } + + // write value to array + if (llValue < llMinFS) + llValue = llMinFS; + else if (llValue > llMaxFS) + llValue = llMaxFS; + + switch (dwByteWidth) + { + default: + case 1: *pbyData++ = (int8) llValue; break; + case 2: *pnData++ = (int16) llValue; break; + case 4: *plData++ = (int32) llValue; break; + case 8: *pllData++ = (int64) llValue; break; + } + } // end of for-loop + + return true; + } diff --git a/Cpp/examples/c_cpp/common/spcm_lib_data.h b/Cpp/examples/c_cpp/common/spcm_lib_data.h new file mode 100644 index 0000000000000000000000000000000000000000..2549c8df84ed7dcf3a001bc3a6a5f6193c38a5c9 --- /dev/null +++ b/Cpp/examples/c_cpp/common/spcm_lib_data.h @@ -0,0 +1,319 @@ +/* +************************************************************************** + +spcm_lib_data.h (c) Spectrum GmbH , 01/2006 + +************************************************************************** + +Offers simple data manipulation routines for the SpcMDrv data format. +Feel free to use this source for own projects and modify it in any kind + +************************************************************************** +*/ + + +#ifndef SPCM_LIB_DATA_H +#define SPCM_LIB_DATA_H + +#include <stdio.h> +#include <limits> + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_card.h" +#include "../sb5_file/sb5_file.h" + + +/* +************************************************************************** +bSpcMDemuxDigitalInputDataToUInt8 + +demultiplexes the digital input data to seperate arrays of uint8 values. +The data buffers for the demultiplexed data must be allocated by the +caller. Each buffer must be of the size (LenInSamples) +************************************************************************** +*/ + +bool bSpcMDemuxDigitalInputDataToUInt8 ( + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + void *pvMuxData, // pointer to the muxed data + uint32 dwLenInSamples, // length ot muxed data in samples + uint8 **ppbyData); // array of pointers for demuxed data + + +/* +************************************************************************** +bSpcMDemuxDigitalDataToInt8 + +demultiplexes the digital channel data to seperate arrays of int8 values. +The data buffers for the demultiplexed data must be allocated by the +caller. +************************************************************************** +*/ + +bool bSpcMDemuxDigitalDataToInt8 ( + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + void *pvMuxData, // pointer to the muxed data + uint32 dwLenInSamples, // length ot muxed data in samples + int8 **ppbyData); // array of pointers for demuxed data + + +/* +************************************************************************** +bMMuxData + +multiplexes a series of channels into one buffer. The function retains +the information how much bytes one sample has from the CardInfo structure. +The source buffers must be same format and the destination buffer must be +lSetChannels * llMemsize for all the data +************************************************************************** +*/ + +bool bSpcMMuxData ( + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + void *pvMuxData, // pointer to the empty muxed data buffer + uint32 dwLenInSamples, // length ot channel data in samples + void **ppvData); // array of pointers for demuxed data + + + +/* +************************************************************************** +dSpcMIntToVoltage + +recalculates an integer value to a voltage value taking selected range +and selected offset into account +************************************************************************** +*/ + +double dSpcMIntToVoltage ( // returns the calculated voltage value + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + int32 lChannel, // channel for which the data is valid + double dValue); // channel value + + + +/* +************************************************************************** +bSpcMDemuxAnalogDataToVoltage + +demultiplexes the analog channel data to seperate arrays. +The data buffers for the demultiplexed data must be allocated by the +caller. Each buffer must be of the size (LenInSamples * sizeof(float)) + +Recalculates the plain data to voltage levels taking resolution, offset +and range into account. +************************************************************************** +*/ + +bool bSpcMDemuxAnalogDataToVoltage ( + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + void *pvMuxData, // pointer to the muxed data + uint32 dwLenInSamples, // length ot muxed data in samples + float **ppfData); // array of pointers for demuxed data + + + +/* +************************************************************************** +bSplitAnalogAndDigitalData + +If synchronous digital inputs have been used with analog data acquistion, +analog and digital data are stored in combined samples, the digital data +using the upper bits of the analog word. + +This function splits analog and digital data into separate arrays. Analog +data is sign extended to int16 again to use it with any calculation +routine. Digital data + +The caller is responsible to allocate buffer data for the split data. The +analog data buffer must be of the size (LenInSamples * Channels * 2), the +digital data needs (LenInSamples * Channels) +************************************************************************** +*/ + +bool bSpcMSplitAnalogAndDigitalData ( + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + void *pvMergedData, // pointer to the merged data + uint32 dwLenInSamples, // length ot merged data in samples + void *pvAnalogData, // pointer to a free buffer for analog data + void *pvDigitalData); // pointer to a free buffer for digital data + + + +/* +************************************************************************** +vFillSB5Header + +Fills a SBench5 file header structure with the current setup of pstCard +************************************************************************** +*/ + +bool bFillSB5Header ( + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + ST_SB5HEAD *pstHeader, // pointer to an empty header structure + const char* pszName); // name of signal + + +/* +************************************************************************** +TCalcXXX + +some simple calculation routines for generic data +************************************************************************** +*/ + + +// remove existing Windows min,max definitions so allow std:: functions +#ifdef max +# undef max +#endif + +#ifdef min +# undef min +#endif + + +// *********************************************************************** +template <class T> +T TSpcMCalcMin( // returns the min value of the signal + T* pTData, // generic data array + uint32 lLenInSamples) // length of the data array + { + if (!pTData) + return 0; + + T TMin = std::numeric_limits < T >::max (); + + for (uint32 j = 0; j < lLenInSamples; j++, pTData++) + if (*pTData < TMin) + TMin = *pTData; + + return TMin; + } + + +// *********************************************************************** +template <class T> +T TSpcMCalcMax( // returns the max value of the signal + T* pTData, // generic data array + uint32 lLenInSamples) // length of the data array + { + if (!pTData) + return 0; + + T TMax = std::numeric_limits < T >::min (); + + + for (uint32 j = 0; j < lLenInSamples; j++, pTData++) + if (*pTData > TMax) + TMax = *pTData; + + return TMax; + } + + +// *********************************************************************** +template <class T> +double dSpcMCalcAverage( // returns the average (DC) of the signal + T* pTData, // generic data array + uint32 lLenInSamples) // length of the data array + { + if (!pTData) + return 0; + + uint32 j; + double dAverage; + + for (dAverage = 0, j = 0; j < lLenInSamples; j++, pTData++) + dAverage += *pTData; + + return (dAverage / lLenInSamples); + } + + +/* +************************************************************************** +bSpcMDemuxAnalogData + +demultiplexes the analog channel data to seperate arrays. +The data buffers for the demultiplexed data must be allocated by the +caller. Each buffer must be of the size (LenInSamples * BytesPerSample) +************************************************************************** +*/ + +template <typename T_MuxData, typename T_ChData> +bool bSpcMDemuxAnalogData ( + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure + T_MuxData *pTMuxData, // pointer to the muxed data + uint32 dwLenInSamples, // length ot muxed data in samples + T_ChData **ppTChannelData) // generic array of pointers for demuxed data + { + uint32 dwSample; + int32 lCh; + T_ChData* ppTChPtr[SPCM_MAX_AICHANNEL]; + + if (!pstCardInfo || !pTMuxData) + return false; + + // set the sorting table for the channels + for (lCh=0; lCh < pstCardInfo->lSetChannels; lCh++) + ppTChPtr[lCh] = ppTChannelData[lCh]; + + // if two modules are active data is sorted mod0ch0, mod1ch0, mod0ch1, ... + if (pstCardInfo->qwSetChEnableMap & ~((1 << (pstCardInfo->lMaxChannels / pstCardInfo->lModulesCount)) - 1)) + for (lCh=0; lCh < (pstCardInfo->lSetChannels >> 1); lCh++) + { + ppTChPtr[2 * lCh + 0] = ppTChannelData[lCh]; + ppTChPtr[2 * lCh + 1] = ppTChannelData[(pstCardInfo->lSetChannels >> 1) + lCh]; + } + + for (dwSample = 0; dwSample < dwLenInSamples; dwSample++) + for (lCh = 0; lCh < pstCardInfo->lSetChannels; lCh++) + *ppTChPtr[lCh]++ = *pTMuxData++; + + return true; + } + +/* +************************************************************************** +bCalcSignal + +calculates simple signal shapes for output card test +************************************************************************** +*/ + +// signal shapes +typedef enum E_SPCM_SIGSHAPE + { + eDCZero, // zero level + eDCPlusFS, // positive full scale level (max) + eDCMinusFS, // negative full scale level (min) + eSine, // sine signal, one full 360° sine per loop + eRectangle, // rectangle with 50% duty + eTriangle, // triangle starting at -full scale level + eSawtooth, // sawtooth starting at -full scale level + eInvertedSine, // like eSine, but with inverted sign + eInvertedRectangle, // like eRectangle, but with inverted sign + eInvertedTriangle, // like eTriangle, but with inverted sign + eInvertedSawtooth // like eSawtooth, but with inverted sign + } E_SPCM_SIGSHAPE; + + +bool bSpcMCalcSignal ( // return true if calculation has succeeded + ST_SPCM_CARDINFO *pstCardInfo, // pointer to a filled card info structure (needed for resolution) + void *pvData, // pointer to free buffer for calculated data + uint32 dwLenInSamples, // length of the data array in samples + uint32 dwByteWidth = 0,// bytes width (for digital cards), if zero we expect a matching width to analog resolution + E_SPCM_SIGSHAPE eShape = eSine, // shape of signal to calculate + uint32 dwLoops = 1, // number of loops in calculated signal + uint32 dwGainP = 100, // gain in percent in relation to resolution + uint32 dwPhase_degree = 0 // phase of signal in degrees + ); + +#endif diff --git a/Cpp/examples/c_cpp/common/spcm_lib_thread.cpp b/Cpp/examples/c_cpp/common/spcm_lib_thread.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9193145fad3ec758943a8893cec4162018850945 --- /dev/null +++ b/Cpp/examples/c_cpp/common/spcm_lib_thread.cpp @@ -0,0 +1,723 @@ +/* +************************************************************************** + +spcm_lib_thread.cpp (c) Spectrum GmbH + +************************************************************************** + +Offers data transfer threads for sample data, timestamp data and ABA date. +Each thread get's a bundle of parameters including a work function that +is used to do something with the data. These threads are used in all our +FIFO examples. + +************************************************************************** +*/ + + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_thread.h" + +// ----- standard c include files ----- +#include <stdio.h> +#include <string.h> + + + +/* +************************************************************************** +bInitThreadStructure: initializes all mutexes and events. If the parameter +hSharedUpdate is set we do not allocate a new event for updat ebut use +this one as a shared event +************************************************************************** +*/ + +bool bInitThreadStructure (ST_THREADDATA* pstThreadData, SPCM_EVENT_HANDLE* phSharedEventUpdate) + { + bool bSetupOk = true; + + // initialize the structre with 0 + memset (pstThreadData, 0, sizeof (ST_THREADDATA)); + + // init the mutex and the events + bSetupOk &= (bSetupOk && spcm_bCreateMutex (&pstThreadData->hMutexSharedAccess)); + bSetupOk &= (bSetupOk && spcm_bCreateEvent (&pstThreadData->hEventInitDone)); + bSetupOk &= (bSetupOk && spcm_bCreateEvent (&pstThreadData->hEventStart)); + bSetupOk &= (bSetupOk && spcm_bCreateEvent (&pstThreadData->hEventStartDone)); + bSetupOk &= (bSetupOk && spcm_bCreateEvent (&pstThreadData->hEventTermDone)); + + // if a shared event is given we store this and set a matching flag + if (phSharedEventUpdate != NULL) + { + pstThreadData->phSharedUpdate = phSharedEventUpdate; + pstThreadData->bSharedUpdate = true; + } + + // otherwise we allocate a new event + else + { + bSetupOk &= (bSetupOk && spcm_bCreateEvent (&pstThreadData->hEventUpdate)); + pstThreadData->phSharedUpdate = &pstThreadData->hEventUpdate; + pstThreadData->bSharedUpdate = false; + } + + return bSetupOk; + } + + + +/* +************************************************************************** +vCleanThreadStructure: clean up (we don't need to care for correct +initialisation as this is checked in the close routines) +************************************************************************** +*/ + +void vCleanThreadStructure (ST_THREADDATA* pstThreadData) + { + spcm_vCloseMutex (&pstThreadData->hMutexSharedAccess); + spcm_vCloseEvent (&pstThreadData->hEventStart); + spcm_vCloseEvent (&pstThreadData->hEventInitDone); + spcm_vCloseEvent (&pstThreadData->hEventStartDone); + spcm_vCloseEvent (&pstThreadData->hEventTermDone); + + if (!pstThreadData->bSharedUpdate) + spcm_vCloseEvent (&pstThreadData->hEventUpdate); + } + + + + +/* +************************************************************************** +main loop. the loop cares for card, data, timestamp and aba data all +enabled by flags in the pstBufferData structure. + +This loop can be either called directly or from within the thread function. +if it's called from the thread function it will handle the mutexes and +events also. + +Mainly the loop does the following steps: + + Call bWorkSetup (user function to setup all details) + Allocate memory for buffer + Start card and transfers depending on the flags that have been set + Loop + Wait for interrupt that announces new data or timeout to occur + Read Status and current positions in the buffers + Recalculate positions and length + Call bWorkDo (user function) with the available data + Set the data that was processed available to card again + Until (Abort OR Error) + Call vWorkClose (user function to close files and clean up) + Clean up buffers + +************************************************************************** +*/ + + +void vMainLoop ( + ST_BUFFERDATA* pstBufferData, // filled card info structure + void* pvWorkData, // working data structure that is passed to the calback functions + SPCM_WORK_INIT* pfn_bWorkSetup, // callback function for pre-run setup + SPCM_WORK_DO* pfn_bWorkDo, // callback function that is called if new data is available + SPCM_WORK_CLOSE* pfn_vWorkClose, // callback function at the end of run + SPCM_ABORTCHECK* pfn_bAbortCheck, // callback function for abort checking on each update loop + ST_THREADDATA* pstThreadData) // threaddata for synchronization. Can be NULL if non threaded version is used + +// *********************************************************************** + + { + void* pvDataBuffer = NULL; + void* pvTSBuffer = NULL; + void* pvABABuffer = NULL; + int32 lStartCmd = 0; + int32 lWaitCmd = 0; + int32 lStatus = 0; + int64 llAvailPos = 0; + uint32 dwError = ERR_OK; + bool bContMemUsed = false; + + + // secure the initialisation + if (pstThreadData) + spcm_vGetMutex (&pstThreadData->hMutexSharedAccess); + + // first we do the setup + pstBufferData->qwDataTransferred = 0; + pstBufferData->qwTSTransferred = 0; + pstBufferData->qwABATransferred = 0; + pstBufferData->dwError = ERR_OK; + if (pfn_bWorkSetup) + if (!(*pfn_bWorkSetup) (pvWorkData, pstBufferData)) + { + printf ("Setup failed!\n"); + dwError = ERR_INIT; + } + + + + // now the setup routine has defined the buffer details and we allocate data + if (!dwError) + { + if (pstBufferData->bStartData) + { + + // try to use cont mem buffer if size matches + uint64 qwContBufLen = 0; + spcm_dwGetContBuf_i64 (pstBufferData->pstCard->hDrv, SPCM_BUF_DATA, &pvDataBuffer, &qwContBufLen); + bContMemUsed = (qwContBufLen >= pstBufferData->dwDataBufLen); + if (!bContMemUsed) + pvDataBuffer = pvAllocMemPageAligned (pstBufferData->dwDataBufLen); + } + if (pstBufferData->bStartTimestamp) + pvTSBuffer = pvAllocMemPageAligned (pstBufferData->dwTSBufLen); + if (pstBufferData->bStartABA) + pvABABuffer = pvAllocMemPageAligned (pstBufferData->dwABABufLen); + if ((!pvDataBuffer && pstBufferData->bStartData) || (!pvTSBuffer && pstBufferData->bStartTimestamp) || (!pvABABuffer && pstBufferData->bStartABA)) + { + printf ("Memory Allocation Error\n"); + dwError = ERR_MEMALLOC; + } + } + + + // all is prepared and we define the buffers for the transfer + if (!pstBufferData->dwError && pstBufferData->bStartData) + pstBufferData->dwError = spcm_dwDefTransfer_i64 (pstBufferData->pstCard->hDrv, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, (uint32) pstBufferData->dwDataNotify, pvDataBuffer, 0, pstBufferData->dwDataBufLen); + if (!pstBufferData->dwError && pstBufferData->bStartTimestamp) + pstBufferData->dwError = spcm_dwDefTransfer_i64 (pstBufferData->pstCard->hDrv, SPCM_BUF_TIMESTAMP, SPCM_DIR_CARDTOPC, (uint32) pstBufferData->dwTSNotify, pvTSBuffer, 0, pstBufferData->dwTSBufLen); + if (!pstBufferData->dwError && pstBufferData->bStartABA) + pstBufferData->dwError = spcm_dwDefTransfer_i64 (pstBufferData->pstCard->hDrv, SPCM_BUF_ABA, SPCM_DIR_CARDTOPC, (uint32) pstBufferData->dwABANotify, pvABABuffer, 0, pstBufferData->dwABABufLen); + + + // send a message that the initialisation has been done + if (pstThreadData) + { + pstThreadData->dwEventFlags |= EVENTFLAG_INITDONE; + spcm_vSignalEvent (&pstThreadData->hEventInitDone); + } + + + // start of the card together with all transfers if enabled + if (!dwError) + { + + // wait for the start event from the main thread + if (pstThreadData) + { + if ((pstThreadData->dwEventFlags & EVENTFLAG_START) == 0) + spcm_bWaitEventWithMutex (&pstThreadData->hEventStart, &pstThreadData->hMutexSharedAccess); + spcm_vReleaseMutex (&pstThreadData->hMutexSharedAccess); + } + + if (pstBufferData->bStartCard) + lStartCmd = M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER; + + if (pstBufferData->bStartData) + { + lStartCmd |= M2CMD_DATA_STARTDMA; + lWaitCmd |= M2CMD_DATA_WAITDMA; + } + + if (pstBufferData->bStartExtraDMA) + lStartCmd |= M2CMD_EXTRA_STARTDMA; + + if (pstBufferData->bStartTimestamp || pstBufferData->bStartABA) + lWaitCmd |= M2CMD_EXTRA_WAITDMA; + + spcm_dwSetParam_i32 (pstBufferData->pstCard->hDrv, SPC_TIMEOUT, pstBufferData->lTimeout); + dwError = spcm_dwSetParam_i32 (pstBufferData->pstCard->hDrv, SPC_M2CMD, lStartCmd); + + if (pstThreadData) + { + pstThreadData->dwEventFlags |= EVENTFLAG_STARTDONE; + spcm_vSignalEvent (&pstThreadData->hEventStartDone); + } + } + + + + // this is the main loop that waits for data. As we defined a timeout this routine is latest called in our timeout interval + while (!dwError) + { + dwError = spcm_dwSetParam_i32 (pstBufferData->pstCard->hDrv, SPC_M2CMD, lWaitCmd); + spcm_dwGetParam_i32 (pstBufferData->pstCard->hDrv, SPC_M2STATUS, &lStatus); + + // Recording complete (for setups with SPC_LOOPS != 0)? + if (lStatus & M2STAT_DATA_END) + { + // DATA_END can also occur if all data has been transfered from card after overrun + if (lStatus & M2STAT_DATA_OVERRUN) + dwError = ERR_FIFOHWOVERRUN; + else + if (pstBufferData->llDataAvailBytes == 0) + dwError = ERR_FIFOFINISHED; + } + + // secure the following access as it's the main data loop + if (pstThreadData) + spcm_vGetMutex (&pstThreadData->hMutexSharedAccess); + + + // read out the current position of data buffer and recalculate it to avoid rollover + if (pstBufferData->bStartData) + { + spcm_dwGetParam_i64 (pstBufferData->pstCard->hDrv, SPC_DATA_AVAIL_USER_LEN, &pstBufferData->llDataAvailBytes); + spcm_dwGetParam_i64 (pstBufferData->pstCard->hDrv, SPC_DATA_AVAIL_USER_POS, &llAvailPos); + if ((llAvailPos + pstBufferData->llDataAvailBytes) >= pstBufferData->dwDataBufLen) + pstBufferData->llDataAvailBytes = (uint64) (pstBufferData->dwDataBufLen - llAvailPos); + pstBufferData->pvDataCurrentBuf = (void*) (((char*) pvDataBuffer) + llAvailPos); + } + + + // read out the timestanp positions and recalculate it to avoid rollover + if (pstBufferData->bStartTimestamp) + { + spcm_dwGetParam_i64 (pstBufferData->pstCard->hDrv, SPC_TS_AVAIL_USER_LEN, &pstBufferData->llTSAvailBytes); + spcm_dwGetParam_i64 (pstBufferData->pstCard->hDrv, SPC_TS_AVAIL_USER_POS, &llAvailPos); + if ((llAvailPos + pstBufferData->llTSAvailBytes) >= pstBufferData->dwTSBufLen) + pstBufferData->llTSAvailBytes = pstBufferData->dwTSBufLen - llAvailPos; + pstBufferData->pvTSCurrentBuf = (void*) (((char*) pvTSBuffer) + llAvailPos); + } + + + // read out the ABA positions and recalculate it to avoid rollover + if (pstBufferData->bStartABA) + { + spcm_dwGetParam_i64 (pstBufferData->pstCard->hDrv, SPC_ABA_AVAIL_USER_LEN, &pstBufferData->llABAAvailBytes); + spcm_dwGetParam_i64 (pstBufferData->pstCard->hDrv, SPC_ABA_AVAIL_USER_POS, &llAvailPos); + if ((llAvailPos + pstBufferData->llABAAvailBytes) >= pstBufferData->dwABABufLen) + pstBufferData->llABAAvailBytes = pstBufferData->dwABABufLen - llAvailPos; + pstBufferData->pvABACurrentBuf = (void*) (((char*) pvABABuffer) + llAvailPos); + } + + // if there is some new data we call our work function + if (pstBufferData->llDataAvailBytes || pstBufferData->llTSAvailBytes || pstBufferData->llABAAvailBytes) + if (pfn_bWorkDo) + if (!(*pfn_bWorkDo) (pvWorkData, pstBufferData)) + dwError = ERR_ABORT; + + + // now we have to set the data available for the card again (the number of bytes may have been modified by the work routine) + if (pstBufferData->bStartData && pstBufferData->llDataAvailBytes) + spcm_dwSetParam_i64 (pstBufferData->pstCard->hDrv, SPC_DATA_AVAIL_CARD_LEN, pstBufferData->llDataAvailBytes); + + if (pstBufferData->bStartTimestamp && pstBufferData->llTSAvailBytes) + spcm_dwSetParam_i64 (pstBufferData->pstCard->hDrv, SPC_TS_AVAIL_CARD_LEN, pstBufferData->llTSAvailBytes); + + if (pstBufferData->bStartABA && pstBufferData->llABAAvailBytes) + spcm_dwSetParam_i64 (pstBufferData->pstCard->hDrv, SPC_ABA_AVAIL_CARD_LEN, pstBufferData->llABAAvailBytes); + + + // we continuously count the number of bytes that we have transferred so far + pstBufferData->qwDataTransferred += pstBufferData->llDataAvailBytes; + pstBufferData->qwTSTransferred += pstBufferData->llTSAvailBytes; + pstBufferData->qwABATransferred += pstBufferData->llABAAvailBytes; + + + // at last we check for abort (not in the threaded version as this is then done in the main thread) + if (pfn_bAbortCheck && !pstThreadData) + if ((*pfn_bAbortCheck) (pvWorkData, pstBufferData)) + dwError = ERR_ABORT; + + + // signal the new status to the main thread + if (pstThreadData) + { + pstBufferData->dwError = dwError; + spcm_vSignalEvent (pstThreadData->phSharedUpdate); + spcm_vReleaseMutex (&pstThreadData->hMutexSharedAccess); + } + + // we don't count timeout as an error as we've forced the loop with a small timeout (non-threaded version) + if (!pstThreadData) + if (dwError == ERR_TIMEOUT) + dwError = ERR_OK; + + // we have to suspend this thread for a short tiem to give other threads some working time + if (pstThreadData) + spcm_vSuspendThread (1); + } // while (!dwError) (Main Loop) + + + // check for the error in the loop + printf ("\n\n"); + switch (dwError) + { + case ERR_FIFOHWOVERRUN: printf ("Loop: Hardware Overrun\n"); break; + case ERR_FIFOFINISHED: printf ("Loop: FIFO Mode finished"); break; + case ERR_OK: printf ("Loop: Finished normal\n"); break; + case ERR_ABORT: printf ("Loop: Aborted...\n"); break; + default: printf ("Loop: Error %4d\n", dwError); break; + } + + + + // copy the error information to the buffer structure + if (pstThreadData) + spcm_vGetMutex (&pstThreadData->hMutexSharedAccess); + + pstBufferData->dwError = dwError; + + // at least we do one last upodate with the final error code + if (pstThreadData) + { + spcm_vReleaseMutex (&pstThreadData->hMutexSharedAccess); + spcm_vSignalEvent (pstThreadData->phSharedUpdate); + } + + + + // close the work + if (pfn_vWorkClose) + (*pfn_vWorkClose) (pvWorkData, pstBufferData); + + // clean up + if (pvDataBuffer && !bContMemUsed) + vFreeMemPageAligned (pvDataBuffer, pstBufferData->dwDataBufLen); + if (pvTSBuffer) + vFreeMemPageAligned (pvTSBuffer, pstBufferData->dwTSBufLen); + if (pvABABuffer) + vFreeMemPageAligned (pvABABuffer, pstBufferData->dwABABufLen); + + // we need to leave the thread with a released mutex, otherwise the other threads may block + if (pstThreadData) + { + pstThreadData->dwEventFlags |= EVENTFLAG_TERMDONE; + spcm_vSignalEvent (&pstThreadData->hEventTermDone); + } + } + + + + +/* +************************************************************************** +vDoMainLoop: + +the non threaded version of the main loop, just calls the shared main loop +and let the thread data section be NULL to disable all synchronization +************************************************************************** +*/ + +void vDoMainLoop ( + ST_BUFFERDATA* pstBufferData, // filled card info structure + void* pvWorkData, // working data structure that is passed to the calback functions + SPCM_WORK_INIT* pfn_bWorkSetup, // callback function for pre-run setup + SPCM_WORK_DO* pfn_bWorkDo, // callback function that is called if new data is available + SPCM_WORK_CLOSE* pfn_vWorkClose, // callback function at the end of run + SPCM_ABORTCHECK* pfn_bAbortCheck) // callback function for abort checking on each update loop + + { + vMainLoop ( + pstBufferData, + pvWorkData, + pfn_bWorkSetup, + pfn_bWorkDo, + pfn_vWorkClose, + pfn_bAbortCheck, + NULL); + } + + + +/* +************************************************************************** + +DataTransfer Thread: it uses the main loop to run the specified thread +function. + +************************************************************************** +*/ + +SPCM_THREAD_RETURN SPCM_THREAD_CALLTYPE pvDataTransferThread (void* pvArguments) + { + ST_THREADDATA* pstThreadData = (ST_THREADDATA*) pvArguments; + ST_BUFFERDATA* pstBufferData = (ST_BUFFERDATA*) pstThreadData->pstBufferData; + void* pvWorkData = pstThreadData->pvWorkData; + + vMainLoop ( + pstBufferData, + pvWorkData, + pstThreadData->pfn_bWorkInit, + pstThreadData->pfn_bWorkDo, + pstThreadData->pfn_vWorkClose, + NULL, + pstThreadData); + + return 0; + } + + + + +/* +************************************************************************** +vDoThreadMainLoop: contains the main FIFO loop in the threaded version. +This function mainly initializes the thread structures and calls +the threads to do the work +************************************************************************** +*/ + +void vDoThreadMainLoop ( + ST_BUFFERDATA* pstBufferData, // filled card info structure + void* pvWorkData, // working data structure that is passed to the calback functions + + SPCM_WORK_INIT* pfn_bWorkInit, // callback function for pre-run setup + SPCM_WORK_DO* pfn_bWorkDo, // callback function that is called if new data is available + SPCM_WORK_CLOSE* pfn_vWorkClose, // callback function at the end of run + + SPCM_ABORTCHECK* pfn_bAbortCheck, // callback function for abort checking on each update loop + bool bSeparateThread, // use separate threads for data, timestamp and ABA + + SPCM_WORK_INIT* pfn_bTSInit, // callback function for timestamo pre-run setup + SPCM_WORK_DO* pfn_bTSDo, // callback function that is called if new timestamps are available + SPCM_WORK_CLOSE* pfn_vTSClose, // callback function at the end of timestamp run + + SPCM_WORK_INIT* pfn_bABAInit, // callback function for ABA pre-run setup + SPCM_WORK_DO* pfn_bABADo, // callback function that is called if new ABA data is available + SPCM_WORK_CLOSE* pfn_vABAClose) // callback function at the end of ABA run + +// *********************************************************************** + + { + SPCM_THREAD_HANDLE hThread[3]; // handles for the maximum of three threads we support + int16 nThreadCount = 0; // number of threads we currently use + ST_THREADDATA stThreadData[3]; // shared data structure between main and data thread + ST_BUFFERDATA stBufferData[3]; // own copies of buffer data + bool bOk = true; + int i; + uint32 dwError; // error code of the thread + + // initialize all to zero for later clean up + for (i=0; i<3; i++) + { + hThread[i] = NULL_HANDLE; + memset (&stThreadData[i], 0, sizeof(ST_THREADDATA)); + } + + + // we set the private buffer data as a copy of the given one and disable the starting flags for separate transfers + for (i=0; i<3; i++) + { + memcpy ((void*) &stBufferData[i], pstBufferData, sizeof (ST_BUFFERDATA)); + + // the transfers should be started separately therefore we need to set the flags individually + if (bSeparateThread) + { + stBufferData[i].bStartABA = false; + stBufferData[i].bStartTimestamp = false; + stBufferData[i].bStartData = false; + stBufferData[i].bStartCard = false; + } + } + + + // count the threads to use and set separate start flags and separate work callback functions + if (bSeparateThread) + { + if (pstBufferData->bStartData) + { + stBufferData[nThreadCount].bStartData = true; + stBufferData[nThreadCount].bStartExtraDMA = false; + stBufferData[nThreadCount].bStartCard = pstBufferData->bStartCard; + nThreadCount++; + } + + if (pstBufferData->bStartTimestamp) + { + stBufferData[nThreadCount].bStartTimestamp = true; + stBufferData[nThreadCount].bStartExtraDMA = true; + nThreadCount++; + } + + // extra dma can only be started once. + if (pstBufferData->bStartABA) + { + stBufferData[nThreadCount].bStartABA = true; + stBufferData[nThreadCount].bStartExtraDMA = !pstBufferData->bStartTimestamp; + nThreadCount++; + } + } + else + { + stBufferData[nThreadCount].bStartExtraDMA = pstBufferData->bStartTimestamp || pstBufferData->bStartABA; + nThreadCount = 1; + } + + + + + // setup the thread data structure we thereby use a shared update as this main thread should get all update calls + // the work data structure is also shared between the different threads + for (i=0; (i<nThreadCount) && bOk; i++) + { + bOk = bInitThreadStructure (&stThreadData[i], (i == 0 ? NULL : &stThreadData[0].hEventUpdate)); + stThreadData[i].pstBufferData = &stBufferData[i]; + stThreadData[i].pvWorkData = pvWorkData; + + if (stBufferData[i].bStartData) + { + stThreadData[i].pfn_bWorkDo = pfn_bWorkDo; + stThreadData[i].pfn_bWorkInit = pfn_bWorkInit; + stThreadData[i].pfn_vWorkClose = pfn_vWorkClose; + } + + if (stBufferData[i].bStartTimestamp && bSeparateThread) + { + stThreadData[i].pfn_bWorkDo = pfn_bTSDo; + stThreadData[i].pfn_bWorkInit = pfn_bTSInit; + stThreadData[i].pfn_vWorkClose = pfn_vTSClose; + } + + if (stBufferData[i].bStartABA && bSeparateThread) + { + stThreadData[i].pfn_bWorkDo = pfn_bABADo; + stThreadData[i].pfn_bWorkInit = pfn_bABAInit; + stThreadData[i].pfn_vWorkClose = pfn_vABAClose; + } + + if (!stThreadData[i].pfn_bWorkDo) + stThreadData[i].pfn_bWorkDo = pfn_bWorkDo; + + if (!stThreadData[i].pfn_bWorkInit) + stThreadData[i].pfn_bWorkInit = pfn_bWorkInit; + + + if (!stThreadData[i].pfn_vWorkClose) + stThreadData[i].pfn_vWorkClose = pfn_vWorkClose; + } + + if (!bOk) + { + printf ("An error occurred while initializing mutex and events!\n"); + return; + } + + + + // now we start the threads + for (i=0; (i<nThreadCount) && bOk; i++) + bOk = spcm_bCreateThread (&pvDataTransferThread, &hThread[i], (void*) &stThreadData[i]); + + if (!bOk) + printf ("An error occurred while initializing mutex and events!\n"); + + // no error, we wait for initialization and check for error + if (bOk) + printf ("\nThread(s) are started now\n...wait for initialisation of thread\n"); + + // wait for thread initialisation done + for (i=0; (i<nThreadCount) && bOk; i++) + { + spcm_vGetMutex (&stThreadData[i].hMutexSharedAccess); + if ((stThreadData[i].dwEventFlags & EVENTFLAG_INITDONE) == 0) + spcm_bWaitEventWithMutex (&stThreadData[i].hEventInitDone, &stThreadData[i].hMutexSharedAccess); + if (stThreadData[i].pstBufferData->dwError) + { + bOk = false; + printf ("...initialisation failed with error %d\n", stThreadData[i].pstBufferData->dwError); + dwError = stThreadData[i].pstBufferData->dwError; + } + } + + + // initialisation ok, we now send the start event + if (bOk) + printf ("...initialisation done, thread is now started\n"); + + // first step: all threads but not the data (and card start) thread are started + for (i=0; (i<nThreadCount) && bOk; i++) + if (!stThreadData[i].pstBufferData->bStartData) + { + stThreadData[i].dwEventFlags |= EVENTFLAG_START; + spcm_vSignalEvent (&stThreadData[i].hEventStart); + + if ((stThreadData[i].dwEventFlags & EVENTFLAG_STARTDONE) == 0) + spcm_bWaitEventWithMutex (&stThreadData[i].hEventStartDone, &stThreadData[i].hMutexSharedAccess); + + spcm_vReleaseMutex (&stThreadData[i].hMutexSharedAccess); + } + + // second step: the data thread is started and with this the card is started + for (i=0; (i<nThreadCount) && bOk; i++) + if (stThreadData[i].pstBufferData->bStartData) + { + stThreadData[i].dwEventFlags |= EVENTFLAG_START; + spcm_vSignalEvent (&stThreadData[i].hEventStart); + + if ((stThreadData[i].dwEventFlags & EVENTFLAG_STARTDONE) == 0) + spcm_bWaitEventWithMutex (&stThreadData[i].hEventStartDone, &stThreadData[i].hMutexSharedAccess); + + spcm_vReleaseMutex (&stThreadData[i].hMutexSharedAccess); + } + + + // we now simply wait for the (shared) update command + while (bOk) + { + spcm_vWaitEvent (&stThreadData[0].hEventUpdate); + + // on each update we can abort the loop + if (pfn_bAbortCheck) + if (pfn_bAbortCheck (pvWorkData, &stBufferData[0])) + { + spcm_dwSetParam_i32 (pstBufferData->pstCard->hDrv, SPC_M2CMD, M2CMD_CARD_STOP | M2CMD_DATA_STOPDMA | M2CMD_EXTRA_STOPDMA); + printf ("\n...Aborted by user\n"); + break; + } + + // we check all error codes of running threads + for (i=0; (i<nThreadCount) && bOk; i++) + { + spcm_vGetMutex (&stThreadData[i].hMutexSharedAccess); + dwError = stThreadData[i].pstBufferData->dwError; + bOk = (dwError == ERR_OK); + spcm_vReleaseMutex (&stThreadData[i].hMutexSharedAccess); + } + } + + // print the error code + switch (dwError) + { + case ERR_TIMEOUT: printf ("\nTimeout has occured"); break; + case ERR_FIFOHWOVERRUN: printf ("\nHardware Overrun"); break; + case ERR_FIFOFINISHED: printf ("\nFIFO Mode finished"); break; + case ERR_OK: printf ("\nFinished normal"); break; + case ERR_ABORT: printf ("\nAborted by user"); break; + case ERR_MEMALLOC: printf ("\nMemory Allocation error"); break; + default: printf ("\nError %4d ", dwError); break; + } + + pstBufferData->dwError = dwError; + + // we have to stop the transfer to force the threads to return + spcm_dwSetParam_i32 (pstBufferData->pstCard->hDrv, SPC_M2CMD, M2CMD_CARD_STOP | M2CMD_DATA_STOPDMA | M2CMD_EXTRA_STOPDMA); + + // now it's time to clean up + for (i=0; i<nThreadCount; i++) + { + if ((stThreadData[i].dwEventFlags & EVENTFLAG_TERMDONE) == 0) + spcm_vWaitEvent (&stThreadData[i].hEventTermDone); + spcm_vJoinThread (&hThread[i], 0); + spcm_vCloseThread (&hThread[i]); + vCleanThreadStructure (&stThreadData[i]); + } + } + + + +/* +************************************************************************** +bKeyAbortCheck: simple abort function that check for escape +************************************************************************** +*/ + +bool bKeyAbortCheck (void* pvWorkData, ST_BUFFERDATA* pstBufferData) + { + if (bKbhit()) + if (cGetch() == 27) + return true; + + return false; + } diff --git a/Cpp/examples/c_cpp/common/spcm_lib_thread.h b/Cpp/examples/c_cpp/common/spcm_lib_thread.h new file mode 100644 index 0000000000000000000000000000000000000000..f30a503a551d421b9e4d3d09d6205c7f71ac98c5 --- /dev/null +++ b/Cpp/examples/c_cpp/common/spcm_lib_thread.h @@ -0,0 +1,230 @@ +/* +************************************************************************** + +spcm_lib_thread.h (c) Spectrum GmbH , 02/2006 + +************************************************************************** + +Offers data transfer threads for sample data, timestamp data and ABA date. +Each thread get's a bundle of parameters including a work function that +is used to do something with the data. These thread sare used in all our +FIFO examples. + +************************************************************************** +*/ + + + +#ifndef SPCM_LIB_THREAD_H +#define SPCM_LIB_THREAD_H + + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +// ----- operating system dependent functions for thead, event and mutex handling ----- +#include "../common/ostools/spcm_oswrap.h" +#include "../common/ostools/spcm_ostools.h" + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_card.h" + + + +// our namespace that we use inside the ostools functions +using namespace SPCM_NAMESPACE; + + + +/* +************************************************************************** +we define three working functions that the thread calls on start, on +each data update and on close. By defining these functions one can +implement nearly every functionality using this thread function. + +Be aware that all these functions are called with the mutex hold. If the +function is doing more work it is requested to release the mutex inbetween + +************************************************************************** +*/ + +struct ST_THREADDATA; +struct ST_BUFFERDATA; + +// initialisation of the working routines +typedef bool (SPCM_WORK_INIT) (void* pvWorkData, ST_BUFFERDATA* pstBufferData); + +// this function does the job. It get's the current available bytes and may modify it if it doesn't use all data +typedef bool (SPCM_WORK_DO) (void* pvWorkData, ST_BUFFERDATA* pstBufferData); + +// this function closes (if file access is done) the work and cleans up if necessary +typedef void (SPCM_WORK_CLOSE) (void* pvWorkData, ST_BUFFERDATA* pstBufferData); + +// simple abort function to be implemented by user program +typedef bool (SPCM_ABORTCHECK) (void* pvWorkData, ST_BUFFERDATA* pstBufferData); + + + +// simple abort function that waits returns true if escape is pressed +bool bKeyAbortCheck (void* pvWorkData, ST_BUFFERDATA* pstBufferData); + + + +/* +************************************************************************** +buffer data: structure to handover current buffer status and available +bytes. The structure is modified several times: + +WORK_INIT: + get's the general setup (pstCard object) + defines BufLen and Notify for up to three transfer objects + may set an error code + +WORK_DO + get's the current pointers to the data buffers and the currently available bytes + modifies the currently available bytes if it doesn't uses all of them + may set an error code + +************************************************************************** +*/ + +struct ST_BUFFERDATA + { + // general setup and status + ST_SPCM_CARDINFO* pstCard; // pointer to the shared card info structure + uint32 dwError; // error code + int32 lTimeout; // timeout in ms for the wait commands + + // starting flags for the different transfers (all together are started) + bool bStartCard; // starts the card + bool bStartData; // starts the data transfer + bool bStartTimestamp; // starts the timestamp transfer + bool bStartABA; // starts the ABA transfer + bool bStartExtraDMA; // this thread starts the extra DMA + + // these settings are to be set by WorkSetup and are used for definitions + uint32 dwDataBufLen; // complete buffer length + uint32 dwDataNotify; // notify size + + uint32 dwTSBufLen; // buffer length of the timestamp + uint32 dwTSNotify; // notify size of timestamp + + uint32 dwABABufLen; // ABA buffer length + uint32 dwABANotify; // notify size of ABA buffer + + // these settings are maintained by the main loop (thread) and are update by the working function + void* pvDataCurrentBuf; // a pointer to the current data buffer starting address + int64 llDataAvailBytes; // current data length that is available + uint64 qwDataTransferred; // complete transferred amount of data + + void* pvTSCurrentBuf; // a pointer to the current timestamp buffer starting address + int64 llTSAvailBytes; // current timestamp length that is available + uint64 qwTSTransferred; // complete transferred amount of timestamp data + + void* pvABACurrentBuf; // a pointer to the current ABA buffe starting address + int64 llABAAvailBytes; // current ABA data length that is available + uint64 qwABATransferred; // complete transferred amount of ABA data + }; + + + +/* +************************************************************************** +The thread data structure contains all exchange data between main program +and the transfer thread. It also contains the mutexes and events to +allow synchronisation +************************************************************************** +*/ +#define EVENTFLAG_INITDONE 0x0000001 +#define EVENTFLAG_START 0x0000002 +#define EVENTFLAG_STARTDONE 0x0000004 +#define EVENTFLAG_TERMDONE 0x0000008 + + +struct ST_THREADDATA + { + // events from main to thread + SPCM_EVENT_HANDLE hEventStart; // starts the acquistion + + // events from thread to main + SPCM_EVENT_HANDLE hEventInitDone; // initialisation of thread is done + SPCM_EVENT_HANDLE hEventStartDone; // the start has been done, tranfer is running now + SPCM_EVENT_HANDLE hEventUpdate; // data is updated + SPCM_EVENT_HANDLE hEventTermDone; // termination is done + bool bSharedUpdate; // the update event is shared with other threads + SPCM_EVENT_HANDLE* phSharedUpdate; // either the shared update event or my own one if I'm the one to share + + uint32 dwEventFlags; // event flags to avoid Linux pthread problems + + SPCM_MUTEX_HANDLE hMutexSharedAccess; // controls the multiple exclusion access to the buffer data section + ST_BUFFERDATA* pstBufferData; // a buffer data structure to fill and forward to working function + void* pvWorkData; // the private working data + + SPCM_WORK_INIT* pfn_bWorkInit; // initialisation function + SPCM_WORK_DO* pfn_bWorkDo; // the working function + SPCM_WORK_CLOSE* pfn_vWorkClose; // closes the working routine + }; + + + +/* +************************************************************************** +vDoThread MainLoop: + +contains the default main thread loop. This one can be used to control one +common thread that cares for all transfers or separate threads for data, +timestamp and ABA data. + +Select the behaviour with the bSeparateThread flag. If separate threads +are used it is necessary to give init, worker and close function callbacks +for each transfer thread. + +************************************************************************** +*/ + +void vDoThreadMainLoop ( + ST_BUFFERDATA* pstBufferData, // filled card info structure + void* pvWorkData, // working data structure that is passed to the calback functions + + SPCM_WORK_INIT* pfn_bWorkInit, // callback function for pre-run setup + SPCM_WORK_DO* pfn_bWorkDo, // callback function that is called if new data is available + SPCM_WORK_CLOSE* pfn_vWorkClose = NULL, // callback function at the end of run + + SPCM_ABORTCHECK* pfn_bAbortCheck = NULL, // callback function for abort checking on each update loop + bool bSeparateThread = false,// use separate threads for data, timestamp and ABA + + SPCM_WORK_INIT* pfn_bTSInit = NULL, // callback function for timestamo pre-run setup + SPCM_WORK_DO* pfn_bTSDo = NULL, // callback function that is called if new timestamps are available + SPCM_WORK_CLOSE* pfn_vTSClose = NULL, // callback function at the end of timestamp run + + SPCM_WORK_INIT* pfn_bABAInit = NULL, // callback function for ABA pre-run setup + SPCM_WORK_DO* pfn_bABADo = NULL, // callback function that is called if new ABA data is available + SPCM_WORK_CLOSE* pfn_vABAClose = NULL); // callback function at the end of ABA run + + + + +/* +************************************************************************** +vDoMainLoop: + +contains the default main loop in a non-threaded version. This one can be +used to control data transfer, timestamp transfer and ABA transfer at the +same time without using threads. +************************************************************************** +*/ + +void vDoMainLoop ( + ST_BUFFERDATA* pstBufferData, // filled card info structure + void* pvWorkData, // working data structure that is passed to the calback functions + + SPCM_WORK_INIT* pfn_bWorkInit, // callback function for pre-run setup + SPCM_WORK_DO* pfn_bWorkDo, // callback function that is called if new data is available + SPCM_WORK_CLOSE* pfn_vWorkClose = NULL, // callback function at the end of run + + SPCM_ABORTCHECK* pfn_bAbortCheck = NULL);// callback function for abort checking on each update loop + +#endif diff --git a/Cpp/examples/c_cpp/common/spcm_netbox_sendmail.cpp b/Cpp/examples/c_cpp/common/spcm_netbox_sendmail.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8e4f1e5c40e6312d59dccbcf20d9d77b8562b304 --- /dev/null +++ b/Cpp/examples/c_cpp/common/spcm_netbox_sendmail.cpp @@ -0,0 +1,365 @@ +/* +************************************************************************** + +spcm_netbox_sendmail.cpp + +************************************************************************** + +This code uses libcurl for mail transfer + +************************************************************************** +*/ + +#include <iostream> +#include <curl/curl.h> +#include <cstdlib> +#include <cstring> + +#define MAX_ATTACHMENTS 16 + +static char* g_szSMTP = NULL; +static char* g_szSMTPUser = NULL; +static char* g_szSMTPPassword = NULL; +static char* g_szSubject = NULL; +static char* g_szBody = NULL; +static char* g_aszFilename[MAX_ATTACHMENTS] = {NULL}; +static unsigned g_dwNextAttachmentIdx = 0; + +static const int CHARS= 76; //Sending 54 chararcters at a time with \r , \n and \0 it becomes 57 +static const int ADD_SIZE= 15 + MAX_ATTACHMENTS*4; // 15 lines for To, From, ..., plus 4 per attachment +static const int SEND_BUF_SIZE= 54; +static char (*fileBuf)[CHARS] = NULL; +static const char cb64[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +using namespace std; + +bool LARGEFILE = false; /*For Percent*/ +int status = 0; /*For Percent*/ +int percent2 = 0; /*For Percent*/ +int percent3 = 0; /*For Percent*/ +int percent4 = 0; /*For Percent*/ +int percent5 = 0; /*For Percent*/ +void LargeFilePercent(int rowcount) + { + //This is for displaying the percentage + //while encoding larger files + int percent = rowcount/100; + + if(LARGEFILE == true) + { + status++; + percent2++; + if (percent2 == 18) + { + percent3++; + percent2 = 0; + } + if (percent3 == percent) + { + percent4++; + percent3 = 0; + } + if (percent4 == 10) + { + system("cls"); + cout << "Larger Files take longer to encode, Please be patient." << endl + << endl << "Encoding, please be patient..." << endl; + cout << percent5 << "%"; + percent5 += 10; + percent4 = 0; + } + if (status == 10000) + { + if(percent5 == 0) + { + cout << " 0%"; percent5 = 10; + } + cout << "."; + status = 0; + } + } + } + +void encodeblock(unsigned char in[3], unsigned char out[4], int len) + { + out[0] = cb64[ in[0] >> 2 ]; + out[1] = cb64[ ((in[0] & 0x03) << 4) | ((in[1] & 0xf0) >> 4) ]; + out[2] = (unsigned char) (len > 1 ? cb64[ ((in[1] & 0x0f) << 2) | ((in[2] & 0xc0) >> 6) ] : '='); + out[3] = (unsigned char) (len > 2 ? cb64[ in[2] & 0x3f ] : '='); + } + +void encode(FILE *infile, unsigned char *output_buf, int rowcount/*For Percent*/) + { + unsigned char in[3], out[4]; + int i, len; + *output_buf = 0; + + while(!feof(infile)) + { + len = 0; + for(i = 0; i < 3; i++) + { + in[i] = (unsigned char) getc(infile); + if(!feof(infile) ) + { + len++; + } + else + { + in[i] = 0; + } + } + if(len) + { + encodeblock(in, out, len); + strncat((char*)output_buf, (char*)out, 4); + } + LargeFilePercent(rowcount); //Display encoded file percent /*For Percent*/ + } + } + + +struct fileBuf_upload_status + { + int lines_read; + }; + +FILE* g_hFileTmp = NULL; +size_t read_file (char** aszFilenames, const char* szFrom, const char* szTo) + { + size_t len = 0; + size_t buffer_size = 0; + char key = ' '; + + unsigned dwFileIdx = 0; + struct + { + std::string sEncoded; + int lNumRows; + } astEncodedFiles[MAX_ATTACHMENTS]; + while (aszFilenames[dwFileIdx] != NULL) + { + //Open the file and make sure it exsits + FILE* hFile = fopen (aszFilenames[dwFileIdx], "rb"); + if(!hFile) + { + cout << "File not found!!!" << endl; + exit (EXIT_FAILURE); + } + + //Get filesize + fseek (hFile, 0, SEEK_END); + size_t fileSize = ftell (hFile); + fseek (hFile, 0, SEEK_SET); + + + //Check Filesize + if (fileSize > 256000/*bytes*/) + { + cout << "Larger Files take longer to encode, Please be patient." << endl; + LARGEFILE = true; /*For Percent*/ + } + cout << endl << "Encoding " << aszFilenames[dwFileIdx] << " please be patient..." << endl; + + //Calculate the number of rows in Base64 encoded string + //also calculate the size of the new char to be created + //for the base64 encode string + astEncodedFiles[dwFileIdx].lNumRows = fileSize / SEND_BUF_SIZE + 1; + int charsize = (astEncodedFiles[dwFileIdx].lNumRows * 72) + (astEncodedFiles[dwFileIdx].lNumRows * 2); + + //Base64 encode image and create encoded_buf string + unsigned char* b64encode = new unsigned char[charsize]; + *b64encode = 0; + encode (hFile, b64encode, astEncodedFiles[dwFileIdx].lNumRows/*For Percent*/); + fclose (hFile); + astEncodedFiles[dwFileIdx].sEncoded = (char*)b64encode; + delete [] b64encode; + + dwFileIdx++; + } + + if (LARGEFILE == true) + cout << endl << endl; /*For Percent*/ + + //Create structure of email to be sent + unsigned dwNumLines = ADD_SIZE; //ADD_SIZE for TO,FROM,SUBJECT,CONTENT-TYPE,CONTENT-TRANSFER-ENCODING,CONETNT-DISPOSITION and \r\n and content + for (unsigned i = 0; i < dwFileIdx; ++i) + dwNumLines += astEncodedFiles[i].lNumRows; + fileBuf = new char[dwNumLines][CHARS]; + for (unsigned i = 0; i < dwNumLines; ++i) + fileBuf[i][0] = '\0'; + +#define BOUNDARY "------------060709040305030006090208" + buffer_size += snprintf (fileBuf[len++], CHARS, "From: %s \r\n", szFrom); + buffer_size += snprintf (fileBuf[len++], CHARS, "To: %s \r\n", szTo); + buffer_size += snprintf (fileBuf[len++], CHARS, "Subject: %s\r\n", g_szSubject); + buffer_size += snprintf (fileBuf[len++], CHARS, "MIME-Version: 1.0\r\n"); + if (dwFileIdx != 0) + { + buffer_size += snprintf (fileBuf[len++], CHARS, "Content-Type: multipart/mixed;\r\n"); + buffer_size += snprintf (fileBuf[len++], CHARS, " boundary=\"" BOUNDARY "\"\r\n"); + buffer_size += snprintf (fileBuf[len++], CHARS, "\r\n"); // empty line to divide header and data + buffer_size += snprintf (fileBuf[len++], CHARS, "This is a multi-part message in MIME format.\r\n"); + buffer_size += snprintf (fileBuf[len++], CHARS, "--" BOUNDARY "\r\n"); + } + buffer_size += snprintf (fileBuf[len++], CHARS, "Content-Type: text/plain; charset=utf-8\r\n"); + buffer_size += snprintf (fileBuf[len++], CHARS, "Content-Transfer-Encoding: 7bit\r\n\r\n"); + buffer_size += snprintf (fileBuf[len++], CHARS, "%s\r\n", g_szBody); + buffer_size += snprintf (fileBuf[len++], CHARS, "\r\n"); + buffer_size += snprintf (fileBuf[len++], CHARS, "\r\n"); + for (unsigned i = 0; i < dwFileIdx; ++i) + { + buffer_size += snprintf (fileBuf[len++], CHARS, "--" BOUNDARY "\r\n"); + buffer_size += snprintf (fileBuf[len++], CHARS, "Content-Type: application/x-msdownload; name=\"%s\"\r\n", strrchr (aszFilenames[i], '/') + 1); + buffer_size += snprintf (fileBuf[len++], CHARS, "Content-Transfer-Encoding: base64\r\n"); + buffer_size += snprintf (fileBuf[len++], CHARS, "Content-Disposition: attachment; filename=\"%s\"\r\n\r\n", strrchr (aszFilenames[i], '/') + 1); + + //This part attaches the Base64 encoded string and + //sets the Base64 linesize to 72 characters + \r\n + size_t dwPos = 0; + std::string sub_encoded_buf; + for (int lRow = 0; lRow <= astEncodedFiles[i].lNumRows - 1; lRow++) + { + sub_encoded_buf = astEncodedFiles[i].sEncoded.substr (dwPos * 72, 72); // Reads 72 characters at a time + sub_encoded_buf += "\r\n"; // and appends \r\n at the end + strcpy (fileBuf[len++], sub_encoded_buf.c_str()); // copy the 72 characters & \r\n to email + buffer_size += sub_encoded_buf.size(); // now increase the buffer_size + dwPos++; // finally increase pos by 1 + } + } + +// this seems to be unncessary. +// if (dwFileIdx != 0) +// buffer_size += snprintf (fileBuf[len++], CHARS, BOUNDARY "--"); + + + return buffer_size; + } + + /* + The fileBuf_source() is a function which CURL calls when it need to obtain data that will be uploaded to the server. + Imagine that fileBuf_source() is something similar to fread(). When called it performs any voodoo-mumbo-jumbo that is needed, + but in the end uploadable data must be stored in *ptr buffer, which is curl's internal buffer. For your in-memory buffer + memcpy() will do just fine as body of fileBuf_source(), so you don't need real fread() at all. + + size * nmemb tells you how big buffer curl has reserved for a single chunk of data. The last void* is a pointer which was + set by CURLOPT_READDATA option - it's a do-what-ever-you-need-with-it kind of pointer, so it can point to a structure + containing data which you're uploading and a some additional info e.g. current progress. + */ +static size_t fileBuf_source(void *ptr, size_t size, size_t nmemb, void *userp) + { + struct fileBuf_upload_status *upload_ctx = (struct fileBuf_upload_status *)userp; + const char *fdata; + + if((size == 0) || (nmemb == 0) || ((size*nmemb) < 1)) + { + return 0; + } + + fdata = fileBuf[upload_ctx->lines_read]; + + if (strcmp (fdata, "")) + { + //printf ("Line %d: %s\n", upload_ctx->lines_read, fdata); + size_t len = strlen(fdata); + memcpy(ptr, fdata, len); + upload_ctx->lines_read++; + return len; + } + + return 0; + } + +// ----- defines SMTP server and login credentials ----- +void vNetboxMailSetServerAndLogin (const char* szSMTPServer, const char* szUsername, const char* szPassword) + { + if (g_szSMTP != NULL) + delete [] g_szSMTP; + g_szSMTP = new char[strlen (szSMTPServer) + 1]; + strcpy (g_szSMTP, szSMTPServer); + + if (g_szSMTPUser != NULL) + delete [] g_szSMTPUser; + g_szSMTPUser = new char[strlen (szUsername) + 1]; + strcpy (g_szSMTPUser, szUsername); + + if (g_szSMTPPassword != NULL) + delete [] g_szSMTPPassword; + g_szSMTPPassword = new char[strlen (szPassword) + 1]; + strcpy (g_szSMTPPassword, szPassword); + } + +// ----- defines the subject of the mail ----- +void vNetboxMailSetSubject (const char* szSubject) + { + if (g_szSubject != NULL) + delete [] g_szSubject; + g_szSubject = new char[strlen (szSubject) + 1]; + strcpy (g_szSubject, szSubject); + } + +// ----- defines the body (content) of the mail ----- +void vNetboxMailSetBody (const char* szBody) + { + if (g_szBody != NULL) + delete [] g_szBody; + g_szBody = new char[strlen (szBody) + 1]; + strcpy (g_szBody, szBody); + } + +// ----- adds a file that should be attached to the mail ----- +// ----- call this function multiple times for multiple attachments ----- +void vNetboxMailAddAttachment (const char* szFilename) + { + if (g_aszFilename[g_dwNextAttachmentIdx] != NULL) + delete [] g_aszFilename[g_dwNextAttachmentIdx]; + g_aszFilename[g_dwNextAttachmentIdx] = new char[strlen (szFilename) + 1]; + strcpy (g_aszFilename[g_dwNextAttachmentIdx], szFilename); + g_dwNextAttachmentIdx++; + } + +// ----- defines sender and recipient of the mail and starts mail transfer ----- +void vNetboxMailSendMail (const char* szFrom, const char* szTo) + { + CURL *curl; + CURLcode res = CURLE_OK; + struct curl_slist *recipients = NULL; + struct fileBuf_upload_status file_upload_ctx; + size_t file_size(0); + + file_upload_ctx.lines_read = 0; + + file_size = read_file (g_aszFilename, szFrom, szTo); + + curl = curl_easy_init(); + if(curl) + { + curl_easy_setopt(curl, CURLOPT_URL, g_szSMTP); // SMTP server address + curl_easy_setopt(curl, CURLOPT_USERNAME, g_szSMTPUser); // username on the SMTP server + curl_easy_setopt(curl, CURLOPT_PASSWORD, g_szSMTPPassword); // password for the SMTP server +/* + curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL); +*/ + //curl_easy_setopt(curl, CURLOPT_CAINFO, "google.pem"); + curl_easy_setopt(curl, CURLOPT_MAIL_FROM, szFrom); + recipients = curl_slist_append(recipients, szTo); + curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients); + curl_easy_setopt(curl, CURLOPT_INFILESIZE, file_size); + curl_easy_setopt(curl, CURLOPT_READFUNCTION, fileBuf_source); + curl_easy_setopt(curl, CURLOPT_READDATA, &file_upload_ctx); + curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); + curl_easy_setopt(curl, CURLOPT_VERBOSE, 0); //Dont display Curl Connection data Change 1L to 0 + + res = curl_easy_perform(curl); + + if(res != CURLE_OK) + fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res)); + curl_slist_free_all(recipients); + curl_easy_cleanup(curl); + + g_dwNextAttachmentIdx = 0; + memset (g_aszFilename, 0, sizeof (char*) * MAX_ATTACHMENTS); + } + delete[] fileBuf; + } + diff --git a/Cpp/examples/c_cpp/common/spcm_netbox_sendmail.h b/Cpp/examples/c_cpp/common/spcm_netbox_sendmail.h new file mode 100644 index 0000000000000000000000000000000000000000..df24e48f160dcb895e5f8f0cf67bf3557b04c078 --- /dev/null +++ b/Cpp/examples/c_cpp/common/spcm_netbox_sendmail.h @@ -0,0 +1,15 @@ +#ifndef SPCM_NETBOX_SENDMAIL_H +#define SPCM_NETBOX_SENDMAIL_H + +// These files use libcurl for mail transfer. + +// mail content +void vNetboxMailSetServerAndLogin (const char* szSMTPServer, const char* szUsername, const char* szPassword); +void vNetboxMailSetSubject (const char* szSubject); +void vNetboxMailSetBody (const char* szBody); +void vNetboxMailAddAttachment (const char* szFile); + +void vNetboxMailSendMail (const char* szFrom, const char* szTo); + +#endif // SPCM_NETBOX_SENDMAIL_H + diff --git a/Cpp/examples/c_cpp/dll_loading/spcm_drv_def.h b/Cpp/examples/c_cpp/dll_loading/spcm_drv_def.h new file mode 100644 index 0000000000000000000000000000000000000000..042d31644c725c9846baf7528bb7dc18306a058b --- /dev/null +++ b/Cpp/examples/c_cpp/dll_loading/spcm_drv_def.h @@ -0,0 +1,39 @@ +/* +************************************************************************** + +spcm_drv_def.h (c) Spectrum GmbH , 04/2006 + +************************************************************************** + +Contains a definetion of all driver function for external linking + +Feel free to use this source for own projects and modify it in any kind + +************************************************************************** +*/ + +// driver handling +typedef drv_handle (_stdcall SPCM_HOPEN) (char* szDeviceName); +typedef void (_stdcall SPCM_VCLOSE) (drv_handle hDevice); + +// software register handling +typedef uint32 (_stdcall SPCM_DWSETPARAM_I32) (drv_handle hDevice, int32 lRegister, int32 lValue); +typedef uint32 (_stdcall SPCM_DWSETPARAM_I64M) (drv_handle hDevice, int32 lRegister, int32 lValueHigh, uint32 dwValueLow); +typedef uint32 (_stdcall SPCM_DWSETPARAM_I64) (drv_handle hDevice, int32 lRegister, int64 llValue); + +typedef uint32 (_stdcall SPCM_DWGETPARAM_I32) (drv_handle hDevice, int32 lRegister, int32* plValue); +typedef uint32 (_stdcall SPCM_DWGETPARAM_I64M) (drv_handle hDevice, int32 lRegister, int32* plValueHigh, uint32* pdwValueLow); +typedef uint32 (_stdcall SPCM_DWGETPARAM_I64) (drv_handle hDevice, int32 lRegister, int64* pllValue); + +// data transfer functions +typedef uint32 (_stdcall SPCM_DWDEFTRANSFER_I64M) (drv_handle hDevice, uint32 dwBufType, uint32 dwDirection, uint32 dwNotifySize, void* pvDataBuffer, uint32 dwBrdOffsH, uint32 dwBrdOffsL, uint32 dwTransferLenH, uint32 dwTransferLenL); +typedef uint32 (_stdcall SPCM_DWDEFTRANSFER_I64) (drv_handle hDevice, uint32 dwBufType, uint32 dwDirection, uint32 dwNotifySize, void* pvDataBuffer, uint64 qwBrdOffs, uint64 qwTransferLen); +typedef uint32 (_stdcall SPCM_DWINVALIDATEBUF) (drv_handle hDevice, uint32 dwBufType); + +// error handling +typedef uint32 (_stdcall SPCM_DWGETERRORINFO_I32) (drv_handle hDevice, uint32* pdwErrorReg, int32* plErrorValue, char pszErrorTextBuffer[ERRORTEXTLEN]); + +// continuous memory +typedef uint32 (_stdcall SPCM_DWGETCONTBUF_I64) (drv_handle hDevice, uint32 dwBufType, void** ppvDataBuffer, uint64* pqwContBufLen); +typedef uint32 (_stdcall SPCM_DWGETCONTBUF_I64M) (drv_handle hDevice, uint32 dwBufType, void** ppvDataBuffer, uint32* pdwContBufLenH, uint32* pdwContBufLenL); + diff --git a/Cpp/examples/c_cpp/dll_loading/spcm_load_dll.cpp b/Cpp/examples/c_cpp/dll_loading/spcm_load_dll.cpp new file mode 100644 index 0000000000000000000000000000000000000000..83ee92cf99159fe48f7df335300d96a814067cb2 --- /dev/null +++ b/Cpp/examples/c_cpp/dll_loading/spcm_load_dll.cpp @@ -0,0 +1,207 @@ +/* +************************************************************************** + +spcm_load_dll.cpp (c) Spectrum GmbH + +************************************************************************** + +Example for all SpcMDrv based products. + +Information about the different products and their drivers can be found +online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/platform-driver-and-series-differences + +This example shows how to load library functions dynamically from a +windows dll or linux shared object (.so), +e.g. if not having a matching lib-file for the compiler. + +Feel free to use this source for own projects and modify it in any kind. + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +// ----- standard c include files ----- +#include <stdio.h> +#include <windows.h> + + + +// ----- include the driver function definitions ----- +#include "spcm_drv_def.h" + + +// ----- global definitions of the function pointers ----- +SPCM_HOPEN* pfn_spcm_hOpen; +SPCM_VCLOSE* pfn_spcm_vClose; +SPCM_DWSETPARAM_I32* pfn_spcm_dwSetParam_i32; +SPCM_DWSETPARAM_I64M* pfn_spcm_dwSetParam_i64m; +SPCM_DWSETPARAM_I64* pfn_spcm_dwSetParam_i64; +SPCM_DWGETPARAM_I32* pfn_spcm_dwGetParam_i32; +SPCM_DWGETPARAM_I64M* pfn_spcm_dwGetParam_i64m; +SPCM_DWGETPARAM_I64* pfn_spcm_dwGetParam_i64; +SPCM_DWDEFTRANSFER_I64M* pfn_spcm_dwDefTransfer_i64m; +SPCM_DWDEFTRANSFER_I64* pfn_spcm_dwDefTransfer_i64; +SPCM_DWINVALIDATEBUF* pfn_spcm_dwInvalidateBuf; +SPCM_DWGETERRORINFO_I32* pfn_spcm_dwGetErrorInfo_i32; +SPCM_DWGETCONTBUF_I64M* pfn_spcm_dwGetContBuf_i64m; +SPCM_DWGETCONTBUF_I64* pfn_spcm_dwGetContBuf_i64; + + +int main() + { + drv_handle hDrv; + int32 lValue; + + +#ifdef WIN32 + bool b32Bit = true; // set to false if you compile a 64bit program + HMODULE hDLL; + + // ----- 32bit ----- + if (b32Bit) + { + // we first load the dll and check whether it is available + hDLL = LoadLibrary ("spcm_win32.dll"); + if (!hDLL) + { + printf ("Library spcm_win32.dll can't be located\n"); + + return 1; + } + + + + // now we load the functions from the DLL using the function names + pfn_spcm_hOpen = (SPCM_HOPEN*) GetProcAddress (hDLL, "_spcm_hOpen@4"); + pfn_spcm_vClose = (SPCM_VCLOSE*) GetProcAddress (hDLL, "_spcm_vClose@4"); + pfn_spcm_dwSetParam_i32 = (SPCM_DWSETPARAM_I32*) GetProcAddress (hDLL, "_spcm_dwSetParam_i32@12"); + pfn_spcm_dwSetParam_i64m = (SPCM_DWSETPARAM_I64M*) GetProcAddress (hDLL, "_spcm_dwSetParam_i64m@16"); + pfn_spcm_dwSetParam_i64 = (SPCM_DWSETPARAM_I64*) GetProcAddress (hDLL, "_spcm_dwSetParam_i64@16"); + pfn_spcm_dwGetParam_i32 = (SPCM_DWGETPARAM_I32*) GetProcAddress (hDLL, "_spcm_dwGetParam_i32@12"); + pfn_spcm_dwGetParam_i64m = (SPCM_DWGETPARAM_I64M*) GetProcAddress (hDLL, "_spcm_dwGetParam_i64m@16"); + pfn_spcm_dwGetParam_i64 = (SPCM_DWGETPARAM_I64*) GetProcAddress (hDLL, "_spcm_dwGetParam_i64@12"); + pfn_spcm_dwDefTransfer_i64m = (SPCM_DWDEFTRANSFER_I64M*) GetProcAddress (hDLL, "_spcm_dwDefTransfer_i64m@36"); + pfn_spcm_dwDefTransfer_i64 = (SPCM_DWDEFTRANSFER_I64*) GetProcAddress (hDLL, "_spcm_dwDefTransfer_i64@36"); + pfn_spcm_dwInvalidateBuf = (SPCM_DWINVALIDATEBUF*) GetProcAddress (hDLL, "_spcm_dwInvalidateBuf@8"); + pfn_spcm_dwGetErrorInfo_i32 = (SPCM_DWGETERRORINFO_I32*) GetProcAddress (hDLL, "_spcm_dwGetErrorInfo_i32@16"); + pfn_spcm_dwGetContBuf_i64m = (SPCM_DWGETCONTBUF_I64M*) GetProcAddress (hDLL, "_spcm_dwGetContBuf_i64m@20"); + pfn_spcm_dwGetContBuf_i64 = (SPCM_DWGETCONTBUF_I64*) GetProcAddress (hDLL, "_spcm_dwGetContBuf_i64@16"); + } + + // ----- 64bit ----- + else + { + // we first load the dll and check whether it is available + hDLL = LoadLibrary ("spcm_win64.dll"); + if (!hDLL) + { + printf ("Library spcm_win64.dll can't be located\n"); + + return 1; + } + + + + // now we load the functions from the DLL using the function names + pfn_spcm_hOpen = (SPCM_HOPEN*) GetProcAddress (hDLL, "spcm_hOpen"); + pfn_spcm_vClose = (SPCM_VCLOSE*) GetProcAddress (hDLL, "spcm_vClose"); + pfn_spcm_dwSetParam_i32 = (SPCM_DWSETPARAM_I32*) GetProcAddress (hDLL, "spcm_dwSetParam_i32"); + pfn_spcm_dwSetParam_i64m = (SPCM_DWSETPARAM_I64M*) GetProcAddress (hDLL, "spcm_dwSetParam_i64m"); + pfn_spcm_dwSetParam_i64 = (SPCM_DWSETPARAM_I64*) GetProcAddress (hDLL, "spcm_dwSetParam_i64"); + pfn_spcm_dwGetParam_i32 = (SPCM_DWGETPARAM_I32*) GetProcAddress (hDLL, "spcm_dwGetParam_i32"); + pfn_spcm_dwGetParam_i64m = (SPCM_DWGETPARAM_I64M*) GetProcAddress (hDLL, "spcm_dwGetParam_i64m"); + pfn_spcm_dwGetParam_i64 = (SPCM_DWGETPARAM_I64*) GetProcAddress (hDLL, "spcm_dwGetParam_i64"); + pfn_spcm_dwDefTransfer_i64m = (SPCM_DWDEFTRANSFER_I64M*) GetProcAddress (hDLL, "spcm_dwDefTransfer_i64m"); + pfn_spcm_dwDefTransfer_i64 = (SPCM_DWDEFTRANSFER_I64*) GetProcAddress (hDLL, "spcm_dwDefTransfer_i64"); + pfn_spcm_dwInvalidateBuf = (SPCM_DWINVALIDATEBUF*) GetProcAddress (hDLL, "spcm_dwInvalidateBuf"); + pfn_spcm_dwGetErrorInfo_i32 = (SPCM_DWGETERRORINFO_I32*) GetProcAddress (hDLL, "spcm_dwGetErrorInfo_i32"); + pfn_spcm_dwGetContBuf_i64m = (SPCM_DWGETCONTBUF_I64M*) GetProcAddress (hDLL, "spcm_dwGetContBuf_i64m"); + pfn_spcm_dwGetContBuf_i64 = (SPCM_DWGETCONTBUF_I64*) GetProcAddress (hDLL, "spcm_dwGetContBuf_i64"); + } + +#else // Linux + void* hLib = dlopen ("libspcm_linux.so", RTLD_NOW); + if (!hLib) + { + printf ("Library libspcm_linux.so can't be located\n"); + + return 1; + } + + pfn_spcm_hOpen = (SPCM_HOPEN*) dlsym (hLib, "spcm_hOpen"); + pfn_spcm_vClose = (SPCM_VCLOSE*) dlsym (hLib, "spcm_vClose"); + pfn_spcm_dwSetParam_i32 = (SPCM_DWSETPARAM_I32*) dlsym (hLib, "spcm_dwSetParam_i32"); + pfn_spcm_dwSetParam_i64m = (SPCM_DWSETPARAM_I64M*) dlsym (hLib, "spcm_dwSetParam_i64m"); + pfn_spcm_dwSetParam_i64 = (SPCM_DWSETPARAM_I64*) dlsym (hLib, "spcm_dwSetParam_i64"); + pfn_spcm_dwGetParam_i32 = (SPCM_DWGETPARAM_I32*) dlsym (hLib, "spcm_dwGetParam_i32"); + pfn_spcm_dwGetParam_i64m = (SPCM_DWGETPARAM_I64M*) dlsym (hLib, "spcm_dwGetParam_i64m"); + pfn_spcm_dwGetParam_i64 = (SPCM_DWGETPARAM_I64*) dlsym (hLib, "spcm_dwGetParam_i64"); + pfn_spcm_dwDefTransfer_i64m = (SPCM_DWDEFTRANSFER_I64M*) dlsym (hLib, "spcm_dwDefTransfer_i64m"); + pfn_spcm_dwDefTransfer_i64 = (SPCM_DWDEFTRANSFER_I64*) dlsym (hLib, "spcm_dwDefTransfer_i64"); + pfn_spcm_dwInvalidateBuf = (SPCM_DWINVALIDATEBUF*) dlsym (hLib, "spcm_dwInvalidateBuf"); + pfn_spcm_dwGetErrorInfo_i32 = (SPCM_DWGETERRORINFO_I32*) dlsym (hLib, "spcm_dwGetErrorInfo_i32"); + pfn_spcm_dwGetContBuf_i64m = (SPCM_DWGETCONTBUF_I64M*) dlsym (hLib, "spcm_dwGetContBuf_i64m"); + pfn_spcm_dwGetContBuf_i64 = (SPCM_DWGETCONTBUF_I64*) dlsym (hLib, "spcm_dwGetContBuf_i64"); +#endif + + + // check whether all these loads have been sucessful + if (!pfn_spcm_hOpen || !pfn_spcm_vClose || !pfn_spcm_dwSetParam_i32 || !pfn_spcm_dwSetParam_i64m || + !pfn_spcm_dwSetParam_i64 || !pfn_spcm_dwGetParam_i32 || !pfn_spcm_dwGetParam_i64m || !pfn_spcm_dwGetParam_i64 || + !pfn_spcm_dwDefTransfer_i64m || !pfn_spcm_dwDefTransfer_i64 || !pfn_spcm_dwInvalidateBuf || !pfn_spcm_dwGetErrorInfo_i32 || + !pfn_spcm_dwGetContBuf_i64m || !pfn_spcm_dwGetContBuf_i64) + { + printf ("One of the functions wasn't found inside the library!\n"); +#ifdef WIN32 + FreeLibrary (hDLL); +#else + dlclose (hLib); +#endif + + return 1; + } + + + + // as an example we open the first card, read out type and serial number and close the card again + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + hDrv = (*pfn_spcm_hOpen) ("/dev/spcm0"); + // hDrv = (*pfn_spcm_hOpen) ("TCPIP::192.168.1.10::inst0::INSTR"); + if (hDrv) + { + (*pfn_spcm_dwGetParam_i32) (hDrv, SPC_PCITYP, &lValue); + printf ("Card Type: M2i.%04x\n", lValue & TYP_VERSIONMASK); + + (*pfn_spcm_dwGetParam_i32) (hDrv, SPC_PCISERIALNO, &lValue); + printf ("Serial number: %05d\n", lValue); + + (*pfn_spcm_vClose) (hDrv); + } + else + printf ("no card found ...\n"); + + +#ifdef WIN32 + FreeLibrary (hDLL); +#else + dlclose (hLib); +#endif + + return 0; + } + diff --git a/Cpp/examples/c_cpp/netbox_discovery/makefile b/Cpp/examples/c_cpp/netbox_discovery/makefile new file mode 100644 index 0000000000000000000000000000000000000000..9b770e8bc99d08d4343c13f03bcb7e4f6032edab --- /dev/null +++ b/Cpp/examples/c_cpp/netbox_discovery/makefile @@ -0,0 +1,21 @@ +COMPILER = g++ +EXECUTABLE = netbox_discovery +LIBS += -lspcm_linux -lpthread -lrt + +OBJECTS = netbox_discovery.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/netbox_discovery/netbox_discovery.cpp b/Cpp/examples/c_cpp/netbox_discovery/netbox_discovery.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5e25330b888141a6106b6d4ddd5c0fc3576b0915 --- /dev/null +++ b/Cpp/examples/c_cpp/netbox_discovery/netbox_discovery.cpp @@ -0,0 +1,175 @@ +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +#include <algorithm> +#include <string> +#include <vector> +#include <iomanip> +#include <iostream> +#include <sstream> +#include <cstring> // memset + +#define TIMEOUT_DISCOVERY 5000 // timeout value in ms + +std::vector <std::string> vsGetAvailableVisaStrings () + { + const uint32 dwMaxNumRemoteCards = 50; + const uint32 dwMaxVisaStringLen = 50; + const uint32 dwMaxIdnStringLen = 256; + + char* pszVisa[dwMaxNumRemoteCards] = { NULL }; + char* pszIdn[dwMaxNumRemoteCards] = { NULL }; + + std::vector <std::string> vsVisa; + + // allocate memory for string list + for (uint32 i = 0; i < dwMaxNumRemoteCards; i++) + { + pszVisa[i] = new char [dwMaxVisaStringLen]; + pszIdn[i] = new char [dwMaxIdnStringLen]; + memset (pszVisa[i], 0, dwMaxVisaStringLen); + memset (pszIdn[i], 0, dwMaxIdnStringLen); + } + + // first make discovery - check if there are any LXI compatible remote devices + uint32 dwError = spcm_dwDiscovery ((char**)pszVisa, dwMaxNumRemoteCards, dwMaxVisaStringLen, TIMEOUT_DISCOVERY); + + // second: check from which manufacturer the devices are + spcm_dwSendIDNRequest ((char**)pszIdn, dwMaxNumRemoteCards, dwMaxIdnStringLen); + + // ----- store VISA strings for all discovered cards and open them afterwards ----- + for (uint32 i = 0; i < dwMaxNumRemoteCards; i++) + { + std::string sIDN (pszIdn[i]); + + if (sIDN.size () == 0) + break; + + if (sIDN.find("Spectrum") != std::string::npos) + vsVisa.push_back (pszVisa[i]); + } + + for (uint32 i = 0; i < dwMaxNumRemoteCards; i++) + { + delete [] pszVisa[i]; + delete [] pszIdn[i]; + } + + return vsVisa; + } + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + std::vector <std::string> vsVisaStrings; + std::vector <int32> vlNetboxSerialnumbers; + + struct ST_REMOTE_CARD + { + std::string sIP; + int32 lCardSN; + int32 lNetboxSN; + std::string sCard; + std::string sVISA; + std::string sNetbox; + + // helper function for std::sort + bool operator<(const ST_REMOTE_CARD& rstRHS) + { + if (sIP < rstRHS.sIP) + return true; + else if (sIP == rstRHS.sIP) + { + if (lNetboxSN > rstRHS.lNetboxSN) // use "greater than" here to get the card with the Netbox-SN to the top + return true; + else if (lNetboxSN == rstRHS.lCardSN) + { + return (lCardSN < rstRHS.lCardSN); + } + } + return false; + } + }; + std::vector < ST_REMOTE_CARD > vstRemoteCards; + + std::cout << "Netbox discovery running...\n\n"; + vsVisaStrings = vsGetAvailableVisaStrings (); + + for (uint32 i = 0; i < vsVisaStrings.size (); i++) + { + // open card + drv_handle hCard = spcm_hOpen (vsVisaStrings[i].c_str ()); + if (!hCard) + { + std::cout << "no card found...\n"; + return 0; + } + + std::string sIP (vsVisaStrings[i].substr (vsVisaStrings[i].find ("::") + 2)); + sIP = sIP.substr (0, sIP.find ("::")); + + // read some infos about the card + int32 lCardType; + spcm_dwGetParam_i32 (hCard, SPC_PCITYP, &lCardType); + int32 lCardSN; + spcm_dwGetParam_i32 (hCard, SPC_PCISERIALNO, &lCardSN); + int32 lNetboxType; + spcm_dwGetParam_i32 (hCard, SPC_NETBOX_TYPE, &lNetboxType); + int32 lNetboxSN; + spcm_dwGetParam_i32 (hCard, SPC_NETBOX_SERIALNO, &lNetboxSN); + + std::ostringstream sCard; + switch (lCardType & TYP_SERIESMASK) + { + case TYP_M2ISERIES: sCard << "M2i." << std::hex << (lCardType & 0xFFFF); break; + case TYP_M2IEXPSERIES: sCard << "M2i." << std::hex << (lCardType & 0xFFFF) << "-exp"; break; + case TYP_M3ISERIES: sCard << "M3i." << std::hex << (lCardType & 0xFFFF); break; + case TYP_M3IEXPSERIES: sCard << "M3i." << std::hex << (lCardType & 0xFFFF) << "-exp"; break; + case TYP_M4IEXPSERIES: sCard << "M4i." << std::hex << (lCardType & 0xFFFF); break; + case TYP_M4XEXPSERIES: sCard << "M4x." << std::hex << (lCardType & 0xFFFF); break; + case TYP_M2PEXPSERIES: sCard << "M2p." << std::hex << (lCardType & 0xFFFF) << "-x4"; break; + case TYP_M5IEXPSERIES: sCard << "M5i." << std::hex << (lCardType & 0xFFFF) << "-x16"; break; + } + + std::ostringstream sNetbox; + if (lNetboxType != 0) + { + sNetbox << "DN" << std::hex << ((lNetboxType & NETBOX_SERIES_MASK) >> 24) << "." << std::hex << ((lNetboxType & NETBOX_FAMILY_MASK) >> 16) << std::hex << ((lNetboxType & NETBOX_SPEED_MASK) >> 8) << "-" << std::setw(2) << std::setfill ('0') << std::dec << (lNetboxType & NETBOX_CHANNEL_MASK); + } + + ST_REMOTE_CARD stRemoteCard = { sIP, lCardSN, lNetboxSN, sCard.str (), vsVisaStrings[i], sNetbox.str () }; + vstRemoteCards.push_back (stRemoteCard); + + // close card + spcm_vClose (hCard); + } + std::sort (vstRemoteCards.begin (), vstRemoteCards.end ()); + + if (vstRemoteCards.size ()) + std::cout << "Netboxes found:\n"; + else + std::cout << "No Netboxes found!\n"; + + std::string sLastIP; + for (uint32 i = 0; i < vstRemoteCards.size (); i++) + { + if (vstRemoteCards[i].sIP != sLastIP) + { + std::cout << vstRemoteCards[i].sNetbox << " at " << vstRemoteCards[i].sIP << " with SN " << vstRemoteCards[i].lNetboxSN << std::endl; + sLastIP = vstRemoteCards[i].sIP; + } + std::cout << "\t" << vstRemoteCards[i].sCard << " SN" << vstRemoteCards[i].lCardSN << " at " << vstRemoteCards[i].sVISA << std::endl; + } + + return EXIT_SUCCESS; + } + + diff --git a/Cpp/examples/c_cpp/netbox_discovery/netbox_discovery.sln b/Cpp/examples/c_cpp/netbox_discovery/netbox_discovery.sln new file mode 100644 index 0000000000000000000000000000000000000000..40cb43c1b0c212184dbcae556589a62bbd7623ca --- /dev/null +++ b/Cpp/examples/c_cpp/netbox_discovery/netbox_discovery.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "netbox_discovery", "netbox_discovery.vcxproj", "{AB068386-BB5C-4442-ACFF-B5D9A79C311A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|x64.ActiveCfg = Debug|x64 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|x64.Build.0 = Debug|x64 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|x86.ActiveCfg = Debug|Win32 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|x86.Build.0 = Debug|Win32 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|x64.ActiveCfg = Release|x64 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|x64.Build.0 = Release|x64 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|x86.ActiveCfg = Release|Win32 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Cpp/examples/c_cpp/netbox_discovery/netbox_discovery.vcxproj b/Cpp/examples/c_cpp/netbox_discovery/netbox_discovery.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..a03ab12202b3a8f263a39fc494f4255ce8f10a26 --- /dev/null +++ b/Cpp/examples/c_cpp/netbox_discovery/netbox_discovery.vcxproj @@ -0,0 +1,260 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>netbox_discovery</ProjectName> + <ProjectGuid>{AB068386-BB5C-4442-ACFF-B5D9A79C311A}</ProjectGuid> + <RootNamespace>simple_rec_fifo</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/simple_rec_fifo.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/simple_rec_fifo.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/simple_rec_fifo.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/simple_rec_fifo.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/simple_rec_fifo.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/simple_rec_fifo.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/netbox_discovery.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/simple_rec_fifo.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/simple_rec_fifo.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/simple_rec_fifo.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/simple_rec_fifo.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/simple_rec_fifo.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/simple_rec_fifo.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/simple_rec_fifo.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\x64/Debug/netbox_discovery.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/simple_rec_fifo.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <ItemGroup> + <ClCompile Include="netbox_discovery.cpp" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/netbox_discovery/netbox_discovery.vcxproj.filters b/Cpp/examples/c_cpp/netbox_discovery/netbox_discovery.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..afa78fb819b3e4404a3e6a4af3995395e5bdce2d --- /dev/null +++ b/Cpp/examples/c_cpp/netbox_discovery/netbox_discovery.vcxproj.filters @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>Header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>Header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>Header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>Header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <Filter Include="Header"> + <UniqueIdentifier>{6fb0b1a4-a1ee-472a-92d9-1368d14cfb85}</UniqueIdentifier> + </Filter> + <Filter Include="Libs"> + <UniqueIdentifier>{3eae0868-da56-4740-8e36-0fbc9985e63d}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="netbox_discovery.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib" /> + <Library Include="..\c_header\spcm_win64_msvcpp.lib" /> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/netbox_embedded_server/client/client_main.cpp b/Cpp/examples/c_cpp/netbox_embedded_server/client/client_main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a47b1e89dc5961eb9f5cfd37b0506e42d5d9e8cd --- /dev/null +++ b/Cpp/examples/c_cpp/netbox_embedded_server/client/client_main.cpp @@ -0,0 +1,124 @@ +#ifdef WIN32 +# include <winsock2.h> // before everything else! +# include <Ws2tcpip.h> + + + +# undef min +# undef max + +typedef int ssize_t; +#else +# include <sys/socket.h> +# include <netinet/in.h> +# include <arpa/inet.h> +# include <unistd.h> +# include <errno.h> +# include <sys/types.h> +# include <netdb.h> + +typedef int SOCKET; +#define SOCKET_ERROR -1 +#endif + +#include <cstring> +#include <ctime> + +#include <iostream> + +#include <cstdlib> + +// ----- include standard driver header from library ----- +#include "../../c_header/dlltyp.h" + +#include "../../common/ostools/spcm_oswrap.h" +#include "../../common/ostools/spcm_ostools.h" +#include "../../common/ostools/spcm_network_winLin.h" + +#define SERVER_PORT 22927 +#define START 0 +#define STOP 1 + + +int main () + { + // ----- init network ----- + dwInitNetwork (); + + // ----- create network socket ----- + SOCKET sockfd = lSocket (AF_INET, SOCK_STREAM, 0); + if (sockfd < 0) + { + std::cerr << "Could not create socket" << std::endl; + return EXIT_FAILURE; + } + + // ----- hostname or IP address of server ----- + const char* szHostname = "192.168.1.10"; + //const char* szHostname = "SERVER"; + + // ----- convert hostname to IP address ----- + struct sockaddr_in serv_addr; + memset (&serv_addr, 0, sizeof(serv_addr)); + serv_addr.sin_family = AF_INET; + + int lErr = lInet_pton (szHostname, &serv_addr); + if (lErr == SOCKET_ERROR) + { + std::cerr << "Could not convert IP address" << std::endl; + lClose (sockfd); + return EXIT_FAILURE; + } + serv_addr.sin_port = htons (SERVER_PORT); + + // ----- connect to server ----- + if (lConnect (sockfd, (struct sockaddr *)&serv_addr, sizeof (serv_addr)) == -1) + { + std::cerr << "Could not connect to server" << std::endl; + lClose (sockfd); + return EXIT_FAILURE; + } + + // ----- send start command to server ----- + uint32 dwMagic = START; + dwWrite (sockfd, &dwMagic, sizeof (uint32)); + + char acBuffer[1024]; + while (true) + { + // ----- read data from sender ----- + unsigned dwReadBytes = dwRead (sockfd, acBuffer, sizeof (acBuffer) - 1); + if (dwReadBytes == 0) + { + // connection closed + std::cerr << "Connection closed" << std::endl; + break; + } + else if (dwReadBytes == SOCKET_ERROR) + { + // error occured + std::cerr << "NETWORK ERROR" << std::endl; + break; + } + else + { + acBuffer[dwReadBytes] = '\0'; + std::cout << acBuffer << std::endl; + } + + // check for escape = abort + if (bKbhit ()) + { + if (cGetch () == 27) + { + uint32 dwMagic = STOP; + dwWrite (sockfd, &dwMagic, sizeof (uint32)); + break; + } + } + } + + lClose (sockfd); + + return EXIT_SUCCESS; + } diff --git a/Cpp/examples/c_cpp/netbox_embedded_server/client/makefile b/Cpp/examples/c_cpp/netbox_embedded_server/client/makefile new file mode 100644 index 0000000000000000000000000000000000000000..1945d82b63c19cd10e5becf0dd28aa2b705e8e29 --- /dev/null +++ b/Cpp/examples/c_cpp/netbox_embedded_server/client/makefile @@ -0,0 +1,23 @@ +COMPILER = g++ +EXECUTABLE = netbox_embedded_client +LIBS += -lspcm_linux -lpthread -lrt +CFLAGS += -DSPCM_NAMESPACE=client + +OBJECTS = client_main.o\ + ../../common/ostools/spcm_ostools_linux.o \ + ../../common/ostools/spcm_network_winLin.o \ + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/netbox_embedded_server/client/netbox_embedded_client.vcproj b/Cpp/examples/c_cpp/netbox_embedded_server/client/netbox_embedded_client.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..1a0d174f5168196fccd9df84413ce319f8f459b9 --- /dev/null +++ b/Cpp/examples/c_cpp/netbox_embedded_server/client/netbox_embedded_client.vcproj @@ -0,0 +1,219 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="netbox_embedded_client" + ProjectGUID="{93F48CF1-5ED5-4202-A223-F2A932FAE397}" + RootNamespace="netbox_embedded_client" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;SPCM_NAMESPACE=client" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="ws2_32.lib" + GenerateDebugInformation="true" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + CharacterSet="2" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="WIN32;SPCM_NAMESPACE=client" + RuntimeLibrary="2" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\client_main.cpp" + > + </File> + <Filter + Name="ostools" + > + <File + RelativePath="..\..\common\ostools\spcm_network_winLin.cpp" + > + </File> + <File + RelativePath="..\..\common\ostools\spcm_ostools_win.cpp" + > + </File> + </Filter> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <Filter + Name="ostools" + > + <File + RelativePath="..\..\common\ostools\spcm_network_winLin.h" + > + </File> + <File + RelativePath="..\..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\..\common\ostools\spcm_oswrap.h" + > + </File> + </Filter> + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/netbox_embedded_server/dbus/dbus-example.c b/Cpp/examples/c_cpp/netbox_embedded_server/dbus/dbus-example.c new file mode 100644 index 0000000000000000000000000000000000000000..e3f479331aade12e33208b09eef6d670851d937f --- /dev/null +++ b/Cpp/examples/c_cpp/netbox_embedded_server/dbus/dbus-example.c @@ -0,0 +1,391 @@ +#define DBUS_API_SUBJECT_TO_CHANGE +#include <dbus/dbus.h> +#include <stdbool.h> +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +/** + * Connect to the DBUS bus and send a broadcast signal + */ +void sendsignal(char* sigvalue) +{ + DBusMessage* msg; + DBusMessageIter args; + DBusConnection* conn; + DBusError err; + int ret; + dbus_uint32_t serial = 0; + + printf("Sending signal with value %s\n", sigvalue); + + // initialise the error value + dbus_error_init(&err); + + // connect to the DBUS system bus, and check for errors + conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err); + if (dbus_error_is_set(&err)) { + fprintf(stderr, "Connection Error (%s)\n", err.message); + dbus_error_free(&err); + } + if (NULL == conn) { + exit(1); + } + + // register our name on the bus, and check for errors + //ret = dbus_bus_request_name(conn, "test.signal.source", DBUS_NAME_FLAG_REPLACE_EXISTING , &err); + ret = dbus_bus_request_name(conn, "com.spectrum.netbox.lan", DBUS_NAME_FLAG_REPLACE_EXISTING , &err); + if (dbus_error_is_set(&err)) { + fprintf(stderr, "Name Error (%s)\n", err.message); + dbus_error_free(&err); + } + if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) { + exit(1); + } + + // create a signal & check for errors + msg = dbus_message_new_signal("/test/signal/Object", // object name of the signal + "Netbox.signal.Type", // interface name of the signal + "LAN"); // name of the signal + if (NULL == msg) + { + fprintf(stderr, "Message Null\n"); + exit(1); + } + + // append arguments onto signal + dbus_message_iter_init_append(msg, &args); + if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &sigvalue)) { + fprintf(stderr, "Out Of Memory!\n"); + exit(1); + } + + // send the message and flush the connection + if (!dbus_connection_send(conn, msg, &serial)) { + fprintf(stderr, "Out Of Memory!\n"); + exit(1); + } + dbus_connection_flush(conn); + + printf("Signal Sent\n"); + + // free the message and close the connection + dbus_message_unref(msg); + dbus_connection_close(conn); +} + +/** + * Call a method on a remote object + */ +void query(char* param) +{ + DBusMessage* msg; + DBusMessageIter args; + DBusConnection* conn; + DBusError err; + DBusPendingCall* pending; + int ret; + bool stat; + dbus_uint32_t level; + + printf("Calling remote method with %s\n", param); + + // initialiset the errors + dbus_error_init(&err); + + // connect to the system bus and check for errors + conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err); + if (dbus_error_is_set(&err)) { + fprintf(stderr, "Connection Error (%s)\n", err.message); + dbus_error_free(&err); + } + if (NULL == conn) { + exit(1); + } + + // request our name on the bus + ret = dbus_bus_request_name(conn, "test.method.caller", DBUS_NAME_FLAG_REPLACE_EXISTING , &err); + if (dbus_error_is_set(&err)) { + fprintf(stderr, "Name Error (%s)\n", err.message); + dbus_error_free(&err); + } + if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) { + exit(1); + } + + // create a new method call and check for errors + msg = dbus_message_new_method_call("test.method.server", // target for the method call + "/test/method/Object", // object to call on + "test.method.Type", // interface to call on + "Method"); // method name + if (NULL == msg) { + fprintf(stderr, "Message Null\n"); + exit(1); + } + + // append arguments + dbus_message_iter_init_append(msg, &args); + if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, ¶m)) { + fprintf(stderr, "Out Of Memory!\n"); + exit(1); + } + + // send message and get a handle for a reply + if (!dbus_connection_send_with_reply (conn, msg, &pending, -1)) { // -1 is default timeout + fprintf(stderr, "Out Of Memory!\n"); + exit(1); + } + if (NULL == pending) { + fprintf(stderr, "Pending Call Null\n"); + exit(1); + } + dbus_connection_flush(conn); + + printf("Request Sent\n"); + + // free message + dbus_message_unref(msg); + + // block until we recieve a reply + dbus_pending_call_block(pending); + + // get the reply message + msg = dbus_pending_call_steal_reply(pending); + if (NULL == msg) { + fprintf(stderr, "Reply Null\n"); + exit(1); + } + // free the pending message handle + dbus_pending_call_unref(pending); + + // read the parameters + if (!dbus_message_iter_init(msg, &args)) + fprintf(stderr, "Message has no arguments!\n"); + else if (DBUS_TYPE_BOOLEAN != dbus_message_iter_get_arg_type(&args)) + fprintf(stderr, "Argument is not boolean!\n"); + else + dbus_message_iter_get_basic(&args, &stat); + + if (!dbus_message_iter_next(&args)) + fprintf(stderr, "Message has too few arguments!\n"); + else if (DBUS_TYPE_UINT32 != dbus_message_iter_get_arg_type(&args)) + fprintf(stderr, "Argument is not int!\n"); + else + dbus_message_iter_get_basic(&args, &level); + + printf("Got Reply: %d, %d\n", stat, level); + + // free reply and close connection + dbus_message_unref(msg); + dbus_connection_close(conn); +} + +void reply_to_method_call(DBusMessage* msg, DBusConnection* conn) +{ + DBusMessage* reply; + DBusMessageIter args; + bool stat = true; + dbus_uint32_t level = 21614; + dbus_uint32_t serial = 0; + char* param = ""; + + // read the arguments + if (!dbus_message_iter_init(msg, &args)) + fprintf(stderr, "Message has no arguments!\n"); + else if (DBUS_TYPE_STRING != dbus_message_iter_get_arg_type(&args)) + fprintf(stderr, "Argument is not string!\n"); + else + dbus_message_iter_get_basic(&args, ¶m); + + printf("Method called with %s\n", param); + + // create a reply from the message + reply = dbus_message_new_method_return(msg); + + // add the arguments to the reply + dbus_message_iter_init_append(reply, &args); + if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_BOOLEAN, &stat)) { + fprintf(stderr, "Out Of Memory!\n"); + exit(1); + } + if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_UINT32, &level)) { + fprintf(stderr, "Out Of Memory!\n"); + exit(1); + } + + // send the reply && flush the connection + if (!dbus_connection_send(conn, reply, &serial)) { + fprintf(stderr, "Out Of Memory!\n"); + exit(1); + } + dbus_connection_flush(conn); + + // free the reply + dbus_message_unref(reply); +} + +/** + * Server that exposes a method call and waits for it to be called + */ +void listen() +{ + DBusMessage* msg; + DBusConnection* conn; + DBusError err; + int ret; + + printf("Listening for method calls\n"); + + // initialise the error + dbus_error_init(&err); + + // connect to the bus and check for errors + conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err); + if (dbus_error_is_set(&err)) { + fprintf(stderr, "Connection Error (%s)\n", err.message); + dbus_error_free(&err); + } + if (NULL == conn) { + fprintf(stderr, "Connection Null\n"); + exit(1); + } + + // request our name on the bus and check for errors + ret = dbus_bus_request_name(conn, "test.method.server", DBUS_NAME_FLAG_REPLACE_EXISTING , &err); + if (dbus_error_is_set(&err)) { + fprintf(stderr, "Name Error (%s)\n", err.message); + dbus_error_free(&err); + } + if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) { + fprintf(stderr, "Not Primary Owner (%d)\n", ret); + exit(1); + } + + // loop, testing for new messages + while (true) { + // non blocking read of the next available message + dbus_connection_read_write(conn, 0); + msg = dbus_connection_pop_message(conn); + + // loop again if we haven't got a message + if (NULL == msg) { + sleep(1); + continue; + } + + // check this is a method call for the right interface & method + if (dbus_message_is_method_call(msg, "test.method.Type", "Method")) + reply_to_method_call(msg, conn); + + // free the message + dbus_message_unref(msg); + } + + // close the connection + dbus_connection_close(conn); +} + +/** + * Listens for signals on the bus + */ +void receive() +{ + DBusMessage* msg; + DBusMessageIter args; + DBusConnection* conn; + DBusError err; + int ret; + char* sigvalue; + + printf("Listening for signals\n"); + + // initialise the errors + dbus_error_init(&err); + + // connect to the bus and check for errors + conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err); + if (dbus_error_is_set(&err)) { + fprintf(stderr, "Connection Error (%s)\n", err.message); + dbus_error_free(&err); + } + if (NULL == conn) { + exit(1); + } + + // request our name on the bus and check for errors + ret = dbus_bus_request_name(conn, "com.spectrum.netbox.embedded.waitingforlan", DBUS_NAME_FLAG_REPLACE_EXISTING , &err); + if (dbus_error_is_set(&err)) { + fprintf(stderr, "Name Error (%s)\n", err.message); + dbus_error_free(&err); + } + if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) { + exit(1); + } + + // add a rule for which messages we want to see + dbus_bus_add_match(conn, "type='signal',interface='Netbox.signal.Type'", &err); // see signals from the given interface + dbus_connection_flush(conn); + if (dbus_error_is_set(&err)) { + fprintf(stderr, "Match Error (%s)\n", err.message); + exit(1); + } + printf("Match rule sent\n"); + + // loop listening for signals being emmitted + while (true) { + + // non blocking read of the next available message + dbus_connection_read_write(conn, 0); + msg = dbus_connection_pop_message(conn); + + // loop again if we haven't read a message + if (NULL == msg) { + sleep(1); + continue; + } + + // check if the message is a signal from the correct interface and with the correct name + if (dbus_message_is_signal(msg, "Netbox.signal.Type", "LAN")) { + + // read the parameters + if (!dbus_message_iter_init(msg, &args)) + fprintf(stderr, "Message Has No Parameters\n"); + else if (DBUS_TYPE_STRING != dbus_message_iter_get_arg_type(&args)) + fprintf(stderr, "Argument is not string!\n"); + else + dbus_message_iter_get_basic(&args, &sigvalue); + + printf("Got Signal with value %s\n", sigvalue); + } + + // free the message + dbus_message_unref(msg); + } + // close the connection + dbus_connection_close(conn); +} + +int main(int argc, char** argv) +{ + if (2 > argc) { + printf ("Syntax: dbus-example [send|receive|listen|query] [<param>]\n"); + return 1; + } + char* param = "no param"; + if (3 >= argc && NULL != argv[2]) param = argv[2]; + if (0 == strcmp(argv[1], "send")) + sendsignal(param); + else if (0 == strcmp(argv[1], "receive")) + receive(); + else if (0 == strcmp(argv[1], "listen")) + listen(); + else if (0 == strcmp(argv[1], "query")) + query(param); + else { + printf ("Syntax: dbus-example [send|receive|listen|query] [<param>]\n"); + return 1; + } + return 0; +} + diff --git a/Cpp/examples/c_cpp/netbox_embedded_server/dbus/makefile b/Cpp/examples/c_cpp/netbox_embedded_server/dbus/makefile new file mode 100644 index 0000000000000000000000000000000000000000..6dc4c3f74e8758f5e4d7ebe00d5491201bc47605 --- /dev/null +++ b/Cpp/examples/c_cpp/netbox_embedded_server/dbus/makefile @@ -0,0 +1,19 @@ +# +# Define a list of pkg-config packages we want to use +pkg_packages := dbus-glib-1 +PKG_CFLAGS := $(shell pkg-config --cflags $(pkg_packages)) +PKG_LDFLAGS := $(shell pkg-config --libs $(pkg_packages)) +# Additional flags for the compiler: +# -g : Add debugging symbols +# -Wall : Enable most gcc warnings +ADD_CFLAGS := -g -Wall +# Combine user supplied, additional, and pkg-config flags +CFLAGS := $(PKG_CFLAGS) $(ADD_CFLAGS) $(CFLAGS) +LDFLAGS := $(PKG_LDFLAGS) $(LDFLAGS) +targets = dbus-example +.PHONY: all clean +all: $(targets) +dbus-example: dbus-example.c + $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) +clean: + $(RM) $(targets) diff --git a/Cpp/examples/c_cpp/netbox_embedded_server/dbus/readme.txt b/Cpp/examples/c_cpp/netbox_embedded_server/dbus/readme.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd8af6df4eefe3a46608dc8925c35e46f75b1883 --- /dev/null +++ b/Cpp/examples/c_cpp/netbox_embedded_server/dbus/readme.txt @@ -0,0 +1,3 @@ +The Netbox distributes a DBUS signal that shows if network is up. + +To check this signal use the receive() function of the supplied DBUS example program. diff --git a/Cpp/examples/c_cpp/netbox_embedded_server/readme.txt b/Cpp/examples/c_cpp/netbox_embedded_server/readme.txt new file mode 100644 index 0000000000000000000000000000000000000000..2568859b072252d0b083ff5ba0dceca01678817d --- /dev/null +++ b/Cpp/examples/c_cpp/netbox_embedded_server/readme.txt @@ -0,0 +1,12 @@ +This directory contains examples for the Embedded Server Option. + +Client +Server +These two programs implement a very simple client-server communication. The server is intended to run on the Netbox while the client runs on the user's PC. + +dbus +This is an example on how to connect to the Netbox's internal signals (currently only LAN state). + +simple_rec_fifo_mail +This example will run a FIFO multi acquisition and send a mail for each acquired segment as a SBench6-compatible binary file. Please keep in mind that a high trigger frequency will flood your mailserver with emails which might trigger some spam detection mechanisms. + diff --git a/Cpp/examples/c_cpp/netbox_embedded_server/server/makefile b/Cpp/examples/c_cpp/netbox_embedded_server/server/makefile new file mode 100644 index 0000000000000000000000000000000000000000..5b37c2008253ad6aef91098f0fad60c2a6f7a170 --- /dev/null +++ b/Cpp/examples/c_cpp/netbox_embedded_server/server/makefile @@ -0,0 +1,23 @@ +COMPILER = g++ +EXECUTABLE = netbox_embedded_server +LIBS += -lspcm_linux -lpthread -lrt +CFLAGS += -DSPCM_NAMESPACE=server + +OBJECTS = server_main.o\ + ../../common/ostools/spcm_ostools_linux.o \ + ../../common/ostools/spcm_network_winLin.o \ + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/netbox_embedded_server/server/netbox_embedded_server.vcproj b/Cpp/examples/c_cpp/netbox_embedded_server/server/netbox_embedded_server.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..c84d56868592914f7c69930a39d0a69ea71112dc --- /dev/null +++ b/Cpp/examples/c_cpp/netbox_embedded_server/server/netbox_embedded_server.vcproj @@ -0,0 +1,223 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="netbox_embedded_server" + ProjectGUID="{2D1AA406-1C82-4926-B726-014905A18E66}" + RootNamespace="netbox_embedded_server" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;SPCM_NAMESPACE=server" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="ws2_32.lib" + GenerateDebugInformation="true" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + CharacterSet="2" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="WIN32;SPCM_NAMESPACE=server" + RuntimeLibrary="2" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\server_main.cpp" + > + </File> + <Filter + Name="ostools" + > + <File + RelativePath="..\..\common\ostools\spcm_network_winLin.cpp" + > + </File> + <File + RelativePath="..\..\common\ostools\spcm_ostools_win.cpp" + > + </File> + </Filter> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <Filter + Name="common" + > + <File + RelativePath="..\..\common\ostools\spcm_network_winLin.h" + > + </File> + <File + RelativePath="..\..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\..\common\ostools\spcm_oswrap.h" + > + </File> + </Filter> + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + <File + RelativePath="..\..\c_header\spcm_win32_msvcpp.lib" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/netbox_embedded_server/server/server_main.cpp b/Cpp/examples/c_cpp/netbox_embedded_server/server/server_main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..96ac08b7dc5409d8e90870f2cf69219d02af8d32 --- /dev/null +++ b/Cpp/examples/c_cpp/netbox_embedded_server/server/server_main.cpp @@ -0,0 +1,364 @@ +/* +******************************************************************************* + +server_main.cpp (c) Spectrum GmbH + +******************************************************************************* + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +******************************************************************************* +*/ + +#ifdef WIN32 +# include <winsock2.h> // before everything else! +# include <Ws2tcpip.h> + + + +# undef min +# undef max + +typedef int ssize_t; +#else +# include <sys/socket.h> +# include <netinet/in.h> +# include <arpa/inet.h> +# include <unistd.h> +# include <errno.h> +# include <sys/types.h> +# include <netdb.h> + +typedef int SOCKET; +#define SOCKET_ERROR -1 +#endif + +#include <cstring> +#include <ctime> + +#include <iostream> +#include <iomanip> +#include <algorithm> + +#include <cstdlib> + +// ----- include standard driver header from library ----- +#include "../../c_header/dlltyp.h" +#include "../../c_header/regs.h" +#include "../../c_header/spcerr.h" +#include "../../c_header/spcm_drv.h" + +#include "../../common/ostools/spcm_oswrap.h" +#include "../../common/ostools/spcm_ostools.h" +#include "../../common/ostools/spcm_network_winLin.h" + + +#define SERVER_PORT 22927 +#define START 0 +#define STOP 1 + +bool bDataCanBeReadFromSocket (SOCKET lSocket) + { + fd_set fdset; + struct timeval stNoWait; + + FD_ZERO (&fdset); + FD_SET (lSocket, &fdset); + memset (&stNoWait, 0, sizeof (stNoWait)); + + // returns immediately if data can be read from socket without blocking + lSelect (lSocket + 1, &fdset, NULL, NULL, &stNoWait); + if (FD_ISSET (lSocket, &fdset)) + return true; + else + return false; + } + + +bool bSetupCard () + { + + return true; + } + +int main () + { + dwInitNetwork (); + + SOCKET listenfd = lSocket (AF_INET, SOCK_STREAM, 0); + + struct sockaddr_in serv_addr; + memset(&serv_addr, '0', sizeof(serv_addr)); + serv_addr.sin_family = AF_INET; + serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); + serv_addr.sin_port = htons(SERVER_PORT); + + lBind (listenfd, (struct sockaddr*)&serv_addr, sizeof(serv_addr)); + + lListen (listenfd, 10); + + SOCKET lAcceptedSocket = INVALID_SOCKET; + fd_set rfds; + SOCKET lMaxSockFd = listenfd; + char acBuffer[1024]; + while (true) + { + FD_ZERO (&rfds); + lMaxSockFd = -1; + if (lAcceptedSocket == INVALID_SOCKET) + { + std::cout << "Waiting for client..." << std::endl; + FD_SET (listenfd, &rfds); + lMaxSockFd = listenfd; + } + else + { + FD_SET (lAcceptedSocket, &rfds); + lMaxSockFd = std::max (lMaxSockFd, lAcceptedSocket); + } + + select ((int)(lMaxSockFd + 1), &rfds, NULL, NULL, NULL); + + if (FD_ISSET(listenfd, &rfds)) + { + std::cout << "Accepted client..." << std::endl; + lAcceptedSocket = accept (listenfd, (struct sockaddr*)NULL, NULL); + } + + // ----- read socket and print received data ----- + if (FD_ISSET (lAcceptedSocket, &rfds)) + { + // ----- read data from sender ----- + unsigned dwReadBytes = dwRead (lAcceptedSocket, acBuffer, sizeof (acBuffer) - 1); + if (dwReadBytes == 0) + { + // connection closed + lClose (lAcceptedSocket); + lAcceptedSocket = INVALID_SOCKET; + } + else if (dwReadBytes == SOCKET_ERROR) + { + // error occured + std::cerr << "NETWORK ERROR" << std::endl; + lClose (lAcceptedSocket); + lAcceptedSocket = INVALID_SOCKET; + } + else + { + uint32 dwMagic = *reinterpret_cast < uint32* > (acBuffer); + switch (dwMagic) + { + case START: + { + drv_handle hCard; + int32 lCardType, lSerialNumber, lFncType; + int16* pnData; + char szErrorTextBuffer[ERRORTEXTLEN]; + uint32 dwError; + int32 lStatus; + int64 llAvailUser, llPCPos; + uint64 qwTotalMem = 0; + uint64 qwToTransfer = MEGA_B(64); + + // settings for the FIFO mode buffer handling + int64 llBufferSize = MEGA_B(4); + int32 lNotifySize = KILO_B(16); + + + // open card + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + hCard = spcm_hOpen ("/dev/spcm0"); + if (!hCard) + { + std::cerr << "no card found..." << std::endl; + return EXIT_FAILURE; + } + +#ifndef WIN32 + system ("netbox_led_client conngreen=1"); +#endif + + // read type, function and sn and check for A/D card + spcm_dwGetParam_i32 (hCard, SPC_PCITYP, &lCardType); + spcm_dwGetParam_i32 (hCard, SPC_PCISERIALNO, &lSerialNumber); + spcm_dwGetParam_i32 (hCard, SPC_FNCTYPE, &lFncType); + + std::cout << "Found: "; + switch (lCardType & TYP_SERIESMASK) + { + case TYP_M2ISERIES: std::cout << "M2i." << std::hex << (lCardType & TYP_VERSIONMASK); break; + case TYP_M2IEXPSERIES: std::cout << "M2i." << std::hex << (lCardType & TYP_VERSIONMASK) << "-Exp"; break; + case TYP_M3ISERIES: std::cout << "M3i." << std::hex << (lCardType & TYP_VERSIONMASK); break; + case TYP_M3IEXPSERIES: std::cout << "M3i." << std::hex << (lCardType & TYP_VERSIONMASK) << "-Exp"; break; + case TYP_M4IEXPSERIES: std::cout << "M4i." << std::hex << (lCardType & TYP_VERSIONMASK) << "-x8"; break; + case TYP_M4XEXPSERIES: std::cout << "M4x." << std::hex << (lCardType & TYP_VERSIONMASK) << "-x4"; break; + default: std::cout << "unknown type"; break; + } + std::cout << " sn " << std::setw (5) << lSerialNumber << std::endl; + + if (lFncType != SPCM_TYPE_AI) + { + std::cerr << "Card not supported by example" << std::endl; + return EXIT_FAILURE; + } + + + // do a simple standard setup + spcm_dwSetParam_i32 (hCard, SPC_CHENABLE, CHANNEL0); // just 1 channel enabled + spcm_dwSetParam_i32 (hCard, SPC_PATH0, 0); + spcm_dwSetParam_i32 (hCard, SPC_AMP0, 1000); + spcm_dwSetParam_i32 (hCard, SPC_CARDMODE, SPC_REC_FIFO_MULTI); // single FIFO mode + spcm_dwSetParam_i32 (hCard, SPC_SEGMENTSIZE, lNotifySize); + spcm_dwSetParam_i32 (hCard, SPC_POSTTRIGGER, lNotifySize - 64); + spcm_dwSetParam_i32 (hCard, SPC_PRETRIGGER, 1024); // 1k of pretrigger data at start of FIFO mode + spcm_dwSetParam_i32 (hCard, SPC_LOOPS, 0); // endless FIFO + spcm_dwSetParam_i32 (hCard, SPC_TIMEOUT, 5000); // timeout 5 s + spcm_dwSetParam_i32 (hCard, SPC_TRIG_ORMASK, SPC_TMASK_NONE); // trigger set to channel + spcm_dwSetParam_i32 (hCard, SPC_TRIG_CH_ORMASK0, SPC_TMASK0_CH0); // trigger set to channel0 + spcm_dwSetParam_i32 (hCard, SPC_TRIG_CH0_MODE, SPC_TM_POS); + spcm_dwSetParam_i32 (hCard, SPC_TRIG_CH0_LEVEL0, 20); + spcm_dwSetParam_i32 (hCard, SPC_TRIG_ANDMASK, 0); // ... + spcm_dwSetParam_i32 (hCard, SPC_CLOCKMODE, SPC_CM_INTPLL); // clock mode internal PLL + + // we try to set the samplerate to 100 kHz (M2i) or 20 MHz (M3i and M4i) on internal PLL, no clock output + if (((lCardType & TYP_SERIESMASK) == TYP_M2ISERIES) || ((lCardType & TYP_SERIESMASK) == TYP_M2IEXPSERIES)) + spcm_dwSetParam_i64 (hCard, SPC_SAMPLERATE, KILO(100)); + else + spcm_dwSetParam_i64 (hCard, SPC_SAMPLERATE, MEGA(20)); + + spcm_dwSetParam_i32 (hCard, SPC_CLOCKOUT, 0); // no clock output + + + // define the data buffer + pnData = (int16*) pvAllocMemPageAligned ((uint64) llBufferSize); + if (!pnData) + { + std::cerr << "memory allocation failed" << std::endl; + spcm_vClose (hCard); + return false; + } + + spcm_dwDefTransfer_i64 (hCard, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, lNotifySize, pnData, 0, llBufferSize); + + + // start everything + dwError = spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_DATA_STARTDMA); + + // check for error + if (dwError != ERR_OK) + { + spcm_dwGetErrorInfo_i32 (hCard, NULL, NULL, szErrorTextBuffer); + std::cout << szErrorTextBuffer << std::endl; + vFreeMemPageAligned (pnData, (uint64) llBufferSize); + spcm_vClose (hCard); + return 0; + } + + // ----- start data processing loop ----- + while (qwTotalMem < qwToTransfer) + { + // ----- check if client has been clocked or if it has sent an abort command ----- + bool bKeepRunning = true; + if (bDataCanBeReadFromSocket (lAcceptedSocket)) + { + unsigned dwReadBytes = dwRead (lAcceptedSocket, acBuffer, sizeof (acBuffer) - 1); + if (dwReadBytes == 0) + { + // connection closed + lClose (lAcceptedSocket); + lAcceptedSocket = INVALID_SOCKET; + bKeepRunning = false; + } + else if (dwReadBytes == SOCKET_ERROR) + { + // error occured + lClose (lAcceptedSocket); + lAcceptedSocket = INVALID_SOCKET; + bKeepRunning = false; + } + else + { + dwMagic = *reinterpret_cast < uint32* > (acBuffer); + if (dwMagic == STOP) + { + bKeepRunning = false; + break; + } + } + } + if (!bKeepRunning) + { + // send the stop command + dwError = spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_CARD_STOP | M2CMD_DATA_STOPDMA); + + spcm_vClose (hCard); + break; + } + + if ((dwError = spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_DATA_WAITDMA)) != ERR_OK) + { + if (dwError == ERR_TIMEOUT) + std::cout << "... Timeout" << std::endl; + else + std::cerr << "... Error: " << dwError << std::endl; + break; + } + + else + { + spcm_dwGetParam_i32 (hCard, SPC_M2STATUS, &lStatus); + spcm_dwGetParam_i64 (hCard, SPC_DATA_AVAIL_USER_LEN, &llAvailUser); + spcm_dwGetParam_i64 (hCard, SPC_DATA_AVAIL_USER_POS, &llPCPos); + + if (llAvailUser >= lNotifySize) + { +#ifndef WIN32 + system ("netbox_led_client armgreen=1"); +#endif + uint32 dwNumSamples = lNotifySize / sizeof (int16); + qwTotalMem += dwNumSamples; + + char* pcStartPos = (char*)pnData + llPCPos; + char* pcEndPos = pcStartPos + lNotifySize; + + // this is the point to do anything with the data + // since notify size is multiple of buffer size, we don't care about buffer wrap-around + int16 nMax = *std::max_element ((int16*)pcStartPos, (int16*)pcEndPos); + int16 nMin = *std::min_element ((int16*)pcStartPos, (int16*)pcEndPos); + int32 lAvg = 0; + for (unsigned dwIdx = 0; dwIdx < dwNumSamples; dwIdx++) + { + lAvg += *(((int16*)pcStartPos) + dwIdx); + } + lAvg /= dwNumSamples; + + char acText[128]; + snprintf (acText, 128, "Maximum: %hd Minimum: %hd Average: %d\n", nMax, nMin, lAvg); + + ssize_t dwWritten_bytes = dwWrite (lAcceptedSocket, acText, strlen (acText)); + + spcm_dwSetParam_i32 (hCard, SPC_DATA_AVAIL_CARD_LEN, lNotifySize); +#ifndef WIN32 + system ("netbox_led_client armgreen=0"); +#endif + } + } + } + break; + } + default: + // unknown magic number. Should not reach here + break; + } + } + } + } + + return EXIT_SUCCESS; + } diff --git a/Cpp/examples/c_cpp/netbox_embedded_server/simple_rec_fifo_mail/makefile b/Cpp/examples/c_cpp/netbox_embedded_server/simple_rec_fifo_mail/makefile new file mode 100644 index 0000000000000000000000000000000000000000..884aceb3869351e9c384ed314be6ddde8f596312 --- /dev/null +++ b/Cpp/examples/c_cpp/netbox_embedded_server/simple_rec_fifo_mail/makefile @@ -0,0 +1,22 @@ +COMPILER = g++ +EXECUTABLE = simple_rec_fifo_mail +LIBS += -lspcm_linux -lpthread -lrt -lcurl + +OBJECTS = simple_rec_fifo_mail.o\ + ../../common/ostools/spcm_ostools_linux.o\ + ../../common//spcm_netbox_sendmail.o\ + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/netbox_embedded_server/simple_rec_fifo_mail/simple_rec_fifo_mail.cpp b/Cpp/examples/c_cpp/netbox_embedded_server/simple_rec_fifo_mail/simple_rec_fifo_mail.cpp new file mode 100644 index 0000000000000000000000000000000000000000..69873adcde0e268aad6390b070a0c991a25fe3fb --- /dev/null +++ b/Cpp/examples/c_cpp/netbox_embedded_server/simple_rec_fifo_mail/simple_rec_fifo_mail.cpp @@ -0,0 +1,286 @@ +/* +************************************************************************** + +simple_rec_fifo.cpp (c) Spectrum GmbH + +************************************************************************** + +Example for all Netboxes based analog acquisition cards. + +Information about the different products and their drivers can be found +online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/platform-driver-and-series-differences + +Shows a simple FIFO mode example using only the few necessary commands + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + +// ----- include standard driver header from library ----- +#include "../../c_header/dlltyp.h" +#include "../../c_header/regs.h" +#include "../../c_header/spcerr.h" +#include "../../c_header/spcm_drv.h" + +#include "../../common/ostools/spcm_oswrap.h" +#include "../../common/ostools/spcm_ostools.h" + +#include "../../common/spcm_netbox_sendmail.h" + +// ----- standard c include files ----- +#include <stdio.h> + + +/* +************************************************************************** +szTypeToName: doing name translation +************************************************************************** +*/ + +char* szTypeToName (int32 lCardType) + { + static char szName[50]; + switch (lCardType & TYP_SERIESMASK) + { + case TYP_M2ISERIES: sprintf (szName, "M2i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M2IEXPSERIES: sprintf (szName, "M2i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M3ISERIES: sprintf (szName, "M3i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M3IEXPSERIES: sprintf (szName, "M3i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M4IEXPSERIES: sprintf (szName, "M4i.%04x-x8", lCardType & TYP_VERSIONMASK); break; + case TYP_M4XEXPSERIES: sprintf (szName, "M4x.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M2PEXPSERIES: sprintf (szName, "M2p.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M5IEXPSERIES: sprintf (szName, "M5i.%04x-x16", lCardType & TYP_VERSIONMASK); break; + default: sprintf (szName, "unknown type"); break; + } + return szName; + } + + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + drv_handle hCard; + int32 lCardType, lSerialNumber, lFncType; + int16* pnData; + char szErrorTextBuffer[ERRORTEXTLEN]; + uint32 dwError; + int32 lStatus; + int64 llAvailUser, llPCPos; + uint64 qwTotalMem = 0; + uint64 qwToTransfer = MEGA_B(64); + + // settings for the FIFO mode buffer handling + int64 llBufferSize = MEGA_B(4); + int32 lNotifySize = KILO_B(16); + + + // open card + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + hCard = spcm_hOpen ("/dev/spcm0"); + // hCard = spcm_hOpen ("TCPIP::192.168.1.10::inst0::INSTR"); + if (!hCard) + { + printf ("no card found...\n"); + return 0; + } + + + // read type, function and sn and check for A/D card + spcm_dwGetParam_i32 (hCard, SPC_PCITYP, &lCardType); + spcm_dwGetParam_i32 (hCard, SPC_PCISERIALNO, &lSerialNumber); + spcm_dwGetParam_i32 (hCard, SPC_FNCTYPE, &lFncType); + + switch (lFncType) + { + case SPCM_TYPE_AI: + printf ("Found: %s sn %05d\n", szTypeToName (lCardType), lSerialNumber); + break; + + default: + printf ("Card: %s sn %05d not supported by example\n", szTypeToName (lCardType), lSerialNumber); + return 0; + } + + + int32 lSegmentSize = KILO_B(4); + int32 lPost = KILO_B(3); + + // do a simple standard setup + spcm_dwSetParam_i32 (hCard, SPC_CHENABLE, CHANNEL0); // just 1 channel enabled + spcm_dwSetParam_i32 (hCard, SPC_SEGMENTSIZE, lSegmentSize); // 4k segment size + spcm_dwSetParam_i32 (hCard, SPC_POSTTRIGGER, lPost); // 1k of pretrigger data at each segment + spcm_dwSetParam_i32 (hCard, SPC_CARDMODE, SPC_REC_FIFO_MULTI); // FIFO Multi mode + spcm_dwSetParam_i32 (hCard, SPC_TIMEOUT, 5000); // timeout 5 s + spcm_dwSetParam_i32 (hCard, SPC_TRIG_ORMASK, 0); // trigger set to software + spcm_dwSetParam_i32 (hCard, SPC_TRIG_ANDMASK, 0); // ... + spcm_dwSetParam_i32 (hCard, SPC_CLOCKMODE, SPC_CM_INTPLL); // clock mode internal PLL + spcm_dwSetParam_i32 (hCard, SPC_TRIG_CH_ORMASK0, SPC_TMASK0_CH0); // channel trigger on channel 0 + spcm_dwSetParam_i32 (hCard, SPC_TRIG_CH0_LEVEL0, 0); // trigger level 0 LSB (= 0 mV) + spcm_dwSetParam_i32 (hCard, SPC_TRIG_CH0_MODE, SPC_TM_POS); // trigger on positive edge + + // we try to set the samplerate to 100 kHz (M2i) or 20 MHz (M3i and M4i) on internal PLL, no clock output + int32 lSamplerate = 0; + if (((lCardType & TYP_SERIESMASK) == TYP_M2ISERIES) || ((lCardType & TYP_SERIESMASK) == TYP_M2IEXPSERIES)) + lSamplerate = KILO(100); + else + lSamplerate = MEGA(20); + spcm_dwSetParam_i64 (hCard, SPC_SAMPLERATE, lSamplerate); + + spcm_dwSetParam_i32 (hCard, SPC_CLOCKOUT, 0); // no clock output + + + // define the data buffer + pnData = (int16*) pvAllocMemPageAligned ((uint64) llBufferSize); + if (!pnData) + { + printf ("memory allocation failed\n"); + spcm_vClose (hCard); + return 0; + } + + spcm_dwDefTransfer_i64 (hCard, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, lNotifySize, pnData, 0, llBufferSize); + + int32 lMaxADCValue = 0; + int32 lIR = 0; + spcm_dwGetParam_i32 (hCard, SPC_MIINST_MAXADCVALUE, &lMaxADCValue); + spcm_dwGetParam_i32 (hCard, SPC_AMP0, &lIR); + + // ----- create a SBench6 compatible header file ----- + FILE* hFile = fopen ("/tmp/segment_binheader.txt", "w"); + fprintf (hFile, "FileType = 16\n"); + fprintf (hFile, "HeaderFileVersion = 2\n"); + fprintf (hFile, "NumAChannels = 1\n"); + fprintf (hFile, "NumDChannels = 0\n"); + fprintf (hFile, "FileFlags = 0\n"); + fprintf (hFile, "DataEncoding = 0\n"); + fprintf (hFile, "TSSize = 8\n"); + fprintf (hFile, "RawDataFormat = 268501268\n"); + fprintf (hFile, "\n"); + fprintf (hFile, "[Ch0]\n"); + fprintf (hFile, "Name = AI-Ch0\n"); + fprintf (hFile, "XUnit = s\n"); + fprintf (hFile, "YUnit = V\n"); + fprintf (hFile, "Description = AI-Ch0\n"); + fprintf (hFile, "MaxRange = %lf\n", static_cast < double > (lIR) / 1000); + fprintf (hFile, "MinRange = %lf\n", -static_cast < double > (lIR) / 1000); + fprintf (hFile, "OrigMaxRange = %d\n", lIR); + fprintf (hFile, "OrigMinRange = %d\n", -lIR); + fprintf (hFile, "UserOffset = 0\n"); + fprintf (hFile, "\n"); + fprintf (hFile, "LenH = 0\n"); + fprintf (hFile, "LenL = %d\n", lSegmentSize); // each segment is transfered as single file + fprintf (hFile, "PostH = 0\n"); + fprintf (hFile, "PostL = %d\n", lPost); + fprintf (hFile, "SegmentH = 0\n"); + fprintf (hFile, "SegmentL = %d\n", lSegmentSize); + fprintf (hFile, "Resolution = 16\n"); + fprintf (hFile, "Samplerate = %d\n", lSamplerate); + fprintf (hFile, "TrigPosH = 0\n"); + fprintf (hFile, "TrigPosL = %d\n", lSegmentSize - lPost); + fprintf (hFile, "TrigDelayH = 0\n"); + fprintf (hFile, "TrigDelayL = 0\n"); + fprintf (hFile, "OffsetH = 0\n"); + fprintf (hFile, "OffsetL = 0\n"); + fprintf (hFile, "Flags = 0\n"); + fprintf (hFile, "ABADivider = 1\n"); + fprintf (hFile, "SlowABALenH = 0\n"); + fprintf (hFile, "SlowABALenL = 0\n"); + fprintf (hFile, "MaxADCValue = %d\n", lMaxADCValue); + fprintf (hFile, "TSRefClock = 1\n"); + fprintf (hFile, "OversamplingFactor = 1\n"); + fprintf (hFile, "TSSamplerate = 0\n"); + fprintf (hFile, "Pretrigger = %d\n", lSegmentSize - lPost); + fclose (hFile); + + // start everything + dwError = spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_DATA_STARTDMA); + + + // check for error + if (dwError != ERR_OK) + { + spcm_dwGetErrorInfo_i32 (hCard, NULL, NULL, szErrorTextBuffer); + printf ("%s\n", szErrorTextBuffer); + vFreeMemPageAligned (pnData, (uint64) llBufferSize); + spcm_vClose (hCard); + return 0; + } + + + // run the FIFO mode and loop through the data + else + { + while (qwTotalMem < qwToTransfer) + { + if ((dwError = spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_DATA_WAITDMA)) != ERR_OK) + { + if (dwError == ERR_TIMEOUT) + printf ("... Timeout\n"); + else + printf ("... Error: %d\n", dwError); + break; + } + + else + { + spcm_dwGetParam_i32 (hCard, SPC_M2STATUS, &lStatus); + spcm_dwGetParam_i64 (hCard, SPC_DATA_AVAIL_USER_LEN, &llAvailUser); + spcm_dwGetParam_i64 (hCard, SPC_DATA_AVAIL_USER_POS, &llPCPos); + + if (llAvailUser >= lNotifySize) + { + qwTotalMem += lNotifySize; + printf ("Stat:%08x Pos:%016llx Avail:%016llx Total:%.2fMB\n", lStatus, llPCPos, llAvailUser, (double) (int64) qwTotalMem / MEGA_B(1)); + + // store data to disk + FILE* hFile = fopen ("/tmp/segment.bin", "wb"); + fwrite ((char*)pnData, lNotifySize, 1, hFile); + fclose (hFile); + + vNetboxMailSetServerAndLogin ("smtp://192.168.1.10:25", "netbox@email.com", "password"); + vNetboxMailSetSubject ("Your Netbox is awaiting your attention"); + vNetboxMailSetBody ("This is the body of the message"); + vNetboxMailAddAttachment ("/tmp/segment.bin"); + vNetboxMailAddAttachment ("/tmp/segment_binheader.txt"); + vNetboxMailSendMail ("from@email.com", "to@email.com"); + + spcm_dwSetParam_i32 (hCard, SPC_DATA_AVAIL_CARD_LEN, lNotifySize); + } + + // check for esape = abort + if (bKbhit ()) + if (cGetch () == 27) + break; + } + } + } + + + // send the stop command + dwError = spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_CARD_STOP | M2CMD_DATA_STOPDMA); + + // clean up + printf ("Finished...\n"); + vFreeMemPageAligned (pnData, (uint64) llBufferSize); + spcm_vClose (hCard); + + return 1; + } + diff --git a/Cpp/examples/c_cpp/netbox_embedded_server/simple_rec_fifo_mail/simple_rec_fifo_mail.vcproj b/Cpp/examples/c_cpp/netbox_embedded_server/simple_rec_fifo_mail/simple_rec_fifo_mail.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..2693b864d16673d0ee6bbc1abf54cd1aa06b5f3e --- /dev/null +++ b/Cpp/examples/c_cpp/netbox_embedded_server/simple_rec_fifo_mail/simple_rec_fifo_mail.vcproj @@ -0,0 +1,252 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="simple_rec_fifo_mail" + ProjectGUID="{AB068386-BB5C-4442-ACFF-B5D9A79C311A}" + RootNamespace="simple_rec_fifo" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/simple_rec_fifo.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/simple_rec_fifo.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/simple_rec_fifo.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/simple_rec_fifo.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/simple_rec_fifo.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/simple_rec_fifo.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/simple_rec_fifo.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/simple_rec_fifo.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/simple_rec_fifo.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/simple_rec_fifo.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="header" + Filter="h;hpp;hxx;hm;inl" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\spcm_netbox_sendmail.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_oswrap.h" + > + </File> + </Filter> + <File + RelativePath=".\simple_rec_fifo_mail.cpp" + > + </File> + <File + RelativePath="..\..\common\spcm_netbox_sendmail.cpp" + > + </File> + <File + RelativePath="..\..\common\ostools\spcm_ostools_win.cpp" + > + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/pulse_generator/makefile b/Cpp/examples/c_cpp/pulse_generator/makefile new file mode 100644 index 0000000000000000000000000000000000000000..89e9d669194d09550615f327ea1ef4b8065d10aa --- /dev/null +++ b/Cpp/examples/c_cpp/pulse_generator/makefile @@ -0,0 +1,21 @@ +COMPILER = g++ +EXECUTABLE = pulse_generator +LIBS += -lspcm_linux -lpthread -lrt + +OBJECTS = pulse_generator.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/pulse_generator/pulse_generator.cpp b/Cpp/examples/c_cpp/pulse_generator/pulse_generator.cpp new file mode 100644 index 0000000000000000000000000000000000000000..79434fe82f4bd6ee912a748a52c9243d3dc6e222 --- /dev/null +++ b/Cpp/examples/c_cpp/pulse_generator/pulse_generator.cpp @@ -0,0 +1,330 @@ +/* +************************************************************************** + +pulse_generator.cpp (c) Spectrum GmbH + +************************************************************************** + +Example program for the pulse generator feature on M4i, M4x, M2p and M5i cards. +Different setups are shown to highlight the capabilities of the pulse +generator feature. +The setup of the card for acquisition/replay is shown in the other examples. + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +#include "../common/ostools/spcm_oswrap.h" +#include "../common/ostools/spcm_ostools.h" + +// ----- standard c include files ----- +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + + +/* +************************************************************************** +szTypeToName: doing name translation +************************************************************************** +*/ + +char* szTypeToName (int32 lCardType) + { + static char szName[50]; + switch (lCardType & TYP_SERIESMASK) + { + case TYP_M2ISERIES: sprintf (szName, "M2i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M2IEXPSERIES: sprintf (szName, "M2i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M3ISERIES: sprintf (szName, "M3i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M3IEXPSERIES: sprintf (szName, "M3i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M4IEXPSERIES: sprintf (szName, "M4i.%04x-x8", lCardType & TYP_VERSIONMASK); break; + case TYP_M4XEXPSERIES: sprintf (szName, "M4x.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M2PEXPSERIES: sprintf (szName, "M2p.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M5IEXPSERIES: sprintf (szName, "M5i.%04x-x16", lCardType & TYP_VERSIONMASK); break; + default: sprintf (szName, "unknown type"); break; + } + return szName; + } + +// ---------------------------------------------------------------------------- +// ----- this functions sets up the pulse generator for X0 to create a continuous signal +void vSingleContinuousSignal (drv_handle hCard) + { + int64 llPulseGenClock = 0; + spcm_dwGetParam_i64 (hCard, SPC_XIO_PULSEGEN_CLOCK, &llPulseGenClock); + + // enable pulse generator output on XIO lines + spcm_dwSetParam_i32 (hCard, SPCM_X0_MODE, SPCM_XMODE_PULSEGEN); + + // setup pulse generator 0 (output on X0) + // generate a continuous signal with 1 MHz + int32 lLenFor1MHz = static_cast < int32 > (llPulseGenClock / MEGA(1)); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN0_MODE, SPCM_PULSEGEN_MODE_TRIGGERED); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN0_LEN, lLenFor1MHz); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN0_HIGH, lLenFor1MHz / 2); // 50% HIGH, 50% LOW + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN0_DELAY, 0); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN0_LOOPS, 0); // 0: infinite + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN0_MUX1_SRC, SPCM_PULSEGEN_MUX1_SRC_UNUSED); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN0_MUX2_SRC, SPCM_PULSEGEN_MUX2_SRC_SOFTWARE); // started by software force command + + // arm the trigger detection for all pulse generators + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN_ENABLE, SPCM_PULSEGEN_ENABLE0); + + // write the settings to the card + // update the clock section to generate the programmed frequencies (SPC_SAMPLERATE) + // and write the pulse generator settings + spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_CARD_WRITESETUP); + + // start all pulse generators that wait for a software command + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN_COMMAND, SPCM_PULSEGEN_CMD_FORCE); + } + + +// ---------------------------------------------------------------------------- +// ----- this functions sets up all pulse generators to create continuous signals +// ----- with various frequencies, high/low characteristics, and offset +void vMultipleContinuousSignals (drv_handle hCard, int32 lCardType) + { + int64 llPulseGenClock = 0; + spcm_dwGetParam_i64 (hCard, SPC_XIO_PULSEGEN_CLOCK, &llPulseGenClock); + + int32 lPulseGenEnableMask = 0; + + // setup pulse generator 0 (output on X0) + // generate a continuous signal with the maximum frequency + spcm_dwSetParam_i32 (hCard, SPCM_X0_MODE, SPCM_XMODE_PULSEGEN); // enable pulse generator output on X0 line + + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN0_MODE, SPCM_PULSEGEN_MODE_TRIGGERED); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN0_LEN, 2); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN0_HIGH, 1); // 50% HIGH, 50% LOW + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN0_DELAY, 0); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN0_LOOPS, 0); // 0: infinite + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN0_MUX1_SRC, SPCM_PULSEGEN_MUX1_SRC_UNUSED); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN0_MUX2_SRC, SPCM_PULSEGEN_MUX2_SRC_SOFTWARE); // started by software force command + lPulseGenEnableMask |= SPCM_PULSEGEN_ENABLE0; // add pulse generator 0 to enable mask + + + // setup pulse generator 1 (output on X1) + // generate a continuous signal with ~1 MHz, 50% duty cycle + spcm_dwSetParam_i32 (hCard, SPCM_X1_MODE, SPCM_XMODE_PULSEGEN); // enable pulse generator output on X1 line + + int32 lLenFor1MHz = static_cast < int32 > (llPulseGenClock / MEGA(1)); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN1_MODE, SPCM_PULSEGEN_MODE_TRIGGERED); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN1_LEN, lLenFor1MHz); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN1_HIGH, lLenFor1MHz / 2); // 50% HIGH, 50% LOW + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN1_DELAY, 0); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN1_LOOPS, 0); // 0: infinite + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN1_MUX1_SRC, SPCM_PULSEGEN_MUX1_SRC_UNUSED); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN1_MUX2_SRC, SPCM_PULSEGEN_MUX2_SRC_SOFTWARE); // started by software force command + lPulseGenEnableMask |= SPCM_PULSEGEN_ENABLE1; // add pulse generator 1 to enable mask + + + // setup pulse generator 2 (output on X2) + // same signal as pulse generator 1, but with a phase shift + spcm_dwSetParam_i32 (hCard, SPCM_X2_MODE, SPCM_XMODE_PULSEGEN); // enable pulse generator output on X2 line + + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN2_MODE, SPCM_PULSEGEN_MODE_TRIGGERED); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN2_LEN, lLenFor1MHz); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN2_HIGH, lLenFor1MHz / 2); // 50% HIGH, 50% LOW + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN2_DELAY, lLenFor1MHz / 4); // delay for 1/4 of the period to achieve a "phase shift" by 90° + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN2_LOOPS, 0); // 0: infinite + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN2_MUX1_SRC, SPCM_PULSEGEN_MUX1_SRC_UNUSED); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN2_MUX2_SRC, SPCM_PULSEGEN_MUX2_SRC_SOFTWARE); // started by software force command + lPulseGenEnableMask |= SPCM_PULSEGEN_ENABLE2; // add pulse generator 2 to enable mask + + + // setup pulse generator 3 (output on X3. Not available on M4i/M4x) + if (((lCardType & TYP_SERIESMASK) != TYP_M4IEXPSERIES) && ((lCardType & TYP_SERIESMASK) != TYP_M4XEXPSERIES)) + { + spcm_dwSetParam_i32 (hCard, SPCM_X3_MODE, SPCM_XMODE_PULSEGEN); // enable pulse generator output on X3 lines + + // generate a continuous signal with ~500 kHz after the first edge on pulse generator 2 occurred, and delay the start for two periods of the 1MHz signal. + int32 lLenFor500kHz = static_cast < int32 > (llPulseGenClock / KILO(500)); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN3_MODE, SPCM_PULSEGEN_MODE_TRIGGERED); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN3_LEN, lLenFor500kHz); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN3_HIGH, 9*lLenFor500kHz / 10); // 90% HIGH, 10% LOW + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN3_DELAY, 2*lLenFor1MHz); // delay for two periods of 1MHz signal + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN3_LOOPS, 0); // 0: infinite + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN3_MUX1_SRC, SPCM_PULSEGEN_MUX1_SRC_UNUSED); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN3_MUX2_SRC, SPCM_PULSEGEN_MUX2_SRC_PULSEGEN2); // started by first edge of pulse generator 2 + lPulseGenEnableMask |= SPCM_PULSEGEN_ENABLE3; // add pulse generator 3 to enable mask + } + + // arm the trigger detection for all pulse generators + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN_ENABLE, lPulseGenEnableMask); + + // write the settings to the card + // update the clock section to generate the programmed frequencies (SPC_SAMPLERATE) + // and write the pulse generator settings + spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_CARD_WRITESETUP); + + // start all pulse generators that wait for a software command + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN_COMMAND, SPCM_PULSEGEN_CMD_FORCE); + } + + +// ---------------------------------------------------------------------------- +// ----- This functions creates a single pulse on X1 after the card has detected a trigger event. +// ----- Possible application: "change" length of trigger output signal, or create a delayed version of trigger output +void vCreateDelayedTriggerPulse (drv_handle hCard) + { + // we use software trigger to trigger the card immediately after it has been started (start command at end of this function) + spcm_dwSetParam_i64 (hCard, SPC_TRIG_ORMASK, SPC_TMASK_SOFTWARE); + + int64 llPulseGenClock = 0; + spcm_dwGetParam_i64 (hCard, SPC_XIO_PULSEGEN_CLOCK, &llPulseGenClock); + + spcm_dwSetParam_i32 (hCard, SPCM_X0_MODE, SPCM_XMODE_TRIGOUT); // trigger output for reference on X0 + spcm_dwSetParam_i32 (hCard, SPCM_X1_MODE, SPCM_XMODE_PULSEGEN); // enable pulse generator output on X1 + + int32 lLen_1ms = static_cast < int32 > (llPulseGenClock * 0.001 + 1); // +1 because the HIGH area needs to be at least one sample less than length, so we increase length by one to get the calculated HIGH time + int32 lOffset_5us = static_cast < int32 > (llPulseGenClock * 0.000005); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN1_MODE, SPCM_PULSEGEN_MODE_SINGLESHOT); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN1_LEN, lLen_1ms); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN1_HIGH, lLen_1ms - 1); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN1_DELAY, lOffset_5us); // delay the pulse for 5us + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN1_LOOPS, 1); // just once + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN1_MUX1_SRC, SPCM_PULSEGEN_MUX1_SRC_UNUSED); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN1_MUX2_SRC, SPCM_PULSEGEN_MUX2_SRC_CARDTRIGGER); // started by card's trigger event + + // arm the trigger detection for our selected pulse generator + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN_ENABLE, SPCM_PULSEGEN_ENABLE1); + + // write the settings to the card + // update the clock section to generate the programmed frequencies (SPC_SAMPLERATE) + // and write the pulse generator settings + spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_CARD_WRITESETUP); + + // start card. Its trigger event will start the pulse generator + spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER); + } + + +// ---------------------------------------------------------------------------- +// ----- This function takes a trigger signal on X2 and gives a pulse that is +// ----- synchronized to the card's clock back out on X1. This pulse can then +// ----- be used to trigger the card and other external equipment without the +// ----- normal 1 clock jitter for external trigger events. +void vSynchronizeExternalPulse (drv_handle hCard) + { + int64 llPulseGenClock = 0; + spcm_dwGetParam_i64 (hCard, SPC_XIO_PULSEGEN_CLOCK, &llPulseGenClock); + + spcm_dwSetParam_i32 (hCard, SPCM_X2_MODE, SPCM_XMODE_ASYNCIN); // we only need to set X2 to some kind of input, and ASYNCIN is available on all card series + spcm_dwSetParam_i32 (hCard, SPCM_X1_MODE, SPCM_XMODE_PULSEGEN); // enable pulse generator output on X1 + + int32 lLen_1ms = static_cast < int32 > (llPulseGenClock * 0.001 + 1); // +1 because the HIGH area needs to be at least one sample less than length, so we increase length by one to get the calculated HIGH time + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN1_MODE, SPCM_PULSEGEN_MODE_TRIGGERED); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN1_LEN, lLen_1ms); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN1_HIGH, lLen_1ms - 1); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN1_DELAY, 0); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN1_LOOPS, 1); // just once per event + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN1_MUX1_SRC, SPCM_PULSEGEN_MUX1_SRC_UNUSED); + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN1_MUX2_SRC, SPCM_PULSEGEN_MUX2_SRC_XIO2); // started by rising edge on X2 + + // arm the trigger detection for our selected pulse generator + spcm_dwSetParam_i32 (hCard, SPC_XIO_PULSEGEN_ENABLE, SPCM_PULSEGEN_ENABLE1); + + // write the settings to the card + spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_CARD_WRITESETUP); + } + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + drv_handle hCard; + int32 lCardType, lSerialNumber; + char szName[50]; + + // ------------------------------------------------------------------------ + // we try to open one card and printout some information on it + + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + sprintf (szName, "/dev/spcm0"); + // sprintf (szName, "TCPIP::192.168.1.10::inst0::INSTR"); + hCard = spcm_hOpen (szName); + + // not one card found + if (!hCard) + { + printf ("no card found...\n"); + return 0; + } + + // read out some info and print it + spcm_dwGetParam_i32 (hCard, SPC_PCITYP, &lCardType); + spcm_dwGetParam_i32 (hCard, SPC_PCISERIALNO, &lSerialNumber); + printf ("Found: %s sn %05d\n", szTypeToName (lCardType), lSerialNumber); + + // pulse generators are not available on M2i and M3i cards + switch (lCardType & TYP_SERIESMASK) + { + case TYP_M2ISERIES: + case TYP_M2IEXPSERIES: + case TYP_M3ISERIES: + case TYP_M3IEXPSERIES: + { + printf ("ERROR: pulse generators not available on this card\n"); + return EXIT_FAILURE; + } + } + + // on newer cards the availability depends on a (paid) feature + // so we check if this card has the pulse generator feature installed + int32 lFeatures = 0; + spcm_dwGetParam_i32 (hCard, SPC_PCIEXTFEATURES, &lFeatures); + if ((lFeatures & SPCM_FEAT_EXTFW_PULSEGEN) == 0) + { + printf ("ERROR: pulse generators not supported by this card\n"); + return EXIT_FAILURE; + } + + // first we set up the channel selection and the clock + // for this example we enable only one channel to be able to use max sampling rate on all card types + // ! changing the card settings while pulse generators are active causes a stop and restart of the pulse generators + spcm_dwSetParam_i32 (hCard, SPC_CHENABLE, CHANNEL0); + int64 llMaxSR = 0; + spcm_dwGetParam_i64 (hCard, SPC_PCISAMPLERATE, &llMaxSR); + spcm_dwSetParam_i64 (hCard, SPC_SAMPLERATE, llMaxSR); + + // start the pulse generator + // uncomment one of the following function calls. Each will set up the pulse generators differently. + vSingleContinuousSignal (hCard); + //vMultipleContinuousSignals (hCard, lCardType); + //vCreateDelayedTriggerPulse (hCard); + //vSynchronizeExternalPulse (hCard); + + // wait until user presses a key + printf ("\nPress a key to stop the pulse generator(s) "); + cGetch (); + + // stop the pulse generators + spcm_dwSetParam_i32(hCard, SPC_XIO_PULSEGEN_ENABLE, 0); + spcm_dwSetParam_i32(hCard, SPC_M2CMD, M2CMD_CARD_WRITESETUP); + + spcm_vClose (hCard); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/pulse_generator/pulse_generator.vcxproj b/Cpp/examples/c_cpp/pulse_generator/pulse_generator.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..74156e098ac46477be88cb7805a8cb5c6d4ac73a --- /dev/null +++ b/Cpp/examples/c_cpp/pulse_generator/pulse_generator.vcxproj @@ -0,0 +1,262 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{AB068386-BB5C-4442-ACFF-B5D9A79C311A}</ProjectGuid> + <RootNamespace>rec_std_single</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="pulse_generator.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/pulse_generator/pulse_generator.vcxproj.filters b/Cpp/examples/c_cpp/pulse_generator/pulse_generator.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..b205ddc9ae3840c32931c6251cb19b32396b315b --- /dev/null +++ b/Cpp/examples/c_cpp/pulse_generator/pulse_generator.vcxproj.filters @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="header"> + <UniqueIdentifier>{bf104e1d-06e1-4c35-8340-89c3b22319b3}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_oswrap.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="pulse_generator.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib" /> + <Library Include="..\c_header\spcm_win64_msvcpp.lib" /> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/readme.txt b/Cpp/examples/c_cpp/readme.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cc46e5e5147906c61714886b879cecfcb761e78 --- /dev/null +++ b/Cpp/examples/c_cpp/readme.txt @@ -0,0 +1,205 @@ +****************************************************************************** + +spcm_drv_c - c/c++ examples for the Spectrum SpcM driver interface. + +****************************************************************************** + +(c) Spectrum GmbH + Ahrensfelder Weg 13-17 + 22927 Grosshansdorf + Germany + + www.spectrum-instrumentation.com + +****************************************************************************** + +This readme file should give you an overview of the different examples and +the content of the different directories. + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +www.spectrum-instrumentation.com/en/knowledge-base-overview + +The SpcMDrv C/C++ examples from Spectrum are only using general c commands +and have been tested with Microsoft Visual C++, Borland C++ Builder under +Windows and and gnu c++ under Linux. Each sub directory contains the source +code of one example, Visual C++ and Borland C++ Builder project files and +one or more makefiles for gnu c++. + +****************************************************************************** + +directory c_header +----------------- +contains all the standard header and library files that are needed to +access the driver. Please do not modify any of these files as they +provide the link to the driver itself. Keep this directory updated +with every driver update you get to have access to new features. + +file dlltyp.h: + defines standard types for different platforms and compiler. All our + examples only use these standard types to be sure to have a defined type + declaration. If using other C/C++ compilers than we you should make a copy + of this file and setup the type declatation matching the new C/C++ + compiler. + +file regs.h: + defines all software registers. This file contains all software registers + for a couple of different cards and also for older driver versions. Please + stay to the manual to see which registers can be used with your card. + +file spcerr.h: + contains the error codes that the driver can return. Again inhere are also + error codes that are only used for other card types or for older driver + versions. + +file spcm_drv.h: + defines the driver interface of the SpcMDrv + +file spcm_win32_msvcpp.lib + Microsoft Visual C++ library file for 32 bit windows platforms + +file spcm_win32_bcppb.lib + Borland C++ Builder library file for 32 bit windows platforms + +All other files of this directory are not used with the SpcMDrv + +****************************************************************************** + + + +directory common +---------------- +This directory contains some c-files and header files that are used by all +examples. These common source files mainly group driver acces functions to +make the examples more simple to understand. Feel free to use the common +functions for your own programs. All these functions are distributed "as is". + +****************************************************************************** + + + +directory rec_std_single +------------------------ +Example for acquistion cards using the standard singleshot mode. + +****************************************************************************** + + + +directory rec_std_multi +----------------------- +Example for acquistion cards using the standard Multiple Recording mode. If +timestamp is installed on the card the timestamps of each segment are also +read and displayed. + +****************************************************************************** + + + +directory rec_std_gate +---------------------- +Example for acquisition cards using the standard Gated Sampling mode together +with timestamps. Position and length of each gate segment is calculated and +display and access to the gate segment is shown. + +****************************************************************************** + + + +directory rec_fifo_single +------------------------- +Examples for acquistion cards using the FIFO mode with continuous acquisition +of data. Control of the data transfer is located in a thread. The examples show +the buffer handling, data separation, calculation and writing of data to file + +****************************************************************************** + + + +directory rec_fifo_multi +------------------------ +Examples for acquisition cards using the FIFO mode with continuous acquisition +of data and Multiple Recording option. If timestamp is also installed +timestamps are recorded and can be also written to file. The examples shows +the buffer handling (including timestamps buffer), data separation, calculation +and writing of data to file + +****************************************************************************** + + + +directory rec_fifo_aba +------------------------ +Examples for acquisition cards using the FIFO mode with continuous acquisition +of data, Multiple Recording option, ABA option and timestamp option. The +examples shows the buffer handling with three totally independent working +threads each responsible for one type of transfer. A fourth main thread +is collecting results from the working threads and displays average and +timestamp distance + +****************************************************************************** + + + +directory rep_std_single +------------------------ +Example for single replay modes. This example covers analog and digital output +cards and allows to test single shots, continous output and single restart. +The signal shape can be selected. + +****************************************************************************** + + + +directory rep_sequence +------------------------ +Example for sequence replay mode. This example covers analog and digital output +cards and shows sequence replay mode as simple sequence and with sequence change +at runtime. + + +****************************************************************************** + + +directory rec_std_single_sync +--------------------- +Contains simple examples showing the synchronization of multiple cards with +the star-hub. The examples only show the synchronization part without any +further data processing. +It also contains examples for usage of system star-hub. + +****************************************************************************** + + + +directory dll_loading +--------------------- +The example shows how one can access the dll functions from a non supported +C/C++ compiler. The example shows how to load a Windows library and how to +access DLL functions without using a lib-file. However it is recommended to +use a lib conversion tool that is normally included into the compiler to +directly access the dll. + + + +directory netbox_embedded_server +-------------------------------- +This directory contains examples that show a client-server communication where +the netbox acts as server and the user's PC as client. +Another example show how to send emails with acquired data using libcurl. + + + +directory sse +-------------------------------- +This directory contains some helpful functions that use SSE commands for +higher speed. + + + +directory test +-------------------------------- +This directory contains several small tools for testing the cards. diff --git a/Cpp/examples/c_cpp/rec_fifo_aba/makefile b/Cpp/examples/c_cpp/rec_fifo_aba/makefile new file mode 100644 index 0000000000000000000000000000000000000000..8160b6315c3f72b11ccee608ea48f407d8f37c1e --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_aba/makefile @@ -0,0 +1,28 @@ +COMPILER = g++ +EXECUTABLE = rec_fifo_aba_thread +LIBS += -lspcm_linux -lpthread -lrt + +OBJECTS = \ + rec_fifo_aba_thread.o\ + ../common/spcm_lib_card.o\ + ../common/spcm_lib_data.o\ + ../common/spcm_lib_thread.o\ + ../common/ostools/spcm_ostools_linux.o + + + + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/rec_fifo_aba/rec_fifo_aba_thread.bpf b/Cpp/examples/c_cpp/rec_fifo_aba/rec_fifo_aba_thread.bpf new file mode 100644 index 0000000000000000000000000000000000000000..5da88241fe8e80944de42def849bf4eab8f1f666 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_aba/rec_fifo_aba_thread.bpf @@ -0,0 +1,3 @@ +This file is used by the project manager only and should be treated like the project file + + main \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_aba/rec_fifo_aba_thread.bpr b/Cpp/examples/c_cpp/rec_fifo_aba/rec_fifo_aba_thread.bpr new file mode 100644 index 0000000000000000000000000000000000000000..acb7266e2ecfcf84b9cbdbd55241d03165c0da52 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_aba/rec_fifo_aba_thread.bpr @@ -0,0 +1,107 @@ +<?xml version='1.0' encoding='utf-8' ?> +<!-- C++Builder XML Project --> +<PROJECT> + <MACROS> + <VERSION value="BCB.06.00"/> + <PROJECT value="rec_fifo_aba_thread.exe"/> + <OBJFILES value="rec_fifo_aba_thread.obj ..\common\spcm_lib_thread.obj + ..\common\spcm_lib_card.obj ..\common\spcm_lib_data.obj + ..\common\ostools\spcm_ostools_win.obj ..\sb5_file\sb5_file.obj"/> + <RESFILES value=""/> + <DEFFILE value=""/> + <RESDEPEN value="$(RESFILES)"/> + <LIBFILES value="..\c_header\spcm_win32_bcppb.lib"/> + <LIBRARIES value=""/> + <SPARELIBS value=""/> + <PACKAGES value="vcl.bpi rtl.bpi vclx.bpi bcbsmp.bpi dclocx.bpi"/> + <PATHCPP value=".;..\common;..\common;..\common;..\common\ostools;..\sb5_file"/> + <PATHPAS value=".;"/> + <PATHRC value=".;"/> + <PATHASM value=".;"/> + <DEBUGLIBPATH value="$(BCB)\lib\debug"/> + <RELEASELIBPATH value="$(BCB)\lib\release"/> + <LINKER value="ilink32"/> + <USERDEFINES value="_DEBUG"/> + <SYSDEFINES value="NO_STRICT;_NO_VCL;_RTLDLL;USEPACKAGES"/> + <MAINSOURCE value="rec_fifo_aba_thread.bpf"/> + <INCLUDEPATH value="C:\svnwork\spcm_drv_c\sb5_file;C:\svnwork\spcm_drv_c\common\ostools;C:\svnwork\spcm_drv_c\common;C:\svnwork\spcm_drv_c\rec_fifo_aba_thread;$(BCB)\include;$(BCB)\include\vcl"/> + <LIBPATH value="C:\svnwork\spcm_drv_c\sb5_file;C:\svnwork\spcm_drv_c\common\ostools;C:\svnwork\spcm_drv_c\common;C:\svnwork\spcm_drv_c\rec_fifo_aba_thread;$(BCB)\lib\obj;$(BCB)\lib"/> + <WARNINGS value="-w-par"/> + <OTHERFILES value=""/> + </MACROS> + <OPTIONS> + <CFLAG1 value="-tWC -tWM -Od -H=$(BCB)\lib\vcl60.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v + -vi- -c"/> + <PFLAGS value="-$YD -$W -$O- -$A8 -v -JPHNE -M"/> + <RFLAGS value=""/> + <AFLAGS value="/mx /w2 /zd"/> + <LFLAGS value="-Tpe -ap -D"" -x -Gn -v"/> + <OTHERFILES value=""/> + </OPTIONS> + <LINKER> + <ALLOBJ value="c0x32.obj $(PACKAGES) $(OBJFILES)"/> + <ALLRES value="$(RESFILES)"/> + <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib"/> + <OTHERFILES value=""/> + </LINKER> + <FILELIST> + <FILE FILENAME="rec_fifo_aba_thread.bpf" FORMNAME="" UNITNAME="rec_fifo_aba_thread" CONTAINERID="BPF" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="rec_fifo_aba_thread.cpp" FORMNAME="" UNITNAME="rec_fifo_aba_thread" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_thread.cpp" FORMNAME="" UNITNAME="spcm_lib_thread.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_card.cpp" FORMNAME="" UNITNAME="spcm_lib_card.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_data.cpp" FORMNAME="" UNITNAME="spcm_lib_data.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\c_header\spcm_win32_bcppb.lib" FORMNAME="" UNITNAME="spcm_win32_bcppb.lib" CONTAINERID="LibTool" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\ostools\spcm_ostools_win.cpp" FORMNAME="" UNITNAME="spcm_ostools_win" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\sb5_file\sb5_file.cpp" FORMNAME="" UNITNAME="sb5_file" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + </FILELIST> + <BUILDTOOLS> + </BUILDTOOLS> + + <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= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +[Parameters] +RunParams= +Launcher= +UseLauncher=0 +DebugCWD= +HostApplication= +RemoteHost= +RemotePath= +RemoteLauncher= +RemoteCWD= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 + </IDEOPTIONS> +</PROJECT> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_aba/rec_fifo_aba_thread.cpp b/Cpp/examples/c_cpp/rec_fifo_aba/rec_fifo_aba_thread.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b9d376ac48c7939d4ad4278d1eb142e28d31b080 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_aba/rec_fifo_aba_thread.cpp @@ -0,0 +1,429 @@ +/* +************************************************************************** + +rec_fifo_aba_thread.cpp (c) Spectrum GmbH + +************************************************************************** + +this example supports all acquisition cards with the Multiple Recording, +ABA and Timestamp option installed. + +Does a continous FIFO transfer in Multiple Recording mode and uses three +threads to continuously read all three kinds of data: +1) segment data is read and transferred data is simply counted +2) ABA data is continuously read and averaged per block +3) timestamps are continuously read and difference is calculated + +The main thread gets the current information, checks for an abort and +displays the information of the three working threads + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + + +// ----- standard c include files ----- +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_card.h" +#include "../common/spcm_lib_data.h" +#include "../common/spcm_lib_thread.h" + + + + +/* +************************************************************************** +Working routine data +************************************************************************** +*/ + +struct ST_WORKDATA + { + SPCM_MUTEX_HANDLE hMutexAccess; // mutex to save the access to the shared display data + + bool bFirstDisplay; // first display generates headlines + int32 lSegmentsize; // segment size of Multiple Recording + + int64 llDataTotal; // total bytes that data thread has performed + + int64 llTSTotal; // total bytes that timestamp thread has performed + double dTSDistance; // timestamp distance (frequency of the signal) + + int64 llABATotal; // total bytes that ABA thread has performed + int16* ppnChData[SPCM_MAX_AICHANNEL]; // channel data for splitted data + double dABAAverage; // current ABA average value + }; + + + +/* +************************************************************************** +bDoCardSetup: setup matching the calculation routine +************************************************************************** +*/ + +bool bDoCardSetup (ST_WORKDATA* pstWorkData, ST_BUFFERDATA* pstBufferData) + { + int i; + + // we first setup the working data + memset (pstWorkData, 0, sizeof(ST_WORKDATA)); + spcm_bCreateMutex (&pstWorkData->hMutexAccess); + pstWorkData->lSegmentsize = KILO_B(4); // segment size + pstWorkData->llDataTotal = 0; + pstWorkData->llTSTotal = 0; + pstWorkData->llABATotal = 0; + pstWorkData->dTSDistance = 0.0; + pstWorkData->dABAAverage = 0.0; + pstWorkData->bFirstDisplay =true; + + + // define the buffer sizes and the notify size that we want + pstBufferData->dwTSBufLen = MEGA_B(1); + pstBufferData->dwTSNotify = KILO_B(4); + pstBufferData->dwDataBufLen = MEGA_B(8); + pstBufferData->dwDataNotify = pstWorkData->lSegmentsize * pstBufferData->pstCard->lSetChannels * pstBufferData->pstCard->lBytesPerSample; + pstBufferData->dwABABufLen = MEGA_B(1); + pstBufferData->dwABANotify = KILO_B(4); + + + // allocate memory for our sorted channel date for the ABA averaging + for (i=0; i<pstBufferData->pstCard->lSetChannels; i++) + pstWorkData->ppnChData[i] = new int16[pstBufferData->dwABANotify / pstBufferData->pstCard->lSetChannels]; + + + // we try to set the samplerate to 1 MHz (M2i) or 20 MHz (M3i) on internal PLL, no clock output + // increase this to test the read-out-after-overrun + if (pstBufferData->pstCard->bM2i) + bSpcMSetupClockPLL (pstBufferData->pstCard, MEGA(1), false); + else if (pstBufferData->pstCard->bM2p) + bSpcMSetupClockPLL (pstBufferData->pstCard, MEGA(10), false); + else if (pstBufferData->pstCard->bM3i || pstBufferData->pstCard->bM4i || pstBufferData->pstCard->bM5i) + bSpcMSetupClockPLL (pstBufferData->pstCard, MEGA(20), false); + printf ("Sampling rate set to %.1lf MHz\n", (double) pstBufferData->pstCard->llSetSamplerate / MEGA(1)); + + // we only enable 1 channel for the example and set the ABA divider to 128 + bSpcMSetupModeRecFIFOABA (pstBufferData->pstCard, CHANNEL0, pstWorkData->lSegmentsize, pstWorkData->lSegmentsize - 128, 128); + + + // we set external trigger for multiple recording + if (pstBufferData->pstCard->bM2i) + bSpcMSetupTrigExternal (pstBufferData->pstCard, SPC_TM_POS, false, 0); + else // M3i, M4i, M4x, M2p + bSpcMSetupTrigExternalLevel (pstBufferData->pstCard, SPC_TM_POS, 1500, 800, false); + + // type dependent card setup + switch (pstBufferData->pstCard->eCardFunction) + { + + // analog acquisition card setup + case AnalogIn: + + // program all input channels to +/-1 V and 50 ohm termination (if it's available) + if (pstBufferData->pstCard->bM2i || pstBufferData->pstCard->bM2p) + { + for (i=0; i < pstBufferData->pstCard->lMaxChannels; i++) + bSpcMSetupInputChannel (pstBufferData->pstCard, i, 1000, true); + } + else + { + bool bTerm = true; + bool bACCoupling = false; + bool bBandwidthLimit = false; + for (i=0; i < pstBufferData->pstCard->lMaxChannels; i++) + bSpcMSetupPathInputCh (pstBufferData->pstCard, i, 0, 1000, 0, bTerm, bACCoupling, bBandwidthLimit); + } + break; + + // digital acquisition card setup + case DigitalIn: + case DigitalIO: + printf ("Not yet implemented\n"); + return false; + break; + } + + // set up the timestamp mode to standard if timestamp is installed + bSpcMSetupTimestamp (pstBufferData->pstCard, SPC_TSMODE_STANDARD | SPC_TSCNT_INTERNAL, 0); + + return pstBufferData->pstCard->bSetError; + } + + + +/* +************************************************************************** +bWorkDo: cares for the sample data: just counts them in our example +************************************************************************** +*/ + +bool bWorkDo (void* pvWorkData, ST_BUFFERDATA* pstBufferData) + { + ST_WORKDATA* pstWorkData = (ST_WORKDATA*) pvWorkData; + + // count the data that has been transferred and set the calculated average + spcm_vGetMutex (&pstWorkData->hMutexAccess); + pstWorkData->llDataTotal += pstBufferData->llDataAvailBytes; + spcm_vReleaseMutex (&pstWorkData->hMutexAccess); + + return true; + } + + + +/* +************************************************************************** +bTSWorkDo: as we get several timestamps at once we add the differences and + calc an average of these +************************************************************************** +*/ + +bool bTSWorkDo (void* pvWorkData, ST_BUFFERDATA* pstBufferData) + { + ST_WORKDATA* pstWorkData = (ST_WORKDATA*) pvWorkData; + double dDiff = 0.0; + uint64* pqwTimestamps = (uint64*) pstBufferData->pvTSCurrentBuf; + uint32 dwTimestampSize = 1; // size of timestamp in uint64 + int32 lOversampling = 1; + + // M2i and M3i work with 1 x 64 bit timestamps and oversampling while M4i works with 2 x 64 bit and without oversampling + if (pstBufferData->pstCard->bM2i || pstBufferData->pstCard->bM3i) + { + dwTimestampSize = 1; + lOversampling = pstBufferData->pstCard->lOversampling; + } + else if (pstBufferData->pstCard->bM4i || pstBufferData->pstCard->bM2p || pstBufferData->pstCard->bM5i) + { + dwTimestampSize = 2; + lOversampling = 1; + } + + // work only with complete timestamps = 8 bytes (the possible half one + // is automatically used at the next time the function is called) + pstBufferData->llTSAvailBytes &= ~0x07; + + // each timestamp is 64/128 bit = 8/16 bytes, depending on card series (see above) + if ((pstBufferData->llTSAvailBytes / (dwTimestampSize * 8)) > 1) + { + for (uint32 i=dwTimestampSize; i < (pstBufferData->llTSAvailBytes / (dwTimestampSize * (dwTimestampSize * 8))); i++) + dDiff += (double) ((int64) (pqwTimestamps[i] - pqwTimestamps[i - dwTimestampSize])); + dDiff /= pstBufferData->pstCard->llSetSamplerate / lOversampling; + dDiff /= (pstBufferData->llTSAvailBytes / (dwTimestampSize * 8) - 1); + } + + // count the data that has been transferred and set the calculated average + spcm_vGetMutex (&pstWorkData->hMutexAccess); + pstWorkData->llTSTotal += pstBufferData->llTSAvailBytes; + pstWorkData->dTSDistance = dDiff; + spcm_vReleaseMutex (&pstWorkData->hMutexAccess); + + return true; + } + + + +/* +************************************************************************** +bABAWorkDo: we calc the average of channel 0. +************************************************************************** +*/ + +bool bABAWorkDo (void* pvWorkData, ST_BUFFERDATA* pstBufferData) + { + ST_WORKDATA* pstWorkData = (ST_WORKDATA*) pvWorkData; + double dAverage = 0.0; + + // we inhere limit the length if data to proceed to our defined notify size as we allocated the channel data buffer in this size + uint32 dwABAAvailBytes = (uint32) pstBufferData->llABAAvailBytes; + if (dwABAAvailBytes > pstBufferData->dwABANotify) + dwABAAvailBytes = pstBufferData->dwABANotify; + pstBufferData->llABAAvailBytes = dwABAAvailBytes; + + // split the data and calculate the average of channel 0 + if (pstBufferData->pstCard->lBytesPerSample == 1) + bSpcMDemuxAnalogData (pstBufferData->pstCard, (int8*)pstBufferData->pvABACurrentBuf, dwABAAvailBytes / pstBufferData->pstCard->lBytesPerSample, pstWorkData->ppnChData); + else + bSpcMDemuxAnalogData (pstBufferData->pstCard, (int16*)pstBufferData->pvABACurrentBuf, dwABAAvailBytes / pstBufferData->pstCard->lBytesPerSample, pstWorkData->ppnChData); + dAverage = dSpcMIntToVoltage (pstBufferData->pstCard, 0, dSpcMCalcAverage (pstWorkData->ppnChData[0], dwABAAvailBytes / pstBufferData->pstCard->lBytesPerSample / pstBufferData->pstCard->lSetChannels)); + + // count the data that has been transferred and set the calculated average + spcm_vGetMutex (&pstWorkData->hMutexAccess); + pstWorkData->llABATotal += pstBufferData->llABAAvailBytes; + pstWorkData->dABAAverage = dAverage; + spcm_vReleaseMutex (&pstWorkData->hMutexAccess); + + return true; + } + + + +/* +************************************************************************** +vABAClean: we delete our channel data object +************************************************************************** +*/ + +void vABAClean (void* pvWorkData, ST_BUFFERDATA* pstBufferData) + { + ST_WORKDATA* pstWorkData = (ST_WORKDATA*) pvWorkData; + int i; + + for (i=0; i<pstBufferData->pstCard->lSetChannels; i++) + delete (pstWorkData->ppnChData[i]); + } + + +/* +************************************************************************** +Abort function: is called on every update, checks for an abort and display +the results of all threads +************************************************************************** +*/ + +bool bAbortCheckAndDisplay (void* pvWorkData, ST_BUFFERDATA* pstBufferData) + { + ST_WORKDATA* pstWorkData = (ST_WORKDATA*) pvWorkData; + + // print the headline if it's the first display + if (pstWorkData->bFirstDisplay) + { + pstWorkData->bFirstDisplay = false; + + printf ("\n\n"); + printf ("******************************************************************\n"); + printf ("Data: transferred sample data in MByte\n"); + printf ("ABA: transferred slow ABA data in MByte (current average of ch0)\n"); + printf ("TS: transferred timestamps in MByte (average distance in block)\n"); + printf ("******************************************************************\n"); + } + + // do the display, secured by mutex as it's shared data between the three working threads and the main thread + spcm_vGetMutex (&pstWorkData->hMutexAccess); + printf ("\rData:%.3fM ABA:%.3fM (Av:%.3f mV) TS: %.3fM (%.3f ms)", + (double) pstWorkData->llDataTotal / MEGA_B(1), + (double) pstWorkData->llABATotal / MEGA_B(1), + pstWorkData->dABAAverage * KILO(1), + (double) pstWorkData->llTSTotal / MEGA_B(1), + pstWorkData->dTSDistance * KILO(1)); + spcm_vReleaseMutex (&pstWorkData->hMutexAccess); + + // check for abort + if (bKbhit()) + if (cGetch() == 27) + return true; + + return false; + } + + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + char szBuffer[1024]; // a character buffer for any messages + ST_SPCM_CARDINFO stCard; // info structure of my card + ST_WORKDATA stWorkData; + ST_BUFFERDATA stBufferData; // buffer and start information + + // ------------------------------------------------------------------------ + // init card number 0 (the first card in the system), get some information and print it + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + if (bSpcMInitCardByIdx (&stCard, 0)) + //if (bSpcMInitCardByIdx (&stCard, "192.168.1.10", 0)) + { + printf (pszSpcMPrintDocumentationLink (&stCard, szBuffer, sizeof (szBuffer))); + printf (pszSpcMPrintCardInfo (&stCard, szBuffer, sizeof (szBuffer))); + } + else + return nSpcMErrorMessageStdOut (&stCard, "Error: Could not open card\n", true); + + memset (&stBufferData, 0, sizeof(stBufferData)); + stBufferData.pstCard = &stCard; + + + // check whether we support this card type in the example + if ((stCard.eCardFunction != AnalogIn) && (stCard.eCardFunction != DigitalIn) && (stCard.eCardFunction != DigitalIO)) + return nSpcMErrorMessageStdOut (&stCard, "Error: Card function not supported by this example\n", false); + if ((stCard.lFeatureMap & SPCM_FEAT_MULTI) == 0) + return nSpcMErrorMessageStdOut (&stCard, "Error: Multiple Recording Option not installed. This example needs the option\n", false); + if ((stCard.lFeatureMap & SPCM_FEAT_ABA) == 0) + return nSpcMErrorMessageStdOut (&stCard, "Error: ABA Option not installed. This example needs the option\n", false); + if ((stCard.lFeatureMap & SPCM_FEAT_TIMESTAMP) == 0) + return nSpcMErrorMessageStdOut (&stCard, "Error: Timestamp Option not installed. This example needs the option\n", false); + + + // ------------------------------------------------------------------------ + // do the card setup, error is routed in the structure so we don't care for the return values + if (!stCard.bSetError) + bDoCardSetup (&stWorkData, &stBufferData); + + + + // ------------------------------------------------------------------------ + // some additional information on the acquisition + if (!stCard.bSetError) + { + printf ("\nData information:\n=================\n"); + printf ("Each segment is %.3f ms long\n", 1000.0 * stWorkData.lSegmentsize / stCard.llSetSamplerate); + printf ("Maximum pulse repetition frequency to reach with this setting is %.2f Hz\n", (double) stCard.llSetSamplerate / stWorkData.lSegmentsize); + } + + + + // ------------------------------------------------------------------------ + // setup the data transfer and start it + stBufferData.bStartCard = true; + stBufferData.bStartData = true; + stBufferData.bStartABA = true; + stBufferData.bStartTimestamp = true; + + // start the threaded loop (10.000 ms = 10 s timeout) + stBufferData.lTimeout = KILO(10); + if (!stCard.bSetError) + vDoThreadMainLoop ( + &stBufferData, // related buffer data + &stWorkData, // related work data + NULL, // data thread setup routine + bWorkDo, // data thread work routine + NULL, // data thread close routine + bAbortCheckAndDisplay, // abort routine (and display) + true, // use seperate threads for all transfers + NULL, // timestamp setup routine + bTSWorkDo, // timestamp work routine + NULL, // timestamp close routine + NULL, // ABA setup routine + bABAWorkDo, // ABA work routine + vABAClean); // AVA close routine + + + // ------------------------------------------------------------------------ + // print error information if an error occured + if (stCard.bSetError) + return nSpcMErrorMessageStdOut (&stCard, "An error occured while programming the card:\n", true); + + + // clean up and close the driver + vSpcMCloseCard (&stCard); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/rec_fifo_aba/rec_fifo_aba_thread.dsp b/Cpp/examples/c_cpp/rec_fifo_aba/rec_fifo_aba_thread.dsp new file mode 100644 index 0000000000000000000000000000000000000000..0dafa88250046af9da9b3c1467c7df976a787761 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_aba/rec_fifo_aba_thread.dsp @@ -0,0 +1,156 @@ +# Microsoft Developer Studio Project File - Name="rec_fifo_aba_thread" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=rec_fifo_aba_thread - Win32 Debug +!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE +!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl +!MESSAGE +!MESSAGE NMAKE /f "rec_fifo_aba_thread.mak". +!MESSAGE +!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben +!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: +!MESSAGE +!MESSAGE NMAKE /f "rec_fifo_aba_thread.mak" CFG="rec_fifo_aba_thread - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "rec_fifo_aba_thread - Win32 Release" (basierend auf "Win32 (x86) Console Application") +!MESSAGE "rec_fifo_aba_thread - Win32 Debug" (basierend auf "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "rec_fifo_aba_thread - 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 /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 /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 /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "rec_fifo_aba_thread - 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 /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 /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 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "rec_fifo_aba_thread - Win32 Release" +# Name "rec_fifo_aba_thread - Win32 Debug" +# Begin Group "common" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\common\spcm_lib_card.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_thread.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_ostools_win.cpp +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_win32_msvcpp.lib +# End Source File +# End Group +# Begin Group "header" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\c_header\dlltyp.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\regs.h +# End Source File +# Begin Source File + +SOURCE=..\sb5_file\sb5_file.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcerr.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_drv.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_card.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_thread.h +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_ostools.h +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_oswrap.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\rec_fifo_aba_thread.cpp +# End Source File +# End Target +# End Project diff --git a/Cpp/examples/c_cpp/rec_fifo_aba/rec_fifo_aba_thread.dsw b/Cpp/examples/c_cpp/rec_fifo_aba/rec_fifo_aba_thread.dsw new file mode 100644 index 0000000000000000000000000000000000000000..1cf1838826b1a4205dee426f90835647f6444e47 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_aba/rec_fifo_aba_thread.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN! + +############################################################################### + +Project: "rec_fifo_aba_thread"=.\rec_fifo_aba_thread.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/Cpp/examples/c_cpp/rec_fifo_aba/rec_fifo_aba_thread.vcproj b/Cpp/examples/c_cpp/rec_fifo_aba/rec_fifo_aba_thread.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..a09cd67a263b84879f18a77db55808efd721c597 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_aba/rec_fifo_aba_thread.vcproj @@ -0,0 +1,654 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="rec_fifo_aba_thread" + ProjectGUID="{6F35D51E-D99C-4C59-AA24-D4A28FFAF48E}" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/rec_fifo_aba_thread.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_fifo_aba_thread.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_fifo_aba_thread.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_fifo_aba_thread.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_fifo_aba_thread.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/rec_fifo_aba_thread.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_fifo_aba_thread.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_fifo_aba_thread.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_fifo_aba_thread.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_fifo_aba_thread.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/rec_fifo_aba_thread.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_fifo_aba_thread.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_fifo_aba_thread.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_fifo_aba_thread.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_fifo_aba_thread.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/rec_fifo_aba_thread.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_fifo_aba_thread.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_fifo_aba_thread.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_fifo_aba_thread.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_fifo_aba_thread.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="common" + > + <File + RelativePath="..\common\spcm_lib_card.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_data.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_thread.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="header" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\sb5_file\sb5_file.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_card.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_data.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_thread.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_oswrap.h" + > + </File> + </Filter> + <File + RelativePath="rec_fifo_aba_thread.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/rec_fifo_aba/rec_fifo_aba_thread.vcxproj b/Cpp/examples/c_cpp/rec_fifo_aba/rec_fifo_aba_thread.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..b6c19f44176d39b1f480ae2f0d1f4d176b8de562 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_aba/rec_fifo_aba_thread.vcxproj @@ -0,0 +1,268 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{6F35D51E-D99C-4C59-AA24-D4A28FFAF48E}</ProjectGuid> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rec_fifo_aba_thread.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_fifo_aba_thread.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_fifo_aba_thread.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_fifo_aba_thread.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rec_fifo_aba_thread.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_fifo_aba_thread.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_fifo_aba_thread.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_fifo_aba_thread.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rec_fifo_aba_thread.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_fifo_aba_thread.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_fifo_aba_thread.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_fifo_aba_thread.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rec_fifo_aba_thread.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_fifo_aba_thread.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_fifo_aba_thread.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_fifo_aba_thread.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="..\common\spcm_lib_card.cpp" /> + <ClCompile Include="..\common\spcm_lib_data.cpp" /> + <ClCompile Include="..\common\spcm_lib_thread.cpp" /> + <ClCompile Include="rec_fifo_aba_thread.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\common\spcm_lib_card.h" /> + <ClInclude Include="..\common\spcm_lib_data.h" /> + <ClInclude Include="..\common\spcm_lib_thread.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + <ClInclude Include="..\sb5_file\sb5_file.h" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_aba/rec_fifo_aba_thread.vcxproj.filters b/Cpp/examples/c_cpp/rec_fifo_aba/rec_fifo_aba_thread.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..890efdc6e0f81cc4534fda2aff22320a458e4e69 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_aba/rec_fifo_aba_thread.vcxproj.filters @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="common"> + <UniqueIdentifier>{7bd83fcb-d389-475d-ad33-3bbc2c93faed}</UniqueIdentifier> + </Filter> + <Filter Include="header"> + <UniqueIdentifier>{43002cc5-acfe-4d69-9e60-8264446c2949}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\spcm_lib_card.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_data.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_thread.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="rec_fifo_aba_thread.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\sb5_file\sb5_file.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_card.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_data.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_thread.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_oswrap.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <Filter>common</Filter> + </Library> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_gate/makefile b/Cpp/examples/c_cpp/rec_fifo_gate/makefile new file mode 100644 index 0000000000000000000000000000000000000000..b2f6e28f4eb15b71e43cdef893ce8664d7075114 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_gate/makefile @@ -0,0 +1,26 @@ +COMPILER = g++ +EXECUTABLE = rec_fifo_gate +LIBS += -lspcm_linux -lpthread -lrt + +OBJECTS = \ + rec_fifo_gate.o\ + ../common/spcm_lib_card.o\ + ../common/spcm_lib_data.o\ + ../common/spcm_lib_thread.o\ + ../sb5_file/sb5_file.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/rec_fifo_gate/rec_fifo_gate.bpf b/Cpp/examples/c_cpp/rec_fifo_gate/rec_fifo_gate.bpf new file mode 100644 index 0000000000000000000000000000000000000000..5da88241fe8e80944de42def849bf4eab8f1f666 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_gate/rec_fifo_gate.bpf @@ -0,0 +1,3 @@ +This file is used by the project manager only and should be treated like the project file + + main \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_gate/rec_fifo_gate.bpr b/Cpp/examples/c_cpp/rec_fifo_gate/rec_fifo_gate.bpr new file mode 100644 index 0000000000000000000000000000000000000000..be1c584b6bc0fc06b516ab3ac5bf136da14c0c2f --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_gate/rec_fifo_gate.bpr @@ -0,0 +1,107 @@ +<?xml version='1.0' encoding='utf-8' ?> +<!-- C++Builder XML Project --> +<PROJECT> + <MACROS> + <VERSION value="BCB.06.00"/> + <PROJECT value="rec_fifo_gate.exe"/> + <OBJFILES value="rec_multi_binaryfile.obj ..\common\spcm_lib_thread.obj + ..\common\spcm_lib_card.obj ..\common\spcm_lib_data.obj + ..\common\ostools\spcm_ostools_win.obj ..\sb5_file\sb5_file.obj"/> + <RESFILES value=""/> + <DEFFILE value=""/> + <RESDEPEN value="$(RESFILES)"/> + <LIBFILES value="..\c_header\spcm_win32_bcppb.lib"/> + <LIBRARIES value=""/> + <SPARELIBS value=""/> + <PACKAGES value="vcl.bpi rtl.bpi vclx.bpi bcbsmp.bpi dclocx.bpi"/> + <PATHCPP value=".;..\common;..\common;..\common;..\common\ostools;..\sb5_file"/> + <PATHPAS value=".;"/> + <PATHRC value=".;"/> + <PATHASM value=".;"/> + <DEBUGLIBPATH value="$(BCB)\lib\debug"/> + <RELEASELIBPATH value="$(BCB)\lib\release"/> + <LINKER value="ilink32"/> + <USERDEFINES value="_DEBUG"/> + <SYSDEFINES value="NO_STRICT;_NO_VCL;_RTLDLL;USEPACKAGES"/> + <MAINSOURCE value="rec_fifo_gate.bpf"/> + <INCLUDEPATH value="C:\svnwork\spcm_drv_c\sb5_file;C:\svnwork\spcm_drv_c\common\ostools;C:\svnwork\spcm_drv_c\common;C:\svnwork\spcm_drv_c\rec_fifo_gate;$(BCB)\include;$(BCB)\include\vcl"/> + <LIBPATH value="C:\svnwork\spcm_drv_c\sb5_file;C:\svnwork\spcm_drv_c\common\ostools;C:\svnwork\spcm_drv_c\common;C:\svnwork\spcm_drv_c\rec_fifo_gate;$(BCB)\lib\obj;$(BCB)\lib"/> + <WARNINGS value="-w-par"/> + <OTHERFILES value=""/> + </MACROS> + <OPTIONS> + <CFLAG1 value="-tWC -tWM -Od -H=$(BCB)\lib\vcl60.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v + -vi- -c"/> + <PFLAGS value="-$YD -$W -$O- -$A8 -v -JPHNE -M"/> + <RFLAGS value=""/> + <AFLAGS value="/mx /w2 /zd"/> + <LFLAGS value="-Tpe -ap -D"" -x -Gn -v"/> + <OTHERFILES value=""/> + </OPTIONS> + <LINKER> + <ALLOBJ value="c0x32.obj $(PACKAGES) $(OBJFILES)"/> + <ALLRES value="$(RESFILES)"/> + <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib"/> + <OTHERFILES value=""/> + </LINKER> + <FILELIST> + <FILE FILENAME="rec_fifo_gate.bpf" FORMNAME="" UNITNAME="rec_fifo_gate" CONTAINERID="BPF" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="rec_multi_binaryfile.cpp" FORMNAME="" UNITNAME="rec_multi_binaryfile" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_thread.cpp" FORMNAME="" UNITNAME="spcm_lib_thread.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_card.cpp" FORMNAME="" UNITNAME="spcm_lib_card.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_data.cpp" FORMNAME="" UNITNAME="spcm_lib_data.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\c_header\spcm_win32_bcppb.lib" FORMNAME="" UNITNAME="spcm_win32_bcppb.lib" CONTAINERID="LibTool" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\ostools\spcm_ostools_win.cpp" FORMNAME="" UNITNAME="spcm_ostools_win" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\sb5_file\sb5_file.cpp" FORMNAME="" UNITNAME="sb5_file" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + </FILELIST> + <BUILDTOOLS> + </BUILDTOOLS> + + <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= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +[Parameters] +RunParams= +Launcher= +UseLauncher=0 +DebugCWD= +HostApplication= +RemoteHost= +RemotePath= +RemoteLauncher= +RemoteCWD= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 + </IDEOPTIONS> +</PROJECT> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_gate/rec_fifo_gate.cpp b/Cpp/examples/c_cpp/rec_fifo_gate/rec_fifo_gate.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e5caa684c80e49827111490fc93a20af10dffd08 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_gate/rec_fifo_gate.cpp @@ -0,0 +1,290 @@ +/* +************************************************************************** + +rec_fifo_gate.cpp (c) Spectrum GmbH + +************************************************************************** + +this example supports all acquisition cards with the option gated sampling +installed. If timestamp is installed the timestamps are also +read. + +Does a continous FIFO transfer and examines the gates length. Data itself +isnot touched. + +Change the global flag g_bThread to use the threaded version or the plain +and more simple loop. + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + + +// ----- standard c include files ----- +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_card.h" +#include "../common/spcm_lib_data.h" +#include "../common/spcm_lib_thread.h" + + +// ----- this is the global thread flag that defines whether we use the thread or non-thread loop ----- +bool g_bThread = true; + + + +/* +************************************************************************** +Working routine data +************************************************************************** +*/ + +struct ST_WORKDATA + { + int32 lPreSamples; + int32 lPostSamples; + int64 llGatesRead; + }; + + + +/* +************************************************************************** +bDoCardSetup: setup matching the calculation routine +************************************************************************** +*/ + +bool bDoCardSetup (ST_WORKDATA* pstWorkData, ST_BUFFERDATA* pstBufferData) + { + int i; + + pstWorkData->lPreSamples = 32; + pstWorkData->lPostSamples = 32; + + // we try to set the samplerate to 1 MHz on internal PLL, no clock output + // we try to set the samplerate to 1 MHz (M2i) or 20 MHz (M3i) on internal PLL, no clock output + // increase this to test the read-out-after-overrun + if (pstBufferData->pstCard->bM2i) + bSpcMSetupClockPLL (pstBufferData->pstCard, MEGA(1), false); + else if (pstBufferData->pstCard->bM2p) + bSpcMSetupClockPLL (pstBufferData->pstCard, MEGA(10), false); + else if (pstBufferData->pstCard->bM3i || pstBufferData->pstCard->bM4i) + bSpcMSetupClockPLL (pstBufferData->pstCard, MEGA(20), false); + printf ("Sampling rate set to %.1lf MHz\n", (double) pstBufferData->pstCard->llSetSamplerate / MEGA(1)); + + // we set external trigger high gate for gated sampling + bSpcMSetupTrigExternal (pstBufferData->pstCard, SPC_TM_POS, false, 0); + + // type dependent card setup + switch (pstBufferData->pstCard->eCardFunction) + { + + // analog acquisition card setup + case AnalogIn: + + // we only enable 1 channel for the example + bSpcMSetupModeRecFIFOGate (pstBufferData->pstCard, CHANNEL0, pstWorkData->lPreSamples, pstWorkData->lPostSamples, 0); + + // program all input channels to +/-1 V and 50 ohm termination (if it's available) + for (i=0; i < pstBufferData->pstCard->lMaxChannels; i++) + bSpcMSetupInputChannel (pstBufferData->pstCard, i, 1000, true); + break; + + // digital acquisition card setup + case DigitalIn: + case DigitalIO: + + // we enable 16 channels + bSpcMSetupModeRecFIFOGate (pstBufferData->pstCard, 0xffff, pstWorkData->lPreSamples, pstWorkData->lPostSamples, 0); + + // set all input channel groups to 110 ohm termination (if it's available) + for (i=0; i < pstBufferData->pstCard->uCfg.stDIO.lGroups; i++) + bSpcMSetupDigitalInput (pstBufferData->pstCard, i, true); + break; + } + + // set up the timestamp mode to standard if timestamp is installed + if (pstBufferData->bStartTimestamp) + bSpcMSetupTimestamp (pstBufferData->pstCard, SPC_TSMODE_STANDARD | SPC_TSCNT_INTERNAL, 0); + + return pstBufferData->pstCard->bSetError; + } + + + +/* +************************************************************************** +Setup working routine +************************************************************************** +*/ + +bool bWorkSetup (void* pvWorkData, ST_BUFFERDATA* pstBufferData) + { + ST_WORKDATA* pstWorkData = (ST_WORKDATA*) pvWorkData; + + // setup for the transfer, to avoid overrun one may use even larger data blocks + pstBufferData->dwDataBufLen = MEGA_B(8); + pstBufferData->dwDataNotify = KILO_B(512); + pstBufferData->dwTSBufLen = MEGA_B(1); + pstBufferData->dwTSNotify = KILO_B(4); + + // setup for the work + pstWorkData->llGatesRead = 0; + + return true; + } + + + +/* +************************************************************************** +bWorkDo: get data and examine the gate intervals +************************************************************************** +*/ + +bool bWorkDo (void* pvWorkData, ST_BUFFERDATA* pstBufferData) + { + ST_WORKDATA* pstWorkData = (ST_WORKDATA*) pvWorkData; + + // read the timestamps, count them and calculate the gate length + uint64 qwTSAvail = pstBufferData->llTSAvailBytes; + uint64 qwTimestampAverageDiff = 0; + uint64 qwGates = 0; + uint32 dwTimestampBytes; + + // ----- M2i+M3i timestamps are 64 bit, M4i/M4x and M2p 128 bit ----- + dwTimestampBytes = 0; + if (pstBufferData->pstCard->bM2i || pstBufferData->pstCard->bM3i) + dwTimestampBytes = 8; + else if (pstBufferData->pstCard->bM4i || pstBufferData->pstCard->bM2p || pstBufferData->pstCard->bM5i) + dwTimestampBytes = 16; + + // we measure the timestamp diff (gate length) and calc an average + while (qwTSAvail >= (2 * dwTimestampBytes)) + { + uint64* pqwTimestamp1 = (uint64*) pstBufferData->pvTSCurrentBuf; + uint64* pqwTimestamp0 = ((uint64*) (((char*)pstBufferData->pvTSCurrentBuf) + dwTimestampBytes)); + uint64 qwDiff = (*pqwTimestamp1) - (*pqwTimestamp0); + + // the timestamps only record the "real world" trigger, we have to add pre- and post manually + qwDiff += pstWorkData->lPreSamples + pstWorkData->lPostSamples; + + // next gate timestamp pair + pstWorkData->llGatesRead++; + qwTimestampAverageDiff += qwDiff; + qwTSAvail -= (2 * dwTimestampBytes); + qwGates++; + pstBufferData->pvTSCurrentBuf = (void*) (((char*) pstBufferData->pvTSCurrentBuf) + (2 * dwTimestampBytes)); + } + + // subtract the bytes that we've not used so far as we still need the rest next time + pstBufferData->llTSAvailBytes -= qwTSAvail; + + // this would also be the position to do something with the data + // TO DO + + // print the status + if (qwGates) + { + qwTimestampAverageDiff /= qwGates; + printf ("\r%.2f MSamples transferred %d Gate Segments, Average Gate Len = %.3f ms\n", (double) pstBufferData->qwDataTransferred / pstBufferData->pstCard->lBytesPerSample / 1024.0 / 1024.0, (uint32) pstWorkData->llGatesRead, 1000.0 * ((uint32) qwTimestampAverageDiff) / pstBufferData->pstCard->llSetSamplerate); + } + else + printf ("\r%.2f MSamples transferred %d Gate Segments\n", (double) pstBufferData->qwDataTransferred / pstBufferData->pstCard->lBytesPerSample / 1024.0 / 1024.0, (uint32) pstWorkData->llGatesRead); + + return true; + } + + + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + char szBuffer[1024]; // a character buffer for any messages + ST_SPCM_CARDINFO stCard; // info structure of my card + ST_WORKDATA stWorkData; + ST_BUFFERDATA stBufferData; // buffer and start information + + // ------------------------------------------------------------------------ + // init card number 0 (the first card in the system), get some information and print it + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + if (bSpcMInitCardByIdx (&stCard, 0)) + //if (bSpcMInitCardByIdx (&stCard, "192.168.1.10", 0)) + { + printf (pszSpcMPrintDocumentationLink (&stCard, szBuffer, sizeof (szBuffer))); + printf (pszSpcMPrintCardInfo (&stCard, szBuffer, sizeof (szBuffer))); + } + else + return nSpcMErrorMessageStdOut (&stCard, "Error: Could not open card\n", true); + + memset (&stBufferData, 0, sizeof(stBufferData)); + stBufferData.pstCard = &stCard; + + + // check whether we support this card type in the example + if ((stCard.eCardFunction != AnalogIn) && (stCard.eCardFunction != DigitalIn) && (stCard.eCardFunction != DigitalIO)) + return nSpcMErrorMessageStdOut (&stCard, "Error: Card function not supported by this example\n", false); + if ((stCard.lFeatureMap & SPCM_FEAT_GATE) == 0) + return nSpcMErrorMessageStdOut (&stCard, "Error: Gated Sampling Option not installed. Examples was done especially for this option!\n", false); + + // set a flag if timestamp is installed + stBufferData.bStartTimestamp = ((stCard.lFeatureMap & SPCM_FEAT_TIMESTAMP) != 0); + + + + // ------------------------------------------------------------------------ + // do the card setup, error is routed in the structure so we don't care for the return values + if (!stCard.bSetError) + bDoCardSetup (&stWorkData, &stBufferData); + + + + // ------------------------------------------------------------------------ + // setup the data transfer and start it + stBufferData.bStartCard = true; + stBufferData.bStartData = true; + stBufferData.bStartTimestamp = ((stCard.lFeatureMap & SPCM_FEAT_TIMESTAMP) != 0); + + // start the threaded loop + stBufferData.lTimeout = 5000; + if (!stCard.bSetError && g_bThread) + vDoThreadMainLoop (&stBufferData, &stWorkData, bWorkSetup, bWorkDo, NULL, bKeyAbortCheck); + + // this is the non threaded loop, we use a small timeout of 100 ms here as we otherwise won't return from the loop if no dat is coming + stBufferData.lTimeout = 100; + if (!stCard.bSetError && !g_bThread) + vDoMainLoop (&stBufferData, &stWorkData, bWorkSetup, bWorkDo, NULL, bKeyAbortCheck); + + + + // ------------------------------------------------------------------------ + // print error information if an error occured + if (stCard.bSetError) + return nSpcMErrorMessageStdOut (&stCard, "An error occured while programming the card:\n", true); + + + // clean up and close the driver + vSpcMCloseCard (&stCard); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/rec_fifo_gate/rec_fifo_gate.dsp b/Cpp/examples/c_cpp/rec_fifo_gate/rec_fifo_gate.dsp new file mode 100644 index 0000000000000000000000000000000000000000..060915758ac598cba1d20de29e46ccf917bdc9cd --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_gate/rec_fifo_gate.dsp @@ -0,0 +1,156 @@ +# Microsoft Developer Studio Project File - Name="rec_fifo_gate" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=rec_fifo_gate - 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 "rec_fifo_gate.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 "rec_fifo_gate.mak" CFG="rec_fifo_gate - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "rec_fifo_gate - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "rec_fifo_gate - 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)" == "rec_fifo_gate - 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 /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 /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 /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "rec_fifo_gate - 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 /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 /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 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "rec_fifo_gate - Win32 Release" +# Name "rec_fifo_gate - Win32 Debug" +# Begin Group "common" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\common\spcm_lib_card.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_thread.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_ostools_win.cpp +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_win32_msvcpp.lib +# End Source File +# End Group +# Begin Group "header" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\c_header\dlltyp.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\regs.h +# End Source File +# Begin Source File + +SOURCE=..\sb5_file\sb5_file.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcerr.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_drv.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_card.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_thread.h +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_ostools.h +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_oswrap.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\rec_fifo_gate.cpp +# End Source File +# End Target +# End Project diff --git a/Cpp/examples/c_cpp/rec_fifo_gate/rec_fifo_gate.dsw b/Cpp/examples/c_cpp/rec_fifo_gate/rec_fifo_gate.dsw new file mode 100644 index 0000000000000000000000000000000000000000..67aa771aa51176baf88442f44b419fe3d3e46e05 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_gate/rec_fifo_gate.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "rec_fifo_gate"=.\rec_fifo_gate.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/Cpp/examples/c_cpp/rec_fifo_gate/rec_fifo_gate.vcproj b/Cpp/examples/c_cpp/rec_fifo_gate/rec_fifo_gate.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..fdc6b424db9dbccdfc7ba3083f4941e4697a98d1 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_gate/rec_fifo_gate.vcproj @@ -0,0 +1,655 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="rec_fifo_gate" + ProjectGUID="{C40034E2-2055-404E-90D0-725CF8C5AD86}" + RootNamespace="rec_fifo_gate" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/rec_fifo_gate.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_fifo_gate.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_fifo_gate.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_fifo_gate.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_fifo_gate.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/rec_fifo_gate.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_fifo_gate.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_fifo_gate.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_fifo_gate.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_fifo_gate.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/rec_fifo_gate.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_fifo_gate.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_fifo_gate.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_fifo_gate.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_fifo_gate.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/rec_fifo_gate.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_fifo_gate.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_fifo_gate.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_fifo_gate.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_fifo_gate.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="common" + > + <File + RelativePath="..\common\spcm_lib_card.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_data.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_thread.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="header" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\sb5_file\sb5_file.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_card.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_data.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_thread.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_oswrap.h" + > + </File> + </Filter> + <File + RelativePath="rec_fifo_gate.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/rec_fifo_gate/rec_fifo_gate.vcxproj b/Cpp/examples/c_cpp/rec_fifo_gate/rec_fifo_gate.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..770b82e6eaa7024f1b3d2065ece90fc0c5ece218 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_gate/rec_fifo_gate.vcxproj @@ -0,0 +1,269 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{C40034E2-2055-404E-90D0-725CF8C5AD86}</ProjectGuid> + <RootNamespace>rec_fifo_gate</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rec_fifo_gate.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_fifo_gate.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_fifo_gate.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_fifo_gate.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rec_fifo_gate.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_fifo_gate.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_fifo_gate.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_fifo_gate.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rec_fifo_gate.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_fifo_gate.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_fifo_gate.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_fifo_gate.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rec_fifo_gate.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_fifo_gate.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_fifo_gate.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_fifo_gate.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="..\common\spcm_lib_card.cpp" /> + <ClCompile Include="..\common\spcm_lib_data.cpp" /> + <ClCompile Include="..\common\spcm_lib_thread.cpp" /> + <ClCompile Include="rec_fifo_gate.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\common\spcm_lib_card.h" /> + <ClInclude Include="..\common\spcm_lib_data.h" /> + <ClInclude Include="..\common\spcm_lib_thread.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + <ClInclude Include="..\sb5_file\sb5_file.h" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_gate/rec_fifo_gate.vcxproj.filters b/Cpp/examples/c_cpp/rec_fifo_gate/rec_fifo_gate.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..3165da3942c8efa306956d4e010a2e42e8cf896d --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_gate/rec_fifo_gate.vcxproj.filters @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="common"> + <UniqueIdentifier>{41b57a3c-1aa5-4139-856e-e11c6a932e51}</UniqueIdentifier> + </Filter> + <Filter Include="header"> + <UniqueIdentifier>{2a68a8ef-7931-4eb2-a308-8edd8dc53f55}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\spcm_lib_card.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_data.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_thread.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="rec_fifo_gate.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\sb5_file\sb5_file.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_card.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_data.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_thread.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_oswrap.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_multi/makefile b/Cpp/examples/c_cpp/rec_fifo_multi/makefile new file mode 100644 index 0000000000000000000000000000000000000000..a96d8ee886b5c703a0d6c7b926c4fd4ccc050b40 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_multi/makefile @@ -0,0 +1,26 @@ +COMPILER = g++ +EXECUTABLE = rec_fifo_multi_binaryfile +LIBS += -lspcm_linux -lpthread -lrt + +OBJECTS = \ + rec_fifo_multi_binaryfile.o\ + ../common/spcm_lib_card.o\ + ../common/spcm_lib_data.o\ + ../common/spcm_lib_thread.o\ + ../sb5_file/sb5_file.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/rec_fifo_multi/makefile.poll b/Cpp/examples/c_cpp/rec_fifo_multi/makefile.poll new file mode 100644 index 0000000000000000000000000000000000000000..04ffbdb9ab84b4892d9aca4768da1eb2bfa4cde9 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_multi/makefile.poll @@ -0,0 +1,24 @@ +COMPILER = g++ +EXECUTABLE = rec_fifo_multi_poll +LIBS += -lspcm_linux -lpthread -lrt + +OBJECTS = \ + rec_fifo_multi_poll.o\ + ../common/spcm_lib_card.o\ + ../common/spcm_lib_data.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi.bpf b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi.bpf new file mode 100644 index 0000000000000000000000000000000000000000..5da88241fe8e80944de42def849bf4eab8f1f666 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi.bpf @@ -0,0 +1,3 @@ +This file is used by the project manager only and should be treated like the project file + + main \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi.bpr b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi.bpr new file mode 100644 index 0000000000000000000000000000000000000000..5da2f903ae128a81a95caad717c1fffaf1629a19 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi.bpr @@ -0,0 +1,107 @@ +<?xml version='1.0' encoding='utf-8' ?> +<!-- C++Builder XML Project --> +<PROJECT> + <MACROS> + <VERSION value="BCB.06.00"/> + <PROJECT value="rec_fifo_multi.exe"/> + <OBJFILES value="rec_multi_binaryfile.obj ..\common\spcm_lib_thread.obj + ..\common\spcm_lib_card.obj ..\common\spcm_lib_data.obj + ..\common\ostools\spcm_ostools_win.obj ..\sb5_file\sb5_file.obj"/> + <RESFILES value=""/> + <DEFFILE value=""/> + <RESDEPEN value="$(RESFILES)"/> + <LIBFILES value="..\c_header\spcm_win32_bcppb.lib"/> + <LIBRARIES value=""/> + <SPARELIBS value=""/> + <PACKAGES value="vcl.bpi rtl.bpi vclx.bpi bcbsmp.bpi dclocx.bpi"/> + <PATHCPP value=".;..\common;..\common;..\common;..\common\ostools;..\sb5_file"/> + <PATHPAS value=".;"/> + <PATHRC value=".;"/> + <PATHASM value=".;"/> + <DEBUGLIBPATH value="$(BCB)\lib\debug"/> + <RELEASELIBPATH value="$(BCB)\lib\release"/> + <LINKER value="ilink32"/> + <USERDEFINES value="_DEBUG"/> + <SYSDEFINES value="NO_STRICT;_NO_VCL;_RTLDLL;USEPACKAGES"/> + <MAINSOURCE value="rec_fifo_multi.bpf"/> + <INCLUDEPATH value="C:\svnwork\spcm_drv_c\sb5_file;C:\svnwork\spcm_drv_c\common\ostools;C:\svnwork\spcm_drv_c\common;C:\svnwork\spcm_drv_c\rec_fifo_multi;$(BCB)\include;$(BCB)\include\vcl"/> + <LIBPATH value="C:\svnwork\spcm_drv_c\sb5_file;C:\svnwork\spcm_drv_c\common\ostools;C:\svnwork\spcm_drv_c\common;C:\svnwork\spcm_drv_c\rec_fifo_multi;$(BCB)\lib\obj;$(BCB)\lib"/> + <WARNINGS value="-w-par"/> + <OTHERFILES value=""/> + </MACROS> + <OPTIONS> + <CFLAG1 value="-tWC -tWM -Od -H=$(BCB)\lib\vcl60.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v + -vi- -c"/> + <PFLAGS value="-$YD -$W -$O- -$A8 -v -JPHNE -M"/> + <RFLAGS value=""/> + <AFLAGS value="/mx /w2 /zd"/> + <LFLAGS value="-Tpe -ap -D"" -x -Gn -v"/> + <OTHERFILES value=""/> + </OPTIONS> + <LINKER> + <ALLOBJ value="c0x32.obj $(PACKAGES) $(OBJFILES)"/> + <ALLRES value="$(RESFILES)"/> + <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib"/> + <OTHERFILES value=""/> + </LINKER> + <FILELIST> + <FILE FILENAME="rec_fifo_multi.bpf" FORMNAME="" UNITNAME="rec_fifo_multi" CONTAINERID="BPF" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="rec_multi_binaryfile.cpp" FORMNAME="" UNITNAME="rec_multi_binaryfile" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_thread.cpp" FORMNAME="" UNITNAME="spcm_lib_thread.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_card.cpp" FORMNAME="" UNITNAME="spcm_lib_card.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_data.cpp" FORMNAME="" UNITNAME="spcm_lib_data.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\c_header\spcm_win32_bcppb.lib" FORMNAME="" UNITNAME="spcm_win32_bcppb.lib" CONTAINERID="LibTool" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\ostools\spcm_ostools_win.cpp" FORMNAME="" UNITNAME="spcm_ostools_win" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\sb5_file\sb5_file.cpp" FORMNAME="" UNITNAME="sb5_file" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + </FILELIST> + <BUILDTOOLS> + </BUILDTOOLS> + + <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= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +[Parameters] +RunParams= +Launcher= +UseLauncher=0 +DebugCWD= +HostApplication= +RemoteHost= +RemotePath= +RemoteLauncher= +RemoteCWD= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 + </IDEOPTIONS> +</PROJECT> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi.dsw b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi.dsw new file mode 100644 index 0000000000000000000000000000000000000000..9365fe8fb23bdd2f0dc53ef7e6468c3f130f6994 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi.dsw @@ -0,0 +1,41 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "rec_multi_binaryfile"=.\rec_multi_binaryfile.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "rec_multi_poll"=.\rec_multi_poll.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi.sln b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi.sln new file mode 100644 index 0000000000000000000000000000000000000000..1b1fc109527c4f303142b6154a5ef86f3b28590e --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi.sln @@ -0,0 +1,36 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rec_multi_binaryfile", "rec_multi_binaryfile.vcproj", "{C40034E2-2055-404E-90D0-725CF8C5AD86}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rec_multi_poll", "rec_multi_poll.vcproj", "{EAE5880B-0B91-4E5C-8B9E-DFD554FDECFF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C40034E2-2055-404E-90D0-725CF8C5AD86}.Debug|Win32.ActiveCfg = Debug|Win32 + {C40034E2-2055-404E-90D0-725CF8C5AD86}.Debug|Win32.Build.0 = Debug|Win32 + {C40034E2-2055-404E-90D0-725CF8C5AD86}.Debug|x64.ActiveCfg = Debug|x64 + {C40034E2-2055-404E-90D0-725CF8C5AD86}.Debug|x64.Build.0 = Debug|x64 + {C40034E2-2055-404E-90D0-725CF8C5AD86}.Release|Win32.ActiveCfg = Release|Win32 + {C40034E2-2055-404E-90D0-725CF8C5AD86}.Release|Win32.Build.0 = Release|Win32 + {C40034E2-2055-404E-90D0-725CF8C5AD86}.Release|x64.ActiveCfg = Release|x64 + {C40034E2-2055-404E-90D0-725CF8C5AD86}.Release|x64.Build.0 = Release|x64 + {EAE5880B-0B91-4E5C-8B9E-DFD554FDECFF}.Debug|Win32.ActiveCfg = Debug|Win32 + {EAE5880B-0B91-4E5C-8B9E-DFD554FDECFF}.Debug|Win32.Build.0 = Debug|Win32 + {EAE5880B-0B91-4E5C-8B9E-DFD554FDECFF}.Debug|x64.ActiveCfg = Debug|x64 + {EAE5880B-0B91-4E5C-8B9E-DFD554FDECFF}.Debug|x64.Build.0 = Debug|x64 + {EAE5880B-0B91-4E5C-8B9E-DFD554FDECFF}.Release|Win32.ActiveCfg = Release|Win32 + {EAE5880B-0B91-4E5C-8B9E-DFD554FDECFF}.Release|Win32.Build.0 = Release|Win32 + {EAE5880B-0B91-4E5C-8B9E-DFD554FDECFF}.Release|x64.ActiveCfg = Release|x64 + {EAE5880B-0B91-4E5C-8B9E-DFD554FDECFF}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_binaryfile.cpp b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_binaryfile.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6fc1dffd764f536861381d199ce340fd2e51a4ff --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_binaryfile.cpp @@ -0,0 +1,451 @@ +/* +************************************************************************** + +rec_multi_binaryfile.cpp (c) Spectrum GmbH + +************************************************************************** + +this example supports all SpcmDrv based acquisition cards with the option +multiple recording installed. If timestamp is installed the timestamps are also +read. + +Information about the different products and their drivers can be found +online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/platform-driver-and-series-differences + +Does a continous FIFO transfer and writes data to a binary file. The file +type can be selected to simple binary file, binary file including the +timestamps at the beginning of each segment or binary file including the +SBench5 format header (*.sbs/*.sb5) file. + +Change the eFileType variable to select between the different file types + +Change the global flag g_bThread to use the threaded version or the plain +and more simple loop. + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + + +// ----- standard c include files ----- +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_card.h" +#include "../common/spcm_lib_data.h" +#include "../common/spcm_lib_thread.h" +#include "../sb5_file/sb5_file.h" + + +// ----- this is the global thread flag that defines whether we use the thread or non-thread loop ----- +bool g_bThread = true; + + + +/* +************************************************************************** +Working routine data +************************************************************************** +*/ + +#define FILENAME "stream_test" + +typedef enum E_FILETYPE {eFT_noWrite, eFT_PlainBinary, eFT_PlainWithTimestamps, eFT_SB5_Stream} E_FILETYPE; + +struct ST_WORKDATA + { + E_FILETYPE eFileType; + int64 llSamplesWritten; + FILE* hFile; + char szFileName[100]; + int32 lSegmentsize; + }; + + + +/* +************************************************************************** +bDoCardSetup: setup matching the calculation routine +************************************************************************** +*/ + +bool bDoCardSetup (ST_WORKDATA* pstWorkData, ST_BUFFERDATA* pstBufferData) + { + int i; + + // FIFO mode setup, we run continuously and use 128 samples of pretrigger for each segment + pstWorkData->lSegmentsize = KILO_B(1); // segment size + pstWorkData->eFileType = eFT_noWrite; // storage mode + + // we try to set the samplerate to 1 MHz (M2i) or 20 MHz (M3i, M4i) on internal PLL, no clock output + // increase this to test the read-out-after-overrun + if (pstBufferData->pstCard->bM2i) + bSpcMSetupClockPLL (pstBufferData->pstCard, MEGA(1), false); + else if (pstBufferData->pstCard->bM2p) + bSpcMSetupClockPLL (pstBufferData->pstCard, MEGA(10), false); + else if (pstBufferData->pstCard->bM3i || pstBufferData->pstCard->bM4i || pstBufferData->pstCard->bM5i) + bSpcMSetupClockPLL (pstBufferData->pstCard, MEGA(20), false); + printf ("Sampling rate set to %.1lf MHz\n", (double) pstBufferData->pstCard->llSetSamplerate / 1000000); + + // we set external trigger for multiple recording + bSpcMSetupTrigExternal (pstBufferData->pstCard, SPC_TM_POS, false, 0); + + // type dependent card setup + switch (pstBufferData->pstCard->eCardFunction) + { + + // analog acquisition card setup + case AnalogIn: + + // we only enable 1 channel for the example + bSpcMSetupModeRecFIFOMulti (pstBufferData->pstCard, CHANNEL0, pstWorkData->lSegmentsize, pstWorkData->lSegmentsize - 128); + + // program all input channels to +/-1 V and 50 ohm termination (if it's available) + if (pstBufferData->pstCard->bM2i || pstBufferData->pstCard->bM2p) + { + for (i=0; i < pstBufferData->pstCard->lMaxChannels; i++) + bSpcMSetupInputChannel (pstBufferData->pstCard, i, 1000, true); + } + else + { + bool bTerm = true; + bool bACCoupling = false; + bool bBandwidthLimit = false; + for (i=0; i < pstBufferData->pstCard->lMaxChannels; i++) + bSpcMSetupPathInputCh (pstBufferData->pstCard, i, 0, 1000, 0, bTerm, bACCoupling, bBandwidthLimit); + } + break; + + // digital acquisition card setup + case DigitalIn: + case DigitalIO: + + // we enable 16 channels for the example + bSpcMSetupModeRecFIFOMulti (pstBufferData->pstCard, 0xffff, pstWorkData->lSegmentsize, pstWorkData->lSegmentsize - 128); + + // set all input channel groups to 110 ohm termination (if it's available) + for (i=0; i < pstBufferData->pstCard->uCfg.stDIO.lGroups; i++) + bSpcMSetupDigitalInput (pstBufferData->pstCard, i, true); + break; + } + + // set up the timestamp mode to standard if timestamp is installed + if (pstBufferData->bStartTimestamp) + bSpcMSetupTimestamp (pstBufferData->pstCard, SPC_TSMODE_STANDARD | SPC_TSCNT_INTERNAL, 0); + + return pstBufferData->pstCard->bSetError; + } + + + +/* +************************************************************************** +Setup working routine +************************************************************************** +*/ + +bool bWorkSetup (void* pvWorkData, ST_BUFFERDATA* pstBufferData) + { + ST_WORKDATA* pstWorkData = (ST_WORKDATA*) pvWorkData; + + // setup for the transfer, to avoid overrun one may use even larger data blocks + pstBufferData->dwDataBufLen = MEGA_B(8); + pstBufferData->dwDataNotify = KILO_B(512); + pstBufferData->dwTSBufLen = MEGA_B(1); + pstBufferData->dwTSNotify = KILO_B(4); + + // setup for the work + pstWorkData->llSamplesWritten = 0; + + switch (pstWorkData->eFileType) + { + case eFT_PlainBinary: + case eFT_PlainWithTimestamps: + sprintf (pstWorkData->szFileName, "%s.bin", FILENAME); + printf ("\nWriting to plan binary file %s\n\n", pstWorkData->szFileName); + break; + + case eFT_SB5_Stream: + if (pstBufferData->pstCard->lSetChannels == 1) + sprintf (pstWorkData->szFileName, "%s.sb5", FILENAME); + else + sprintf (pstWorkData->szFileName, "%s.sbs", FILENAME); + printf ("\nWriting to SBench 5 binary file %s\n\n", pstWorkData->szFileName); + break; + + case eFT_noWrite: + printf ("\nJust simulating, no real write\n\n"); + break; + } + + // check some details if we're storing segments together with timestamps + if (pstWorkData->eFileType == eFT_PlainWithTimestamps) + { + uint32 dwSegments = pstBufferData->dwDataBufLen / pstWorkData->lSegmentsize / pstBufferData->pstCard->lSetChannels / pstBufferData->pstCard->lBytesPerSample; + + // check whether timestamps are installed, otherwise this mode doesn't make sense + if (!pstBufferData->bStartTimestamp) + { + printf ("\nThis storing mode needs the option timestamp installed. it doesn't work with your card\n"); + return false; + } + + // a full number of segments have to fit in our buffer otherwise the algorithm in this example won't work + if (((uint32) (pstBufferData->dwDataBufLen / dwSegments) * dwSegments) != pstBufferData->dwDataBufLen) + { + printf ("\nFor this storing mode a full number of segments must fir into the buffer. Please correct setup\n"); + return false; + } + } + + if (pstWorkData->eFileType != eFT_noWrite) + pstWorkData->hFile = fopen (pstWorkData->szFileName, "w+b"); + + // we now have to write the SB5 header if this format has been selected + if (pstWorkData->hFile && (pstWorkData->eFileType == eFT_SB5_Stream)) + { + ST_SB5HEAD* pstHeader; + bool bReturn; + + pstHeader = pstSB5_AllocHeader (pstBufferData->pstCard->lSetChannels); + if (!bFillSB5Header (pstBufferData->pstCard, pstHeader, "Test")) + return false; + + bReturn = bSB5_StoreHeader (pstWorkData->hFile, pstHeader); + vSB5_FreeHeader (pstHeader); + + return bReturn; + } + + return ((pstWorkData->hFile != NULL) || (pstWorkData->eFileType == eFT_noWrite)); + } + + + +/* +************************************************************************** +bWorkDo: stores data to hard disk +************************************************************************** +*/ + +bool bWorkDo (void* pvWorkData, ST_BUFFERDATA* pstBufferData) + { + ST_WORKDATA* pstWorkData = (ST_WORKDATA*) pvWorkData; + size_t dwWritten, dwTimestampBytes; + + // ----- M2i+M3i timestamps are 64 bit, M4i 128 bit ----- + dwTimestampBytes = 0; + if (pstBufferData->pstCard->bM2i || pstBufferData->pstCard->bM3i) + dwTimestampBytes = 8; + else if (pstBufferData->pstCard->bM4i || pstBufferData->pstCard->bM2p || pstBufferData->pstCard->bM5i) + dwTimestampBytes = 16; + + // ----- data together with timestamps ----- + if (pstWorkData->eFileType == eFT_PlainWithTimestamps) + { + + // if we write timestamps together with data we need enough data from both here + uint32 dwSegmentInBytes = (pstWorkData->lSegmentsize * pstBufferData->pstCard->lBytesPerSample * pstBufferData->pstCard->lSetChannels); + uint64 qwDataAvail = pstBufferData->llDataAvailBytes; + uint64 qwTSAvail = pstBufferData->llTSAvailBytes; + + // at least one timestamp and one segment is there + while ((qwTSAvail >= 8) && (qwDataAvail >= dwSegmentInBytes)) + { + + // write the current timestamp and then the data + dwWritten = fwrite (pstBufferData->pvTSCurrentBuf, 1, dwTimestampBytes, pstWorkData->hFile); + + if (dwWritten == dwTimestampBytes) + dwWritten = fwrite (pstBufferData->pvDataCurrentBuf, 1, dwSegmentInBytes, pstWorkData->hFile); + if (dwWritten != dwSegmentInBytes) + { + printf ("\nData Write error\n"); + return false; + } + + // count the timestamp and recalc sizes and positions + pstWorkData->llSamplesWritten++; + qwTSAvail -= dwTimestampBytes; + pstBufferData->pvTSCurrentBuf = (void*) (((char*) pstBufferData->pvTSCurrentBuf) + dwTimestampBytes); + qwDataAvail -= dwSegmentInBytes; + pstBufferData->pvDataCurrentBuf = (void*) (((char*) pstBufferData->pvDataCurrentBuf) + dwSegmentInBytes); + } + + // subtract the bytes that we've not used so far as we still need the rest next time + pstBufferData->llDataAvailBytes -= qwDataAvail; + pstBufferData->llTSAvailBytes -= qwTSAvail; + + // print the status + printf ("\r%.2f MSamples written to %s, %d segments in total", + (double) pstBufferData->qwDataTransferred / pstBufferData->pstCard->lBytesPerSample / 1024.0 / 1024.0, + pstWorkData->szFileName, + (int32) pstWorkData->llSamplesWritten); + + return true; + } + + + + // ----- simple data, timestamps are not recorded or ignored ----- + if (pstWorkData->eFileType != eFT_noWrite) + { + + // we limit the data to write to chunks of notify size to avoid a jam in the fwrite function + if (pstBufferData->llDataAvailBytes > pstBufferData->dwDataNotify) + pstBufferData->llDataAvailBytes = pstBufferData->dwDataNotify; + + // write the data and count the samples + dwWritten = fwrite (pstBufferData->pvDataCurrentBuf, 1, (size_t)pstBufferData->llDataAvailBytes, pstWorkData->hFile); + pstWorkData->llSamplesWritten += dwWritten / pstBufferData->pstCard->lBytesPerSample; + if (dwWritten != pstBufferData->llDataAvailBytes) + { + printf ("\nData Write error\n"); + return false; + } + + // announce the number of data that has been written + printf ("\r%.2f MSamples written to %s, %.2fk Timestamps received", + (double) pstBufferData->qwDataTransferred / pstBufferData->pstCard->lBytesPerSample / 1024.0 / 1024.0, + pstWorkData->szFileName, + (double) pstBufferData->qwTSTransferred / dwTimestampBytes / 1024.0); + } + + // ----- no data written, just announce the transferred data ----- + if (pstWorkData->eFileType == eFT_noWrite) + printf ("\r%.2f MSamples written, %.2fk Timestamps received", + (double) pstBufferData->qwDataTransferred / pstBufferData->pstCard->lBytesPerSample / 1024.0 / 1024.0, + (double) pstBufferData->qwTSTransferred / dwTimestampBytes / 1024.0); + + return true; + } + + + + +/* +************************************************************************** +vWorkClose: Close the work and clean up +************************************************************************** +*/ + +void vWorkClose (void* pvWorkData, ST_BUFFERDATA* pstBufferData) + { + ST_WORKDATA* pstWorkData = (ST_WORKDATA*) pvWorkData; + + if (pstWorkData->eFileType != eFT_noWrite) + if (pstWorkData->hFile) + { + if (pstWorkData->eFileType == eFT_SB5_Stream) + bSB5_UpdateSamples (pstWorkData->hFile, (int32) pstWorkData->llSamplesWritten); + + fclose (pstWorkData->hFile); + } + } + + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + char szBuffer[1024]; // a character buffer for any messages + ST_SPCM_CARDINFO stCard; // info structure of my card + ST_WORKDATA stWorkData; + ST_BUFFERDATA stBufferData; // buffer and start information + + // ------------------------------------------------------------------------ + // init card number 0 (the first card in the system), get some information and print it + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + if (bSpcMInitCardByIdx (&stCard, 0)) + //if (bSpcMInitCardByIdx (&stCard, "192.168.1.10", 0)) + { + printf (pszSpcMPrintDocumentationLink (&stCard, szBuffer, sizeof (szBuffer))); + printf (pszSpcMPrintCardInfo (&stCard, szBuffer, sizeof (szBuffer))); + } + else + return nSpcMErrorMessageStdOut (&stCard, "Error: Could not open card\n", true); + + memset (&stBufferData, 0, sizeof(stBufferData)); + stBufferData.pstCard = &stCard; + + + // check whether we support this card type in the example + if ((stCard.eCardFunction != AnalogIn) && (stCard.eCardFunction != DigitalIn) && (stCard.eCardFunction != DigitalIO)) + return nSpcMErrorMessageStdOut (&stCard, "Error: Card function not supported by this example\n", false); + if ((stCard.lFeatureMap & SPCM_FEAT_MULTI) == 0) + return nSpcMErrorMessageStdOut (&stCard, "Error: Multiple Recording Option not installed. Examples was done especially for this option!\n", false); + + // set a flag if timestamp is installed + stBufferData.bStartTimestamp = ((stCard.lFeatureMap & SPCM_FEAT_TIMESTAMP) != 0); + + + + // ------------------------------------------------------------------------ + // do the card setup, error is routed in the structure so we don't care for the return values + if (!stCard.bSetError) + bDoCardSetup (&stWorkData, &stBufferData); + + + + // ------------------------------------------------------------------------ + // some additional information on the acquisition + if (!stCard.bSetError) + { + printf ("\nData information:\n=================\n"); + printf ("Each segment is %.3f ms long\n", 1000.0 * stWorkData.lSegmentsize / stCard.llSetSamplerate); + printf ("Maximum pulse repetition frequency to reach with this setting is %.2f Hz\n", (double) stCard.llSetSamplerate / stWorkData.lSegmentsize); + } + + + + // ------------------------------------------------------------------------ + // setup the data transfer and start it + stBufferData.bStartCard = true; + stBufferData.bStartData = true; + stBufferData.bStartTimestamp = ((stCard.lFeatureMap & SPCM_FEAT_TIMESTAMP) != 0); + + // start the threaded loop + stBufferData.lTimeout = 5000; + if (!stCard.bSetError && g_bThread) + vDoThreadMainLoop (&stBufferData, &stWorkData, bWorkSetup, bWorkDo, vWorkClose, bKeyAbortCheck); + + // this is the non threaded loop, we use a small timeout of 100 ms here as we otherwise won't return from the loop if no dat is coming + stBufferData.lTimeout = 100; + if (!stCard.bSetError && !g_bThread) + { + stBufferData.bStartExtraDMA = stBufferData.bStartTimestamp; + vDoMainLoop (&stBufferData, &stWorkData, bWorkSetup, bWorkDo, vWorkClose, bKeyAbortCheck); + } + + + + // ------------------------------------------------------------------------ + // print error information if an error occured + if (stCard.bSetError) + return nSpcMErrorMessageStdOut (&stCard, "An error occured while programming the card:\n", true); + + + // clean up and close the driver + vSpcMCloseCard (&stCard); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_binaryfile.dsp b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_binaryfile.dsp new file mode 100644 index 0000000000000000000000000000000000000000..2e30088d399df918f60d7005562e211105b941ff --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_binaryfile.dsp @@ -0,0 +1,160 @@ +# Microsoft Developer Studio Project File - Name="rec_multi_binaryfile" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=rec_multi_binaryfile - Win32 Debug +!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE +!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl +!MESSAGE +!MESSAGE NMAKE /f "rec_multi_binaryfile.mak". +!MESSAGE +!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben +!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: +!MESSAGE +!MESSAGE NMAKE /f "rec_multi_binaryfile.mak" CFG="rec_multi_binaryfile - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "rec_multi_binaryfile - Win32 Release" (basierend auf "Win32 (x86) Console Application") +!MESSAGE "rec_multi_binaryfile - Win32 Debug" (basierend auf "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "rec_multi_binaryfile - 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 /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 /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 /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "rec_multi_binaryfile - 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 /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 /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 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "rec_multi_binaryfile - Win32 Release" +# Name "rec_multi_binaryfile - Win32 Debug" +# Begin Group "common" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\sb5_file\sb5_file.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_card.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_thread.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_ostools_win.cpp +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_win32_msvcpp.lib +# End Source File +# End Group +# Begin Group "header" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\c_header\dlltyp.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\regs.h +# End Source File +# Begin Source File + +SOURCE=..\sb5_file\sb5_file.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcerr.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_drv.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_card.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_thread.h +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_ostools.h +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_oswrap.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\rec_multi_binaryfile.cpp +# End Source File +# End Target +# End Project diff --git a/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_binaryfile.vcproj b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_binaryfile.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..c897d97b18fb70969707957e5cc96ddb64fdeadd --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_binaryfile.vcproj @@ -0,0 +1,690 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="rec_multi_binaryfile" + ProjectGUID="{C40034E2-2055-404E-90D0-725CF8C5AD86}" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/rec_multi_binaryfile.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_multi_binaryfile.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_multi_binaryfile.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_multi_binaryfile.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_multi_binaryfile.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/rec_multi_binaryfile.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_multi_binaryfile.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_multi_binaryfile.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_multi_binaryfile.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_multi_binaryfile.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/rec_multi_binaryfile.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_multi_binaryfile.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_multi_binaryfile.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_multi_binaryfile.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_multi_binaryfile.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/rec_multi_binaryfile.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_multi_binaryfile.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_multi_binaryfile.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_multi_binaryfile.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_multi_binaryfile.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="common" + > + <File + RelativePath="..\sb5_file\sb5_file.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_card.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_data.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_thread.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="header" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\sb5_file\sb5_file.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_card.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_data.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_thread.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_oswrap.h" + > + </File> + </Filter> + <File + RelativePath="rec_multi_binaryfile.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_binaryfile.vcxproj b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_binaryfile.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..9545b8cdfdd87cbbf23dff7cca2c7c65c7801ea7 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_binaryfile.vcxproj @@ -0,0 +1,269 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{C40034E2-2055-404E-90D0-725CF8C5AD86}</ProjectGuid> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rec_multi_binaryfile.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_multi_binaryfile.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_multi_binaryfile.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_multi_binaryfile.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rec_multi_binaryfile.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_multi_binaryfile.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_multi_binaryfile.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_multi_binaryfile.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rec_multi_binaryfile.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_multi_binaryfile.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_multi_binaryfile.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_multi_binaryfile.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rec_multi_binaryfile.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_multi_binaryfile.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_multi_binaryfile.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_multi_binaryfile.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="..\common\spcm_lib_card.cpp" /> + <ClCompile Include="..\common\spcm_lib_data.cpp" /> + <ClCompile Include="..\common\spcm_lib_thread.cpp" /> + <ClCompile Include="..\sb5_file\sb5_file.cpp" /> + <ClCompile Include="rec_fifo_multi_binaryfile.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\common\spcm_lib_card.h" /> + <ClInclude Include="..\common\spcm_lib_data.h" /> + <ClInclude Include="..\common\spcm_lib_thread.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + <ClInclude Include="..\sb5_file\sb5_file.h" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_binaryfile.vcxproj.filters b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_binaryfile.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..c795861fe5cd798947c0e2bde1bb52d072776a81 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_binaryfile.vcxproj.filters @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="common"> + <UniqueIdentifier>{ab092090-47a7-43a4-ab94-46ab3957011a}</UniqueIdentifier> + </Filter> + <Filter Include="header"> + <UniqueIdentifier>{e3e5496b-f028-47f2-a606-c6f6e82af063}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\sb5_file\sb5_file.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_card.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_data.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_thread.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="rec_fifo_multi_binaryfile.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\sb5_file\sb5_file.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_card.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_data.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_thread.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_oswrap.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib" /> + <Library Include="..\c_header\spcm_win64_msvcpp.lib" /> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_poll.cpp b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_poll.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6725d43fe030453b4a20a9b76239250bb6117f7d --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_poll.cpp @@ -0,0 +1,389 @@ +/* +************************************************************************** + +rec_multi_poll.cpp (c) Spectrum GmbH + +************************************************************************** + +Example for all SpcMDrv based acquisition cards with the option +Multiple Recording installed. + +Information about the different products and their drivers can be found +online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/platform-driver-and-series-differences + +Shows Multiple Recording data acquisition using fifo mode. If timestamp +is installed the corresponding timestamp values are also read +out and displayed. + +If Timestamp and BaseXIO are installed the BaseXIO lines are set to the +timestamp acquisition mode and are sampled on every trigger event. The +samples BaseXIO lines are also shown. + +Feel free to use this source for own projects and modify it in any kind. + +This example shows the polling of the status, no wait function is used + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_card.h" +#include "../common/spcm_lib_data.h" + +// ----- operating system dependent functions for thead, event and mutex handling ----- +#include "../common/ostools/spcm_oswrap.h" +#include "../common/ostools/spcm_ostools.h" + + +// ----- standard c include files ----- +#include <stdio.h> +#include <stdlib.h> + + + +/* +************************************************************************** +vDoCardSetup +************************************************************************** +*/ + +void vDoCardSetup (ST_SPCM_CARDINFO *pstCard, int32 lSegmentsize, int32 lPosttrigger, int32 lLoops) + { + int i; + + // Multiple Recording setup (1 channel to keep example simple) + bSpcMSetupModeRecFIFOMulti (pstCard, CHANNEL0, lSegmentsize, lPosttrigger, lLoops); + + // we try to set the samplerate to 1 MHz (M2i) or 20 MHz (M3i) on internal PLL, no clock output + // increase this to test the read-out-after-overrun + if (pstCard->bM2i) + bSpcMSetupClockPLL (pstCard, MEGA(1), false); + else if (pstCard->bM2p) + bSpcMSetupClockPLL (pstCard, MEGA(10), false); + else if (pstCard->bM3i || pstCard->bM4i || pstCard->bM5i) + bSpcMSetupClockPLL (pstCard, MEGA(20), false); + printf ("Sampling rate set to %.1lf MHz\n", (double) pstCard->llSetSamplerate / 1000000); + + // we set trigger to external positive edge, please connect the trigger line! + printf ("\n"); + printf ("*************************************************************************\n"); + printf ("* Using external trigger - please connect a signal to the trigger input *\n"); + printf ("* Example is best working with a 10 kHz Trigger signal *\n"); + printf ("*************************************************************************\n\n"); + bSpcMSetupTrigExternal (pstCard, SPC_TM_POS, false, 0); + + // type dependent card setup + switch (pstCard->eCardFunction) + { + + // analog acquisition card setup + case AnalogIn: + + // program all input channels to +/-1 V and 50 ohm termination (if it's available) + if (pstCard->bM2i || pstCard->bM2p) + { + for (i=0; i < pstCard->lMaxChannels; i++) + bSpcMSetupInputChannel (pstCard, i, 1000, true); + } + else + { + bool bTerm = true; + bool bACCoupling = false; + bool bBandwidthLimit = false; + for (i=0; i < pstCard->lMaxChannels; i++) + bSpcMSetupPathInputCh (pstCard, i, 0, 1000, 0, bTerm, bACCoupling, bBandwidthLimit); + } + break; + } + + + // if timestamp and basexio are installed we acquire the asynchronous inputs with the timestamps + if ((pstCard->lFeatureMap & SPCM_FEAT_TIMESTAMP) && (pstCard->lFeatureMap & SPCM_FEAT_BASEXIO)) + bSpcMSetupTimestamp (pstCard, SPC_TSMODE_STANDARD | SPC_TSCNT_INTERNAL | SPC_TSXIOACQ_ENABLE, 0); + + // set up the timestamp mode to standard if timestamp is installed + else if ((pstCard->lFeatureMap & SPCM_FEAT_TIMESTAMP) != 0) + bSpcMSetupTimestamp (pstCard, SPC_TSMODE_STANDARD | SPC_TSCNT_INTERNAL, 0); + + } + + + +/* +************************************************************************** +nShowData +************************************************************************** +*/ + +int16 nShowData (ST_SPCM_CARDINFO *pstCard, int32 lDataAvailBytes, void* pvDataCurrentBuf) + { + + // add your data processing here + printf ("Data Buffer Ready: %d Bytes\n", lDataAvailBytes); + + return ERR_OK; + } + + + +/* +************************************************************************** +nShowTimestamps +************************************************************************** +*/ + +int16 nShowTimestamps (ST_SPCM_CARDINFO *pstCard, int32 lTSAvailBytes, uint64* pqwTSCurrentBuf) + { + + // add your timestamp processing here + printf ("Timestamp data ready: %d Bytes\n", lTSAvailBytes); + + return ERR_OK; + } + + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + char szBuffer[1024]; // a character buffer for any messages + ST_SPCM_CARDINFO stCard; // info structure of my card + int32 lDataBufLen, lDataNotify, lTSBufLen, lTSNotify; + int32 lAvailPos, lDataAvailBytes = 0, lTSAvailBytes = 0; + int32 lSegmentsize, lPosttrigger, lLoops; + int32 lOversampling = 1; + bool bTimestampInstalled, bBaseXIOInstalled; + uint64* pqwTSBuffer = NULL; + uint64* pqwTSCurrentBuf; + void* pvDataBuffer; + void* pvDataCurrentBuf; + int64 llDataTransferred = 0, llTSTransferred = 0; + uint32 dwErr; + bool bDataReady, bTimestampsReady, bReady = false; + + + + // ------------------------------------------------------------------------ + // init card number 0 (the first card in the system), get some information and print it + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + if (bSpcMInitCardByIdx (&stCard, 0)) + //if (bSpcMInitCardByIdx (&stCard, "192.168.1.10", 0)) + { + printf (pszSpcMPrintDocumentationLink (&stCard, szBuffer, sizeof (szBuffer))); + printf (pszSpcMPrintCardInfo (&stCard, szBuffer, sizeof (szBuffer))); + } + else + return nSpcMErrorMessageStdOut (&stCard, "Error: Could not open card\n", true); + + + // check whether we support this card type in the example + if (stCard.eCardFunction != AnalogIn) + return nSpcMErrorMessageStdOut (&stCard, "Error: Card function not supported by this example\n", false); + if ((stCard.lFeatureMap & SPCM_FEAT_MULTI) == 0) + return nSpcMErrorMessageStdOut (&stCard, "Error: Multiple Recording Option not installed. Examples was done especially for this option!\n", false); + + // if timestamp is installed we set a flag to support this mode in the example also + bTimestampInstalled = ((stCard.lFeatureMap & SPCM_FEAT_TIMESTAMP) != 0); + bBaseXIOInstalled = ((stCard.lFeatureMap & SPCM_FEAT_BASEXIO) != 0); + + + + // ------------------------------------------------------------------------ + // do the card setup, error is routed in the structure so we don't care for the return values + lDataBufLen = MEGA_B(1); + lDataNotify = KILO_B(4); + lTSBufLen = KILO_B(128); + lTSNotify = KILO_B(4); + lSegmentsize = KILO_B(4); + lPosttrigger = lSegmentsize / 2; + + lLoops = 0; // recording infinite number of segments + + if (!stCard.bSetError) + vDoCardSetup (&stCard, lSegmentsize, lPosttrigger, lLoops); + + + + // ------------------------------------------------------------------------ + // allocate memory buffer + if (!stCard.bSetError) + { + pvDataBuffer = pvAllocMemPageAligned (lDataBufLen); + if (bTimestampInstalled) + pqwTSBuffer = (uint64*)pvAllocMemPageAligned (lTSBufLen); + if (!pvDataBuffer || (bTimestampInstalled && !pqwTSBuffer)) + return nSpcMErrorMessageStdOut (&stCard, "Memory allocation error\n", false); + } + + + + // ------------------------------------------------------------------------ + // start the acquisition + + // if using timestamps we need to start the transfer before the card start to avoid an overrun of the timestamp memory + if (bTimestampInstalled) + { + printf ("Starting the timestamp DMA transfer\n"); + spcm_dwDefTransfer_i64 (stCard.hDrv, SPCM_BUF_TIMESTAMP, SPCM_DIR_CARDTOPC, lTSNotify, (void*) pqwTSBuffer, 0, lTSBufLen); + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_EXTRA_STARTDMA); + } + + // We'll define the buffer for data to start everything together + spcm_dwDefTransfer_i64 (stCard.hDrv, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, lDataNotify, pvDataBuffer, 0, lDataBufLen); + + printf ("Starting the card, the data transfer and poll\n"); + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_DATA_STARTDMA); + + + while (!bReady) + { + if (!stCard.bSetError) + { + printf ("\n"); + + // this is our status polling loop + int32 lOldStatus = 0, lStatus = 0; + int32 lOldTrigCount = 0, lTrigCount = 0; + + bTimestampsReady = false; + bDataReady = false; + do + { + dwErr = spcm_dwGetParam_i32 (stCard.hDrv, SPC_M2STATUS, &lStatus); + + // check for changed status and set flags + if (lOldStatus != lStatus) + { + printf ("Status: "); + if (lStatus & M2STAT_CARD_PRETRIGGER) + printf ("Armed "); + + if (lStatus & M2STAT_CARD_TRIGGER) + printf ("1stTrigger "); + + if (lStatus & M2STAT_CARD_READY) + { + printf ("CardReady "); + bReady = true; + } + + if (lStatus & M2STAT_DATA_BLOCKREADY) + { + printf ("DataReady "); + bDataReady = true; + } + + if (lStatus & M2STAT_EXTRA_BLOCKREADY) + { + printf ("TimestampReady "); + bTimestampsReady = true; + } + printf ("\n"); + } + + lOldStatus = lStatus; + + // check trigger count, available with firmware V10 (M2i) or V20 (M3i) +/* + if (!dwErr) + { + dwErr = spcm_dwGetParam_i32 (stCard.hDrv, SPC_TRIGGERCOUNTER, &lTrigCount); + if (lTrigCount != lOldTrigCount) + printf ("TrigCount = %d\n", lTrigCount); + lOldTrigCount = lTrigCount; + } +*/ + } + while (!dwErr && !(bReady || bTimestampsReady || bDataReady)); + + // check for error code + if (spcm_dwGetErrorInfo_i32 (stCard.hDrv, NULL, NULL, szBuffer)) + { + vFreeMemPageAligned (pvDataBuffer, lDataBufLen); + if (bTimestampInstalled) + vFreeMemPageAligned (pqwTSBuffer, lTSBufLen); + return nSpcMErrorMessageStdOut (&stCard, szBuffer, false); + } + + // process data and set dat aavailable again + if (bDataReady) + { + spcm_dwGetParam_i32 (stCard.hDrv, SPC_DATA_AVAIL_USER_LEN, &lDataAvailBytes); + spcm_dwGetParam_i32 (stCard.hDrv, SPC_DATA_AVAIL_USER_POS, &lAvailPos); + if ((lAvailPos + lDataAvailBytes) >= lDataBufLen) + lDataAvailBytes = (uint32) (lDataBufLen - lAvailPos); + pvDataCurrentBuf = (void*) (((char*) pvDataBuffer) + lAvailPos); + llDataTransferred += lDataAvailBytes; + + nShowData (&stCard, lDataAvailBytes, pvDataCurrentBuf); + + dwErr = spcm_dwSetParam_i32 (stCard.hDrv, SPC_DATA_AVAIL_CARD_LEN, lDataAvailBytes); + } + + // process timestamps and set data aavailable again + if (bTimestampsReady && bTimestampInstalled) + { + spcm_dwGetParam_i32 (stCard.hDrv, SPC_TS_AVAIL_USER_LEN, &lTSAvailBytes); + spcm_dwGetParam_i32 (stCard.hDrv, SPC_TS_AVAIL_USER_POS, &lAvailPos); + + // align available bytes to full timestamps + if (stCard.bM4i || stCard.bM2p || stCard.bM5i) + lTSAvailBytes &= 0xFFFFFFF0; // 16 byte per stamp + else + lTSAvailBytes &= 0xFFFFFFF8; // 8 byte per stamp + + if ((lAvailPos + lTSAvailBytes) >= lTSBufLen) + lTSAvailBytes = (uint32) (lTSBufLen - lAvailPos); + pqwTSCurrentBuf = (uint64*) (((char*) pqwTSBuffer) + lAvailPos); + llTSTransferred += lTSAvailBytes; + + nShowTimestamps (&stCard, lTSAvailBytes, pqwTSCurrentBuf); + + dwErr = spcm_dwSetParam_i32 (stCard.hDrv, SPC_TS_AVAIL_CARD_LEN, lTSAvailBytes); + } + } + + if (bKbhit ()) + { + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_STOP); + cGetch(); + } + } + + + // ------------------------------------------------------------------------ + // print error information if an error occured + if (stCard.bSetError) + return nSpcMErrorMessageStdOut (&stCard, "An error occured while programming the card:\n", true); + + + // clean up and close the driver + vSpcMCloseCard (&stCard); + vFreeMemPageAligned (pvDataBuffer, lDataBufLen); + if (bTimestampInstalled) + vFreeMemPageAligned (pqwTSBuffer, lTSBufLen); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_poll.dsp b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_poll.dsp new file mode 100644 index 0000000000000000000000000000000000000000..88fd261aa66a1cf857025def645bc60838b3c14b --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_poll.dsp @@ -0,0 +1,140 @@ +# Microsoft Developer Studio Project File - Name="rec_multi_poll" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=rec_multi_poll - 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 "rec_multi_poll.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 "rec_multi_poll.mak" CFG="rec_multi_poll - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "rec_multi_poll - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "rec_multi_poll - 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)" == "rec_multi_poll - 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 /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)" == "rec_multi_poll - 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 /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 "rec_multi_poll - Win32 Release" +# Name "rec_multi_poll - Win32 Debug" +# Begin Group "common" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\common\spcm_lib_card.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_ostools_win.cpp +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_win32_msvcpp.lib +# End Source File +# End Group +# Begin Group "header" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\c_header\dlltyp.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\regs.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcerr.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_drv.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_card.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.h +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_ostools.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\rec_multi_poll.cpp +# End Source File +# End Target +# End Project diff --git a/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_poll.vcproj b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_poll.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..b49036466b47b154dd3e3439e14ef9b7bee51f24 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_poll.vcproj @@ -0,0 +1,606 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="rec_multi_poll" + ProjectGUID="{EAE5880B-0B91-4E5C-8B9E-DFD554FDECFF}" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/rec_multi_poll.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_multi_poll.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_multi_poll.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_multi_poll.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_multi_poll.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/rec_multi_poll.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_multi_poll.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_multi_poll.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_multi_poll.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_multi_poll.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/rec_multi_poll.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_multi_poll.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_multi_poll.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_multi_poll.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_multi_poll.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/rec_multi_poll.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_multi_poll.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_multi_poll.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_multi_poll.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_multi_poll.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="common" + > + <File + RelativePath="..\common\spcm_lib_card.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_data.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="header" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_card.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_data.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + </Filter> + <File + RelativePath="rec_multi_poll.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_poll.vcxproj b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_poll.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..17b96a8e53bc3eeacff59aecaf9f4d773aec2014 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_poll.vcxproj @@ -0,0 +1,264 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{EAE5880B-0B91-4E5C-8B9E-DFD554FDECFF}</ProjectGuid> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rec_multi_poll.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_multi_poll.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_multi_poll.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_multi_poll.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rec_multi_poll.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_multi_poll.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_multi_poll.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_multi_poll.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rec_multi_poll.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_multi_poll.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_multi_poll.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_multi_poll.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rec_multi_poll.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_multi_poll.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_multi_poll.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_multi_poll.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="..\common\spcm_lib_card.cpp" /> + <ClCompile Include="..\common\spcm_lib_data.cpp" /> + <ClCompile Include="rec_fifo_multi_poll.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\spcm_lib_card.h" /> + <ClInclude Include="..\common\spcm_lib_data.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_poll.vcxproj.filters b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_poll.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..066a6a805217b9eac889affd26beeceb8c85bd96 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_multi/rec_fifo_multi_poll.vcxproj.filters @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="common"> + <UniqueIdentifier>{bfd51133-482d-48d9-ada6-5dd1a5886aa2}</UniqueIdentifier> + </Filter> + <Filter Include="header"> + <UniqueIdentifier>{a8e8b2e6-c284-417a-9dad-a5ee0ac250a5}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\spcm_lib_card.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_data.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="rec_fifo_multi_poll.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_card.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_data.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib" /> + <Library Include="..\c_header\spcm_win64_msvcpp.lib" /> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_single/makefile.asciifile b/Cpp/examples/c_cpp/rec_fifo_single/makefile.asciifile new file mode 100644 index 0000000000000000000000000000000000000000..62a2e114f4a4fc5f5989a72ef7f6fd8c1449bc8d --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/makefile.asciifile @@ -0,0 +1,25 @@ +COMPILER = g++ +EXECUTABLE = rec_single_asciifile +LIBS += -lspcm_linux -lpthread -lrt + +OBJECTS = \ + rec_single_asciifile.o\ + ../common/spcm_lib_card.o\ + ../common/spcm_lib_data.o\ + ../common/spcm_lib_thread.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/rec_fifo_single/makefile.average b/Cpp/examples/c_cpp/rec_fifo_single/makefile.average new file mode 100644 index 0000000000000000000000000000000000000000..de51f2f3e00bbea907ac5b8d3c38577b7b4fe3be --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/makefile.average @@ -0,0 +1,25 @@ +COMPILER = g++ +EXECUTABLE = rec_single_average +LIBS += -lspcm_linux -lpthread -lrt + +OBJECTS = \ + rec_single_average.o\ + ../common/spcm_lib_card.o\ + ../common/spcm_lib_data.o\ + ../common/spcm_lib_thread.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/rec_fifo_single/makefile.binaryfile b/Cpp/examples/c_cpp/rec_fifo_single/makefile.binaryfile new file mode 100644 index 0000000000000000000000000000000000000000..ddf70cb1783a8a570230edd6963cbb9d7b8af972 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/makefile.binaryfile @@ -0,0 +1,26 @@ +COMPILER = g++ +EXECUTABLE = rec_single_binaryfile +LIBS += -lspcm_linux -lpthread -lrt + +OBJECTS = \ + rec_single_binaryfile.o\ + ../common/spcm_lib_card.o\ + ../common/spcm_lib_data.o\ + ../common/spcm_lib_thread.o\ + ../sb5_file/sb5_file.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/rec_fifo_single/makefile.poll b/Cpp/examples/c_cpp/rec_fifo_single/makefile.poll new file mode 100644 index 0000000000000000000000000000000000000000..57a6a8c9739c8d7143df4f58e6299f2e68ab6c29 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/makefile.poll @@ -0,0 +1,24 @@ +COMPILER = g++ +EXECUTABLE = rec_fifo_single_poll +LIBS += -lspcm_linux -lpthread -lrt + +OBJECTS = \ + rec_fifo_single_poll.o\ + ../common/spcm_lib_card.o\ + ../common/spcm_lib_data.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_fifo_single.bpg b/Cpp/examples/c_cpp/rec_fifo_single/rec_fifo_single.bpg new file mode 100644 index 0000000000000000000000000000000000000000..5579f6bc401524eb4fa092f39a0741c820d27bd1 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_fifo_single.bpg @@ -0,0 +1,30 @@ +#------------------------------------------------------------------------------ +VERSION = BWS.01 +#------------------------------------------------------------------------------ +!ifndef ROOT +ROOT = $(MAKEDIR)\.. +!endif +#------------------------------------------------------------------------------ +MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$** +DCC = $(ROOT)\bin\dcc32.exe $** +BRCC = $(ROOT)\bin\brcc32.exe $** +#------------------------------------------------------------------------------ +PROJECTS = rec_single_binaryfile.exe rec_single_average.exe \ + rec_single_asciifile.exe +#------------------------------------------------------------------------------ +default: $(PROJECTS) +#------------------------------------------------------------------------------ + +rec_single_binaryfile.exe: rec_single_binaryfile.bpr + $(ROOT)\bin\bpr2mak $** + $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak + +rec_single_average.exe: rec_single_average.bpr + $(ROOT)\bin\bpr2mak $** + $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak + +rec_single_asciifile.exe: rec_single_asciifile.bpr + $(ROOT)\bin\bpr2mak $** + $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak + + diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_fifo_single.dsw b/Cpp/examples/c_cpp/rec_fifo_single/rec_fifo_single.dsw new file mode 100644 index 0000000000000000000000000000000000000000..9043d8a2f9ba689d596c2ab2e7a47ce71052819d --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_fifo_single.dsw @@ -0,0 +1,65 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "rec_fifo_single_poll"=.\rec_fifo_single_poll.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "rec_single_asciifile"=.\rec_single_asciifile.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "rec_single_average"=.\rec_single_average.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "rec_single_binaryfile"=.\rec_single_binaryfile.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_fifo_single.sln b/Cpp/examples/c_cpp/rec_fifo_single/rec_fifo_single.sln new file mode 100644 index 0000000000000000000000000000000000000000..665009adb5e2d979618035cabec13ee3e56e64e3 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_fifo_single.sln @@ -0,0 +1,56 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rec_fifo_single_poll", "rec_fifo_single_poll.vcproj", "{E10A3A9A-ED50-4E21-8503-F9E0E9B235B7}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rec_single_asciifile", "rec_single_asciifile.vcproj", "{31B6AF2E-BF61-45BB-AE0E-D819DE443AE2}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rec_single_average", "rec_single_average.vcproj", "{C7E8D563-BF2C-4AEA-98A5-EFADA43EE6EB}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rec_single_binaryfile", "rec_single_binaryfile.vcproj", "{7E25D4B9-F5D6-4D15-9BC1-0FD1158BC807}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E10A3A9A-ED50-4E21-8503-F9E0E9B235B7}.Debug|Win32.ActiveCfg = Debug|Win32 + {E10A3A9A-ED50-4E21-8503-F9E0E9B235B7}.Debug|Win32.Build.0 = Debug|Win32 + {E10A3A9A-ED50-4E21-8503-F9E0E9B235B7}.Debug|x64.ActiveCfg = Debug|x64 + {E10A3A9A-ED50-4E21-8503-F9E0E9B235B7}.Debug|x64.Build.0 = Debug|x64 + {E10A3A9A-ED50-4E21-8503-F9E0E9B235B7}.Release|Win32.ActiveCfg = Release|Win32 + {E10A3A9A-ED50-4E21-8503-F9E0E9B235B7}.Release|Win32.Build.0 = Release|Win32 + {E10A3A9A-ED50-4E21-8503-F9E0E9B235B7}.Release|x64.ActiveCfg = Release|x64 + {E10A3A9A-ED50-4E21-8503-F9E0E9B235B7}.Release|x64.Build.0 = Release|x64 + {31B6AF2E-BF61-45BB-AE0E-D819DE443AE2}.Debug|Win32.ActiveCfg = Debug|Win32 + {31B6AF2E-BF61-45BB-AE0E-D819DE443AE2}.Debug|Win32.Build.0 = Debug|Win32 + {31B6AF2E-BF61-45BB-AE0E-D819DE443AE2}.Debug|x64.ActiveCfg = Debug|x64 + {31B6AF2E-BF61-45BB-AE0E-D819DE443AE2}.Debug|x64.Build.0 = Debug|x64 + {31B6AF2E-BF61-45BB-AE0E-D819DE443AE2}.Release|Win32.ActiveCfg = Release|Win32 + {31B6AF2E-BF61-45BB-AE0E-D819DE443AE2}.Release|Win32.Build.0 = Release|Win32 + {31B6AF2E-BF61-45BB-AE0E-D819DE443AE2}.Release|x64.ActiveCfg = Release|x64 + {31B6AF2E-BF61-45BB-AE0E-D819DE443AE2}.Release|x64.Build.0 = Release|x64 + {C7E8D563-BF2C-4AEA-98A5-EFADA43EE6EB}.Debug|Win32.ActiveCfg = Debug|Win32 + {C7E8D563-BF2C-4AEA-98A5-EFADA43EE6EB}.Debug|Win32.Build.0 = Debug|Win32 + {C7E8D563-BF2C-4AEA-98A5-EFADA43EE6EB}.Debug|x64.ActiveCfg = Debug|x64 + {C7E8D563-BF2C-4AEA-98A5-EFADA43EE6EB}.Debug|x64.Build.0 = Debug|x64 + {C7E8D563-BF2C-4AEA-98A5-EFADA43EE6EB}.Release|Win32.ActiveCfg = Release|Win32 + {C7E8D563-BF2C-4AEA-98A5-EFADA43EE6EB}.Release|Win32.Build.0 = Release|Win32 + {C7E8D563-BF2C-4AEA-98A5-EFADA43EE6EB}.Release|x64.ActiveCfg = Release|x64 + {C7E8D563-BF2C-4AEA-98A5-EFADA43EE6EB}.Release|x64.Build.0 = Release|x64 + {7E25D4B9-F5D6-4D15-9BC1-0FD1158BC807}.Debug|Win32.ActiveCfg = Debug|Win32 + {7E25D4B9-F5D6-4D15-9BC1-0FD1158BC807}.Debug|Win32.Build.0 = Debug|Win32 + {7E25D4B9-F5D6-4D15-9BC1-0FD1158BC807}.Debug|x64.ActiveCfg = Debug|x64 + {7E25D4B9-F5D6-4D15-9BC1-0FD1158BC807}.Debug|x64.Build.0 = Debug|x64 + {7E25D4B9-F5D6-4D15-9BC1-0FD1158BC807}.Release|Win32.ActiveCfg = Release|Win32 + {7E25D4B9-F5D6-4D15-9BC1-0FD1158BC807}.Release|Win32.Build.0 = Release|Win32 + {7E25D4B9-F5D6-4D15-9BC1-0FD1158BC807}.Release|x64.ActiveCfg = Release|x64 + {7E25D4B9-F5D6-4D15-9BC1-0FD1158BC807}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_fifo_single_poll.cpp b/Cpp/examples/c_cpp/rec_fifo_single/rec_fifo_single_poll.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9b584bec5fd68289723551e9674754429f7b22b2 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_fifo_single_poll.cpp @@ -0,0 +1,249 @@ +/* +************************************************************************** + +rec_fifo_single_poll.cpp (c) Spectrum GmbH + +************************************************************************** + +Example for all SpcMDrv based analog and digital acquisition cards. + +Information about the different products and their drivers can be found +online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/platform-driver-and-series-differences + +Shows FIFO acquisitition. + +This example doesn't use interrupt mode but shows status polling. Be +aware that this of course uses complete CPU time just for polling data. + +This example also shows how to read out the remaining data from the on-board +memory in case that an overung has occurred. + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + + +// ----- standard c include files ----- +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <math.h> + + + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_card.h" +#include "../common/spcm_lib_data.h" +#include "../common/ostools/spcm_oswrap.h" +#include "../common/ostools/spcm_ostools.h" + + + +/* +************************************************************************** +bDoCardSetup: setup of acquisition card +************************************************************************** +*/ + +bool bDoCardSetup (ST_SPCM_CARDINFO *pstCard) + { + int i; + + // we try to set the samplerate to 1 MHz (M2i) or 20 MHz (M3i, M4i) on internal PLL, no clock output + // increase this to test the read-out-after-overrun + if (pstCard->bM2i) + bSpcMSetupClockPLL (pstCard, MEGA(1), false); + else if (pstCard->bM2p) + bSpcMSetupClockPLL (pstCard, MEGA(10), false); + else if (pstCard->bM3i || pstCard->bM4i || pstCard->bM5i) + bSpcMSetupClockPLL (pstCard, MEGA(20), false); + + printf ("Sampling rate set to %.1lf MHz\n", (double) pstCard->llSetSamplerate / 1000000); + + // we set software trigger, no trigger output + bSpcMSetupTrigSoftware (pstCard, false); + + // type dependent card setup + switch (pstCard->eCardFunction) + { + case AnalogIn: + + // program all input channels to +/-1 V and 50 ohm termination (if it's available) + if (pstCard->bM2i || pstCard->bM2p) + { + for (i=0; i < pstCard->lMaxChannels; i++) + bSpcMSetupInputChannel (pstCard, i, 1000, true); + } + else + { + bool bTerm = true; + bool bACCoupling = false; + bool bBandwidthLimit = false; + for (i=0; i < pstCard->lMaxChannels; i++) + bSpcMSetupPathInputCh (pstCard, i, 0, 1000, 0, bTerm, bACCoupling, bBandwidthLimit); + } + + // FIFO mode setup, we run continuously + // all channels are activated + bSpcMSetupModeRecFIFOSingle (pstCard, (1 << pstCard->lMaxChannels) - 1, 32); + break; + + case DigitalIn: + case DigitalIO: + + // FIFO mode setup, we run continuously, 16 channels activated + bSpcMSetupModeRecFIFOSingle (pstCard, 0xffff, 4); + break; + } + + return pstCard->bSetError; + } + + + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + char szBuffer[1024]; // a character buffer for any messages + ST_SPCM_CARDINFO stCard; // info structure of my card + void* pvBuffer = NULL; + uint32 dwErr; + + // setup for the FIFO mode + int64 llSWBufSize = KILO_B(512); + int64 llNotifySize = KILO_B(64); + + + + // ------------------------------------------------------------------------ + // init card number 0 (the first card in the system), get some information and print it + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + if (bSpcMInitCardByIdx (&stCard, 0)) + //if (bSpcMInitCardByIdx (&stCard, "192.168.1.10", 0)) + { + printf (pszSpcMPrintDocumentationLink (&stCard, szBuffer, sizeof (szBuffer))); + printf (pszSpcMPrintCardInfo (&stCard, szBuffer, sizeof (szBuffer))); + } + else + return nSpcMErrorMessageStdOut (&stCard, "Error: Could not open card\n", true); + + + // check whether we support this card type in the example + if ((stCard.eCardFunction != AnalogIn) && (stCard.eCardFunction != DigitalIn) && (stCard.eCardFunction != DigitalIO)) + return nSpcMErrorMessageStdOut (&stCard, "Error: Card function not supported by this example\n", false); + + + + // ------------------------------------------------------------------------ + // do the card setup, error is routed in the structure so we don't care for the return values + if (!stCard.bSetError) + bDoCardSetup (&stCard); + + + + // ------------------------------------------------------------------------ + // allocate and setup the fifo buffer + pvBuffer = pvAllocMemPageAligned ((uint32) llSWBufSize); + if (!pvBuffer) + return nSpcMErrorMessageStdOut (&stCard, "Memory allocation error\n", false); + spcm_dwDefTransfer_i64 (stCard.hDrv, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, (uint32) llNotifySize, pvBuffer, 0, llSWBufSize); + + // we now start everything + if (!stCard.bSetError) + dwErr = spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_DATA_STARTDMA); + + + + // ------------------------------------------------------------------------ + // this is our main polling loop + printf ("\n\n"); + if (!stCard.bSetError) + { + int64 llTransferredBytes = 0; + int64 llAvailUser; + int64 llBufferFillPromille; + int32 lStatus; + + // we loop as long as everthing is ok or an overrun has occurred + while ((dwErr == ERR_OK) || (dwErr == ERR_FIFOHWOVERRUN)) + { + + // check status and fill size of buffers + if (!dwErr) dwErr = spcm_dwGetParam_i32 (stCard.hDrv, SPC_M2STATUS, &lStatus); + if (!dwErr) dwErr = spcm_dwGetParam_i64 (stCard.hDrv, SPC_DATA_AVAIL_USER_LEN, &llAvailUser); + if (!dwErr) dwErr = spcm_dwGetParam_i64 (stCard.hDrv, SPC_FILLSIZEPROMILLE, &llBufferFillPromille); + + // give some status messages + printf("\r["); + if (lStatus & M2STAT_CARD_PRETRIGGER) printf (" Pre"); else printf (" "); + if (lStatus & M2STAT_CARD_TRIGGER) printf (" Trg"); else printf (" "); + if (lStatus & M2STAT_CARD_TRIGGER) printf (" Rdy"); else printf (" "); + if (lStatus & M2STAT_DATA_BLOCKREADY) printf (" DBlk"); else printf (" "); + if (lStatus & M2STAT_DATA_END) printf (" DEnd"); else printf (" "); + if (lStatus & M2STAT_DATA_OVERRUN) printf (" DOvr"); else printf (" "); + printf ("] "); + + // some data has been transferred + if (llAvailUser > 0) + { + llTransferredBytes += llAvailUser; + + // this is the point to do something with the data, we simple give a message here + printf ("Avail:%6dkB SW:%3.0f%% HW:%3d%% Total:%6.2fMB", (int32) (llAvailUser / KILO_B(1)), (float) 100.0 * llAvailUser / llSWBufSize, (uint32) llBufferFillPromille / 10, (float) llTransferredBytes / MEGA_B(1)); + + // set the data free for FIFO mode again + dwErr = spcm_dwSetParam_i64 (stCard.hDrv, SPC_DATA_AVAIL_CARD_LEN, llAvailUser); + } + + // check for data end, being emerged after an overrun and all the remaining data has been read out + // the loop continues after the overrun to get all data that is still in the on-board memory + if (lStatus & M2STAT_DATA_END) + { + dwErr = ERR_ABORT; + printf ("\nOverrun and all remaining data has been read out, we quit now!\n"); + } + + // check for esc=abort + if (!dwErr) + if (bKbhit()) + if (cGetch() == 27) + { + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_STOP); + dwErr = ERR_ABORT; + printf ("\n\n"); + } + } + } + + + + // ------------------------------------------------------------------------ + // print error information if an error occured + if (stCard.bSetError) + return nSpcMErrorMessageStdOut (&stCard, "An error occured while programming the card:\n", true); + + + // clean up and close the driver + vSpcMCloseCard (&stCard); + + printf ("\n\n"); + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_fifo_single_poll.dsp b/Cpp/examples/c_cpp/rec_fifo_single/rec_fifo_single_poll.dsp new file mode 100644 index 0000000000000000000000000000000000000000..cfe308941809666aacece3d8bbc0cc8a35f684b3 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_fifo_single_poll.dsp @@ -0,0 +1,148 @@ +# Microsoft Developer Studio Project File - Name="rec_fifo_single_poll" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=rec_fifo_single_poll - 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 "rec_fifo_single_poll.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 "rec_fifo_single_poll.mak" CFG="rec_fifo_single_poll - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "rec_fifo_single_poll - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "rec_fifo_single_poll - 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)" == "rec_fifo_single_poll - 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 /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)" == "rec_fifo_single_poll - 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 /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 "rec_fifo_single_poll - Win32 Release" +# Name "rec_fifo_single_poll - Win32 Debug" +# Begin Group "common" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\common\spcm_lib_card.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_ostools_win.cpp +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_win32_msvcpp.lib +# End Source File +# End Group +# Begin Group "header" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\c_header\dlltyp.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\regs.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcerr.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_drv.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_card.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_thread.h +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_ostools.h +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_oswrap.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\rec_fifo_single_poll.cpp +# End Source File +# End Target +# End Project diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_fifo_single_poll.vcproj b/Cpp/examples/c_cpp/rec_fifo_single/rec_fifo_single_poll.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..6aa60f95ab77358f085cb16511bfaf9155c6f138 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_fifo_single_poll.vcproj @@ -0,0 +1,583 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="rec_fifo_single_poll" + ProjectGUID="{E10A3A9A-ED50-4E21-8503-F9E0E9B235B7}" + RootNamespace="rec_single_asciifile" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/rec_single_asciifile.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_single_asciifile.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_fifo_single_poll.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_single_asciifile.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_single_asciifile.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/rec_single_asciifile.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_single_asciifile.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_fifo_single_poll.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_single_asciifile.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_single_asciifile.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/rec_single_asciifile.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_single_asciifile.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_fifo_single_poll.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_single_asciifile.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_single_asciifile.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/rec_single_asciifile.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_single_asciifile.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_fifo_single_poll.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_single_asciifile.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_single_asciifile.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="common" + > + <File + RelativePath="..\common\spcm_lib_card.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_data.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="header" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_card.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_data.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_thread.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_oswrap.h" + > + </File> + </Filter> + <File + RelativePath=".\rec_fifo_single_poll.cpp" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_fifo_single_poll.vcxproj b/Cpp/examples/c_cpp/rec_fifo_single/rec_fifo_single_poll.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..14ab833b52eb061b966b569f8bc788d11cd2676e --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_fifo_single_poll.vcxproj @@ -0,0 +1,267 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{E10A3A9A-ED50-4E21-8503-F9E0E9B235B7}</ProjectGuid> + <RootNamespace>rec_single_asciifile</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rec_single_asciifile.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_single_asciifile.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_single_asciifile.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_single_asciifile.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rec_single_asciifile.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_single_asciifile.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_single_asciifile.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_single_asciifile.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rec_single_asciifile.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_single_asciifile.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_single_asciifile.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_single_asciifile.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rec_single_asciifile.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_single_asciifile.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_single_asciifile.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_single_asciifile.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="..\common\spcm_lib_card.cpp" /> + <ClCompile Include="..\common\spcm_lib_data.cpp" /> + <ClCompile Include="rec_fifo_single_poll.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\common\spcm_lib_card.h" /> + <ClInclude Include="..\common\spcm_lib_data.h" /> + <ClInclude Include="..\common\spcm_lib_thread.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_fifo_single_poll.vcxproj.filters b/Cpp/examples/c_cpp/rec_fifo_single/rec_fifo_single_poll.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..7667e410357d4b59bbfded5b6614765dcd49bf37 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_fifo_single_poll.vcxproj.filters @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="common"> + <UniqueIdentifier>{b704dd05-10eb-49b4-adc7-ae1b96ff8707}</UniqueIdentifier> + </Filter> + <Filter Include="header"> + <UniqueIdentifier>{8d7f60fe-e68d-40f9-8263-815d21d5f962}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\spcm_lib_card.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_data.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="rec_fifo_single_poll.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_card.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_data.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_thread.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_oswrap.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_single_asciifile.bpf b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_asciifile.bpf new file mode 100644 index 0000000000000000000000000000000000000000..5da88241fe8e80944de42def849bf4eab8f1f666 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_asciifile.bpf @@ -0,0 +1,3 @@ +This file is used by the project manager only and should be treated like the project file + + main \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_single_asciifile.bpr b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_asciifile.bpr new file mode 100644 index 0000000000000000000000000000000000000000..356c468edaa4016529818e21abcc8b545a67b2b6 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_asciifile.bpr @@ -0,0 +1,107 @@ +<?xml version='1.0' encoding='utf-8' ?> +<!-- C++Builder XML Project --> +<PROJECT> + <MACROS> + <VERSION value="BCB.06.00"/> + <PROJECT value="rec_single_asciifile.exe"/> + <OBJFILES value="..\common\spcm_lib_thread.obj ..\common\spcm_lib_card.obj + ..\common\spcm_lib_data.obj ..\common\ostools\spcm_ostools_win.obj + rec_single_asciifile.obj ..\sb5_file\sb5_file.obj"/> + <RESFILES value=""/> + <DEFFILE value=""/> + <RESDEPEN value="$(RESFILES)"/> + <LIBFILES value="..\c_header\spcm_win32_bcppb.lib"/> + <LIBRARIES value=""/> + <SPARELIBS value=""/> + <PACKAGES value="vcl.bpi rtl.bpi vclx.bpi bcbsmp.bpi dclocx.bpi"/> + <PATHCPP value=".;..\common;..\common;..\common;..\common\ostools;..\sb5_file"/> + <PATHPAS value=".;"/> + <PATHRC value=".;"/> + <PATHASM value=".;"/> + <DEBUGLIBPATH value="$(BCB)\lib\debug"/> + <RELEASELIBPATH value="$(BCB)\lib\release"/> + <LINKER value="ilink32"/> + <USERDEFINES value="_DEBUG"/> + <SYSDEFINES value="NO_STRICT;_NO_VCL;_RTLDLL;USEPACKAGES"/> + <MAINSOURCE value="rec_single_asciifile.bpf"/> + <INCLUDEPATH value="..\sb5_file;C:\svnwork\spcm_drv_c\common\ostools;C:\svnwork\spcm_drv_c\common;C:\svnwork\spcm_drv_c\rec_fifo_single;$(BCB)\include;$(BCB)\include\vcl"/> + <LIBPATH value="..\sb5_file;C:\svnwork\spcm_drv_c\common\ostools;C:\svnwork\spcm_drv_c\common;C:\svnwork\spcm_drv_c\rec_fifo_single;$(BCB)\lib\obj;$(BCB)\lib"/> + <WARNINGS value="-w-par"/> + <OTHERFILES value=""/> + </MACROS> + <OPTIONS> + <CFLAG1 value="-tWC -tWM -Od -H=$(BCB)\lib\vcl60.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v + -vi- -c"/> + <PFLAGS value="-$YD -$W -$O- -$A8 -v -JPHNE -M"/> + <RFLAGS value=""/> + <AFLAGS value="/mx /w2 /zd"/> + <LFLAGS value="-Tpe -ap -D"" -x -Gn -v"/> + <OTHERFILES value=""/> + </OPTIONS> + <LINKER> + <ALLOBJ value="c0x32.obj $(PACKAGES) $(OBJFILES)"/> + <ALLRES value="$(RESFILES)"/> + <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib"/> + <OTHERFILES value=""/> + </LINKER> + <FILELIST> + <FILE FILENAME="rec_single_asciifile.bpf" FORMNAME="" UNITNAME="rec_single_asciifile" CONTAINERID="BPF" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_thread.cpp" FORMNAME="" UNITNAME="spcm_lib_thread.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_card.cpp" FORMNAME="" UNITNAME="spcm_lib_card.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_data.cpp" FORMNAME="" UNITNAME="spcm_lib_data.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\c_header\spcm_win32_bcppb.lib" FORMNAME="" UNITNAME="spcm_win32_bcppb.lib" CONTAINERID="LibTool" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\ostools\spcm_ostools_win.cpp" FORMNAME="" UNITNAME="spcm_ostools_win" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="rec_single_asciifile.cpp" FORMNAME="" UNITNAME="rec_single_asciifile" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\sb5_file\sb5_file.cpp" FORMNAME="" UNITNAME="sb5_file" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + </FILELIST> + <BUILDTOOLS> + </BUILDTOOLS> + + <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= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +[Parameters] +RunParams= +Launcher= +UseLauncher=0 +DebugCWD= +HostApplication= +RemoteHost= +RemotePath= +RemoteLauncher= +RemoteCWD= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 + </IDEOPTIONS> +</PROJECT> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_single_asciifile.cpp b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_asciifile.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f04558833de64c8084f5a43f2b70b4f52ccc3d56 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_asciifile.cpp @@ -0,0 +1,308 @@ +/* +************************************************************************** + +rec_single_ascii.cpp (c) Spectrum GmbH + +************************************************************************** + +Does a continous FIFO transfer and writes data as hex to an ascii file + +Change the global flag g_bThread to use the threaded version or the plain +and more simple loop. + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_card.h" +#include "../common/spcm_lib_data.h" +#include "../common/spcm_lib_thread.h" + +// ----- standard c include files ----- +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + + +// ----- this is the global thread flag that defines whether we use the thread or non-thread loop ----- +bool g_bThread = false; + + +/* +************************************************************************** +bDoCardSetup: setup matching the calculation routine +************************************************************************** +*/ + +bool bDoCardSetup (ST_SPCM_CARDINFO *pstCard) + { + int i; + int64 llChannelMask; + + // set mask for maximal channels + if (pstCard->lMaxChannels >= 64) + llChannelMask = -1; // -1 is all bits set to 1 = 0xffffffffffffffff + else + llChannelMask = ((int64) 1 << pstCard->lMaxChannels) - 1; + + // FIFO mode setup, we run continuously and have 32 samples of pre data before trigger event + // all available channels are activated + bSpcMSetupModeRecFIFOSingle (pstCard, llChannelMask, 32); + + // we try to set the samplerate to 1 MHz (M2i) or 20 MHz (M3i, M4i) on internal PLL, no clock output + // increase this to test the read-out-after-overrun + if (pstCard->bM2i) + bSpcMSetupClockPLL (pstCard, MEGA(1), false); + else if (pstCard->bM2p) + bSpcMSetupClockPLL (pstCard, MEGA(10), false); + else if (pstCard->bM3i || pstCard->bM4i || pstCard->bM5i) + bSpcMSetupClockPLL (pstCard, MEGA(20), false); + printf ("Sampling rate set to %.1lf MHz\n", (double) pstCard->llSetSamplerate / 1000000); + + // we set software trigger, no trigger output + bSpcMSetupTrigSoftware (pstCard, false); + + // type dependent card setup + switch (pstCard->eCardFunction) + { + + // analog acquisition card setup + case AnalogIn: + + // program all input channels to +/-1 V and 50 ohm termination (if it's available) + if (pstCard->bM2i || pstCard->bM2p) + { + for (i=0; i < pstCard->lMaxChannels; i++) + bSpcMSetupInputChannel (pstCard, i, 1000, true); + } + else + { + bool bTerm = true; + bool bACCoupling = false; + bool bBandwidthLimit = false; + for (i=0; i < pstCard->lMaxChannels; i++) + bSpcMSetupPathInputCh (pstCard, i, 0, 1000, 0, bTerm, bACCoupling, bBandwidthLimit); + } + break; + + // digital acquisition card setup + case DigitalIn: + case DigitalIO: + + // set all input channel groups to 110 ohm termination (if it's available) + for (i=0; i < pstCard->uCfg.stDIO.lGroups; i++) + bSpcMSetupDigitalInput (pstCard, i, true); + break; + } + + return pstCard->bSetError; + } + + + +#define FILENAME "FIFO_ascii_test.txt" + +/* +************************************************************************** +Working routine data +************************************************************************** +*/ + +struct ST_WORKDATA + { + FILE* hFile; + int64 llFileSize; + }; + + + +/* +************************************************************************** +Setup working routine +************************************************************************** +*/ + +bool bWorkInit (void* pvWorkData, ST_BUFFERDATA* pstBufferData) + { + ST_WORKDATA* pstWorkData = (ST_WORKDATA*) pvWorkData; + + // setup for the transfer, to avoid overrun we use quite large blocks as this has a better throughput to hard disk + pstBufferData->dwDataBufLen = MEGA_B(64); + pstBufferData->dwDataNotify = MEGA_B(1); + + // setup for the work + pstWorkData->hFile = fopen (FILENAME, "wt"); + pstWorkData->llFileSize = 0; + + return (pstWorkData->hFile != NULL); + } + + + +/* +************************************************************************** +bWorkDo: stores data to hard disk +************************************************************************** +*/ + +bool bWorkDo (void* pvWorkData, ST_BUFFERDATA* pstBufferData) + { + ST_WORKDATA* pstWorkData = (ST_WORKDATA*) pvWorkData; + int32 lChannels = pstBufferData->pstCard->lSetChannels; + int32 lSamples = pstBufferData->dwDataNotify / pstBufferData->pstCard->lBytesPerSample; + FILE* f = pstWorkData->hFile; + int32 lIndex; + + + // we only care for blocks of notify size + if (pstBufferData->llDataAvailBytes < pstBufferData->dwDataNotify) + return true; + + pstBufferData->llDataAvailBytes = pstBufferData->dwDataNotify; + + // we don't use the split data function as this takes too much time, Instead we go through data manually and write + // as this is an universal example we need two loops for 8 bit wide analog data and for 12, 14, 16 bit analog data + + // 1 byte data (8 bit resolution) + if (pstBufferData->pstCard->lBytesPerSample == 1) + { + int8* pbyData = (int8*) pstBufferData->pvDataCurrentBuf; + for (lIndex = 0; lIndex < lSamples; lIndex ++) + { + fprintf (f, "0x%02x ", *pbyData++ & 0xff); + if ((lIndex % lChannels) == (lChannels -1)) + fprintf (f, "\n"); + } + pstWorkData->llFileSize += 5 * lSamples + 2 * (lSamples / lChannels); + } + + // 2 byte data (12, 14 and 16 bit resolution) + else + { + int16* pnData = (int16*) pstBufferData->pvDataCurrentBuf; + for (lIndex = 0; lIndex < lSamples; lIndex ++) + { + fprintf (f, "0x%04x ", *pnData++ & 0xffff); + if ((lIndex % lChannels) == (lChannels -1)) + fprintf (f, "\n"); + } + pstWorkData->llFileSize += 7 * lSamples + 2 * (lSamples / lChannels); + } + + // announce the number of data that has been written + printf ("\r%.2f MSamples (sum) written to %s (file size: %.2f MB)", + (double) pstBufferData->qwDataTransferred / pstBufferData->pstCard->lBytesPerSample / 1024.0 / 1024.0, + FILENAME, + (double) pstWorkData->llFileSize / 1024 / 1024); + + + return true; + } + + + + +/* +************************************************************************** +vWorkClose: Close the work and clean up +************************************************************************** +*/ + +void vWorkClose (void* pvWorkData, ST_BUFFERDATA* pstBufferData) + { + ST_WORKDATA* pstWorkData = (ST_WORKDATA*) pvWorkData; + + if (pstWorkData->hFile) + fclose (pstWorkData->hFile); + } + + + + + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + char szBuffer[1024]; // a character buffer for any messages + ST_SPCM_CARDINFO stCard; // info structure of my card + ST_BUFFERDATA stBufferData; // buffer and transfer definitions + ST_WORKDATA stWorkData; // work data for the working functions + + + // ------------------------------------------------------------------------ + // init card number 0 (the first card in the system), get some information and print it + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + if (bSpcMInitCardByIdx (&stCard, 0)) + //if (bSpcMInitCardByIdx (&stCard, "192.168.1.10", 0)) + { + printf (pszSpcMPrintDocumentationLink (&stCard, szBuffer, sizeof (szBuffer))); + printf (pszSpcMPrintCardInfo (&stCard, szBuffer, sizeof (szBuffer))); + } + else + return nSpcMErrorMessageStdOut (&stCard, "Error: Could not open card\n", true); + + + // check whether we support this card type in the example + if ((stCard.eCardFunction != AnalogIn) && (stCard.eCardFunction != DigitalIn) && (stCard.eCardFunction != DigitalIO)) + return nSpcMErrorMessageStdOut (&stCard, "Error: Card function not supported by this example\n", false); + + + // ------------------------------------------------------------------------ + // do the card setup, error is routed in the structure so we don't care for the return values + if (!stCard.bSetError) + bDoCardSetup (&stCard); + + + // ------------------------------------------------------------------------ + // setup the data transfer thread and start it, we use atimeout of 5 s in the example + memset (&stBufferData, 0, sizeof(stBufferData)); + stBufferData.pstCard = &stCard; + stBufferData.bStartCard = true; + stBufferData.bStartData = true; + stBufferData.lTimeout = 5000; + + // start the threaded version if g_bThread is defined + if (!stCard.bSetError && g_bThread) + vDoThreadMainLoop (&stBufferData, &stWorkData, bWorkInit, bWorkDo, vWorkClose, bKeyAbortCheck); + + // start the unthreaded version with a smaller timeout of 100 ms to gain control about the FIFO loop + stBufferData.lTimeout = 100; + if (!stCard.bSetError && !g_bThread) + vDoMainLoop (&stBufferData, &stWorkData, bWorkInit, bWorkDo, vWorkClose, bKeyAbortCheck); + + + // ------------------------------------------------------------------------ + // print error information if an error occured + if (stCard.bSetError) + return nSpcMErrorMessageStdOut (&stCard, "An error occured while programming the card:\n", true); + + + // clean up and close the driver + vSpcMCloseCard (&stCard); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_single_asciifile.dsp b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_asciifile.dsp new file mode 100644 index 0000000000000000000000000000000000000000..176dc9d61a011c1ecac140185182b59aa2f86929 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_asciifile.dsp @@ -0,0 +1,152 @@ +# Microsoft Developer Studio Project File - Name="rec_single_asciifile" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=rec_single_asciifile - Win32 Debug +!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE +!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl +!MESSAGE +!MESSAGE NMAKE /f "rec_single_asciifile.mak". +!MESSAGE +!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben +!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: +!MESSAGE +!MESSAGE NMAKE /f "rec_single_asciifile.mak" CFG="rec_single_asciifile - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "rec_single_asciifile - Win32 Release" (basierend auf "Win32 (x86) Console Application") +!MESSAGE "rec_single_asciifile - Win32 Debug" (basierend auf "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "rec_single_asciifile - 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 /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)" == "rec_single_asciifile - 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 /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 "rec_single_asciifile - Win32 Release" +# Name "rec_single_asciifile - Win32 Debug" +# Begin Group "common" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\common\spcm_lib_card.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_thread.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_ostools_win.cpp +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_win32_msvcpp.lib +# End Source File +# End Group +# Begin Group "header" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\c_header\dlltyp.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\regs.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcerr.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_drv.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_card.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_thread.h +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_ostools.h +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_oswrap.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\rec_single_asciifile.cpp +# End Source File +# End Target +# End Project diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_single_asciifile.vcproj b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_asciifile.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..c04d090847c93b3e6fdc276f64add56eb87bc633 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_asciifile.vcproj @@ -0,0 +1,651 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="rec_single_asciifile" + ProjectGUID="{31B6AF2E-BF61-45BB-AE0E-D819DE443AE2}" + RootNamespace="rec_single_asciifile" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/rec_single_asciifile.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_single_asciifile.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_single_asciifile.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_single_asciifile.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_single_asciifile.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/rec_single_asciifile.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_single_asciifile.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_single_asciifile.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_single_asciifile.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_single_asciifile.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/rec_single_asciifile.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_single_asciifile.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_single_asciifile.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_single_asciifile.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_single_asciifile.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/rec_single_asciifile.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_single_asciifile.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_single_asciifile.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_single_asciifile.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_single_asciifile.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="common" + > + <File + RelativePath="..\common\spcm_lib_card.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_data.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_thread.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="header" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_card.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_data.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_thread.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_oswrap.h" + > + </File> + </Filter> + <File + RelativePath="rec_single_asciifile.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_single_asciifile.vcxproj b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_asciifile.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..7769b3669a5125de80b3d757152cb33e3b08584b --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_asciifile.vcxproj @@ -0,0 +1,268 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{31B6AF2E-BF61-45BB-AE0E-D819DE443AE2}</ProjectGuid> + <RootNamespace>rec_single_asciifile</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rec_single_asciifile.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_single_asciifile.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_single_asciifile.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_single_asciifile.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rec_single_asciifile.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_single_asciifile.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_single_asciifile.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_single_asciifile.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rec_single_asciifile.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_single_asciifile.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_single_asciifile.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_single_asciifile.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rec_single_asciifile.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_single_asciifile.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_single_asciifile.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_single_asciifile.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="..\common\spcm_lib_card.cpp" /> + <ClCompile Include="..\common\spcm_lib_data.cpp" /> + <ClCompile Include="..\common\spcm_lib_thread.cpp" /> + <ClCompile Include="rec_single_asciifile.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\common\spcm_lib_card.h" /> + <ClInclude Include="..\common\spcm_lib_data.h" /> + <ClInclude Include="..\common\spcm_lib_thread.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_single_asciifile.vcxproj.filters b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_asciifile.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..96a2f54c53312570c3fb458fa0913d4ce6bd8fec --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_asciifile.vcxproj.filters @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="common"> + <UniqueIdentifier>{8be6539f-d17c-4894-ab6e-fc5480546754}</UniqueIdentifier> + </Filter> + <Filter Include="header"> + <UniqueIdentifier>{c7f2c8dc-f7b3-4ae1-bb2f-3eb738aa4888}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\spcm_lib_card.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_data.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_thread.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="rec_single_asciifile.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_card.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_data.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_thread.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_oswrap.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_single_average.bpf b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_average.bpf new file mode 100644 index 0000000000000000000000000000000000000000..5da88241fe8e80944de42def849bf4eab8f1f666 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_average.bpf @@ -0,0 +1,3 @@ +This file is used by the project manager only and should be treated like the project file + + main \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_single_average.bpr b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_average.bpr new file mode 100644 index 0000000000000000000000000000000000000000..6f6e4669b8d4d0d767648e925af315cd71e1d39f --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_average.bpr @@ -0,0 +1,106 @@ +<?xml version='1.0' encoding='utf-8' ?> +<!-- C++Builder XML Project --> +<PROJECT> + <MACROS> + <VERSION value="BCB.06.00"/> + <PROJECT value="rec_single_average.exe"/> + <OBJFILES value="rec_single_average.obj ..\common\spcm_lib_thread.obj + ..\common\spcm_lib_card.obj ..\common\spcm_lib_data.obj + ..\common\ostools\spcm_ostools_win.obj"/> + <RESFILES value=""/> + <DEFFILE value=""/> + <RESDEPEN value="$(RESFILES)"/> + <LIBFILES value="..\c_header\spcm_win32_bcppb.lib"/> + <LIBRARIES value=""/> + <SPARELIBS value=""/> + <PACKAGES value="vcl.bpi rtl.bpi vclx.bpi bcbsmp.bpi dclocx.bpi"/> + <PATHCPP value=".;..\common;..\common;..\common;..\common\ostools"/> + <PATHPAS value=".;"/> + <PATHRC value=".;"/> + <PATHASM value=".;"/> + <DEBUGLIBPATH value="$(BCB)\lib\debug"/> + <RELEASELIBPATH value="$(BCB)\lib\release"/> + <LINKER value="ilink32"/> + <USERDEFINES value="_DEBUG"/> + <SYSDEFINES value="NO_STRICT;_NO_VCL;_RTLDLL;USEPACKAGES"/> + <MAINSOURCE value="rec_single_average.bpf"/> + <INCLUDEPATH value="C:\svnwork\spcm_drv_c\common\ostools;C:\svnwork\spcm_drv_c\common;C:\svnwork\spcm_drv_c\rec_fifo_single;$(BCB)\include;$(BCB)\include\vcl"/> + <LIBPATH value="C:\svnwork\spcm_drv_c\common\ostools;C:\svnwork\spcm_drv_c\common;C:\svnwork\spcm_drv_c\rec_fifo_single;$(BCB)\lib\obj;$(BCB)\lib"/> + <WARNINGS value="-w-par"/> + <OTHERFILES value=""/> + </MACROS> + <OPTIONS> + <CFLAG1 value="-tWC -tWM -Od -H=$(BCB)\lib\vcl60.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v + -vi- -c"/> + <PFLAGS value="-$YD -$W -$O- -$A8 -v -JPHNE -M"/> + <RFLAGS value=""/> + <AFLAGS value="/mx /w2 /zd"/> + <LFLAGS value="-Tpe -ap -D"" -x -Gn -v"/> + <OTHERFILES value=""/> + </OPTIONS> + <LINKER> + <ALLOBJ value="c0x32.obj $(PACKAGES) $(OBJFILES)"/> + <ALLRES value="$(RESFILES)"/> + <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib"/> + <OTHERFILES value=""/> + </LINKER> + <FILELIST> + <FILE FILENAME="rec_single_average.bpf" FORMNAME="" UNITNAME="rec_single_average" CONTAINERID="BPF" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="rec_single_average.cpp" FORMNAME="" UNITNAME="rec_single_average" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_thread.cpp" FORMNAME="" UNITNAME="spcm_lib_thread.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_card.cpp" FORMNAME="" UNITNAME="spcm_lib_card.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_data.cpp" FORMNAME="" UNITNAME="spcm_lib_data.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\c_header\spcm_win32_bcppb.lib" FORMNAME="" UNITNAME="spcm_win32_bcppb.lib" CONTAINERID="LibTool" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\ostools\spcm_ostools_win.cpp" FORMNAME="" UNITNAME="spcm_ostools_win" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + </FILELIST> + <BUILDTOOLS> + </BUILDTOOLS> + + <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= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +[Parameters] +RunParams= +Launcher= +UseLauncher=0 +DebugCWD= +HostApplication= +RemoteHost= +RemotePath= +RemoteLauncher= +RemoteCWD= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 + </IDEOPTIONS> +</PROJECT> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_single_average.cpp b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_average.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cc9d4453029de97810cbce24a27d88b0ec4a220e --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_average.cpp @@ -0,0 +1,298 @@ +/* +************************************************************************** + +fifo_single_average.cpp (c) Spectrum GmbH + +************************************************************************** + +Does a simple averaging of continuous FIFO data and shows the result +in one print line + +Change the global flag g_bThread to use the threaded version or the plain +and more simple loop. + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_card.h" +#include "../common/spcm_lib_data.h" +#include "../common/spcm_lib_thread.h" + +// ----- standard c include files ----- +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + + +// ----- this is the global thread flag that defines whether we use the thread or non-thread loop ----- +bool g_bThread = true; + + +/* +************************************************************************** +bDoCardSetuo: setup matching the calculation routine +************************************************************************** +*/ + +bool bDoCardSetup (ST_SPCM_CARDINFO *pstCard) + { + int i; + + // FIFO mode setup, we run continuously and have 32 samples of pre data before trigger event + // all available channels are activated + bSpcMSetupModeRecFIFOSingle (pstCard, (1 << pstCard->lMaxChannels) - 1, 32); + + // we try to set the samplerate to 1 MHz (M2i) or 20 MHz (M3i, M4i) on internal PLL, no clock output + // increase this to test the read-out-after-overrun + if (pstCard->bM2i) + bSpcMSetupClockPLL (pstCard, MEGA(1), false); + else if (pstCard->bM2p) + bSpcMSetupClockPLL (pstCard, MEGA(10), false); + else if (pstCard->bM3i || pstCard->bM4i || pstCard->bM5i) + bSpcMSetupClockPLL (pstCard, MEGA(20), false); + printf ("Sampling rate set to %.1lf MHz\n", (double) pstCard->llSetSamplerate / 1000000); + + // we set software trigger, no trigger output + bSpcMSetupTrigSoftware (pstCard, false); + + // type dependent card setup + switch (pstCard->eCardFunction) + { + + // analog acquisition card setup + case AnalogIn: + + // program all input channels to +/-1 V and 50 ohm termination (if it's available) + if (pstCard->bM2i || pstCard->bM2p) + { + for (i=0; i < pstCard->lMaxChannels; i++) + bSpcMSetupInputChannel (pstCard, i, 1000, true); + } + else + { + bool bTerm = true; + bool bACCoupling = false; + bool bBandwidthLimit = false; + for (i=0; i < pstCard->lMaxChannels; i++) + bSpcMSetupPathInputCh (pstCard, i, 0, 1000, 0, bTerm, bACCoupling, bBandwidthLimit); + } + break; + } + + return pstCard->bSetError; + } + + + +/* +************************************************************************** +Working routine data +************************************************************************** +*/ + +struct ST_WORKDATA + { + bool bFirst; + double dMinInBlock; + double dMaxInBlock; + int16* ppnChannelData[SPCM_MAX_AICHANNEL]; + int32 lNotifySamplesPerChannel; + }; + + + +/* +************************************************************************** +Setup working routine +************************************************************************** +*/ + +bool bWorkInit (void* pvWorkData, ST_BUFFERDATA* pstBufferData) + { + bool bOk; + + ST_WORKDATA* pstWorkData = (ST_WORKDATA*) pvWorkData; + + // setup for the transfer + pstBufferData->dwDataBufLen = MEGA_B(32); + pstBufferData->dwDataNotify = KILO_B(64); + + // setup for the work + pstWorkData->bFirst = true; + pstWorkData->lNotifySamplesPerChannel = pstBufferData->dwDataNotify / pstBufferData->pstCard->lSetChannels / pstBufferData->pstCard->lBytesPerSample; + + // allocate arrays for channel data of notify size + bOk = true; + for (int i = 0; i < pstBufferData->pstCard->lSetChannels; i++) + { + pstWorkData->ppnChannelData[i] = (int16*) pvAllocMemPageAligned (pstWorkData->lNotifySamplesPerChannel * 2); + if (!pstWorkData->ppnChannelData[i]) + bOk = false; + } + + return bOk; + } + + + +/* +************************************************************************** +bWorkDo: does the averageing and prints the results in one line + +This function is absolutely not optimized for high data throughput. It's +just an example to show the handling of data. To have highest trhoughput +one should not use the easy DemuxAnalogToInt16 function but access the +multiplexed data directly. +************************************************************************** +*/ + +bool bWorkDo (void* pvWorkData, ST_BUFFERDATA* pstBufferData) + { + ST_WORKDATA* pstWorkData = (ST_WORKDATA*) pvWorkData; + double dAverage; + + // we only care for blocks of notify size + if (pstBufferData->llDataAvailBytes < pstBufferData->dwDataNotify) + return true; + + pstBufferData->llDataAvailBytes = pstBufferData->dwDataNotify; + + // now let's split up the data + if (pstBufferData->pstCard->lBytesPerSample == 1) + bSpcMDemuxAnalogData (pstBufferData->pstCard, static_cast < int8* > (pstBufferData->pvDataCurrentBuf), pstWorkData->lNotifySamplesPerChannel, pstWorkData->ppnChannelData); + else + bSpcMDemuxAnalogData (pstBufferData->pstCard, static_cast < int16* > (pstBufferData->pvDataCurrentBuf), pstWorkData->lNotifySamplesPerChannel, pstWorkData->ppnChannelData); + + + // calculate average of first channel + dAverage = dSpcMCalcAverage (pstWorkData->ppnChannelData[0], pstWorkData->lNotifySamplesPerChannel); + dAverage = dSpcMIntToVoltage (pstBufferData->pstCard, 0, dAverage); + + // store min/max if changed + if (pstWorkData->bFirst || (pstWorkData->dMinInBlock > dAverage)) + pstWorkData->dMinInBlock = dAverage; + if (pstWorkData->bFirst || (pstWorkData->dMaxInBlock < dAverage)) + pstWorkData->dMaxInBlock = dAverage; + + if (pstWorkData->bFirst) + printf ("\n%11s %12s %12s %12s\n", "Transferred", "Average", "Min", "Max"); + + pstWorkData->bFirst = false; + + // print some details + printf ("\r%8.2f MB %9.2f mV %9.2f mV %9.2f mV", + (double) pstBufferData->qwDataTransferred / 1024 / 1024, + 1000.0 * dAverage, + 1000.0 * pstWorkData->dMinInBlock, + 1000.0 * pstWorkData->dMaxInBlock); + + return true; + } + + + + +/* +************************************************************************** +vWorkClose: Close the work and clean up +************************************************************************** +*/ + +void vWorkClose (void* pvWorkData, ST_BUFFERDATA* pstBufferData) + { + ST_WORKDATA* pstWorkData = (ST_WORKDATA*) pvWorkData; + + for (int i = 0; i < pstBufferData->pstCard->lSetChannels; i++) + if (pstWorkData->ppnChannelData[i]) + vFreeMemPageAligned ((void*) pstWorkData->ppnChannelData[i], pstWorkData->lNotifySamplesPerChannel * 2); + } + + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + char szBuffer[1024]; // a character buffer for any messages + ST_SPCM_CARDINFO stCard; // info structure of my card + ST_BUFFERDATA stBufferData; // buffer and transfer definitions + ST_WORKDATA stWorkData; // work data for the working functions + + + + // ------------------------------------------------------------------------ + // init card number 0 (the first card in the system), get some information and print it + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + if (bSpcMInitCardByIdx (&stCard, 0)) + //if (bSpcMInitCardByIdx (&stCard, "192.168.1.10", 0)) + { + printf (pszSpcMPrintDocumentationLink (&stCard, szBuffer, sizeof (szBuffer))); + printf (pszSpcMPrintCardInfo (&stCard, szBuffer, sizeof (szBuffer))); + } + else + return nSpcMErrorMessageStdOut (&stCard, "Error: Could not open card\n", true); + + + // check whether we support this card type in the example + if (stCard.eCardFunction != AnalogIn) + return nSpcMErrorMessageStdOut (&stCard, "Error: Card function not supported by this example\n", false); + + + // ------------------------------------------------------------------------ + // do the card setup, error is routed in the structure so we don't care for the return values + if (!stCard.bSetError) + bDoCardSetup (&stCard); + + + // ------------------------------------------------------------------------ + // setup the data transfer thread and start it, we use atimeout of 5 s in the example + memset (&stBufferData, 0, sizeof(stBufferData)); + stBufferData.pstCard = &stCard; + stBufferData.bStartCard = true; + stBufferData.bStartData = true; + stBufferData.lTimeout = 5000; + + // start the threaded version if g_bThread is defined + if (!stCard.bSetError && g_bThread) + vDoThreadMainLoop (&stBufferData, &stWorkData, bWorkInit, bWorkDo, vWorkClose, bKeyAbortCheck); + + // start the unthreaded version with a smaller timeout of 100 ms to gain control about the FIFO loop + stBufferData.lTimeout = 100; + if (!stCard.bSetError && !g_bThread) + vDoMainLoop (&stBufferData, &stWorkData, bWorkInit, bWorkDo, vWorkClose, bKeyAbortCheck); + + + // ------------------------------------------------------------------------ + // print error information if an error occured + if (stCard.bSetError) + return nSpcMErrorMessageStdOut (&stCard, "An error occured while programming the card:\n", true); + + + // clean up and close the driver + vSpcMCloseCard (&stCard); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_single_average.dsp b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_average.dsp new file mode 100644 index 0000000000000000000000000000000000000000..6a6e9071a6a205bb3266ca3d0c29dac1eef16e1a --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_average.dsp @@ -0,0 +1,156 @@ +# Microsoft Developer Studio Project File - Name="rec_single_average" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=rec_single_average - Win32 Debug +!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE +!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl +!MESSAGE +!MESSAGE NMAKE /f "rec_single_average.mak". +!MESSAGE +!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben +!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: +!MESSAGE +!MESSAGE NMAKE /f "rec_single_average.mak" CFG="rec_single_average - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "rec_single_average - Win32 Release" (basierend auf "Win32 (x86) Console Application") +!MESSAGE "rec_single_average - Win32 Debug" (basierend auf "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "rec_single_average - 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 /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 /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 /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "rec_single_average - 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 /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 /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 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "rec_single_average - Win32 Release" +# Name "rec_single_average - Win32 Debug" +# Begin Group "common" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\common\spcm_lib_card.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_thread.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_ostools_win.cpp +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_win32_msvcpp.lib +# End Source File +# End Group +# Begin Group "header" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\c_header\dlltyp.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\regs.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcerr.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_drv.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_card.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_thread.h +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_ostools.h +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_oswrap.h +# End Source File +# Begin Source File + +SOURCE=..\thread_work\spcm_thread_work.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\rec_single_average.cpp +# End Source File +# End Target +# End Project diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_single_average.vcproj b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_average.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..dbfcff2ec93c98c9978c2301d2b5da55329d108a --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_average.vcproj @@ -0,0 +1,655 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="rec_single_average" + ProjectGUID="{C7E8D563-BF2C-4AEA-98A5-EFADA43EE6EB}" + RootNamespace="rec_single_average" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/rec_single_average.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_single_average.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_single_average.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_single_average.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_single_average.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/rec_single_average.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_single_average.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_single_average.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_single_average.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_single_average.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/rec_single_average.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_single_average.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_single_average.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_single_average.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_single_average.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/rec_single_average.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_single_average.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_single_average.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_single_average.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_single_average.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="common" + > + <File + RelativePath="..\common\spcm_lib_card.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_data.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_thread.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="header" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_card.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_data.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_thread.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_oswrap.h" + > + </File> + <File + RelativePath="..\thread_work\spcm_thread_work.h" + > + </File> + </Filter> + <File + RelativePath="rec_single_average.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_single_average.vcxproj b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_average.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..66c5e4259815ebdc8c5ffbbe28878e2ad303beeb --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_average.vcxproj @@ -0,0 +1,269 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{C7E8D563-BF2C-4AEA-98A5-EFADA43EE6EB}</ProjectGuid> + <RootNamespace>rec_single_average</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rec_single_average.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_single_average.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_single_average.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_single_average.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rec_single_average.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_single_average.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_single_average.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_single_average.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rec_single_average.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_single_average.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_single_average.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_single_average.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rec_single_average.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_single_average.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_single_average.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_single_average.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="..\common\spcm_lib_card.cpp" /> + <ClCompile Include="..\common\spcm_lib_data.cpp" /> + <ClCompile Include="..\common\spcm_lib_thread.cpp" /> + <ClCompile Include="rec_single_average.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\common\spcm_lib_card.h" /> + <ClInclude Include="..\common\spcm_lib_data.h" /> + <ClInclude Include="..\common\spcm_lib_thread.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + <ClInclude Include="..\thread_work\spcm_thread_work.h" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_single_average.vcxproj.filters b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_average.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..e5ccbfddd3b5446587da89062e154ae0ed14a09c --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_average.vcxproj.filters @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="common"> + <UniqueIdentifier>{f3064a37-eeac-4ba3-be90-5f642a200727}</UniqueIdentifier> + </Filter> + <Filter Include="header"> + <UniqueIdentifier>{2df29187-2f97-4696-be5a-d3a67b4fe64a}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\spcm_lib_card.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_data.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_thread.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="rec_single_average.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_card.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_data.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_thread.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_oswrap.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\thread_work\spcm_thread_work.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_single_binaryfile.bpf b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_binaryfile.bpf new file mode 100644 index 0000000000000000000000000000000000000000..5da88241fe8e80944de42def849bf4eab8f1f666 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_binaryfile.bpf @@ -0,0 +1,3 @@ +This file is used by the project manager only and should be treated like the project file + + main \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_single_binaryfile.bpr b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_binaryfile.bpr new file mode 100644 index 0000000000000000000000000000000000000000..04195ba60701dd776e5c641df27653bf4569a40f --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_binaryfile.bpr @@ -0,0 +1,107 @@ +<?xml version='1.0' encoding='utf-8' ?> +<!-- C++Builder XML Project --> +<PROJECT> + <MACROS> + <VERSION value="BCB.06.00"/> + <PROJECT value="rec_single_binaryfile.exe"/> + <OBJFILES value="..\common\spcm_lib_thread.obj ..\common\spcm_lib_card.obj + ..\common\spcm_lib_data.obj ..\common\ostools\spcm_ostools_win.obj + rec_single_binaryfile.obj ..\sb5_file\sb5_file.obj"/> + <RESFILES value=""/> + <DEFFILE value=""/> + <RESDEPEN value="$(RESFILES)"/> + <LIBFILES value="..\c_header\spcm_win32_bcppb.lib"/> + <LIBRARIES value=""/> + <SPARELIBS value=""/> + <PACKAGES value="vcl.bpi rtl.bpi vclx.bpi bcbsmp.bpi dclocx.bpi"/> + <PATHCPP value=".;..\common;..\common;..\common;..\common\ostools;..\sb5_file"/> + <PATHPAS value=".;"/> + <PATHRC value=".;"/> + <PATHASM value=".;"/> + <DEBUGLIBPATH value="$(BCB)\lib\debug"/> + <RELEASELIBPATH value="$(BCB)\lib\release"/> + <LINKER value="ilink32"/> + <USERDEFINES value="_DEBUG"/> + <SYSDEFINES value="NO_STRICT;_NO_VCL;_RTLDLL;USEPACKAGES"/> + <MAINSOURCE value="rec_single_binaryfile.bpf"/> + <INCLUDEPATH value="..\sb5_file;C:\svnwork\spcm_drv_c\common\ostools;C:\svnwork\spcm_drv_c\common;C:\svnwork\spcm_drv_c\rec_fifo_single;$(BCB)\include;$(BCB)\include\vcl"/> + <LIBPATH value="..\sb5_file;C:\svnwork\spcm_drv_c\common\ostools;C:\svnwork\spcm_drv_c\common;C:\svnwork\spcm_drv_c\rec_fifo_single;$(BCB)\lib\obj;$(BCB)\lib"/> + <WARNINGS value="-w-par"/> + <OTHERFILES value=""/> + </MACROS> + <OPTIONS> + <CFLAG1 value="-tWC -tWM -Od -H=$(BCB)\lib\vcl60.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v + -vi- -c"/> + <PFLAGS value="-$YD -$W -$O- -$A8 -v -JPHNE -M"/> + <RFLAGS value=""/> + <AFLAGS value="/mx /w2 /zd"/> + <LFLAGS value="-Tpe -ap -D"" -x -Gn -v"/> + <OTHERFILES value=""/> + </OPTIONS> + <LINKER> + <ALLOBJ value="c0x32.obj $(PACKAGES) $(OBJFILES)"/> + <ALLRES value="$(RESFILES)"/> + <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib"/> + <OTHERFILES value=""/> + </LINKER> + <FILELIST> + <FILE FILENAME="rec_single_binaryfile.bpf" FORMNAME="" UNITNAME="rec_single_binaryfile" CONTAINERID="BPF" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_thread.cpp" FORMNAME="" UNITNAME="spcm_lib_thread.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_card.cpp" FORMNAME="" UNITNAME="spcm_lib_card.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_data.cpp" FORMNAME="" UNITNAME="spcm_lib_data.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\c_header\spcm_win32_bcppb.lib" FORMNAME="" UNITNAME="spcm_win32_bcppb.lib" CONTAINERID="LibTool" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\ostools\spcm_ostools_win.cpp" FORMNAME="" UNITNAME="spcm_ostools_win" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="rec_single_binaryfile.cpp" FORMNAME="" UNITNAME="rec_single_binaryfile" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\sb5_file\sb5_file.cpp" FORMNAME="" UNITNAME="sb5_file" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + </FILELIST> + <BUILDTOOLS> + </BUILDTOOLS> + + <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= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +[Parameters] +RunParams= +Launcher= +UseLauncher=0 +DebugCWD= +HostApplication= +RemoteHost= +RemotePath= +RemoteLauncher= +RemoteCWD= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 + </IDEOPTIONS> +</PROJECT> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_single_binaryfile.cpp b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_binaryfile.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f5731d21b01f8cae1ddf4d68d600246a6e26a07b --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_binaryfile.cpp @@ -0,0 +1,338 @@ +/* +************************************************************************** + +rec_single_binaryfile.cpp (c) Spectrum GmbH + +************************************************************************** + +this example supports all acquisition cards + +Does a continous FIFO transfer and writes data to a binary file. The file +type can be selected to simple binary file or binary file including the +SBench5 format header (*.sbs/*sb5) file. + +change the eFileType variable to select between plain binary and SB5 +file. + +Change the global flag g_bThread to use the threaded version or the plain +and more simple loop. + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + + +// ----- standard c include files ----- +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_card.h" +#include "../common/spcm_lib_data.h" +#include "../common/spcm_lib_thread.h" +#include "../sb5_file/sb5_file.h" + + +// ----- this is the global thread flag that defines whether we use the thread or non-thread loop ----- +bool g_bThread = false; + + + +/* +************************************************************************** +bDoCardSetup: setup matching the calculation routine +************************************************************************** +*/ + +bool bDoCardSetup (ST_SPCM_CARDINFO *pstCard) + { + int i; + int64 llChannelMask; + + // set mask for maximal channels + if (pstCard->lMaxChannels >= 64) + llChannelMask = -1; // -1 is all bits set to 1 = 0xffffffffffffffff + else + llChannelMask = ((int64) 1 << pstCard->lMaxChannels) - 1; + + // FIFO mode setup, we run continuously and have 32 samples of pre data before trigger event + // all available channels are activated + // Use the parameters llBlockToRec and llLoopToRec to limit the amount of data (default is zero = endless). + bSpcMSetupModeRecFIFOSingle (pstCard, llChannelMask, 32); + + // we try to set the samplerate to 1 MHz (M2i) or 20 MHz (M3i, M4i) on internal PLL, no clock output + // increase this to test the read-out-after-overrun + if (pstCard->bM2i) + bSpcMSetupClockPLL (pstCard, MEGA(1), false); + else if (pstCard->bM2p) + bSpcMSetupClockPLL (pstCard, MEGA(10), false); + else if (pstCard->bM3i || pstCard->bM4i || pstCard->bM5i) + bSpcMSetupClockPLL (pstCard, MEGA(20), false); + printf ("Sampling rate set to %.1lf MHz\n", (double) pstCard->llSetSamplerate / 1000000); + + // we set software trigger, no trigger output + bSpcMSetupTrigSoftware (pstCard, false); + + // type dependent card setup + switch (pstCard->eCardFunction) + { + + // analog acquisition card setup + case AnalogIn: + + // program all input channels to +/-1 V and 50 ohm termination (if it's available) + if (pstCard->bM2i || pstCard->bM2p) + { + for (i=0; i < pstCard->lMaxChannels; i++) + bSpcMSetupInputChannel (pstCard, i, 1000, true); + } + else + { + bool bTerm = true; + bool bACCoupling = false; + bool bBandwidthLimit = false; + for (i=0; i < pstCard->lMaxChannels; i++) + bSpcMSetupPathInputCh (pstCard, i, 0, 1000, 0, bTerm, bACCoupling, bBandwidthLimit); + } + break; + + // digital acquisition card setup + case DigitalIn: + case DigitalIO: + + // set all input channel groups to 110 ohm termination (if it's available) + for (i=0; i < pstCard->uCfg.stDIO.lGroups; i++) + bSpcMSetupDigitalInput (pstCard, i, true); + break; + } + + return pstCard->bSetError; + } + + + +/* +************************************************************************** +Working routine data +************************************************************************** +*/ + +#define FILENAME "stream_test" + +typedef enum E_FILETYPE {eFT_noWrite, eFT_PlainBinary, eFT_SB5_Stream} E_FILETYPE; + +struct ST_WORKDATA + { + E_FILETYPE eFileType; + int64 llSamplesWritten; + FILE* hFile; + char szFileName[100]; + }; + + + +/* +************************************************************************** +Setup working routine +************************************************************************** +*/ + +bool bWorkInit (void* pvWorkData, ST_BUFFERDATA* pstBufferData) + { + ST_WORKDATA* pstWorkData = (ST_WORKDATA*) pvWorkData; + + // setup for the transfer, to avoid overrun we use quite large blocks as this has a better throughput to hard disk + pstBufferData->dwDataBufLen = MEGA_B(64); + pstBufferData->dwDataNotify = MEGA_B(1); + + // setup for the work + pstWorkData->llSamplesWritten = 0; + pstWorkData->eFileType = eFT_noWrite; + + switch (pstWorkData->eFileType) + { + case eFT_PlainBinary: + sprintf (pstWorkData->szFileName, "%s.bin", FILENAME); + printf ("\nWriting to plan binary file %s\n\n", pstWorkData->szFileName); + break; + + case eFT_SB5_Stream: + if (pstBufferData->pstCard->lSetChannels == 1) + sprintf (pstWorkData->szFileName, "%s.sb5", FILENAME); + else + sprintf (pstWorkData->szFileName, "%s.sbs", FILENAME); + printf ("\nWriting to SBench 5 binary file %s\n\n", pstWorkData->szFileName); + break; + + case eFT_noWrite: + printf ("\nno real write, just Simulation\n\n"); + } + + if (pstWorkData->eFileType != eFT_noWrite) + pstWorkData->hFile = fopen (pstWorkData->szFileName, "w+b"); + + // we now have to write the SB5 header if this format has been selected + if (pstWorkData->hFile && (pstWorkData->eFileType == eFT_SB5_Stream)) + { + ST_SB5HEAD* pstHeader; + bool bReturn; + + pstHeader = pstSB5_AllocHeader (pstBufferData->pstCard->lSetChannels); + if (!bFillSB5Header (pstBufferData->pstCard, pstHeader, "Test")) + return false; + + // our pretrigger has been defined to 16 by setup -> that's our x offset + pstHeader->dXOffset = 16.0 / pstBufferData->pstCard->llSetSamplerate; + + bReturn = bSB5_StoreHeader (pstWorkData->hFile, pstHeader); + vSB5_FreeHeader (pstHeader); + + return bReturn; + } + + return ((pstWorkData->hFile != NULL) || (pstWorkData->eFileType == eFT_noWrite)); + } + + + +/* +************************************************************************** +bWorkDo: stores data to hard disk +************************************************************************** +*/ + +bool bWorkDo (void* pvWorkData, ST_BUFFERDATA* pstBufferData) + { + ST_WORKDATA* pstWorkData = (ST_WORKDATA*) pvWorkData; + uint32 dwWritten; + + // write the data and count the samples + if (pstWorkData->eFileType != eFT_noWrite) + { + dwWritten = fwrite (pstBufferData->pvDataCurrentBuf, 1, pstBufferData->llDataAvailBytes, pstWorkData->hFile); + pstWorkData->llSamplesWritten += dwWritten / pstBufferData->pstCard->lBytesPerSample; + if (dwWritten != pstBufferData->llDataAvailBytes) + { + printf ("\nData Write error\n"); + return false; + } + + // announce the number of data that has been written + printf ("\r%.2f MSamples (sum) written to %s", + (double) pstBufferData->qwDataTransferred / pstBufferData->pstCard->lBytesPerSample / MEGA_B(1), + pstWorkData->szFileName); + } + + // simulation: just count the data + if (pstWorkData->eFileType == eFT_noWrite) + printf ("\r%.2f MSamples (sum) transferred", + (double) pstBufferData->qwDataTransferred / pstBufferData->pstCard->lBytesPerSample / MEGA_B(1)); + + + + return true; + } + + + + +/* +************************************************************************** +vWorkClose: Close the work and clean up +************************************************************************** +*/ + +void vWorkClose (void* pvWorkData, ST_BUFFERDATA* pstBufferData) + { + ST_WORKDATA* pstWorkData = (ST_WORKDATA*) pvWorkData; + + if (pstWorkData->eFileType != eFT_noWrite) + if (pstWorkData->hFile) + { + if (pstWorkData->eFileType == eFT_SB5_Stream) + bSB5_UpdateSamples (pstWorkData->hFile, (int32) pstWorkData->llSamplesWritten); + + fclose (pstWorkData->hFile); + } + } + + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + char szBuffer[1024]; // a character buffer for any messages + ST_SPCM_CARDINFO stCard; // info structure of my card + ST_BUFFERDATA stBufferData; // buffer and transfer definitions + ST_WORKDATA stWorkData; // work data for the working functions + + // ------------------------------------------------------------------------ + // init card number 0 (the first card in the system), get some information and print it + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + if (bSpcMInitCardByIdx (&stCard, 0)) + //if (bSpcMInitCardByIdx (&stCard, "192.168.1.10", 0)) + { + printf (pszSpcMPrintDocumentationLink (&stCard, szBuffer, sizeof (szBuffer))); + printf (pszSpcMPrintCardInfo (&stCard, szBuffer, sizeof (szBuffer))); + } + else + return nSpcMErrorMessageStdOut (&stCard, "Error: Could not open card\n", true); + + + // check whether we support this card type in the example + if ((stCard.eCardFunction != AnalogIn) && (stCard.eCardFunction != DigitalIn) && (stCard.eCardFunction != DigitalIO)) + return nSpcMErrorMessageStdOut (&stCard, "Error: Card function not supported by this example\n", false); + + + // ------------------------------------------------------------------------ + // do the card setup, error is routed in the structure so we don't care for the return values + if (!stCard.bSetError) + bDoCardSetup (&stCard); + + + // ------------------------------------------------------------------------ + // setup the data transfer thread and start it, we use atimeout of 5 s in the example + memset (&stBufferData, 0, sizeof(stBufferData)); + stBufferData.pstCard = &stCard; + stBufferData.bStartCard = true; + stBufferData.bStartData = true; + stBufferData.lTimeout = 5000; + + // start the threaded version if g_bThread is defined + if (!stCard.bSetError && g_bThread) + vDoThreadMainLoop (&stBufferData, &stWorkData, bWorkInit, bWorkDo, vWorkClose, bKeyAbortCheck); + + // start the unthreaded version with a smaller timeout of 100 ms to gain control about the FIFO loop + stBufferData.lTimeout = 100; + if (!stCard.bSetError && !g_bThread) + vDoMainLoop (&stBufferData, &stWorkData, bWorkInit, bWorkDo, vWorkClose, bKeyAbortCheck); + + + // ------------------------------------------------------------------------ + // print error information if an error occured + if (stCard.bSetError) + return nSpcMErrorMessageStdOut (&stCard, "An error occured while programming the card:\n", true); + + + // clean up and close the driver + vSpcMCloseCard (&stCard); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_single_binaryfile.dsp b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_binaryfile.dsp new file mode 100644 index 0000000000000000000000000000000000000000..5175e3f5397fc65907240eaf9641cfa04349d26c --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_binaryfile.dsp @@ -0,0 +1,160 @@ +# Microsoft Developer Studio Project File - Name="rec_single_binaryfile" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=rec_single_binaryfile - Win32 Debug +!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE +!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl +!MESSAGE +!MESSAGE NMAKE /f "rec_single_binaryfile.mak". +!MESSAGE +!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben +!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: +!MESSAGE +!MESSAGE NMAKE /f "rec_single_binaryfile.mak" CFG="rec_single_binaryfile - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "rec_single_binaryfile - Win32 Release" (basierend auf "Win32 (x86) Console Application") +!MESSAGE "rec_single_binaryfile - Win32 Debug" (basierend auf "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "rec_single_binaryfile - 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 /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 /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 /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "rec_single_binaryfile - 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 /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 /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 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "rec_single_binaryfile - Win32 Release" +# Name "rec_single_binaryfile - Win32 Debug" +# Begin Group "common" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\sb5_file\sb5_file.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_card.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_thread.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_ostools_win.cpp +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_win32_msvcpp.lib +# End Source File +# End Group +# Begin Group "header" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\c_header\dlltyp.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\regs.h +# End Source File +# Begin Source File + +SOURCE=..\sb5_file\sb5_file.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcerr.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_drv.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_card.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_thread.h +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_ostools.h +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_oswrap.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\rec_single_binaryfile.cpp +# End Source File +# End Target +# End Project diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_single_binaryfile.vcproj b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_binaryfile.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..12735a02aacf635edfad6bf81ae6714f73335e0e --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_binaryfile.vcproj @@ -0,0 +1,691 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="rec_single_binaryfile" + ProjectGUID="{7E25D4B9-F5D6-4D15-9BC1-0FD1158BC807}" + RootNamespace="rec_single_binaryfile" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/rec_single_binaryfile.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_single_binaryfile.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_single_binaryfile.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_single_binaryfile.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_single_binaryfile.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/rec_single_binaryfile.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_single_binaryfile.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_single_binaryfile.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_single_binaryfile.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_single_binaryfile.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/rec_single_binaryfile.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_single_binaryfile.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_single_binaryfile.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_single_binaryfile.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_single_binaryfile.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/rec_single_binaryfile.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_single_binaryfile.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_single_binaryfile.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_single_binaryfile.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_single_binaryfile.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="common" + > + <File + RelativePath="..\sb5_file\sb5_file.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_card.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_data.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_thread.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="header" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\sb5_file\sb5_file.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_card.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_data.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_thread.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_oswrap.h" + > + </File> + </Filter> + <File + RelativePath="rec_single_binaryfile.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_single_binaryfile.vcxproj b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_binaryfile.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..e7810221220e8b4c4e9a7c8719b36fd67b39e29a --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_binaryfile.vcxproj @@ -0,0 +1,270 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{7E25D4B9-F5D6-4D15-9BC1-0FD1158BC807}</ProjectGuid> + <RootNamespace>rec_single_binaryfile</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rec_single_binaryfile.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_single_binaryfile.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_single_binaryfile.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_single_binaryfile.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rec_single_binaryfile.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_single_binaryfile.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_single_binaryfile.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_single_binaryfile.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rec_single_binaryfile.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_single_binaryfile.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_single_binaryfile.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_single_binaryfile.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rec_single_binaryfile.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_single_binaryfile.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_single_binaryfile.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_single_binaryfile.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="..\common\spcm_lib_card.cpp" /> + <ClCompile Include="..\common\spcm_lib_data.cpp" /> + <ClCompile Include="..\common\spcm_lib_thread.cpp" /> + <ClCompile Include="..\sb5_file\sb5_file.cpp" /> + <ClCompile Include="rec_single_binaryfile.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\common\spcm_lib_card.h" /> + <ClInclude Include="..\common\spcm_lib_data.h" /> + <ClInclude Include="..\common\spcm_lib_thread.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + <ClInclude Include="..\sb5_file\sb5_file.h" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_fifo_single/rec_single_binaryfile.vcxproj.filters b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_binaryfile.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..1c80a56ccf984cd6f37a08392071cf1fde1489ff --- /dev/null +++ b/Cpp/examples/c_cpp/rec_fifo_single/rec_single_binaryfile.vcxproj.filters @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="common"> + <UniqueIdentifier>{a9751b01-e7e6-4095-863d-7c1f07b8326e}</UniqueIdentifier> + </Filter> + <Filter Include="header"> + <UniqueIdentifier>{425cb221-e92a-49bc-a0f3-af18cce59017}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\sb5_file\sb5_file.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_card.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_data.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_thread.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="rec_single_binaryfile.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\sb5_file\sb5_file.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_card.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_data.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_thread.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_oswrap.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_aba/makefile b/Cpp/examples/c_cpp/rec_std_aba/makefile new file mode 100644 index 0000000000000000000000000000000000000000..8b5f9e10e69b4f0e3fc44291a6c90674249df489 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_aba/makefile @@ -0,0 +1,24 @@ +COMPILER = g++ +EXECUTABLE = rec_std_aba +LIBS += -lspcm_linux -lpthread -lrt + +OBJECTS = \ + rec_std_aba.o\ + ../common/spcm_lib_card.o\ + ../common/spcm_lib_data.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/rec_std_aba/rec_std_aba.cpp b/Cpp/examples/c_cpp/rec_std_aba/rec_std_aba.cpp new file mode 100644 index 0000000000000000000000000000000000000000..70a5a6d77f1ff9ef2c9f058abe408450ccb79e67 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_aba/rec_std_aba.cpp @@ -0,0 +1,403 @@ +/* +************************************************************************** + +rec_std_aba.cpp (c) Spectrum GmbH + +************************************************************************** + +Example for all SpcMDrv based acquisition cards with the ABA option +installed. + +Information about the different products and their drivers can be found +online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/platform-driver-and-series-differences + +Shows ABA data acquisition using standard ABA mode. Slow data is +acquired until all segments of the multiple recording are taken. +If timestamp is installed the corresponding timestamp values are also read +out and displayed. + +If Timestamp and BaseXIO are installed the BaseXIO lines are set to the +timestamp acquisition mode and are sampled on every trigger event. The +samples BaseXIO lines are also shown. + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_card.h" +#include "../common/spcm_lib_data.h" + +#include "../common/ostools/spcm_oswrap.h" +#include "../common/ostools/spcm_ostools.h" + +// ----- standard c include files ----- +#include <stdio.h> +#include <stdlib.h> + + + +/* +************************************************************************** +vDoCardSetup +************************************************************************** +*/ + +void vDoCardSetup (ST_SPCM_CARDINFO *pstCard, int64 llMemsize, int32 lSegmentsize, int32 lPosttrigger) + { + int i; + + // ABA Recording Setup + bSpcMSetupModeRecStdABA (pstCard, ((int64) 1 << pstCard->lMaxChannels) - 1, llMemsize, lSegmentsize, lPosttrigger, 512); + + // we try to set the samplerate to 1/4 of maximum samplerate on internal PLL, no clock output, + // if the card can't run 10 MHz it is set to maximum sampling rate internally + bSpcMSetupClockPLL (pstCard, pstCard->llMaxSamplerate / 4, false); + printf ("Sampling rate set to %.1lf MHz\n", (double) pstCard->llSetSamplerate / 1000000); + + // we set trigger to external positive edge, please connect the trigger line! + printf ("\n!!! Using external trigger - please connect a signal to the trigger input !!!\n"); + bSpcMSetupTrigExternal (pstCard, SPC_TM_POS, false, 0); + + // type dependent card setup + switch (pstCard->eCardFunction) + { + + // analog acquisition card setup + case AnalogIn: + + // program all input channels to +/-1 V and 50 ohm termination (if it's available) + for (i=0; i < pstCard->lMaxChannels; i++) + if (pstCard->bM2i || pstCard->bM2p) + bSpcMSetupInputChannel (pstCard, i, 1000, true); + else if (pstCard->bM3i || pstCard->bM4i || pstCard->bM5i) + bSpcMSetupPathInputCh (pstCard, i, 0, 1000, 0, false, true, true); + + break; + + // digital acquisition card setup + case DigitalIn: + case DigitalIO: + printf ("Not yet implemented\n"); + break; + } + + + // if timestamp and basexio are installed we acquire the asynchronous inputs with the timestamps + if ((pstCard->lFeatureMap & SPCM_FEAT_TIMESTAMP) && (pstCard->lFeatureMap & SPCM_FEAT_BASEXIO)) + bSpcMSetupTimestamp (pstCard, SPC_TSMODE_STANDARD | SPC_TSCNT_INTERNAL | SPC_TSXIOACQ_ENABLE, 0); + + // set up the timestamp mode to standard if timestamp is installed + else if ((pstCard->lFeatureMap & SPCM_FEAT_TIMESTAMP) != 0) + bSpcMSetupTimestamp (pstCard, SPC_TSMODE_STANDARD | SPC_TSCNT_INTERNAL, 0); + + } + + + +/* +************************************************************************** +nShowAnalogData +************************************************************************** +*/ + +int16 nShowAnalogData (ST_SPCM_CARDINFO *pstCard, int32 lSegmentsize, int32 lPosttrigger, void* pvBuffer, bool bTimestampInstalled, bool bBaseXIO, uint64* pqwTimestamps) + { + int16* ppnChannelData[SPCM_MAX_AICHANNEL]; + int i; + int32 lSegmentIdx; + uint32 dwBaseXIOLines; + + for (i=0; i<pstCard->lSetChannels; i++) + { + ppnChannelData[i] = new int16[lSegmentsize]; + if (!ppnChannelData[i]) + return nSpcMErrorMessageStdOut (pstCard, "Memory allocation error\n", false); + } + + + // loop across all acquired segments + + if (bTimestampInstalled && bBaseXIO) + printf ("\n%8s %12s %12s %12s %4s %15s %10s\n", "Segment", "Min", "Max", "Average", "BXIO", "Timestamp", "Timediff"); + else if (bTimestampInstalled) + printf ("\n%8s %12s %12s %12s %15s %10s\n", "Segment", "Min", "Max", "Average", "Timestamp", "Timediff"); + else + printf ("\n%8s %12s %12s %12s\n", "Segment", "Min", "Max", "Average"); + + for (lSegmentIdx = 0; lSegmentIdx < (pstCard->llSetMemsize / lSegmentsize); lSegmentIdx++) + { + + // split data function + if (pstCard->lBytesPerSample == 1) + bSpcMDemuxAnalogData (pstCard, (int8*)pvGetSegmentDataPointer (pstCard, pvBuffer, lSegmentsize, lSegmentIdx, pstCard->lBytesPerSample), lSegmentsize, ppnChannelData); + else + bSpcMDemuxAnalogData (pstCard, (int16*)pvGetSegmentDataPointer (pstCard, pvBuffer, lSegmentsize, lSegmentIdx, pstCard->lBytesPerSample), lSegmentsize, ppnChannelData); + + // we just look at channel 0 to keep output simple independant of the number of channels + printf ("%8d %9.2f mV %9.2f mV %9.2f mV ", lSegmentIdx, + 1000.0 * dSpcMIntToVoltage (pstCard, 0, TSpcMCalcMin (ppnChannelData[0], (uint32) lSegmentsize)), + 1000.0 * dSpcMIntToVoltage (pstCard, 0, TSpcMCalcMax (ppnChannelData[0], (uint32) lSegmentsize)), + 1000.0 * dSpcMIntToVoltage (pstCard, 0, dSpcMCalcAverage (ppnChannelData[0], (uint32) lSegmentsize))); + + // if basexio is installed we split the 8 asynchronous lines and clean up the timestamp + if (bBaseXIO) + { + dwBaseXIOLines = (uint32) (pqwTimestamps[lSegmentIdx] >> 56); + + // unmask the BaseXIOLines from the timestamps + pqwTimestamps[lSegmentIdx] &= ~(((uint64) 0xff000000) << 32); + printf (" %02x ", dwBaseXIOLines); + } + + // print the timestamps and the difference, keeping track of the oversampling factor + + // M2i and M3i use 64 bit timestamps and M4i and M2p 128 bit + if (bTimestampInstalled) + { + + // M2i and M3i use 64 bit timestamps, M4i, M2p and M5i 128 bit + if (pstCard->bM2i || pstCard->bM3i) + printf ("%12.6f ms ", 1000.0 * (double) ((int64) pqwTimestamps[lSegmentIdx]) / pstCard->llSetSamplerate / pstCard->lOversampling); + else if (pstCard->bM4i || pstCard->bM2p || pstCard->bM5i) + printf ("%12.6f ms ", 1000.0 * (double) ((int64) pqwTimestamps[2 * lSegmentIdx]) / pstCard->llSetSamplerate); + } + + // print the difference, starting with segment 1 + if (bTimestampInstalled && (lSegmentIdx > 0)) + { + + // M2i and M3i use 64 bit timestamps and M4i and M2p 128 bit + if (pstCard->bM2i || pstCard->bM3i) + printf ("%7.2f ms", 1000.0 * (double) (int64) (pqwTimestamps[lSegmentIdx] - pqwTimestamps[lSegmentIdx - 1]) / pstCard->llSetSamplerate / pstCard->lOversampling); + else if (pstCard->bM4i || pstCard->bM2p || pstCard->bM5i) + printf ("%7.2f ms", 1000.0 * (double) (int64) (pqwTimestamps[2*lSegmentIdx] - pqwTimestamps[2*lSegmentIdx - 2]) / pstCard->llSetSamplerate); + } + + + printf ("\n"); + } + + // clean up + for (i=0; i<pstCard->lSetChannels; i++) + delete [] (ppnChannelData[i]); + + return 0; + } + + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + char szBuffer[1024]; // a character buffer for any messages + ST_SPCM_CARDINFO stCard; // info structure of my card + int64 llMemsize; + int32 lSegmentsize, lPosttrigger; + int32 lOversampling = 1; + int32 lStatus = 0; + int64 llAvailABABytes, llByteABAPos; + int64 llABATransfer = 0; + uint32 dwABANotifySize = 4096; + bool bTimestampInstalled = 0, bBaseXIOInstalled = 0; + uint64 qwMemInBytes; + uint64 qwTSBufferLen_bytes = 0; + uint64 qwABABufferLen_bytes = 0; + uint64* pqwTimestamps = NULL; + void* pvBuffer; + void* pvABABuffer; + + // ------------------------------------------------------------------------ + // init card number 0 (the first card in the system), get some information and print it + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + if (bSpcMInitCardByIdx (&stCard, 0)) + //if (bSpcMInitCardByIdx (&stCard, "192.168.1.10", 0)) + { + printf (pszSpcMPrintDocumentationLink (&stCard, szBuffer, sizeof (szBuffer))); + printf (pszSpcMPrintCardInfo (&stCard, szBuffer, sizeof (szBuffer))); + } + else + return nSpcMErrorMessageStdOut (&stCard, "Error: Could not open card\n", true); + + + // check whether we support this card type in the example + if ((stCard.eCardFunction != AnalogIn) && (stCard.eCardFunction != DigitalIn) && (stCard.eCardFunction != DigitalIO)) + return nSpcMErrorMessageStdOut (&stCard, "Error: Card function not supported by this example\n", false); + if ((stCard.lFeatureMap & SPCM_FEAT_ABA) == 0) + return nSpcMErrorMessageStdOut (&stCard, "Error: ABA Option not installed. Examples was done especially for this option!\n", false); + + // if timestamp is installed we set a flag to support this mode in the example also + bTimestampInstalled = ((stCard.lFeatureMap & SPCM_FEAT_TIMESTAMP) != 0); + bBaseXIOInstalled = ((stCard.lFeatureMap & SPCM_FEAT_BASEXIO) != 0); + + // ------------------------------------------------------------------------ + // do the card setup, error is routed in the structure so we don't care for the return values + llMemsize = KILO_B(64); + lSegmentsize = KILO_B(16); + lPosttrigger = 16128; + if (!stCard.bSetError) + vDoCardSetup (&stCard, llMemsize, lSegmentsize, lPosttrigger); + + + // ------------------------------------------------------------------------ + // calculate the amount of data we need and allocate memory buffer + if (!stCard.bSetError) + { + qwMemInBytes = stCard.llSetMemsize * stCard.lBytesPerSample * stCard.lSetChannels; + pvBuffer = pvAllocMemPageAligned (qwMemInBytes); + + qwABABufferLen_bytes = 20*dwABANotifySize; + pvABABuffer = pvAllocMemPageAligned (qwABABufferLen_bytes); + } + + // M2i and M3i use 64 bit timestamps and M4i and M2p 128 bit + if (stCard.bM2i || stCard.bM3i) + qwTSBufferLen_bytes = sizeof (uint64) * llMemsize / lSegmentsize; + else if (stCard.bM4i || stCard.bM2p || stCard.bM5i) + qwTSBufferLen_bytes = 2ULL * sizeof (uint64) * llMemsize / lSegmentsize; + + pqwTimestamps = (uint64*)pvAllocMemPageAligned (qwTSBufferLen_bytes); + + if (!pvBuffer || (bTimestampInstalled &&!pqwTimestamps)) + return nSpcMErrorMessageStdOut (&stCard, "Memory allocation error\n", false); + + // ------------------------------------------------------------------------ + // make acquisition and get data + if (!stCard.bSetError) + { + printf ("\n"); + + // if using timestamps we need to start the transfer before the card start to avoid an overrun of the timestamp memory + if (bTimestampInstalled) + { + printf ("Defining timestamp transfer\n"); + + // M2i and M3i use 64 bit timestamps and M4i and M2p 128 bit + if (stCard.bM2i || stCard.bM3i) + spcm_dwDefTransfer_i64 (stCard.hDrv, SPCM_BUF_TIMESTAMP, SPCM_DIR_CARDTOPC, 0, (void*) pqwTimestamps, 0, llMemsize / lSegmentsize * sizeof (uint64)); + else if (stCard.bM4i || stCard.bM2p || stCard.bM5i) + spcm_dwDefTransfer_i64 (stCard.hDrv, SPCM_BUF_TIMESTAMP, SPCM_DIR_CARDTOPC, 0, (void*) pqwTimestamps, 0, 2 * llMemsize / lSegmentsize * sizeof (uint64)); + } + + // starting the ABA DMA transfer + printf ("Defining ABA transfer\n"); + spcm_dwDefTransfer_i64 (stCard.hDrv, SPCM_BUF_ABA, SPCM_DIR_CARDTOPC, dwABANotifySize, pvABABuffer, 0, 20*dwABANotifySize); + printf ("Starting the extra DMA transfer\n"); + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_EXTRA_STARTDMA); + + // We'll start and wait untill the card has finished + printf ("Starting the card\n\n"); + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER); + + while(!stCard.bSetError && (lStatus & M2STAT_CARD_READY) != M2STAT_CARD_READY) + { + + spcm_dwGetParam_i64 (stCard.hDrv, SPC_ABA_AVAIL_USER_LEN, &llAvailABABytes); + spcm_dwGetParam_i64 (stCard.hDrv, SPC_ABA_AVAIL_USER_POS, &llByteABAPos); + + if ((llByteABAPos + llAvailABABytes) >= 20*dwABANotifySize) + { + llAvailABABytes = 20*dwABANotifySize - llByteABAPos; + } + + spcm_dwSetParam_i64 (stCard.hDrv, SPC_ABA_AVAIL_CARD_LEN, llAvailABABytes); + + spcm_dwGetParam_i32 (stCard.hDrv, SPC_M2STATUS, &lStatus ); + + if (llAvailABABytes > 0) + { + llABATransfer = llABATransfer + llAvailABABytes; + printf("\rABA data transfered so far: %lld; ", llABATransfer); + printf("Actually available ABA data: %lld", llAvailABABytes); + } + + } + + // we define the buffer for transfer and start the DMA transfer + printf ("\n\nStarting the DMA transfer and waiting until data is in PC memory\n"); + spcm_dwDefTransfer_i64 (stCard.hDrv, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, 0, pvBuffer, 0, qwMemInBytes); + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA); + + // check for error code + if (spcm_dwGetErrorInfo_i32 (stCard.hDrv, NULL, NULL, szBuffer)) + { + vFreeMemPageAligned (pvBuffer, qwMemInBytes); + vFreeMemPageAligned (pvABABuffer, qwABABufferLen_bytes); + return nSpcMErrorMessageStdOut (&stCard, szBuffer, false); + } + printf ("... acquisition ended, data has been transferred to PC memory\n"); + } + // wait for the timestamps (should be already done as we started the transfer before the card start) + if (bTimestampInstalled) + { + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_EXTRA_WAITDMA); + printf ("... timestamps have been transferred to PC memory\n"); + } + + + // ------------------------------------------------------------------------ + // we go through the segments, split the data in separate channels and show some results + if (!stCard.bSetError) + { + + // some additional information on the acquisition + printf ("\nData information:\n=================\n"); + printf ("Each segment is %.3f ms long\n", 1000.0 * lSegmentsize / stCard.llSetSamplerate); + printf ("Maximum pulse repetition frequency to reach with this setting is %.2f Hz\n", (double) stCard.llSetSamplerate / lSegmentsize); + + switch (stCard.eCardFunction) + { + case AnalogIn: + nShowAnalogData (&stCard, lSegmentsize, lPosttrigger, pvBuffer, bTimestampInstalled, bBaseXIOInstalled, pqwTimestamps); + break; + + case DigitalIn: + case DigitalIO: + break; + } + + if (bTimestampInstalled) + vFreeMemPageAligned (pqwTimestamps, qwTSBufferLen_bytes); + } + + spcm_dwInvalidateBuf (stCard.hDrv, SPCM_BUF_DATA); + spcm_dwInvalidateBuf (stCard.hDrv, SPCM_BUF_ABA); + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_STOP | M2CMD_DATA_STOPDMA ); + + vFreeMemPageAligned (pvBuffer, qwMemInBytes); + vFreeMemPageAligned (pvABABuffer, qwABABufferLen_bytes); + + // ------------------------------------------------------------------------ + // print error information if an error occured + if (stCard.bSetError) + return nSpcMErrorMessageStdOut (&stCard, "An error occured while programming the card:\n", true); + + + // clean up and close the driver + vSpcMCloseCard (&stCard); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/rec_std_aba/rec_std_aba.dsp b/Cpp/examples/c_cpp/rec_std_aba/rec_std_aba.dsp new file mode 100644 index 0000000000000000000000000000000000000000..87ee563446ed03f75c842a426936969c200231d9 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_aba/rec_std_aba.dsp @@ -0,0 +1,132 @@ +# Microsoft Developer Studio Project File - Name="rec_std_aba" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=rec_std_aba - Win32 Debug +!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE +!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl +!MESSAGE +!MESSAGE NMAKE /f "rec_std_aba.mak". +!MESSAGE +!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben +!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: +!MESSAGE +!MESSAGE NMAKE /f "rec_std_aba.mak" CFG="rec_std_aba - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "rec_std_aba - Win32 Release" (basierend auf "Win32 (x86) Console Application") +!MESSAGE "rec_std_aba - Win32 Debug" (basierend auf "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "rec_std_aba - 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 /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)" == "rec_std_aba - 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 /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 "rec_std_aba - Win32 Release" +# Name "rec_std_aba - Win32 Debug" +# Begin Group "header" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\c_header\dlltyp.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\regs.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcerr.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_drv.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_card.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_win32_msvcpp.lib +# End Source File +# End Group +# Begin Group "common" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\common\spcm_lib_card.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.cpp +# End Source File +# End Group +# Begin Source File + +SOURCE=.\rec_std_aba.cpp +# End Source File +# End Target +# End Project diff --git a/Cpp/examples/c_cpp/rec_std_aba/rec_std_aba.dsw b/Cpp/examples/c_cpp/rec_std_aba/rec_std_aba.dsw new file mode 100644 index 0000000000000000000000000000000000000000..ebb16f1ff8276fe0054df22c9afebd637d254dd6 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_aba/rec_std_aba.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN! + +############################################################################### + +Project: "rec_std_aba"=.\rec_std_aba.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/Cpp/examples/c_cpp/rec_std_aba/rec_std_aba.vcproj b/Cpp/examples/c_cpp/rec_std_aba/rec_std_aba.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..fdeab1ce51f5c4c6b09500e26db59539b490f986 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_aba/rec_std_aba.vcproj @@ -0,0 +1,580 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="rec_std_aba" + ProjectGUID="{FCC5524D-B6B2-4CD6-8E27-D45A29BD23F0}" + RootNamespace="rec_std_aba" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/rec_std_aba.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_std_aba.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_std_aba.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_std_aba.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_std_aba.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/rec_std_aba.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_std_aba.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_std_aba.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_std_aba.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_std_aba.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/rec_std_aba.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_std_aba.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_std_aba.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_std_aba.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_std_aba.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/rec_std_aba.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_std_aba.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_std_aba.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_std_aba.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_std_aba.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="header" + Filter="h;hpp;hxx;hm;inl" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_card.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_data.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_oswrap.h" + > + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="common" + > + <File + RelativePath="..\common\spcm_lib_card.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_data.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + </File> + </Filter> + <File + RelativePath="rec_std_aba.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/rec_std_aba/rec_std_aba.vcxproj b/Cpp/examples/c_cpp/rec_std_aba/rec_std_aba.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..b4bc272a83afbe7599da5a056757a5d59698826d --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_aba/rec_std_aba.vcxproj @@ -0,0 +1,266 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{FCC5524D-B6B2-4CD6-8E27-D45A29BD23F0}</ProjectGuid> + <RootNamespace>rec_std_aba</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rec_std_aba.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_std_aba.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_aba.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_aba.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rec_std_aba.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_std_aba.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_aba.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_aba.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rec_std_aba.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_aba.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_aba.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_aba.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rec_std_aba.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_aba.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_aba.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_aba.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\common\spcm_lib_card.h" /> + <ClInclude Include="..\common\spcm_lib_data.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="..\common\spcm_lib_card.cpp" /> + <ClCompile Include="..\common\spcm_lib_data.cpp" /> + <ClCompile Include="rec_std_aba.cpp" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_aba/rec_std_aba.vcxproj.filters b/Cpp/examples/c_cpp/rec_std_aba/rec_std_aba.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..ae47af1b1c7e78ca9afaa323a371d70e8edaaa61 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_aba/rec_std_aba.vcxproj.filters @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="header"> + <UniqueIdentifier>{3b77be4e-ed89-415d-8574-a090cdd7707e}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + <Filter Include="common"> + <UniqueIdentifier>{47b2b5fb-21db-4f53-b3bb-d43410cda573}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_card.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_data.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_oswrap.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\spcm_lib_card.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_data.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="rec_std_aba.cpp" /> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib"> + <Filter>header</Filter> + </CustomBuild> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib"> + <Filter>header</Filter> + </CustomBuild> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_average/makefile.rec_std_average b/Cpp/examples/c_cpp/rec_std_average/makefile.rec_std_average new file mode 100644 index 0000000000000000000000000000000000000000..32bdb9fe01b795cf5112c5e017e122cdd1dc3c18 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_average/makefile.rec_std_average @@ -0,0 +1,24 @@ +COMPILER = g++ +EXECUTABLE = rec_std_average +LIBS += -lspcm_linux -lrt -lpthread + +OBJECTS = \ + rec_std_average.o\ + ../common/spcm_lib_card.o\ + ../common/spcm_lib_data.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/rec_std_average/rec_std_average.bpf b/Cpp/examples/c_cpp/rec_std_average/rec_std_average.bpf new file mode 100644 index 0000000000000000000000000000000000000000..5da88241fe8e80944de42def849bf4eab8f1f666 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_average/rec_std_average.bpf @@ -0,0 +1,3 @@ +This file is used by the project manager only and should be treated like the project file + + main \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_average/rec_std_average.bpr b/Cpp/examples/c_cpp/rec_std_average/rec_std_average.bpr new file mode 100644 index 0000000000000000000000000000000000000000..fa7241ec4e629fbb0393ea5e00c67c50759c7e81 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_average/rec_std_average.bpr @@ -0,0 +1,107 @@ +<?xml version='1.0' encoding='utf-8' ?> +<!-- C++Builder XML Project --> +<PROJECT> + <MACROS> + <VERSION value="BCB.06.00"/> + <PROJECT value="rec_std_average.exe"/> + <OBJFILES value="rec_std_average.obj ..\common\spcm_lib_thread.obj + ..\common\spcm_lib_card.obj ..\common\spcm_lib_data.obj + ..\common\ostools\spcm_ostools_win.obj ..\sb5_file\sb5_file.obj"/> + <RESFILES value=""/> + <DEFFILE value=""/> + <RESDEPEN value="$(RESFILES)"/> + <LIBFILES value="..\c_header\spcm_win32_bcppb.lib"/> + <LIBRARIES value=""/> + <SPARELIBS value=""/> + <PACKAGES value="vcl.bpi rtl.bpi vclx.bpi bcbsmp.bpi dclocx.bpi"/> + <PATHCPP value=".;..\common;..\common;..\common;..\common\ostools;..\sb5_file"/> + <PATHPAS value=".;"/> + <PATHRC value=".;"/> + <PATHASM value=".;"/> + <DEBUGLIBPATH value="$(BCB)\lib\debug"/> + <RELEASELIBPATH value="$(BCB)\lib\release"/> + <LINKER value="ilink32"/> + <USERDEFINES value="_DEBUG"/> + <SYSDEFINES value="NO_STRICT;_NO_VCL;_RTLDLL;USEPACKAGES"/> + <MAINSOURCE value="rec_std_average.bpf"/> + <INCLUDEPATH value="C:\svnwork\spcm_drv_c\sb5_file;C:\svnwork\spcm_drv_c\common\ostools;C:\svnwork\spcm_drv_c\common;C:\svnwork\spcm_drv_c\rec_std_average;$(BCB)\include;$(BCB)\include\vcl"/> + <LIBPATH value="C:\svnwork\spcm_drv_c\sb5_file;C:\svnwork\spcm_drv_c\common\ostools;C:\svnwork\spcm_drv_c\common;C:\svnwork\spcm_drv_c\rec_std_average;$(BCB)\lib\obj;$(BCB)\lib"/> + <WARNINGS value="-w-par"/> + <OTHERFILES value=""/> + </MACROS> + <OPTIONS> + <CFLAG1 value="-tWC -tWM -Od -H=$(BCB)\lib\vcl60.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v + -vi- -c"/> + <PFLAGS value="-$YD -$W -$O- -$A8 -v -JPHNE -M"/> + <RFLAGS value=""/> + <AFLAGS value="/mx /w2 /zd"/> + <LFLAGS value="-Tpe -ap -D"" -x -Gn -v"/> + <OTHERFILES value=""/> + </OPTIONS> + <LINKER> + <ALLOBJ value="c0x32.obj $(PACKAGES) $(OBJFILES)"/> + <ALLRES value="$(RESFILES)"/> + <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib"/> + <OTHERFILES value=""/> + </LINKER> + <FILELIST> + <FILE FILENAME="rec_std_average.bpf" FORMNAME="" UNITNAME="rec_std_average" CONTAINERID="BPF" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="rec_std_average.cpp" FORMNAME="" UNITNAME="rec_std_average" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_thread.cpp" FORMNAME="" UNITNAME="spcm_lib_thread.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_card.cpp" FORMNAME="" UNITNAME="spcm_lib_card.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_data.cpp" FORMNAME="" UNITNAME="spcm_lib_data.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\c_header\spcm_win32_bcppb.lib" FORMNAME="" UNITNAME="spcm_win32_bcppb.lib" CONTAINERID="LibTool" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\ostools\spcm_ostools_win.cpp" FORMNAME="" UNITNAME="spcm_ostools_win" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\sb5_file\sb5_file.cpp" FORMNAME="" UNITNAME="sb5_file" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + </FILELIST> + <BUILDTOOLS> + </BUILDTOOLS> + + <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= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +[Parameters] +RunParams= +Launcher= +UseLauncher=0 +DebugCWD= +HostApplication= +RemoteHost= +RemotePath= +RemoteLauncher= +RemoteCWD= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 + </IDEOPTIONS> +</PROJECT> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_average/rec_std_average.cpp b/Cpp/examples/c_cpp/rec_std_average/rec_std_average.cpp new file mode 100644 index 0000000000000000000000000000000000000000..65b90b493478c064daf724cbbf996a3a18efc63e --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_average/rec_std_average.cpp @@ -0,0 +1,247 @@ +/* +************************************************************************** + +rec_std_average.cpp (c) Spectrum GmbH + +************************************************************************** + +Example for all acquisition cards with the option Average installed. + +Information about the different products and their drivers can be found +online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/platform-driver-and-series-differences + +Shows Average data acquisition using single mode (one shot). If +timestamp is installed the corresponding timestamp values are also read +out and displayed. + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_card.h" +#include "../common/spcm_lib_data.h" + +#include "../common/ostools/spcm_oswrap.h" +#include "../common/ostools/spcm_ostools.h" + +// ----- standard c include files ----- +#include <stdio.h> +#include <stdlib.h> + + + +/* +************************************************************************** +vDoCardSetup +************************************************************************** +*/ + +void vDoCardSetup (ST_SPCM_CARDINFO *pstCard, int64 llMemsize, int32 lSegmentsize, int32 lPosttrigger, int32 lAverages) + { + int i; + int64 llChannelMask; + + // Channel enable setup + llChannelMask = ((int64) 1 << pstCard->lMaxChannels) - 1; + + bSpcMSetupModeRecStdAverage(pstCard, llChannelMask, llMemsize, lSegmentsize, lPosttrigger, lAverages); + + // we try to set the samplerate to maximum samplerate on internal PLL, no clock output, + bSpcMSetupClockPLL (pstCard, pstCard->llMaxSamplerate , false); + printf ("Sampling rate set to %.1lf MHz\n", (double) pstCard->llSetSamplerate / 1000000); + + // we set trigger to external positive edge, please connect the trigger line! + printf ("\n!!! Using external trigger - please connect a signal to the trigger input !!!\n\n"); + //bSpcMSetupTrigExternal (pstCard, SPC_TM_POS, false, 0); + bSpcMSetupTrigChannel (pstCard, 0, SPC_TM_POS, 100); + + // program all input channels to +/-1 V and 50 ohm termination (if it's available) + for (i=0; i < pstCard->lMaxChannels; i++) + bSpcMSetupPathInputCh (pstCard, i, 0, 1000, 0); + } + + + +/* +************************************************************************** +nShowAnalogData +************************************************************************** +*/ + +int16 nShowAnalogData (ST_SPCM_CARDINFO *pstCard, int32 lSegmentsize, int32 lPosttrigger, void* pvBuffer, bool bAcquireTimestamps, uint64* pqwTimestamps, int32 lAverages) + { + int32* pplChannelData[SPCM_MAX_AICHANNEL]; + int i; + int32 lSegmentIdx; + + for (i=0; i<pstCard->lSetChannels; i++) + { + pplChannelData[i] = new int32[lSegmentsize]; + if (!pplChannelData[i]) + return nSpcMErrorMessageStdOut (pstCard, "Memory allocation error\n", false); + } + + // loop across all acquired segments + printf ("\n%8s %12s %12s %12s\n", "Segment", "Min", "Max", "Average"); + + // Display some information per segment + pstCard->uCfg.stAI.lMaxADCValue *= lAverages; // the maximum "ADC" value has increased because we added up lAverages segments + for (lSegmentIdx = 0; lSegmentIdx < (pstCard->llSetMemsize / lSegmentsize); lSegmentIdx++) + { + // split data function to have easier per channel access to the samples + bSpcMDemuxAnalogData (pstCard, (int32*)pvGetSegmentDataPointer (pstCard, pvBuffer, lSegmentsize, lSegmentIdx, 4), lSegmentsize, pplChannelData); + + // we just look at one certain to keep output simple independant of the number of activated channels + uint8 byChannel = 0; + printf ("%8d %9.2f mV %9.2f mV %9.2f mV", lSegmentIdx, + 1000.0 * dSpcMIntToVoltage (pstCard, 0, TSpcMCalcMin (pplChannelData[byChannel], (uint32) lSegmentsize)), + 1000.0 * dSpcMIntToVoltage (pstCard, 0, TSpcMCalcMax (pplChannelData[byChannel], (uint32) lSegmentsize)), + 1000.0 * dSpcMIntToVoltage (pstCard, 0, dSpcMCalcAverage (pplChannelData[byChannel], (uint32) lSegmentsize))); + + printf ("\n"); + } + + // clean up + for (i=0; i<pstCard->lSetChannels; i++) + delete [] (pplChannelData[i]); + + return 0; + } + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + char szBuffer[1024]; // a character buffer for any messages + ST_SPCM_CARDINFO stCard; // info structure of my card + int64 llMemsize; + int32 lSegmentsize, lPosttrigger, lAveragesPerSegment, lNumberOfSegments; + int32 lOversampling = 1; + uint64 qwMemInBytes; + void* pvBuffer; + + + // ------------------------------------------------------------------------ + // init card number 0 (the first card in the system), get some information and print it + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + if (bSpcMInitCardByIdx (&stCard, 1)) + //if (bSpcMInitCardByIdx (&stCard, "192.168.1.10", 0)) + { + printf (pszSpcMPrintDocumentationLink (&stCard, szBuffer, sizeof (szBuffer))); + printf (pszSpcMPrintCardInfo (&stCard, szBuffer, sizeof (szBuffer))); + } + else + return nSpcMErrorMessageStdOut (&stCard, "Error: Could not open card\n", true); + + // check whether we support this card type in the example + if (!stCard.bM4i) + return nSpcMErrorMessageStdOut (&stCard, "Error. Averaging only works on M4i cards\n", false); + if (stCard.eCardFunction != AnalogIn) + return nSpcMErrorMessageStdOut (&stCard, "Error: Card function not supported by this example\n", false); + if ((stCard.lExtFeatureMap & SPCM_FEAT_EXTFW_SEGAVERAGE) == 0) + return nSpcMErrorMessageStdOut (&stCard, "Error: Average Option not installed. Examples was done especially for this option!\n", false); + + + // ------------------------------------------------------------------------ + // do the card setup, error is routed in the structure so we don't care for the return values + lNumberOfSegments = 16; + lSegmentsize = KILO_B(8); + lPosttrigger = lSegmentsize - KILO_B(1); + lAveragesPerSegment = 16; + + llMemsize = (int64) lSegmentsize * (int64) lNumberOfSegments; + + if (!stCard.bSetError) + vDoCardSetup (&stCard, llMemsize, lSegmentsize, lPosttrigger, lAveragesPerSegment); + + // ------------------------------------------------------------------------ + // calculate the amount of data we need and allocate memory buffer + if (!stCard.bSetError) + { + // for averaging the number of bytes per sample is fixed to 4 (32 bit samples) + qwMemInBytes = (uint64) stCard.llSetMemsize * (uint64) sizeof(int32) * (uint64) stCard.lSetChannels; + + pvBuffer = pvAllocMemPageAligned (qwMemInBytes); + + if (!pvBuffer) + return nSpcMErrorMessageStdOut (&stCard, "Memory allocation error\n", false); + } + + // ------------------------------------------------------------------------ + // make acquisition and get data + if (!stCard.bSetError) + { + printf ("\n"); + + // We'll start and wait untill the card has finished or until a timeout occurs + spcm_dwSetParam_i32 (stCard.hDrv, SPC_TIMEOUT, 5000); + printf ("Starting the card and waiting for ready interrupt\n"); + if (spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_CARD_WAITREADY) == ERR_TIMEOUT) + { + vFreeMemPageAligned (pvBuffer, qwMemInBytes); + return nSpcMErrorMessageStdOut (&stCard, "... Timeout\n", false); + } + else + { + // we define the buffer for transfer and start the DMA transfer + printf ("Starting the DMA transfer and waiting until data is in PC memory\n"); + spcm_dwDefTransfer_i64 (stCard.hDrv, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, 0, pvBuffer, 0, qwMemInBytes); + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA); + + // check for error code + if (spcm_dwGetErrorInfo_i32 (stCard.hDrv, NULL, NULL, szBuffer)) + { + vFreeMemPageAligned (pvBuffer, qwMemInBytes); + return nSpcMErrorMessageStdOut (&stCard, szBuffer, false); + } + printf ("... acquisition ended, data has been transferred to PC memory\n"); + } + } + + // ------------------------------------------------------------------------ + // we go through the segments, split the data in separate channels and show some results + if (!stCard.bSetError) + { + // some additional information on the acquisition + printf ("\nData information:\n=================\n"); + printf ("Each segment is %.3f ms long\n", 1000.0 * lSegmentsize / stCard.llSetSamplerate); + printf ("Maximum pulse repetition frequency to reach with this setting is %.2f Hz\n", (double) stCard.llSetSamplerate / lSegmentsize); + + nShowAnalogData (&stCard, lSegmentsize, lPosttrigger, pvBuffer, false, NULL, lAveragesPerSegment); + } + + // ------------------------------------------------------------------------ + // print error information if an error occured + if (stCard.bSetError) + return nSpcMErrorMessageStdOut (&stCard, "An error occured while programming the card:\n", true); + + // clean up and close the driver + vSpcMCloseCard (&stCard); + vFreeMemPageAligned (pvBuffer, qwMemInBytes); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/rec_std_average/rec_std_average.dsp b/Cpp/examples/c_cpp/rec_std_average/rec_std_average.dsp new file mode 100644 index 0000000000000000000000000000000000000000..c51714829a5b14cf3c9e036285d912980014f6e6 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_average/rec_std_average.dsp @@ -0,0 +1,132 @@ +# Microsoft Developer Studio Project File - Name="rec_std_average" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=rec_std_average - Win32 Debug +!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE +!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl +!MESSAGE +!MESSAGE NMAKE /f "rec_std_average.mak". +!MESSAGE +!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben +!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: +!MESSAGE +!MESSAGE NMAKE /f "rec_std_average.mak" CFG="rec_std_average - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "rec_std_average - Win32 Release" (basierend auf "Win32 (x86) Console Application") +!MESSAGE "rec_std_average - Win32 Debug" (basierend auf "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "rec_std_average - 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 /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 /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 /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "rec_std_average - 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 /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 /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 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "rec_std_average - Win32 Release" +# Name "rec_std_average - Win32 Debug" +# Begin Group "common" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\common\spcm_lib_card.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.cpp +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_win32_msvcpp.lib +# End Source File +# End Group +# Begin Group "header" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\c_header\dlltyp.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\regs.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcerr.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_drv.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_card.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\rec_std_average.cpp +# End Source File +# End Target +# End Project diff --git a/Cpp/examples/c_cpp/rec_std_average/rec_std_average.dsw b/Cpp/examples/c_cpp/rec_std_average/rec_std_average.dsw new file mode 100644 index 0000000000000000000000000000000000000000..d91d264357d88d2418e407516c8daf26d747d3d8 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_average/rec_std_average.dsw @@ -0,0 +1,41 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "rec_std_average"=.\rec_std_average.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "rec_std_average_poll"=.\rec_std_average_poll.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/Cpp/examples/c_cpp/rec_std_average/rec_std_average.vcproj b/Cpp/examples/c_cpp/rec_std_average/rec_std_average.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..63a2b732004adf294e67d00574278dc715265e30 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_average/rec_std_average.vcproj @@ -0,0 +1,581 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="rec_std_average" + ProjectGUID="{DE7EFF20-D29A-489A-92B6-3056B9F21E93}" + RootNamespace="rec_std_average" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/rec_std_average.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_std_average.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + CompileAs="2" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_std_average.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_std_average.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_std_average.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/rec_std_average.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_std_average.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + CompileAs="2" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_std_average.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_std_average.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_std_average.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/rec_std_average.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_std_average.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_std_average.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_std_average.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_std_average.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/rec_std_average.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_std_average.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_std_average.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_std_average.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_std_average.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="common" + > + <File + RelativePath="..\common\spcm_lib_card.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_data.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="header" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_card.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_data.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_oswrap.h" + > + </File> + </Filter> + <File + RelativePath="rec_std_average.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/rec_std_average/rec_std_average.vcxproj b/Cpp/examples/c_cpp/rec_std_average/rec_std_average.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..ef25ddb3eb48063bd7e5c8832e46df76f09e0e7f --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_average/rec_std_average.vcxproj @@ -0,0 +1,268 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{DE7EFF20-D29A-489A-92B6-3056B9F21E93}</ProjectGuid> + <RootNamespace>rec_std_average</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rec_std_average.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_average.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + <CompileAs>CompileAsCpp</CompileAs> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_average.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_average.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rec_std_average.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_average.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <CompileAs>CompileAsCpp</CompileAs> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_average.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_average.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rec_std_average.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_std_average.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_average.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_average.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rec_std_average.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_std_average.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_average.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_average.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="..\common\spcm_lib_card.cpp" /> + <ClCompile Include="..\common\spcm_lib_data.cpp" /> + <ClCompile Include="rec_std_average.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\common\spcm_lib_card.h" /> + <ClInclude Include="..\common\spcm_lib_data.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> diff --git a/Cpp/examples/c_cpp/rec_std_average/rec_std_average.vcxproj.filters b/Cpp/examples/c_cpp/rec_std_average/rec_std_average.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..6dea331eb81f737822113577a8ca849d760ef473 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_average/rec_std_average.vcxproj.filters @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="common"> + <UniqueIdentifier>{52cf81df-983e-48d9-8ade-4cefd0f87806}</UniqueIdentifier> + </Filter> + <Filter Include="header"> + <UniqueIdentifier>{4876356c-e27a-4d7a-b8d1-90846fc00c26}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\spcm_lib_card.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_data.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="rec_std_average.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_card.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_data.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_oswrap.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_gate/makefile b/Cpp/examples/c_cpp/rec_std_gate/makefile new file mode 100644 index 0000000000000000000000000000000000000000..de6dc179ded5bfeeb9413d546aecb5879acdafeb --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_gate/makefile @@ -0,0 +1,24 @@ +COMPILER = g++ +EXECUTABLE = rec_std_gate +LIBS += -lspcm_linux -lrt -lpthread + +OBJECTS = \ + rec_std_gate.o\ + ../common/spcm_lib_card.o\ + ../common/spcm_lib_data.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/rec_std_gate/rec_std_gate.bpf b/Cpp/examples/c_cpp/rec_std_gate/rec_std_gate.bpf new file mode 100644 index 0000000000000000000000000000000000000000..5da88241fe8e80944de42def849bf4eab8f1f666 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_gate/rec_std_gate.bpf @@ -0,0 +1,3 @@ +This file is used by the project manager only and should be treated like the project file + + main \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_gate/rec_std_gate.bpr b/Cpp/examples/c_cpp/rec_std_gate/rec_std_gate.bpr new file mode 100644 index 0000000000000000000000000000000000000000..c00e9cb8cc3d33bf31cfee64bdd82a0e7210ecd0 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_gate/rec_std_gate.bpr @@ -0,0 +1,107 @@ +<?xml version='1.0' encoding='utf-8' ?> +<!-- C++Builder XML Project --> +<PROJECT> + <MACROS> + <VERSION value="BCB.06.00"/> + <PROJECT value="rec_std_gate.exe"/> + <OBJFILES value="rec_std_gate.obj ..\common\spcm_lib_thread.obj + ..\common\spcm_lib_card.obj ..\common\spcm_lib_data.obj + ..\common\ostools\spcm_ostools_win.obj ..\sb5_file\sb5_file.obj"/> + <RESFILES value=""/> + <DEFFILE value=""/> + <RESDEPEN value="$(RESFILES)"/> + <LIBFILES value="..\c_header\spcm_win32_bcppb.lib"/> + <LIBRARIES value=""/> + <SPARELIBS value=""/> + <PACKAGES value="vcl.bpi rtl.bpi vclx.bpi bcbsmp.bpi dclocx.bpi"/> + <PATHCPP value=".;..\common;..\common;..\common;..\common\ostools;..\sb5_file"/> + <PATHPAS value=".;"/> + <PATHRC value=".;"/> + <PATHASM value=".;"/> + <DEBUGLIBPATH value="$(BCB)\lib\debug"/> + <RELEASELIBPATH value="$(BCB)\lib\release"/> + <LINKER value="ilink32"/> + <USERDEFINES value="_DEBUG"/> + <SYSDEFINES value="NO_STRICT;_NO_VCL;_RTLDLL;USEPACKAGES"/> + <MAINSOURCE value="rec_std_gate.bpf"/> + <INCLUDEPATH value="C:\svnwork\spcm_drv_c\sb5_file;C:\svnwork\spcm_drv_c\common\ostools;C:\svnwork\spcm_drv_c\common;C:\svnwork\spcm_drv_c\rec_std_gate;$(BCB)\include;$(BCB)\include\vcl"/> + <LIBPATH value="C:\svnwork\spcm_drv_c\sb5_file;C:\svnwork\spcm_drv_c\common\ostools;C:\svnwork\spcm_drv_c\common;C:\svnwork\spcm_drv_c\rec_std_gate;$(BCB)\lib\obj;$(BCB)\lib"/> + <WARNINGS value="-w-par"/> + <OTHERFILES value=""/> + </MACROS> + <OPTIONS> + <CFLAG1 value="-tWC -tWM -Od -H=$(BCB)\lib\vcl60.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v + -vi- -c"/> + <PFLAGS value="-$YD -$W -$O- -$A8 -v -JPHNE -M"/> + <RFLAGS value=""/> + <AFLAGS value="/mx /w2 /zd"/> + <LFLAGS value="-Tpe -ap -D"" -x -Gn -v"/> + <OTHERFILES value=""/> + </OPTIONS> + <LINKER> + <ALLOBJ value="c0x32.obj $(PACKAGES) $(OBJFILES)"/> + <ALLRES value="$(RESFILES)"/> + <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib"/> + <OTHERFILES value=""/> + </LINKER> + <FILELIST> + <FILE FILENAME="rec_std_gate.bpf" FORMNAME="" UNITNAME="rec_std_gate" CONTAINERID="BPF" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="rec_std_gate.cpp" FORMNAME="" UNITNAME="rec_std_gate" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_thread.cpp" FORMNAME="" UNITNAME="spcm_lib_thread.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_card.cpp" FORMNAME="" UNITNAME="spcm_lib_card.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_data.cpp" FORMNAME="" UNITNAME="spcm_lib_data.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\c_header\spcm_win32_bcppb.lib" FORMNAME="" UNITNAME="spcm_win32_bcppb.lib" CONTAINERID="LibTool" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\ostools\spcm_ostools_win.cpp" FORMNAME="" UNITNAME="spcm_ostools_win" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\sb5_file\sb5_file.cpp" FORMNAME="" UNITNAME="sb5_file" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + </FILELIST> + <BUILDTOOLS> + </BUILDTOOLS> + + <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= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +[Parameters] +RunParams= +Launcher= +UseLauncher=0 +DebugCWD= +HostApplication= +RemoteHost= +RemotePath= +RemoteLauncher= +RemoteCWD= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 + </IDEOPTIONS> +</PROJECT> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_gate/rec_std_gate.cpp b/Cpp/examples/c_cpp/rec_std_gate/rec_std_gate.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ba436f4ba9b06bc7da591a31228cf0c0d0266102 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_gate/rec_std_gate.cpp @@ -0,0 +1,449 @@ +/* +************************************************************************** + +rec_std_gate.cpp (c) Spectrum GmbH + +************************************************************************** + +Example for all SpcMDrv based acquisition cards with the option +Gated Sampling and Timestamp installed. + +Information about the different products and their drivers can be found +online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/platform-driver-and-series-differences + +Shows Gated Sampling data acquisition using single mode (one shot). Start +position and length of the gates are recorded using the timestamp feature. + +This example is done quite simple and defines the number of gates that +one expects globally. However if you have no idea how many gates are +expected and you wish to read out all the timestamps it is necessary to +implement the timestamp readout dynamically. Please have a look at the +Gated Sampling FIFO example to see how this may look like. + +************************************************************************** + +Feel free to use this source for own projects and modify it in any kind +This example is provided "as is" without any guarantee. + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_card.h" +#include "../common/spcm_lib_data.h" + +#include "../common/ostools/spcm_oswrap.h" +#include "../common/ostools/spcm_ostools.h" + +// ----- standard c include files ----- +#include <stdio.h> +#include <stdlib.h> + + +// to keep it simple we define globally how many gate we will handle +// in this example. Each gate produces two timestamps +#define MAXGATES 1000 + + +// maximum output lines to keep display simple +#define MAXLINES 20 + + + +/* +************************************************************************** +vDoCardSetup +************************************************************************** +*/ + +void vDoCardSetup (ST_SPCM_CARDINFO *pstCard, int64 llMemsize, int32 lPreSamples, int32 lPostSamples) + { + int i; + int64 llChannelMask; + + // gated sampling with 256k memory, each gate segment has 16 samples of pre data and 16 samples of post data + if (pstCard->lMaxChannels >= 64) + llChannelMask = -1; // -1 is all bits set to 1 = 0xffffffffffffffff + else + llChannelMask = ((int64) 1 << pstCard->lMaxChannels) - 1; + + bSpcMSetupModeRecStdGate (pstCard, llChannelMask, llMemsize, lPreSamples, lPostSamples); + + // we try to set the samplerate to 10 MHz on internal PLL, no clock output, + // if the card can't run 10 MHz it is set to maximum sampling rate internally + bSpcMSetupClockPLL (pstCard, MEGA(10), false); + printf ("Sampling rate set to %.1lf MHz\n", (double) pstCard->llSetSamplerate / 1000000); + + // we set trigger to external high gate, please connect the trigger line! + printf ("\n!!! Using external trigger - please connect a signal to the trigger input !!!\n\n"); + bSpcMSetupTrigExternal (pstCard, SPC_TM_POS, false, 0); + + // type dependent card setup + switch (pstCard->eCardFunction) + { + + // analog acquisition card setup + case AnalogIn: + + // program all input channels to +/-1 V and 50 ohm termination (if it's available) + for (i=0; i < pstCard->lMaxChannels; i++) + bSpcMSetupInputChannel (pstCard, i, 1000, true); + break; + + // digital acquisition card setup + case DigitalIn: + case DigitalIO: + + // set all input channel groups to 110 ohm termination (if it's available) + for (i=0; i < pstCard->uCfg.stDIO.lGroups; i++) + bSpcMSetupDigitalInput (pstCard, i, true); + break; + } + + // set up the timestamp mode to standard + bSpcMSetupTimestamp (pstCard, SPC_TSMODE_STARTRESET | SPC_TSCNT_INTERNAL, 0); + } + + + + +/* +************************************************************************** +vShowAnalogData: displays the recorded data and timstamps. Does an average +over each gate segment and shows start position and length +************************************************************************** +*/ + +int16 nShowAnalogData (ST_SPCM_CARDINFO *pstCard, int32 lPreSamples, int32 lPostSamples, void* pvBuffer, uint64* pqwTimestamps, int64 llAvailTimestamps) + { + int i; + int16* ppnChannelData[SPCM_MAX_AICHANNEL]; + int32 lGateStartPos, lGateSegmentLen; + int32 lGateIdx; + int64 llGateCount; + + // allocate channel data + for (i=0; i<pstCard->lSetChannels; i++) + { + ppnChannelData[i] = new int16[(int32) pstCard->llSetMemsize]; + if (!ppnChannelData[i]) + return nSpcMErrorMessageStdOut (pstCard, "Memory allocation error\n", false); + } + + // split data function + if (pstCard->lBytesPerSample == 1) + bSpcMDemuxAnalogData (pstCard, (int8*)pvBuffer, (int32) pstCard->llSetMemsize, ppnChannelData); + else + bSpcMDemuxAnalogData (pstCard, (int16*)pvBuffer, (int32) pstCard->llSetMemsize, ppnChannelData); + + // some additional information on the acquisition + printf ("\nData information:\n=================\n"); + printf ("We've read %d timestamps, making %d gate segments\n", (int)llAvailTimestamps, (int)(llAvailTimestamps / 2)); + + // as the last gate is for sure not ending within the memory we only get one timestamp for this one + llGateCount = ((llAvailTimestamps + 1) / 2); + + // loop across all acquired gate segments and print some information + // keep in mind that each segment produces 2 timestamps + lGateStartPos = 0; + printf ("%6s %8s %8s %12s %15s %15s\n", "Index", "Pos", "Length", "Average Ch0", "Timestamp", "Timediff"); + for (lGateIdx = 0; (lGateIdx < llGateCount) && (lGateIdx < MAXLINES); lGateIdx ++) + { + + // M2i and M3i use 64 bit timestamps and M4i and M2p 128 bit + if (pstCard->bM2i || pstCard->bM3i) + lGateSegmentLen = (int32) (pqwTimestamps[2 * lGateIdx + 1] - pqwTimestamps[2 * lGateIdx]); + else if (pstCard->bM4i || pstCard->bM2p || pstCard->bM5i) + lGateSegmentLen = (int32) (pqwTimestamps[4 * lGateIdx + 2] - pqwTimestamps[4 * lGateIdx]); + + // the timestamps only calculate the real world gate signal, we have to add our pre and postsample + lGateSegmentLen += (lPreSamples + lPostSamples); + + // as the last gate didn't had a second timestamp we calc this length by the available data + if (lGateIdx == (llGateCount - 1)) + lGateSegmentLen = (int32) (pstCard->llSetMemsize - lGateStartPos); + + printf ("%6d %8d %8d %9.2f mV", + lGateIdx, + lGateStartPos, + lGateSegmentLen, + 1000.0 * dSpcMIntToVoltage (pstCard, 0, dSpcMCalcAverage (&ppnChannelData[0][lGateStartPos], lGateSegmentLen))); + + // M2i and M3i use 64 bit timestamps and M4i and M2p 128 bit + if (pstCard->bM2i || pstCard->bM3i) + printf (" %12.6f ms ", 1000.0 * (double) pqwTimestamps[2 * lGateIdx + 0] / pstCard->llSetSamplerate / pstCard->lOversampling); + else if (pstCard->bM4i || pstCard->bM2p || pstCard->bM5i) + printf (" %12.6f ms ", 1000.0 * (double) pqwTimestamps[4 * lGateIdx + 0] / pstCard->llSetSamplerate); + + // calc the difference to the last segment + if ((lGateIdx > 0) && (pstCard->bM2i || pstCard->bM3i)) + printf ("%12.6f ms", 1000.0 * (double) (pqwTimestamps[2 * lGateIdx] - pqwTimestamps[2 * (lGateIdx - 1)]) / pstCard->llSetSamplerate / pstCard->lOversampling); + else if ((lGateIdx > 0) && (pstCard->bM4i || pstCard->bM2p || pstCard->bM5i)) + printf ("%12.6f ms", 1000.0 * (double) (pqwTimestamps[4 * lGateIdx] - pqwTimestamps[4 * (lGateIdx - 1)]) / pstCard->llSetSamplerate); + + printf ("\n"); + lGateStartPos += lGateSegmentLen; + } + + // clean up + for (i=0; i<pstCard->lSetChannels; i++) + delete [] (ppnChannelData[i]); + + return 0; + } + +/* +************************************************************************** +nShowDigitalData +************************************************************************** +*/ + +int16 nShowDigitalData (ST_SPCM_CARDINFO *pstCard, void* pvBuffer, uint32 dwNrOfSamplesToShow) + { + int32 i, lChIdx; + uint32 dwSampleIdx; + int8* ppbyChannelData[SPCM_MAX_DIOCHANNEL]; + + // allocate channel data + for (i=0; i<pstCard->lSetChannels; i++) + { + ppbyChannelData[i] = new int8[(int32) pstCard->llSetMemsize]; + if (!ppbyChannelData[i]) + return nSpcMErrorMessageStdOut (pstCard, "Memory allocation error\n", false); + } + + // split data function + bSpcMDemuxDigitalDataToInt8 (pstCard, pvBuffer, (int32) (pstCard->llSetMemsize), ppbyChannelData); + + // print samples for each channel + printf ("\nPrint first %u samples of all channels:\n\n", dwNrOfSamplesToShow); + + for (dwSampleIdx=0; dwSampleIdx<dwNrOfSamplesToShow; dwSampleIdx++) + { + printf ("SampleNr.%u\n", dwSampleIdx); + + if (pstCard->lSetChannels < 16) + { + + // less than 16 channels + lChIdx = pstCard->lSetChannels-1; + + while (lChIdx >= 0) + { + printf ("[D%d] = %d ", lChIdx, ppbyChannelData[lChIdx][dwSampleIdx]); + lChIdx--; + } + + printf ("\n\n"); + } + else + { + + // 16 channels and more + lChIdx = pstCard->lSetChannels-1; + + while (lChIdx > 0) + { + printf ("[D%d ......... D%d] ", lChIdx, lChIdx - 15); + lChIdx -= 16; + } + + printf ("\n"); + + lChIdx = pstCard->lSetChannels-1; + while (lChIdx >= 0) + { + printf ("%d", ppbyChannelData[lChIdx][dwSampleIdx]); + + if (!(lChIdx%16)) + printf (" "); + else + if (!(lChIdx%4)) + printf ("."); + + lChIdx--; + } + + printf ("\n\n"); + } + } + + for (i=0; i<pstCard->lSetChannels; i++) + delete [] (ppbyChannelData[i]); + + return 0; + } + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + char szBuffer[1024]; // a character buffer for any messages + ST_SPCM_CARDINFO stCard; // info structure of my card + int64 llMemsize; + int32 lPreSamples, lPostSamples; + int32 lOversampling = 1; + int64 llAvailTimestamps, llAvailTimestampBytes; + uint64 qwMemInBytes; + uint64 qwTSBufferLen_bytes = 0; + uint64* pqwTimestamps; + void* pvBuffer; + + + // ------------------------------------------------------------------------ + // init card number 0 (the first card in the system), get some information and print it + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + if (bSpcMInitCardByIdx (&stCard, 0)) + //if (bSpcMInitCardByIdx (&stCard, "192.168.1.10", 0)) + { + printf (pszSpcMPrintDocumentationLink (&stCard, szBuffer, sizeof (szBuffer))); + printf (pszSpcMPrintCardInfo (&stCard, szBuffer, sizeof (szBuffer))); + } + else + return nSpcMErrorMessageStdOut (&stCard, "Error: Could not open card\n", true); + + + // check whether we support this card type in the example + if ((stCard.eCardFunction != AnalogIn) && (stCard.eCardFunction != DigitalIn) && (stCard.eCardFunction != DigitalIO)) + return nSpcMErrorMessageStdOut (&stCard, "Error: Card function not supported by this example\n", false); + if ((stCard.lFeatureMap & SPCM_FEAT_GATE) == 0) + return nSpcMErrorMessageStdOut (&stCard, "Error: Gated Sampling Option not installed. Examples was done especially for this option!\n", false); + if ((stCard.lFeatureMap & SPCM_FEAT_TIMESTAMP) == 0) + return nSpcMErrorMessageStdOut (&stCard, "Error: Timestamp Option not installed. Examples was done especially for this option!\n", false); + + + // ------------------------------------------------------------------------ + // do the card setup, error is routed in the structure so we don't care for the return values + llMemsize = KILO_B(64); + lPreSamples = 32; + lPostSamples = 32; + if (!stCard.bSetError) + vDoCardSetup (&stCard, llMemsize, lPreSamples, lPostSamples); + + // ------------------------------------------------------------------------ + // calculate the amount of data we need and allocate memory buffer + if (!stCard.bSetError) + { + switch (stCard.eCardFunction) + { + case AnalogIn: + qwMemInBytes = stCard.llSetMemsize * stCard.lBytesPerSample * stCard.lSetChannels; + break; + + case DigitalIn: + case DigitalIO: + qwMemInBytes = stCard.llSetMemsize; + break; + } + + + // M2i and M3i use 64 bit timestamps and M4i and M2p 128 bit + if (stCard.bM2i || stCard.bM3i) + qwTSBufferLen_bytes = sizeof (uint64) * MAXGATES * 2; + else if (stCard.bM4i || stCard.bM2p || stCard.bM5i) + qwTSBufferLen_bytes = 2ULL * sizeof (uint64) * MAXGATES * 2; + + pqwTimestamps = (uint64*)pvAllocMemPageAligned (qwTSBufferLen_bytes); + + pvBuffer = pvAllocMemPageAligned (qwMemInBytes); + if (!pvBuffer || !pqwTimestamps) + return nSpcMErrorMessageStdOut (&stCard, "Memory allocation error\n", false); + } + + // ------------------------------------------------------------------------ + // make acquisition and get data + if (!stCard.bSetError) + { + // We'll start and wait untill the card has finished or until a timeout occurs + + // M2i and M3i use 64 bit timestamps and M4i and M2p 128 bit + if (stCard.bM2i || stCard.bM3i) + spcm_dwDefTransfer_i64 (stCard.hDrv, SPCM_BUF_TIMESTAMP, SPCM_DIR_CARDTOPC, 0, (void*) pqwTimestamps, 0, MAXGATES * 2 * sizeof (uint64)); + else if (stCard.bM4i || stCard.bM2p || stCard.bM5i) + spcm_dwDefTransfer_i64 (stCard.hDrv, SPCM_BUF_TIMESTAMP, SPCM_DIR_CARDTOPC, 0, (void*) pqwTimestamps, 0, MAXGATES * 4 * sizeof (uint64)); + + spcm_dwSetParam_i32 (stCard.hDrv, SPC_TIMEOUT, 5000); + printf ("Starting the card together with timestamp transfer and waiting for ready interrupt\n"); + if (spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_START | M2CMD_EXTRA_STARTDMA | M2CMD_CARD_ENABLETRIGGER | M2CMD_CARD_WAITREADY) == ERR_TIMEOUT) + { + vFreeMemPageAligned (pvBuffer, qwMemInBytes); + return nSpcMErrorMessageStdOut (&stCard, "... Timeout", false); + } + else + { + + // we define the buffer for transfer and start the DMA transfer + printf ("Starting the DMA transfer and waiting until data is in PC memory\n"); + spcm_dwDefTransfer_i64 (stCard.hDrv, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, 0, pvBuffer, 0, qwMemInBytes); + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA); + + // check for error code + if (spcm_dwGetErrorInfo_i32 (stCard.hDrv, NULL, NULL, szBuffer)) + { + vFreeMemPageAligned (pvBuffer, qwMemInBytes); + return nSpcMErrorMessageStdOut (&stCard, szBuffer, false); + } + printf ("... acquisition ended, data has been transferred to PC memory\n"); + + // we read out timestamps (should be already done as we started timestamp read together with card + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_EXTRA_WAITDMA); + spcm_dwGetParam_i64 (stCard.hDrv, SPC_TS_AVAIL_USER_LEN, &llAvailTimestampBytes); + llAvailTimestamps = llAvailTimestampBytes / 8; + printf ("... timestamps have been transferred to PC memory\n"); + } + } + + + + // ------------------------------------------------------------------------ + // we do something with the acquired data + if (!stCard.bSetError) + switch (stCard.eCardFunction) + { + case AnalogIn: + nShowAnalogData (&stCard, lPreSamples, lPostSamples, pvBuffer, pqwTimestamps, llAvailTimestamps); + break; + + case DigitalIn: + case DigitalIO: + + // show first 10 samples for each channel + nShowDigitalData (&stCard, pvBuffer, 10); + break; + } + + + + // ------------------------------------------------------------------------ + // print error information if an error occured + if (stCard.bSetError) + return nSpcMErrorMessageStdOut (&stCard, "An error occured while programming the card:\n", true); + + + // clean up and close the driver + vSpcMCloseCard (&stCard); + vFreeMemPageAligned (pvBuffer, qwMemInBytes); + vFreeMemPageAligned (pqwTimestamps, qwTSBufferLen_bytes); + + return EXIT_SUCCESS; + } diff --git a/Cpp/examples/c_cpp/rec_std_gate/rec_std_gate.dsp b/Cpp/examples/c_cpp/rec_std_gate/rec_std_gate.dsp new file mode 100644 index 0000000000000000000000000000000000000000..725a7e8666d5dd2fb91dfe9dbe2892fa432bc713 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_gate/rec_std_gate.dsp @@ -0,0 +1,132 @@ +# Microsoft Developer Studio Project File - Name="rec_std_gate" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=rec_std_gate - Win32 Debug +!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE +!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl +!MESSAGE +!MESSAGE NMAKE /f "rec_std_gate.mak". +!MESSAGE +!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben +!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: +!MESSAGE +!MESSAGE NMAKE /f "rec_std_gate.mak" CFG="rec_std_gate - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "rec_std_gate - Win32 Release" (basierend auf "Win32 (x86) Console Application") +!MESSAGE "rec_std_gate - Win32 Debug" (basierend auf "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "rec_std_gate - 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 /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 /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 /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "rec_std_gate - 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 /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 /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 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "rec_std_gate - Win32 Release" +# Name "rec_std_gate - Win32 Debug" +# Begin Group "common" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\common\spcm_lib_card.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.cpp +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_win32_msvcpp.lib +# End Source File +# End Group +# Begin Group "header" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\c_header\dlltyp.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\regs.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcerr.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_drv.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_card.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\rec_std_gate.cpp +# End Source File +# End Target +# End Project diff --git a/Cpp/examples/c_cpp/rec_std_gate/rec_std_gate.dsw b/Cpp/examples/c_cpp/rec_std_gate/rec_std_gate.dsw new file mode 100644 index 0000000000000000000000000000000000000000..8850ea7fa88f09fae4d412bd78ec5067351938bc --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_gate/rec_std_gate.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN! + +############################################################################### + +Project: "rec_std_gate"=.\rec_std_gate.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/Cpp/examples/c_cpp/rec_std_gate/rec_std_gate.vcproj b/Cpp/examples/c_cpp/rec_std_gate/rec_std_gate.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..613a5b1edd0f2c3e3f3fc792b445bcb42f809ee0 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_gate/rec_std_gate.vcproj @@ -0,0 +1,579 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="rec_std_gate" + ProjectGUID="{D750729D-A440-460A-BD49-065588423AC8}" + RootNamespace="rec_std_gate" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/rec_std_gate.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_std_gate.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_std_gate.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_std_gate.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_std_gate.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/rec_std_gate.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_std_gate.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_std_gate.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_std_gate.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_std_gate.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/rec_std_gate.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_std_gate.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_std_gate.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_std_gate.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_std_gate.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/rec_std_gate.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_std_gate.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_std_gate.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_std_gate.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_std_gate.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="common" + > + <File + RelativePath="..\common\spcm_lib_card.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_data.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="header" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_card.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_data.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_oswrap.h" + > + </File> + </Filter> + <File + RelativePath="rec_std_gate.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/rec_std_gate/rec_std_gate.vcxproj b/Cpp/examples/c_cpp/rec_std_gate/rec_std_gate.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..db089c0e892ce81eb177c017fa5e3764f5f144e2 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_gate/rec_std_gate.vcxproj @@ -0,0 +1,266 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{D750729D-A440-460A-BD49-065588423AC8}</ProjectGuid> + <RootNamespace>rec_std_gate</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rec_std_gate.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_gate.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_gate.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_gate.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rec_std_gate.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_gate.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_gate.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_gate.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rec_std_gate.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_std_gate.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_gate.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_gate.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rec_std_gate.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_std_gate.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_gate.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_gate.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="..\common\spcm_lib_card.cpp" /> + <ClCompile Include="..\common\spcm_lib_data.cpp" /> + <ClCompile Include="rec_std_gate.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\common\spcm_lib_card.h" /> + <ClInclude Include="..\common\spcm_lib_data.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_gate/rec_std_gate.vcxproj.filters b/Cpp/examples/c_cpp/rec_std_gate/rec_std_gate.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..e0bc7e3f2ef02316045dc21690591df1d27a1444 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_gate/rec_std_gate.vcxproj.filters @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="common"> + <UniqueIdentifier>{928c6af4-dd08-4cfe-9478-2d1b0ab6fdc4}</UniqueIdentifier> + </Filter> + <Filter Include="header"> + <UniqueIdentifier>{98984fdc-356a-4ec9-9937-844a503e2879}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\spcm_lib_card.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_data.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="rec_std_gate.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_card.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_data.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_oswrap.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_multi/makefile.rec_std_multi b/Cpp/examples/c_cpp/rec_std_multi/makefile.rec_std_multi new file mode 100644 index 0000000000000000000000000000000000000000..eb533df132636986209f25e8261ccc7bcd124795 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_multi/makefile.rec_std_multi @@ -0,0 +1,24 @@ +COMPILER = g++ +EXECUTABLE = rec_std_multi +LIBS += -lspcm_linux -lrt -lpthread + +OBJECTS = \ + rec_std_multi.o\ + ../common/spcm_lib_card.o\ + ../common/spcm_lib_data.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/rec_std_multi/makefile.rec_std_multi_poll b/Cpp/examples/c_cpp/rec_std_multi/makefile.rec_std_multi_poll new file mode 100644 index 0000000000000000000000000000000000000000..081eaf36125deb453a66ef56896a4cf404ec60ec --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_multi/makefile.rec_std_multi_poll @@ -0,0 +1,24 @@ +COMPILER = g++ +EXECUTABLE = rec_std_multi_poll +LIBS += -lspcm_linux -lrt -lpthread + +OBJECTS = \ + rec_std_multi_poll.o\ + ../common/spcm_lib_card.o\ + ../common/spcm_lib_data.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi.bpf b/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi.bpf new file mode 100644 index 0000000000000000000000000000000000000000..5da88241fe8e80944de42def849bf4eab8f1f666 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi.bpf @@ -0,0 +1,3 @@ +This file is used by the project manager only and should be treated like the project file + + main \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi.bpr b/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi.bpr new file mode 100644 index 0000000000000000000000000000000000000000..77e1f386aed9c511154a44134f33670beeb16189 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi.bpr @@ -0,0 +1,107 @@ +<?xml version='1.0' encoding='utf-8' ?> +<!-- C++Builder XML Project --> +<PROJECT> + <MACROS> + <VERSION value="BCB.06.00"/> + <PROJECT value="rec_std_multi.exe"/> + <OBJFILES value="rec_std_multi.obj ..\common\spcm_lib_thread.obj + ..\common\spcm_lib_card.obj ..\common\spcm_lib_data.obj + ..\common\ostools\spcm_ostools_win.obj ..\sb5_file\sb5_file.obj"/> + <RESFILES value=""/> + <DEFFILE value=""/> + <RESDEPEN value="$(RESFILES)"/> + <LIBFILES value="..\c_header\spcm_win32_bcppb.lib"/> + <LIBRARIES value=""/> + <SPARELIBS value=""/> + <PACKAGES value="vcl.bpi rtl.bpi vclx.bpi bcbsmp.bpi dclocx.bpi"/> + <PATHCPP value=".;..\common;..\common;..\common;..\common\ostools;..\sb5_file"/> + <PATHPAS value=".;"/> + <PATHRC value=".;"/> + <PATHASM value=".;"/> + <DEBUGLIBPATH value="$(BCB)\lib\debug"/> + <RELEASELIBPATH value="$(BCB)\lib\release"/> + <LINKER value="ilink32"/> + <USERDEFINES value="_DEBUG"/> + <SYSDEFINES value="NO_STRICT;_NO_VCL;_RTLDLL;USEPACKAGES"/> + <MAINSOURCE value="rec_std_multi.bpf"/> + <INCLUDEPATH value="C:\svnwork\spcm_drv_c\sb5_file;C:\svnwork\spcm_drv_c\common\ostools;C:\svnwork\spcm_drv_c\common;C:\svnwork\spcm_drv_c\rec_std_multi;$(BCB)\include;$(BCB)\include\vcl"/> + <LIBPATH value="C:\svnwork\spcm_drv_c\sb5_file;C:\svnwork\spcm_drv_c\common\ostools;C:\svnwork\spcm_drv_c\common;C:\svnwork\spcm_drv_c\rec_std_multi;$(BCB)\lib\obj;$(BCB)\lib"/> + <WARNINGS value="-w-par"/> + <OTHERFILES value=""/> + </MACROS> + <OPTIONS> + <CFLAG1 value="-tWC -tWM -Od -H=$(BCB)\lib\vcl60.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v + -vi- -c"/> + <PFLAGS value="-$YD -$W -$O- -$A8 -v -JPHNE -M"/> + <RFLAGS value=""/> + <AFLAGS value="/mx /w2 /zd"/> + <LFLAGS value="-Tpe -ap -D"" -x -Gn -v"/> + <OTHERFILES value=""/> + </OPTIONS> + <LINKER> + <ALLOBJ value="c0x32.obj $(PACKAGES) $(OBJFILES)"/> + <ALLRES value="$(RESFILES)"/> + <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib"/> + <OTHERFILES value=""/> + </LINKER> + <FILELIST> + <FILE FILENAME="rec_std_multi.bpf" FORMNAME="" UNITNAME="rec_std_multi" CONTAINERID="BPF" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="rec_std_multi.cpp" FORMNAME="" UNITNAME="rec_std_multi" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_thread.cpp" FORMNAME="" UNITNAME="spcm_lib_thread.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_card.cpp" FORMNAME="" UNITNAME="spcm_lib_card.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_data.cpp" FORMNAME="" UNITNAME="spcm_lib_data.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\c_header\spcm_win32_bcppb.lib" FORMNAME="" UNITNAME="spcm_win32_bcppb.lib" CONTAINERID="LibTool" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\ostools\spcm_ostools_win.cpp" FORMNAME="" UNITNAME="spcm_ostools_win" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\sb5_file\sb5_file.cpp" FORMNAME="" UNITNAME="sb5_file" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + </FILELIST> + <BUILDTOOLS> + </BUILDTOOLS> + + <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= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +[Parameters] +RunParams= +Launcher= +UseLauncher=0 +DebugCWD= +HostApplication= +RemoteHost= +RemotePath= +RemoteLauncher= +RemoteCWD= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 + </IDEOPTIONS> +</PROJECT> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi.cpp b/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi.cpp new file mode 100644 index 0000000000000000000000000000000000000000..19c7517d753ba464b50cc6b4953b307c95a343bc --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi.cpp @@ -0,0 +1,512 @@ +/* +************************************************************************** + +rec_std_multi.cpp (c) Spectrum GmbH + +************************************************************************** + +Example for all SpcMDrv based acquisition cards with the option +Multiple Recording installed. + +Information about the different products and their drivers can be found +online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/platform-driver-and-series-differences + +Shows Multiple Recoridng data acquisition using single mode (one shot). If +timestamp is installed the corresponding timestamp values are also read +out and displayed. + +If Timestamp and BaseXIO are installed the BaseXIO lines are set to the +timestamp acquisition mode and are sampled on every trigger event. The +samples BaseXIO lines are also shown. + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_card.h" +#include "../common/spcm_lib_data.h" + +#include "../common/ostools/spcm_oswrap.h" +#include "../common/ostools/spcm_ostools.h" + +// ----- standard c include files ----- +#include <stdio.h> +#include <stdlib.h> + + + +/* +************************************************************************** +vDoCardSetup +************************************************************************** +*/ + +void vDoCardSetup (ST_SPCM_CARDINFO *pstCard, int64 llMemsize, int32 lSegmentsize, int32 lPosttrigger) + { + int i; + int64 llChannelMask; + + // Multiple Recording setup + if (pstCard->lMaxChannels >= 64) + llChannelMask = -1; // -1 is all bits set to 1 = 0xffffffffffffffff + else + llChannelMask = ((int64) 1 << pstCard->lMaxChannels) - 1; + + bSpcMSetupModeRecStdMulti (pstCard, llChannelMask, llMemsize, lSegmentsize, lPosttrigger); + + // we try to set the samplerate to 1/4 of maximum samplerate on internal PLL, no clock output, + // if the card can't run 10 MHz it is set to maximum sampling rate internally + bSpcMSetupClockPLL (pstCard, pstCard->llMaxSamplerate / 4, false); + printf ("Sampling rate set to %.1lf MHz\n", (double) pstCard->llSetSamplerate / 1000000); + + // we set trigger to external positive edge, please connect the trigger line! + printf ("\n!!! Using external trigger - please connect a signal to the trigger input !!!\n\n"); + bSpcMSetupTrigExternal (pstCard, SPC_TM_POS, false, 0); + + // type dependent card setup + switch (pstCard->eCardFunction) + { + + // analog acquisition card setup + case AnalogIn: + + // program all input channels to +/-1 V and 50 ohm termination (if it's available) + for (i=0; i < pstCard->lMaxChannels; i++) + if (pstCard->bM2i || pstCard->bM2p) + bSpcMSetupInputChannel (pstCard, i, 1000, true); + else if (pstCard->bM3i || pstCard->bM4i || pstCard->bM5i) + bSpcMSetupPathInputCh (pstCard, i, 0, 1000, 0, false, true, true); + break; + + // digital acquisition card setup + case DigitalIn: + case DigitalIO: + + // set all input channel groups to 110 ohm termination (if it's available) + for (i=0; i < pstCard->uCfg.stDIO.lGroups; i++) + bSpcMSetupDigitalInput (pstCard, i, true); + break; + } + + + // if timestamp and basexio are installed we acquire the asynchronous inputs with the timestamps + if ((pstCard->lFeatureMap & SPCM_FEAT_TIMESTAMP) && (pstCard->lFeatureMap & SPCM_FEAT_BASEXIO)) + bSpcMSetupTimestamp (pstCard, SPC_TSMODE_STANDARD | SPC_TSCNT_INTERNAL | SPC_TSXIOACQ_ENABLE, 0); + + // set up the timestamp mode to standard if timestamp is installed + else if ((pstCard->lFeatureMap & SPCM_FEAT_TIMESTAMP) != 0) + { + int32 lAvailTSModes = 0; + spcm_dwGetParam_i32 (pstCard->hDrv, SPC_TIMESTAMP_AVAILMODES, &lAvailTSModes); + + int32 lTSCmd = SPC_TSMODE_STANDARD | SPC_TSCNT_INTERNAL; + if (lAvailTSModes & SPC_TSFEAT_TRGSRC) + lTSCmd |= SPC_TSFEAT_TRGSRC; // acquire trigger sources + if (lAvailTSModes & SPC_TSXIOACQ_ENABLE) + lTSCmd |= SPC_TSXIOACQ_ENABLE; // acquire bits on multipurpose lines + bSpcMSetupTimestamp (pstCard, lTSCmd, 0); + } + } + + + +/* +************************************************************************** +nShowAnalogData +************************************************************************** +*/ + +template < typename T > +int16 nShowAnalogData (ST_SPCM_CARDINFO *pstCard, int32 lSegmentsize, int32 lPosttrigger, void* pvBuffer, bool bTimestampInstalled, bool bBaseXIO, bool bTrigSrc, uint64* pqwTimestamps) + { + T* ppTChannelData[SPCM_MAX_AICHANNEL]; + int i; + int32 lSegmentIdx; + uint32 dwBaseXIOLines; + + for (i = 0; i < pstCard->lSetChannels; i++) + { + ppTChannelData[i] = new T[lSegmentsize]; + if (!ppTChannelData[i]) + return nSpcMErrorMessageStdOut (pstCard, "Memory allocation error\n", false); + } + + + // loop across all acquired segments + if (bTimestampInstalled && bBaseXIO) + printf ("\n%8s %12s %12s %12s %4s %15s %10s\n", "Segment", "Min", "Max", "Average", "BXIO", "Timestamp", "Timediff"); + else if (bTimestampInstalled && bTrigSrc) + printf ("\n%8s %12s %12s %12s %15s %10s %16s\n", "Segment", "Min", "Max", "Average", "Timestamp", "Timediff", "Trigger Source"); + else if (bTimestampInstalled) + printf ("\n%8s %12s %12s %12s %15s %10s\n", "Segment", "Min", "Max", "Average", "Timestamp", "Timediff"); + else + printf ("\n%8s %12s %12s %12s\n", "Segment", "Min", "Max", "Average"); + for (lSegmentIdx = 0; lSegmentIdx < (pstCard->llSetMemsize / lSegmentsize); lSegmentIdx++) + { + + // split data function + bSpcMDemuxAnalogData (pstCard, (T*)pvGetSegmentDataPointer (pstCard, pvBuffer, lSegmentsize, lSegmentIdx, pstCard->lBytesPerSample), lSegmentsize, ppTChannelData); + + // we just look at channel 0 to keep output simple independant of the number of channels + printf ("%8d %9.2f mV %9.2f mV %9.2f mV ", lSegmentIdx, + 1000.0 * dSpcMIntToVoltage (pstCard, 0, TSpcMCalcMin (ppTChannelData[0], (uint32) lSegmentsize)), + 1000.0 * dSpcMIntToVoltage (pstCard, 0, TSpcMCalcMax (ppTChannelData[0], (uint32) lSegmentsize)), + 1000.0 * dSpcMIntToVoltage (pstCard, 0, dSpcMCalcAverage (ppTChannelData[0], (uint32) lSegmentsize))); + + + // if basexio is installed we split the 8 asynchronous lines and clean up the timestamp + if (bBaseXIO) + { + dwBaseXIOLines = (uint32) (pqwTimestamps[lSegmentIdx] >> 56); + + // unmask the BaseXIOLines from the timestamps + pqwTimestamps[lSegmentIdx] &= ~(((uint64) 0xff000000) << 32); + printf (" %02x ", dwBaseXIOLines); + } + + // print the timestamps and the difference, keeping track of the oversampling factor + if (bTimestampInstalled) + { + + // M2i and M3i use 64 bit timestamps, M4i, M2p and M5i 128 bit + if (pstCard->bM2i || pstCard->bM3i) + printf ("%12.6f ms ", 1000.0 * (double) ((int64) pqwTimestamps[lSegmentIdx]) / pstCard->llSetSamplerate / pstCard->lOversampling); + else if (pstCard->bM4i || pstCard->bM2p || pstCard->bM5i) + printf ("%12.6f ms ", 1000.0 * (double) ((int64) pqwTimestamps[2 * lSegmentIdx]) / pstCard->llSetSamplerate); + + // print the difference, starting with segment 1 + if (lSegmentIdx > 0) + { + + // M2i and M3i use 64 bit timestamps, M4i, M2p and M5i 128 bit + if (pstCard->bM2i || pstCard->bM3i) + printf ("%7.2f ms", 1000.0 * (double) (int64) (pqwTimestamps[lSegmentIdx] - pqwTimestamps[lSegmentIdx - 1]) / pstCard->llSetSamplerate / pstCard->lOversampling); + else if (pstCard->bM4i || pstCard->bM2p || pstCard->bM5i) + printf ("%7.2f ms", 1000.0 * (double) (int64) (pqwTimestamps[2*lSegmentIdx] - pqwTimestamps[2*lSegmentIdx - 2]) / pstCard->llSetSamplerate); + } + else + printf (" "); // for trigger source alignment + + // print trigger sources for each segment + if (bTrigSrc) + { + if ((pqwTimestamps[2*lSegmentIdx + 1]) & SPC_TRGSRC_MASK_CH0) + printf (" Ch0"); + if ((pqwTimestamps[2*lSegmentIdx + 1]) & SPC_TRGSRC_MASK_CH1) + printf (" Ch1"); + if ((pqwTimestamps[2*lSegmentIdx + 1]) & SPC_TRGSRC_MASK_CH2) + printf (" Ch2"); + if ((pqwTimestamps[2*lSegmentIdx + 1]) & SPC_TRGSRC_MASK_CH3) + printf (" Ch3"); + if ((pqwTimestamps[2*lSegmentIdx + 1]) & SPC_TRGSRC_MASK_CH4) + printf (" Ch4"); + if ((pqwTimestamps[2*lSegmentIdx + 1]) & SPC_TRGSRC_MASK_CH5) + printf (" Ch5"); + if ((pqwTimestamps[2*lSegmentIdx + 1]) & SPC_TRGSRC_MASK_CH6) + printf (" Ch6"); + if ((pqwTimestamps[2*lSegmentIdx + 1]) & SPC_TRGSRC_MASK_CH7) + printf (" Ch7"); + if ((pqwTimestamps[2*lSegmentIdx + 1]) & SPC_TRGSRC_MASK_EXT0) + printf (" EXT0"); + if ((pqwTimestamps[2*lSegmentIdx + 1]) & SPC_TRGSRC_MASK_EXT1) + printf (" EXT1"); + if ((pqwTimestamps[2*lSegmentIdx + 1]) & SPC_TRGSRC_MASK_FORCE) + printf (" FORCE"); + } + } + + + printf ("\n"); + } + + // clean up + for (i = 0; i < pstCard->lSetChannels; i++) + delete [] (ppTChannelData[i]); + + return 0; + } + +/* +************************************************************************** +nShowDigitalData +************************************************************************** +*/ + +int16 nShowDigitalData (ST_SPCM_CARDINFO *pstCard, void* pvBuffer, uint32 dwNrOfSamplesToShow) + { + int32 i, lChIdx; + uint32 dwSampleIdx; + int8* ppbyChannelData[SPCM_MAX_DIOCHANNEL]; + + // allocate channel data + for (i=0; i<pstCard->lSetChannels; i++) + { + ppbyChannelData[i] = new int8[(int32) pstCard->llSetMemsize]; + if (!ppbyChannelData[i]) + return nSpcMErrorMessageStdOut (pstCard, "Memory allocation error\n", false); + } + + // split data function + bSpcMDemuxDigitalDataToInt8 (pstCard, pvBuffer, (int32) (pstCard->llSetMemsize), ppbyChannelData); + + // print samples for each channel + printf ("\nPrint first %u samples of all channels:\n\n", dwNrOfSamplesToShow); + + for (dwSampleIdx=0; dwSampleIdx<dwNrOfSamplesToShow; dwSampleIdx++) + { + printf ("SampleNr.%u\n", dwSampleIdx); + + if (pstCard->lSetChannels < 16) + { + + // less than 16 channels + lChIdx = pstCard->lSetChannels-1; + + while (lChIdx >= 0) + { + printf ("[D%d] = %d ", lChIdx, ppbyChannelData[lChIdx][dwSampleIdx]); + lChIdx--; + } + + printf ("\n\n"); + } + else + { + + // 16 channels and more + lChIdx = pstCard->lSetChannels-1; + + while (lChIdx > 0) + { + printf ("[D%d ......... D%d] ", lChIdx, lChIdx - 15); + lChIdx -= 16; + } + + printf ("\n"); + + lChIdx = pstCard->lSetChannels-1; + while (lChIdx >= 0) + { + printf ("%d", ppbyChannelData[lChIdx][dwSampleIdx]); + + if (!(lChIdx%16)) + printf (" "); + else + if (!(lChIdx%4)) + printf ("."); + + lChIdx--; + } + + printf ("\n\n"); + } + } + + for (i=0; i<pstCard->lSetChannels; i++) + delete (ppbyChannelData[i]); + + return 0; + } + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + char szBuffer[1024]; // a character buffer for any messages + ST_SPCM_CARDINFO stCard; // info structure of my card + int64 llMemsize; + int32 lSegmentsize, lPosttrigger; + int32 lOversampling = 1; + bool bTimestampInstalled, bBaseXIOInstalled; + bool bTrigSrcAvailable = false; + uint64 qwMemInBytes; + uint64 qwTSBufferLen_bytes = 0; + uint64* pqwTimestamps = NULL; + void* pvBuffer; + + + // ------------------------------------------------------------------------ + // init card number 0 (the first card in the system), get some information and print it + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + if (bSpcMInitCardByIdx (&stCard, 0)) + //if (bSpcMInitCardByIdx (&stCard, "192.168.1.10", 0)) + { + printf (pszSpcMPrintDocumentationLink (&stCard, szBuffer, sizeof (szBuffer))); + printf (pszSpcMPrintCardInfo (&stCard, szBuffer, sizeof (szBuffer))); + } + else + return nSpcMErrorMessageStdOut (&stCard, "Error: Could not open card\n", true); + + + // check whether we support this card type in the example + if ((stCard.eCardFunction != AnalogIn) && (stCard.eCardFunction != DigitalIn) && (stCard.eCardFunction != DigitalIO)) + return nSpcMErrorMessageStdOut (&stCard, "Error: Card function not supported by this example\n", false); + if ((stCard.lFeatureMap & SPCM_FEAT_MULTI) == 0) + return nSpcMErrorMessageStdOut (&stCard, "Error: Multiple Recording Option not installed. Examples was done especially for this option!\n", false); + + // if timestamp is installed we set a flag to support this mode in the example also + bTimestampInstalled = ((stCard.lFeatureMap & SPCM_FEAT_TIMESTAMP) != 0); + bBaseXIOInstalled = ((stCard.lFeatureMap & SPCM_FEAT_BASEXIO) != 0); + if (stCard.bM4i || stCard.bM2p || stCard.bM5i) + bTrigSrcAvailable = true; + + + + // ------------------------------------------------------------------------ + // do the card setup, error is routed in the structure so we don't care for the return values + llMemsize = KILO_B(256); + lSegmentsize = KILO_B(16); + lPosttrigger = KILO_B(15); + if (!stCard.bSetError) + vDoCardSetup (&stCard, llMemsize, lSegmentsize, lPosttrigger); + + + + // ------------------------------------------------------------------------ + // calculate the amount of data we need and allocate memory buffer + if (!stCard.bSetError) + { + qwMemInBytes = stCard.llSetMemsize * stCard.lBytesPerSample * stCard.lSetChannels; + pvBuffer = pvAllocMemPageAligned (qwMemInBytes); + + if (bTimestampInstalled) + { + + // M2i and M3i use 64 bit timestamps and M4i and M2p 128 bit + if (stCard.bM2i || stCard.bM3i) + qwTSBufferLen_bytes = sizeof (uint64) * llMemsize / lSegmentsize; + else if (stCard.bM4i || stCard.bM2p || stCard.bM5i) + qwTSBufferLen_bytes = 2ULL*sizeof (uint64) * llMemsize / lSegmentsize; + + pqwTimestamps = (uint64*)pvAllocMemPageAligned (qwTSBufferLen_bytes); + } + + if (!pvBuffer || (bTimestampInstalled &&!pqwTimestamps)) + return nSpcMErrorMessageStdOut (&stCard, "Memory allocation error\n", false); + } + + + + // ------------------------------------------------------------------------ + // make acquisition and get data + if (!stCard.bSetError) + { + printf ("\n"); + + // if using timestamps we need to start the transfer before the card start to avoid an overrun of the timestamp memory + if (bTimestampInstalled) + { + printf ("Starting the timestamp DMA transfer\n"); + + // M2i and M3i use 64 bit timestamps and M4i and M2p 128 bit + if (stCard.bM2i || stCard.bM3i) + spcm_dwDefTransfer_i64 (stCard.hDrv, SPCM_BUF_TIMESTAMP, SPCM_DIR_CARDTOPC, 0, (void*) pqwTimestamps, 0, llMemsize / lSegmentsize * sizeof (uint64)); + else if (stCard.bM4i || stCard.bM2p || stCard.bM5i) + spcm_dwDefTransfer_i64 (stCard.hDrv, SPCM_BUF_TIMESTAMP, SPCM_DIR_CARDTOPC, 0, (void*) pqwTimestamps, 0, 2 * llMemsize / lSegmentsize * sizeof (uint64)); + + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_EXTRA_STARTDMA); + } + + // We'll start and wait untill the card has finished or until a timeout occurs + spcm_dwSetParam_i32 (stCard.hDrv, SPC_TIMEOUT, 5000); + printf ("Starting the card and waiting for ready interrupt\n"); + if (spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_CARD_WAITREADY) == ERR_TIMEOUT) + { + vFreeMemPageAligned (pvBuffer, qwMemInBytes); + return nSpcMErrorMessageStdOut (&stCard, "... Timeout\n", false); + } + else + { + + // we define the buffer for transfer and start the DMA transfer + printf ("Starting the DMA transfer and waiting until data is in PC memory\n"); + spcm_dwDefTransfer_i64 (stCard.hDrv, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, 0, pvBuffer, 0, qwMemInBytes); + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA); + + // check for error code + if (spcm_dwGetErrorInfo_i32 (stCard.hDrv, NULL, NULL, szBuffer)) + { + vFreeMemPageAligned (pvBuffer, qwMemInBytes); + return nSpcMErrorMessageStdOut (&stCard, szBuffer, false); + } + printf ("... acquisition ended, data has been transferred to PC memory\n"); + + // wait for the timestamps (should be already done as we started the transfer before the card start) + if (bTimestampInstalled) + { + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_EXTRA_WAITDMA); + printf ("... timestamps have been transferred to PC memory\n"); + } + } + } + + + + // ------------------------------------------------------------------------ + // we go through the segments, split the data in separate channels and show some results + if (!stCard.bSetError) + { + + // some additional information on the acquisition + printf ("\nData information:\n=================\n"); + printf ("Each segment is %.3f ms long\n", 1000.0 * lSegmentsize / stCard.llSetSamplerate); + printf ("Maximum pulse repetition frequency to reach with this setting is %.2f Hz\n", (double) stCard.llSetSamplerate / lSegmentsize); + + switch (stCard.eCardFunction) + { + case AnalogIn: + if (stCard.lBytesPerSample == 2) + nShowAnalogData < int16 >(&stCard, lSegmentsize, lPosttrigger, pvBuffer, bTimestampInstalled, bBaseXIOInstalled, bTrigSrcAvailable, pqwTimestamps); + else + nShowAnalogData < int8 >(&stCard, lSegmentsize, lPosttrigger, pvBuffer, bTimestampInstalled, bBaseXIOInstalled, bTrigSrcAvailable, pqwTimestamps); + break; + + case DigitalIn: + case DigitalIO: + + // show first 10 samples for each channel + nShowDigitalData (&stCard, pvBuffer, 10); + break; + } + + if (bTimestampInstalled) + vFreeMemPageAligned (pqwTimestamps, qwTSBufferLen_bytes); + } + + + + // ------------------------------------------------------------------------ + // print error information if an error occured + if (stCard.bSetError) + return nSpcMErrorMessageStdOut (&stCard, "An error occured while programming the card:\n", true); + + + // clean up and close the driver + vSpcMCloseCard (&stCard); + vFreeMemPageAligned (pvBuffer, qwMemInBytes); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi.dsp b/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi.dsp new file mode 100644 index 0000000000000000000000000000000000000000..1963ffb4fe9ce406076ba07078525bad3c9456d8 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi.dsp @@ -0,0 +1,132 @@ +# Microsoft Developer Studio Project File - Name="rec_std_multi" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=rec_std_multi - Win32 Debug +!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE +!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl +!MESSAGE +!MESSAGE NMAKE /f "rec_std_multi.mak". +!MESSAGE +!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben +!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: +!MESSAGE +!MESSAGE NMAKE /f "rec_std_multi.mak" CFG="rec_std_multi - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "rec_std_multi - Win32 Release" (basierend auf "Win32 (x86) Console Application") +!MESSAGE "rec_std_multi - Win32 Debug" (basierend auf "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "rec_std_multi - 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 /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 /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 /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "rec_std_multi - 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 /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 /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 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "rec_std_multi - Win32 Release" +# Name "rec_std_multi - Win32 Debug" +# Begin Group "common" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\common\spcm_lib_card.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.cpp +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_win32_msvcpp.lib +# End Source File +# End Group +# Begin Group "header" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\c_header\dlltyp.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\regs.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcerr.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_drv.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_card.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\rec_std_multi.cpp +# End Source File +# End Target +# End Project diff --git a/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi.dsw b/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi.dsw new file mode 100644 index 0000000000000000000000000000000000000000..5a78b3b8225879b122b02b457f19145ce0c7b195 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi.dsw @@ -0,0 +1,41 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "rec_std_multi"=.\rec_std_multi.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "rec_std_multi_poll"=.\rec_std_multi_poll.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi.vcproj b/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..0493b20f0180309ff9a37072e81bd4ec7c134194 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi.vcproj @@ -0,0 +1,593 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="rec_std_multi" + ProjectGUID="{DE7EFF20-D29A-489A-92B6-3056B9F21E93}" + RootNamespace="rec_std_multi" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/rec_std_multi.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_std_multi.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_std_multi.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_std_multi.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_std_multi.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/rec_std_multi.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_std_multi.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_std_multi.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_std_multi.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_std_multi.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/rec_std_multi.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_std_multi.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_std_multi.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_std_multi.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_std_multi.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/rec_std_multi.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_std_multi.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_std_multi.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_std_multi.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_std_multi.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="common" + > + <File + RelativePath="..\common\spcm_lib_card.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_data.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="header" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_card.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_data.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_oswrap.h" + > + </File> + </Filter> + <File + RelativePath="rec_std_multi.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi.vcxproj b/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..5add20392bd00c4ef4726db14f9844cc83601b20 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi.vcxproj @@ -0,0 +1,266 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{DE7EFF20-D29A-489A-92B6-3056B9F21E93}</ProjectGuid> + <RootNamespace>rec_std_multi</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rec_std_multi.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_multi.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_multi.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_multi.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rec_std_multi.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_multi.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_multi.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_multi.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rec_std_multi.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_std_multi.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_multi.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_multi.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rec_std_multi.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_std_multi.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_multi.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_multi.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="..\common\spcm_lib_card.cpp" /> + <ClCompile Include="..\common\spcm_lib_data.cpp" /> + <ClCompile Include="rec_std_multi.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\common\spcm_lib_card.h" /> + <ClInclude Include="..\common\spcm_lib_data.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi.vcxproj.filters b/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..253dc708753be991fd3b59c9eb521fe97c2770d8 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi.vcxproj.filters @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="common"> + <UniqueIdentifier>{269422cf-b44f-4d02-a5a2-7172e1299d04}</UniqueIdentifier> + </Filter> + <Filter Include="header"> + <UniqueIdentifier>{68fc190a-08bb-4d5d-bfd8-1cc68f6ebf1f}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\spcm_lib_card.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_data.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="rec_std_multi.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_card.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_data.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_oswrap.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi_poll.cpp b/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi_poll.cpp new file mode 100644 index 0000000000000000000000000000000000000000..500a2c25d3c6c946446a202500a656ea8b1e2941 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi_poll.cpp @@ -0,0 +1,398 @@ +/* +************************************************************************** + +rec_std_multi_poll.cpp (c) Spectrum GmbH + +************************************************************************** + +Example for all SpcMDrv based acquisition cards with the option +Multiple Recording installed. + +Information about the different products and their drivers can be found +online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/platform-driver-and-series-differences + +Shows Multiple Recoridng data acquisition using single mode (one shot). If +timestamp is installed the corresponding timestamp values are also read +out and displayed. + +If Timestamp and BaseXIO are installed the BaseXIO lines are set to the +timestamp acquisition mode and are sampled on every trigger event. The +samples BaseXIO lines are also shown. + +Feel free to use this source for own projects and modify it in any kind + +This example shows the polling of the status, no wait function is used + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_card.h" +#include "../common/spcm_lib_data.h" + +#include "../common/ostools/spcm_oswrap.h" +#include "../common/ostools/spcm_ostools.h" + +// ----- standard c include files ----- +#include <stdio.h> +#include <stdlib.h> + + + +/* +************************************************************************** +vDoCardSetup +************************************************************************** +*/ + +void vDoCardSetup (ST_SPCM_CARDINFO *pstCard, int64 llMemsize, int32 lSegmentsize, int32 lPosttrigger) + { + int i; + + // Multiple Recording setup + bSpcMSetupModeRecStdMulti (pstCard, (1 << pstCard->lMaxChannels) - 1, llMemsize, lSegmentsize, lPosttrigger); + + // we try to set the samplerate to 10 MHz on internal PLL, no clock output, + // if the card can't run 10 MHz it is set to maximum sampling rate internally + bSpcMSetupClockPLL (pstCard, 10000000, false); + printf ("Sampling rate set to %.1lf MHz\n", (double) pstCard->llSetSamplerate / 1000000); + + // we set trigger to external positive edge, please connect the trigger line! + printf ("\n!!! Using external trigger - please connect a signal to the trigger input !!!\n\n"); + bSpcMSetupTrigExternal (pstCard, SPC_TM_POS, false, 0); + + // type dependent card setup + switch (pstCard->eCardFunction) + { + + // analog acquisition card setup + case AnalogIn: + + // program all input channels to +/-1 V and 50 ohm termination (if it's available) + for (i=0; i < pstCard->lMaxChannels; i++) + bSpcMSetupInputChannel (pstCard, i, 1000, true); + break; + } + + + // if timestamp and basexio are installed we acquire the asynchronous inputs with the timestamps + if ((pstCard->lFeatureMap & SPCM_FEAT_TIMESTAMP) && (pstCard->lFeatureMap & SPCM_FEAT_BASEXIO)) + bSpcMSetupTimestamp (pstCard, SPC_TSMODE_STANDARD | SPC_TSCNT_INTERNAL | SPC_TSXIOACQ_ENABLE, 0); + + // set up the timestamp mode to standard if timestamp is installed + else if ((pstCard->lFeatureMap & SPCM_FEAT_TIMESTAMP) != 0) + bSpcMSetupTimestamp (pstCard, SPC_TSMODE_STANDARD | SPC_TSCNT_INTERNAL, 0); + + } + + + +/* +************************************************************************** +nShowAnalogData +************************************************************************** +*/ + +int16 nShowAnalogData (ST_SPCM_CARDINFO *pstCard, int32 lSegmentsize, int32 lPosttrigger, void* pvBuffer, bool bTimestampInstalled, bool bBaseXIO, uint64* pqwTimestamps) + { + int16* ppnChannelData[SPCM_MAX_AICHANNEL]; + int i; + int32 lSegmentIdx; + uint32 dwBaseXIOLines; + + for (i=0; i<pstCard->lSetChannels; i++) + { + ppnChannelData[i] = new int16[lSegmentsize]; + if (!ppnChannelData[i]) + return nSpcMErrorMessageStdOut (pstCard, "Memory allocation error\n", false); + } + + + // loop across all acquired segments + if (bTimestampInstalled && bBaseXIO) + printf ("\n%8s %12s %12s %12s %4s %15s %10s\n", "Segment", "Min", "Max", "Average", "BXIO", "Timestamp", "Timediff"); + else if (bTimestampInstalled) + printf ("\n%8s %12s %12s %12s %15s %10s\n", "Segment", "Min", "Max", "Average", "Timestamp", "Timediff"); + else + printf ("\n%8s %12s %12s %12s\n", "Segment", "Min", "Max", "Average"); + for (lSegmentIdx = 0; lSegmentIdx < (pstCard->llSetMemsize / lSegmentsize); lSegmentIdx++) + { + + // split data function + if (pstCard->lBytesPerSample == 1) + bSpcMDemuxAnalogData (pstCard, (int8*)pvGetSegmentDataPointer (pstCard, pvBuffer, lSegmentsize, lSegmentIdx, pstCard->lBytesPerSample), lSegmentsize, ppnChannelData); + else + bSpcMDemuxAnalogData (pstCard, (int16*)pvGetSegmentDataPointer (pstCard, pvBuffer, lSegmentsize, lSegmentIdx, pstCard->lBytesPerSample), lSegmentsize, ppnChannelData); + + // we just look at channel 0 to keep output simple independant of the number of channels + printf ("%8d %9.2f mV %9.2f mV %9.2f mV ", lSegmentIdx, + 1000.0 * dSpcMIntToVoltage (pstCard, 0, TSpcMCalcMin (ppnChannelData[0], (uint32) lSegmentsize)), + 1000.0 * dSpcMIntToVoltage (pstCard, 0, TSpcMCalcMax (ppnChannelData[0], (uint32) lSegmentsize)), + 1000.0 * dSpcMIntToVoltage (pstCard, 0, dSpcMCalcAverage (ppnChannelData[0], (uint32) lSegmentsize))); + + + // if basexio is installed we split the 8 asynchronous lines and clean up the timestamp + if (bBaseXIO) + { + dwBaseXIOLines = (uint32) (pqwTimestamps[lSegmentIdx] >> 56); + + // unmask the BaseXIOLines from the timestamps + pqwTimestamps[lSegmentIdx] &= ~(((uint64) 0xff000000) << 32); + printf (" %02x ", dwBaseXIOLines); + } + + // print the timestamps and the difference, keeping track of the oversampling factor + if (bTimestampInstalled) + { + + // M2i and M3i use 64 bit timestamps, M4i, M2p and M5i 128 bit + if (pstCard->bM2i || pstCard->bM3i) + printf ("%12.6f ms ", 1000.0 * (double) ((int64) pqwTimestamps[lSegmentIdx]) / pstCard->llSetSamplerate / pstCard->lOversampling); + else if (pstCard->bM4i || pstCard->bM2p || pstCard->bM5i) + printf ("%12.6f ms ", 1000.0 * (double) ((int64) pqwTimestamps[2 * lSegmentIdx]) / pstCard->llSetSamplerate); + } + + // print the difference, starting with segment 1 + if (bTimestampInstalled && (lSegmentIdx > 0)) + { + + // M2i and M3i use 64 bit timestamps, M4i, M2p and M5i 128 bit + if (pstCard->bM2i || pstCard->bM3i) + printf ("%7.2f ms", 1000.0 * (double) (int64) (pqwTimestamps[lSegmentIdx] - pqwTimestamps[lSegmentIdx - 1]) / pstCard->llSetSamplerate / pstCard->lOversampling); + else if (pstCard->bM4i || pstCard->bM2p || pstCard->bM5i) + printf ("%7.2f ms", 1000.0 * (double) (int64) (pqwTimestamps[2*lSegmentIdx] - pqwTimestamps[2*lSegmentIdx - 2]) / pstCard->llSetSamplerate); + } + + + printf ("\n"); + } + + // clean up + for (i=0; i<pstCard->lSetChannels; i++) + delete (ppnChannelData[i]); + + return 0; + } + + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + char szBuffer[1024]; // a character buffer for any messages + ST_SPCM_CARDINFO stCard; // info structure of my card + int64 llMemsize; + int32 lSegmentsize, lPosttrigger; + int32 lOversampling = 1; + bool bTimestampInstalled, bBaseXIOInstalled; + uint64 qwMemInBytes; + uint64 qwTSBufferLen_bytes = 0; + uint64* pqwTimestamps = NULL; + void* pvBuffer; + uint32 dwErr; + + + // ------------------------------------------------------------------------ + // init card number 0 (the first card in the system), get some information and print it + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + if (bSpcMInitCardByIdx (&stCard, 0)) + //if (bSpcMInitCardByIdx (&stCard, "192.168.1.10", 0)) + { + printf (pszSpcMPrintDocumentationLink (&stCard, szBuffer, sizeof (szBuffer))); + printf (pszSpcMPrintCardInfo (&stCard, szBuffer, sizeof (szBuffer))); + } + else + return nSpcMErrorMessageStdOut (&stCard, "Error: Could not open card\n", true); + + + // check whether we support this card type in the example + if (stCard.eCardFunction != AnalogIn) + return nSpcMErrorMessageStdOut (&stCard, "Error: Card function not supported by this example\n", false); + if ((stCard.lFeatureMap & SPCM_FEAT_MULTI) == 0) + return nSpcMErrorMessageStdOut (&stCard, "Error: Multiple Recording Option not installed. Examples was done especially for this option!\n", false); + + // if timestamp is installed we set a flag to support this mode in the example also + bTimestampInstalled = ((stCard.lFeatureMap & SPCM_FEAT_TIMESTAMP) != 0); + bBaseXIOInstalled = ((stCard.lFeatureMap & SPCM_FEAT_BASEXIO) != 0); + + + + // ------------------------------------------------------------------------ + // do the card setup, error is routed in the structure so we don't care for the return values + llMemsize = KILO_B(256); + lSegmentsize = KILO_B(16); + lPosttrigger = KILO_B(15); + if (!stCard.bSetError) + vDoCardSetup (&stCard, llMemsize, lSegmentsize, lPosttrigger); + + + + // ------------------------------------------------------------------------ + // calculate the amount of data we need and allocate memory buffer + if (!stCard.bSetError) + { + qwMemInBytes = stCard.llSetMemsize * stCard.lBytesPerSample * stCard.lSetChannels; + pvBuffer = pvAllocMemPageAligned (qwMemInBytes); + + if (bTimestampInstalled) + { + + // M2i and M3i use 64 bit timestamps and M4i, M2p and M5i 128 bit + if (stCard.bM2i || stCard.bM3i) + qwTSBufferLen_bytes = sizeof (uint64) * llMemsize / lSegmentsize; + else if (stCard.bM4i || stCard.bM2p || stCard.bM5i) + qwTSBufferLen_bytes = 2ULL*sizeof (uint64) * llMemsize / lSegmentsize; + + pqwTimestamps = (uint64*)pvAllocMemPageAligned (qwTSBufferLen_bytes); + } + + if (!pvBuffer || (bTimestampInstalled &&!pqwTimestamps)) + return nSpcMErrorMessageStdOut (&stCard, "Memory allocation error\n", false); + } + + + + // ------------------------------------------------------------------------ + // make acquisition and get data (program a number of loops if wanted + int32 lLoops = 3; + while (lLoops--) + { + if (!stCard.bSetError) + { + printf ("\n"); + + // if using timestamps we need to start the transfer before the card start to avoid an overrun of the timestamp memory + if (bTimestampInstalled) + { + printf ("Starting the timestamp DMA transfer\n"); + + // M2i and M3i use 64 bit timestamps and M4i, M2p and M5i 128 bit + if (stCard.bM2i || stCard.bM3i) + spcm_dwDefTransfer_i64 (stCard.hDrv, SPCM_BUF_TIMESTAMP, SPCM_DIR_CARDTOPC, 0, (void*) pqwTimestamps, 0, llMemsize / lSegmentsize * sizeof (uint64)); + else if (stCard.bM4i || stCard.bM2p || stCard.bM5i) + spcm_dwDefTransfer_i64 (stCard.hDrv, SPCM_BUF_TIMESTAMP, SPCM_DIR_CARDTOPC, 0, (void*) pqwTimestamps, 0, 2 * llMemsize / lSegmentsize * sizeof (uint64)); + + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_EXTRA_STARTDMA); + } + + // We'll define the buffer for data to start everything together + spcm_dwDefTransfer_i64 (stCard.hDrv, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, 0, pvBuffer, 0, qwMemInBytes); + + printf ("Starting the card, the data transfer and poll\n"); + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_DATA_STARTDMA); + + + // this is our status polling loop + bool bReady = false; + bool bTimestampsReady = !bTimestampInstalled; + bool bDataReady = false; + int32 lOldStatus = 0, lStatus; + do + { + dwErr = spcm_dwGetParam_i32 (stCard.hDrv, SPC_M2STATUS, &lStatus); + + // check for changed status and set flags + if (lOldStatus != lStatus) + { + if (lStatus & M2STAT_CARD_PRETRIGGER) + printf ("Armed "); + + if (lStatus & M2STAT_CARD_TRIGGER) + printf ("1stTrigger "); + + if (lStatus & M2STAT_CARD_READY) + { + printf ("CardReady "); + bReady = true; + } + + if (lStatus & M2STAT_DATA_END) + { + printf ("DataTransferred "); + bDataReady = true; + } + + if (lStatus & M2STAT_EXTRA_END) + { + printf ("TimestampsTransferred "); + bTimestampsReady = true; + } + printf ("\n"); + } + + lOldStatus = lStatus; + } + while (!dwErr && (!bReady || !bTimestampsReady || !bDataReady)); + + // check for error code + if (spcm_dwGetErrorInfo_i32 (stCard.hDrv, NULL, NULL, szBuffer)) + { + vFreeMemPageAligned (pvBuffer, qwMemInBytes); + return nSpcMErrorMessageStdOut (&stCard, szBuffer, false); + } + + printf ("... acquisition ended, data has been transferred to PC memory\n"); + } + + + + // ------------------------------------------------------------------------ + // we go through the segments, split the data in separate channels and show some results + if (!stCard.bSetError) + { + + // some additional information on the acquisition + printf ("\nData information:\n=================\n"); + printf ("Each segment is %.3f ms long\n", 1000.0 * lSegmentsize / stCard.llSetSamplerate); + printf ("Maximum pulse repetition frequency to reach with this setting is %.2f Hz\n", (double) stCard.llSetSamplerate / lSegmentsize); + + switch (stCard.eCardFunction) + { + case AnalogIn: + nShowAnalogData (&stCard, lSegmentsize, lPosttrigger, pvBuffer, bTimestampInstalled, bBaseXIOInstalled, pqwTimestamps); + break; + + case DigitalIn: + case DigitalIO: + break; + } + } + } + + + // ------------------------------------------------------------------------ + // print error information if an error occured + if (stCard.bSetError) + return nSpcMErrorMessageStdOut (&stCard, "An error occured while programming the card:\n", true); + + + // clean up and close the driver + vSpcMCloseCard (&stCard); + vFreeMemPageAligned (pvBuffer, qwMemInBytes); + if (bTimestampInstalled) + vFreeMemPageAligned (pqwTimestamps, qwTSBufferLen_bytes); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi_poll.dsp b/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi_poll.dsp new file mode 100644 index 0000000000000000000000000000000000000000..d0fa2f9e2226b870f5809e1b72323ce70e3b1631 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi_poll.dsp @@ -0,0 +1,132 @@ +# Microsoft Developer Studio Project File - Name="rec_std_multi_poll" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=rec_std_multi_poll - Win32 Debug +!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE +!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl +!MESSAGE +!MESSAGE NMAKE /f "rec_std_multi_poll.mak". +!MESSAGE +!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben +!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: +!MESSAGE +!MESSAGE NMAKE /f "rec_std_multi_poll.mak" CFG="rec_std_multi_poll - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "rec_std_multi_poll - Win32 Release" (basierend auf "Win32 (x86) Console Application") +!MESSAGE "rec_std_multi_poll - Win32 Debug" (basierend auf "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "rec_std_multi_poll - 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 /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 /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 /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "rec_std_multi_poll - 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 /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 /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 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "rec_std_multi_poll - Win32 Release" +# Name "rec_std_multi_poll - Win32 Debug" +# Begin Group "common" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\common\spcm_lib_card.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.cpp +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_win32_msvcpp.lib +# End Source File +# End Group +# Begin Group "header" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\c_header\dlltyp.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\regs.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcerr.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_drv.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_card.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\rec_std_multi_poll.cpp +# End Source File +# End Target +# End Project diff --git a/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi_poll.vcproj b/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi_poll.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..a7fbfc4475e49979e26122123c797f907fe12531 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi_poll.vcproj @@ -0,0 +1,579 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="rec_std_multi_poll" + ProjectGUID="{B0EBDCC4-4989-4C31-A2B6-A68D4F71721C}" + RootNamespace="rec_std_multi_poll" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/rec_std_multi_poll.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_std_multi_poll.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_std_multi_poll.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_std_multi_poll.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_std_multi_poll.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/rec_std_multi_poll.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_std_multi_poll.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_std_multi_poll.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_std_multi_poll.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_std_multi_poll.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/rec_std_multi_poll.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_std_multi_poll.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_std_multi_poll.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_std_multi_poll.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_std_multi_poll.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/rec_std_multi_poll.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_std_multi_poll.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_std_multi_poll.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_std_multi_poll.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_std_multi_poll.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="common" + > + <File + RelativePath="..\common\spcm_lib_card.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_data.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="header" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_card.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_data.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_oswrap.h" + > + </File> + </Filter> + <File + RelativePath="rec_std_multi_poll.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi_poll.vcxproj b/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi_poll.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..d76dbbcdcea8494ab5bebd396c1e95fdea62ece5 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi_poll.vcxproj @@ -0,0 +1,266 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{B0EBDCC4-4989-4C31-A2B6-A68D4F71721C}</ProjectGuid> + <RootNamespace>rec_std_multi_poll</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rec_std_multi_poll.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_multi_poll.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_multi_poll.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_multi_poll.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rec_std_multi_poll.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_multi_poll.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_multi_poll.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_multi_poll.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rec_std_multi_poll.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_std_multi_poll.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_multi_poll.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_multi_poll.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rec_std_multi_poll.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_std_multi_poll.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_multi_poll.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_multi_poll.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="..\common\spcm_lib_card.cpp" /> + <ClCompile Include="..\common\spcm_lib_data.cpp" /> + <ClCompile Include="rec_std_multi_poll.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\common\spcm_lib_card.h" /> + <ClInclude Include="..\common\spcm_lib_data.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi_poll.vcxproj.filters b/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi_poll.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..e45b2a8ffc63dd34808ffc86dc079b8bf978bf78 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_multi/rec_std_multi_poll.vcxproj.filters @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="common"> + <UniqueIdentifier>{2ec8f340-1593-405d-a07c-b34c13e94758}</UniqueIdentifier> + </Filter> + <Filter Include="header"> + <UniqueIdentifier>{633e71cf-011b-405e-b2be-920b0af589b8}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\spcm_lib_card.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_data.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="rec_std_multi_poll.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_card.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_data.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_oswrap.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_single/makefile b/Cpp/examples/c_cpp/rec_std_single/makefile new file mode 100644 index 0000000000000000000000000000000000000000..fe551970d478a801441f2874dcfa1d2cf7e1f779 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single/makefile @@ -0,0 +1,24 @@ +COMPILER = g++ +EXECUTABLE = rec_std_single +LIBS += -lspcm_linux -lrt -lpthread + +OBJECTS = \ + rec_std_single.o\ + ../common/spcm_lib_card.o\ + ../common/spcm_lib_data.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/rec_std_single/rec_std_single.bpf b/Cpp/examples/c_cpp/rec_std_single/rec_std_single.bpf new file mode 100644 index 0000000000000000000000000000000000000000..5da88241fe8e80944de42def849bf4eab8f1f666 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single/rec_std_single.bpf @@ -0,0 +1,3 @@ +This file is used by the project manager only and should be treated like the project file + + main \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_single/rec_std_single.bpr b/Cpp/examples/c_cpp/rec_std_single/rec_std_single.bpr new file mode 100644 index 0000000000000000000000000000000000000000..2fe31c6bb8c3913a356f394cc0c2a175b3dd64c4 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single/rec_std_single.bpr @@ -0,0 +1,104 @@ +<?xml version='1.0' encoding='utf-8' ?> +<!-- C++Builder XML Project --> +<PROJECT> + <MACROS> + <VERSION value="BCB.06.00"/> + <PROJECT value="rec_std_single.exe"/> + <OBJFILES value="rec_std_single.obj ..\common\spcm_lib_thread.obj + ..\common\spcm_lib_card.obj ..\common\spcm_lib_data.obj"/> + <RESFILES value=""/> + <DEFFILE value=""/> + <RESDEPEN value="$(RESFILES)"/> + <LIBFILES value="..\c_header\spcm_win32_bcppb.lib"/> + <LIBRARIES value=""/> + <SPARELIBS value=""/> + <PACKAGES value="vcl.bpi rtl.bpi vclx.bpi bcbsmp.bpi dclocx.bpi"/> + <PATHCPP value=".;..\common;..\common;..\common"/> + <PATHPAS value=".;"/> + <PATHRC value=".;"/> + <PATHASM value=".;"/> + <DEBUGLIBPATH value="$(BCB)\lib\debug"/> + <RELEASELIBPATH value="$(BCB)\lib\release"/> + <LINKER value="ilink32"/> + <USERDEFINES value="_DEBUG"/> + <SYSDEFINES value="NO_STRICT;_NO_VCL;_RTLDLL;USEPACKAGES"/> + <MAINSOURCE value="rec_std_single.bpf"/> + <INCLUDEPATH value="C:\svnwork\spcm_drv_c\common;C:\svnwork\spcm_drv_c\rec_std_single;$(BCB)\include;$(BCB)\include\vcl"/> + <LIBPATH value="C:\svnwork\spcm_drv_c\common;C:\svnwork\spcm_drv_c\rec_std_single;$(BCB)\lib\obj;$(BCB)\lib"/> + <WARNINGS value="-w-par"/> + <OTHERFILES value=""/> + </MACROS> + <OPTIONS> + <CFLAG1 value="-tWC -tWM -Od -H=$(BCB)\lib\vcl60.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v + -vi- -c"/> + <PFLAGS value="-$YD -$W -$O- -$A8 -v -JPHNE -M"/> + <RFLAGS value=""/> + <AFLAGS value="/mx /w2 /zd"/> + <LFLAGS value="-Tpe -ap -D"" -x -Gn -v"/> + <OTHERFILES value=""/> + </OPTIONS> + <LINKER> + <ALLOBJ value="c0x32.obj $(PACKAGES) $(OBJFILES)"/> + <ALLRES value="$(RESFILES)"/> + <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib"/> + <OTHERFILES value=""/> + </LINKER> + <FILELIST> + <FILE FILENAME="rec_std_single.bpf" FORMNAME="" UNITNAME="rec_std_single" CONTAINERID="BPF" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="rec_std_single.cpp" FORMNAME="" UNITNAME="rec_std_single" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_thread.cpp" FORMNAME="" UNITNAME="spcm_lib_thread.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_card.cpp" FORMNAME="" UNITNAME="spcm_lib_card.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_data.cpp" FORMNAME="" UNITNAME="spcm_lib_data.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\c_header\spcm_win32_bcppb.lib" FORMNAME="" UNITNAME="spcm_win32_bcppb.lib" CONTAINERID="LibTool" DESIGNCLASS="" LOCALCOMMAND=""/> + </FILELIST> + <BUILDTOOLS> + </BUILDTOOLS> + + <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= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +[Parameters] +RunParams= +Launcher= +UseLauncher=0 +DebugCWD= +HostApplication= +RemoteHost= +RemotePath= +RemoteLauncher= +RemoteCWD= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 + </IDEOPTIONS> +</PROJECT> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_single/rec_std_single.cpp b/Cpp/examples/c_cpp/rec_std_single/rec_std_single.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ea9749fa0d734a11342c775996dc2e8375009c21 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single/rec_std_single.cpp @@ -0,0 +1,458 @@ +/* +************************************************************************** + +rec_std_single.cpp (c) Spectrum GmbH + +************************************************************************** + +Example for all SpcMDrv based acquisition cards. + +Information about the different products and their drivers can be found +online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/platform-driver-and-series-differences + +Shows standard data acquisition using single mode (one shot) + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_card.h" +#include "../common/spcm_lib_data.h" + +#include "../common/ostools/spcm_oswrap.h" +#include "../common/ostools/spcm_ostools.h" + +// ----- standard c include files ----- +#include <stdio.h> +#include <stdlib.h> + + + +/* +************************************************************************** +vDoCardSetup +************************************************************************** +*/ + +void vDoCardSetup (ST_SPCM_CARDINFO *pstCard) + { + int i; + int64 llChannelMask; + + // set mask for maximal channels + if (pstCard->lMaxChannels >= 64) + llChannelMask = -1; // -1 is all bits set to 1 = 0xffffffffffffffff + else + llChannelMask = ((int64) 1 << pstCard->lMaxChannels) - 1; + + // standard single, all channels, memsize=16k, posttrigge=8k -> pretrigger=8k + bSpcMSetupModeRecStdSingle (pstCard, llChannelMask, KILO_B(16), KILO_B(8)); + + // we try to set the samplerate to 10 max/4 internal PLL, no clock output + bSpcMSetupClockPLL (pstCard, pstCard->llMaxSamplerate / 4, false); + printf ("Sampling rate set to %.1lf MHz\n", (double) pstCard->llSetSamplerate / 1000000); + + // we set software trigger, no trigger output + bSpcMSetupTrigSoftware (pstCard, false); + + + // type dependent card setup + switch (pstCard->eCardFunction) + { + + // analog acquisition card setup + case AnalogIn: + + // program all input channels to +/-1 V and 50 ohm termination (if it's available) + for (i=0; i < pstCard->lMaxChannels; i++) + if (pstCard->bM2i || pstCard->bM2p) + bSpcMSetupInputChannel (pstCard, i, 1000, true); + else if (pstCard->bM3i || pstCard->bM4i || pstCard->bM5i) + bSpcMSetupPathInputCh (pstCard, i, 0, 1000, 0, false, true, true); + + // activate digital inputs if available + if (pstCard->bM2i) + { + if ((pstCard->lBytesPerSample > 1) && (pstCard->lFeatureMap & SPCM_FEAT_DIGITAL)) + spcm_dwSetParam_i32 (pstCard->hDrv, SPC_READDIGITAL, 1); + } + + break; + + // digital acquisition card setup + case DigitalIn: + case DigitalIO: + + // set all input channel groups to 110 ohm termination (if it's available) + for (i=0; i < pstCard->uCfg.stDIO.lGroups; i++) + bSpcMSetupDigitalInput (pstCard, i, true); + break; + } + } + + + + +/* +************************************************************************** +nShowAnalogData +************************************************************************** +*/ + +int16 nShowAnalogData (ST_SPCM_CARDINFO *pstCard, void* pvBuffer) + { + int i; + double dAverage; + int16 nMin; + int16 nMax; + int16* ppnChannelData[SPCM_MAX_AICHANNEL]; + + // allocate channel data + for (i=0; i<pstCard->lSetChannels; i++) + { + ppnChannelData[i] = new int16[(int32) pstCard->llSetMemsize]; + if (!ppnChannelData[i]) + return nSpcMErrorMessageStdOut (pstCard, "Memory allocation error\n", false); + } + + // split data function + if (pstCard->lBytesPerSample == 1) + bSpcMDemuxAnalogData (pstCard, (int8*)pvBuffer, (int32) pstCard->llSetMemsize, ppnChannelData); + else + bSpcMDemuxAnalogData (pstCard, (int16*)pvBuffer, (int32) pstCard->llSetMemsize, ppnChannelData); + + // calc and print some figures + printf ("\nSome details of the acquired data:\n"); + for (i=0; i<pstCard->lSetChannels; i++) + { + dAverage = dSpcMCalcAverage (ppnChannelData[i], (uint32) pstCard->llSetMemsize); + nMin = TSpcMCalcMin (ppnChannelData[i], (uint32) pstCard->llSetMemsize); + nMax = TSpcMCalcMax (ppnChannelData[i], (uint32) pstCard->llSetMemsize); + printf ("Ch %2d\n Min: %7d (%9.2f mV)\n Max: %7d (%9.2f mV)\n Av: %7.2f (%9.2f mV)\n\n", i, + nMin, 1000.0 * dSpcMIntToVoltage (pstCard, i, nMin), + nMax, 1000.0 * dSpcMIntToVoltage (pstCard, i, nMax), + dAverage, 1000.0 * dSpcMIntToVoltage (pstCard, i, dAverage)); + } + + for (i=0; i<pstCard->lSetChannels; i++) + delete [] (ppnChannelData[i]); + + return 0; + } + +/* +************************************************************************** +nShowDigitalInputData +************************************************************************** +*/ + +int16 nShowDigitalInputData (ST_SPCM_CARDINFO *pstCard, void* pvBuffer, uint32 dwNrOfSamplesToShow) + { + int32 lNrOfDigCh, lCh, lBitShift, i; + uint32 dwSampleIdx; + uint8 byDigMask, byBitVal; + + uint8* ppbyChannelData[SPCM_MAX_AICHANNEL]; + + if (((pstCard->lCardType & TYP_SERIESMASK) == TYP_M4IEXPSERIES) || ((pstCard->lCardType & TYP_SERIESMASK) == TYP_M4XEXPSERIES)) + { + lNrOfDigCh = 1; + } + else + { + lNrOfDigCh = 16 - pstCard->uCfg.stAI.lResolution; + } + + // allocate channel data + for (i = 0; i < pstCard->lSetChannels; i++) + { + ppbyChannelData[i] = new uint8[(int32)pstCard->llSetMemsize]; + if (!ppbyChannelData[i]) + return nSpcMErrorMessageStdOut (pstCard, "Memory allocation error\n", false); + } + + // demux digital input data + bSpcMDemuxDigitalInputDataToUInt8 (pstCard, pvBuffer, (int32)pstCard->llSetMemsize, ppbyChannelData); + + // print digital inputs + printf ("\nDigital inputs:\n"); + + for (dwSampleIdx = 0; dwSampleIdx < dwNrOfSamplesToShow; dwSampleIdx++) + { + printf ("[D0 - D%d] : ", pstCard->lSetChannels*lNrOfDigCh - 1); + + for (lCh = 0; lCh < pstCard->lSetChannels; lCh++) + { + byDigMask = ppbyChannelData[lCh][dwSampleIdx]; + lBitShift = 0; + + do + { + byBitVal = byDigMask & 0x01; + + printf ("%u", byBitVal); + + byDigMask = byDigMask >> 1; + lBitShift++; + }while (lBitShift < lNrOfDigCh); + + printf (" "); + } + printf ("\n"); + } + + for (i = 0; i < pstCard->lSetChannels; i++) + delete [] (ppbyChannelData[i]); + + return 0; + } + +/* +************************************************************************** +nShowDigitalData +************************************************************************** +*/ + +int16 nShowDigitalData (ST_SPCM_CARDINFO *pstCard, void* pvBuffer, uint32 dwNrOfSamplesToShow) + { + int32 i, lChIdx; + uint32 dwSampleIdx; + int8* ppbyChannelData[SPCM_MAX_DIOCHANNEL]; + + // allocate channel data + for (i=0; i<pstCard->lSetChannels; i++) + { + ppbyChannelData[i] = new int8[(int32) pstCard->llSetMemsize]; + if (!ppbyChannelData[i]) + return nSpcMErrorMessageStdOut (pstCard, "Memory allocation error\n", false); + } + + // split data function + bSpcMDemuxDigitalDataToInt8 (pstCard, pvBuffer, (int32) (pstCard->llSetMemsize), ppbyChannelData); + + // print samples for each channel + printf ("\nPrint first %u samples of all channels:\n\n", dwNrOfSamplesToShow); + + for (dwSampleIdx=0; dwSampleIdx<dwNrOfSamplesToShow; dwSampleIdx++) + { + printf ("SampleNr.%u\n", dwSampleIdx); + + if (pstCard->lSetChannels < 16) + { + + // less than 16 channels + lChIdx = pstCard->lSetChannels-1; + + while (lChIdx >= 0) + { + printf ("[D%d] = %d ", lChIdx, ppbyChannelData[lChIdx][dwSampleIdx]); + lChIdx--; + } + + printf ("\n\n"); + } + else + { + + // 16 channels and more + lChIdx = pstCard->lSetChannels-1; + + while (lChIdx > 0) + { + printf ("[D%d ......... D%d] ", lChIdx, lChIdx - 15); + lChIdx -= 16; + } + + printf ("\n"); + + lChIdx = pstCard->lSetChannels-1; + while (lChIdx >= 0) + { + printf ("%d", ppbyChannelData[lChIdx][dwSampleIdx]); + + if (!(lChIdx%16)) + printf (" "); + else + if (!(lChIdx%4)) + printf ("."); + + lChIdx--; + } + + printf ("\n\n"); + } + } + + for (i=0; i<pstCard->lSetChannels; i++) + delete [] (ppbyChannelData[i]); + + return 0; + } + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + char szBuffer[1024]; // a character buffer for any messages + ST_SPCM_CARDINFO stCard; // info structure of my card + uint64 qwMemInBytes; + void* pvBuffer; + + // ------------------------------------------------------------------------ + // init card number 0 (the first card in the system), get some information and print it + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + if (bSpcMInitCardByIdx (&stCard, 0)) + //if (bSpcMInitCardByIdx (&stCard, "192.168.169.42", 0)) + { + printf (pszSpcMPrintDocumentationLink (&stCard, szBuffer, sizeof (szBuffer))); + printf (pszSpcMPrintCardInfo (&stCard, szBuffer, sizeof (szBuffer))); + } + else + return nSpcMErrorMessageStdOut (&stCard, "Error: Could not open card\n", true); + + // check whether we support this card type in the example + if (stCard.eCardFunction != AnalogIn && stCard.eCardFunction != DigitalIn && stCard.eCardFunction != DigitalIO) + return nSpcMErrorMessageStdOut (&stCard, "Error: Card function not supported by this example\n", false); + + + + // ------------------------------------------------------------------------ + // do the card setup, error is routed in the structure so we don't care for the return values + if (!stCard.bSetError) + vDoCardSetup (&stCard); + + + // ------------------------------------------------------------------------ + // calculate the amount of data we need and allocate memory buffer + if (!stCard.bSetError) + { + + switch (stCard.eCardFunction) + { + case AnalogIn: + qwMemInBytes = stCard.llSetMemsize * stCard.lBytesPerSample * stCard.lSetChannels; + break; + + case DigitalIn: + case DigitalIO: + qwMemInBytes = stCard.lSetChannels / 8 * stCard.llSetMemsize; + break; + } + + pvBuffer = pvAllocMemPageAligned (qwMemInBytes); + if (!pvBuffer) + return nSpcMErrorMessageStdOut (&stCard, "Memory allocation error\n", false); + } + + + + // ------------------------------------------------------------------------ + // make acquisition and get data + if (!stCard.bSetError) + { + + // We'll start and wait untill the card has finished or until a timeout occurs + spcm_dwSetParam_i32 (stCard.hDrv, SPC_TIMEOUT, 5000); + printf ("\nStarting the card and waiting for ready interrupt\n"); + if (spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_CARD_WAITREADY) == ERR_TIMEOUT) + { + vFreeMemPageAligned (pvBuffer, qwMemInBytes); + return nSpcMErrorMessageStdOut (&stCard, "... Timeout\n", false); + } + else + { + + // we define the buffer for transfer and start the DMA transfer + printf ("Starting the DMA transfer and waiting until data is in PC memory\n"); + spcm_dwDefTransfer_i64 (stCard.hDrv, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, 0, pvBuffer, 0, qwMemInBytes); + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA); + + // check for error code + if (spcm_dwGetErrorInfo_i32 (stCard.hDrv, NULL, NULL, szBuffer)) + { + vFreeMemPageAligned (pvBuffer, qwMemInBytes); + return nSpcMErrorMessageStdOut (&stCard, szBuffer, false); + } + printf ("... acquisition ended, data has been transferred to PC memory\n"); + } + } + + + + // ------------------------------------------------------------------------ + // we split the data in separate channels and show some details + if (!stCard.bSetError) + switch (stCard.eCardFunction) + { + case AnalogIn: + { + int32 lReadDigital = 0; + if (stCard.bM2i) + spcm_dwGetParam_i32 (stCard.hDrv, SPC_READDIGITAL, &lReadDigital); + + // check if digital inputs are set + if (lReadDigital) + { + // memory allocation for analog and digital data + void* pvAnalogData = (void*) new uint8[(int) qwMemInBytes]; + void* pvDigitalData = (void*) new uint8[(int) (qwMemInBytes / stCard.lBytesPerSample)]; + + // split data in analog and digital part + bSpcMSplitAnalogAndDigitalData (&stCard, pvBuffer, (uint32)(qwMemInBytes / stCard.lBytesPerSample), pvAnalogData, pvDigitalData); + + // show digital data + nShowDigitalInputData (&stCard, pvDigitalData, 10); + + // show analog data + nShowAnalogData (&stCard, pvAnalogData); + } + else + nShowAnalogData (&stCard, pvBuffer); + break; + } + + case DigitalIn: + case DigitalIO: + + // show first 10 samples for each channel + nShowDigitalData (&stCard, pvBuffer, 10); + break; + } + + + + // ------------------------------------------------------------------------ + // print error information if an error occured + if (stCard.bSetError) + return nSpcMErrorMessageStdOut (&stCard, "An error occured while programming the card:\n", true); + + + // clean up and close the driver + vSpcMCloseCard (&stCard); + vFreeMemPageAligned (pvBuffer, qwMemInBytes); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/rec_std_single/rec_std_single.dsp b/Cpp/examples/c_cpp/rec_std_single/rec_std_single.dsp new file mode 100644 index 0000000000000000000000000000000000000000..dd6032603cf6fa03d39d2251cc3a22f44200ed75 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single/rec_std_single.dsp @@ -0,0 +1,134 @@ +# Microsoft Developer Studio Project File - Name="rec_std_single" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=rec_std_single - Win32 Debug +!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE +!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl +!MESSAGE +!MESSAGE NMAKE /f "rec_std_single.mak". +!MESSAGE +!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben +!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: +!MESSAGE +!MESSAGE NMAKE /f "rec_std_single.mak" CFG="rec_std_single - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "rec_std_single - Win32 Release" (basierend auf "Win32 (x86) Console Application") +!MESSAGE "rec_std_single - Win32 Debug" (basierend auf "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "rec_std_single - 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" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c +# SUBTRACT CPP /YX /Yc /Yu +# 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)" == "rec_std_single - 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" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c +# SUBTRACT CPP /YX /Yc /Yu +# 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 "rec_std_single - Win32 Release" +# Name "rec_std_single - Win32 Debug" +# Begin Group "header" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\c_header\dlltyp.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\regs.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcerr.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_drv.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_card.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.h +# End Source File +# End Group +# Begin Group "common" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\common\spcm_lib_card.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.cpp +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_win32_msvcpp.lib +# End Source File +# End Group +# Begin Source File + +SOURCE=.\rec_std_single.cpp +# End Source File +# End Target +# End Project diff --git a/Cpp/examples/c_cpp/rec_std_single/rec_std_single.dsw b/Cpp/examples/c_cpp/rec_std_single/rec_std_single.dsw new file mode 100644 index 0000000000000000000000000000000000000000..544f6e1514f7d68a6d67187f99e46246847311a6 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single/rec_std_single.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN! + +############################################################################### + +Project: "rec_std_single"=.\rec_std_single.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/Cpp/examples/c_cpp/rec_std_single/rec_std_single.vcproj b/Cpp/examples/c_cpp/rec_std_single/rec_std_single.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..d6d72af439aa5a791d115a8c388c2e88b82c26fb --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single/rec_std_single.vcproj @@ -0,0 +1,580 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="rec_std_single" + ProjectGUID="{AB068386-BB5C-4442-ACFF-B5D9A79C311A}" + RootNamespace="rec_std_single" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/rec_std_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_std_single.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_std_single.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_std_single.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_std_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/rec_std_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_std_single.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_std_single.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_std_single.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_std_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/rec_std_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_std_single.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_std_single.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_std_single.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_std_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/rec_std_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_std_single.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_std_single.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_std_single.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_std_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="header" + Filter="h;hpp;hxx;hm;inl" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_card.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_data.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_oswrap.h" + > + </File> + </Filter> + <Filter + Name="common" + > + <File + RelativePath="..\common\spcm_lib_card.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_data.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Filter> + <File + RelativePath="rec_std_single.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/rec_std_single/rec_std_single.vcxproj b/Cpp/examples/c_cpp/rec_std_single/rec_std_single.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..438dc8c2426cf899875419fc5b4c2fd5261f1091 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single/rec_std_single.vcxproj @@ -0,0 +1,266 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{AB068386-BB5C-4442-ACFF-B5D9A79C311A}</ProjectGuid> + <RootNamespace>rec_std_single</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\common\spcm_lib_card.h" /> + <ClInclude Include="..\common\spcm_lib_data.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="..\common\spcm_lib_card.cpp" /> + <ClCompile Include="..\common\spcm_lib_data.cpp" /> + <ClCompile Include="rec_std_single.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_single/rec_std_single.vcxproj.filters b/Cpp/examples/c_cpp/rec_std_single/rec_std_single.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..cc55ff7496957d92bf6425d41805abb0fc0f7b30 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single/rec_std_single.vcxproj.filters @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="header"> + <UniqueIdentifier>{d33d7167-0dd5-4859-910a-5c03348787d6}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + <Filter Include="common"> + <UniqueIdentifier>{6e758013-efe3-4db0-8791-6be21b68f744}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_card.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_data.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_oswrap.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\spcm_lib_card.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_data.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="rec_std_single.cpp" /> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_single_sync/makefile.rec_std_sync b/Cpp/examples/c_cpp/rec_std_single_sync/makefile.rec_std_sync new file mode 100644 index 0000000000000000000000000000000000000000..15e8c6eef142820179adb68bce2306d7bfa8c94a --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single_sync/makefile.rec_std_sync @@ -0,0 +1,23 @@ +COMPILER = g++ +EXECUTABLE = rec_std_sync +LIBS += -lspcm_linux -lrt + +OBJECTS = \ + rec_std_sync.o\ + ../common/spcm_lib_card.o\ + ../common/spcm_lib_data.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/rec_std_single_sync/makefile.rec_std_system_sync b/Cpp/examples/c_cpp/rec_std_single_sync/makefile.rec_std_system_sync new file mode 100644 index 0000000000000000000000000000000000000000..3f77a30a26e7f35e7bcbc101368c4b1af92d40b7 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single_sync/makefile.rec_std_system_sync @@ -0,0 +1,23 @@ +COMPILER = g++ +EXECUTABLE = rec_std_system_sync +LIBS += -lspcm_linux -lrt + +OBJECTS = \ + rec_std_system_sync.o\ + ../common/spcm_lib_card.o\ + ../common/spcm_lib_data.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_sync.bpf b/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_sync.bpf new file mode 100644 index 0000000000000000000000000000000000000000..5da88241fe8e80944de42def849bf4eab8f1f666 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_sync.bpf @@ -0,0 +1,3 @@ +This file is used by the project manager only and should be treated like the project file + + main \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_sync.bpr b/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_sync.bpr new file mode 100644 index 0000000000000000000000000000000000000000..907cac7316e086a58db08cacf13fe2ae8646b329 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_sync.bpr @@ -0,0 +1,104 @@ +<?xml version='1.0' encoding='utf-8' ?> +<!-- C++Builder XML Project --> +<PROJECT> + <MACROS> + <VERSION value="BCB.06.00"/> + <PROJECT value="rec_std_sync.exe"/> + <OBJFILES value="rec_std_sync.obj ..\common\spcm_lib_thread.obj + ..\common\spcm_lib_card.obj ..\common\spcm_lib_data.obj"/> + <RESFILES value=""/> + <DEFFILE value=""/> + <RESDEPEN value="$(RESFILES)"/> + <LIBFILES value="..\c_header\spcm_win32_bcppb.lib"/> + <LIBRARIES value=""/> + <SPARELIBS value=""/> + <PACKAGES value="vcl.bpi rtl.bpi vclx.bpi bcbsmp.bpi dclocx.bpi"/> + <PATHCPP value=".;..\common;..\common;..\common"/> + <PATHPAS value=".;"/> + <PATHRC value=".;"/> + <PATHASM value=".;"/> + <DEBUGLIBPATH value="$(BCB)\lib\debug"/> + <RELEASELIBPATH value="$(BCB)\lib\release"/> + <LINKER value="ilink32"/> + <USERDEFINES value="_DEBUG"/> + <SYSDEFINES value="NO_STRICT;_NO_VCL;_RTLDLL;USEPACKAGES"/> + <MAINSOURCE value="rec_std_sync.bpf"/> + <INCLUDEPATH value="C:\svnwork\spcm_drv_c\common;C:\svnwork\spcm_drv_c\rec_std_sync;$(BCB)\include;$(BCB)\include\vcl"/> + <LIBPATH value="C:\svnwork\spcm_drv_c\common;C:\svnwork\spcm_drv_c\rec_std_sync;$(BCB)\lib\obj;$(BCB)\lib"/> + <WARNINGS value="-w-par"/> + <OTHERFILES value=""/> + </MACROS> + <OPTIONS> + <CFLAG1 value="-tWC -tWM -Od -H=$(BCB)\lib\vcl60.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v + -vi- -c"/> + <PFLAGS value="-$YD -$W -$O- -$A8 -v -JPHNE -M"/> + <RFLAGS value=""/> + <AFLAGS value="/mx /w2 /zd"/> + <LFLAGS value="-Tpe -ap -D"" -x -Gn -v"/> + <OTHERFILES value=""/> + </OPTIONS> + <LINKER> + <ALLOBJ value="c0x32.obj $(PACKAGES) $(OBJFILES)"/> + <ALLRES value="$(RESFILES)"/> + <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib"/> + <OTHERFILES value=""/> + </LINKER> + <FILELIST> + <FILE FILENAME="rec_std_sync.bpf" FORMNAME="" UNITNAME="rec_std_sync" CONTAINERID="BPF" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="rec_std_sync.cpp" FORMNAME="" UNITNAME="rec_std_sync" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_thread.cpp" FORMNAME="" UNITNAME="spcm_lib_thread.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_card.cpp" FORMNAME="" UNITNAME="spcm_lib_card.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_data.cpp" FORMNAME="" UNITNAME="spcm_lib_data.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\c_header\spcm_win32_bcppb.lib" FORMNAME="" UNITNAME="spcm_win32_bcppb.lib" CONTAINERID="LibTool" DESIGNCLASS="" LOCALCOMMAND=""/> + </FILELIST> + <BUILDTOOLS> + </BUILDTOOLS> + + <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= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +[Parameters] +RunParams= +Launcher= +UseLauncher=0 +DebugCWD= +HostApplication= +RemoteHost= +RemotePath= +RemoteLauncher= +RemoteCWD= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 + </IDEOPTIONS> +</PROJECT> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_sync.cpp b/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_sync.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bd1c9ee50e5adf5dca24437814ae35f6e52f3b46 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_sync.cpp @@ -0,0 +1,291 @@ +/* +************************************************************************** + +rec_std_sync.cpp (c) Spectrum GmbH + +************************************************************************** + +Example for all SpcMDrv based acquisition cards. + +Information about the different products and their drivers can be found +online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/platform-driver-and-series-differences + +Shows the synchronization of one or more cards with acquisition mode + +The Star-Hub is accessed directly as this is very simple + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_card.h" +#include "../common/spcm_lib_data.h" + +// ----- standard c include files ----- +#include <stdio.h> +#include <stdlib.h> + + + +/* +************************************************************************** +vDoCardSetup +************************************************************************** +*/ + +void vDoCardSetup (ST_SPCM_CARDINFO *pstCard) + { + int i; + + // standard single, all channels, memsize=16k, posttrigge=8k -> pretrigger=8k + bSpcMSetupModeRecStdSingle (pstCard, pstCard->lMaxChannels == 64 ? -1 : (1 << pstCard->lMaxChannels) - 1, 16 * 1024, 8 * 1024); + + // we try to set the samplerate to 1 MHz (M2i) or 20 MHz (M3i and M4i) on internal PLL, no clock output + if (pstCard->bM2i) + bSpcMSetupClockPLL (pstCard, MEGA(1), false); + else if (pstCard->bM2p) + bSpcMSetupClockPLL (pstCard, MEGA(10), false); + else + bSpcMSetupClockPLL (pstCard, MEGA(20), false); + printf ("Sampling rate card %d set to %.1lf MHz\n", pstCard->lCardIdx, (double) pstCard->llSetSamplerate / MEGA (1)); + + // type dependent card setup + switch (pstCard->eCardFunction) + { + + // analog acquisition card setup + case AnalogIn: + + // program all input channels to +/-1 V and 50 ohm termination (if it's available) + for (i=0; i < pstCard->lMaxChannels; i++) + if (pstCard->bM2i || pstCard->bM2p) + bSpcMSetupInputChannel (pstCard, i, 1000, true); + else if (pstCard->bM3i || pstCard->bM4i || pstCard->bM5i) + bSpcMSetupPathInputCh (pstCard, i, 0, 1000, 0, false, true, true); + break; + + // digital acquisition card setup + case DigitalIn: + case DigitalIO: + printf ("Not yet implemented\n"); + break; + } + } + + + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + char szBuffer[1024]; // a character buffer for any messages + ST_SPCM_CARDINFO* pstCard[MAXBRD]; // info structure of my card + int16 nCardCount, nIdx; + int16 nStarHubCarrierIdx = 0; + bool bStarhubFound = false; + drv_handle hSync; + bool bOk = true; + int32 lSyncdCards; + + + + // ------------------------------------------------------------------------ + // init all cards in the system + for (nCardCount = 0; nCardCount < MAXBRD; nCardCount++) + { + pstCard[nCardCount] = new ST_SPCM_CARDINFO; + + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + if (!bSpcMInitCardByIdx (pstCard[nCardCount], nCardCount)) + //if (!bSpcMInitCardByIdx (pstCard[nCardCount], "192.168.1.10", nCardCount)) + { + + // no card found + if (!nCardCount) + return nSpcMErrorMessageStdOut (pstCard[nCardCount], "Error: Could not open card\n", true); + + // clean up + delete pstCard[nCardCount]; + break; + } + + // check for star hub on the card + else + { + if ((pstCard[nCardCount]->lFeatureMap & SPCM_FEAT_STARHUB5) || (pstCard[nCardCount]->lFeatureMap & SPCM_FEAT_STARHUB16)) + { + bStarhubFound = true; + nStarHubCarrierIdx = nCardCount; + } + } + } + + printf (pszSpcMPrintDocumentationLink (pstCard[0], szBuffer, sizeof (szBuffer))); + + // print info of all cards + for (nIdx = 0; nIdx < nCardCount; nIdx++) + printf ("Card %d\n%s\n\n", nIdx, pszSpcMPrintCardInfo (pstCard[nIdx], szBuffer, sizeof (szBuffer))); + + // not our example if there's no starhub + if (!bStarhubFound) + { + printf ("\nThere's no starhub in the system, this example can't run\n"); + bOk = false; + } + + // the star hub is accessed under it's own handle + if (bOk) + { + hSync = spcm_hOpen ("sync0"); + if (!hSync) + { + printf ("\nCan't open starhub handle\n"); + bOk = false; + } + + spcm_dwGetParam_i32 (hSync, SPC_SYNC_READ_SYNCCOUNT, &lSyncdCards); + } + + + + // ------------------------------------------------------------------------ + // show cable connection info + if (bOk) + { + printf ("Star-Hub information:\n"); + printf ("star-hub is connected with %d cards\n", lSyncdCards); + for (nIdx = 0; nIdx < lSyncdCards; nIdx++) + { + int32 lCable; + spcm_dwGetParam_i32 (hSync, SPC_SYNC_READ_CABLECON0 + nIdx, &lCable); + printf (" Card Idx %d (sn %05d) is", nIdx, pstCard[nIdx]->lSerialNumber); + if (lCable != -1) + printf (" connected on cable %d\n", lCable); + else + printf (" not connected with the star-hub\n"); + } + printf ("\n"); + } + + + + // ------------------------------------------------------------------------ + // setup + if (bOk) + { + + // all cards got a similar setup, trigger sources disabled as default + for (nIdx = 0; (nIdx < nCardCount) && bOk; nIdx++) + { + vDoCardSetup (pstCard[nIdx]); + bOk = bSpcMSetupTrigMask (pstCard[nIdx], 0, 0, 0, 0, 0, 0); + } + + // 1st card is used as trigger master (un-comment the second line to have external trigger on card 0) + bOk =bSpcMSetupTrigSoftware (pstCard[0], false); + //bOk =bSpcMSetupTrigExternal (pstCard[0], SPC_TM_POS, false, 0); + } + + // and run + if (bOk) + { + uint32 dwError = ERR_OK; + + // sync setup, all card activated, last card is clock master + if (!dwError) dwError = spcm_dwSetParam_i32 (hSync, SPC_SYNC_ENABLEMASK, (1 << nCardCount) - 1); + if (!dwError) dwError = spcm_dwSetParam_i32 (hSync, SPC_SYNC_CLKMASK, (1 << nStarHubCarrierIdx)); + + // start the cards and wait for ready with a timeout of 5 seconds (5000 ms) + if (!dwError) dwError = spcm_dwSetParam_i32 (hSync, SPC_TIMEOUT, KILO(5)); + if (!dwError) + { + printf ("Acquisition started for all cards\n"); + dwError = spcm_dwSetParam_i32 (hSync, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_CARD_WAITREADY); + if (dwError == ERR_TIMEOUT) + printf ("... Timeout\n"); + + else if (!dwError) + { + printf ("... Sucessfully finished\n"); + + // ----- read data from the cards ----- + void* apvBuffer[MAXBRD] = { NULL }; + for (nIdx = 0; (nIdx < nCardCount); nIdx++) + { + uint64 qwBufferLen_samples = pstCard[nIdx]->llSetMemsize * pstCard[nIdx]->lSetChannels; + uint64 qwBufferLen_bytes = qwBufferLen_samples * pstCard[nIdx]->lBytesPerSample; + if (pstCard[nIdx]->lBytesPerSample == 1) + apvBuffer[nIdx] = new int8[(size_t)qwBufferLen_samples]; + else + apvBuffer[nIdx] = new int16[(size_t)qwBufferLen_samples]; + spcm_dwDefTransfer_i64 (pstCard[nIdx]->hDrv, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, 0, apvBuffer[nIdx], 0, qwBufferLen_bytes); + + // start DMA transfer and wait until it is finished + spcm_dwSetParam_i32 (hSync, SPC_TIMEOUT, 0); + spcm_dwSetParam_i32(pstCard[nIdx]->hDrv, SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA); + } + + // now all data from each card is in the corresponding buffer + // do something with the data + // ... + + // after we have processed the data, we delete the buffers again + for (nIdx = 0; (nIdx < nCardCount); nIdx++) + { + if (pstCard[nIdx]->lBytesPerSample == 1) + delete [] static_cast < int8* > (apvBuffer[nIdx]); + else + delete [] static_cast < int16* > (apvBuffer[nIdx]); + } + } + } + + // error message if something went wrong + if (dwError && (dwError != ERR_TIMEOUT)) + { + char szErrorMsg[ERRORTEXTLEN]; + spcm_dwGetErrorInfo_i32 (hSync, NULL, NULL, szErrorMsg); + printf ("\nError:\n%s\n", szErrorMsg); + } + } + + + + + // ------------------------------------------------------------------------ + // clean up and close the driver + if (bOk && hSync) + spcm_vClose (hSync); + + for (nIdx = 0; nIdx < nCardCount; nIdx++) + { + vSpcMCloseCard (pstCard[nIdx]); + delete (pstCard[nIdx]); + } + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_sync.dsp b/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_sync.dsp new file mode 100644 index 0000000000000000000000000000000000000000..e9518d0713fd0f73007ef623137fc737254dc010 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_sync.dsp @@ -0,0 +1,133 @@ +# Microsoft Developer Studio Project File - Name="rec_std_sync" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=rec_std_sync - Win32 Debug +!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE +!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl +!MESSAGE +!MESSAGE NMAKE /f "rec_std_sync.mak". +!MESSAGE +!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben +!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: +!MESSAGE +!MESSAGE NMAKE /f "rec_std_sync.mak" CFG="rec_std_sync - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "rec_std_sync - Win32 Release" (basierend auf "Win32 (x86) Console Application") +!MESSAGE "rec_std_sync - Win32 Debug" (basierend auf "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "rec_std_sync - 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" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /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)" == "rec_std_sync - 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" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c +# SUBTRACT CPP /YX /Yc /Yu +# 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 "rec_std_sync - Win32 Release" +# Name "rec_std_sync - Win32 Debug" +# Begin Group "header" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\c_header\dlltyp.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\regs.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcerr.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_drv.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_card.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.h +# End Source File +# End Group +# Begin Group "common" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\common\spcm_lib_card.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.cpp +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_win32_msvcpp.lib +# End Source File +# End Group +# Begin Source File + +SOURCE=.\rec_std_sync.cpp +# End Source File +# End Target +# End Project diff --git a/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_sync.vcproj b/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_sync.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..e6c1a2e1d4ee238e78c4994e79e3826a77f7cf23 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_sync.vcproj @@ -0,0 +1,572 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="rec_std_sync" + ProjectGUID="{0E10C8B0-8027-455A-BE9C-40C5779FFD15}" + RootNamespace="rec_std_sync" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/rec_std_sync.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_std_sync.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_std_sync.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_std_sync.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_std_sync.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/rec_std_sync.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + PrecompiledHeaderThrough="" + PrecompiledHeaderFile=".\Release/rec_std_sync.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_std_sync.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_std_sync.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_std_sync.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/rec_std_sync.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_std_sync.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_std_sync.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_std_sync.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_std_sync.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/rec_std_sync.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + PrecompiledHeaderThrough="" + PrecompiledHeaderFile=".\Release/rec_std_sync.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_std_sync.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_std_sync.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_std_sync.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="header" + Filter="h;hpp;hxx;hm;inl" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_card.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_data.h" + > + </File> + </Filter> + <Filter + Name="common" + > + <File + RelativePath="..\common\spcm_lib_card.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_data.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Filter> + <File + RelativePath="rec_std_sync.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_sync.vcxproj b/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_sync.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..8ebabfa4b4dc2216643f537c41d75cb53523138a --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_sync.vcxproj @@ -0,0 +1,267 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{0E10C8B0-8027-455A-BE9C-40C5779FFD15}</ProjectGuid> + <RootNamespace>rec_std_sync</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rec_std_sync.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_sync.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_sync.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_sync.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rec_std_sync.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader /> + <PrecompiledHeaderFile /> + <PrecompiledHeaderOutputFile>.\Release/rec_std_sync.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_sync.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_sync.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rec_std_sync.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_sync.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_sync.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_sync.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rec_std_sync.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader /> + <PrecompiledHeaderFile /> + <PrecompiledHeaderOutputFile>.\Release/rec_std_sync.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_sync.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_sync.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\common\spcm_lib_card.h" /> + <ClInclude Include="..\common\spcm_lib_data.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\spcm_lib_card.cpp" /> + <ClCompile Include="..\common\spcm_lib_data.cpp" /> + <ClCompile Include="rec_std_sync.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_sync.vcxproj.filters b/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_sync.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..a36e65c1250752312a7d666ec86147aae60db7a8 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_sync.vcxproj.filters @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="header"> + <UniqueIdentifier>{b8935c29-17e3-4b9a-b905-939105daa4bd}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + <Filter Include="common"> + <UniqueIdentifier>{38b0f332-6404-42ab-b50a-ee27e0dd2603}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_card.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_data.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\spcm_lib_card.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_data.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="rec_std_sync.cpp" /> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_system_sync.cpp b/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_system_sync.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f842afef4cea3dce663d651ddf3dd05e655f92fb --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_system_sync.cpp @@ -0,0 +1,400 @@ +/* +************************************************************************** + +rec_std_system_sync.cpp (c) Spectrum GmbH + +************************************************************************** + +Example for all M2i acquisition cards. + +Shows the synchronization of one or more cards on each system +starhub with standard single acquisition mode. + +For simplicity this example assumes that at least one +"system starhub master" and one "system starhub slave" are both +installed in the same PC system, to gain easy software +access to both devices, without the need for inter-system +software communication. + +Such a setup is rather unlikely for real-world use, because +such setup would render the usage of a system starhub over a +standard starhub rather useless. + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_card.h" +#include "../common/spcm_lib_data.h" + +// ----- standard c include files ----- +#include <stdio.h> +#include <stdlib.h> + + + +/* +************************************************************************** +vDoCardSetup +************************************************************************** +*/ + +void vDoCardSetup (ST_SPCM_CARDINFO *pstCard) + { + int i; + + // standard single, all channels, memsize=16k, posttrigge=8k -> pretrigger=8k + bSpcMSetupModeRecStdSingle (pstCard, pstCard->lMaxChannels == 64 ? -1 : (1 << pstCard->lMaxChannels) - 1, 16 * 1024, 8 * 1024); + + // we try to set the samplerate to 1 MHz (M2i) or 20 MHz (M3i and M4i) on internal PLL, no clock output + if (pstCard->bM2i) + bSpcMSetupClockPLL (pstCard, MEGA(1), false); + else + bSpcMSetupClockPLL (pstCard, MEGA(20), false); + printf ("Sampling rate card %d set to %.1lf MHz\n", pstCard->lCardIdx, (double) pstCard->llSetSamplerate / MEGA (1)); + + // type dependent card setup + switch (pstCard->eCardFunction) + { + + // analog acquisition card setup + case AnalogIn: + + // program all input channels to +/-1 V and 50 ohm termination (if it's available) + for (i=0; i < pstCard->lMaxChannels; i++) + if (pstCard->bM2i || pstCard->bM2p) + bSpcMSetupInputChannel (pstCard, i, 1000, true); + else if (pstCard->bM3i || pstCard->bM4i || pstCard->bM5i) + bSpcMSetupPathInputCh (pstCard, i, 0, 1000, 0, false, true, true); + break; + + // digital acquisition card setup + case DigitalIn: + case DigitalIO: + printf ("Not yet implemented\n"); + break; + } + } + + + + +/* +************************************************************************** +main +************************************************************************** +*/ +#define NO_OF_STARHUBS 2 + +int main () + { + char szBuffer[1024]; // a character buffer for any messages + ST_SPCM_CARDINFO* pstCard[MAXBRD]; // info structure of my card + int16 nCardCount; + int16 nStarhubCount; + int16 nIdx; + drv_handle hSync[NO_OF_STARHUBS]; + bool bOk = true; + bool bStarhubFound = false; + bool bSystemMasterStarhubFound = false; + bool bSystemSlaveStarhubFound = false; + int32 plSyncedCards[NO_OF_STARHUBS]; + char szSyncName[20]; + + + + // ------------------------------------------------------------------------ + // init all cards in the system + for (nCardCount = 0; nCardCount < MAXBRD; nCardCount++) + { + pstCard[nCardCount] = new ST_SPCM_CARDINFO; + + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + if (!bSpcMInitCardByIdx (pstCard[nCardCount], nCardCount)) + //if (!bSpcMInitCardByIdx (pstCard[nCardCount], "192.168.1.10", nCardCount)) + { + // no card found + if (!nCardCount) + return nSpcMErrorMessageStdOut (pstCard[nCardCount], "Error: Could not open card\n", true); + + // clean up + delete pstCard[nCardCount]; + break; + } + else + { + // check for star hub on the card + if ((pstCard[nCardCount]->lFeatureMap & SPCM_FEAT_STARHUBSYSMASTER) || (pstCard[nCardCount]->lFeatureMap & SPCM_FEAT_STARHUB16)) + bStarhubFound = true; + + if (pstCard[nCardCount]->lFeatureMap & SPCM_FEAT_STARHUBSYSMASTER) + bSystemMasterStarhubFound = true; + + if (pstCard[nCardCount]->lFeatureMap & SPCM_FEAT_STARHUBSYSSLAVE) + bSystemSlaveStarhubFound = true; + } + } + + + printf (pszSpcMPrintDocumentationLink (pstCard[0], szBuffer, sizeof (szBuffer))); + + // print info of all cards + for (nIdx = 0; nIdx < nCardCount; nIdx++) + printf ("Card %d\n%s\n\n", nIdx, pszSpcMPrintCardInfo (pstCard[nIdx], szBuffer, sizeof (szBuffer))); + + // not our example if there's no starhub + if (!bStarhubFound) + { + printf ("\nThere's no starhub in the system, this example can't run\n"); + bOk = false; + } + + // not our example if there's no system starhub master + if (!bSystemMasterStarhubFound) + { + printf ("\nThere's no system starhub master in the system, this example can't run\n"); + bOk = false; + } + + // not our example if there's no system starhub slave + if (!bSystemSlaveStarhubFound) + { + printf ("\nThere's no system starhub slave in the system, this example can't run\n"); + bOk = false; + } + + + // the star hubs are accessed by their own handles + if (bOk) + { + for (nStarhubCount = 0; nStarhubCount < NO_OF_STARHUBS; nStarhubCount++) + { + sprintf (szSyncName, "/dev/sync%d", nStarhubCount); + hSync[nStarhubCount] = spcm_hOpen (szSyncName); + if (!hSync[nStarhubCount]) + { + printf ("\nCan't open starhub handle\n"); + bOk = false; + } + spcm_dwGetParam_i32 (hSync[nStarhubCount], SPC_SYNC_READ_SYNCCOUNT, &plSyncedCards[nStarhubCount]); + } + } + + + + // ------------------------------------------------------------------------ + // show cable connection info for all cards on all starhubs + if (bOk) + { + for (nStarhubCount = 0; nStarhubCount < NO_OF_STARHUBS; nStarhubCount++) + { + printf ("Star-Hub %d information:\n", nStarhubCount); + printf ("Star-hub is connected with %d cards\n", plSyncedCards[nStarhubCount]); + for (nIdx = 0; nIdx < plSyncedCards[nStarhubCount]; nIdx++) + { + int32 lCable; + spcm_dwGetParam_i32 (hSync[nStarhubCount], SPC_SYNC_READ_CABLECON0 + nIdx, &lCable); + printf (" Card Idx %d (sn %05d) is", nIdx, pstCard[nIdx]->lSerialNumber); + if (lCable != -1) + printf (" connected on cable %d\n", lCable); + else + printf (" not connected with the star-hub\n"); + } + printf ("\n\n"); + } + } + + + + // ------------------------------------------------------------------------ + // setup + if (bOk) + { + // all cards on all starhubs got a similar setup, trigger sources disabled as default + for (nIdx = 0; (nIdx < nCardCount) && bOk; nIdx++) + { + vDoCardSetup (pstCard[nIdx]); + bOk = bSpcMSetupTrigMask (pstCard[nIdx], 0, 0, 0, 0, 0, 0); + } + + // 1st card is used as trigger master (un-comment the second line to have external trigger on card 0) + bOk =bSpcMSetupTrigSoftware (pstCard[0], false); + //bOk =bSpcMSetupTrigExternal (pstCard[0], SPC_TM_POS, false, 0); + } + + // and run the required sequence for system starhub setups + if (bOk) + { + uint32 dwError = ERR_OK; + + // configure all starhubs + for (nStarhubCount = 0; nStarhubCount < NO_OF_STARHUBS; nStarhubCount++) + { + // sync setup, all cards on all starhubs activated + if (!dwError) dwError = spcm_dwSetParam_i32 (hSync[nStarhubCount], SPC_SYNC_ENABLEMASK, (1 << plSyncedCards[nStarhubCount]) - 1); + + int32 lFeatures; + spcm_dwGetParam_i32 (hSync[nStarhubCount], SPC_PCIFEATURES, &lFeatures); + + // last card on System-Star-Hub Master is set as clock master + // And on each System-Star-Hub Slave also last card is set as clock master (necessary dummy) + if (!dwError) dwError = spcm_dwSetParam_i32 (hSync[nStarhubCount], SPC_SYNC_CLKMASK, (1 << (plSyncedCards[nStarhubCount] - 1))); + + // setup System-Star-Hubs to synchronize clock and trigger + if (!dwError) dwError = spcm_dwSetParam_i32 (hSync[nStarhubCount], SPC_SYNC_MODE, SPC_SYNC_SYSTEMCLOCKTRIG); + + // define delay compensation (if required): set to default value of 4 here + if (!dwError) dwError = spcm_dwSetParam_i32 (hSync[nStarhubCount], SPC_SYNC_SYSTEM_TRIGADJUST, 4); + + // configure a timeout of 5 seconds (5000 ms) for all cards, to avoid program deadlocks + // in case that starting either master or slave(s) does not properly work + if (!dwError) dwError = spcm_dwSetParam_i32 (hSync[nStarhubCount], SPC_TIMEOUT, KILO(5)); + } + + + // transfer setup to sytsem master starhub card to have sampling clocks active before starting the slaves + for (nStarhubCount = 0; nStarhubCount < NO_OF_STARHUBS; nStarhubCount++) + { + int32 lFeatures; + spcm_dwGetParam_i32 (hSync[nStarhubCount], SPC_PCIFEATURES, &lFeatures); + + if (lFeatures & SPCM_FEAT_STARHUBSYSMASTER) + { + if (!dwError) dwError = spcm_dwSetParam_i32 (hSync[nStarhubCount], SPC_M2CMD, M2CMD_CARD_WRITESETUP); + + // leave loop once we found the master + break; + } + } + + + printf("\n... Starting all starhubs\n"); + + + // start all slave starhubs first + for (nStarhubCount = 0; nStarhubCount < NO_OF_STARHUBS; nStarhubCount++) + { + int32 lFeatures; + spcm_dwGetParam_i32 (hSync[nStarhubCount], SPC_PCIFEATURES, &lFeatures); + + // start all slaves first (but not the master itself) + if ((lFeatures & SPCM_FEAT_STARHUBSYSSLAVE) && !(lFeatures & SPCM_FEAT_STARHUBSYSMASTER)) + { + if (!dwError) + { + printf ("Acquisition started for slave Star-Hub%d\n", nStarhubCount); + dwError = spcm_dwSetParam_i32 (hSync[nStarhubCount], SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER); + } + + // error message if something went wrong + if (dwError && (dwError != ERR_TIMEOUT)) + { + char szErrorMsg[ERRORTEXTLEN]; + spcm_dwGetErrorInfo_i32 (hSync[nStarhubCount], NULL, NULL, szErrorMsg); + printf ("\nError:\n%s\n", szErrorMsg); + } + } + } + + + // finally start master starhub + for (nStarhubCount = 0; nStarhubCount < NO_OF_STARHUBS; nStarhubCount++) + { + int32 lFeatures; + spcm_dwGetParam_i32 (hSync[nStarhubCount], SPC_PCIFEATURES, &lFeatures); + + // start all master last + if (lFeatures & SPCM_FEAT_STARHUBSYSMASTER) + { + if (!dwError) + { + printf ("Acquisition started for master Star-Hub%d\n", nStarhubCount); + dwError = spcm_dwSetParam_i32 (hSync[nStarhubCount], SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_CARD_WAITREADY); + if (dwError == ERR_TIMEOUT) + printf ("... Master Timeout\n"); + } + + // error message if something went wrong + if (dwError && (dwError != ERR_TIMEOUT)) + { + char szErrorMsg[ERRORTEXTLEN]; + spcm_dwGetErrorInfo_i32 (hSync[nStarhubCount], NULL, NULL, szErrorMsg); + printf ("\nError:\n%s\n", szErrorMsg); + } + + // leave loop once we started the master + break; + } + } + + // check if all slaves are ready + for (nStarhubCount = 0; nStarhubCount < NO_OF_STARHUBS; nStarhubCount++) + { + int32 lFeatures; + int32 lStatus; + spcm_dwGetParam_i32 (hSync[nStarhubCount], SPC_PCIFEATURES, &lFeatures); + + // read status from all slaves (but not the master itself) + if ((lFeatures & SPCM_FEAT_STARHUBSYSSLAVE) && !(lFeatures & SPCM_FEAT_STARHUBSYSMASTER)) + { + do + { + dwError = spcm_dwGetParam_i32 (hSync[nStarhubCount], SPC_M2STATUS, &lStatus); + } + while (!(lStatus & M2STAT_CARD_READY) && !dwError); + + // error message if something went wrong + if (dwError && (dwError != ERR_TIMEOUT)) + { + char szErrorMsg[ERRORTEXTLEN]; + spcm_dwGetErrorInfo_i32 (hSync[nStarhubCount], NULL, NULL, szErrorMsg); + printf ("\nError:\n%s\n", szErrorMsg); + } + } + } + + if (!dwError) + { + // + // this would be the point to read data from all the cards on all starhubs + // + printf ("... Sucessfully finished\n"); + } + } + + + + // ------------------------------------------------------------------------ + // clean up and close the driver + for (nStarhubCount = 0; nStarhubCount < NO_OF_STARHUBS; nStarhubCount++) + { + if (bOk && hSync[nStarhubCount]) + spcm_vClose (hSync[nStarhubCount]); + } + + for (nIdx = 0; nIdx < nCardCount; nIdx++) + { + vSpcMCloseCard (pstCard[nIdx]); + delete (pstCard[nIdx]); + } + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_system_sync.dsp b/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_system_sync.dsp new file mode 100644 index 0000000000000000000000000000000000000000..51a00a9107c89dfbd345f23ca500bb45fa496945 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_system_sync.dsp @@ -0,0 +1,133 @@ +# Microsoft Developer Studio Project File - Name="rec_std_system_sync" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=rec_std_system_sync - Win32 Debug +!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE +!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl +!MESSAGE +!MESSAGE NMAKE /f "rec_std_system_sync.mak". +!MESSAGE +!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben +!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: +!MESSAGE +!MESSAGE NMAKE /f "rec_std_system_sync.mak" CFG="rec_std_system_sync - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "rec_std_system_sync - Win32 Release" (basierend auf "Win32 (x86) Console Application") +!MESSAGE "rec_std_system_sync - Win32 Debug" (basierend auf "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "rec_std_system_sync - 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" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /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)" == "rec_std_system_sync - 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" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c +# SUBTRACT CPP /YX /Yc /Yu +# 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 "rec_std_system_sync - Win32 Release" +# Name "rec_std_system_sync - Win32 Debug" +# Begin Group "header" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\c_header\dlltyp.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\regs.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcerr.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_drv.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_card.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.h +# End Source File +# End Group +# Begin Group "common" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\common\spcm_lib_card.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.cpp +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_win32_msvcpp.lib +# End Source File +# End Group +# Begin Source File + +SOURCE=.\rec_std_system_sync.cpp +# End Source File +# End Target +# End Project diff --git a/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_system_sync.vcproj b/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_system_sync.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..c404114a9d65bf0cb58f5a4f1d82f72d7dbdab47 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_system_sync.vcproj @@ -0,0 +1,572 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="rec_std_system_sync" + ProjectGUID="{AA56AE55-D0C7-4F72-A32E-FE6144024027}" + RootNamespace="rec_std_system_sync" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/rec_std_system_sync.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_std_system_sync.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_std_system_sync.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_std_system_sync.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_std_system_sync.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/rec_std_system_sync.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + PrecompiledHeaderThrough="" + PrecompiledHeaderFile=".\Release/rec_std_system_sync.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_std_system_sync.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_std_system_sync.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_std_system_sync.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/rec_std_system_sync.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_std_system_sync.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_std_system_sync.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_std_system_sync.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_std_system_sync.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/rec_std_system_sync.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + PrecompiledHeaderThrough="" + PrecompiledHeaderFile=".\Release/rec_std_system_sync.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_std_system_sync.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_std_system_sync.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_std_system_sync.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="header" + Filter="h;hpp;hxx;hm;inl" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_card.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_data.h" + > + </File> + </Filter> + <Filter + Name="common" + > + <File + RelativePath="..\common\spcm_lib_card.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_data.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Filter> + <File + RelativePath="rec_std_system_sync.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_system_sync.vcxproj b/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_system_sync.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..d340477a430c4b88bd5b60fc5b6411dfee57d204 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_system_sync.vcxproj @@ -0,0 +1,267 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{AA56AE55-D0C7-4F72-A32E-FE6144024027}</ProjectGuid> + <RootNamespace>rec_std_system_sync</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rec_std_system_sync.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_system_sync.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_system_sync.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_system_sync.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rec_std_system_sync.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader /> + <PrecompiledHeaderFile /> + <PrecompiledHeaderOutputFile>.\Release/rec_std_system_sync.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_system_sync.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_system_sync.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rec_std_system_sync.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_system_sync.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_system_sync.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_system_sync.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rec_std_system_sync.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader /> + <PrecompiledHeaderFile /> + <PrecompiledHeaderOutputFile>.\Release/rec_std_system_sync.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_system_sync.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_system_sync.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\common\spcm_lib_card.h" /> + <ClInclude Include="..\common\spcm_lib_data.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\spcm_lib_card.cpp" /> + <ClCompile Include="..\common\spcm_lib_data.cpp" /> + <ClCompile Include="rec_std_system_sync.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_system_sync.vcxproj.filters b/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_system_sync.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..c8940c828095f7ea7d8a8431cd4fe669b6b6857f --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single_sync/rec_std_system_sync.vcxproj.filters @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="header"> + <UniqueIdentifier>{62f68953-f119-4ca5-a3b8-44045268dd8c}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + <Filter Include="common"> + <UniqueIdentifier>{63fd6933-a45c-43a8-bb07-2ae8b9b3de64}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_card.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_data.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\spcm_lib_card.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_data.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="rec_std_system_sync.cpp" /> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_single_sync/shdirect.cpp b/Cpp/examples/c_cpp/rec_std_single_sync/shdirect.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5f68cb5eb03fd432699616fb73a0dd2bf1a8ae18 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single_sync/shdirect.cpp @@ -0,0 +1,305 @@ +/* +************************************************************************** + +shdirect.cpp (c) Spectrum GmbH, 10/2018 + +************************************************************************** + +Example for all SpcMDrv based (M2i, M2i-Express and M2p) cards. The example works +with two cards from the same series, one of them must have a star-hub installed. + +Shows the synchronization of two cards using the special SH-Direct clock mode. +In that mode one card (or one set of cards) is running in a normal synchronisation +and another card (or several cards) just take the clock from the star-hub as an +external clock. Besides using this clock the cards run totally independent. + +This mode can for example be used to run a waveform or pattern generator +continuously and run a data acquisition card with the same speed but start +it several times with different setup all while the generator card is still +running. + +This example expects the star hub to be present on a generator card! + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_card.h" +#include "../common/spcm_lib_data.h" + +// ----- standard c include files ----- +#include <stdio.h> +#include <stdlib.h> + + + +/* +************************************************************************** +vDoCardSetup +************************************************************************** +*/ + +void vDoGeneratorCardSetup (ST_SPCM_CARDINFO *pstCard) + { + int i; + + // we try to set the samplerate to 1 MHz on internal PLL with enabled clock output + bSpcMSetupClockPLL (pstCard, MEGA (1), true); + + // type dependent card setup + switch (pstCard->eCardFunction) + { + + // analog acquisition card setup + case AnalogOut: + + // continuous mode with one channel + bSpcMSetupModeRepStdLoops (pstCard, CHANNEL0, KILO_B(16), 0); + + // program all analog outputs to +/-1 V, no offset, no filter + for (i=0; i < pstCard->lMaxChannels; i++) + bSpcMSetupAnalogOutputChannel (pstCard, i, 1000); + break; + + // digital output card setup + case DigitalOut: + case DigitalIO: + + // continuous mode with 16 channels + bSpcMSetupModeRepStdLoops (pstCard, 0xffff, KILO_B(16), 0); + bSpcMSetupDigitalOutput (pstCard, 0); + break; + } + + // software trigger for start + bSpcMSetupTrigSoftware (pstCard); + } + +// *********************************************************************** + +void vDoAcquisitionCardSetup (ST_SPCM_CARDINFO *pstCard) + { + int i; + + // the card is running with the direct star-hub clock here! (same clock or diveded from master) + spcm_dwSetParam_i32 (pstCard->hDrv, SPC_CLOCKMODE, SPC_CM_SHDIRECT); + spcm_dwSetParam_i64 (pstCard->hDrv, SPC_SAMPLERATE, KILO(500)); + spcm_dwSetParam_i32 (pstCard->hDrv, SPC_CLOCKOUT, 1); + + // type dependent card setup + switch (pstCard->eCardFunction) + { + + // analog acquisition card setup + case AnalogIn: + + // single shot mode with one channel + bSpcMSetupModeRecStdSingle (pstCard, CHANNEL0, KILO_B(16), KILO_B(8)); + + // program all analog inputs to +/-1 V, 50 ohm termination + for (i=0; i < pstCard->lMaxChannels; i++) + bSpcMSetupInputChannel (pstCard, i, 1000, true); + break; + + // digital input card setup + case DigitalIn: + case DigitalIO: + + // single shot mode with 16 channels + bSpcMSetupModeRecStdSingle (pstCard, 0xffff, KILO_B(16), KILO_B(8)); + + // termination active + bSpcMSetupDigitalInput (pstCard, 0, true); + break; + } + + // software trigger for start + bSpcMSetupTrigSoftware (pstCard); + } + + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + char szBuffer[1024]; // a character buffer for any messages + ST_SPCM_CARDINFO* pstCard[MAXBRD]; // info structure of my card + int16 nCardCount, nIdx, nStarHubCard = 0, nAcquisitionCard = 0; + bool bStarhubFound = false; + drv_handle hSync = NULL; + bool bOk = true; + int32 lSyncdCards; + uint32 dwError = ERR_OK; + + + + // ------------------------------------------------------------------------ + // init all cards in the system + for (nCardCount = 0; nCardCount < MAXBRD; nCardCount++) + { + pstCard[nCardCount] = new ST_SPCM_CARDINFO; + + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + if (!bSpcMInitCardByIdx (pstCard[nCardCount], nCardCount)) + //if (!bSpcMInitCardByIdx (pstCard[nCardCount], "192.168.1.10", nCardCount)) + { + + // no card found + if (!nCardCount) + return nSpcMErrorMessageStdOut (pstCard[nCardCount], "Error: Could not open card\n", true); + + // clean up + delete pstCard[nCardCount]; + break; + } + + // check for star hub on the card and store the card index + else + if ((pstCard[nCardCount]->lFeatureMap & SPCM_FEAT_STARHUB5) || (pstCard[nCardCount]->lFeatureMap & SPCM_FEAT_STARHUB16)) + { + bStarhubFound = true; + nStarHubCard = nCardCount; + } + else + nAcquisitionCard = nCardCount; + } + + printf (pszSpcMPrintDocumentationLink (pstCard[0], szBuffer, sizeof (szBuffer))); + + // print info of all cards + for (nIdx = 0; nIdx < nCardCount; nIdx++) + printf ("Card %d %s\n%s\n\n", nIdx, (nIdx == nStarHubCard? "(SH carrier)" : ""), pszSpcMPrintCardInfo (pstCard[nIdx], szBuffer, sizeof (szBuffer))); + + // not our example if there's no starhub + if (!bStarhubFound) + { + printf ("\nThere's no starhub in the system, this example can't run\n"); + bOk = false; + } + + // the star-hub card must be a generator card for the example + if (bOk) + switch (pstCard[nStarHubCard]->eCardFunction) + { + case AnalogIn: + case DigitalIn: + printf ("\nThe example expects a generator card as the star-hub holding card\n"); + bOk = false; + break; + } + + // all other cards must be acquisition cards + if (bOk) + for (nIdx = 0; (nIdx < nCardCount) && bOk; nIdx++) + if (nIdx != nStarHubCard) + switch (pstCard[nIdx]->eCardFunction) + { + case AnalogOut: + case DigitalOut: + printf ("\nThe example expects acquisition cards for all cards that do not hold the star-hub\n"); + bOk = false; + break; + } + + + // the star hub is accessed under it's own handle + if (bOk) + { + hSync = spcm_hOpen ("sync0"); + if (!hSync) + { + printf ("\nCan't open starhub handle\n"); + bOk = false; + } + + spcm_dwGetParam_i32 (hSync, SPC_SYNC_READ_SYNCCOUNT, &lSyncdCards); + } + + + + // ------------------------------------------------------------------------ + // setup and run all + if (bOk) + { + + // setup + vDoGeneratorCardSetup (pstCard[nStarHubCard]); + vDoAcquisitionCardSetup (pstCard[nAcquisitionCard]); + + // sync setup, only the star-hub card runs synchronised with itself + if (!dwError) dwError = spcm_dwSetParam_i32 (hSync, SPC_SYNC_ENABLEMASK, (1 << nStarHubCard)); + if (!dwError) dwError = spcm_dwSetParam_i32 (hSync, SPC_SYNC_CLKMASK, (1 << nStarHubCard)); + + // the star-hub card must be started first as it provides clock information for + // the other cards! + + // start the generator card + printf ("... start generator card\n"); + if (!dwError) dwError = spcm_dwSetParam_i32 (hSync, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER); + + // read out the sampling rates and show it + int64 llTest; + spcm_dwGetParam_i64 (pstCard[nStarHubCard]->hDrv, SPC_SAMPLERATE, &llTest); + printf ("Sampling rate generator card: %.2lf MS/s\n", (double) llTest / MEGA(1)); + spcm_dwGetParam_i64 (pstCard[nAcquisitionCard]->hDrv, SPC_SAMPLERATE, &llTest); + printf ("Sampling rate acquisition card: %.2lf MS/s\n", (double) llTest / MEGA(1)); + printf ("\n"); + + // we now start the acquisition card a couple of times, it runs with the clock + // taken from the star-hub. To keep the example simple we only use one acquisition + // card here + for (int i=0; (i<10) && (dwError == ERR_OK); i++) + { + printf ("... start acquisition card and wait for ready\n"); + dwError = spcm_dwSetParam_i32 (pstCard[nAcquisitionCard]->hDrv, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_CARD_WAITREADY); + if (dwError == ERR_OK) + printf ("... ready\n"); + } + } + + // error message if something went wrong + if (dwError && (dwError != ERR_TIMEOUT)) + { + char szErrorMsg[ERRORTEXTLEN]; + if (!spcm_dwGetErrorInfo_i32 (hSync, NULL, NULL, szErrorMsg)) + spcm_dwGetErrorInfo_i32 (pstCard[nAcquisitionCard]->hDrv, NULL, NULL, szErrorMsg); + printf ("\nError:\n%s\n", szErrorMsg); + } + + + // ------------------------------------------------------------------------ + // clean up and close the driver + if (hSync) + spcm_vClose (hSync); + + for (nIdx = 0; nIdx < nCardCount; nIdx++) + { + vSpcMCloseCard (pstCard[nIdx]); + delete (pstCard[nIdx]); + } + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/rec_std_single_sync/shdirect.dsp b/Cpp/examples/c_cpp/rec_std_single_sync/shdirect.dsp new file mode 100644 index 0000000000000000000000000000000000000000..4577eabe7019c2be613e8d723c38c06db8f8ca2f --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single_sync/shdirect.dsp @@ -0,0 +1,133 @@ +# Microsoft Developer Studio Project File - Name="shdirect" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=shdirect - Win32 Debug +!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE +!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl +!MESSAGE +!MESSAGE NMAKE /f "shdirect.mak". +!MESSAGE +!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben +!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: +!MESSAGE +!MESSAGE NMAKE /f "shdirect.mak" CFG="shdirect - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "shdirect - Win32 Release" (basierend auf "Win32 (x86) Console Application") +!MESSAGE "shdirect - Win32 Debug" (basierend auf "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "shdirect - 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" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /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)" == "shdirect - 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" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c +# SUBTRACT CPP /YX /Yc /Yu +# 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 "shdirect - Win32 Release" +# Name "shdirect - Win32 Debug" +# Begin Group "header" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\c_header\dlltyp.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\regs.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcerr.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_drv.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_card.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.h +# End Source File +# End Group +# Begin Group "common" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\common\spcm_lib_card.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.cpp +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_win32_msvcpp.lib +# End Source File +# End Group +# Begin Source File + +SOURCE=.\shdirect.cpp +# End Source File +# End Target +# End Project diff --git a/Cpp/examples/c_cpp/rec_std_single_sync/shdirect.vcproj b/Cpp/examples/c_cpp/rec_std_single_sync/shdirect.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..0e0580b0740a5eea2943926ae5b003a947d6abf6 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single_sync/shdirect.vcproj @@ -0,0 +1,572 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="shdirect" + ProjectGUID="{CB609605-432F-4433-A73A-4D7D1FC34B52}" + RootNamespace="shdirect" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/shdirect.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + PrecompiledHeaderThrough="" + PrecompiledHeaderFile=".\Release/shdirect.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/shdirect.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/shdirect.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/shdirect.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/shdirect.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/shdirect.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/shdirect.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/shdirect.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/shdirect.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/shdirect.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + PrecompiledHeaderThrough="" + PrecompiledHeaderFile=".\Release/shdirect.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/shdirect.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/shdirect.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/shdirect.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/shdirect.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/shdirect.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/shdirect.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/shdirect.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/shdirect.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="header" + Filter="h;hpp;hxx;hm;inl" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_card.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_data.h" + > + </File> + </Filter> + <Filter + Name="common" + > + <File + RelativePath="..\common\spcm_lib_card.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_data.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Filter> + <File + RelativePath="shdirect.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/rec_std_single_sync/shdirect.vcxproj b/Cpp/examples/c_cpp/rec_std_single_sync/shdirect.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..ed3a9616d7f87035b7627716f66ac40ce0728408 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single_sync/shdirect.vcxproj @@ -0,0 +1,267 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{CB609605-432F-4433-A73A-4D7D1FC34B52}</ProjectGuid> + <RootNamespace>shdirect</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/shdirect.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader /> + <PrecompiledHeaderFile /> + <PrecompiledHeaderOutputFile>.\Release/shdirect.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/shdirect.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/shdirect.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/shdirect.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/shdirect.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/shdirect.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/shdirect.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/shdirect.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader /> + <PrecompiledHeaderFile /> + <PrecompiledHeaderOutputFile>.\Release/shdirect.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/shdirect.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/shdirect.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/shdirect.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/shdirect.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/shdirect.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/shdirect.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\common\spcm_lib_card.h" /> + <ClInclude Include="..\common\spcm_lib_data.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\spcm_lib_card.cpp" /> + <ClCompile Include="..\common\spcm_lib_data.cpp" /> + <ClCompile Include="shdirect.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_single_sync/shdirect.vcxproj.filters b/Cpp/examples/c_cpp/rec_std_single_sync/shdirect.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..4784a67859e4e659657774bf1d760b5976631d1e --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single_sync/shdirect.vcxproj.filters @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="header"> + <UniqueIdentifier>{445f897b-5351-43bd-916c-329bef077411}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + <Filter Include="common"> + <UniqueIdentifier>{956ad952-7dd1-4013-a395-9d0ca4261a66}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_card.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_data.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\spcm_lib_card.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_data.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="shdirect.cpp" /> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rec_std_single_sync/simple_sync.dsw b/Cpp/examples/c_cpp/rec_std_single_sync/simple_sync.dsw new file mode 100644 index 0000000000000000000000000000000000000000..fd265fc4de300369b8b7ab856a5529005f83a16c --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single_sync/simple_sync.dsw @@ -0,0 +1,41 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "rec_std_sync"=.\rec_std_sync.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "shdirect"=.\shdirect.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/Cpp/examples/c_cpp/rec_std_single_sync/simple_sync.sln b/Cpp/examples/c_cpp/rec_std_single_sync/simple_sync.sln new file mode 100644 index 0000000000000000000000000000000000000000..6b44181dfd554cf9a8417c121cfe4f44a2c2a4d0 --- /dev/null +++ b/Cpp/examples/c_cpp/rec_std_single_sync/simple_sync.sln @@ -0,0 +1,46 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shdirect", "shdirect.vcproj", "{CB609605-432F-4433-A73A-4D7D1FC34B52}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rec_std_sync", "rec_std_sync.vcproj", "{0E10C8B0-8027-455A-BE9C-40C5779FFD15}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rec_std_system_sync", "rec_std_system_sync.vcproj", "{AA56AE55-D0C7-4F72-A32E-FE6144024027}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CB609605-432F-4433-A73A-4D7D1FC34B52}.Debug|Win32.ActiveCfg = Debug|Win32 + {CB609605-432F-4433-A73A-4D7D1FC34B52}.Debug|Win32.Build.0 = Debug|Win32 + {CB609605-432F-4433-A73A-4D7D1FC34B52}.Debug|x64.ActiveCfg = Debug|x64 + {CB609605-432F-4433-A73A-4D7D1FC34B52}.Debug|x64.Build.0 = Debug|x64 + {CB609605-432F-4433-A73A-4D7D1FC34B52}.Release|Win32.ActiveCfg = Release|Win32 + {CB609605-432F-4433-A73A-4D7D1FC34B52}.Release|Win32.Build.0 = Release|Win32 + {CB609605-432F-4433-A73A-4D7D1FC34B52}.Release|x64.ActiveCfg = Release|x64 + {CB609605-432F-4433-A73A-4D7D1FC34B52}.Release|x64.Build.0 = Release|x64 + {0E10C8B0-8027-455A-BE9C-40C5779FFD15}.Debug|Win32.ActiveCfg = Debug|Win32 + {0E10C8B0-8027-455A-BE9C-40C5779FFD15}.Debug|Win32.Build.0 = Debug|Win32 + {0E10C8B0-8027-455A-BE9C-40C5779FFD15}.Debug|x64.ActiveCfg = Debug|x64 + {0E10C8B0-8027-455A-BE9C-40C5779FFD15}.Debug|x64.Build.0 = Debug|x64 + {0E10C8B0-8027-455A-BE9C-40C5779FFD15}.Release|Win32.ActiveCfg = Release|Win32 + {0E10C8B0-8027-455A-BE9C-40C5779FFD15}.Release|Win32.Build.0 = Release|Win32 + {0E10C8B0-8027-455A-BE9C-40C5779FFD15}.Release|x64.ActiveCfg = Release|x64 + {0E10C8B0-8027-455A-BE9C-40C5779FFD15}.Release|x64.Build.0 = Release|x64 + {AA56AE55-D0C7-4F72-A32E-FE6144024027}.Debug|Win32.ActiveCfg = Debug|Win32 + {AA56AE55-D0C7-4F72-A32E-FE6144024027}.Debug|Win32.Build.0 = Debug|Win32 + {AA56AE55-D0C7-4F72-A32E-FE6144024027}.Debug|x64.ActiveCfg = Debug|x64 + {AA56AE55-D0C7-4F72-A32E-FE6144024027}.Debug|x64.Build.0 = Debug|x64 + {AA56AE55-D0C7-4F72-A32E-FE6144024027}.Release|Win32.ActiveCfg = Release|Win32 + {AA56AE55-D0C7-4F72-A32E-FE6144024027}.Release|Win32.Build.0 = Release|Win32 + {AA56AE55-D0C7-4F72-A32E-FE6144024027}.Release|x64.ActiveCfg = Release|x64 + {AA56AE55-D0C7-4F72-A32E-FE6144024027}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Cpp/examples/c_cpp/rep_fifo_multi/makefile b/Cpp/examples/c_cpp/rep_fifo_multi/makefile new file mode 100644 index 0000000000000000000000000000000000000000..67a0dfb8bca8e7171b2f70b962b1a33217fce046 --- /dev/null +++ b/Cpp/examples/c_cpp/rep_fifo_multi/makefile @@ -0,0 +1,24 @@ +COMPILER = g++ +EXECUTABLE = rep_fifo_multi +LIBS += -lspcm_linux -lpthread -lrt + +OBJECTS = \ + rep_fifo_multi.o\ + ../common/spcm_lib_card.o\ + ../common/spcm_lib_data.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(OBJECTS) + rm -f $(EXECUTABLE) + diff --git a/Cpp/examples/c_cpp/rep_fifo_multi/rep_fifo_multi.cpp b/Cpp/examples/c_cpp/rep_fifo_multi/rep_fifo_multi.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a8c31bba794e4af7c809632bbd08d13994880978 --- /dev/null +++ b/Cpp/examples/c_cpp/rep_fifo_multi/rep_fifo_multi.cpp @@ -0,0 +1,326 @@ +/* +************************************************************************** + +rep_fifo_multi.cpp (c) Spectrum GmbH + +************************************************************************** + +Example for all M2i, M4i, M4x, M2p analog and digital generator cards. +Shows FIFO multi replay mode. + +Feel free to use this source for own projects and modify it in any kind. + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + + +// ----- standard c include files ----- +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +#define _USE_MATH_DEFINES // for M_PI +#include <math.h> + + + +// ----- include of common example libraries ----- +#include "../common/spcm_lib_card.h" +#include "../common/spcm_lib_data.h" +#include "../common/ostools/spcm_oswrap.h" +#include "../common/ostools/spcm_ostools.h" + + + +/* +************************************************************************** +bDoCardSetup: setup matching the calculation routine +************************************************************************** +*/ + +bool bDoCardSetup (ST_SPCM_CARDINFO *pstCard) + { + int i; + + int lFilter = 0; + + // we try to set the samplerate to 1 MHz (M2i) or 50 MHz (M4i, M5i) on internal PLL, no clock output + if (pstCard->bM4i || pstCard->bM5i) + { + bSpcMSetupClockPLL (pstCard, MEGA(50), false); + lFilter = 1; // the only available filter + } + else + { + bSpcMSetupClockPLL (pstCard, MEGA(1), false); + lFilter = 3; // highest cut-off frequency + } + printf ("Sampling rate set to %.1lf MHz\n", (double) pstCard->llSetSamplerate / MEGA(1)); + + // external trigger, rising edge + bSpcMSetupTrigExternal (pstCard, SPC_TM_POS, false); + + // type dependent card setup + switch (pstCard->eCardFunction) + { + + // analog generator card setup + case AnalogOut: + { + // program all output channels to +/-1 V, zero offset and filter + for (i=0; i < pstCard->lMaxChannels; i++) + bSpcMSetupAnalogOutputChannel (pstCard, i, 1000, 0, lFilter); + + // FIFO multi mode setup, we run continuously + // only one chanel is activated for analog output to keep example simple + bSpcMSetupModeRepFIFOMulti (pstCard, CHANNEL0, 1024); + break; + } + + + // digital generator card setup + case DigitalIn: + case DigitalIO: + { + // FIFO mode setup, we run continuously + if (pstCard->bM2p) + { + // 75xx cannot enable less than 16 channels + bSpcMSetupModeRepFIFOSingle (pstCard, 0xffff); + } + else + { + // 8 channels (1 byte) is activated + bSpcMSetupModeRepFIFOSingle (pstCard, 0xff); + } + break; + } + } + + return pstCard->bSetError; + } + + + +/* +************************************************************************** +DoDataCalculation: calculates the output data. The calculation routine + is quite simple as we either have one analog channel + or 8 digital channels to calculate +************************************************************************** +*/ +static int64 g_llOffset = 0; +static int64 g_llXDiv = KILO_B(100); + +bool bDoDataCalculation (ST_SPCM_CARDINFO *pstCard, void* pvBuffer, int64 llBytesToCalculate) + { + int64 i; + int16* pnData = (int16*) pvBuffer; + int8* pbyData = (int8*) pvBuffer; + double dSineXScale = 2.0 * M_PI / g_llXDiv; + + switch (pstCard->eCardFunction) + { + + // analog generator card setup: 1 channel slow sine signal + case AnalogOut: + { + if (pstCard->lBytesPerSample == 1) + { + for (i = 0; i < llBytesToCalculate; i++) + pbyData[i] = (int8) (pstCard->uCfg.stAO.lMaxDACValue * sin (dSineXScale * (g_llOffset + i))); + } + else + { + for (i = 0; i < llBytesToCalculate/2; i++) + pnData[i] = (int16) (pstCard->uCfg.stAO.lMaxDACValue * sin (dSineXScale * (g_llOffset + i))); + } + + g_llOffset += (llBytesToCalculate / pstCard->lBytesPerSample); + break; + } + + // digital generator card setup: simple ramp + case DigitalIn: + case DigitalIO: + { + for (i=0; i<llBytesToCalculate; i++) + pbyData[i] = (int8) i; + break; + } + } + + return true; + } + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + char szBuffer[1024]; // a character buffer for any messages + ST_SPCM_CARDINFO stCard; // info structure of my card + void* pvBuffer = NULL; + uint32 dwErr; + int nKeyCheck = 0; // key check counter to avoid to much key polling + + // setup for the FIFO mode (HW buffer size can be programmed starting with firmware V9) + int64 llHWBufSize = KILO_B(64); + int64 llSWBufSize = KILO_B(128); + int64 llNotifySize = KILO_B(8); + + + + // some example checks + if (llSWBufSize % llNotifySize) + { + printf ("In our example we can only handle sw buffers that are a whole numbered multiple of the notify size\n"); + return 1; + } + + + // ------------------------------------------------------------------------ + // init card number 0 (the first card in the system), get some information and print it + // uncomment the second line and replace the IP address to use remote + // cards like in a generatorNETBOX + if (bSpcMInitCardByIdx (&stCard, 0)) + //if (bSpcMInitCardByIdx (&stCard, "192.168.1.10", 0)) + { + printf (pszSpcMPrintDocumentationLink (&stCard, szBuffer, sizeof (szBuffer))); + printf (pszSpcMPrintCardInfo (&stCard, szBuffer, sizeof (szBuffer))); + } + else + return nSpcMErrorMessageStdOut (&stCard, "Error: Could not open card\n", true); + + + // check whether we support this card type in the example + if ((stCard.eCardFunction != AnalogOut) && (stCard.eCardFunction != DigitalOut) && (stCard.eCardFunction != DigitalIO)) + return nSpcMErrorMessageStdOut (&stCard, "Error: Card function not supported by this example\n", false); + + + + + // ------------------------------------------------------------------------ + // do the card setup, error is routed in the structure so we don't care for the return values + if (!stCard.bSetError) + { + bool bError = bDoCardSetup (&stCard); + if (bError) + { + printf ("Error: An error occurred in card setup.\n"); + return 1; + } + } + + + + // starting with firmware version V9 we can program the hardware buffer size to reduce the latency + if (stCard.lCtrlFwVersion >= 9) + { + spcm_dwSetParam_i64 (stCard.hDrv, SPC_DATA_OUTBUFSIZE, llHWBufSize); + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_WRITESETUP); + } + + // ------------------------------------------------------------------------ + // allocate and setup the fifo buffer and fill it once with data + pvBuffer = pvAllocMemPageAligned ((uint32) llSWBufSize); + if (!pvBuffer) + return nSpcMErrorMessageStdOut (&stCard, "Memory allocation error\n", false); + spcm_dwDefTransfer_i64 (stCard.hDrv, SPCM_BUF_DATA, SPCM_DIR_PCTOCARD, (uint32) llNotifySize, pvBuffer, 0, llSWBufSize); + bDoDataCalculation (&stCard, pvBuffer, llSWBufSize); + spcm_dwSetParam_i64 (stCard.hDrv, SPC_DATA_AVAIL_CARD_LEN, llSWBufSize); + + // now buffer is full of data and we start the transfer (output is not started yet), timeout is 5 seconds + spcm_dwSetParam_i32 (stCard.hDrv, SPC_TIMEOUT, 5000); + dwErr = spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA); + + + + + // ------------------------------------------------------------------------ + // this is our main output and calculation loop + int64 llTransferredBytes = 0; + int64 llAvailUser; + int64 llBufferFillPromille; + int64 llUserPos; + bool bStarted = false; + + while (!dwErr) + { + spcm_dwGetParam_i64 (stCard.hDrv, SPC_DATA_AVAIL_USER_LEN, &llAvailUser); + spcm_dwGetParam_i64 (stCard.hDrv, SPC_FILLSIZEPROMILLE, &llBufferFillPromille); + printf ("\rSW-Buffer: %3.0f%% HW-Buffer:%3d%%, Total Bytes so far: %6.2f MB", (float) 100.0 * (llSWBufSize - llAvailUser) / llSWBufSize, (uint32) llBufferFillPromille / 10, (float) llTransferredBytes / MEGA_B(1)); + + + // we recalculate the amount of data that is free and set this part available for card again + // inhere we only take pieces of notify size + if (llAvailUser >= llNotifySize) + { + llTransferredBytes += llNotifySize; + spcm_dwGetParam_i64 (stCard.hDrv, SPC_DATA_AVAIL_USER_POS, &llUserPos); + bDoDataCalculation (&stCard, ((int8*) pvBuffer) + llUserPos, llNotifySize); + dwErr = spcm_dwSetParam_i64 (stCard.hDrv, SPC_DATA_AVAIL_CARD_LEN, llNotifySize); + } + + // we start the output as soon as we have a sufficient amount of data on card + // inhere we start if the hardware buffer is completely full + if (!bStarted && !dwErr && (llBufferFillPromille == 1000)) + { + printf ("\nStart the output\n"); + dwErr = spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER); + bStarted = true; + } + + // wait for the next buffer to be free + if (!dwErr) + dwErr = spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_DATA_WAITDMA); + + // check for esc=abort + if (!dwErr) + { + if (nKeyCheck-- == 0) + { + nKeyCheck = 64; + if (bKbhit()) + { + switch (cGetch()) + { + case 27: + printf ("\nOutput stopped\n"); + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_STOP); + dwErr = ERR_ABORT; + break; + } + } + } + } + } + + // show runtime errors + if (dwErr && !stCard.bSetError) + printf ("\nEnd with Runtime Error Code:%d\n-> %s\n\n", dwErr, pszSpcMTranslateRuntimeError (dwErr, szBuffer)); + + // ------------------------------------------------------------------------ + // print error information if an error occured + if (stCard.bSetError) + return nSpcMErrorMessageStdOut (&stCard, "An error occured while programming the card:\n", true); + + vFreeMemPageAligned (pvBuffer, (uint32) llSWBufSize); + + // clean up and close the driver + vSpcMCloseCard (&stCard); + + return EXIT_SUCCESS; + } diff --git a/Cpp/examples/c_cpp/rep_fifo_multi/rep_fifo_multi.vcproj b/Cpp/examples/c_cpp/rep_fifo_multi/rep_fifo_multi.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..22a54bf2a8f247cf8164cd36a5c54882bfeca7da --- /dev/null +++ b/Cpp/examples/c_cpp/rep_fifo_multi/rep_fifo_multi.vcproj @@ -0,0 +1,608 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="rep_fifo_multi" + ProjectGUID="{EF4E7883-EA98-4D8D-82D6-1402B1EA5016}" + RootNamespace="rep_fifo_single" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/rep_fifo_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rep_fifo_single.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rep_fifo_multi.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rep_fifo_single.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rep_fifo_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/rep_fifo_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rep_fifo_single.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rep_fifo_multi.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rep_fifo_single.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rep_fifo_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/rep_fifo_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rep_fifo_single.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rep_fifo_multi.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rep_fifo_single.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rep_fifo_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/rep_fifo_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rep_fifo_single.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rep_fifo_multi.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rep_fifo_single.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rep_fifo_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="header" + Filter="h;hpp;hxx;hm;inl" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_card.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_data.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + </Filter> + <Filter + Name="common" + > + <File + RelativePath="..\common\spcm_lib_card.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_data.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Filter> + <File + RelativePath=".\rep_fifo_multi.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/rep_fifo_multi/rep_fifo_multi.vcxproj b/Cpp/examples/c_cpp/rep_fifo_multi/rep_fifo_multi.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..fc012ebc7edbfeb9752964005aca1eb4a293e404 --- /dev/null +++ b/Cpp/examples/c_cpp/rep_fifo_multi/rep_fifo_multi.vcxproj @@ -0,0 +1,265 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{EF4E7883-EA98-4D8D-82D6-1402B1EA5016}</ProjectGuid> + <RootNamespace>rep_fifo_single</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rep_fifo_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rep_fifo_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rep_fifo_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rep_fifo_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rep_fifo_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rep_fifo_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rep_fifo_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rep_fifo_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rep_fifo_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rep_fifo_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rep_fifo_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rep_fifo_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rep_fifo_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rep_fifo_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rep_fifo_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rep_fifo_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\spcm_lib_card.h" /> + <ClInclude Include="..\common\spcm_lib_data.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="..\common\spcm_lib_card.cpp" /> + <ClCompile Include="..\common\spcm_lib_data.cpp" /> + <ClCompile Include="rep_fifo_multi.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rep_fifo_multi/rep_fifo_multi.vcxproj.filters b/Cpp/examples/c_cpp/rep_fifo_multi/rep_fifo_multi.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..7c07d56efaa5ba2543de701db7ae34c27b5621c0 --- /dev/null +++ b/Cpp/examples/c_cpp/rep_fifo_multi/rep_fifo_multi.vcxproj.filters @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="header"> + <UniqueIdentifier>{9f048e28-44d0-4fb8-878b-863f6d753b05}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + <Filter Include="common"> + <UniqueIdentifier>{c6329382-68aa-4e36-93e2-f8f3869802f4}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_card.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_data.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\spcm_lib_card.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_data.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="rep_fifo_multi.cpp" /> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rep_fifo_single/makefile.single b/Cpp/examples/c_cpp/rep_fifo_single/makefile.single new file mode 100644 index 0000000000000000000000000000000000000000..0024b5f2081f16dcb938ef662e6b745096517068 --- /dev/null +++ b/Cpp/examples/c_cpp/rep_fifo_single/makefile.single @@ -0,0 +1,24 @@ +COMPILER = g++ +EXECUTABLE = rep_fifo_single +LIBS += -lspcm_linux -lpthread -lrt + +OBJECTS = \ + rep_fifo_single.o\ + ../common/spcm_lib_card.o\ + ../common/spcm_lib_data.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/rep_fifo_single/makefile.single_poll b/Cpp/examples/c_cpp/rep_fifo_single/makefile.single_poll new file mode 100644 index 0000000000000000000000000000000000000000..5c0e2c1436ef3243ad3751c89b061d2bad8cacae --- /dev/null +++ b/Cpp/examples/c_cpp/rep_fifo_single/makefile.single_poll @@ -0,0 +1,24 @@ +COMPILER = g++ +EXECUTABLE = rep_fifo_single_poll +LIBS += -lspcm_linux -lpthread -lrt + +OBJECTS = \ + rep_fifo_single_poll.o\ + ../common/spcm_lib_card.o\ + ../common/spcm_lib_data.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single.bpf b/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single.bpf new file mode 100644 index 0000000000000000000000000000000000000000..5da88241fe8e80944de42def849bf4eab8f1f666 --- /dev/null +++ b/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single.bpf @@ -0,0 +1,3 @@ +This file is used by the project manager only and should be treated like the project file + + main \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single.bpr b/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single.bpr new file mode 100644 index 0000000000000000000000000000000000000000..d72384ff7896f66a3500c1c25d6fe901f4bae066 --- /dev/null +++ b/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single.bpr @@ -0,0 +1,104 @@ +<?xml version='1.0' encoding='utf-8' ?> +<!-- C++Builder XML Project --> +<PROJECT> + <MACROS> + <VERSION value="BCB.06.00"/> + <PROJECT value="rep_fifo_single.exe"/> + <OBJFILES value="rep_fifo_single.obj ..\common\spcm_lib_thread.obj + ..\common\spcm_lib_card.obj ..\common\spcm_lib_data.obj"/> + <RESFILES value=""/> + <DEFFILE value=""/> + <RESDEPEN value="$(RESFILES)"/> + <LIBFILES value="..\c_header\spcm_win32_bcppb.lib"/> + <LIBRARIES value=""/> + <SPARELIBS value=""/> + <PACKAGES value="vcl.bpi rtl.bpi vclx.bpi bcbsmp.bpi dclocx.bpi"/> + <PATHCPP value=".;..\common;..\common;..\common"/> + <PATHPAS value=".;"/> + <PATHRC value=".;"/> + <PATHASM value=".;"/> + <DEBUGLIBPATH value="$(BCB)\lib\debug"/> + <RELEASELIBPATH value="$(BCB)\lib\release"/> + <LINKER value="ilink32"/> + <USERDEFINES value="_DEBUG"/> + <SYSDEFINES value="NO_STRICT;_NO_VCL;_RTLDLL;USEPACKAGES"/> + <MAINSOURCE value="rep_fifo_single.bpf"/> + <INCLUDEPATH value="C:\svnwork\spcm_drv_c\common;C:\svnwork\spcm_drv_c\rep_fifo_single;$(BCB)\include;$(BCB)\include\vcl"/> + <LIBPATH value="C:\svnwork\spcm_drv_c\common;C:\svnwork\spcm_drv_c\rep_fifo_single;$(BCB)\lib\obj;$(BCB)\lib"/> + <WARNINGS value="-w-par"/> + <OTHERFILES value=""/> + </MACROS> + <OPTIONS> + <CFLAG1 value="-tWC -tWM -Od -H=$(BCB)\lib\vcl60.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v + -vi- -c"/> + <PFLAGS value="-$YD -$W -$O- -$A8 -v -JPHNE -M"/> + <RFLAGS value=""/> + <AFLAGS value="/mx /w2 /zd"/> + <LFLAGS value="-Tpe -ap -D"" -x -Gn -v"/> + <OTHERFILES value=""/> + </OPTIONS> + <LINKER> + <ALLOBJ value="c0x32.obj $(PACKAGES) $(OBJFILES)"/> + <ALLRES value="$(RESFILES)"/> + <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib"/> + <OTHERFILES value=""/> + </LINKER> + <FILELIST> + <FILE FILENAME="rep_fifo_single.bpf" FORMNAME="" UNITNAME="rep_fifo_single" CONTAINERID="BPF" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="rep_fifo_single.cpp" FORMNAME="" UNITNAME="rep_fifo_single" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_thread.cpp" FORMNAME="" UNITNAME="spcm_lib_thread.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_card.cpp" FORMNAME="" UNITNAME="spcm_lib_card.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_data.cpp" FORMNAME="" UNITNAME="spcm_lib_data.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\c_header\spcm_win32_bcppb.lib" FORMNAME="" UNITNAME="spcm_win32_bcppb.lib" CONTAINERID="LibTool" DESIGNCLASS="" LOCALCOMMAND=""/> + </FILELIST> + <BUILDTOOLS> + </BUILDTOOLS> + + <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= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +[Parameters] +RunParams= +Launcher= +UseLauncher=0 +DebugCWD= +HostApplication= +RemoteHost= +RemotePath= +RemoteLauncher= +RemoteCWD= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 + </IDEOPTIONS> +</PROJECT> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single.cpp b/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a08b77d353f30d0e66b25613942c4483984a7d01 --- /dev/null +++ b/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single.cpp @@ -0,0 +1,328 @@ +/* +************************************************************************** + +rep_fifo_single.cpp (c) Spectrum GmbH + +************************************************************************** + +Example for all M2i, M4i, M4x, M2p analog and digital generator cards. +Shows FIFO replay mode as single shot. + +To test output latency the example allows to change the output signal +frequency by pressing the space key. + +Feel free to use this source for own projects and modify it in any kind. + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + + +// ----- standard c include files ----- +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +#define _USE_MATH_DEFINES // for M_PI +#include <math.h> + + + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_card.h" +#include "../common/spcm_lib_data.h" +#include "../common/ostools/spcm_oswrap.h" +#include "../common/ostools/spcm_ostools.h" + + + +/* +************************************************************************** +bDoCardSetup: setup matching the calculation routine +************************************************************************** +*/ + +bool bDoCardSetup (ST_SPCM_CARDINFO *pstCard) + { + int i; + int lFilter = 0; + + // we try to set the samplerate to 1 MHz (M2i) or 50 MHz (M4i, M5i) on internal PLL, no clock output + if (pstCard->bM4i || pstCard->bM5i) + { + bSpcMSetupClockPLL (pstCard, MEGA(50), false); + lFilter = 1; // the only available filter + } + else + { + bSpcMSetupClockPLL (pstCard, MEGA(1), false); + lFilter = 3; // highest cut-off frequency + } + printf ("Sampling rate set to %.1lf MHz\n", (double) pstCard->llSetSamplerate / MEGA(1)); + + // we set software trigger, no trigger output + bSpcMSetupTrigSoftware (pstCard, false); + + // type dependent card setup + switch (pstCard->eCardFunction) + { + + // analog generator card setup + case AnalogOut: + { + // program all output channels to +/-1 V, zero offset and filter + for (i=0; i < pstCard->lMaxChannels; i++) + bSpcMSetupAnalogOutputChannel (pstCard, i, 1000, 0, lFilter); + + // FIFO mode setup, we run continuously + // only one chanel is activated for analog output to keep example simple + bSpcMSetupModeRepFIFOSingle (pstCard, CHANNEL0); + break; + } + + // digital generator card setup + case DigitalIn: + case DigitalIO: + { + // FIFO mode setup, we run continuously + if (pstCard->bM2p) + { + // 75xx cannot enable less than 16 channels + bSpcMSetupModeRepFIFOSingle (pstCard, 0xffff); + } + else + { + // 8 channels (1 byte) is activated + bSpcMSetupModeRepFIFOSingle (pstCard, 0xff); + } + break; + } + } + + return pstCard->bSetError; + } + + + +/* +************************************************************************** +DoDataCalculation: calculates the output data. The calculation routine + is quite simple as we either have one analog channel + or 8 digital channels to calculate +************************************************************************** +*/ +static int64 g_llOffset = 0; +static int64 g_llXDiv = KILO_B(100); + +bool bDoDataCalculation (ST_SPCM_CARDINFO *pstCard, void* pvBuffer, int64 llBytesToCalculate) + { + int64 i; + int16* pnData = (int16*) pvBuffer; + int8* pbyData = (int8*) pvBuffer; + double dSineXScale = 2.0 * M_PI / g_llXDiv; + + switch (pstCard->eCardFunction) + { + // analog generator card setup: 1 channel slow sine signal + case AnalogOut: + { + if (pstCard->lBytesPerSample == 1) + { + for (i = 0; i < llBytesToCalculate; i++) + pbyData[i] = (int8) (pstCard->uCfg.stAO.lMaxDACValue * sin (dSineXScale * (g_llOffset + i))); + } + else + { + for (i = 0; i < llBytesToCalculate/2; i++) + pnData[i] = (int16) (pstCard->uCfg.stAO.lMaxDACValue * sin (dSineXScale * (g_llOffset + i))); + } + + g_llOffset += (llBytesToCalculate / pstCard->lBytesPerSample); + break; + } + + + // digital generator card setup: simple ramp + case DigitalIn: + case DigitalIO: + { + for (i=0; i<llBytesToCalculate; i++) + pbyData[i] = (int8) i; + break; + } + } + + return true; + } + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + char szBuffer[1024]; // a character buffer for any messages + ST_SPCM_CARDINFO stCard; // info structure of my card + void* pvBuffer = NULL; + uint32 dwErr; + int nKeyCheck = 0; // key check counter to avoid to much key polling + + // setup for the FIFO mode (HW buffer size can be programmed starting with firmware V9) + int64 llHWBufSize = KILO_B(64); + int64 llSWBufSize = KILO_B(128); + int64 llNotifySize = KILO_B(8); + + + + // some example checks + if (llSWBufSize % llNotifySize) + { + printf ("In our example we can only handle sw buffers that are a whole numbered multiple of the notify size\n"); + return 1; + } + + + // ------------------------------------------------------------------------ + // init card number 0 (the first card in the system), get some information and print it + if (bSpcMInitCardByIdx (&stCard, 0)) + { + printf (pszSpcMPrintDocumentationLink (&stCard, szBuffer, sizeof (szBuffer))); + printf (pszSpcMPrintCardInfo (&stCard, szBuffer, sizeof (szBuffer))); + } + else + return nSpcMErrorMessageStdOut (&stCard, "Error: Could not open card\n", true); + + + // check whether we support this card type in the example + if ((stCard.eCardFunction != AnalogOut) && (stCard.eCardFunction != DigitalOut) && (stCard.eCardFunction != DigitalIO)) + return nSpcMErrorMessageStdOut (&stCard, "Error: Card function not supported by this example\n", false); + + + + + // ------------------------------------------------------------------------ + // do the card setup, error is routed in the structure so we don't care for the return values + if (!stCard.bSetError) + { + bool bError = bDoCardSetup (&stCard); + if (bError) + { + printf ("Error: An error occured in card setup\n"); + return 1; + } + } + + + // starting with firmware version V9 we can program the hardware buffer size to reduce the latency + if (stCard.lCtrlFwVersion >= 9) + { + spcm_dwSetParam_i64 (stCard.hDrv, SPC_DATA_OUTBUFSIZE, llHWBufSize); + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_WRITESETUP); + } + + // ------------------------------------------------------------------------ + // allocate and setup the fifo buffer and fill it once with data + pvBuffer = pvAllocMemPageAligned ((uint32) llSWBufSize); + if (!pvBuffer) + return nSpcMErrorMessageStdOut (&stCard, "Memory allocation error\n", false); + spcm_dwDefTransfer_i64 (stCard.hDrv, SPCM_BUF_DATA, SPCM_DIR_PCTOCARD, (uint32) llNotifySize, pvBuffer, 0, llSWBufSize); + bDoDataCalculation (&stCard, pvBuffer, llSWBufSize); + spcm_dwSetParam_i64 (stCard.hDrv, SPC_DATA_AVAIL_CARD_LEN, llSWBufSize); + + // now buffer is full of data and we start the transfer (output is not started yet), timeout is 1 second + spcm_dwSetParam_i32 (stCard.hDrv, SPC_TIMEOUT, 1000); + dwErr = spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA); + + + + + // ------------------------------------------------------------------------ + // this is our main output and calculation loop + int64 llTransferredBytes = 0; + int64 llAvailUser; + int64 llBufferFillPromille; + int64 llUserPos; + bool bStarted = false; + + while (!dwErr) + { + spcm_dwGetParam_i64 (stCard.hDrv, SPC_DATA_AVAIL_USER_LEN, &llAvailUser); + spcm_dwGetParam_i64 (stCard.hDrv, SPC_FILLSIZEPROMILLE, &llBufferFillPromille); + printf ("\rSW-Buffer: %3.0f%% HW-Buffer:%3d%%, Total Bytes so far: %6.2f MB", (float) 100.0 * (llSWBufSize - llAvailUser) / llSWBufSize, (uint32) llBufferFillPromille / 10, (float) llTransferredBytes / MEGA_B(1)); + + + // we recalculate the amount of data that is free and set this part available for card again + // inhere we only take pieces of notify size + if (llAvailUser >= llNotifySize) + { + llTransferredBytes += llNotifySize; + spcm_dwGetParam_i64 (stCard.hDrv, SPC_DATA_AVAIL_USER_POS, &llUserPos); + bDoDataCalculation (&stCard, ((int8*) pvBuffer) + llUserPos, llNotifySize); + dwErr = spcm_dwSetParam_i64 (stCard.hDrv, SPC_DATA_AVAIL_CARD_LEN, llNotifySize); + } + + // we start the output as soon as we have a sufficient amount of data on card + // inhere we start if the hardware buffer is completely full + if (!bStarted && !dwErr && (llBufferFillPromille == 1000)) + { + printf ("\nStart the output\n"); + dwErr = spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER); + bStarted = true; + } + + // wait for the next buffer to be free + if (!dwErr) + dwErr = spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_DATA_WAITDMA); + + + // check for esc=abort + if (!dwErr) + if (nKeyCheck-- == 0) + { + nKeyCheck = 64; + if (bKbhit()) + switch (cGetch()) + { + case 27: + printf ("\nOutput stopped\n"); + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_STOP); + dwErr = ERR_ABORT; + break; + + // blank changes the signal to test the output latency + case ' ': + printf ("\nChange Signal\n"); + g_llXDiv /= 2; + break; + + } + } + } + + // show runtime errors + if (dwErr && !stCard.bSetError) + printf ("\nEnd with Runtime Error Code:%d\n-> %s\n\n", dwErr, pszSpcMTranslateRuntimeError (dwErr, szBuffer)); + + // ------------------------------------------------------------------------ + // print error information if an error occured + if (stCard.bSetError) + return nSpcMErrorMessageStdOut (&stCard, "An error occured while programming the card:\n", true); + + vFreeMemPageAligned (pvBuffer, (uint32) llSWBufSize); + + // clean up and close the driver + vSpcMCloseCard (&stCard); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single.dsp b/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single.dsp new file mode 100644 index 0000000000000000000000000000000000000000..6c88e8cbaeb8902e8793f4600f42cc324e3b2fa3 --- /dev/null +++ b/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single.dsp @@ -0,0 +1,142 @@ +# Microsoft Developer Studio Project File - Name="rep_fifo_single" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=rep_fifo_single - Win32 Debug +!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE +!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl +!MESSAGE +!MESSAGE NMAKE /f "rep_fifo_single.mak". +!MESSAGE +!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben +!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: +!MESSAGE +!MESSAGE NMAKE /f "rep_fifo_single.mak" CFG="rep_fifo_single - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "rep_fifo_single - Win32 Release" (basierend auf "Win32 (x86) Console Application") +!MESSAGE "rep_fifo_single - Win32 Debug" (basierend auf "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "rep_fifo_single - 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" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c +# SUBTRACT CPP /YX /Yc /Yu +# 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)" == "rep_fifo_single - 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" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c +# SUBTRACT CPP /YX /Yc /Yu +# 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 "rep_fifo_single - Win32 Release" +# Name "rep_fifo_single - Win32 Debug" +# Begin Group "header" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\c_header\dlltyp.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\regs.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcerr.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_drv.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_card.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.h +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_ostools.h +# End Source File +# End Group +# Begin Group "common" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\common\spcm_lib_card.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_ostools_win.cpp +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_win32_msvcpp.lib +# End Source File +# End Group +# Begin Source File + +SOURCE=.\rep_fifo_single.cpp +# End Source File +# End Target +# End Project diff --git a/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single.dsw b/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single.dsw new file mode 100644 index 0000000000000000000000000000000000000000..de48218b5e79460ebcaa65cc50f49ff0d6af0f91 --- /dev/null +++ b/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single.dsw @@ -0,0 +1,41 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "rep_fifo_single"=.\rep_fifo_single.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "rep_fifo_single_poll"=.\rep_fifo_single_poll.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single.vcproj b/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..11a677774c3d4f8d84d5a5b785030795cc62a957 --- /dev/null +++ b/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single.vcproj @@ -0,0 +1,608 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="rep_fifo_single" + ProjectGUID="{EF4E7883-EA98-4D8D-82D6-1402B1EA5016}" + RootNamespace="rep_fifo_single" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/rep_fifo_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rep_fifo_single.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rep_fifo_single.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rep_fifo_single.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rep_fifo_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/rep_fifo_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rep_fifo_single.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rep_fifo_single.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rep_fifo_single.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rep_fifo_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/rep_fifo_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rep_fifo_single.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rep_fifo_single.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rep_fifo_single.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rep_fifo_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/rep_fifo_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rep_fifo_single.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rep_fifo_single.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rep_fifo_single.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rep_fifo_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="header" + Filter="h;hpp;hxx;hm;inl" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_card.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_data.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + </Filter> + <Filter + Name="common" + > + <File + RelativePath="..\common\spcm_lib_card.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_data.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Filter> + <File + RelativePath="rep_fifo_single.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single.vcxproj b/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..b7c9e7db9f238f2b5bec6b3bf32b46f2eebca8cd --- /dev/null +++ b/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single.vcxproj @@ -0,0 +1,265 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{EF4E7883-EA98-4D8D-82D6-1402B1EA5016}</ProjectGuid> + <RootNamespace>rep_fifo_single</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rep_fifo_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rep_fifo_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rep_fifo_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rep_fifo_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rep_fifo_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rep_fifo_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rep_fifo_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rep_fifo_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rep_fifo_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rep_fifo_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rep_fifo_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rep_fifo_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rep_fifo_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rep_fifo_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rep_fifo_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rep_fifo_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\spcm_lib_card.h" /> + <ClInclude Include="..\common\spcm_lib_data.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="..\common\spcm_lib_card.cpp" /> + <ClCompile Include="..\common\spcm_lib_data.cpp" /> + <ClCompile Include="rep_fifo_single.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single.vcxproj.filters b/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..0c4f72312bd6092a185600220bf4fcb883521daa --- /dev/null +++ b/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single.vcxproj.filters @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="header"> + <UniqueIdentifier>{8e86f348-86c2-4e9b-946f-df04cf9f596a}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + <Filter Include="common"> + <UniqueIdentifier>{504bd461-d62b-41fb-9649-bff7628b9929}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_card.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_data.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\spcm_lib_card.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_data.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="rep_fifo_single.cpp" /> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single_poll.cpp b/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single_poll.cpp new file mode 100644 index 0000000000000000000000000000000000000000..67053a025181272cf9721050d9c3e0c4fd63d3e0 --- /dev/null +++ b/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single_poll.cpp @@ -0,0 +1,305 @@ +/* +************************************************************************** + +rep_fifo_single_poll.cpp (c) Spectrum GmbH + +************************************************************************** + +Example for all M2i, M4i, M4x, M2p analog and digital generator cards. +Shows FIFO replay mode as single shot. + +This example doesn't use interrupt mode but shows status polling. Be +aware that this of course uses complete CPU time just for polling data. + +Feel free to use this source for own projects and modify it in any kind. + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + + +// ----- standard c include files ----- +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +#define _USE_MATH_DEFINES // for M_PI +#include <math.h> + + + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_card.h" +#include "../common/spcm_lib_data.h" +#include "../common/ostools/spcm_oswrap.h" +#include "../common/ostools/spcm_ostools.h" +#include "../sb5_file/sb5_file.h" + + + +/* +************************************************************************** +bDoCardSetup: setup matching the calculation routine +************************************************************************** +*/ + +bool bDoCardSetup (ST_SPCM_CARDINFO *pstCard) + { + int i; + int lFilter = 0; + + // we try to set the samplerate to 1 MHz (M2i) or 50 MHz (M4i, M5i) on internal PLL, no clock output + if (pstCard->bM4i || pstCard->bM5i) + { + bSpcMSetupClockPLL (pstCard, MEGA(50), false); + lFilter = 1; // the only available filter + } + else + { + bSpcMSetupClockPLL (pstCard, MEGA(1), false); + lFilter = 3; // highest cut-off frequency + } + printf ("Sampling rate set to %.1lf MHz\n", (double) pstCard->llSetSamplerate / MEGA(1)); + + // we set software trigger, no trigger output + bSpcMSetupTrigSoftware (pstCard, false); + + // type dependent card setup + switch (pstCard->eCardFunction) + { + + // analog generator card setup + case AnalogOut: + + // program all output channels to +/-1 V, zero offset and filter + for (i=0; i < pstCard->lMaxChannels; i++) + bSpcMSetupAnalogOutputChannel (pstCard, i, 1000, 0, lFilter); + + // FIFO mode setup, we run continuously + // only one chanel is activated for analog output to keep example simple + bSpcMSetupModeRepFIFOSingle (pstCard, CHANNEL0); + break; + + + + // digital generator card setup + case DigitalIn: + case DigitalIO: + + // FIFO mode setup, we run continuously + // 8 channels (1 byte) is activated + bSpcMSetupModeRepFIFOSingle (pstCard, 0xff); + break; + } + + return pstCard->bSetError; + } + + + +/* +************************************************************************** +DoDataCalculation: calculates the output data. The calculation routine + is quite simple as we either have one analog channel + or 8 digital channels to calculate +************************************************************************** +*/ +static int64 g_llOffset = 0; + +bool bDoDataCalculation (ST_SPCM_CARDINFO *pstCard, void* pvBuffer, int64 llBytesToCalculate) + { + int64 i; + int16* pnData = (int16*) pvBuffer; + int8* pbyData = (int8*) pvBuffer; + double dSineXScale = 2.0 * M_PI / 123456; + + switch (pstCard->eCardFunction) + { + + // analog generator card setup: 1 channel slow sine signal + case AnalogOut: + { + if (pstCard->lBytesPerSample == 1) + { + for (i = 0; i < llBytesToCalculate; i++) + pbyData[i] = (int8) (pstCard->uCfg.stAO.lMaxDACValue * sin (dSineXScale * (g_llOffset + i))); + } + else + { + for (i = 0; i < llBytesToCalculate/2; i++) + pnData[i] = (int16) (pstCard->uCfg.stAO.lMaxDACValue * sin (dSineXScale * (g_llOffset + i))); + } + + g_llOffset += (llBytesToCalculate / pstCard->lBytesPerSample); + break; + } + + + // digital generator card setup: simple ramp + case DigitalIn: + case DigitalIO: + { + for (i=0; i<llBytesToCalculate; i++) + pbyData[i] = (int8) i; + break; + } + } + + return true; + } + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + char szBuffer[1024]; // a character buffer for any messages + ST_SPCM_CARDINFO stCard; // info structure of my card + void* pvBuffer = NULL; + uint32 dwErr; + + // setup for the FIFO mode (HW buffer size can be programmed starting with firmware V9) + int64 llHWBufSize = KILO_B(256); + int64 llSWBufSize = KILO_B(512); + int64 llNotifySize = KILO_B(64); + + + + // some example checks + if (llSWBufSize % llNotifySize) + { + printf ("In our example we can only handle sw buffers that are a whole numbered multiple of the notify size\n"); + return 1; + } + + + // ------------------------------------------------------------------------ + // init card number 0 (the first card in the system), get some information and print it + // uncomment the second line and replace the IP address to use remote + // cards like in a generatorNETBOX + if (bSpcMInitCardByIdx (&stCard, 0)) + //if (bSpcMInitCardByIdx (&stCard, "192.168.1.10", 0)) + { + printf (pszSpcMPrintDocumentationLink (&stCard, szBuffer, sizeof (szBuffer))); + printf (pszSpcMPrintCardInfo (&stCard, szBuffer, sizeof (szBuffer))); + } + else + return nSpcMErrorMessageStdOut (&stCard, "Error: Could not open card\n", true); + + + // check whether we support this card type in the example + if ((stCard.eCardFunction != AnalogOut) && (stCard.eCardFunction != DigitalOut) && (stCard.eCardFunction != DigitalIO)) + return nSpcMErrorMessageStdOut (&stCard, "Error: Card function not supported by this example\n", false); + + + + + // ------------------------------------------------------------------------ + // do the card setup, error is routed in the structure so we don't care for the return values + if (!stCard.bSetError) + bDoCardSetup (&stCard); + + + // starting with firmware version V9 we can program the hardware buffer size to reduce the latency + if (stCard.lCtrlFwVersion >= 9) + { + spcm_dwSetParam_i64 (stCard.hDrv, SPC_DATA_OUTBUFSIZE, llHWBufSize); + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_WRITESETUP); + } + + // ------------------------------------------------------------------------ + // allocate and setup the fifo buffer and fill it once with data + pvBuffer = pvAllocMemPageAligned ((uint32) llSWBufSize); + if (!pvBuffer) + return nSpcMErrorMessageStdOut (&stCard, "Memory allocation error\n", false); + spcm_dwDefTransfer_i64 (stCard.hDrv, SPCM_BUF_DATA, SPCM_DIR_PCTOCARD, (uint32) llNotifySize, pvBuffer, 0, llSWBufSize); + bDoDataCalculation (&stCard, pvBuffer, llSWBufSize); + spcm_dwSetParam_i64 (stCard.hDrv, SPC_DATA_AVAIL_CARD_LEN, llSWBufSize); + + // now buffer is full of data and we start the transfer (output is not started yet), timeout is 1 second + spcm_dwSetParam_i32 (stCard.hDrv, SPC_TIMEOUT, 1000); + dwErr = spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_DATA_STARTDMA); + + + + + // ------------------------------------------------------------------------ + // this is our main output and calculation loop + int64 llTransferredBytes = 0; + int64 llAvailUser; + int64 llBufferFillPromille; + int64 llUserPos; + bool bStarted = false; + int32 lStatus; + + while (!dwErr) + { + + // check status and fill size of buffers + spcm_dwGetParam_i32 (stCard.hDrv, SPC_M2STATUS, &lStatus); + spcm_dwGetParam_i64 (stCard.hDrv, SPC_DATA_AVAIL_USER_LEN, &llAvailUser); + spcm_dwGetParam_i64 (stCard.hDrv, SPC_FILLSIZEPROMILLE, &llBufferFillPromille); + + + + // if there's a new block ready we fill it with new data + if ((lStatus & M2STAT_DATA_BLOCKREADY) && (llAvailUser >= llNotifySize)) + { + printf ("\rSW-Buffer: %3.0f%% HW-Buffer:%3d%%, Total Bytes so far: %6.2f MB", (float) 100.0 * (llSWBufSize - llAvailUser) / llSWBufSize, (uint32) llBufferFillPromille / 10, (float) llTransferredBytes / MEGA_B(1)); + + + // we recalculate the amount of data that is free and set this part available for card again + // inhere we only take pieces of notify size + llTransferredBytes += llNotifySize; + spcm_dwGetParam_i64 (stCard.hDrv, SPC_DATA_AVAIL_USER_POS, &llUserPos); + bDoDataCalculation (&stCard, ((int8*) pvBuffer) + llUserPos, llNotifySize); + dwErr = spcm_dwSetParam_i64 (stCard.hDrv, SPC_DATA_AVAIL_CARD_LEN, llNotifySize); + } + + + + // we start the output as soon as we have a sufficient amount of data on card + // inhere we start if the hardware buffer is completely full + if (!bStarted && !dwErr && (llBufferFillPromille == 1000)) + { + printf ("\nStart the output\n"); + dwErr = spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER); + bStarted = true; + } + + + // check for esc=abort + if (!dwErr) + if (bKbhit()) + if (cGetch() == 27) + { + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_STOP); + dwErr = ERR_ABORT; + } + } + + + + // ------------------------------------------------------------------------ + // print error information if an error occured + if (stCard.bSetError) + return nSpcMErrorMessageStdOut (&stCard, "An error occured while programming the card:\n", true); + + vFreeMemPageAligned (pvBuffer, (uint32) llSWBufSize); + + // clean up and close the driver + vSpcMCloseCard (&stCard); + + return EXIT_SUCCESS; + } diff --git a/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single_poll.dsp b/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single_poll.dsp new file mode 100644 index 0000000000000000000000000000000000000000..1709490d3618ce526afdd42734bf4a6becf2e623 --- /dev/null +++ b/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single_poll.dsp @@ -0,0 +1,150 @@ +# Microsoft Developer Studio Project File - Name="rep_fifo_single_poll" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=rep_fifo_single_poll - 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 "rep_fifo_single_poll.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 "rep_fifo_single_poll.mak" CFG="rep_fifo_single_poll - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "rep_fifo_single_poll - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "rep_fifo_single_poll - 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)" == "rep_fifo_single_poll - 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" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c +# SUBTRACT CPP /YX /Yc /Yu +# 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)" == "rep_fifo_single_poll - 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" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c +# SUBTRACT CPP /YX /Yc /Yu +# 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 "rep_fifo_single_poll - Win32 Release" +# Name "rep_fifo_single_poll - Win32 Debug" +# Begin Group "header" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\c_header\dlltyp.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\regs.h +# End Source File +# Begin Source File + +SOURCE=..\sb5_file\sb5_file.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcerr.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_drv.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_card.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.h +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_ostools.h +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_oswrap.h +# End Source File +# End Group +# Begin Group "common" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\common\spcm_lib_card.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_ostools_win.cpp +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_win32_msvcpp.lib +# End Source File +# End Group +# Begin Source File + +SOURCE=.\rep_fifo_single_poll.cpp +# End Source File +# End Target +# End Project diff --git a/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single_poll.vcproj b/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single_poll.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..0cac5af3eb8efd3aa6e548de33cef172190f80c0 --- /dev/null +++ b/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single_poll.vcproj @@ -0,0 +1,616 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="rep_fifo_single_poll" + ProjectGUID="{BBA8AD7C-A6A0-4384-AA4E-75D02333B9A7}" + RootNamespace="rep_fifo_single_poll" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/rep_fifo_single_poll.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rep_fifo_single_poll.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rep_fifo_single_poll.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rep_fifo_single_poll.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rep_fifo_single_poll.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/rep_fifo_single_poll.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rep_fifo_single_poll.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rep_fifo_single_poll.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rep_fifo_single_poll.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rep_fifo_single_poll.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/rep_fifo_single_poll.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rep_fifo_single_poll.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rep_fifo_single_poll.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rep_fifo_single_poll.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rep_fifo_single_poll.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/rep_fifo_single_poll.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rep_fifo_single_poll.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rep_fifo_single_poll.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rep_fifo_single_poll.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rep_fifo_single_poll.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="header" + Filter="h;hpp;hxx;hm;inl" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\sb5_file\sb5_file.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_card.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_data.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_oswrap.h" + > + </File> + </Filter> + <Filter + Name="common" + > + <File + RelativePath="..\common\spcm_lib_card.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_data.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Filter> + <File + RelativePath="rep_fifo_single_poll.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single_poll.vcxproj b/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single_poll.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..7775ed5cb1274b0ae5e08e346d941b3145e8fb61 --- /dev/null +++ b/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single_poll.vcxproj @@ -0,0 +1,267 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{BBA8AD7C-A6A0-4384-AA4E-75D02333B9A7}</ProjectGuid> + <RootNamespace>rep_fifo_single_poll</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rep_fifo_single_poll.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rep_fifo_single_poll.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rep_fifo_single_poll.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rep_fifo_single_poll.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rep_fifo_single_poll.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rep_fifo_single_poll.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rep_fifo_single_poll.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rep_fifo_single_poll.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rep_fifo_single_poll.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rep_fifo_single_poll.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rep_fifo_single_poll.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rep_fifo_single_poll.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rep_fifo_single_poll.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rep_fifo_single_poll.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rep_fifo_single_poll.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rep_fifo_single_poll.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\common\spcm_lib_card.h" /> + <ClInclude Include="..\common\spcm_lib_data.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + <ClInclude Include="..\sb5_file\sb5_file.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="..\common\spcm_lib_card.cpp" /> + <ClCompile Include="..\common\spcm_lib_data.cpp" /> + <ClCompile Include="rep_fifo_single_poll.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single_poll.vcxproj.filters b/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single_poll.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..7c8a90ebdac53f574f656984eff15f635bbecd8b --- /dev/null +++ b/Cpp/examples/c_cpp/rep_fifo_single/rep_fifo_single_poll.vcxproj.filters @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="header"> + <UniqueIdentifier>{5149afc6-6602-4eeb-9a38-78180bd15af5}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + <Filter Include="common"> + <UniqueIdentifier>{4b8e10b1-9a7d-46e9-8f7e-fbd94758994c}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\sb5_file\sb5_file.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_card.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_data.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_oswrap.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\spcm_lib_card.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_data.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="rep_fifo_single_poll.cpp" /> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rep_sequence/makefile b/Cpp/examples/c_cpp/rep_sequence/makefile new file mode 100644 index 0000000000000000000000000000000000000000..3f168f9455db21c1ca13ad00e7692d3378380545 --- /dev/null +++ b/Cpp/examples/c_cpp/rep_sequence/makefile @@ -0,0 +1,25 @@ +COMPILER = g++ +EXECUTABLE = rep_sequence +LIBS += -lspcm_linux -lpthread -lrt +CFLAGS += -DSPCM_NAMESPACE=spcmdrv + +OBJECTS = \ + rep_sequence.o\ + ../common/ostools/spcm_ostools_linux.o\ + ../common/spcm_lib_card.o\ + ../common/spcm_lib_data.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/rep_sequence/rep_sequence.cpp b/Cpp/examples/c_cpp/rep_sequence/rep_sequence.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6f03b320eb643d079ffb9b86480ee0f1a99ee7d2 --- /dev/null +++ b/Cpp/examples/c_cpp/rep_sequence/rep_sequence.cpp @@ -0,0 +1,575 @@ +/* +************************************************************************** + +rep_sequence.cpp (c) Spectrum GmbH + +************************************************************************** + +Example for all M2i, M4i, M4x, M2p analog and digital generator cards. +Shows sequence replay mode as simple sequence and with sequence +change at runtime or through external trigger. + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_card.h" +#include "../common/spcm_lib_data.h" + +// ----- operating system dependent functions for thread, event, keyboard and mutex handling ----- +#include "../common/ostools/spcm_oswrap.h" +#include "../common/ostools/spcm_ostools.h" + +// ----- standard c include files ----- +#include <stdio.h> +#include <stdlib.h> + +#define _USE_MATH_DEFINES // for M_PI +#include <math.h> + + + +#define USING_EXTERNAL_TRIGGER 0 // wait for keystroke to switch to next sequence group +//#define USING_EXTERNAL_TRIGGER 1 // use external trigger to switch to next sequence group + + + +/* +************************************************************************** +vDoCardSetup +************************************************************************** +*/ + +void vDoCardSetup (ST_SPCM_CARDINFO *pstCard) + { + int i; + int64 llChannelMask; + + + // for easy sample data handling set mask for one channel (8 ... 16 bit per sample) + if ((pstCard->eCardFunction == DigitalOut) + || (pstCard->eCardFunction == DigitalIO)) + { + llChannelMask = 0xff; + + // At M2p.75xx is the minimum value 16. + if ((pstCard->lCardType & 0x7500) == 0x7500) + llChannelMask = 0xffff; + } + else + { + llChannelMask = CHANNEL0; + //llChannelMask = CHANNEL0 | CHANNEL1; // uncomment to use two channels + } + + + // we try to set the samplerate to a quarter of maximum on internal PLL, no clock output + bSpcMSetupClockPLL (pstCard, pstCard->llMaxSamplerate / 4, false); + printf ("Sampling rate set to %.1lf MHz\n", (double) pstCard->llSetSamplerate / 1000000); + + + // setup replay sequence mode with 32 segments + bSpcMSetupModeRepSequence (pstCard, llChannelMask, 32); + + if (!USING_EXTERNAL_TRIGGER) + // software trigger + bSpcMSetupTrigSoftware (pstCard, false); + else + // external TTL trigger (with termination off) if the "SPCSEQ_ENDLOOPONTRIG" flag is used + // The start of the first step need then a trigger too or a "M2CMD_CARD_FORCETRIGGER" command. + bSpcMSetupTrigExternal (pstCard, SPC_TM_POS, false); + + + // type dependent card setup + switch (pstCard->eCardFunction) + { + + // analog generator card setup + case AnalogOut: + + // program all output channels to +/- 1 V with no offset and hold last sample at end of output + for (i=0; i < pstCard->lMaxChannels; i++) + bSpcMSetupAnalogOutputChannel (pstCard, i, 1000, 0, 0, SPCM_STOPLVL_HOLDLAST); + break; + + // digital generator card setup + case DigitalOut: + case DigitalIO: + for (i=0; i < pstCard->uCfg.stDIO.lGroups; i++) + bSpcMSetupDigitalOutput (pstCard, i, SPCM_STOPLVL_LOW, 0, 3300); + break; + } + } + + + +/* +************************************************************************** +vWriteSegmentData +************************************************************************** +*/ + +void vWriteSegmentData (ST_SPCM_CARDINFO *pstCard, uint32 dwSegmentIndex, uint32 dwSegmentLenSample, void* pvSegData) + { + uint32 dwError = 0; + uint32 dwBytePerSample = pstCard->lBytesPerSample; + uint32 dwSetChannels = pstCard->lSetChannels; + + // lBytesPerSample is at digital cards not correct. + if ((pstCard->eCardFunction == DigitalOut) + || (pstCard->eCardFunction == DigitalIO)) + { + // convert sum of bit-channels to byte. + dwBytePerSample = pstCard->lSetChannels / 8; + + // Only using one channel at digital cards. + dwSetChannels = 1; + } + + uint32 dwSegLenByte = dwSegmentLenSample * dwBytePerSample * dwSetChannels; + + + // for 8 bit sample rearange order in buffer from 16 bit to 8 bit + if (dwBytePerSample == 1) + { + int8* pcData = (int8*) pvSegData; + int16* pnData = (int16*) pvSegData; + + for (uint32 i = 0; i < dwSegmentLenSample * dwSetChannels; i++) + pcData[i] = pnData[i] & 0xff; + } + + // setup + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCard->hDrv, SPC_SEQMODE_WRITESEGMENT, dwSegmentIndex); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCard->hDrv, SPC_SEQMODE_SEGMENTSIZE, dwSegmentLenSample); + + // write data to board (main) sample memory + if (!dwError) dwError = spcm_dwDefTransfer_i64 (pstCard->hDrv, SPCM_BUF_DATA, SPCM_DIR_PCTOCARD, 0, pvSegData, 0, dwSegLenByte); + if (!dwError) dwError = spcm_dwSetParam_i32 (pstCard->hDrv, SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA); + } + + + +/* +************************************************************************** +DoDataCalculation: calculates and writes the output data for all segments +************************************************************************** +*/ + +bool bDoDataCalculation (ST_SPCM_CARDINFO *pstCard) + { + uint32 i; + uint32 dwSegmentLenSample, dwSegLenByte; + + printf ("Calculation of output data\n"); + + + uint32 dwFactor = 1; + // This series has a slightly increased minimum size value. + if (pstCard->bM4i || pstCard->bM5i) + dwFactor = 6; + + + int32 lSetChannels = pstCard->lSetChannels; + + // lSetChannels is at digital cards bit ocunt. + if ((pstCard->eCardFunction == DigitalOut) + || (pstCard->eCardFunction == DigitalIO)) + { + // Only using one channel at digital cards. + lSetChannels = 1; + } + + + // buffer for data transfer (allocate for 8 bit sample 2 byte too) + dwSegLenByte = 2 * dwFactor * 512 * lSetChannels; // max value are from the sine calculation + void* pvBuffer = (void*) pvAllocMemPageAligned (dwSegLenByte); + if (!pvBuffer) + return nSpcMErrorMessageStdOut (pstCard, "Memory allocation error\n", false) != -1; + int16 *pnData = (int16*) pvBuffer; + + + // helper values: Full Scale + uint32 dwFS = 127; + if (pstCard->eCardFunction == AnalogOut) + dwFS = pstCard->uCfg.stAO.lMaxDACValue; + uint32 dwFShalf = dwFS / 2; + + + // (main) sample memory segment index: +#define SEG_RAMPUP 0 // ramp up +#define SEG_RAMPDOWN 1 // ramp down +#define SEG_SYNC 2 // negative sync puls, for example oscilloscope trigger +// 3 // unused +#define SEG_Q1SIN 4 // first quadrant of sinus signal +#define SEG_Q2SIN 5 // second quadrant of sinus signal +#define SEG_Q3SIN 6 // third quadrant of sinus signal +#define SEG_Q4SIN 7 // fourth quadrant of sinus signal +#define SEG_STOP 8 // DC level for stop/end +// remainder: unused + + + // --- sync puls: first half zero, second half -FS + dwSegmentLenSample = dwFactor * 80; + for (i = 0; i < dwSegmentLenSample / 2; i++) + for (int lChannel = 0; lChannel < lSetChannels; ++lChannel) + pnData[i * lSetChannels + lChannel] = 0; + + if (pstCard->eCardFunction == AnalogOut) + for (; i < dwSegmentLenSample; i++) + for (int lChannel = 0; lChannel < lSetChannels; ++lChannel) + pnData[i * lSetChannels + lChannel] = -((int16) dwFS); + else // digital boards (no two's complement) + for (; i < dwSegmentLenSample; i++) + for (int lChannel = 0; lChannel < lSetChannels; ++lChannel) + pnData[i * lSetChannels + lChannel] = 0xff; + + vWriteSegmentData (pstCard, SEG_SYNC, dwSegmentLenSample, pvBuffer); + + + // --- ramp up + dwSegmentLenSample = dwFactor * 64; + for (i = 0; i < dwSegmentLenSample; i++) + for (int lChannel = 0; lChannel < lSetChannels; ++lChannel) + pnData[i * lSetChannels + lChannel] = (int16) (i * dwFShalf / dwSegmentLenSample); + + vWriteSegmentData (pstCard, SEG_RAMPUP, dwSegmentLenSample, pvBuffer); + + + // --- ramp down + dwSegmentLenSample = dwFactor * 64; + for (i = 0; i < dwSegmentLenSample; i++) + for (int lChannel = 0; lChannel < lSetChannels; ++lChannel) + pnData[i * lSetChannels + lChannel] = (int16) (dwFS - (i * dwFShalf / dwSegmentLenSample)); + + vWriteSegmentData (pstCard, SEG_RAMPDOWN, dwSegmentLenSample, pvBuffer); + + + // --- sinus + dwSegmentLenSample = dwFactor * 512; + for (i = 0; i < dwSegmentLenSample; i++) + for (int lChannel = 0; lChannel < lSetChannels; ++lChannel) + pnData[i * lSetChannels + lChannel] = (int16) (dwFShalf + (dwFShalf * sin (2.0 * M_PI * i / dwSegmentLenSample) + 0.5)); + + // write each quadrant in a own segment + vWriteSegmentData (pstCard, SEG_Q1SIN, dwSegmentLenSample / 4, (void*) &pnData[lSetChannels * 0 * dwSegmentLenSample / 4]); + vWriteSegmentData (pstCard, SEG_Q2SIN, dwSegmentLenSample / 4, (void*) &pnData[lSetChannels * 1 * dwSegmentLenSample / 4]); + vWriteSegmentData (pstCard, SEG_Q3SIN, dwSegmentLenSample / 4, (void*) &pnData[lSetChannels * 2 * dwSegmentLenSample / 4]); + vWriteSegmentData (pstCard, SEG_Q4SIN, dwSegmentLenSample / 4, (void*) &pnData[lSetChannels * 3 * dwSegmentLenSample / 4]); + + + // --- DC level + dwSegmentLenSample = dwFactor * 128; + for (i = 0; i < dwSegmentLenSample; i++) + for (int lChannel = 0; lChannel < lSetChannels; ++lChannel) + pnData[i * lSetChannels + lChannel] = (int16) (dwFS / 2); + + vWriteSegmentData (pstCard, SEG_STOP, dwSegmentLenSample, pvBuffer); + + + vFreeMemPageAligned (pvBuffer, dwSegLenByte); + + return true; + } + + + +/* +************************************************************************** +vWriteStepEntry +************************************************************************** +*/ + +void vWriteStepEntry (ST_SPCM_CARDINFO *pstCard, uint32 dwStepIndex, + uint32 dwStepNextIndex, uint32 dwSegmentIndex, uint32 dwLoops, uint32 dwFlags) + { + uint32 dwError = 0; + uint64 qwSequenceEntry = 0; + + // setup register value + qwSequenceEntry = (dwFlags & ~SPCSEQ_LOOPMASK) | (dwLoops & SPCSEQ_LOOPMASK); + qwSequenceEntry <<= 32; + qwSequenceEntry |= ((dwStepNextIndex << 16)& SPCSEQ_NEXTSTEPMASK) | (dwSegmentIndex & SPCSEQ_SEGMENTMASK); + + if (!dwError) dwError = spcm_dwSetParam_i64 (pstCard->hDrv, SPC_SEQMODE_STEPMEM0 + dwStepIndex, qwSequenceEntry); + } + + + +/* +************************************************************************** +bool bConfigureSequence +************************************************************************** +*/ + +bool bConfigureSequence (ST_SPCM_CARDINFO *pstCard) + { + // sequence memory + // four sequence loops are programmed (each with 6 steps) + // a keystroke or ext. trigger switched to the next sequence + // the loop value for the ramp increase in each sequence + // 0 ... 5: sync, Q1sin, Q2sin, Q3sin, Q4sin, ramp up + // 8 ... 13: sync, Q2sin, Q3sin, Q4sin, Q1sin, ramp down + // 16 ... 21: sync, Q3sin, Q4sin, Q1sin, Q2sin, ramp up + // 24 ... 29: sync, Q4sin, Q1sin, Q2sin, Q3sin, ramp down + + // +-- StepIndex + // | +-- StepNextIndex + // | | +-- SegmentIndex + // | | | +-- Loops + // | | | | +-- Flags: SPCSEQ_ENDLOOPONTRIG + // sin // | | | | | For using this flag disable Software-Trigger above. + vWriteStepEntry (pstCard, 0, 1, SEG_SYNC, 3, 0); + vWriteStepEntry (pstCard, 1, 2, SEG_Q1SIN, 1, 0); + vWriteStepEntry (pstCard, 2, 3, SEG_Q2SIN, 1, 0); + vWriteStepEntry (pstCard, 3, 4, SEG_Q3SIN, 1, 0); + vWriteStepEntry (pstCard, 4, 5, SEG_Q4SIN, 1, 0); + if (!USING_EXTERNAL_TRIGGER) + vWriteStepEntry (pstCard, 5, 1, SEG_RAMPDOWN, 1, 0); + else + vWriteStepEntry (pstCard, 5, 8, SEG_RAMPDOWN, 1, SPCSEQ_ENDLOOPONTRIG); +#define LAST_STEP_OFFSET 5 + + // cos + vWriteStepEntry (pstCard, 8, 9, SEG_SYNC, 3, 0); + vWriteStepEntry (pstCard, 9, 10, SEG_Q2SIN, 1, 0); + vWriteStepEntry (pstCard, 10, 11, SEG_Q3SIN, 1, 0); + vWriteStepEntry (pstCard, 11, 12, SEG_Q4SIN, 1, 0); + vWriteStepEntry (pstCard, 12, 13, SEG_Q1SIN, 1, 0); + if (!USING_EXTERNAL_TRIGGER) + vWriteStepEntry (pstCard, 13, 9, SEG_RAMPUP, 2, 0); + else + vWriteStepEntry (pstCard, 13, 16, SEG_RAMPUP, 2, SPCSEQ_ENDLOOPONTRIG); + + // inverted sin + vWriteStepEntry (pstCard, 16, 17, SEG_SYNC, 3, 0); + vWriteStepEntry (pstCard, 17, 18, SEG_Q3SIN, 1, 0); + vWriteStepEntry (pstCard, 18, 19, SEG_Q4SIN, 1, 0); + vWriteStepEntry (pstCard, 19, 20, SEG_Q1SIN, 1, 0); + vWriteStepEntry (pstCard, 20, 21, SEG_Q2SIN, 1, 0); + if (!USING_EXTERNAL_TRIGGER) + vWriteStepEntry (pstCard, 21, 17, SEG_RAMPDOWN, 3, 0); + else + vWriteStepEntry (pstCard, 21, 24, SEG_RAMPDOWN, 3, SPCSEQ_ENDLOOPONTRIG); + + // inverted cos + vWriteStepEntry (pstCard, 24, 25, SEG_SYNC, 3, 0); + vWriteStepEntry (pstCard, 25, 26, SEG_Q4SIN, 1, 0); + vWriteStepEntry (pstCard, 26, 27, SEG_Q1SIN, 1, 0); + vWriteStepEntry (pstCard, 27, 28, SEG_Q2SIN, 1, 0); + vWriteStepEntry (pstCard, 28, 29, SEG_Q3SIN, 1, 0); + vWriteStepEntry (pstCard, 29, 30, SEG_RAMPUP, 4, 0); + vWriteStepEntry (pstCard, 30, 30, SEG_STOP, 1, SPCSEQ_END); // M2i and M2p: the complete segment is replayed + // M4i: only a few or none sample from this segment are replayed + + // Configure the beginning (index of first seq-entry to start) of the sequence replay. + spcm_dwSetParam_i32 (pstCard->hDrv, SPC_SEQMODE_STARTSTEP, 0); + + // dump steps if necessary + if (0) + { + printf ("\n"); + for (int i = 0; i < 32; i++) + { + int64 llTemp; + spcm_dwGetParam_i64 (pstCard->hDrv, SPC_SEQMODE_STEPMEM0 + i, &llTemp); + printf ("Step %.2d: 0x%08x_%08x\n", i, (uint32) (llTemp >> 32), (uint32) llTemp); + } + printf ("\n\n"); + } + + return true; + } + + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + char szBuffer[1024]; // a character buffer for any messages + ST_SPCM_CARDINFO stCard; // info structure of my card + + + // ------------------------------------------------------------------------ + // init card number 0 (the first card in the system), get some information and print it + // uncomment the second line and replace the IP address to use remote + // cards like in a generatorNETBOX + if (bSpcMInitCardByIdx (&stCard, 0)) + //if (bSpcMInitCardByIdx (&stCard, "192.168.1.10", 0)) + { + printf (pszSpcMPrintDocumentationLink (&stCard, szBuffer, sizeof (szBuffer))); + printf (pszSpcMPrintCardInfo (&stCard, szBuffer, sizeof (szBuffer))); + } + else + return nSpcMErrorMessageStdOut (&stCard, "Error: Could not open card\n", true); + + + // check whether we support this card type in the example + if ((stCard.eCardFunction != AnalogOut) && (stCard.eCardFunction != DigitalOut) && (stCard.eCardFunction != DigitalIO)) + return nSpcMErrorMessageStdOut (&stCard, "Error: Card function not supported by this example\n", false); + + if (!(stCard.lFeatureMap & SPCM_FEAT_SEQUENCE) + || (stCard.bM2i && (stCard.lCtrlFwVersion < 20)) + || (stCard.bM4i && (stCard.lCtrlFwVersion < 14))) // on M2i and M4i sequence mode has been released as update. on M2p it is available since first release + return nSpcMErrorMessageStdOut (&stCard, "Error: option 'sequence replay' not installed or firmware version to old\n", false); + + printf ("\n"); + + + // ------------------------------------------------------------------------ + // do the card setup, error is routed in the structure so we don't care for the return values + if (!stCard.bSetError) + { + vDoCardSetup (&stCard); + } + + + // ------------------------------------------------------------------------ + // calculate the amount of data we need and allocate memory buffer + if (!stCard.bSetError) + { + // calculate the data + if (!bDoDataCalculation (&stCard)) + return nSpcMErrorMessageStdOut (&stCard, "Data calculation failed\n", false); + + printf ("... data has been transferred to board memory\n"); + + // setup the the sequence + if (!bConfigureSequence (&stCard)) + return nSpcMErrorMessageStdOut (&stCard, "Sequence setup failed\n", false); + + printf ("... sequence configured\n"); + } + + + // ------------------------------------------------------------------------ + // start the generation + if (!stCard.bSetError) + { + // We'll start and wait until all sequences are replayed. + spcm_dwSetParam_i32 (stCard.hDrv, SPC_TIMEOUT, 0); + printf ("\nStarting the card\n"); + if (spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER) != ERR_OK) + { + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_STOP); + return nSpcMErrorMessageStdOut (&stCard, "... error", false); + } + + + printf ("\nsequence replay runs, switch to next sequence (3 times possible) with"); + if (!USING_EXTERNAL_TRIGGER) + printf ("\n key: c ... change sequence\n\n"); + else + printf ("\n a (slow) TTL signal on external trigger input connector\n\n"); + + int32 lCardStatus = 0; + uint32 dwSequenceActual = 0; // first step in a sequence + uint32 dwSequenceNext; + do + { + if (bKbhit ()) + { + char c = cGetch (); + switch (c) + { + case 27: // ESC + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_STOP); + break; + + case 'c': + case 'C': + if (!USING_EXTERNAL_TRIGGER) + { + dwSequenceNext = (dwSequenceActual + 8) % 32; + printf ("sequence %d\n", dwSequenceNext / 8); + + // switch to next sequence + // (before it is possible to overwrite the segment data of the new used segments with new values) + uint32 dwError; + int64 llStep; + + // --- change the next step value from the sequence end entry in the actual sequence + dwError = spcm_dwGetParam_i64 (stCard.hDrv, SPC_SEQMODE_STEPMEM0 + dwSequenceActual + LAST_STEP_OFFSET, &llStep); + llStep = (llStep & ~((int64)SPCSEQ_NEXTSTEPMASK)) | dwSequenceNext << 16; + dwError = spcm_dwSetParam_i64 (stCard.hDrv, SPC_SEQMODE_STEPMEM0 + dwSequenceActual + LAST_STEP_OFFSET, llStep); + + dwSequenceActual = dwSequenceNext; + } + break; + } + } + else + { + SPCM_NAMESPACE::spcm_vSuspendThread (10); // ms + + // Demonstrate the two different sequence status values at M2i and M4i / M2p cards. + static int32 s_lSeqStatusOld = 0; + int32 lSeqStatus; + spcm_dwGetParam_i32 (stCard.hDrv, SPC_SEQMODE_STATUS, &lSeqStatus); + + // Avoid a lot of outputs in none external trigger mode. + if (USING_EXTERNAL_TRIGGER) + { + if (s_lSeqStatusOld != lSeqStatus) + { + s_lSeqStatusOld = lSeqStatus; + + if (stCard.bM2i) + { + if (lSeqStatus & SEQSTAT_STEPCHANGE) + printf ("status: sequence changed\n"); + } + if (stCard.bM4i + || stCard.bM2p + || stCard.bM5i) + { + // Valid values only available on a started card. + if (lCardStatus & M2STAT_CARD_PRETRIGGER) + printf ("status: actual sequence number: %d\n", lSeqStatus); + } + } + } + } + + spcm_dwGetParam_i32 (stCard.hDrv, SPC_M2STATUS, &lCardStatus); + } + while (!(lCardStatus & M2STAT_CARD_READY)); + + printf ("\n\n programm finished (press key)"); + cGetch (); + } + + + // ------------------------------------------------------------------------ + // print error information if an error occured + if (stCard.bSetError) + return nSpcMErrorMessageStdOut (&stCard, "An error occured while programming the card:\n", true); + + + // close the driver + vSpcMCloseCard (&stCard); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/rep_sequence/rep_sequence.sln b/Cpp/examples/c_cpp/rep_sequence/rep_sequence.sln new file mode 100644 index 0000000000000000000000000000000000000000..b68a69d76110bbd943b80c50a8220c4c4ac379c1 --- /dev/null +++ b/Cpp/examples/c_cpp/rep_sequence/rep_sequence.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rep_sequence", "rep_sequence.vcxproj", "{38EB7558-D630-4AEA-AA81-E80B1DB127DC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {38EB7558-D630-4AEA-AA81-E80B1DB127DC}.Debug|x64.ActiveCfg = Debug|x64 + {38EB7558-D630-4AEA-AA81-E80B1DB127DC}.Debug|x64.Build.0 = Debug|x64 + {38EB7558-D630-4AEA-AA81-E80B1DB127DC}.Debug|x86.ActiveCfg = Debug|Win32 + {38EB7558-D630-4AEA-AA81-E80B1DB127DC}.Debug|x86.Build.0 = Debug|Win32 + {38EB7558-D630-4AEA-AA81-E80B1DB127DC}.Release|x64.ActiveCfg = Release|x64 + {38EB7558-D630-4AEA-AA81-E80B1DB127DC}.Release|x64.Build.0 = Release|x64 + {38EB7558-D630-4AEA-AA81-E80B1DB127DC}.Release|x86.ActiveCfg = Release|Win32 + {38EB7558-D630-4AEA-AA81-E80B1DB127DC}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Cpp/examples/c_cpp/rep_sequence/rep_sequence.vcproj b/Cpp/examples/c_cpp/rep_sequence/rep_sequence.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..926357cca648e6abc1a96cdba450f63c073784ad --- /dev/null +++ b/Cpp/examples/c_cpp/rep_sequence/rep_sequence.vcproj @@ -0,0 +1,608 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="rep_sequence" + ProjectGUID="{38EB7558-D630-4AEA-AA81-E80B1DB127DC}" + RootNamespace="rep_sequence" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/rep_sequence.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rep_sequence.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rep_sequence.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rep_sequence.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rep_sequence.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/rep_sequence.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rep_sequence.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rep_sequence.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rep_sequence.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rep_sequence.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/rep_sequence.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rep_sequence.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rep_sequence.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rep_sequence.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rep_sequence.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/rep_sequence.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rep_sequence.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rep_sequence.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rep_sequence.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rep_sequence.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="header" + Filter="h;hpp;hxx;hm;inl" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_card.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_data.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + </Filter> + <Filter + Name="common" + > + <File + RelativePath="..\common\spcm_lib_card.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_data.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Filter> + <File + RelativePath="rep_sequence.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/rep_sequence/rep_sequence.vcxproj b/Cpp/examples/c_cpp/rep_sequence/rep_sequence.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..3ea25b0034d7da7f20b6e735c47fb0b4de69283b --- /dev/null +++ b/Cpp/examples/c_cpp/rep_sequence/rep_sequence.vcxproj @@ -0,0 +1,265 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{38EB7558-D630-4AEA-AA81-E80B1DB127DC}</ProjectGuid> + <RootNamespace>rep_sequence</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rep_sequence.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rep_sequence.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rep_sequence.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rep_sequence.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rep_sequence.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rep_sequence.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rep_sequence.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rep_sequence.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rep_sequence.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rep_sequence.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rep_sequence.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rep_sequence.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rep_sequence.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rep_sequence.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rep_sequence.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rep_sequence.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\spcm_lib_card.h" /> + <ClInclude Include="..\common\spcm_lib_data.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="..\common\spcm_lib_card.cpp" /> + <ClCompile Include="..\common\spcm_lib_data.cpp" /> + <ClCompile Include="rep_sequence.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rep_sequence/rep_sequence.vcxproj.filters b/Cpp/examples/c_cpp/rep_sequence/rep_sequence.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..095e4abb4429c90ebc8c0e1760611e390a6855fa --- /dev/null +++ b/Cpp/examples/c_cpp/rep_sequence/rep_sequence.vcxproj.filters @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="header"> + <UniqueIdentifier>{6791ab96-c511-46b0-95c1-6db093ea0434}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + <Filter Include="common"> + <UniqueIdentifier>{b9a5d846-69a2-4dd8-a7ad-ccde087d5ca9}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_card.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_data.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\spcm_lib_card.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_data.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="rep_sequence.cpp" /> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rep_std_single/makefile b/Cpp/examples/c_cpp/rep_std_single/makefile new file mode 100644 index 0000000000000000000000000000000000000000..cf2d2410c8f659c0cf25b734eb280a9bb35f447a --- /dev/null +++ b/Cpp/examples/c_cpp/rep_std_single/makefile @@ -0,0 +1,24 @@ +COMPILER = g++ +EXECUTABLE = rep_std_single +LIBS += -lspcm_linux -lpthread -lrt + +OBJECTS = \ + rep_std_single.o\ + ../common/ostools/spcm_ostools_linux.o\ + ../common/spcm_lib_card.o\ + ../common/spcm_lib_data.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/rep_std_single/rep_std_single.bpf b/Cpp/examples/c_cpp/rep_std_single/rep_std_single.bpf new file mode 100644 index 0000000000000000000000000000000000000000..5da88241fe8e80944de42def849bf4eab8f1f666 --- /dev/null +++ b/Cpp/examples/c_cpp/rep_std_single/rep_std_single.bpf @@ -0,0 +1,3 @@ +This file is used by the project manager only and should be treated like the project file + + main \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rep_std_single/rep_std_single.bpr b/Cpp/examples/c_cpp/rep_std_single/rep_std_single.bpr new file mode 100644 index 0000000000000000000000000000000000000000..2cc321f67b7e6a99241881788b1cc54c5e57475a --- /dev/null +++ b/Cpp/examples/c_cpp/rep_std_single/rep_std_single.bpr @@ -0,0 +1,104 @@ +<?xml version='1.0' encoding='utf-8' ?> +<!-- C++Builder XML Project --> +<PROJECT> + <MACROS> + <VERSION value="BCB.06.00"/> + <PROJECT value="rep_std_single.exe"/> + <OBJFILES value="rep_std_single.obj ..\common\spcm_lib_thread.obj + ..\common\spcm_lib_card.obj ..\common\spcm_lib_data.obj"/> + <RESFILES value=""/> + <DEFFILE value=""/> + <RESDEPEN value="$(RESFILES)"/> + <LIBFILES value="..\c_header\spcm_win32_bcppb.lib"/> + <LIBRARIES value=""/> + <SPARELIBS value=""/> + <PACKAGES value="vcl.bpi rtl.bpi vclx.bpi bcbsmp.bpi dclocx.bpi"/> + <PATHCPP value=".;..\common;..\common;..\common"/> + <PATHPAS value=".;"/> + <PATHRC value=".;"/> + <PATHASM value=".;"/> + <DEBUGLIBPATH value="$(BCB)\lib\debug"/> + <RELEASELIBPATH value="$(BCB)\lib\release"/> + <LINKER value="ilink32"/> + <USERDEFINES value="_DEBUG"/> + <SYSDEFINES value="NO_STRICT;_NO_VCL;_RTLDLL;USEPACKAGES"/> + <MAINSOURCE value="rep_std_single.bpf"/> + <INCLUDEPATH value="C:\svnwork\spcm_drv_c\common;C:\svnwork\spcm_drv_c\rep_std_single;$(BCB)\include;$(BCB)\include\vcl"/> + <LIBPATH value="C:\svnwork\spcm_drv_c\common;C:\svnwork\spcm_drv_c\rep_std_single;$(BCB)\lib\obj;$(BCB)\lib"/> + <WARNINGS value="-w-par"/> + <OTHERFILES value=""/> + </MACROS> + <OPTIONS> + <CFLAG1 value="-tWC -tWM -Od -H=$(BCB)\lib\vcl60.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v + -vi- -c"/> + <PFLAGS value="-$YD -$W -$O- -$A8 -v -JPHNE -M"/> + <RFLAGS value=""/> + <AFLAGS value="/mx /w2 /zd"/> + <LFLAGS value="-Tpe -ap -D"" -x -Gn -v"/> + <OTHERFILES value=""/> + </OPTIONS> + <LINKER> + <ALLOBJ value="c0x32.obj $(PACKAGES) $(OBJFILES)"/> + <ALLRES value="$(RESFILES)"/> + <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib"/> + <OTHERFILES value=""/> + </LINKER> + <FILELIST> + <FILE FILENAME="rep_std_single.bpf" FORMNAME="" UNITNAME="rep_std_single" CONTAINERID="BPF" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="rep_std_single.cpp" FORMNAME="" UNITNAME="rep_std_single" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_thread.cpp" FORMNAME="" UNITNAME="spcm_lib_thread.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_card.cpp" FORMNAME="" UNITNAME="spcm_lib_card.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\common\spcm_lib_data.cpp" FORMNAME="" UNITNAME="spcm_lib_data.cpp" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/> + <FILE FILENAME="..\c_header\spcm_win32_bcppb.lib" FORMNAME="" UNITNAME="spcm_win32_bcppb.lib" CONTAINERID="LibTool" DESIGNCLASS="" LOCALCOMMAND=""/> + </FILELIST> + <BUILDTOOLS> + </BUILDTOOLS> + + <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= + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +[Parameters] +RunParams= +Launcher= +UseLauncher=0 +DebugCWD= +HostApplication= +RemoteHost= +RemotePath= +RemoteLauncher= +RemoteCWD= +RemoteDebug=0 + +[Compiler] +ShowInfoMsgs=0 +LinkDebugVcl=0 + </IDEOPTIONS> +</PROJECT> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rep_std_single/rep_std_single.cpp b/Cpp/examples/c_cpp/rep_std_single/rep_std_single.cpp new file mode 100644 index 0000000000000000000000000000000000000000..858eb6cdb5b9c3489394e02a32be4b787cff2b4b --- /dev/null +++ b/Cpp/examples/c_cpp/rep_std_single/rep_std_single.cpp @@ -0,0 +1,423 @@ +/* +************************************************************************** + +rep_std_single.cpp (c) Spectrum GmbH + +************************************************************************** + +Example for all SpcMDrv based analog and digital generator cards. + +Information about the different products and their drivers can be found +online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/platform-driver-and-series-differences + +Shows standard replay mode as single shot, continous or single restart + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_card.h" +#include "../common/spcm_lib_data.h" + +// ----- operating system dependent functions for thead, event, keyboard and mutex handling ----- +#include "../common/ostools/spcm_oswrap.h" +#include "../common/ostools/spcm_ostools.h" + +// ----- standard c include files ----- +#include <stdio.h> +#include <stdlib.h> + + + +/* +************************************************************************** +vDoCardSetup +************************************************************************** +*/ + +void vDoCardSetup (ST_SPCM_CARDINFO *pstCard, int32 lReplayMode, int64 llLoops = 0) + { + int i; + int64 llChannelMask; + + + // set mask for maximal channels + if (pstCard->lMaxChannels >= 64) + llChannelMask = -1; // -1 is all bits set to 1 = 0xffffffffffffffff + else + llChannelMask = ((int64) 1 << pstCard->lMaxChannels) - 1; + + + // we try to set the samplerate to 1 MHz (M2i) or 50 MHz (M4i) on internal PLL, no clock output + if (pstCard->bM4i || pstCard->bM5i) + bSpcMSetupClockPLL (pstCard, MEGA(50), false); + else + bSpcMSetupClockPLL (pstCard, MEGA(1), false); + printf ("Sampling rate set to %.1lf MHz\n", (double) pstCard->llSetSamplerate / 1000000); + + + // setup the replay mode and the trigger + switch (lReplayMode) + { + + // with loops == 1: singleshot replay with software trigger + // with loops == 0: endless continuous mode with software trigger + case SPC_REP_STD_SINGLE: + bSpcMSetupModeRepStdLoops (pstCard, llChannelMask, KILO_B(64), llLoops); + bSpcMSetupTrigSoftware (pstCard, true); + + // on M2i starting with build 1604 we can use the trigger output as a marker for each loop start + // be sure to have the trigger output enabled for this + if (pstCard->bM2i) + { + if ((pstCard->lLibVersion & 0xFFFF) >= 1604) + spcm_dwSetParam_i32 (pstCard->hDrv, SPC_CONTOUTMARK, 1); + } + break; + + // single restart (one signal on every trigger edge) with ext trigger positive edge + case SPC_REP_STD_SINGLERESTART: + bSpcMSetupModeRepStdSingleRestart (pstCard, llChannelMask, KILO_B(64), 0); + bSpcMSetupTrigExternal (pstCard, SPC_TM_POS, false, 0); + break; + } + + + + // type dependent card setup + switch (pstCard->eCardFunction) + { + + // analog generator card setup + case AnalogOut: + + // program all output channels to +/- 1 V with no offset + for (i=0; i < pstCard->lMaxChannels; i++) + bSpcMSetupAnalogOutputChannel (pstCard, i, 1000, 0, 0); + break; + + // digital generator card setup + case DigitalOut: + case DigitalIO: + for (i=0; i < pstCard->uCfg.stDIO.lGroups; i++) + bSpcMSetupDigitalOutput (pstCard, i, SPCM_STOPLVL_LOW, 0, 3300); + break; + } + } + + + +/* +************************************************************************** +DoDataCalculation: calculates the output data +************************************************************************** +*/ + +bool bDoDataCalculation (ST_SPCM_CARDINFO *pstCard, void* pvBuffer) + { + void* ppvChannelData[SPCM_MAX_AOCHANNEL]; + int i; + + printf ("Calculation of output data\n"); + + switch (pstCard->eCardFunction) + { + + // analog waveform generator card, each channel gets a different waveform + case AnalogOut: + { + // allocate buffers for each channel + for (i=0; i < pstCard->lMaxChannels; i++) + { + if (pstCard->lBytesPerSample == 1) + ppvChannelData[i] = new int8[(unsigned) pstCard->llSetMemsize]; + else + ppvChannelData[i] = new int16[(unsigned) pstCard->llSetMemsize]; + if (!ppvChannelData[i]) + return (nSpcMErrorMessageStdOut (pstCard, "Memory allocation error\n", false) == 0); + } + + // calculate channel data + for (i=0; i < pstCard->lMaxChannels; i++) + { + switch (i) + { + case 0: bSpcMCalcSignal (pstCard, ppvChannelData[0], (uint32) pstCard->llSetMemsize, 0, eSine); break; + case 1: bSpcMCalcSignal (pstCard, ppvChannelData[1], (uint32) pstCard->llSetMemsize, 0, eTriangle); break; + case 2: bSpcMCalcSignal (pstCard, ppvChannelData[2], (uint32) pstCard->llSetMemsize, 0, eSawtooth); break; + case 3: bSpcMCalcSignal (pstCard, ppvChannelData[3], (uint32) pstCard->llSetMemsize, 0, eRectangle); break; + case 4: bSpcMCalcSignal (pstCard, ppvChannelData[4], (uint32) pstCard->llSetMemsize, 0, eInvertedSine); break; + case 5: bSpcMCalcSignal (pstCard, ppvChannelData[5], (uint32) pstCard->llSetMemsize, 0, eInvertedTriangle); break; + case 6: bSpcMCalcSignal (pstCard, ppvChannelData[6], (uint32) pstCard->llSetMemsize, 0, eInvertedSawtooth); break; + case 7: bSpcMCalcSignal (pstCard, ppvChannelData[7], (uint32) pstCard->llSetMemsize, 0, eInvertedRectangle); break; + } + } + + // mux it into the output buffer + bSpcMMuxData (pstCard, pvBuffer, (uint32) pstCard->llSetMemsize, ppvChannelData); + + // clean up channel buffers + for (i=0; i < pstCard->lMaxChannels; i++) + { + if (pstCard->lBytesPerSample == 1) + delete [] (int8*)ppvChannelData[i]; + else + delete [] (int16*)ppvChannelData[i]; + } + + break; + } + + // digital generator card: sine over all channels + case DigitalOut: + case DigitalIO: + { + // we need to tell the calc function the number of bytes for one complete word -> [channels/8] + bSpcMCalcSignal (pstCard, pvBuffer, (uint32) pstCard->llSetMemsize, pstCard->lSetChannels / 8, eSine); + break; + } + } + + + return true; + } + +/* +************************************************************************** +bSetMultiPurposeDigOut +************************************************************************** +*/ + +bool bSetMultiPurposeDigOut (ST_SPCM_CARDINFO *pstCard, void* pvBuffer) + { + if (pstCard->uCfg.stAO.lResolution != 16) + return false; + + int16* pnData = (int16*)pvBuffer; + int64 llDataLength = pstCard->lSetChannels * pstCard->llSetMemsize; + + uint32 dwXMode_X0 = 0; + uint32 dwXMode_X1 = 0; + uint32 dwXMode_X2 = 0; + uint32 dwXMode_X3 = 0; + + uint32 dwNumOfDigOutChannels = 0; + + // set all available and active XIO channels to digital output mode + if (pstCard->lSetChannels >= 1 && pstCard->qwSetChEnableMap & 0x01) + { + dwXMode_X0 = SPCM_XMODE_DIGOUT | SPCM_XMODE_DIGOUTSRC_CH0 | SPCM_XMODE_DIGOUTSRC_BIT15; + if (spcm_dwSetParam_i32 (pstCard->hDrv, SPCM_X0_MODE, dwXMode_X0)) + return false; + dwNumOfDigOutChannels = 1; + } + + if (pstCard->lSetChannels >= 2 && pstCard->qwSetChEnableMap & 0x03) + { + dwXMode_X1 = SPCM_XMODE_DIGOUT | SPCM_XMODE_DIGOUTSRC_CH1 | SPCM_XMODE_DIGOUTSRC_BIT15; + if (spcm_dwSetParam_i32 (pstCard->hDrv, SPCM_X1_MODE, dwXMode_X1)) + return false; + dwNumOfDigOutChannels = 2; + } + + if (pstCard->lSetChannels >= 3 && pstCard->qwSetChEnableMap & 0x07) + { + dwXMode_X2 = SPCM_XMODE_DIGOUT | SPCM_XMODE_DIGOUTSRC_CH2 | SPCM_XMODE_DIGOUTSRC_BIT15; + if (spcm_dwSetParam_i32 (pstCard->hDrv, SPCM_X2_MODE, dwXMode_X2)) + return false; + dwNumOfDigOutChannels = 3; + } + + if (pstCard->bM2p) + { + if (pstCard->lSetChannels >= 4 && pstCard->qwSetChEnableMap & 0x0F) + { + dwXMode_X3 = SPCM_XMODE_DIGOUT | SPCM_XMODE_DIGOUTSRC_CH3 | SPCM_XMODE_DIGOUTSRC_BIT15; + if (spcm_dwSetParam_i32 (pstCard->hDrv, SPCM_X3_MODE, dwXMode_X3)) + return false; + dwNumOfDigOutChannels = 4; + } + } + + bool bDigValHigh; + + for (int64 llDataIdx = 0; llDataIdx < llDataLength; llDataIdx += pstCard->lSetChannels) + { + if (llDataIdx < llDataLength / 2) + bDigValHigh = true; + else + bDigValHigh = false; + + // digital output value is set by adjusting highest bit in sample + for (uint32 dwDigChIdx = 0; dwDigChIdx < dwNumOfDigOutChannels; dwDigChIdx++) + { + // shift sample by one bit + pnData[llDataIdx + dwDigChIdx] >>= 1; + + // adjust bit 15 in sample to desired digital output value + if (bDigValHigh) + pnData[llDataIdx + dwDigChIdx] |= 0x8000; + else + pnData[llDataIdx + dwDigChIdx] &= 0x7FFF; + } + } + + return true; + } + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + char szBuffer[1024]; // a character buffer for any messages + ST_SPCM_CARDINFO stCard; // info structure of my card + uint64 qwMemInBytes; + void* pvBuffer = NULL; + + bool bMultiPurposeDigOut = false; + + // ------------------------------------------------------------------------ + // init card number 0 (the first card in the system), get some information and print it + // uncomment the second line and replace the IP address to use remote + // cards like in a generatorNETBOX + if (bSpcMInitCardByIdx (&stCard, 0)) + //if (bSpcMInitCardByIdx (&stCard, "192.168.1.10", 0)) + { + printf (pszSpcMPrintDocumentationLink (&stCard, szBuffer, sizeof (szBuffer))); + printf (pszSpcMPrintCardInfo (&stCard, szBuffer, sizeof (szBuffer))); + } + else + return nSpcMErrorMessageStdOut (&stCard, "Error: Could not open card\n", true); + + + // check whether we support this card type in the example + if ((stCard.eCardFunction != AnalogOut) && (stCard.eCardFunction != DigitalOut) && (stCard.eCardFunction != DigitalIO)) + return nSpcMErrorMessageStdOut (&stCard, "Error: Card function not supported by this example\n", false); + + + // ------------------------------------------------------------------------ + // do the card setup, error is routed in the structure so we don't care for the return values + if (!stCard.bSetError) + { + printf ("\nPlease select the output mode:\n\n(S)ingleshot\n(C)ontinuous"); + if (stCard.eCardFunction == AnalogOut && !stCard.bM2i) + printf (" + (D)igital Output (Multi Purpose IO Lines)"); + printf ("\nSingle (R)estart\n"); + + switch (cGetch()) + { + default: + case 's': + case 'S': + vDoCardSetup (&stCard, SPC_REP_STD_SINGLE, 1/*just once*/); + break; + + case 'c': + case 'C': + vDoCardSetup (&stCard, SPC_REP_STD_SINGLE, 0/*forever*/); + break; + + case 'r': + case 'R': + vDoCardSetup (&stCard, SPC_REP_STD_SINGLERESTART); + break; + + case 'd': + case 'D': + vDoCardSetup (&stCard, SPC_REP_STD_SINGLE, 0/*forever*/); + if (stCard.eCardFunction == AnalogOut && !stCard.bM2i) + bMultiPurposeDigOut = true; + break; + } + } + + + // ------------------------------------------------------------------------ + // calculate the amount of data we need and allocate memory buffer + if (!stCard.bSetError) + { + if (stCard.eCardFunction == DigitalOut || stCard.eCardFunction == DigitalIO) + qwMemInBytes = stCard.llSetMemsize * stCard.lSetChannels / 8; + else + qwMemInBytes = stCard.llSetMemsize * stCard.lBytesPerSample * stCard.lSetChannels; + + // buffer for data transfer, containing multiplexed data later on + pvBuffer = pvAllocMemPageAligned (qwMemInBytes); + if (!pvBuffer) + return nSpcMErrorMessageStdOut (&stCard, "Memory allocation error\n", false); + + // calculate the data + if (!bDoDataCalculation (&stCard, pvBuffer)) + return nSpcMErrorMessageStdOut (&stCard, "Data calculation failed\n", false); + + if (bMultiPurposeDigOut) + { + if (!bSetMultiPurposeDigOut (&stCard, pvBuffer)) + return nSpcMErrorMessageStdOut (&stCard, "Multi Pupose IO Lines setup failed\n", false); + } + } + + // ------------------------------------------------------------------------ + // start the generation + if (!stCard.bSetError) + { + + // we define the buffer for transfer and start the DMA transfer + printf ("Starting the DMA transfer and waiting until data is in board memory\n"); + spcm_dwDefTransfer_i64 (stCard.hDrv, SPCM_BUF_DATA, SPCM_DIR_PCTOCARD, 0, pvBuffer, 0, qwMemInBytes); + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA); + + // check for error code + if (spcm_dwGetErrorInfo_i32 (stCard.hDrv, NULL, NULL, szBuffer)) + { + vFreeMemPageAligned (pvBuffer, qwMemInBytes); + return nSpcMErrorMessageStdOut (&stCard, szBuffer, false); + } + printf ("... data has been transferred to board memory\n"); + + // We'll start and wait untill the card has finished or until a timeout occurs + spcm_dwSetParam_i32 (stCard.hDrv, SPC_TIMEOUT, 5000); + printf ("\nStarting the card and waiting for ready interrupt\n(continuous and single restart will have timeout)\n"); + if (spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_CARD_WAITREADY) == ERR_TIMEOUT) + { + vFreeMemPageAligned (pvBuffer, qwMemInBytes); + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_STOP); + return nSpcMErrorMessageStdOut (&stCard, "... Timeout", false); + } + } + + + // ------------------------------------------------------------------------ + // print error information if an error occured + if (stCard.bSetError) + return nSpcMErrorMessageStdOut (&stCard, "An error occured while programming the card:\n", true); + + // clean up and close the driver + vSpcMCloseCard (&stCard); + + vFreeMemPageAligned (pvBuffer, qwMemInBytes); + + return EXIT_SUCCESS; + } diff --git a/Cpp/examples/c_cpp/rep_std_single/rep_std_single.dsp b/Cpp/examples/c_cpp/rep_std_single/rep_std_single.dsp new file mode 100644 index 0000000000000000000000000000000000000000..13c7e5ce60d0307e6587ab6f87a8239f4586cc57 --- /dev/null +++ b/Cpp/examples/c_cpp/rep_std_single/rep_std_single.dsp @@ -0,0 +1,151 @@ +# Microsoft Developer Studio Project File - Name="rep_std_single" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=rep_std_single - Win32 Debug +!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE +!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl +!MESSAGE +!MESSAGE NMAKE /f "rep_std_single.mak". +!MESSAGE +!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben +!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: +!MESSAGE +!MESSAGE NMAKE /f "rep_std_single.mak" CFG="rep_std_single - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "rep_std_single - Win32 Release" (basierend auf "Win32 (x86) Console Application") +!MESSAGE "rep_std_single - Win32 Debug" (basierend auf "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "rep_std_single - 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" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c +# SUBTRACT CPP /YX /Yc /Yu +# 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)" == "rep_std_single - 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" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c +# SUBTRACT CPP /YX /Yc /Yu +# 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 "rep_std_single - Win32 Release" +# Name "rep_std_single - Win32 Debug" +# Begin Group "header" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\c_header\dlltyp.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\regs.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcerr.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_drv.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_card.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.h +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_ostools.h +# End Source File +# End Group +# Begin Group "common" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\common\spcm_lib_card.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_ostools_win.cpp +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_win32_msvcpp.lib +# End Source File +# End Group +# Begin Source File + +SOURCE=.\rep_std_single.cpp + +!IF "$(CFG)" == "rep_std_single - Win32 Release" + +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "rep_std_single - Win32 Debug" + +!ENDIF + +# End Source File +# End Target +# End Project diff --git a/Cpp/examples/c_cpp/rep_std_single/rep_std_single.dsw b/Cpp/examples/c_cpp/rep_std_single/rep_std_single.dsw new file mode 100644 index 0000000000000000000000000000000000000000..7400020287bf2965852762fc5cc67fe67ab58897 --- /dev/null +++ b/Cpp/examples/c_cpp/rep_std_single/rep_std_single.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN! + +############################################################################### + +Project: "rep_std_single"=.\rep_std_single.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/Cpp/examples/c_cpp/rep_std_single/rep_std_single.vcproj b/Cpp/examples/c_cpp/rep_std_single/rep_std_single.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..f2a2c0cf7338806f94995fbdb106efde5694ab1b --- /dev/null +++ b/Cpp/examples/c_cpp/rep_std_single/rep_std_single.vcproj @@ -0,0 +1,608 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="rep_std_single" + ProjectGUID="{2611E26D-E32F-4AA0-A9E6-8CF3A36717C5}" + RootNamespace="rep_std_single" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/rep_std_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rep_std_single.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rep_std_single.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rep_std_single.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rep_std_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/rep_std_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rep_std_single.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rep_std_single.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rep_std_single.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rep_std_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/rep_std_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rep_std_single.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rep_std_single.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rep_std_single.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rep_std_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/rep_std_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rep_std_single.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rep_std_single.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rep_std_single.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rep_std_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="header" + Filter="h;hpp;hxx;hm;inl" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_card.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_data.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + </Filter> + <Filter + Name="common" + > + <File + RelativePath="..\common\spcm_lib_card.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_data.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Filter> + <File + RelativePath="rep_std_single.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/rep_std_single/rep_std_single.vcxproj b/Cpp/examples/c_cpp/rep_std_single/rep_std_single.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..3ba32b87d61137f0cd5cb51b9ec104ace684b79c --- /dev/null +++ b/Cpp/examples/c_cpp/rep_std_single/rep_std_single.vcxproj @@ -0,0 +1,265 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{2611E26D-E32F-4AA0-A9E6-8CF3A36717C5}</ProjectGuid> + <RootNamespace>rep_std_single</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rep_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rep_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rep_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rep_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rep_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rep_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rep_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rep_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rep_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rep_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rep_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rep_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rep_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rep_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rep_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rep_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\spcm_lib_card.h" /> + <ClInclude Include="..\common\spcm_lib_data.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="..\common\spcm_lib_card.cpp" /> + <ClCompile Include="..\common\spcm_lib_data.cpp" /> + <ClCompile Include="rep_std_single.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/rep_std_single/rep_std_single.vcxproj.filters b/Cpp/examples/c_cpp/rep_std_single/rep_std_single.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..97671f77ad279587878e3f9936edfc0d5ca6bc23 --- /dev/null +++ b/Cpp/examples/c_cpp/rep_std_single/rep_std_single.vcxproj.filters @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="header"> + <UniqueIdentifier>{5dba36b6-fb53-4c86-aada-17fc31d82ca4}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + <Filter Include="common"> + <UniqueIdentifier>{2cafaaa2-9f57-4348-b6aa-2d67501e0795}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_card.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\spcm_lib_data.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\spcm_lib_card.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\spcm_lib_data.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="rep_std_single.cpp" /> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/sb5_file/sb5_file.cpp b/Cpp/examples/c_cpp/sb5_file/sb5_file.cpp new file mode 100644 index 0000000000000000000000000000000000000000..16de32a0034f300aaf2c1b7325291b662c490805 --- /dev/null +++ b/Cpp/examples/c_cpp/sb5_file/sb5_file.cpp @@ -0,0 +1,455 @@ +/* +************************************************************************** + +sb5_file.cpp (c) Spectrum GmbH + +************************************************************************** + +implements the header load and write functions + +Feel free to use these functions in your own programs. + +************************************************************************** +*/ + +#include "sb5_file.h" + +#include <string.h> + + + +/* +**************************************************************************** +header type information +**************************************************************************** +*/ + +#define SH_TYP_MASK 0xFF000000 // mask for type information +#define SH_TYP_INT32 0x01000000 // entry is 32 bit integer +#define SH_TYP_DOUBLE 0x02000000 // entry is 64 bit double +#define SH_TYP_TEXT 0x04000000 // entry is zero terminated string +#define SH_TYP_DATA 0x80000000 // entry is the data area + +#define SH_CHX_MASK 0x00FF0000 // mask for channel index +#define SH_CHX_CH0 0x00000000 // channel 0 +#define SH_CHX_CH1 0x00010000 // channel 1 +#define SH_CHX_CH2 0x00020000 // channel 2 + // ... + + +/* +**************************************************************************** +header information +**************************************************************************** +*/ + +#define SH_ID_IDMASK 0x0000FFFF // mask for information id +#define SH_ID_DATA 0x80000000 // data area +#define SH_ID_XOFFSET 0x02000001 // offset x direction (trigger) +#define SH_ID_XRANGE 0x02000002 // scaling in x direction (1/sampling rate) +#define SH_ID_YRANGE 0x02000003 // scaling in y direction (voltage) +#define SH_ID_YOFFSET 0x02000004 // offset y direction +#define SH_ID_SOURCE 0x04000005 // data source (normally name of generating card) +#define SH_ID_SAMPLES 0x01000006 // number of samples in file +#define SH_ID_SIGNALNAME 0x04000007 // name of signal +#define SH_ID_SIGNALTYP 0x01000008 // type of signal as defined below +#define SH_ID_TIMESTAMP 0x04000009 // time stamp (just system time) +#define SH_ID_MULTISEGMENT 0x0100000C // segment size on Multiple Recording files +#define SH_ID_SOURCEFS 0x0200000D // full scale range of source signal (used on FFT display) +#define SH_ID_MUXCOUNT 0x01000015 // number of multiplexed signals in file +#define SH_ID_MUXINDEX 0x01000016 // index of multiplexed signals as sorting may be different + + + +/* +**************************************************************************** +SBench file identification +**************************************************************************** +*/ + +#define SB5DATALEN 10 +#define SB5DATA "SB5Data___" +#define SB5STREAM "SB5Stream_" + + + +/* +**************************************************************************** +Some simple read and write routines. All return true if sucessful +**************************************************************************** +*/ + +void vWriteHeader (bool* pbOk, FILE* hFile, int32 lId) + { + if (*pbOk) + (*pbOk) = (fwrite (&lId, sizeof(int32), 1, hFile) == 1); + } + +// ************************************************************************* + +void vWriteHeader (bool* pbOk, FILE* hFile, int32 lId, int32 lValue) + { + if (*pbOk) + (*pbOk) = (fwrite (&lId, sizeof(int32), 1, hFile) == 1); + if (*pbOk) + (*pbOk) = (fwrite (&lValue, sizeof (int32), 1, hFile) == 1); + } + +// ************************************************************************* + +void vWriteHeader (bool* pbOk, FILE* hFile, int32 lId, double dValue) + { + if (*pbOk) + (*pbOk) = (fwrite (&lId, sizeof(int32), 1, hFile) == 1); + if (*pbOk) + (*pbOk) = (fwrite (&dValue, sizeof (double), 1, hFile) == 1); + } + +// ************************************************************************* + +void vWriteHeader (bool* pbOk, FILE* hFile, int32 lId, const char* pszValue, const char* pszDefault) + { + int32 lLen ; + + if (pszValue) + lLen = (int32) strlen (pszValue) + 1; + else + lLen = (int32) strlen (pszDefault) + 1; + + if (*pbOk) + (*pbOk) = (fwrite (&lId, sizeof(int32), 1, hFile) == 1); + if (*pbOk) + (*pbOk) = (fwrite (&lLen, sizeof (int32), 1, hFile) == 1); + if (*pbOk && pszValue) + (*pbOk) = (fwrite (pszValue, lLen, 1, hFile) == 1); + if (*pbOk && !pszValue) + (*pbOk) = (fwrite (pszDefault, lLen, 1, hFile) == 1); + } + + + +/* +**************************************************************************** +bSB5_StoreHeader: stores the given header information to an already opened +file. The file pointer is afterwards directly at the beginning of the data +section and plain binary data can be written +**************************************************************************** +*/ + +bool bSB5_StoreHeader (FILE* hFile, ST_SB5HEAD* pstHead) + { + bool bOk = true; + + if (!hFile) + return false; + + // some simple header checks + if ((pstHead->lChannels < 0) || (pstHead->lChannels > SB5MAXMUX)) + return false; + + // go to beginning of file and write identification + bOk = !fseek (hFile, 0, SEEK_SET); + if (bOk && (pstHead->lChannels == 1)) + bOk = (fwrite (SB5DATA, SB5DATALEN, 1, hFile) == 1); + if (bOk && (pstHead->lChannels > 1)) + bOk = (fwrite (SB5STREAM, SB5DATALEN, 1, hFile) == 1); + + // multiplex channels + if (pstHead->lChannels > 1) + vWriteHeader (&bOk, hFile, SH_ID_MUXCOUNT, pstHead->lChannels); + + // we write samples as second as we may need to update this again + vWriteHeader (&bOk, hFile, SH_ID_SAMPLES, pstHead->lSumSamples); + + // write data information + vWriteHeader (&bOk, hFile, SH_ID_SIGNALTYP, pstHead->lSignalType); + vWriteHeader (&bOk, hFile, SH_ID_MULTISEGMENT, pstHead->lMRSegmentsize); + vWriteHeader (&bOk, hFile, SH_ID_XOFFSET, pstHead->dXOffset); + vWriteHeader (&bOk, hFile, SH_ID_XRANGE, pstHead->dXScale); + + // if strins aren't specified we took defaults + vWriteHeader (&bOk, hFile, SH_ID_SIGNALNAME, pstHead->pszSignalName, "SB5File"); + vWriteHeader (&bOk, hFile, SH_ID_SOURCE, pstHead->pszSource, "<unknown>"); + vWriteHeader (&bOk, hFile, SH_ID_TIMESTAMP, pstHead->pszTimestamp, "<not specified>"); + + // write channel related information + for (int i=0; i<pstHead->lChannels; i++) + { + vWriteHeader (&bOk, hFile, SH_ID_MUXINDEX | ((i << 16) & SH_CHX_MASK), pstHead->plMuxIdx[i]); + vWriteHeader (&bOk, hFile, SH_ID_YRANGE | ((i << 16) & SH_CHX_MASK), pstHead->pdYScale[i]); + vWriteHeader (&bOk, hFile, SH_ID_YOFFSET | ((i << 16) & SH_CHX_MASK), pstHead->pdYOffset[i]); + vWriteHeader (&bOk, hFile, SH_ID_SOURCEFS | ((i << 16) & SH_CHX_MASK), pstHead->pdSourceFS[i]); + } + + // at last we write the data identifier + vWriteHeader (&bOk, hFile, SH_ID_DATA); + + return bOk; + } + + + +/* +**************************************************************************** +Alloc/Free Header. Allocation of header with all arrays correctly set. +Storage for strings need to be allocated separately +**************************************************************************** +*/ + +ST_SB5HEAD* pstSB5_AllocHeader (int32 lChannels) + { + ST_SB5HEAD* pstHeader; + + if ((lChannels < 0) || (lChannels > SB5MAXMUX)) + return NULL; + + pstHeader = new ST_SB5HEAD; + memset (pstHeader, 0, sizeof (ST_SB5HEAD)); + + pstHeader->pdSourceFS = new double[lChannels]; + pstHeader->pdYOffset = new double[lChannels]; + pstHeader->pdYScale = new double[lChannels]; + pstHeader->plMuxIdx = new int32[lChannels]; + pstHeader->lChannels = lChannels; + + return pstHeader; + } + +// ************************************************************************* + +void vSB5_FreeHeader (ST_SB5HEAD* pstHeader) + { + if (!pstHeader) + return; + + delete [] (pstHeader->pdSourceFS); + delete [] (pstHeader->pdYOffset); + delete [] (pstHeader->pdYScale); + delete [] (pstHeader->plMuxIdx); + if (pstHeader->pszSignalName) + delete [] (pstHeader->pszSignalName); + if (pstHeader->pszSource) + delete [] (pstHeader->pszSource); + if (pstHeader->pszTimestamp) + delete [] (pstHeader->pszTimestamp); + + delete (pstHeader); + } + + + +/* +**************************************************************************** +bSB5_UpdateSamples: tries to update the samples settings at the end of +writing if this information wasn#t known when writing the header information +as usually on streaming files. +**************************************************************************** +*/ + +bool bSB5_UpdateSamples (FILE* hFile, int32 lSamples) + { + bool bOk = true; + int32 lPos; + int32 plEntry[2]; + + // search for samples, it's either first or second + bOk = !fseek (hFile, SB5DATALEN, SEEK_SET); + while (bOk) + { + lPos = ftell (hFile); + bOk = (fread (plEntry, sizeof(int32), 2, hFile) == 2); + if (bOk && plEntry[0] == SH_ID_SAMPLES) + { + bOk = !fseek (hFile, lPos, SEEK_SET); + vWriteHeader (&bOk, hFile, SH_ID_SAMPLES, lSamples); + return true; + } + } + + return false; + } + + + +/* +**************************************************************************** +pstSB5_LoadHeader: load the header information from an already opened file. +The file pointer is afterwards directly at the beginning of the data +section and plain binary data can be read +**************************************************************************** +*/ + +#define MAXTEXTLEN 1024 + +ST_SB5HEAD* pstSB5_LoadHeader (FILE* hFile) + { + ST_SB5HEAD* pstHeader; + bool bOk; + int32 lChannels = 0; + int32 lId, lValue, lLen, lCh; + double dValue; + char szBuffer[MAXTEXTLEN]; + int i; + + if (!hFile) + return NULL; + + // examine the identification tag + bOk = (fread (szBuffer, SB5DATALEN, 1, hFile) == 1); + if (!bOk) + return NULL; + + // check for file type + if (strncmp (szBuffer, SB5STREAM, SB5DATALEN) == 0) + { + bOk = (fread (&lId, sizeof(int32), 1, hFile) == 1); + if (!bOk || (lId != SH_ID_MUXCOUNT)) + return NULL; + bOk = (fread (&lChannels, sizeof (int32), 1, hFile) == 1); + } + else if (strncmp (szBuffer, SB5DATA, SB5DATALEN) == 0) + lChannels = 1; + else + return NULL; + + // check number of channels + if (!bOk || (lChannels < 0) || (lChannels > SB5MAXMUX)) + return NULL; + + // now we know that the file type is correct and we know which tpye it is + pstHeader = pstSB5_AllocHeader (lChannels); + + // we predefine the mux signals in case that we don't find them + for (i=0; i<lChannels; i++) + pstHeader->plMuxIdx[i] = i; + + // now we loop through the complete header and fill our details + while (bOk) + { + + // ----- read the entry ----- + bOk = (fread (&lId, sizeof(int32), 1, hFile) == 1); + if (bOk) + switch (lId & SH_TYP_MASK) + { + + // if we find the data tag, we're done + case SH_TYP_DATA: + return pstHeader; + + // int32 entry + case SH_TYP_INT32: + bOk = (fread (&lValue, sizeof(int32), 1, hFile) == 1); + break; + + // double entry + case SH_TYP_DOUBLE: + bOk = (fread (&dValue, sizeof(double), 1, hFile) == 1); + break; + + // text entry + case SH_TYP_TEXT: + bOk = (fread (&lLen, sizeof(int32), 1, hFile) == 1); + if (lLen > (MAXTEXTLEN - 1)) + bOk = false; + if (bOk) + { + bOk = (fread (szBuffer, lLen, 1, hFile) == 1); + szBuffer[lLen] = 0; + } + break; + + // unknown entry + default: + bOk = false; + break; + } // switch (lId & SH_TYP_MASK) + + // ----- fill entry in header ----- + if (bOk) + switch (lId & ~SH_CHX_MASK) + { + case SH_ID_XOFFSET: + pstHeader->dXOffset = dValue; + break; + + case SH_ID_XRANGE: + pstHeader->dXScale = dValue; + break; + + case SH_ID_SAMPLES: + pstHeader->lSumSamples = lValue; + break; + + case SH_ID_SIGNALTYP: + pstHeader->lSignalType = lValue; + break; + + case SH_ID_MULTISEGMENT: + pstHeader->lMRSegmentsize = lValue; + break; + + case SH_ID_SOURCE: + pstHeader->pszSource = new char[strlen(szBuffer) + 1]; + strcpy (pstHeader->pszSource, szBuffer); + break; + + case SH_ID_SIGNALNAME: + pstHeader->pszSignalName = new char[strlen(szBuffer) + 1]; + strcpy (pstHeader->pszSignalName, szBuffer); + break; + + case SH_ID_TIMESTAMP: + pstHeader->pszTimestamp = new char[strlen(szBuffer) + 1]; + strcpy (pstHeader->pszTimestamp, szBuffer); + break; + + case SH_ID_YRANGE: + lCh = (lId >> 16) & 0x0f; + if (lCh > (lChannels - 1)) + bOk = false; + else + pstHeader->pdYScale[lCh] = dValue; + break; + + case SH_ID_YOFFSET: + lCh = (lId >> 16) & 0x0f; + if (lCh > (lChannels - 1)) + bOk = false; + else + pstHeader->pdYOffset[lCh] = dValue; + break; + + case SH_ID_SOURCEFS: + lCh = (lId >> 16) & 0x0f; + if (lCh > (lChannels - 1)) + bOk = false; + else + pstHeader->pdSourceFS[lCh] = dValue; + break; + + case SH_ID_MUXINDEX: + lCh = (lId >> 16) & 0x0f; + if (lCh > (lChannels - 1)) + bOk = false; + else + pstHeader->plMuxIdx[lCh] = lValue; + break; + + default: + break; + + } // switch (lId) + + } // while (bOk) + + + // something failed + if (!bOk) + { + vSB5_FreeHeader (pstHeader); + pstHeader = NULL; + } + return pstHeader; + } + diff --git a/Cpp/examples/c_cpp/sb5_file/sb5_file.h b/Cpp/examples/c_cpp/sb5_file/sb5_file.h new file mode 100644 index 0000000000000000000000000000000000000000..7ec1879efbd3067bc27ea78a492f7b9af85f6c9e --- /dev/null +++ b/Cpp/examples/c_cpp/sb5_file/sb5_file.h @@ -0,0 +1,162 @@ +/* +************************************************************************** + +sb5_file.h (c) Spectrum GmbH , 01/2006 + +************************************************************************** + +offers defintions and functions to handle files of SBench5 format. The +functions handle both *.sb5 data files for single channels and *.sbs data +files for streaming files with multiplexed data. + +If using the storage functions please be sure to use the correct file +names if you wish to open the files under SBench5. + +Feel free to use these functions in your own programs. + +************************************************************************** +*/ + +#ifndef SB5_FILE_H +#define SB5_FILE_H + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +// ----- standard c include files ----- +#include <stdio.h> + + + +/* +**************************************************************************** +signal types +**************************************************************************** +*/ + +#define SIGNAL_TYP_TYPMASK 0xFF000000 // mask for signal type +#define SIGNAL_TYP_ALL 0xFF000000 +#define SIGNAL_TYP_ANALOGTIME 0x01000000 // analog signal +#define SIGNAL_TYP_DIGITALTIME 0x02000000 // digital signal +#define SIGNAL_TYP_FFT 0x04000000 // fft signal +#define SIGNAL_TYP_ANADIGTIME 0x10000000 // mixed analog/digital signal, digital bits in upper bits of analog signal +#define SIGNAL_TYP_ANALOGSTREAM 0x20000000 // analog multiplexed stream +#define SIGNAL_TYP_DIGITALSTREAM 0x40000000 // digital multiplexed stream +#define SIGNAL_TYP_ANADIGSTREAM 0x80000000 // mixed analog/digital multiplexed stream + + + +/* +**************************************************************************** +sample bit width (coded in signaltype) +**************************************************************************** +*/ + +#define SIGNAL_TYP_BITMASK 0x000000FF +#define SIGNAL_TYP_2BIT 0x00000002 +#define SIGNAL_TYP_4BIT 0x00000004 +#define SIGNAL_TYP_6BIT 0x00000006 +#define SIGNAL_TYP_8BIT 0x00000008 +#define SIGNAL_TYP_10BIT 0x0000000A +#define SIGNAL_TYP_12BIT 0x0000000C +#define SIGNAL_TYP_14BIT 0x0000000E +#define SIGNAL_TYP_16BIT 0x00000010 +#define SIGNAL_TYP_FLOAT 0x00000040 + + + +/* +**************************************************************************** +sample byte width (coded in signal type) +**************************************************************************** +*/ + +#define SIGNAL_TYP_BYTEMASK 0x00000F00 +#define SIGNAL_TYP_1BYTE 0x00000100 +#define SIGNAL_TYP_2BYTE 0x00000200 +#define SIGNAL_TYP_4BYTE 0x00000400 + + + + +/* +**************************************************************************** +sb5 header information structure +If reading header be sure to have storage space for SB5MAXMUX for all +channel related information. +**************************************************************************** +*/ + +// maximum number of multiplexed channels +#define SB5MAXMUX 16 + +struct ST_SB5HEAD + { + int32 lSignalType; // signal type as defined above, be sure to include type, bit width and byte width + char* pszSignalName; // name of the signal + char* pszSource; // source (normally generating card) + char* pszTimestamp; // generating timestamp + int32 lChannels; // number of channels stored + int32 lSumSamples; // number of stored samples in total (SamplesPerChannel * Channels) + int32 lMRSegmentsize; // size of one segment in multiple reoording files + double dXOffset; // offset in x direction (trigger position) + double dXScale; // x direction scaling (1/sampling rate) + double* pdYScale; // array with y scaling information for each channel + double* pdYOffset; // array with y offset information for each channel + double* pdSourceFS; // array with full scale ranges of source signal + int32* plMuxIdx; // array with multiplex indexes of each channel + }; + + + +/* +**************************************************************************** +bSB5_StoreHeader: stores the given header information to an already opened +file. The file pointer is afterwards directly at the beginning of the data +section and plain binary data can be written +**************************************************************************** +*/ + +// allocates an empty header structure with correct arrays for channel parameters +ST_SB5HEAD* pstSB5_AllocHeader (int32 lChannels); + +// frees the header structure +void vSB5_FreeHeader (ST_SB5HEAD* pstHeader); + +// the store function +bool bSB5_StoreHeader ( // returns true if storage succeeded + FILE* hFile, // file handle of an already opened empty file + ST_SB5HEAD* pstHeader); // pointer to a filled header structure, be sure to fill all values correctly + + + +/* +**************************************************************************** +bSB5_UpdateSamples: tries to update the samples settings at the end of +writing if this information wasn#t known when writing the header information +as usually on streaming files. +**************************************************************************** +*/ + +bool bSB5_UpdateSamples ( // returns true if update succeeded + FILE* hFile, // file handle of an already opened empty file + int32 lSamples); // samples value to update + + + +/* +**************************************************************************** +bSB5_LoadHeader: load the header information from an already opened file. +The file pointer is afterwards directly at the beginning of the data +section and plain binary data can be read +**************************************************************************** +*/ + +ST_SB5HEAD* pstSB5_LoadHeader ( // returns pointer to new allocated and filled header or NULL if an error occurs + FILE* hFile); // file handle of an already opened empty file + + +#endif diff --git a/Cpp/examples/c_cpp/sb6_read_purebinary/main.cpp b/Cpp/examples/c_cpp/sb6_read_purebinary/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b4223e4d4a0db5960f1ae35de8bc7ee1683309a5 --- /dev/null +++ b/Cpp/examples/c_cpp/sb6_read_purebinary/main.cpp @@ -0,0 +1,117 @@ +/* +************************************************************************** + +sb6_read_purebinary.cpp (c) Spectrum GmbH + +************************************************************************** + +Example shows how to read a SBench6 pure binary export file + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + +#include "sb6_read_purebinary.h" +#include <iostream> +#include <iomanip> + +#define FILE_ANLOG 0 +#define FILE_DIGITAL 1 + +using namespace std; + +int main () + { + HeaderInfo stHeaderInfo; + vector <float*> vpfChData; + vector <unsigned char*> vpbyChData; + + // set path to pure binary file + string sPureBinaryFilePath = "export.bin"; + + // create path to header file + string sHeaderFilePath = sPureBinaryFilePath; + sHeaderFilePath = sHeaderFilePath.erase (sHeaderFilePath.find_last_of (".")) + "_binheader.txt"; + + // read infos from header file and store them in header info struct + if (SB6_bReadPureBinaryHeaderInfos (sHeaderFilePath, stHeaderInfo)) + { + // this example reads only pure analog or pure digital files + if (stHeaderInfo.dwNumAChannels > 0 && stHeaderInfo.dwNumDChannels > 0) + return 0; + + int lFileType = FILE_ANLOG; + if (stHeaderInfo.dwNumDChannels > 0) + lFileType = FILE_DIGITAL; + + switch (lFileType) + { + case FILE_ANLOG: + // read data from binary file. + // data is stored in vector: + // vector[0] => data for channel 0 + // vector[1] => data for channel 1 + // ... + // vector[n] => data for channel n + vpfChData = SB6_ReadPureBinaryFileAnalog (sPureBinaryFilePath, stHeaderInfo); + + if (vpfChData.size ()) + { + // plot first 32 samples for each channel + for (uint32 dwChIdx = 0; dwChIdx < vpfChData.size (); dwChIdx++) + { + cout << "Plot first 32 samples of " + stHeaderInfo.vstChInfos[dwChIdx].sName + ":" << endl; + for (uint64 qwDataIdx = 0; qwDataIdx < stHeaderInfo.qwLen && qwDataIdx < 32; qwDataIdx++) + cout << vpfChData[dwChIdx][qwDataIdx] << " mV\n"; + + cout << endl; + } + + // free memory + SB6_vClearChData (vpfChData); + } + break; + + case FILE_DIGITAL: + // read data from binary file. + // data is stored in vector: + // vector[0] => data for digital channel group D07-D00 + // vector[1] => data for digital channel group D15-D08 + // vector[2] => data for digital channel group D23-D16 + // vector[3] => data for digital channel group D31-D24 + // ... + + vpbyChData = SB6_ReadPureBinaryFileDigital (sPureBinaryFilePath, stHeaderInfo); + + if (vpbyChData.size ()) + { + int lMaxDigChIndex = 8 * vpbyChData.size () - 1; + + cout << "Plot first 128 samples for each channel:\n"; + + for (uint64 qwDataIdx = 0; qwDataIdx < stHeaderInfo.qwLen && qwDataIdx < 128; qwDataIdx++) + { + cout << "[D" << dec << lMaxDigChIndex << "-D0]: 0x"; + for (int32 lChGroupIdx = vpbyChData.size () - 1; lChGroupIdx >= 0; lChGroupIdx--) + cout << hex << setfill ('0') << setw (2) << (uint16)vpbyChData[lChGroupIdx][qwDataIdx]; + + cout << endl; + } + + // free memory + SB6_vClearChData (vpbyChData); + } + break; + } + } + + return 0; + } diff --git a/Cpp/examples/c_cpp/sb6_read_purebinary/makefile b/Cpp/examples/c_cpp/sb6_read_purebinary/makefile new file mode 100644 index 0000000000000000000000000000000000000000..990b925f1c06deb67a58fc0a3f7757c0d69f3c90 --- /dev/null +++ b/Cpp/examples/c_cpp/sb6_read_purebinary/makefile @@ -0,0 +1,21 @@ +COMPILER = g++ +EXECUTABLE = sb6_read_purebinary +LIBS += -lpthread -lrt + +OBJECTS = main.o\ + sb6_read_purebinary.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/sb6_read_purebinary/sb6_read_purebinary.cpp b/Cpp/examples/c_cpp/sb6_read_purebinary/sb6_read_purebinary.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b580d04abb9337188903da67b8f4e608cb33df2e --- /dev/null +++ b/Cpp/examples/c_cpp/sb6_read_purebinary/sb6_read_purebinary.cpp @@ -0,0 +1,522 @@ +/* +************************************************************************** + +sb6_read_purebinary.cpp (c) Spectrum GmbH + +************************************************************************** + +Example shows how to read a SBench6 pure binary export file + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + +#include "sb6_read_purebinary.h" +#include <fstream> +#include <cstring> + +using namespace std; + +/* +************************************************************************** +SB6_bReadPureBinaryHeaderInfos +************************************************************************** +*/ + +bool SB6_bReadPureBinaryHeaderInfos (string sHeaderFilePath, HeaderInfo &stHeaderInfo) + { + string sLine, sValue; + + ifstream oFileStream (sHeaderFilePath); + if (!oFileStream.is_open ()) + return false; + + memset (&stHeaderInfo, 0, sizeof (stHeaderInfo)); + + int32 lCurrentChIndex = -1; + + while (getline (oFileStream, sLine)) + { + if (sLine.find ("[Ch") == 0) + { + lCurrentChIndex = -1; + + uint32 dwDigitStart = 3; + uint32 dwDigitEnd = sLine.find_last_of ("]"); + + if (dwDigitEnd < string::npos) + { + sValue = sLine.substr (dwDigitStart, dwDigitEnd - dwDigitStart); + lCurrentChIndex = stol (sValue.c_str ()); + for (int32 lIdx = stHeaderInfo.vstChInfos.size (); lIdx < lCurrentChIndex + 1; lIdx++) + stHeaderInfo.vstChInfos.push_back (ChannelInfo ()); + } + } + + if (sLine.find ("Name") == 0 && lCurrentChIndex >= 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 2); + stHeaderInfo.vstChInfos[lCurrentChIndex].sName = sValue; + } + + if (sLine.find ("XUnit") == 0 && lCurrentChIndex >= 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 2); + stHeaderInfo.vstChInfos[lCurrentChIndex].sXUnit = sValue; + } + + if (sLine.find ("YUnit") == 0 && lCurrentChIndex >= 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 2); + stHeaderInfo.vstChInfos[lCurrentChIndex].sYUnit = sValue; + } + + if (sLine.find ("Description") == 0 && lCurrentChIndex >= 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 2); + stHeaderInfo.vstChInfos[lCurrentChIndex].sDescription = sValue; + } + + if (sLine.find ("MaxRange") == 0 && lCurrentChIndex >= 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.vstChInfos[lCurrentChIndex].dMaxRange = stod (sValue.c_str ()); + } + + if (sLine.find ("MinRange") == 0 && lCurrentChIndex >= 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.vstChInfos[lCurrentChIndex].dMinRange = stod (sValue.c_str ()); + } + + if (sLine.find ("OrigMaxRange") == 0 && lCurrentChIndex >= 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.vstChInfos[lCurrentChIndex].lOrigMaxRange = stol (sValue.c_str ()); + } + + if (sLine.find ("OrigMinRange") == 0 && lCurrentChIndex >= 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.vstChInfos[lCurrentChIndex].lOrigMinRange = stol (sValue.c_str ()); + } + + if (sLine.find ("UserOffset") == 0 && lCurrentChIndex >= 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.vstChInfos[lCurrentChIndex].lUserOffset = stol (sValue.c_str ()); + } + + if (sLine.find ("NumAChannels") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.dwNumAChannels = stoul (sValue.c_str ()); + continue; + } + + if (sLine.find ("NumDChannels") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.dwNumDChannels = stoul (sValue.c_str ()); + continue; + } + + if (sLine.find ("FileFlags") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.dwFileFlags = stoul (sValue.c_str ()); + continue; + } + + if (sLine.find ("DataEncoding") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.dwDataEncoding = stoul (sValue.c_str ()); + continue; + } + + if (sLine.find ("ChannelSorting") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.dwChannelSorting = stoul (sValue.c_str ()); + continue; + } + + if (sLine.find ("TSSize") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.dwTSSize = stoul (sValue.c_str ()); + continue; + } + + if (sLine.find ("RawDataFormat") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.dwRawDataFormat = stoul (sValue.c_str ()); + continue; + } + + if (sLine.find ("StoreDate") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.dwStoreDate = stoul (sValue.c_str ()); + continue; + } + + if (sLine.find ("StoreTime") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.dwStoreTime = stoul (sValue.c_str ()); + continue; + } + + if (sLine.find ("LenH") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.qwLen = (static_cast <uint64> (stoul (sValue.c_str ())) << 32) | (stHeaderInfo.qwLen & 0xFFFFFFFF); + continue; + } + + if (sLine.find ("LenL") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.qwLen = (stHeaderInfo.qwLen & 0xFFFFFFFF00000000) | static_cast <uint64> (stoul (sValue.c_str ())); + continue; + } + + if (sLine.find ("PostH") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.qwPost = (static_cast <uint64> (stoul (sValue.c_str ())) << 32) | (stHeaderInfo.qwPost & 0xFFFFFFFF); + continue; + } + + if (sLine.find ("PostL") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.qwPost = (stHeaderInfo.qwPost & 0xFFFFFFFF00000000) | static_cast <uint64> (stoul (sValue.c_str ())); + continue; + } + + if (sLine.find ("SegmentH") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.qwSegment = (static_cast <uint64> (stoul (sValue.c_str ())) << 32) | (stHeaderInfo.qwSegment & 0xFFFFFFFF); + continue; + } + + if (sLine.find ("SegmentL") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.qwSegment = (stHeaderInfo.qwSegment & 0xFFFFFFFF00000000) | static_cast <uint64> (stoul (sValue.c_str ())); + continue; + } + + if (sLine.find ("Pretrigger") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.dwPretrigger = stoul (sValue.c_str ()); + continue; + } + + if (sLine.find ("Resolution") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.dwResolution = stoul (sValue.c_str ()); + continue; + } + + if (sLine.find ("Samplerate") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.qwSamplerate = stoull (sValue.c_str ()); + continue; + } + + if (sLine.find ("TrigPosH") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.qwTrigPos = (static_cast <uint64> (stoul (sValue.c_str ())) << 32) | (stHeaderInfo.qwTrigPos & 0xFFFFFFFF); + continue; + } + + if (sLine.find ("TrigPosL") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.qwTrigPos = (stHeaderInfo.qwTrigPos & 0xFFFFFFFF00000000) | static_cast <uint64> (stoul (sValue.c_str ())); + continue; + } + + if (sLine.find ("TrigDelayH") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.qwTrigDelay = (static_cast <uint64> (stoul (sValue.c_str ())) << 32) | (stHeaderInfo.qwTrigDelay & 0xFFFFFFFF); + continue; + } + + if (sLine.find ("TrigDelayL") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.qwTrigDelay = (stHeaderInfo.qwTrigDelay & 0xFFFFFFFF00000000) | static_cast <uint64> (stoul (sValue.c_str ())); + continue; + } + + if (sLine.find ("OffsetH") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.qwOffset = (static_cast <uint64> (stoul (sValue.c_str ())) << 32) | (stHeaderInfo.qwOffset & 0xFFFFFFFF); + continue; + } + + if (sLine.find ("OffsetL") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.qwOffset = (stHeaderInfo.qwOffset & 0xFFFFFFFF00000000) | static_cast <uint64> (stoul (sValue.c_str ())); + continue; + } + + if (sLine.find ("Flags") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.dwFlags = stoul (sValue.c_str ()); + continue; + } + + if (sLine.find ("ABADivider") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.dwABADivider = stoul (sValue.c_str ()); + continue; + } + + if (sLine.find ("SlowABALenH") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.qwSlowABALen = (static_cast <uint64> (stoul (sValue.c_str ())) << 32) | (stHeaderInfo.qwSlowABALen & 0xFFFFFFFF); + continue; + } + + if (sLine.find ("SlowABALenL") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.qwSlowABALen = (stHeaderInfo.qwSlowABALen & 0xFFFFFFFF00000000) | static_cast <uint64> (stoul (sValue.c_str ())); + continue; + } + + if (sLine.find ("MaxADCValue") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.dwMaxADCValue = stoul (sValue.c_str ()); + continue; + } + + if (sLine.find ("TSRefClock") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.dwTSRefClock = stoul (sValue.c_str ()); + continue; + } + + if (sLine.find ("OversamplingFactor") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.dwOversamplingFactor = stoul (sValue.c_str ()); + continue; + } + + if (sLine.find ("TSSamplerate") == 0) + { + sValue = sLine.substr (sLine.find_last_of ("=") + 1); + stHeaderInfo.qwTSSamplerate = stoull (sValue.c_str ()); + continue; + } + } + + return true; + } + +/* +************************************************************************** +SB6_ReadPureBinaryFileAnalog +************************************************************************** +*/ + +vector <float*> SB6_ReadPureBinaryFileAnalog (string sFilePath, HeaderInfo stHeaderInfo, uint64 qwLengthSamples, uint64 qwOffsetSamples) + { + char *pbyDataBuffer = NULL; + int16 *pnDataBuffer = NULL; + uint64 qwLengthPerCh = 0; + + vector <float*> vpfChData; + + ifstream oFileStream (sFilePath, ios::binary); + if (oFileStream.is_open ()) + { + // get number of channels from header file + uint32 dwNumCh = stHeaderInfo.dwNumAChannels; + + // check number of available channel infos + if (dwNumCh > stHeaderInfo.vstChInfos.size ()) + return vpfChData; + + // get resolution info from header file + uint32 dwBytesPerSample = 1; + if (stHeaderInfo.dwResolution > 8) + dwBytesPerSample = 2; + + // if length parameter is not set read complete data + if (qwLengthSamples > 0) + qwLengthPerCh = qwLengthSamples; + else + qwLengthPerCh = stHeaderInfo.qwLen; + + // adjust MaxADCValue if this is not set + if (!stHeaderInfo.dwMaxADCValue) + stHeaderInfo.dwMaxADCValue = 1; + + // calculate buffer size in bytes + uint64 qwBufferLength = dwNumCh * dwBytesPerSample * qwLengthPerCh; + + // allocate buffer memory + pbyDataBuffer = new char[(size_t)qwBufferLength]; + + // allocate memory for each channel + for (uint32 dwChIdx = 0; dwChIdx < dwNumCh; dwChIdx++) + vpfChData.push_back (new float[(size_t)qwLengthPerCh]); + + // set data offset + if (qwOffsetSamples > 0) + { + // calculate offset in bytes + uint64 qwOffsetBytes = dwBytesPerSample * dwNumCh * qwOffsetSamples; + oFileStream.seekg (qwOffsetBytes, ios::beg); + } + + // read data from file + oFileStream.read (pbyDataBuffer, qwBufferLength); + + uint64 qwDataIdx = 0; + + pnDataBuffer = (int16*)pbyDataBuffer; + for (uint64 qwBufferIdx = 0; qwBufferIdx < qwBufferLength / (uint64)dwBytesPerSample; qwBufferIdx += dwNumCh) + { + // calculate voltage values for each channel + for (uint32 dwChIdx = 0; dwChIdx < dwNumCh; dwChIdx++) + { + if (dwBytesPerSample == 2) + vpfChData[dwChIdx][qwDataIdx] = (float)(pnDataBuffer[qwBufferIdx + dwChIdx] * stHeaderInfo.vstChInfos[dwChIdx].lOrigMaxRange) / (float)stHeaderInfo.dwMaxADCValue; + else + vpfChData[dwChIdx][qwDataIdx] = (float)(pbyDataBuffer[qwBufferIdx + dwChIdx] * stHeaderInfo.vstChInfos[dwChIdx].lOrigMaxRange) / (float)stHeaderInfo.dwMaxADCValue; + } + + qwDataIdx++; + } + + // free buffer memory + delete[] pbyDataBuffer; + } + + return vpfChData; + } + +/* +************************************************************************** +SB6_ReadPureBinaryFileDigital +************************************************************************** +*/ + +vector <unsigned char*> SB6_ReadPureBinaryFileDigital (string sFilePath, HeaderInfo stHeaderInfo, uint64 qwLengthSamples, uint64 qwOffsetSamples) + { + char *pbyDataBuffer = NULL; + uint64 qwLengthPerCh = 0; + uint32 dwNumCh = 0; + uint32 dwDigitalGroup = 0; + + vector <unsigned char*> vpbyChData; + + ifstream oFileStream (sFilePath, ios::binary); + if (oFileStream.is_open ()) + { + // get number of channels from header file + dwNumCh = stHeaderInfo.dwNumDChannels; + dwDigitalGroup = dwNumCh / 8; + + // check number of available channel infos + if (dwNumCh > stHeaderInfo.vstChInfos.size ()) + return vpbyChData; + + // if length parameter is not set read complete data + if (qwLengthSamples > 0) + qwLengthPerCh = qwLengthSamples; + else + qwLengthPerCh = stHeaderInfo.qwLen; + + // calculate buffer size in bytes + uint64 qwBufferLength = dwDigitalGroup * qwLengthPerCh; + + // allocate buffer memory + pbyDataBuffer = new char[(size_t)qwBufferLength]; + + // allocate memory for each digital channel group + for (uint32 dwGroupIdx = 0; dwGroupIdx < dwDigitalGroup; dwGroupIdx++) + vpbyChData.push_back (new unsigned char[(size_t)qwLengthPerCh]); + + // set data offset + if (qwOffsetSamples > 0) + { + // calculate offset in bytes + uint64 qwOffsetBytes = dwDigitalGroup * qwOffsetSamples; + oFileStream.seekg (qwOffsetBytes, ios::beg); + } + + // read data from file + oFileStream.read (pbyDataBuffer, qwBufferLength); + + uint64 qwDataIdx = 0; + + for (uint64 qwBufferIdx = 0; qwBufferIdx < qwBufferLength; qwBufferIdx += dwDigitalGroup) + { + for (uint32 dwGroupIdx = 0; dwGroupIdx < dwDigitalGroup; dwGroupIdx++) + vpbyChData[dwGroupIdx][qwDataIdx] = pbyDataBuffer[qwBufferIdx + dwGroupIdx]; + + qwDataIdx++; + } + + // free buffer memory + delete[] pbyDataBuffer; + } + + return vpbyChData; + } + +/* +************************************************************************** +SB6_vClearChData +************************************************************************** +*/ + +void SB6_vClearChData (vector <float*> &vpfChData) + { + // free memory for each channel + for (uint32 dwChIdx = 0; dwChIdx < vpfChData.size (); dwChIdx++) + delete[] vpfChData[dwChIdx]; + + vpfChData.clear (); + } + +void SB6_vClearChData (vector <unsigned char*> &vpbyChData) + { + // free memory for each channel + for (uint32 dwChIdx = 0; dwChIdx < vpbyChData.size (); dwChIdx++) + delete[] vpbyChData[dwChIdx]; + + vpbyChData.clear (); + } diff --git a/Cpp/examples/c_cpp/sb6_read_purebinary/sb6_read_purebinary.h b/Cpp/examples/c_cpp/sb6_read_purebinary/sb6_read_purebinary.h new file mode 100644 index 0000000000000000000000000000000000000000..a52a01759342b33b122cfe7a659ae4e52ab5aa13 --- /dev/null +++ b/Cpp/examples/c_cpp/sb6_read_purebinary/sb6_read_purebinary.h @@ -0,0 +1,57 @@ +#ifndef SB6_READ_PUREBINARY_H +#define SB6_READ_PUREBINARY_H + +#include "../c_header/dlltyp.h" +#include <string> +#include <vector> + +struct ChannelInfo + { + std::string sName; + std::string sXUnit; + std::string sYUnit; + std::string sDescription; + double dMaxRange; + double dMinRange; + int32 lOrigMaxRange; + int32 lOrigMinRange; + int32 lUserOffset; + }; + +struct HeaderInfo + { + uint32 dwNumAChannels; + uint32 dwNumDChannels; + uint32 dwFileFlags; + uint32 dwDataEncoding; + uint32 dwChannelSorting; + uint32 dwTSSize; + uint32 dwRawDataFormat; + uint32 dwStoreDate; + uint32 dwStoreTime; + uint64 qwLen; + uint64 qwPost; + uint64 qwSegment; + uint32 dwPretrigger; + uint32 dwResolution; + int64 qwSamplerate; + uint64 qwTrigPos; + uint64 qwTrigDelay; + uint64 qwOffset; + uint32 dwFlags; + uint32 dwABADivider; + uint64 qwSlowABALen; + uint32 dwMaxADCValue; + uint32 dwTSRefClock; + uint32 dwOversamplingFactor; + int64 qwTSSamplerate; + std::vector <ChannelInfo> vstChInfos; + }; + +bool SB6_bReadPureBinaryHeaderInfos (std::string sHeaderFilePath, HeaderInfo &stHeaderInfo); +std::vector <float*> SB6_ReadPureBinaryFileAnalog (std::string sFilePath, HeaderInfo stHeaderInfo, uint64 qwLength = 0, uint64 qwOffset = 0); +std::vector <unsigned char*> SB6_ReadPureBinaryFileDigital (std::string sFilePath, HeaderInfo stHeaderInfo, uint64 qwLength = 0, uint64 qwOffset = 0); +void SB6_vClearChData (std::vector <float*> &vpfChData); +void SB6_vClearChData (std::vector <unsigned char*> &vpbyChData); + +#endif // SB6_READ_PUREBINARY_H \ No newline at end of file diff --git a/Cpp/examples/c_cpp/sb6_read_purebinary/sb6_read_purebinary.vcxproj b/Cpp/examples/c_cpp/sb6_read_purebinary/sb6_read_purebinary.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..ce6eb3118c4f36bb0a4c4efc2fc4d8aea8ca370e --- /dev/null +++ b/Cpp/examples/c_cpp/sb6_read_purebinary/sb6_read_purebinary.vcxproj @@ -0,0 +1,159 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{9DACF3ED-C24B-4358-B7F9-EC1F743B3254}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>sb6_read_purebinary</RootNamespace> + <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="Shared"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <SDLCheck>true</SDLCheck> + </ClCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <SDLCheck>true</SDLCheck> + </ClCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <SDLCheck>true</SDLCheck> + </ClCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <SDLCheck>true</SDLCheck> + </ClCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="sb6_read_purebinary.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="main.cpp" /> + <ClCompile Include="sb6_read_purebinary.cpp" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/sb6_read_purebinary/sb6_read_purebinary.vcxproj.filters b/Cpp/examples/c_cpp/sb6_read_purebinary/sb6_read_purebinary.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..bccbfadcb78ca33f44796d70a14538ef7f1409bc --- /dev/null +++ b/Cpp/examples/c_cpp/sb6_read_purebinary/sb6_read_purebinary.vcxproj.filters @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Header Files"> + <UniqueIdentifier>{1d2a8ca8-ca05-4109-80da-f4b36ee0b5e6}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files"> + <UniqueIdentifier>{69ed0e95-4cc3-4fe7-89d2-328fdb97a9d3}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="sb6_read_purebinary.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="sb6_read_purebinary.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="main.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/simple_rec_fifo/makefile b/Cpp/examples/c_cpp/simple_rec_fifo/makefile new file mode 100644 index 0000000000000000000000000000000000000000..484d8a5a75f526c1e3635cd977f798446bd073ce --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rec_fifo/makefile @@ -0,0 +1,21 @@ +COMPILER = g++ +EXECUTABLE = simple_rec_fifo +LIBS += -lspcm_linux -lpthread -lrt + +OBJECTS = simple_rec_fifo.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/simple_rec_fifo/simple_rec_fifo.cpp b/Cpp/examples/c_cpp/simple_rec_fifo/simple_rec_fifo.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bbc96b86283b0471d781f7b525d0b7757a409d86 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rec_fifo/simple_rec_fifo.cpp @@ -0,0 +1,216 @@ +/* +************************************************************************** + +simple_rec_fifo.cpp (c) Spectrum GmbH + +************************************************************************** + +Example for all SpcMDrv based analog acquisition cards. + +Information about the different products and their drivers can be found +online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/platform-driver-and-series-differences + +Shows a simple FIFO mode example using only the few necessary commands + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +#include "../common/ostools/spcm_oswrap.h" +#include "../common/ostools/spcm_ostools.h" + +// ----- standard c include files ----- +#include <stdio.h> +#include <stdlib.h> + + +/* +************************************************************************** +szTypeToName: doing name translation +************************************************************************** +*/ + +char* szTypeToName (int32 lCardType) + { + static char szName[50]; + switch (lCardType & TYP_SERIESMASK) + { + case TYP_M2ISERIES: sprintf (szName, "M2i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M2IEXPSERIES: sprintf (szName, "M2i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M3ISERIES: sprintf (szName, "M3i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M3IEXPSERIES: sprintf (szName, "M3i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M4IEXPSERIES: sprintf (szName, "M4i.%04x-x8", lCardType & TYP_VERSIONMASK); break; + case TYP_M4XEXPSERIES: sprintf (szName, "M4x.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M2PEXPSERIES: sprintf (szName, "M2p.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M5IEXPSERIES: sprintf (szName, "M5i.%04x-x16", lCardType & TYP_VERSIONMASK); break; + default: sprintf (szName, "unknown type"); break; + } + return szName; + } + + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + drv_handle hCard; + int32 lCardType, lSerialNumber, lFncType; + int16* pnData; + char szErrorTextBuffer[ERRORTEXTLEN]; + uint32 dwError; + int32 lStatus; + int64 llAvailUser, llPCPos; + uint64 qwTotalMem = 0; + uint64 qwToTransfer = MEGA_B(64); + + // settings for the FIFO mode buffer handling + int64 llBufferSize = MEGA_B(4); + int32 lNotifySize = KILO_B(16); + + + // open card + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + hCard = spcm_hOpen ("/dev/spcm0"); + // hCard = spcm_hOpen ("TCPIP::192.168.1.10::inst0::INSTR"); + if (!hCard) + { + printf ("no card found...\n"); + return 0; + } + + + // read type, function and sn and check for A/D card + spcm_dwGetParam_i32 (hCard, SPC_PCITYP, &lCardType); + spcm_dwGetParam_i32 (hCard, SPC_PCISERIALNO, &lSerialNumber); + spcm_dwGetParam_i32 (hCard, SPC_FNCTYPE, &lFncType); + + switch (lFncType) + { + case SPCM_TYPE_AI: + printf ("Found: %s sn %05d\n", szTypeToName (lCardType), lSerialNumber); + break; + + default: + printf ("Card: %s sn %05d not supported by example\n", szTypeToName (lCardType), lSerialNumber); + return 0; + } + + + // do a simple standard setup + spcm_dwSetParam_i32 (hCard, SPC_CHENABLE, CHANNEL0); // just 1 channel enabled + spcm_dwSetParam_i32 (hCard, SPC_PRETRIGGER, 1024); // 1k of pretrigger data at start of FIFO mode + spcm_dwSetParam_i32 (hCard, SPC_CARDMODE, SPC_REC_FIFO_SINGLE); // single FIFO mode + spcm_dwSetParam_i32 (hCard, SPC_TIMEOUT, 5000); // timeout 5 s + spcm_dwSetParam_i32 (hCard, SPC_TRIG_ORMASK, SPC_TMASK_SOFTWARE); // trigger set to software + spcm_dwSetParam_i32 (hCard, SPC_TRIG_ANDMASK, 0); // ... + spcm_dwSetParam_i32 (hCard, SPC_CLOCKMODE, SPC_CM_INTPLL); // clock mode internal PLL + + // we try to set the samplerate to 100 kHz (M2i) or 20 MHz (M3i and M4i) on internal PLL, no clock output + if (((lCardType & TYP_SERIESMASK) == TYP_M2ISERIES) || ((lCardType & TYP_SERIESMASK) == TYP_M2IEXPSERIES)) + spcm_dwSetParam_i64 (hCard, SPC_SAMPLERATE, KILO(100)); + if ((lCardType & TYP_SERIESMASK) == TYP_M2PEXPSERIES) + spcm_dwSetParam_i64 (hCard, SPC_SAMPLERATE, MEGA(10)); + else + spcm_dwSetParam_i64 (hCard, SPC_SAMPLERATE, MEGA(20)); + + spcm_dwSetParam_i32 (hCard, SPC_CLOCKOUT, 0); // no clock output + + + // define the data buffer + pnData = (int16*) pvAllocMemPageAligned ((uint64) llBufferSize); + if (!pnData) + { + printf ("memory allocation failed\n"); + spcm_vClose (hCard); + return 0; + } + + spcm_dwDefTransfer_i64 (hCard, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, lNotifySize, pnData, 0, llBufferSize); + + // start everything + dwError = spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_DATA_STARTDMA); + + + // check for error + if (dwError != ERR_OK) + { + spcm_dwGetErrorInfo_i32 (hCard, NULL, NULL, szErrorTextBuffer); + printf ("%s\n", szErrorTextBuffer); + vFreeMemPageAligned (pnData, (uint64) llBufferSize); + spcm_vClose (hCard); + return 0; + } + + + // run the FIFO mode and loop through the data + else + { + while (qwTotalMem < qwToTransfer) + { + if ((dwError = spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_DATA_WAITDMA)) != ERR_OK) + { + if (dwError == ERR_TIMEOUT) + printf ("... Timeout\n"); + else + printf ("... Error: %d\n", dwError); + break; + } + + else + { + spcm_dwGetParam_i32 (hCard, SPC_M2STATUS, &lStatus); + spcm_dwGetParam_i64 (hCard, SPC_DATA_AVAIL_USER_LEN, &llAvailUser); + spcm_dwGetParam_i64 (hCard, SPC_DATA_AVAIL_USER_POS, &llPCPos); + + if (llAvailUser >= lNotifySize) + { + qwTotalMem += lNotifySize; + printf ("Stat:%08x Pos:%016llx Avail:%016llx Total:%.2fMB\n", lStatus, llPCPos, llAvailUser, (double) (int64) qwTotalMem / MEGA_B(1)); + + // this is the point to do anything with the data + + spcm_dwSetParam_i32 (hCard, SPC_DATA_AVAIL_CARD_LEN, lNotifySize); + } + + // check for esape = abort + if (bKbhit ()) + if (cGetch () == 27) + break; + } + } + } + + + // send the stop command + dwError = spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_CARD_STOP | M2CMD_DATA_STOPDMA); + + // clean up + printf ("Finished...\n"); + vFreeMemPageAligned (pnData, (uint64) llBufferSize); + spcm_vClose (hCard); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/simple_rec_fifo/simple_rec_fifo.sln b/Cpp/examples/c_cpp/simple_rec_fifo/simple_rec_fifo.sln new file mode 100644 index 0000000000000000000000000000000000000000..4553684ea7d101f72bab59558f293ab329cf89ea --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rec_fifo/simple_rec_fifo.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simple_rec_fifo", "simple_rec_fifo.vcproj", "{AB068386-BB5C-4442-ACFF-B5D9A79C311A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|Win32.ActiveCfg = Debug|Win32 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|Win32.Build.0 = Debug|Win32 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|x64.ActiveCfg = Debug|x64 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|x64.Build.0 = Debug|x64 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|Win32.ActiveCfg = Release|Win32 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|Win32.Build.0 = Release|Win32 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|x64.ActiveCfg = Release|x64 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Cpp/examples/c_cpp/simple_rec_fifo/simple_rec_fifo.vcproj b/Cpp/examples/c_cpp/simple_rec_fifo/simple_rec_fifo.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..6706887f7cc4d194ecf81a3c4072f26a0b39be4c --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rec_fifo/simple_rec_fifo.vcproj @@ -0,0 +1,496 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="simple_rec_fifo" + ProjectGUID="{AB068386-BB5C-4442-ACFF-B5D9A79C311A}" + RootNamespace="simple_rec_fifo" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/simple_rec_fifo.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/simple_rec_fifo.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/simple_rec_fifo.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/simple_rec_fifo.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/simple_rec_fifo.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/simple_rec_fifo.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/simple_rec_fifo.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/simple_rec_fifo.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/simple_rec_fifo.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/simple_rec_fifo.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/simple_rec_fifo.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/simple_rec_fifo.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/simple_rec_fifo.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/simple_rec_fifo.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/simple_rec_fifo.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/simple_rec_fifo.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/simple_rec_fifo.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/simple_rec_fifo.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/simple_rec_fifo.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/simple_rec_fifo.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="header" + Filter="h;hpp;hxx;hm;inl" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_oswrap.h" + > + </File> + </Filter> + <File + RelativePath="simple_rec_fifo.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/simple_rec_fifo/simple_rec_fifo.vcxproj b/Cpp/examples/c_cpp/simple_rec_fifo/simple_rec_fifo.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..4761a2306226f60213bff7fa1aa596496225dccc --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rec_fifo/simple_rec_fifo.vcxproj @@ -0,0 +1,262 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{AB068386-BB5C-4442-ACFF-B5D9A79C311A}</ProjectGuid> + <RootNamespace>simple_rec_fifo</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/simple_rec_fifo.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/simple_rec_fifo.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/simple_rec_fifo.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/simple_rec_fifo.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/simple_rec_fifo.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/simple_rec_fifo.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/simple_rec_fifo.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/simple_rec_fifo.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/simple_rec_fifo.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/simple_rec_fifo.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/simple_rec_fifo.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/simple_rec_fifo.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/simple_rec_fifo.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/simple_rec_fifo.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/simple_rec_fifo.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/simple_rec_fifo.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="simple_rec_fifo.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/simple_rec_fifo/simple_rec_fifo.vcxproj.filters b/Cpp/examples/c_cpp/simple_rec_fifo/simple_rec_fifo.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..dcec4bbd4f27276ec712c33e2e77c5ed566e939f --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rec_fifo/simple_rec_fifo.vcxproj.filters @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="header"> + <UniqueIdentifier>{f679fc55-3bd3-4f11-b75f-80c27acab2b4}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_oswrap.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="simple_rec_fifo.cpp" /> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib" /> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib" /> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/simple_rec_fifo_software_average/makefile b/Cpp/examples/c_cpp/simple_rec_fifo_software_average/makefile new file mode 100644 index 0000000000000000000000000000000000000000..ca4295fc98a1a00f5e0c12c0eac9760ca37096a7 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rec_fifo_software_average/makefile @@ -0,0 +1,21 @@ +COMPILER = g++ +EXECUTABLE = simple_rec_fifo_software_average +LIBS += -lspcm_linux -lpthread -lrt + +OBJECTS = simple_rec_fifo_software_average.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/simple_rec_fifo_software_average/simple_rec_fifo_software_average.cpp b/Cpp/examples/c_cpp/simple_rec_fifo_software_average/simple_rec_fifo_software_average.cpp new file mode 100644 index 0000000000000000000000000000000000000000..918baf0dfc3090d7940d5eef0c719eba951ca18c --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rec_fifo_software_average/simple_rec_fifo_software_average.cpp @@ -0,0 +1,392 @@ +/* +************************************************************************** + +simple_rec_fifo_software_average (c) Spectrum GmbH + +************************************************************************** + +Example for Spectrum M4i analog acquisition cards to show software based +block average. The example is build for a M4i.2230-x8, a 1 channel +5 GS/s 8 Bit digitizer. + +The test parameter section allows to define the different test settings +and handles multi-thread averaging as well as single-thread averaging +For running this example an external trigger source in the region of +1 to 2 kHz is needed. + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +#include "../common/ostools/spcm_oswrap.h" +#include "../common/ostools/spcm_ostools.h" + +// ----- standard c include files ----- +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + + +/* +************************************************************************** +Test Parameters +************************************************************************** +*/ + +const bool bThreads = true; // test the thread based version +const int32 lThreads = 4; // number of threads to split the average to +const int32 lSegmentsize = KILO_B(1024); // segment size per trigger +const int32 lNumSegments = 1; // number of segments per interrupt +const int32 lAverageLoop = 1000; // number of averages (summations) + + + + +/* +************************************************************************** +szTypeToName: doing name translation +************************************************************************** +*/ + +char* szTypeToName (int32 lCardType) + { + static char szName[50]; + switch (lCardType & TYP_SERIESMASK) + { + case TYP_M2ISERIES: sprintf (szName, "M2i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M2IEXPSERIES: sprintf (szName, "M2i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M3ISERIES: sprintf (szName, "M3i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M3IEXPSERIES: sprintf (szName, "M3i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M4IEXPSERIES: sprintf (szName, "M4i.%04x-x8", lCardType & TYP_VERSIONMASK); break; + case TYP_M4XEXPSERIES: sprintf (szName, "M4x.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M2PEXPSERIES: sprintf (szName, "M2p.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M5IEXPSERIES: sprintf (szName, "M5i.%04x-x16", lCardType & TYP_VERSIONMASK); break; + default: sprintf (szName, "unknown type"); break; + } + return szName; + } + + +/* +************************************************************************** +bKeyCheckAsync: faster than kbhit() +************************************************************************** +*/ +int g_nKeyPress; +bool bKeyCheckAsync () + { +#ifdef WIN32 + return (g_nKeyPress != GetAsyncKeyState(VK_ESCAPE)); +#endif + } + + +/* +************************************************************************** +thread structúre and thread for average +************************************************************************** +*/ + +typedef struct + { + bool bRunNotQuit; // controls whether the thread is running or should stop + int8* pbyData; // pointer to the data buffer + int64 llCurDataPos; // current position of next available data inside the buffer + int32* plAverageData; // pointer to average (summation) buffer + int32 lSegmentsize; // size of complete average segment + int32 lStartOffset; // start position inside segment that the thread is handling + int32 lAveragesize; // size of average data that is handled by this thread + int32 lNumSegments; // number of sequencing segments that should be handled in one run + SPCM_EVENT_HANDLE hStart; // received event to start calculation + SPCM_EVENT_HANDLE hEnd; // transmitted event after end of calculation + SPCM_THREAD_HANDLE hThread; // thread handle + } SPCM_AVERAGE_DATA; + +// *********************************************************************** + +SPCM_THREAD_RETURN SPCM_THREAD_CALLTYPE pvAverageSegmentPart (void* pvArguments) + { + SPCM_AVERAGE_DATA* pstData = (SPCM_AVERAGE_DATA*) pvArguments; + int32 i, j; + int32 lStart; + int32 lEnd; + int32 lNumSegments = pstData->lNumSegments; + int32* plAverageData = pstData->plAverageData; + int8* pbyData = pstData->pbyData; + + while (pstData->bRunNotQuit) + { + spcm_vWaitEvent (&pstData->hStart); + + for (j=0; j<lNumSegments; j++) + { + lStart = j * pstData->lSegmentsize + pstData->lStartOffset; + lEnd = pstData->lStartOffset + pstData->lAveragesize; + + for (i=lStart; i < lEnd; i++) + plAverageData[i] += (int32) pbyData[i]; + } + + spcm_vSignalEvent (&pstData->hEnd); + } + + return 0; + } + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + drv_handle hCard; + int32 lCardType, lSerialNumber, lFncType; + int8* pbyData; + int32* plAverageData; + int32* plStorageData; + char szErrorTextBuffer[ERRORTEXTLEN]; + uint32 dwError; + int32 lStatus; + int64 llAvailUser, llPCPos; + int32 lFillsize; + uint64 qwTotalMem = 0; + int32 i, j; + + // FIFO mode buffer handling + int32 lNotifySize = lSegmentsize * lNumSegments; + int64 llBufferSize = lNotifySize * 16; // software (DMA) buffer size + int32 lSegmentCount = 0; // number of segments acquired so far + int32 lAverageCount = 0; // current average + + // settings for the average threads + SPCM_AVERAGE_DATA stAverageData[lThreads]; + + // ------------------------------------------------- + // open card + hCard = spcm_hOpen ("/dev/spcm0"); + if (!hCard) + { + printf ("no card found...\n"); + return 0; + } + + // read type, function and sn and check for correct /D card + spcm_dwGetParam_i32 (hCard, SPC_PCITYP, &lCardType); + spcm_dwGetParam_i32 (hCard, SPC_PCISERIALNO, &lSerialNumber); + spcm_dwGetParam_i32 (hCard, SPC_FNCTYPE, &lFncType); + + switch (lFncType) + { + case SPCM_TYPE_AI: + printf ("Found: %s sn %05d\n", szTypeToName (lCardType), lSerialNumber); + switch (lCardType & TYP_VERSIONMASK) + { + case 0x2230: + case 0x2233: + case 0x2234: + break; + + default: + printf ("The example is set up for the M4i.223x cards and runs with 1 channel 5 GS/s 8 bit. For other digitizers the example settings have to be adopted\n"); + return 0; + } + break; + + default: + printf ("Card: %s sn %05d not supported by example\n", szTypeToName (lCardType), lSerialNumber); + return 0; + } + + + // ------------------------------------------------- + // define the data buffers + pbyData = (int8*) pvAllocMemPageAligned ((uint64) llBufferSize); + plAverageData = (int32*) pvAllocMemPageAligned ((uint64) lSegmentsize * sizeof(int32)); + plStorageData = (int32*) pvAllocMemPageAligned ((uint64) lSegmentsize * sizeof(int32)); + if (!pbyData || !plAverageData || !plStorageData) + { + printf ("memory allocation failed\n"); + spcm_vClose (hCard); + return 0; + } + memset ((void*) plAverageData, 0, lSegmentsize * sizeof(int32)); + + // ------------------------------------------------- + // set up the average threads + for (i=0; i<lThreads; i++) + { + stAverageData[i].bRunNotQuit = true; + stAverageData[i].lNumSegments = lNumSegments; + stAverageData[i].lAveragesize = lSegmentsize / lThreads; + stAverageData[i].lSegmentsize = lSegmentsize; + stAverageData[i].lStartOffset = i * stAverageData[i].lAveragesize; + stAverageData[i].pbyData = pbyData; + stAverageData[i].plAverageData = plAverageData; + spcm_bCreateEvent (&stAverageData[i].hStart); + spcm_bCreateEvent (&stAverageData[i].hEnd); + spcm_bCreateThread (pvAverageSegmentPart, &stAverageData[i].hThread, (void*) &stAverageData[i]); + } + + + // ------------------------------------------------- + // do a simple standard setup + spcm_dwSetParam_i32 (hCard, SPC_CHENABLE, CHANNEL0); // just 1 channel enabled + + spcm_dwSetParam_i32 (hCard, SPC_CARDMODE, SPC_REC_FIFO_MULTI); // single FIFO mode + spcm_dwSetParam_i32 (hCard, SPC_LOOPS, 0); // endless + spcm_dwSetParam_i32 (hCard, SPC_SEGMENTSIZE, lSegmentsize); // 1k of pretrigger data at start of FIFO mode + spcm_dwSetParam_i32 (hCard, SPC_POSTTRIGGER, lSegmentsize - 32); // 32 samples pretrigger data for each segment + spcm_dwSetParam_i32 (hCard, SPC_TIMEOUT, 5000); // timeout 5 s + + spcm_dwSetParam_i32 (hCard, SPC_TRIG_ORMASK, SPC_TMASK_EXT0); // trigger set to external input Ext0 + spcm_dwSetParam_i32 (hCard, SPC_TRIG_ANDMASK, 0); // ... + spcm_dwSetParam_i32 (hCard, SPC_TRIG_EXT0_MODE, SPC_TM_POS); // ... + spcm_dwSetParam_i32 (hCard, SPC_TRIG_EXT0_LEVEL0, 1000); // level set to 1000 mV + + spcm_dwSetParam_i32 (hCard, SPC_CLOCKMODE, SPC_CM_INTPLL); // clock mode internal PLL + spcm_dwSetParam_i64 (hCard, SPC_SAMPLERATE, MEGA (2500)); // 5 GS/s + spcm_dwSetParam_i32 (hCard, SPC_CLOCKOUT, 0); // no clock output + + spcm_dwDefTransfer_i64 (hCard, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, lNotifySize, pbyData, 0, llBufferSize); + + // start everything + dwError = spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_DATA_STARTDMA); + + + // check for error + if (dwError != ERR_OK) + { + spcm_dwGetErrorInfo_i32 (hCard, NULL, NULL, szErrorTextBuffer); + printf ("%s\n", szErrorTextBuffer); + vFreeMemPageAligned (pbyData, (uint64) llBufferSize); + spcm_vClose (hCard); + return 0; + } + + + // ------------------------------------------------- + // run the FIFO mode and loop through the data + while (1) + { + + // wait for interrupt and check on error + if ((dwError = spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_DATA_WAITDMA)) != ERR_OK) + { + if (dwError == ERR_TIMEOUT) + printf ("... Timeout\n"); + else + printf ("... Error: %d\n", dwError); + break; + } + + // -------------------------------------------------------------------------- + // we have new data available + else + { + spcm_dwGetParam_i32 (hCard, SPC_M2STATUS, &lStatus); + spcm_dwGetParam_i64 (hCard, SPC_DATA_AVAIL_USER_LEN, &llAvailUser); + spcm_dwGetParam_i64 (hCard, SPC_DATA_AVAIL_USER_POS, &llPCPos); + if (lStatus & M2STAT_DATA_OVERRUN) + { + printf ("\nOverrun!!!\n"); + break; + } + + if (llAvailUser >= lNotifySize) + { + qwTotalMem += lNotifySize; + lSegmentCount += lNumSegments; + lAverageCount += lNumSegments; + + + // -------------------------------------------------------------------------- + // summation loop inline + if (!bThreads) + { + for (j=0; j < lNumSegments; j++) + for (i=0; i < lSegmentsize; i++) + plAverageData[i] += (int32) pbyData[llPCPos + i]; + } + + // summation loop thread based + else + { + for (i=0; i < lThreads; i++) + { + stAverageData[i].llCurDataPos = llPCPos; + spcm_vSignalEvent (&stAverageData[i].hStart); + } + for (i=0; i<lThreads; i++) + spcm_vWaitEvent (&stAverageData[i].hEnd); + } + + // -------------------------------------------------------------------------- + // avarage loop reached loop: store data + if (lAverageCount >= lAverageLoop) + { + + // copy average buffer and clear it for next loop + lAverageCount = 0; + memcpy ((void*) plStorageData, (void*) plAverageData, lSegmentsize * sizeof(int32)); + memset ((void*) plAverageData, 0, lSegmentsize * sizeof(int32)); + + // read out buffer fillsize and print it + spcm_dwGetParam_i32 (hCard, SPC_FILLSIZEPROMILLE, &lFillsize); + printf ("Stat:%08x Segments:%d Fillesize = %4d%%%% Total:%.2fMB\n", lStatus, lSegmentCount, lFillsize, (double) (int64) qwTotalMem / MEGA_B(1)); + } + + // free the buffer + spcm_dwSetParam_i32 (hCard, SPC_DATA_AVAIL_CARD_LEN, lNotifySize); + } + + // check for esape = abort +#ifdef WIN32 + if (bKeyCheckAsync()) +#else + if (bKbhit ()) +#endif + if (cGetch () == 27) + break; + } + } + + // send the stop command + dwError = spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_CARD_STOP | M2CMD_DATA_STOPDMA); + + // clean up the average threads + for (i=0; i<lThreads; i++) + { + stAverageData[i].bRunNotQuit = false; + spcm_vSignalEvent (&stAverageData[i].hStart); + spcm_vWaitEvent (&stAverageData[i].hEnd); + spcm_vJoinThread (&stAverageData[i].hThread, 100); + spcm_vCloseThread (&stAverageData[i].hThread); + } + + // clean up memory + printf ("Finished...\n"); + vFreeMemPageAligned (pbyData, (uint64) llBufferSize); + vFreeMemPageAligned (plAverageData, (uint64) lSegmentsize * sizeof(int32)); + vFreeMemPageAligned (plStorageData, (uint64) lSegmentsize * sizeof(int32)); + spcm_vClose (hCard); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/simple_rec_fifo_software_average/simple_rec_fifo_software_average.sln b/Cpp/examples/c_cpp/simple_rec_fifo_software_average/simple_rec_fifo_software_average.sln new file mode 100644 index 0000000000000000000000000000000000000000..b00ed70497755c81f7a3728295a32326892b90a8 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rec_fifo_software_average/simple_rec_fifo_software_average.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simple_rec_fifo_software_average", "simple_rec_fifo_software_average.vcproj", "{AB068386-BB5C-4442-ACFF-B5D9A79C311A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|Win32.ActiveCfg = Debug|Win32 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|Win32.Build.0 = Debug|Win32 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|x64.ActiveCfg = Debug|x64 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|x64.Build.0 = Debug|x64 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|Win32.ActiveCfg = Release|Win32 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|Win32.Build.0 = Release|Win32 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|x64.ActiveCfg = Release|x64 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Cpp/examples/c_cpp/simple_rec_fifo_software_average/simple_rec_fifo_software_average.vcproj b/Cpp/examples/c_cpp/simple_rec_fifo_software_average/simple_rec_fifo_software_average.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..8ada8cbb0909a4236cb3cc2db64c04381e989e68 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rec_fifo_software_average/simple_rec_fifo_software_average.vcproj @@ -0,0 +1,502 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="simple_rec_fifo_software_average" + ProjectGUID="{AB068386-BB5C-4442-ACFF-B5D9A79C311A}" + RootNamespace="simple_rec_fifo_software_average" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/simple_rec_fifo_software_average.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + EnableIntrinsicFunctions="true" + FavorSizeOrSpeed="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + EnableEnhancedInstructionSet="2" + PrecompiledHeaderFile=".\Release/simple_rec_fifo_software_average.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/simple_rec_fifo_software_average.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/simple_rec_fifo_software_average.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/simple_rec_fifo_software_average.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/simple_rec_fifo_software_average.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/simple_rec_fifo_software_average.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/simple_rec_fifo_software_average.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/simple_rec_fifo_software_average.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/simple_rec_fifo_software_average.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/simple_rec_fifo_software_average.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + EnableIntrinsicFunctions="true" + FavorSizeOrSpeed="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + EnableEnhancedInstructionSet="2" + PrecompiledHeaderFile=".\Release/simple_rec_fifo_software_average.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/simple_rec_fifo_software_average.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/simple_rec_fifo_software_average.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/simple_rec_fifo_software_average.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/simple_rec_fifo_software_average.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/simple_rec_fifo_software_average.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/simple_rec_fifo_software_average.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/simple_rec_fifo_software_average.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/simple_rec_fifo_software_average.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="header" + Filter="h;hpp;hxx;hm;inl" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_oswrap.h" + > + </File> + </Filter> + <File + RelativePath="simple_rec_fifo_software_average.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/simple_rec_fifo_software_average/simple_rec_fifo_software_average.vcxproj b/Cpp/examples/c_cpp/simple_rec_fifo_software_average/simple_rec_fifo_software_average.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..9be497314be5fa1700b38c016f4b152653792d7f --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rec_fifo_software_average/simple_rec_fifo_software_average.vcxproj @@ -0,0 +1,268 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{AB068386-BB5C-4442-ACFF-B5D9A79C311A}</ProjectGuid> + <RootNamespace>simple_rec_fifo_software_average</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/simple_rec_fifo_software_average.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet> + <PrecompiledHeaderOutputFile>.\Release/simple_rec_fifo_software_average.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/simple_rec_fifo_software_average.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/simple_rec_fifo_software_average.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/simple_rec_fifo_software_average.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/simple_rec_fifo_software_average.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/simple_rec_fifo_software_average.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/simple_rec_fifo_software_average.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/simple_rec_fifo_software_average.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet> + <PrecompiledHeaderOutputFile>.\Release/simple_rec_fifo_software_average.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/simple_rec_fifo_software_average.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/simple_rec_fifo_software_average.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/simple_rec_fifo_software_average.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/simple_rec_fifo_software_average.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/simple_rec_fifo_software_average.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/simple_rec_fifo_software_average.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="simple_rec_fifo_software_average.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/simple_rec_fifo_software_average/simple_rec_fifo_software_average.vcxproj.filters b/Cpp/examples/c_cpp/simple_rec_fifo_software_average/simple_rec_fifo_software_average.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..c9e7945491d6fe549c1ec90b11ee7769db44222d --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rec_fifo_software_average/simple_rec_fifo_software_average.vcxproj.filters @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="header"> + <UniqueIdentifier>{f1800eee-469d-4d52-88fc-c8aabc57fd31}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_oswrap.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="simple_rec_fifo_software_average.cpp" /> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib" /> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib" /> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/simple_rec_segment_statistic/makefile b/Cpp/examples/c_cpp/simple_rec_segment_statistic/makefile new file mode 100644 index 0000000000000000000000000000000000000000..82d3a3690805966d31bbcd7b8e98d79e42994407 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rec_segment_statistic/makefile @@ -0,0 +1,21 @@ +COMPILER = g++ +EXECUTABLE = simple_rec_segment_statistic +LIBS += -lspcm_linux -lpthread -lrt + +OBJECTS = simple_rec_segment_statistic.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/simple_rec_segment_statistic/simple_rec_segment_statistic.cpp b/Cpp/examples/c_cpp/simple_rec_segment_statistic/simple_rec_segment_statistic.cpp new file mode 100644 index 0000000000000000000000000000000000000000..402deb44f9c98eb0b388b59eb17d7cb92e84c69c --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rec_segment_statistic/simple_rec_segment_statistic.cpp @@ -0,0 +1,263 @@ +/* +************************************************************************** + +simple_rec_segment_statistic.cpp (c) Spectrum GmbH + +************************************************************************** + +Example for all M4i analog acquisition cards. +Shows a simple segment statistic example +using only a few necessary commands. + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +#include "../common/ostools/spcm_oswrap.h" +#include "../common/ostools/spcm_ostools.h" + +// ----- standard c include files ----- +#include <stdio.h> +#include <stdlib.h> + + +/* +************************************************************************** +szTypeToName: doing name translation +************************************************************************** +*/ + +char* szTypeToName (int32 lCardType) + { + static char szName[50]; + switch (lCardType & TYP_SERIESMASK) + { + case TYP_M2ISERIES: sprintf (szName, "M2i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M2IEXPSERIES: sprintf (szName, "M2i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M3ISERIES: sprintf (szName, "M3i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M3IEXPSERIES: sprintf (szName, "M3i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M4IEXPSERIES: sprintf (szName, "M4i.%04x-x8", lCardType & TYP_VERSIONMASK); break; + case TYP_M4XEXPSERIES: sprintf (szName, "M4x.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M2PEXPSERIES: sprintf (szName, "M2p.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M5IEXPSERIES: sprintf (szName, "M5i.%04x-x16", lCardType & TYP_VERSIONMASK); break; + default: sprintf (szName, "unknown type"); break; + } + return szName; + } + + +// define structures for more easy data access +typedef struct + { + SPCM_SEGSTAT_STRUCT_CHx pst_Channel[4]; + } SPCM_SEGSTAT_STRUCT_4CH; + +typedef struct + { + SPCM_SEGSTAT_STRUCT_CHx pst_Channel[2]; + } SPCM_SEGSTAT_STRUCT_2CH; + +typedef struct + { + SPCM_SEGSTAT_STRUCT_CHx pst_Channel[1]; + } SPCM_SEGSTAT_STRUCT_1CH; + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + drv_handle hCard; + int32 lCardType, lSerialNumber, lFncType, lFeatMask; + int32 lMaxChannels, lChannelMask; + int64 llMaxSamplerate; + char szErrorTextBuffer[ERRORTEXTLEN]; + uint32 dwError; + + // open card + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + hCard = spcm_hOpen ("/dev/spcm0"); + // hCard = spcm_hOpen ("TCPIP::192.168.1.10::inst0::INSTR"); + if (!hCard) + { + printf ("no card found...\n"); + return 0; + } + + // read type, function and sn and check for A/D card + spcm_dwGetParam_i32 (hCard, SPC_PCITYP, &lCardType); + spcm_dwGetParam_i32 (hCard, SPC_PCISERIALNO, &lSerialNumber); + spcm_dwGetParam_i32 (hCard, SPC_FNCTYPE, &lFncType); + + switch (lFncType) + { + case SPCM_TYPE_AI: + printf ("Found: %s sn %05d\n", szTypeToName (lCardType), lSerialNumber); + break; + + default: + printf ("Card: %s sn %05d not supported by example\n", szTypeToName (lCardType), lSerialNumber); + return 0; + } + + // check for necessary segment statistic feature + spcm_dwGetParam_i32 (hCard, SPC_PCIEXTFEATURES, &lFeatMask); + if ((lFeatMask & SPCM_FEAT_EXTFW_SEGSTAT) == 0) + { + printf ("This example requires segment statistic feature installed \n"); + spcm_vClose (hCard); + return 0; + } + + + // do a simple standard setup + uint32 dwSegmentsize = KILO_B(4); // define length of each segment + uint32 dwPosttrigger = KILO_B(2); // define samples as posttrigger + uint32 dwNumOfSegments = 16; // number of segments to record + + spcm_dwSetParam_i32 (hCard, SPC_SEGMENTSIZE, dwSegmentsize); + spcm_dwSetParam_i32 (hCard, SPC_POSTTRIGGER, dwPosttrigger); + + // (all data resides in on-board memory, no streaming) + spcm_dwSetParam_i32 (hCard, SPC_MEMSIZE, dwSegmentsize * dwNumOfSegments); + + // enable all available channels + spcm_dwGetParam_i32 (hCard, SPC_MIINST_CHPERMODULE, &lMaxChannels); + lChannelMask = ((int32) 1 << lMaxChannels) - 1; + spcm_dwSetParam_i32 (hCard, SPC_CHENABLE, lChannelMask); + + // use segment statistic mode, timeout set to 5s + spcm_dwSetParam_i32 (hCard, SPC_CARDMODE, SPC_REC_STD_SEGSTATS); + spcm_dwSetParam_i32 (hCard, SPC_TIMEOUT, 5000); + + // disable external triggers + spcm_dwSetParam_i32 (hCard, SPC_TRIG_ORMASK, 0); + spcm_dwSetParam_i32 (hCard, SPC_TRIG_ANDMASK, 0); + + // enable channel trigger + int32 lTriggerChannel = 0; + spcm_dwSetParam_i32 (hCard, SPC_TRIG_CH_ORMASK0, (SPC_TMASK0_CH0 << lTriggerChannel)); + spcm_dwSetParam_i32 (hCard, SPC_TRIG_CH_ANDMASK0, 0); + spcm_dwSetParam_i32 (hCard, SPC_TRIG_CH0_MODE + lTriggerChannel, SPC_TM_NEG); + + // set up maximum available sample rate, no clock output + spcm_dwGetParam_i64 (hCard, SPC_MIINST_MAXADCLOCK, &llMaxSamplerate); + spcm_dwSetParam_i32 (hCard, SPC_CLOCKMODE, SPC_CM_INTPLL); + spcm_dwSetParam_i64 (hCard, SPC_SAMPLERATE, llMaxSamplerate); + spcm_dwSetParam_i32 (hCard, SPC_CLOCKOUT, 0); + + // set timestamp to start reset + spcm_dwSetParam_i32 (hCard, SPC_TIMESTAMP_CMD, SPC_TSMODE_STARTRESET); + + + + // settings for the buffer handling + int64 llBufferSize = sizeof (SPCM_SEGSTAT_STRUCT_CHx) * lMaxChannels * dwNumOfSegments; + + // define the data buffer + void* pvData = (void*) pvAllocMemPageAligned ((uint64) llBufferSize); + + // check for memory allocation errors + if (!pvData) + { + printf ("memory allocation failed\n"); + spcm_vClose (hCard); + return 0; + } + + + + // start the acquisition + dwError = spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_CARD_WAITREADY); + + // check for error + if (dwError != ERR_OK) + { + spcm_dwGetErrorInfo_i32 (hCard, NULL, NULL, szErrorTextBuffer); + printf ("%s\n", szErrorTextBuffer); + vFreeMemPageAligned (pvData, (uint64) llBufferSize); + spcm_vClose (hCard); + return 0; + } + + + + // set up and start data transfer + spcm_dwDefTransfer_i64 (hCard, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, 0, pvData , 0, llBufferSize); + spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA); + + + // cast and printout data (depending on active channels to structure to get more easy access) + if (lMaxChannels == 1) + { + SPCM_SEGSTAT_STRUCT_1CH* ppstData = (SPCM_SEGSTAT_STRUCT_1CH*) pvData; + + // read out data of every segment (one channel only to keep things simple) + for (uint32 dwSegment = 0; dwSegment < dwNumOfSegments; dwSegment++) + { + printf("\nSegment %.2d: Min: %7.d Max:%7.d, Avrg; %f", + dwSegment, + ppstData[dwSegment].pst_Channel[lTriggerChannel].nMin, + ppstData[dwSegment].pst_Channel[lTriggerChannel].nMax, + ((double) (ppstData[dwSegment].pst_Channel[lTriggerChannel].llAvrg) / (double) dwSegmentsize)); + } + } + else if (lMaxChannels == 2) + { + SPCM_SEGSTAT_STRUCT_2CH* ppstData = (SPCM_SEGSTAT_STRUCT_2CH*) pvData; + + // read out data of every segment (one channel only to keep things simple) + for (uint32 dwSegment = 0; dwSegment < dwNumOfSegments; dwSegment++) + { + printf("\nSegment %.2d: Min: %7.4d Max:%7.4d, Avrg; %f", + dwSegment, + ppstData[dwSegment].pst_Channel[lTriggerChannel].nMin, + ppstData[dwSegment].pst_Channel[lTriggerChannel].nMax, + ((double) (ppstData[dwSegment].pst_Channel[lTriggerChannel].llAvrg) / (double) dwSegmentsize)); + } + } + else + { + SPCM_SEGSTAT_STRUCT_4CH* ppstData = (SPCM_SEGSTAT_STRUCT_4CH*) pvData; + + // read out data of every segment (one channel only to keep things simple) + for (uint32 dwSegment = 0; dwSegment < dwNumOfSegments; dwSegment++) + { + printf("\nSegment %.2d: Min: %7.4d Max:%7.4d, Avrg; %f", + dwSegment, + ppstData[dwSegment].pst_Channel[lTriggerChannel].nMin, + ppstData[dwSegment].pst_Channel[lTriggerChannel].nMax, + ((double) (ppstData[dwSegment].pst_Channel[lTriggerChannel].llAvrg) / (double) dwSegmentsize)); + } + } + + + // clean up + printf ("\n\nFinished...\n"); + + vFreeMemPageAligned (pvData, (uint64) llBufferSize); + spcm_vClose (hCard); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/simple_rec_segment_statistic/simple_rec_segment_statistic.sln b/Cpp/examples/c_cpp/simple_rec_segment_statistic/simple_rec_segment_statistic.sln new file mode 100644 index 0000000000000000000000000000000000000000..fab2e56b7c8497484a974c236f00d89724a4d1f1 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rec_segment_statistic/simple_rec_segment_statistic.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simple_rec_segment_statistic", "simple_rec_segment_statistic.vcproj", "{AB068386-BB5C-4442-ACFF-B5D9A79C311A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|Win32.ActiveCfg = Debug|Win32 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|Win32.Build.0 = Debug|Win32 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|x64.ActiveCfg = Debug|x64 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|x64.Build.0 = Debug|x64 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|Win32.ActiveCfg = Release|Win32 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|Win32.Build.0 = Release|Win32 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|x64.ActiveCfg = Release|x64 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Cpp/examples/c_cpp/simple_rec_segment_statistic/simple_rec_segment_statistic.vcproj b/Cpp/examples/c_cpp/simple_rec_segment_statistic/simple_rec_segment_statistic.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..36d31defeb003d316f0a296cae09c63366cf23f9 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rec_segment_statistic/simple_rec_segment_statistic.vcproj @@ -0,0 +1,496 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="simple_rec_segment_statistic" + ProjectGUID="{AB068386-BB5C-4442-ACFF-B5D9A79C311A}" + RootNamespace="simple_rec_segment_statistic" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/simple_rec_segment_statistic.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/simple_rec_segment_statistic.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/simple_rec_segment_statistic.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/simple_rec_segment_statistic.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/simple_rec_segment_statistic.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/simple_rec_segment_statistic.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/simple_rec_segment_statistic.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/simple_rec_segment_statistic.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/simple_rec_segment_statistic.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/simple_rec_segment_statistic.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/simple_rec_segment_statistic.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/simple_rec_segment_statistic.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/simple_rec_segment_statistic.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/simple_rec_segment_statistic.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/simple_rec_segment_statistic.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/simple_rec_segment_statistic.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/simple_rec_segment_statistic.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/simple_rec_segment_statistic.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/simple_rec_segment_statistic.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/simple_rec_segment_statistic.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="header" + Filter="h;hpp;hxx;hm;inl" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_oswrap.h" + > + </File> + </Filter> + <File + RelativePath="simple_rec_segment_statistic.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/simple_rec_segment_statistic/simple_rec_segment_statistic.vcxproj b/Cpp/examples/c_cpp/simple_rec_segment_statistic/simple_rec_segment_statistic.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..45931f22380e777e342807ee44b9e95ceac4ee91 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rec_segment_statistic/simple_rec_segment_statistic.vcxproj @@ -0,0 +1,262 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{AB068386-BB5C-4442-ACFF-B5D9A79C311A}</ProjectGuid> + <RootNamespace>simple_rec_segment_statistic</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/simple_rec_segment_statistic.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/simple_rec_segment_statistic.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/simple_rec_segment_statistic.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/simple_rec_segment_statistic.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/simple_rec_segment_statistic.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/simple_rec_segment_statistic.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/simple_rec_segment_statistic.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/simple_rec_segment_statistic.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/simple_rec_segment_statistic.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/simple_rec_segment_statistic.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/simple_rec_segment_statistic.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/simple_rec_segment_statistic.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/simple_rec_segment_statistic.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/simple_rec_segment_statistic.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/simple_rec_segment_statistic.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/simple_rec_segment_statistic.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="simple_rec_segment_statistic.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/simple_rec_segment_statistic/simple_rec_segment_statistic.vcxproj.filters b/Cpp/examples/c_cpp/simple_rec_segment_statistic/simple_rec_segment_statistic.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..aece530dd654481a90609c4f61e069f4362f0a23 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rec_segment_statistic/simple_rec_segment_statistic.vcxproj.filters @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="header"> + <UniqueIdentifier>{53a0b7b5-f642-485e-a02b-61852e91b463}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_oswrap.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="simple_rec_segment_statistic.cpp" /> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib" /> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib" /> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/simple_rec_std/makefile b/Cpp/examples/c_cpp/simple_rec_std/makefile new file mode 100644 index 0000000000000000000000000000000000000000..4910a597a8f759555002961af54618beb304e05b --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rec_std/makefile @@ -0,0 +1,21 @@ +COMPILER = g++ +EXECUTABLE = simple_rec_std +LIBS += -lspcm_linux -lpthread -lrt + +OBJECTS = simple_rec_std.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/simple_rec_std/simple_rec_std.cpp b/Cpp/examples/c_cpp/simple_rec_std/simple_rec_std.cpp new file mode 100644 index 0000000000000000000000000000000000000000..94428ec87a3db62cacbf6242a9bc64e2e35edf65 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rec_std/simple_rec_std.cpp @@ -0,0 +1,212 @@ +/* +************************************************************************** + +simple_rec_std.cpp (c) Spectrum GmbH + +************************************************************************** + +Example for all SpcMDrv based analog acquisition cards. + +Information about the different products and their drivers can be found +online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/platform-driver-and-series-difference + +Shows a simple standard mode example using only the few necessary commands + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +#include "../common/ostools/spcm_oswrap.h" +#include "../common/ostools/spcm_ostools.h" + +// ----- standard c include files ----- +#include <stdio.h> +#include <stdlib.h> + + +/* +************************************************************************** +szTypeToName: doing name translation +************************************************************************** +*/ + +char* szTypeToName (int32 lCardType) + { + static char szName[50]; + switch (lCardType & TYP_SERIESMASK) + { + case TYP_M2ISERIES: sprintf (szName, "M2i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M2IEXPSERIES: sprintf (szName, "M2i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M3ISERIES: sprintf (szName, "M3i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M3IEXPSERIES: sprintf (szName, "M3i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M4IEXPSERIES: sprintf (szName, "M4i.%04x-x8", lCardType & TYP_VERSIONMASK); break; + case TYP_M4XEXPSERIES: sprintf (szName, "M4x.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M2PEXPSERIES: sprintf (szName, "M2p.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M5IEXPSERIES: sprintf (szName, "M5i.%04x-x16", lCardType & TYP_VERSIONMASK); break; + default: sprintf (szName, "unknown type"); break; + } + return szName; + } + + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + drv_handle hCard; + int32 lCardType, lSerialNumber, lFncType; + int16* pnData = NULL; + int8* pbyData = NULL; + char szErrorTextBuffer[ERRORTEXTLEN]; + uint32 dwError; + + // open card + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + hCard = spcm_hOpen ("/dev/spcm0"); + // hCard = spcm_hOpen ("TCPIP::192.168.1.10::inst0::INSTR"); + if (!hCard) + { + printf ("no card found...\n"); + return 0; + } + + + // read type, function and sn and check for A/D card + spcm_dwGetParam_i32 (hCard, SPC_PCITYP, &lCardType); + spcm_dwGetParam_i32 (hCard, SPC_PCISERIALNO, &lSerialNumber); + spcm_dwGetParam_i32 (hCard, SPC_FNCTYPE, &lFncType); + + switch (lFncType) + { + case SPCM_TYPE_AI: + printf ("Found: %s sn %05d\n", szTypeToName (lCardType), lSerialNumber); + break; + + default: + printf ("Card: %s sn %05d not supported by example\n", szTypeToName (lCardType), lSerialNumber); + return 0; + } + + int64 llMemsize = 16384; // set memsize to 16 kS + + // do a simple standard setup + spcm_dwSetParam_i32 (hCard, SPC_CARDMODE, SPC_REC_STD_SINGLE); // single standard mode + spcm_dwSetParam_i32 (hCard, SPC_CHENABLE, CHANNEL0); // just 1 channel enabled + spcm_dwSetParam_i64 (hCard, SPC_MEMSIZE, llMemsize); // acquire 16 kS in total + spcm_dwSetParam_i64 (hCard, SPC_POSTTRIGGER, llMemsize / 2); // half of the total number of samples after trigger event + spcm_dwSetParam_i32 (hCard, SPC_TRIG_ORMASK, SPC_TMASK_SOFTWARE); // trigger set to software + spcm_dwSetParam_i32 (hCard, SPC_TRIG_ANDMASK, 0); // ... + spcm_dwSetParam_i32 (hCard, SPC_CLOCKMODE, SPC_CM_INTPLL); // clock mode internal PLL + spcm_dwSetParam_i32 (hCard, SPC_CLOCKOUT, 0); // no clock output + spcm_dwSetParam_i32 (hCard, SPC_TIMEOUT, 5000); // timeout 5 s + + // set card to maximum sampling rate + int64 llMaxSamplingrate = 0; + spcm_dwGetParam_i64 (hCard, SPC_PCISAMPLERATE, &llMaxSamplingrate); + spcm_dwSetParam_i64 (hCard, SPC_SAMPLERATE, llMaxSamplingrate); + + + // start card and wait for card ready + dwError = spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_CARD_WAITREADY); + + // check for error + if (dwError != ERR_OK) + { + spcm_dwGetErrorInfo_i32 (hCard, NULL, NULL, szErrorTextBuffer); + printf ("%s\n", szErrorTextBuffer); + spcm_vClose (hCard); + return 0; + } + + + // setup transfer buffer and start DMA to transfer data from card to pc memory + + // read bytes per sample value (8 bit cards = 1 bytes, 12, 14, 16 bit cards = 2 bytes) + int32 lBytesPerSample = 0; + spcm_dwGetParam_i32 (hCard, SPC_MIINST_BYTESPERSAMPLE, &lBytesPerSample); + + // define data buffer + int64 llBufferSize = llMemsize * lBytesPerSample; + + switch (lBytesPerSample) + { + case 1: + pbyData = (int8*) pvAllocMemPageAligned (llBufferSize); + if (pbyData) + spcm_dwDefTransfer_i64 (hCard, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, 0, pbyData, 0, llBufferSize); + break; + + case 2: + pnData = (int16*) pvAllocMemPageAligned (llBufferSize); + if (pnData) + spcm_dwDefTransfer_i64 (hCard, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, 0, pnData, 0, llBufferSize); + break; + } + + if (!pbyData && !pnData) + { + printf ("memory allocation failed\n"); + spcm_vClose (hCard); + return 0; + } + + // start DMA and wait for DMA transfer ready state + dwError = spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA); + + + // get minimum and maximum values from data + int32 lMin = 32767; + int32 lMax = -32767; + + for (int64 llDataIdx = 0; llDataIdx < llMemsize; llDataIdx++) + { + switch (lBytesPerSample) + { + case 1: + if (pbyData[llDataIdx] < lMin) lMin = pbyData[llDataIdx]; + if (pbyData[llDataIdx] > lMax) lMax = pbyData[llDataIdx]; + break; + case 2: + if (pnData[llDataIdx] < lMin) lMin = pnData[llDataIdx]; + if (pnData[llDataIdx] > lMax) lMax = pnData[llDataIdx]; + break; + } + } + + printf ("\nMinimum: %d\n", lMin); + printf ("Maximum: %d\n\n", lMax); + + // close card + spcm_vClose (hCard); + + switch (lBytesPerSample) + { + case 1: vFreeMemPageAligned (pbyData, llBufferSize); break; + case 2: vFreeMemPageAligned (pnData, llBufferSize); break; + } + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/simple_rec_std/simple_rec_std.vcproj b/Cpp/examples/c_cpp/simple_rec_std/simple_rec_std.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..4f025dfb2ecedc0bd2aa644c7b4105640ff38d31 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rec_std/simple_rec_std.vcproj @@ -0,0 +1,496 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="simple_rec_fifo" + ProjectGUID="{AB068386-BB5C-4442-ACFF-B5D9A79C311A}" + RootNamespace="simple_rec_fifo" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/simple_rec_fifo.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/simple_rec_fifo.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/simple_rec_fifo.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/simple_rec_fifo.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/simple_rec_fifo.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/simple_rec_fifo.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/simple_rec_fifo.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/simple_rec_fifo.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/simple_rec_fifo.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/simple_rec_fifo.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/simple_rec_fifo.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/simple_rec_fifo.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/simple_rec_fifo.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/simple_rec_fifo.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/simple_rec_fifo.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/simple_rec_fifo.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/simple_rec_fifo.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/simple_rec_fifo.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/simple_rec_fifo.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/simple_rec_fifo.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="header" + Filter="h;hpp;hxx;hm;inl" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_oswrap.h" + > + </File> + </Filter> + <File + RelativePath=".\simple_rec_std.cpp" + > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/simple_rec_std/simple_rec_std.vcxproj b/Cpp/examples/c_cpp/simple_rec_std/simple_rec_std.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..51712a4c797119e4f07a1b1f7a3120239b7927ac --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rec_std/simple_rec_std.vcxproj @@ -0,0 +1,246 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>simple_rec_std</ProjectName> + <ProjectGuid>{C35D57FE-8A46-4BC1-9CF6-CF8DE8767C0A}</ProjectGuid> + <RootNamespace>simple_rec_fifo</RootNamespace> + <WindowsTargetPlatformVersion> + </WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/simple_rec_fifo.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/simple_rec_fifo.pch</PrecompiledHeaderOutputFile> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/simple_rec_fifo.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/simple_rec_fifo.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/simple_rec_fifo.pch</PrecompiledHeaderOutputFile> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/simple_rec_fifo.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/simple_rec_fifo.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/simple_rec_fifo.pch</PrecompiledHeaderOutputFile> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/simple_rec_fifo.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/simple_rec_fifo.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/simple_rec_fifo.pch</PrecompiledHeaderOutputFile> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/simple_rec_fifo.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="simple_rec_std.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/simple_rec_std/simple_rec_std.vcxproj.filters b/Cpp/examples/c_cpp/simple_rec_std/simple_rec_std.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..9895c61fd0a2230abcb354275823296763be8e1a --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rec_std/simple_rec_std.vcxproj.filters @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <ClCompile Include="simple_rec_std.cpp" /> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp"> + <Filter>Libs</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>Header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>Header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>Header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>Header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>Header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_oswrap.h"> + <Filter>Header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <Filter Include="Header"> + <UniqueIdentifier>{da0e9b67-353f-4c16-8aba-40f0dffd6413}</UniqueIdentifier> + </Filter> + <Filter Include="Libs"> + <UniqueIdentifier>{4a792919-840e-4d23-b721-64c9f6fd94db}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <Filter>Libs</Filter> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <Filter>Libs</Filter> + </Library> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/simple_rep_fifo/makefile b/Cpp/examples/c_cpp/simple_rep_fifo/makefile new file mode 100644 index 0000000000000000000000000000000000000000..40fa2bf633e157ece6a9ccdf8815630469f517e7 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rep_fifo/makefile @@ -0,0 +1,21 @@ +COMPILER = g++ +EXECUTABLE = simple_rep_fifo +LIBS += -lspcm_linux -lpthread -lrt + +OBJECTS = simple_rep_fifo.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/simple_rep_fifo/simple_rep_fifo.cpp b/Cpp/examples/c_cpp/simple_rep_fifo/simple_rep_fifo.cpp new file mode 100644 index 0000000000000000000000000000000000000000..64b5f7b0924f0f809e9519f00e83a01d5b68cccc --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rep_fifo/simple_rep_fifo.cpp @@ -0,0 +1,359 @@ +/* +************************************************************************** + +simple_rep_fifo.cpp (c) Spectrum GmbH + +************************************************************************** + +Example for all SpcMDrv based analog generation cards. + +Information about the different products and their drivers can be found +online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/platform-driver-and-series-differences + +Shows a FIFO mode example using only the few necessary commands + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +#include "../common/ostools/spcm_oswrap.h" +#include "../common/ostools/spcm_ostools.h" + +// ----- standard c include files ----- +#include <cstdio> +#include <cstdlib> +#include <cstring> + +#define _USE_MATH_DEFINES // for M_PI +#include <cmath> + +#define MAX_WAVEFORMS 3 +#define WAVEFORM_LENGTH (1024*1024) + +/* +************************************************************************** +szTypeToName: doing name translation +************************************************************************** +*/ + +char* szTypeToName (int32 lCardType) + { + static char szName[50]; + switch (lCardType & TYP_SERIESMASK) + { + case TYP_M2ISERIES: sprintf (szName, "M2i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M2IEXPSERIES: sprintf (szName, "M2i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M3ISERIES: sprintf (szName, "M3i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M3IEXPSERIES: sprintf (szName, "M3i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M4IEXPSERIES: sprintf (szName, "M4i.%04x-x8", lCardType & TYP_VERSIONMASK); break; + case TYP_M4XEXPSERIES: sprintf (szName, "M4x.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M2PEXPSERIES: sprintf (szName, "M2p.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M5IEXPSERIES: sprintf (szName, "M5i.%04x-x16", lCardType & TYP_VERSIONMASK); break; + default: sprintf (szName, "unknown type"); break; + } + return szName; + } + +void vCalcWaveforms (int16** ppnWaveforms, uint32 dwNumWaveforms, uint32 dwLength, int32 lMaxADCValue) + { + double dMulti = (double)(2.*lMaxADCValue-1) / (double)dwLength; + + for (uint32 dwWaveformIdx = 0; dwWaveformIdx < dwNumWaveforms; dwWaveformIdx++) + { + for (uint32 lDataIdx = 0; lDataIdx < dwLength; lDataIdx++) + { + switch (dwWaveformIdx) + { + // rectangle + case 1: + if (lDataIdx < dwLength / 2) + ppnWaveforms[dwWaveformIdx][lDataIdx] = (int16)(lMaxADCValue - 1); + else + ppnWaveforms[dwWaveformIdx][lDataIdx] = (int16)(lMaxADCValue * -1); + break; + + // ramp + case 2: + ppnWaveforms[dwWaveformIdx][lDataIdx] = -lMaxADCValue + (int16)(lDataIdx * dMulti); + break; + + // sine + default: + ppnWaveforms[dwWaveformIdx][lDataIdx] = (int16)((lMaxADCValue - 1) * sin ((2.0 * M_PI * lDataIdx) / dwLength)); + break; + } + } + } + } + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + drv_handle hCard = NULL_HANDLE; + bool bError = false; + int32 lCardType, lSerialNumber, lFncType, lDataIdx, lWaveformIdx; + int16* pnDataBuffer = NULL; + int16* ppnWaveforms[MAX_WAVEFORMS]; + char szErrorTextBuffer[ERRORTEXTLEN], szName[50]; + + // settings for the FIFO mode buffer handling + int64 llSamplerate = MEGA(50); + + // setup for the FIFO mode (HW buffer size can be programmed starting with firmware V9) + int64 llBufferSize = 64 * sizeof (int16) * WAVEFORM_LENGTH; + int64 llHWBufSize = MEGA_B(1024); + uint32 dwNotifySize = sizeof (int16) * WAVEFORM_LENGTH; + + // some example checks + if (llBufferSize % dwNotifySize) + { + printf ("In our example we can only handle sw buffers that are a whole numbered multiple of the notify size\n"); + return 1; + } + + // ------------------------------------------------------------------------ + // uncomment the second line and replace the IP address to use remote + // cards like in a generatorNETBOX + int32 lCardIdx = 0; + sprintf (szName, "/dev/spcm%d", lCardIdx); + // sprintf (szName, "TCPIP::192.168.1.10::inst%d::INSTR", lCardIdx); + hCard = spcm_hOpen (szName); + + // no card found + if (!hCard) + { + printf ("no card found...\n"); + return 0; + } + + // read out some info and print it + spcm_dwGetParam_i32 (hCard, SPC_PCITYP, &lCardType); + spcm_dwGetParam_i32 (hCard, SPC_PCISERIALNO, &lSerialNumber); + spcm_dwGetParam_i32 (hCard, SPC_FNCTYPE, &lFncType); + + switch (lFncType) + { + case SPCM_TYPE_AO: + printf ("Found: %s sn %05d\n", szTypeToName (lCardType), lSerialNumber); + break; + + // only D/A cards allowed in example + default: + printf ("Card: %s sn %05d not supported by example\n", szTypeToName (lCardType), lSerialNumber); + bError = true; + break; + } + + int32 lMaxADCValue = 0; + spcm_dwGetParam_i32 (hCard, SPC_MIINST_MAXADCVALUE, &lMaxADCValue); + + // ------------------------------------------------------------------------ + // do a simple standard setup for all cards + spcm_dwSetParam_i32 (hCard, SPC_CHENABLE, CHANNEL0); // just 1 channel enabled + spcm_dwSetParam_i32 (hCard, SPC_CARDMODE, SPC_REP_FIFO_SINGLE); // single FIFO mode + spcm_dwSetParam_i32 (hCard, SPC_TIMEOUT, 5000); // timeout 5 s + spcm_dwSetParam_i32 (hCard, SPC_CLOCKMODE, SPC_CM_INTPLL); // clock mode internal PLL + spcm_dwSetParam_i64 (hCard, SPC_SAMPLERATE, llSamplerate); // sampling clock (used default for this example is 50 MHz) + spcm_dwSetParam_i32 (hCard, SPC_CLOCKOUT, 0); // no clock output + spcm_dwSetParam_i32 (hCard, SPC_AMP0, 1000); // 1V output amplitude + spcm_dwSetParam_i32 (hCard, SPC_LOOPS, 0); // loop continuously + spcm_dwSetParam_i32 (hCard, SPC_ENABLEOUT0, 1); // enable output of ch0 + + // trigger mode definition (in our example it is software trigger) + spcm_dwSetParam_i32 (hCard, SPC_TRIG_ORMASK, 0); + spcm_dwSetParam_i32 (hCard, SPC_TRIG_ANDMASK, 0); + spcm_dwSetParam_i32 (hCard, SPC_TRIG_ORMASK, SPC_TMASK_SOFTWARE); + + // starting with firmware version V9 we can program the hardware buffer size to reduce the latency + int32 lHWFWVersion = 0; + spcm_dwGetParam_i32 (hCard, SPC_PCIVERSION, &lHWFWVersion); + if ((lHWFWVersion & 0xFFFF) >= 9) + { + spcm_dwSetParam_i64 (hCard, SPC_DATA_OUTBUFSIZE, llHWBufSize); + spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_CARD_WRITESETUP); + } + + // ------------------------------------------------------------------------ + // calculate waveforms + for (uint32 dwIdx = 0; dwIdx < MAX_WAVEFORMS; dwIdx++) + ppnWaveforms[dwIdx] = (int16*)pvAllocMemPageAligned (sizeof (int16) * (uint64)WAVEFORM_LENGTH); + + vCalcWaveforms (ppnWaveforms, MAX_WAVEFORMS, WAVEFORM_LENGTH, lMaxADCValue); + + // ------------------------------------------------------------------------ + // define and allocate the data buffers + pnDataBuffer = (int16*) pvAllocMemPageAligned ((uint64) llBufferSize); + if (!pnDataBuffer) + { + printf ("memory allocation failed\n"); + bError = true; + } + else + { + spcm_dwDefTransfer_i64 (hCard, SPCM_BUF_DATA, SPCM_DIR_PCTOCARD, dwNotifySize, pnDataBuffer, 0, llBufferSize); + + // ------------------------------------------------------------------------ + // copy waveform data to buffer + lWaveformIdx = 0; + lDataIdx = 0; + for (int64 llPos = 0; llPos < llBufferSize / 2; ++llPos) // llBufferSize / 2 gives the number of samples in the buffer + { + pnDataBuffer[llPos] = ppnWaveforms[lWaveformIdx][lDataIdx]; + ++lDataIdx %= WAVEFORM_LENGTH; + } + } + + // ------------------------------------------------------------------------ + // do start and check for error + if (!bError) + { + // transfer data in buffer to card memory + spcm_dwSetParam_i64 (hCard, SPC_DATA_AVAIL_CARD_LEN, llBufferSize); + + spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA); + } + + + // ------------------------------------------------------------------------ + // this is the main data loop: we wait for all cards to have space available + // in a loop. This may be put into threads to have one thread controlling data of + // one card. In our example we simply put it in the main loop as each card is + // configured similar and will have space available at the same time + if (!bError) + { + int64 llTransferredBytes = 0; + int64 llAvailUser = 0; + int64 llBufferFillPromille = 0; + int64 llUserPos = 0; + bool bStarted = false; + bool bAbort = false; + + // run the FIFO loop + uint32 dwNumCardsFilled = 0; // count number of cards whose memory has been filled (only pre-start) + while (!bError && !bAbort) + { + // get available space in DMA buffer + spcm_dwGetParam_i64 (hCard, SPC_DATA_AVAIL_USER_LEN, &llAvailUser); + spcm_dwGetParam_i64 (hCard, SPC_FILLSIZEPROMILLE, &llBufferFillPromille); + printf ("\rSW-Buffer: %3.0f%% HW-Buffer:%3d%%, Total Bytes so far: %6.2f MB", (float) 100.0 * (llBufferSize - llAvailUser) / llBufferSize, (uint32) llBufferFillPromille / 10, (float) llTransferredBytes / MEGA_B(1)); + + if (llAvailUser >= dwNotifySize) + { + // get position of free space in DMA buffer + spcm_dwGetParam_i64 (hCard, SPC_DATA_AVAIL_USER_POS, &llUserPos); + + // avoid buffer wrap-around + int64 llDataToWrite = dwNotifySize; + if (llUserPos + dwNotifySize > llBufferSize) + llDataToWrite = llBufferSize - llUserPos; + + // copy new data to buffer + memcpy (pnDataBuffer + (llUserPos/2), ppnWaveforms[lWaveformIdx], (size_t)llDataToWrite); + + // set data available for transfer + spcm_dwSetParam_i64 (hCard, SPC_DATA_AVAIL_CARD_LEN, llDataToWrite); + llTransferredBytes += llDataToWrite; + + // switch waveform after 1 GB has been transferred + if (!(llTransferredBytes % (1024*1024*1024))) + ++lWaveformIdx %= MAX_WAVEFORMS; + } + + // we start the output as soon as we have a sufficient amount of data on card + // inhere we start if the hardware buffer is completely full + if (!bStarted && !bError && (llBufferFillPromille == 1000)) + { + printf ("\nStart the output\n"); + + // start command including enable of trigger engine -> error check + if (spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER) != ERR_OK) + { + spcm_dwGetErrorInfo_i32 (hCard, NULL, NULL, szErrorTextBuffer); + printf ("%s\n", szErrorTextBuffer); + bError = true; + } + bStarted = true; + } + + // wait for the next buffer to be free + switch (spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_DATA_WAITDMA)) + { + case ERR_TIMEOUT: + printf ("... timeout\n"); + bError = true; + break; + + case ERR_FIFOHWOVERRUN: + case ERR_FIFOBUFOVERRUN: + printf ("... buffer underrun\n"); + bError = true; + break; + + case ERR_OK: + break; + + default: + bError = true; + break; + } + + /* + // check for escape = abort + if (bKbhit ()) + { + if (cGetch () == 27) + bAbort = true; + } + */ + } + } + + + // ------------------------------------------------------------------------ + // check for errors + if (bError) + { + spcm_dwGetErrorInfo_i32 (hCard, NULL, NULL, szErrorTextBuffer); + printf ("Error: %s\n", szErrorTextBuffer); + } + + // no error: we managed to run through completely + else + printf ("\nfinished ...\n"); + + // send the stop command + spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_CARD_STOP | M2CMD_DATA_STOPDMA); + + // clean up + if (pnDataBuffer) + vFreeMemPageAligned (pnDataBuffer, (uint64) llBufferSize); + + for (uint32 dwIdx = 0; dwIdx < MAX_WAVEFORMS; dwIdx++) + vFreeMemPageAligned (ppnWaveforms[dwIdx], sizeof (int16) * (uint64)WAVEFORM_LENGTH); + + spcm_vClose (hCard); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/simple_rep_fifo/simple_rep_fifo.vcproj b/Cpp/examples/c_cpp/simple_rep_fifo/simple_rep_fifo.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..4d7c92535ff04517dafc756eee4c537d10c8e0c3 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rep_fifo/simple_rep_fifo.vcproj @@ -0,0 +1,464 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="simple_rep_fifo" + ProjectGUID="{AB068386-BB5C-4442-ACFF-B5D9A79C311A}" + RootNamespace="rec_std_single" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/rec_std_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_std_single.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_std_single.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_std_single.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_std_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/rec_std_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_std_single.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_std_single.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_std_single.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_std_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/rec_std_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_std_single.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_std_single.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_std_single.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_std_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/rec_std_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_std_single.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_std_single.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_std_single.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_std_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="header" + Filter="h;hpp;hxx;hm;inl" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_oswrap.h" + > + </File> + </Filter> + <File + RelativePath=".\simple_rep_fifo.cpp" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/simple_rep_fifo/simple_rep_fifo.vcxproj b/Cpp/examples/c_cpp/simple_rep_fifo/simple_rep_fifo.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..5af4ee7208ef7d47272e3391769fee6ec49f4b22 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rep_fifo/simple_rep_fifo.vcxproj @@ -0,0 +1,262 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{AB068386-BB5C-4442-ACFF-B5D9A79C311A}</ProjectGuid> + <RootNamespace>rec_std_single</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="simple_rep_fifo.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> diff --git a/Cpp/examples/c_cpp/simple_rep_fifo/simple_rep_fifo.vcxproj.filters b/Cpp/examples/c_cpp/simple_rep_fifo/simple_rep_fifo.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..285a6f45917c70d1220d00291cd6b38fa7efec16 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rep_fifo/simple_rep_fifo.vcxproj.filters @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="header"> + <UniqueIdentifier>{5bf2a4db-dd6c-4a11-9913-f9987cf4e5a2}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_oswrap.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="simple_rep_fifo.cpp" /> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib" /> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib" /> + </ItemGroup> +</Project> diff --git a/Cpp/examples/c_cpp/simple_rep_std/makefile b/Cpp/examples/c_cpp/simple_rep_std/makefile new file mode 100644 index 0000000000000000000000000000000000000000..01807cdab74419d336c9c8865eb74df557f4e6cc --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rep_std/makefile @@ -0,0 +1,21 @@ +COMPILER = g++ +EXECUTABLE = simple_rep_std +LIBS += -lspcm_linux -lpthread -lrt + +OBJECTS = simple_rep_std.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/simple_rep_std/simple_rep_std.cpp b/Cpp/examples/c_cpp/simple_rep_std/simple_rep_std.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8cfced0d9ba10b88374f66bf0725605d8e860f23 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rep_std/simple_rep_std.cpp @@ -0,0 +1,218 @@ +/* +************************************************************************** + +simple_rep_std.cpp (c) Spectrum GmbH + +************************************************************************** + +Example for all SpcMDrv based analog generation cards. + +Information about the different products and their drivers can be found +online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/platform-driver-and-series-differences + +Shows a standard mode example using only the few necessary commands + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +#include "../common/ostools/spcm_oswrap.h" +#include "../common/ostools/spcm_ostools.h" + +// ----- standard c include files ----- +#include <cstdio> +#include <cstdlib> +#define _USE_MATH_DEFINES +#include <cmath> + +#define WAVEFORM_LENGTH (1024*1024) + +/* +************************************************************************** +szTypeToName: doing name translation +************************************************************************** +*/ + +char* szTypeToName (int32 lCardType) + { + static char szName[50]; + switch (lCardType & TYP_SERIESMASK) + { + case TYP_M2ISERIES: sprintf (szName, "M2i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M2IEXPSERIES: sprintf (szName, "M2i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M3ISERIES: sprintf (szName, "M3i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M3IEXPSERIES: sprintf (szName, "M3i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M4IEXPSERIES: sprintf (szName, "M4i.%04x-x8", lCardType & TYP_VERSIONMASK); break; + case TYP_M4XEXPSERIES: sprintf (szName, "M4x.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M2PEXPSERIES: sprintf (szName, "M2p.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M5IEXPSERIES: sprintf (szName, "M5i.%04x-x16", lCardType & TYP_VERSIONMASK); break; + default: sprintf (szName, "unknown type"); break; + } + return szName; + } + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + drv_handle hCard = NULL_HANDLE; + bool bError = false; + char szErrorTextBuffer[ERRORTEXTLEN], szName[50]; + + int64 llSamplerate = MEGA(50); + + // ------------------------------------------------------------------------ + // uncomment the second line and replace the IP address to use remote + // cards like in a generatorNETBOX + int32 lCardIdx = 0; + sprintf (szName, "/dev/spcm%d", lCardIdx); + // sprintf (szName, "TCPIP::192.168.1.10::inst%d::INSTR", lCardIdx); + hCard = spcm_hOpen (szName); + + // no card found + if (!hCard) + { + printf ("no card found...\n"); + return 0; + } + + // read out some info and print it + int32 lCardType = 0; + spcm_dwGetParam_i32 (hCard, SPC_PCITYP, &lCardType); + int32 lSerialNumber = 0; + spcm_dwGetParam_i32 (hCard, SPC_PCISERIALNO, &lSerialNumber); + int32 lFncType = 0; + spcm_dwGetParam_i32 (hCard, SPC_FNCTYPE, &lFncType); + + switch (lFncType) + { + case SPCM_TYPE_AO: + printf ("Found: %s sn %05d\n", szTypeToName (lCardType), lSerialNumber); + break; + + // only D/A cards allowed in example + default: + printf ("Card: %s sn %05d not supported by example\n", szTypeToName (lCardType), lSerialNumber); + bError = true; + break; + } + + int32 lMaxDACValue = 0; + spcm_dwGetParam_i32 (hCard, SPC_MIINST_MAXADCVALUE, &lMaxDACValue); + + int32 lNumModules = 0; + spcm_dwGetParam_i32 (hCard, SPC_MIINST_MODULES, &lNumModules); + int32 lNumChPerModule = 0; + spcm_dwGetParam_i32 (hCard, SPC_MIINST_CHPERMODULE, &lNumChPerModule); + int32 lNumCh = lNumModules * lNumChPerModule; + + // ------------------------------------------------------------------------ + // do a simple standard setup for all cards + spcm_dwSetParam_i32 (hCard, SPC_CHENABLE, (0x1 << lNumCh) - 1); // enable all channels + spcm_dwSetParam_i32 (hCard, SPC_CARDMODE, SPC_REP_STD_SINGLE); // standard single mode + spcm_dwSetParam_i32 (hCard, SPC_CLOCKMODE, SPC_CM_INTPLL); // clock mode internal PLL + spcm_dwSetParam_i64 (hCard, SPC_SAMPLERATE, llSamplerate); // sampling clock + spcm_dwSetParam_i32 (hCard, SPC_CLOCKOUT, 0); // no clock output + spcm_dwSetParam_i32 (hCard, SPC_MEMSIZE, WAVEFORM_LENGTH); // number of samples per channel + spcm_dwSetParam_i32 (hCard, SPC_LOOPS, 0); // loop continuous + + // trigger mode definition (in our example it is software trigger) + spcm_dwSetParam_i32 (hCard, SPC_TRIG_ORMASK, SPC_TMASK_SOFTWARE); + spcm_dwSetParam_i32 (hCard, SPC_TRIG_ANDMASK, 0); + + // setup the channels + for (int lChIdx = 0; lChIdx < lNumCh; ++lChIdx) + { + spcm_dwSetParam_i32 (hCard, SPC_AMP0 + 100 * lChIdx, 1000); // +-1V output amplitude + spcm_dwSetParam_i32 (hCard, SPC_ENABLEOUT0 + 100 * lChIdx, 1); // enable output of channel + } + + // ------------------------------------------------------------------------ + // calculate waveforms + int64 llBufferSize = sizeof (int16) * lNumCh * (uint64)WAVEFORM_LENGTH; + int16* anDMABuffer = (int16*)pvAllocMemPageAligned (llBufferSize); + for (int lChIdx = 0; lChIdx < lNumCh; ++lChIdx) + { + // calculate each sample and put it into the DMA buffer (multiplexed) + for (int i = 0; i < WAVEFORM_LENGTH; ++i) + { + int16 nValue = 0; + switch (lChIdx) + { + default: + case 0: + // sine + nValue = (int16)(lMaxDACValue * sin (2. * M_PI * i / (WAVEFORM_LENGTH / (lChIdx + 1)))); // for channel zero we generate one period. for channels higher than 3 a faster sine is generated + break; + case 1: + // one rectangle period (max amplitude) + if (i < WAVEFORM_LENGTH / 2) + nValue = (int16)lMaxDACValue - 1; + else + nValue = (int16)-lMaxDACValue; + break; + case 2: + // rising ramp + nValue = (int16)(-lMaxDACValue + 2*lMaxDACValue * ((double)i / WAVEFORM_LENGTH)); + break; + case 3: + { + // sinc function in the interval -4pi to +4pi + double dX = -4. * M_PI + 8. * M_PI * ((double)i / WAVEFORM_LENGTH); + nValue = (int16)(lMaxDACValue * sin (dX) / dX); + break; + } + } + + anDMABuffer[lNumCh * i + lChIdx] = nValue; + } + } + + printf ("Starting the DMA transfer and waiting until data is in board memory\n"); + spcm_dwDefTransfer_i64 (hCard, SPCM_BUF_DATA, SPCM_DIR_PCTOCARD, 0, anDMABuffer, 0, llBufferSize); + spcm_dwSetParam_i64 (hCard, SPC_DATA_AVAIL_CARD_LEN, llBufferSize); + spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA); + printf ("... data has been transferred to board memory\n"); + + // We'll start and wait until the card has finished or until a timeout occurs + spcm_dwSetParam_i32 (hCard, SPC_TIMEOUT, 10 * 1000); // 10 seconds timeout + printf ("\nStarting the card and waiting for ready interrupt\n(continuous and single restart will have timeout)\n"); + // start command including enable of trigger engine -> error check + if (spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_CARD_WAITREADY) != ERR_OK) + { + spcm_dwGetErrorInfo_i32 (hCard, NULL, NULL, szErrorTextBuffer); + printf ("Error: %s\n", szErrorTextBuffer); + } + + printf ("\nFinished ...\n"); + + // send the stop command + spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_CARD_STOP | M2CMD_DATA_STOPDMA); + + // clean up + vFreeMemPageAligned (anDMABuffer, llBufferSize); + + spcm_vClose (hCard); + + return EXIT_SUCCESS; + } diff --git a/Cpp/examples/c_cpp/simple_rep_std/simple_rep_std.vcxproj b/Cpp/examples/c_cpp/simple_rep_std/simple_rep_std.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..2788fc2347d5d0ffb0323575e06680422fec4a4e --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rep_std/simple_rep_std.vcxproj @@ -0,0 +1,262 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{AB068386-BB5C-4442-ACFF-B5D9A79C311A}</ProjectGuid> + <RootNamespace>rec_std_single</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="simple_rep_std.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> diff --git a/Cpp/examples/c_cpp/simple_rep_std/simple_rep_std.vcxproj.filters b/Cpp/examples/c_cpp/simple_rep_std/simple_rep_std.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..54592eef12bc2bbfdd483c5f2ce3c4510f907580 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_rep_std/simple_rep_std.vcxproj.filters @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="header"> + <UniqueIdentifier>{5bf2a4db-dd6c-4a11-9913-f9987cf4e5a2}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_oswrap.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="simple_rep_std.cpp" /> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib" /> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib" /> + </ItemGroup> +</Project> diff --git a/Cpp/examples/c_cpp/simple_sync_io_fifo/simple_sync_io_fifo.cpp b/Cpp/examples/c_cpp/simple_sync_io_fifo/simple_sync_io_fifo.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0b6ad48657a804084e8c24f7285e5778ee00c1e7 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_sync_io_fifo/simple_sync_io_fifo.cpp @@ -0,0 +1,481 @@ +/* +************************************************************************** + +simple_sync_io_fifo.cpp (c) Spectrum GmbH + +************************************************************************** + +Example for all SpcMDrv based cards. + +Information about the different products and their drivers can be found +online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/platform-driver-and-series-differences + +Shows a synchronized FIFO mode example using only the few necessary commands + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + +#define MAXCARDS 16 + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +#include "../common/ostools/spcm_oswrap.h" +#include "../common/ostools/spcm_ostools.h" + +// ----- standard c include files ----- +#include <stdio.h> +#include <stdlib.h> + +#define _USE_MATH_DEFINES // for M_PI +#include <math.h> + +typedef struct + { + drv_handle hCard; + bool bDMAStarted; + int32 lFncType; + int32 lMaxADCValue; + int16* pnData; + } ST_CARD; + +/* +************************************************************************** +szTypeToName: doing name translation +************************************************************************** +*/ + +char* szTypeToName (int32 lCardType) + { + static char szName[50]; + switch (lCardType & TYP_SERIESMASK) + { + case TYP_M2ISERIES: sprintf (szName, "M2i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M2IEXPSERIES: sprintf (szName, "M2i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M3ISERIES: sprintf (szName, "M3i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M3IEXPSERIES: sprintf (szName, "M3i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M4IEXPSERIES: sprintf (szName, "M4i.%04x-x8", lCardType & TYP_VERSIONMASK); break; + case TYP_M4XEXPSERIES: sprintf (szName, "M4x.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M2PEXPSERIES: sprintf (szName, "M2p.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M5IEXPSERIES: sprintf (szName, "M5i.%04x-x16", lCardType & TYP_VERSIONMASK); break; + default: sprintf (szName, "unknown type"); break; + } + return szName; + } + +/* +************************************************************************** +bSetupAICard: doing simple setup for AD cards +************************************************************************** +*/ + +bool bSetupAICard (drv_handle hCard) + { + int32 lCardType; + + uint32 dwError = 0; + + dwError += spcm_dwSetParam_i32 (hCard, SPC_CHENABLE, CHANNEL0); // just 1 channel enabled + dwError += spcm_dwSetParam_i32 (hCard, SPC_CARDMODE, SPC_REC_FIFO_SINGLE); // single FIFO mode + dwError += spcm_dwSetParam_i32 (hCard, SPC_PRETRIGGER, 1024); // 1k of pretrigger data at start of FIFO mode + dwError += spcm_dwSetParam_i32 (hCard, SPC_TIMEOUT, 5000); // timeout 5 s + dwError += spcm_dwSetParam_i32 (hCard, SPC_AMP0, 1000); // 1V input range + dwError += spcm_dwSetParam_i32 (hCard, SPC_CLOCKMODE, SPC_CM_INTPLL); // clock mode internal PLL + dwError += spcm_dwSetParam_i32 (hCard, SPC_CLOCKOUT, 0); // no clock output + dwError += spcm_dwSetParam_i32 (hCard, SPC_TRIG_ORMASK, 0); + dwError += spcm_dwSetParam_i32 (hCard, SPC_TRIG_ANDMASK, 0); + dwError += spcm_dwSetParam_i32 (hCard, SPC_TRIG_ORMASK, SPC_TMASK_SOFTWARE); + + dwError += spcm_dwGetParam_i32 (hCard, SPC_PCITYP, &lCardType); + + // we try to set the samplerate to 100 kHz (M2i) or 10 MHz + if (((lCardType & TYP_SERIESMASK) == TYP_M2ISERIES) || ((lCardType & TYP_SERIESMASK) == TYP_M2IEXPSERIES)) + dwError += spcm_dwSetParam_i64 (hCard, SPC_SAMPLERATE, KILO(100)); + else + dwError += spcm_dwSetParam_i64 (hCard, SPC_SAMPLERATE, MEGA(10)); + + if (!dwError) + return false; + else + return true; + } + +/* +************************************************************************** +bSetupAOCard: doing simple setup for DA cards +************************************************************************** +*/ + +bool bSetupAOCard (drv_handle hCard) + { + int32 lCardType; + + uint32 dwError = 0; + + dwError += spcm_dwSetParam_i32 (hCard, SPC_CHENABLE, CHANNEL0); // just 1 channel enabled + dwError += spcm_dwSetParam_i32 (hCard, SPC_CARDMODE, SPC_REP_FIFO_SINGLE); // single FIFO mode + dwError += spcm_dwSetParam_i32 (hCard, SPC_TIMEOUT, 5000); // timeout 5 s + dwError += spcm_dwSetParam_i32 (hCard, SPC_CLOCKMODE, SPC_CM_INTPLL); // clock mode internal PLL + dwError += spcm_dwSetParam_i32 (hCard, SPC_CLOCKOUT, 0); // no clock output + dwError += spcm_dwSetParam_i32 (hCard, SPC_AMP0, 1000); // 1V output amplitude + dwError += spcm_dwSetParam_i32 (hCard, SPC_LOOPS, 0); // loop continuous + dwError += spcm_dwSetParam_i32 (hCard, SPC_ENABLEOUT0, 1); + dwError += spcm_dwSetParam_i32 (hCard, SPC_TRIG_ORMASK, 0); + dwError += spcm_dwSetParam_i32 (hCard, SPC_TRIG_ANDMASK, 0); + dwError += spcm_dwSetParam_i32 (hCard, SPC_TRIG_ORMASK, SPC_TMASK_SOFTWARE); + + dwError += spcm_dwGetParam_i32 (hCard, SPC_PCITYP, &lCardType); + + // we try to set the samplerate to 100 kHz (M2i) or 10 MHz + if (((lCardType & TYP_SERIESMASK) == TYP_M2ISERIES) || ((lCardType & TYP_SERIESMASK) == TYP_M2IEXPSERIES)) + dwError += spcm_dwSetParam_i64 (hCard, SPC_SAMPLERATE, KILO(100)); + else + dwError += spcm_dwSetParam_i64 (hCard, SPC_SAMPLERATE, MEGA(10)); + + if (!dwError) + return false; + else + return true; + } + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + ST_CARD astCards[MAXCARDS]; + drv_handle hSync = 0; + bool bError = false; + int32 lCardType, lSerialNumber, lFncType, lFeatures, lMaxADCValue, lStatus; + int64 llAvailUser, llPCPos; + char szErrorTextBuffer[ERRORTEXTLEN], szName[50]; + + int32 lCardsCount = 0; + int32 lFirstAICardIdx = -1; + bool bStarHubAvailable = false; + + uint64 qwBytesToTransfer = MEGA_B(256); + int32 lFillSizePercentStart = 50; + uint32 dwNumPeriodsInBuffer = 128; + + // settings for the FIFO mode buffer handling + int64 llBufferSize = MEGA_B(16); + int32 lNotifySize = KILO_B(128); + + // clear card structs + for (int32 lIdx = 0; lIdx < MAXCARDS; lIdx++) + memset (&astCards[lIdx], 0, sizeof (ST_CARD)); + + // we try to open all cards and printout some information on them + for (int32 lCardIdx = 0; !bError && (lCardIdx < MAXCARDS); lCardIdx++) + { + // uncomment the second line and replace the IP address to use remote cards + sprintf (szName, "/dev/spcm%d", lCardIdx); + // sprintf (szName, "TCPIP::192.168.1.10::inst%d::INSTR", lCardIdx); + drv_handle hCard = spcm_hOpen (szName); + + // not one card found + if (!lCardIdx && !hCard) + { + printf ("no card found...\n"); + return 0; + } + + // no more cards found in system + if (!hCard) + break; + + // read out some info and print it + spcm_dwGetParam_i32 (hCard, SPC_PCITYP, &lCardType); + spcm_dwGetParam_i32 (hCard, SPC_PCISERIALNO, &lSerialNumber); + spcm_dwGetParam_i32 (hCard, SPC_FNCTYPE, &lFncType); + spcm_dwGetParam_i32 (hCard, SPC_MIINST_MAXADCVALUE, &lMaxADCValue); + + // we check if StarHub is available + spcm_dwGetParam_i32 (hCard, SPC_PCIFEATURES, &lFeatures); + if (lFeatures & (SPCM_FEAT_STARHUB4 | SPCM_FEAT_STARHUB16)) + bStarHubAvailable = true; + + if ((lFncType != SPCM_TYPE_AI) && (lFncType != SPCM_TYPE_AO)) + { + printf ("Card: %s sn %05d not supported by example\n", szTypeToName (lCardType), lSerialNumber); + bError = true; + } + else + { + printf ("Found: %s sn %05d\n", szTypeToName (lCardType), lSerialNumber); + + ST_CARD stCard; + stCard.hCard = hCard; + stCard.lFncType = lFncType; + stCard.lMaxADCValue = lMaxADCValue; + + if ((lFirstAICardIdx < 0) && (lFncType == SPCM_TYPE_AI)) + lFirstAICardIdx = lCardsCount; + + astCards[lCardsCount++] = stCard; + } + } + + // try to open the star-hub + if (!bError && bStarHubAvailable) + { + hSync = spcm_hOpen ("sync0"); + if (!hSync) + { + printf ("no star-hub found. This is essential for the example ...\n"); + bError = true; + } + else + printf ("Found Star-Hub ...\n"); + } + + // define the data buffer + for (int32 lCardIdx = 0; !bError && (lCardIdx < lCardsCount); lCardIdx++) + { + astCards[lCardIdx].pnData = (int16*) pvAllocMemPageAligned ((uint64) llBufferSize); + if (!astCards[lCardIdx].pnData) + { + printf ("memory allocation failed\n"); + bError = true; + } + + if (!bError) + { + switch (astCards[lCardIdx].lFncType) + { + case SPCM_TYPE_AI: + bError = bSetupAICard (astCards[lCardIdx].hCard); + spcm_dwDefTransfer_i64 (astCards[lCardIdx].hCard, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, lNotifySize, astCards[lCardIdx].pnData, 0, llBufferSize); + break; + + case SPCM_TYPE_AO: + bError = bSetupAOCard (astCards[lCardIdx].hCard); + spcm_dwDefTransfer_i64 (astCards[lCardIdx].hCard, SPCM_BUF_DATA, SPCM_DIR_PCTOCARD, lNotifySize, astCards[lCardIdx].pnData, 0, llBufferSize); + + // calculate data for output (a sine in this case) + for (int64 llPos = 0; llPos < llBufferSize; ++llPos) + astCards[lCardIdx].pnData[llPos / sizeof (int16)] = static_cast < int16 > (astCards[lCardIdx].lMaxADCValue * sin (((2.0 * M_PI * llPos) / llBufferSize) * dwNumPeriodsInBuffer)); + break; + } + } + } + + // do the sync setup + if (!bError) + { + spcm_dwSetParam_i32 (hSync, SPC_SYNC_ENABLEMASK, (1 << lCardsCount) - 1); + + // transfer data in buffer to DA cards memory + for (int32 lCardIdx = 0; !bError && (lCardIdx < lCardsCount); lCardIdx++) + { + astCards[lCardIdx].bDMAStarted = false; + + if (astCards[lCardIdx].lFncType == SPCM_TYPE_AO) + { + spcm_dwSetParam_i64 (astCards[lCardIdx].hCard, SPC_DATA_AVAIL_CARD_LEN, llBufferSize); + spcm_dwSetParam_i32 (astCards[lCardIdx].hCard, SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA); + astCards[lCardIdx].bDMAStarted = true; + } + } + } + + // ------------------------------------------------------------------------ + // this is the main data loop: we wait for all cards having data available + // in a loop. This may be put into threads to have one thread controlling data of + // one card. + uint64 qwTotalMem = 0; + + int64 llBufferFillPromille = 0; + + bool bStartCards = false; + bool bStarted = false; + + if (!bError) + { + printf ("\n***** Before all cards are started the DA cards buffers are filled to %d%% *****\n", lFillSizePercentStart); + + // run the FIFO loop + bool bAbort = false; + while ((qwTotalMem < qwBytesToTransfer) && !bError && !bAbort) + { + if (bStartCards) + { + printf ("\n\n***** Start Cards *****\n"); + + // start DMA transfer for all AD cards + for (int32 lCardIdx = 0; lCardIdx < lCardsCount; lCardIdx++) + { + if (astCards[lCardIdx].lFncType == SPCM_TYPE_AI) + { + spcm_dwSetParam_i32 (astCards[lCardIdx].hCard, SPC_M2CMD, M2CMD_DATA_STARTDMA); + astCards[lCardIdx].bDMAStarted = true; + } + } + + // start command including enable of trigger engine -> error check + if (spcm_dwSetParam_i32 (hSync, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER) != ERR_OK) + { + spcm_dwGetErrorInfo_i32 (hSync, NULL, NULL, szErrorTextBuffer); + printf ("%s\n", szErrorTextBuffer); + bError = true; + } + bStarted = true; + bStartCards = false; + } + + + for (int32 lCardIdx = 0; !bError && (lCardIdx < lCardsCount); lCardIdx++) + { + // wait for new data to be available and check return value + if (astCards[lCardIdx].bDMAStarted) + { + switch (spcm_dwSetParam_i32 (astCards[lCardIdx].hCard, SPC_M2CMD, M2CMD_DATA_WAITDMA)) + { + case ERR_TIMEOUT: + printf ("... timeout\n"); + bError = true; + break; + + case ERR_FIFOHWOVERRUN: + case ERR_FIFOBUFOVERRUN: + printf ("... buffer overrun\n"); + bError = true; + break; + + case ERR_OK: + break; + + default: + bError = true; + break; + } + } + + // ***** AD Card ***** + if (bStarted && (astCards[lCardIdx].lFncType == SPCM_TYPE_AI)) + { + // read out status information, available data and do something with the data + if (!bError) + { + spcm_dwGetParam_i32 (astCards[lCardIdx].hCard, SPC_M2STATUS, &lStatus); + spcm_dwGetParam_i64 (astCards[lCardIdx].hCard, SPC_DATA_AVAIL_USER_LEN, &llAvailUser); + spcm_dwGetParam_i64 (astCards[lCardIdx].hCard, SPC_DATA_AVAIL_USER_POS, &llPCPos); + + if (llAvailUser >= lNotifySize) + { + // we count data only on first card + if (lCardIdx == lFirstAICardIdx) + qwTotalMem += lNotifySize; + + printf ("AD: Card:%d: Stat:%08x Pos:%016llx Avail:%016llx Total:%.2fMB\r", lCardIdx, lStatus, llPCPos, llAvailUser, (double) (int64) qwTotalMem / MEGA_B(1)); + + // !!!!!!!!!! this is the point to do anything with the data !!!!!!!!!! + // in the example we set all data to zero to show how to access the buffer + // Please note that SPC_DATA_AVAIL_USER_POS and SPC_DATA_AVAIL_USER_LEN give position + // and length in bytes. To acces int16 array we therefore use lPCPos/2 + memset ((void*) &astCards[lCardIdx].pnData[llPCPos/2], 0, lNotifySize); + + // buffer is free for DMA transfer again + spcm_dwSetParam_i32 (astCards[lCardIdx].hCard, SPC_DATA_AVAIL_CARD_LEN, lNotifySize); + } + } + } + + // ***** DA Card ***** + if (astCards[lCardIdx].lFncType == SPCM_TYPE_AO) + { + // get available space in DMA buffer + spcm_dwGetParam_i64 (astCards[lCardIdx].hCard, SPC_DATA_AVAIL_USER_LEN, &llAvailUser); + spcm_dwGetParam_i64 (astCards[lCardIdx].hCard, SPC_FILLSIZEPROMILLE, &llBufferFillPromille); + + if (!bStarted) + printf ("DA: Card: %d SW-Buffer: %3.0f%% HW-Buffer:%3d%%\r", lCardIdx, (float) 100.0 * (llBufferSize - llAvailUser) / llBufferSize, (uint32) llBufferFillPromille / 10); + + if (llAvailUser >= lNotifySize) + { + // get position of free space in DMA buffer + spcm_dwGetParam_i64 (astCards[lCardIdx].hCard, SPC_DATA_AVAIL_USER_POS, &llPCPos); + + // avoid buffer wrap-around + int64 llDataToWrite = lNotifySize; + if (llPCPos + lNotifySize > llBufferSize) + llDataToWrite = llBufferSize - llPCPos; + + // calculate new data + for (int64 llPos = llPCPos; llPos < llPCPos + llDataToWrite; ++llPos) + astCards[lCardIdx].pnData[llPos / sizeof (int16)] = static_cast < int16 > (lMaxADCValue * sin (((2.0 * M_PI * llPos) / llBufferSize) * dwNumPeriodsInBuffer)); + + // set data available for transfer + spcm_dwSetParam_i64 (astCards[lCardIdx].hCard, SPC_DATA_AVAIL_CARD_LEN, llDataToWrite); + } + + // we start the output as soon as we have a sufficient amount of data on card + // inhere we start if the hardware buffer is 50% filled + if (!bStarted && !bError && (llBufferFillPromille >= 10*lFillSizePercentStart)) + bStartCards = true; + } + } + + // check for esape = abort + if (bKbhit()) + { + if (cGetch() == 27) + { + bAbort = true; + break; + } + } + } + + printf ("\n\n"); + } + + // stop card + spcm_dwSetParam_i32 (hSync, SPC_M2CMD, M2CMD_CARD_STOP); + + // check for errors + if (bError) + { + for (int32 lCardIdx = 0; lCardIdx < lCardsCount; lCardIdx++) + { + spcm_dwGetErrorInfo_i32 (astCards[lCardIdx].hCard, NULL, NULL, szErrorTextBuffer); + printf ("Error card %d: %s\n", lCardIdx, szErrorTextBuffer); + } + } + + for (int32 lCardIdx = 0; lCardIdx < lCardsCount; lCardIdx++) + { + // stop DMA + spcm_dwSetParam_i32 (astCards[lCardIdx].hCard, SPC_M2CMD, M2CMD_DATA_STOPDMA); + + // clean up + if (astCards[lCardIdx].pnData) + vFreeMemPageAligned (astCards[lCardIdx].pnData, (uint64) llBufferSize); + } + + if (hSync) + spcm_vClose (hSync); + + for (int32 lCardIdx = 0; lCardIdx < lCardsCount; lCardIdx++) + spcm_vClose (astCards[lCardIdx].hCard); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/simple_sync_io_fifo/simple_sync_io_fifo.vcxproj b/Cpp/examples/c_cpp/simple_sync_io_fifo/simple_sync_io_fifo.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..d4d109e990444e9e42272f8365d29fa9f45b6a99 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_sync_io_fifo/simple_sync_io_fifo.vcxproj @@ -0,0 +1,262 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{AB068386-BB5C-4442-ACFF-B5D9A79C311A}</ProjectGuid> + <RootNamespace>rec_std_single</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="simple_sync_io_fifo.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/simple_sync_io_fifo/simple_sync_io_fifo.vcxproj.filters b/Cpp/examples/c_cpp/simple_sync_io_fifo/simple_sync_io_fifo.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..3212da2fb1cfefcc82f95c15281fbd1223932c48 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_sync_io_fifo/simple_sync_io_fifo.vcxproj.filters @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="simple_sync_io_fifo.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_oswrap.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib" /> + <Library Include="..\c_header\spcm_win64_msvcpp.lib" /> + </ItemGroup> + <ItemGroup> + <Filter Include="header"> + <UniqueIdentifier>{bf578d6c-ab53-47b4-8ae9-071cf05640c7}</UniqueIdentifier> + </Filter> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/simple_sync_rec_fifo/makefile b/Cpp/examples/c_cpp/simple_sync_rec_fifo/makefile new file mode 100644 index 0000000000000000000000000000000000000000..faf1c8b57f63f272ea8fd7891e3d424cf44df4cf --- /dev/null +++ b/Cpp/examples/c_cpp/simple_sync_rec_fifo/makefile @@ -0,0 +1,21 @@ +COMPILER = g++ +EXECUTABLE = simple_sync_rec_fifo +LIBS += -lspcm_linux -lpthread -lrt + +OBJECTS = simple_sync_rec_fifo.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/simple_sync_rec_fifo/simple_sync_rec_fifo.cpp b/Cpp/examples/c_cpp/simple_sync_rec_fifo/simple_sync_rec_fifo.cpp new file mode 100644 index 0000000000000000000000000000000000000000..474513f5cd732cd357ad5bf92410a50e2e19b67f --- /dev/null +++ b/Cpp/examples/c_cpp/simple_sync_rec_fifo/simple_sync_rec_fifo.cpp @@ -0,0 +1,334 @@ +/* +************************************************************************** + +simple_sync_rec_fifo.cpp (c) Spectrum GmbH + +************************************************************************** + +Example for all SpcMDrv based analog acquisition cards. + +Information about the different products and their drivers can be found +online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/platform-driver-and-series-differences + +Shows a synchronized FIFO mode example using only the few necessary commands. + +Feel free to use this source for own projects and modify it in any kind. + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +#include "../common/ostools/spcm_oswrap.h" +#include "../common/ostools/spcm_ostools.h" + +// ----- standard c include files ----- +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + + +/* +************************************************************************** +szTypeToName: doing name translation +************************************************************************** +*/ + +char* szTypeToName (int32 lCardType) + { + static char szName[50]; + switch (lCardType & TYP_SERIESMASK) + { + case TYP_M2ISERIES: sprintf (szName, "M2i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M2IEXPSERIES: sprintf (szName, "M2i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M3ISERIES: sprintf (szName, "M3i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M3IEXPSERIES: sprintf (szName, "M3i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M4IEXPSERIES: sprintf (szName, "M4i.%04x-x8", lCardType & TYP_VERSIONMASK); break; + case TYP_M4XEXPSERIES: sprintf (szName, "M4x.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M2PEXPSERIES: sprintf (szName, "M2p.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M5IEXPSERIES: sprintf (szName, "M5i.%04x-x16", lCardType & TYP_VERSIONMASK); break; + default: sprintf (szName, "unknown type"); break; + } + return szName; + } + + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + drv_handle ahCard[16]; + drv_handle hSync = 0; + bool bError = false; + int32 lIdx, lCardCount; + int32 lCardType, lSerialNumber, lFncType, lFeatures, lStarHubCarrierIdx = 0; + int64 llTmp; + int16* apnData[16]; + char szErrorTextBuffer[ERRORTEXTLEN], szName[50]; + int32 lStatus; + int64 llAvailUser, llPCPos; + uint64 qwTotalMem = 0; + uint64 qwToTransfer = MEGA_B(512); + + // settings for the FIFO mode buffer handling + uint64 qwBufferSize = MEGA_B(16); + int32 lNotifySize = KILO_B(128); + int64 llSamplerate = KILO(100); + + // ------------------------------------------------------------------------ + // we try to open all cards and printout some information on them + for (lCardCount = 0; !bError && (lCardCount < 16); lCardCount++) + { + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + sprintf (szName, "/dev/spcm%d", lCardCount); + // sprintf (szName, "TCPIP::192.168.1.10::inst%d::INSTR", lCardCount); + ahCard[lCardCount] = spcm_hOpen (szName); + apnData[lCardCount] = NULL; + + // not one card found + if (!lCardCount && !ahCard[lCardCount]) + { + printf ("no card found...\n"); + return 0; + } + + // no more cards found in system + if (!ahCard[lCardCount]) + break; + + // read out some info and print it + spcm_dwGetParam_i32 (ahCard[lCardCount], SPC_PCITYP, &lCardType); + spcm_dwGetParam_i32 (ahCard[lCardCount], SPC_PCISERIALNO, &lSerialNumber); + spcm_dwGetParam_i32 (ahCard[lCardCount], SPC_FNCTYPE, &lFncType); + + // we check for minimum samplerate (on first series of M3i sync only works with min samplerate * 2) + spcm_dwGetParam_i64 (ahCard[lCardCount], SPC_MIINST_MINADCLOCK, &llTmp); + if ((2*llTmp) > llSamplerate) + llSamplerate = (2*llTmp); + + // we check which card carries the StarHub + spcm_dwGetParam_i32 (ahCard[lCardCount], SPC_PCIFEATURES, &lFeatures); + if (lFeatures & (SPCM_FEAT_STARHUB4 | SPCM_FEAT_STARHUB16)) + lStarHubCarrierIdx = lCardCount; + + switch (lFncType) + { + case SPCM_TYPE_AI: + printf ("Found: %s sn %05d\n", szTypeToName (lCardType), lSerialNumber); + break; + + // only A/D cards allowed in example + default: + printf ("Card: %s sn %05d not supported by example\n", szTypeToName (lCardType), lSerialNumber); + bError = true; + break; + } + } + + + // ------------------------------------------------------------------------ + // try to open the star-hub + if (!bError) + { + hSync = spcm_hOpen ("sync0"); + if (!hSync) + { + printf ("no star-hub found. This is essential for the example ...\n"); + bError = true; + } + else + printf ("Found Star-Hub ...\n"); + } + + + // ------------------------------------------------------------------------ + // do a simple standard setup for all cards + for (lIdx = 0; !bError && (lIdx < lCardCount); lIdx++) + { + spcm_dwSetParam_i32 (ahCard[lIdx], SPC_CHENABLE, CHANNEL0); // just 1 channel enabled + spcm_dwSetParam_i32 (ahCard[lIdx], SPC_PRETRIGGER, 1024); // 1k of pretrigger data at start of FIFO mode + spcm_dwSetParam_i32 (ahCard[lIdx], SPC_CARDMODE, SPC_REC_FIFO_SINGLE); // single FIFO mode + spcm_dwSetParam_i32 (ahCard[lIdx], SPC_TIMEOUT, 5000); // timeout 5 s + spcm_dwSetParam_i32 (ahCard[lIdx], SPC_CLOCKMODE, SPC_CM_INTPLL); // clock mode internal PLL + spcm_dwSetParam_i64 (ahCard[lIdx], SPC_SAMPLERATE, llSamplerate); // sampling clock (100k or smallest possible) + spcm_dwSetParam_i32 (ahCard[lIdx], SPC_CLOCKOUT, 0); // no clock output + + // trigger mode definition (in our example it is software trigger) + spcm_dwSetParam_i32 (ahCard[lIdx], SPC_TRIG_ORMASK, 0); + spcm_dwSetParam_i32 (ahCard[lIdx], SPC_TRIG_ANDMASK, 0); + spcm_dwSetParam_i32 (ahCard[lIdx], SPC_TRIG_ORMASK, SPC_TMASK_SOFTWARE); + } + + // ------------------------------------------------------------------------ + // define and allocate the data buffers + for (lIdx = 0; !bError && (lIdx < lCardCount); lIdx++) + { + void* pvContBuf = NULL; + uint64 qwContBufLen = 0; + spcm_dwGetContBuf_i64 (ahCard[lIdx], SPCM_BUF_DATA, &pvContBuf, &qwContBufLen); + if (qwContBufLen >= qwBufferSize) + { + printf ("using continuous memory\n"); + apnData[lIdx] = (int16*)pvContBuf; + } + else + apnData[lIdx] = (int16*) pvAllocMemPageAligned (qwBufferSize); + + if (!apnData[lIdx]) + { + printf ("memory allocation failed\n"); + bError = true; + } + else + spcm_dwDefTransfer_i64 (ahCard[lIdx], SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, lNotifySize, apnData[lIdx], 0, qwBufferSize); + } + + + // ------------------------------------------------------------------------ + // do the sync setup, start and check for error + if (!bError) + { + spcm_dwSetParam_i32 (hSync, SPC_SYNC_ENABLEMASK, (1 << lCardCount) - 1); + + // clock mask only used for M2i series. Ignored on M3i series + spcm_dwSetParam_i32 (hSync, SPC_SYNC_CLKMASK, (1 << lStarHubCarrierIdx)); + + // start DMA on each card (prior to card start to have DMA armed if first data is coming) + for (lIdx = 0; !bError && (lIdx < lCardCount); lIdx++) + spcm_dwSetParam_i32 (ahCard[lIdx], SPC_M2CMD, M2CMD_DATA_STARTDMA); + + // start command including enable of trigger engine -> error check + if (spcm_dwSetParam_i32 (hSync, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER) != ERR_OK) + { + spcm_dwGetErrorInfo_i32 (hSync, NULL, NULL, szErrorTextBuffer); + printf ("%s\n", szErrorTextBuffer); + bError = true; + } + } + + + // ------------------------------------------------------------------------ + // this is the main data loop: we wait for all cards having data available + // in a loop. This may be put into threads to have one thread controlling data of + // one card. In our example we simply put it in the main loop as each card is + // configured similar and will have data available at the same time + if (!bError) + { + + // run the FIFO loop + bool bAbort = false; + while ((qwTotalMem < qwToTransfer) && !bError && !bAbort) + { + for (lIdx = 0; !bError && (lIdx < lCardCount); lIdx++) + { + + // wait for new data to be available and check return value + switch (spcm_dwSetParam_i32 (ahCard[lIdx], SPC_M2CMD, M2CMD_DATA_WAITDMA)) + { + case ERR_TIMEOUT: + printf ("... timeout\n"); + bError = true; + break; + + case ERR_FIFOHWOVERRUN: + case ERR_FIFOBUFOVERRUN: + printf ("... buffer overrun\n"); + bError = true; + break; + + case ERR_OK: + break; + + default: + bError = true; + break; + } + + // read out status information, available data and do something with the data + if (!bError) + { + spcm_dwGetParam_i32 (ahCard[lIdx], SPC_M2STATUS, &lStatus); + spcm_dwGetParam_i64 (ahCard[lIdx], SPC_DATA_AVAIL_USER_LEN, &llAvailUser); + spcm_dwGetParam_i64 (ahCard[lIdx], SPC_DATA_AVAIL_USER_POS, &llPCPos); + + if (llAvailUser >= lNotifySize) + { + // we count data only on first card + if (lIdx == 0) + qwTotalMem += lNotifySize; + + printf ("Card:%d: Stat:%08x Pos:%016llx Avail:%016llx Total:%.2fMB\n", lIdx, lStatus, llPCPos, llAvailUser, (double) (int64) qwTotalMem / MEGA_B(1)); + + // !!!!!!!!!! this is the point to do anything with the data !!!!!!!!!! + // in the example we set all data to zero to show how to access the buffer + // Please note that SPC_DATA_AVAIL_USER_POS and SPC_DATA_AVAIL_USER_LEN give position + // and length in bytes. To acces int16 array we therefore use lPCPos/2 + memset ((void*) &apnData[lIdx][llPCPos/2], 0, lNotifySize); + + // buffer is free for DMA transfer again + spcm_dwSetParam_i32 (ahCard[lIdx], SPC_DATA_AVAIL_CARD_LEN, lNotifySize); + } + + // check for esape = abort + if (bKbhit()) + { + if (cGetch() == 27) + { + bAbort = true; + break; + } + } + } + } + } + } + + + // ------------------------------------------------------------------------ + // check for errors + if (bError) + { + for (lIdx = 0; lIdx < lCardCount; lIdx++) + spcm_dwGetErrorInfo_i32 (ahCard[lIdx], NULL, NULL, szErrorTextBuffer); + printf ("Error card %d: %s\n", lIdx, szErrorTextBuffer); + } + + // no error: we managed to run through completely + else + printf ("\nfinished ...\n"); + + // send the stop command + spcm_dwSetParam_i32 (hSync, SPC_M2CMD, M2CMD_CARD_STOP | M2CMD_DATA_STOPDMA); + + // clean up + for (lIdx = 0; lIdx < lCardCount; lIdx++) + if (apnData[lIdx]) + vFreeMemPageAligned (apnData[lIdx], qwBufferSize); + + if (hSync) + spcm_vClose (hSync); + for (lIdx = 0; lIdx < lCardCount; lIdx++) + spcm_vClose (ahCard[lIdx]); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/simple_sync_rec_fifo/simple_sync_rec_fifo.sln b/Cpp/examples/c_cpp/simple_sync_rec_fifo/simple_sync_rec_fifo.sln new file mode 100644 index 0000000000000000000000000000000000000000..2e8d6199a571d863f638d8ca4463be970a07c9e0 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_sync_rec_fifo/simple_sync_rec_fifo.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simple_sync_rec_fifo", "simple_sync_rec_fifo.vcproj", "{AB068386-BB5C-4442-ACFF-B5D9A79C311A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|Win32.ActiveCfg = Debug|Win32 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|Win32.Build.0 = Debug|Win32 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|x64.ActiveCfg = Debug|x64 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|x64.Build.0 = Debug|x64 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|Win32.ActiveCfg = Release|Win32 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|Win32.Build.0 = Release|Win32 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|x64.ActiveCfg = Release|x64 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Cpp/examples/c_cpp/simple_sync_rec_fifo/simple_sync_rec_fifo.vcproj b/Cpp/examples/c_cpp/simple_sync_rec_fifo/simple_sync_rec_fifo.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..0c63b663aaabbd68a0351383050aaeeb2e707d04 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_sync_rec_fifo/simple_sync_rec_fifo.vcproj @@ -0,0 +1,464 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="simple_sync_rec_fifo" + ProjectGUID="{AB068386-BB5C-4442-ACFF-B5D9A79C311A}" + RootNamespace="rec_std_single" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/rec_std_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_std_single.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_std_single.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_std_single.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_std_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/rec_std_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_std_single.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_std_single.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_std_single.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_std_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/rec_std_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_std_single.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_std_single.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_std_single.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_std_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/rec_std_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_std_single.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_std_single.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_std_single.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_std_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="header" + Filter="h;hpp;hxx;hm;inl" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_oswrap.h" + > + </File> + </Filter> + <File + RelativePath=".\simple_sync_rec_fifo.cpp" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/simple_sync_rec_fifo/simple_sync_rec_fifo.vcxproj b/Cpp/examples/c_cpp/simple_sync_rec_fifo/simple_sync_rec_fifo.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..0a6b26b3e6a25f055352d8ce2f25331c75893189 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_sync_rec_fifo/simple_sync_rec_fifo.vcxproj @@ -0,0 +1,262 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{AB068386-BB5C-4442-ACFF-B5D9A79C311A}</ProjectGuid> + <RootNamespace>rec_std_single</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="simple_sync_rec_fifo.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/simple_sync_rec_fifo/simple_sync_rec_fifo.vcxproj.filters b/Cpp/examples/c_cpp/simple_sync_rec_fifo/simple_sync_rec_fifo.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..704f5c1cee5e671a4a388dc0a7fe78819af80052 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_sync_rec_fifo/simple_sync_rec_fifo.vcxproj.filters @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="header"> + <UniqueIdentifier>{d569a4a9-5861-4381-8b4a-7b4bc1fe5712}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_oswrap.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="simple_sync_rec_fifo.cpp" /> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib" /> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib" /> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/simple_sync_rep_fifo/makefile b/Cpp/examples/c_cpp/simple_sync_rep_fifo/makefile new file mode 100644 index 0000000000000000000000000000000000000000..97bf8d106814331b28f28e49074250fbb6c9cfe4 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_sync_rep_fifo/makefile @@ -0,0 +1,21 @@ +COMPILER = g++ +EXECUTABLE = simple_sync_rep_fifo +LIBS += -lspcm_linux -lpthread -lrt + +OBJECTS = simple_sync_rep_fifo.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/simple_sync_rep_fifo/simple_sync_rep_fifo.cpp b/Cpp/examples/c_cpp/simple_sync_rep_fifo/simple_sync_rep_fifo.cpp new file mode 100644 index 0000000000000000000000000000000000000000..41d53f457dbc7873ec9f98a0fef2b50ebaa4ee52 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_sync_rep_fifo/simple_sync_rep_fifo.cpp @@ -0,0 +1,373 @@ +/* +************************************************************************** + +simple_sync_rep_fifo.cpp (c) Spectrum GmbH + +************************************************************************** + +Example for all SpcMDrv based analog generation cards. + +Information about the different products and their drivers can be found +online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/platform-driver-and-series-differences + +Shows a synchronized FIFO mode example using only the few necessary commands + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +#include "../common/ostools/spcm_oswrap.h" +#include "../common/ostools/spcm_ostools.h" + +// ----- standard c include files ----- +#include <stdio.h> +#include <stdlib.h> + +#define _USE_MATH_DEFINES // for M_PI +#include <math.h> + +/* +************************************************************************** +szTypeToName: doing name translation +************************************************************************** +*/ + +char* szTypeToName (int32 lCardType) + { + static char szName[50]; + switch (lCardType & TYP_SERIESMASK) + { + case TYP_M2ISERIES: sprintf (szName, "M2i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M2IEXPSERIES: sprintf (szName, "M2i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M3ISERIES: sprintf (szName, "M3i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M3IEXPSERIES: sprintf (szName, "M3i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M4IEXPSERIES: sprintf (szName, "M4i.%04x-x8", lCardType & TYP_VERSIONMASK); break; + case TYP_M4XEXPSERIES: sprintf (szName, "M4x.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M2PEXPSERIES: sprintf (szName, "M2p.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M5IEXPSERIES: sprintf (szName, "M5i.%04x-x16", lCardType & TYP_VERSIONMASK); break; + default: sprintf (szName, "unknown type"); break; + } + return szName; + } + + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + drv_handle ahCard[16]; + drv_handle hSync = 0; + bool bError = false; + int32 lIdx, lCardCount; + int32 lCardType, lSerialNumber, lFncType, lFeatures, lStarHubCarrierIdx; + int16* apnData[16]; + char szErrorTextBuffer[ERRORTEXTLEN], szName[50]; + + // settings for the FIFO mode buffer handling + int64 llSamplerate = MEGA(1); + + // setup for the FIFO mode (HW buffer size can be programmed starting with firmware V9) + int64 llBufferSize = MEGA_B(16); + int64 llHWBufSize = MEGA_B(32); + uint32 dwNotifySize = MEGA_B(1); + + uint32 dwNumPeriodsInBuffer = 128; + + // some example checks + if (llBufferSize % dwNotifySize) + { + printf ("In our example we can only handle sw buffers that are a whole numbered multiple of the notify size\n"); + return 1; + } + + // ------------------------------------------------------------------------ + // we try to open all cards and printout some information on them + for (lCardCount = 0; !bError && (lCardCount < 16); lCardCount++) + { + // uncomment the second line and replace the IP address to use remote + // cards like in a generatorNETBOX + sprintf (szName, "/dev/spcm%d", lCardCount); + // sprintf (szName, "TCPIP::192.168.1.10::inst%d::INSTR", lCardCount); + ahCard[lCardCount] = spcm_hOpen (szName); + apnData[lCardCount] = NULL; + + // not one card found + if (!lCardCount && !ahCard[lCardCount]) + { + printf ("no card found...\n"); + return 0; + } + + // no more cards found in system + if (!ahCard[lCardCount]) + break; + + // read out some info and print it + spcm_dwGetParam_i32 (ahCard[lCardCount], SPC_PCITYP, &lCardType); + spcm_dwGetParam_i32 (ahCard[lCardCount], SPC_PCISERIALNO, &lSerialNumber); + spcm_dwGetParam_i32 (ahCard[lCardCount], SPC_FNCTYPE, &lFncType); + + // we check which card carries the StarHub + spcm_dwGetParam_i32 (ahCard[lCardCount], SPC_PCIFEATURES, &lFeatures); + if (lFeatures & (SPCM_FEAT_STARHUB4 | SPCM_FEAT_STARHUB16)) + lStarHubCarrierIdx = lCardCount; + + switch (lFncType) + { + case SPCM_TYPE_AO: + printf ("Found: %s sn %05d\n", szTypeToName (lCardType), lSerialNumber); + break; + + // only D/A cards allowed in example + default: + printf ("Card: %s sn %05d not supported by example\n", szTypeToName (lCardType), lSerialNumber); + bError = true; + break; + } + } + + int32 lMaxADCValue = 0; + spcm_dwGetParam_i32 (ahCard[0], SPC_MIINST_MAXADCVALUE, &lMaxADCValue); + + // ------------------------------------------------------------------------ + // try to open the star-hub + if (!bError) + { + hSync = spcm_hOpen ("sync0"); + if (!hSync) + { + printf ("no star-hub found. This is essential for the example ...\n"); + bError = true; + } + else + printf ("Found Star-Hub ...\n"); + } + + + // ------------------------------------------------------------------------ + // do a simple standard setup for all cards + for (lIdx = 0; !bError && (lIdx < lCardCount); lIdx++) + { + spcm_dwSetParam_i32 (ahCard[lIdx], SPC_CHENABLE, CHANNEL0); // just 1 channel enabled + spcm_dwSetParam_i32 (ahCard[lIdx], SPC_CARDMODE, SPC_REP_FIFO_SINGLE); // single FIFO mode + spcm_dwSetParam_i32 (ahCard[lIdx], SPC_TIMEOUT, 5000); // timeout 5 s + spcm_dwSetParam_i32 (ahCard[lIdx], SPC_CLOCKMODE, SPC_CM_INTPLL); // clock mode internal PLL + spcm_dwSetParam_i64 (ahCard[lIdx], SPC_SAMPLERATE, llSamplerate); // sampling clock (100k or smallest possible) + spcm_dwSetParam_i32 (ahCard[lIdx], SPC_CLOCKOUT, 0); // no clock output + spcm_dwSetParam_i32 (ahCard[lIdx], SPC_AMP0, 1000); // 1V output amplitude + spcm_dwSetParam_i32 (ahCard[lIdx], SPC_LOOPS, 0); // loop continuous + + // trigger mode definition (in our example it is software trigger) + spcm_dwSetParam_i32 (ahCard[lIdx], SPC_TRIG_ORMASK, 0); + spcm_dwSetParam_i32 (ahCard[lIdx], SPC_TRIG_ANDMASK, 0); + spcm_dwSetParam_i32 (ahCard[lIdx], SPC_TRIG_ORMASK, SPC_TMASK_SOFTWARE); + } + + // starting with firmware version V9 we can program the hardware buffer size to reduce the latency + for (lIdx = 0; !bError && (lIdx < lCardCount); lIdx++) + { + int32 lFWVersion = 0; + spcm_dwGetParam_i32 (ahCard[lIdx], SPC_PCIVERSION, &lFWVersion); + if (lFWVersion >= 9) + { + spcm_dwSetParam_i64 (ahCard[lIdx], SPC_DATA_OUTBUFSIZE, llHWBufSize); + spcm_dwSetParam_i32 (ahCard[lIdx], SPC_M2CMD, M2CMD_CARD_WRITESETUP); + } + } + + // ------------------------------------------------------------------------ + // define and allocate the data buffers + for (lIdx = 0; !bError && (lIdx < lCardCount); lIdx++) + { + apnData[lIdx] = (int16*) pvAllocMemPageAligned ((uint64) llBufferSize); + if (!apnData[lIdx]) + { + printf ("memory allocation failed\n"); + bError = true; + } + else + spcm_dwDefTransfer_i64 (ahCard[lIdx], SPCM_BUF_DATA, SPCM_DIR_PCTOCARD, dwNotifySize, apnData[lIdx], 0, llBufferSize); + } + + // ------------------------------------------------------------------------ + // calculate data for output (a sine in this case) + for (lIdx = 0; !bError && (lIdx < lCardCount); lIdx++) + { + for (int64 llPos = 0; llPos < llBufferSize; ++llPos) + { + apnData[lIdx][llPos / sizeof (int16)] = static_cast < int16 > (lMaxADCValue * sin (((2.0 * M_PI * llPos) / llBufferSize) * dwNumPeriodsInBuffer)); + } + } + + // ------------------------------------------------------------------------ + // do the sync setup, start and check for error + if (!bError) + { + spcm_dwSetParam_i32 (hSync, SPC_SYNC_ENABLEMASK, (1 << lCardCount) - 1); + + // clock mask only used for M2i series + spcm_dwSetParam_i32 (hSync, SPC_SYNC_CLKMASK, (1 << lStarHubCarrierIdx)); + + // transfer data in buffer to card memory + for (lIdx = 0; !bError && (lIdx < lCardCount); lIdx++) + { + spcm_dwSetParam_i64 (ahCard[lIdx], SPC_DATA_AVAIL_CARD_LEN, llBufferSize); + + spcm_dwSetParam_i32 (ahCard[lIdx], SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA); + } + } + + + // ------------------------------------------------------------------------ + // this is the main data loop: we wait for all cards to have space available + // in a loop. This may be put into threads to have one thread controlling data of + // one card. In our example we simply put it in the main loop as each card is + // configured similar and will have space available at the same time + if (!bError) + { + int64 llTransferredBytes[16] = { 0 }; + int64 llAvailUser = 0; + int64 llBufferFillPromille = 0; + int64 llUserPos = 0; + bool bStarted = false; + bool bAbort = false; + + // run the FIFO loop + uint32 dwNumCardsFilled = 0; // count number of cards whose memory has been filled (only pre-start) + while (!bError && !bAbort) + { + printf ("\n"); + for (lIdx = 0; !bError && !bAbort && (lIdx < lCardCount); lIdx++) + { + // get available space in DMA buffer + spcm_dwGetParam_i64 (ahCard[lIdx], SPC_DATA_AVAIL_USER_LEN, &llAvailUser); + spcm_dwGetParam_i64 (ahCard[lIdx], SPC_FILLSIZEPROMILLE, &llBufferFillPromille); + printf ("Card: %d SW-Buffer: %3.0f%% HW-Buffer:%3d%%, Total Bytes so far: %6.2f MB\n", lIdx, (float) 100.0 * (llBufferSize - llAvailUser) / llBufferSize, (uint32) llBufferFillPromille / 10, (float) llTransferredBytes[lIdx] / MEGA_B(1)); + + if (llAvailUser >= dwNotifySize) + { + // get position of free space in DMA buffer + spcm_dwGetParam_i64 (ahCard[lIdx], SPC_DATA_AVAIL_USER_POS, &llUserPos); + + // avoid buffer wrap-around + int64 llDataToWrite = dwNotifySize; + if (llUserPos + dwNotifySize > llBufferSize) + llDataToWrite = llBufferSize - llUserPos; + + // calculate new data + for (int64 llPos = llUserPos; llPos < llUserPos + llDataToWrite; ++llPos) + { + apnData[lIdx][llPos / sizeof (int16)] = static_cast < int16 > (lMaxADCValue * sin (((2.0 * M_PI * llPos) / llBufferSize) * dwNumPeriodsInBuffer)); + } + + // set data available for transfer + spcm_dwSetParam_i64 (ahCard[lIdx], SPC_DATA_AVAIL_CARD_LEN, llDataToWrite); + llTransferredBytes[lIdx] += llDataToWrite; + } + + // we start the output as soon as we have a sufficient amount of data on card + // inhere we start if the hardware buffer is completely full + if (!bStarted && !bError && (llBufferFillPromille == 1000)) + { + dwNumCardsFilled++; + + // when the memory of all cards has been filled, start the cards + if (dwNumCardsFilled == lCardCount) + { + printf ("\nStart the output\n"); + + // start command including enable of trigger engine -> error check + if (spcm_dwSetParam_i32 (hSync, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER) != ERR_OK) + { + spcm_dwGetErrorInfo_i32 (hSync, NULL, NULL, szErrorTextBuffer); + printf ("%s\n", szErrorTextBuffer); + bError = true; + } + bStarted = true; + } + } + + // wait for the next buffer to be free + switch (spcm_dwSetParam_i32 (ahCard[lIdx], SPC_M2CMD, M2CMD_DATA_WAITDMA)) + { + case ERR_TIMEOUT: + printf ("... timeout\n"); + bError = true; + break; + + case ERR_FIFOHWOVERRUN: + case ERR_FIFOBUFOVERRUN: + printf ("... buffer underrun\n"); + bError = true; + break; + + case ERR_OK: + break; + + default: + bError = true; + break; + } + + // check for esape = abort + if (bKbhit ()) + { + if (cGetch () == 27) + bAbort = true; + } + } + } + } + + + // ------------------------------------------------------------------------ + // check for errors + if (bError) + { + for (lIdx = 0; lIdx < lCardCount; lIdx++) + spcm_dwGetErrorInfo_i32 (ahCard[lIdx], NULL, NULL, szErrorTextBuffer); + printf ("Error card %d: %s\n", lIdx, szErrorTextBuffer); + } + + // no error: we managed to run through completely + else + printf ("\nfinished ...\n"); + + // send the stop command + for (lIdx = 0; lIdx < lCardCount; lIdx++) + spcm_dwSetParam_i32 (ahCard[lIdx], SPC_M2CMD, M2CMD_CARD_STOP | M2CMD_DATA_STOPDMA); + + // clean up + for (lIdx = 0; lIdx < lCardCount; lIdx++) + if (apnData[lIdx]) + vFreeMemPageAligned (apnData[lIdx], (uint64) llBufferSize); + + if (hSync) + spcm_vClose (hSync); + for (lIdx = 0; lIdx < lCardCount; lIdx++) + spcm_vClose (ahCard[lIdx]); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/simple_sync_rep_fifo/simple_sync_rep_fifo.vcproj b/Cpp/examples/c_cpp/simple_sync_rep_fifo/simple_sync_rep_fifo.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..d597c93b8749975e5c43925fd80aff66864d0b7a --- /dev/null +++ b/Cpp/examples/c_cpp/simple_sync_rep_fifo/simple_sync_rep_fifo.vcproj @@ -0,0 +1,464 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="simple_sync_rep_fifo" + ProjectGUID="{AB068386-BB5C-4442-ACFF-B5D9A79C311A}" + RootNamespace="rec_std_single" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/rec_std_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_std_single.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_std_single.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_std_single.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_std_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/rec_std_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_std_single.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_std_single.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_std_single.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_std_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/rec_std_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_std_single.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_std_single.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_std_single.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_std_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/rec_std_single.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_std_single.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_std_single.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_std_single.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_std_single.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="header" + Filter="h;hpp;hxx;hm;inl" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_oswrap.h" + > + </File> + </Filter> + <File + RelativePath=".\simple_sync_rep_fifo.cpp" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/simple_sync_rep_fifo/simple_sync_rep_fifo.vcxproj b/Cpp/examples/c_cpp/simple_sync_rep_fifo/simple_sync_rep_fifo.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..e390d574a3d5f480cab34bb4f3e77559f946ffcb --- /dev/null +++ b/Cpp/examples/c_cpp/simple_sync_rep_fifo/simple_sync_rep_fifo.vcxproj @@ -0,0 +1,262 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{AB068386-BB5C-4442-ACFF-B5D9A79C311A}</ProjectGuid> + <RootNamespace>rec_std_single</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="simple_sync_rep_fifo.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/simple_sync_rep_fifo/simple_sync_rep_fifo.vcxproj.filters b/Cpp/examples/c_cpp/simple_sync_rep_fifo/simple_sync_rep_fifo.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..3ea64db30102ed5bccac01a238adc5551252de36 --- /dev/null +++ b/Cpp/examples/c_cpp/simple_sync_rep_fifo/simple_sync_rep_fifo.vcxproj.filters @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="header"> + <UniqueIdentifier>{5bf2a4db-dd6c-4a11-9913-f9987cf4e5a2}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_oswrap.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="simple_sync_rep_fifo.cpp" /> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib" /> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib" /> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/spectrum_simple_template/makefile b/Cpp/examples/c_cpp/spectrum_simple_template/makefile new file mode 100644 index 0000000000000000000000000000000000000000..688a191b39a957179fb9ba28e2b150c97fd1b40b --- /dev/null +++ b/Cpp/examples/c_cpp/spectrum_simple_template/makefile @@ -0,0 +1,21 @@ +COMPILER = g++ +EXECUTABLE = spectrum_simple_template +LIBS += -lspcm_linux -lpthread -lrt + +OBJECTS = spectrum_simple_template.o\ + ../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/spectrum_simple_template/spectrum_simple_template.cpp b/Cpp/examples/c_cpp/spectrum_simple_template/spectrum_simple_template.cpp new file mode 100644 index 0000000000000000000000000000000000000000..81dfcb0694abac0627868f82b12f2031b7fe9f0f --- /dev/null +++ b/Cpp/examples/c_cpp/spectrum_simple_template/spectrum_simple_template.cpp @@ -0,0 +1,103 @@ +/* +************************************************************************** + +spectrum_simple_template.cpp (c) Spectrum GmbH + +************************************************************************** + +Simple template as base for own programming + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" +#include "../c_header/regs.h" +#include "../c_header/spcerr.h" +#include "../c_header/spcm_drv.h" + +#include "../common/ostools/spcm_oswrap.h" +#include "../common/ostools/spcm_ostools.h" + +// ----- standard c include files ----- +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + + +/* +************************************************************************** +szTypeToName: doing name translation +************************************************************************** +*/ + +char* szTypeToName (int32 lCardType) + { + static char szName[50]; + switch (lCardType & TYP_SERIESMASK) + { + case TYP_M2ISERIES: sprintf (szName, "M2i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M2IEXPSERIES: sprintf (szName, "M2i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M3ISERIES: sprintf (szName, "M3i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M3IEXPSERIES: sprintf (szName, "M3i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M4IEXPSERIES: sprintf (szName, "M4i.%04x-x8", lCardType & TYP_VERSIONMASK); break; + case TYP_M4XEXPSERIES: sprintf (szName, "M4x.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M2PEXPSERIES: sprintf (szName, "M2p.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M5IEXPSERIES: sprintf (szName, "M5i.%04x-x16", lCardType & TYP_VERSIONMASK); break; + default: sprintf (szName, "unknown type"); break; + } + return szName; + } + + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + drv_handle hCard; + int32 lCardType, lSerialNumber; + char szName[50]; + + // ------------------------------------------------------------------------ + // we try to open one card and printout some information on it + + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + sprintf (szName, "/dev/spcm0"); + // sprintf (szName, "TCPIP::192.168.1.10::inst0::INSTR"); + hCard = spcm_hOpen (szName); + + // not one card found + if (!hCard) + { + printf ("no card found...\n"); + return 0; + } + + // read out some info and print it + spcm_dwGetParam_i32 (hCard, SPC_PCITYP, &lCardType); + spcm_dwGetParam_i32 (hCard, SPC_PCISERIALNO, &lSerialNumber); + printf ("Found: %s sn %05d\n", szTypeToName (lCardType), lSerialNumber); + + // ------------------------------------------------------------------------ + // start here with programming + // ------------------------------------------------------------------------ + + spcm_vClose (hCard); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/spectrum_simple_template/spectrum_simple_template.sln b/Cpp/examples/c_cpp/spectrum_simple_template/spectrum_simple_template.sln new file mode 100644 index 0000000000000000000000000000000000000000..7a907ad208747c3115ece3a2f0f5cefea897afd2 --- /dev/null +++ b/Cpp/examples/c_cpp/spectrum_simple_template/spectrum_simple_template.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "spectrum_simple_template", "spectrum_simple_template.vcproj", "{AB068386-BB5C-4442-ACFF-B5D9A79C311A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|Win32.ActiveCfg = Debug|Win32 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|Win32.Build.0 = Debug|Win32 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|x64.ActiveCfg = Debug|x64 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|x64.Build.0 = Debug|x64 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|Win32.ActiveCfg = Release|Win32 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|Win32.Build.0 = Release|Win32 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|x64.ActiveCfg = Release|x64 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Cpp/examples/c_cpp/spectrum_simple_template/spectrum_simple_template.vcproj b/Cpp/examples/c_cpp/spectrum_simple_template/spectrum_simple_template.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..3d44fc33237235bcbac2a6dc4847f66c54d7d1a8 --- /dev/null +++ b/Cpp/examples/c_cpp/spectrum_simple_template/spectrum_simple_template.vcproj @@ -0,0 +1,464 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="spectrum_simple_template" + ProjectGUID="{AB068386-BB5C-4442-ACFF-B5D9A79C311A}" + RootNamespace="$(ProjectName)" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/$(ProjectName).tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/$(ProjectName).pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)\$(ProjectName).exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/$(ProjectName).pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/$(ProjectName).bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/$(ProjectName).tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/$(ProjectName).pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)\$(ProjectName).exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/$(ProjectName).pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/$(ProjectName).bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/$(ProjectName).tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/$(ProjectName).pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)\$(ProjectName).exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/$(ProjectName).pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/$(ProjectName).bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/$(ProjectName).tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/$(ProjectName).pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)\$(ProjectName).exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/$(ProjectName).pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/$(ProjectName).bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="header" + Filter="h;hpp;hxx;hm;inl" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_oswrap.h" + > + </File> + </Filter> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath=".\spectrum_simple_template.cpp" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/spectrum_simple_template/spectrum_simple_template.vcxproj b/Cpp/examples/c_cpp/spectrum_simple_template/spectrum_simple_template.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..b267ba5e0a7a8fc5d15bc6417dd928b08740019b --- /dev/null +++ b/Cpp/examples/c_cpp/spectrum_simple_template/spectrum_simple_template.vcxproj @@ -0,0 +1,262 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{AB068386-BB5C-4442-ACFF-B5D9A79C311A}</ProjectGuid> + <RootNamespace>rec_std_single</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rec_std_single.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_std_single.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_std_single.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_std_single.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="spectrum_simple_template.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/spectrum_simple_template/spectrum_simple_template.vcxproj.filters b/Cpp/examples/c_cpp/spectrum_simple_template/spectrum_simple_template.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..48a0c3aa330ed14107d5bc0c29d2f64cda4e97cf --- /dev/null +++ b/Cpp/examples/c_cpp/spectrum_simple_template/spectrum_simple_template.vcxproj.filters @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="header"> + <UniqueIdentifier>{bf104e1d-06e1-4c35-8340-89c3b22319b3}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\common\ostools\spcm_oswrap.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="spectrum_simple_template.cpp" /> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\c_header\spcm_win32_msvcpp.lib" /> + <CustomBuild Include="..\c_header\spcm_win64_msvcpp.lib" /> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/sse/spc_sse_demux.cpp b/Cpp/examples/c_cpp/sse/spc_sse_demux.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1cefa07855b47d68f114d46ce31b47093f9ca510 --- /dev/null +++ b/Cpp/examples/c_cpp/sse/spc_sse_demux.cpp @@ -0,0 +1,243 @@ +/* +************************************************************************** + +spc_sse_demux.cpp (c) Spectrum GmbH + +************************************************************************** + +Implements data demultiplexing functions using SSE2 commands by intrinsic +functions. Tested with Microsoft Visual C++ (Windows) and Gnu C++ (Linux) + +These functions need a CPU supporting SSE2 commands to run. Please see +the Intrinsic Guide by Intel for more information: +https://software.intel.com/sites/landingpage/IntrinsicsGuide + +The demultiplexing functions speed up the process to demultiplex a single +packed data array with 2, 4 or 8 multiplexed channels into separate data +arrays, one for each channel. Compared to a simple nested for-loop these +function can speed up the demultiplexing process up to the factor of 8x + +Feel free to use these functions in your own programs. + +************************************************************************** +*/ + +#include "spc_sse_demux.h" + +// ---------------------------------------------------------------------------- +// ----- Demultiplexing of 2 channels. +// ----- pnData and all anChX must be 16 byte aligned. +// ----- Replace _mm_load_si128/_mm_store_si128 with _mm_loadu_si128/_mm_storeu_si128 +// ----- if you want to use unaligned memory. +// ----- This function requires dwNumSamples to be a multiple of 8 because all +// ----- operations take place on 128bit = 8*16bit. +// ----- anChX needs to point to enough memory to hold dwNumSamples. +// ---------------------------------------------------------------------------- +void vDemuxData2_int16 (int16* anMuxedData, uint32 dwNumSamples, int16* anCh0, int16* anCh1) + { + const uint32 dwNumCh = 2; + + // ----- init pointers to 128 block for easier access later on ----- + __m128i* powReadPos = reinterpret_cast < __m128i * > (anMuxedData); + __m128i* powWritePosCh0 = reinterpret_cast < __m128i * > (anCh0); + __m128i* powWritePosCh1 = reinterpret_cast < __m128i * > (anCh1); + + // ----- demux data. 8 samples per channel in each run of the for loop ----- + __m128i xmmData1, xmmData2; + __m128i xmmTmp1, xmmTmp2, xmmTmp3; + const uint32 dwNumSamplesPer128Bit = sizeof(__m128i)/sizeof(int16); + for (uint32 i = 0; i < dwNumSamples * dwNumCh; i += dwNumSamplesPer128Bit * dwNumCh) + { + // load data from memory + xmmData1 = _mm_load_si128 (powReadPos++); // B3A3B2A2 B1A1B0A0 + xmmData2 = _mm_load_si128 (powReadPos++); // B7A7B6A6 B5A5B4A4 + + // sort lower 4 samples + xmmTmp1 = _mm_shufflelo_epi16 (xmmData1, (3 << 6) | (1 << 4) | (2 << 2) | (0 << 0)); // B3A3B2A2 B1B0A1A0 + xmmTmp1 = _mm_shufflehi_epi16 (xmmTmp1, (3 << 6) | (1 << 4) | (2 << 2) | (0 << 0)); // B3B2A3A2 B1B0A1A0 + xmmTmp1 = _mm_shuffle_epi32 (xmmTmp1, (3 << 6) | (1 << 4) | (2 << 2) | (0 << 0)); // B3B2B1B0 A3A2A1A0 + + // sort upper 4 samples + xmmTmp2 = _mm_shufflelo_epi16 (xmmData2, (3 << 6) | (1 << 4) | (2 << 2) | (0 << 0)); // B7A7B6A6 B5B4A5A4 + xmmTmp2 = _mm_shufflehi_epi16 (xmmTmp2, (3 << 6) | (1 << 4) | (2 << 2) | (0 << 0)); // B7B6A7A6 B5B4A5A4 + xmmTmp2 = _mm_shuffle_epi32 (xmmTmp2, (3 << 6) | (1 << 4) | (2 << 2) | (0 << 0)); // B7B6B5B4 A7A6A5A4 + + xmmTmp3 = _mm_unpacklo_epi64 (xmmTmp1, xmmTmp2); // A7A6A5A4 A3A2A1A0 + _mm_store_si128 (powWritePosCh0, xmmTmp3); + + xmmTmp3 = _mm_unpackhi_epi64 (xmmTmp1, xmmTmp2); // B7B6B5B4 B3B2B1B0 + _mm_store_si128 (powWritePosCh1, xmmTmp3); + + // ----- increase write position in each demuxed buffer ----- + powWritePosCh0++; + powWritePosCh1++; + } + } + +// ---------------------------------------------------------------------------- +// ----- Demultiplexing of 4 channels. +// ----- pnData and all anChX must be 16 byte aligned. +// ----- Replace _mm_load_si128/_mm_store_si128 with _mm_loadu_si128/_mm_storeu_si128 +// ----- if you want to use unaligned memory. +// ----- This function requires dwNumSamples to be a multiple of 8 because all +// ----- operations take place on 128bit = 8*16bit. +// ----- anChX needs to point to enough memory to hold dwNumSamples. +// ---------------------------------------------------------------------------- +void vDemuxData4_int16 (int16* anMuxedData, uint32 dwNumSamples, int16* anCh0, int16* anCh1, int16* anCh2, int16* anCh3) + { + const uint32 dwNumCh = 4; + + // ----- init pointers to 128 block for easier access later on ----- + __m128i* powReadPos = reinterpret_cast < __m128i * > (anMuxedData); + __m128i* powWritePosCh0 = reinterpret_cast < __m128i * > (anCh0); + __m128i* powWritePosCh1 = reinterpret_cast < __m128i * > (anCh1); + __m128i* powWritePosCh2 = reinterpret_cast < __m128i * > (anCh2); + __m128i* powWritePosCh3 = reinterpret_cast < __m128i * > (anCh3); + + // ----- demux data. 8 samples per channel in each run of the for loop ----- + __m128i xmmData1, xmmData2, xmmData3, xmmData4; + __m128i xmmTmp1, xmmTmp2; + const uint32 dwNumSamplesPer128Bit = sizeof(__m128i)/sizeof(int16); + for (uint32 i = 0; i < dwNumSamples * dwNumCh; i += dwNumSamplesPer128Bit * dwNumCh) + { + xmmData1 = _mm_load_si128 (powReadPos++); // D1C1B1A1 D0C0B0A0 + xmmData2 = _mm_load_si128 (powReadPos++); // D3C3B3A3 D2C2B2A2 + xmmData3 = _mm_load_si128 (powReadPos++); // D5C5B5A5 D4C4B4A4 + xmmData4 = _mm_load_si128 (powReadPos++); // D7C7B7A7 D6C6B6A6 + + // lower four samples + xmmTmp1 = _mm_unpacklo_epi16 (xmmData1, xmmData2); // D2D0 C2C0 B2B0 A2A0 + xmmTmp2 = _mm_unpackhi_epi16 (xmmData1, xmmData2); // D3D1 C3C1 B3B1 A3A1 + + xmmData1 = _mm_unpacklo_epi16 (xmmTmp1, xmmTmp2); // B3B2B1B0 A3A2A1A0 + xmmData2 = _mm_unpackhi_epi16 (xmmTmp1, xmmTmp2); // D3D2D1D0 C3C2C1C0 + + // upper four samples + xmmTmp1 = _mm_unpacklo_epi16 (xmmData3, xmmData4); // D6D4 C6C4 B6B4 A6A4 + xmmTmp2 = _mm_unpackhi_epi16 (xmmData3, xmmData4); // D7D5 C7C5 B7B5 A7A5 + + xmmData3 = _mm_unpacklo_epi16 (xmmTmp1, xmmTmp2); // B7B6B5B4 A7A6A5A4 + xmmData4 = _mm_unpackhi_epi16 (xmmTmp1, xmmTmp2); // D7D6D5D4 C7C6C5C4 + + xmmTmp1 = _mm_unpacklo_epi64 (xmmData1, xmmData3); // A7A6A5A4 A3A2A1A0 + _mm_store_si128 (powWritePosCh0, xmmTmp1); + + xmmTmp1 = _mm_unpackhi_epi64 (xmmData1, xmmData3); // B7B6B5B4 B3B2B1B0 + _mm_store_si128 (powWritePosCh1, xmmTmp1); + + xmmTmp1 = _mm_unpacklo_epi64 (xmmData2, xmmData4); // C7C6C5C4 C3C2C1C0 + _mm_store_si128 (powWritePosCh2, xmmTmp1); + + xmmTmp1 = _mm_unpackhi_epi64 (xmmData2, xmmData4); // D7D6D5D4 D3D2D1D0 + _mm_store_si128 (powWritePosCh3, xmmTmp1); + + // ----- increase write position in each demuxed buffer ----- + powWritePosCh0++; + powWritePosCh1++; + powWritePosCh2++; + powWritePosCh3++; + } + } + +// ---------------------------------------------------------------------------- +// ----- Demultiplexing of 8 channels. +// ----- pnData and all anChX must be 16 byte aligned. +// ----- Replace _mm_load_si128/_mm_store_si128 with _mm_loadu_si128/_mm_storeu_si128 +// ----- if you want to use unaligned memory. +// ----- This function requires dwNumSamples to be a multiple of 8 because all +// ----- operations take place on 128bit = 8*16bit. +// ----- anChX needs to point to enough memory to hold dwNumSamples. +// ---------------------------------------------------------------------------- +void vDemuxData8_int16 (int16* anMuxedData, uint32 dwNumSamples, int16* anCh0, int16* anCh1, int16* anCh2, int16* anCh3, int16* anCh4, int16* anCh5, int16* anCh6, int16* anCh7) + { + const uint32 dwNumCh = 8; + + // ----- init pointers to 128 block for easier access later on ----- + __m128i* powReadPos = reinterpret_cast < __m128i * > (anMuxedData); + __m128i* powWritePosCh0 = reinterpret_cast < __m128i * > (anCh0); + __m128i* powWritePosCh1 = reinterpret_cast < __m128i * > (anCh1); + __m128i* powWritePosCh2 = reinterpret_cast < __m128i * > (anCh2); + __m128i* powWritePosCh3 = reinterpret_cast < __m128i * > (anCh3); + __m128i* powWritePosCh4 = reinterpret_cast < __m128i * > (anCh4); + __m128i* powWritePosCh5 = reinterpret_cast < __m128i * > (anCh5); + __m128i* powWritePosCh6 = reinterpret_cast < __m128i * > (anCh6); + __m128i* powWritePosCh7 = reinterpret_cast < __m128i * > (anCh7); + + // ----- demux data. 8 samples per channel in each run of the for loop ----- + __m128i xmmData1, xmmData2, xmmData3, xmmData4; + __m128i xmmTmp1, xmmTmp2, xmmTmp3, xmmTmp4, xmmTmp5, xmmTmp6, xmmTmp7; + __m128i xmmResult; + const uint32 dwNumSamplesPer128Bit = sizeof(__m128i)/sizeof(int16); + for (uint32 i = 0; i < dwNumSamples * dwNumCh; i += dwNumSamplesPer128Bit * dwNumCh) + { + // ----- load and sort lower four samples ----- + xmmData1 = _mm_load_si128 (powReadPos++); // H0G0F0E0 D0C0B0A0 + xmmData2 = _mm_load_si128 (powReadPos++); // H1G1F1E1 D1C1B1A1 + xmmData3 = _mm_load_si128 (powReadPos++); // H2G2F2E2 D2C2B2A2 + xmmData4 = _mm_load_si128 (powReadPos++); // H3G3F3E3 D3C3B3A3 + + xmmTmp1 = _mm_unpacklo_epi16 (xmmData1, xmmData2); // D1D0C1C0 B1B0A1A0 + xmmTmp2 = _mm_unpacklo_epi16 (xmmData3, xmmData4); // D3D2C3C2 B3B2A3A2 + xmmTmp3 = _mm_unpacklo_epi32 (xmmTmp1, xmmTmp2); // B3B2B1B0 A3A2A1A0 + xmmTmp4 = _mm_unpackhi_epi32 (xmmTmp1, xmmTmp2); // D3D2D1D0 C3C2C1C0 + + xmmTmp1 = _mm_unpackhi_epi16 (xmmData1, xmmData2); // H1H0G1G0 F1F0E1E0 + xmmTmp2 = _mm_unpackhi_epi16 (xmmData3, xmmData4); // H3H2G3G2 F3F2E3E2 + xmmTmp5 = _mm_unpacklo_epi32 (xmmTmp1, xmmTmp2); // F3F2F1F0 E3E2E1E0 + xmmTmp6 = _mm_unpackhi_epi32 (xmmTmp1, xmmTmp2); // H3H2H1H0 G3G2G1G0 + + // ----- load and sort upper four samples ----- + xmmData1 = _mm_load_si128 (powReadPos++); // H4G4F4E4 D4C4B4A4 + xmmData2 = _mm_load_si128 (powReadPos++); // H5G5F5E5 D5C5B5A5 + xmmData3 = _mm_load_si128 (powReadPos++); // H6G6F6E6 D6C6B6A6 + xmmData4 = _mm_load_si128 (powReadPos++); // H7G7F7E7 D7C7B7A7 + + xmmTmp1 = _mm_unpacklo_epi16 (xmmData1, xmmData2); // D5D4C5C4 B5B4A5A4 + xmmTmp2 = _mm_unpacklo_epi16 (xmmData3, xmmData4); // D7D6C7C6 B7B6A7A6 + xmmTmp7 = _mm_unpacklo_epi32 (xmmTmp1, xmmTmp2); // B7B6B5B4 A7A6A5A4 + + // ----- merge lower and upper four samples and write to result buffer ----- + xmmResult = _mm_unpacklo_epi64 (xmmTmp3, xmmTmp7); // A7A6A5A4 A3A2A1A0 + _mm_store_si128 (powWritePosCh0, xmmResult); + + xmmResult = _mm_unpackhi_epi64 (xmmTmp3, xmmTmp7); // B7B6B5B4 B3B2B1B0 + _mm_store_si128 (powWritePosCh1, xmmResult); + + xmmTmp7 = _mm_unpackhi_epi32 (xmmTmp1, xmmTmp2); // D7D6D5D4 C7C6C5C4 + + xmmResult = _mm_unpacklo_epi64 (xmmTmp4, xmmTmp7); // C7C6C5C4 C3C2C1C0 + _mm_store_si128 (powWritePosCh2, xmmResult); + + xmmResult = _mm_unpackhi_epi64 (xmmTmp4, xmmTmp7); // D7D6D5D4 D3D2D1D0 + _mm_store_si128 (powWritePosCh3, xmmResult); + + + xmmTmp1 = _mm_unpackhi_epi16 (xmmData1, xmmData2); // H5H4G5G4 F5F4E5E4 + xmmTmp2 = _mm_unpackhi_epi16 (xmmData3, xmmData4); // H7H6G7G6 F7F6E7E6 + xmmTmp7 = _mm_unpacklo_epi32 (xmmTmp1, xmmTmp2); // F7F6F5F4 E7E6E5E4 + + xmmResult = _mm_unpacklo_epi64 (xmmTmp5, xmmTmp7); // E7E6E5E4 E3E2E1E0 + _mm_store_si128 (powWritePosCh4, xmmResult); + + xmmResult = _mm_unpackhi_epi64 (xmmTmp5, xmmTmp7); // F7F6F5F4 F3F2F1F0 + _mm_store_si128 (powWritePosCh5, xmmResult); + + xmmTmp7 = _mm_unpackhi_epi32 (xmmTmp1, xmmTmp2); // H7H6H5H4 G7G6G5G4 + + xmmResult = _mm_unpacklo_epi64 (xmmTmp6, xmmTmp7); // G7G6G5G4 G3G2G1G0 + _mm_store_si128 (powWritePosCh6, xmmResult); + + xmmResult = _mm_unpackhi_epi64 (xmmTmp6, xmmTmp7); // H7H6H5H4 H3H2H1H0 + _mm_store_si128 (powWritePosCh7, xmmResult); + + // ----- increase write position in each demuxed buffer ----- + powWritePosCh0++; + powWritePosCh1++; + powWritePosCh2++; + powWritePosCh3++; + powWritePosCh4++; + powWritePosCh5++; + powWritePosCh6++; + powWritePosCh7++; + } + } diff --git a/Cpp/examples/c_cpp/sse/spc_sse_demux.h b/Cpp/examples/c_cpp/sse/spc_sse_demux.h new file mode 100644 index 0000000000000000000000000000000000000000..ce5b38fe71cf5b55411fe7fa012901541e3871d1 --- /dev/null +++ b/Cpp/examples/c_cpp/sse/spc_sse_demux.h @@ -0,0 +1,34 @@ +/* +************************************************************************** + +spc_sse_demux.h (c) Spectrum GmbH , 03/2016 + +************************************************************************** + +These functions demultiplex the data from one muxed DMA buffer to multiple +buffers where each contains only the samples from one channel. + +Feel free to use these functions in your own programs. + +************************************************************************** +*/ + +#ifndef SPC_SSE_DEMUX_H +#define SPC_SSE_DEMUX_H + +// ----- include standard driver header from library ----- +#include "../c_header/dlltyp.h" + +// ----- SSE2 Intrinsics ----- +#include <emmintrin.h> + +// Demultiplexing of 2 channels. See source file for more details. +void vDemuxData2_int16 (int16* anMuxedData, uint32 dwNumSamples, int16* anCh0, int16* anCh1); + +// Demultiplexing of 4 channels. See source file for more details. +void vDemuxData4_int16 (int16* anMuxedData, uint32 dwNumSamples, int16* anCh0, int16* anCh1, int16* anCh2, int16* anCh3); + +// Demultiplexing of 8 channels. See source file for more details. +void vDemuxData8_int16 (int16* anMuxedData, uint32 dwNumSamples, int16* anCh0, int16* anCh1, int16* anCh2, int16* anCh3, int16* anCh4, int16* anCh5, int16* anCh6, int16* anCh7); + +#endif // SPC_SSE_DEMUX_H diff --git a/Cpp/examples/c_cpp/test/asynchronous_IO_speed/async_io_speed.cpp b/Cpp/examples/c_cpp/test/asynchronous_IO_speed/async_io_speed.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ff824a15d957f59b0dd73464b49691386b771067 --- /dev/null +++ b/Cpp/examples/c_cpp/test/asynchronous_IO_speed/async_io_speed.cpp @@ -0,0 +1,177 @@ +/* +************************************************************************** + +async_io_speed.cpp (c) Spectrum GmbH + +************************************************************************** + +Multi-Purpose I/O loop speed test +The tool measures the write and read time of asynchronous I/O commands +on the Multi-Purpose I/O lines of M2p and M4i cards. + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + +// ----- include standard driver header from library ----- +#include "../../c_header/dlltyp.h" +#include "../../c_header/regs.h" +#include "../../c_header/spcerr.h" +#include "../../c_header/spcm_drv.h" + +#include "../../common/ostools/spcm_oswrap.h" +#include "../../common/ostools/spcm_ostools.h" + +// ----- standard c include files ----- +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + + +/* +************************************************************************** +szTypeToName: doing name translation +************************************************************************** +*/ + +char* szTypeToName (int32 lCardType) + { + static char szName[50]; + switch (lCardType & TYP_SERIESMASK) + { + case TYP_M2ISERIES: sprintf (szName, "M2i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M2IEXPSERIES: sprintf (szName, "M2i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M3ISERIES: sprintf (szName, "M3i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M3IEXPSERIES: sprintf (szName, "M3i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M4IEXPSERIES: sprintf (szName, "M4i.%04x-x8", lCardType & TYP_VERSIONMASK); break; + case TYP_M4XEXPSERIES: sprintf (szName, "M4x.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M2PEXPSERIES: sprintf (szName, "M2p.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M5IEXPSERIES: sprintf (szName, "M5i.%04x-x16", lCardType & TYP_VERSIONMASK); break; + default: sprintf (szName, "unknown type"); break; + } + return szName; + } + + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + drv_handle hCard; + int32 lCardType, lSerialNumber; + char szName[50]; + + // ------------------------------------------------------------------------ + // we try to open one card and printout some information on it + + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + sprintf (szName, "/dev/spcm0"); + // sprintf (szName, "TCPIP::192.168.1.10::inst0::INSTR"); + hCard = spcm_hOpen (szName); + + // not one card found + if (!hCard) + { + printf ("no card found...\n"); + return 0; + } + + // read out some info and print it + spcm_dwGetParam_i32 (hCard, SPC_PCITYP, &lCardType); + spcm_dwGetParam_i32 (hCard, SPC_PCISERIALNO, &lSerialNumber); + printf ("Found: %s sn %05d\n", szTypeToName (lCardType), lSerialNumber); + + + // check for cards that don't have multi purpose I/O lines + switch (lCardType & TYP_SERIESMASK) + { + case TYP_M2ISERIES: + case TYP_M2IEXPSERIES: + case TYP_M3ISERIES: + case TYP_M3IEXPSERIES: + printf("test program needs multi-purpose I/O lines what your card type doesn't have\n"); + exit(0); + } + + + // ------------------------------------------------------------------------ + // Test Loops + // ------------------------------------------------------------------------ + + + int32 i, lTmp, lMaxIO = 100000; + LARGE_INTEGER uStartTimeWrite, uEndTimeWrite, uStartTimeRead, uEndTimeRead, uHighResFreq; + double dRunTime, dAverageTime; + uint32 dwErr; + + printf("Start Loop\n"); + + QueryPerformanceFrequency(&uHighResFreq); + + // write loop + dwErr = spcm_dwSetParam_i32(hCard, SPCM_X1_MODE, SPCM_XMODE_ASYNCOUT); + if (!dwErr) + { + QueryPerformanceCounter(&uStartTimeWrite); + for (i = 0; i < lMaxIO; i++) + dwErr = spcm_dwSetParam_i32(hCard, SPCM_XX_ASYNCIO, i & 2); + QueryPerformanceCounter(&uEndTimeWrite); + } + + // read loop + dwErr = spcm_dwSetParam_i32(hCard, SPCM_X1_MODE, SPCM_XMODE_ASYNCIN); + if (!dwErr) + { + QueryPerformanceCounter(&uStartTimeRead); + for (i = 0; i < lMaxIO; i++) + dwErr = spcm_dwGetParam_i32(hCard, SPCM_XX_ASYNCIO, &lTmp); + QueryPerformanceCounter(&uEndTimeRead); + } + + // error check + if (dwErr) + { + uint32 dwErrorReg; + int32 lErrorValue; + char szErrorText[200]; + spcm_dwGetErrorInfo_i32(hCard, &dwErrorReg, &lErrorValue, szErrorText); + printf("Error:\n%s\n\n", szErrorText); + } + + // print result + else + { + printf("Finished: %d AsyncIO Write and %d Read Commands\n", lMaxIO, lMaxIO); + + dRunTime = (double)(uEndTimeWrite.QuadPart - uStartTimeWrite.QuadPart) / uHighResFreq.QuadPart; + dAverageTime = (double)dRunTime / (double)lMaxIO; + printf("Write Run Time: %.8lf s\n", dRunTime); + printf("Write Average Time: %.8lf s\n", dAverageTime); + printf("Write Average Frequency: %.2lf kHz\n", 1.0 / 1000.0 / dAverageTime); + printf("\n"); + + dRunTime = (double)(uEndTimeRead.QuadPart - uStartTimeRead.QuadPart) / uHighResFreq.QuadPart; + dAverageTime = (double)dRunTime / (double)lMaxIO; + printf("Read Run Time: %.8lf s\n", dRunTime); + printf("Read Average Time: %.8lf s\n", dAverageTime); + printf("Read Average Frequency: %.2lf kHz\n", 1.0 / 1000.0 / dAverageTime); + } + + spcm_vClose (hCard); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/test/asynchronous_IO_speed/async_io_speed.sln b/Cpp/examples/c_cpp/test/asynchronous_IO_speed/async_io_speed.sln new file mode 100644 index 0000000000000000000000000000000000000000..0c4c70537e509ed9c71a32930f4606c9294c966c --- /dev/null +++ b/Cpp/examples/c_cpp/test/asynchronous_IO_speed/async_io_speed.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "spectrum_simple_template", "spectrum_simple_template.vcxproj", "{AB068386-BB5C-4442-ACFF-B5D9A79C311A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|x64.ActiveCfg = Debug|x64 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|x64.Build.0 = Debug|x64 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|x86.ActiveCfg = Debug|Win32 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Debug|x86.Build.0 = Debug|Win32 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|x64.ActiveCfg = Release|x64 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|x64.Build.0 = Release|x64 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|x86.ActiveCfg = Release|Win32 + {AB068386-BB5C-4442-ACFF-B5D9A79C311A}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Cpp/examples/c_cpp/test/asynchronous_IO_speed/async_io_speed.vcproj b/Cpp/examples/c_cpp/test/asynchronous_IO_speed/async_io_speed.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..3d44fc33237235bcbac2a6dc4847f66c54d7d1a8 --- /dev/null +++ b/Cpp/examples/c_cpp/test/asynchronous_IO_speed/async_io_speed.vcproj @@ -0,0 +1,464 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="spectrum_simple_template" + ProjectGUID="{AB068386-BB5C-4442-ACFF-B5D9A79C311A}" + RootNamespace="$(ProjectName)" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/$(ProjectName).tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/$(ProjectName).pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)\$(ProjectName).exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/$(ProjectName).pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/$(ProjectName).bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/$(ProjectName).tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/$(ProjectName).pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)\$(ProjectName).exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/$(ProjectName).pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/$(ProjectName).bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/$(ProjectName).tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/$(ProjectName).pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)\$(ProjectName).exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/$(ProjectName).pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/$(ProjectName).bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/$(ProjectName).tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/$(ProjectName).pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)\$(ProjectName).exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/$(ProjectName).pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/$(ProjectName).bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="header" + Filter="h;hpp;hxx;hm;inl" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_oswrap.h" + > + </File> + </Filter> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath=".\spectrum_simple_template.cpp" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/test/asynchronous_IO_speed/async_io_speed.vcxproj b/Cpp/examples/c_cpp/test/asynchronous_IO_speed/async_io_speed.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..aae9fee2ac40bfcc8872ac84bc462ba0a3ba556a --- /dev/null +++ b/Cpp/examples/c_cpp/test/asynchronous_IO_speed/async_io_speed.vcxproj @@ -0,0 +1,255 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{AB068386-BB5C-4442-ACFF-B5D9A79C311A}</ProjectGuid> + <RootNamespace>$(ProjectName)</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/$(ProjectName).tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/$(ProjectName).pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(OutDir)$(ProjectName).exe</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/$(ProjectName).pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/$(ProjectName).bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/$(ProjectName).tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/$(ProjectName).pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(OutDir)$(ProjectName).exe</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/$(ProjectName).pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/$(ProjectName).bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/$(ProjectName).tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/$(ProjectName).pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(OutDir)$(ProjectName).exe</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/$(ProjectName).pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/$(ProjectName).bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/$(ProjectName).tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/$(ProjectName).pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(OutDir)$(ProjectName).exe</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/$(ProjectName).pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/$(ProjectName).bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\..\c_header\dlltyp.h" /> + <ClInclude Include="..\..\c_header\regs.h" /> + <ClInclude Include="..\..\c_header\spcerr.h" /> + <ClInclude Include="..\..\c_header\spcm_drv.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="async_io_speed.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\..\c_header\spcm_win32_msvcpp.lib" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/test/asynchronous_IO_speed/async_io_speed.vcxproj.filters b/Cpp/examples/c_cpp/test/asynchronous_IO_speed/async_io_speed.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..176501d6030961fc5bc0b04fea5b0eeb6893ba23 --- /dev/null +++ b/Cpp/examples/c_cpp/test/asynchronous_IO_speed/async_io_speed.vcxproj.filters @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="header"> + <UniqueIdentifier>{60a17647-9522-489d-a544-1b272be5c545}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\..\common\ostools\spcm_oswrap.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="async_io_speed.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\..\c_header\spcm_win32_msvcpp.lib" /> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/test/closed_loop_ad_da/closed_loop_ad_da.cpp b/Cpp/examples/c_cpp/test/closed_loop_ad_da/closed_loop_ad_da.cpp new file mode 100644 index 0000000000000000000000000000000000000000..eb06613758f89c40277fb79d2bac32ab7d3c5c10 --- /dev/null +++ b/Cpp/examples/c_cpp/test/closed_loop_ad_da/closed_loop_ad_da.cpp @@ -0,0 +1,411 @@ +/* +************************************************************************** + +closed_loop_ad_da.cpp (c) Spectrum GmbH + +************************************************************************** + +This program acquires data using an analog acquisition card, and replays it +immediately using an AWG card. + +Feel free to use this source for own projects and modify it in any kind + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + +/* +************************************************************************** +This example needs one A/D and one D/A card with the following connection: +A/D X0 (trigger out) to D/A trigger input +A/D clock-out to D/A clock input + +Best performance reached: +- compile the release version +- close the developemnt software +- close all other programs running +- directly start the release version +************************************************************************** +*/ + +// ----- include standard driver header from library ----- +#include "../../c_header/dlltyp.h" +#include "../../c_header/regs.h" +#include "../../c_header/spcerr.h" +#include "../../c_header/spcm_drv.h" + +#include "../../common/ostools/spcm_oswrap.h" +#include "../../common/ostools/spcm_ostools.h" + +// ----- standard c include files ----- +#include <cstdio> +#include <cstdlib> +#include <cstring> +#include <time.h> + + +/* +************************************************************************** +szTypeToName: doing name translation +************************************************************************** +*/ + +char* szTypeToName (int32 lCardType) + { + static char szName[50]; + switch (lCardType & TYP_SERIESMASK) + { + case TYP_M2ISERIES: sprintf (szName, "M2i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M2IEXPSERIES: sprintf (szName, "M2i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M3ISERIES: sprintf (szName, "M3i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M3IEXPSERIES: sprintf (szName, "M3i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M4IEXPSERIES: sprintf (szName, "M4i.%04x-x8", lCardType & TYP_VERSIONMASK); break; + case TYP_M4XEXPSERIES: sprintf (szName, "M4x.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M2PEXPSERIES: sprintf (szName, "M2p.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M5IEXPSERIES: sprintf (szName, "M5i.%04x-x16", lCardType & TYP_VERSIONMASK); break; + default: sprintf (szName, "unknown type"); break; + } + return szName; + } + + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + uint32 dwError = ERR_OK; + uint64 qwToTransfer = GIGA_B(1024); + + uint64 qwTotalMem = 0; + int32 lStatusAD = 0; + int32 lStatusDA = 0; + int64 llAvailUserAD = 0; + int64 llPCPosAD = 0; + int64 llAvailUserDA = 0; + int64 llPCPosDA = 0; + int64 llBytesToProcess = 0; + int32 lFillsizeAD = 0; + int32 lFillsizeDA = 0; + int32 lRefClockOutput; + time_t stTime; + + // settings for the example + int32 lIR_mV = 1000; + + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // these are the main settings that control stability and latency + int32 lNumCh = 1; // number of channels active on both cards + int64 llSampleRate = KILO(500000); // sampling rate in kHz + int32 lNotifySize = KILO_B(256); // size of one notify size (data transfererd until interrupt is issued) + int64 llBufferSizeDA = 4 * lNotifySize;// total size of software buffer + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + int64 llBufferSizeAD = llBufferSizeDA; + + // ----- calculate delay ----- + printf ("\nCalculated delay between A/D and D/A:\n"); + printf ("D/A buffer: %0.2lf ms\n\n", 1000.0 * (double)llBufferSizeDA / 2.0 / (double)llSampleRate / (double) lNumCh); + + // ----- open cards ----- + // ----- this program will use the first AD and first DA card it finds ----- + drv_handle hCardAD = NULL_HANDLE; + drv_handle hCardDA = NULL_HANDLE; + int lNumCards = 0; + while ((hCardAD == NULL_HANDLE) || (hCardDA == NULL_HANDLE)) + { + // open card + char szDeviceName[12] = { '\0' }; + sprintf (szDeviceName, "/dev/spcm%d", lNumCards); + drv_handle hCard = spcm_hOpen (szDeviceName); + if (!hCard) + { + printf ("no card found...\n"); + return EXIT_FAILURE; + } + + // check if the card is AD, DA or something else + int32 lFncType = 0; + spcm_dwGetParam_i32 (hCard, SPC_FNCTYPE, &lFncType); + if (lFncType == SPCM_TYPE_AI) + hCardAD = hCard; + else if (lFncType == SPCM_TYPE_AO) + hCardDA = hCard; + else + spcm_vClose (hCard); + lNumCards++; + } + + + // ----- print some info about cards that are going to be used ----- + int32 lCardType = 0; + int32 lSerialNumber = 0; + spcm_dwGetParam_i32 (hCardAD, SPC_PCITYP, &lCardType); + spcm_dwGetParam_i32 (hCardAD, SPC_PCISERIALNO, &lSerialNumber); + printf ("AD card: %s sn %05d\n", szTypeToName (lCardType), lSerialNumber); + + spcm_dwGetParam_i32 (hCardDA, SPC_PCITYP, &lCardType); + spcm_dwGetParam_i32 (hCardDA, SPC_PCISERIALNO, &lSerialNumber); + printf ("DA card: %s sn %05d\n", szTypeToName (lCardType), lSerialNumber); + + // calculate channel mask from active channel count + int32 lChMask = (1 << lNumCh) - 1; + + // ----- setup AD card ----- + spcm_dwSetParam_i32 (hCardAD, SPC_CHENABLE, lChMask); + spcm_dwSetParam_i32 (hCardAD, SPC_PRETRIGGER, 32); + spcm_dwSetParam_i32 (hCardAD, SPC_CARDMODE, SPC_REC_FIFO_SINGLE); // single FIFO mode + spcm_dwSetParam_i32 (hCardAD, SPC_TIMEOUT, 5000); // timeout 5 s + spcm_dwSetParam_i32 (hCardAD, SPC_TRIG_ORMASK, SPC_TMASK_EXT0); // waiting for a trigger that isn't connected to allow force trigger + spcm_dwSetParam_i32 (hCardAD, SPC_TRIG_ANDMASK, 0); // ... + spcm_dwSetParam_i32 (hCardAD, SPCM_X0_MODE, SPCM_XMODE_TRIGOUT); // trigger output to D/A card + spcm_dwSetParam_i32 (hCardAD, SPC_CLOCKMODE, SPC_CM_INTPLL); // clock mode internal PLL + spcm_dwSetParam_i32 (hCardAD, SPC_CLOCKOUT, 1); // clock output + spcm_dwSetParam_i32 (hCardAD, SPC_SPECIALCLOCK, 1); // use special clock to be able to use odd sampling rates on M4i.44xx + spcm_dwSetParam_i64 (hCardAD, SPC_SAMPLERATE, llSampleRate); + for (int i = 0; i < lNumCh; ++i) + { + spcm_dwSetParam_i64 (hCardAD, SPC_PATH0 + i*100, 0); // path 0 + spcm_dwSetParam_i64 (hCardAD, SPC_AMP0 + i*100, lIR_mV); // input range as defined above + spcm_dwSetParam_i64 (hCardAD, SPC_ACDC0 + i*100, COUPLING_DC); // use DC coupling + } + spcm_dwSetParam_i32 (hCardAD, SPC_M2CMD, M2CMD_CARD_WRITESETUP); // write setup to avoid later settling wait time and to activate clock output + spcm_dwGetParam_i32 (hCardAD, SPC_CLOCKOUTFREQUENCY, &lRefClockOutput); // read the refrence clock output frequency to write this to the D/A card + + // ----- setup DA card ----- + spcm_dwSetParam_i32 (hCardDA, SPC_CHENABLE, lChMask); + spcm_dwSetParam_i32 (hCardDA, SPC_CARDMODE, SPC_REP_FIFO_SINGLE); // single FIFO mode + spcm_dwSetParam_i32 (hCardDA, SPC_TIMEOUT, 5000); // timeout 5 s + spcm_dwSetParam_i32 (hCardDA, SPC_TRIG_ORMASK, SPC_TMASK_EXT0); // wait fro trigger from A/D card + spcm_dwSetParam_i32 (hCardDA, SPC_TRIG_ANDMASK, 0); // ... + spcm_dwSetParam_i32 (hCardDA, SPC_TRIG_EXT0_MODE, SPC_TM_POS); // positive edge + spcm_dwSetParam_i32 (hCardDA, SPC_TRIG_TERM, 0); // high impedance input + spcm_dwSetParam_i32 (hCardDA, SPC_TRIG_EXT0_LEVEL0, 1500); // 1.5 V trigger level + spcm_dwSetParam_i32 (hCardDA, SPC_CLOCKMODE, SPC_CM_EXTREFCLOCK); // clock mode external refrence clock (from A/D card) + spcm_dwSetParam_i32 (hCardDA, SPC_REFERENCECLOCK, lRefClockOutput); // reference clock from A/D card + spcm_dwSetParam_i32 (hCardDA, SPC_CLOCKOUT, 0); // no clock output + spcm_dwSetParam_i64 (hCardDA, SPC_SAMPLERATE, llSampleRate); + for (int i = 0; i < lNumCh; ++i) + { + spcm_dwSetParam_i64 (hCardDA, SPC_AMP0 + i*100, lIR_mV); // use same voltage level as the AD card (also see below for DATACONVERSION) + spcm_dwSetParam_i64 (hCardDA, SPC_ENABLEOUT0 + i*100, 1); // enable the output + } + spcm_dwSetParam_i32 (hCardDA, SPC_M2CMD, M2CMD_CARD_WRITESETUP); // write setup to avoid later settling wait time + + // ----- if resolution of AD card and DA card do not match we use the data conversion feature of the DA card to get similar output levels ----- + int32 lResolutionAD = 0; + int32 lResolutionDA = 0; + spcm_dwGetParam_i32 (hCardAD, SPC_MIINST_BITSPERSAMPLE, &lResolutionAD); + spcm_dwGetParam_i32 (hCardDA, SPC_MIINST_BITSPERSAMPLE, &lResolutionDA); + switch (lResolutionDA) + { + case 16: + { + if (lResolutionAD == 14) + spcm_dwSetParam_i32 (hCardDA, SPC_DATACONVERSION, SPCM_DC_14BIT_TO_16BIT); + else if (lResolutionAD == 12) + spcm_dwSetParam_i32 (hCardDA, SPC_DATACONVERSION, SPCM_DC_12BIT_TO_16BIT); + break; + } + case 14: + { + if (lResolutionAD == 16) + spcm_dwSetParam_i32 (hCardDA, SPC_DATACONVERSION, SPCM_DC_16BIT_TO_14BIT); + else if (lResolutionAD == 12) + spcm_dwSetParam_i32 (hCardDA, SPC_DATACONVERSION, SPCM_DC_12BIT_TO_14BIT); + break; + } + } + + // ----- print used sample rates of both cards ----- + int64 llUsedSampleRate = 0; + spcm_dwGetParam_i64 (hCardAD, SPC_SAMPLERATE, &llUsedSampleRate); + printf ("Used Samplerate AD: %lld\n", llUsedSampleRate); + spcm_dwGetParam_i64 (hCardDA, SPC_SAMPLERATE, &llUsedSampleRate); + printf ("Used Samplerate DA: %lld\n", llUsedSampleRate); + + // ----- define the data buffers ----- + int16* pnDataAD = (int16*) pvAllocMemPageAligned ((uint64) llBufferSizeAD); + if (!pnDataAD) + { + printf ("memory allocation failed\n"); + spcm_vClose (hCardAD); + spcm_vClose (hCardDA); + return EXIT_FAILURE; + } + + int16* pnDataDA = (int16*) pvAllocMemPageAligned ((uint64) llBufferSizeDA); + if (!pnDataDA) + { + printf ("memory allocation failed\n"); + + vFreeMemPageAligned (pnDataAD, (uint64) llBufferSizeAD); + spcm_vClose (hCardAD); + spcm_vClose (hCardDA); + return EXIT_FAILURE; + } + + // define the buffers for transfer + dwError = spcm_dwDefTransfer_i64 (hCardAD, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, lNotifySize, pnDataAD, 0, llBufferSizeAD); + dwError = spcm_dwDefTransfer_i64 (hCardDA, SPCM_BUF_DATA, SPCM_DIR_PCTOCARD, lNotifySize, pnDataDA, 0, llBufferSizeDA); + + printf ("\nClosed Loop starts now. Press CTRL-C to abort\n... no output during loop for best performance\n"); + stTime = time(NULL); + printf("\nStart Time: %s\n", ctime(&stTime)); + + // ------------------------------------------------------- + // ------------------------------------------------------- + // ----- run the FIFO mode and loop through the data ----- + + // ----- transfer empty buffer data to the D/A card ----- + // this defines the delay between input and output of the loop + if (!dwError) + { + dwError = spcm_dwGetParam_i64(hCardDA, SPC_DATA_AVAIL_USER_LEN, &llAvailUserDA); + dwError = spcm_dwGetParam_i64(hCardDA, SPC_DATA_AVAIL_USER_POS, &llPCPosDA); + dwError = spcm_dwSetParam_i64(hCardDA, SPC_DATA_AVAIL_CARD_LEN, llBufferSizeDA); + dwError = spcm_dwSetParam_i32(hCardDA, SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA); + } + + // ----- start D/A and wait until it is armed ----- + if (!dwError) + { + dwError = spcm_dwSetParam_i32(hCardDA, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER); + do + { + dwError = spcm_dwGetParam_i32(hCardDA, SPC_M2STATUS, &lStatusDA); + } while ((lStatusDA & M2STAT_CARD_PRETRIGGER) == 0); + } + + // ----- start AD card ----- + // this will automatically trigger the D/A card and start the output of the empty buffer + if (!dwError) + { + dwError = spcm_dwSetParam_i32(hCardAD, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER); + dwError = spcm_dwSetParam_i32(hCardAD, SPC_M2CMD, M2CMD_DATA_STARTDMA); + dwError = spcm_dwSetParam_i32(hCardAD, SPC_M2CMD, M2CMD_CARD_FORCETRIGGER); // starts the acquisition and via trigger output the generation also + spcm_dwSetParam_i32(hCardAD, SPCM_XX_ASYNCIO, 7); + } + + // ----- LOOP LOOP LOOP ------------------------------------------------------------------------------- + // in the loop each buffer of data received from the A/D card is copied and transferred to the D/A card + while (!dwError && (qwTotalMem < qwToTransfer)) + { + + // wait for next A/D buffer to be ready + dwError = spcm_dwSetParam_i32 (hCardAD, SPC_M2CMD, M2CMD_DATA_WAITDMA); + + // process next block of data + if (!dwError) + { + dwError = spcm_dwGetParam_i32(hCardAD, SPC_M2STATUS, &lStatusAD); + spcm_dwGetParam_i64(hCardAD, SPC_DATA_AVAIL_USER_LEN, &llAvailUserAD); + spcm_dwGetParam_i64(hCardAD, SPC_DATA_AVAIL_USER_POS, &llPCPosAD); + if (lStatusAD & M2STAT_CARD_READY) + { + printf("\n\nA/D card stopped acquisition\n"); + dwError = ERR_ABORT; + } + } + + if (!dwError) + { + dwError = spcm_dwGetParam_i32(hCardDA, SPC_M2STATUS, &lStatusDA); + if (lStatusDA & M2STAT_CARD_READY) + { + printf("\n\nD/A card stopped replay\n"); + dwError = ERR_ABORT; + } + } + + // ----- process data if at least one notify size is available (this should always be the case after WAITDMA) ----- + if (!dwError && (llAvailUserAD >= lNotifySize)) + { + spcm_dwGetParam_i64 (hCardDA, SPC_DATA_AVAIL_USER_LEN, &llAvailUserDA); + spcm_dwGetParam_i64 (hCardDA, SPC_DATA_AVAIL_USER_POS, &llPCPosDA); + + // we will handle each block serparately to get best performance + llBytesToProcess = (int64) lNotifySize; + + // this is the point to do something with the data + // we will simply copy it unmodified to the buffer of the DA card + memcpy (pnDataDA + (llPCPosDA / sizeof (int16)), pnDataAD + (llPCPosAD / sizeof (int16)), (size_t) llBytesToProcess); + + // mark data bytes as processed (=free) for AD card + spcm_dwSetParam_i64 (hCardAD, SPC_DATA_AVAIL_CARD_LEN, llBytesToProcess); + + // mark data bytes as available for DA card and wait for end of data transfer + spcm_dwSetParam_i64 (hCardDA, SPC_DATA_AVAIL_CARD_LEN, llBytesToProcess); + dwError = spcm_dwSetParam_i32(hCardDA, SPC_M2CMD, M2CMD_DATA_WAITDMA); + + qwTotalMem += llBytesToProcess; + + // ----- print some status info ----- + // to get best performance no printf function should be used in the loop + spcm_dwGetParam_i32 (hCardAD, SPC_FILLSIZEPROMILLE, &lFillsizeAD); + spcm_dwGetParam_i32 (hCardDA, SPC_FILLSIZEPROMILLE, &lFillsizeDA); + + // printf decreases performance a lot! + //printf ("\rStatAD:%08x StatDA:%08x FillAD: %3d FillDA: %3d Total:%.2fMB", lStatusAD, lStatusDA, lFillsizeAD, lFillsizeDA, (double) (int64) qwTotalMem / MEGA_B(1)); + } + } + // ------------------------------------------------------- + // ------------------------------------------------------- + // ------------------------------------------------------- + + printf("\n\n"); + + // check for timeout + if (dwError == ERR_TIMEOUT) + printf("Timeout occurred, reduce speed or enlarge buffers\n"); + + // error checking + uint32 dwADError = 0; + uint32 dwADErrorReg = 0; + int32 lADErrorValue = 0; + char szADErrorText[ERRORTEXTLEN]; + + uint32 dwDAError = 0; + uint32 dwDAErrorReg = 0; + int32 lDAErrorValue = 0; + char szDAErrorText[ERRORTEXTLEN]; + + dwADError = spcm_dwGetErrorInfo_i32 (hCardAD, &dwADErrorReg, &lADErrorValue, szADErrorText); + if (dwADError) + printf("AD Error: %d\n%s\n", dwADError, szADErrorText); + dwDAError = spcm_dwGetErrorInfo_i32 (hCardDA, &dwDAErrorReg, &lDAErrorValue, szDAErrorText); + if (dwDAError) + printf("DA Error: %d\n%s\n", dwDAError, szDAErrorText); + + // send the stop command + dwError = spcm_dwSetParam_i32 (hCardDA, SPC_M2CMD, M2CMD_CARD_STOP | M2CMD_DATA_STOPDMA); + dwError = spcm_dwSetParam_i32 (hCardAD, SPC_M2CMD, M2CMD_CARD_STOP | M2CMD_DATA_STOPDMA); + + // clean up + printf ("Finished...\n"); + stTime = time(NULL); + printf("End Time: %s\n", ctime(&stTime)); + + vFreeMemPageAligned (pnDataAD, (uint64) llBufferSizeAD); + vFreeMemPageAligned (pnDataDA, (uint64) llBufferSizeDA); + + spcm_vClose (hCardAD); + spcm_vClose (hCardDA); + + cGetch(); + + if (dwError) + return EXIT_FAILURE; + + return EXIT_SUCCESS; + } diff --git a/Cpp/examples/c_cpp/test/closed_loop_ad_da/closed_loop_ad_da.vcxproj b/Cpp/examples/c_cpp/test/closed_loop_ad_da/closed_loop_ad_da.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..bbb2092b3ef635ad720bab8234b06e7a0e3f9bc0 --- /dev/null +++ b/Cpp/examples/c_cpp/test/closed_loop_ad_da/closed_loop_ad_da.vcxproj @@ -0,0 +1,263 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{AB068386-BB5C-4442-ACFF-B5D9A79C311A}</ProjectGuid> + <RootNamespace>roundtrip</RootNamespace> + <ProjectName>closed_loop_ad_da</ProjectName> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/simple_rec_fifo.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/simple_rec_fifo.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/simple_rec_fifo.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/simple_rec_fifo.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/simple_rec_fifo.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/simple_rec_fifo.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/simple_rec_fifo.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/simple_rec_fifo.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/simple_rec_fifo.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/simple_rec_fifo.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/simple_rec_fifo.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/simple_rec_fifo.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/simple_rec_fifo.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/simple_rec_fifo.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>$(TargetPath)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/simple_rec_fifo.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/simple_rec_fifo.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\..\c_header\dlltyp.h" /> + <ClInclude Include="..\..\c_header\regs.h" /> + <ClInclude Include="..\..\c_header\spcerr.h" /> + <ClInclude Include="..\..\c_header\spcm_drv.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="closed_loop_ad_da.cpp" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/test/closed_loop_ad_da/closed_loop_ad_da.vcxproj.filters b/Cpp/examples/c_cpp/test/closed_loop_ad_da/closed_loop_ad_da.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..f8c5c12cfee36817810960e85eb169455d4227ec --- /dev/null +++ b/Cpp/examples/c_cpp/test/closed_loop_ad_da/closed_loop_ad_da.vcxproj.filters @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <ClInclude Include="..\..\c_header\dlltyp.h"> + <Filter>Headers\c_header</Filter> + </ClInclude> + <ClInclude Include="..\..\c_header\regs.h"> + <Filter>Headers\c_header</Filter> + </ClInclude> + <ClInclude Include="..\..\c_header\spcerr.h"> + <Filter>Headers\c_header</Filter> + </ClInclude> + <ClInclude Include="..\..\c_header\spcm_drv.h"> + <Filter>Headers\c_header</Filter> + </ClInclude> + <ClInclude Include="..\..\common\ostools\spcm_ostools.h"> + <Filter>Headers\ostools</Filter> + </ClInclude> + <ClInclude Include="..\..\common\ostools\spcm_oswrap.h"> + <Filter>Headers\ostools</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <Library Include="..\..\c_header\spcm_win32_msvcpp.lib" /> + <Library Include="..\..\c_header\spcm_win64_msvcpp.lib" /> + </ItemGroup> + <ItemGroup> + <Filter Include="Headers"> + <UniqueIdentifier>{ab225bbd-3e54-4ce5-bea0-ad0114a5d105}</UniqueIdentifier> + </Filter> + <Filter Include="Headers\c_header"> + <UniqueIdentifier>{3b3b011c-874e-4610-9ae3-23c375634160}</UniqueIdentifier> + </Filter> + <Filter Include="Headers\ostools"> + <UniqueIdentifier>{89c3b204-455c-493a-adb3-fabd1e01bdc6}</UniqueIdentifier> + </Filter> + <Filter Include="Sources"> + <UniqueIdentifier>{96b44a4f-afef-4b3e-811b-1367540a78c2}</UniqueIdentifier> + </Filter> + <Filter Include="Sources\ostools"> + <UniqueIdentifier>{9d80a65f-099c-4923-a3a5-e66732683f58}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\common\ostools\spcm_ostools_win.cpp"> + <Filter>Sources\ostools</Filter> + </ClCompile> + <ClCompile Include="closed_loop_ad_da.cpp"> + <Filter>Sources</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/test/closed_loop_ad_da/makefile b/Cpp/examples/c_cpp/test/closed_loop_ad_da/makefile new file mode 100644 index 0000000000000000000000000000000000000000..d20058c5e60abfec8bcc94900ad2baf6e48d8b06 --- /dev/null +++ b/Cpp/examples/c_cpp/test/closed_loop_ad_da/makefile @@ -0,0 +1,22 @@ +COMPILER = g++ +EXECUTABLE = closed_loop_ad_da +LIBS += -lspcm_linux -lpthread -lrt +CFLAGS += -O2 + +OBJECTS = closed_loop_ad_da.o\ + ../../common/ostools/spcm_ostools_linux.o + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/test/memtest/Makefile b/Cpp/examples/c_cpp/test/memtest/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..1c4910c85c918728e7a268d3af8585b7e875dce4 --- /dev/null +++ b/Cpp/examples/c_cpp/test/memtest/Makefile @@ -0,0 +1,27 @@ +CFLAGS = -fPIC -Wall -O1 -DISP_SUPPORT_M2IKERNEL -DSPCM_NAMESPACE=spcm_memtest -DNDEBUG + +COMPILER = g++ +EXECUTABLE = spcm_memtest + +#IMPORTANT: add files with .o ending, otherwise linux will produce run-time errors when library is used + +OBJECTS = main.o \ + ../../common/ostools/spcm_ostools_linux.o + + +LIBS += -lrt -lstdc++ -lpthread -lspcm_linux + +all: $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(COMPILER) $(CFLAGS) $(GCC3VISIBILITYFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LIBS) + +%.o: %.cpp + $(COMPILER) $(CFLAGS) -o $*.o -c $*.cpp + +install: + +clean: + rm -f $(EXECUTABLE) + rm -f $(OBJECTS) + diff --git a/Cpp/examples/c_cpp/test/memtest/main.cpp b/Cpp/examples/c_cpp/test/memtest/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5304255b8f1d778de20f163f09fedd898ed28725 --- /dev/null +++ b/Cpp/examples/c_cpp/test/memtest/main.cpp @@ -0,0 +1,452 @@ +/* +************************************************************************** + +spcm_memtest.cpp (c) Spectrum GmbH + +************************************************************************** + +Memory test like in Spectrum Control Center for use in custom applications. + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + +#include <cstdlib> +#include <cstdio> +#include <cstring> +#include <iostream> +#include <iomanip> + +#include "../../c_header/dlltyp.h" +#include "../../c_header/regs.h" +#include "../../c_header/spcerr.h" +#include "../../c_header/spcm_drv.h" + +#include "../../common/ostools/spcm_oswrap.h" +#include "../../common/ostools/spcm_ostools.h" + +/* +************************************************************************** +szTypeToName: doing name translation +************************************************************************** +*/ + +char* szTypeToName (int32 lCardType) + { + static char szName[50]; + switch (lCardType & TYP_SERIESMASK) + { + case TYP_M2ISERIES: sprintf (szName, "M2i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M2IEXPSERIES: sprintf (szName, "M2i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M3ISERIES: sprintf (szName, "M3i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M3IEXPSERIES: sprintf (szName, "M3i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M4IEXPSERIES: sprintf (szName, "M4i.%04x-x8", lCardType & TYP_VERSIONMASK); break; + case TYP_M4XEXPSERIES: sprintf (szName, "M4x.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M2PEXPSERIES: sprintf (szName, "M2p.%04x-x4", lCardType & TYP_VERSIONMASK); break; + default: sprintf (szName, "unknown type"); break; + } + return szName; + } + + +// **************************************************************************** +// ***** command line Memory test for SPCM cards +// **************************************************************************** + +struct ST_SETUP + { + uint32 dwNumLoops; + uint32 dwNumReadsAfterWrite; + int64 llReducedMemsize; + int64 llOffset; + bool bUseContinuousMemory; // use ContMem if available and large enough + }; + +uint32 dwRunMemtest (drv_handle hCard, const struct ST_SETUP* pstSetup); + +int main (int argc, char* argv[]) + { + struct ST_SETUP stSetup = { 1, 1, 0, 0, true }; + char szCard[50]; + + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + sprintf (szCard, "/dev/spcm0"); + // sprintf (szCard, "TCPIP::192.168.1.10::inst0::INSTR"); + + + for (int lArg = 1; lArg < argc; ++lArg) + { + if (strcmp (argv[lArg], "--card") == 0) + { + // uncomment the second line and replace the IP address to use remote + // cards like in a digitizerNETBOX + sprintf (szCard, "/dev/spcm%s", argv[lArg + 1]); + // sprintf (szCard, "TCPIP::192.168.1.10::inst%s::INSTR", argv[lArg + 1]); + lArg++; + } + else if (strcmp (argv[lArg], "--loop") == 0) + { + int lLoops = atoi (argv[lArg + 1]); + if (lLoops == -1) + stSetup.dwNumLoops = 0xFFFFFFFF; // used as "forever" + else + stSetup.dwNumLoops = lLoops; + lArg++; + } + else if (strcmp (argv[lArg], "--read") == 0) + { + stSetup.dwNumReadsAfterWrite = atoi (argv[lArg + 1]); + lArg++; + } + else if (strcmp (argv[lArg], "--mem") == 0) + { + stSetup.llReducedMemsize = atoll (argv[lArg + 1]); + lArg++; + } + else if (strcmp (argv[lArg], "--offset") == 0) + { + stSetup.llOffset = atoll (argv[lArg + 1]); + lArg++; + } + else if ((strcmp (argv[lArg], "--help") == 0) + || (strcmp (argv[lArg], "-h") == 0) + || (strcmp (argv[lArg], "/?") == 0)) + { + std::cout << "Commandline Memtest for SPCM-based cards" << std::endl; + std::cout << std::endl; + std::cout << "Syntax: " << argv[0] << " [options]" << std::endl; + std::cout << "Options:" << std::endl; + std::cout << "--card <n>: index of card to be used. Default: 0" << std::endl; + std::cout << "--loop <n>: number of times the memtest should run. Default: 1. Use -1 to run test in endless loop." << std::endl; + std::cout << "--read <n>: number of times the data should be read from the card. Default: 1" << std::endl; + std::cout << "--mem <n>: number of bytes to test. Default: complete onboard memory" << std::endl; + std::cout << "--offset <n>: offset in the onboard memory in bytes. Default: 0" << std::endl; + std::cout << "--help: print this text" << std::endl; + std::cout << std::endl; + return EXIT_SUCCESS; + } + else + { + std::cerr << "Unknown parameter \"" << argv[lArg] << "\"." << std::endl; + std::cout << "Use --help to get help." << std::endl; + return EXIT_FAILURE; + } + } + + drv_handle hCard = spcm_hOpen (szCard); + if (hCard == NULL) + { + std::cerr << "Could not open card" << std::endl; + return EXIT_FAILURE; + } + + dwRunMemtest (hCard, &stSetup); + + spcm_vClose (hCard); + + return EXIT_SUCCESS; + } + +enum MEMTEST_STATE { MEMTEST_WRITE, MEMTEST_READ }; +struct ST_MEMTESTRESULTS + { + MEMTEST_STATE eState; + bool bOk; + uint32 dwLoopCount; + uint32 dwReadCount; // if we read multiple times in one loop + }; + +// ---------------------------------------------------------------------------- +// ----- Memtest +// ---------------------------------------------------------------------------- + +// Two reasons to use our own modified implementation of the Microsoft random generator: +// 1. He generates only 15 Bit. +// 2. Slow because of thread safety + +uint32 g_dwOwnRand_Hold = 1; + +void vOwnRand_Seed (uint32 dwSeed) + { + g_dwOwnRand_Hold = dwSeed; + } + +inline uint32 dwOwnRand () + { + // Microsoft rand.c is a Linear Congruential Generator + // return(((holdrand = holdrand * 214013L + 2531011L) >> 16) & 0x7fff); + + g_dwOwnRand_Hold = g_dwOwnRand_Hold * 214013L + 2531011L; + + return (g_dwOwnRand_Hold >> 15) & 0xffff; + } + + +/* +************************************************************************** +the memtest function +************************************************************************** +*/ + +#define TEST_PATTERN ((dwOwnRand () << 16) | dwOwnRand ()); + +uint32 dwRunMemtest (drv_handle hCard, const struct ST_SETUP* pstSetup) + { + uint32 dwReturn = ERR_OK; + uint32 dwError = ERR_OK; + int64 llBlockSize = 1 * MEGA_B(1); + uint64 qwContBufLen = 0; + uint32* pdwBuffer = NULL; + uint32 dwPercentageNew = 0; + uint32 dwPercentageOld = 0; + uint32 dwBufIdx = 0; + uint32* pdwBuf = NULL; + + // ----- no memory test for demo cards ----- + int32 lDemoCard = 0; + spcm_dwGetParam_i32 (hCard, SPC_MIINST_ISDEMOCARD, &lDemoCard); + if (lDemoCard != 0) + { + std::cerr << "Memtest for Demo cards is not supported." << std::endl; + return ERR_FNCNOTSUPPORTED; + } + + // ----- get and print some basic information about the used card ----- + int32 lCardType = 0; + spcm_dwGetParam_i32 (hCard, SPC_PCITYP, &lCardType); + + int32 lSN = 0; + spcm_dwGetParam_i32 (hCard, SPC_PCISERIALNR, &lSN); + + int64 llMemsize = 0; + spcm_dwGetParam_i64 (hCard, SPC_PCIMEMSIZE, &llMemsize); + + std::cout << "Found " << szTypeToName (lCardType) << " sn " << std::setw (5) << std::setfill ('0') << lSN << std::setfill (' ') << " with " << llMemsize / MEGA_B(1) << "MB memory" << std::endl; + + // ----- try to use a continuous buffer for data transfer or allocate a buffer in case there’s none or it's too small. ----- + dwError = spcm_dwGetContBuf_i64 (hCard, SPCM_BUF_DATA, (void**) &pdwBuffer, &qwContBufLen); + if (!pstSetup->bUseContinuousMemory || (qwContBufLen < (2 * (uint64) llBlockSize))) + { + // ContMem not used. + qwContBufLen = 0; + + pdwBuffer = (uint32*) pvAllocMemPageAligned (2 * llBlockSize); + + // check for mem alloc error + if (!pdwBuffer) + return ERR_MEMALLOC; + } + + // Use a reduced memsize? + if (pstSetup->llReducedMemsize) + llMemsize = pstSetup->llReducedMemsize; + + // this struct will hold the results + ST_MEMTESTRESULTS stMemTestResult; + memset (&stMemTestResult, 0, sizeof (stMemTestResult)); + + // init the random number generator + srand((uint32) time(NULL)); + vOwnRand_Seed ((uint32) time(NULL)); + + // ----- main loop ----- + uint32 dwLoopCnt = 0; + uint32 dwLoops = pstSetup->dwNumLoops; + do + { + if (pstSetup->dwNumLoops != 0xFFFFFFFF) + std::cout << "sn " << lSN << ": Loop " << pstSetup->dwNumLoops - dwLoops + 1 << "/" << pstSetup->dwNumLoops << std::endl; + else + std::cout << "sn " << lSN << ": Loop " << dwLoopCnt << std::endl; + + // initialization with random start pattern + uint32 dwStart = rand() * rand() + rand(); + + stMemTestResult.eState = MEMTEST_WRITE; + + // basic setup + dwError = spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_CARD_RESET); + if (dwError == ERR_OK) + dwError = spcm_dwSetParam_i32 (hCard, SPC_MEMTEST, 1); + if (dwError == ERR_OK) + dwError = spcm_dwSetParam_i32 (hCard, SPC_TIMEOUT, 1000); + + dwPercentageOld = 0; + dwBufIdx = 0; + uint32 dwSRand = rand (); + srand (dwSRand); + + // ----- write loop ----- + vOwnRand_Seed (dwSRand); + + if (dwError == ERR_OK) + dwError = spcm_dwDefTransfer_i64 (hCard, SPCM_BUF_DATA, SPCM_DIR_PCTOCARD, (uint32) llBlockSize, pdwBuffer, pstSetup->llOffset, 2 * llBlockSize); + if (dwError == ERR_OK) + dwError = spcm_dwSetParam_i32 (hCard, SPC_DATA_AVAIL_CARD_LEN, 0); + + uint32 dwCmd = M2CMD_DATA_STARTDMA; + for (int64 llBlock = 0; (llBlock < llMemsize) && !dwError; llBlock += llBlockSize) + { + std::cout << "\rWriting data... " << std::setw (3) << std::fixed << std::setprecision (0) << std::right << (100. * llBlock) / llMemsize << "%"; + + // Use the buffers in ping-pong mode. + if (dwBufIdx == 0) + { + pdwBuf = pdwBuffer; + dwBufIdx = 1; // next loop use other buffer + } + else + { + pdwBuf = pdwBuffer + llBlockSize / sizeof (uint32); + dwBufIdx = 0; // next loop use other buffer + } + + // ----- fill the data block with test pattern ----- + for (int32 i = (uint32) llBlockSize / sizeof (uint32); i; --i) + { + *pdwBuf = TEST_PATTERN; + ++pdwBuf; + } + + // New data for transfer available. + if (dwError == ERR_OK) + dwError = spcm_dwSetParam_i64 (hCard, SPC_DATA_AVAIL_CARD_LEN, llBlockSize); + + // Every 1 % update the progress bar. + dwPercentageNew = (uint32) (50.0 * llBlock / llMemsize + 0.5); + if (dwPercentageOld < dwPercentageNew) + { + dwPercentageOld = dwPercentageNew; + } + + // wait until data has been transfered to card and we can fill a new block + if (dwError == ERR_OK) + dwError = spcm_dwSetParam_i32 (hCard, SPC_M2CMD, dwCmd); // first value StartDMA + dwCmd = M2CMD_DATA_WAITDMA; + } + + // ----- wait until all data has been transfered to the card ----- + int32 lAvailBytes = 0; + uint32 dwTime_ms, dwStartTime_ms = SPCM_NAMESPACE::dwGetTickCount (); + do + { + if (dwError == ERR_OK) + dwError = spcm_dwGetParam_i32 (hCard, SPC_DATA_AVAIL_USER_LEN, &lAvailBytes); + + dwTime_ms = SPCM_NAMESPACE::dwGetTickCount (); + + // overflow, we simply start at 0 again and allow one addtional timeout time for this loop + if (dwTime_ms < dwStartTime_ms) + dwStartTime_ms = 0; + + // check for timeout + if ((dwTime_ms - dwStartTime_ms) > 1000) // random timeout value + dwError = ERR_TIMEOUT; + } + while (!dwError && (lAvailBytes < 2 * llBlockSize)); + + if (dwError == ERR_OK) + dwError = spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_DATA_STOPDMA); + + std::cout << std::endl; + + // ----- read + compare loop + for (uint32 dwReadLoop = 0; dwReadLoop < pstSetup->dwNumReadsAfterWrite && !dwError; ++dwReadLoop) + { + srand (dwSRand); + stMemTestResult.eState = MEMTEST_READ; + stMemTestResult.dwReadCount = dwReadLoop; + + // clear DMA buffer + memset (pdwBuffer, 0, (size_t) (2 * llBlockSize)); + + vOwnRand_Seed (dwSRand); + dwPercentageOld = 0; + dwBufIdx = 0; + stMemTestResult.bOk = true; + + // Start read transfer and wait for one buffer. + if (dwError == ERR_OK) + dwError = spcm_dwDefTransfer_i64 (hCard, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, (uint32) llBlockSize, pdwBuffer, pstSetup->llOffset, 2 * llBlockSize); + if (dwError == ERR_OK) + dwError = spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA); + + for (int64 llBlock = 0; (llBlock < llMemsize) && !dwError; llBlock += llBlockSize) + { + std::cout << "\rReading data " << "(" << dwReadLoop + 1 << "/" << pstSetup->dwNumReadsAfterWrite << ") ... " << std::setw (3) << std::fixed << std::setprecision (0) << std::right << (100. * llBlock) / llMemsize << "%"; + uint32 dwErrorCounter = 0; + + // use the other buffer + if (dwBufIdx == 0) + { + pdwBuf = pdwBuffer; + dwBufIdx = 1; // next loop use other buffer + } + else + { + pdwBuf = pdwBuffer + llBlockSize / 4; + dwBufIdx = 0; // next loop use other buffer + } + + uint32 dwNomVal = 0; // holds the expected value + for (int32 i = (uint32) (llBlockSize / sizeof (uint32)); i; --i, ++pdwBuf) + { + dwNomVal = TEST_PATTERN; + + // check if expected value and value that we read back from card match + if (*pdwBuf != dwNomVal) + { + dwErrorCounter++; + } + } + + // mark memory as available for transfer again + if (dwError == ERR_OK) + dwError = spcm_dwSetParam_i64 (hCard, SPC_DATA_AVAIL_CARD_LEN, llBlockSize); + + // print only a line with the error count if new errors occured + if (dwErrorCounter) + { + stMemTestResult.bOk = false; + } + + // wait for new data from the board + if (dwError == ERR_OK) + dwError = spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_DATA_WAITDMA); + } // for: block + + std::cout << " " << (stMemTestResult.bOk? "OK" : "FAIL") << std::endl; + + if (dwError == ERR_OK) + dwError = spcm_dwSetParam_i32 (hCard, SPC_M2CMD, M2CMD_DATA_STOPDMA); + } // for: lReadLoops + + // clear error in driver + if (dwError != ERR_OK) + spcm_dwGetErrorInfo_i32 (hCard, NULL, NULL, NULL); + + // Every error should be displayed. + if (dwError) + dwReturn = dwError; + + // decrease number of remaining loops if we don't loop forever + if (pstSetup->dwNumLoops != 0xFFFFFFFF) + dwLoops--; + + dwLoopCnt++; + } + while (dwLoops && (dwReturn == ERR_OK)); + + // free DMA memory if we allocated it ourself + if (qwContBufLen == 0) + vFreeMemPageAligned (pdwBuffer, 2 * llBlockSize); + + return dwReturn; + } diff --git a/Cpp/examples/c_cpp/test/memtest/spcm_memtest.vcxproj b/Cpp/examples/c_cpp/test/memtest/spcm_memtest.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..7de929ba97df8e4623f2bb3630b63fc8b64e1432 --- /dev/null +++ b/Cpp/examples/c_cpp/test/memtest/spcm_memtest.vcxproj @@ -0,0 +1,155 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{1A2F6A46-155D-4E77-8FFF-2A88C5DD0994}</ProjectGuid> + <RootNamespace>spcm_speedtest</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>$(SolutionDir)$(Configuration)\</OutDir> + <IntDir>$(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>$(SolutionDir)$(Configuration)\</OutDir> + <IntDir>$(Configuration)\</IntDir> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + <DisableSpecificWarnings>4996</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4996</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4996</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4996</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="main.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\c_header\dlltyp.h" /> + <ClInclude Include="..\..\c_header\regs.h" /> + <ClInclude Include="..\..\c_header\spcerr.h" /> + <ClInclude Include="..\..\c_header\spcm_drv.h" /> + <ClInclude Include="..\..\m2i_drv\ostools\spcm_ostools.h" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </Library> + <Library Include="..\..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </Library> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/test/memtest/spcm_memtest.vcxproj.filters b/Cpp/examples/c_cpp/test/memtest/spcm_memtest.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..97d1fbb490cafb0c18c7a3119b9408a4dafc4d70 --- /dev/null +++ b/Cpp/examples/c_cpp/test/memtest/spcm_memtest.vcxproj.filters @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Source Files\ostools"> + <UniqueIdentifier>{3586b202-ef20-402b-aa66-63cb2034f068}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Header Files\c_header"> + <UniqueIdentifier>{d248ee42-f4b6-4ff8-a4c0-a1d791034597}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\ostools"> + <UniqueIdentifier>{a785b83e-6d32-49d0-b7c5-951f3da491c0}</UniqueIdentifier> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="main.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\common\ostools\spcm_ostools_win.cpp"> + <Filter>Source Files\ostools</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\m2i_drv\ostools\spcm_ostools.h"> + <Filter>Header Files\ostools</Filter> + </ClInclude> + <ClInclude Include="..\..\c_header\dlltyp.h"> + <Filter>Header Files\c_header</Filter> + </ClInclude> + <ClInclude Include="..\..\c_header\regs.h"> + <Filter>Header Files\c_header</Filter> + </ClInclude> + <ClInclude Include="..\..\c_header\spcerr.h"> + <Filter>Header Files\c_header</Filter> + </ClInclude> + <ClInclude Include="..\..\c_header\spcm_drv.h"> + <Filter>Header Files\c_header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <Library Include="..\..\c_header\spcm_win32_msvcpp.lib" /> + <Library Include="..\..\c_header\spcm_win64_msvcpp.lib" /> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/test/rec_fifo_hd_speed.cpp b/Cpp/examples/c_cpp/test/rec_fifo_hd_speed.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1362ff371c276fdf9de012f7713feacf190f0fc6 --- /dev/null +++ b/Cpp/examples/c_cpp/test/rec_fifo_hd_speed.cpp @@ -0,0 +1,524 @@ +/* +************************************************************************** + +rec_fifo_hd_speed.cpp (c) Spectrum GmbH + +************************************************************************** + +this example supports all acquisition cards + +Does FIFO acquisition to hard disk to test the maximum writing performance +of the hard disk + +This program only runs under Windows as it uses some windows specific API +calls for data writing, time measurement and key checking + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + + +// ----- standard c include files ----- +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <conio.h> + +// ----- include of common example librarys ----- +#include "../common/spcm_lib_card.h" +#include "../common/spcm_lib_data.h" +#include "../common/spcm_lib_thread.h" + + +// ----- global setup for the run (can be changed interactively) ----- +int64 g_llSamplingRate = MEGA(20); +int32 g_lNotifySize = KILO_B(1024); +int32 g_lBufferSize = MEGA_B(128); +bool g_bThread = false; +uint64 g_qwChannelEnable = 1; +uint32 g_dwUpdateBuffers = 1; +uint32 g_dwUpdateCount = 0; +enum {eStandard, eHDSpeedTest, eSpeedTest} g_eMode = eStandard; + +#define FILENAME "stream_test" + + + +/* +************************************************************************** +bDoCardSetup: setup matching the calculation routine +************************************************************************** +*/ + +bool bDoCardSetup (ST_SPCM_CARDINFO *pstCard) + { + + + // FIFO mode setup, we run continuously and have 16 samples of pre data before trigger event + // all available channels are activated + bSpcMSetupModeRecFIFOSingle (pstCard, g_qwChannelEnable, 16); + + // we try to set the samplerate on internal PLL, no clock output + if (g_llSamplingRate > pstCard->llMaxSamplerate) + g_llSamplingRate = pstCard->llMaxSamplerate; + + // for M4i.44xx series we activate the fine granularity clock setup mode + if (pstCard->bM4i && ((pstCard->lCardType & TYP_FAMILYMASK) == 0x4400)) + spcm_dwSetParam_i64 (pstCard->hDrv, SPC_SPECIALCLOCK, 1); + + bSpcMSetupClockPLL (pstCard, g_llSamplingRate, false); + printf ("Sampling rate set to %.1lf MHz\n", (double) pstCard->llSetSamplerate / MEGA(1)); + + // we set software trigger, no trigger output + bSpcMSetupTrigSoftware (pstCard, false); + + return pstCard->bSetError; + } + + + +/* +************************************************************************** +Working routine data +************************************************************************** +*/ + + +struct ST_WORKDATA + { + int64 llWritten; + HANDLE hFile; + char szFileName[100]; + LARGE_INTEGER uStartTime; + LARGE_INTEGER uLastTime; + LARGE_INTEGER uHighResFreq; + }; + + + +/* +************************************************************************** +Setup working routine +************************************************************************** +*/ + +bool bWorkInit (void* pvWorkData, ST_BUFFERDATA* pstBufferData) + { + ST_WORKDATA* pstWorkData = (ST_WORKDATA*) pvWorkData; + + // setup for the transfer, to avoid overrun we use quite large blocks as this has a better throughput to hard disk + pstBufferData->dwDataBufLen = g_lBufferSize; + pstBufferData->dwDataNotify = g_lNotifySize; + + // setup for the work + pstWorkData->llWritten = 0; + + sprintf (pstWorkData->szFileName, "%s.bin", FILENAME); + + printf ("\n"); + printf ("Written HW-Buf SW-Buf Average Current\n-----------------------------------------------------\n"); + if ((g_eMode == eStandard) || (g_eMode == eHDSpeedTest)) + pstWorkData->hFile = CreateFile (pstWorkData->szFileName, + GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, + CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_NO_BUFFERING, + NULL); + + QueryPerformanceFrequency (&pstWorkData->uHighResFreq); + pstWorkData->uStartTime.QuadPart = 0; + + return ((pstWorkData->hFile != NULL) || (g_eMode == eSpeedTest)); + } + + + +/* +************************************************************************** +bWorkDo: stores data to hard disk +************************************************************************** +*/ + +bool bWorkDo (void* pvWorkData, ST_BUFFERDATA* pstBufferData) + { + ST_WORKDATA* pstWorkData = (ST_WORKDATA*) pvWorkData; + uint32 dwWritten; + int64 llBufferFillPromille; + LARGE_INTEGER uTime; + double dAverageTime = 0; + double dLastTime = 0; + double dAverageSpeed = 0; + double dLastSpeed = 0; + + + + // first call will initialize all time measurings + QueryPerformanceCounter (&uTime); + if (pstWorkData->uStartTime.QuadPart == 0) + { + pstWorkData->uStartTime.QuadPart = uTime.QuadPart; + pstWorkData->uLastTime.QuadPart = uTime.QuadPart; + } + + // calc transfer speed + else + { + dAverageTime = (double) (uTime.QuadPart - pstWorkData->uStartTime.QuadPart) / pstWorkData->uHighResFreq.QuadPart; + dLastTime = (double) (uTime.QuadPart - pstWorkData->uLastTime.QuadPart) / pstWorkData->uHighResFreq.QuadPart; + dAverageSpeed = (double) pstWorkData->llWritten / dAverageTime / MEGA_B(1); + dLastSpeed = (double) pstBufferData->dwDataNotify / dLastTime / MEGA_B(1); + pstWorkData->uLastTime.QuadPart = uTime.QuadPart; + } + + + // write the data and count the samples + if (g_eMode == eSpeedTest) + dwWritten = pstBufferData->dwDataNotify; + else + WriteFile (pstWorkData->hFile, pstBufferData->pvDataCurrentBuf, pstBufferData->dwDataNotify, &dwWritten, NULL); + + pstWorkData->llWritten += dwWritten; + if (dwWritten != pstBufferData->dwDataNotify) + { + printf ("\nData Write error\n"); + return false; + } + + // current status + if (--g_dwUpdateCount == 0) + { + g_dwUpdateCount = g_dwUpdateBuffers; + spcm_dwGetParam_i64 (pstBufferData->pstCard->hDrv, SPC_FILLSIZEPROMILLE, &llBufferFillPromille); + + printf ("\r"); + if (pstBufferData->qwDataTransferred > GIGA_B(1)) + printf ("%7.2lf GB", (double) pstBufferData->qwDataTransferred / GIGA_B(1)); + else + printf ("%7.2lf MB", (double) pstBufferData->qwDataTransferred / MEGA_B(1)); + + printf (" %6.1lf %%", (double) llBufferFillPromille / 10.0); + + printf (" %6.1lf %%", 100.0 * (double) pstBufferData->llDataAvailBytes / pstBufferData->dwDataBufLen); + + // print transfer speed + printf (" %6.2lf MB/s", dAverageSpeed); + printf (" %6.2lf MB/s", dLastSpeed); + } + + pstBufferData->llDataAvailBytes = pstBufferData->dwDataNotify; + + return true; + } + + + + +/* +************************************************************************** +vWorkClose: Close the work and clean up + For speed reason is the bKeyAbortCheck function (with + kbhit() inside) not used! +************************************************************************** +*/ + +void vWorkClose (void* pvWorkData, ST_BUFFERDATA* pstBufferData) + { + ST_WORKDATA* pstWorkData = (ST_WORKDATA*) pvWorkData; + + if (pstWorkData->hFile && (g_eMode != eSpeedTest)) + CloseHandle (pstWorkData->hFile); + } + + +/* +************************************************************************** +bKeyCheckAsync +************************************************************************** +*/ +int g_nKeyPress; +bool bKeyCheckAsync (void* , ST_BUFFERDATA*) + { + return (g_nKeyPress != GetAsyncKeyState(VK_ESCAPE)); + } + + + +/* +************************************************************************** +bSetup: returns true if start, false if abort +************************************************************************** +*/ + +bool bSetup (ST_SPCM_CARDINFO* pstCard) + { + double dTmp; + uint32 dwTmp; + int32 lChannels; + char szErrorText[ERRORTEXTLEN], szNameBuffer[100]; + uint64 qwContBufLen; + + // read out cont buf len and set default buffer size to it + void* pvTmp; + spcm_dwSetParam_i64 (pstCard->hDrv, SPC_M2CMD, M2CMD_CARD_RESET); + spcm_dwGetContBuf_i64 (pstCard->hDrv, SPCM_BUF_DATA, &pvTmp, &qwContBufLen); + if (qwContBufLen > 0) + g_lBufferSize = (int32) qwContBufLen; + + while (1) + { + printf ("\n\n"); + printf ("Current Setup\n-------------\n"); + printf (" Card Selection: %s", pszSpcMPrintCardInfo (pstCard, szNameBuffer, sizeof (szNameBuffer), false)); + printf ("I ....... Interface speed: "); + switch (g_eMode) + { + case eStandard: printf ("Normal FIFO mode to HD\n"); break; + case eHDSpeedTest: printf ("Max PCI/PCIe interface speed to HD\n"); break; + case eSpeedTest: printf ("Max PCI/PCIe interface speed only\n"); break; + } + printf ("B ....... Buffer Size: %.2lf MByte (Continuous Buffer: %d MByte)\n", (double) g_lBufferSize / MEGA_B(1), (int32) (qwContBufLen / MEGA_B(1))); + printf ("N ....... Notify Size: %d kByte\n", g_lNotifySize / KILO_B(1)); + if (g_eMode == eStandard) + { + printf ("S ....... Sampling Rate: %.2lf MS/s\n", (double) g_llSamplingRate / MEGA(1)); + printf ("T ....... Thread Mode: %s\n", g_bThread ? "on" : "off"); + printf ("C ....... Channel Enable: %x\n", g_qwChannelEnable); + } + printf ("Enter ... Start Test\n"); + printf ("Q ....... Quit\n"); + + // for M4i.44xx series we activate the fine granularity clock setup mode + if (pstCard->bM4i && ((pstCard->lCardType & TYP_FAMILYMASK) == 0x4400)) + spcm_dwSetParam_i64 (pstCard->hDrv, SPC_SPECIALCLOCK, 1); + + spcm_dwSetParam_i64 (pstCard->hDrv, SPC_CHENABLE, g_qwChannelEnable); + spcm_dwSetParam_i64 (pstCard->hDrv, SPC_SAMPLERATE, g_llSamplingRate); + spcm_dwGetParam_i64 (pstCard->hDrv, SPC_SAMPLERATE, &g_llSamplingRate); + spcm_dwGetParam_i32 (pstCard->hDrv, SPC_CHCOUNT, &lChannels); + spcm_dwSetParam_i32 (pstCard->hDrv, SPC_TEST_FIFOSPEED, (g_eMode != eStandard) ? 1 : 0); + + + + if (spcm_dwGetErrorInfo_i32 (pstCard->hDrv, NULL, NULL, szErrorText) != ERR_OK) + printf ("\nSetup Error:\n------------\n%s\n\n", szErrorText); + else + { + double dTransferSpeed; + if (pstCard->eCardFunction == AnalogIn) + dTransferSpeed = (double) g_llSamplingRate * lChannels * pstCard->lBytesPerSample; + else + dTransferSpeed = (double) g_llSamplingRate * lChannels / 8; + + if (g_eMode == eStandard) + { + printf (" Sampling Rate adjusted to: %.2lf MS/s\n", (double) g_llSamplingRate / MEGA(1)); + printf (" Transfer Speed: %.2lf MByte/s\n", dTransferSpeed / MEGA_B(1)); + } + else + printf (" Transfer Speed: max\n"); + + // calc the display update rate in buffers to x/second to keep display overhead small + g_dwUpdateBuffers = (uint32) (dTransferSpeed / g_lNotifySize / 4); + if (g_dwUpdateBuffers < 1) + g_dwUpdateBuffers = 1; + g_dwUpdateCount = g_dwUpdateBuffers; + } + printf ("\n"); + + + switch (_getch()) + { + case 'q': + case 'Q': + return false; + + case 13: + if (g_lBufferSize <= (int32) qwContBufLen) + printf ("\n***** Continuous Buffer from Kernel Driver used *****\n\n"); + return true; + + case 'i': + case 'I': + switch (g_eMode) + { + case eStandard: g_eMode = eHDSpeedTest; break; + case eHDSpeedTest: g_eMode = eSpeedTest; break; + case eSpeedTest: g_eMode = eStandard; break; + } + break; + + case 't': + case 'T': + g_bThread = !g_bThread; + break; + + case 's': + case 'S': + printf ("Sampling Rate (MS/s): "); + scanf ("%lf", &dTmp); + g_llSamplingRate = (int32) (dTmp * MEGA(1)); + break; + + case 'b': + case 'B': + printf ("Buffer Size (MByte): "); + scanf ("%lf", &dTmp); + g_lBufferSize = (int32) (dTmp * MEGA_B(1)); + break; + + case 'n': + case 'N': + printf ("Notify Size (kByte): "); + scanf ("%lf", &dTmp); + g_lNotifySize = (int32) (dTmp * KILO_B(1)); + break; + + case 'c': + case 'C': + printf ("Channel Enable Mask (hex): "); + scanf ("%x", &dwTmp); + g_qwChannelEnable = dwTmp; + break; + + } + } + } + + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + char szBuffer[1024]; // a character buffer for any messages + ST_SPCM_CARDINFO astCard[MAXBRD]; // info structure of my card + ST_BUFFERDATA stBufferData; // buffer and transfer definitions + ST_WORKDATA stWorkData; // work data for the working functions + int32 lCardIdx = 0; + int32 lCardCount = 0; + + // ------------------------------------------------------------------------ + // init cards, get some information and print it + for (lCardIdx = 0; lCardIdx < MAXBRD; lCardIdx++) + { + if (bSpcMInitCardByIdx (&astCard[lCardCount], lCardIdx)) + { + printf (pszSpcMPrintCardInfo (&astCard[lCardCount], szBuffer, sizeof (szBuffer))); + printf ("\n"); + lCardCount++; + } + } + if (lCardCount == 0) + { + printf ("No Spectrum card found...\n"); + return 0; + } + + // if we have more than one card we make the selection now + if (lCardCount > 1) + { + do + { + printf ("\n"); + printf ("Please select the card to test:\n"); + printf ("-------------------------------\n"); + for (lCardIdx = 0; lCardIdx < lCardCount; lCardIdx++) + printf ("%d ..... M2i.%04x sn %05d\n", lCardIdx, astCard[lCardIdx].lCardType & TYP_VERSIONMASK, astCard[lCardIdx].lSerialNumber); + + int16 nSelection = _getch(); + if (nSelection == 27) + return 1; + if ((nSelection >= '0') && (nSelection < ('0' + lCardIdx))) + lCardIdx = (nSelection - '0'); + } + while (lCardIdx == lCardCount); + + // close all the other cards allowing a second instance of the program to run + for (int32 lCloseIdx = 0; lCloseIdx < lCardCount; lCloseIdx++) + if (lCloseIdx != lCardIdx) + vSpcMCloseCard (&astCard[lCloseIdx]); + } + else + lCardIdx = 0; + + + + // check whether we support this card type in the example + if ((astCard[lCardIdx].eCardFunction != AnalogIn) && (astCard[lCardIdx].eCardFunction != DigitalIn) && (astCard[lCardIdx].eCardFunction != DigitalIO)) + return nSpcMErrorMessageStdOut (&astCard[lCardIdx], "Error: Card function not supported by this example\n", false); + + + // we start with 16 bit acquisition as this is supported by all cards + switch (astCard[lCardIdx].eCardFunction) + { + case AnalogIn: + switch (astCard[lCardIdx].lBytesPerSample) + { + case 1: g_qwChannelEnable = CHANNEL1 | CHANNEL0; break; + case 2: g_qwChannelEnable = CHANNEL0; break; + } + break; + + case DigitalIn: + case DigitalIO: + g_qwChannelEnable = 0xffff; + break; + } + + + + // ------------------------------------------------------------------------ + // do the card setup, error is routed in the structure so we don't care for the return values + while (bSetup(&astCard[lCardIdx])) + { + if (!astCard[lCardIdx].bSetError) + bDoCardSetup (&astCard[lCardIdx]); + + + // ------------------------------------------------------------------------ + // setup the data transfer thread and start it, we use atimeout of 5 s in the example + memset (&stBufferData, 0, sizeof(stBufferData)); + stBufferData.pstCard = &astCard[lCardIdx]; + stBufferData.bStartCard = true; + stBufferData.bStartData = true; + stBufferData.lTimeout = 5000; + + // setup for async esc check + g_nKeyPress = GetAsyncKeyState(VK_ESCAPE); + + // start the threaded version if g_bThread is defined + if (!astCard[lCardIdx].bSetError && g_bThread) + vDoThreadMainLoop (&stBufferData, &stWorkData, bWorkInit, bWorkDo, vWorkClose, bKeyCheckAsync); + + // start the unthreaded version with a smaller timeout of 100 ms to gain control about the FIFO loop + stBufferData.lTimeout = 100; + if (!astCard[lCardIdx].bSetError && !g_bThread) + vDoMainLoop (&stBufferData, &stWorkData, bWorkInit, bWorkDo, vWorkClose, bKeyCheckAsync); + + + // ------------------------------------------------------------------------ + // print error information if an error occured + if (astCard[lCardIdx].bSetError) + return nSpcMErrorMessageStdOut (&astCard[lCardIdx], "An error occured while programming the card:\n", true); + + } // if (bStart) + + + // clean up and close the driver + vSpcMCloseCard (&astCard[lCardIdx]); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/test/rec_fifo_hd_speed/rec_fifo_hd_speed.cpp b/Cpp/examples/c_cpp/test/rec_fifo_hd_speed/rec_fifo_hd_speed.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7e42569d9ab68c61f6ead120d4a084c4bf71a51b --- /dev/null +++ b/Cpp/examples/c_cpp/test/rec_fifo_hd_speed/rec_fifo_hd_speed.cpp @@ -0,0 +1,543 @@ +/* +************************************************************************** + +rec_fifo_hd_speed.cpp (c) Spectrum GmbH + +************************************************************************** + +this example supports all acquisition cards + +Does FIFO acquisition to hard disk to test the maximum writing performance +of the hard disk + +This program only runs under Windows as it uses some windows specific API +calls for data writing, time measurement and key checking + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + + +// ----- standard c include files ----- +#include <cstdio> +#include <cstring> +#include <cstdlib> +#include <conio.h> + +// ----- include of common example librarys ----- +#include "../../common/spcm_lib_card.h" +#include "../../common/spcm_lib_data.h" +#include "../../common/spcm_lib_thread.h" + + +// ----- global setup for the run (can be changed interactively) ----- +int64 g_llSamplingRate = MEGA(20); +int32 g_lNotifySize = KILO_B(1024); +int64 g_llBufferSize = MEGA_B(128); +bool g_bThread = false; +uint64 g_qwChannelEnable = 1; +uint32 g_dwUpdateBuffers = 1; +uint32 g_dwUpdateCount = 0; +enum + { + eFifoToHD, // card -> PC memory -> HDD + eFifoToRAM, // card -> PC memory + eHDSpeedTest, // card -> PC memory -> HDD (interface speed) + eSpeedTest // card -> PC memory (interface speed) + } g_eMode = eFifoToHD; + +#define FILENAME "stream_test" + + + +/* +************************************************************************** +bDoCardSetup: setup matching the calculation routine +************************************************************************** +*/ + +bool bDoCardSetup (ST_SPCM_CARDINFO *pstCard) + { + + + // FIFO mode setup, we run continuously and have 16 samples of pre data before trigger event + // all available channels are activated + bSpcMSetupModeRecFIFOSingle (pstCard, g_qwChannelEnable, 16); + + // we try to set the samplerate on internal PLL, no clock output + if (g_llSamplingRate > pstCard->llMaxSamplerate) + g_llSamplingRate = pstCard->llMaxSamplerate; + + // for M4i.44xx series we activate the fine granularity clock setup mode + if (pstCard->bM4i && ((pstCard->lCardType & TYP_FAMILYMASK) == 0x4400)) + spcm_dwSetParam_i64 (pstCard->hDrv, SPC_SPECIALCLOCK, 1); + + bSpcMSetupClockPLL (pstCard, g_llSamplingRate, false); + printf ("Sampling rate set to %.1lf MHz\n", (double) pstCard->llSetSamplerate / MEGA(1)); + + // we set software trigger, no trigger output + bSpcMSetupTrigSoftware (pstCard, false); + + return pstCard->bSetError; + } + + + +/* +************************************************************************** +Working routine data +************************************************************************** +*/ + + +struct ST_WORKDATA + { + int64 llWritten; + HANDLE hFile; + char szFileName[100]; + LARGE_INTEGER uStartTime; + LARGE_INTEGER uLastTime; + LARGE_INTEGER uHighResFreq; + }; + + + +/* +************************************************************************** +Setup working routine +************************************************************************** +*/ + +bool bWorkInit (void* pvWorkData, ST_BUFFERDATA* pstBufferData) + { + ST_WORKDATA* pstWorkData = (ST_WORKDATA*) pvWorkData; + + // setup for the transfer, to avoid overrun we use quite large blocks as this has a better throughput to hard disk + pstBufferData->dwDataBufLen = static_cast < uint32 > (g_llBufferSize); + pstBufferData->dwDataNotify = static_cast < uint32 > (g_lNotifySize); + + // setup for the work + pstWorkData->llWritten = 0; + + sprintf (pstWorkData->szFileName, "%s.bin", FILENAME); + + printf ("\n"); + printf ("Written HW-Buf SW-Buf Average Current\n-----------------------------------------------------\n"); + if ((g_eMode == eFifoToHD) || (g_eMode == eHDSpeedTest)) + { + pstWorkData->hFile = CreateFile (pstWorkData->szFileName, + GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, + CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_NO_BUFFERING, + NULL); + } + else + pstWorkData->hFile = NULL; + + QueryPerformanceFrequency (&pstWorkData->uHighResFreq); + pstWorkData->uStartTime.QuadPart = 0; + + return ((pstWorkData->hFile != NULL) || (g_eMode == eSpeedTest) || (g_eMode == eFifoToRAM)); + } + + + +/* +************************************************************************** +bWorkDo: stores data to hard disk +************************************************************************** +*/ + +bool bWorkDo (void* pvWorkData, ST_BUFFERDATA* pstBufferData) + { + ST_WORKDATA* pstWorkData = (ST_WORKDATA*) pvWorkData; + uint32 dwWritten; + int64 llBufferFillPromille; + LARGE_INTEGER uTime; + double dAverageTime = 0; + double dLastTime = 0; + double dAverageSpeed = 0; + double dLastSpeed = 0; + + + + // first call will initialize all time measurings + QueryPerformanceCounter (&uTime); + if (pstWorkData->uStartTime.QuadPart == 0) + { + pstWorkData->uStartTime.QuadPart = uTime.QuadPart; + pstWorkData->uLastTime.QuadPart = uTime.QuadPart; + } + + // calc transfer speed + else + { + dAverageTime = (double) (uTime.QuadPart - pstWorkData->uStartTime.QuadPart) / pstWorkData->uHighResFreq.QuadPart; + dLastTime = (double) (uTime.QuadPart - pstWorkData->uLastTime.QuadPart) / pstWorkData->uHighResFreq.QuadPart; + dAverageSpeed = (double) pstWorkData->llWritten / dAverageTime / MEGA_B(1); + dLastSpeed = (double) pstBufferData->dwDataNotify / dLastTime / MEGA_B(1); + pstWorkData->uLastTime.QuadPart = uTime.QuadPart; + } + + + // write the data and count the samples + switch (g_eMode) + { + case eFifoToRAM: + case eSpeedTest: + dwWritten = pstBufferData->dwDataNotify; + break; + default: // the other modes write to HDD + WriteFile (pstWorkData->hFile, pstBufferData->pvDataCurrentBuf, pstBufferData->dwDataNotify, &dwWritten, NULL); + break; + } + + pstWorkData->llWritten += dwWritten; + if (dwWritten != pstBufferData->dwDataNotify) + { + printf ("\nData Write error\n"); + return false; + } + + // current status + if (--g_dwUpdateCount == 0) + { + g_dwUpdateCount = g_dwUpdateBuffers; + spcm_dwGetParam_i64 (pstBufferData->pstCard->hDrv, SPC_FILLSIZEPROMILLE, &llBufferFillPromille); + + printf ("\r"); + if (pstBufferData->qwDataTransferred > GIGA_B(1)) + printf ("%7.2lf GiB", (double) pstBufferData->qwDataTransferred / GIGA_B(1)); + else + printf ("%7.2lf MiB", (double) pstBufferData->qwDataTransferred / MEGA_B(1)); + + printf (" %6.1lf %%", (double) llBufferFillPromille / 10.0); + + printf (" %6.1lf %%", 100.0 * (double) pstBufferData->llDataAvailBytes / pstBufferData->dwDataBufLen); + + // print transfer speed + printf (" %6.2lf MiB/s", dAverageSpeed); + printf (" %6.2lf MiB/s", dLastSpeed); + } + + pstBufferData->llDataAvailBytes = pstBufferData->dwDataNotify; + + return true; + } + + + + +/* +************************************************************************** +vWorkClose: Close the work and clean up + For speed reason is the bKeyAbortCheck function (with + kbhit() inside) not used! +************************************************************************** +*/ + +void vWorkClose (void* pvWorkData, ST_BUFFERDATA* pstBufferData) + { + ST_WORKDATA* pstWorkData = (ST_WORKDATA*) pvWorkData; + + if (pstWorkData->hFile && (g_eMode != eSpeedTest)) + CloseHandle (pstWorkData->hFile); + } + + +/* +************************************************************************** +bKeyCheckAsync +************************************************************************** +*/ +int g_nKeyPress; +bool bKeyCheckAsync (void* , ST_BUFFERDATA*) + { + return (g_nKeyPress != GetAsyncKeyState(VK_ESCAPE)); + } + + + +/* +************************************************************************** +bSetup: returns true if start, false if abort +************************************************************************** +*/ + +bool bSetup (ST_SPCM_CARDINFO* pstCard) + { + double dTmp; + uint32 dwTmp; + int32 lChannels; + char szErrorText[ERRORTEXTLEN], szNameBuffer[100]; + uint64 qwContBufLen; + + // read out cont buf len and set default buffer size to it + void* pvTmp; + spcm_dwSetParam_i64 (pstCard->hDrv, SPC_M2CMD, M2CMD_CARD_RESET); + spcm_dwGetContBuf_i64 (pstCard->hDrv, SPCM_BUF_DATA, &pvTmp, &qwContBufLen); + if (qwContBufLen > 0) + g_llBufferSize = (int32) qwContBufLen; + + while (1) + { + printf ("\n\n"); + printf ("Current Setup\n-------------\n"); + printf (" Card Selection: %s", pszSpcMPrintCardInfo (pstCard, szNameBuffer, sizeof (szNameBuffer), false)); + printf ("I ....... Interface speed: "); + switch (g_eMode) + { + case eFifoToHD: printf ("Normal FIFO mode to HD\n"); break; + case eFifoToRAM: printf ("Normal FIFO mode to RAM\n"); break; + case eHDSpeedTest: printf ("Max PCI/PCIe interface speed to HD\n"); break; + case eSpeedTest: printf ("Max PCI/PCIe interface speed only\n"); break; + } + printf ("B ....... Buffer Size: %.2lf MiByte (Continuous Buffer: %d MiByte)\n", (double) g_llBufferSize / MEGA_B(1), (int32) (qwContBufLen / MEGA_B(1))); + printf ("N ....... Notify Size: %d kiByte\n", (int)(g_lNotifySize / KILO_B(1))); + if ((g_eMode == eFifoToHD) || (g_eMode == eFifoToRAM)) + { + printf ("S ....... Sampling Rate: %.2lf MS/s\n", (double) g_llSamplingRate / MEGA(1)); + printf ("T ....... Thread Mode: %s\n", g_bThread ? "on" : "off"); + printf ("C ....... Channel Enable: 0x%llx\n", g_qwChannelEnable); + } + printf ("Enter ... Start Test\n"); + printf ("Q ....... Quit\n"); + + // for M4i.44xx series we activate the fine granularity clock setup mode + if (pstCard->bM4i && ((pstCard->lCardType & TYP_FAMILYMASK) == 0x4400)) + spcm_dwSetParam_i64 (pstCard->hDrv, SPC_SPECIALCLOCK, 1); + + spcm_dwSetParam_i64 (pstCard->hDrv, SPC_CHENABLE, g_qwChannelEnable); + spcm_dwSetParam_i64 (pstCard->hDrv, SPC_SAMPLERATE, g_llSamplingRate); + spcm_dwGetParam_i64 (pstCard->hDrv, SPC_SAMPLERATE, &g_llSamplingRate); + spcm_dwGetParam_i32 (pstCard->hDrv, SPC_CHCOUNT, &lChannels); + if ((g_eMode == eHDSpeedTest) || (g_eMode == eSpeedTest)) + spcm_dwSetParam_i32 (pstCard->hDrv, SPC_TEST_FIFOSPEED, 1); + + + + if (spcm_dwGetErrorInfo_i32 (pstCard->hDrv, NULL, NULL, szErrorText) != ERR_OK) + printf ("\nSetup Error:\n------------\n%s\n\n", szErrorText); + else + { + double dTransferSpeed; + if (pstCard->eCardFunction == AnalogIn) + dTransferSpeed = (double) g_llSamplingRate * lChannels * pstCard->lBytesPerSample; + else + dTransferSpeed = (double) g_llSamplingRate * lChannels / 8; + + if ((g_eMode == eFifoToHD) || (g_eMode == eFifoToRAM)) + { + printf (" Sampling Rate adjusted to: %.2lf MS/s\n", (double) g_llSamplingRate / MEGA(1)); + printf (" Transfer Speed: %.2lf MiByte/s\n", dTransferSpeed / MEGA_B(1)); + } + else + printf (" Transfer Speed: max\n"); + + // calc the display update rate in buffers to x/second to keep display overhead small + g_dwUpdateBuffers = (uint32) (dTransferSpeed / g_lNotifySize / 4); + if (g_dwUpdateBuffers < 1) + g_dwUpdateBuffers = 1; + g_dwUpdateCount = g_dwUpdateBuffers; + } + printf ("\n"); + + + switch (_getch()) + { + case 'q': + case 'Q': + return false; + + case 13: + if (g_llBufferSize <= (int32) qwContBufLen) + printf ("\n***** Continuous Buffer from Kernel Driver used *****\n\n"); + return true; + + case 'i': + case 'I': + switch (g_eMode) + { + case eFifoToHD: g_eMode = eFifoToRAM; break; + case eFifoToRAM: g_eMode = eHDSpeedTest; break; + case eHDSpeedTest: g_eMode = eSpeedTest; break; + case eSpeedTest: g_eMode = eFifoToHD; break; + } + break; + + case 't': + case 'T': + g_bThread = !g_bThread; + break; + + case 's': + case 'S': + printf ("Sampling Rate (MS/s): "); + scanf ("%lf", &dTmp); + g_llSamplingRate = (int32) (dTmp * MEGA(1)); + break; + + case 'b': + case 'B': + printf ("Buffer Size (MiByte): "); + scanf ("%lf", &dTmp); + g_llBufferSize = (int32) (dTmp * MEGA_B(1)); + break; + + case 'n': + case 'N': + printf ("Notify Size (kiByte): "); + scanf ("%lf", &dTmp); + g_lNotifySize = (int32) (dTmp * KILO_B(1)); + break; + + case 'c': + case 'C': + printf ("Channel Enable Mask (hex): "); + scanf ("%x", &dwTmp); + g_qwChannelEnable = dwTmp; + break; + + } + } + } + + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + char szBuffer[1024]; // a character buffer for any messages + ST_SPCM_CARDINFO astCard[MAXBRD]; // info structure of my card + ST_BUFFERDATA stBufferData; // buffer and transfer definitions + ST_WORKDATA stWorkData; // work data for the working functions + int32 lCardIdx = 0; + int32 lCardCount = 0; + + // ------------------------------------------------------------------------ + // init cards, get some information and print it + for (lCardIdx = 0; lCardIdx < MAXBRD; lCardIdx++) + { + if (bSpcMInitCardByIdx (&astCard[lCardCount], lCardIdx)) + { + printf (pszSpcMPrintCardInfo (&astCard[lCardCount], szBuffer, sizeof (szBuffer))); + printf ("\n"); + lCardCount++; + } + } + if (lCardCount == 0) + { + printf ("No Spectrum card found...\n"); + return 0; + } + + // if we have more than one card we make the selection now + if (lCardCount > 1) + { + do + { + printf ("\n"); + printf ("Please select the card to test:\n"); + printf ("-------------------------------\n"); + for (lCardIdx = 0; lCardIdx < lCardCount; lCardIdx++) + printf ("%d ..... %s\n", lCardIdx, pszSpcMPrintCardInfo (&astCard[lCardIdx], szBuffer, sizeof (szBuffer), false)); + + int16 nSelection = _getch(); + if (nSelection == 27) + return 1; + if ((nSelection >= '0') && (nSelection < ('0' + lCardIdx))) + lCardIdx = (nSelection - '0'); + } + while (lCardIdx == lCardCount); + + // close all the other cards allowing a second instance of the program to run + for (int32 lCloseIdx = 0; lCloseIdx < lCardCount; lCloseIdx++) + if (lCloseIdx != lCardIdx) + vSpcMCloseCard (&astCard[lCloseIdx]); + } + else + lCardIdx = 0; + + + + // check whether we support this card type in the example + if ((astCard[lCardIdx].eCardFunction != AnalogIn) && (astCard[lCardIdx].eCardFunction != DigitalIn) && (astCard[lCardIdx].eCardFunction != DigitalIO)) + return nSpcMErrorMessageStdOut (&astCard[lCardIdx], "Error: Card function not supported by this example\n", false); + + + // we start with 16 bit acquisition as this is supported by all cards + switch (astCard[lCardIdx].eCardFunction) + { + case AnalogIn: + switch (astCard[lCardIdx].lBytesPerSample) + { + case 1: g_qwChannelEnable = CHANNEL1 | CHANNEL0; break; + case 2: g_qwChannelEnable = CHANNEL0; break; + } + break; + + case DigitalIn: + case DigitalIO: + g_qwChannelEnable = 0xffff; + break; + } + + + + // ------------------------------------------------------------------------ + // do the card setup, error is routed in the structure so we don't care for the return values + while (bSetup(&astCard[lCardIdx])) + { + if (!astCard[lCardIdx].bSetError) + bDoCardSetup (&astCard[lCardIdx]); + + + // ------------------------------------------------------------------------ + // setup the data transfer thread and start it, we use a timeout of 5 s in the example + memset (&stBufferData, 0, sizeof(stBufferData)); + stBufferData.pstCard = &astCard[lCardIdx]; + stBufferData.bStartCard = true; + stBufferData.bStartData = true; + stBufferData.lTimeout = 5000; + + // setup for async esc check + g_nKeyPress = GetAsyncKeyState(VK_ESCAPE); + + // start the threaded version if g_bThread is defined + if (!astCard[lCardIdx].bSetError && g_bThread) + vDoThreadMainLoop (&stBufferData, &stWorkData, bWorkInit, bWorkDo, vWorkClose, bKeyCheckAsync); + + // start the unthreaded version with a smaller timeout of 100 ms to gain control about the FIFO loop + stBufferData.lTimeout = 100; + if (!astCard[lCardIdx].bSetError && !g_bThread) + vDoMainLoop (&stBufferData, &stWorkData, bWorkInit, bWorkDo, vWorkClose, bKeyCheckAsync); + + + // ------------------------------------------------------------------------ + // print error information if an error occured + if (astCard[lCardIdx].bSetError) + return nSpcMErrorMessageStdOut (&astCard[lCardIdx], "An error occured while programming the card:\n", true); + + } // if (bStart) + + + // clean up and close the driver + vSpcMCloseCard (&astCard[lCardIdx]); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/test/rec_fifo_hd_speed/rec_fifo_hd_speed.dsp b/Cpp/examples/c_cpp/test/rec_fifo_hd_speed/rec_fifo_hd_speed.dsp new file mode 100644 index 0000000000000000000000000000000000000000..d2cffaccad9cb2f24cd7193032a4cce4b230ef43 --- /dev/null +++ b/Cpp/examples/c_cpp/test/rec_fifo_hd_speed/rec_fifo_hd_speed.dsp @@ -0,0 +1,160 @@ +# Microsoft Developer Studio Project File - Name="rec_fifo_hd_speed" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=rec_fifo_hd_speed - Win32 Debug +!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE +!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl +!MESSAGE +!MESSAGE NMAKE /f "rec_fifo_hd_speed.mak". +!MESSAGE +!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben +!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: +!MESSAGE +!MESSAGE NMAKE /f "rec_fifo_hd_speed.mak" CFG="rec_fifo_hd_speed - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "rec_fifo_hd_speed - Win32 Release" (basierend auf "Win32 (x86) Console Application") +!MESSAGE "rec_fifo_hd_speed - Win32 Debug" (basierend auf "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "rec_fifo_hd_speed - 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 /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 /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 /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "rec_fifo_hd_speed - 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 /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 /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 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "rec_fifo_hd_speed - Win32 Release" +# Name "rec_fifo_hd_speed - Win32 Debug" +# Begin Group "common" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\sb5_file\sb5_file.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_card.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_thread.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_ostools_win.cpp +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_win32_msvcpp.lib +# End Source File +# End Group +# Begin Group "header" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\c_header\dlltyp.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\regs.h +# End Source File +# Begin Source File + +SOURCE=..\sb5_file\sb5_file.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcerr.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_drv.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_card.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_thread.h +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_ostools.h +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_oswrap.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\rec_fifo_hd_speed.cpp +# End Source File +# End Target +# End Project diff --git a/Cpp/examples/c_cpp/test/rec_fifo_hd_speed/rec_fifo_hd_speed.sln b/Cpp/examples/c_cpp/test/rec_fifo_hd_speed/rec_fifo_hd_speed.sln new file mode 100644 index 0000000000000000000000000000000000000000..3b0134eba08dfc0621b7543719ac9167d287cf75 --- /dev/null +++ b/Cpp/examples/c_cpp/test/rec_fifo_hd_speed/rec_fifo_hd_speed.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rec_fifo_hd_speed", "rec_fifo_hd_speed.vcproj", "{25F4024B-53D9-4682-B4F3-DE9EC778997E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {25F4024B-53D9-4682-B4F3-DE9EC778997E}.Debug|Win32.ActiveCfg = Debug|Win32 + {25F4024B-53D9-4682-B4F3-DE9EC778997E}.Debug|Win32.Build.0 = Debug|Win32 + {25F4024B-53D9-4682-B4F3-DE9EC778997E}.Debug|x64.ActiveCfg = Debug|x64 + {25F4024B-53D9-4682-B4F3-DE9EC778997E}.Debug|x64.Build.0 = Debug|x64 + {25F4024B-53D9-4682-B4F3-DE9EC778997E}.Release|Win32.ActiveCfg = Release|Win32 + {25F4024B-53D9-4682-B4F3-DE9EC778997E}.Release|Win32.Build.0 = Release|Win32 + {25F4024B-53D9-4682-B4F3-DE9EC778997E}.Release|x64.ActiveCfg = Release|x64 + {25F4024B-53D9-4682-B4F3-DE9EC778997E}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Cpp/examples/c_cpp/test/rec_fifo_hd_speed/rec_fifo_hd_speed.vcproj b/Cpp/examples/c_cpp/test/rec_fifo_hd_speed/rec_fifo_hd_speed.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..dcc9c50b3d821384ae44d26697249b1539baa643 --- /dev/null +++ b/Cpp/examples/c_cpp/test/rec_fifo_hd_speed/rec_fifo_hd_speed.vcproj @@ -0,0 +1,691 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="rec_fifo_hd_speed" + ProjectGUID="{25F4024B-53D9-4682-B4F3-DE9EC778997E}" + RootNamespace="rec_fifo_hd_speed" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/rec_fifo_hd_speed.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_fifo_hd_speed.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_fifo_hd_speed.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_fifo_hd_speed.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_fifo_hd_speed.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/rec_fifo_hd_speed.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_fifo_hd_speed.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_fifo_hd_speed.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_fifo_hd_speed.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_fifo_hd_speed.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/rec_fifo_hd_speed.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rec_fifo_hd_speed.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rec_fifo_hd_speed.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rec_fifo_hd_speed.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rec_fifo_hd_speed.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/rec_fifo_hd_speed.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rec_fifo_hd_speed.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rec_fifo_hd_speed.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rec_fifo_hd_speed.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rec_fifo_hd_speed.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="common" + > + <File + RelativePath="..\sb5_file\sb5_file.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_card.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_data.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_thread.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="header" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\sb5_file\sb5_file.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_card.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_data.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_thread.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_oswrap.h" + > + </File> + </Filter> + <File + RelativePath="rec_fifo_hd_speed.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/test/rec_fifo_hd_speed/rec_fifo_hd_speed.vcxproj b/Cpp/examples/c_cpp/test/rec_fifo_hd_speed/rec_fifo_hd_speed.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..cc4e49e37b5df9f8e828c49545e6903a66265598 --- /dev/null +++ b/Cpp/examples/c_cpp/test/rec_fifo_hd_speed/rec_fifo_hd_speed.vcxproj @@ -0,0 +1,270 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{25F4024B-53D9-4682-B4F3-DE9EC778997E}</ProjectGuid> + <RootNamespace>rec_fifo_hd_speed</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rec_fifo_hd_speed.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_fifo_hd_speed.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>.\Debug/rec_fifo_hd_speed.exe</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_fifo_hd_speed.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_fifo_hd_speed.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rec_fifo_hd_speed.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_fifo_hd_speed.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>.\Release/rec_fifo_hd_speed.exe</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_fifo_hd_speed.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_fifo_hd_speed.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rec_fifo_hd_speed.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rec_fifo_hd_speed.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>.\Debug/rec_fifo_hd_speed.exe</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rec_fifo_hd_speed.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rec_fifo_hd_speed.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rec_fifo_hd_speed.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rec_fifo_hd_speed.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>.\Release/rec_fifo_hd_speed.exe</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rec_fifo_hd_speed.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rec_fifo_hd_speed.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="..\..\common\spcm_lib_card.cpp" /> + <ClCompile Include="..\..\common\spcm_lib_data.cpp" /> + <ClCompile Include="..\..\common\spcm_lib_thread.cpp" /> + <ClCompile Include="..\..\sb5_file\sb5_file.cpp" /> + <ClCompile Include="rec_fifo_hd_speed.cpp" /> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </CustomBuild> + <CustomBuild Include="..\..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </CustomBuild> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\..\common\ostools\spcm_oswrap.h" /> + <ClInclude Include="..\..\common\spcm_lib_card.h" /> + <ClInclude Include="..\..\common\spcm_lib_data.h" /> + <ClInclude Include="..\..\common\spcm_lib_thread.h" /> + <ClInclude Include="..\..\c_header\dlltyp.h" /> + <ClInclude Include="..\..\c_header\regs.h" /> + <ClInclude Include="..\..\c_header\spcerr.h" /> + <ClInclude Include="..\..\c_header\spcm_drv.h" /> + <ClInclude Include="..\..\sb5_file\sb5_file.h" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/test/rec_fifo_hd_speed/rec_fifo_hd_speed.vcxproj.filters b/Cpp/examples/c_cpp/test/rec_fifo_hd_speed/rec_fifo_hd_speed.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..83f5deab8378b75bf687711c418bad8649843e32 --- /dev/null +++ b/Cpp/examples/c_cpp/test/rec_fifo_hd_speed/rec_fifo_hd_speed.vcxproj.filters @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="common"> + <UniqueIdentifier>{c9a47d39-f94a-442e-85c8-fb6371ef8524}</UniqueIdentifier> + </Filter> + <Filter Include="header"> + <UniqueIdentifier>{af81d9b8-8dff-4626-a90a-e07faef03a6a}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="rec_fifo_hd_speed.cpp" /> + <ClCompile Include="..\..\sb5_file\sb5_file.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\..\common\spcm_lib_card.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\..\common\spcm_lib_data.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\..\common\spcm_lib_thread.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\..\common\ostools\spcm_ostools_win.cpp"> + <Filter>common</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\..\sb5_file\sb5_file.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\..\common\spcm_lib_card.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\..\common\spcm_lib_data.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\..\common\spcm_lib_thread.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\..\common\ostools\spcm_oswrap.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\..\c_header\spcm_win32_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + <CustomBuild Include="..\..\c_header\spcm_win64_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/test/rep_fifo_hd_speed/rep_fifo_hd_speed.cpp b/Cpp/examples/c_cpp/test/rep_fifo_hd_speed/rep_fifo_hd_speed.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ba5e542cea12f1287720889985b3b8dc065ef9d5 --- /dev/null +++ b/Cpp/examples/c_cpp/test/rep_fifo_hd_speed/rep_fifo_hd_speed.cpp @@ -0,0 +1,432 @@ +/* +************************************************************************** + +rep_fifo_hd_speed.cpp (c) Spectrum GmbH + +************************************************************************** + +this example supports all generator cards + +Does FIFO replay from hard disk to test the maximum reading performance +of the hard disk. + +This program only runs under Windows as it uses some windows specific API +calls for file handling and key checking. + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + + +************************************************************************** +*/ + + + +// ----- standard c include files ----- +#include <cstdio> +#include <cstring> +#include <cstdlib> +#include <cmath> +#include <conio.h> + +// ----- include of common example librarys ----- +#include "../../common/spcm_lib_card.h" +#include "../../common/spcm_lib_data.h" +#include "../../common/ostools/spcm_oswrap.h" +#include "../../common/ostools/spcm_ostools.h" + + +// ----- global setup for the run (can be changed interactively) ----- +int32 g_lSamplingRate = MEGA(10); +int32 g_lNotifySize = KILO_B(1024); +int32 g_lSWBufferSize = MEGA_B(128); +int32 g_lHWBufferSize = MEGA_B(64); +int64 g_llFileSize = GIGA_B (4); +uint64 g_qwChannelEnable = 1; +HANDLE g_hFile = NULL; + +#define FILENAME "stream_test.bin" + + + +/* +************************************************************************** +bDoCardSetup: setup matching the calculation routine +************************************************************************** +*/ + +bool bDoCardSetup (ST_SPCM_CARDINFO *pstCard) + { + + bSpcMSetupModeRepFIFOSingle (pstCard, g_qwChannelEnable); + + // we try to set the samplerate to 1 MHz on internal PLL, no clock output + bSpcMSetupClockPLL (pstCard, g_lSamplingRate, false); + printf ("Sampling rate set to %.1lf MHz\n", (double) pstCard->llSetSamplerate / MEGA(1)); + + // we set software trigger, no trigger output + bSpcMSetupTrigSoftware (pstCard, false); + + return pstCard->bSetError; + } + + + +/* +************************************************************************** +DoDataCalculation: calculates the output data. Reads data from file +************************************************************************** +*/ + +bool bDoDataCalculation (ST_SPCM_CARDINFO *pstCard, void* pvBuffer, int64 llBytesToCalculate) + { + uint32 dwRead; + ReadFile (g_hFile, pvBuffer, (uint32) llBytesToCalculate, &dwRead, NULL); + if (dwRead != (uint32) llBytesToCalculate) + printf ("\nFile Read Error (completed?)\n"); + return (dwRead == (uint32) llBytesToCalculate); + } + + + +/* +************************************************************************** +bSetup: returns true if start, false if abort +************************************************************************** +*/ + +bool bSetup (ST_SPCM_CARDINFO* pstCard) + { + double dTmp; + uint32 dwTmp; + int32 lChannels; + char szErrorText[ERRORTEXTLEN]; + bool bStart = false; + + while (!bStart) + { + printf ("\n\n"); + printf ("Current Setup\n-------------\n"); + printf ("S ....... Sampling Rate: %.2lf MS/s\n", (double) g_lSamplingRate / MEGA(1)); + printf ("B ....... SW Buffer Size: %.2lf MByte\n", (double) g_lSWBufferSize / MEGA_B(1)); + printf ("H ....... HW Buffer Size: %.2lf MByte\n", (double) g_lHWBufferSize / MEGA_B(1)); + printf ("N ....... Notify Size: %d kByte\n", g_lNotifySize / KILO_B(1)); + printf ("C ....... Channel Enable: %x\n", g_qwChannelEnable); + printf ("F ....... File Size: %.2lf GByte\n", (double) g_llFileSize / GIGA_B(1)); + printf ("Enter ... Start Test\n"); + printf ("Esc ..... Abort\n"); + + spcm_dwSetParam_i64 (pstCard->hDrv, SPC_CHENABLE, g_qwChannelEnable); + spcm_dwSetParam_i64 (pstCard->hDrv, SPC_SAMPLERATE, g_lSamplingRate); + spcm_dwGetParam_i32 (pstCard->hDrv, SPC_CHCOUNT, &lChannels); + if (spcm_dwGetErrorInfo_i32 (pstCard->hDrv, NULL, NULL, szErrorText) != ERR_OK) + printf ("\nSetup Error:\n------------\n%s\n\n", szErrorText); + else + { + if (pstCard->eCardFunction == AnalogOut) + printf (" Transfer Speed: %.2lf MByte/s\n", (double) g_lSamplingRate * lChannels * pstCard->lBytesPerSample / MEGA_B(1)); + else + printf (" Transfer Speed: %.2lf MByte/s\n", (double) g_lSamplingRate * lChannels / 8 / MEGA_B(1)); + } + printf ("\n"); + + + switch (getch()) + { + case 27: return false; + case 13: bStart = true; break; + + case 's': + case 'S': + printf ("Sampling Rate (MS/s): "); + scanf ("%lf", &dTmp); + g_lSamplingRate = (int32) (dTmp * MEGA(1)); + break; + + case 'f': + case 'F': + printf ("File Size (GByte): "); + scanf ("%lf", &dTmp); + g_llFileSize = (int64) (dTmp * GIGA_B(1)); + + // must be multiple of page size (4k) + g_llFileSize = ((g_llFileSize >> 12) << 12); + break; + + case 'b': + case 'B': + printf ("SW Buffer Size (MByte): "); + scanf ("%lf", &dTmp); + g_lSWBufferSize = (int32) (dTmp * MEGA_B(1)); + break; + + case 'h': + case 'H': + printf ("HW Buffer Size (MByte): "); + scanf ("%lf", &dTmp); + g_lHWBufferSize = (int32) (dTmp * MEGA_B(1)); + break; + + case 'n': + case 'N': + printf ("Notify Size (kByte): "); + scanf ("%lf", &dTmp); + g_lNotifySize = (int32) (dTmp * KILO_B(1)); + break; + + case 'c': + case 'C': + printf ("Channel Enable Mask (hex): "); + scanf ("%x", &dwTmp); + g_qwChannelEnable = dwTmp; + break; + + } + } + + // start was called -> generate the file or open an existing one + while (1) + { + g_hFile = CreateFile (FILENAME, + GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_NO_BUFFERING, + NULL); + + // file exists, check size + if (g_hFile != INVALID_HANDLE_VALUE) + { + LARGE_INTEGER liFileSize; + GetFileSizeEx (g_hFile, &liFileSize); + + if (liFileSize.QuadPart >= g_llFileSize) + return true; + + // too small -> delete + CloseHandle (g_hFile); + DeleteFile (FILENAME); + } + + // make a new file + g_hFile = CreateFile (FILENAME, + GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, + CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_NO_BUFFERING, + NULL); + + int64 llFileStep = MEGA_B(1); + void* pvData = pvAllocMemPageAligned ((uint32) llFileStep); + int64 llIdx, llRemain; + uint32 dwWritten; + + printf ("\nWriting file with output data...\n"); + memset (pvData, 0x5A, (uint32) llFileStep); + for (llIdx = 0; llIdx < g_llFileSize; llIdx += llFileStep) + { + llRemain = (g_llFileSize - llIdx) > llFileStep ? llFileStep : g_llFileSize - llIdx; + + printf ("\rFileSize: %.3lf GByte of %.3lf GByte", (double) llIdx / GIGA_B(1), (double) g_llFileSize / GIGA_B(1)); + WriteFile (g_hFile, pvData, (uint32) llRemain, &dwWritten, NULL); + if (dwWritten != (uint32) llRemain) + { + printf ("File Write Error!\n"); + CloseHandle (g_hFile); + return false; + } + if (kbhit()) + if (getch() == 27) + { + CloseHandle (g_hFile); + return false; + } + + } + vFreeMemPageAligned (pvData, (uint32) llFileStep); + CloseHandle (g_hFile); + } + + return false; + } + + + +/* +************************************************************************** +main +************************************************************************** +*/ + +int main () + { + char szBuffer[1024]; // a character buffer for any messages + ST_SPCM_CARDINFO stCard; // info structure of my card + void* pvBuffer = NULL; + uint32 dwErr; + + + // some example checks + if (g_lSWBufferSize % g_lNotifySize) + { + printf ("In our example we can only handle sw buffers that are a whole numbered multiple of the notify size\n"); + return 1; + } + + + // ------------------------------------------------------------------------ + // init card number 0 (the first card in the system), get some information and print it + if (bSpcMInitCardByIdx (&stCard, 0)) + { + printf (pszSpcMPrintDocumentationLink (&stCard, szBuffer, sizeof (szBuffer))); + printf (pszSpcMPrintCardInfo (&stCard, szBuffer, sizeof (szBuffer))); + } + else + return nSpcMErrorMessageStdOut (&stCard, "Error: Could not open card\n", true); + + + // check whether we support this card type in the example + if ((stCard.eCardFunction != AnalogOut) && (stCard.eCardFunction != DigitalOut) && (stCard.eCardFunction != DigitalIO)) + return nSpcMErrorMessageStdOut (&stCard, "Error: Card function not supported by this example\n", false); + + + // we start with 16 bit acquisition as this is supported by all cards + switch (stCard.eCardFunction) + { + case AnalogOut: + switch (stCard.lBytesPerSample) + { + case 1: g_qwChannelEnable = CHANNEL1 | CHANNEL0; break; + case 2: g_qwChannelEnable = CHANNEL0; break; + } + break; + + default: + g_qwChannelEnable = 0xffff; + break; + } + + + + // ------------------------------------------------------------------------ + // do the card setup, error is routed in the structure so we don't care for the return values + while (bSetup(&stCard)) + { + if (!stCard.bSetError) + bDoCardSetup (&stCard); + + // ------------------------------------------------------------------------ + // allocate and setup the fifo buffer and fill it once with data + pvBuffer = pvAllocMemPageAligned ((uint32) g_lSWBufferSize); + if (!pvBuffer) + return nSpcMErrorMessageStdOut (&stCard, "Memory allocation error\n", false); + + // starting with firmware version V9 we can program the hardware buffer size to reduce the latency + if (stCard.lCtrlFwVersion >= 9) + { + spcm_dwSetParam_i64 (stCard.hDrv, SPC_DATA_OUTBUFSIZE, g_lHWBufferSize); + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_WRITESETUP); + } + + spcm_dwDefTransfer_i64 (stCard.hDrv, SPCM_BUF_DATA, SPCM_DIR_PCTOCARD, (uint32) g_lNotifySize, pvBuffer, 0, g_lSWBufferSize); + + + // do initial calculation + printf ("Fill SW-Buffer from file...\n"); + for (int32 lPos = 0; lPos < g_lSWBufferSize; lPos += g_lNotifySize) + bDoDataCalculation (&stCard, (void*) ((int32) pvBuffer + lPos), g_lNotifySize); + + + spcm_dwSetParam_i64 (stCard.hDrv, SPC_DATA_AVAIL_CARD_LEN, g_lSWBufferSize); + + // now buffer is full of data and we start the transfer (output is not started yet), timeout is 1 second + spcm_dwSetParam_i32 (stCard.hDrv, SPC_TIMEOUT, 1000); + dwErr = spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA); + + + + + // ------------------------------------------------------------------------ + // this is our main output and calculation loop + int64 llTransferredBytes = 0; + int64 llAvailUser; + int64 llBufferFillPromille; + int64 llUserPos; + bool bStarted = false; + + while (!dwErr) + { + spcm_dwGetParam_i64 (stCard.hDrv, SPC_DATA_AVAIL_USER_LEN, &llAvailUser); + spcm_dwGetParam_i64 (stCard.hDrv, SPC_FILLSIZEPROMILLE, &llBufferFillPromille); + if (llTransferredBytes > GIGA_B(1)) + printf ("\rSW-Buffer: %3.0f%% HW-Buffer:%3d%%, Total Bytes so far: %6.2f GB ", (float) 100.0 * (g_lSWBufferSize - llAvailUser) / g_lSWBufferSize, (uint32) llBufferFillPromille / 10, (float) llTransferredBytes / GIGA_B(1)); + else + printf ("\rSW-Buffer: %3.0f%% HW-Buffer:%3d%%, Total Bytes so far: %6.2f MB", (float) 100.0 * (g_lSWBufferSize - llAvailUser) / g_lSWBufferSize, (uint32) llBufferFillPromille / 10, (float) llTransferredBytes / MEGA_B(1)); + + + // we recalculate the amount of data that is free and set this part available for card again + // inhere we only take pieces of notify size + if (llAvailUser >= g_lNotifySize) + { + llTransferredBytes += g_lNotifySize; + spcm_dwGetParam_i64 (stCard.hDrv, SPC_DATA_AVAIL_USER_POS, &llUserPos); + if (bDoDataCalculation (&stCard, ((int8*) pvBuffer) + llUserPos, g_lNotifySize)) + dwErr = spcm_dwSetParam_i64 (stCard.hDrv, SPC_DATA_AVAIL_CARD_LEN, g_lNotifySize); + else + dwErr = ERR_ABORT; + } + + // we start the output as soon as we have a sufficient amount of data on card + // inhere we start if the hardware buffer is completely full + if (!bStarted && !dwErr && (llBufferFillPromille == 1000)) + { + printf ("\nStart the output\n"); + dwErr = spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER); + bStarted = true; + } + + // wait for the next buffer to be free + if (!dwErr) + dwErr = spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_DATA_WAITDMA); + + + // check for esc=abort + if (!dwErr) + if (bKbhit()) + if (cGetch() == 27) + { + printf ("\nOutput stopped\n"); + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_STOP); + dwErr = ERR_ABORT; + } + } + + // show runtime errors + if (dwErr && !stCard.bSetError) + printf ("\nEnd with Runtime Error Code:%d\n-> %s\n\n", dwErr, pszSpcMTranslateRuntimeError (dwErr, szBuffer)); + + // ------------------------------------------------------------------------ + // print error information if an error occured + if (stCard.bSetError) + return nSpcMErrorMessageStdOut (&stCard, "An error occured while programming the card:\n", true); + + // stop the card + spcm_dwSetParam_i32 (stCard.hDrv, SPC_M2CMD, M2CMD_CARD_RESET); + if (g_hFile) + CloseHandle (g_hFile); + + vFreeMemPageAligned (pvBuffer, (uint32) g_lSWBufferSize); + } + + // clean up and close the driver + vSpcMCloseCard (&stCard); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/test/rep_fifo_hd_speed/rep_fifo_hd_speed.dsp b/Cpp/examples/c_cpp/test/rep_fifo_hd_speed/rep_fifo_hd_speed.dsp new file mode 100644 index 0000000000000000000000000000000000000000..b09a8b6e4c89efb8db04893118fa54b2b9842c02 --- /dev/null +++ b/Cpp/examples/c_cpp/test/rep_fifo_hd_speed/rep_fifo_hd_speed.dsp @@ -0,0 +1,142 @@ +# Microsoft Developer Studio Project File - Name="rep_fifo_hd_speed" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=rep_fifo_hd_speed - Win32 Debug +!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE +!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl +!MESSAGE +!MESSAGE NMAKE /f "rep_fifo_hd_speed.mak". +!MESSAGE +!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben +!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: +!MESSAGE +!MESSAGE NMAKE /f "rep_fifo_hd_speed.mak" CFG="rep_fifo_hd_speed - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "rep_fifo_hd_speed - Win32 Release" (basierend auf "Win32 (x86) Console Application") +!MESSAGE "rep_fifo_hd_speed - Win32 Debug" (basierend auf "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "rep_fifo_hd_speed - 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" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c +# SUBTRACT CPP /YX /Yc /Yu +# 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)" == "rep_fifo_hd_speed - 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" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c +# SUBTRACT CPP /YX /Yc /Yu +# 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 "rep_fifo_hd_speed - Win32 Release" +# Name "rep_fifo_hd_speed - Win32 Debug" +# Begin Group "header" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\c_header\dlltyp.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\regs.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcerr.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_drv.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_card.h +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.h +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_ostools.h +# End Source File +# End Group +# Begin Group "common" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\common\spcm_lib_card.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\spcm_lib_data.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\ostools\spcm_ostools_win.cpp +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_win32_msvcpp.lib +# End Source File +# End Group +# Begin Source File + +SOURCE=.\rep_fifo_hd_speed.cpp +# End Source File +# End Target +# End Project diff --git a/Cpp/examples/c_cpp/test/rep_fifo_hd_speed/rep_fifo_hd_speed.vcproj b/Cpp/examples/c_cpp/test/rep_fifo_hd_speed/rep_fifo_hd_speed.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..b9ea5800122f0365e184c0b4e83814b8ab33ed67 --- /dev/null +++ b/Cpp/examples/c_cpp/test/rep_fifo_hd_speed/rep_fifo_hd_speed.vcproj @@ -0,0 +1,608 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="rep_fifo_hd_speed" + ProjectGUID="{F8229828-20A8-4843-BC57-C5BD6D193050}" + RootNamespace="rep_fifo_hd_speed" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/rep_fifo_hd_speed.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rep_fifo_hd_speed.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rep_fifo_hd_speed.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rep_fifo_hd_speed.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rep_fifo_hd_speed.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/rep_fifo_hd_speed.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rep_fifo_hd_speed.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rep_fifo_hd_speed.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rep_fifo_hd_speed.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rep_fifo_hd_speed.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/rep_fifo_hd_speed.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/rep_fifo_hd_speed.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/rep_fifo_hd_speed.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/rep_fifo_hd_speed.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/rep_fifo_hd_speed.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/rep_fifo_hd_speed.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/rep_fifo_hd_speed.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/rep_fifo_hd_speed.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/rep_fifo_hd_speed.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/rep_fifo_hd_speed.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="header" + Filter="h;hpp;hxx;hm;inl" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_card.h" + > + </File> + <File + RelativePath="..\common\spcm_lib_data.h" + > + </File> + <File + RelativePath="..\common\ostools\spcm_ostools.h" + > + </File> + </Filter> + <Filter + Name="common" + > + <File + RelativePath="..\common\spcm_lib_card.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\spcm_lib_data.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\common\ostools\spcm_ostools_win.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Filter> + <File + RelativePath="rep_fifo_hd_speed.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/test/rep_fifo_hd_speed/rep_fifo_hd_speed.vcxproj b/Cpp/examples/c_cpp/test/rep_fifo_hd_speed/rep_fifo_hd_speed.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..acf81e2ebf5daf1550dd4d5a42a63b80e415b9b6 --- /dev/null +++ b/Cpp/examples/c_cpp/test/rep_fifo_hd_speed/rep_fifo_hd_speed.vcxproj @@ -0,0 +1,265 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{F8229828-20A8-4843-BC57-C5BD6D193050}</ProjectGuid> + <RootNamespace>rep_fifo_hd_speed</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/rep_fifo_hd_speed.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rep_fifo_hd_speed.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>.\Debug/rep_fifo_hd_speed.exe</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rep_fifo_hd_speed.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rep_fifo_hd_speed.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/rep_fifo_hd_speed.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rep_fifo_hd_speed.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>.\Release/rep_fifo_hd_speed.exe</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rep_fifo_hd_speed.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rep_fifo_hd_speed.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/rep_fifo_hd_speed.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/rep_fifo_hd_speed.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>.\Debug/rep_fifo_hd_speed.exe</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/rep_fifo_hd_speed.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/rep_fifo_hd_speed.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/rep_fifo_hd_speed.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/rep_fifo_hd_speed.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>.\Release/rep_fifo_hd_speed.exe</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/rep_fifo_hd_speed.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/rep_fifo_hd_speed.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\common\ostools\spcm_ostools.h" /> + <ClInclude Include="..\..\common\spcm_lib_card.h" /> + <ClInclude Include="..\..\common\spcm_lib_data.h" /> + <ClInclude Include="..\..\c_header\dlltyp.h" /> + <ClInclude Include="..\..\c_header\regs.h" /> + <ClInclude Include="..\..\c_header\spcerr.h" /> + <ClInclude Include="..\..\c_header\spcm_drv.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\common\ostools\spcm_ostools_win.cpp" /> + <ClCompile Include="..\..\common\spcm_lib_card.cpp" /> + <ClCompile Include="..\..\common\spcm_lib_data.cpp" /> + <ClCompile Include="rep_fifo_hd_speed.cpp" /> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </CustomBuild> + <CustomBuild Include="..\..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </CustomBuild> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> diff --git a/Cpp/examples/c_cpp/test/rep_fifo_hd_speed/rep_fifo_hd_speed.vcxproj.filters b/Cpp/examples/c_cpp/test/rep_fifo_hd_speed/rep_fifo_hd_speed.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..3ff3add65050938f97e4939dc729d0cc54a20ae7 --- /dev/null +++ b/Cpp/examples/c_cpp/test/rep_fifo_hd_speed/rep_fifo_hd_speed.vcxproj.filters @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="header"> + <UniqueIdentifier>{79467de0-7d5a-4137-9b8d-04b11784b74d}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + <Filter Include="common"> + <UniqueIdentifier>{045de223-02cd-43f4-9543-9bac9b2e1ca0}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\c_header\dlltyp.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\..\c_header\regs.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\..\c_header\spcerr.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\..\c_header\spcm_drv.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\..\common\spcm_lib_card.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\..\common\spcm_lib_data.h"> + <Filter>header</Filter> + </ClInclude> + <ClInclude Include="..\..\common\ostools\spcm_ostools.h"> + <Filter>header</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\common\spcm_lib_card.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\..\common\spcm_lib_data.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="..\..\common\ostools\spcm_ostools_win.cpp"> + <Filter>common</Filter> + </ClCompile> + <ClCompile Include="rep_fifo_hd_speed.cpp" /> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\..\c_header\spcm_win32_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + <CustomBuild Include="..\..\c_header\spcm_win64_msvcpp.lib"> + <Filter>common</Filter> + </CustomBuild> + </ItemGroup> +</Project> diff --git a/Cpp/examples/c_cpp/test/spcm_repetition/spcm_repetition_test.cpp b/Cpp/examples/c_cpp/test/spcm_repetition/spcm_repetition_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..afc78cc39f690d9c7887ee8ec2daf71085989bc9 --- /dev/null +++ b/Cpp/examples/c_cpp/test/spcm_repetition/spcm_repetition_test.cpp @@ -0,0 +1,225 @@ +/* +************************************************************************** + +spcm_repetion_test.cpp (c) Spectrum GmbH + +************************************************************************** + +This example supports all M2i/M3i/M4i/M4x/M2p/M5i cards. It measures the +repetion rate for different block sizes in either direction. + +Documentation for the API as well as a detailed description of the hardware +can be found in the manual for each device which can be found on our website: +https://www.spectrum-instrumentation.com/en/downloads + +Further information can be found online in the Knowledge Base: +https://www.spectrum-instrumentation.com/en/knowledge-base-overview + +************************************************************************** +*/ + + + +// ----- standard c include files ----- +#include <stdio.h> +#include <stdlib.h> +#include <conio.h> + +// ----- include driver libraries ----- +#include "../../c_header/dlltyp.h" +#include "../../c_header/regs.h" +#include "../../c_header/spcerr.h" +#include "../../c_header/spcm_drv.h" + +char* szTypeToName (int32 lCardType) + { + static char szName[50]; + switch (lCardType & TYP_SERIESMASK) + { + case TYP_M2ISERIES: sprintf (szName, "M2i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M2IEXPSERIES: sprintf (szName, "M2i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M3ISERIES: sprintf (szName, "M3i.%04x", lCardType & TYP_VERSIONMASK); break; + case TYP_M3IEXPSERIES: sprintf (szName, "M3i.%04x-Exp", lCardType & TYP_VERSIONMASK); break; + case TYP_M4IEXPSERIES: sprintf (szName, "M4i.%04x-x8", lCardType & TYP_VERSIONMASK); break; + case TYP_M4XEXPSERIES: sprintf (szName, "M4x.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M2PEXPSERIES: sprintf (szName, "M2p.%04x-x4", lCardType & TYP_VERSIONMASK); break; + case TYP_M5IEXPSERIES: sprintf (szName, "M5i.%04x-x16", lCardType & TYP_VERSIONMASK); break; + default: sprintf (szName, "unknown type"); break; + } + return szName; + } + +int main () + { + drv_handle hDrv; + char szErrorText[ERRORTEXTLEN]; + int32 lKernelVersion, lDLLVersion, lCardType, lSN, lBytesPerSample, lFunctionType; + int64 llMaxSamplerate; + + + // try to open the card + printf ("Trying to open the driver ...\n"); + hDrv = spcm_hOpen ("spcm0"); + + if (!hDrv) + { + printf ("open of device failed\n"); + spcm_dwGetErrorInfo_i32 (NULL, NULL, NULL, szErrorText); + printf ("... %s\n", szErrorText); + _getch(); + return EXIT_FAILURE; + } + + // get some card information and print it + spcm_dwGetParam_i32 (hDrv, SPC_GETKERNELVERSION, &lKernelVersion); + spcm_dwGetParam_i32 (hDrv, SPC_GETDRVVERSION, &lDLLVersion); + spcm_dwGetParam_i32 (hDrv, SPC_PCITYP, &lCardType); + spcm_dwGetParam_i32 (hDrv, SPC_FNCTYPE, &lFunctionType); + spcm_dwGetParam_i32 (hDrv, SPC_PCISERIALNO, &lSN); + spcm_dwGetParam_i64 (hDrv, SPC_PCISAMPLERATE, &llMaxSamplerate); + spcm_dwGetParam_i32 (hDrv, SPC_MIINST_BYTESPERSAMPLE, &lBytesPerSample); + + + printf ("---------------------------------------\n"); +#ifdef WIN32 + printf ("PC: %s\n", getenv ("COMPUTERNAME")); +#endif // WIN32 + printf ("%s sn %05d\n", szTypeToName (lCardType), lSN); + printf ("Max. Sampling rate: %lld\n", llMaxSamplerate); + printf ("Kernel Version: V %d.%d build %d\n", (lKernelVersion >> 24) & 0xff, (lKernelVersion >> 16) & 0xff, lKernelVersion & 0xffff); + printf ("Library Version: V %d.%d build %d\n", (lDLLVersion >> 24) & 0xff, (lDLLVersion >> 16) & 0xff, lDLLVersion & 0xffff); + + switch (lCardType & TYP_SERIESMASK) + { + case TYP_M2IEXPSERIES: + case TYP_M3IEXPSERIES: + case TYP_M4IEXPSERIES: + case TYP_M4XEXPSERIES: + case TYP_M2PEXPSERIES: + case TYP_M5IEXPSERIES: + { + int32 lPCIeGen = 0; + int32 lPCIeLanes = 0; + int32 lPCIePayload = 0; + spcm_dwGetParam_i32 (hDrv, SPC_PCIEXPGENERATION, &lPCIeGen); + spcm_dwGetParam_i32 (hDrv, SPC_PCIEXPLANES, &lPCIeLanes); + spcm_dwGetParam_i32 (hDrv, SPC_PCIEXPPAYLOAD, &lPCIePayload); + printf ("PCIe Gen%dx%d, Payload: %d Bytes\n", lPCIeGen, lPCIeLanes, lPCIePayload); + break; + } + default: + // keine Businfos für PCI Karten + break; + } + printf ("---------------------------------------\n"); + + // setup the card for test + int16 *pnBuffer, *pnContMem; + int32 lMaxBufsize = MEGA_B(64); + int32 lMaxLoop; + int32 lBufsize, lLoop; + uint64 qwContBufLen; + LARGE_INTEGER uStart, uEnd, uLoopStart, uLoopEnd, uMin, uMax; + double dAvTime, dMinTime, dMaxTime; + LARGE_INTEGER uHighResFreq; + + spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_CARD_RESET); + spcm_dwSetParam_i32 (hDrv, SPC_TRIG_ANDMASK, 0); + spcm_dwSetParam_i32 (hDrv, SPC_TRIG_ORMASK, SPC_TMASK_SOFTWARE); + spcm_dwSetParam_i32 (hDrv, SPC_TRIG_EXT0_MODE, SPC_TM_POS); + spcm_dwSetParam_i32 (hDrv, SPC_CLOCKMODE, SPC_CM_INTPLL); + spcm_dwSetParam_i64 (hDrv, SPC_SAMPLERATE, llMaxSamplerate); + spcm_dwSetParam_i32 (hDrv, SPC_TIMEOUT, 0); + spcm_dwSetParam_i32 (hDrv, SPC_CARDMODE, SPC_REC_STD_SINGLE); + switch (lFunctionType) + { + case SPCM_TYPE_AI: + spcm_dwSetParam_i32 (hDrv, SPC_CHENABLE, CHANNEL0); + spcm_dwSetParam_i32 (hDrv, SPC_CARDMODE, SPC_REC_STD_SINGLE); + break; + + case SPCM_TYPE_AO: + case SPCM_TYPE_DO: + spcm_vClose (hDrv); + printf ("\ncard type not supported yet (press key)\n"); + _getch(); + break; + + case SPCM_TYPE_DI: + case SPCM_TYPE_DIO: + spcm_dwSetParam_i32 (hDrv, SPC_CHENABLE, 0xff); + spcm_dwSetParam_i32 (hDrv, SPC_CARDMODE, SPC_REC_STD_SINGLE); + break; + } + + // ----- Buffer Handling ----- + pnBuffer = (int16*) VirtualAlloc (NULL, lMaxBufsize, MEM_COMMIT, PAGE_READWRITE); + spcm_dwGetContBuf_i64 (hDrv, SPCM_BUF_DATA, (void**) &pnContMem, &qwContBufLen); + printf ("Cont Mem: %.2f MByte \n", (double) qwContBufLen / 1024.0 / 1024.0); + printf ("\n"); + + QueryPerformanceFrequency (&uHighResFreq); + for (lBufsize = 1024; lBufsize <= lMaxBufsize; lBufsize *= 2) + { + if (lBufsize < (1024*1024)) + printf ("%4d kByte ", lBufsize / 1024); + else + printf ("%4d MByte ", lBufsize / 1024 / 1024); + + // calc max loops depending on the buffersize + lMaxLoop = lMaxBufsize / lBufsize; + if (lMaxLoop < 3) lMaxLoop = 3; + if (lMaxLoop > 1000) lMaxLoop = 1000; + + spcm_dwSetParam_i32 (hDrv, SPC_MEMSIZE, lBufsize/lBytesPerSample); + spcm_dwSetParam_i32 (hDrv, SPC_POSTTRIGGER, lBufsize/lBytesPerSample - lBufsize/8); + spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_CARD_WAITREADY); + + uMin.QuadPart = 1000000000000; + uMax.QuadPart = 0; + + // now the speed measuring loop starts + QueryPerformanceCounter (&uStart); + for (lLoop = 1; lLoop <= lMaxLoop; lLoop++) + { + QueryPerformanceCounter (&uLoopStart); + + // use cont mem buf if available and large enough + if (lBufsize <= (int32) qwContBufLen) + spcm_dwDefTransfer_i64 (hDrv, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, 0, (void*) pnContMem, 0, lBufsize); + else + spcm_dwDefTransfer_i64 (hDrv, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, 0, (void*) pnBuffer, 0, lBufsize); + + spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA); + + // check for min and max repitition time + QueryPerformanceCounter (&uLoopEnd); + if ((uLoopEnd.QuadPart - uLoopStart.QuadPart) > uMax.QuadPart) + uMax.QuadPart = (uLoopEnd.QuadPart - uLoopStart.QuadPart); + if ((uLoopEnd.QuadPart - uLoopStart.QuadPart) < uMin.QuadPart) + uMin.QuadPart = (uLoopEnd.QuadPart - uLoopStart.QuadPart); + } + QueryPerformanceCounter (&uEnd); + + + // calc and print the results for this buffer size + dAvTime = (double) (uEnd.QuadPart - uStart.QuadPart) / lMaxLoop / uHighResFreq.QuadPart; + dMinTime = (double) (uMin.QuadPart) / uHighResFreq.QuadPart; + dMaxTime = (double) (uMax.QuadPart) / uHighResFreq.QuadPart; + + printf (" %5.1f MB/s Rep: %6.1f Hz Time(ms) Min=%6.2f Max=%6.2f Av=%6.2f\n", + (double) (dAvTime == 0 ? 0.0 : lBufsize / dAvTime / 1024.0 / 1024.0), + (double) (1.0 / dAvTime), + 1000.0 * dMinTime, + 1000.0 * dMaxTime, + 1000.0 * dAvTime); + } + + VirtualFree (pnBuffer, 0, MEM_RELEASE); + spcm_vClose (hDrv); + printf ("\n...end (press key)\n"); + _getch(); + + return EXIT_SUCCESS; + } + diff --git a/Cpp/examples/c_cpp/test/spcm_repetition/spcm_repetition_test.dsp b/Cpp/examples/c_cpp/test/spcm_repetition/spcm_repetition_test.dsp new file mode 100644 index 0000000000000000000000000000000000000000..4f2885865715dfdfea32d0111317f2d909e34738 --- /dev/null +++ b/Cpp/examples/c_cpp/test/spcm_repetition/spcm_repetition_test.dsp @@ -0,0 +1,120 @@ +# Microsoft Developer Studio Project File - Name="spcm_repetition_test" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=spcm_repetition_test - Win32 Debug +!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE +!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl +!MESSAGE +!MESSAGE NMAKE /f "spcm_repetition_test.mak". +!MESSAGE +!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben +!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: +!MESSAGE +!MESSAGE NMAKE /f "spcm_repetition_test.mak" CFG="spcm_repetition_test - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "spcm_repetition_test - Win32 Release" (basierend auf "Win32 (x86) Console Application") +!MESSAGE "spcm_repetition_test - Win32 Debug" (basierend auf "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "spcm_repetition_test - 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 /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)" == "spcm_repetition_test - 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 /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 "spcm_repetition_test - Win32 Release" +# Name "spcm_repetition_test - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\spcm_repetition_test.cpp +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_win32_msvcpp.lib +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\c_header\dlltyp.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\regs.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcerr.h +# End Source File +# Begin Source File + +SOURCE=..\c_header\spcm_drv.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 +# End Target +# End Project diff --git a/Cpp/examples/c_cpp/test/spcm_repetition/spcm_repetition_test.dsw b/Cpp/examples/c_cpp/test/spcm_repetition/spcm_repetition_test.dsw new file mode 100644 index 0000000000000000000000000000000000000000..45a4d25c6d25f8706c9c09d00086900986bb4d97 --- /dev/null +++ b/Cpp/examples/c_cpp/test/spcm_repetition/spcm_repetition_test.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN! + +############################################################################### + +Project: "spcm_repetition_test"=.\spcm_repetition_test.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/Cpp/examples/c_cpp/test/spcm_repetition/spcm_repetition_test.vcproj b/Cpp/examples/c_cpp/test/spcm_repetition/spcm_repetition_test.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..b76a89c5b01ca6bbe7372d86f4fb2c24160d2fea --- /dev/null +++ b/Cpp/examples/c_cpp/test/spcm_repetition/spcm_repetition_test.vcproj @@ -0,0 +1,494 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8,00" + Name="spcm_repetition_test" + ProjectGUID="{C0AE30CD-9A7F-494B-B181-5D1B36A48290}" + RootNamespace="spcm_repetition_test" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory=".\Debug" + IntermediateDirectory=".\Debug" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Debug/spcm_repetition_test.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/spcm_repetition_test.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/spcm_repetition_test.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/spcm_repetition_test.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/spcm_repetition_test.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory=".\Release" + IntermediateDirectory=".\Release" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TypeLibraryName=".\Release/spcm_repetition_test.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/spcm_repetition_test.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/spcm_repetition_test.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/spcm_repetition_test.pdb" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/spcm_repetition_test.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Debug/spcm_repetition_test.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + PrecompiledHeaderFile=".\Debug/spcm_repetition_test.pch" + AssemblerListingLocation=".\Debug/" + ObjectFile=".\Debug/" + ProgramDataBaseFileName=".\Debug/" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Debug/spcm_repetition_test.exe" + LinkIncremental="2" + SuppressStartupBanner="true" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug/spcm_repetition_test.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Debug/spcm_repetition_test.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + TypeLibraryName=".\Release/spcm_repetition_test.tlb" + HeaderFileName="" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS" + StringPooling="true" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + PrecompiledHeaderFile=".\Release/spcm_repetition_test.pch" + AssemblerListingLocation=".\Release/" + ObjectFile=".\Release/" + ProgramDataBaseFileName=".\Release/" + WarningLevel="3" + SuppressStartupBanner="true" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1031" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile=".\Release/spcm_repetition_test.exe" + LinkIncremental="1" + SuppressStartupBanner="true" + ProgramDatabaseFile=".\Release/spcm_repetition_test.pdb" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + SuppressStartupBanner="true" + OutputFile=".\Release/spcm_repetition_test.bsc" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" + > + <File + RelativePath="spcm_repetition_test.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + > + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win32_msvcpp.lib" + > + <FileConfiguration + Name="Debug|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|x64" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\c_header\spcm_win64_msvcpp.lib" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl" + > + <File + RelativePath="..\c_header\dlltyp.h" + > + </File> + <File + RelativePath="..\c_header\regs.h" + > + </File> + <File + RelativePath="..\c_header\spcerr.h" + > + </File> + <File + RelativePath="..\c_header\spcm_drv.h" + > + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Cpp/examples/c_cpp/test/spcm_repetition/spcm_repetition_test.vcxproj b/Cpp/examples/c_cpp/test/spcm_repetition/spcm_repetition_test.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..ed790ac4c94fd7ea1b3c5f6ddf1bb3ecb0bdfe9f --- /dev/null +++ b/Cpp/examples/c_cpp/test/spcm_repetition/spcm_repetition_test.vcxproj @@ -0,0 +1,259 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{C0AE30CD-9A7F-494B-B181-5D1B36A48290}</ProjectGuid> + <RootNamespace>spcm_repetition_test</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v140</PlatformToolset> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>.\Debug\</OutDir> + <IntDir>.\Debug\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>.\Release\</OutDir> + <IntDir>.\Release\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(Platform)\$(Configuration)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Midl> + <TypeLibraryName>.\Debug/spcm_repetition_test.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/spcm_repetition_test.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>.\Debug/spcm_repetition_test.exe</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/spcm_repetition_test.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/spcm_repetition_test.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Midl> + <TypeLibraryName>.\Release/spcm_repetition_test.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/spcm_repetition_test.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>.\Release/spcm_repetition_test.exe</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/spcm_repetition_test.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/spcm_repetition_test.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Debug/spcm_repetition_test.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeaderOutputFile>.\Debug/spcm_repetition_test.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Debug/</AssemblerListingLocation> + <ObjectFileName>.\Debug/</ObjectFileName> + <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>.\Debug/spcm_repetition_test.exe</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>.\Debug/spcm_repetition_test.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Debug/spcm_repetition_test.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + <TypeLibraryName>.\Release/spcm_repetition_test.tlb</TypeLibraryName> + <HeaderFileName /> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeaderOutputFile>.\Release/spcm_repetition_test.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>.\Release/</AssemblerListingLocation> + <ObjectFileName>.\Release/</ObjectFileName> + <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <SuppressStartupBanner>true</SuppressStartupBanner> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0407</Culture> + </ResourceCompile> + <Link> + <OutputFile>.\Release/spcm_repetition_test.exe</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <ProgramDatabaseFile>.\Release/spcm_repetition_test.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + <Bscmake> + <SuppressStartupBanner>true</SuppressStartupBanner> + <OutputFile>.\Release/spcm_repetition_test.bsc</OutputFile> + </Bscmake> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="spcm_repetition_test.cpp" /> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\..\c_header\spcm_win32_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </CustomBuild> + <CustomBuild Include="..\..\c_header\spcm_win64_msvcpp.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </CustomBuild> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h" /> + <ClInclude Include="..\c_header\regs.h" /> + <ClInclude Include="..\c_header\spcerr.h" /> + <ClInclude Include="..\c_header\spcm_drv.h" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/Cpp/examples/c_cpp/test/spcm_repetition/spcm_repetition_test.vcxproj.filters b/Cpp/examples/c_cpp/test/spcm_repetition/spcm_repetition_test.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..f1767d729d5575bd7db8f53d74e61bf723a47653 --- /dev/null +++ b/Cpp/examples/c_cpp/test/spcm_repetition/spcm_repetition_test.vcxproj.filters @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{6f34ae90-2ae0-4796-ab0e-258a6f5f0e34}</UniqueIdentifier> + <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{935bea33-1c75-4abd-a4f4-8770e834930e}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{2a1a6c38-8479-475c-8692-608a3a52c322}</UniqueIdentifier> + <Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="spcm_repetition_test.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\c_header\dlltyp.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\c_header\regs.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcerr.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\c_header\spcm_drv.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\..\c_header\spcm_win32_msvcpp.lib"> + <Filter>Source Files</Filter> + </CustomBuild> + <CustomBuild Include="..\..\c_header\spcm_win64_msvcpp.lib"> + <Filter>Source Files</Filter> + </CustomBuild> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/Cpp/lib/AWG.cpp b/Cpp/lib/AWG.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5f9ea9e558d1c893bbcbc2d8935a59a5ba3cc0e3 --- /dev/null +++ b/Cpp/lib/AWG.cpp @@ -0,0 +1,6 @@ +#include "AWG.h" + +AWG::AWG(int cardID) +{ + +}; diff --git a/Cpp/lib/AWG.h b/Cpp/lib/AWG.h new file mode 100644 index 0000000000000000000000000000000000000000..5d03634e6d5051bca626f73eab65e4d375ead3ce --- /dev/null +++ b/Cpp/lib/AWG.h @@ -0,0 +1,19 @@ +#pragma once +#include "dlltyp.h" +#include "regs.h" +#include "spcerr.h" +#include "spcm_drv.h" + +class AWG +{ +private: + typedef struct // dirty struct containing much card info + { + drv_handle cardHandle; + + } CARDINFO; + +public: + AWG(int cardID); +}; + diff --git a/Cpp/lib/dlltyp.h b/Cpp/lib/dlltyp.h new file mode 100644 index 0000000000000000000000000000000000000000..db56c17e904a5a7fed2d8d4fce7c9a2dd54a6a82 --- /dev/null +++ b/Cpp/lib/dlltyp.h @@ -0,0 +1,391 @@ +#ifndef DLLTYP_H +#define DLLTYP_H + + + +/* +************************************************************************** + +dlltyp.h (c) Spectrum GmbH, 2006 + +************************************************************************** + +definitions common for all Spectrum drivers and card types. This header +tries to examine the type of compiler and then defines common data types +that have the same length under all compilers and operating systems. + +This header should be the first header to include in all C/C++ projects + +************************************************************************** + +Please do not change this file as it's continuously updated with new +driver versions. If you need other settings for your special compiler +type please add these settings in an extra header file + +************************************************************************** +*/ + +// ----- some global definitions for the drivers ----- +#define MAXBRD 64 +#define SPCM_MAXDEMO 100 + + + +/* +************************************************************************** +this part now tries to examine the compiler type and sets one of the +defines that is used later for the type definition +************************************************************************** +*/ + +// ----- Borland C+ compiler. If the version is > 0x410 it's the C++ Builder and the same types can be used as for Visual C++ ----- +#ifdef __BORLANDC__ +# if (__BCPLUSPLUS__>0x410) +# define VC_WINNT +# elif defined(_Windows) +# define BC_WIN31 +# else +# define BC_DOS +# endif +#endif + +// ----- Microsoft Visual C++ compiler, either as std_call or as c_call ----- +#ifdef _WINSTDCALL +# ifdef _MSC_VER +# ifdef _WINNT +# define VC_STDCALLNT +# else +# define VC_STDCALL95 +# endif +# endif +#elif defined(_MSC_VER) +# ifdef _WIN32 +# ifdef _WINNT +# define VC_WINNT +# else +# define VC_WIN95 +# endif +# else +# define VC_WIN31 +# endif +#endif +#if defined (_WIN32) || defined (_WIN64) +# define _WIN // analog to _LINUX +#endif + +// ----- GCC in various environments +#if defined (__GNUC__) +# if defined (__MINGW32__) +# define _GCCWIN +# elif defined (__CYGWIN__) +# define _GCCWIN +# elif defined (__QNX__) +# define _QNX +# elif !defined(__vxworks) +# define _LINUX +# endif +#endif + +// VxWorks +#ifdef __vxworks +# define _VXWORKS +#endif + + +// ----- LabWindows/CVI +#ifdef _CVI_ +# define _LWCVI +#endif + +// ----- 64 Bit Linux (in addition to _LINUX) ----- +#if defined (__x86_64__) || defined (__amd64__) || defined (__aarch64__) +# if defined (_LINUX) +# define _LINUX64 +# endif +#endif + + + +/* +************************************************************************** +now we hopefully know the compiler type and define all the types matching +this compiler and the platform +************************************************************************** +*/ + +// ----- Borland C++ for DOS (only used with older drivers) ----- +#ifdef BC_DOS +# define int16 int +# define uint16 unsigned int +# define int8 char +# define uint8 unsigned char +# define int32 long int +# define uint32 unsigned long int +# define dataptr void huge* +# define ptr8 char huge* +# define uptr8 unsigned char huge* +# define ptr16 int huge* +# define uptr16 unsigned int huge* +# define ptr32 long int huge* +# define uptr32 unsigned long int huge* +# define bool int8 +# define true 1 +# define false 0 +# define EXP extern "C" _export int16 +# define EXPC extern _export int16 +# define IMP extern "C" _import int16 +# define HEAD extern "C" int16 +#endif + +// ----- Borland C++ for Windows 3.1/3.11 (only used with older drivers) ----- +#ifdef BC_WIN31 +# define int16 int +# define uint16 unsigned int +# define int8 char +# define uint8 unsigned char +# define int32 long int +# define uint32 unsigned long int +# define dataptr void huge* +# define ptr8 char huge* +# define uptr8 unsigned char huge* +# define ptr16 int huge* +# define uptr16 unsigned int huge* +# define ptr32 long int huge* +# define uptr32 unsigned long int huge* +# ifdef _EasyWin +# define EXP extern "C" _export int16 +# define IMP extern "C" _import int16 +# define HEAD extern "C" int16 +# else +# define EXP extern "C" _export int16 FAR PASCAL +# define EXPC extern _export int16 FAR PASCAL +# define IMP extern "C" _import int16 FAR PASCAL +# define HEAD extern "C" int16 FAR PASCAL +# endif +#endif + +// ----- Visual C++ for Windows 3.1/3.11 (only used with older drivers) ----- +#ifdef VC_WIN31 +# define int8 char +# define uint8 unsigned char +# define int16 short int +# define uint16 unsigned short int +# define int32 long int +# define uint32 unsigned long int +# define dataptr void huge* +# define ptr8 char* +# define uptr8 unsigned char* +# define ptr16 short int* +# define uptr16 unsigned short int* +# define ptr32 long int* +# define uptr32 unsigned long int* +# define EXP extern "C" __declspec (dllexport) int16 +# define IMP extern "C" __declspec (dllimport) int16 +# define HEAD extern "C" __declspec (dllexport) int16 +#endif + +// ----- Visual C++ / Borland C++ Builder for Windows 32 bit starting with Windows 95 ----- +#if defined(VC_WIN95) || defined(VC_WINNT) +# ifndef NO_WTYPES_IN_DLLTYP +# include <wtypes.h> +# endif +# define int8 char +# define uint8 unsigned char +# define int16 short int +# define uint16 unsigned short int +# define int32 long int +# define uint32 unsigned long int +# define int64 __int64 +# define uint64 unsigned int64 +# define dataptr void* +# define ptr8 char* +# define uptr8 unsigned char* +# define ptr16 short int* +# define uptr16 unsigned short int* +# define ptr32 long int* +# define uptr32 unsigned long int* +# ifndef __cplusplus +# define bool int8 +# define true 1 +# define false 0 +# endif +# define drv_handle void* + +# ifdef __cplusplus +# define EXP extern "C" __declspec (dllexport) int16 +# define EXPC extern __declspec (dllexport) int16 +# define IMP extern "C" __declspec (dllimport) int16 +# define HEAD extern "C" __declspec (dllexport) int16 + +# define SPCM_EXPORT extern "C" __declspec (dllexport) +# define SPCM_IMPORT extern "C" __declspec (dllimport) +# else +# define EXP extern __declspec (dllexport) int16 +# define EXPC extern __declspec (dllexport) int16 +# define IMP extern __declspec (dllimport) int16 +# define HEAD extern __declspec (dllexport) int16 + +# define SPCM_EXPORT extern __declspec (dllexport) +# define SPCM_IMPORT extern __declspec (dllimport) +# endif +#endif + +// ----- Visual C++ using standard calls for all windows 32 bit platforms ----- +#if defined(VC_STDCALL95) || defined(VC_STDCALLNT) +# ifndef NO_WTYPES_IN_DLLTYP +# include <wtypes.h> +# endif +# define int8 char +# define uint8 unsigned char +# define int16 short int +# define uint16 unsigned short int +# define int32 long int +# define uint32 unsigned long int +# define int64 __int64 +# define uint64 unsigned __int64 +# define dataptr void* +# define ptr8 char* +# define uptr8 unsigned char* +# define ptr16 short int* +# define uptr16 unsigned short int* +# define ptr32 long int* +# define uptr32 unsigned long int* +# ifndef __cplusplus +# define bool int8 +# define true 1 +# define false 0 +# endif +# define drv_handle void* +# define EXP extern "C" __declspec (dllexport) int16 _stdcall +# define EXPC extern __declspec (dllexport) int16 _stdcall +# define IMP extern "C" __declspec (dllimport) int16 _stdcall +# define HEAD extern "C" __declspec (dllexport) int16 _stdcall + +# define SPCM_EXPORT extern "C" __declspec (dllexport) +# define SPCM_IMPORT extern "C" __declspec (dllimport) +#endif + +// ----- Linux ----- +#if defined (_LINUX) || defined (_QNX) +# if defined (__aarch64__) +# define int8 signed char // on Jetson "char" is unsigned +# else +# define int8 char +# endif +# define int16 short int +# define int32 int +# define int64 long long +# define uint8 unsigned char +# define uint16 unsigned short int +# define uint32 unsigned int +# define uint64 unsigned long long +# define dataptr void * +# define ptr8 int8* +# define ptr16 int16* +# define ptr32 int32* +# define uptr8 uint8* +# define uptr16 uint16* +# define uptr32 uint32* +# if !defined(bool) && !defined(__cplusplus) +# define bool int8 +# define true 1 +# define false 0 +# endif +# define drv_handle void* +# define EXPC int16 +# define HEAD int16 +# define SPEC_IOC_MAGIC 's' +# define SPEC_IOC_MAXNR 6 +# define GETPARAM _IOR(SPEC_IOC_MAGIC,1,int32[2]) +# define SETPARAM _IOW(SPEC_IOC_MAGIC,2,int32[2]) +# define GETCH _IOR(SPEC_IOC_MAGIC,3,int32[1]) +# define SETCH _IOW(SPEC_IOC_MAGIC,4,int32[1]) + typedef struct {int32 lReg; void* pvAdr;} _SETGETADR ; +# define SETADR _IOW(SPEC_IOC_MAGIC,5,_SETGETADR) +# define GETADR _IOR(SPEC_IOC_MAGIC,6,_SETGETADR) + +# ifdef __cplusplus +# define SPCM_IMPORT extern "C" +# if __GNUC__ >= 4 +# define SPCM_EXPORT extern "C" __attribute__ ((visibility ("default"))) +# else +# define SPCM_EXPORT extern "C" +# endif +# else +# define SPCM_IMPORT +# define SPCM_EXPORT extern "C" +# endif +# define _stdcall +#endif + +// ----- LabWindows/CVI ----- +#if defined(_LWCVI) +# define int8 char +# define uint8 unsigned char +# define int16 short int +# define uint16 unsigned short int +# define int32 long int +# define uint32 unsigned long int +# define int64 __int64 +# define uint64 unsigned int64 +# define dataptr void* +# define ptr8 char* +# define uptr8 unsigned char* +# define ptr16 short int* +# define uptr16 unsigned short int* +# define ptr32 long int* +# define uptr32 unsigned long int* +# define drv_handle void* +# define bool int8 +# define true 1 +# define false 0 +# define SPCM_EXPORT extern "C" __declspec (dllexport) +# define SPCM_IMPORT +# define _stdcall __stdcall +#endif + +// ----- Gnu C Windows ----- +#if defined (_GCCWIN) +typedef char int8; +typedef short int int16; +typedef int int32; +typedef long long int64; +typedef unsigned char uint8; +typedef unsigned short int uint16; +typedef unsigned long int uint32; +typedef unsigned long long uint64; +typedef void* dataptr; +typedef int8* ptr8; +typedef int16* ptr16; +typedef int32* ptr32; +typedef uint8* uptr8; +typedef uint16* uptr16; +typedef uint32* uptr32; +# if !defined(bool) && !defined(__cplusplus) + typedef int8 bool; +# define true 1 +# define false 0 +# endif +typedef void* drv_handle; +typedef int16 EXPC; +typedef int16 HEAD; +# ifdef __cplusplus +# define SPCM_IMPORT extern "C" +# else +# define SPCM_IMPORT +# endif +#endif + +// --- define data structure for segment statistic mode +typedef struct + { + int64 llAvrg; + int16 nMin; + int16 nMax; + uint32 dwMinPos; + uint32 dwMaxPos; + uint32 _Unused; + uint64 qw_Timestamp; + } SPCM_SEGSTAT_STRUCT_CHx; + +#endif diff --git a/Cpp/lib/errors.h b/Cpp/lib/errors.h new file mode 100644 index 0000000000000000000000000000000000000000..6a733be4604357cc2d3351707f4fb20a0edd26fa --- /dev/null +++ b/Cpp/lib/errors.h @@ -0,0 +1,12 @@ +// *********************************************************************** +// errors.h: Old Spectrum error code header file. Has been changed in may +// 2004 to spcerr.h because errors.h has already been in use by +// windows. +// Please change the include section of your project to include +// spcerr.h directly. +// *********************************************************************** + + +#pragma message ("*** Please change include path from errors.h to spcerr.h ***") + +#include "spcerr.h" diff --git a/Cpp/lib/regs.h b/Cpp/lib/regs.h new file mode 100644 index 0000000000000000000000000000000000000000..c241323da0ce06a14f18639c5ae7468393eaa4be --- /dev/null +++ b/Cpp/lib/regs.h @@ -0,0 +1,3684 @@ +// *********************************************************************** +// +// regs.h (c) Spectrum GmbH, 2006 +// +// *********************************************************************** +// +// software register and constants definition for all Spectrum drivers. +// Please stick to the card manual to see which of the inhere defined +// registers are used on your hardware. +// +// *********************************************************************** + + + +// *********************************************************************** +// macros for kilo, Mega or Giga as standard version or binary (_B) (2^x) +// *********************************************************************** + +#define KILO(k) ((uint64) 1000 * (k)) +#define MEGA(m) ((uint64) 1000 * 1000 * (m)) +#define GIGA(g) ((uint64) 1000 * 1000 * 1000 * (g)) +#define KILO_B(k) ((uint64) 1024 * (k)) +#define MEGA_B(m) ((uint64) 1024 * 1024 * (m)) +#define GIGA_B(g) ((uint64) 1024 * 1024 * 1024 * (g)) + + + + +// *********************************************************************** +// card types +// *********************************************************************** + +#define TYP_PCIDEVICEID 0x00000000l + +// ***** Board Types *************** +#define TYP_EVAL 0x00000010l +#define TYP_RSDLGA 0x00000014l +#define TYP_GMG 0x00000018l +#define TYP_VAN8 0x00000020l +#define TYP_VAC 0x00000028l + +#define TYP_PCIAUTOINSTALL 0x000000FFl + +#define TYP_DAP116 0x00000100l +#define TYP_PAD82 0x00000200l +#define TYP_PAD82a 0x00000210l +#define TYP_PAD82b 0x00000220l +#define TYP_PCI212 0x00000300l +#define TYP_PAD1232a 0x00000400l +#define TYP_PAD1232b 0x00000410l +#define TYP_PAD1232c 0x00000420l +#define TYP_PAD1616a 0x00000500l +#define TYP_PAD1616b 0x00000510l +#define TYP_PAD1616c 0x00000520l +#define TYP_PAD1616d 0x00000530l +#define TYP_PAD52 0x00000600l +#define TYP_PAD242 0x00000700l +#define TYP_PCK400 0x00000800l +#define TYP_PAD164_2M 0x00000900l +#define TYP_PAD164_5M 0x00000910l +#define TYP_PCI208 0x00001000l +#define TYP_CPCI208 0x00001001l +#define TYP_PCI412 0x00001100l +#define TYP_PCIDIO32 0x00001200l +#define TYP_PCI248 0x00001300l +#define TYP_PADCO 0x00001400l +#define TYP_TRS582 0x00001500l +#define TYP_PCI258 0x00001600l + + +// ------ series and familiy identifiers ----- +#define TYP_SERIESMASK 0x00FF0000l // the series (= type of base card), e.g. MI.xxxx +#define TYP_VERSIONMASK 0x0000FFFFl // the version, e.g. XX.3012 +#define TYP_FAMILYMASK 0x0000FF00l // the family, e.g. XX.30xx +#define TYP_TYPEMASK 0x000000FFl // the type, e.g. XX.xx12 +#define TYP_SPEEDMASK 0x000000F0l // the speed grade, e.g. XX.xx1x +#define TYP_CHMASK 0x0000000Fl // the channel/modules, e.g. XX.xxx2 + +#define TYP_MISERIES 0x00000000l +#define TYP_MCSERIES 0x00010000l +#define TYP_MXSERIES 0x00020000l +#define TYP_M2ISERIES 0x00030000l +#define TYP_M2IEXPSERIES 0x00040000l +#define TYP_M3ISERIES 0x00050000l +#define TYP_M3IEXPSERIES 0x00060000l +#define TYP_M4IEXPSERIES 0x00070000l +#define TYP_M4XEXPSERIES 0x00080000l +#define TYP_M2PEXPSERIES 0x00090000l +#define TYP_M5IEXPSERIES 0x000A0000l + + + +// ----- MI.20xx, MC.20xx, MX.20xx ----- +#define TYP_MI2020 0x00002020l +#define TYP_MI2021 0x00002021l +#define TYP_MI2025 0x00002025l +#define TYP_MI2030 0x00002030l +#define TYP_MI2031 0x00002031l + +#define TYP_M2I2020 0x00032020l +#define TYP_M2I2021 0x00032021l +#define TYP_M2I2025 0x00032025l +#define TYP_M2I2030 0x00032030l +#define TYP_M2I2031 0x00032031l + +#define TYP_M2I2020EXP 0x00042020l +#define TYP_M2I2021EXP 0x00042021l +#define TYP_M2I2025EXP 0x00042025l +#define TYP_M2I2030EXP 0x00042030l +#define TYP_M2I2031EXP 0x00042031l + +#define TYP_MC2020 0x00012020l +#define TYP_MC2021 0x00012021l +#define TYP_MC2025 0x00012025l +#define TYP_MC2030 0x00012030l +#define TYP_MC2031 0x00012031l + +#define TYP_MX2020 0x00022020l +#define TYP_MX2025 0x00022025l +#define TYP_MX2030 0x00022030l + +// ----- M3i.21xx, M3i.21xx-Exp (8 bit A/D) ----- +#define TYP_M3I2120 0x00052120l // 1x500M +#define TYP_M3I2122 0x00052122l // 1x500M & 2x250M +#define TYP_M3I2130 0x00052130l // 1x1G +#define TYP_M3I2132 0x00052132l // 1x1G & 2x500M + +#define TYP_M3I2120EXP 0x00062120l // 1x500M +#define TYP_M3I2122EXP 0x00062122l // 1x500M & 2x250M +#define TYP_M3I2130EXP 0x00062130l // 1x1G +#define TYP_M3I2132EXP 0x00062132l // 1x1G & 2x500M + +// ----- M4i.22xx-x8 (8 bit A/D) ----- +#define TYP_M4I22XX_X8 0x00072200l +#define TYP_M4I2210_X8 0x00072210l // 1x1.25G +#define TYP_M4I2211_X8 0x00072211l // 2x1.25G +#define TYP_M4I2212_X8 0x00072212l // 4x1.25G +#define TYP_M4I2220_X8 0x00072220l // 1x2.5G +#define TYP_M4I2221_X8 0x00072221l // 2x2.5G +#define TYP_M4I2223_X8 0x00072223l // 1x2.5G & 2x1.25G +#define TYP_M4I2230_X8 0x00072230l // 1x5G +#define TYP_M4I2233_X8 0x00072233l // 1x5G & 2x2.5G +#define TYP_M4I2234_X8 0x00072234l // 1x5G & 2x2.5G & 4x1.25G +#define TYP_M4I2280_X8 0x00072280l // customer specific variant +#define TYP_M4I2281_X8 0x00072281l // customer specific variant +#define TYP_M4I2283_X8 0x00072283l // customer specific variant +#define TYP_M4I2290_X8 0x00072290l // customer specific variant +#define TYP_M4I2293_X8 0x00072293l // customer specific variant +#define TYP_M4I2294_X8 0x00072294l // customer specific variant + +// ----- M4x.22xx-x8 (8 bit A/D) ----- +#define TYP_M4X22XX_X4 0x00082200l +#define TYP_M4X2210_X4 0x00082210l // 1x1.25G +#define TYP_M4X2211_X4 0x00082211l // 2x1.25G +#define TYP_M4X2212_X4 0x00082212l // 4x1.25G +#define TYP_M4X2220_X4 0x00082220l // 1x2.5G +#define TYP_M4X2221_X4 0x00082221l // 2x2.5G +#define TYP_M4X2223_X4 0x00082223l // 1x2.5G & 2x1.25G +#define TYP_M4X2230_X4 0x00082230l // 1x5G +#define TYP_M4X2233_X4 0x00082233l // 1x5G & 2x2.5G +#define TYP_M4X2234_X4 0x00082234l // 1x5G & 2x2.5G & 4x1.25G + +// ----- M4i.23xx-x8 (7 bit A/D) ----- +#define TYP_M4I23XX_X8 0x00072300l +#define TYP_M4I2320_X8 0x00072320l // 1x2.5G +#define TYP_M4I2321_X8 0x00072321l // 2x2.5G +#define TYP_M4I2323_X8 0x00072323l // 1x2.5G & 2x1.25G +#define TYP_M4I2330_X8 0x00072330l // 1x5G +#define TYP_M4I2333_X8 0x00072333l // 1x5G & 2x2.5G +#define TYP_M4I2334_X8 0x00072334l // 1x5G & 2x2.5G & 4x1.25G + +// ----- MI.30xx, MC.30xx, MX.30xx ----- +#define TYP_MI3010 0x00003010l +#define TYP_MI3011 0x00003011l +#define TYP_MI3012 0x00003012l +#define TYP_MI3013 0x00003013l +#define TYP_MI3014 0x00003014l +#define TYP_MI3015 0x00003015l +#define TYP_MI3016 0x00003016l +#define TYP_MI3020 0x00003020l +#define TYP_MI3021 0x00003021l +#define TYP_MI3022 0x00003022l +#define TYP_MI3023 0x00003023l +#define TYP_MI3024 0x00003024l +#define TYP_MI3025 0x00003025l +#define TYP_MI3026 0x00003026l +#define TYP_MI3027 0x00003027l +#define TYP_MI3031 0x00003031l +#define TYP_MI3033 0x00003033l + +#define TYP_M2I3010 0x00033010l +#define TYP_M2I3011 0x00033011l +#define TYP_M2I3012 0x00033012l +#define TYP_M2I3013 0x00033013l +#define TYP_M2I3014 0x00033014l +#define TYP_M2I3015 0x00033015l +#define TYP_M2I3016 0x00033016l +#define TYP_M2I3020 0x00033020l +#define TYP_M2I3021 0x00033021l +#define TYP_M2I3022 0x00033022l +#define TYP_M2I3023 0x00033023l +#define TYP_M2I3024 0x00033024l +#define TYP_M2I3025 0x00033025l +#define TYP_M2I3026 0x00033026l +#define TYP_M2I3027 0x00033027l +#define TYP_M2I3031 0x00033031l +#define TYP_M2I3033 0x00033033l + +#define TYP_M2I3010EXP 0x00043010l +#define TYP_M2I3011EXP 0x00043011l +#define TYP_M2I3012EXP 0x00043012l +#define TYP_M2I3013EXP 0x00043013l +#define TYP_M2I3014EXP 0x00043014l +#define TYP_M2I3015EXP 0x00043015l +#define TYP_M2I3016EXP 0x00043016l +#define TYP_M2I3020EXP 0x00043020l +#define TYP_M2I3021EXP 0x00043021l +#define TYP_M2I3022EXP 0x00043022l +#define TYP_M2I3023EXP 0x00043023l +#define TYP_M2I3024EXP 0x00043024l +#define TYP_M2I3025EXP 0x00043025l +#define TYP_M2I3026EXP 0x00043026l +#define TYP_M2I3027EXP 0x00043027l +#define TYP_M2I3031EXP 0x00043031l +#define TYP_M2I3033EXP 0x00043033l + +#define TYP_MC3010 0x00013010l +#define TYP_MC3011 0x00013011l +#define TYP_MC3012 0x00013012l +#define TYP_MC3013 0x00013013l +#define TYP_MC3014 0x00013014l +#define TYP_MC3015 0x00013015l +#define TYP_MC3016 0x00013016l +#define TYP_MC3020 0x00013020l +#define TYP_MC3021 0x00013021l +#define TYP_MC3022 0x00013022l +#define TYP_MC3023 0x00013023l +#define TYP_MC3024 0x00013024l +#define TYP_MC3025 0x00013025l +#define TYP_MC3026 0x00013026l +#define TYP_MC3027 0x00013027l +#define TYP_MC3031 0x00013031l +#define TYP_MC3033 0x00013033l + +#define TYP_MX3010 0x00023010l +#define TYP_MX3011 0x00023011l +#define TYP_MX3012 0x00023012l +#define TYP_MX3020 0x00023020l +#define TYP_MX3021 0x00023021l +#define TYP_MX3022 0x00023022l +#define TYP_MX3031 0x00023031l + + + +// ----- MI.31xx, MC.31xx, MX.31xx ----- +#define TYP_MI3110 0x00003110l +#define TYP_MI3111 0x00003111l +#define TYP_MI3112 0x00003112l +#define TYP_MI3120 0x00003120l +#define TYP_MI3121 0x00003121l +#define TYP_MI3122 0x00003122l +#define TYP_MI3130 0x00003130l +#define TYP_MI3131 0x00003131l +#define TYP_MI3132 0x00003132l +#define TYP_MI3140 0x00003140l + +#define TYP_M2I3110 0x00033110l +#define TYP_M2I3111 0x00033111l +#define TYP_M2I3112 0x00033112l +#define TYP_M2I3120 0x00033120l +#define TYP_M2I3121 0x00033121l +#define TYP_M2I3122 0x00033122l +#define TYP_M2I3130 0x00033130l +#define TYP_M2I3131 0x00033131l +#define TYP_M2I3132 0x00033132l + +#define TYP_M2I3110EXP 0x00043110l +#define TYP_M2I3111EXP 0x00043111l +#define TYP_M2I3112EXP 0x00043112l +#define TYP_M2I3120EXP 0x00043120l +#define TYP_M2I3121EXP 0x00043121l +#define TYP_M2I3122EXP 0x00043122l +#define TYP_M2I3130EXP 0x00043130l +#define TYP_M2I3131EXP 0x00043131l +#define TYP_M2I3132EXP 0x00043132l + +#define TYP_MC3110 0x00013110l +#define TYP_MC3111 0x00013111l +#define TYP_MC3112 0x00013112l +#define TYP_MC3120 0x00013120l +#define TYP_MC3121 0x00013121l +#define TYP_MC3122 0x00013122l +#define TYP_MC3130 0x00013130l +#define TYP_MC3131 0x00013131l +#define TYP_MC3132 0x00013132l + +#define TYP_MX3110 0x00023110l +#define TYP_MX3111 0x00023111l +#define TYP_MX3120 0x00023120l +#define TYP_MX3121 0x00023121l +#define TYP_MX3130 0x00023130l +#define TYP_MX3131 0x00023131l + + + +// ----- M3i.32xx, M3i.32xx-Exp (12 bit A/D) ----- +#define TYP_M3I3220 0x00053220l // 1x250M +#define TYP_M3I3221 0x00053221l // 2x250M +#define TYP_M3I3240 0x00053240l // 1x500M +#define TYP_M3I3242 0x00053242l // 1x500M & 2x250M + +#define TYP_M3I3220EXP 0x00063220l // 1x250M +#define TYP_M3I3221EXP 0x00063221l // 2x250M +#define TYP_M3I3240EXP 0x00063240l // 1x500M +#define TYP_M3I3242EXP 0x00063242l // 1x500M & 2x250M + +// ----- M5i.33xx-x4 (12 bit A/D) ----- +#define TYP_M5I33XX_X16 0x000A3300 // generic +#define TYP_M5I3321_X16 0x000A3321 // 2x3.2G 12bit +#define TYP_M5I3330_X16 0x000A3330 // 1x6.4G 12bit +#define TYP_M5I3337_X16 0x000A3337 // 1x6.4G 2x3.2G 12bit +#define TYP_M5I3350_X16 0x000A3350 // 1x10G 12bit +#define TYP_M5I3357_X16 0x000A3357 // 1x10G 2x5G 12bit + +// ----- MI.40xx, MC.40xx, MX.40xx ----- +#define TYP_MI4020 0x00004020l +#define TYP_MI4021 0x00004021l +#define TYP_MI4022 0x00004022l +#define TYP_MI4030 0x00004030l +#define TYP_MI4031 0x00004031l +#define TYP_MI4032 0x00004032l + +#define TYP_M2I4020 0x00034020l +#define TYP_M2I4021 0x00034021l +#define TYP_M2I4022 0x00034022l +#define TYP_M2I4028 0x00034028l +#define TYP_M2I4030 0x00034030l +#define TYP_M2I4031 0x00034031l +#define TYP_M2I4032 0x00034032l +#define TYP_M2I4038 0x00034038l + +#define TYP_M2I4020EXP 0x00044020l +#define TYP_M2I4021EXP 0x00044021l +#define TYP_M2I4022EXP 0x00044022l +#define TYP_M2I4028EXP 0x00044028l +#define TYP_M2I4030EXP 0x00044030l +#define TYP_M2I4031EXP 0x00044031l +#define TYP_M2I4032EXP 0x00044032l +#define TYP_M2I4038EXP 0x00044038l + +#define TYP_MC4020 0x00014020l +#define TYP_MC4021 0x00014021l +#define TYP_MC4022 0x00014022l +#define TYP_MC4030 0x00014030l +#define TYP_MC4031 0x00014031l +#define TYP_MC4032 0x00014032l + +#define TYP_MX4020 0x00024020l +#define TYP_MX4021 0x00024021l +#define TYP_MX4030 0x00024030l +#define TYP_MX4031 0x00024031l + + + +// ----- M3i.41xx, M3i.41xx-Exp (14 bit A/D) ----- +#define TYP_M3I4110 0x00054110l // 1x100M +#define TYP_M3I4111 0x00054111l // 2x100M +#define TYP_M3I4120 0x00054120l // 1x250M +#define TYP_M3I4121 0x00054121l // 2x250M +#define TYP_M3I4140 0x00054140l // 1x400M +#define TYP_M3I4142 0x00054142l // 1x400M & 2x250M + +#define TYP_M3I4110EXP 0x00064110l // 1x100M +#define TYP_M3I4111EXP 0x00064111l // 2x100M +#define TYP_M3I4120EXP 0x00064120l // 1x250M +#define TYP_M3I4121EXP 0x00064121l // 2x250M +#define TYP_M3I4140EXP 0x00064140l // 1x400M +#define TYP_M3I4142EXP 0x00064142l // 1x400M & 2x250M + +// ----- M4i.44xx-x8 (generic) ----- +#define TYP_M4I44XX_X8 0x00074400 // + +#define TYP_M4I4410_X8 0x00074410 // 2x130M 16bit +#define TYP_M4I4411_X8 0x00074411 // 4x130M 16bit +#define TYP_M4I4420_X8 0x00074420 // 2x250M 16bit +#define TYP_M4I4421_X8 0x00074421 // 4x250M 16bit +#define TYP_M4I4450_X8 0x00074450 // 2x500M 14bit +#define TYP_M4I4451_X8 0x00074451 // 4x500M 14bit +#define TYP_M4I4470_X8 0x00074470 // 2x180M 16bit +#define TYP_M4I4471_X8 0x00074471 // 4x180M 16bit +#define TYP_M4I4480_X8 0x00074480 // 2x400M 14bit +#define TYP_M4I4481_X8 0x00074481 // 4x400M 14bit + +// ----- M4x.44xx-x4 (14/16 bit A/D) ----- +#define TYP_M4X44XX_X4 0x00084400 // generic +#define TYP_M4X4410_X4 0x00084410 // 2x130M 16bit +#define TYP_M4X4411_X4 0x00084411 // 4x130M 16bit +#define TYP_M4X4420_X4 0x00084420 // 2x250M 16bit +#define TYP_M4X4421_X4 0x00084421 // 4x250M 16bit +#define TYP_M4X4450_X4 0x00084450 // 2x500M 14bit +#define TYP_M4X4451_X4 0x00084451 // 4x500M 14bit +#define TYP_M4X4470_X4 0x00084470 // 2x180M 16bit +#define TYP_M4X4471_X4 0x00084471 // 4x180M 16bit +#define TYP_M4X4480_X4 0x00084480 // 2x400M 14bit +#define TYP_M4X4481_X4 0x00084481 // 4x400M 14bit + + +// ----- MI.45xx, MC.45xx, MX.45xx ----- +#define TYP_MI4520 0x00004520l +#define TYP_MI4521 0x00004521l +#define TYP_MI4530 0x00004530l +#define TYP_MI4531 0x00004531l +#define TYP_MI4540 0x00004540l +#define TYP_MI4541 0x00004541l + +#define TYP_M2I4520 0x00034520l +#define TYP_M2I4521 0x00034521l +#define TYP_M2I4530 0x00034530l +#define TYP_M2I4531 0x00034531l +#define TYP_M2I4540 0x00034540l +#define TYP_M2I4541 0x00034541l + +#define TYP_MC4520 0x00014520l +#define TYP_MC4521 0x00014521l +#define TYP_MC4530 0x00014530l +#define TYP_MC4531 0x00014531l +#define TYP_MC4540 0x00014540l +#define TYP_MC4541 0x00014541l + +#define TYP_MX4520 0x00024520l +#define TYP_MX4530 0x00024530l +#define TYP_MX4540 0x00024540l + + + +// ----- MI.46xx, MC.46xx, MX.46xx ----- +#define TYP_MI4620 0x00004620l +#define TYP_MI4621 0x00004621l +#define TYP_MI4622 0x00004622l +#define TYP_MI4630 0x00004630l +#define TYP_MI4631 0x00004631l +#define TYP_MI4632 0x00004632l +#define TYP_MI4640 0x00004640l +#define TYP_MI4641 0x00004641l +#define TYP_MI4642 0x00004642l +#define TYP_MI4650 0x00004650l +#define TYP_MI4651 0x00004651l +#define TYP_MI4652 0x00004652l + +#define TYP_M2I4620 0x00034620l +#define TYP_M2I4621 0x00034621l +#define TYP_M2I4622 0x00034622l +#define TYP_M2I4630 0x00034630l +#define TYP_M2I4631 0x00034631l +#define TYP_M2I4632 0x00034632l +#define TYP_M2I4640 0x00034640l +#define TYP_M2I4641 0x00034641l +#define TYP_M2I4642 0x00034642l +#define TYP_M2I4650 0x00034650l +#define TYP_M2I4651 0x00034651l +#define TYP_M2I4652 0x00034652l + +#define TYP_M2I4620EXP 0x00044620l +#define TYP_M2I4621EXP 0x00044621l +#define TYP_M2I4622EXP 0x00044622l +#define TYP_M2I4630EXP 0x00044630l +#define TYP_M2I4631EXP 0x00044631l +#define TYP_M2I4632EXP 0x00044632l +#define TYP_M2I4640EXP 0x00044640l +#define TYP_M2I4641EXP 0x00044641l +#define TYP_M2I4642EXP 0x00044642l +#define TYP_M2I4650EXP 0x00044650l +#define TYP_M2I4651EXP 0x00044651l +#define TYP_M2I4652EXP 0x00044652l + +#define TYP_MC4620 0x00014620l +#define TYP_MC4621 0x00014621l +#define TYP_MC4622 0x00014622l +#define TYP_MC4630 0x00014630l +#define TYP_MC4631 0x00014631l +#define TYP_MC4632 0x00014632l +#define TYP_MC4640 0x00014640l +#define TYP_MC4641 0x00014641l +#define TYP_MC4642 0x00014642l +#define TYP_MC4650 0x00014650l +#define TYP_MC4651 0x00014651l +#define TYP_MC4652 0x00014652l + +#define TYP_MX4620 0x00024620l +#define TYP_MX4621 0x00024621l +#define TYP_MX4630 0x00024630l +#define TYP_MX4631 0x00024631l +#define TYP_MX4640 0x00024640l +#define TYP_MX4641 0x00024641l +#define TYP_MX4650 0x00024650l +#define TYP_MX4651 0x00024651l + + + +// ----- MI.47xx, MC.47xx, MX.47xx ----- +#define TYP_MI4710 0x00004710l +#define TYP_MI4711 0x00004711l +#define TYP_MI4720 0x00004720l +#define TYP_MI4721 0x00004721l +#define TYP_MI4730 0x00004730l +#define TYP_MI4731 0x00004731l +#define TYP_MI4740 0x00004740l +#define TYP_MI4741 0x00004741l + +#define TYP_M2I4710 0x00034710l +#define TYP_M2I4711 0x00034711l +#define TYP_M2I4720 0x00034720l +#define TYP_M2I4721 0x00034721l +#define TYP_M2I4730 0x00034730l +#define TYP_M2I4731 0x00034731l +#define TYP_M2I4740 0x00034740l +#define TYP_M2I4741 0x00034741l + +#define TYP_M2I4710EXP 0x00044710l +#define TYP_M2I4711EXP 0x00044711l +#define TYP_M2I4720EXP 0x00044720l +#define TYP_M2I4721EXP 0x00044721l +#define TYP_M2I4730EXP 0x00044730l +#define TYP_M2I4731EXP 0x00044731l +#define TYP_M2I4740EXP 0x00044740l +#define TYP_M2I4741EXP 0x00044741l + +#define TYP_MC4710 0x00014710l +#define TYP_MC4711 0x00014711l +#define TYP_MC4720 0x00014720l +#define TYP_MC4721 0x00014721l +#define TYP_MC4730 0x00014730l +#define TYP_MC4731 0x00014731l + +#define TYP_MX4710 0x00024710l +#define TYP_MX4720 0x00024720l +#define TYP_MX4730 0x00024730l + + + +// ----- M3i.48xx, M3i.48xx-Exp (16 bit A/D) ----- +#define TYP_M3I4830 0x00054830l +#define TYP_M3I4831 0x00054831l +#define TYP_M3I4840 0x00054840l +#define TYP_M3I4841 0x00054841l +#define TYP_M3I4860 0x00054860l +#define TYP_M3I4861 0x00054861l + +#define TYP_M3I4830EXP 0x00064830l +#define TYP_M3I4831EXP 0x00064831l +#define TYP_M3I4840EXP 0x00064840l +#define TYP_M3I4841EXP 0x00064841l +#define TYP_M3I4860EXP 0x00064860l +#define TYP_M3I4861EXP 0x00064861l + + + +// ----- MI.46xx, MC.46xx, MX.46xx ----- +#define TYP_MI4911 0x00004911l +#define TYP_MI4912 0x00004912l +#define TYP_MI4931 0x00004931l +#define TYP_MI4932 0x00004932l +#define TYP_MI4960 0x00004960l +#define TYP_MI4961 0x00004961l +#define TYP_MI4963 0x00004963l +#define TYP_MI4964 0x00004964l + +#define TYP_MC4911 0x00014911l +#define TYP_MC4912 0x00014912l +#define TYP_MC4931 0x00014931l +#define TYP_MC4932 0x00014932l +#define TYP_MC4960 0x00014960l +#define TYP_MC4961 0x00014961l +#define TYP_MC4963 0x00014963l +#define TYP_MC4964 0x00014964l + +#define TYP_MX4911 0x00024911l +#define TYP_MX4931 0x00024931l +#define TYP_MX4960 0x00024960l +#define TYP_MX4963 0x00024963l + +#define TYP_M2I4911 0x00034911l +#define TYP_M2I4912 0x00034912l +#define TYP_M2I4931 0x00034931l +#define TYP_M2I4932 0x00034932l +#define TYP_M2I4960 0x00034960l +#define TYP_M2I4961 0x00034961l +#define TYP_M2I4963 0x00034963l +#define TYP_M2I4964 0x00034964l + +#define TYP_M2I4911EXP 0x00044911l +#define TYP_M2I4912EXP 0x00044912l +#define TYP_M2I4931EXP 0x00044931l +#define TYP_M2I4932EXP 0x00044932l +#define TYP_M2I4960EXP 0x00044960l +#define TYP_M2I4961EXP 0x00044961l +#define TYP_M2I4963EXP 0x00044963l +#define TYP_M2I4964EXP 0x00044964l + +// ----- M2p.59xx-x4 ----- +#define TYP_M2P59XX_X4 0x00095900l // generic +#define TYP_M2P5911_X4 0x00095911l +#define TYP_M2P5912_X4 0x00095912l +#define TYP_M2P5913_X4 0x00095913l +#define TYP_M2P5916_X4 0x00095916l +#define TYP_M2P5920_X4 0x00095920l +#define TYP_M2P5921_X4 0x00095921l +#define TYP_M2P5922_X4 0x00095922l +#define TYP_M2P5923_X4 0x00095923l +#define TYP_M2P5926_X4 0x00095926l +#define TYP_M2P5930_X4 0x00095930l +#define TYP_M2P5931_X4 0x00095931l +#define TYP_M2P5932_X4 0x00095932l +#define TYP_M2P5933_X4 0x00095933l +#define TYP_M2P5936_X4 0x00095936l +#define TYP_M2P5940_X4 0x00095940l +#define TYP_M2P5941_X4 0x00095941l +#define TYP_M2P5942_X4 0x00095942l +#define TYP_M2P5943_X4 0x00095943l +#define TYP_M2P5946_X4 0x00095946l +#define TYP_M2P5960_X4 0x00095960l +#define TYP_M2P5961_X4 0x00095961l +#define TYP_M2P5962_X4 0x00095962l +#define TYP_M2P5966_X4 0x00095966l +#define TYP_M2P5968_X4 0x00095968l + + +// ----- MI.60xx, MC.60xx, MX.60xx ----- +#define TYP_MI6010 0x00006010l +#define TYP_MI6011 0x00006011l +#define TYP_MI6012 0x00006012l +#define TYP_MI6021 0x00006021l +#define TYP_MI6022 0x00006022l +#define TYP_MI6030 0x00006030l +#define TYP_MI6031 0x00006031l +#define TYP_MI6033 0x00006033l +#define TYP_MI6034 0x00006034l + +#define TYP_M2I6010 0x00036010l +#define TYP_M2I6011 0x00036011l +#define TYP_M2I6012 0x00036012l +#define TYP_M2I6021 0x00036021l +#define TYP_M2I6022 0x00036022l +#define TYP_M2I6030 0x00036030l +#define TYP_M2I6031 0x00036031l +#define TYP_M2I6033 0x00036033l +#define TYP_M2I6034 0x00036034l + +#define TYP_M2I6010EXP 0x00046010l +#define TYP_M2I6011EXP 0x00046011l +#define TYP_M2I6012EXP 0x00046012l +#define TYP_M2I6021EXP 0x00046021l +#define TYP_M2I6022EXP 0x00046022l +#define TYP_M2I6030EXP 0x00046030l +#define TYP_M2I6031EXP 0x00046031l +#define TYP_M2I6033EXP 0x00046033l +#define TYP_M2I6034EXP 0x00046034l + +#define TYP_MC6010 0x00016010l +#define TYP_MC6011 0x00016011l +#define TYP_MC6012 0x00016012l +#define TYP_MC6021 0x00016021l +#define TYP_MC6022 0x00016022l +#define TYP_MC6030 0x00016030l +#define TYP_MC6031 0x00016031l +#define TYP_MC6033 0x00016033l +#define TYP_MC6034 0x00016034l + +#define TYP_MX6010 0x00026010l +#define TYP_MX6011 0x00026011l +#define TYP_MX6021 0x00026021l +#define TYP_MX6030 0x00026030l +#define TYP_MX6033 0x00026033l + + + +// ----- MI.61xx, MC.61xx, MX.61xx ----- +#define TYP_MI6105 0x00006105l +#define TYP_MI6110 0x00006110l +#define TYP_MI6111 0x00006111l + +#define TYP_M2I6105 0x00036105l +#define TYP_M2I6110 0x00036110l +#define TYP_M2I6111 0x00036111l + +#define TYP_M2I6105EXP 0x00046105l +#define TYP_M2I6110EXP 0x00046110l +#define TYP_M2I6111EXP 0x00046111l + +#define TYP_MC6110 0x00016110l +#define TYP_MC6111 0x00016111l + +#define TYP_MX6110 0x00026110l + +// ----- M2p.65xx-x4 ----- +#define TYP_M2P65XX_X4 0x00096500l // generic +#define TYP_M2P6522_X4 0x00096522l // 4 ch @ 40 MS/s (1x4) (low voltage) +#define TYP_M2P6523_X4 0x00096523l // 8 ch @ 40 MS/s (low voltage) +#define TYP_M2P6530_X4 0x00096530l // 1 ch @ 40 MS/s +#define TYP_M2P6531_X4 0x00096531l // 2 ch @ 40 MS/s +#define TYP_M2P6532_X4 0x00096532l // 4 ch @ 40 MS/s (1x4) +#define TYP_M2P6536_X4 0x00096536l // 4 ch @ 40 MS/s (2x2) +#define TYP_M2P6533_X4 0x00096533l // 8 ch @ 40 MS/s +#define TYP_M2P6540_X4 0x00096540l // 1 ch @ 40 MS/s (high voltage) +#define TYP_M2P6541_X4 0x00096541l // 2 ch @ 40 MS/s (high voltage) +#define TYP_M2P6546_X4 0x00096546l // 4 ch @ 40 MS/s (2x2) (high voltage) +#define TYP_M2P6560_X4 0x00096560l // 1 ch @ 125 MS/s +#define TYP_M2P6561_X4 0x00096561l // 2 ch @ 125 MS/s +#define TYP_M2P6562_X4 0x00096562l // 4 ch @ 125 MS/s (1x4) +#define TYP_M2P6566_X4 0x00096566l // 4 ch @ 125 MS/s (2x2) +#define TYP_M2P6568_X4 0x00096568l // 8 ch @ 125/80 MS/s +#define TYP_M2P6570_X4 0x00096570l // 1 ch @ 125 MS/s (high voltage) +#define TYP_M2P6571_X4 0x00096571l // 2 ch @ 125 MS/s (high voltage) +#define TYP_M2P6576_X4 0x00096576l // 4 ch @ 125 MS/s (2x2) (high voltage) + +// ----- M4i.66xx-x8 (16 bit D/A) ----- +// ----- M4i.66xx-x8 (generic) ----- +#define TYP_M4I66XX_X8 0x00076600 + +#define TYP_M4I6620_X8 0x00076620 // 1 ch @ 625 MS/s +#define TYP_M4I6621_X8 0x00076621 // 2 ch @ 625 MS/s +#define TYP_M4I6622_X8 0x00076622 // 4 ch @ 625 MS/s +#define TYP_M4I6630_X8 0x00076630 // 1 ch @ 1250 MS/s +#define TYP_M4I6631_X8 0x00076631 // 2 ch @ 1250 MS/s + +// ----- M4x.66xx-x8 (16 bit D/A) ----- +// ----- M4x.66xx-x8 (generic) ----- +#define TYP_M4X66XX_X4 0x00086600 + +#define TYP_M4X6620_X4 0x00086620 // 1 ch @ 625 MS/s +#define TYP_M4X6621_X4 0x00086621 // 2 ch @ 625 MS/s +#define TYP_M4X6622_X4 0x00086622 // 4 ch @ 625 MS/s +#define TYP_M4X6630_X4 0x00086630 // 1 ch @ 1250 MS/s +#define TYP_M4X6631_X4 0x00086631 // 2 ch @ 1250 MS/s + +// ----- MI.70xx, MC.70xx, MX.70xx ----- +#define TYP_MI7005 0x00007005l +#define TYP_MI7010 0x00007010l +#define TYP_MI7011 0x00007011l +#define TYP_MI7020 0x00007020l +#define TYP_MI7021 0x00007021l + +#define TYP_M2I7005 0x00037005l +#define TYP_M2I7010 0x00037010l +#define TYP_M2I7011 0x00037011l +#define TYP_M2I7020 0x00037020l +#define TYP_M2I7021 0x00037021l + +#define TYP_M2I7005EXP 0x00047005l +#define TYP_M2I7010EXP 0x00047010l +#define TYP_M2I7011EXP 0x00047011l +#define TYP_M2I7020EXP 0x00047020l +#define TYP_M2I7021EXP 0x00047021l + +#define TYP_MC7005 0x00017005l +#define TYP_MC7010 0x00017010l +#define TYP_MC7011 0x00017011l +#define TYP_MC7020 0x00017020l +#define TYP_MC7021 0x00017021l + +#define TYP_MX7005 0x00027005l +#define TYP_MX7010 0x00027010l +#define TYP_MX7011 0x00027011l + + + +// ----- MI.72xx, MC.72xx, MX.72xx ----- +#define TYP_MI7210 0x00007210l +#define TYP_MI7211 0x00007211l +#define TYP_MI7220 0x00007220l +#define TYP_MI7221 0x00007221l + +#define TYP_M2I7210 0x00037210l +#define TYP_M2I7211 0x00037211l +#define TYP_M2I7220 0x00037220l +#define TYP_M2I7221 0x00037221l + +#define TYP_M2I7210EXP 0x00047210l +#define TYP_M2I7211EXP 0x00047211l +#define TYP_M2I7220EXP 0x00047220l +#define TYP_M2I7221EXP 0x00047221l + +#define TYP_MC7210 0x00017210l +#define TYP_MC7211 0x00017211l +#define TYP_MC7220 0x00017220l +#define TYP_MC7221 0x00017221l + +#define TYP_MX7210 0x00027210l +#define TYP_MX7220 0x00027220l + +// ----- M2p.75xx-x4 ----- +#define TYP_M2P75XX_X4 0x00097500l // generic +#define TYP_M2P7515_X4 0x00097515l + +// ----- M4i.77xx-x8 ----- +#define TYP_M4I77XX_X8 0x00077700 // generic +#define TYP_M4I7710_X8 0x00077710 // single-ended +#define TYP_M4I7720_X8 0x00077720 // single-ended +#define TYP_M4I7730_X8 0x00077730 // single-ended +#define TYP_M4I7725_X8 0x00077725 // differential +#define TYP_M4I7735_X8 0x00077735 // differential + +// ----- M4x.77xx-x8 ----- +#define TYP_M4X77XX_X4 0x00087700 // generic +#define TYP_M4X7710_X4 0x00087710 // single-ended +#define TYP_M4X7720_X4 0x00087720 // single-ended +#define TYP_M4X7730_X4 0x00087730 // single-ended +#define TYP_M4X7725_X4 0x00087725 // differential +#define TYP_M4X7735_X4 0x00087735 // differential + +// ----- MX.90xx ----- +#define TYP_MX9010 0x00029010l + + + +// *********************************************************************** +// software registers +// *********************************************************************** + + +// ***** PCI Features Bits (MI/MC/MX and prior cards) ********* +#define PCIBIT_MULTI 0x00000001 +#define PCIBIT_DIGITAL 0x00000002 +#define PCIBIT_CH0DIGI 0x00000004 +#define PCIBIT_EXTSAM 0x00000008 +#define PCIBIT_3CHANNEL 0x00000010 +#define PCIBIT_GATE 0x00000020 +#define PCIBIT_SLAVE 0x00000040 +#define PCIBIT_MASTER 0x00000080 +#define PCIBIT_DOUBLEMEM 0x00000100 +#define PCIBIT_SYNC 0x00000200 +#define PCIBIT_TIMESTAMP 0x00000400 +#define PCIBIT_STARHUB 0x00000800 +#define PCIBIT_CA 0x00001000 +#define PCIBIT_XIO 0x00002000 +#define PCIBIT_AMPLIFIER 0x00004000 +#define PCIBIT_DIFFMODE 0x00008000 + +#define PCIBIT_ELISA 0x10000000 + + +// ***** PCI features starting with M2i card series ***** +#define SPCM_FEAT_MULTI 0x00000001 // multiple recording +#define SPCM_FEAT_GATE 0x00000002 // gated sampling +#define SPCM_FEAT_DIGITAL 0x00000004 // additional synchronous digital inputs or outputs +#define SPCM_FEAT_TIMESTAMP 0x00000008 // timestamp +#define SPCM_FEAT_STARHUB5 0x00000020 // starhub for 5 cards installed (M2i + M2i-Exp) +#define SPCM_FEAT_STARHUB4 0x00000020 // starhub for 4 cards installed (M3i + M3i-Exp) +#define SPCM_FEAT_STARHUB6_EXTM 0x00000020 // starhub for 6 cards installed as card extension or piggy back (M2p) +#define SPCM_FEAT_STARHUB8_EXTM 0x00000020 // starhub for 8 cards installed as card extension or piggy back (M4i-Exp) +#define SPCM_FEAT_STARHUB16 0x00000040 // starhub for 16 cards installed (M2i, M2i-exp) +#define SPCM_FEAT_STARHUB16_EXTM 0x00000040 // starhub for 16 cards installed as card extension or piggy back (M2p) +#define SPCM_FEAT_STARHUB8 0x00000040 // starhub for 8 cards installed (M3i + M3i-Exp) +#define SPCM_FEAT_STARHUBXX_MASK 0x00000060 // mask to detect one of the above installed starhub +#define SPCM_FEAT_ABA 0x00000080 // ABA mode installed +#define SPCM_FEAT_BASEXIO 0x00000100 // extra I/O on base card installed +#define SPCM_FEAT_AMPLIFIER_10V 0x00000200 // external amplifier for 60/61 +#define SPCM_FEAT_STARHUBSYSMASTER 0x00000400 // system starhub master installed +#define SPCM_FEAT_DIFFMODE 0x00000800 // Differential mode installed +#define SPCM_FEAT_SEQUENCE 0x00001000 // Sequence programming mode for generator cards +#define SPCM_FEAT_AMPMODULE_10V 0x00002000 // amplifier module for 60/61 +#define SPCM_FEAT_STARHUBSYSSLAVE 0x00004000 // system starhub slave installed +#define SPCM_FEAT_NETBOX 0x00008000 // card is part of netbox +#define SPCM_FEAT_REMOTESERVER 0x00010000 // remote server can be used with this card +#define SPCM_FEAT_SCAPP 0x00020000 // SCAPP option (CUDA RDMA) +#define SPCM_FEAT_DIG16_SMB 0x00040000 // M2p: 16 additional digital inputs or outputs (via SMB connectors) +#define SPCM_FEAT_DIG8_SMA 0x00040000 // M4i: 8 additional digital inputs or 6 additional outputs (via SMA connectors) +#define SPCM_FEAT_DIG16_FX2 0x00080000 // M2p: 16 additional digital inputs or outputs (via FX2 connector) +#define SPCM_FEAT_DIGITALBWFILTER 0x00100000 // Digital BW filter is available +#define SPCM_FEAT_CUSTOMMOD_MASK 0xF0000000 // mask for custom modification code, meaning of code depends on type and customer + + +// ***** Extended Features starting with M4i ***** +#define SPCM_FEAT_EXTFW_SEGSTAT 0x00000001 // segment (Multiple Recording, ABA) statistics like average, min/max +#define SPCM_FEAT_EXTFW_SEGAVERAGE 0x00000002 // average of multiple segments (Multiple Recording, ABA) +#define SPCM_FEAT_EXTFW_BOXCAR 0x00000004 // boxcar averaging (high-res mode) +#define SPCM_FEAT_EXTFW_PULSEGEN 0x00000008 // pulse generators on XIO lines available + + +// ***** Error Request ************* +#define ERRORTEXTLEN 200 +#define SPC_LASTERRORTEXT 999996l +#define SPC_LASTERRORVALUE 999997l +#define SPC_LASTERRORREG 999998l +#define SPC_LASTERRORCODE 999999l // Reading this reset the internal error-memory. + +// ***** constants to use with the various _ACDC registers ***** +#define COUPLING_DC 0 +#define COUPLING_AC 1 + + +// ***** Register and Command Structure +#define SPC_COMMAND 0l +#define SPC_RESET 0l +#define SPC_SOFTRESET 1l +#define SPC_WRITESETUP 2l +#define SPC_START 10l +#define SPC_STARTANDWAIT 11l +#define SPC_FIFOSTART 12l +#define SPC_FIFOWAIT 13l +#define SPC_FIFOSTARTNOWAIT 14l +#define SPC_FORCETRIGGER 16l +#define SPC_STOP 20l +#define SPC_FLUSHFIFOBUFFER 21l +#define SPC_POWERDOWN 30l +#define SPC_SYNCMASTER 100l +#define SPC_SYNCTRIGGERMASTER 101l +#define SPC_SYNCMASTERFIFO 102l +#define SPC_SYNCSLAVE 110l +#define SPC_SYNCTRIGGERSLAVE 111l +#define SPC_SYNCSLAVEFIFO 112l +#define SPC_NOSYNC 120l +#define SPC_SYNCSTART 130l +#define SPC_SYNCCALCMASTER 140l +#define SPC_SYNCCALCMASTERFIFO 141l +#define SPC_PXIDIVIDERRESET 150l +#define SPC_RELAISON 200l +#define SPC_RELAISOFF 210l +#define SPC_ADJUSTSTART 300l +#define SPC_FIFO_BUFREADY0 400l +#define SPC_FIFO_BUFREADY1 401l +#define SPC_FIFO_BUFREADY2 402l +#define SPC_FIFO_BUFREADY3 403l +#define SPC_FIFO_BUFREADY4 404l +#define SPC_FIFO_BUFREADY5 405l +#define SPC_FIFO_BUFREADY6 406l +#define SPC_FIFO_BUFREADY7 407l +#define SPC_FIFO_BUFREADY8 408l +#define SPC_FIFO_BUFREADY9 409l +#define SPC_FIFO_BUFREADY10 410l +#define SPC_FIFO_BUFREADY11 411l +#define SPC_FIFO_BUFREADY12 412l +#define SPC_FIFO_BUFREADY13 413l +#define SPC_FIFO_BUFREADY14 414l +#define SPC_FIFO_BUFREADY15 415l +#define SPC_FIFO_AUTOBUFSTART 500l +#define SPC_FIFO_AUTOBUFEND 510l + +#define SPC_STATUS 10l +#define SPC_RUN 0l +#define SPC_TRIGGER 10l +#define SPC_READY 20l + + + +// commands for M2 cards +#define SPC_M2CMD 100l // write a command +#define M2CMD_CARD_RESET 0x00000001l // hardware reset +#define M2CMD_CARD_WRITESETUP 0x00000002l // write setup only +#define M2CMD_CARD_START 0x00000004l // start of card (including writesetup) +#define M2CMD_CARD_ENABLETRIGGER 0x00000008l // enable trigger engine +#define M2CMD_CARD_FORCETRIGGER 0x00000010l // force trigger +#define M2CMD_CARD_DISABLETRIGGER 0x00000020l // disable trigger engine again (multi or gate) +#define M2CMD_CARD_STOP 0x00000040l // stop run +#define M2CMD_CARD_FLUSHFIFO 0x00000080l // flush fifos to memory +#define M2CMD_CARD_INVALIDATEDATA 0x00000100l // current data in memory is invalidated, next data transfer start will wait until new data is available +#define M2CMD_CARD_INTERNALRESET 0x00000200l // INTERNAL reset command + +#define M2CMD_ALL_STOP 0x00440060l // stops card and all running transfers + +#define M2CMD_CARD_WAITPREFULL 0x00001000l // wait until pretrigger is full +#define M2CMD_CARD_WAITTRIGGER 0x00002000l // wait for trigger recognition +#define M2CMD_CARD_WAITREADY 0x00004000l // wait for card ready + +#define M2CMD_DATA_STARTDMA 0x00010000l // start of DMA transfer for data +#define M2CMD_DATA_WAITDMA 0x00020000l // wait for end of data transfer / next block ready +#define M2CMD_DATA_STOPDMA 0x00040000l // abort the data transfer +#define M2CMD_DATA_POLL 0x00080000l // transfer data using single access and polling + +#define M2CMD_EXTRA_STARTDMA 0x00100000l // start of DMA transfer for extra (ABA + timestamp) data +#define M2CMD_EXTRA_WAITDMA 0x00200000l // wait for end of extra (ABA + timestamp) data transfer / next block ready +#define M2CMD_EXTRA_STOPDMA 0x00400000l // abort the extra (ABA + timestamp) data transfer +#define M2CMD_EXTRA_POLL 0x00800000l // transfer data using single access and polling + +#define M2CMD_DATA_SGFLUSH 0x01000000l // flush incomplete pages from sg list + + +// status for M2 cards (bitmask) +#define SPC_M2STATUS 110l // read the current status +#define M2STAT_NONE 0x00000000l // status empty +#define M2STAT_CARD_PRETRIGGER 0x00000001l // pretrigger area is full +#define M2STAT_CARD_TRIGGER 0x00000002l // trigger recognized +#define M2STAT_CARD_READY 0x00000004l // card is ready, run finished +#define M2STAT_CARD_SEGMENT_PRETRG 0x00000008l // since M4i: at muliple-recording: pretrigger area of a segment is full + +#define M2STAT_DATA_BLOCKREADY 0x00000100l // next data block is available +#define M2STAT_DATA_END 0x00000200l // data transfer has ended +#define M2STAT_DATA_OVERRUN 0x00000400l // FIFO overrun (record) or underrun (replay) +#define M2STAT_DATA_ERROR 0x00000800l // internal error + +#define M2STAT_EXTRA_BLOCKREADY 0x00001000l // next extra data (ABA and timestamp) block is available +#define M2STAT_EXTRA_END 0x00002000l // extra data (ABA and timestamp) transfer has ended +#define M2STAT_EXTRA_OVERRUN 0x00004000l // FIFO overrun +#define M2STAT_EXTRA_ERROR 0x00008000l // internal error + +#define M2STAT_TSCNT_OVERRUN 0x00010000l // timestamp counter overrun + +#define M2STAT_INTERNALMASK 0xff000000l // mask for internal status signals +#define M2STAT_INTERNAL_SYSLOCK 0x02000000l + + + +// buffer control registers for samples data +#define SPC_DATA_AVAIL_USER_LEN 200l // number of bytes available for user (valid data if READ, free buffer if WRITE) +#define SPC_DATA_AVAIL_USER_POS 201l // the current byte position where the available user data starts +#define SPC_DATA_AVAIL_CARD_LEN 202l // number of bytes available for card (free buffer if READ, filled data if WRITE) +#define SPC_DATA_OUTBUFSIZE 209l // output buffer size in bytes + +// buffer control registers for extra data (ABA slow data, timestamps) +#define SPC_ABA_AVAIL_USER_LEN 210l // number of bytes available for user (valid data if READ, free buffer if WRITE) +#define SPC_ABA_AVAIL_USER_POS 211l // the current byte position where the available user data starts +#define SPC_ABA_AVAIL_CARD_LEN 212l // number of bytes available for card (free buffer if READ, filled data if WRITE) + +#define SPC_TS_AVAIL_USER_LEN 220l // number of bytes available for user (valid data if READ, free buffer if WRITE) +#define SPC_TS_AVAIL_USER_POS 221l // the current byte position where the available user data starts +#define SPC_TS_AVAIL_CARD_LEN 222l // number of bytes available for card (free buffer if READ, filled data if WRITE) + + + +// Installation +#define SPC_VERSION 1000l +#define SPC_ISAADR 1010l +#define SPC_INSTMEM 1020l +#define SPC_INSTSAMPLERATE 1030l +#define SPC_BRDTYP 1040l + +// MI/MC/MX type information (internal use) +#define SPC_MIINST_MODULES 1100l +#define SPC_MIINST_CHPERMODULE 1110l +#define SPC_MIINST_BYTESPERSAMPLE 1120l +#define SPC_MIINST_BITSPERSAMPLE 1125l +#define SPC_MIINST_MAXADCVALUE 1126l +#define SPC_MIINST_MINADCLOCK 1130l +#define SPC_MIINST_MAXADCLOCK 1140l +#define SPC_MIINST_MINEXTCLOCK 1145l +#define SPC_MIINST_MAXEXTCLOCK 1146l +#define SPC_MIINST_MINSYNCCLOCK 1147l +#define SPC_MIINST_MINEXTREFCLOCK 1148l +#define SPC_MIINST_MAXEXTREFCLOCK 1149l +#define SPC_MIINST_QUARZ 1150l +#define SPC_MIINST_QUARZ2 1151l +#define SPC_MIINST_MINEXTCLOCK1 1152l +#define SPC_MIINST_FLAGS 1160l +#define SPC_MIINST_FIFOSUPPORT 1170l +#define SPC_MIINST_ISDEMOCARD 1175l + +// Driver information +#define SPC_GETDRVVERSION 1200l +#define SPC_GETKERNELVERSION 1210l +#define SPC_GETDRVTYPE 1220l +#define DRVTYP_DOS 0l +#define DRVTYP_LINUX32 1l +#define DRVTYP_VXD 2l +#define DRVTYP_NTLEGACY 3l +#define DRVTYP_WDM32 4l +#define DRVTYP_WDM64 5l +#define DRVTYP_WOW64 6l +#define DRVTYP_LINUX64 7l +#define DRVTYP_QNX32 8l +#define DRVTYP_QNX64 9l +#define SPC_GETCOMPATIBILITYVERSION 1230l +#define SPC_GETMINDRVVERSION 1240l + +// PCI, CompactPCI and PXI Installation Information +#define SPC_PCITYP 2000l + +// ***** available card function types ***** +#define SPC_FNCTYPE 2001l +#define SPCM_TYPE_AI 0x01 +#define SPCM_TYPE_AO 0x02 +#define SPCM_TYPE_DI 0x04 +#define SPCM_TYPE_DO 0x08 +#define SPCM_TYPE_DIO 0x10 + +#define SPC_PCIVERSION 2010l +#define SPC_PCIEXTVERSION 2011l +#define SPC_PCIMODULEVERSION 2012l +#define SPC_PCIMODULEBVERSION 2013l +#define SPC_BASEPCBVERSION 2014l +#define SPC_MODULEPCBVERSION 2015l +#define SPC_MODULEAPCBVERSION 2015l +#define SPC_MODULEBPCBVERSION 2016l +#define SPC_EXTPCBVERSION 2017l +#define SPC_PCIDIGVERSION 2018l +#define SPC_DIGPCBVERSION 2019l +#define SPC_PCIDATE 2020l +#define SPC_CALIBDATE 2025l +#define SPC_CALIBDATEONBOARD 2026l +#define SPC_PCISERIALNR 2030l +#define SPC_PCISERIALNO 2030l +#define SPC_PCIHWBUSNO 2040l +#define SPC_PCIHWDEVNO 2041l +#define SPC_PCIHWFNCNO 2042l +#define SPC_PCIHWSLOTNO 2043l +#define SPC_PCIEXPGENERATION 2050l +#define SPC_PCIEXPLANES 2051l +#define SPC_PCIEXPPAYLOAD 2052l +#define SPC_PCIEXPREADREQUESTSIZE 2053l +#define SPC_PCIEXPREADCOMPLBOUNDARY 2054l +#define SPC_PXIHWSLOTNO 2055l +#define SPC_PCISAMPLERATE 2100l +#define SPC_PCIMEMSIZE 2110l +#define SPC_PCIFEATURES 2120l +#define SPC_PCIEXTFEATURES 2121l +#define SPC_PCIINFOADR 2200l +#define SPC_PCIINTERRUPT 2300l +#define SPC_PCIBASEADR0 2400l +#define SPC_PCIBASEADR1 2401l +#define SPC_PCIREGION0 2410l +#define SPC_PCIREGION1 2411l +#define SPC_READTRGLVLCOUNT 2500l +#define SPC_READIRCOUNT 3000l +#define SPC_READUNIPOLAR0 3010l +#define SPC_READUNIPOLAR1 3020l +#define SPC_READUNIPOLAR2 3030l +#define SPC_READUNIPOLAR3 3040l +#define SPC_READMAXOFFSET 3100l + +#define SPC_READAIFEATURES 3101l +#define SPCM_AI_TERM 0x00000001 // input termination available +#define SPCM_AI_SE 0x00000002 // single-ended mode available +#define SPCM_AI_DIFF 0x00000004 // differential mode available +#define SPCM_AI_OFFSPERCENT 0x00000008 // offset programming is done in percent of input range +#define SPCM_AI_OFFSMV 0x00000010 // offset programming is done in mV absolut +#define SPCM_AI_OVERRANGEDETECT 0x00000020 // overrange detection is programmable +#define SPCM_AI_DCCOUPLING 0x00000040 // DC coupling available +#define SPCM_AI_ACCOUPLING 0x00000080 // AC coupling available +#define SPCM_AI_LOWPASS 0x00000100 // selectable low pass +#define SPCM_AI_ACDC_OFFS_COMP 0x00000200 // AC/DC offset compensation +#define SPCM_AI_DIFFMUX 0x00000400 // differential mode (two channels combined to one) available +#define SPCM_AI_GLOBALLOWPASS 0x00000800 // globally selectable low pass (all channels same setting) +#define SPCM_AI_AUTOCALOFFS 0x00001000 // automatic offset calibration in hardware +#define SPCM_AI_AUTOCALGAIN 0x00002000 // automatic gain calibration in hardware +#define SPCM_AI_AUTOCALOFFSNOIN 0x00004000 // automatic offset calibration with open inputs +#define SPCM_AI_HIGHIMP 0x00008000 // high impedance available +#define SPCM_AI_LOWIMP 0x00010000 // low impedance available (50 ohm) +#define SPCM_AI_DIGITALLOWPASS 0x00020000 // selectable digital low pass filter +#define SPCM_AI_INDIVPULSEWIDTH 0x00100000 // individual pulsewidth per channel available + +#define SPC_READAOFEATURES 3102l +#define SPCM_AO_SE 0x00000002 // single-ended mode available +#define SPCM_AO_DIFF 0x00000004 // differential mode available +#define SPCM_AO_PROGFILTER 0x00000008 // programmable filters available +#define SPCM_AO_PROGOFFSET 0x00000010 // programmable offset available +#define SPCM_AO_PROGGAIN 0x00000020 // programmable gain available +#define SPCM_AO_PROGSTOPLEVEL 0x00000040 // programmable stop level available +#define SPCM_AO_DOUBLEOUT 0x00000080 // double out mode available +#define SPCM_AO_ENABLEOUT 0x00000100 // outputs can be disabled/enabled + +#define SPC_READDIFEATURES 3103l +#define SPCM_DI_TERM 0x00000001 // input termination available +#define SPCM_DI_SE 0x00000002 // single-ended mode available +#define SPCM_DI_DIFF 0x00000004 // differential mode available +#define SPCM_DI_PROGTHRESHOLD 0x00000008 // programmable threshold available +#define SPCM_DI_HIGHIMP 0x00000010 // high impedance available +#define SPCM_DI_LOWIMP 0x00000020 // low impedance available +#define SPCM_DI_INDIVPULSEWIDTH 0x00100000 // individual pulsewidth per channel available +#define SPCM_DI_IOCHANNEL 0x00200000 // connected with DO channel + +#define SPC_READDOFEATURES 3104l +#define SPCM_DO_SE 0x00000002 // single-ended mode available +#define SPCM_DO_DIFF 0x00000004 // differential mode available +#define SPCM_DO_PROGSTOPLEVEL 0x00000008 // programmable stop level available +#define SPCM_DO_PROGOUTLEVELS 0x00000010 // programmable output levels (low + high) available +#define SPCM_DO_ENABLEMASK 0x00000020 // individual enable mask for each output channel +#define SPCM_DO_IOCHANNEL 0x00200000 // connected with DI channel + +#define SPC_READCHGROUPING 3110l +#define SPC_READAIPATHCOUNT 3120l // number of available analog input paths +#define SPC_READAIPATH 3121l // the current path for which all the settings are read + +#define SPCM_CUSTOMMOD 3130l +#define SPCM_CUSTOMMOD_BASE_MASK 0x000000FF +#define SPCM_CUSTOMMOD_MODULE_MASK 0x0000FF00 +#define SPCM_CUSTOMMOD_STARHUB_MASK 0x00FF0000 + +#define SPC_READRANGECH0_0 3200l +#define SPC_READRANGECH0_1 3201l +#define SPC_READRANGECH0_2 3202l +#define SPC_READRANGECH0_3 3203l +#define SPC_READRANGECH0_4 3204l +#define SPC_READRANGECH0_5 3205l +#define SPC_READRANGECH0_6 3206l +#define SPC_READRANGECH0_7 3207l +#define SPC_READRANGECH0_8 3208l +#define SPC_READRANGECH0_9 3209l +#define SPC_READRANGECH1_0 3300l +#define SPC_READRANGECH1_1 3301l +#define SPC_READRANGECH1_2 3302l +#define SPC_READRANGECH1_3 3303l +#define SPC_READRANGECH1_4 3304l +#define SPC_READRANGECH1_5 3305l +#define SPC_READRANGECH1_6 3306l +#define SPC_READRANGECH1_7 3307l +#define SPC_READRANGECH1_8 3308l +#define SPC_READRANGECH1_9 3309l +#define SPC_READRANGECH2_0 3400l +#define SPC_READRANGECH2_1 3401l +#define SPC_READRANGECH2_2 3402l +#define SPC_READRANGECH2_3 3403l +#define SPC_READRANGECH3_0 3500l +#define SPC_READRANGECH3_1 3501l +#define SPC_READRANGECH3_2 3502l +#define SPC_READRANGECH3_3 3503l + +#define SPC_READRANGEMIN0 4000l +#define SPC_READRANGEMIN99 4099l +#define SPC_READRANGEMAX0 4100l +#define SPC_READRANGEMAX99 4199l +#define SPC_READOFFSMIN0 4200l +#define SPC_READOFFSMIN99 4299l +#define SPC_READOFFSMAX0 4300l +#define SPC_READOFFSMAX99 4399l +#define SPC_PCICOUNTER 9000l +#define SPC_BUFFERPOS 9010l + +#define SPC_READAOGAINMIN 9100l +#define SPC_READAOGAINMAX 9110l +#define SPC_READAOOFFSETMIN 9120l +#define SPC_READAOOFFSETMAX 9130l + +#define SPC_CARDMODE 9500l // card modes as listed below +#define SPC_AVAILCARDMODES 9501l // list with available card modes + +// card modes +#define SPC_REC_STD_SINGLE 0x00000001 // singleshot recording to memory +#define SPC_REC_STD_MULTI 0x00000002 // multiple records to memory on each trigger event +#define SPC_REC_STD_GATE 0x00000004 // gated recording to memory on gate signal +#define SPC_REC_STD_ABA 0x00000008 // ABA: A slowly to extra FIFO, B to memory on each trigger event +#define SPC_REC_STD_SEGSTATS 0x00010000 // segment information stored on each trigger segment -> stored in on-board memory +#define SPC_REC_STD_AVERAGE 0x00020000 // multiple records summed to average memory on each trigger event -> stored in on-board memory +#define SPC_REC_STD_AVERAGE_16BIT 0x00080000 // multiple records summed to average memory on each trigger event -> stored in on-board memory +#define SPC_REC_STD_BOXCAR 0x00800000 // boxcar averaging + +#define SPC_REC_FIFO_SINGLE 0x00000010 // singleshot to FIFO on trigger event +#define SPC_REC_FIFO_MULTI 0x00000020 // multiple records to FIFO on each trigger event +#define SPC_REC_FIFO_GATE 0x00000040 // gated sampling to FIFO on gate signal +#define SPC_REC_FIFO_ABA 0x00000080 // ABA: A slowly to extra FIFO, B to FIFO on each trigger event +#define SPC_REC_FIFO_SEGSTATS 0x00100000 // segment information stored on each trigger segment -> streamed to host +#define SPC_REC_FIFO_AVERAGE 0x00200000 // multiple records summed to average memory on each trigger event -> streamed to host +#define SPC_REC_FIFO_AVERAGE_16BIT 0x00400000 // multiple records summed to average memory on each trigger event -> streamed to host +#define SPC_REC_FIFO_BOXCAR 0x01000000 // boxcar averaging FIFO mode +#define SPC_REC_FIFO_SINGLE_MONITOR 0x02000000 // like SPC_REC_FIFO_SINGLE but with additional slow A data stream for monitoring + +#define SPC_REP_STD_SINGLE 0x00000100 // single replay from memory on trigger event +#define SPC_REP_STD_MULTI 0x00000200 // multiple replay from memory on each trigger event +#define SPC_REP_STD_GATE 0x00000400 // gated replay from memory on gate signal + +#define SPC_REP_FIFO_SINGLE 0x00000800 // single replay from FIFO on trigger event +#define SPC_REP_FIFO_MULTI 0x00001000 // multiple replay from FIFO on each trigger event +#define SPC_REP_FIFO_GATE 0x00002000 // gated replay from FIFO on gate signal + +#define SPC_REP_STD_CONTINUOUS 0x00004000 // continuous replay started by one trigger event +#define SPC_REP_STD_SINGLERESTART 0x00008000 // single replays on every detected trigger event +#define SPC_REP_STD_SEQUENCE 0x00040000 // sequence mode replay + +// Waveforms for demo cards +#define SPC_DEMOWAVEFORM 9600l +#define SPC_AVAILDEMOWAVEFORMS 9601l +#define SPCM_DEMOWAVEFORM_SINE 0x00000001 +#define SPCM_DEMOWAVEFORM_RECT 0x00000002 +#define SPCM_DEMOWAVEFORM_TRIANGLE 0x00000004 + + +// Memory +#define SPC_MEMSIZE 10000l +#define SPC_SEGMENTSIZE 10010l +#define SPC_LOOPS 10020l +#define SPC_PRETRIGGER 10030l +#define SPC_ABADIVIDER 10040l +#define SPC_AVERAGES 10050l +#define SPC_BOX_AVERAGES 10060l +#define SPC_SEGSPLIT_START 10070l +#define SPC_SEGSPLIT_PAUSE 10071l +#define SPC_POSTTRIGGER 10100l +#define SPC_STARTOFFSET 10200l + +// Memory info (depends on mode and channelenable) +#define SPC_AVAILMEMSIZE_MIN 10201l +#define SPC_AVAILMEMSIZE_MAX 10202l +#define SPC_AVAILMEMSIZE_STEP 10203l +#define SPC_AVAILPOSTTRIGGER_MIN 10204l +#define SPC_AVAILPOSTTRIGGER_MAX 10205l +#define SPC_AVAILPOSTTRIGGER_STEP 10206l + +#define SPC_AVAILABADIVIDER_MIN 10207l +#define SPC_AVAILABADIVIDER_MAX 10208l +#define SPC_AVAILABADIVIDER_STEP 10209l + +#define SPC_AVAILLOOPS_MIN 10210l +#define SPC_AVAILLOOPS_MAX 10211l +#define SPC_AVAILLOOPS_STEP 10212l + +#define SPC_AVAILAVERAGES_MIN 10220l +#define SPC_AVAILAVERAGES_MAX 10221l +#define SPC_AVAILAVERAGES_STEP 10222l + +#define SPC_AVAILAVRGSEGSIZE_MIN 10223l +#define SPC_AVAILAVRGSEGSIZE_MAX 10224l +#define SPC_AVAILAVRGSEGSIZE_STEP 10225l + +#define SPC_AVAILAVERAGES16BIT_MIN 10226l +#define SPC_AVAILAVERAGES16BIT_MAX 10227l +#define SPC_AVAILAVERAGES16BIT_STEP 10228l + +#define SPC_AVAILAVRG16BITSEGSIZE_MIN 10229l +#define SPC_AVAILAVRG16BITSEGSIZE_MAX 10230l +#define SPC_AVAILAVRG16BITSEGSIZE_STEP 10231l + +#define SPC_AVAILBOXCARAVERAGES_MIN 10232l +#define SPC_AVAILBOXCARAVERAGES_MAX 10233l +#define SPC_AVAILBOXCARAVERAGES_STEPFACTOR 10234l + + +// Channels +#define SPC_CHENABLE 11000l +#define SPC_CHCOUNT 11001l +#define SPC_CHMODACOUNT 11100l +#define SPC_CHMODBCOUNT 11101l + + +// ----- channel enable flags for A/D and D/A boards (MI/MC/MX series) ----- +// and all cards on M2i series +#define CHANNEL0 0x00000001 +#define CHANNEL1 0x00000002 +#define CHANNEL2 0x00000004 +#define CHANNEL3 0x00000008 +#define CHANNEL4 0x00000010 +#define CHANNEL5 0x00000020 +#define CHANNEL6 0x00000040 +#define CHANNEL7 0x00000080 +#define CHANNEL8 0x00000100 +#define CHANNEL9 0x00000200 +#define CHANNEL10 0x00000400 +#define CHANNEL11 0x00000800 +#define CHANNEL12 0x00001000 +#define CHANNEL13 0x00002000 +#define CHANNEL14 0x00004000 +#define CHANNEL15 0x00008000 +#define CHANNEL16 0x00010000 +#define CHANNEL17 0x00020000 +#define CHANNEL18 0x00040000 +#define CHANNEL19 0x00080000 +#define CHANNEL20 0x00100000 +#define CHANNEL21 0x00200000 +#define CHANNEL22 0x00400000 +#define CHANNEL23 0x00800000 +#define CHANNEL24 0x01000000 +#define CHANNEL25 0x02000000 +#define CHANNEL26 0x04000000 +#define CHANNEL27 0x08000000 +#define CHANNEL28 0x10000000 +#define CHANNEL29 0x20000000 +#define CHANNEL30 0x40000000 +#define CHANNEL31 0x80000000 +// CHANNEL32 up to CHANNEL63 are placed in the upper 32 bit of a 64 bit word (M2i only) + + +// ----- old digital i/o settings for 16 bit implementation (MI/MC/MX series) ----- +#define CH0_8BITMODE 65536l // for MI.70xx only +#define CH0_16BIT 1l +#define CH0_32BIT 3l +#define CH1_16BIT 4l +#define CH1_32BIT 12l + +// ----- new digital i/o settings for 8 bit implementation (MI/MC/MX series) ----- +#define MOD0_8BIT 1l +#define MOD0_16BIT 3l +#define MOD0_32BIT 15l +#define MOD1_8BIT 16l +#define MOD1_16BIT 48l +#define MOD1_32BIT 240l + +#define SPC_CHROUTE0 11010l +#define SPC_CHROUTE1 11020l + +#define SPC_BITENABLE 11030l + + + +// ----- Clock Settings ----- +#define SPC_SAMPLERATE 20000l +#define SPC_SYNCCLOCK 20005l +#define SPC_SAMPLERATE2 20010l +#define SPC_SR2 20020l +#define SPC_PLL_ENABLE 20030l +#define SPC_PLL_ISLOCKED 20031l +#define SPC_CLOCKDIV 20040l +#define SPC_INTCLOCKDIV 20041l +#define SPC_PXICLOCKDIV 20042l +#define SPC_PLL_R 20060l +#define SPC_PLL_F 20061l +#define SPC_PLL_S 20062l +#define SPC_PLL_DIV 20063l +#define SPC_PXI_CLK_OUT 20090l +#define SPC_EXTERNALCLOCK 20100l +#define SPC_EXTERNOUT 20110l +#define SPC_CLOCKOUT 20110l +#define SPC_CLOCKOUTFREQUENCY 20111l +#define SPC_CLOCK50OHM 20120l +#define SPC_CLOCK110OHM 20120l +#define SPC_CLOCK75OHM 20120l +#define SPC_STROBE75OHM 20121l +#define SPC_EXTERNRANGE 20130l +#define SPC_EXTRANGESHDIRECT 20131l +#define EXRANGE_NONE 0l +#define EXRANGE_NOPLL 1l +#define EXRANGE_SINGLE 2l +#define EXRANGE_BURST_S 4l +#define EXRANGE_BURST_M 8l +#define EXRANGE_BURST_L 16l +#define EXRANGE_BURST_XL 32l +#define EXRANGE_LOW 64l +#define EXRANGE_HIGH 128l +#define EXRANGE_LOW_DPS 256l // digital phase synchronization +#define SPC_REFERENCECLOCK 20140l +#define REFCLOCK_PXI -1l + +// ----- new clock registers starting with M2i cards ----- +#define SPC_CLOCKMODE 20200l // clock mode as listed below +#define SPC_AVAILCLOCKMODES 20201l // returns all available clock modes +#define SPC_CM_INTPLL 0x00000001 // use internal PLL +#define SPC_CM_QUARTZ1 0x00000002 // use plain quartz1 (with divider) +#define SPC_CM_QUARTZ2 0x00000004 // use plain quartz2 (with divider) +#define SPC_CM_EXTERNAL 0x00000008 // use external clock directly +#define SPC_CM_EXTERNAL0 0x00000008 // use external clock0 directly (identical value to SPC_CM_EXTERNAL) +#define SPC_CM_EXTDIVIDER 0x00000010 // use external clock with programmed divider +#define SPC_CM_EXTREFCLOCK 0x00000020 // external reference clock fed in (defined with SPC_REFERENCECLOCK) +#define SPC_CM_PXIREFCLOCK 0x00000040 // PXI reference clock +#define SPC_CM_SHDIRECT 0x00000080 // Star-hub direct clock (not synchronised) +#define SPC_CM_QUARTZ2_DIRSYNC 0x00000100 // use plain quartz2 (with divider) and put the Q2 clock on the star-hub module +#define SPC_CM_QUARTZ1_DIRSYNC 0x00000200 // use plain quartz1 (with divider) and put the Q1 clock on the star-hub module +#define SPC_CM_EXTERNAL1 0x00000400 // use external clock1 directly +// ----- internal use only! ----- +#define SPC_CM_SYNCINT 0x01000000 +#define SPC_CM_SYNCEXT 0x02000000 + +#define SPC_CLOCK_READFEATURES 20205l +#define SPC_CLOCK_READFEATURES0 20205l +#define SPC_CLOCK_READFEATURES1 20206l +#define SPCM_CKFEAT_TERM 0x00000001 +#define SPCM_CKFEAT_HIGHIMP 0x00000002 +#define SPCM_CKFEAT_DCCOUPLING 0x00000004 +#define SPCM_CKFEAT_ACCOUPLING 0x00000008 +#define SPCM_CKFEAT_SE 0x00000010 +#define SPCM_CKFEAT_DIFF 0x00000020 +#define SPCM_CKFEAT_PROGEDGE 0x00000040 +#define SPCM_CKFEAT_LEVELPROG 0x00000100 +#define SPCM_CKFEAT_PROGTHRESHOLD 0x00000200 +#define SPCM_CKFEAT_PROGDELAY 0x00000400 + +#define SPC_BURSTSYSCLOCKMODE 20210l +#define SPC_SYNCMASTERSYSCLOCKMODE 20211l +#define SPC_CLOCK_SETUP_CHANGED 20212l + +// clock delay if available +#define SPC_CLOCK_AVAILDELAY_MIN 20220l +#define SPC_CLOCK_AVAILDELAY_MAX 20221l +#define SPC_CLOCK_AVAILDELAY_STEP 20222l +#define SPC_CLOCK_DELAY 20223l + +// clock edges +#define SPC_AVAILCLOCKEDGES 20224l +#define SPCM_EDGE_FALLING 0x00000001 // Originally SPCM_RISING_EDGE : name and value of constant intentionally changed with driver versions greater than V5.24. See hardware manual for details. +#define SPCM_EDGE_RISING 0x00000002 // Originally SPCM_FALLING_EDGE : name and value of constant intentionally changed with driver versions greater than V5.24. See hardware manual for details. +#define SPCM_BOTH_EDGES 0x00000004 +#define SPCM_EDGES_BOTH 0x00000004 //Just added for good measure to match naming scheme of above SPCM_EDGE_FALLING and SPCM_EDGE_RISING constants. +#define SPC_CLOCK_EDGE 20225l + +// mux definitions for channel routing +#define SPC_CHANNELMUXINFO 20300l +#define SPCM_MUX_NONE 0x00000000 // nothing is interlaced +#define SPCM_MUX_MUXONMOD 0x00000001 // data on module is multiplexed, only one channel can have full speed +#define SPCM_MUX_INVERTCLKONMOD 0x00000002 // two channels on one module run with inverted clock +#define SPCM_MUX_DLY 0x00000003 // delay cable between modules, one channel can have full interlace speed +#define SPCM_MUX_DLYANDMUXONMOD 0x00000004 // delay cable between modules and multplexing on module +#define SPCM_MUX_MUXBETWEENMODS 0x00000005 // multiplexed between modules (fastest sampling rate only with one module) +#define SPCM_MUX_MUXONMOD2CH 0x00000006 // data on module is multiplexed, only two channel can have full speed +#define SPCM_MUX_MAX4CH 0x00000007 // only four channels can have full speed, independent of distribution on modules + + +// ----- In/Out Range ----- +#define SPC_OFFS0 30000l +#define SPC_AMP0 30010l +#define SPC_ACDC0 30020l +#define SPC_ACDC_OFFS_COMPENSATION0 30021l +#define SPC_50OHM0 30030l +#define SPC_DIFF0 30040l +#define SPC_DOUBLEOUT0 30041l +#define SPC_DIGITAL0 30050l +#define SPC_110OHM0 30060l +#define SPC_110OHM0L 30060l +#define SPC_75OHM0 30060l +#define SPC_INOUT0 30070l +#define SPC_FILTER0 30080l +#define SPC_BANKSWITCH0 30081l +#define SPC_PATH0 30090l +#define SPC_ENABLEOUT0 30091l + +#define SPC_OFFS1 30100l +#define SPC_AMP1 30110l +#define SPC_ACDC1 30120l +#define SPC_ACDC_OFFS_COMPENSATION1 30121l +#define SPC_50OHM1 30130l +#define SPC_DIFF1 30140l +#define SPC_DOUBLEOUT1 30141l +#define SPC_DIGITAL1 30150l +#define SPC_110OHM1 30160l +#define SPC_110OHM0H 30160l +#define SPC_75OHM1 30160l +#define SPC_INOUT1 30170l +#define SPC_FILTER1 30180l +#define SPC_BANKSWITCH1 30181l +#define SPC_PATH1 30190l +#define SPC_ENABLEOUT1 30191l + +#define SPC_OFFS2 30200l +#define SPC_AMP2 30210l +#define SPC_ACDC2 30220l +#define SPC_ACDC_OFFS_COMPENSATION2 30221l +#define SPC_50OHM2 30230l +#define SPC_DIFF2 30240l +#define SPC_DOUBLEOUT2 30241l +#define SPC_110OHM2 30260l +#define SPC_110OHM1L 30260l +#define SPC_75OHM2 30260l +#define SPC_INOUT2 30270l +#define SPC_FILTER2 30280l +#define SPC_BANKSWITCH2 30281l +#define SPC_PATH2 30290l +#define SPC_ENABLEOUT2 30291l + +#define SPC_OFFS3 30300l +#define SPC_AMP3 30310l +#define SPC_ACDC3 30320l +#define SPC_ACDC_OFFS_COMPENSATION3 30321l +#define SPC_50OHM3 30330l +#define SPC_DIFF3 30340l +#define SPC_DOUBLEOUT3 30341l +#define SPC_110OHM3 30360l +#define SPC_110OHM1H 30360l +#define SPC_75OHM3 30360l +#define SPC_INOUT3 30370l +#define SPC_FILTER3 30380l +#define SPC_BANKSWITCH3 30381l +#define SPC_PATH3 30390l +#define SPC_ENABLEOUT3 30391l + +#define SPC_OFFS4 30400l +#define SPC_AMP4 30410l +#define SPC_ACDC4 30420l +#define SPC_50OHM4 30430l +#define SPC_DIFF4 30440l +#define SPC_DOUBLEOUT4 30441l +#define SPC_FILTER4 30480l +#define SPC_ENABLEOUT4 30491l +#define SPC_PATH4 30490l + +#define SPC_OFFS5 30500l +#define SPC_AMP5 30510l +#define SPC_ACDC5 30520l +#define SPC_50OHM5 30530l +#define SPC_DIFF5 30540l +#define SPC_DOUBLEOUT5 30541l +#define SPC_FILTER5 30580l +#define SPC_ENABLEOUT5 30591l +#define SPC_PATH5 30590l + +#define SPC_OFFS6 30600l +#define SPC_AMP6 30610l +#define SPC_ACDC6 30620l +#define SPC_50OHM6 30630l +#define SPC_DIFF6 30640l +#define SPC_DOUBLEOUT6 30641l +#define SPC_FILTER6 30680l +#define SPC_ENABLEOUT6 30691l +#define SPC_PATH6 30690l + +#define SPC_OFFS7 30700l +#define SPC_AMP7 30710l +#define SPC_ACDC7 30720l +#define SPC_50OHM7 30730l +#define SPC_DIFF7 30740l +#define SPC_DOUBLEOUT7 30741l +#define SPC_FILTER7 30780l +#define SPC_ENABLEOUT7 30791l +#define SPC_PATH7 30790l + +#define SPC_OFFS8 30800l +#define SPC_AMP8 30810l +#define SPC_ACDC8 30820l +#define SPC_50OHM8 30830l +#define SPC_DIFF8 30840l +#define SPC_PATH8 30890l + +#define SPC_OFFS9 30900l +#define SPC_AMP9 30910l +#define SPC_ACDC9 30920l +#define SPC_50OHM9 30930l +#define SPC_DIFF9 30940l +#define SPC_PATH9 30990l + +#define SPC_OFFS10 31000l +#define SPC_AMP10 31010l +#define SPC_ACDC10 31020l +#define SPC_50OHM10 31030l +#define SPC_DIFF10 31040l +#define SPC_PATH10 31090l + +#define SPC_OFFS11 31100l +#define SPC_AMP11 31110l +#define SPC_ACDC11 31120l +#define SPC_50OHM11 31130l +#define SPC_DIFF11 31140l +#define SPC_PATH11 31190l + +#define SPC_OFFS12 31200l +#define SPC_AMP12 31210l +#define SPC_ACDC12 31220l +#define SPC_50OHM12 31230l +#define SPC_DIFF12 31240l +#define SPC_PATH12 31290l + +#define SPC_OFFS13 31300l +#define SPC_AMP13 31310l +#define SPC_ACDC13 31320l +#define SPC_50OHM13 31330l +#define SPC_DIFF13 31340l +#define SPC_PATH13 31390l + +#define SPC_OFFS14 31400l +#define SPC_AMP14 31410l +#define SPC_ACDC14 31420l +#define SPC_50OHM14 31430l +#define SPC_DIFF14 31440l +#define SPC_PATH14 31490l + +#define SPC_OFFS15 31500l +#define SPC_AMP15 31510l +#define SPC_ACDC15 31520l +#define SPC_50OHM15 31530l +#define SPC_DIFF15 31540l +#define SPC_PATH15 31590l + +#define SPC_110OHMTRIGGER 30400l +#define SPC_110OHMCLOCK 30410l + + +#define AMP_BI200 200l +#define AMP_BI500 500l +#define AMP_BI1000 1000l +#define AMP_BI2000 2000l +#define AMP_BI2500 2500l +#define AMP_BI4000 4000l +#define AMP_BI5000 5000l +#define AMP_BI10000 10000l +#define AMP_UNI400 100400l +#define AMP_UNI1000 101000l +#define AMP_UNI2000 102000l + + +// ----- Trigger Settings ----- +#define SPC_TRIGGERMODE 40000l +#define SPC_TRIG_OUTPUT 40100l +#define SPC_TRIGGEROUT 40100l +#define SPC_TRIG_TERM 40110l +#define SPC_TRIG_TERM0 40110l +#define SPC_TRIGGER50OHM 40110l +#define SPC_TRIGGER110OHM0 40110l +#define SPC_TRIGGER75OHM0 40110l +#define SPC_TRIG_TERM1 40111l +#define SPC_TRIGGER110OHM1 40111l +#define SPC_TRIG_EXT0_ACDC 40120l +#define SPC_TRIG_EXT1_ACDC 40121l +#define SPC_TRIG_EXT2_ACDC 40122l + +#define SPC_TRIGGERMODE0 40200l +#define SPC_TRIGGERMODE1 40201l +#define SPC_TRIGGERMODE2 40202l +#define SPC_TRIGGERMODE3 40203l +#define SPC_TRIGGERMODE4 40204l +#define SPC_TRIGGERMODE5 40205l +#define SPC_TRIGGERMODE6 40206l +#define SPC_TRIGGERMODE7 40207l +#define SPC_TRIGGERMODE8 40208l +#define SPC_TRIGGERMODE9 40209l +#define SPC_TRIGGERMODE10 40210l +#define SPC_TRIGGERMODE11 40211l +#define SPC_TRIGGERMODE12 40212l +#define SPC_TRIGGERMODE13 40213l +#define SPC_TRIGGERMODE14 40214l +#define SPC_TRIGGERMODE15 40215l + +#define TM_SOFTWARE 0l +#define TM_NOTRIGGER 10l +#define TM_CHXPOS 10000l +#define TM_CHXPOS_LP 10001l +#define TM_CHXPOS_SP 10002l +#define TM_CHXPOS_GS 10003l +#define TM_CHXPOS_SS 10004l +#define TM_CHXNEG 10010l +#define TM_CHXNEG_LP 10011l +#define TM_CHXNEG_SP 10012l +#define TM_CHXNEG_GS 10013l +#define TM_CHXNEG_SS 10014l +#define TM_CHXOFF 10020l +#define TM_CHXBOTH 10030l +#define TM_CHXWINENTER 10040l +#define TM_CHXWINENTER_LP 10041l +#define TM_CHXWINENTER_SP 10042l +#define TM_CHXWINLEAVE 10050l +#define TM_CHXWINLEAVE_LP 10051l +#define TM_CHXWINLEAVE_SP 10052l +#define TM_CHXLOW 10060l +#define TM_CHXHIGH 10061l +#define TM_CHXINWIN 10062l +#define TM_CHXOUTWIN 10063l +#define TM_CHXSPIKE 10064l + + +#define TM_CH0POS 10000l +#define TM_CH0NEG 10010l +#define TM_CH0OFF 10020l +#define TM_CH0BOTH 10030l +#define TM_CH1POS 10100l +#define TM_CH1NEG 10110l +#define TM_CH1OFF 10120l +#define TM_CH1BOTH 10130l +#define TM_CH2POS 10200l +#define TM_CH2NEG 10210l +#define TM_CH2OFF 10220l +#define TM_CH2BOTH 10230l +#define TM_CH3POS 10300l +#define TM_CH3NEG 10310l +#define TM_CH3OFF 10320l +#define TM_CH3BOTH 10330l + +#define TM_TTLPOS 20000l +#define TM_TTLHIGH_LP 20001l +#define TM_TTLHIGH_SP 20002l +#define TM_TTLNEG 20010l +#define TM_TTLLOW_LP 20011l +#define TM_TTLLOW_SP 20012l +#define TM_TTL 20020l +#define TM_TTLBOTH 20030l +#define TM_TTLBOTH_LP 20031l +#define TM_TTLBOTH_SP 20032l +#define TM_CHANNEL 20040l +#define TM_TTLHIGH 20050l +#define TM_TTLLOW 20051l +#define TM_PATTERN 21000l +#define TM_PATTERN_LP 21001l +#define TM_PATTERN_SP 21002l +#define TM_PATTERNANDEDGE 22000l +#define TM_PATTERNANDEDGE_LP 22001l +#define TM_PATTERNANDEDGE_SP 22002l +#define TM_GATELOW 30000l +#define TM_GATEHIGH 30010l +#define TM_GATEPATTERN 30020l +#define TM_CHOR 35000l +#define TM_CHAND 35010l +#define TM_CHORTTLPOS 35020l +#define TM_CHORTTLNEG 35021l + +#define SPC_PXITRGOUT 40300l +#define PTO_OFF 0l +#define PTO_LINE0 1l +#define PTO_LINE1 2l +#define PTO_LINE2 3l +#define PTO_LINE3 4l +#define PTO_LINE4 5l +#define PTO_LINE5 6l +#define PTO_LINE6 7l +#define PTO_LINE7 8l +#define PTO_LINESTAR 9l +#define SPC_PXITRGOUT_AVAILABLE 40301l // bitmap register + +#define SPC_PXISTARTRG_DIVRST_OUT 40302l // bitmap register +#define SPC_PXISTARTRG_DIVRST_OUT_AVAILABLE 40303l +#define SPC_PXISTARTRG_OUT 40304l // bitmap register +#define PSTO_LINESTAR0 0x00000001 +#define PSTO_LINESTAR1 0x00000002 +#define PSTO_LINESTAR2 0x00000004 +#define PSTO_LINESTAR3 0x00000008 +#define PSTO_LINESTAR4 0x00000010 +#define PSTO_LINESTAR5 0x00000020 +#define PSTO_LINESTAR6 0x00000040 +#define PSTO_LINESTAR7 0x00000080 +#define PSTO_LINESTAR8 0x00000100 +#define PSTO_LINESTAR9 0x00000200 +#define PSTO_LINESTAR10 0x00000400 +#define PSTO_LINESTAR11 0x00000800 +#define PSTO_LINESTAR12 0x00001000 +#define PSTO_LINE0 0x00010000 +#define PSTO_LINE1 0x00020000 +#define PSTO_LINE2 0x00040000 +#define PSTO_LINE3 0x00080000 +#define PSTO_LINE4 0x00100000 +#define PSTO_LINE5 0x00200000 +#define PSTO_LINE6 0x00400000 +#define PSTO_LINE7 0x00800000 +#define SPC_PXISTARTRG_OUT_AVAILABLE 40305l + +#define SPC_PXITRGIN 40310l // bitmap register +#define PTI_OFF 0l +#define PTI_LINE0 1l +#define PTI_LINE1 2l +#define PTI_LINE2 4l +#define PTI_LINE3 8l +#define PTI_LINE4 16l +#define PTI_LINE5 32l +#define PTI_LINE6 64l +#define PTI_LINE7 128l +#define PTI_LINESTAR 256l +#define SPC_PXITRGIN_AVAILABLE 40311l // bitmap register +#define SPC_PXI_DIVIDER_RESET_IN 40320l +#define SPC_PXI_DIVIDER_RESET_IN_AVAILABLE 40321l + + +// new registers of M2i driver +#define SPC_TRIG_AVAILORMASK 40400l +#define SPC_TRIG_ORMASK 40410l +#define SPC_TRIG_AVAILANDMASK 40420l +#define SPC_TRIG_ANDMASK 40430l +#define SPC_TMASK_NONE 0x00000000 +#define SPC_TMASK_SOFTWARE 0x00000001 +#define SPC_TMASK_EXT0 0x00000002 +#define SPC_TMASK_EXT1 0x00000004 +#define SPC_TMASK_EXT2 0x00000008 +#define SPC_TMASK_EXT3 0x00000010 +#define SPC_TMASK_EXT4 0x00000020 +#define SPC_TMASK_XIO0 0x00000100 +#define SPC_TMASK_XIO1 0x00000200 +#define SPC_TMASK_XIO2 0x00000400 +#define SPC_TMASK_XIO3 0x00000800 +#define SPC_TMASK_XIO4 0x00001000 +#define SPC_TMASK_XIO5 0x00002000 +#define SPC_TMASK_XIO6 0x00004000 +#define SPC_TMASK_XIO7 0x00008000 +#define SPC_TMASK_PXI0 0x00100000 +#define SPC_TMASK_PXI1 0x00200000 +#define SPC_TMASK_PXI2 0x00400000 +#define SPC_TMASK_PXI3 0x00800000 +#define SPC_TMASK_PXI4 0x01000000 +#define SPC_TMASK_PXI5 0x02000000 +#define SPC_TMASK_PXI6 0x04000000 +#define SPC_TMASK_PXI7 0x08000000 +#define SPC_TMASK_PXISTAR 0x10000000 +#define SPC_TMASK_PXIDSTARB 0x20000000 + +#define SPC_TRIG_CH_AVAILORMASK0 40450l +#define SPC_TRIG_CH_AVAILORMASK1 40451l +#define SPC_TRIG_CH_ORMASK0 40460l +#define SPC_TRIG_CH_ORMASK1 40461l +#define SPC_TRIG_CH_AVAILANDMASK0 40470l +#define SPC_TRIG_CH_AVAILANDMASK1 40471l +#define SPC_TRIG_CH_ANDMASK0 40480l +#define SPC_TRIG_CH_ANDMASK1 40481l +#define SPC_TMASK0_NONE 0x00000000 +#define SPC_TMASK0_CH0 0x00000001 +#define SPC_TMASK0_CH1 0x00000002 +#define SPC_TMASK0_CH2 0x00000004 +#define SPC_TMASK0_CH3 0x00000008 +#define SPC_TMASK0_CH4 0x00000010 +#define SPC_TMASK0_CH5 0x00000020 +#define SPC_TMASK0_CH6 0x00000040 +#define SPC_TMASK0_CH7 0x00000080 +#define SPC_TMASK0_CH8 0x00000100 +#define SPC_TMASK0_CH9 0x00000200 +#define SPC_TMASK0_CH10 0x00000400 +#define SPC_TMASK0_CH11 0x00000800 +#define SPC_TMASK0_CH12 0x00001000 +#define SPC_TMASK0_CH13 0x00002000 +#define SPC_TMASK0_CH14 0x00004000 +#define SPC_TMASK0_CH15 0x00008000 +#define SPC_TMASK0_CH16 0x00010000 +#define SPC_TMASK0_CH17 0x00020000 +#define SPC_TMASK0_CH18 0x00040000 +#define SPC_TMASK0_CH19 0x00080000 +#define SPC_TMASK0_CH20 0x00100000 +#define SPC_TMASK0_CH21 0x00200000 +#define SPC_TMASK0_CH22 0x00400000 +#define SPC_TMASK0_CH23 0x00800000 +#define SPC_TMASK0_CH24 0x01000000 +#define SPC_TMASK0_CH25 0x02000000 +#define SPC_TMASK0_CH26 0x04000000 +#define SPC_TMASK0_CH27 0x08000000 +#define SPC_TMASK0_CH28 0x10000000 +#define SPC_TMASK0_CH29 0x20000000 +#define SPC_TMASK0_CH30 0x40000000 +#define SPC_TMASK0_CH31 0x80000000 + +#define SPC_TMASK1_NONE 0x00000000 +#define SPC_TMASK1_CH32 0x00000001 +#define SPC_TMASK1_CH33 0x00000002 +#define SPC_TMASK1_CH34 0x00000004 +#define SPC_TMASK1_CH35 0x00000008 +#define SPC_TMASK1_CH36 0x00000010 +#define SPC_TMASK1_CH37 0x00000020 +#define SPC_TMASK1_CH38 0x00000040 +#define SPC_TMASK1_CH39 0x00000080 +#define SPC_TMASK1_CH40 0x00000100 +#define SPC_TMASK1_CH41 0x00000200 +#define SPC_TMASK1_CH42 0x00000400 +#define SPC_TMASK1_CH43 0x00000800 +#define SPC_TMASK1_CH44 0x00001000 +#define SPC_TMASK1_CH45 0x00002000 +#define SPC_TMASK1_CH46 0x00004000 +#define SPC_TMASK1_CH47 0x00008000 +#define SPC_TMASK1_CH48 0x00010000 +#define SPC_TMASK1_CH49 0x00020000 +#define SPC_TMASK1_CH50 0x00040000 +#define SPC_TMASK1_CH51 0x00080000 +#define SPC_TMASK1_CH52 0x00100000 +#define SPC_TMASK1_CH53 0x00200000 +#define SPC_TMASK1_CH54 0x00400000 +#define SPC_TMASK1_CH55 0x00800000 +#define SPC_TMASK1_CH56 0x01000000 +#define SPC_TMASK1_CH57 0x02000000 +#define SPC_TMASK1_CH58 0x04000000 +#define SPC_TMASK1_CH59 0x08000000 +#define SPC_TMASK1_CH60 0x10000000 +#define SPC_TMASK1_CH61 0x20000000 +#define SPC_TMASK1_CH62 0x40000000 +#define SPC_TMASK1_CH63 0x80000000 + +#define SPC_TRIG_EXT_AVAILMODES 40500l +#define SPC_TRIG_EXT0_AVAILMODES 40500l +#define SPC_TRIG_EXT1_AVAILMODES 40501l +#define SPC_TRIG_EXT2_AVAILMODES 40502l +#define SPC_TRIG_EXT0_AVAILMODESOR 40503l +#define SPC_TRIG_EXT1_AVAILMODESOR 40504l +#define SPC_TRIG_EXT2_AVAILMODESOR 40505l +#define SPC_TRIG_EXT0_AVAILMODESAND 40506l +#define SPC_TRIG_EXT1_AVAILMODESAND 40507l +#define SPC_TRIG_EXT2_AVAILMODESAND 40508l +#define SPC_TRIG_EXT3_AVAILMODESAND 40509l +#define SPC_TRIG_EXT0_MODE 40510l +#define SPC_TRIG_EXT1_MODE 40511l +#define SPC_TRIG_EXT2_MODE 40512l +#define SPC_TRIG_EXT3_MODE 40513l +#define SPC_TRIG_EXT3_AVAILMODES 40514l +#define SPC_TRIG_EXT3_AVAILMODESOR 40515l +#define SPC_TRIG_EXT4_AVAILMODES 40516l +#define SPC_TRIG_EXT4_AVAILMODESOR 40517l +#define SPC_TRIG_EXT4_AVAILMODESAND 40518l +#define SPC_TRIG_EXT4_MODE 40519l + +#define SPC_TRIG_EXT0_READFEATURES 40520l +#define SPC_TRIG_EXT1_READFEATURES 40521l +#define SPC_TRIG_EXT2_READFEATURES 40522l +#define SPC_TRIG_EXT3_READFEATURES 40523l +#define SPC_TRIG_EXT4_READFEATURES 40524l +#define SPCM_TRFEAT_TERM 0x00000001 +#define SPCM_TRFEAT_HIGHIMP 0x00000002 +#define SPCM_TRFEAT_DCCOUPLING 0x00000004 +#define SPCM_TRFEAT_ACCOUPLING 0x00000008 +#define SPCM_TRFEAT_SE 0x00000010 +#define SPCM_TRFEAT_DIFF 0x00000020 +#define SPCM_TRFEAT_LEVELPROG 0x00000100 +#define SPCM_TRFEAT_PROGTHRESHOLD 0x00000200 + +// legacy constants: not enough contiguous constants possible for X4..X19 +#define SPC_LEGACY_X0_READFEATURES 40530l +#define SPC_LEGACY_X1_READFEATURES 40531l +#define SPC_LEGACY_X2_READFEATURES 40532l +#define SPC_LEGACY_X3_READFEATURES 40533l + +// legacy constants: not enough contiguous constants possible for X4..X19 +#define SPC_LEGACY_X0_TERM 40535l +#define SPC_LEGACY_X1_TERM 40536l +#define SPC_LEGACY_X2_TERM 40537l +#define SPC_LEGACY_X3_TERM 40538l + +#define SPC_TRIG_XIO_AVAILMODES 40550l +#define SPC_TRIG_XIO_AVAILMODESOR 40551l +#define SPC_TRIG_XIO_AVAILMODESAND 40552l +#define SPC_TRIG_XIO0_MODE 40560l +#define SPC_TRIG_XIO1_MODE 40561l +#define SPC_TM_MODEMASK 0x00FFFFFF +#define SPC_TM_NONE 0x00000000 +#define SPC_TM_POS 0x00000001 +#define SPC_TM_NEG 0x00000002 +#define SPC_TM_BOTH 0x00000004 +#define SPC_TM_HIGH 0x00000008 +#define SPC_TM_LOW 0x00000010 +#define SPC_TM_WINENTER 0x00000020 +#define SPC_TM_WINLEAVE 0x00000040 +#define SPC_TM_INWIN 0x00000080 +#define SPC_TM_OUTSIDEWIN 0x00000100 +#define SPC_TM_SPIKE 0x00000200 +#define SPC_TM_PATTERN 0x00000400 +#define SPC_TM_STEEPPOS 0x00000800 +#define SPC_TM_STEEPNEG 0x00001000 +#define SPC_TM_EXTRAMASK 0xFF000000 +#define SPC_TM_REARM 0x01000000 +#define SPC_TM_PW_SMALLER 0x02000000 +#define SPC_TM_PW_GREATER 0x04000000 +#define SPC_TM_DOUBLEEDGE 0x08000000 +#define SPC_TM_PULSESTRETCH 0x10000000 +#define SPC_TM_HYSTERESIS 0x20000000 + +#define SPC_TRIG_PATTERN_AVAILMODES 40580l +#define SPC_TRIG_PATTERN_MODE 40590l + +#define SPC_TRIG_CH_AVAILMODES 40600l +#define SPC_TRIG_CH_AVAILMODESOR 40601l +#define SPC_TRIG_CH_AVAILMODESAND 40602l +#define SPC_TRIG_CH0_MODE 40610l +#define SPC_TRIG_CH1_MODE 40611l +#define SPC_TRIG_CH2_MODE 40612l +#define SPC_TRIG_CH3_MODE 40613l +#define SPC_TRIG_CH4_MODE 40614l +#define SPC_TRIG_CH5_MODE 40615l +#define SPC_TRIG_CH6_MODE 40616l +#define SPC_TRIG_CH7_MODE 40617l +#define SPC_TRIG_CH8_MODE 40618l +#define SPC_TRIG_CH9_MODE 40619l +#define SPC_TRIG_CH10_MODE 40620l +#define SPC_TRIG_CH11_MODE 40621l +#define SPC_TRIG_CH12_MODE 40622l +#define SPC_TRIG_CH13_MODE 40623l +#define SPC_TRIG_CH14_MODE 40624l +#define SPC_TRIG_CH15_MODE 40625l +#define SPC_TRIG_CH16_MODE 40626l +#define SPC_TRIG_CH17_MODE 40627l +#define SPC_TRIG_CH18_MODE 40628l +#define SPC_TRIG_CH19_MODE 40629l +#define SPC_TRIG_CH20_MODE 40630l +#define SPC_TRIG_CH21_MODE 40631l +#define SPC_TRIG_CH22_MODE 40632l +#define SPC_TRIG_CH23_MODE 40633l +#define SPC_TRIG_CH24_MODE 40634l +#define SPC_TRIG_CH25_MODE 40635l +#define SPC_TRIG_CH26_MODE 40636l +#define SPC_TRIG_CH27_MODE 40637l +#define SPC_TRIG_CH28_MODE 40638l +#define SPC_TRIG_CH29_MODE 40639l +#define SPC_TRIG_CH30_MODE 40640l +#define SPC_TRIG_CH31_MODE 40641l + +#define SPC_TRIG_CH32_MODE 40642l +#define SPC_TRIG_CH33_MODE 40643l +#define SPC_TRIG_CH34_MODE 40644l +#define SPC_TRIG_CH35_MODE 40645l +#define SPC_TRIG_CH36_MODE 40646l +#define SPC_TRIG_CH37_MODE 40647l +#define SPC_TRIG_CH38_MODE 40648l +#define SPC_TRIG_CH39_MODE 40649l +#define SPC_TRIG_CH40_MODE 40650l +#define SPC_TRIG_CH41_MODE 40651l +#define SPC_TRIG_CH42_MODE 40652l +#define SPC_TRIG_CH43_MODE 40653l +#define SPC_TRIG_CH44_MODE 40654l +#define SPC_TRIG_CH45_MODE 40655l +#define SPC_TRIG_CH46_MODE 40656l +#define SPC_TRIG_CH47_MODE 40657l +#define SPC_TRIG_CH48_MODE 40658l +#define SPC_TRIG_CH49_MODE 40659l +#define SPC_TRIG_CH50_MODE 40660l +#define SPC_TRIG_CH51_MODE 40661l +#define SPC_TRIG_CH52_MODE 40662l +#define SPC_TRIG_CH53_MODE 40663l +#define SPC_TRIG_CH54_MODE 40664l +#define SPC_TRIG_CH55_MODE 40665l +#define SPC_TRIG_CH56_MODE 40666l +#define SPC_TRIG_CH57_MODE 40667l +#define SPC_TRIG_CH58_MODE 40668l +#define SPC_TRIG_CH59_MODE 40669l +#define SPC_TRIG_CH60_MODE 40670l +#define SPC_TRIG_CH61_MODE 40671l +#define SPC_TRIG_CH62_MODE 40672l +#define SPC_TRIG_CH63_MODE 40673l + + +#define SPC_TRIG_AVAILDELAY 40800l +#define SPC_TRIG_AVAILDELAY_STEP 40801l +#define SPC_TRIG_DELAY 40810l + +#define SPC_TRIG_AVAILHOLDOFF 40802l +#define SPC_TRIG_AVAILHOLDOFF_STEP 40803l +#define SPC_TRIG_HOLDOFF 40811l + +#define SPC_SINGLESHOT 41000l +#define SPC_OUTONTRIGGER 41100l +#define SPC_RESTARTCONT 41200l +#define SPC_SINGLERESTART 41300l + +#define SPC_TRIGGERLEVEL 42000l +#define SPC_TRIGGERLEVEL0 42000l +#define SPC_TRIGGERLEVEL1 42001l +#define SPC_TRIGGERLEVEL2 42002l +#define SPC_TRIGGERLEVEL3 42003l +#define SPC_TRIGGERLEVEL4 42004l +#define SPC_TRIGGERLEVEL5 42005l +#define SPC_TRIGGERLEVEL6 42006l +#define SPC_TRIGGERLEVEL7 42007l +#define SPC_TRIGGERLEVEL8 42008l +#define SPC_TRIGGERLEVEL9 42009l +#define SPC_TRIGGERLEVEL10 42010l +#define SPC_TRIGGERLEVEL11 42011l +#define SPC_TRIGGERLEVEL12 42012l +#define SPC_TRIGGERLEVEL13 42013l +#define SPC_TRIGGERLEVEL14 42014l +#define SPC_TRIGGERLEVEL15 42015l + +#define SPC_AVAILHIGHLEVEL_MIN 41997l +#define SPC_AVAILHIGHLEVEL_MAX 41998l +#define SPC_AVAILHIGHLEVEL_STEP 41999l + +#define SPC_HIGHLEVEL0 42000l +#define SPC_HIGHLEVEL1 42001l +#define SPC_HIGHLEVEL2 42002l +#define SPC_HIGHLEVEL3 42003l +#define SPC_HIGHLEVEL4 42004l +#define SPC_HIGHLEVEL5 42005l +#define SPC_HIGHLEVEL6 42006l +#define SPC_HIGHLEVEL7 42007l +#define SPC_HIGHLEVEL8 42008l +#define SPC_HIGHLEVEL9 42009l +#define SPC_HIGHLEVEL10 42010l +#define SPC_HIGHLEVEL11 42011l +#define SPC_HIGHLEVEL12 42012l +#define SPC_HIGHLEVEL13 42013l +#define SPC_HIGHLEVEL14 42014l +#define SPC_HIGHLEVEL15 42015l + +#define SPC_AVAILLOWLEVEL_MIN 42097l +#define SPC_AVAILLOWLEVEL_MAX 42098l +#define SPC_AVAILLOWLEVEL_STEP 42099l + +#define SPC_LOWLEVEL0 42100l +#define SPC_LOWLEVEL1 42101l +#define SPC_LOWLEVEL2 42102l +#define SPC_LOWLEVEL3 42103l +#define SPC_LOWLEVEL4 42104l +#define SPC_LOWLEVEL5 42105l +#define SPC_LOWLEVEL6 42106l +#define SPC_LOWLEVEL7 42107l +#define SPC_LOWLEVEL8 42108l +#define SPC_LOWLEVEL9 42109l +#define SPC_LOWLEVEL10 42110l +#define SPC_LOWLEVEL11 42111l +#define SPC_LOWLEVEL12 42112l +#define SPC_LOWLEVEL13 42113l +#define SPC_LOWLEVEL14 42114l +#define SPC_LOWLEVEL15 42115l + +#define SPC_TRIG_CH0_LEVEL0 42200l +#define SPC_TRIG_CH1_LEVEL0 42201l +#define SPC_TRIG_CH2_LEVEL0 42202l +#define SPC_TRIG_CH3_LEVEL0 42203l +#define SPC_TRIG_CH4_LEVEL0 42204l +#define SPC_TRIG_CH5_LEVEL0 42205l +#define SPC_TRIG_CH6_LEVEL0 42206l +#define SPC_TRIG_CH7_LEVEL0 42207l +#define SPC_TRIG_CH8_LEVEL0 42208l +#define SPC_TRIG_CH9_LEVEL0 42209l +#define SPC_TRIG_CH10_LEVEL0 42210l +#define SPC_TRIG_CH11_LEVEL0 42211l +#define SPC_TRIG_CH12_LEVEL0 42212l +#define SPC_TRIG_CH13_LEVEL0 42213l +#define SPC_TRIG_CH14_LEVEL0 42214l +#define SPC_TRIG_CH15_LEVEL0 42215l + +#define SPC_TRIG_CH0_LEVEL1 42300l +#define SPC_TRIG_CH1_LEVEL1 42301l +#define SPC_TRIG_CH2_LEVEL1 42302l +#define SPC_TRIG_CH3_LEVEL1 42303l +#define SPC_TRIG_CH4_LEVEL1 42304l +#define SPC_TRIG_CH5_LEVEL1 42305l +#define SPC_TRIG_CH6_LEVEL1 42306l +#define SPC_TRIG_CH7_LEVEL1 42307l +#define SPC_TRIG_CH8_LEVEL1 42308l +#define SPC_TRIG_CH9_LEVEL1 42309l +#define SPC_TRIG_CH10_LEVEL1 42310l +#define SPC_TRIG_CH11_LEVEL1 42311l +#define SPC_TRIG_CH12_LEVEL1 42312l +#define SPC_TRIG_CH13_LEVEL1 42313l +#define SPC_TRIG_CH14_LEVEL1 42314l +#define SPC_TRIG_CH15_LEVEL1 42315l + +#define SPC_TRIG_EXT0_LEVEL0 42320l +#define SPC_TRIG_EXT1_LEVEL0 42321l +#define SPC_TRIG_EXT2_LEVEL0 42322l + +#define SPC_TRIG_EXT0_LEVEL1 42330l +#define SPC_TRIG_EXT1_LEVEL1 42331l +#define SPC_TRIG_EXT2_LEVEL1 42332l + +#define SPC_TRIG_EXT_AVAIL0_MIN 42340l +#define SPC_TRIG_EXT_AVAIL0_MAX 42341l +#define SPC_TRIG_EXT_AVAIL0_STEP 42342l + +#define SPC_TRIG_EXT_AVAIL1_MIN 42345l +#define SPC_TRIG_EXT_AVAIL1_MAX 42346l +#define SPC_TRIG_EXT_AVAIL1_STEP 42347l + +// threshold levels (for 77xx) +#define SPC_THRESHOLD0 42400l // threshold level for channel group 0 +#define SPC_THRESHOLD1 42401l // threshold level for channel group 1 +#define SPC_THRESHOLD2 42402l // threshold level for channel group 2 +#define SPC_THRESHOLD3 42403l // threshold level for channel group 3 +#define SPC_CLOCK_THRESHOLD 42410l // threshold level for clock input +#define SPC_TRIG_THRESHOLD 42411l // threshold level for trigger input +#define SPC_X0X1_THRESHOLD 42412l // threshold level for X0/X1 input +#define SPC_STROBE_THRESHOLD 42413l // threshold level for strobe input + +#define SPC_AVAILTHRESHOLD_MIN 42420l +#define SPC_AVAILTHRESHOLD_MAX 42421l +#define SPC_AVAILTHRESHOLD_STEP 42422l + +#define SPC_AVAILAVRGMODES 42429l +#define SPC_AVRGMODE_CH0 42430l +#define SPC_AVRGMODE_CH1 42431l +#define SPC_AVRGMODE_CH2 42432l +#define SPC_AVRGMODE_CH3 42433l +#define AVRGMODE_NORMAL 0x0l // normal block averaging +#define AVRGMODE_TDA_HIGH 0x1l // threshold defined averaging: (samples > threshhold) will be used, others replaced +#define AVRGMODE_TDA_LOW 0x2l // threshold defined averaging: (samples <= threshhold) will be used, others replaced + +#define SPC_TDA_THRESHOLD_CH0 42440l // threshhold for threshold defined averaging in LSB of ADC +#define SPC_TDA_THRESHOLD_CH1 42441l +#define SPC_TDA_THRESHOLD_CH2 42442l +#define SPC_TDA_THRESHOLD_CH3 42443l + +#define SPC_TDA_REPLACEMENT_CH0 42450l // replacement sample value for threshold defined averaging in LSB of ADC +#define SPC_TDA_REPLACEMENT_CH1 42451l +#define SPC_TDA_REPLACEMENT_CH2 42452l +#define SPC_TDA_REPLACEMENT_CH3 42453l + +#define SPC_CLOCK_AVAILTHRESHOLD_MIN 42423l +#define SPC_CLOCK_AVAILTHRESHOLD_MAX 42424l +#define SPC_CLOCK_AVAILTHRESHOLD_STEP 42425l + +#define SPC_TRIG_AVAILTHRESHOLD_MIN 42426l +#define SPC_TRIG_AVAILTHRESHOLD_MAX 42427l +#define SPC_TRIG_AVAILTHRESHOLD_STEP 42428l + +#define SPC_TRIGGERPATTERN 43000l +#define SPC_TRIGGERPATTERN0 43000l +#define SPC_TRIGGERPATTERN1 43001l +#define SPC_TRIGGERMASK 43100l +#define SPC_TRIGGERMASK0 43100l +#define SPC_TRIGGERMASK1 43101l + +#define SPC_PULSEWIDTH 44000l +#define SPC_PULSEWIDTH0 44000l +#define SPC_PULSEWIDTH1 44001l + +#define SPC_TRIG_CH_AVAILPULSEWIDTH 44100l +#define SPC_TRIG_CH_PULSEWIDTH 44101l +#define SPC_TRIG_CH0_PULSEWIDTH 44101l +#define SPC_TRIG_CH1_PULSEWIDTH 44102l +#define SPC_TRIG_CH2_PULSEWIDTH 44103l +#define SPC_TRIG_CH3_PULSEWIDTH 44104l +#define SPC_TRIG_CH4_PULSEWIDTH 44105l +#define SPC_TRIG_CH5_PULSEWIDTH 44106l +#define SPC_TRIG_CH6_PULSEWIDTH 44107l +#define SPC_TRIG_CH7_PULSEWIDTH 44108l +#define SPC_TRIG_CH8_PULSEWIDTH 44109l +#define SPC_TRIG_CH9_PULSEWIDTH 44110l +#define SPC_TRIG_CH10_PULSEWIDTH 44111l +#define SPC_TRIG_CH11_PULSEWIDTH 44112l +#define SPC_TRIG_CH12_PULSEWIDTH 44113l +#define SPC_TRIG_CH13_PULSEWIDTH 44114l +#define SPC_TRIG_CH14_PULSEWIDTH 44115l +#define SPC_TRIG_CH15_PULSEWIDTH 44116l + +#define SPC_TRIG_EXT_AVAILPULSEWIDTH 44200l +#define SPC_TRIG_EXT0_PULSEWIDTH 44210l +#define SPC_TRIG_EXT1_PULSEWIDTH 44211l +#define SPC_TRIG_EXT2_PULSEWIDTH 44212l +#define SPC_TRIG_EXT3_PULSEWIDTH 44213l + +// available dividers for MICX +#define SPC_READCLOCKDIVCOUNT 44300l +#define SPC_CLOCKDIV0 44301l +#define SPC_CLOCKDIV1 44302l +#define SPC_CLOCKDIV2 44303l +#define SPC_CLOCKDIV3 44304l +#define SPC_CLOCKDIV4 44305l +#define SPC_CLOCKDIV5 44306l +#define SPC_CLOCKDIV6 44307l +#define SPC_CLOCKDIV7 44308l +#define SPC_CLOCKDIV8 44309l +#define SPC_CLOCKDIV9 44310l +#define SPC_CLOCKDIV10 44311l +#define SPC_CLOCKDIV11 44312l +#define SPC_CLOCKDIV12 44313l +#define SPC_CLOCKDIV13 44314l +#define SPC_CLOCKDIV14 44315l +#define SPC_CLOCKDIV15 44316l +#define SPC_CLOCKDIV16 44317l + +#define SPC_READTROFFSET 45000l +#define SPC_TRIGGEREDGE 46000l +#define SPC_TRIGGEREDGE0 46000l +#define SPC_TRIGGEREDGE1 46001l +#define TE_POS 10000l +#define TE_NEG 10010l +#define TE_BOTH 10020l +#define TE_NONE 10030l + + +// ----- Timestamp ----- +#define CH_TIMESTAMP 9999l + +#define SPC_TIMESTAMP_CMD 47000l +#define TS_RESET 0l +#define TS_MODE_DISABLE 10l +#define TS_MODE_STARTRESET 11l +#define TS_MODE_STANDARD 12l +#define TS_MODE_REFCLOCK 13l +#define TS_MODE_TEST5555 90l +#define TS_MODE_TESTAAAA 91l +#define TS_MODE_ZHTEST 92l + +// ----- modes for M2i, M3i, M4i, M4x, M2p hardware (bitmap) ----- +#define SPC_TIMESTAMP_AVAILMODES 47001l +#define SPC_TSMODE_DISABLE 0x00000000 +#define SPC_TS_RESET 0x00000001 +#define SPC_TSMODE_STANDARD 0x00000002 +#define SPC_TSMODE_STARTRESET 0x00000004 +#define SPC_TS_RESET_WAITREFCLK 0x00000008 +#define SPC_TSCNT_INTERNAL 0x00000100 +#define SPC_TSCNT_REFCLOCKPOS 0x00000200 +#define SPC_TSCNT_REFCLOCKNEG 0x00000400 +#define SPC_TSFEAT_NONE 0x00000000 +#define SPC_TSFEAT_STORE1STABA 0x00010000 +#define SPC_TSFEAT_INCRMODE 0x00020000 +#define SPC_TSFEAT_INCRMODE12 0x00040000 +#define SPC_TSFEAT_TRGSRC 0x00080000 + +#define SPC_TSXIOACQ_DISABLE 0x00000000 +#define SPC_TSXIOACQ_ENABLE 0x00001000 +#define SPC_TSXIOINC_ENABLE 0x00002000 +#define SPC_TSXIOINC12_ENABLE 0x00004000 + +#define SPC_TSMODE_MASK 0x000000FF +#define SPC_TSCNT_MASK 0x00000F00 +#define SPC_TSFEAT_MASK 0x000F0000 + +#define SPC_TRGSRC_MASK_CH0 0x00000001 +#define SPC_TRGSRC_MASK_CH1 0x00000002 +#define SPC_TRGSRC_MASK_CH2 0x00000004 +#define SPC_TRGSRC_MASK_CH3 0x00000008 +#define SPC_TRGSRC_MASK_CH4 0x00000010 +#define SPC_TRGSRC_MASK_CH5 0x00000020 +#define SPC_TRGSRC_MASK_CH6 0x00000040 +#define SPC_TRGSRC_MASK_CH7 0x00000080 +#define SPC_TRGSRC_MASK_EXT0 0x00000100 +#define SPC_TRGSRC_MASK_EXT1 0x00000200 +#define SPC_TRGSRC_MASK_FORCE 0x00000400 +// space for digital channels using TSXIOACQ_ENABLE of standard multi-purpose lines +#define SPC_TRGSRC_MASK_PXI0 0x00010000 +#define SPC_TRGSRC_MASK_PXI1 0x00020000 +#define SPC_TRGSRC_MASK_PXI2 0x00040000 +#define SPC_TRGSRC_MASK_PXI3 0x00080000 +#define SPC_TRGSRC_MASK_PXI4 0x00100000 +#define SPC_TRGSRC_MASK_PXI5 0x00200000 +#define SPC_TRGSRC_MASK_PXI6 0x00400000 +#define SPC_TRGSRC_MASK_PXI7 0x00800000 +#define SPC_TRGSRC_MASK_PXISTAR 0x01000000 +#define SPC_TRGSRC_MASK_PXIDSTARB 0x02000000 +#define SPC_TRGSRC_MASK_X0 0x10000000 +#define SPC_TRGSRC_MASK_X1 0x20000000 +#define SPC_TRGSRC_MASK_X2 0x40000000 +#define SPC_TRGSRC_MASK_X3 0x80000000 +// space for more digital channels using TSXIOACQ_ENABLE of additional multi-purpose lines (optional) + + +#define SPC_TIMESTAMP_STATUS 47010l +#define TS_FIFO_EMPTY 0l +#define TS_FIFO_LESSHALF 1l +#define TS_FIFO_MOREHALF 2l +#define TS_FIFO_OVERFLOW 3l + +#define SPC_TIMESTAMP_COUNT 47020l +#define SPC_TIMESTAMP_STARTTIME 47030l +#define SPC_TIMESTAMP_STARTDATE 47031l +#define SPC_TIMESTAMP_FIFO 47040l +#define SPC_TIMESTAMP_TIMEOUT 47045l + +#define SPC_TIMESTAMP_RESETMODE 47050l +#define TS_RESET_POS 10l +#define TS_RESET_NEG 20l + + + +// ----- Extra I/O module ----- +#define SPC_XIO_DIRECTION 47100l +#define XD_CH0_INPUT 0l +#define XD_CH0_OUTPUT 1l +#define XD_CH1_INPUT 0l +#define XD_CH1_OUTPUT 2l +#define XD_CH2_INPUT 0l +#define XD_CH2_OUTPUT 4l +#define SPC_XIO_DIGITALIO 47110l +#define SPC_XIO_ANALOGOUT0 47120l +#define SPC_XIO_ANALOGOUT1 47121l +#define SPC_XIO_ANALOGOUT2 47122l +#define SPC_XIO_ANALOGOUT3 47123l +#define SPC_XIO_WRITEDACS 47130l + + + +// ----- M3i multi purpose lines (X0, X1 ) +// ----- M4i + M4x multi purpose lines (X0, X1, X2 ) +// ----- M2p multi purpose lines (X0, X1, X2, X3) and with installed option also (X4 .. X19) + +// legacy constants: not enough contiguous constants possible for X4..X19, +// hence new constants for X-modes (SPCM_X0_MODE.. SPCM_X19_MODE) exist further below +#define SPCM_LEGACY_X0_MODE 47200l +#define SPCM_LEGACY_X1_MODE 47201l +#define SPCM_LEGACY_X2_MODE 47202l +#define SPCM_LEGACY_X3_MODE 47203l +#define SPCM_LEGACY_X0_AVAILMODES 47210l +#define SPCM_LEGACY_X1_AVAILMODES 47211l +#define SPCM_LEGACY_X2_AVAILMODES 47212l +#define SPCM_LEGACY_X3_AVAILMODES 47213l +#define SPCM_XMODE_DISABLE 0x00000000 +#define SPCM_XMODE_ASYNCIN 0x00000001 // used as asynchronous input +#define SPCM_XMODE_ASYNCOUT 0x00000002 // used as asynchronous output +#define SPCM_XMODE_DIGIN 0x00000004 // used as synchronous digital input +#define SPCM_XMODE_DIGOUT 0x00000008 // used as synchronous digital output +#define SPCM_XMODE_TRIGIN 0x00000010 // used as trigger input +#define SPCM_XMODE_TRIGOUT 0x00000020 // used as trigger output +#define SPCM_XMODE_OVROUT 0x00000040 // used as ADC overrange output +#define SPCM_XMODE_DIGIN2BIT 0x00000080 // used as synchronous digital input, 2bits per channel +#define SPCM_XMODE_RUNSTATE 0x00000100 // shows the run state of the card (high = run) +#define SPCM_XMODE_ARMSTATE 0x00000200 // shows the arm state (high = armed for trigger of one single card) +#define SPCM_XMODE_DIRECTTRIGOUT 0x00000400 // used as direct trigger output (safe mode) +#define SPCM_XMODE_DIRECTTRIGOUT_LR 0x00000800 // used as direct trigger output (low re-arm) +#define SPCM_XMODE_REFCLKOUT 0x00001000 // outputs internal or fed in external refclock +#define SPCM_XMODE_CONTOUTMARK 0x00002000 // outputs a half posttrigger long HIGH pulse on replay +#define SPCM_XMODE_SYSCLKOUT 0x00004000 // outputs internal system clock +#define SPCM_XMODE_CLKOUT 0x00008000 // clock output +#define SPCM_XMODE_SYNCARMSTATE 0x00010000 // shows the arm state (high = armed for trigger when all cards connected to a Star-Hub are armed) +#define SPCM_XMODE_OPTDIGIN2BIT 0x00020000 // used as synchronous digital input from digitaloption, 2bits per channel +#define SPCM_XMODE_OPTDIGIN4BIT 0x00040000 // used as synchronous digital input from digitaloption, 4bits per channel +#define SPCM_XMODE_PULSEGEN 0x00080000 // output of pulse generator +#define SPCM_XMODE_MODEMASK 0x000FFFFF + +// additional constants to be combined together with SPCM_XMODE_DIGOUT to select analog channel containing digital data +#define SPCM_XMODE_DIGOUTSRC_CH0 0x01000000 // Select Ch0 as source +#define SPCM_XMODE_DIGOUTSRC_CH1 0x02000000 // Select Ch1 as source +#define SPCM_XMODE_DIGOUTSRC_CH2 0x04000000 // Select Ch2 as source +#define SPCM_XMODE_DIGOUTSRC_CH3 0x08000000 // Select Ch3 as source +#define SPCM_XMODE_DIGOUTSRC_CH4 0x10000000 // Select Ch4 as source +#define SPCM_XMODE_DIGOUTSRC_CH5 0x20000000 // Select Ch5 as source +#define SPCM_XMODE_DIGOUTSRC_CH6 0x40000000 // Select Ch6 as source +#define SPCM_XMODE_DIGOUTSRC_CH7 0x80000000 // Select Ch7 as source +#define SPCM_XMODE_DIGOUTSRC_CHMASK 0xFF000000 + +// additional constants to be combined together with SPCM_XMODE_DIGOUT to select digital signal source +#define SPCM_XMODE_DIGOUTSRC_BIT15 0x00100000 // Use Bit15 (MSB ) of selected channel: channel resolution will be reduced to 15 bit +#define SPCM_XMODE_DIGOUTSRC_BIT14 0x00200000 // Use Bit14 (MSB - 1) of selected channel: channel resolution will be reduced to 14 bit +#define SPCM_XMODE_DIGOUTSRC_BIT13 0x00400000 // Use Bit13 (MSB - 2) of selected channel: channel resolution will be reduced to 13 bit +#define SPCM_XMODE_DIGOUTSRC_BIT12 0x00800000 // Use Bit12 (MSB - 3) of selected channel: channel resolution will be reduced to 12 bit +#define SPCM_XMODE_DIGOUTSRC_BITMASK 0x00F00000 +// special combinations for M2p.65xx cards with options SPCM_FEAT_DIG16_SMB or SPCM_FEAT_DIG16_FX2 +#define SPCM_XMODE_DIGOUTSRC_BIT15_downto_0 0x00F00000 // use all 16 bits of selected channel on (X19..X4) : channel will only contain digital data +#define SPCM_XMODE_DIGOUTSRC_BIT15_downto_8 0x00700000 // use upper 8 bits of selected channel for (X19..X12) or (X11..X4): channel resolution will be reduced to 8 bit + +#define SPCM_XX_ASYNCIO 47220l // asynchronous in/out register + +#define SPC_DIGMODE0 47250l +#define SPC_DIGMODE1 47251l +#define SPC_DIGMODE2 47252l +#define SPC_DIGMODE3 47253l +#define SPC_DIGMODE4 47254l +#define SPC_DIGMODE5 47255l +#define SPC_DIGMODE6 47256l +#define SPC_DIGMODE7 47257l +#define SPCM_DIGMODE_OFF 0x00000000 +#define SPCM_DIGMODE_X0 0x21084000 // (M2P_DIGMODE_X0 << (32 - 5)) | (M2P_DIGMODE_X0 << (32 - 10)) | (M2P_DIGMODE_X0 << (32 - 15)) | (M2P_DIGMODE_X0 << (32 - 20)) +#define SPCM_DIGMODE_X1 0x294A5000 // (M2P_DIGMODE_X1 << (32 - 5)) | (M2P_DIGMODE_X1 << (32 - 10)) | (M2P_DIGMODE_X1 << (32 - 15)) | (M2P_DIGMODE_X1 << (32 - 20)) +#define SPCM_DIGMODE_X2 0x318C6000 // (M2P_DIGMODE_X2 << (32 - 5)) | (M2P_DIGMODE_X2 << (32 - 10)) | (M2P_DIGMODE_X2 << (32 - 15)) | (M2P_DIGMODE_X2 << (32 - 20)) +#define SPCM_DIGMODE_X3 0x39CE7000 // (M2P_DIGMODE_X3 << (32 - 5)) | (M2P_DIGMODE_X3 << (32 - 10)) | (M2P_DIGMODE_X3 << (32 - 15)) | (M2P_DIGMODE_X3 << (32 - 20)) +#define SPCM_DIGMODE_X4 0x84210001 +#define SPCM_DIGMODE_X5 0x8c631002 +#define SPCM_DIGMODE_X6 0x94a52004 +#define SPCM_DIGMODE_X7 0x9ce73008 +#define SPCM_DIGMODE_X8 0xa5294010 +#define SPCM_DIGMODE_X9 0xad6b5020 +#define SPCM_DIGMODE_X10 0xb5ad6040 +#define SPCM_DIGMODE_X11 0xbdef7080 +#define SPCM_DIGMODE_X12 0xc6318100 +#define SPCM_DIGMODE_X13 0xce739200 +#define SPCM_DIGMODE_X14 0xd6b5a400 +#define SPCM_DIGMODE_X15 0xdef7b800 +#define SPCM_DIGMODE_X16 0xe739c000 +#define SPCM_DIGMODE_X17 0xef7bd000 +#define SPCM_DIGMODE_X18 0xf7bde000 +#define SPCM_DIGMODE_X19 0xfffff000 + +#define DIGMODEMASK_BIT15 0xF8000000 +#define DIGMODEMASK_BIT14 0x07C00000 +#define DIGMODEMASK_BIT13 0x003E0000 +#define DIGMODEMASK_BIT12 0x0001F000 +#define DIGMODEMASK_BIT11 0x00000800 // one bit only for bit 11 downto 0 +#define DIGMODEMASK_BIT10 0x00000400 +#define DIGMODEMASK_BIT9 0x00000200 +#define DIGMODEMASK_BIT8 0x00000100 +#define DIGMODEMASK_BIT7 0x00000080 +#define DIGMODEMASK_BIT6 0x00000040 +#define DIGMODEMASK_BIT5 0x00000020 +#define DIGMODEMASK_BIT4 0x00000010 +#define DIGMODEMASK_BIT3 0x00000008 +#define DIGMODEMASK_BIT2 0x00000004 +#define DIGMODEMASK_BIT1 0x00000002 +#define DIGMODEMASK_BIT0 0x00000001 + +// provided for convenience +#define SPCM_DIGMODE_CHREPLACE 0xFFBBCFFF +//#define SPCM_DIGMODE_CHREPLACE ( (DIGMODEMASK_BIT15 & SPCM_DIGMODE_X19) +// | (DIGMODEMASK_BIT14 & SPCM_DIGMODE_X18) +// | (DIGMODEMASK_BIT13 & SPCM_DIGMODE_X17) +// | (DIGMODEMASK_BIT12 & SPCM_DIGMODE_X16) +// | (DIGMODEMASK_BIT11 & SPCM_DIGMODE_X15) +// | (DIGMODEMASK_BIT10 & SPCM_DIGMODE_X14) +// | (DIGMODEMASK_BIT9 & SPCM_DIGMODE_X13) +// | (DIGMODEMASK_BIT8 & SPCM_DIGMODE_X12) +// | (DIGMODEMASK_BIT7 & SPCM_DIGMODE_X11) +// | (DIGMODEMASK_BIT6 & SPCM_DIGMODE_X10) +// | (DIGMODEMASK_BIT5 & SPCM_DIGMODE_X9 ) +// | (DIGMODEMASK_BIT4 & SPCM_DIGMODE_X8 ) +// | (DIGMODEMASK_BIT3 & SPCM_DIGMODE_X7 ) +// | (DIGMODEMASK_BIT2 & SPCM_DIGMODE_X6 ) +// | (DIGMODEMASK_BIT1 & SPCM_DIGMODE_X5 ) +// | (DIGMODEMASK_BIT0 & SPCM_DIGMODE_X4 ) ) +// + + +// ----- M4x PXI Trigger lines ----- +#define SPC_PXITRG0_MODE 47300l +#define SPC_PXITRG1_MODE 47301l +#define SPC_PXITRG2_MODE 47302l +#define SPC_PXITRG3_MODE 47303l +#define SPC_PXITRG4_MODE 47304l +#define SPC_PXITRG5_MODE 47305l +#define SPC_PXITRG6_MODE 47306l +#define SPC_PXITRG7_MODE 47307l +#define SPC_PXISTAR_MODE 47308l +#define SPC_PXIDSTARC_MODE 47309l +#define SPC_PXITRG0_AVAILMODES 47310l +#define SPC_PXITRG1_AVAILMODES 47311l +#define SPC_PXITRG2_AVAILMODES 47312l +#define SPC_PXITRG3_AVAILMODES 47313l +#define SPC_PXITRG4_AVAILMODES 47314l +#define SPC_PXITRG5_AVAILMODES 47315l +#define SPC_PXITRG6_AVAILMODES 47316l +#define SPC_PXITRG7_AVAILMODES 47317l +#define SPC_PXISTAR_AVAILMODES 47318l +#define SPC_PXIDSTARC_AVAILMODES 47319l +#define SPC_PXITRG_ASYNCIO 47320l // asynchronous in/out register +#define SPCM_PXITRGMODE_DISABLE 0x00000000 +#define SPCM_PXITRGMODE_IN 0x00000001 // used as input +#define SPCM_PXITRGMODE_ASYNCOUT 0x00000002 // used as asynchronous output +#define SPCM_PXITRGMODE_RUNSTATE 0x00000004 // shows the run state of the card (high = run) +#define SPCM_PXITRGMODE_ARMSTATE 0x00000008 // shows the arm state (high = armed for trigger) +#define SPCM_PXITRGMODE_TRIGOUT 0x00000010 // used as trigger output +#define SPCM_PXITRGMODE_REFCLKOUT 0x00000020 // outputs PXI refclock (10 MHz) +#define SPCM_PXITRGMODE_CONTOUTMARK 0x00000040 // outputs a half posttrigger long HIGH pulse on replay + + +// ----- Star-Hub ----- +// 48000 not usable + +#define SPC_STARHUB_STATUS 48010l + +#define SPC_STARHUB_ROUTE0 48100l // Routing Information for Test +#define SPC_STARHUB_ROUTE99 48199l // ... + + +// Spcm driver (M2i, M3i, M4i, M4x, M2p) sync setup registers +#define SPC_SYNC_READ_SYNCCOUNT 48990l // number of sync'd cards +#define SPC_SYNC_READ_NUMCONNECTORS 48991l // number of connectors on starhub + +#define SPC_SYNC_READ_CARDIDX0 49000l // read index of card at location 0 of sync +#define SPC_SYNC_READ_CARDIDX1 49001l // ... +#define SPC_SYNC_READ_CARDIDX2 49002l // ... +#define SPC_SYNC_READ_CARDIDX3 49003l // ... +#define SPC_SYNC_READ_CARDIDX4 49004l // ... +#define SPC_SYNC_READ_CARDIDX5 49005l // ... +#define SPC_SYNC_READ_CARDIDX6 49006l // ... +#define SPC_SYNC_READ_CARDIDX7 49007l // ... +#define SPC_SYNC_READ_CARDIDX8 49008l // ... +#define SPC_SYNC_READ_CARDIDX9 49009l // ... +#define SPC_SYNC_READ_CARDIDX10 49010l // ... +#define SPC_SYNC_READ_CARDIDX11 49011l // ... +#define SPC_SYNC_READ_CARDIDX12 49012l // ... +#define SPC_SYNC_READ_CARDIDX13 49013l // ... +#define SPC_SYNC_READ_CARDIDX14 49014l // ... +#define SPC_SYNC_READ_CARDIDX15 49015l // ... + +#define SPC_SYNC_READ_CABLECON0 49100l // read cable connection of card at location 0 of sync +#define SPC_SYNC_READ_CABLECON1 49101l // ... +#define SPC_SYNC_READ_CABLECON2 49102l // ... +#define SPC_SYNC_READ_CABLECON3 49103l // ... +#define SPC_SYNC_READ_CABLECON4 49104l // ... +#define SPC_SYNC_READ_CABLECON5 49105l // ... +#define SPC_SYNC_READ_CABLECON6 49106l // ... +#define SPC_SYNC_READ_CABLECON7 49107l // ... +#define SPC_SYNC_READ_CABLECON8 49108l // ... +#define SPC_SYNC_READ_CABLECON9 49109l // ... +#define SPC_SYNC_READ_CABLECON10 49110l // ... +#define SPC_SYNC_READ_CABLECON11 49111l // ... +#define SPC_SYNC_READ_CABLECON12 49112l // ... +#define SPC_SYNC_READ_CABLECON13 49113l // ... +#define SPC_SYNC_READ_CABLECON14 49114l // ... +#define SPC_SYNC_READ_CABLECON15 49115l // ... + +#define SPC_SYNC_ENABLEMASK 49200l // synchronisation enable (mask) +#define SPC_SYNC_NOTRIGSYNCMASK 49210l // trigger disabled for sync (mask) +#define SPC_SYNC_CLKMASK 49220l // clock master (mask) +#define SPC_SYNC_MODE 49230l // synchronization mode +#define SPC_AVAILSYNC_MODES 49231l // available synchronization modes +#define SPC_SYNC_STANDARD 0x00000001 // starhub uses its own clock and trigger sources +#define SPC_SYNC_SYSTEMCLOCK 0x00000002 // starhub uses own trigger sources and takes clock from system starhub +#define SPC_SYNC_SYSTEMCLOCKTRIG 0x00000004 // starhub takes clock and trigger from system starhub (trigger sampled on rising clock edge) +#define SPC_SYNC_SYSTEMCLOCKTRIGN 0x00000008 // starhub takes clock and trigger from system starhub (trigger sampled on falling clock edge) +#define SPC_SYNC_SYSTEM_TRIGADJUST 49240l // Delay value for adjusting trigger position using system starhub + + +// ----- Gain and Offset Adjust DAC's ----- +#define SPC_ADJ_START 50000l + +#define SPC_ADJ_LOAD 50000l +#define SPC_ADJ_SAVE 50010l +#define ADJ_DEFAULT 0l +#define ADJ_USER0 1l +#define ADJ_USER1 2l +#define ADJ_USER2 3l +#define ADJ_USER3 4l +#define ADJ_USER4 5l +#define ADJ_USER5 6l +#define ADJ_USER6 7l +#define ADJ_USER7 8l + +#define SPC_ADJ_AUTOADJ 50020l +#define ADJ_ALL 0l +#define ADJ_CURRENT 1l +#define ADJ_EXTERNAL 2l +#define ADJ_1MOHM 3l + +#define ADJ_CURRENT_CLOCK 4l +#define ADJ_CURRENT_IR 8l +#define ADJ_OFFSET_ONLY 16l +#define ADJ_SPECIAL_CLOCK 32l + +#define SPC_ADJ_SOURCE_CALLBACK 50021l +#define SPC_ADJ_PROGRESS_CALLBACK 50022l + +#define SPC_ADJ_SET 50030l +#define SPC_ADJ_FAILMASK 50040l + +#define SPC_ADJ_CALIBSOURCE 50050l +#define ADJ_CALSRC_GAIN 1l +#define ADJ_CALSRC_OFF 0l +#define ADJ_CALSRC_GND -1l +#define ADJ_CALSRC_GNDOFFS -2l +#define ADJ_CALSRC_AC 10l +#define ADJ_CALSRC_ADC 11l + +#define SPC_ADJ_CALIBVALUE0 50060l +#define SPC_ADJ_CALIBVALUE1 50061l +#define SPC_ADJ_CALIBVALUE2 50062l +#define SPC_ADJ_CALIBVALUE3 50063l +#define SPC_ADJ_CALIBVALUE4 50064l +#define SPC_ADJ_CALIBVALUE5 50065l +#define SPC_ADJ_CALIBVALUE6 50066l +#define SPC_ADJ_CALIBVALUE7 50067l + +#define SPC_ADJ_OFFSET_CH0 50900l +#define SPC_ADJ_OFFSET_CH1 50901l +#define SPC_ADJ_OFFSET_CH2 50902l +#define SPC_ADJ_OFFSET_CH3 50903l +#define SPC_ADJ_OFFSET_CH4 50904l +#define SPC_ADJ_OFFSET_CH5 50905l +#define SPC_ADJ_OFFSET_CH6 50906l +#define SPC_ADJ_OFFSET_CH7 50907l +#define SPC_ADJ_OFFSET_CH8 50908l +#define SPC_ADJ_OFFSET_CH9 50909l +#define SPC_ADJ_OFFSET_CH10 50910l +#define SPC_ADJ_OFFSET_CH11 50911l +#define SPC_ADJ_OFFSET_CH12 50912l +#define SPC_ADJ_OFFSET_CH13 50913l +#define SPC_ADJ_OFFSET_CH14 50914l +#define SPC_ADJ_OFFSET_CH15 50915l + +#define SPC_ADJ_GAIN_CH0 50916l +#define SPC_ADJ_GAIN_CH1 50917l +#define SPC_ADJ_GAIN_CH2 50918l +#define SPC_ADJ_GAIN_CH3 50919l +#define SPC_ADJ_GAIN_CH4 50920l +#define SPC_ADJ_GAIN_CH5 50921l +#define SPC_ADJ_GAIN_CH6 50922l +#define SPC_ADJ_GAIN_CH7 50923l +#define SPC_ADJ_GAIN_CH8 50924l +#define SPC_ADJ_GAIN_CH9 50925l +#define SPC_ADJ_GAIN_CH10 50926l +#define SPC_ADJ_GAIN_CH11 50927l +#define SPC_ADJ_GAIN_CH12 50928l +#define SPC_ADJ_GAIN_CH13 50929l +#define SPC_ADJ_GAIN_CH14 50930l +#define SPC_ADJ_GAIN_CH15 50931l + +#define SPC_ADJ_OFFSET0 51000l +#define SPC_ADJ_OFFSET999 51999l + +#define SPC_ADJ_GAIN0 52000l +#define SPC_ADJ_GAIN999 52999l + +#define SPC_ADJ_CORRECT0 53000l +#define SPC_ADJ_OFFS_CORRECT0 53000l +#define SPC_ADJ_CORRECT999 53999l +#define SPC_ADJ_OFFS_CORRECT999 53999l + +#define SPC_ADJ_XIOOFFS0 54000l +#define SPC_ADJ_XIOOFFS1 54001l +#define SPC_ADJ_XIOOFFS2 54002l +#define SPC_ADJ_XIOOFFS3 54003l + +#define SPC_ADJ_XIOGAIN0 54010l +#define SPC_ADJ_XIOGAIN1 54011l +#define SPC_ADJ_XIOGAIN2 54012l +#define SPC_ADJ_XIOGAIN3 54013l + +#define SPC_ADJ_GAIN_CORRECT0 55000l +#define SPC_ADJ_GAIN_CORRECT999 55999l + +#define SPC_ADJ_OFFSCALIBCORRECT0 56000l +#define SPC_ADJ_OFFSCALIBCORRECT999 56999l + +#define SPC_ADJ_GAINCALIBCORRECT0 57000l +#define SPC_ADJ_GAINCALIBCORRECT999 57999l + +#define SPC_ADJ_ANALOGTRIGGER0 58000l +#define SPC_ADJ_ANALOGTRIGGER99 58099l + +#define SPC_ADJ_CALIBSAMPLERATE0 58100l +#define SPC_ADJ_CALIBSAMPLERATE99 58199l + +#define SPC_ADJ_CALIBSAMPLERATE_GAIN0 58200l +#define SPC_ADJ_CALIBSAMPLERATE_GAIN99 58299l + +#define SPC_ADJ_REFCLOCK 58300l +#define SPC_ADJ_STARHUB_REFCLOCK 58301l + +#define SPC_ADJ_END 59999l + + + +// ----- FIFO Control ----- +#define SPC_FIFO_BUFFERS 60000l // number of FIFO buffers +#define SPC_FIFO_BUFLEN 60010l // len of each FIFO buffer +#define SPC_FIFO_BUFCOUNT 60020l // number of FIFO buffers tranfered until now +#define SPC_FIFO_BUFMAXCNT 60030l // number of FIFO buffers to be transfered (0=continuous) +#define SPC_FIFO_BUFADRCNT 60040l // number of FIFO buffers allowed +#define SPC_FIFO_BUFREADY 60050l // fifo buffer ready register (same as SPC_COMMAND + SPC_FIFO_BUFREADY0...) +#define SPC_FIFO_BUFFILLCNT 60060l // number of currently filled buffers +#define SPC_FIFO_BUFADR0 60100l // adress of FIFO buffer no. 0 +#define SPC_FIFO_BUFADR1 60101l // ... +#define SPC_FIFO_BUFADR2 60102l // ... +#define SPC_FIFO_BUFADR3 60103l // ... +#define SPC_FIFO_BUFADR4 60104l // ... +#define SPC_FIFO_BUFADR5 60105l // ... +#define SPC_FIFO_BUFADR6 60106l // ... +#define SPC_FIFO_BUFADR7 60107l // ... +#define SPC_FIFO_BUFADR8 60108l // ... +#define SPC_FIFO_BUFADR9 60109l // ... +#define SPC_FIFO_BUFADR10 60110l // ... +#define SPC_FIFO_BUFADR11 60111l // ... +#define SPC_FIFO_BUFADR12 60112l // ... +#define SPC_FIFO_BUFADR13 60113l // ... +#define SPC_FIFO_BUFADR14 60114l // ... +#define SPC_FIFO_BUFADR15 60115l // ... +#define SPC_FIFO_BUFADR255 60355l // last + + + +// ----- Filter ----- +#define SPC_FILTER 100000l +#define SPC_READNUMFILTERS 100001l // number of programable filters +#define SPC_FILTERFREQUENCY0 100002l // frequency of filter 0 (bypass) +#define SPC_FILTERFREQUENCY1 100003l // frequency of filter 1 +#define SPC_FILTERFREQUENCY2 100004l // frequency of filter 2 +#define SPC_FILTERFREQUENCY3 100005l // frequency of filter 3 +#define SPC_DIGITALBWFILTER 100100l // enable/disable digital bandwith filter + + +// ----- Pattern ----- +#define SPC_PATTERNENABLE 110000l +#define SPC_READDIGITAL 110100l + +#define SPC_DIGITALMODE0 110200l +#define SPC_DIGITALMODE1 110201l +#define SPC_DIGITALMODE2 110202l +#define SPC_DIGITALMODE3 110203l +#define SPC_DIGITALMODE4 110204l +#define SPC_DIGITALMODE5 110205l +#define SPC_DIGITALMODE6 110206l +#define SPC_DIGITALMODE7 110207l +#define SPC_DIGITALMODE_OFF 0l +#define SPC_DIGITALMODE_2BIT 1l +#define SPC_DIGITALMODE_4BIT 2l +#define SPC_DIGITALMODE_CHREPLACE 3l + + +// ----- Miscellanous ----- +#define SPC_MISCDAC0 200000l +#define SPC_MISCDAC1 200010l +#define SPC_FACTORYMODE 200020l +#define SPC_DIRECTDAC 200030l +#define SPC_NOTRIGSYNC 200040l +#define SPC_DSPDIRECT 200100l +#define SPC_DMAPHYSICALADR 200110l +#define SPC_MICXCOMP_CLOSEBOARD 200119l +#define SPC_MICXCOMPATIBILITYMODE 200120l +#define SPC_TEST_FIFOSPEED 200121l +#define SPC_RELOADDEMO 200122l +#define SPC_OVERSAMPLINGFACTOR 200123l +#define SPC_ISMAPPEDCARD 200124l +#define SPCM_NOT_MAPPED 0l +#define SPCM_LOCAL_MAPPED 1l +#define SPCM_REMOTE_MAPPED 2l +#define SPC_GETTHREADHANDLE 200130l +#define SPC_GETKERNELHANDLE 200131l +#define SPC_XYZMODE 200200l +#define SPC_INVERTDATA 200300l +#define SPC_GATEMARKENABLE 200400l +#define SPC_GATE_LEN_ALIGNMENT 200401l +#define SPC_CONTOUTMARK 200450l +#define SPC_EXPANDINT32 200500l +#define SPC_NOPRETRIGGER 200600l +#define SPC_RELAISWAITTIME 200700l +#define SPC_DACWAITTIME 200710l +#define SPC_DELAY_US 200720l +#define SPC_ILAMODE 200800l +#define SPC_NMDGMODE 200810l +#define SPC_CKADHALF_OUTPUT 200820l +#define SPC_LONGTRIG_OUTPUT 200830l +#define SPC_STOREMODAENDOFSEGMENT 200840l +#define SPC_COUNTERMODE 200850l +#define SPC_CNTMOD_MASK 0x0000000F +#define SPC_CNTMOD_PARALLELDATA 0x00000000 +#define SPC_CNTMOD_8BITCNT 0x00000001 +#define SPC_CNTMOD_2x8BITCNT 0x00000002 +#define SPC_CNTMOD_16BITCNT 0x00000003 +#define SPC_CNT0_MASK 0x000000F0 +#define SPC_CNT0_CNTONPOSEDGE 0x00000000 +#define SPC_CNT0_CNTONNEGEDGE 0x00000010 +#define SPC_CNT0_RESETHIGHLVL 0x00000000 +#define SPC_CNT0_RESETLOWLVL 0x00000020 +#define SPC_CNT0_STOPATMAX 0x00000000 +#define SPC_CNT0_ROLLOVER 0x00000040 +#define SPC_CNT1_MASK 0x00000F00 +#define SPC_CNT1_CNTONPOSEDGE 0x00000000 +#define SPC_CNT1_CNTONNEGEDGE 0x00000100 +#define SPC_CNT1_RESETHIGHLVL 0x00000000 +#define SPC_CNT1_RESETLOWLVL 0x00000200 +#define SPC_CNT1_STOPATMAX 0x00000000 +#define SPC_CNT1_ROLLOVER 0x00000400 +#define SPC_CNTCMD_MASK 0x0000F000 +#define SPC_CNTCMD_RESETCNT0 0x00001000 +#define SPC_CNTCMD_RESETCNT1 0x00002000 +#define SPC_ENHANCEDSTATUS 200900l +#define SPC_ENHSTAT_OVERRANGE0 0x00000001 +#define SPC_ENHSTAT_OVERRANGE1 0x00000002 +#define SPC_ENHSTAT_OVERRANGE2 0x00000004 +#define SPC_ENHSTAT_OVERRANGE3 0x00000008 +#define SPC_ENHSTAT_OVERRANGE4 0x00000010 +#define SPC_ENHSTAT_OVERRANGE5 0x00000020 +#define SPC_ENHSTAT_OVERRANGE6 0x00000040 +#define SPC_ENHSTAT_OVERRANGE7 0x00000080 +#define SPC_ENHSTAT_COMPARATOR0 0x40000000 +#define SPC_ENHSTAT_COMPARATOR1 0x80000000 +#define SPC_ENHSTAT_COMPARATOR2 0x20000000 +#define SPC_ENHSTAT_TRGCOMPARATOR 0x40000000 +#define SPC_ENHSTAT_CLKCOMPARATOR 0x80000000 +#define SPC_TRIGGERCOUNTER 200905l +#define SPC_FILLSIZEPROMILLE 200910l +#define SPC_OVERRANGEBIT 201000l +#define SPC_2CH8BITMODE 201100l +#define SPC_12BITMODE 201200l +#define SPC_HOLDLASTSAMPLE 201300l + +#define SPC_DATACONVERSION 201400l +#define SPC_AVAILDATACONVERSION 201401l +#define SPCM_DC_NONE 0x00000000 +#define SPCM_DC_12BIT_TO_14BIT 0x00000001 +#define SPCM_DC_16BIT_TO_14BIT 0x00000002 +#define SPCM_DC_12BIT_TO_16BIT 0x00000004 +#define SPCM_DC_14BIT_TO_16BIT 0x00000008 +#define SPCM_DC_15BIT_TO_16BIT 0x00000010 +#define SPCM_DC_13BIT_TO_16BIT 0x00000020 +#define SPCM_DC_14BIT_TO_8BIT 0x00000100 +#define SPCM_DC_16BIT_TO_8BIT 0x00000200 +#define SPCM_DC_16BIT_TO_12BIT 0x00000400 +#define SPCM_DC_TO_OFFSETBINARY 0x00000800 + +#define SPC_CARDIDENTIFICATION 201500l + +#define SPC_HANDSHAKE 201600l + +#define SPC_CKSYNC0 202000l +#define SPC_CKSYNC1 202001l +#define SPC_DISABLEMOD0 203000l +#define SPC_DISABLEMOD1 203010l +#define SPC_ENABLEOVERRANGECHECK 204000l +#define SPC_OVERRANGESTATUS 204010l +#define SPC_BITMODE 205000l + +#define SPC_READBACK 206000l +#define SPC_AVAILSTOPLEVEL 206009l +#define SPC_STOPLEVEL1 206010l +#define SPC_STOPLEVEL0 206020l +#define SPC_CH0_STOPLEVEL 206020l +#define SPC_CH1_STOPLEVEL 206021l +#define SPC_CH2_STOPLEVEL 206022l +#define SPC_CH3_STOPLEVEL 206023l +#define SPC_CH4_STOPLEVEL 206024l +#define SPC_CH5_STOPLEVEL 206025l +#define SPC_CH6_STOPLEVEL 206026l +#define SPC_CH7_STOPLEVEL 206027l +#define SPCM_STOPLVL_TRISTATE 0x00000001 +#define SPCM_STOPLVL_LOW 0x00000002 +#define SPCM_STOPLVL_HIGH 0x00000004 +#define SPCM_STOPLVL_HOLDLAST 0x00000008 +#define SPCM_STOPLVL_ZERO 0x00000010 +#define SPCM_STOPLVL_CUSTOM 0x00000020 + +#define SPC_DIFFMODE 206030l +#define SPC_DACADJUST 206040l + +#define SPC_CH0_CUSTOM_STOP 206050l +#define SPC_CH1_CUSTOM_STOP 206051l +#define SPC_CH2_CUSTOM_STOP 206052l +#define SPC_CH3_CUSTOM_STOP 206053l +#define SPC_CH4_CUSTOM_STOP 206054l +#define SPC_CH5_CUSTOM_STOP 206055l +#define SPC_CH6_CUSTOM_STOP 206056l +#define SPC_CH7_CUSTOM_STOP 206057l + +#define SPC_AMP_MODE 207000l + +#define SPCM_FW_CTRL 210000l +#define SPCM_FW_CTRL_GOLDEN 210001l +#define SPCM_FW_CTRL_ACTIVE 210002l +#define SPCM_FW_CLOCK 210010l +#define SPCM_FW_CONFIG 210020l +#define SPCM_FW_MODULEA 210030l +#define SPCM_FW_MODULEB 210031l +#define SPCM_FW_MODULEA_ACTIVE 210032l +#define SPCM_FW_MODULEB_ACTIVE 210033l +#define SPCM_FW_MODEXTRA 210050l +#define SPCM_FW_MODEXTRA_ACTIVE 210052l +#define SPCM_FW_POWER 210060l +#define SPCM_FW_POWER_ACTIVE 210062l + +#define SPC_MULTI 220000l +#define SPC_DOUBLEMEM 220100l +#define SPC_MULTIMEMVALID 220200l +#define SPC_BANK 220300l +#define SPC_GATE 220400l +#define SPC_RELOAD 230000l +#define SPC_USEROUT 230010l +#define SPC_WRITEUSER0 230100l +#define SPC_WRITEUSER1 230110l +#define SPC_READUSER0 230200l +#define SPC_READUSER1 230210l +#define SPC_MUX 240000l +#define SPC_ADJADC 241000l +#define SPC_ADJOFFS0 242000l +#define SPC_ADJOFFS1 243000l +#define SPC_ADJGAIN0 244000l +#define SPC_ADJGAIN1 245000l +#define SPC_READEPROM 250000l +#define SPC_WRITEEPROM 250010l +#define SPC_DIRECTIO 260000l +#define SPC_DIRECT_MODA 260010l +#define SPC_DIRECT_MODB 260020l +#define SPC_DIRECT_EXT0 260030l +#define SPC_DIRECT_EXT1 260031l +#define SPC_DIRECT_EXT2 260032l +#define SPC_DIRECT_EXT3 260033l +#define SPC_DIRECT_EXT4 260034l +#define SPC_DIRECT_EXT5 260035l +#define SPC_DIRECT_EXT6 260036l +#define SPC_DIRECT_EXT7 260037l +#define SPC_MEMTEST 270000l +#define SPC_NODMA 275000l +#define SPC_NOCOUNTER 275010l +#define SPC_NOSCATTERGATHER 275020l +#define SPC_USER_RELAIS_OVERWRITE 275030l +#define SPCM_URO_ENABLE 0x80000000 +#define SPCM_URO_INVERT_10TO1REL 0x00000001 +#define SPC_RUNINTENABLE 290000l +#define SPC_XFERBUFSIZE 295000l +#define SPC_CHLX 295010l +#define SPC_SPECIALCLOCK 295100l +#define SPC_PLL0_ICP 295105l +#define SPCM_ICP0 0x00000000 +// ... +#define SPCM_ICP7 0x00000007 +#define SPC_STARTDELAY 295110l +#define SPC_BASISTTLTRIG 295120l +#define SPC_TIMEOUT 295130l +#define SPC_SWL_INFO 295140l +#define SPC_SWD_INFO 295141l +#define SPC_SWD_DOWN 295142l +#define SPC_SWL_EXTRAINFO 295143l +#define SPC_SPECIALCLOCK_ADJUST0 295150l +#define SPC_SPECIALCLOCK_ADJUST1 295151l +#define SPC_SPECIALCLOCK_ADJUST2 295152l +#define SPC_SPECIALCLOCK_ADJUST3 295153l +#define SPCM_SPECIALCLOCK_ADJUST_SHIFT 1000000 +#define SPC_REGACC_CONTMEM 299000l +#define SPC_REGACC_MEMORYUSAGE 299001l +#define SPC_REINITLOGSETTINGS 299998l +#define SPC_LOGDLLCALLS 299999l + + + + + + +// ----- PCK400 ----- +#define SPC_FREQUENCE 300000l +#define SPC_DELTAFREQUENCE 300010l +#define SPC_PINHIGH 300100l +#define SPC_PINLOW 300110l +#define SPC_PINDELTA 300120l +#define SPC_STOPLEVEL 300200l +#define SPC_PINRELAIS 300210l +#define SPC_EXTERNLEVEL 300300l + + + +// ----- PADCO ----- +#define SPC_COUNTER0 310000l +#define SPC_COUNTER1 310001l +#define SPC_COUNTER2 310002l +#define SPC_COUNTER3 310003l +#define SPC_COUNTER4 310004l +#define SPC_COUNTER5 310005l +#define SPC_MODE0 310100l +#define SPC_MODE1 310101l +#define SPC_MODE2 310102l +#define SPC_MODE3 310103l +#define SPC_MODE4 310104l +#define SPC_MODE5 310105l +#define CM_SINGLE 1l +#define CM_MULTI 2l +#define CM_POSEDGE 4l +#define CM_NEGEDGE 8l +#define CM_HIGHPULSE 16l +#define CM_LOWPULSE 32l + + + +// ----- PAD1616 ----- +#define SPC_SEQUENCERESET 320000l +#define SPC_SEQUENCEADD 320010l +#define SEQ_IR_10000MV 0l +#define SEQ_IR_5000MV 1l +#define SEQ_IR_2000MV 2l +#define SEQ_IR_1000MV 3l +#define SEQ_IR_500MV 4l +#define SEQ_CH0 0l +#define SEQ_CH1 8l +#define SEQ_CH2 16l +#define SEQ_CH3 24l +#define SEQ_CH4 32l +#define SEQ_CH5 40l +#define SEQ_CH6 48l +#define SEQ_CH7 56l +#define SEQ_CH8 64l +#define SEQ_CH9 72l +#define SEQ_CH10 80l +#define SEQ_CH11 88l +#define SEQ_CH12 96l +#define SEQ_CH13 104l +#define SEQ_CH14 112l +#define SEQ_CH15 120l +#define SEQ_TRIGGER 128l +#define SEQ_START 256l + + + +// ----- Option CA ----- +#define SPC_CA_MODE 330000l +#define CAMODE_OFF 0l +#define CAMODE_CDM 1l +#define CAMODE_KW 2l +#define CAMODE_OT 3l +#define CAMODE_CDMMUL 4l +#define SPC_CA_TRIGDELAY 330010l +#define SPC_CA_CKDIV 330020l +#define SPC_CA_PULS 330030l +#define SPC_CA_CKMUL 330040l +#define SPC_CA_DREHZAHLFORMAT 330050l +#define CADREH_4X4 0l +#define CADREH_1X16 1l +#define SPC_CA_KWINVERT 330060l +#define SPC_CA_OUTA 330100l +#define SPC_CA_OUTB 330110l +#define CAOUT_TRISTATE 0l +#define CAOUT_LOW 1l +#define CAOUT_HIGH 2l +#define CAOUT_CDM 3l +#define CAOUT_OT 4l +#define CAOUT_KW 5l +#define CAOUT_TRIG 6l +#define CAOUT_CLK 7l +#define CAOUT_KW60 8l +#define CAOUT_KWGAP 9l +#define CAOUT_TRDLY 10l +#define CAOUT_INVERT 16l + + +// ----- Option Sequence Mode (output cards) ----- +#define SPC_SEQMODE_STEPMEM0 340000l +// ... +#define SPC_SEQMODE_STEPMEM8191 348191l + +// low part of 64 bit entry +#define SPCSEQ_SEGMENTMASK 0x0000FFFF +#define SPCSEQ_NEXTSTEPMASK 0xFFFF0000 + +// high part of 64 bit entry +#define SPCSEQ_LOOPMASK 0x000FFFFF +#define SPCSEQ_ENDLOOPALWAYS 0x00000000 +#define SPCSEQ_ENDLOOPONTRIG 0x40000000 +#define SPCSEQ_END 0x80000000 + +#define SPC_SEQMODE_AVAILMAXSEGMENT 349900l +#define SPC_SEQMODE_AVAILMAXSTEPS 349901l +#define SPC_SEQMODE_AVAILMAXLOOP 349902l +#define SPC_SEQMODE_AVAILFEATURES 349903l + +#define SPC_SEQMODE_MAXSEGMENTS 349910l +#define SPC_SEQMODE_WRITESEGMENT 349920l +#define SPC_SEQMODE_STARTSTEP 349930l +#define SPC_SEQMODE_SEGMENTSIZE 349940l + +#define SPC_SEQMODE_STATUS 349950l +#define SEQSTAT_STEPCHANGE 0x80000000l + + +// ----- netbox registers ----- +#define SPC_NETBOX_TYPE 400000l +#define NETBOX_SERIES_MASK 0xFF000000 +#define NETBOX_FAMILY_MASK 0x00FF0000 +#define NETBOX_SPEED_MASK 0x0000FF00 +#define NETBOX_CHANNEL_MASK 0x000000FF + +#define NETBOX_SERIES_DN2 0x02000000 +#define NETBOX_SERIES_DN6 0x06000000 + +#define NETBOX_FAMILY_20 0x00200000 +#define NETBOX_FAMILY_22 0x00220000 +#define NETBOX_FAMILY_44 0x00440000 +#define NETBOX_FAMILY_46 0x00460000 +#define NETBOX_FAMILY_47 0x00470000 +#define NETBOX_FAMILY_48 0x00480000 +#define NETBOX_FAMILY_49 0x00490000 +#define NETBOX_FAMILY_59 0x00590000 +#define NETBOX_FAMILY_60 0x00600000 +#define NETBOX_FAMILY_65 0x00650000 +#define NETBOX_FAMILY_66 0x00660000 +#define NETBOX_FAMILY_8X 0x00800000 +#define NETBOX_FAMILY_80 0x00800000 +#define NETBOX_FAMILY_81 0x00810000 +#define NETBOX_FAMILY_82 0x00820000 +#define NETBOX_FAMILY_83 0x00830000 + +#define NETBOX_SPEED_1 0x00000100 +#define NETBOX_SPEED_2 0x00000200 +#define NETBOX_SPEED_3 0x00000300 +#define NETBOX_SPEED_4 0x00000400 +#define NETBOX_SPEED_5 0x00000500 +#define NETBOX_SPEED_6 0x00000600 +#define NETBOX_SPEED_7 0x00000700 +#define NETBOX_SPEED_8 0x00000800 + +#define NETBOX_CHANNELS_2 0x00000002 +#define NETBOX_CHANNELS_4 0x00000004 +#define NETBOX_CHANNELS_6 0x00000006 +#define NETBOX_CHANNELS_8 0x00000008 +#define NETBOX_CHANNELS_10 0x0000000A +#define NETBOX_CHANNELS_12 0x0000000C +#define NETBOX_CHANNELS_16 0x00000010 +#define NETBOX_CHANNELS_20 0x00000014 +#define NETBOX_CHANNELS_24 0x00000018 +#define NETBOX_CHANNELS_32 0x00000020 +#define NETBOX_CHANNELS_40 0x00000028 +#define NETBOX_CHANNELS_48 0x00000030 + +#define SPC_NETBOX_SERIALNO 400001l +#define SPC_NETBOX_PRODUCTIONDATE 400002l +#define SPC_NETBOX_HWVERSION 400003l +#define SPC_NETBOX_SWVERSION 400004l + +#define SPC_NETBOX_FEATURES 400005l +#define NETBOX_FEAT_DCPOWER 0x1 +#define NETBOX_FEAT_BOOTATPOWERON 0x2 +#define NETBOX_FEAT_EMBEDDEDSERVER 0x4 + +#define SPC_NETBOX_CUSTOM 400006l + +#define SPC_NETBOX_WAKEONLAN 400007l +#define SPC_NETBOX_MACADDRESS 400008l +#define SPC_NETBOX_LANIDFLASH 400009l +#define SPC_NETBOX_TEMPERATURE 400010l +#define SPC_NETBOX_SHUTDOWN 400011l +#define SPC_NETBOX_RESTART 400012l +#define SPC_NETBOX_FANSPEED0 400013l +#define SPC_NETBOX_FANSPEED1 400014l +#define SPC_NETBOX_TEMPERATURE_K 400010l // same SPC_NETBOX_TEMPERATURE +#define SPC_NETBOX_TEMPERATURE_C 400015l +#define SPC_NETBOX_TEMPERATURE_F 400016l +#define SPC_NETBOX_TEMPERATURE1_K 400017l +#define SPC_NETBOX_TEMPERATURE1_C 400018l +#define SPC_NETBOX_TEMPERATURE1_F 400019l +#define SPC_NETBOX_TEMPERATURE2_K 400020l +#define SPC_NETBOX_TEMPERATURE2_C 400021l +#define SPC_NETBOX_TEMPERATURE2_F 400022l + +// ----- hardware monitor registers ----- +#define SPC_MON_V_PCIE_BUS 500000l +#define SPC_MON_V_CONNECTOR 500001l +#define SPC_MON_CARD_PWRSOURCE 500002l +#define CARD_PWRSOURCE_BUS 0l +#define CARD_PWRSOURCE_CONNECTOR 1l +#define SPC_MON_V_CARD_IN 500003l +#define SPC_MON_I_CARD_IN 500004l +#define SPC_MON_P_CARD_IN 500005l +#define SPC_MON_V_3V3 500006l +#define SPC_MON_V_2V5 500007l +#define SPC_MON_V_CORE 500008l +#define SPC_MON_V_AVTT 500009l +#define SPC_MON_V_AVCC 500010l +#define SPC_MON_V_MEMVCC 500011l +#define SPC_MON_V_MEMVTT 500012l +#define SPC_MON_V_CP_POS 500013l +#define SPC_MON_V_CP_NEG 500014l + +#define SPC_MON_V_5VA 500015l +#define SPC_MON_V_ADCA 500016l +#define SPC_MON_V_ADCD 500017l +#define SPC_MON_V_OP_POS 500018l +#define SPC_MON_V_OP_NEG 500019l +#define SPC_MON_V_COMP_NEG 500020l +#define SPC_MON_V_COMP_POS 500021l + +// legacy temperature registers (Kelvin) +#define SPC_MON_T_BASE_CTRL 500022l +#define SPC_MON_T_MODULE_0 500023l +#define SPC_MON_T_MODULE_1 500024l + +// new temperature registers for Kelvin (TK), Celsius (TC) or Fahrenheit (TF) +#define SPC_MON_TK_BASE_CTRL 500022l +#define SPC_MON_TK_MODULE_0 500023l +#define SPC_MON_TK_MODULE_1 500024l + +#define SPC_MON_TC_BASE_CTRL 500025l +#define SPC_MON_TC_MODULE_0 500026l +#define SPC_MON_TC_MODULE_1 500027l + +#define SPC_MON_TF_BASE_CTRL 500028l +#define SPC_MON_TF_MODULE_0 500029l +#define SPC_MON_TF_MODULE_1 500030l + +// some more voltages (used on M2p) +#define SPC_MON_V_1V8_BASE 500031l +#define SPC_MON_V_1V8_MOD 500032l +#define SPC_MON_V_MODA_0 500033l +#define SPC_MON_V_MODA_1 500034l +#define SPC_MON_V_MODB_0 500035l +#define SPC_MON_V_MODB_1 500037l + +// some more voltages and temperatures (used on M2p.65xx-hv) +#define SPC_MON_TK_MODA_0 500023l // same as SPC_MON_TK_MODULE_0 +#define SPC_MON_TK_MODA_1 500038l +#define SPC_MON_TK_MODA_2 500039l +#define SPC_MON_TK_MODA_3 500040l +#define SPC_MON_TK_MODA_4 500041l +#define SPC_MON_TK_MODB_0 500024l // same as SPC_MON_TK_MODULE_1 +#define SPC_MON_TK_MODB_1 500042l +#define SPC_MON_TK_MODB_2 500043l +#define SPC_MON_TK_MODB_3 500044l +#define SPC_MON_TK_MODB_4 500045l + +#define SPC_MON_TC_MODA_0 500026l // same as SPC_MON_TC_MODULE_0 +#define SPC_MON_TC_MODA_1 500046l +#define SPC_MON_TC_MODA_2 500047l +#define SPC_MON_TC_MODA_3 500048l +#define SPC_MON_TC_MODA_4 500049l +#define SPC_MON_TC_MODB_0 500027l // same as SPC_MON_TC_MODULE_1 +#define SPC_MON_TC_MODB_1 500050l +#define SPC_MON_TC_MODB_2 500051l +#define SPC_MON_TC_MODB_3 500052l +#define SPC_MON_TC_MODB_4 500053l + +#define SPC_MON_TF_MODA_0 500029l // same as SPC_MON_TF_MODULE_0 +#define SPC_MON_TF_MODA_1 500054l +#define SPC_MON_TF_MODA_2 500055l +#define SPC_MON_TF_MODA_3 500056l +#define SPC_MON_TF_MODA_4 500057l +#define SPC_MON_TF_MODB_0 500030l // same as SPC_MON_TF_MODULE_1 +#define SPC_MON_TF_MODB_1 500058l +#define SPC_MON_TF_MODB_2 500059l +#define SPC_MON_TF_MODB_3 500060l +#define SPC_MON_TF_MODB_4 500061l + +#define SPC_MON_I_MODA_0 500062l +#define SPC_MON_I_MODA_1 500063l +#define SPC_MON_I_MODA_2 500064l +#define SPC_MON_I_MODA_3 500065l +#define SPC_MON_I_MODB_0 500066l +#define SPC_MON_I_MODB_1 500067l +#define SPC_MON_I_MODB_2 500068l +#define SPC_MON_I_MODB_3 500069l + +#define SPC_MON_MOD_FAULT 500070l +#define SPC_CLR_MOD_FAULT 500071l + +// power section temperature registers for Kelvin (TK), Celsius (TC) or Fahrenheit (TF) +#define SPC_MON_TK_MODA_5 500072l +#define SPC_MON_TK_MODB_5 500073l + +#define SPC_MON_TC_MODA_5 500074l +#define SPC_MON_TC_MODB_5 500075l + +#define SPC_MON_TF_MODA_5 500076l +#define SPC_MON_TF_MODB_5 500077l + +// even more monitors (used on M5i) +#define SPC_MON_V_MOD_0 500078l +#define SPC_MON_V_MOD_1 500079l +#define SPC_MON_V_MOD_2 500080l +#define SPC_MON_V_MOD_3 500081l +#define SPC_MON_V_MOD_4 500082l +#define SPC_MON_V_MOD_5 500083l +#define SPC_MON_V_MOD_6 500084l +#define SPC_MON_V_MOD_7 500085l +#define SPC_MON_V_MOD_8 500086l +#define SPC_MON_V_MOD_9 500087l +#define SPC_MON_V_MOD_10 500088l + +#define SPC_MON_TK_MODULE_2 500089l +#define SPC_MON_TC_MODULE_2 500090l +#define SPC_MON_TF_MODULE_2 500091l + +#define SPC_MON_RPM_FAN0 500092l +#define SPC_MON_RPM_FAN1 500093l + +#define SPC_MON_V_MEMVTTA 500094l +#define SPC_MON_V_MEMVTTB 500095l +#define SPC_MON_V_VCCAUX 500096l +#define SPC_MON_V_MEMAUXA 500097l +#define SPC_MON_V_MEMAUXB 500098l +#define SPC_MON_TK_BASE_0 500099l +#define SPC_MON_TC_BASE_0 500100l +#define SPC_MON_TF_BASE_0 500101l +#define SPC_MON_TK_BASE_1 500102l +#define SPC_MON_TC_BASE_1 500103l +#define SPC_MON_TF_BASE_1 500104l +#define SPC_MON_I_CORE 500105l +#define SPC_MON_V_CORE_REMOTE 500106l + + +// mask with available monitor registers +#define SPC_AVAILMONITORS 510000l +#define SPCM_MON_T_BASE_CTRL 0x0000000000000001ULL +#define SPCM_MON_T_MODULE_0 0x0000000000000002ULL +#define SPCM_MON_T_MODULE_1 0x0000000000000004ULL +#define SPCM_MON_T_MODULE_2 0x0000000000000008ULL + +#define SPCM_MON_V_PCIE_BUS 0x0000000000000010ULL +#define SPCM_MON_V_CONNECTOR 0x0000000000000020ULL +#define SPCM_MON_CARD_PWRSOURCE 0x0000000000000040ULL +#define SPCM_MON_V_CARD_IN 0x0000000000000080ULL +#define SPCM_MON_I_CARD_IN 0x0000000000000100ULL +#define SPCM_MON_P_CARD_IN 0x0000000000000200ULL +#define SPCM_MON_V_3V3 0x0000000000000400ULL +#define SPCM_MON_V_2V5 0x0000000000000800ULL +#define SPCM_MON_V_CORE 0x0000000000001000ULL +#define SPCM_MON_V_AVTT 0x0000000000002000ULL +#define SPCM_MON_V_AVCC 0x0000000000004000ULL +#define SPCM_MON_V_MEMVCC 0x0000000000008000ULL +#define SPCM_MON_V_MEMVTT 0x0000000000010000ULL +#define SPCM_MON_V_CP_POS 0x0000000000020000ULL +#define SPCM_MON_V_CP_NEG 0x0000000000040000ULL +#define SPCM_MON_V_5VA 0x0000000000080000ULL +#define SPCM_MON_V_ADCA 0x0000000000100000ULL +#define SPCM_MON_V_ADCD 0x0000000000200000ULL +#define SPCM_MON_V_OP_POS 0x0000000000400000ULL +#define SPCM_MON_V_OP_NEG 0x0000000000800000ULL +#define SPCM_MON_V_COMP_NEG 0x0000000001000000ULL +#define SPCM_MON_V_COMP_POS 0x0000000002000000ULL +#define SPCM_MON_V_1V8_BASE 0x0000000004000000ULL +#define SPCM_MON_V_1V8_MOD 0x0000000008000000ULL + +#define SPCM_MON_V_MODA_0 0x0000000010000000ULL +#define SPCM_MON_V_MODA_1 0x0000000020000000ULL +#define SPCM_MON_V_MODB_0 0x0000000040000000ULL +#define SPCM_MON_V_MODB_1 0x0000000080000000ULL + +#define SPCM_MON_T_MODA_0 0x0000000000000002ULL // same as SPCM_MON_T_MODULE_0 +#define SPCM_MON_T_MODA_1 0x0000000100000000ULL +#define SPCM_MON_T_MODA_2 0x0000000200000000ULL +#define SPCM_MON_T_MODA_3 0x0000000400000000ULL +#define SPCM_MON_T_MODA_4 0x0000000800000000ULL + +#define SPCM_MON_T_MODB_0 0x0000000000000004ULL // same as SPCM_MON_T_MODULE_1 +#define SPCM_MON_T_MODB_1 0x0000001000000000ULL +#define SPCM_MON_T_MODB_2 0x0000002000000000ULL +#define SPCM_MON_T_MODB_3 0x0000004000000000ULL +#define SPCM_MON_T_MODB_4 0x0000008000000000ULL + +#define SPCM_MON_I_MODA_0 0x0000010000000000ULL +#define SPCM_MON_I_MODA_1 0x0000020000000000ULL +#define SPCM_MON_I_MODA_2 0x0000040000000000ULL +#define SPCM_MON_I_MODA_3 0x0000080000000000ULL + +#define SPCM_MON_I_MODB_0 0x0000100000000000ULL +#define SPCM_MON_I_MODB_1 0x0000200000000000ULL +#define SPCM_MON_I_MODB_2 0x0000400000000000ULL +#define SPCM_MON_I_MODB_3 0x0000800000000000ULL + +#define SPCM_MON_T_MODA_5 0x0001000000000000ULL +#define SPCM_MON_T_MODB_5 0x0002000000000000ULL + +#define SPCM_MON_V_MEMVTTA 0x0004000000000000ULL +#define SPCM_MON_V_MEMVTTB 0x0008000000000000ULL +#define SPCM_MON_V_MEMAUXA 0x0010000000000000ULL +#define SPCM_MON_V_MEMAUXB 0x0020000000000000ULL +#define SPCM_MON_V_VCCAUX 0x0040000000000000ULL + +#define SPCM_MON_T_BASE_0 0x0080000000000000ULL +#define SPCM_MON_T_BASE_1 0x0100000000000000ULL +#define SPCM_MON_RPM_FAN0 0x0200000000000000ULL +#define SPCM_MON_RPM_FAN1 0x0400000000000000ULL + +#define SPCM_MON_I_CORE 0x0800000000000000ULL +#define SPCM_MON_V_CORE_REMOTE 0x1000000000000000ULL + + +#define SPC_AVAILMONITORS1 510001l +#define SPCM_MON_V_MOD_0 0x0000000000000001ULL +#define SPCM_MON_V_MOD_1 0x0000000000000002ULL +#define SPCM_MON_V_MOD_2 0x0000000000000004ULL +#define SPCM_MON_V_MOD_3 0x0000000000000008ULL +#define SPCM_MON_V_MOD_4 0x0000000000000010ULL +#define SPCM_MON_V_MOD_5 0x0000000000000020ULL +#define SPCM_MON_V_MOD_6 0x0000000000000040ULL +#define SPCM_MON_V_MOD_7 0x0000000000000080ULL +#define SPCM_MON_V_MOD_8 0x0000000000000100ULL +#define SPCM_MON_V_MOD_9 0x0000000000000200ULL +#define SPCM_MON_V_MOD_10 0x0000000000000400ULL + + + +// ----- re-located multi-purpose i/o related registers ----- +#define SPC_X0_READFEATURES 600000l +#define SPC_X1_READFEATURES 600001l +#define SPC_X2_READFEATURES 600002l +#define SPC_X3_READFEATURES 600003l +#define SPC_X4_READFEATURES 600004l +#define SPC_X5_READFEATURES 600005l +#define SPC_X6_READFEATURES 600006l +#define SPC_X7_READFEATURES 600007l +#define SPC_X8_READFEATURES 600008l +#define SPC_X9_READFEATURES 600009l +#define SPC_X10_READFEATURES 600010l +#define SPC_X11_READFEATURES 600011l +#define SPC_X12_READFEATURES 600012l +#define SPC_X13_READFEATURES 600013l +#define SPC_X14_READFEATURES 600014l +#define SPC_X15_READFEATURES 600015l +#define SPC_X16_READFEATURES 600016l +#define SPC_X17_READFEATURES 600017l +#define SPC_X18_READFEATURES 600018l +#define SPC_X19_READFEATURES 600019l +#define SPCM_XFEAT_TERM 0x00000001 +#define SPCM_XFEAT_HIGHIMP 0x00000002 +#define SPCM_XFEAT_DCCOUPLING 0x00000004 +#define SPCM_XFEAT_ACCOUPLING 0x00000008 +#define SPCM_XFEAT_SE 0x00000010 +#define SPCM_XFEAT_DIFF 0x00000020 +#define SPCM_XFEAT_PROGTHRESHOLD 0x00000040 + +#define SPC_X0_TERM 600100l +#define SPC_X1_TERM 600101l +#define SPC_X2_TERM 600102l +#define SPC_X3_TERM 600103l +#define SPC_X4_TERM 600104l +#define SPC_X5_TERM 600105l +#define SPC_X6_TERM 600106l +#define SPC_X7_TERM 600107l +#define SPC_X8_TERM 600108l +#define SPC_X9_TERM 600109l +#define SPC_X10_TERM 600110l +#define SPC_X11_TERM 600111l +#define SPC_X12_TERM 600112l +#define SPC_X13_TERM 600113l +#define SPC_X14_TERM 600114l +#define SPC_X15_TERM 600115l +#define SPC_X16_TERM 600116l +#define SPC_X17_TERM 600117l +#define SPC_X18_TERM 600118l +#define SPC_X19_TERM 600119l + +#define SPCM_X0_MODE 600200l +#define SPCM_X1_MODE 600201l +#define SPCM_X2_MODE 600202l +#define SPCM_X3_MODE 600203l +#define SPCM_X4_MODE 600204l +#define SPCM_X5_MODE 600205l +#define SPCM_X6_MODE 600206l +#define SPCM_X7_MODE 600207l +#define SPCM_X8_MODE 600208l +#define SPCM_X9_MODE 600209l +#define SPCM_X10_MODE 600210l +#define SPCM_X11_MODE 600211l +#define SPCM_X12_MODE 600212l +#define SPCM_X13_MODE 600213l +#define SPCM_X14_MODE 600214l +#define SPCM_X15_MODE 600215l +#define SPCM_X16_MODE 600216l +#define SPCM_X17_MODE 600217l +#define SPCM_X18_MODE 600218l +#define SPCM_X19_MODE 600219l + +#define SPCM_X0_AVAILMODES 600300l +#define SPCM_X1_AVAILMODES 600301l +#define SPCM_X2_AVAILMODES 600302l +#define SPCM_X3_AVAILMODES 600303l +#define SPCM_X4_AVAILMODES 600304l +#define SPCM_X5_AVAILMODES 600305l +#define SPCM_X6_AVAILMODES 600306l +#define SPCM_X7_AVAILMODES 600307l +#define SPCM_X8_AVAILMODES 600308l +#define SPCM_X9_AVAILMODES 600309l +#define SPCM_X10_AVAILMODES 600310l +#define SPCM_X11_AVAILMODES 600311l +#define SPCM_X12_AVAILMODES 600312l +#define SPCM_X13_AVAILMODES 600313l +#define SPCM_X14_AVAILMODES 600314l +#define SPCM_X15_AVAILMODES 600315l +#define SPCM_X16_AVAILMODES 600316l +#define SPCM_X17_AVAILMODES 600317l +#define SPCM_X18_AVAILMODES 600318l +#define SPCM_X19_AVAILMODES 600319l +// for definitions of the available modes see section at SPCM_LEGACY_X0_MODE above + +#define SPC_XIO_PULSEGEN0_MODE 601000l +#define SPC_XIO_PULSEGEN1_MODE 601100l +#define SPC_XIO_PULSEGEN2_MODE 601200l +#define SPC_XIO_PULSEGEN3_MODE 601300l +#define SPCM_PULSEGEN_MODE_GATED 1 +#define SPCM_PULSEGEN_MODE_TRIGGERED 2 +#define SPCM_PULSEGEN_MODE_SINGLESHOT 3 + +#define SPC_XIO_PULSEGEN0_LEN 601001l +#define SPC_XIO_PULSEGEN1_LEN 601101l +#define SPC_XIO_PULSEGEN2_LEN 601201l +#define SPC_XIO_PULSEGEN3_LEN 601301l + +#define SPC_XIO_PULSEGEN0_HIGH 601002l +#define SPC_XIO_PULSEGEN1_HIGH 601102l +#define SPC_XIO_PULSEGEN2_HIGH 601202l +#define SPC_XIO_PULSEGEN3_HIGH 601302l + +#define SPC_XIO_PULSEGEN0_OFFSET 601003l +#define SPC_XIO_PULSEGEN1_OFFSET 601103l +#define SPC_XIO_PULSEGEN2_OFFSET 601203l +#define SPC_XIO_PULSEGEN3_OFFSET 601303l + +#define SPC_XIO_PULSEGEN0_LOOPS 601004l +#define SPC_XIO_PULSEGEN1_LOOPS 601104l +#define SPC_XIO_PULSEGEN2_LOOPS 601204l +#define SPC_XIO_PULSEGEN3_LOOPS 601304l + +#define SPC_XIO_PULSEGEN0_MUX1_SRC 601005l +#define SPC_XIO_PULSEGEN1_MUX1_SRC 601105l +#define SPC_XIO_PULSEGEN2_MUX1_SRC 601205l +#define SPC_XIO_PULSEGEN3_MUX1_SRC 601305l +#define SPCM_PULSEGEN_MUX1_SRC_UNUSED 0 +#define SPCM_PULSEGEN_MUX1_SRC_RUN 1 +#define SPCM_PULSEGEN_MUX1_SRC_ARM 2 + +#define SPC_XIO_PULSEGEN0_MUX2_SRC 601006l +#define SPC_XIO_PULSEGEN1_MUX2_SRC 601106l +#define SPC_XIO_PULSEGEN2_MUX2_SRC 601206l +#define SPC_XIO_PULSEGEN3_MUX2_SRC 601306l +#define SPCM_PULSEGEN_MUX2_SRC_UNUSED 0 +#define SPCM_PULSEGEN_MUX2_SRC_SOFTWARE 1 +#define SPCM_PULSEGEN_MUX2_SRC_CARDTRIGGER 2 +#define SPCM_PULSEGEN_MUX2_SRC_PULSEGEN0 3 +#define SPCM_PULSEGEN_MUX2_SRC_PULSEGEN1 4 +#define SPCM_PULSEGEN_MUX2_SRC_PULSEGEN2 5 +#define SPCM_PULSEGEN_MUX2_SRC_PULSEGEN3 6 +#define SPCM_PULSEGEN_MUX2_SRC_XIO0 7 +#define SPCM_PULSEGEN_MUX2_SRC_XIO1 8 +#define SPCM_PULSEGEN_MUX2_SRC_XIO2 9 +#define SPCM_PULSEGEN_MUX2_SRC_XIO3 10 + +#define SPC_XIO_PULSEGEN0_CONFIG 601007l +#define SPC_XIO_PULSEGEN1_CONFIG 601107l +#define SPC_XIO_PULSEGEN2_CONFIG 601207l +#define SPC_XIO_PULSEGEN3_CONFIG 601307l +#define SPCM_PULSEGEN_CONFIG_MUX1_INVERT 0x1 +#define SPCM_PULSEGEN_CONFIG_MUX2_INVERT 0x2 +#define SPCM_PULSEGEN_CONFIG_INVERT 0x4 +#define SPCM_PULSEGEN_CONFIG_HIGH 0x8 + +#define SPC_XIO_PULSEGEN_ENABLE 601500l +#define SPCM_PULSEGEN_ENABLE0 0x01 +#define SPCM_PULSEGEN_ENABLE1 0x02 +#define SPCM_PULSEGEN_ENABLE2 0x04 +#define SPCM_PULSEGEN_ENABLE3 0x08 + +#define SPC_XIO_PULSEGEN_COMMAND 601501l +#define SPCM_PULSEGEN_CMD_FORCE 0x1 + +#define SPC_XIO_PULSEGEN_CLOCK 602000l +#define SPC_XIO_PULSEGEN_AVAILLEN_MIN 602001l +#define SPC_XIO_PULSEGEN_AVAILLEN_MAX 602002l +#define SPC_XIO_PULSEGEN_AVAILLEN_STEP 602003l +#define SPC_XIO_PULSEGEN_AVAILHIGH_MIN 602004l +#define SPC_XIO_PULSEGEN_AVAILHIGH_MAX 602005l +#define SPC_XIO_PULSEGEN_AVAILHIGH_STEP 602006l +#define SPC_XIO_PULSEGEN_AVAILOFFSET_MIN 602007l +#define SPC_XIO_PULSEGEN_AVAILOFFSET_MAX 602008l +#define SPC_XIO_PULSEGEN_AVAILOFFSET_STEP 602009l +#define SPC_XIO_PULSEGEN_AVAILLOOPS_MIN 602010l +#define SPC_XIO_PULSEGEN_AVAILLOOPS_MAX 602011l +#define SPC_XIO_PULSEGEN_AVAILLOOPS_STEP 602012l + +// ----- Hardware registers (debug use only) ----- +#define SPC_REG0x00 900000l +#define SPC_REG0x02 900010l +#define SPC_REG0x04 900020l +#define SPC_REG0x06 900030l +#define SPC_REG0x08 900040l +#define SPC_REG0x0A 900050l +#define SPC_REG0x0C 900060l +#define SPC_REG0x0E 900070l + +#define SPC_DEBUGREG0 900100l +#define SPC_DEBUGREG15 900115l +#define SPC_DEBUGVALUE0 900200l +#define SPC_DEBUGVALUE15 900215l + +#define SPC_MI_ISP 901000l +#define ISP_TMS_0 0l +#define ISP_TMS_1 1l +#define ISP_TDO_0 0l +#define ISP_TDO_1 2l + + +#define SPC_EE_RWAUTH 901100l +#define SPC_EE_REG 901110l +#define SPC_EE_RESETCOUNTER 901120l + +// ----- Test Registers ----- +#define SPC_TEST_BASE 902000l +#define SPC_TEST_LOCAL_START 902100l +#define SPC_TEST_LOCAL_END 902356l +#define SPC_TEST_PLX_START 902400l +#define SPC_TEST_PLX_END 902656l + +// 9012xx not usable +// 901900 not usable +// 903000 not usable +// 91xxxx not usable + +// ----- used by GetErrorInfo to mark errors in other functions than SetParam/GetParam ----- +#define SPC_FUNCTION_DEFTRANSFER 100000000l diff --git a/Cpp/lib/spcerr.h b/Cpp/lib/spcerr.h new file mode 100644 index 0000000000000000000000000000000000000000..25ba925fb7fe8544741e712a2da8b6ef57f01d15 --- /dev/null +++ b/Cpp/lib/spcerr.h @@ -0,0 +1,104 @@ + +// *********************************************************************** +// +// SpcErr.h (c) Spectrum GmbH, 2006 +// +// *********************************************************************** +// +// error codes of the Spectrum drivers. Until may 2004 this file was +// errors.h. Name has been changed because errors.h has been already in +// use by windows. +// +// *********************************************************************** + +#define SPCM_ERROR_ORIGIN_MASK 0x80000000 // this bit marks the origin of the error +#define SPCM_ERROR_ORIGIN_LOCAL 0x00000000 // error occured on local system +#define SPCM_ERROR_ORIGIN_REMOTE 0x80000000 // error occured on remote system (netbox) + +#define ERR_OK 0x0000 // 0 No Error +#define ERR_INIT 0x0001 // 1 Initialisation error +#define ERR_NR 0x0002 // 2 Board number out of range +#define ERR_TYP 0x0003 // 3 Unknown board Typ +#define ERR_FNCNOTSUPPORTED 0x0004 // 4 This function is not supported by the hardware +#define ERR_BRDREMAP 0x0005 // 5 The Board Index Remap table is wrong +#define ERR_KERNELVERSION 0x0006 // 6 The kernel version and the dll version are mismatching +#define ERR_HWDRVVERSION 0x0007 // 7 The driver version doesn't match the minimum requirements of the board +#define ERR_ADRRANGE 0x0008 // 8 The address range is disabled (fatal error) +#define ERR_INVALIDHANDLE 0x0009 // 9 Handle not valid +#define ERR_BOARDNOTFOUND 0x000A // 10 Card with given name hasn't been found +#define ERR_BOARDINUSE 0x000B // 11 Card with given name is already in use by another application +#define ERR_EXPHW64BITADR 0x000C // 12 Express hardware version not able to handle 64 bit addressing -> update needed +#define ERR_FWVERSION 0x000D // 13 Firmware versions of synchronized cards or for this driver do not match -> update needed +#define ERR_SYNCPROTOCOL 0x000E // 14 Synchronization protocol of synchronized cards does not match -> update needed +#define ERR_KERNEL 0x000F // 15 Some error occurred in the kernel driver +#define ERR_LASTERR 0x0010 // 16 Old Error waiting to be read +#define ERR_ABORT 0x0020 // 32 Abort of wait function +#define ERR_BOARDLOCKED 0x0030 // 48 Board acess already locked by another process. it's not possible to acess one board through multiple processes +#define ERR_DEVICE_MAPPING 0x0032 // 50 Device is mapped to an invalid device +#define ERR_NETWORKSETUP 0x0040 // 64 Network setup failed +#define ERR_NETWORKTRANSFER 0x0041 // 65 Network data transfer failed +#define ERR_FWPOWERCYCLE 0x0042 // 66 Power cycle needed to update card's firmware (simple PC reboot not sufficient !) +#define ERR_NETWORKTIMEOUT 0x0043 // 67 Network timeout +#define ERR_BUFFERSIZE 0x0044 // 68 Buffer too small +#define ERR_RESTRICTEDACCESS 0x0045 // 69 access to card has been restricted +#define ERR_INVALIDPARAM 0x0046 // 70 invalid parameter for function +#define ERR_TEMPERATURE 0x0047 // 71 card temperature too high +#define ERR_FAN 0x0048 // 72 fan speed too low + +#define ERR_REG 0x0100 // 256 unknown Register for this Board +#define ERR_VALUE 0x0101 // 257 Not a possible value in this state +#define ERR_FEATURE 0x0102 // 258 Feature of the board not installed +#define ERR_SEQUENCE 0x0103 // 259 Channel sequence not allowed +#define ERR_READABORT 0x0104 // 260 Read not allowed after abort +#define ERR_NOACCESS 0x0105 // 261 Access to this register denied +#define ERR_POWERDOWN 0x0106 // 262 not allowed in Powerdown mode +#define ERR_TIMEOUT 0x0107 // 263 timeout occured while waiting for interrupt +#define ERR_CALLTYPE 0x0108 // 264 call type (int32 mux) is not allowed for this register +#define ERR_EXCEEDSINT32 0x0109 // 265 return value is int32 but software register exceeds the 32 bit integer range -> use 2x32 or 64 +#define ERR_NOWRITEALLOWED 0x010A // 266 register cannot be written, read only +#define ERR_SETUP 0x010B // 267 the setup isn't valid +#define ERR_CLOCKNOTLOCKED 0x010C // 268 clock section not locked: perhaps no external clock signal connected or not stable +#define ERR_MEMINIT 0x010D // 269 on-board memory initialization error +#define ERR_POWERSUPPLY 0x010E // 270 on-board power supply error +#define ERR_ADCCOMMUNICATION 0x010F // 271 communication with ADC failed +#define ERR_CHANNEL 0x0110 // 272 Wrong number of Channel to be read out +#define ERR_NOTIFYSIZE 0x0111 // 273 Notify block size isn't valid +#define ERR_RUNNING 0x0120 // 288 Board is running, changes not allowed +#define ERR_ADJUST 0x0130 // 304 Auto Adjust has an error +#define ERR_PRETRIGGERLEN 0x0140 // 320 pretrigger length exceeds allowed values +#define ERR_DIRMISMATCH 0x0141 // 321 direction of card and memory transfer mismatch +#define ERR_POSTEXCDSEGMENT 0x0142 // 322 posttrigger exceeds segment size in multiple recording mode +#define ERR_SEGMENTINMEM 0x0143 // 323 memsize is not a multiple of segmentsize, last segment hasn't full length +#define ERR_MULTIPLEPW 0x0144 // 324 multiple pulsewidth counters used but card only supports one at the time +#define ERR_NOCHANNELPWOR 0x0145 // 325 channel pulsewidth can't be OR'd +#define ERR_ANDORMASKOVRLAP 0x0146 // 326 AND mask and OR mask overlap in at least one channel -> not possible +#define ERR_ANDMASKEDGE 0x0147 // 327 AND mask together with edge trigger mode is not allowed +#define ERR_ORMASKLEVEL 0x0148 // 328 OR mask together with level trigger mode is not allowed +#define ERR_EDGEPERMOD 0x0149 // 329 All trigger edges must be simular on one module +#define ERR_DOLEVELMINDIFF 0x014A // 330 minimum difference between low output level and high output level not reached +#define ERR_STARHUBENABLE 0x014B // 331 card holding the star-hub must be active for sync +#define ERR_PATPWSMALLEDGE 0x014C // 332 Combination of pattern with pulsewidht smaller and edge is not allowed +#define ERR_XMODESETUP 0x014D // 333 The chosen setup for (SPCM_X0_MODE .. SPCM_X19_MODE) is not valid. See hardware manual for details. +#define ERR_AVRG_TDA 0x014E // 334 Setup for Average TDA Mode not valid. Check Threshold and Replacement values for chosen AVRGMODE. + +#define ERR_NOPCI 0x0200 // 512 No PCI bus found +#define ERR_PCIVERSION 0x0201 // 513 Wrong PCI bus version +#define ERR_PCINOBOARDS 0x0202 // 514 No Spectrum PCI boards found +#define ERR_PCICHECKSUM 0x0203 // 515 Checksum error on PCI board +#define ERR_DMALOCKED 0x0204 // 516 DMA buffer in use, try later +#define ERR_MEMALLOC 0x0205 // 517 Memory Allocation error +#define ERR_EEPROMLOAD 0x0206 // 518 EEProm load error +#define ERR_CARDNOSUPPORT 0x0207 // 519 no support for that card in the library +#define ERR_CONFIGACCESS 0x0208 // 520 error occured during config write or read + +#define ERR_FIFOBUFOVERRUN 0x0300 // 768 Buffer overrun in FIFO mode +#define ERR_FIFOHWOVERRUN 0x0301 // 769 hardware buffer overrun (acquisition) or underrun (replay) in FIFO mode +#define ERR_FIFOFINISHED 0x0302 // 770 FIFO transfer hs been finished. Number of buffers has been transferred +#define ERR_FIFOSETUP 0x0309 // 777 FIFO setup not possible, transfer rate to high (max 250 MB/s) + +#define ERR_TIMESTAMP_SYNC 0x0310 // 784 Synchronisation to ref clock failed +#define ERR_STARHUB 0x0320 // 800 Autorouting of Starhub failed + +#define ERR_INTERNAL_ERROR 0xFFFF // 65535 Internal hardware error detected, please check for update + + diff --git a/Cpp/lib/spcm_drv.h b/Cpp/lib/spcm_drv.h new file mode 100644 index 0000000000000000000000000000000000000000..a7e17a9e319b22f37766cf77efeeeffce2eb7561 --- /dev/null +++ b/Cpp/lib/spcm_drv.h @@ -0,0 +1,276 @@ +/* +************************************************************************** + +spcm_interface.h (c) Spectrum GmbH , 08/2005 + +************************************************************************** + +Interface of the spectrum driver for all M2I cards. + +************************************************************************** +*/ + + + +/* +************************************************************************** + +open/close: +opens and closes the specified board. The returned handle is used by all +function calls. The device name is operating system specific. Under +linux it's normally "/dev/spcm0" for card#0 and under windows it's "spc0" +In a synchronized system the starhub has it's own handle, received under +the device name "starhub" + +*************************************************************************** +*/ + +// tries to open the device and returns handle or error code +SPCM_IMPORT drv_handle _stdcall spcm_hOpen ( + const char* szDeviceName); // name of the device to be opened + +//************************************************************************* + +// closes the device +SPCM_IMPORT void _stdcall spcm_vClose ( + drv_handle hDevice); // handle to an already opened device + + + + + +/* +************************************************************************** + +SetParam and GetParam: +handles the register based access to the driver. Each functionality is +programmed by accessing one of the software registers of the driver + +Functions are declared as i32 for single 32 bit integer access, i64 for +single 64 bit integer access or 64m for multiplexed 64 bit integer access +consisting one 32 bit integer high-part and one 32 bit unsigned integer +low part. + +Most software registers are only handled by the i32 or i64 function and +are then not allowed to be accessed by i64m functions. Some registers +can be more than 32 bit wide. They can be accessed by any of the +functions. If accessed by the i32 function the value is limited to the +32 bit signed integer area. + +*************************************************************************** +*/ + +// Sets a software register using 1 x 32 bit integer value. Return value is an error code +SPCM_IMPORT uint32 _stdcall spcm_dwSetParam_i32 ( + drv_handle hDevice, // handle to an already opened device + int32 lRegister, // software register to be modified + int32 lValue); // the value to be set + +//************************************************************************* + +// Sets a software register using 2 x 32 bit integer value. Return value is an error code +SPCM_IMPORT uint32 _stdcall spcm_dwSetParam_i64m ( + drv_handle hDevice, // handle to an already opened device + int32 lRegister, // software register to be modified + int32 lValueHigh, // upper 32 bit of the value. Containing the sign bit ! + uint32 dwValueLow); // lower 32 bit of the value. + +//************************************************************************* + +// Sets a software register using 1 x 64 bit integer value. Return value is an error code +SPCM_IMPORT uint32 _stdcall spcm_dwSetParam_i64 ( + drv_handle hDevice, // handle to an already opened device + int32 lRegister, // software register to be modified + int64 llValue); // the value to be set + + + +//************************************************************************* +//************************************************************************* + +// Reads out a software register using 1 x 32 bit integer value. Return value is an error code +SPCM_IMPORT uint32 _stdcall spcm_dwGetParam_i32 ( + drv_handle hDevice, // handle to an already opened device + int32 lRegister, // software register to be read out + int32* plValue); // pointer for the return value + +//************************************************************************* + +// Reads out a software register using 2 x 32 bit integer value. Return value is an error code +SPCM_IMPORT uint32 _stdcall spcm_dwGetParam_i64m ( + drv_handle hDevice, // handle to an already opened device + int32 lRegister, // software register to be read out + int32* plValueHigh, // pointer for the upper part of the return value + uint32* pdwValueLow); // pointer for the lower part of the return value + +//************************************************************************* + +// Reads out a software register using 1 x 64 bit integer value. Return value is an error code +SPCM_IMPORT uint32 _stdcall spcm_dwGetParam_i64 ( + drv_handle hDevice, // handle to an already opened device + int32 lRegister, // software register to be read out + int64* pllValue); // pointer for the return value + + + + +/* +************************************************************************** + +DefTransfer: +sets up all needed information for the next data transfer. Data transfer +itself is started by an extra register command. + +The function needs 64 bit unsigned integer values. Therefore it is +available as an i64m type, consisting of one upper 32 bit uint and one +lower 32 bit uint value. And it is availabl as a true 64 bit version. + +Offset and length are both given in samples. As data is multiplexed the +transfer buffer in PC memory must be large enough to handle +[length x channels] entries + +*************************************************************************** +*/ + +// defintions of the transfer direction +#define SPCM_DIR_PCTOCARD 0 // transfer from PC memory to card memory +#define SPCM_DIR_CARDTOPC 1 // transfer from card memory to PC memory +#define SPCM_DIR_CARDTOGPU 2 // RDMA transfer from card memory to GPU memory +#define SPCM_DIR_GPUTOCARD 3 // RDMA transfer from GPU memory to card memory + +// defintions of the different data buffers +#define SPCM_BUF_DATA 1000 // main data buffer for acquired or generated samples +#define SPCM_BUF_ABA 2000 // buffer for ABA data, holds the A-DATA (slow samples) +#define SPCM_BUF_TIMESTAMP 3000 // buffer for timestamps +#define SPCM_BUF_LOG 4000 // write content of buffer to log file + +//************************************************************************* + +// Defines the transer buffer by using 2 x 32 bit unsigned integer values for each 64 bit value +SPCM_IMPORT uint32 _stdcall spcm_dwDefTransfer_i64m( + drv_handle hDevice, // handle to an already opened device + uint32 dwBufType, // type of the buffer to define as listed above under SPCM_BUF_XXXX + uint32 dwDirection, // the transfer direction as defined above + uint32 dwNotifySize, // amount of bytes after which i want do receive an event (0=end of transfer) + void* pvDataBuffer, // pointer to the data buffer + uint32 dwBrdOffsH, // high part of offset in board memory + uint32 dwBrdOffsL, // low part of offset in board memory + uint32 dwTransferLenH, // high part of transfer buffer length + uint32 dwTransferLenL); // low part of transfer buffer length + +//************************************************************************* + +// Defines the transer buffer by using 64 bit unsigned integer values +SPCM_IMPORT uint32 _stdcall spcm_dwDefTransfer_i64 ( + drv_handle hDevice, // handle to an already opened device + uint32 dwBufType, // type of the buffer to define as listed above under SPCM_BUF_XXXX + uint32 dwDirection, // the transfer direction as defined above + uint32 dwNotifySize, // amount of bytes after which i want do receive an event (0=end of transfer) + void* pvDataBuffer, // pointer to the data buffer + uint64 qwBrdOffs, // offset for transfer in board memory + uint64 qwTransferLen); // buffer length + +//************************************************************************* + +// invalidate the transfer buffer (is automatically performed if new transfer buffer is defined with DefTransfer) +SPCM_IMPORT uint32 _stdcall spcm_dwInvalidateBuf ( + drv_handle hDevice, // handle to an already opened device + uint32 dwBufType); // type of the buffer to invalidate as listed above under SPCM_BUF_XXXX + + + +/* +************************************************************************** + +GetContBuf +reads out the internal continuous memory buffer if one has been allocated +this continuous buffer allows faster data transfer especially on Express cards + +*************************************************************************** +*/ + +SPCM_IMPORT uint32 _stdcall spcm_dwGetContBuf_i64 ( + drv_handle hDevice, // handle to an already opened device + uint32 dwBufType, // type of the buffer to read as listed above under SPCM_BUF_XXXX + void** ppvDataBuffer, // address of available data buffer + uint64* pqwContBufLen); // length of available continuous buffer + +//************************************************************************* + +SPCM_IMPORT uint32 _stdcall spcm_dwGetContBuf_i64m ( + drv_handle hDevice, // handle to an already opened device + uint32 dwBufType, // type of the buffer to read as listed above under SPCM_BUF_XXXX + void** ppvDataBuffer, // address of available data buffer + uint32* pdwContBufLenH, // high part of length of available continuous buffer + uint32* pdwContBufLenL); // low part of length of available continuous buffer + + + +/* +************************************************************************** + +GetErrorInfo: +reads out the complete error information that is stored in the driver. +internal error locking is afterwards reset. +If hDevice is zero the last open error is returned. + +*************************************************************************** +*/ + +SPCM_IMPORT uint32 _stdcall spcm_dwGetErrorInfo_i32 ( + drv_handle hDevice, // handle to an already opened device + uint32* pdwErrorReg, // adress of the error register (can zero if not of interest) + int32* plErrorValue, // adress of the error value (can zero if not of interest) + char pszErrorTextBuffer[ERRORTEXTLEN]); // text buffer for text error + + + +/* +************************************************************************** + +StartEBox: +starts the ethernet box by instanciate the kernelhandle_lan_ebox. +The ethernet box is the server with a card with is waiting for +request by lan-client (host pc). + +*************************************************************************** +*/ + +SPCM_IMPORT uint32 _stdcall spcm_dwStartEBox (); + + + +/* +************************************************************************** + +dwDiscovery: +the lan-client (host pc) starts a broadcast request and wait for a answer +with the VISA string. +A VISA string contains the ip address of the ethernet box. + +*************************************************************************** +*/ + +SPCM_IMPORT uint32 _stdcall spcm_dwDiscovery ( + char** pszVisaString, // user-allocated array of C-strings to return the VISA strings + uint32 dwMaxNoOfDevices, // the maximum number of devices to be returned + uint32 dwMaxVisaLen, // maximum length of one entry in pszVisaString + uint32 dwTimeout); // time in milli seconds that the function will wait until each device has answered. + + + +/* +************************************************************************** + +dwWriteIDNRequest: +the lan-client (host pc) sends a "IDN" request to the ethernet box. +So the ethernet box will send a message which contains the manufacturer, +the model, the serial number and the firmware version + +*************************************************************************** +*/ + +SPCM_IMPORT uint32 _stdcall spcm_dwSendIDNRequest ( + char** szIdnString, //the IDN string looks like that: <manufacturer>,<model>,<serial number>,<firmware version> + uint32 dwNoOfDevices, + uint32 dwIdnStringLen); //string which contains manufacturer, the model, the serial number and the firmware version diff --git a/Cpp/run.cpp b/Cpp/run.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a048923511b6c8b4ea1adeaad485c69ccf93d3ce --- /dev/null +++ b/Cpp/run.cpp @@ -0,0 +1,20 @@ +// Cpp.cpp : This file contains the 'main' function. Program execution begins and ends there. +// + +#include <iostream> + +int main() +{ + std::cout << "Hello World!\n"; +} + +// Run program: Ctrl + F5 or Debug > Start Without Debugging menu +// Debug program: F5 or Debug > Start Debugging menu + +// Tips for Getting Started: +// 1. Use the Solution Explorer window to add/manage files +// 2. Use the Team Explorer window to connect to source control +// 3. Use the Output window to see build output and other messages +// 4. Use the Error List window to view errors +// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project +// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file