From: Uwe Hermann Date: Wed, 19 Jul 2017 19:29:09 +0000 (+0200) Subject: drivers: Drop unneeded or duplicate comments. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=ca314e060f653e6a0b5ec0f58914bac4d426217f;p=libsigrok.git drivers: Drop unneeded or duplicate comments. Drop various comments which are not really needed, too verbose, document obvious things, are duplicated across all drivers, or simply incorrect. --- diff --git a/src/hardware/agilent-dmm/api.c b/src/hardware/agilent-dmm/api.c index 052e503c..d38cdf0c 100644 --- a/src/hardware/agilent-dmm/api.c +++ b/src/hardware/agilent-dmm/api.c @@ -316,7 +316,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) sr_sw_limits_acquisition_start(&devc->limits); std_session_send_df_header(sdi); - /* Poll every 10ms, or whenever some data comes in. */ serial = sdi->conn; serial_source_add(sdi->session, serial, G_IO_IN, 10, agdmm_receive_data, (void *)sdi); diff --git a/src/hardware/agilent-dmm/protocol.h b/src/hardware/agilent-dmm/protocol.h index 2510d736..85b52357 100644 --- a/src/hardware/agilent-dmm/protocol.h +++ b/src/hardware/agilent-dmm/protocol.h @@ -68,13 +68,11 @@ struct agdmm_profile { const struct agdmm_recv *recvs; }; -/* Private, per-device-instance driver context. */ struct dev_context { const struct agdmm_profile *profile; struct sr_sw_limits limits; int data_source; - /* Runtime. */ const struct agdmm_job *jobs; int current_job; gboolean job_running; diff --git a/src/hardware/appa-55ii/api.c b/src/hardware/appa-55ii/api.c index eab203dd..aecfc262 100644 --- a/src/hardware/appa-55ii/api.c +++ b/src/hardware/appa-55ii/api.c @@ -192,7 +192,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) std_session_send_df_header(sdi); - /* Poll every 50ms, or whenever some data comes in. */ serial_source_add(sdi->session, serial, G_IO_IN, 50, appa_55ii_receive_data, (void *)sdi); diff --git a/src/hardware/appa-55ii/protocol.h b/src/hardware/appa-55ii/protocol.h index 248d672e..171ac636 100644 --- a/src/hardware/appa-55ii/protocol.h +++ b/src/hardware/appa-55ii/protocol.h @@ -36,13 +36,10 @@ enum { DATA_SOURCE_MEMORY, }; -/** Private, per-device-instance driver context. */ struct dev_context { - /* Acquisition settings */ struct sr_sw_limits limits; gboolean data_source; /**< Whether to read live samples or memory */ - /* Temporary state across callbacks */ uint8_t buf[APPA_55II_BUF_SIZE]; unsigned int buf_len; uint8_t log_buf[64]; diff --git a/src/hardware/arachnid-labs-re-load-pro/api.c b/src/hardware/arachnid-labs-re-load-pro/api.c index 9c1fe532..11a6e305 100644 --- a/src/hardware/arachnid-labs-re-load-pro/api.c +++ b/src/hardware/arachnid-labs-re-load-pro/api.c @@ -153,7 +153,6 @@ static int config_list(uint32_t key, GVariant **data, GVariantBuilder gvb; if (!cg) { - /* No channel group: global options. */ return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts); } else { switch (key) { @@ -288,7 +287,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) return SR_ERR; } - /* Poll every 100ms, or whenever some data comes in. */ serial_source_add(sdi->session, serial, G_IO_IN, 100, reloadpro_receive_data, (void *)sdi); diff --git a/src/hardware/arachnid-labs-re-load-pro/protocol.h b/src/hardware/arachnid-labs-re-load-pro/protocol.h index 8307053b..d954fcac 100644 --- a/src/hardware/arachnid-labs-re-load-pro/protocol.h +++ b/src/hardware/arachnid-labs-re-load-pro/protocol.h @@ -29,7 +29,6 @@ #define RELOADPRO_BUFSIZE 100 -/** Private, per-device-instance driver context. */ struct dev_context { struct sr_sw_limits limits; uint8_t buf[RELOADPRO_BUFSIZE]; diff --git a/src/hardware/asix-sigma/api.c b/src/hardware/asix-sigma/api.c index bc6c87e8..163032c3 100644 --- a/src/hardware/asix-sigma/api.c +++ b/src/hardware/asix-sigma/api.c @@ -19,10 +19,6 @@ * along with this program. If not, see . */ -/* - * ASIX SIGMA/SIGMA2 logic analyzer driver - */ - #include #include "protocol.h" @@ -85,8 +81,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) ftdi_init(&devc->ftdic); - /* Look for SIGMAs. */ - if ((ret = ftdi_usb_find_all(&devc->ftdic, &devlist, USB_VENDOR, USB_PRODUCT)) <= 0) { if (ret < 0) @@ -116,7 +110,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) devc->capture_ratio = 50; devc->use_triggers = 0; - /* Register SIGMA device. */ sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INITIALIZING; sdi->vendor = g_strdup(USB_VENDOR_NAME); @@ -127,7 +120,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) sdi->priv = devc; - /* We will open the device again when we need it. */ ftdi_list_free(&devlist); return std_scan_complete(di, g_slist_append(NULL, sdi)); diff --git a/src/hardware/asix-sigma/protocol.c b/src/hardware/asix-sigma/protocol.c index 01382e75..dd4efd0d 100644 --- a/src/hardware/asix-sigma/protocol.c +++ b/src/hardware/asix-sigma/protocol.c @@ -677,7 +677,6 @@ SR_PRIV int sigma_convert_trigger(const struct sr_dev_inst *sdi) return SR_OK; } - /* Software trigger to determine exact trigger position. */ static int get_trigger_offset(uint8_t *samples, uint16_t last_sample, struct sigma_trigger *t) diff --git a/src/hardware/asix-sigma/protocol.h b/src/hardware/asix-sigma/protocol.h index 88821769..98eb1a68 100644 --- a/src/hardware/asix-sigma/protocol.h +++ b/src/hardware/asix-sigma/protocol.h @@ -255,7 +255,6 @@ struct sigma_state { uint16_t lastsample; }; -/* Private, per-device-instance driver context. */ struct dev_context { struct ftdi_context ftdic; uint64_t cur_samplerate; diff --git a/src/hardware/atten-pps3xxx/api.c b/src/hardware/atten-pps3xxx/api.c index c88914f9..0a16ca5f 100644 --- a/src/hardware/atten-pps3xxx/api.c +++ b/src/hardware/atten-pps3xxx/api.c @@ -195,7 +195,6 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s devc = sdi->priv; if (!cg) { - /* No channel group: global options. */ switch (key) { case SR_CONF_CHANNEL_CONFIG: *data = g_variant_new_string(channel_modes[devc->channel_mode]); @@ -263,7 +262,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd ret = SR_OK; devc = sdi->priv; if (!cg) { - /* No channel group: global options. */ switch (key) { case SR_CONF_CHANNEL_CONFIG: sval = g_variant_get_string(data, NULL); @@ -294,7 +292,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd return SR_ERR_NA; } } else { - /* Channel group specified: per-channel options. */ /* We only ever have one channel per channel group in this driver. */ ch = cg->channels->data; channel = ch->index; @@ -342,7 +339,6 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst * devc = (sdi) ? sdi->priv : NULL; if (!cg) { - /* No channel group: global options. */ switch (key) { case SR_CONF_SCAN_OPTIONS: case SR_CONF_DEVICE_OPTIONS: @@ -360,8 +356,6 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst * return SR_ERR_NA; } } else { - /* Channel group specified: per-channel options. */ - /* We only ever have one channel per channel group in this driver. */ ch = cg->channels->data; channel = ch->index; diff --git a/src/hardware/atten-pps3xxx/protocol.h b/src/hardware/atten-pps3xxx/protocol.h index b9a256d1..f9409c2d 100644 --- a/src/hardware/atten-pps3xxx/protocol.h +++ b/src/hardware/atten-pps3xxx/protocol.h @@ -71,15 +71,11 @@ struct per_channel_config { gboolean output_enabled_set; }; -/** Private, per-device-instance driver context. */ struct dev_context { - /* Model-specific information */ const struct pps_model *model; - /* Acquisition state */ gboolean acquisition_running; - /* Operational state */ gboolean config_dirty; struct per_channel_config *config; /* Blocking write timeout for packet. */ @@ -91,7 +87,6 @@ struct dev_context { int channel_mode_set; gboolean over_current_protection_set; - /* Temporary state across callbacks */ uint8_t packet[PACKET_SIZE]; int packet_size; diff --git a/src/hardware/baylibre-acme/protocol.h b/src/hardware/baylibre-acme/protocol.h index 8717debd..2425c992 100644 --- a/src/hardware/baylibre-acme/protocol.h +++ b/src/hardware/baylibre-acme/protocol.h @@ -49,7 +49,6 @@ enum probe_type { PROBE_TEMP, }; -/** Private, per-device-instance driver context. */ struct dev_context { uint64_t samplerate; struct sr_sw_limits limits; diff --git a/src/hardware/beaglelogic/api.c b/src/hardware/beaglelogic/api.c index e35a9a73..e450a094 100644 --- a/src/hardware/beaglelogic/api.c +++ b/src/hardware/beaglelogic/api.c @@ -21,7 +21,6 @@ #include "protocol.h" #include "beaglelogic.h" -/* Scan options */ static const uint32_t scanopts[] = { SR_CONF_NUM_LOGIC_CHANNELS, }; @@ -30,7 +29,6 @@ static const uint32_t drvopts[] = { SR_CONF_LOGIC_ANALYZER, }; -/* Hardware capabilities */ static const uint32_t devopts[] = { SR_CONF_CONTINUOUS, SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET, @@ -40,7 +38,6 @@ static const uint32_t devopts[] = { SR_CONF_NUM_LOGIC_CHANNELS | SR_CONF_GET, }; -/* Trigger matching capabilities */ static const int32_t soft_trigger_matches[] = { SR_TRIGGER_ZERO, SR_TRIGGER_ONE, @@ -120,10 +117,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) beaglelogic_set_sampleunit(devc); beaglelogic_close(devc); - /* Signal */ sr_info("BeagleLogic device found at "BEAGLELOGIC_DEV_NODE); - /* Fill the channels */ for (i = 0; i < maxch; i++) sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, channel_names[i]); diff --git a/src/hardware/beaglelogic/protocol.h b/src/hardware/beaglelogic/protocol.h index e058a60a..5df27dcd 100644 --- a/src/hardware/beaglelogic/protocol.h +++ b/src/hardware/beaglelogic/protocol.h @@ -32,13 +32,10 @@ #define SAMPLEUNIT_TO_BYTES(x) ((x) == 1 ? 1 : 2) -/** Private, per-device-instance driver context. */ struct dev_context { - /* Model-specific information */ int max_channels; uint32_t fw_ver; - /* Acquisition settings: see beaglelogic.h */ uint64_t cur_samplerate; uint64_t limit_samples; uint32_t sampleunit; @@ -49,7 +46,6 @@ struct dev_context { uint32_t bufunitsize; uint32_t buffersize; - /* Operational state */ int fd; GPollFD pollfd; int last_error; diff --git a/src/hardware/brymen-bm86x/api.c b/src/hardware/brymen-bm86x/api.c index d9575c00..3b4da516 100644 --- a/src/hardware/brymen-bm86x/api.c +++ b/src/hardware/brymen-bm86x/api.c @@ -101,7 +101,6 @@ static int dev_open(struct sr_dev_inst *sdi) if ((ret = sr_usb_open(drvc->sr_ctx->libusb_ctx, usb)) < 0) return SR_ERR; - /* Detach kernel drivers which grabbed this device (if any). */ if (libusb_kernel_driver_active(usb->devhdl, 0) == 1) { ret = libusb_detach_kernel_driver(usb->devhdl, 0); if (ret < 0) { @@ -112,7 +111,6 @@ static int dev_open(struct sr_dev_inst *sdi) devc->detached_kernel_driver = 1; } - /* Claim interface 0. */ if ((ret = libusb_claim_interface(usb->devhdl, 0)) < 0) { sr_err("Failed to claim interface 0: %s.", libusb_error_name(ret)); diff --git a/src/hardware/brymen-bm86x/protocol.h b/src/hardware/brymen-bm86x/protocol.h index 4cba7674..c5c4d596 100644 --- a/src/hardware/brymen-bm86x/protocol.h +++ b/src/hardware/brymen-bm86x/protocol.h @@ -27,15 +27,9 @@ #define LOG_PREFIX "brymen-bm86x" -/** Private, per-device-instance driver context. */ struct dev_context { - /* Acquisition settings */ struct sr_sw_limits sw_limits; - - /* Operational state */ - int detached_kernel_driver;/**< Whether kernel driver was detached or not */ - - /* Temporary state across callbacks */ + int detached_kernel_driver; /**< Whether kernel driver was detached or not */ int interrupt_pending; }; diff --git a/src/hardware/brymen-dmm/api.c b/src/hardware/brymen-dmm/api.c index fb66d9bf..d8593143 100644 --- a/src/hardware/brymen-dmm/api.c +++ b/src/hardware/brymen-dmm/api.c @@ -110,13 +110,10 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) if (!conn) return NULL; - if (serialcomm) { - /* Use the provided comm specs. */ + if (serialcomm) devices = brymen_scan(di, conn, serialcomm); - } else { - /* But 9600/8n1 should work all of the time. */ + else devices = brymen_scan(di, conn, "9600/8n1/dtr=1/rts=1"); - } return devices; } @@ -149,7 +146,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) sr_sw_limits_acquisition_start(&devc->sw_limits); std_session_send_df_header(sdi); - /* Poll every 50ms, or whenever some data comes in. */ serial = sdi->conn; serial_source_add(sdi->session, serial, G_IO_IN, 50, brymen_dmm_receive_data, (void *)sdi); diff --git a/src/hardware/brymen-dmm/protocol.h b/src/hardware/brymen-dmm/protocol.h index 7e02180e..d5090ee6 100644 --- a/src/hardware/brymen-dmm/protocol.h +++ b/src/hardware/brymen-dmm/protocol.h @@ -38,7 +38,6 @@ enum packet_len_status { PACKET_INVALID_HEADER, }; -/** Private, per-device-instance driver context. */ struct dev_context { struct sr_sw_limits sw_limits; diff --git a/src/hardware/cem-dt-885x/api.c b/src/hardware/cem-dt-885x/api.c index 4bdbc076..79689cd9 100644 --- a/src/hardware/cem-dt-885x/api.c +++ b/src/hardware/cem-dt-885x/api.c @@ -330,7 +330,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) std_session_send_df_header(sdi); - /* Poll every 100ms, or whenever some data comes in. */ serial = sdi->conn; serial_source_add(sdi->session, serial, G_IO_IN, 150, cem_dt_885x_receive_data, (void *)sdi); diff --git a/src/hardware/cem-dt-885x/protocol.h b/src/hardware/cem-dt-885x/protocol.h index bb098422..f183ed11 100644 --- a/src/hardware/cem-dt-885x/protocol.h +++ b/src/hardware/cem-dt-885x/protocol.h @@ -87,23 +87,18 @@ enum { DATA_SOURCE_MEMORY, }; -/** Private, per-device-instance driver context. */ struct dev_context { - /* Device state */ enum sr_mqflag cur_mqflags; int recording; int cur_meas_range; int cur_data_source; - /* Acquisition settings */ uint64_t limit_samples; - /* Operational state */ int state; uint64_t num_samples; gboolean enable_data_source_memory; - /* Temporary state across callbacks */ unsigned char cmd; unsigned char token; int buf_len; diff --git a/src/hardware/center-3xx/api.c b/src/hardware/center-3xx/api.c index 5e34f696..3f517a22 100644 --- a/src/hardware/center-3xx/api.c +++ b/src/hardware/center-3xx/api.c @@ -109,13 +109,10 @@ static GSList *scan(GSList *options, int idx) if (!conn) return NULL; - if (serialcomm) { - /* Use the provided comm specs. */ + if (serialcomm) devices = center_scan(conn, serialcomm, idx); - } else { - /* Try the default. */ + else devices = center_scan(conn, center_devs[idx].conn, idx); - } return std_scan_complete(center_devs[idx].di, devices); } @@ -149,7 +146,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, int idx) std_session_send_df_header(sdi); - /* Poll every 500ms, or whenever some data comes in. */ serial = sdi->conn; serial_source_add(sdi->session, serial, G_IO_IN, 500, center_devs[idx].receive_data, (void *)sdi); diff --git a/src/hardware/center-3xx/protocol.h b/src/hardware/center-3xx/protocol.h index fbbdaf30..6bd2c27c 100644 --- a/src/hardware/center-3xx/protocol.h +++ b/src/hardware/center-3xx/protocol.h @@ -51,7 +51,6 @@ extern SR_PRIV const struct center_dev_info center_devs[]; #define SERIAL_BUFSIZE 256 -/** Private, per-device-instance driver context. */ struct dev_context { struct sr_sw_limits sw_limits; diff --git a/src/hardware/chronovu-la/api.c b/src/hardware/chronovu-la/api.c index d02ef3ef..3bf56095 100644 --- a/src/hardware/chronovu-la/api.c +++ b/src/hardware/chronovu-la/api.c @@ -65,7 +65,6 @@ static int add_device(int model, struct libusb_device_descriptor *des, ret = SR_OK; - /* Allocate memory for our private device context. */ devc = g_malloc0(sizeof(struct dev_context)); /* Set some sane defaults. */ @@ -97,7 +96,6 @@ static int add_device(int model, struct libusb_device_descriptor *des, /* We now know the device, set its max. samplerate as default. */ devc->cur_samplerate = devc->prof->max_samplerate; - /* Register the device with libsigrok. */ sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE; sdi->vendor = g_strdup("ChronoVu"); @@ -231,7 +229,6 @@ static int dev_open(struct sr_dev_inst *sdi) devc = sdi->priv; - /* Allocate memory for the FTDI context and initialize it. */ if (!(devc->ftdic = ftdi_new())) { sr_err("Failed to initialize libftdi."); return SR_ERR; @@ -240,7 +237,6 @@ static int dev_open(struct sr_dev_inst *sdi) sr_dbg("Opening %s device (%04x:%04x).", devc->prof->modelname, devc->usb_vid, devc->usb_pid); - /* Open the device. */ if ((ret = ftdi_usb_open_desc(devc->ftdic, devc->usb_vid, devc->usb_pid, devc->prof->iproduct, NULL)) < 0) { sr_err("Failed to open FTDI device (%d): %s.", @@ -248,21 +244,18 @@ static int dev_open(struct sr_dev_inst *sdi) goto err_ftdi_free; } - /* Purge RX/TX buffers in the FTDI chip. */ if ((ret = ftdi_usb_purge_buffers(devc->ftdic)) < 0) { sr_err("Failed to purge FTDI buffers (%d): %s.", ret, ftdi_get_error_string(devc->ftdic)); goto err_ftdi_free; } - /* Enable flow control in the FTDI chip. */ if ((ret = ftdi_setflowctrl(devc->ftdic, SIO_RTS_CTS_HS)) < 0) { sr_err("Failed to enable FTDI flow control (%d): %s.", ret, ftdi_get_error_string(devc->ftdic)); goto err_ftdi_free; } - /* Wait 100ms. */ g_usleep(100 * 1000); return SR_OK; diff --git a/src/hardware/chronovu-la/protocol.h b/src/hardware/chronovu-la/protocol.h index 609f37d9..1e2036f7 100644 --- a/src/hardware/chronovu-la/protocol.h +++ b/src/hardware/chronovu-la/protocol.h @@ -44,28 +44,18 @@ enum { struct cv_profile { int model; const char *modelname; - const char *iproduct; /* USB iProduct string */ + const char *iproduct; unsigned int num_channels; uint64_t max_samplerate; const int num_trigger_matches; float trigger_constant; }; -/* Private, per-device-instance driver context. */ struct dev_context { - /** Device profile struct for this device. */ const struct cv_profile *prof; - - /** FTDI device context (used by libftdi). */ struct ftdi_context *ftdic; - - /** The currently configured samplerate of the device. */ uint64_t cur_samplerate; - - /** The current sampling limit (in ms). */ uint64_t limit_msec; - - /** The current sampling limit (in number of samples). */ uint64_t limit_samples; /** @@ -124,7 +114,6 @@ struct dev_context { uint64_t samplerates[255]; }; -/* protocol.c */ extern SR_PRIV const char *cv_channel_names[]; extern const struct cv_profile cv_profiles[]; SR_PRIV void cv_fill_samplerates_if_needed(const struct sr_dev_inst *sdi); diff --git a/src/hardware/colead-slm/api.c b/src/hardware/colead-slm/api.c index 7db1549b..5281178f 100644 --- a/src/hardware/colead-slm/api.c +++ b/src/hardware/colead-slm/api.c @@ -110,7 +110,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) sr_sw_limits_acquisition_start(&devc->limits); std_session_send_df_header(sdi); - /* Poll every 150ms, or whenever some data comes in. */ serial = sdi->conn; serial_source_add(sdi->session, serial, G_IO_IN, 150, colead_slm_receive_data, (void *)sdi); diff --git a/src/hardware/colead-slm/protocol.h b/src/hardware/colead-slm/protocol.h index 8b298bb7..1849a865 100644 --- a/src/hardware/colead-slm/protocol.h +++ b/src/hardware/colead-slm/protocol.h @@ -31,7 +31,6 @@ enum { COMMAND_SENT, }; -/** Private, per-device-instance driver context. */ struct dev_context { struct sr_sw_limits limits; diff --git a/src/hardware/conrad-digi-35-cpu/api.c b/src/hardware/conrad-digi-35-cpu/api.c index d1454acb..141a3d97 100644 --- a/src/hardware/conrad-digi-35-cpu/api.c +++ b/src/hardware/conrad-digi-35-cpu/api.c @@ -17,14 +17,6 @@ * along with this program. If not, see . */ -/** - * @file - * - * Conrad DIGI 35 CPU power supply driver - * - * @internal - */ - #include #include "protocol.h" diff --git a/src/hardware/conrad-digi-35-cpu/protocol.c b/src/hardware/conrad-digi-35-cpu/protocol.c index 732bec62..78f7d1c3 100644 --- a/src/hardware/conrad-digi-35-cpu/protocol.c +++ b/src/hardware/conrad-digi-35-cpu/protocol.c @@ -17,12 +17,6 @@ * along with this program. If not, see . */ -/** - * @file - * Conrad DIGI 35 CPU power supply driver - * @internal - */ - #include #include "protocol.h" diff --git a/src/hardware/conrad-digi-35-cpu/protocol.h b/src/hardware/conrad-digi-35-cpu/protocol.h index 99d2cb70..b02af9e2 100644 --- a/src/hardware/conrad-digi-35-cpu/protocol.h +++ b/src/hardware/conrad-digi-35-cpu/protocol.h @@ -17,14 +17,6 @@ * along with this program. If not, see . */ -/** - * @file - * - * Conrad DIGI 35 CPU power supply driver - * - * @internal - */ - #ifndef LIBSIGROK_HARDWARE_CONRAD_DIGI_35_CPU_PROTOCOL_H #define LIBSIGROK_HARDWARE_CONRAD_DIGI_35_CPU_PROTOCOL_H diff --git a/src/hardware/demo/protocol.h b/src/hardware/demo/protocol.h index 7930624d..0b13ebfb 100644 --- a/src/hardware/demo/protocol.h +++ b/src/hardware/demo/protocol.h @@ -34,7 +34,6 @@ /* Size of the analog pattern space per channel. */ #define ANALOG_BUFSIZE 4096 -/* Private, per-device-instance driver context. */ struct dev_context { uint64_t cur_samplerate; uint64_t limit_samples; @@ -105,9 +104,6 @@ enum { /* Analog patterns we can generate. */ enum { - /** - * Square wave. - */ PATTERN_SQUARE, PATTERN_SINE, PATTERN_TRIANGLE, diff --git a/src/hardware/dreamsourcelab-dslogic/api.c b/src/hardware/dreamsourcelab-dslogic/api.c index 08dded01..6427cfdc 100644 --- a/src/hardware/dreamsourcelab-dslogic/api.c +++ b/src/hardware/dreamsourcelab-dslogic/api.c @@ -67,7 +67,6 @@ static const uint32_t devopts[] = { SR_CONF_CLOCK_EDGE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, }; -/* Names assigned to available edge slope choices. */ static const char *const signal_edge_names[] = { [DS_EDGE_RISING] = "rising", [DS_EDGE_FALLING] = "falling", @@ -223,7 +222,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) } } - /* Skip if the device was not found. */ if (!prof) continue; diff --git a/src/hardware/dreamsourcelab-dslogic/protocol.h b/src/hardware/dreamsourcelab-dslogic/protocol.h index 467389bd..f7150664 100644 --- a/src/hardware/dreamsourcelab-dslogic/protocol.h +++ b/src/hardware/dreamsourcelab-dslogic/protocol.h @@ -112,16 +112,13 @@ struct dev_context { */ int64_t fw_updated; - /* Supported samplerates */ const uint64_t *samplerates; int num_samplerates; - /* Device/capture settings */ uint64_t cur_samplerate; uint64_t limit_samples; uint64_t capture_ratio; - /* Operational settings */ gboolean acq_aborted; unsigned int sent_samples; diff --git a/src/hardware/fluke-dmm/api.c b/src/hardware/fluke-dmm/api.c index 50add95d..d91a2807 100644 --- a/src/hardware/fluke-dmm/api.c +++ b/src/hardware/fluke-dmm/api.c @@ -210,7 +210,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) sr_sw_limits_acquisition_start(&devc->limits); std_session_send_df_header(sdi); - /* Poll every 100ms, or whenever some data comes in. */ serial = sdi->conn; serial_source_add(sdi->session, serial, G_IO_IN, 50, fluke_receive_data, (void *)sdi); diff --git a/src/hardware/fluke-dmm/protocol.h b/src/hardware/fluke-dmm/protocol.h index b8afc900..36ece3c9 100644 --- a/src/hardware/fluke-dmm/protocol.h +++ b/src/hardware/fluke-dmm/protocol.h @@ -46,12 +46,10 @@ struct flukedmm_profile { int timeout; }; -/* Private, per-device-instance driver context. */ struct dev_context { const struct flukedmm_profile *profile; struct sr_sw_limits limits; - /* Runtime. */ char buf[FLUKEDMM_BUFSIZE]; int buflen; int64_t cmd_sent_at; diff --git a/src/hardware/ftdi-la/api.c b/src/hardware/ftdi-la/api.c index c2914eea..c59ff9ad 100644 --- a/src/hardware/ftdi-la/api.c +++ b/src/hardware/ftdi-la/api.c @@ -111,7 +111,6 @@ static void scan_device(struct ftdi_context *ftdic, return; } - /* Allocate memory for our private device context. */ devc = g_malloc0(sizeof(struct dev_context)); /* Allocate memory for the incoming data. */ @@ -138,7 +137,6 @@ static void scan_device(struct ftdi_context *ftdic, } sr_dbg("Found an FTDI device: %s.", model); - /* Register the device with libsigrok. */ sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE; sdi->vendor = vendor; @@ -214,7 +212,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) } } - /* Allocate memory for the FTDI context (ftdic) and initialize it. */ ftdic = ftdi_new(); if (!ftdic) { sr_err("Failed to initialize libftdi."); @@ -273,7 +270,6 @@ static int dev_open(struct sr_dev_inst *sdi) goto err_ftdi_free; } - /* Purge RX/TX buffers in the FTDI chip. */ ret = ftdi_usb_purge_buffers(devc->ftdic); if (ret < 0) { sr_err("Failed to purge FTDI RX/TX buffers (%d): %s.", @@ -281,7 +277,6 @@ static int dev_open(struct sr_dev_inst *sdi) goto err_dev_open_close_ftdic; } - /* Reset the FTDI bitmode. */ ret = ftdi_set_bitmode(devc->ftdic, 0x00, BITMODE_RESET); if (ret < 0) { sr_err("Failed to reset the FTDI chip bitmode (%d): %s.", diff --git a/src/hardware/ftdi-la/protocol.h b/src/hardware/ftdi-la/protocol.h index d5ba9b09..495c4dbb 100644 --- a/src/hardware/ftdi-la/protocol.h +++ b/src/hardware/ftdi-la/protocol.h @@ -36,7 +36,6 @@ struct ftdi_chip_desc { char *channel_names[]; }; -/** Private, per-device-instance driver context. */ struct dev_context { struct ftdi_context *ftdic; const struct ftdi_chip_desc *desc; diff --git a/src/hardware/fx2lafw/api.c b/src/hardware/fx2lafw/api.c index b9d43428..9e5b2424 100644 --- a/src/hardware/fx2lafw/api.c +++ b/src/hardware/fx2lafw/api.c @@ -268,7 +268,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) } } - /* Skip if the device was not found. */ if (!prof) continue; diff --git a/src/hardware/fx2lafw/protocol.h b/src/hardware/fx2lafw/protocol.h index f5ef67c9..1403c8ab 100644 --- a/src/hardware/fx2lafw/protocol.h +++ b/src/hardware/fx2lafw/protocol.h @@ -98,16 +98,13 @@ struct dev_context { */ int64_t fw_updated; - /* Supported samplerates */ const uint64_t *samplerates; int num_samplerates; - /* Device/capture settings */ uint64_t cur_samplerate; uint64_t limit_samples; uint64_t capture_ratio; - /* Operational settings */ gboolean trigger_fired; gboolean acq_aborted; gboolean sample_wide; diff --git a/src/hardware/gmc-mh-1x-2x/api.c b/src/hardware/gmc-mh-1x-2x/api.c index 7443f487..91f12560 100644 --- a/src/hardware/gmc-mh-1x-2x/api.c +++ b/src/hardware/gmc-mh-1x-2x/api.c @@ -17,14 +17,6 @@ * along with this program. If not, see . */ -/** - * @file - * - * Gossen Metrawatt Metrahit 1x/2x drivers - * - * @internal - */ - #include #include #include "protocol.h" @@ -388,7 +380,6 @@ static int dev_acquisition_start_1x_2x_rs232(const struct sr_dev_inst *sdi) sr_sw_limits_acquisition_start(&devc->limits); std_session_send_df_header(sdi); - /* Poll every 40ms, or whenever some data comes in. */ serial = sdi->conn; serial_source_add(sdi->session, serial, G_IO_IN, 40, gmc_mh_1x_2x_receive_data, (void *)sdi); @@ -408,7 +399,6 @@ static int dev_acquisition_start_2x_bd232(const struct sr_dev_inst *sdi) sr_sw_limits_acquisition_start(&devc->limits); std_session_send_df_header(sdi); - /* Poll every 40ms, or whenever some data comes in. */ serial = sdi->conn; serial_source_add(sdi->session, serial, G_IO_IN, 40, gmc_mh_2x_receive_data, (void *)sdi); diff --git a/src/hardware/gmc-mh-1x-2x/protocol.c b/src/hardware/gmc-mh-1x-2x/protocol.c index 5820a0ec..53efdf42 100644 --- a/src/hardware/gmc-mh-1x-2x/protocol.c +++ b/src/hardware/gmc-mh-1x-2x/protocol.c @@ -17,20 +17,11 @@ * along with this program. If not, see . */ -/** - * @file - * - * Gossen Metrawatt Metrahit 1x/2x drivers - * - * @internal - */ - #include #include #include #include "protocol.h" -/* Internal Headers */ static guchar calc_chksum_14(guchar *dta); static int chk_msg14(struct sr_dev_inst *sdi); @@ -1283,9 +1274,7 @@ static void create_cmd_14(guchar addr, guchar func, guchar *params, guchar *buf) } } -/** Request one measurement from 2x multimeter (msg 8). - * - */ +/** Request one measurement from 2x multimeter (msg 8). */ int req_meas14(const struct sr_dev_inst *sdi) { struct dev_context *devc; @@ -1361,7 +1350,8 @@ int req_stat14(const struct sr_dev_inst *sdi, gboolean power_on) return SR_OK; } -/** Decode model in "send mode". +/** + * Decode model in "send mode". * * @param[in] mcode Model code. * @return Model code. diff --git a/src/hardware/gmc-mh-1x-2x/protocol.h b/src/hardware/gmc-mh-1x-2x/protocol.h index 52563d95..ed759694 100644 --- a/src/hardware/gmc-mh-1x-2x/protocol.h +++ b/src/hardware/gmc-mh-1x-2x/protocol.h @@ -17,14 +17,6 @@ * along with this program. If not, see . */ -/** - * @file - * - * Gossen Metrawatt Metrahit 1x/2x drivers - * - * @internal - */ - #ifndef LIBSIGROK_HARDWARE_GMC_MH_1X_2X_PROTOCOL_H #define LIBSIGROK_HARDWARE_GMC_MH_1X_2X_PROTOCOL_H @@ -84,15 +76,11 @@ enum model { METRAHIT_29S = METRAHIT_28S + 1, }; -/** Private, per-device-instance driver context. */ struct dev_context { - /* Model-specific information */ enum model model; /**< Model code. */ - /* Acquisition settings */ struct sr_sw_limits limits; - /* Operational state */ gboolean settings_ok; /**< Settings msg received yet. */ int msg_type; /**< Message type (MSGID_INF, ...). */ int msg_len; /**< Message length (valid when msg, curr. type known).*/ @@ -112,12 +100,10 @@ struct dev_context { int64_t req_sent_at; /**< Request sent. */ gboolean response_pending; /**< Request sent, response is pending. */ - /* Temporary state across callbacks */ uint8_t buf[GMC_BUFSIZE]; /**< Buffer for read callback */ int buflen; /**< Data len in buf */ }; -/* Forward declarations */ SR_PRIV int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg); SR_PRIV int gmc_decode_model_bd(uint8_t mcode); diff --git a/src/hardware/gwinstek-gds-800/protocol.h b/src/hardware/gwinstek-gds-800/protocol.h index 382e87b8..d5c2e5a0 100644 --- a/src/hardware/gwinstek-gds-800/protocol.h +++ b/src/hardware/gwinstek-gds-800/protocol.h @@ -44,7 +44,6 @@ enum gds_state WAIT_FOR_TRANSFER_OF_CHANNEL_DATA_COMPLETE, }; -/** Private, per-device-instance driver context. */ struct dev_context { enum gds_state state; uint64_t cur_acq_frame; diff --git a/src/hardware/hameg-hmo/protocol.h b/src/hardware/hameg-hmo/protocol.h index ccdcb90c..74ef3da9 100644 --- a/src/hardware/hameg-hmo/protocol.h +++ b/src/hardware/hameg-hmo/protocol.h @@ -92,7 +92,6 @@ struct scope_state { uint64_t sample_rate; }; -/** Private, per-device-instance driver context. */ struct dev_context { const void *model_config; void *model_state; diff --git a/src/hardware/hp-3457a/protocol.c b/src/hardware/hp-3457a/protocol.c index aa8ab528..f0197290 100644 --- a/src/hardware/hp-3457a/protocol.c +++ b/src/hardware/hp-3457a/protocol.c @@ -25,6 +25,7 @@ static int set_mq_volt(struct sr_scpi_dev_inst *scpi, enum sr_mqflag flags); static int set_mq_amp(struct sr_scpi_dev_inst *scpi, enum sr_mqflag flags); static int set_mq_ohm(struct sr_scpi_dev_inst *scpi, enum sr_mqflag flags); + /* * The source for the frequency measurement can be either AC voltage, AC+DC * voltage, AC current, or AC+DC current. Configuring this is not yet diff --git a/src/hardware/hp-3457a/protocol.h b/src/hardware/hp-3457a/protocol.h index dda19a23..3fef0efa 100644 --- a/src/hardware/hp-3457a/protocol.h +++ b/src/hardware/hp-3457a/protocol.h @@ -57,13 +57,10 @@ enum channel_conn { CONN_REAR, }; -/** Private, per-device-instance driver context. */ struct dev_context { - /* Model-specific information */ /* Information about rear card option, or NULL if unknown */ const struct rear_card_info *rear_card; - /* Acquisition settings */ enum sr_mq measurement_mq; enum sr_mqflag measurement_mq_flags; enum sr_unit measurement_unit; @@ -73,7 +70,6 @@ struct dev_context { unsigned int num_active_channels; struct sr_channel *current_channel; - /* Operational state */ enum acquisition_state acq_state; enum channel_conn input_loc; uint64_t num_samples; diff --git a/src/hardware/hung-chang-dso-2100/protocol.h b/src/hardware/hung-chang-dso-2100/protocol.h index 7168bd69..f7268f3b 100644 --- a/src/hardware/hung-chang-dso-2100/protocol.h +++ b/src/hardware/hung-chang-dso-2100/protocol.h @@ -29,9 +29,7 @@ #define MAX_RETRIES 4 #define NUM_CHANNELS 2 -/** Private, per-device-instance driver context. */ struct dev_context { - /* Acquisition settings */ GSList *enabled_channel; uint8_t channel; uint8_t rate; @@ -42,7 +40,6 @@ struct dev_context { uint8_t offset[2]; uint8_t gain[2]; - /* Operational state */ uint64_t frame_limit; uint64_t frame; uint64_t probe[2]; @@ -51,7 +48,6 @@ struct dev_context { uint8_t retries; gboolean adc2; - /* Temporary state across callbacks */ float *samples; float factor; gboolean state_known; diff --git a/src/hardware/ikalogic-scanalogic2/api.c b/src/hardware/ikalogic-scanalogic2/api.c index 8b9e7f16..8005fe07 100644 --- a/src/hardware/ikalogic-scanalogic2/api.c +++ b/src/hardware/ikalogic-scanalogic2/api.c @@ -181,10 +181,6 @@ static int dev_open(struct sr_dev_inst *sdi) if (sr_usb_open(drvc->sr_ctx->libusb_ctx, usb) != SR_OK) return SR_ERR; - /* - * Determine if a kernel driver is active on this interface and, if so, - * detach it. - */ if (libusb_kernel_driver_active(usb->devhdl, USB_INTERFACE) == 1) { ret = libusb_detach_kernel_driver(usb->devhdl, USB_INTERFACE); if (ret < 0) { diff --git a/src/hardware/ikalogic-scanalogic2/protocol.c b/src/hardware/ikalogic-scanalogic2/protocol.c index c58050bb..6dd66999 100644 --- a/src/hardware/ikalogic-scanalogic2/protocol.c +++ b/src/hardware/ikalogic-scanalogic2/protocol.c @@ -640,10 +640,6 @@ SR_PRIV int sl2_get_device_info(struct sr_dev_driver *di, if (sr_usb_open(drvc->sr_ctx->libusb_ctx, &usb) != SR_OK) return SR_ERR; - /* - * Determine if a kernel driver is active on this interface and, if so, - * detach it. - */ if (libusb_kernel_driver_active(usb.devhdl, USB_INTERFACE) == 1) { ret = libusb_detach_kernel_driver(usb.devhdl, USB_INTERFACE); diff --git a/src/hardware/ikalogic-scanalogic2/protocol.h b/src/hardware/ikalogic-scanalogic2/protocol.h index d7a27357..bb9de666 100644 --- a/src/hardware/ikalogic-scanalogic2/protocol.h +++ b/src/hardware/ikalogic-scanalogic2/protocol.h @@ -120,7 +120,6 @@ enum { STATE_WAIT_DEVICE_READY }; -/** Private, per-device-instance driver context. */ struct dev_context { /* Current selected samplerate. */ uint64_t samplerate; diff --git a/src/hardware/ikalogic-scanaplus/api.c b/src/hardware/ikalogic-scanaplus/api.c index 67da9b39..86c1402e 100644 --- a/src/hardware/ikalogic-scanaplus/api.c +++ b/src/hardware/ikalogic-scanaplus/api.c @@ -38,7 +38,6 @@ static const uint32_t devopts[] = { SR_CONF_SAMPLERATE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, }; -/* Channels are numbered 1-9. */ static const char *channel_names[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", }; @@ -67,7 +66,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) (void)options; - /* Allocate memory for our private device context. */ devc = g_malloc0(sizeof(struct dev_context)); /* Allocate memory for the incoming compressed samples. */ @@ -82,13 +80,11 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) goto err_free_compressed_buf; } - /* Allocate memory for the FTDI context (ftdic) and initialize it. */ if (!(devc->ftdic = ftdi_new())) { sr_err("Failed to initialize libftdi."); goto err_free_sample_buf; } - /* Check for the device and temporarily open it. */ ret = ftdi_usb_open_desc(devc->ftdic, USB_VENDOR_ID, USB_DEVICE_ID, USB_IPRODUCT, NULL); if (ret < 0) { @@ -99,7 +95,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) goto err_free_ftdic; } - /* Register the device with libsigrok. */ sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE; sdi->vendor = g_strdup(USB_VENDOR_NAME); @@ -109,14 +104,13 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) for (i = 0; i < ARRAY_SIZE(channel_names); i++) sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, channel_names[i]); - /* Close device. We'll reopen it again when we need it. */ scanaplus_close(devc); return std_scan_complete(di, g_slist_append(NULL, sdi)); scanaplus_close(devc); err_free_ftdic: - ftdi_free(devc->ftdic); /* NOT free() or g_free()! */ + ftdi_free(devc->ftdic); err_free_sample_buf: g_free(devc->sample_buf); err_free_compressed_buf: @@ -134,7 +128,6 @@ static int dev_open(struct sr_dev_inst *sdi) devc = sdi->priv; - /* Select interface A, otherwise communication will fail. */ ret = ftdi_set_interface(devc->ftdic, INTERFACE_A); if (ret < 0) { sr_err("Failed to set FTDI interface A (%d): %s", ret, @@ -142,7 +135,6 @@ static int dev_open(struct sr_dev_inst *sdi) return SR_ERR; } - /* Open the device. */ ret = ftdi_usb_open_desc(devc->ftdic, USB_VENDOR_ID, USB_DEVICE_ID, USB_IPRODUCT, NULL); if (ret < 0) { @@ -151,14 +143,12 @@ static int dev_open(struct sr_dev_inst *sdi) return SR_ERR; } - /* Purge RX/TX buffers in the FTDI chip. */ if ((ret = ftdi_usb_purge_buffers(devc->ftdic)) < 0) { sr_err("Failed to purge FTDI RX/TX buffers (%d): %s.", ret, ftdi_get_error_string(devc->ftdic)); goto err_dev_open_close_ftdic; } - /* Reset the FTDI bitmode. */ ret = ftdi_set_bitmode(devc->ftdic, 0xff, BITMODE_RESET); if (ret < 0) { sr_err("Failed to reset the FTDI chip bitmode (%d): %s.", @@ -166,7 +156,6 @@ static int dev_open(struct sr_dev_inst *sdi) goto err_dev_open_close_ftdic; } - /* Set FTDI bitmode to "sync FIFO". */ ret = ftdi_set_bitmode(devc->ftdic, 0xff, BITMODE_SYNCFF); if (ret < 0) { sr_err("Failed to put FTDI chip into sync FIFO mode (%d): %s.", @@ -174,7 +163,6 @@ static int dev_open(struct sr_dev_inst *sdi) goto err_dev_open_close_ftdic; } - /* Set the FTDI latency timer to 2. */ ret = ftdi_set_latency_timer(devc->ftdic, 2); if (ret < 0) { sr_err("Failed to set FTDI latency timer (%d): %s.", @@ -182,7 +170,6 @@ static int dev_open(struct sr_dev_inst *sdi) goto err_dev_open_close_ftdic; } - /* Set the FTDI read data chunk size to 64kB. */ ret = ftdi_read_data_set_chunksize(devc->ftdic, 64 * 1024); if (ret < 0) { sr_err("Failed to set FTDI read data chunk size (%d): %s.", diff --git a/src/hardware/ikalogic-scanaplus/protocol.h b/src/hardware/ikalogic-scanaplus/protocol.h index f7978324..fde2e4e2 100644 --- a/src/hardware/ikalogic-scanaplus/protocol.h +++ b/src/hardware/ikalogic-scanaplus/protocol.h @@ -31,15 +31,9 @@ #define COMPRESSED_BUF_SIZE (64 * 1024) -/* Private, per-device-instance driver context. */ struct dev_context { - /** FTDI device context (used by libftdi). */ struct ftdi_context *ftdic; - - /** The current sampling limit (in ms). */ uint64_t limit_msec; - - /** The current sampling limit (in number of samples). */ uint64_t limit_samples; uint8_t *compressed_buf; diff --git a/src/hardware/kecheng-kc-330b/protocol.c b/src/hardware/kecheng-kc-330b/protocol.c index 1ee5c5e2..1bbe5746 100644 --- a/src/hardware/kecheng-kc-330b/protocol.c +++ b/src/hardware/kecheng-kc-330b/protocol.c @@ -20,6 +20,7 @@ #include #include #include "protocol.h" + extern const uint64_t kecheng_kc_330b_sample_intervals[][2]; SR_PRIV int kecheng_kc_330b_handle_events(int fd, int revents, void *cb_data) diff --git a/src/hardware/kecheng-kc-330b/protocol.h b/src/hardware/kecheng-kc-330b/protocol.h index e2090d84..e750ff47 100644 --- a/src/hardware/kecheng-kc-330b/protocol.h +++ b/src/hardware/kecheng-kc-330b/protocol.h @@ -66,9 +66,7 @@ enum { DEVICE_INACTIVE, }; -/** Private, per-device-instance driver context. */ struct dev_context { - /* Acquisition settings */ uint64_t limit_samples; int sample_interval; int alarm_low; @@ -76,7 +74,6 @@ struct dev_context { enum sr_mqflag mqflags; int data_source; - /* Operational state */ int state; gboolean config_dirty; uint64_t num_samples; @@ -84,9 +81,7 @@ struct dev_context { struct libusb_transfer *xfer; unsigned char buf[128]; - /* Temporary state across callbacks */ gint64 last_live_request; - }; SR_PRIV int kecheng_kc_330b_handle_events(int fd, int revents, void *cb_data); diff --git a/src/hardware/kern-scale/api.c b/src/hardware/kern-scale/api.c index 283e5b17..7b7d3d08 100644 --- a/src/hardware/kern-scale/api.c +++ b/src/hardware/kern-scale/api.c @@ -147,7 +147,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) sr_sw_limits_acquisition_start(&devc->limits); std_session_send_df_header(sdi); - /* Poll every 50ms, or whenever some data comes in. */ serial_source_add(sdi->session, serial, G_IO_IN, 50, kern_scale_receive_data, (void *)sdi); diff --git a/src/hardware/kern-scale/protocol.h b/src/hardware/kern-scale/protocol.h index 934aff02..836eb91b 100644 --- a/src/hardware/kern-scale/protocol.h +++ b/src/hardware/kern-scale/protocol.h @@ -46,7 +46,6 @@ struct scale_info { #define SCALE_BUFSIZE 256 -/** Private, per-device-instance driver context. */ struct dev_context { struct sr_sw_limits limits; diff --git a/src/hardware/korad-kaxxxxp/api.c b/src/hardware/korad-kaxxxxp/api.c index 04a26834..acd50961 100644 --- a/src/hardware/korad-kaxxxxp/api.c +++ b/src/hardware/korad-kaxxxxp/api.c @@ -26,17 +26,13 @@ static const uint32_t scanopts[] = { }; static const uint32_t drvopts[] = { - /* Device class */ SR_CONF_POWER_SUPPLY, }; static const uint32_t devopts[] = { - /* Device class */ - /* Acquisition modes. */ SR_CONF_CONTINUOUS, SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET, SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET, - /* Device configuration */ SR_CONF_VOLTAGE | SR_CONF_GET, SR_CONF_VOLTAGE_TARGET | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, SR_CONF_CURRENT | SR_CONF_GET, @@ -129,7 +125,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) sr_dbg("Found: %s %s (idx %d, ID '%s').", models[model_id].vendor, models[model_id].name, model_id, models[model_id].id); - /* Init device instance, etc. */ sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE; sdi->vendor = g_strdup(models[model_id].vendor); diff --git a/src/hardware/korad-kaxxxxp/protocol.h b/src/hardware/korad-kaxxxxp/protocol.h index e88360e7..2423ce99 100644 --- a/src/hardware/korad-kaxxxxp/protocol.h +++ b/src/hardware/korad-kaxxxxp/protocol.h @@ -17,12 +17,6 @@ * along with this program. If not, see . */ -/** - * @file - * Korad KAxxxxP power supply driver - * @internal - */ - #ifndef LIBSIGROK_HARDWARE_KORAD_KAXXXXP_PROTOCOL_H #define LIBSIGROK_HARDWARE_KORAD_KAXXXXP_PROTOCOL_H @@ -70,17 +64,13 @@ enum { KAXXXXP_RECALL, }; -/** Private, per-device-instance driver context. */ struct dev_context { - /* Model-specific information */ const struct korad_kaxxxxp_model *model; /**< Model information. */ - /* Acquisition settings */ struct sr_sw_limits limits; int64_t req_sent_at; gboolean reply_pending; - /* Operational state */ float current; /**< Last current value [A] read from device. */ float current_max; /**< Output current set. */ float voltage; /**< Last voltage value [V] read from device. */ @@ -92,7 +82,6 @@ struct dev_context { gboolean ocp_enabled; /**< Output current protection enabled. */ gboolean ovp_enabled; /**< Output voltage protection enabled. */ - /* Temporary state across callbacks */ int target; /**< What reply to expect. */ int program; /**< Program to store or recall. */ char reply[6]; diff --git a/src/hardware/lascar-el-usb/protocol.h b/src/hardware/lascar-el-usb/protocol.h index 9e7b7167..14699096 100644 --- a/src/hardware/lascar-el-usb/protocol.h +++ b/src/hardware/lascar-el-usb/protocol.h @@ -39,9 +39,9 @@ #define SLEEP_US_LONG (5 * 1000) #define SLEEP_US_SHORT (1 * 1000) -/** Private, per-device-instance driver context. */ struct dev_context { const struct elusb_profile *profile; + /* Generic EL-USB */ unsigned char config[MAX_CONFIGBLOCK_SIZE]; unsigned int log_size; @@ -50,6 +50,7 @@ struct dev_context { unsigned int logged_samples; unsigned int rcvd_samples; uint64_t limit_samples; + /* Model-specific */ /* EL-USB-CO: these are something like scaling and calibration values * fixed per device, used to convert the sample values to CO ppm. */ diff --git a/src/hardware/lecroy-logicstudio/protocol.h b/src/hardware/lecroy-logicstudio/protocol.h index 1ac3d0fc..f6a0ea09 100644 --- a/src/hardware/lecroy-logicstudio/protocol.h +++ b/src/hardware/lecroy-logicstudio/protocol.h @@ -33,7 +33,6 @@ struct samplerate_info; -/** Private, per-device-instance driver context. */ struct dev_context { struct libusb_transfer *intr_xfer; struct libusb_transfer *bulk_xfer; diff --git a/src/hardware/lecroy-xstream/api.c b/src/hardware/lecroy-xstream/api.c index 281a3871..140308dc 100644 --- a/src/hardware/lecroy-xstream/api.c +++ b/src/hardware/lecroy-xstream/api.c @@ -504,6 +504,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) devc = sdi->priv; scpi = sdi->conn; + /* Preset empty results. */ g_slist_free(devc->enabled_channels); devc->enabled_channels = NULL; diff --git a/src/hardware/lecroy-xstream/protocol.h b/src/hardware/lecroy-xstream/protocol.h index 0200c197..266504e6 100644 --- a/src/hardware/lecroy-xstream/protocol.h +++ b/src/hardware/lecroy-xstream/protocol.h @@ -76,7 +76,6 @@ struct scope_state { uint64_t sample_rate; }; -/** Private, per-device-instance driver context. */ struct dev_context { const void *model_config; void *model_state; diff --git a/src/hardware/link-mso19/api.c b/src/hardware/link-mso19/api.c index 6069c71b..47ace67d 100644 --- a/src/hardware/link-mso19/api.c +++ b/src/hardware/link-mso19/api.c @@ -374,7 +374,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) return SR_OK; } -/* This stops acquisition on ALL devices, ignoring dev_index. */ static int dev_acquisition_stop(struct sr_dev_inst *sdi) { stop_acquisition(sdi); diff --git a/src/hardware/link-mso19/protocol.h b/src/hardware/link-mso19/protocol.h index 4c8a66b2..5097d053 100644 --- a/src/hardware/link-mso19/protocol.h +++ b/src/hardware/link-mso19/protocol.h @@ -84,7 +84,6 @@ struct mso_prototrig { uint8_t spimode; }; -/* Private, per-device-instance driver context. */ struct dev_context { /* info */ uint8_t hwmodel; @@ -97,10 +96,11 @@ struct dev_context { uint16_t offset_range; uint64_t limit_samples; uint64_t num_samples; + /* register cache */ uint8_t ctlbase1; uint8_t ctlbase2; - /* state */ + uint8_t la_threshold; uint64_t cur_rate; uint8_t dso_probe_attn; diff --git a/src/hardware/manson-hcs-3xxx/api.c b/src/hardware/manson-hcs-3xxx/api.c index 4015ec76..ab1e3b9b 100644 --- a/src/hardware/manson-hcs-3xxx/api.c +++ b/src/hardware/manson-hcs-3xxx/api.c @@ -18,14 +18,6 @@ * along with this program; if not, see . */ -/** - * @file - * - * Manson HCS-3xxx series power supply driver - * - * @internal - */ - #include #include "protocol.h" @@ -35,17 +27,13 @@ static const uint32_t scanopts[] = { }; static const uint32_t drvopts[] = { - /* Device class */ SR_CONF_POWER_SUPPLY, }; static const uint32_t devopts[] = { - /* Device class */ - /* Acquisition modes. */ SR_CONF_CONTINUOUS, SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET, SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET, - /* Device configuration */ SR_CONF_VOLTAGE | SR_CONF_GET, SR_CONF_VOLTAGE_TARGET | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, SR_CONF_CURRENT | SR_CONF_GET, @@ -137,7 +125,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) } g_strfreev(tokens); - /* Init device instance, etc. */ sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE; sdi->vendor = g_strdup("Manson"); @@ -337,7 +324,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) devc->reply_pending = FALSE; devc->req_sent_at = 0; - /* Poll every 10ms, or whenever some data comes in. */ serial = sdi->conn; serial_source_add(sdi->session, serial, G_IO_IN, 10, hcs_receive_data, (void *)sdi); diff --git a/src/hardware/manson-hcs-3xxx/protocol.c b/src/hardware/manson-hcs-3xxx/protocol.c index 19d58180..30017d1c 100644 --- a/src/hardware/manson-hcs-3xxx/protocol.c +++ b/src/hardware/manson-hcs-3xxx/protocol.c @@ -18,14 +18,6 @@ * along with this program; if not, see . */ -/** - * @file - * - * Manson HCS-3xxx Series power supply driver - * - * @internal - */ - #include #include "protocol.h" diff --git a/src/hardware/manson-hcs-3xxx/protocol.h b/src/hardware/manson-hcs-3xxx/protocol.h index 93cc5475..da47afb0 100644 --- a/src/hardware/manson-hcs-3xxx/protocol.h +++ b/src/hardware/manson-hcs-3xxx/protocol.h @@ -18,14 +18,6 @@ * along with this program; if not, see . */ -/** - * @file - * - * Manson HCS-3xxx Series power supply driver - * - * @internal - */ - #ifndef LIBSIGROK_HARDWARE_MANSON_HCS_3XXX_PROTOCOL_H #define LIBSIGROK_HARDWARE_MANSON_HCS_3XXX_PROTOCOL_H @@ -66,7 +58,6 @@ struct hcs_model { double current[3]; /**< Min, max, step */ }; -/** Private, per-device-instance driver context. */ struct dev_context { const struct hcs_model *model; /**< Model information. */ diff --git a/src/hardware/maynuo-m97/api.c b/src/hardware/maynuo-m97/api.c index 08bc1615..970e8437 100644 --- a/src/hardware/maynuo-m97/api.c +++ b/src/hardware/maynuo-m97/api.c @@ -365,7 +365,6 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst * devc = (sdi) ? sdi->priv : NULL; if (!cg) { - /* No channel group: global options. */ return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts); } else { switch (key) { diff --git a/src/hardware/maynuo-m97/protocol.h b/src/hardware/maynuo-m97/protocol.h index a2e39f58..31589d90 100644 --- a/src/hardware/maynuo-m97/protocol.h +++ b/src/hardware/maynuo-m97/protocol.h @@ -34,15 +34,9 @@ struct maynuo_m97_model { unsigned int max_power; }; -/** Private, per-device-instance driver context. */ struct dev_context { - /* Model-specific information */ const struct maynuo_m97_model *model; - - /* Acquisition settings */ struct sr_sw_limits limits; - - /* Operational state */ int expecting_registers; }; diff --git a/src/hardware/mic-985xx/api.c b/src/hardware/mic-985xx/api.c index 3af30a2a..cec9a73f 100644 --- a/src/hardware/mic-985xx/api.c +++ b/src/hardware/mic-985xx/api.c @@ -116,13 +116,10 @@ static GSList *scan(GSList *options, int idx) if (!conn) return NULL; - if (serialcomm) { - /* Use the provided comm specs. */ + if (serialcomm) devices = mic_scan(conn, serialcomm, idx); - } else { - /* Try the default. */ + else devices = mic_scan(conn, mic_devs[idx].conn, idx); - } return devices; } @@ -166,7 +163,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, int idx) sr_sw_limits_acquisition_start(&devc->limits); std_session_send_df_header(sdi); - /* Poll every 100ms, or whenever some data comes in. */ serial = sdi->conn; serial_source_add(sdi->session, serial, G_IO_IN, 100, mic_devs[idx].receive_data, (void *)sdi); diff --git a/src/hardware/mic-985xx/protocol.h b/src/hardware/mic-985xx/protocol.h index d4ad06d9..c9ba0944 100644 --- a/src/hardware/mic-985xx/protocol.h +++ b/src/hardware/mic-985xx/protocol.h @@ -51,7 +51,6 @@ extern SR_PRIV const struct mic_dev_info mic_devs[]; #define SERIAL_BUFSIZE 256 -/** Private, per-device-instance driver context. */ struct dev_context { struct sr_sw_limits limits; diff --git a/src/hardware/motech-lps-30x/api.c b/src/hardware/motech-lps-30x/api.c index d5a834f7..6164e4ac 100644 --- a/src/hardware/motech-lps-30x/api.c +++ b/src/hardware/motech-lps-30x/api.c @@ -18,14 +18,6 @@ * along with this program. If not, see . */ -/** - * @file - * - * Motech LPS-30x series power supply driver - * - * @internal - */ - #include #include #include @@ -38,31 +30,23 @@ SR_PRIV int lps_cmd_ok(struct sr_serial_dev_inst *serial, const char *fmt, ...); SR_PRIV int lps_cmd_reply(char *reply, struct sr_serial_dev_inst *serial, const char *fmt, ...); SR_PRIV int lps_query_status(struct sr_dev_inst *sdi); -/* Serial communication parameters */ #define SERIALCOMM "2400/8n1/dtr=1/rts=1/flow=0" #define VENDOR_MOTECH "Motech" -/** Driver scanning options. */ static const uint32_t scanopts[] = { SR_CONF_CONN, SR_CONF_SERIALCOMM, }; -/** Driver capabilities generic. */ static const uint32_t drvopts[] = { - /* Device class */ SR_CONF_POWER_SUPPLY, }; -/** Hardware capabilities generic. */ static const uint32_t devopts[] = { - /* Device class */ - /* Acquisition modes. */ SR_CONF_CONTINUOUS, SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET, SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET, - /* Device configuration */ SR_CONF_CHANNEL_CONFIG | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, }; @@ -75,7 +59,7 @@ static const uint32_t devopts_ch12[] = { SR_CONF_ENABLED | SR_CONF_GET | SR_CONF_SET, }; -/** Hardware capabilities channel 3. (LPS-304/305 only). */ +/** Hardware capabilities channel 3 (LPS-304/305 only). */ static const uint32_t devopts_ch3[] = { SR_CONF_VOLTAGE | SR_CONF_GET, SR_CONF_ENABLED | SR_CONF_GET | SR_CONF_SET, @@ -133,8 +117,7 @@ static const struct lps_modelspec models[] = { }, }; -/** Send command to device with va_list. - */ +/** Send command to device with va_list. */ SR_PRIV int lps_send_va(struct sr_serial_dev_inst *serial, const char *fmt, va_list args) { int retc; @@ -155,8 +138,7 @@ SR_PRIV int lps_send_va(struct sr_serial_dev_inst *serial, const char *fmt, va_l return SR_OK; } -/** Send command to device. - */ +/** Send command to device. */ SR_PRIV int lps_send_req(struct sr_serial_dev_inst *serial, const char *fmt, ...) { int retc; @@ -367,8 +349,7 @@ SR_PRIV int lps_read_reply(struct sr_serial_dev_inst *serial, char **buf, int *b return SR_ERR; /* Timeout! */ } -/** Scan for LPS-300 series device. - */ +/** Scan for LPS-300 series device. */ static GSList *do_scan(lps_modelid modelid, struct sr_dev_driver *drv, GSList *options) { struct sr_dev_inst *sdi; @@ -523,7 +504,6 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s devc = sdi->priv; if (!cg) { - /* No channel group: global options. */ switch (key) { case SR_CONF_LIMIT_SAMPLES: case SR_CONF_LIMIT_MSEC: @@ -538,6 +518,7 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s /* We only ever have one channel per channel group in this driver. */ ch = cg->channels->data; ch_idx = ch->index; + switch (key) { case SR_CONF_VOLTAGE: *data = g_variant_new_double(devc->channel_status[ch_idx].output_voltage_last); @@ -582,7 +563,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd return SR_ERR_NA; if (!cg) { - /* No channel group: global options. */ switch (key) { case SR_CONF_LIMIT_MSEC: case SR_CONF_LIMIT_SAMPLES: @@ -609,7 +589,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd return SR_ERR_NA; } } else { - /* Channel group specified: per-channel options. */ /* We only ever have one channel per channel group in this driver. */ ch = cg->channels->data; ch_idx = ch->index; @@ -679,7 +658,6 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst * devc = (sdi) ? sdi->priv : NULL; - /* Device options, independent from channel groups. */ if (!cg) { switch (key) { case SR_CONF_SCAN_OPTIONS: @@ -699,9 +677,10 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst * } } - /* Device options, depending on channel groups. */ + /* We only ever have one channel per channel group in this driver. */ ch = cg->channels->data; ch_idx = ch->index; + switch (key) { case SR_CONF_DEVICE_OPTIONS: if ((ch_idx == 0) || (ch_idx == 1)) /* CH1, CH2 */ diff --git a/src/hardware/motech-lps-30x/protocol.c b/src/hardware/motech-lps-30x/protocol.c index 867cbb45..c952ed0b 100644 --- a/src/hardware/motech-lps-30x/protocol.c +++ b/src/hardware/motech-lps-30x/protocol.c @@ -18,14 +18,6 @@ * along with this program. If not, see . */ -/** - * @file - * - * Motech LPS-30x series power supply driver - * - * @internal - */ - #include #include #include diff --git a/src/hardware/motech-lps-30x/protocol.h b/src/hardware/motech-lps-30x/protocol.h index cb74148f..99e453eb 100644 --- a/src/hardware/motech-lps-30x/protocol.h +++ b/src/hardware/motech-lps-30x/protocol.h @@ -18,14 +18,6 @@ * along with this program. If not, see . */ -/** - * @file - * - * Motech LPS-30x series power supply driver - * - * @internal - */ - #ifndef LIBSIGROK_HARDWARE_MOTECH_LPS_30X_PROTOCOL_H #define LIBSIGROK_HARDWARE_MOTECH_LPS_30X_PROTOCOL_H @@ -93,22 +85,17 @@ struct channel_status { gdouble output_current_max; }; -/** Private, per-device-instance driver context. */ struct dev_context { - /* Model-specific information */ const struct lps_modelspec *model; - /* Acquisition status */ gboolean acq_running; /**< Acquisition is running. */ struct sr_sw_limits limits; acquisition_req acq_req; /**< Current request. */ uint8_t acq_req_pending; /**< Request pending. 0=none, 1=reply, 2=OK */ - /* Operational state */ struct channel_status channel_status[MAX_CHANNELS]; guint8 tracking_mode; /**< 0=off, 1=Tracking from CH1, 2=Tracking from CH2. */ - /* Temporary state across callbacks */ int64_t req_sent_at; /**< Request sent. */ gchar buf[LINELEN_MAX]; /**< Buffer for read callback */ int buflen; /**< Data len in buf */ diff --git a/src/hardware/norma-dmm/api.c b/src/hardware/norma-dmm/api.c index 96d69b12..094fe951 100644 --- a/src/hardware/norma-dmm/api.c +++ b/src/hardware/norma-dmm/api.c @@ -17,11 +17,6 @@ * along with this program. If not, see . */ -/** @file - * Norma DM9x0/Siemens B102x DMMs driver. - * @internal - */ - #include #include "protocol.h" @@ -192,7 +187,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) sr_sw_limits_acquisition_start(&devc->limits); std_session_send_df_header(sdi); - /* Poll every 100ms, or whenever some data comes in. */ serial = sdi->conn; serial_source_add(sdi->session, serial, G_IO_IN, 100, norma_dmm_receive_data, (void *)sdi); diff --git a/src/hardware/norma-dmm/protocol.c b/src/hardware/norma-dmm/protocol.c index 804fc36e..39924176 100644 --- a/src/hardware/norma-dmm/protocol.c +++ b/src/hardware/norma-dmm/protocol.c @@ -17,14 +17,6 @@ * along with this program. If not, see . */ -/** - * @file - * - * Norma DM9x0/Siemens B102x DMMs driver. - * - * @internal - */ - #include #include "protocol.h" diff --git a/src/hardware/norma-dmm/protocol.h b/src/hardware/norma-dmm/protocol.h index bec61070..9891741e 100644 --- a/src/hardware/norma-dmm/protocol.h +++ b/src/hardware/norma-dmm/protocol.h @@ -28,14 +28,6 @@ #include #include "libsigrok-internal.h" -/** - * @file - * - * Norma DM9x0/Siemens B102x DMMs driver. - * - * @internal - */ - #define LOG_PREFIX "norma-dmm" #define NMADMM_BUFSIZE 256 @@ -57,21 +49,16 @@ struct nmadmm_req { /** Strings for requests. */ extern const struct nmadmm_req nmadmm_requests[]; -/** Private, per-device-instance driver context. */ struct dev_context { - /* Model-specific information */ int type; /**< DM9x0, e.g. 5 = DM950 */ - /* Acquisition settings */ struct sr_sw_limits limits; - /* Operational state */ int last_req; /**< Last request. */ int64_t req_sent_at; /**< Request sent. */ gboolean last_req_pending; /**< Last request not answered yet. */ int lowbatt; /**< Low battery. 1=low, 2=critical. */ - /* Temporary state across callbacks */ uint8_t buf[NMADMM_BUFSIZE]; /**< Buffer for read callback */ int buflen; /**< Data len in buf */ }; diff --git a/src/hardware/openbench-logic-sniffer/protocol.h b/src/hardware/openbench-logic-sniffer/protocol.h index 4525ba2c..723da636 100644 --- a/src/hardware/openbench-logic-sniffer/protocol.h +++ b/src/hardware/openbench-logic-sniffer/protocol.h @@ -66,15 +66,12 @@ #define FLAG_FILTER (1 << 1) #define FLAG_DEMUX (1 << 0) -/* Private, per-device-instance driver context. */ struct dev_context { - /* Fixed device settings */ int max_channels; uint32_t max_samples; uint32_t max_samplerate; uint32_t protocol_version; - /* Acquisition settings */ uint64_t cur_samplerate; uint32_t cur_samplerate_divider; uint64_t limit_samples; @@ -86,7 +83,6 @@ struct dev_context { int num_stages; uint16_t flag_reg; - /* Operational states */ unsigned int num_transfers; unsigned int num_samples; int num_bytes; @@ -94,7 +90,6 @@ struct dev_context { int cnt_samples; int cnt_samples_rle; - /* Temporary variables */ unsigned int rle_count; unsigned char sample[4]; unsigned char tmp_sample[4]; diff --git a/src/hardware/pce-322a/api.c b/src/hardware/pce-322a/api.c index 1ac30aed..66983c9c 100644 --- a/src/hardware/pce-322a/api.c +++ b/src/hardware/pce-322a/api.c @@ -306,7 +306,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) std_session_send_df_header(sdi); - /* Poll every 150ms, or whenever some data comes in. */ serial = sdi->conn; serial_source_add(sdi->session, serial, G_IO_IN, 150, pce_322a_receive_data, (void *)sdi); diff --git a/src/hardware/pce-322a/protocol.h b/src/hardware/pce-322a/protocol.h index 094b3ab4..338e37e3 100644 --- a/src/hardware/pce-322a/protocol.h +++ b/src/hardware/pce-322a/protocol.h @@ -68,17 +68,13 @@ enum { MEM_STATE_GET_MEMORY_BLOCK, }; -/** Private, per-device-instance driver context. */ struct dev_context { - /* Model-specific information */ uint64_t cur_mqflags; uint8_t cur_meas_range; - /* Acquisition settings */ uint8_t cur_data_source; uint64_t limit_samples; - /* Operational state */ uint64_t num_samples; /* Memory reading state */ @@ -88,7 +84,6 @@ struct dev_context { uint16_t memory_block_counter; /* Number of memory blocks retrieved so far. */ uint8_t memory_block_cursor; /* Number of bytes retrieved in current memory block. */ - /* Temporary state across callbacks. */ uint8_t buffer[BUFFER_SIZE]; int buffer_len; int buffer_skip; /* Number of bytes to skip in memory mode. */ diff --git a/src/hardware/pipistrello-ols/api.c b/src/hardware/pipistrello-ols/api.c index f16b659e..8dd474cf 100644 --- a/src/hardware/pipistrello-ols/api.c +++ b/src/hardware/pipistrello-ols/api.c @@ -91,31 +91,24 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) devices = NULL; - /* Allocate memory for our private device context. */ devc = g_malloc0(sizeof(struct dev_context)); - /* Device-specific settings */ devc->max_samplebytes = devc->max_samplerate = devc->protocol_version = 0; - /* Acquisition settings */ devc->limit_samples = devc->capture_ratio = 0; devc->trigger_at = -1; devc->channel_mask = 0xffffffff; devc->flag_reg = 0; - /* Allocate memory for the incoming ftdi data. */ devc->ftdi_buf = g_malloc0(FTDI_BUF_SIZE); - /* Allocate memory for the FTDI context (ftdic) and initialize it. */ if (!(devc->ftdic = ftdi_new())) { sr_err("Failed to initialize libftdi."); goto err_free_ftdi_buf;; } - /* Try to open the FTDI device */ - if (p_ols_open(devc) != SR_OK) { + if (p_ols_open(devc) != SR_OK) goto err_free_ftdic; - } /* The discovery procedure is like this: first send the Reset * command (0x00) 5 times, since the device could be anywhere @@ -166,7 +159,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) goto err_close_ftdic; } - /* Close device. We'll reopen it again when we need it. */ p_ols_close(devc); /* Parse the metadata. */ @@ -184,7 +176,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) err_close_ftdic: p_ols_close(devc); err_free_ftdic: - ftdi_free(devc->ftdic); /* NOT free() or g_free()! */ + ftdi_free(devc->ftdic); err_free_ftdi_buf: g_free(devc->ftdi_buf); g_free(devc); diff --git a/src/hardware/pipistrello-ols/protocol.c b/src/hardware/pipistrello-ols/protocol.c index dbe79c6a..66430acb 100644 --- a/src/hardware/pipistrello-ols/protocol.c +++ b/src/hardware/pipistrello-ols/protocol.c @@ -73,7 +73,6 @@ SR_PRIV int p_ols_open(struct dev_context *devc) /* Note: Caller checks devc and devc->ftdic. */ - /* Select interface B, otherwise communication will fail. */ ret = ftdi_set_interface(devc->ftdic, INTERFACE_B); if (ret < 0) { sr_err("Failed to set FTDI interface B (%d): %s", ret, @@ -81,7 +80,6 @@ SR_PRIV int p_ols_open(struct dev_context *devc) return SR_ERR; } - /* Check for the device and temporarily open it. */ ret = ftdi_usb_open_desc(devc->ftdic, USB_VENDOR_ID, USB_DEVICE_ID, USB_IPRODUCT, NULL); if (ret < 0) { @@ -92,14 +90,12 @@ SR_PRIV int p_ols_open(struct dev_context *devc) return SR_ERR; } - /* Purge RX/TX buffers in the FTDI chip. */ if ((ret = ftdi_usb_purge_buffers(devc->ftdic)) < 0) { sr_err("Failed to purge FTDI RX/TX buffers (%d): %s.", ret, ftdi_get_error_string(devc->ftdic)); goto err_open_close_ftdic; } - /* Reset the FTDI bitmode. */ ret = ftdi_set_bitmode(devc->ftdic, 0xff, BITMODE_RESET); if (ret < 0) { sr_err("Failed to reset the FTDI chip bitmode (%d): %s.", @@ -107,7 +103,6 @@ SR_PRIV int p_ols_open(struct dev_context *devc) goto err_open_close_ftdic; } - /* Set the FTDI latency timer to 16. */ ret = ftdi_set_latency_timer(devc->ftdic, 16); if (ret < 0) { sr_err("Failed to set FTDI latency timer (%d): %s.", @@ -115,7 +110,6 @@ SR_PRIV int p_ols_open(struct dev_context *devc) goto err_open_close_ftdic; } - /* Set the FTDI read data chunk size to 64kB. */ ret = ftdi_read_data_set_chunksize(devc->ftdic, 64 * 1024); if (ret < 0) { sr_err("Failed to set FTDI read data chunk size (%d): %s.", diff --git a/src/hardware/pipistrello-ols/protocol.h b/src/hardware/pipistrello-ols/protocol.h index c2bd2ccb..c1aaac4b 100644 --- a/src/hardware/pipistrello-ols/protocol.h +++ b/src/hardware/pipistrello-ols/protocol.h @@ -75,19 +75,15 @@ #define FLAG_FILTER (1 << 1) #define FLAG_DEMUX (1 << 0) -/* Private, per-device-instance driver context. */ struct dev_context { - /** FTDI device context (used by libftdi). */ struct ftdi_context *ftdic; uint8_t *ftdi_buf; - /* Fixed device settings */ int max_channels; uint32_t max_samplebytes; uint32_t max_samplerate; uint32_t protocol_version; - /* Acquisition settings */ uint64_t cur_samplerate; uint32_t cur_samplerate_divider; uint32_t max_samples; @@ -101,7 +97,6 @@ struct dev_context { int num_stages; uint16_t flag_reg; - /* Operational states */ unsigned int num_transfers; unsigned int num_samples; int num_bytes; @@ -109,7 +104,6 @@ struct dev_context { unsigned int cnt_samples; int cnt_samples_rle; - /* Temporary variables */ unsigned int rle_count; unsigned char sample[4]; unsigned char tmp_sample[4]; diff --git a/src/hardware/rigol-ds/protocol.h b/src/hardware/rigol-ds/protocol.h index e7779704..3b172991 100644 --- a/src/hardware/rigol-ds/protocol.h +++ b/src/hardware/rigol-ds/protocol.h @@ -89,9 +89,7 @@ enum wait_events { WAIT_STOP, /* Wait for scope stopping (only single shots) */ }; -/** Private, per-device-instance driver context. */ struct dev_context { - /* Device model */ const struct rigol_ds_model *model; enum data_format format; @@ -127,8 +125,6 @@ struct dev_context { float trigger_level; char *coupling[MAX_ANALOG_CHANNELS]; - /* Operational state */ - /* Number of frames received in total. */ uint64_t num_frames; /* GSList entry for the current channel. */ diff --git a/src/hardware/rohde-schwarz-sme-0x/protocol.h b/src/hardware/rohde-schwarz-sme-0x/protocol.h index 7b66c814..65e5c6d1 100644 --- a/src/hardware/rohde-schwarz-sme-0x/protocol.h +++ b/src/hardware/rohde-schwarz-sme-0x/protocol.h @@ -41,9 +41,7 @@ struct rs_device_model { double power_min; }; -/** Private, per-device-instance driver context. */ struct dev_context { - /* Model-specific information */ const struct rs_device_model *model_config; }; diff --git a/src/hardware/saleae-logic-pro/protocol.h b/src/hardware/saleae-logic-pro/protocol.h index ca80f258..98444543 100644 --- a/src/hardware/saleae-logic-pro/protocol.h +++ b/src/hardware/saleae-logic-pro/protocol.h @@ -36,23 +36,18 @@ */ #define CONV_BUFFER_SIZE (2 * 8 * 16384 + CONV_BATCH_SIZE) -/** Private, per-device-instance driver context. */ struct dev_context { - /* Acquisition settings */ unsigned int dig_channel_cnt; uint16_t dig_channel_mask; uint16_t dig_channel_masks[16]; uint64_t dig_samplerate; - /* Operational state */ uint32_t lfsr; - /* Temporary state across callbacks */ unsigned int num_transfers; unsigned int submitted_transfers; struct libusb_transfer **transfers; - /* Conversion buffer */ uint8_t *conv_buffer; unsigned int conv_size; unsigned int batch_index; diff --git a/src/hardware/saleae-logic16/protocol.h b/src/hardware/saleae-logic16/protocol.h index 9eead9a9..00335816 100644 --- a/src/hardware/saleae-logic16/protocol.h +++ b/src/hardware/saleae-logic16/protocol.h @@ -41,7 +41,6 @@ enum fpga_variant { FPGA_VARIANT_MCUPRO /* mcupro clone v4.6 with Actel FPGA */ }; -/** Private, per-device-instance driver context. */ struct dev_context { /** Distinguishing between original Logic16 and clones */ enum fpga_variant fpga_variant; diff --git a/src/hardware/scpi-pps/api.c b/src/hardware/scpi-pps/api.c index 74487962..cad2a874 100644 --- a/src/hardware/scpi-pps/api.c +++ b/src/hardware/scpi-pps/api.c @@ -439,7 +439,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd return SR_ERR_ARG; if (cg) - /* Channel group specified. */ select_channel(sdi, cg->channels->data); devc = sdi->priv; @@ -523,7 +522,6 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst * devc = (sdi) ? sdi->priv : NULL; if (!cg) { - /* No channel group: global options. */ switch (key) { case SR_CONF_SCAN_OPTIONS: case SR_CONF_DEVICE_OPTIONS: @@ -555,7 +553,6 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst * return SR_ERR_NA; } } else { - /* Channel group specified. */ /* * Per-channel-group options depending on a channel are actually * done with the first channel. Channel groups in PPS can have diff --git a/src/hardware/scpi-pps/profiles.c b/src/hardware/scpi-pps/profiles.c index 75be9efd..f3c58dca 100644 --- a/src/hardware/scpi-pps/profiles.c +++ b/src/hardware/scpi-pps/profiles.c @@ -130,7 +130,6 @@ static const struct scpi_command chroma_61604_cmd[] = { }; /* Chroma 62000 series DC source */ - static const uint32_t chroma_62000_devopts[] = { SR_CONF_CONTINUOUS, }; @@ -307,7 +306,6 @@ static const struct scpi_command rigol_dp800_cmd[] = { }; /* HP 663xx series */ - static const uint32_t hp_6630a_devopts[] = { SR_CONF_CONTINUOUS, SR_CONF_ENABLED | SR_CONF_SET, @@ -572,6 +570,7 @@ SR_PRIV const struct scpi_pps pps_profiles[] = { agilent_n5700a_cmd, .probe_channels = NULL, }, + /* Agilent N5767A */ { "Agilent", "N5767A", 0, ARRAY_AND_SIZE(agilent_n5700a_devopts), @@ -581,6 +580,7 @@ SR_PRIV const struct scpi_pps pps_profiles[] = { agilent_n5700a_cmd, .probe_channels = NULL, }, + /* Chroma 61604 */ { "Chroma", "61604", 0, ARRAY_AND_SIZE(chroma_61604_devopts), @@ -590,6 +590,7 @@ SR_PRIV const struct scpi_pps pps_profiles[] = { chroma_61604_cmd, .probe_channels = NULL, }, + /* Chroma 62000 series */ { "Chroma", "620[0-9]{2}P-[0-9]{2,3}-[0-9]{1,3}", 0, ARRAY_AND_SIZE(chroma_62000_devopts), @@ -599,6 +600,7 @@ SR_PRIV const struct scpi_pps pps_profiles[] = { chroma_62000_cmd, .probe_channels = chroma_62000p_probe_channels, }, + /* HP 6633A */ { "HP", "6633A", 0, ARRAY_AND_SIZE(hp_6630a_devopts), diff --git a/src/hardware/scpi-pps/protocol.h b/src/hardware/scpi-pps/protocol.h index 80593cec..d4425e72 100644 --- a/src/hardware/scpi-pps/protocol.h +++ b/src/hardware/scpi-pps/protocol.h @@ -136,17 +136,13 @@ enum acq_states { STATE_STOP, }; -/** Private, per-device-instance driver context. */ struct dev_context { - /* Model-specific information */ const struct scpi_pps *device; - /* Operational state */ gboolean beeper_was_set; struct channel_spec *channels; struct channel_group_spec *channel_groups; - /* Temporary state across callbacks */ struct sr_channel *cur_channel; }; diff --git a/src/hardware/serial-dmm/api.c b/src/hardware/serial-dmm/api.c index 687b35b9..7fb68865 100644 --- a/src/hardware/serial-dmm/api.c +++ b/src/hardware/serial-dmm/api.c @@ -168,7 +168,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) sr_sw_limits_acquisition_start(&devc->limits); std_session_send_df_header(sdi); - /* Poll every 50ms, or whenever some data comes in. */ serial = sdi->conn; serial_source_add(sdi->session, serial, G_IO_IN, 50, receive_data, (void *)sdi); diff --git a/src/hardware/serial-dmm/protocol.h b/src/hardware/serial-dmm/protocol.h index 97493456..c80180ce 100644 --- a/src/hardware/serial-dmm/protocol.h +++ b/src/hardware/serial-dmm/protocol.h @@ -60,7 +60,6 @@ struct dmm_info { #define DMM_BUFSIZE 256 -/** Private, per-device-instance driver context. */ struct dev_context { struct sr_sw_limits limits; diff --git a/src/hardware/sysclk-lwla/api.c b/src/hardware/sysclk-lwla/api.c index 1ff70eeb..71a358b9 100644 --- a/src/hardware/sysclk-lwla/api.c +++ b/src/hardware/sysclk-lwla/api.c @@ -26,20 +26,14 @@ #include #include "protocol.h" -/* Supported device scan options. - */ static const uint32_t scanopts[] = { SR_CONF_CONN, }; -/* Driver capabilities. - */ static const uint32_t drvopts[] = { SR_CONF_LOGIC_ANALYZER, }; -/* Supported trigger match conditions. - */ static const int32_t trigger_matches[] = { SR_TRIGGER_ZERO, SR_TRIGGER_ONE, @@ -47,22 +41,16 @@ static const int32_t trigger_matches[] = { SR_TRIGGER_FALLING, }; -/* Names assigned to available trigger sources. - */ static const char *const trigger_source_names[] = { [TRIGGER_CHANNELS] = "CH", [TRIGGER_EXT_TRG] = "TRG", }; -/* Names assigned to available edge slope choices. - */ static const char *const signal_edge_names[] = { [EDGE_POSITIVE] = "r", [EDGE_NEGATIVE] = "f", }; -/* Create a new sigrok device instance for the indicated LWLA model. - */ static struct sr_dev_inst *dev_inst_new(const struct model_info *model) { struct sr_dev_inst *sdi; @@ -70,7 +58,6 @@ static struct sr_dev_inst *dev_inst_new(const struct model_info *model) int i; char name[8]; - /* Initialize private device context. */ devc = g_malloc0(sizeof(struct dev_context)); devc->model = model; devc->active_fpga_config = FPGA_NOCONF; @@ -78,16 +65,13 @@ static struct sr_dev_inst *dev_inst_new(const struct model_info *model) devc->samplerate = model->samplerates[0]; devc->channel_mask = (UINT64_C(1) << model->num_channels) - 1; - /* Create sigrok device instance. */ sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE; sdi->vendor = g_strdup(VENDOR_NAME); sdi->model = g_strdup(model->name); sdi->priv = devc; - /* Generate list of logic channels. */ for (i = 0; i < model->num_channels; i++) { - /* The LWLA series simply number channels from CH1 to CHxx. */ g_snprintf(name, sizeof(name), "CH%d", i + 1); sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, name); } @@ -148,8 +132,6 @@ static struct sr_dev_inst *dev_inst_new_matching(GSList *conn_matches, return sdi; } -/* Scan for SysClk LWLA devices and create a device instance for each one. - */ static GSList *scan(struct sr_dev_driver *di, GSList *options) { GSList *conn_devices, *devices, *node; @@ -236,8 +218,6 @@ static int drain_usb(struct sr_usb_dev_inst *usb, unsigned int endpoint) return SR_OK; } -/* Open and initialize device. - */ static int dev_open(struct sr_dev_inst *sdi) { struct drv_context *drvc; @@ -300,7 +280,6 @@ static int dev_open(struct sr_dev_inst *sdi) return ret; } -/* Shutdown and close device. */ static int dev_close(struct sr_dev_inst *sdi) { struct dev_context *devc; @@ -344,8 +323,6 @@ static int has_devopt(const struct model_info *model, uint32_t key) return FALSE; } -/* Read device configuration setting. - */ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { @@ -426,8 +403,6 @@ static int lookup_index(GVariant *value, const char *const *table, int len) return -1; } -/* Write device configuration setting. - */ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { @@ -501,8 +476,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd return SR_OK; } -/* Apply channel configuration change. - */ static int config_channel_set(const struct sr_dev_inst *sdi, struct sr_channel *ch, unsigned int changes) { @@ -532,8 +505,7 @@ static int config_channel_set(const struct sr_dev_inst *sdi, return SR_OK; } -/* Derive trigger masks from the session's trigger configuration. - */ +/* Derive trigger masks from the session's trigger configuration. */ static int prepare_trigger_masks(const struct sr_dev_inst *sdi) { uint64_t trigger_mask, trigger_values, trigger_edge_mask; @@ -598,8 +570,6 @@ static int prepare_trigger_masks(const struct sr_dev_inst *sdi) return SR_OK; } -/* Apply current device configuration to the hardware. - */ static int config_commit(const struct sr_dev_inst *sdi) { struct dev_context *devc; @@ -688,8 +658,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) return lwla_start_acquisition(sdi); } -/* Request that a running capture operation be stopped. - */ static int dev_acquisition_stop(struct sr_dev_inst *sdi) { struct dev_context *devc; @@ -704,8 +672,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) return SR_OK; } -/* SysClk LWLA driver descriptor. - */ static struct sr_dev_driver sysclk_lwla_driver_info = { .name = "sysclk-lwla", .longname = "SysClk LWLA series", diff --git a/src/hardware/sysclk-lwla/lwla.h b/src/hardware/sysclk-lwla/lwla.h index 35e33f79..bf5318d1 100644 --- a/src/hardware/sysclk-lwla/lwla.h +++ b/src/hardware/sysclk-lwla/lwla.h @@ -69,8 +69,7 @@ struct sr_usb_dev_inst; */ #define PACKET_SIZE (5000 * 4 * 5) -/** LWLA protocol command ID codes. - */ +/** LWLA protocol command ID codes. */ enum command_id { CMD_READ_REG = 1, CMD_WRITE_REG = 2, @@ -89,22 +88,19 @@ enum status_flag { STATUS_MEM_AVAIL = 1 << 6, }; -/** LWLA1034 run-length encoding states. - */ +/** LWLA1034 run-length encoding states. */ enum rle_state { RLE_STATE_DATA, RLE_STATE_LEN }; -/** Register address/value pair. - */ +/** Register address/value pair. */ struct regval { unsigned int reg; uint32_t val; }; -/** LWLA sample acquisition and decompression state. - */ +/** LWLA sample acquisition and decompression state. */ struct acquisition_state { uint64_t samples_max; /* maximum number of samples to process */ uint64_t samples_done; /* number of samples sent to the session bus */ diff --git a/src/hardware/sysclk-lwla/lwla1016.c b/src/hardware/sysclk-lwla/lwla1016.c index d16a35e7..4b412fb5 100644 --- a/src/hardware/sysclk-lwla/lwla1016.c +++ b/src/hardware/sysclk-lwla/lwla1016.c @@ -21,28 +21,22 @@ #include "lwla.h" #include "protocol.h" -/* Number of logic channels. - */ +/* Number of logic channels. */ #define NUM_CHANNELS 16 -/* Unit size for the sigrok logic datafeed. - */ +/* Unit size for the sigrok logic datafeed. */ #define UNIT_SIZE ((NUM_CHANNELS + 7) / 8) -/* Size of the acquisition buffer in device memory units. - */ +/* Size of the acquisition buffer in device memory units. */ #define MEMORY_DEPTH (256 * 1024) /* 256k x 32 bit */ -/* Capture memory read start address. - */ +/* Capture memory read start address. */ #define READ_START_ADDR 2 -/* Number of device memory units (32 bit) to read at a time. - */ +/* Number of device memory units (32 bit) to read at a time. */ #define READ_CHUNK_LEN 250 -/** LWLA1016 register addresses. - */ +/** LWLA1016 register addresses. */ enum reg_addr { REG_CHAN_MASK = 0x1000, /* bit mask of enabled channels */ @@ -64,15 +58,13 @@ enum reg_addr { REG_DIV_COUNT = 0x10BC, /* write */ }; -/** Flag bits for REG_MEM_CTRL. - */ +/** Flag bits for REG_MEM_CTRL. */ enum mem_ctrl_flag { MEM_CTRL_RESET = 1 << 0, MEM_CTRL_WRITE = 1 << 1, }; -/** Flag bits for REG_CAP_CTRL. - */ +/** Flag bits for REG_CAP_CTRL. */ enum cap_ctrl_flag { CAP_CTRL_FIFO32_FULL = 1 << 0, /* "fifo32_ful" bit */ CAP_CTRL_FIFO64_FULL = 1 << 1, /* "fifo64_ful" bit */ @@ -83,22 +75,19 @@ enum cap_ctrl_flag { CAP_CTRL_CNTR_NOT_ENDR = 1 << 6, /* "cntr_not_endr" bit */ }; -/* Available FPGA configurations. - */ +/* Available FPGA configurations. */ enum fpga_config { FPGA_100 = 0, /* 100 MS/s, no compression */ FPGA_100_TS, /* 100 MS/s, timing-state mode */ }; -/* FPGA bitstream resource filenames. - */ +/* FPGA bitstream resource filenames. */ static const char bitstream_map[][32] = { [FPGA_100] = "sysclk-lwla1016-100.rbf", [FPGA_100_TS] = "sysclk-lwla1016-100-ts.rbf", }; -/* Demangle incoming sample data from the transfer buffer. - */ +/* Demangle incoming sample data from the transfer buffer. */ static void read_response(struct acquisition_state *acq) { uint32_t *in_p, *out_p; @@ -136,8 +125,7 @@ static void read_response(struct acquisition_state *acq) acq->samples_done += run_samples; } -/* Demangle and decompress incoming sample data from the transfer buffer. - */ +/* Demangle and decompress incoming sample data from the transfer buffer. */ static void read_response_rle(struct acquisition_state *acq) { uint32_t *in_p; @@ -233,8 +221,7 @@ static int test_read_memory(const struct sr_dev_inst *sdi, return SR_OK; } -/* Select and transfer FPGA bitstream for the current configuration. - */ +/* Select and transfer FPGA bitstream for the current configuration. */ static int apply_fpga_config(const struct sr_dev_inst *sdi) { struct dev_context *devc; @@ -259,8 +246,7 @@ static int apply_fpga_config(const struct sr_dev_inst *sdi) return ret; } -/* Perform initialization self test. - */ +/* Perform initialization self test. */ static int device_init_check(const struct sr_dev_inst *sdi) { static const struct regval mem_reset[] = { @@ -443,8 +429,7 @@ static int handle_response(const struct sr_dev_inst *sdi) return SR_OK; } -/* Model descriptor for the LWLA1016. - */ +/* Model descriptor for the LWLA1016. */ SR_PRIV const struct model_info lwla1016_info = { .name = "LWLA1016", .num_channels = NUM_CHANNELS, diff --git a/src/hardware/sysclk-lwla/lwla1034.c b/src/hardware/sysclk-lwla/lwla1034.c index a4bda368..63ca46f5 100644 --- a/src/hardware/sysclk-lwla/lwla1034.c +++ b/src/hardware/sysclk-lwla/lwla1034.c @@ -21,24 +21,19 @@ #include "lwla.h" #include "protocol.h" -/* Number of logic channels. - */ +/* Number of logic channels. */ #define NUM_CHANNELS 34 -/* Bit mask covering all logic channels. - */ +/* Bit mask covering all logic channels. */ #define ALL_CHANNELS_MASK ((UINT64_C(1) << NUM_CHANNELS) - 1) -/* Unit size for the sigrok logic datafeed. - */ +/* Unit size for the sigrok logic datafeed. */ #define UNIT_SIZE ((NUM_CHANNELS + 7) / 8) -/* Size of the acquisition buffer in device memory units. - */ +/* Size of the acquisition buffer in device memory units. */ #define MEMORY_DEPTH (256 * 1024) /* 256k x 36 bit */ -/* Capture memory read start address. - */ +/* Capture memory read start address. */ #define READ_START_ADDR 4 /* Number of device memory units (36 bit) to read at a time. Slices of 8 @@ -56,8 +51,7 @@ */ #define READ_CHUNK_LEN (28 * 8) -/* Bit mask for the RLE repeat-count-follows flag. - */ +/* Bit mask for the RLE repeat-count-follows flag. */ #define RLE_FLAG_LEN_FOLLOWS (UINT64_C(1) << 35) /* Start index and count for bulk long register reads. @@ -67,8 +61,7 @@ #define READ_LREGS_START LREG_MEM_FILL #define READ_LREGS_COUNT (LREG_STATUS + 1 - READ_LREGS_START) -/** LWLA1034 register addresses. - */ +/** LWLA1034 register addresses. */ enum reg_addr { REG_MEM_CTRL = 0x1074, /* capture buffer control */ REG_MEM_FILL = 0x1078, /* capture buffer fill level */ @@ -82,15 +75,13 @@ enum reg_addr { REG_LONG_HIGH = 0x10BC, /* long register high word */ }; -/** Flag bits for REG_MEM_CTRL. - */ +/** Flag bits for REG_MEM_CTRL. */ enum mem_ctrl_flag { MEM_CTRL_WRITE = 1 << 0, /* "wr1rd0" bit */ MEM_CTRL_CLR_IDX = 1 << 1, /* "clr_idx" bit */ }; -/* LWLA1034 long register addresses. - */ +/* LWLA1034 long register addresses. */ enum long_reg_addr { LREG_CHAN_MASK = 0, /* channel enable mask */ LREG_DIV_COUNT = 1, /* clock divider max count */ @@ -107,8 +98,7 @@ enum long_reg_addr { LREG_TEST_ID = 100, /* constant test ID */ }; -/** Flag bits for LREG_CAP_CTRL. - */ +/** Flag bits for LREG_CAP_CTRL. */ enum cap_ctrl_flag { CAP_CTRL_TRG_EN = 1 << 0, /* "trg_en" bit */ CAP_CTRL_CLR_TIMEBASE = 1 << 2, /* "do_clr_timebase" bit */ @@ -117,8 +107,7 @@ enum cap_ctrl_flag { CAP_CTRL_CLR_COUNTER = 1 << 6, /* "clr_cntr0" bit */ }; -/* Available FPGA configurations. - */ +/* Available FPGA configurations. */ enum fpga_config { FPGA_OFF = 0, /* FPGA shutdown config */ FPGA_INT, /* internal clock config */ @@ -126,8 +115,7 @@ enum fpga_config { FPGA_EXTNEG, /* external clock, falling edge config */ }; -/* FPGA bitstream resource filenames. - */ +/* FPGA bitstream resource filenames. */ static const char bitstream_map[][32] = { [FPGA_OFF] = "sysclk-lwla1034-off.rbf", [FPGA_INT] = "sysclk-lwla1034-int.rbf", @@ -135,8 +123,7 @@ static const char bitstream_map[][32] = { [FPGA_EXTNEG] = "sysclk-lwla1034-extneg.rbf", }; -/* Read 64-bit long register. - */ +/* Read 64-bit long register. */ static int read_long_reg(const struct sr_usb_dev_inst *usb, uint32_t addr, uint64_t *value) { @@ -164,8 +151,7 @@ static int read_long_reg(const struct sr_usb_dev_inst *usb, return SR_OK; } -/* Queue access sequence for a long register write. - */ +/* Queue access sequence for a long register write. */ static void queue_long_regval(struct acquisition_state *acq, uint32_t addr, uint64_t value) { @@ -175,8 +161,7 @@ static void queue_long_regval(struct acquisition_state *acq, lwla_queue_regval(acq, REG_LONG_STROBE, 0); } -/* Helper to fill in the long register bulk write command. - */ +/* Helper to fill in the long register bulk write command. */ static inline void bulk_long_set(struct acquisition_state *acq, unsigned int idx, uint64_t value) { @@ -186,8 +171,7 @@ static inline void bulk_long_set(struct acquisition_state *acq, acq->xfer_buf_out[4 * idx + 6] = LWLA_WORD_3(value); } -/* Helper for dissecting the response to a long register bulk read. - */ +/* Helper for dissecting the response to a long register bulk read. */ static inline uint64_t bulk_long_get(const struct acquisition_state *acq, unsigned int idx) { @@ -317,8 +301,7 @@ static int detect_short_transfer_quirk(const struct sr_dev_inst *sdi) return SR_ERR; } -/* Select and transfer FPGA bitstream for the current configuration. - */ +/* Select and transfer FPGA bitstream for the current configuration. */ static int apply_fpga_config(const struct sr_dev_inst *sdi) { struct dev_context *devc; @@ -347,8 +330,7 @@ static int apply_fpga_config(const struct sr_dev_inst *sdi) return ret; } -/* Perform initialization self test. - */ +/* Perform initialization self test. */ static int device_init_check(const struct sr_dev_inst *sdi) { uint64_t value; @@ -369,8 +351,7 @@ static int device_init_check(const struct sr_dev_inst *sdi) return detect_short_transfer_quirk(sdi); } -/* Set up the device in preparation for an acquisition session. - */ +/* Set up the device in preparation for an acquisition session. */ static int setup_acquisition(const struct sr_dev_inst *sdi) { static const struct regval capture_init[] = { @@ -565,8 +546,7 @@ static int handle_response(const struct sr_dev_inst *sdi) return SR_OK; } -/** Model descriptor for the LWLA1034. - */ +/** Model descriptor for the LWLA1034. */ SR_PRIV const struct model_info lwla1034_info = { .name = "LWLA1034", .num_channels = NUM_CHANNELS, diff --git a/src/hardware/sysclk-lwla/protocol.c b/src/hardware/sysclk-lwla/protocol.c index 85997249..45c07952 100644 --- a/src/hardware/sysclk-lwla/protocol.c +++ b/src/hardware/sysclk-lwla/protocol.c @@ -22,8 +22,7 @@ #include "protocol.h" #include "lwla.h" -/* Submit an already filled-in USB transfer. - */ +/* Submit an already filled-in USB transfer. */ static int submit_transfer(struct dev_context *devc, struct libusb_transfer *xfer) { @@ -40,8 +39,7 @@ static int submit_transfer(struct dev_context *devc, return SR_OK; } -/* Set up transfer for the next register in a write sequence. - */ +/* Set up transfer for the next register in a write sequence. */ static void next_reg_write(struct acquisition_state *acq) { struct regval *regval; @@ -56,8 +54,7 @@ static void next_reg_write(struct acquisition_state *acq) acq->xfer_out->length = 4 * sizeof(acq->xfer_buf_out[0]); } -/* Set up transfer for the next register in a read sequence. - */ +/* Set up transfer for the next register in a read sequence. */ static void next_reg_read(struct acquisition_state *acq) { unsigned int addr; @@ -70,8 +67,7 @@ static void next_reg_read(struct acquisition_state *acq) acq->xfer_out->length = 2 * sizeof(acq->xfer_buf_out[0]); } -/* Decode the response to a register read request. - */ +/* Decode the response to a register read request. */ static int read_reg_response(struct acquisition_state *acq) { uint32_t value; @@ -87,8 +83,7 @@ static int read_reg_response(struct acquisition_state *acq) return SR_OK; } -/* Enter a new state and submit the corresponding request to the device. - */ +/* Enter a new state and submit the corresponding request to the device. */ static int submit_request(const struct sr_dev_inst *sdi, enum protocol_state state) { @@ -123,8 +118,7 @@ static int submit_request(const struct sr_dev_inst *sdi, return submit_transfer(devc, acq->xfer_out); } -/* Evaluate and act on the response to a capture status request. - */ +/* Evaluate and act on the response to a capture status request. */ static void handle_status_response(const struct sr_dev_inst *sdi) { struct dev_context *devc; @@ -160,8 +154,7 @@ static void handle_status_response(const struct sr_dev_inst *sdi) } } -/* Evaluate and act on the response to a capture length request. - */ +/* Evaluate and act on the response to a capture length request. */ static void handle_length_response(const struct sr_dev_inst *sdi) { struct dev_context *devc; @@ -191,8 +184,7 @@ static void handle_length_response(const struct sr_dev_inst *sdi) submit_request(sdi, STATE_READ_PREPARE); } -/* Evaluate and act on the response to a capture memory read request. - */ +/* Evaluate and act on the response to a capture memory read request. */ static void handle_read_response(const struct sr_dev_inst *sdi) { struct dev_context *devc; @@ -250,8 +242,7 @@ static void handle_read_response(const struct sr_dev_inst *sdi) submit_request(sdi, STATE_READ_FINISH); } -/* Destroy and unset the acquisition state record. - */ +/* Destroy and unset the acquisition state record. */ static void clear_acquisition_state(const struct sr_dev_inst *sdi) { struct dev_context *devc; @@ -269,8 +260,7 @@ static void clear_acquisition_state(const struct sr_dev_inst *sdi) } } -/* USB I/O source callback. - */ +/* USB I/O source callback. */ static int transfer_event(int fd, int revents, void *cb_data) { const struct sr_dev_inst *sdi; @@ -321,8 +311,7 @@ static int transfer_event(int fd, int revents, void *cb_data) return G_SOURCE_REMOVE; } -/* USB output transfer completion callback. - */ +/* USB output transfer completion callback. */ static void LIBUSB_CALL transfer_out_completed(struct libusb_transfer *transfer) { const struct sr_dev_inst *sdi; @@ -386,8 +375,7 @@ static void LIBUSB_CALL transfer_out_completed(struct libusb_transfer *transfer) } } -/* USB input transfer completion callback. - */ +/* USB input transfer completion callback. */ static void LIBUSB_CALL transfer_in_completed(struct libusb_transfer *transfer) { const struct sr_dev_inst *sdi; @@ -448,8 +436,7 @@ static void LIBUSB_CALL transfer_in_completed(struct libusb_transfer *transfer) } } -/* Set up the acquisition state record. - */ +/* Set up the acquisition state record. */ static int init_acquisition_state(const struct sr_dev_inst *sdi) { struct dev_context *devc; diff --git a/src/hardware/sysclk-lwla/protocol.h b/src/hardware/sysclk-lwla/protocol.h index ebfc704a..027f3f55 100644 --- a/src/hardware/sysclk-lwla/protocol.h +++ b/src/hardware/sysclk-lwla/protocol.h @@ -46,46 +46,40 @@ struct acquisition_state; -/* USB vendor and product IDs. - */ +/* USB vendor and product IDs. */ enum { USB_VID_SYSCLK = 0x2961, USB_PID_LWLA1016 = 0x6688, USB_PID_LWLA1034 = 0x6689, }; -/* USB device characteristics. - */ +/* USB device characteristics. */ enum { USB_CONFIG = 1, USB_INTERFACE = 0, USB_TIMEOUT_MS = 1000, }; -/** USB device end points. - */ +/** USB device end points. */ enum usb_endpoint { EP_COMMAND = 2, EP_CONFIG = 4, EP_REPLY = 6 | LIBUSB_ENDPOINT_IN }; -/** LWLA1034 clock sources. - */ +/** LWLA1034 clock sources. */ enum clock_source { CLOCK_INTERNAL = 0, CLOCK_EXT_CLK, }; -/** LWLA1034 trigger sources. - */ +/** LWLA1034 trigger sources. */ enum trigger_source { TRIGGER_CHANNELS = 0, TRIGGER_EXT_TRG, }; -/** Edge choices for the LWLA1034 external clock and trigger inputs. - */ +/** Edge choices for the LWLA1034 external clock and trigger inputs. */ enum signal_edge { EDGE_POSITIVE = 0, EDGE_NEGATIVE, @@ -96,8 +90,7 @@ enum { FPGA_NOCONF = -1, }; -/** Acquisition protocol states. - */ +/** Acquisition protocol states. */ enum protocol_state { /* idle states */ STATE_IDLE = 0, @@ -114,8 +107,6 @@ enum protocol_state { STATE_READ_REQUEST, }; -/** Private, per-device-instance driver context. - */ struct dev_context { uint64_t samplerate; /* requested samplerate */ uint64_t limit_msec; /* requested capture duration in ms */ @@ -142,8 +133,7 @@ struct dev_context { enum signal_edge cfg_trigger_slope; /* ext trigger slope setting */ }; -/** LWLA model descriptor. - */ +/** LWLA model descriptor. */ struct model_info { char name[12]; int num_channels; diff --git a/src/hardware/teleinfo/api.c b/src/hardware/teleinfo/api.c index 75928098..f7e52aac 100644 --- a/src/hardware/teleinfo/api.c +++ b/src/hardware/teleinfo/api.c @@ -153,7 +153,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) std_session_send_df_header(sdi); - /* Poll every 50ms, or whenever some data comes in. */ serial_source_add(sdi->session, serial, G_IO_IN, 50, teleinfo_receive_data, (void *)sdi); diff --git a/src/hardware/teleinfo/protocol.h b/src/hardware/teleinfo/protocol.h index f450547e..b617074f 100644 --- a/src/hardware/teleinfo/protocol.h +++ b/src/hardware/teleinfo/protocol.h @@ -37,15 +37,9 @@ enum optarif { #define TELEINFO_BUF_SIZE 256 -/** Private, per-device-instance driver context. */ struct dev_context { - /* Acquisition settings */ struct sr_sw_limits sw_limits; - - /* Operational state */ enum optarif optarif; /**< The device mode (which measures are reported) */ - - /* Temporary state across callbacks */ uint8_t buf[TELEINFO_BUF_SIZE]; int buf_len; }; diff --git a/src/hardware/testo/api.c b/src/hardware/testo/api.c index b208ff72..9ad81739 100644 --- a/src/hardware/testo/api.c +++ b/src/hardware/testo/api.c @@ -111,7 +111,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)); - /* Hardcode the 435 for now.*/ + /* Hardcode the 435 for now. */ if (strcmp(product, "testo 435/635/735")) continue; diff --git a/src/hardware/testo/protocol.h b/src/hardware/testo/protocol.h index 654eb697..a6def0b5 100644 --- a/src/hardware/testo/protocol.h +++ b/src/hardware/testo/protocol.h @@ -51,19 +51,13 @@ struct testo_model { const uint8_t *request; }; -/** Private, per-device-instance driver context. */ struct dev_context { - /* Model-specific information */ const struct testo_model *model; - - /* Acquisition settings */ struct sr_sw_limits sw_limits; - /* Operational state */ uint8_t channel_units[MAX_CHANNELS]; int num_channels; - /* Temporary state across callbacks */ struct libusb_transfer *out_transfer; uint8_t reply[MAX_REPLY_SIZE]; int reply_size; diff --git a/src/hardware/tondaj-sl-814/api.c b/src/hardware/tondaj-sl-814/api.c index be1ea82b..788bc884 100644 --- a/src/hardware/tondaj-sl-814/api.c +++ b/src/hardware/tondaj-sl-814/api.c @@ -121,7 +121,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) sr_sw_limits_acquisition_start(&devc->limits); - /* Poll every 500ms, or whenever some data comes in. */ serial = sdi->conn; serial_source_add(sdi->session, serial, G_IO_IN, 500, tondaj_sl_814_receive_data, (void *)sdi); diff --git a/src/hardware/tondaj-sl-814/protocol.h b/src/hardware/tondaj-sl-814/protocol.h index 8aa8ad97..b7cbd218 100644 --- a/src/hardware/tondaj-sl-814/protocol.h +++ b/src/hardware/tondaj-sl-814/protocol.h @@ -26,7 +26,6 @@ #define LOG_PREFIX "tondaj-sl-814" -/** Private, per-device-instance driver context. */ struct dev_context { struct sr_sw_limits limits; int state; diff --git a/src/hardware/uni-t-dmm/api.c b/src/hardware/uni-t-dmm/api.c index 5730633c..61936c77 100644 --- a/src/hardware/uni-t-dmm/api.c +++ b/src/hardware/uni-t-dmm/api.c @@ -137,7 +137,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) std_session_send_df_header(sdi); - sr_session_source_add(sdi->session, -1, 0, 10 /* poll_timeout */, + sr_session_source_add(sdi->session, -1, 0, 10, uni_t_dmm_receive_data, (void *)sdi); return SR_OK; diff --git a/src/hardware/uni-t-dmm/protocol.c b/src/hardware/uni-t-dmm/protocol.c index 4114aec4..11177083 100644 --- a/src/hardware/uni-t-dmm/protocol.c +++ b/src/hardware/uni-t-dmm/protocol.c @@ -103,7 +103,6 @@ static int hid_chip_init(struct sr_dev_inst *sdi, uint16_t baudrate) usb = sdi->conn; - /* Detach kernel drivers which grabbed this device (if any). */ if (libusb_kernel_driver_active(usb->devhdl, 0) == 1) { ret = libusb_detach_kernel_driver(usb->devhdl, 0); if (ret < 0) { @@ -113,7 +112,6 @@ static int hid_chip_init(struct sr_dev_inst *sdi, uint16_t baudrate) } } - /* Claim interface 0. */ if ((ret = libusb_claim_interface(usb->devhdl, 0)) < 0) { sr_err("Failed to claim interface 0: %s.", libusb_error_name(ret)); diff --git a/src/hardware/uni-t-dmm/protocol.h b/src/hardware/uni-t-dmm/protocol.h index 4158833f..4258d413 100644 --- a/src/hardware/uni-t-dmm/protocol.h +++ b/src/hardware/uni-t-dmm/protocol.h @@ -45,7 +45,6 @@ struct dmm_info { #define DMM_BUFSIZE 256 -/** Private, per-device-instance driver context. */ struct dev_context { struct sr_sw_limits limits; diff --git a/src/hardware/uni-t-ut32x/protocol.h b/src/hardware/uni-t-ut32x/protocol.h index 969ccfa6..f499dcde 100644 --- a/src/hardware/uni-t-ut32x/protocol.h +++ b/src/hardware/uni-t-ut32x/protocol.h @@ -48,18 +48,14 @@ enum { CMD_GET_STORED = 7, }; -/** Private, per-device-instance driver context. */ struct dev_context { - /* Acquisition settings */ uint64_t limit_samples; gboolean data_source; - /* Operational state */ uint64_t num_samples; unsigned char buf[8]; struct libusb_transfer *xfer; - /* Temporary state across callbacks */ unsigned char packet[32]; int packet_len; }; diff --git a/src/hardware/victor-dmm/api.c b/src/hardware/victor-dmm/api.c index d5d7e4a7..fd13421f 100644 --- a/src/hardware/victor-dmm/api.c +++ b/src/hardware/victor-dmm/api.c @@ -105,8 +105,6 @@ static int dev_open(struct sr_dev_inst *sdi) if (ret != SR_OK) return ret; - /* The device reports as HID class, so the kernel would have - * claimed it. */ if (libusb_kernel_driver_active(usb->devhdl, 0) == 1) { if ((ret = libusb_detach_kernel_driver(usb->devhdl, 0)) < 0) { sr_err("Failed to detach kernel driver: %s.", diff --git a/src/hardware/victor-dmm/protocol.h b/src/hardware/victor-dmm/protocol.h index 5c07d373..fe665e43 100644 --- a/src/hardware/victor-dmm/protocol.h +++ b/src/hardware/victor-dmm/protocol.h @@ -28,7 +28,6 @@ #define DMM_DATA_SIZE 14 -/** Private, per-device-instance driver context. */ struct dev_context { struct sr_sw_limits limits; }; diff --git a/src/hardware/yokogawa-dlm/api.c b/src/hardware/yokogawa-dlm/api.c index 650174a0..cc0cacbd 100644 --- a/src/hardware/yokogawa-dlm/api.c +++ b/src/hardware/yokogawa-dlm/api.c @@ -476,10 +476,6 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst * devc = (sdi) ? sdi->priv : NULL; model = (devc) ? devc->model_config : NULL; - /* - * If cg is NULL, only the SR_CONF_DEVICE_OPTIONS that are not - * specific to a channel group must be returned. - */ if (!cg) { switch (key) { case SR_CONF_SCAN_OPTIONS: @@ -611,7 +607,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) devc->current_channel = devc->enabled_channels; dlm_channel_data_request(sdi); - /* Call our callback when data comes in or after 5ms. */ sr_scpi_source_add(sdi->session, scpi, G_IO_IN, 5, dlm_data_receive, (void *)sdi); diff --git a/src/hardware/yokogawa-dlm/protocol.c b/src/hardware/yokogawa-dlm/protocol.c index 6955baae..ead078fa 100644 --- a/src/hardware/yokogawa-dlm/protocol.c +++ b/src/hardware/yokogawa-dlm/protocol.c @@ -18,13 +18,6 @@ * along with this program. If not, see . */ -/** - * @file - * - * Yokogawa DL/DLM series oscilloscope driver - * @internal - */ - #include #include "scpi.h" #include "protocol.h" diff --git a/src/hardware/yokogawa-dlm/protocol.h b/src/hardware/yokogawa-dlm/protocol.h index 80def3f9..ac0f4f1b 100644 --- a/src/hardware/yokogawa-dlm/protocol.h +++ b/src/hardware/yokogawa-dlm/protocol.h @@ -95,7 +95,6 @@ struct scope_state { uint32_t samples_per_frame; }; -/** Private, per-device-instance driver context. */ struct dev_context { const void *model_config; void *model_state; diff --git a/src/hardware/zeroplus-logic-cube/api.c b/src/hardware/zeroplus-logic-cube/api.c index 4ffcced8..e0124ed8 100644 --- a/src/hardware/zeroplus-logic-cube/api.c +++ b/src/hardware/zeroplus-logic-cube/api.c @@ -203,12 +203,11 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) prof = &zeroplus_models[j]; } } - /* Skip if the device was not found. */ + if (!prof) continue; sr_info("Found ZEROPLUS %s.", prof->model_name); - /* Register the device with libsigrok. */ sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE; sdi->vendor = g_strdup(VENDOR_NAME); @@ -216,7 +215,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) sdi->serial_num = g_strdup(serial_num); sdi->connection_id = g_strdup(connection_id); - /* Allocate memory for our private driver context. */ devc = g_malloc0(sizeof(struct dev_context)); sdi->priv = devc; devc->prof = prof; @@ -232,7 +230,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) devc->memory_size = MEMORY_SIZE_8K; // memset(devc->trigger_buffer, 0, NUM_TRIGGER_STAGES); - /* Fill in channellist according to this device's profile. */ for (j = 0; j < devc->num_channels; j++) sr_channel_new(sdi, j, SR_CHANNEL_LOGIC, TRUE, channel_names[j]); @@ -627,7 +624,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) return SR_OK; } -/* TODO: This stops acquisition on ALL devices, ignoring dev_index. */ static int dev_acquisition_stop(struct sr_dev_inst *sdi) { struct sr_usb_dev_inst *usb; diff --git a/src/hardware/zeroplus-logic-cube/protocol.h b/src/hardware/zeroplus-logic-cube/protocol.h index cd83f9b1..62aa0255 100644 --- a/src/hardware/zeroplus-logic-cube/protocol.h +++ b/src/hardware/zeroplus-logic-cube/protocol.h @@ -30,7 +30,6 @@ #define LOG_PREFIX "zeroplus" -/* Private, per-device-instance driver context. */ struct dev_context { uint64_t cur_samplerate; uint64_t max_samplerate; diff --git a/src/hwdriver.c b/src/hwdriver.c index 5378d74a..41f71abe 100644 --- a/src/hwdriver.c +++ b/src/hwdriver.c @@ -861,6 +861,9 @@ SR_API int sr_config_commit(const struct sr_dev_inst *sdi) * @param[in] cg The channel group on the device instance for which to list * the values, or NULL. If this device instance doesn't * have channel groups, this must not be != NULL. + * If cg is NULL, this function will return the "common" device + * instance options that are channel-group independent. Otherwise + * it will return the channel-group specific options. * @param[in] key The configuration key (SR_CONF_*). * @param[in,out] data A pointer to a GVariant where the list will be stored. * The caller is given ownership of the GVariant and must thus diff --git a/src/lcr/es51919.c b/src/lcr/es51919.c index eeb724ec..02e6dd02 100644 --- a/src/lcr/es51919.c +++ b/src/lcr/es51919.c @@ -387,15 +387,11 @@ static const char *const models[] = { "NONE", "PARALLEL", "SERIES", "AUTO", }; -/** Private, per-device-instance driver context. */ struct dev_context { - /** The number of frames. */ struct dev_limit_counter frame_count; - /** The time limit counter. */ struct dev_time_counter time_count; - /** Data buffer. */ struct dev_buffer *buf; /** The frequency of the test signal (index to frequencies[]). */ @@ -886,7 +882,6 @@ SR_PRIV int es51919_serial_acquisition_start(const struct sr_dev_inst *sdi) std_session_send_df_header(sdi); - /* Poll every 50ms, or whenever some data comes in. */ serial = sdi->conn; serial_source_add(sdi->session, serial, G_IO_IN, 50, receive_data, (void *)sdi);