diff --git a/libsigrok4DSL/hardware/DSL/dscope.c b/libsigrok4DSL/hardware/DSL/dscope.c index a6998ae5..0ac715d9 100644 --- a/libsigrok4DSL/hardware/DSL/dscope.c +++ b/libsigrok4DSL/hardware/DSL/dscope.c @@ -39,7 +39,6 @@ static const int total_buffer_time = 200; static const int buffer_size = 1024 * 1024; static const int instant_buffer_size = 1024 * 1024; static const int cons_buffer_size = 128; -static const int buffer_cnt = 4; static struct sr_dev_mode mode_list[] = { {"OSC", DSO}, @@ -561,9 +560,10 @@ static int DSCope_dev_open(struct sr_dev_inst *sdi) devc = sdi->priv; usb = sdi->conn; - if (sdi->status == SR_ST_ACTIVE) + if (sdi->status == SR_ST_ACTIVE) { /* Device is already in use. */ return SR_ERR; + } skip = 0; device_count = libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist); diff --git a/libsigrok4DSL/hardware/DSL/dslogic.c b/libsigrok4DSL/hardware/DSL/dslogic.c index dd8adf2c..ccae06ba 100644 --- a/libsigrok4DSL/hardware/DSL/dslogic.c +++ b/libsigrok4DSL/hardware/DSL/dslogic.c @@ -37,10 +37,8 @@ #define max(a,b) ((a)>(b)?(a):(b)) static const unsigned int single_buffer_time = 20; -static const unsigned int total_buffer_time = 200; +static const unsigned int total_buffer_time = 100; static const unsigned int instant_buffer_size = 1024 * 1024; -static const unsigned int cons_buffer_size = 128; -static const unsigned int buffer_cnt = 4; static struct sr_dev_mode mode_list[] = { {"LA", LOGIC}, @@ -180,10 +178,6 @@ static const int32_t sessions_pro[] = { SR_CONF_TRIGGER_MARGIN, }; -static const int32_t ch_sessions[] = { - SR_CONF_VDIV -}; - static const char *probe_names[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", @@ -258,7 +252,6 @@ static const uint64_t samplecounts[] = { }; static uint16_t opmodes_show_count = 3; -static const uint8_t zero_base_addr = 0x80; SR_PRIV struct sr_dev_driver DSLogic_driver_info; static struct sr_dev_driver *di = &DSLogic_driver_info; @@ -662,9 +655,10 @@ static int DSLogic_dev_open(struct sr_dev_inst *sdi) devc = sdi->priv; usb = sdi->conn; - if (sdi->status == SR_ST_ACTIVE) + if (sdi->status == SR_ST_ACTIVE) { /* Device is already in use. */ return SR_ERR; + } skip = 0; device_count = libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist); @@ -2358,7 +2352,7 @@ static unsigned int get_number_of_transfers(struct DSL_context *devc) { unsigned int n; /* Total buffer size should be able to hold about 100ms of data. */ - n = 100 * to_bytes_per_ms(devc) / get_buffer_size(devc); + n = total_buffer_time * to_bytes_per_ms(devc) / get_buffer_size(devc); if (n > NUM_SIMUL_TRANSFERS) return NUM_SIMUL_TRANSFERS; @@ -2386,15 +2380,12 @@ static int receive_data(int fd, int revents, const struct sr_dev_inst *sdi) struct timeval tv; struct drv_context *drvc; struct DSL_context *devc; - struct sr_usb_dev_inst *usb; - int ret; (void)fd; (void)revents; drvc = di->priv; devc = sdi->priv; - usb = sdi->conn; tv.tv_sec = tv.tv_usec = 0; libusb_handle_events_timeout_completed(drvc->sr_ctx->libusb_ctx, &tv, &completed); diff --git a/libsigrokdecode4DSL/configure.ac b/libsigrokdecode4DSL/configure.ac index 02b2f3a6..3b8deab6 100644 --- a/libsigrokdecode4DSL/configure.ac +++ b/libsigrokdecode4DSL/configure.ac @@ -46,7 +46,7 @@ AM_PROG_CC_C_O # Set the standard the C library headers should conform to. AH_VERBATIM([_POSIX_C_SOURCE], [/* The targeted POSIX standard. */ #ifndef _POSIX_C_SOURCE -# define _POSIX_C_SOURCE 200112L +# define _POSIX_C_SOURCE 200809L #endif]) # Get compiler versions. diff --git a/libsigrokdecode4DSL/instance.c b/libsigrokdecode4DSL/instance.c index 4041b8c5..e9dec740 100644 --- a/libsigrokdecode4DSL/instance.c +++ b/libsigrokdecode4DSL/instance.c @@ -597,8 +597,9 @@ SRD_PRIV int srd_inst_decode(const struct srd_decoder_inst *di, uint8_t chunk_ty } Py_DecRef(py_res); - if (logic->logic_mask == 0) + if (logic->logic_mask == 0) { logic->itercnt -= logic->samplenum; + } return SRD_OK; } diff --git a/libsigrokdecode4DSL/module_sigrokdecode.c b/libsigrokdecode4DSL/module_sigrokdecode.c index 54b5573b..15c40f12 100644 --- a/libsigrokdecode4DSL/module_sigrokdecode.c +++ b/libsigrokdecode4DSL/module_sigrokdecode.c @@ -58,8 +58,9 @@ PyMODINIT_FUNC PyInit_sigrokdecode(void) logic_type = srd_logic_type_new(); if (!logic_type) goto err_out; - if (PyModule_AddObject(mod, "srd_logic", logic_type) < 0) + if (PyModule_AddObject(mod, "srd_logic", logic_type) < 0) { goto err_out; + } /* Expose output types as symbols in the sigrokdecode module */ if (PyModule_AddIntConstant(mod, "OUTPUT_ANN", SRD_OUTPUT_ANN) < 0)