From 4b25cbffa17c9b8c9c30f98ffe6918a15b664b2a Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Wed, 19 Jul 2017 22:21:17 +0200 Subject: [PATCH] drivers: Drop some unnecessary prefixes. --- src/hardware/asix-sigma/protocol.c | 4 +- .../dreamsourcelab-dslogic/protocol.c | 11 ++- src/hardware/fx2lafw/api.c | 2 +- src/hardware/hameg-hmo/protocol.c | 82 +++++++++---------- src/hardware/yokogawa-dlm/api.c | 16 ++-- src/hardware/yokogawa-dlm/protocol.c | 26 +++--- 6 files changed, 69 insertions(+), 72 deletions(-) diff --git a/src/hardware/asix-sigma/protocol.c b/src/hardware/asix-sigma/protocol.c index dd4efd0d..41c6dc87 100644 --- a/src/hardware/asix-sigma/protocol.c +++ b/src/hardware/asix-sigma/protocol.c @@ -47,7 +47,7 @@ SR_PRIV const uint64_t samplerates[] = { SR_PRIV const size_t samplerates_count = ARRAY_SIZE(samplerates); -static const char sigma_firmware_files[][24] = { +static const char firmware_files[][24] = { /* 50 MHz, supports 8 bit fractions */ "asix-sigma-50.fw", /* 100 MHz */ @@ -439,7 +439,7 @@ static int upload_firmware(struct sr_context *ctx, const char *firmware; /* Avoid downloading the same firmware multiple times. */ - firmware = sigma_firmware_files[firmware_idx]; + firmware = firmware_files[firmware_idx]; if (devc->cur_firmware == firmware_idx) { sr_info("Not uploading firmware file '%s' again.", firmware); return SR_OK; diff --git a/src/hardware/dreamsourcelab-dslogic/protocol.c b/src/hardware/dreamsourcelab-dslogic/protocol.c index 77d1e0ef..efb626dc 100644 --- a/src/hardware/dreamsourcelab-dslogic/protocol.c +++ b/src/hardware/dreamsourcelab-dslogic/protocol.c @@ -98,7 +98,7 @@ struct cmd_start_acquisition { uint8_t sample_delay_l; }; -struct dslogic_fpga_config { +struct fpga_config { uint32_t sync; uint16_t mode_header; @@ -337,8 +337,7 @@ static uint16_t enabled_channel_mask(const struct sr_dev_inst *sdi) * Get the session trigger and configure the FPGA structure * accordingly. */ -static void set_trigger(const struct sr_dev_inst *sdi, - struct dslogic_fpga_config *cfg) +static void set_trigger(const struct sr_dev_inst *sdi, struct fpga_config *cfg) { struct sr_trigger *trigger; struct sr_trigger_stage *stage; @@ -443,7 +442,7 @@ static int fpga_configure(const struct sr_dev_inst *sdi) struct dev_context *devc; struct sr_usb_dev_inst *usb; uint8_t c[3]; - struct dslogic_fpga_config cfg; + struct fpga_config cfg; uint16_t v16; uint32_t v32; int transferred, len, ret; @@ -464,7 +463,7 @@ static int fpga_configure(const struct sr_dev_inst *sdi) WL32(&cfg.end_sync, DS_CFG_END); /* Pass in the length of a fixed-size struct. Really. */ - len = sizeof(struct dslogic_fpga_config) / 2; + len = sizeof(struct fpga_config) / 2; c[0] = len & 0xff; c[1] = (len >> 8) & 0xff; c[2] = (len >> 16) & 0xff; @@ -517,7 +516,7 @@ static int fpga_configure(const struct sr_dev_inst *sdi) set_trigger(sdi, &cfg); - len = sizeof(struct dslogic_fpga_config); + len = sizeof(struct fpga_config); ret = libusb_bulk_transfer(usb->devhdl, 2 | LIBUSB_ENDPOINT_OUT, (unsigned char *)&cfg, len, &transferred, USB_TIMEOUT); if (ret < 0 || transferred != len) { diff --git a/src/hardware/fx2lafw/api.c b/src/hardware/fx2lafw/api.c index 9e5b2424..078b9c5c 100644 --- a/src/hardware/fx2lafw/api.c +++ b/src/hardware/fx2lafw/api.c @@ -435,7 +435,7 @@ static int dev_close(struct sr_dev_inst *sdi) if (!usb->devhdl) return SR_ERR_BUG; - sr_info("fx2lafw: Closing device on %d.%d (logical) / %s (physical) interface %d.", + sr_info("Closing device on %d.%d (logical) / %s (physical) interface %d.", usb->bus, usb->address, sdi->connection_id, USB_INTERFACE); libusb_release_interface(usb->devhdl, USB_INTERFACE); libusb_close(usb->devhdl); diff --git a/src/hardware/hameg-hmo/protocol.c b/src/hardware/hameg-hmo/protocol.c index 12e79c47..437b5f37 100644 --- a/src/hardware/hameg-hmo/protocol.c +++ b/src/hardware/hameg-hmo/protocol.c @@ -57,7 +57,7 @@ static const char *hameg_scpi_dialect[] = { [SCPI_CMD_GET_PROBE_UNIT] = ":PROB%d:SET:ATT:UNIT?", }; -static const uint32_t hmo_devopts[] = { +static const uint32_t devopts[] = { SR_CONF_OSCILLOSCOPE, SR_CONF_LIMIT_FRAMES | SR_CONF_GET | SR_CONF_SET, SR_CONF_SAMPLERATE | SR_CONF_GET, @@ -68,13 +68,13 @@ static const uint32_t hmo_devopts[] = { SR_CONF_TRIGGER_SLOPE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, }; -static const uint32_t hmo_analog_devopts[] = { +static const uint32_t analog_devopts[] = { SR_CONF_NUM_VDIV | SR_CONF_GET, SR_CONF_VDIV | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, SR_CONF_COUPLING | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, }; -static const char *hmo_coupling_options[] = { +static const char *coupling_options[] = { "AC", // AC with 50 Ohm termination (152x, 202x, 30xx, 1202) "ACL", // AC with 1 MOhm termination "DC", // DC with 50 Ohm termination @@ -90,7 +90,7 @@ static const char *scope_trigger_slopes[] = { NULL, }; -static const char *hmo_compact2_trigger_sources[] = { +static const char *compact2_trigger_sources[] = { "CH1", "CH2", "LINE", @@ -109,7 +109,7 @@ static const char *hmo_compact2_trigger_sources[] = { NULL, }; -static const char *hmo_compact4_trigger_sources[] = { +static const char *compact4_trigger_sources[] = { "CH1", "CH2", "CH3", @@ -130,7 +130,7 @@ static const char *hmo_compact4_trigger_sources[] = { NULL, }; -static const char *hmo_compact4_dig16_trigger_sources[] = { +static const char *compact4_dig16_trigger_sources[] = { "CH1", "CH2", "CH3", @@ -159,7 +159,7 @@ static const char *hmo_compact4_dig16_trigger_sources[] = { NULL, }; -static const uint64_t hmo_timebases[][2] = { +static const uint64_t timebases[][2] = { /* nanoseconds */ { 2, 1000000000 }, { 5, 1000000000 }, @@ -198,7 +198,7 @@ static const uint64_t hmo_timebases[][2] = { { 50, 1 }, }; -static const uint64_t hmo_vdivs[][2] = { +static const uint64_t vdivs[][2] = { /* millivolts */ { 1, 1000 }, { 2, 1000 }, @@ -256,21 +256,21 @@ static const struct scope_config scope_models[] = { .analog_names = &scope_analog_channel_names, .digital_names = &scope_digital_channel_names, - .devopts = &hmo_devopts, - .num_devopts = ARRAY_SIZE(hmo_devopts), + .devopts = &devopts, + .num_devopts = ARRAY_SIZE(devopts), - .analog_devopts = &hmo_analog_devopts, - .num_analog_devopts = ARRAY_SIZE(hmo_analog_devopts), + .analog_devopts = &analog_devopts, + .num_analog_devopts = ARRAY_SIZE(analog_devopts), - .coupling_options = &hmo_coupling_options, - .trigger_sources = &hmo_compact2_trigger_sources, + .coupling_options = &coupling_options, + .trigger_sources = &compact2_trigger_sources, .trigger_slopes = &scope_trigger_slopes, - .timebases = &hmo_timebases, - .num_timebases = ARRAY_SIZE(hmo_timebases), + .timebases = &timebases, + .num_timebases = ARRAY_SIZE(timebases), - .vdivs = &hmo_vdivs, - .num_vdivs = ARRAY_SIZE(hmo_vdivs), + .vdivs = &vdivs, + .num_vdivs = ARRAY_SIZE(vdivs), .num_xdivs = 12, .num_ydivs = 8, @@ -286,21 +286,21 @@ static const struct scope_config scope_models[] = { .analog_names = &scope_analog_channel_names, .digital_names = &scope_digital_channel_names, - .devopts = &hmo_devopts, - .num_devopts = ARRAY_SIZE(hmo_devopts), + .devopts = &devopts, + .num_devopts = ARRAY_SIZE(devopts), - .analog_devopts = &hmo_analog_devopts, - .num_analog_devopts = ARRAY_SIZE(hmo_analog_devopts), + .analog_devopts = &analog_devopts, + .num_analog_devopts = ARRAY_SIZE(analog_devopts), - .coupling_options = &hmo_coupling_options, - .trigger_sources = &hmo_compact4_trigger_sources, + .coupling_options = &coupling_options, + .trigger_sources = &compact4_trigger_sources, .trigger_slopes = &scope_trigger_slopes, - .timebases = &hmo_timebases, - .num_timebases = ARRAY_SIZE(hmo_timebases), + .timebases = &timebases, + .num_timebases = ARRAY_SIZE(timebases), - .vdivs = &hmo_vdivs, - .num_vdivs = ARRAY_SIZE(hmo_vdivs), + .vdivs = &vdivs, + .num_vdivs = ARRAY_SIZE(vdivs), .num_xdivs = 12, .num_ydivs = 8, @@ -316,21 +316,21 @@ static const struct scope_config scope_models[] = { .analog_names = &scope_analog_channel_names, .digital_names = &scope_digital_channel_names, - .devopts = &hmo_devopts, - .num_devopts = ARRAY_SIZE(hmo_devopts), + .devopts = &devopts, + .num_devopts = ARRAY_SIZE(devopts), - .analog_devopts = &hmo_analog_devopts, - .num_analog_devopts = ARRAY_SIZE(hmo_analog_devopts), + .analog_devopts = &analog_devopts, + .num_analog_devopts = ARRAY_SIZE(analog_devopts), - .coupling_options = &hmo_coupling_options, - .trigger_sources = &hmo_compact4_dig16_trigger_sources, + .coupling_options = &coupling_options, + .trigger_sources = &compact4_dig16_trigger_sources, .trigger_slopes = &scope_trigger_slopes, - .timebases = &hmo_timebases, - .num_timebases = ARRAY_SIZE(hmo_timebases), + .timebases = &timebases, + .num_timebases = ARRAY_SIZE(timebases), - .vdivs = &hmo_vdivs, - .num_vdivs = ARRAY_SIZE(hmo_vdivs), + .vdivs = &vdivs, + .num_vdivs = ARRAY_SIZE(vdivs), .num_xdivs = 12, .num_ydivs = 8, @@ -462,8 +462,7 @@ static int analog_channel_state_get(struct sr_scpi_dev_inst *scpi, if (sr_scpi_get_string(scpi, command, &tmp_str) != SR_OK) return SR_ERR; - if (array_float_get(tmp_str, hmo_vdivs, ARRAY_SIZE(hmo_vdivs), - &j) != SR_OK) { + if (array_float_get(tmp_str, vdivs, ARRAY_SIZE(vdivs), &j) != SR_OK) { g_free(tmp_str); sr_err("Could not determine array index for vertical div scale."); return SR_ERR; @@ -628,8 +627,7 @@ SR_PRIV int hmo_scope_state_get(struct sr_dev_inst *sdi) &tmp_str) != SR_OK) return SR_ERR; - if (array_float_get(tmp_str, hmo_timebases, ARRAY_SIZE(hmo_timebases), - &i) != SR_OK) { + if (array_float_get(tmp_str, timebases, ARRAY_SIZE(timebases), &i) != SR_OK) { g_free(tmp_str); sr_err("Could not determine array index for time base."); return SR_ERR; diff --git a/src/hardware/yokogawa-dlm/api.c b/src/hardware/yokogawa-dlm/api.c index cc0cacbd..e1702956 100644 --- a/src/hardware/yokogawa-dlm/api.c +++ b/src/hardware/yokogawa-dlm/api.c @@ -28,16 +28,16 @@ static struct sr_dev_driver yokogawa_dlm_driver_info; static const char *MANUFACTURER_ID = "YOKOGAWA"; static const char *MANUFACTURER_NAME = "Yokogawa"; -static const uint32_t dlm_scanopts[] = { +static const uint32_t scanopts[] = { SR_CONF_CONN, }; -static const uint32_t dlm_drvopts[] = { +static const uint32_t drvopts[] = { SR_CONF_LOGIC_ANALYZER, SR_CONF_OSCILLOSCOPE, }; -static const uint32_t dlm_devopts[] = { +static const uint32_t devopts[] = { SR_CONF_LIMIT_FRAMES | SR_CONF_GET | SR_CONF_SET, SR_CONF_SAMPLERATE | SR_CONF_GET, SR_CONF_TIMEBASE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, @@ -47,13 +47,13 @@ static const uint32_t dlm_devopts[] = { SR_CONF_TRIGGER_SLOPE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, }; -static const uint32_t dlm_analog_devopts[] = { +static const uint32_t analog_devopts[] = { SR_CONF_NUM_VDIV | SR_CONF_GET, SR_CONF_VDIV | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, SR_CONF_COUPLING | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, }; -static const uint32_t dlm_digital_devopts[] = { +static const uint32_t digital_devopts[] = { }; enum { @@ -480,7 +480,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst * switch (key) { case SR_CONF_SCAN_OPTIONS: case SR_CONF_DEVICE_OPTIONS: - return STD_CONFIG_LIST(key, data, sdi, cg, dlm_scanopts, dlm_drvopts, dlm_devopts); + return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts); case SR_CONF_TIMEBASE: *data = build_tuples(&dlm_timebases, ARRAY_SIZE(dlm_timebases)); return SR_OK; @@ -509,10 +509,10 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst * case SR_CONF_DEVICE_OPTIONS: if (cg_type == CG_ANALOG) { *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, - dlm_analog_devopts, ARRAY_SIZE(dlm_analog_devopts), sizeof(uint32_t)); + analog_devopts, ARRAY_SIZE(analog_devopts), sizeof(uint32_t)); } else if (cg_type == CG_DIGITAL) { *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, - dlm_digital_devopts, ARRAY_SIZE(dlm_digital_devopts), sizeof(uint32_t)); + digital_devopts, ARRAY_SIZE(digital_devopts), sizeof(uint32_t)); } else { *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, NULL, 0, sizeof(uint32_t)); diff --git a/src/hardware/yokogawa-dlm/protocol.c b/src/hardware/yokogawa-dlm/protocol.c index ead078fa..0dff00d6 100644 --- a/src/hardware/yokogawa-dlm/protocol.c +++ b/src/hardware/yokogawa-dlm/protocol.c @@ -22,7 +22,7 @@ #include "scpi.h" #include "protocol.h" -static const char *dlm_coupling_options[] = { +static const char *coupling_options[] = { "AC", "DC", "DC50", @@ -30,7 +30,7 @@ static const char *dlm_coupling_options[] = { NULL, }; -static const char *dlm_2ch_trigger_sources[] = { +static const char *trigger_sources_2ch[] = { "1", "2", "LINE", @@ -39,7 +39,7 @@ static const char *dlm_2ch_trigger_sources[] = { }; /* TODO: Is BITx handled correctly or is Dx required? */ -static const char *dlm_4ch_trigger_sources[] = { +static const char *trigger_sources_4ch[] = { "1", "2", "3", @@ -193,8 +193,8 @@ static const struct scope_config scope_models[] = { .analog_names = &scope_analog_channel_names, .digital_names = &scope_digital_channel_names_8, - .coupling_options = &dlm_coupling_options, - .trigger_sources = &dlm_2ch_trigger_sources, + .coupling_options = &coupling_options, + .trigger_sources = &trigger_sources_2ch, .num_xdivs = 10, .num_ydivs = 8, @@ -209,8 +209,8 @@ static const struct scope_config scope_models[] = { .analog_names = &scope_analog_channel_names, .digital_names = &scope_digital_channel_names_8, - .coupling_options = &dlm_coupling_options, - .trigger_sources = &dlm_4ch_trigger_sources, + .coupling_options = &coupling_options, + .trigger_sources = &trigger_sources_4ch, .num_xdivs = 10, .num_ydivs = 8, @@ -227,8 +227,8 @@ static const struct scope_config scope_models[] = { .analog_names = &scope_analog_channel_names, .digital_names = NULL, - .coupling_options = &dlm_coupling_options, - .trigger_sources = &dlm_4ch_trigger_sources, + .coupling_options = &coupling_options, + .trigger_sources = &trigger_sources_4ch, .num_xdivs = 10, .num_ydivs = 8, @@ -243,8 +243,8 @@ static const struct scope_config scope_models[] = { .analog_names = &scope_analog_channel_names, .digital_names = &scope_digital_channel_names_32, - .coupling_options = &dlm_coupling_options, - .trigger_sources = &dlm_4ch_trigger_sources, + .coupling_options = &coupling_options, + .trigger_sources = &trigger_sources_4ch, .num_xdivs = 10, .num_ydivs = 8, @@ -259,8 +259,8 @@ static const struct scope_config scope_models[] = { .analog_names = &scope_analog_channel_names, .digital_names = &scope_digital_channel_names_32, - .coupling_options = &dlm_coupling_options, - .trigger_sources = &dlm_4ch_trigger_sources, + .coupling_options = &coupling_options, + .trigger_sources = &trigger_sources_4ch, .num_xdivs = 10, .num_ydivs = 8,