Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a7ffdcc6b3f5
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0fc1a0dd4566
Choose a head ref
  • 11 commits
  • 12 files changed
  • 2 contributors

Commits on Jun 21, 2020

  1. Copy the full SHA
    035fb1c View commit details
  2. Copy the full SHA
    0bf8ab0 View commit details
  3. Replaced usleep() call in Rigol driver on Win32

    nshcat committed Jun 21, 2020
    Copy the full SHA
    18980a5 View commit details
  4. Copy the full SHA
    cb65e31 View commit details
  5. Copy the full SHA
    56adc07 View commit details
  6. Copy the full SHA
    59e1042 View commit details
  7. Copy the full SHA
    705898d View commit details
  8. Copy the full SHA
    d2ce20b View commit details
  9. Copy the full SHA
    1d088eb View commit details
  10. Fixed typo

    nshcat committed Jun 21, 2020
    Copy the full SHA
    6bd3b39 View commit details
  11. Merge pull request #156 from nshcat/win32_fixed

    Fixes to allow compilation on Win32
    azonenberg authored Jun 21, 2020
    Copy the full SHA
    0fc1a0d View commit details
14 changes: 13 additions & 1 deletion scopehal/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -3,6 +3,14 @@ link_directories(${GTKMM_LIBRARY_DIRS} ${SIGCXX_LIBRARY_DIRS})

find_library(LXI_LIB lxi)

if(LXI_LIB)
set(HAS_LXI true)
set(LXI_LIBRARIES ${LXI_LIB})
else()
set(HAS_LXI false)
set(LXI_LIBRARIES "")
endif()

set(SCOPEHAL_SOURCES
base64.cpp
scopehal.cpp
@@ -41,9 +49,13 @@ set(SCOPEHAL_SOURCES

add_library(scopehal SHARED
${SCOPEHAL_SOURCES})
target_link_libraries(scopehal ${SIGCXX_LIBRARIES} ${GTKMM_LIBRARIES} xptools log graphwidget yaml-cpp ${LXI_LIB})
target_link_libraries(scopehal ${SIGCXX_LIBRARIES} ${GTKMM_LIBRARIES} xptools log graphwidget yaml-cpp ${LXI_LIBRARIES})

target_include_directories(scopehal
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

if(${HAS_LXI})
target_compile_definitions(scopehal PUBLIC HAS_LXI)
endif()

install(TARGETS scopehal LIBRARY DESTINATION /usr/lib)
4 changes: 4 additions & 0 deletions scopehal/LeCroyOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -27,6 +27,8 @@
* *
***********************************************************************************************************************/

#ifndef _WIN32

#include "scopehal.h"
#include "LeCroyOscilloscope.h"
#include "ProtocolDecoder.h"
@@ -2153,3 +2155,5 @@ int64_t LeCroyOscilloscope::GetDeskewForChannel(size_t channel)

return skew_ps;
}

#endif
4 changes: 4 additions & 0 deletions scopehal/LeCroyOscilloscope.h
Original file line number Diff line number Diff line change
@@ -27,6 +27,8 @@
* *
***********************************************************************************************************************/

#ifndef _WIN32

#ifndef LeCroyOscilloscope_h
#define LeCroyOscilloscope_h

@@ -243,3 +245,5 @@ class LeCroyOscilloscope
};

#endif

#endif
13 changes: 13 additions & 0 deletions scopehal/RigolOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -27,6 +27,11 @@
* *
***********************************************************************************************************************/

#ifdef _WIN32
#include <chrono>
#include <thread>
#endif

#include "scopehal.h"
#include "RigolOscilloscope.h"

@@ -463,7 +468,11 @@ void RigolOscilloscope::ResetTriggerConditions()
Oscilloscope::TriggerMode RigolOscilloscope::PollTrigger()
{
//workaround for high latency links to let the UI thread get the mutex
#ifdef _WIN32
std::this_thread::sleep_for(std::chrono::microseconds(1000));
#else
usleep(1000);
#endif

lock_guard<recursive_mutex> lock(m_mutex);

@@ -502,7 +511,11 @@ bool RigolOscilloscope::AcquireData(bool toQueue)
bool enabled[4] = {true, true, true, true};

//workaround for high latency links to let the UI thread get the mutex
#ifdef _WIN32
std::this_thread::sleep_for(std::chrono::microseconds(1000));
#else
usleep(1000);
#endif

lock_guard<recursive_mutex> lock(m_mutex);
LogIndenter li;
4 changes: 4 additions & 0 deletions scopehal/SCPILxiTransport.cpp
Original file line number Diff line number Diff line change
@@ -32,6 +32,8 @@
@author Tom Verbeure
@brief Implementation of SCPILxiTransport
*/

#ifdef HAS_LXI

extern "C"
{
@@ -222,3 +224,5 @@ bool SCPILxiTransport::IsCommandBatchingSupported()
{
return false;
}

#endif
4 changes: 4 additions & 0 deletions scopehal/SCPILxiTransport.h
Original file line number Diff line number Diff line change
@@ -33,6 +33,8 @@
@brief Declaration of SCPILxiTransport
*/

#ifdef HAS_LXI

#ifndef SCPILxiTransport_h
#define SCPILxiTransport_h

@@ -78,3 +80,5 @@ class SCPILxiTransport : public SCPITransport
};

#endif

#endif
4 changes: 4 additions & 0 deletions scopehal/SiglentSCPIOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -27,6 +27,8 @@
* *
***********************************************************************************************************************/

#ifndef _WIN32

#include "scopehal.h"
#include "SiglentSCPIOscilloscope.h"
#include "ProtocolDecoder.h"
@@ -398,3 +400,5 @@ bool SiglentSCPIOscilloscope::AcquireData(bool toQueue)

return true;
}

#endif
4 changes: 4 additions & 0 deletions scopehal/SiglentSCPIOscilloscope.h
Original file line number Diff line number Diff line change
@@ -27,6 +27,8 @@
* *
***********************************************************************************************************************/

#ifndef _WIN32

#ifndef SiglentSCPIOscilloscope_h
#define SiglentSCPIOscilloscope_h

@@ -204,3 +206,5 @@ struct SiglentWaveformDesc_t
};

#endif

#endif
15 changes: 13 additions & 2 deletions scopehal/scopehal.cpp
Original file line number Diff line number Diff line change
@@ -42,7 +42,10 @@
#include "RohdeSchwarzOscilloscope.h"
#include "SiglentSCPIOscilloscope.h"
#include <libgen.h>

#ifndef _WIN32
#include <dlfcn.h>
#endif

using namespace std;

@@ -52,9 +55,12 @@ using namespace std;
void TransportStaticInit()
{
AddTransportClass(SCPISocketTransport);
AddTransportClass(SCPILxiTransport);
AddTransportClass(SCPITMCTransport);
AddTransportClass(VICPSocketTransport);

#ifdef HAS_LXI
AddTransportClass(SCPILxiTransport);
#endif
}

/**
@@ -65,10 +71,13 @@ void DriverStaticInit()
AddDriverClass(AgilentOscilloscope);
AddDriverClass(AntikernelLabsOscilloscope);
AddDriverClass(AntikernelLogicAnalyzer);
AddDriverClass(LeCroyOscilloscope);
AddDriverClass(RigolOscilloscope);
AddDriverClass(RohdeSchwarzOscilloscope);

#ifndef _WIN32
AddDriverClass(LeCroyOscilloscope);
AddDriverClass(SiglentSCPIOscilloscope);
#endif
}

string GetDefaultChannelColor(int i)
@@ -109,6 +118,7 @@ uint64_t ConvertVectorSignalToScalar(vector<bool> bits)
*/
void InitializePlugins()
{
#ifndef _WIN32
char tmp[1024];
vector<string> search_dirs;
search_dirs.push_back("/usr/lib/scopehal/plugins/");
@@ -157,4 +167,5 @@ void InitializePlugins()

closedir(hdir);
}
#endif
}
1 change: 1 addition & 0 deletions scopeprotocols/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -68,6 +68,7 @@ add_library(scopeprotocols SHARED
${SCOPEPROTOCOLS_SOURCES})

target_link_libraries(scopeprotocols
scopehal
${LIBFFTS_LIBRARIES})

target_include_directories(scopeprotocols
20 changes: 20 additions & 0 deletions scopeprotocols/FFTDecoder.cpp
Original file line number Diff line number Diff line change
@@ -31,6 +31,10 @@
#include "FFTDecoder.h"
#include <ffts.h>

#ifdef _WIN32
#include <windows.h>
#endif

using namespace std;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -125,12 +129,23 @@ void FFTDecoder::Refresh()
//TODO: handle non-uniform sample rates
float* rdin;
size_t insize = npoints * sizeof(float);

#ifdef _WIN32
rdin = (float*)_aligned_malloc(insize, 32);
#else
posix_memalign((void**)&rdin, 32, insize);
#endif

memcpy(rdin, &din->m_samples[0], insize);

float* rdout;
const size_t nouts = npoints/2 + 1;

#ifdef _WIN32
rdout = (float*)_aligned_malloc(2 * nouts * sizeof(float), 32);
#else
posix_memalign((void**)&rdout, 32, 2 * nouts * sizeof(float));
#endif

//Calculate the FFT
auto plan = ffts_init_1d_real(npoints, FFTS_FORWARD);
@@ -175,6 +190,11 @@ void FFTDecoder::Refresh()
SetData(cap);

//Clean up
#ifdef _WIN32
_aligned_free(rdin);
_aligned_free(rdout);
#else
free(rdin);
free(rdout);
#endif
}
5 changes: 5 additions & 0 deletions scopeprotocols/SincInterpolationDecoder.cpp
Original file line number Diff line number Diff line change
@@ -27,6 +27,11 @@
* *
***********************************************************************************************************************/

#ifdef _WIN32
#define _USE_MATH_DEFINES
#include <cmath>
#endif

#include "../scopehal/scopehal.h"
#include "SincInterpolationDecoder.h"