2
0
forked from Ivasoft/DSView

the step 1 of code refactoring

This commit is contained in:
dreamsourcelabTAI
2022-07-14 13:50:40 +08:00
parent a3d3ebc05b
commit b63cc00d9e
69 changed files with 421 additions and 523 deletions

View File

@@ -21,8 +21,8 @@
#include "appcontrol.h"
#include "libsigrok.h"
#include "libsigrokdecode.h"
#include <libsigrok.h>
#include <libsigrokdecode.h>
#include <QDir>
#include <QCoreApplication>
#include <QWidget>

View File

@@ -24,8 +24,7 @@
#ifndef DSVIEW_PV_DATA_ANALOGSNAPSHOT_H
#define DSVIEW_PV_DATA_ANALOGSNAPSHOT_H
#include "libsigrok.h"
#include <libsigrok.h>
#include "snapshot.h"
#include <utility>

View File

@@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libsigrokdecode.h"
#include <libsigrokdecode.h>
#include <vector>
#include <assert.h>

View File

@@ -212,8 +212,7 @@ const char* AnnotationResTable::format_to_string(const char *hex_str, int fmt)
sprintf(g_number_tmp_64, "%c", (char)lv);
return g_number_tmp_64;
}
}
char * const wr_buf = g_number_tmp_64;
}
g_number_tmp_64[0] = '[';
strcpy(g_number_tmp_64 + 1, data);
g_number_tmp_64[len+1] = ']';

View File

@@ -20,8 +20,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libsigrokdecode.h"
#include <libsigrokdecode.h>
#include "decoder.h"
#include <assert.h>

View File

@@ -21,7 +21,7 @@
#include "row.h"
#include "libsigrokdecode.h"
#include <libsigrokdecode.h>
#include <assert.h>
namespace pv {

View File

@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libsigrokdecode.h"
#include <libsigrokdecode.h>
#include "decode/annotation.h"
#include "decode/rowdata.h"

View File

@@ -23,7 +23,7 @@
#ifndef DSVIEW_PV_DATA_DECODERSTACK_H
#define DSVIEW_PV_DATA_DECODERSTACK_H
#include "libsigrokdecode.h"
#include <libsigrokdecode.h>
#include <list>
#include <boost/optional.hpp>
#include <QObject>

View File

@@ -27,7 +27,7 @@
#include <vector>
#include <map>
#include "libsigrok.h"
#include <libsigrok.h>
#include "snapshot.h"
namespace DsoSnapshotTest {

View File

@@ -24,7 +24,7 @@
#ifndef DSVIEW_PV_DATA_LOGICSNAPSHOT_H
#define DSVIEW_PV_DATA_LOGICSNAPSHOT_H
#include "libsigrok.h"
#include <libsigrok.h>
#include "snapshot.h"
#include <QString>
#include <utility>

View File

@@ -23,12 +23,10 @@
#define DSVIEW_PV_DEVICE_DEVINST_H
#include <QObject>
#include <string>
#include <glib.h>
#include <stdint.h>
#include "libsigrok.h"
#include <libsigrok.h>
struct sr_dev_inst;
struct sr_channel;

View File

@@ -20,7 +20,7 @@
*/
#include "decoderoptionsdlg.h"
#include "libsigrokdecode.h"
#include <libsigrokdecode.h>
#include <QScrollArea>
#include <QDialogButtonBox>
#include <assert.h>

View File

@@ -24,6 +24,7 @@
#ifndef DSVIEW_PV_DEVICEOPTIONS_H
#define DSVIEW_PV_DEVICEOPTIONS_H
#include <libsigrok.h>
#include <QDialog>
#include <QDialogButtonBox>
#include <QGroupBox>
@@ -36,9 +37,7 @@
#include <QRadioButton>
#include <QTimer>
#include <QWidget>
#include <vector>
#include "libsigrok.h"
#include <vector>
#include "../device/devinst.h"
#include "../prop/binding/deviceoptions.h"
#include "../prop/binding/probeoptions.h"

View File

@@ -23,7 +23,7 @@
#ifndef DSVIEW_PV_PROTOCOLDOCK_H
#define DSVIEW_PV_PROTOCOLDOCK_H
#include "libsigrokdecode.h"
#include <libsigrokdecode.h>
#include <QDockWidget>
#include <QPushButton>

View File

@@ -34,8 +34,7 @@
#include <QInputMethodEvent>
#include <QApplication>
#include <math.h>
#include "libsigrok.h"
#include <libsigrok.h>
namespace pv {
namespace dock {

View File

@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libsigrokdecode.h"
#include <libsigrokdecode.h>
#include "decoderoptions.h"
#include <boost/bind.hpp>

View File

@@ -28,8 +28,7 @@
#include <boost/optional.hpp>
#include <QString>
#include "libsigrok.h"
#include <libsigrok.h>
#include "binding.h"
namespace pv {

View File

@@ -27,8 +27,7 @@
#include <boost/optional.hpp>
#include <QString>
#include "libsigrok.h"
#include <libsigrok.h>
#include "binding.h"
namespace pv {

View File

@@ -21,7 +21,7 @@
*/
#include "libsigrokdecode.h"
#include <libsigrokdecode.h>
#include "sigsession.h"
#include "mainwindow.h"

View File

@@ -36,7 +36,7 @@
#include "data/mathstack.h"
#include "interface/icallbacks.h"
#include "dstimer.h"
#include "libsigrok.h"
#include <libsigrok.h>
struct srd_decoder;

View File

@@ -55,7 +55,7 @@
#include <QTextCodec>
#endif
#include "libsigrokdecode.h"
#include <libsigrokdecode.h>
#include "config/appconfig.h"
#include "dsvdef.h"
#include "utility/encoding.h"

View File

@@ -27,7 +27,7 @@
#include <string>
#include <thread>
#include <QObject>
#include "libsigrok.h"
#include <libsigrok.h>
#include "interface/icallbacks.h"

View File

@@ -27,7 +27,7 @@
#include <QToolButton>
#include <QAction>
#include <QMenu>
#include "libsigrok.h"
#include <libsigrok.h>
#include "../sigsession.h"
#include "../interface/uicallback.h"

View File

@@ -20,10 +20,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libsigrokdecode.h"
#include "../dsvdef.h"
#include <libsigrokdecode.h>
#include "../dsvdef.h"
#include <boost/functional/hash.hpp>
#include <QAction>
#include <QFormLayout>

View File

@@ -34,7 +34,7 @@
#include <QToolButton>
#include <QLabel>
#include "libsigrok.h"
#include <libsigrok.h>
namespace pv {

View File

@@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libsigrokdecode.h"
#include <libsigrokdecode.h>
#include <math.h>
#include "logicsignal.h"
#include "view.h"

View File

@@ -34,7 +34,7 @@
#include <stdint.h>
#include <list>
#include "libsigrok.h"
#include <libsigrok.h>
#include "trace.h"
namespace pv {

View File

@@ -26,9 +26,8 @@
#include <QLabel>
#include <QDateTime>
#include <QPushButton>
#include <QToolButton>
#include "libsigrok.h"
#include <QToolButton>
#include <libsigrok.h>
namespace pv {

View File

@@ -19,8 +19,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libsigrokdecode.h"
#include <libsigrokdecode.h>
#include "decodergroupbox.h"
#include "../data/decoderstack.h"
#include "../data/decode/decoder.h"

View File

@@ -19,8 +19,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libsigrokdecode.h"
#include <libsigrokdecode.h>
#include "decodermenu.h"
#include <assert.h>

1
lang/cn/dsl.txt Normal file
View File

@@ -0,0 +1 @@

View File

@@ -17,8 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "libsigrok.h"
#include "libsigrok-internal.h"
#include <glib.h>
#include "config.h" /* Needed for HAVE_LIBUSB_1_0 and others. */
@@ -85,35 +84,7 @@
*
* Example for a minimal program using libsigrok:
*
* @code{.c}
* #include <stdio.h>
* #include <libsigrok/libsigrok.h>
*
* int main(int argc, char **argv)
* {
* int ret;
* struct sr_context *sr_ctx;
*
* if ((ret = sr_init(&sr_ctx)) != SR_OK) {
* printf("Error initializing libsigrok (%s): %s.",
* sr_strerror_name(ret), sr_strerror(ret));
* return 1;
* }
*
* // Use libsigrok functions here...
*
* if ((ret = sr_exit(sr_ctx)) != SR_OK) {
* printf("Error shutting down libsigrok (%s): %s.",
* sr_strerror_name(ret), sr_strerror(ret));
* return 1;
* }
*
* return 0;
* }
* @endcode
*
* @{
*/
/**
* Sanity-check all libsigrok drivers.
@@ -365,14 +336,12 @@ SR_API int sr_init(struct sr_context **ctx)
context->hotplug_tv.tv_sec = 0;
context->hotplug_tv.tv_usec = 0;
#ifdef HAVE_LIBUSB_1_0
ret = libusb_init(&context->libusb_ctx);
if (LIBUSB_SUCCESS != ret) {
sr_err("libusb_init() returned %s.\n", libusb_error_name(ret));
ret = SR_ERR;
goto done;
}
#endif
*ctx = context;
context = NULL;
@@ -402,10 +371,8 @@ SR_API int sr_exit(struct sr_context *ctx)
sr_hw_cleanup_all();
#ifdef HAVE_LIBUSB_1_0
libusb_exit(ctx->libusb_ctx);
#endif
g_free(ctx);
sr_log_uninit(); //try uninit log

View File

@@ -17,7 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "libsigrok.h"
#include "libsigrok-internal.h"
#include <stdio.h>
#include <glib.h>
@@ -239,8 +238,6 @@ SR_PRIV void sr_dev_inst_free(struct sr_dev_inst *sdi)
g_free(sdi);
}
#ifdef HAVE_LIBUSB_1_0
/** @private */
SR_PRIV struct sr_usb_dev_inst *sr_usb_dev_inst_new(uint8_t bus,
uint8_t address, struct libusb_device_handle *hdl)
@@ -267,8 +264,6 @@ SR_PRIV void sr_usb_dev_inst_free(struct sr_usb_dev_inst *usb)
/* Nothing to do for this device instance type. */
}
#endif
/**
* @private
*

View File

@@ -17,9 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../../libsigrok.h"
#include "../../libsigrok-internal.h"
#include "../../libsigrok-internal.h"
#include "command.h"
#include "dsl.h"
#include <assert.h>

View File

@@ -20,8 +20,7 @@
#ifndef LIBDSL_HARDWARE_COMMAND_H
#define LIBDSL_HARDWARE_COMMAND_H
#include <glib.h>
#include "../../libsigrok.h"
#include <glib.h>
#include "../../libsigrok-internal.h"
/* Protocol commands */

View File

@@ -18,9 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../../libsigrok.h"
#include "../../libsigrok-internal.h"
#include "../../libsigrok-internal.h"
#include "dsl.h"
#include "command.h"
#include "../../log.h"

View File

@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../../libsigrok.h"
#include "../../libsigrok-internal.h"
#include "command.h"
#include "dsl.h"
@@ -27,6 +27,9 @@
#include <assert.h>
#include <sys/stat.h>
#undef LOG_PREFIX
#define LOG_PREFIX "DSL Hardware: "
extern struct ds_trigger *trigger;
static const int32_t probeOptions[] = {
@@ -76,6 +79,18 @@ static struct sr_dev_mode mode_list[] = {
{DSO, "Oscilloscope", "示波器", "osc", "osc.svg"},
};
static const gboolean default_ms_en[] = {
FALSE, /* DSO_MS_BEGIN */
TRUE, /* DSO_MS_FREQ */
FALSE, /* DSO_MS_PERD */
TRUE, /* DSO_MS_VMAX */
TRUE, /* DSO_MS_VMIN */
FALSE, /* DSO_MS_VRMS */
FALSE, /* DSO_MS_VMEA */
FALSE, /* DSO_MS_VP2P */
};
SR_PRIV void dsl_probe_init(struct sr_dev_inst *sdi)
{
unsigned int i, j;

View File

@@ -21,8 +21,7 @@
#ifndef LIBDSL_HARDWARE_DSL_H
#define LIBDSL_HARDWARE_DSL_H
#include <glib.h>
#include "../../libsigrok.h"
#include <glib.h>
#include "../../libsigrok-internal.h"
#include "command.h"
@@ -36,15 +35,7 @@
#include <sys/stat.h>
#include <inttypes.h>
#undef min
#define min(a,b) ((a)<(b)?(a):(b))
#undef max
#define max(a,b) ((a)>(b)?(a):(b))
#undef LOG_PREFIX
#define LOG_PREFIX "DSL Hardware: "
#define USB_INTERFACE 0
#define USB_CONFIGURATION 1
#define NUM_TRIGGER_STAGES 16
@@ -1052,16 +1043,7 @@ static const struct DSL_profile supported_DSCope[] = {
{ 0, 0, LIBUSB_SPEED_UNKNOWN, 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}}
};
static const gboolean default_ms_en[] = {
FALSE, /* DSO_MS_BEGIN */
TRUE, /* DSO_MS_FREQ */
FALSE, /* DSO_MS_PERD */
TRUE, /* DSO_MS_VMAX */
TRUE, /* DSO_MS_VMIN */
FALSE, /* DSO_MS_VRMS */
FALSE, /* DSO_MS_VMEA */
FALSE, /* DSO_MS_VP2P */
};
enum {
DSL_ERROR = -1,

View File

@@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../../libsigrok.h"
#include "../../libsigrok-internal.h"
#include "dsl.h"
@@ -28,6 +28,14 @@
#undef LOG_PREFIX
#define LOG_PREFIX "dslogic: "
static const char *maxHeights[] = {
"1X",
"2X",
"3X",
"4X",
"5X",
};
enum {
/** Buffer mode */
OP_BUFFER = 0,
@@ -87,14 +95,6 @@ static const char *filters[] = {
"1 Sample Clock",
};
static const char *maxHeights[] = {
"1X",
"2X",
"3X",
"4X",
"5X",
};
static const int32_t hwoptions[] = {
SR_CONF_OPERATION_MODE,
SR_CONF_BUFFER_OPTIONS,

View File

@@ -20,7 +20,7 @@
/*
* Helper functions for the Cypress EZ-USB / FX2 series chips.
*/
#include "../../libsigrok.h"
#include "../../libsigrok-internal.h"
#include <glib.h>
#include <glib/gstdio.h>

View File

@@ -17,7 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../../libsigrok.h"
#include "../../libsigrok-internal.h"
#include <stdlib.h>
#include <glib.h>

View File

@@ -21,6 +21,22 @@
*/
#include "demo.h"
#include <math.h>
#include <errno.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <inttypes.h>
#include <unistd.h>
#ifdef _WIN32
#include <io.h>
#include <fcntl.h>
#define pipe(fds) _pipe(fds, 4096, _O_BINARY)
#endif
#include "../../log.h"
/* Message logging helpers with subsystem-specific prefix string. */
@@ -68,6 +84,97 @@ static const uint8_t probeCoupling[] = {
SR_AC_COUPLING,
};
static const char *maxHeights[] = {
"1X",
"2X",
"3X",
"4X",
"5X",
};
/* We name the probes 0-7 on our demo driver. */
static const char *probe_names[] = {
"0", "1", "2", "3",
"4", "5", "6", "7",
"8", "9", "10", "11",
"12", "13", "14", "15",
NULL,
};
static const char *probeMapUnits[] = {
"V",
"A",
"°C",
"°F",
"g",
"m",
"m/s",
};
static const gboolean default_ms_en[] = {
FALSE, /* DSO_MS_BEGIN */
TRUE, /* DSO_MS_FREQ */
FALSE, /* DSO_MS_PERD */
TRUE, /* DSO_MS_VMAX */
TRUE, /* DSO_MS_VMIN */
FALSE, /* DSO_MS_VRMS */
FALSE, /* DSO_MS_VMEA */
FALSE, /* DSO_MS_VP2P */
};
static struct sr_dev_mode mode_list[] = {
{LOGIC, "Logic Analyzer", "逻辑分析仪", "la", "la.svg"},
{ANALOG, "Data Acquisition", "数据记录仪", "daq", "daq.svg"},
{DSO, "Oscilloscope", "示波器", "osc", "osc.svg"},
};
/* hardware Capabilities */
#define CAPS_MODE_LOGIC (1 << 0)
#define CAPS_MODE_ANALOG (1 << 1)
#define CAPS_MODE_DSO (1 << 2)
#define CAPS_FEATURE_NONE 0
// zero calibration ability
#define CAPS_FEATURE_ZERO (1 << 4)
/* end */
static const struct DEMO_profile supported_Demo[] = {
/*
* Demo
*/
{"DreamSourceLab", "Demo Device", NULL,
{CAPS_MODE_LOGIC | CAPS_MODE_ANALOG | CAPS_MODE_DSO,
CAPS_FEATURE_NONE,
(1 << DEMO_LOGIC100x16) |
(1 << DEMO_ANALOG10x2) |
(1 << DEMO_DSO200x2),
SR_Mn(100),
SR_Kn(20),
0,
vdivs10to2000,
0,
DEMO_LOGIC100x16,
PATTERN_SINE,
SR_NS(500)}
},
{ 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}
};
static const struct DEMO_channels channel_modes[] = {
// LA Stream
{DEMO_LOGIC100x16, LOGIC, SR_CHANNEL_LOGIC, 16, 1, SR_MHZ(1), SR_Mn(1),
SR_KHZ(10), SR_MHZ(100), "Use 16 Channels (Max 20MHz)"},
// DAQ
{DEMO_ANALOG10x2, ANALOG, SR_CHANNEL_ANALOG, 2, 8, SR_MHZ(1), SR_Mn(1),
SR_HZ(10), SR_MHZ(10), "Use Channels 0~1 (Max 10MHz)"},
// OSC
{DEMO_DSO200x2, DSO, SR_CHANNEL_DSO, 2, 8, SR_MHZ(100), SR_Kn(10),
SR_HZ(100), SR_MHZ(200), "Use Channels 0~1 (Max 200MHz)"}
};
/* Private, per-device-instance driver context. */
/* TODO: struct context as with the other drivers. */

View File

@@ -22,47 +22,8 @@
#define LIBDSL_HARDWARE_DEMO_H
#include <glib.h>
#include "../../libsigrok.h"
#include "../../libsigrok-internal.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <errno.h>
#include <assert.h>
#include <sys/stat.h>
#include <inttypes.h>
#include <unistd.h>
#ifdef _WIN32
#include <io.h>
#include <fcntl.h>
#define pipe(fds) _pipe(fds, 4096, _O_BINARY)
#endif
#undef min
#define min(a,b) ((a)<(b)?(a):(b))
#undef max
#define max(a,b) ((a)>(b)?(a):(b))
/* hardware Capabilities */
#define CAPS_MODE_LOGIC (1 << 0)
#define CAPS_MODE_ANALOG (1 << 1)
#define CAPS_MODE_DSO (1 << 2)
#define CAPS_FEATURE_NONE 0
// zero calibration ability
#define CAPS_FEATURE_ZERO (1 << 4)
/* end */
static struct sr_dev_mode mode_list[] = {
{LOGIC, "Logic Analyzer", "逻辑分析仪", "la", "la.svg"},
{ANALOG, "Data Acquisition", "数据记录仪", "daq", "daq.svg"},
{DSO, "Oscilloscope", "示波器", "osc", "osc.svg"},
};
/* Supported patterns which we can generate */
enum DEMO_PATTERN {
PATTERN_SINE = 0,
@@ -135,43 +96,6 @@ struct DEMO_channels {
const char *descr;
};
static const struct DEMO_channels channel_modes[] = {
// LA Stream
{DEMO_LOGIC100x16, LOGIC, SR_CHANNEL_LOGIC, 16, 1, SR_MHZ(1), SR_Mn(1),
SR_KHZ(10), SR_MHZ(100), "Use 16 Channels (Max 20MHz)"},
// DAQ
{DEMO_ANALOG10x2, ANALOG, SR_CHANNEL_ANALOG, 2, 8, SR_MHZ(1), SR_Mn(1),
SR_HZ(10), SR_MHZ(10), "Use Channels 0~1 (Max 10MHz)"},
// OSC
{DEMO_DSO200x2, DSO, SR_CHANNEL_DSO, 2, 8, SR_MHZ(100), SR_Kn(10),
SR_HZ(100), SR_MHZ(200), "Use Channels 0~1 (Max 200MHz)"}
};
static const struct DEMO_profile supported_Demo[] = {
/*
* Demo
*/
{"DreamSourceLab", "Demo Device", NULL,
{CAPS_MODE_LOGIC | CAPS_MODE_ANALOG | CAPS_MODE_DSO,
CAPS_FEATURE_NONE,
(1 << DEMO_LOGIC100x16) |
(1 << DEMO_ANALOG10x2) |
(1 << DEMO_DSO200x2),
SR_Mn(100),
SR_Kn(20),
0,
vdivs10to2000,
0,
DEMO_LOGIC100x16,
PATTERN_SINE,
SR_NS(500)}
},
{ 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}
};
struct demo_context {
const struct DEMO_profile *profile;
@@ -246,43 +170,7 @@ static const uint64_t samplerates[] = {
SR_GHZ(10),
};
static const char *probeMapUnits[] = {
"V",
"A",
"°C",
"°F",
"g",
"m",
"m/s",
};
/* We name the probes 0-7 on our demo driver. */
static const char *probe_names[] = {
"0", "1", "2", "3",
"4", "5", "6", "7",
"8", "9", "10", "11",
"12", "13", "14", "15",
NULL,
};
static const gboolean default_ms_en[] = {
FALSE, /* DSO_MS_BEGIN */
TRUE, /* DSO_MS_FREQ */
FALSE, /* DSO_MS_PERD */
TRUE, /* DSO_MS_VMAX */
TRUE, /* DSO_MS_VMIN */
FALSE, /* DSO_MS_VRMS */
FALSE, /* DSO_MS_VMEA */
FALSE, /* DSO_MS_VP2P */
};
static const char *maxHeights[] = {
"1X",
"2X",
"3X",
"4X",
"5X",
};
static const int const_dc = 1.95 / 10 * 255;
static const int sinx[] = {

View File

@@ -16,8 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "libsigrok.h"
#include "libsigrok-internal.h"
#include <stdlib.h>
#include <stdio.h>

View File

@@ -17,7 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../libsigrok.h"
#include "../libsigrok-internal.h"
#include <stdlib.h>
#include <sys/types.h>

View File

@@ -57,7 +57,7 @@
/* */
#include "../libsigrok.h"
#include "../libsigrok-internal.h"
#include <stdlib.h>
#include <glib.h>

View File

@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../libsigrok.h"
#include "../libsigrok-internal.h"
#include <sys/types.h>
#include <sys/stat.h>

View File

@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../libsigrok.h"
#include "../libsigrok-internal.h"
/**

View File

@@ -23,12 +23,8 @@
//#include <stdarg.h>
#include <glib.h>
#include "config.h" /* Needed for HAVE_LIBUSB_1_0 and others. */
#ifdef HAVE_LIBUSB_1_0
#include <libusb-1.0/libusb.h>
#endif
// firmware binary file directory, endswith letter '/'
extern char DS_RES_PATH[500];
#include "libsigrok.h"
/**
* @file
@@ -46,23 +42,28 @@ extern char DS_RES_PATH[500];
#define ARRAY_AND_SIZE(a) (a), ARRAY_SIZE(a)
#endif
#undef min
#define min(a,b) ((a)<(b)?(a):(b))
#undef max
#define max(a,b) ((a)>(b)?(a):(b))
// firmware binary file directory, endswith letter '/'
extern char DS_RES_PATH[500];
struct sr_context {
#ifdef HAVE_LIBUSB_1_0
libusb_context *libusb_ctx;
libusb_hotplug_callback_handle hotplug_handle;
hotplug_event_callback hotplug_callback;
void *hotplug_user_data;
struct timeval hotplug_tv;
#endif
};
#ifdef HAVE_LIBUSB_1_0
struct sr_usb_dev_inst {
uint8_t bus;
uint8_t address;
struct libusb_device_handle *devhdl;
};
#endif
#define SERIAL_PARITY_NONE 0
#define SERIAL_PARITY_EVEN 1
@@ -80,6 +81,28 @@ struct drv_context {
};
/*
* Oscilloscope
*/
#define MAX_TIMEBASE SR_SEC(10)
#define MIN_TIMEBASE SR_NS(10)
struct ds_trigger {
uint16_t trigger_en;
uint16_t trigger_mode;
uint16_t trigger_pos;
uint16_t trigger_stages;
unsigned char trigger_logic[TriggerStages+1];
unsigned char trigger0_inv[TriggerStages+1];
unsigned char trigger1_inv[TriggerStages+1];
char trigger0[TriggerStages+1][MaxTriggerProbes];
char trigger1[TriggerStages+1][MaxTriggerProbes];
uint32_t trigger0_count[TriggerStages+1];
uint32_t trigger1_count[TriggerStages+1];
};
/*--- device.c --------------------------------------------------------------*/
SR_PRIV struct sr_channel *sr_channel_new(uint16_t index, int type,
@@ -91,13 +114,11 @@ SR_PRIV struct sr_dev_inst *sr_dev_inst_new(int mode, int index, int status,
const char *vendor, const char *model, const char *version);
SR_PRIV void sr_dev_inst_free(struct sr_dev_inst *sdi);
#ifdef HAVE_LIBUSB_1_0
/* USB-specific instances */
SR_PRIV struct sr_usb_dev_inst *sr_usb_dev_inst_new(uint8_t bus,
uint8_t address, struct libusb_device_handle *hdl);
SR_PRIV GSList *sr_usb_find_usbtmc(libusb_context *usb_ctx);
SR_PRIV void sr_usb_dev_inst_free(struct sr_usb_dev_inst *usb);
#endif
/* Serial-specific instances */
SR_PRIV struct sr_serial_dev_inst *sr_serial_dev_inst_new(const char *port,
@@ -174,21 +195,17 @@ SR_PRIV int serial_stream_detect(struct sr_serial_dev_inst *serial,
/*--- hardware/common/ezusb.c -----------------------------------------------*/
#ifdef HAVE_LIBUSB_1_0
SR_PRIV int ezusb_reset(struct libusb_device_handle *hdl, int set_clear);
SR_PRIV int ezusb_install_firmware(libusb_device_handle *hdl,
const char *filename);
SR_PRIV int ezusb_upload_firmware(libusb_device *dev, int configuration,
const char *filename);
#endif
/*--- hardware/common/usb.c -------------------------------------------------*/
#ifdef HAVE_LIBUSB_1_0
SR_PRIV GSList *sr_usb_find(libusb_context *usb_ctx, const char *conn);
SR_PRIV int sr_usb_open(libusb_context *usb_ctx, struct sr_usb_dev_inst *usb);
#endif
#endif

View File

@@ -21,12 +21,12 @@
#define LIBSIGROK_SIGROK_H
#include <sys/time.h>
#include <stdio.h>
#include <sys/time.h>
#include <stdint.h>
#include <inttypes.h>
#include <glib.h>
//#include "version.h"
#ifdef __cplusplus
extern "C" {
@@ -81,6 +81,23 @@ enum {
*/
};
#define SR_MAX_PROBENAME_LEN 32
#define DS_MAX_ANALOG_PROBES_NUM 4
#define DS_MAX_DSO_PROBES_NUM 2
#define TriggerStages 16
#define TriggerProbes 16
#define MaxTriggerProbes 32
#define TriggerCountBits 16
#define STriggerDataStage 3
#define DS_MAX_TRIG_PERCENT 90
#define DS_CONF_DSO_HDIVS 10
#define DS_CONF_DSO_VDIVS 10
#define SAMPLES_ALIGN 1023ULL
/* Handy little macros */
#define SR_HZ(n) (n)
#define SR_KHZ(n) ((n) * (uint64_t)(1000ULL))
@@ -111,28 +128,7 @@ enum {
#define SR_V(n) ((n) * (uint64_t)(1000ULL))
#define SR_KV(n) ((n) * (uint64_t)(1000000ULL))
#define SR_MV(n) ((n) * (uint64_t)(1000000000ULL))
#define SR_MAX_PROBENAME_LEN 32
#define DS_MAX_ANALOG_PROBES_NUM 4
#define DS_MAX_DSO_PROBES_NUM 2
#define TriggerStages 16
#define TriggerProbes 16
#define MaxTriggerProbes 32
#define TriggerCountBits 16
#define STriggerDataStage 3
#define DS_CONF_DSO_HDIVS 10
#define DS_CONF_DSO_VDIVS 10
#define DS_MAX_TRIG_PERCENT 90
#define SAMPLES_ALIGN 1023ULL
/*
* Oscilloscope
*/
#define MAX_TIMEBASE SR_SEC(10)
#define MIN_TIMEBASE SR_NS(10)
/*
* Use SR_API to mark public API symbols, and SR_PRIV for private symbols.
*
@@ -1258,20 +1254,6 @@ enum {
DSO_TRIGGER_FALLING,
};
struct ds_trigger {
uint16_t trigger_en;
uint16_t trigger_mode;
uint16_t trigger_pos;
uint16_t trigger_stages;
unsigned char trigger_logic[TriggerStages+1];
unsigned char trigger0_inv[TriggerStages+1];
unsigned char trigger1_inv[TriggerStages+1];
char trigger0[TriggerStages+1][MaxTriggerProbes];
char trigger1[TriggerStages+1][MaxTriggerProbes];
uint32_t trigger0_count[TriggerStages+1];
uint32_t trigger1_count[TriggerStages+1];
};
struct ds_trigger_pos {
uint32_t check_id;
uint32_t real_pos;
@@ -1283,9 +1265,181 @@ struct ds_trigger_pos {
typedef int (*sr_receive_data_callback_t)(int fd, int revents, const struct sr_dev_inst *sdi);
#include "proto.h"
#include "version.h"
#include <log/xlog.h>
/**
* @file
*
* Header file containing API function prototypes.
*/
/*--- backend.c -------------------------------------------------------------*/
//@event, 1:attach, 2:left
typedef void (*hotplug_event_callback)(void *context,void *device, int event, void *userdata);
SR_API int sr_init(struct sr_context **ctx);
SR_API int sr_exit(struct sr_context *ctx);
SR_API int sr_listen_hotplug(struct sr_context *ctx, hotplug_event_callback callback, void *userdata);
SR_API int sr_close_hotplug(struct sr_context *ctx);
SR_API void sr_hotplug_wait_timout(struct sr_context *ctx);
/*--- log.c -----------------------------------------------------------------*/
/**
* Use a shared context, and drop the private log context
*/
SR_API void sr_log_set_context(xlog_context *ctx);
/**
* Set the private log context level
*/
SR_API void sr_log_level(int level);
/*--- device.c --------------------------------------------------------------*/
SR_API int sr_dev_probe_name_set(const struct sr_dev_inst *sdi,
int probenum, const char *name);
SR_API int sr_dev_probe_enable(const struct sr_dev_inst *sdi, int probenum,
gboolean state);
SR_API int sr_dev_trigger_set(const struct sr_dev_inst *sdi, uint16_t probenum,
const char *trigger);
SR_API GSList *sr_dev_list(const struct sr_dev_driver *driver);
SR_API const GSList *sr_dev_mode_list(const struct sr_dev_inst *sdi);
SR_API int sr_dev_clear(const struct sr_dev_driver *driver);
SR_API int sr_dev_open(struct sr_dev_inst *sdi);
SR_API int sr_dev_close(struct sr_dev_inst *sdi);
/*--- hwdriver.c ------------------------------------------------------------*/
SR_API struct sr_dev_driver **sr_driver_list(void);
SR_API int sr_driver_init(struct sr_context *ctx,
struct sr_dev_driver *driver);
SR_API GSList *sr_driver_scan(struct sr_dev_driver *driver, GSList *options);
SR_API int sr_config_get(const struct sr_dev_driver *driver,
const struct sr_dev_inst *sdi,
const struct sr_channel *ch,
const struct sr_channel_group *cg,
int key, GVariant **data);
SR_API int sr_config_set(struct sr_dev_inst *sdi,
struct sr_channel *ch,
struct sr_channel_group *cg,
int key, GVariant *data);
SR_API int sr_config_list(const struct sr_dev_driver *driver,
const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg,
int key, GVariant **data);
SR_API const struct sr_config_info *sr_config_info_get(int key);
SR_API const struct sr_config_info *sr_config_info_name_get(const char *optname);
SR_API int sr_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, gboolean prg);
SR_API struct sr_config *sr_config_new(int key, GVariant *data);
SR_API void sr_config_free(struct sr_config *src);
//SR_API void sr_test_usb_api();
/*--------------------session.c----------------*/
typedef void (*sr_datafeed_callback_t)(const struct sr_dev_inst *sdi,
const struct sr_datafeed_packet *packet, void *cb_data);
SR_API void sr_set_firmware_resource_dir(const char *dir);
/* Session setup */
SR_API int sr_session_load(const char *filename);
SR_API struct sr_session *sr_session_new(void);
SR_API int sr_session_destroy(void);
SR_API int sr_session_dev_remove_all(void);
SR_API int sr_session_dev_add(struct sr_dev_inst *sdi);
SR_API int sr_session_dev_list(GSList **devlist);
/* Datafeed setup */
SR_API int sr_session_datafeed_callback_remove_all(void);
SR_API int sr_session_datafeed_callback_add(sr_datafeed_callback_t cb,
void *cb_data);
/* Session control */
SR_API int sr_session_start(void);
SR_API int sr_session_run(void);
SR_API int sr_session_stop(void);
SR_API int sr_session_source_add(int fd, int events, int timeout,
sr_receive_data_callback_t cb, const struct sr_dev_inst *sdi);
SR_API int sr_session_source_add_pollfd(GPollFD *pollfd, int timeout,
sr_receive_data_callback_t cb, const struct sr_dev_inst *sdi);
SR_API int sr_session_source_add_channel(GIOChannel *channel, int events,
int timeout, sr_receive_data_callback_t cb, const struct sr_dev_inst *sdi);
SR_API int sr_session_source_remove(int fd);
SR_API int sr_session_source_remove_pollfd(GPollFD *pollfd);
SR_API int sr_session_source_remove_channel(GIOChannel *channel);
//0:ok, 1:error
SR_API int sr_check_session_start_before();
/*--- input/input.c ---------------------------------------------------------*/
SR_API struct sr_input_format **sr_input_list(void);
/*--- output/output.c -------------------------------------------------------*/
SR_API const struct sr_output_module **sr_output_list(void);
/*--- strutil.c -------------------------------------------------------------*/
SR_API char *sr_si_string_u64(uint64_t x, const char *unit);
SR_API char *sr_iec_string_u64(uint64_t x, const char *unit);
SR_API char *sr_samplerate_string(uint64_t samplerate);
SR_API char *sr_samplecount_string(uint64_t samplecount);
SR_API char *sr_period_string(uint64_t frequency);
SR_API char *sr_time_string(uint64_t time);
SR_API char *sr_voltage_string(uint64_t v_p, uint64_t v_q);
SR_API int sr_parse_sizestring(const char *sizestring, uint64_t *size);
SR_API uint64_t sr_parse_timestring(const char *timestring);
SR_API gboolean sr_parse_boolstring(const char *boolstring);
SR_API int sr_parse_period(const char *periodstr, uint64_t *p, uint64_t *q);
SR_API int sr_parse_voltage(const char *voltstr, uint64_t *p, uint64_t *q);
/*--- version.c -------------------------------------------------------------*/
SR_API int sr_package_version_major_get(void);
SR_API int sr_package_version_minor_get(void);
SR_API int sr_package_version_micro_get(void);
SR_API const char *sr_package_version_string_get(void);
SR_API int sr_lib_version_current_get(void);
SR_API int sr_lib_version_revision_get(void);
SR_API int sr_lib_version_age_get(void);
SR_API const char *sr_lib_version_string_get(void);
/*--- error.c ---------------------------------------------------------------*/
SR_API const char *sr_strerror(int error_code);
SR_API const char *sr_strerror_name(int error_code);
/*--- trigger.c ------------------------------------------------------------*/
SR_API int ds_trigger_init(void);
SR_API int ds_trigger_destroy(void);
SR_API struct ds_trigger *ds_trigger_get(void);
SR_API int ds_trigger_stage_set_value(uint16_t stage, uint16_t probes, char *trigger0, char *trigger1);
SR_API int ds_trigger_stage_set_logic(uint16_t stage, uint16_t probes, unsigned char trigger_logic);
SR_API int ds_trigger_stage_set_inv(uint16_t stage, uint16_t probes, unsigned char trigger0_inv, unsigned char trigger1_inv);
SR_API int ds_trigger_stage_set_count(uint16_t stage, uint16_t probes, uint32_t trigger0_count, uint32_t trigger1_count);
SR_API int ds_trigger_probe_set(uint16_t probe, unsigned char trigger0, unsigned char trigger1);
SR_API int ds_trigger_set_stage(uint16_t stages);
SR_API int ds_trigger_set_pos(uint16_t position);
SR_API uint16_t ds_trigger_get_pos();
SR_API int ds_trigger_set_en(uint16_t enable);
SR_API uint16_t ds_trigger_get_en();
SR_API int ds_trigger_set_mode(uint16_t mode);
SR_PRIV uint16_t ds_trigger_get_mask0(uint16_t stage, uint16_t msc, uint16_t lsc, gboolean qutr_mode, gboolean half_mode);
SR_PRIV uint16_t ds_trigger_get_value0(uint16_t stage, uint16_t msc, uint16_t lsc, gboolean qutr_mode, gboolean half_mode);
SR_PRIV uint16_t ds_trigger_get_edge0(uint16_t stage, uint16_t msc, uint16_t lsc, gboolean qutr_mode, gboolean half_mode);
SR_PRIV uint16_t ds_trigger_get_mask1(uint16_t stage, uint16_t msc, uint16_t lsc, gboolean qutr_mode, gboolean half_mode);
SR_PRIV uint16_t ds_trigger_get_value1(uint16_t stage, uint16_t msc, uint16_t lsc, gboolean qutr_mode, gboolean half_mode);
SR_PRIV uint16_t ds_trigger_get_edge1(uint16_t stage, uint16_t msc, uint16_t lsc, gboolean qutr_mode, gboolean half_mode);
#ifdef __cplusplus
}
#endif

View File

@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "../libsigrok.h"
#include "../libsigrok-internal.h"
#include <stdlib.h>
#include <string.h>

View File

@@ -18,7 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "../libsigrok.h"
#include "../libsigrok-internal.h"
#include <stdlib.h>
#include <string.h>

View File

@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../libsigrok.h"
#include "../libsigrok-internal.h"
#include <string.h>
#include "../log.h"

View File

@@ -16,8 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "libsigrok.h"
#include "libsigrok-internal.h"
#include <stdlib.h>
#include <unistd.h>

View File

@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "../libsigrok.h"
#include "../libsigrok-internal.h"
#include <stdlib.h>
#include <string.h>

View File

@@ -1,198 +0,0 @@
/*
* This file is part of the libsigrok project.
*
* Copyright (C) 2013 Bert Vermeulen <bert@biot.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBSIGROK_SIGROK_PROTO_H
#define LIBSIGROK_SIGROK_PROTO_H
#include <log/xlog.h>
/**
* @file
*
* Header file containing API function prototypes.
*/
/*--- backend.c -------------------------------------------------------------*/
//@event, 1:attach, 2:left
typedef void (*hotplug_event_callback)(void *context,void *device, int event, void *userdata);
SR_API int sr_init(struct sr_context **ctx);
SR_API int sr_exit(struct sr_context *ctx);
SR_API int sr_listen_hotplug(struct sr_context *ctx, hotplug_event_callback callback, void *userdata);
SR_API int sr_close_hotplug(struct sr_context *ctx);
SR_API void sr_hotplug_wait_timout(struct sr_context *ctx);
/*--- log.c -----------------------------------------------------------------*/
/**
* Use a shared context, and drop the private log context
*/
SR_API void sr_log_set_context(xlog_context *ctx);
/**
* Set the private log context level
*/
SR_API void sr_log_level(int level);
/*--- device.c --------------------------------------------------------------*/
SR_API int sr_dev_probe_name_set(const struct sr_dev_inst *sdi,
int probenum, const char *name);
SR_API int sr_dev_probe_enable(const struct sr_dev_inst *sdi, int probenum,
gboolean state);
SR_API int sr_dev_trigger_set(const struct sr_dev_inst *sdi, uint16_t probenum,
const char *trigger);
SR_API GSList *sr_dev_list(const struct sr_dev_driver *driver);
SR_API const GSList *sr_dev_mode_list(const struct sr_dev_inst *sdi);
SR_API int sr_dev_clear(const struct sr_dev_driver *driver);
SR_API int sr_dev_open(struct sr_dev_inst *sdi);
SR_API int sr_dev_close(struct sr_dev_inst *sdi);
/*--- hwdriver.c ------------------------------------------------------------*/
SR_API struct sr_dev_driver **sr_driver_list(void);
SR_API int sr_driver_init(struct sr_context *ctx,
struct sr_dev_driver *driver);
SR_API GSList *sr_driver_scan(struct sr_dev_driver *driver, GSList *options);
SR_API int sr_config_get(const struct sr_dev_driver *driver,
const struct sr_dev_inst *sdi,
const struct sr_channel *ch,
const struct sr_channel_group *cg,
int key, GVariant **data);
SR_API int sr_config_set(struct sr_dev_inst *sdi,
struct sr_channel *ch,
struct sr_channel_group *cg,
int key, GVariant *data);
SR_API int sr_config_list(const struct sr_dev_driver *driver,
const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg,
int key, GVariant **data);
SR_API const struct sr_config_info *sr_config_info_get(int key);
SR_API const struct sr_config_info *sr_config_info_name_get(const char *optname);
SR_API int sr_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, gboolean prg);
SR_API struct sr_config *sr_config_new(int key, GVariant *data);
SR_API void sr_config_free(struct sr_config *src);
//SR_API void sr_test_usb_api();
/*--------------------session.c----------------*/
typedef void (*sr_datafeed_callback_t)(const struct sr_dev_inst *sdi,
const struct sr_datafeed_packet *packet, void *cb_data);
SR_API void sr_set_firmware_resource_dir(const char *dir);
/* Session setup */
SR_API int sr_session_load(const char *filename);
SR_API struct sr_session *sr_session_new(void);
SR_API int sr_session_destroy(void);
SR_API int sr_session_dev_remove_all(void);
SR_API int sr_session_dev_add(struct sr_dev_inst *sdi);
SR_API int sr_session_dev_list(GSList **devlist);
/* Datafeed setup */
SR_API int sr_session_datafeed_callback_remove_all(void);
SR_API int sr_session_datafeed_callback_add(sr_datafeed_callback_t cb,
void *cb_data);
/* Session control */
SR_API int sr_session_start(void);
SR_API int sr_session_run(void);
SR_API int sr_session_stop(void);
SR_API int sr_session_source_add(int fd, int events, int timeout,
sr_receive_data_callback_t cb, const struct sr_dev_inst *sdi);
SR_API int sr_session_source_add_pollfd(GPollFD *pollfd, int timeout,
sr_receive_data_callback_t cb, const struct sr_dev_inst *sdi);
SR_API int sr_session_source_add_channel(GIOChannel *channel, int events,
int timeout, sr_receive_data_callback_t cb, const struct sr_dev_inst *sdi);
SR_API int sr_session_source_remove(int fd);
SR_API int sr_session_source_remove_pollfd(GPollFD *pollfd);
SR_API int sr_session_source_remove_channel(GIOChannel *channel);
//0:ok, 1:error
SR_API int sr_check_session_start_before();
/*--- input/input.c ---------------------------------------------------------*/
SR_API struct sr_input_format **sr_input_list(void);
/*--- output/output.c -------------------------------------------------------*/
SR_API const struct sr_output_module **sr_output_list(void);
/*--- strutil.c -------------------------------------------------------------*/
SR_API char *sr_si_string_u64(uint64_t x, const char *unit);
SR_API char *sr_iec_string_u64(uint64_t x, const char *unit);
SR_API char *sr_samplerate_string(uint64_t samplerate);
SR_API char *sr_samplecount_string(uint64_t samplecount);
SR_API char *sr_period_string(uint64_t frequency);
SR_API char *sr_time_string(uint64_t time);
SR_API char *sr_voltage_string(uint64_t v_p, uint64_t v_q);
SR_API int sr_parse_sizestring(const char *sizestring, uint64_t *size);
SR_API uint64_t sr_parse_timestring(const char *timestring);
SR_API gboolean sr_parse_boolstring(const char *boolstring);
SR_API int sr_parse_period(const char *periodstr, uint64_t *p, uint64_t *q);
SR_API int sr_parse_voltage(const char *voltstr, uint64_t *p, uint64_t *q);
/*--- version.c -------------------------------------------------------------*/
SR_API int sr_package_version_major_get(void);
SR_API int sr_package_version_minor_get(void);
SR_API int sr_package_version_micro_get(void);
SR_API const char *sr_package_version_string_get(void);
SR_API int sr_lib_version_current_get(void);
SR_API int sr_lib_version_revision_get(void);
SR_API int sr_lib_version_age_get(void);
SR_API const char *sr_lib_version_string_get(void);
/*--- error.c ---------------------------------------------------------------*/
SR_API const char *sr_strerror(int error_code);
SR_API const char *sr_strerror_name(int error_code);
/*--- trigger.c ------------------------------------------------------------*/
SR_API int ds_trigger_init(void);
SR_API int ds_trigger_destroy(void);
SR_API struct ds_trigger *ds_trigger_get(void);
SR_API int ds_trigger_stage_set_value(uint16_t stage, uint16_t probes, char *trigger0, char *trigger1);
SR_API int ds_trigger_stage_set_logic(uint16_t stage, uint16_t probes, unsigned char trigger_logic);
SR_API int ds_trigger_stage_set_inv(uint16_t stage, uint16_t probes, unsigned char trigger0_inv, unsigned char trigger1_inv);
SR_API int ds_trigger_stage_set_count(uint16_t stage, uint16_t probes, uint32_t trigger0_count, uint32_t trigger1_count);
SR_API int ds_trigger_probe_set(uint16_t probe, unsigned char trigger0, unsigned char trigger1);
SR_API int ds_trigger_set_stage(uint16_t stages);
SR_API int ds_trigger_set_pos(uint16_t position);
SR_API uint16_t ds_trigger_get_pos();
SR_API int ds_trigger_set_en(uint16_t enable);
SR_API uint16_t ds_trigger_get_en();
SR_API int ds_trigger_set_mode(uint16_t mode);
SR_PRIV uint16_t ds_trigger_get_mask0(uint16_t stage, uint16_t msc, uint16_t lsc, gboolean qutr_mode, gboolean half_mode);
SR_PRIV uint16_t ds_trigger_get_value0(uint16_t stage, uint16_t msc, uint16_t lsc, gboolean qutr_mode, gboolean half_mode);
SR_PRIV uint16_t ds_trigger_get_edge0(uint16_t stage, uint16_t msc, uint16_t lsc, gboolean qutr_mode, gboolean half_mode);
SR_PRIV uint16_t ds_trigger_get_mask1(uint16_t stage, uint16_t msc, uint16_t lsc, gboolean qutr_mode, gboolean half_mode);
SR_PRIV uint16_t ds_trigger_get_value1(uint16_t stage, uint16_t msc, uint16_t lsc, gboolean qutr_mode, gboolean half_mode);
SR_PRIV uint16_t ds_trigger_get_edge1(uint16_t stage, uint16_t msc, uint16_t lsc, gboolean qutr_mode, gboolean half_mode);
#endif

View File

@@ -17,7 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "libsigrok.h"
#include "libsigrok-internal.h"
#include <stdio.h>
#include <stdlib.h>

View File

@@ -16,8 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "libsigrok.h"
#include "libsigrok-internal.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -50,6 +49,7 @@ static const char *maxHeights[] = {
"4X",
"5X",
};
static const uint64_t vdivs[] = {
SR_mV(10),
SR_mV(20),

View File

@@ -17,7 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "libsigrok.h"
#include "libsigrok-internal.h"
#include <string.h>
#include <stdlib.h>

View File

@@ -18,7 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libsigrok.h"
#include "libsigrok-internal.h"
#include <glib.h>
#include "log.h"
@@ -207,11 +206,7 @@ SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver,
if (sdi->conn) {
if (sdi->inst_type == SR_INST_USB)
#if HAVE_LIBUSB_1_0
sr_usb_dev_inst_free(sdi->conn);
#else
;
#endif
else if (sdi->inst_type == SR_INST_SERIAL)
sr_serial_dev_inst_free(sdi->conn);
}

View File

@@ -18,9 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libsigrok.h"
#include "libsigrok-internal.h"
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>

View File

@@ -20,7 +20,7 @@
#include <stdlib.h>
#include <check.h>
#include "../libsigrok.h"
#include <libsigrok.h>
/*
* Check various basic init related things.

View File

@@ -20,7 +20,7 @@
#include <stdlib.h>
#include <check.h>
#include "../libsigrok.h"
#include <libsigrok.h>
#include "lib.h"
struct sr_context *sr_ctx;

View File

@@ -20,7 +20,7 @@
#include <stdlib.h>
#include <check.h>
#include "../libsigrok.h"
#include <libsigrok.h>
Suite *suite_core(void);
Suite *suite_strutil(void);

View File

@@ -19,7 +19,7 @@
*/
#include <check.h>
#include "../libsigrok.h"
#include <libsigrok.h>
struct sr_context *sr_ctx;

View File

@@ -21,7 +21,7 @@
#include <stdio.h>
#include <string.h>
#include <check.h>
#include "../libsigrok.h"
#include <libsigrok.h>
/* Get a libsigrok driver by name. */
struct sr_dev_driver *srtest_driver_get(const char *drivername)

View File

@@ -21,7 +21,7 @@
#ifndef LIBSIGROK_TESTS_LIB_H
#define LIBSIGROK_TESTS_LIB_H
#include "../libsigrok.h"
#include <libsigrok.h>
struct sr_dev_driver *srtest_driver_get(const char *drivername);
void srtest_driver_init(struct sr_context *sr_ctx, struct sr_dev_driver *driver);

View File

@@ -18,7 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libsigrok.h"
#include "libsigrok-internal.h"
#include <stdio.h>
#include <stdlib.h>

View File

@@ -19,6 +19,7 @@
*/
#include "libsigrok.h"
#include "version.h"
/**
* @file