|
|
|
@ -32,6 +32,8 @@
|
|
|
|
|
#include "gpib_functions.h"
|
|
|
|
|
#include "gpib/ib.h"
|
|
|
|
|
|
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
|
|
#include <tqimage.h>
|
|
|
|
|
|
|
|
|
|
extern char falpha[1024];
|
|
|
|
@ -602,11 +604,21 @@ int scope_perform_initial_setup(const char * scopeType, int gpibDevice) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define ENABLE_PROFILING
|
|
|
|
|
|
|
|
|
|
int scope_get_channel_trace(int desired_channel, const char * scopeType, int gpibDevice) {
|
|
|
|
|
char segarray[4194304];
|
|
|
|
|
long array_pointer;
|
|
|
|
|
long ai;
|
|
|
|
|
|
|
|
|
|
#ifdef ENABLE_PROFILING
|
|
|
|
|
struct timespec tp1, tp2, tp3, tp4, tp5, tp6, tp7;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef ENABLE_PROFILING
|
|
|
|
|
clock_gettime(CLOCK_REALTIME, &tp1);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// Send request
|
|
|
|
|
printf("[INFO] Getting oscilloscope trace for channel %d [Stage 1]\n\r", desired_channel);
|
|
|
|
|
if (strcmp("HP54600OS", scopeType) == 0) {
|
|
|
|
@ -621,11 +633,19 @@ int scope_get_channel_trace(int desired_channel, const char * scopeType, int gpi
|
|
|
|
|
printf("[DEBG] Writing: %s\n\r", falpha);
|
|
|
|
|
#endif
|
|
|
|
|
if (gpib_write(gpibDevice, falpha) == 0) {
|
|
|
|
|
#ifdef ENABLE_PROFILING
|
|
|
|
|
clock_gettime(CLOCK_REALTIME, &tp2);
|
|
|
|
|
printf("[PROFILE] %f s\n\r", ((tp2.tv_nsec+(tp2.tv_sec*1e9))-(tp1.tv_nsec+(tp1.tv_sec*1e9)))/1e9);
|
|
|
|
|
#endif
|
|
|
|
|
sprintf(falpha,"WFMPRE?");
|
|
|
|
|
#ifdef ENABLE_EXTRA_DEBUGGING
|
|
|
|
|
printf("[DEBG] Writing: %s\n\r", falpha);
|
|
|
|
|
#endif
|
|
|
|
|
if (gpib_write(gpibDevice, falpha) == 0) {
|
|
|
|
|
#ifdef ENABLE_PROFILING
|
|
|
|
|
clock_gettime(CLOCK_REALTIME, &tp3);
|
|
|
|
|
printf("[PROFILE] %f s\n\r", ((tp3.tv_nsec+(tp3.tv_sec*1e9))-(tp2.tv_nsec+(tp2.tv_sec*1e9)))/1e9);
|
|
|
|
|
#endif
|
|
|
|
|
// Read response
|
|
|
|
|
#ifdef ENABLE_EXTRA_DEBUGGING
|
|
|
|
|
printf("[DEBG] Trying to read %i bytes from GPIB device...\n", 65535);
|
|
|
|
@ -638,6 +658,10 @@ int scope_get_channel_trace(int desired_channel, const char * scopeType, int gpi
|
|
|
|
|
#ifdef ENABLE_EXTRA_DEBUGGING
|
|
|
|
|
printf("[DEBG] Read %li bytes from GPIB device\n", ai);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef ENABLE_PROFILING
|
|
|
|
|
clock_gettime(CLOCK_REALTIME, &tp4);
|
|
|
|
|
printf("[PROFILE] %f s\n\r", ((tp4.tv_nsec+(tp4.tv_sec*1e9))-(tp3.tv_nsec+(tp3.tv_sec*1e9)))/1e9);
|
|
|
|
|
#endif
|
|
|
|
|
TQString preamble(segarray);
|
|
|
|
|
TQStringList resultPairs = TQStringList::split(";", preamble, FALSE);
|
|
|
|
|
// Find/initialize critical data values
|
|
|
|
@ -663,6 +687,10 @@ int scope_get_channel_trace(int desired_channel, const char * scopeType, int gpi
|
|
|
|
|
printf("[DEBG] Writing: %s\n\r", falpha);
|
|
|
|
|
#endif
|
|
|
|
|
if (gpib_write(gpibDevice, falpha) == 0) {
|
|
|
|
|
#ifdef ENABLE_PROFILING
|
|
|
|
|
clock_gettime(CLOCK_REALTIME, &tp5);
|
|
|
|
|
printf("[PROFILE] %f s\n\r", ((tp5.tv_nsec+(tp5.tv_sec*1e9))-(tp4.tv_nsec+(tp4.tv_sec*1e9)))/1e9);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef ENABLE_EXTRA_DEBUGGING
|
|
|
|
|
printf("[DEBG] Trying to read %i bytes from GPIB device...\n", 65535*2);
|
|
|
|
|
#endif
|
|
|
|
@ -671,6 +699,10 @@ int scope_get_channel_trace(int desired_channel, const char * scopeType, int gpi
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
#ifdef ENABLE_PROFILING
|
|
|
|
|
clock_gettime(CLOCK_REALTIME, &tp6);
|
|
|
|
|
printf("[PROFILE] %f s\n\r", ((tp6.tv_nsec+(tp6.tv_sec*1e9))-(tp5.tv_nsec+(tp5.tv_sec*1e9)))/1e9);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef ENABLE_EXTRA_DEBUGGING
|
|
|
|
|
printf("[DEBG] Read %li bytes from GPIB device\n", ai);
|
|
|
|
|
#endif
|
|
|
|
@ -701,6 +733,10 @@ int scope_get_channel_trace(int desired_channel, const char * scopeType, int gpi
|
|
|
|
|
return -2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef ENABLE_PROFILING
|
|
|
|
|
clock_gettime(CLOCK_REALTIME, &tp7);
|
|
|
|
|
printf("[PROFILE] %f s\n\r", ((tp7.tv_nsec+(tp7.tv_sec*1e9))-(tp6.tv_nsec+(tp6.tv_sec*1e9)))/1e9);
|
|
|
|
|
#endif
|
|
|
|
|
return array_pointer;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|