aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2016-05-12 15:13:47 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2016-05-18 01:41:55 +0200
commitdd5c48a6d567a3cac62c4b0058588273bbeea171 (patch)
treed2f979e9f9cf2ec86f8b59704a9728dcac797af1
parente32862ebccac5ae063abc68d9ce13a66ad46bb97 (diff)
Put driver pointers into special section
The sigrok core needs a list of all available drivers. Currently this list is manually maintained by updating a global list whenever a driver is added or removed. Introduce a new special section that contains the list of all drivers. The SR_REGISTER_DEV_DRIVER() and SR_REGISTER_DEV_DRIVER_LIST() macro is used to add drivers to this new list. This is done by placing the pointers to the driver into a special section. Since nothing else is in this section it is known that it is simply a list of driver pointers and the core can iterate over it as if it was an array. The advantage of this approach is that the code necessary to add a driver to the list is completely contained to the driver source and it is no longer necessary to maintain a global list. If a driver is built it will automatically appear in the list, if it is not built in won't. This means that the list is always correct, whereas the previous approach used ifdefs in the global driver list file which could get out-of-sync with the actual condition when the driver was built. Any sr_dev_driver structs that are no longer used outside the driver module are marked as static. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
-rw-r--r--Makefile.am8
-rw-r--r--src/backend.c9
-rw-r--r--src/drivers.c375
-rw-r--r--src/hardware/agilent-dmm/api.c3
-rw-r--r--src/hardware/appa-55ii/api.c3
-rw-r--r--src/hardware/arachnid-labs-re-load-pro/api.c3
-rw-r--r--src/hardware/asix-sigma/api.c3
-rw-r--r--src/hardware/atten-pps3xxx/api.c3
-rw-r--r--src/hardware/baylibre-acme/api.c3
-rw-r--r--src/hardware/beaglelogic/api.c3
-rw-r--r--src/hardware/brymen-bm86x/api.c3
-rw-r--r--src/hardware/brymen-dmm/api.c3
-rw-r--r--src/hardware/cem-dt-885x/api.c3
-rw-r--r--src/hardware/center-3xx/api.c9
-rw-r--r--src/hardware/chronovu-la/api.c3
-rw-r--r--src/hardware/colead-slm/api.c3
-rw-r--r--src/hardware/conrad-digi-35-cpu/api.c3
-rw-r--r--src/hardware/demo/demo.c3
-rw-r--r--src/hardware/deree-de5000/api.c3
-rw-r--r--src/hardware/driver_list_end.c26
-rw-r--r--src/hardware/driver_list_start.c26
-rw-r--r--src/hardware/fluke-dmm/api.c3
-rw-r--r--src/hardware/ftdi-la/api.c3
-rw-r--r--src/hardware/fx2lafw/api.c3
-rw-r--r--src/hardware/gmc-mh-1x-2x/api.c6
-rw-r--r--src/hardware/gwinstek-gds-800/api.c5
-rw-r--r--src/hardware/hameg-hmo/api.c5
-rw-r--r--src/hardware/hantek-6xxx/api.c3
-rw-r--r--src/hardware/hantek-dso/api.c3
-rw-r--r--src/hardware/hp-3457a/api.c5
-rw-r--r--src/hardware/hung-chang-dso-2100/api.c3
-rw-r--r--src/hardware/ikalogic-scanalogic2/api.c3
-rw-r--r--src/hardware/ikalogic-scanaplus/api.c3
-rw-r--r--src/hardware/kecheng-kc-330b/api.c3
-rw-r--r--src/hardware/kern-scale/api.c11
-rw-r--r--src/hardware/korad-kaxxxxp/api.c3
-rw-r--r--src/hardware/lascar-el-usb/api.c1
-rw-r--r--src/hardware/lecroy-logicstudio/api.c3
-rw-r--r--src/hardware/link-mso19/api.c3
-rw-r--r--src/hardware/manson-hcs-3xxx/api.c3
-rw-r--r--src/hardware/maynuo-m97/api.c5
-rw-r--r--src/hardware/mic-985xx/api.c9
-rw-r--r--src/hardware/motech-lps-30x/api.c3
-rw-r--r--src/hardware/norma-dmm/api.c10
-rw-r--r--src/hardware/openbench-logic-sniffer/api.c1
-rw-r--r--src/hardware/pipistrello-ols/api.c1
-rw-r--r--src/hardware/rigol-ds/api.c5
-rw-r--r--src/hardware/saleae-logic16/api.c3
-rw-r--r--src/hardware/scpi-pps/api.c5
-rw-r--r--src/hardware/serial-dmm/api.c9
-rw-r--r--src/hardware/sysclk-lwla/api.c3
-rw-r--r--src/hardware/teleinfo/api.c3
-rw-r--r--src/hardware/testo/api.c3
-rw-r--r--src/hardware/tondaj-sl-814/api.c3
-rw-r--r--src/hardware/uni-t-dmm/api.c9
-rw-r--r--src/hardware/uni-t-ut32x/api.c3
-rw-r--r--src/hardware/victor-dmm/api.c3
-rw-r--r--src/hardware/yokogawa-dlm/api.c5
-rw-r--r--src/hardware/zeroplus-logic-cube/api.c3
-rw-r--r--src/libsigrok-internal.h67
60 files changed, 260 insertions, 463 deletions
diff --git a/Makefile.am b/Makefile.am
index 69080ba..16dd83a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -54,7 +54,6 @@ libsigrok_la_SOURCES = \
src/session.c \
src/session_file.c \
src/session_driver.c \
- src/drivers.c \
src/hwdriver.c \
src/trigger.c \
src/soft-trigger.c \
@@ -168,6 +167,10 @@ libsigrok_la_SOURCES += \
src/scale/kern.c
# Hardware drivers
+
+# This entry must be placed before all drivers
+libsigrok_la_SOURCES += src/hardware/driver_list_start.c
+
if HW_AGILENT_DMM
libsigrok_la_SOURCES += \
src/hardware/agilent-dmm/api.c \
@@ -500,6 +503,9 @@ libsigrok_la_SOURCES += \
src/hardware/zeroplus-logic-cube/api.c
endif
+# This entry must be placed after all drivers
+libsigrok_la_SOURCES += src/hardware/driver_list_end.c
+
libsigrok_la_LIBADD = $(SR_EXTRA_LIBS) $(LIBSIGROK_LIBS)
libsigrok_la_LDFLAGS = -version-info $(SR_LIB_VERSION) -no-undefined
diff --git a/src/backend.c b/src/backend.c
index e829912..f58ab7e 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -448,6 +448,8 @@ static int sanity_check_all_transform_modules(void)
return ret;
}
+extern struct sr_dev_driver *sr_driver_list_start;
+
/**
* Initialize libsigrok.
*
@@ -468,7 +470,7 @@ SR_API int sr_init(struct sr_context **ctx)
{
int ret = SR_ERR;
struct sr_context *context;
- struct sr_dev_driver ***lists, **drivers;
+ struct sr_dev_driver **drivers;
GArray *array;
#ifdef _WIN32
WSADATA wsadata;
@@ -485,9 +487,8 @@ SR_API int sr_init(struct sr_context **ctx)
/* Generate ctx->driver_list at runtime. */
array = g_array_new(TRUE, FALSE, sizeof(struct sr_dev_driver *));
- for (lists = drivers_lists; *lists; lists++)
- for (drivers = *lists; *drivers; drivers++)
- g_array_append_val(array, *drivers);
+ for (drivers = (&sr_driver_list_start) + 1; *drivers; drivers++)
+ g_array_append_val(array, *drivers);
context->driver_list = (struct sr_dev_driver **)array->data;
g_array_free(array, FALSE);
diff --git a/src/drivers.c b/src/drivers.c
deleted file mode 100644
index 1f55325..0000000
--- a/src/drivers.c
+++ /dev/null
@@ -1,375 +0,0 @@
-/*
- * This file is part of the libsigrok project.
- *
- * Copyright (C) 2014 Bert Vermeulen <bert@biot.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <config.h>
-#include <libsigrok/libsigrok.h>
-#include "libsigrok-internal.h"
-
-/** @cond PRIVATE */
-#ifdef HAVE_HW_AGILENT_DMM
-extern SR_PRIV struct sr_dev_driver agdmm_driver_info;
-#endif
-#ifdef HAVE_HW_APPA_55II
-extern SR_PRIV struct sr_dev_driver appa_55ii_driver_info;
-#endif
-#ifdef HAVE_HW_ARACHNID_LABS_RE_LOAD_PRO
-extern SR_PRIV struct sr_dev_driver arachnid_labs_re_load_pro_driver_info;
-#endif
-#ifdef HAVE_HW_ASIX_SIGMA
-extern SR_PRIV struct sr_dev_driver asix_sigma_driver_info;
-#endif
-#ifdef HAVE_HW_ATTEN_PPS3XXX
-extern SR_PRIV struct sr_dev_driver atten_pps3203_driver_info;
-#endif
-#ifdef HAVE_HW_BAYLIBRE_ACME
-extern SR_PRIV struct sr_dev_driver baylibre_acme_driver_info;
-#endif
-#ifdef HAVE_HW_BEAGLELOGIC
-extern SR_PRIV struct sr_dev_driver beaglelogic_driver_info;
-#endif
-#ifdef HAVE_HW_BRYMEN_BM86X
-extern SR_PRIV struct sr_dev_driver brymen_bm86x_driver_info;
-#endif
-#ifdef HAVE_HW_BRYMEN_DMM
-extern SR_PRIV struct sr_dev_driver brymen_bm857_driver_info;
-#endif
-#ifdef HAVE_HW_CEM_DT_885X
-extern SR_PRIV struct sr_dev_driver cem_dt_885x_driver_info;
-#endif
-#ifdef HAVE_HW_CENTER_3XX
-extern SR_PRIV struct sr_dev_driver center_309_driver_info;
-extern SR_PRIV struct sr_dev_driver voltcraft_k204_driver_info;
-#endif
-#ifdef HAVE_HW_CHRONOVU_LA
-extern SR_PRIV struct sr_dev_driver chronovu_la_driver_info;
-#endif
-#ifdef HAVE_HW_COLEAD_SLM
-extern SR_PRIV struct sr_dev_driver colead_slm_driver_info;
-#endif
-#ifdef HAVE_HW_CONRAD_DIGI_35_CPU
-extern SR_PRIV struct sr_dev_driver conrad_digi_35_cpu_driver_info;
-#endif
-#ifdef HAVE_HW_DEMO
-extern SR_PRIV struct sr_dev_driver demo_driver_info;
-#endif
-#ifdef HAVE_HW_DEREE_DE5000
-extern SR_PRIV struct sr_dev_driver deree_de5000_driver_info;
-#endif
-#ifdef HAVE_HW_FLUKE_DMM
-extern SR_PRIV struct sr_dev_driver flukedmm_driver_info;
-#endif
-#ifdef HAVE_HW_FTDI_LA
-extern SR_PRIV struct sr_dev_driver ftdi_la_driver_info;
-#endif
-#ifdef HAVE_HW_FX2LAFW
-extern SR_PRIV struct sr_dev_driver fx2lafw_driver_info;
-#endif
-#ifdef HAVE_HW_GMC_MH_1X_2X
-extern SR_PRIV struct sr_dev_driver gmc_mh_1x_2x_rs232_driver_info;
-extern SR_PRIV struct sr_dev_driver gmc_mh_2x_bd232_driver_info;
-#endif
-#ifdef HAVE_HW_GWINSTEK_GDS_800
-extern SR_PRIV struct sr_dev_driver gwinstek_gds_800_driver_info;
-#endif
-#ifdef HAVE_HW_HAMEG_HMO
-extern SR_PRIV struct sr_dev_driver hameg_hmo_driver_info;
-#endif
-#ifdef HAVE_HW_HANTEK_6XXX
-extern SR_PRIV struct sr_dev_driver hantek_6xxx_driver_info;
-#endif
-#ifdef HAVE_HW_HANTEK_DSO
-extern SR_PRIV struct sr_dev_driver hantek_dso_driver_info;
-#endif
-#ifdef HAVE_HW_HP_3457A
-extern SR_PRIV struct sr_dev_driver hp_3457a_driver_info;
-#endif
-#ifdef HAVE_HW_HUNG_CHANG_DSO_2100
-extern SR_PRIV struct sr_dev_driver hung_chang_dso_2100_driver_info;
-#endif
-#ifdef HAVE_HW_IKALOGIC_SCANALOGIC2
-extern SR_PRIV struct sr_dev_driver ikalogic_scanalogic2_driver_info;
-#endif
-#ifdef HAVE_HW_IKALOGIC_SCANAPLUS
-extern SR_PRIV struct sr_dev_driver ikalogic_scanaplus_driver_info;
-#endif
-#ifdef HAVE_HW_KECHENG_KC_330B
-extern SR_PRIV struct sr_dev_driver kecheng_kc_330b_driver_info;
-#endif
-#ifdef HAVE_HW_KERN_SCALE
-extern SR_PRIV struct sr_dev_driver *kern_scale_drivers[];
-#endif
-#ifdef HAVE_HW_KORAD_KAXXXXP
-extern SR_PRIV struct sr_dev_driver korad_kaxxxxp_driver_info;
-#endif
-#ifdef HAVE_HW_LASCAR_EL_USB
-extern SR_PRIV struct sr_dev_driver lascar_el_usb_driver_info;
-#endif
-#ifdef HAVE_HW_LECROY_LOGICSTUDIO
-extern SR_PRIV struct sr_dev_driver lecroy_logicstudio_driver_info;
-#endif
-#ifdef HAVE_HW_LINK_MSO19
-extern SR_PRIV struct sr_dev_driver link_mso19_driver_info;
-#endif
-#ifdef HAVE_HW_MANSON_HCS_3XXX
-extern SR_PRIV struct sr_dev_driver manson_hcs_3xxx_driver_info;
-#endif
-#ifdef HAVE_HW_MAYNUO_M97
-extern SR_PRIV struct sr_dev_driver maynuo_m97_driver_info;
-#endif
-#ifdef HAVE_HW_MIC_985XX
-extern SR_PRIV struct sr_dev_driver mic_98581_driver_info;
-extern SR_PRIV struct sr_dev_driver mic_98583_driver_info;
-#endif
-#ifdef HAVE_HW_MOTECH_LPS_30X
-extern SR_PRIV struct sr_dev_driver motech_lps_301_driver_info;
-#endif
-#ifdef HAVE_HW_NORMA_DMM
-extern SR_PRIV struct sr_dev_driver norma_dmm_driver_info;
-extern SR_PRIV struct sr_dev_driver siemens_b102x_driver_info;
-#endif
-#ifdef HAVE_HW_OPENBENCH_LOGIC_SNIFFER
-extern SR_PRIV struct sr_dev_driver ols_driver_info;
-#endif
-#ifdef HAVE_HW_PIPISTRELLO_OLS
-extern SR_PRIV struct sr_dev_driver p_ols_driver_info;
-#endif
-#ifdef HAVE_HW_RIGOL_DS
-extern SR_PRIV struct sr_dev_driver rigol_ds_driver_info;
-#endif
-#ifdef HAVE_HW_SALEAE_LOGIC16
-extern SR_PRIV struct sr_dev_driver saleae_logic16_driver_info;
-#endif
-#ifdef HAVE_HW_SCPI_PPS
-extern SR_PRIV struct sr_dev_driver scpi_pps_driver_info;
-#endif
-#ifdef HAVE_HW_SERIAL_DMM
-extern SR_PRIV struct sr_dev_driver *serial_dmm_drivers[];
-#endif
-#ifdef HAVE_HW_SYSCLK_LWLA
-extern SR_PRIV struct sr_dev_driver sysclk_lwla_driver_info;
-#endif
-#ifdef HAVE_HW_TELEINFO
-extern SR_PRIV struct sr_dev_driver teleinfo_driver_info;
-#endif
-#ifdef HAVE_HW_TESTO
-extern SR_PRIV struct sr_dev_driver testo_driver_info;
-#endif
-#ifdef HAVE_HW_TONDAJ_SL_814
-extern SR_PRIV struct sr_dev_driver tondaj_sl_814_driver_info;
-#endif
-#ifdef HAVE_HW_UNI_T_DMM
-extern SR_PRIV struct sr_dev_driver *uni_t_dmm_drivers[];
-#endif
-#ifdef HAVE_HW_UNI_T_UT32X
-extern SR_PRIV struct sr_dev_driver uni_t_ut32x_driver_info;
-#endif
-#ifdef HAVE_HW_VICTOR_DMM
-extern SR_PRIV struct sr_dev_driver victor_dmm_driver_info;
-#endif
-#ifdef HAVE_HW_YOKOGAWA_DLM
-extern SR_PRIV struct sr_dev_driver yokogawa_dlm_driver_info;
-#endif
-#ifdef HAVE_HW_ZEROPLUS_LOGIC_CUBE
-extern SR_PRIV struct sr_dev_driver zeroplus_logic_cube_driver_info;
-#endif
-
-#define DRVS struct sr_dev_driver *[]
-
-SR_PRIV struct sr_dev_driver **drivers_lists[] = {
-#ifdef HAVE_HW_AGILENT_DMM
- (DRVS) {&agdmm_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_APPA_55II
- (DRVS) {&appa_55ii_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_ARACHNID_LABS_RE_LOAD_PRO
- (DRVS) {&arachnid_labs_re_load_pro_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_ASIX_SIGMA
- (DRVS) {&asix_sigma_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_ATTEN_PPS3XXX
- (DRVS) {&atten_pps3203_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_BAYLIBRE_ACME
- (DRVS) {&baylibre_acme_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_BEAGLELOGIC
- (DRVS) {&beaglelogic_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_BRYMEN_BM86X
- (DRVS) {&brymen_bm86x_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_BRYMEN_DMM
- (DRVS) {&brymen_bm857_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_CEM_DT_885X
- (DRVS) {&cem_dt_885x_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_CENTER_3XX
- (DRVS) {
- &center_309_driver_info,
- &voltcraft_k204_driver_info,
- NULL
- },
-#endif
-#ifdef HAVE_HW_CHRONOVU_LA
- (DRVS) {&chronovu_la_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_COLEAD_SLM
- (DRVS) {&colead_slm_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_CONRAD_DIGI_35_CPU
- (DRVS) {&conrad_digi_35_cpu_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_DEMO
- (DRVS) {&demo_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_DEREE_DE5000
- (DRVS) {&deree_de5000_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_FLUKE_DMM
- (DRVS) {&flukedmm_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_FTDI_LA
- (DRVS) {&ftdi_la_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_FX2LAFW
- (DRVS) {&fx2lafw_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_GMC_MH_1X_2X
- (DRVS) {
- &gmc_mh_1x_2x_rs232_driver_info,
- &gmc_mh_2x_bd232_driver_info,
- NULL
- },
-#endif
-#ifdef HAVE_HW_GWINSTEK_GDS_800
- (DRVS) {&gwinstek_gds_800_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_HAMEG_HMO
- (DRVS) {&hameg_hmo_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_HANTEK_6XXX
- (DRVS) {&hantek_6xxx_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_HANTEK_DSO
- (DRVS) {&hantek_dso_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_HP_3457A
- (DRVS) {&hp_3457a_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_HUNG_CHANG_DSO_2100
- (DRVS) {&hung_chang_dso_2100_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_IKALOGIC_SCANALOGIC2
- (DRVS) {&ikalogic_scanalogic2_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_IKALOGIC_SCANAPLUS
- (DRVS) {&ikalogic_scanaplus_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_KECHENG_KC_330B
- (DRVS) {&kecheng_kc_330b_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_KERN_SCALE
- kern_scale_drivers,
-#endif
-#ifdef HAVE_HW_KORAD_KAXXXXP
- (DRVS) {&korad_kaxxxxp_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_LASCAR_EL_USB
- (DRVS) {&lascar_el_usb_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_LECROY_LOGICSTUDIO
- (DRVS) {&lecroy_logicstudio_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_LINK_MSO19
- (DRVS) {&link_mso19_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_MANSON_HCS_3XXX
- (DRVS) {&manson_hcs_3xxx_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_MAYNUO_M97
- (DRVS) {&maynuo_m97_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_MIC_985XX
- (DRVS) {
- &mic_98581_driver_info,
- &mic_98583_driver_info,
- NULL
- },
-#endif
-#ifdef HAVE_HW_MOTECH_LPS_30X
- (DRVS) {&motech_lps_301_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_NORMA_DMM
- (DRVS) {
- &norma_dmm_driver_info,
- &siemens_b102x_driver_info,
- NULL
- },
-#endif
-#ifdef HAVE_HW_OPENBENCH_LOGIC_SNIFFER
- (DRVS) {&ols_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_PIPISTRELLO_OLS
- (DRVS) {&p_ols_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_RIGOL_DS
- (DRVS) {&rigol_ds_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_SALEAE_LOGIC16
- (DRVS) {&saleae_logic16_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_SCPI_PPS
- (DRVS) {&scpi_pps_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_SERIAL_DMM
- serial_dmm_drivers,
-#endif
-#ifdef HAVE_HW_SYSCLK_LWLA
- (DRVS) {&sysclk_lwla_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_TELEINFO
- (DRVS) {&teleinfo_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_TESTO
- (DRVS) {&testo_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_TONDAJ_SL_814
- (DRVS) {&tondaj_sl_814_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_UNI_T_DMM
- uni_t_dmm_drivers,
-#endif
-#ifdef HAVE_HW_UNI_T_UT32X
- (DRVS) {&uni_t_ut32x_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_VICTOR_DMM
- (DRVS) {&victor_dmm_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_YOKOGAWA_DLM
- (DRVS) {&yokogawa_dlm_driver_info, NULL},
-#endif
-#ifdef HAVE_HW_ZEROPLUS_LOGIC_CUBE
- (DRVS) {&zeroplus_logic_cube_driver_info, NULL},
-#endif
- NULL,
-};
-/** @endcond */
diff --git a/src/hardware/agilent-dmm/api.c b/src/hardware/agilent-dmm/api.c
index bb7c53e..514a2d2 100644
--- a/src/hardware/agilent-dmm/api.c
+++ b/src/hardware/agilent-dmm/api.c
@@ -229,7 +229,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
sdi->conn, LOG_PREFIX);
}
-SR_PRIV struct sr_dev_driver agdmm_driver_info = {
+static struct sr_dev_driver agdmm_driver_info = {
.name = "agilent-dmm",
.longname = "Agilent U12xx series DMMs",
.api_version = 1,
@@ -247,3 +247,4 @@ SR_PRIV struct sr_dev_driver agdmm_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(agdmm_driver_info);
diff --git a/src/hardware/appa-55ii/api.c b/src/hardware/appa-55ii/api.c
index 4c297c1..d6c5d6a 100644
--- a/src/hardware/appa-55ii/api.c
+++ b/src/hardware/appa-55ii/api.c
@@ -226,7 +226,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
std_serial_dev_close, sdi->conn, LOG_PREFIX);
}
-SR_PRIV struct sr_dev_driver appa_55ii_driver_info = {
+static struct sr_dev_driver appa_55ii_driver_info = {
.name = "appa-55ii",
.longname = "APPA 55II",
.api_version = 1,
@@ -244,3 +244,4 @@ SR_PRIV struct sr_dev_driver appa_55ii_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(appa_55ii_driver_info);
diff --git a/src/hardware/arachnid-labs-re-load-pro/api.c b/src/hardware/arachnid-labs-re-load-pro/api.c
index 6683e28..aeacda1 100644
--- a/src/hardware/arachnid-labs-re-load-pro/api.c
+++ b/src/hardware/arachnid-labs-re-load-pro/api.c
@@ -358,7 +358,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
std_serial_dev_close, sdi->conn, LOG_PREFIX);
}
-SR_PRIV struct sr_dev_driver arachnid_labs_re_load_pro_driver_info = {
+static struct sr_dev_driver arachnid_labs_re_load_pro_driver_info = {
.name = "arachnid-labs-re-load-pro",
.longname = "Arachnid Labs Re:load Pro",
.api_version = 1,
@@ -375,3 +375,4 @@ SR_PRIV struct sr_dev_driver arachnid_labs_re_load_pro_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(arachnid_labs_re_load_pro_driver_info);
diff --git a/src/hardware/asix-sigma/api.c b/src/hardware/asix-sigma/api.c
index fb0c695..255d3d5 100644
--- a/src/hardware/asix-sigma/api.c
+++ b/src/hardware/asix-sigma/api.c
@@ -403,7 +403,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver asix_sigma_driver_info = {
+static struct sr_dev_driver asix_sigma_driver_info = {
.name = "asix-sigma",
.longname = "ASIX SIGMA/SIGMA2",
.api_version = 1,
@@ -421,3 +421,4 @@ SR_PRIV struct sr_dev_driver asix_sigma_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(asix_sigma_driver_info);
diff --git a/src/hardware/atten-pps3xxx/api.c b/src/hardware/atten-pps3xxx/api.c
index e0e3838..e1ec5f0 100644
--- a/src/hardware/atten-pps3xxx/api.c
+++ b/src/hardware/atten-pps3xxx/api.c
@@ -485,7 +485,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver atten_pps3203_driver_info = {
+static struct sr_dev_driver atten_pps3203_driver_info = {
.name = "atten-pps3203",
.longname = "Atten PPS3203T-3S",
.api_version = 1,
@@ -503,3 +503,4 @@ SR_PRIV struct sr_dev_driver atten_pps3203_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(atten_pps3203_driver_info);
diff --git a/src/hardware/baylibre-acme/api.c b/src/hardware/baylibre-acme/api.c
index 6665369..1d83228 100644
--- a/src/hardware/baylibre-acme/api.c
+++ b/src/hardware/baylibre-acme/api.c
@@ -386,7 +386,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver baylibre_acme_driver_info = {
+static struct sr_dev_driver baylibre_acme_driver_info = {
.name = "baylibre-acme",
.longname = "BayLibre ACME (Another Cute Measurement Equipment)",
.api_version = 1,
@@ -403,3 +403,4 @@ SR_PRIV struct sr_dev_driver baylibre_acme_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(baylibre_acme_driver_info);
diff --git a/src/hardware/beaglelogic/api.c b/src/hardware/beaglelogic/api.c
index e862d99..6deafb8 100644
--- a/src/hardware/beaglelogic/api.c
+++ b/src/hardware/beaglelogic/api.c
@@ -356,7 +356,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver beaglelogic_driver_info = {
+static struct sr_dev_driver beaglelogic_driver_info = {
.name = "beaglelogic",
.longname = "BeagleLogic",
.api_version = 1,
@@ -373,3 +373,4 @@ SR_PRIV struct sr_dev_driver beaglelogic_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(beaglelogic_driver_info);
diff --git a/src/hardware/brymen-bm86x/api.c b/src/hardware/brymen-bm86x/api.c
index 9d1600e..eb41b84 100644
--- a/src/hardware/brymen-bm86x/api.c
+++ b/src/hardware/brymen-bm86x/api.c
@@ -240,7 +240,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver brymen_bm86x_driver_info = {
+static struct sr_dev_driver brymen_bm86x_driver_info = {
.name = "brymen-bm86x",
.longname = "Brymen BM86X",
.api_version = 1,
@@ -258,3 +258,4 @@ SR_PRIV struct sr_dev_driver brymen_bm86x_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(brymen_bm86x_driver_info);
diff --git a/src/hardware/brymen-dmm/api.c b/src/hardware/brymen-dmm/api.c
index b38ba37..595ea99 100644
--- a/src/hardware/brymen-dmm/api.c
+++ b/src/hardware/brymen-dmm/api.c
@@ -189,7 +189,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
sdi->conn, LOG_PREFIX);
}
-SR_PRIV struct sr_dev_driver brymen_bm857_driver_info = {
+static struct sr_dev_driver brymen_bm857_driver_info = {
.name = "brymen-bm857",
.longname = "Brymen BM857",
.api_version = 1,
@@ -207,3 +207,4 @@ SR_PRIV struct sr_dev_driver brymen_bm857_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(brymen_bm857_driver_info);
diff --git a/src/hardware/cem-dt-885x/api.c b/src/hardware/cem-dt-885x/api.c
index 6134ba6..af3626b 100644
--- a/src/hardware/cem-dt-885x/api.c
+++ b/src/hardware/cem-dt-885x/api.c
@@ -377,7 +377,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
sdi->conn, LOG_PREFIX);
}
-SR_PRIV struct sr_dev_driver cem_dt_885x_driver_info = {
+static struct sr_dev_driver cem_dt_885x_driver_info = {
.name = "cem-dt-885x",
.longname = "CEM DT-885x",
.api_version = 1,
@@ -395,3 +395,4 @@ SR_PRIV struct sr_dev_driver cem_dt_885x_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(cem_dt_885x_driver_info);
diff --git a/src/hardware/center-3xx/api.c b/src/hardware/center-3xx/api.c
index 40e8dbd..27c8d7e 100644
--- a/src/hardware/center-3xx/api.c
+++ b/src/hardware/center-3xx/api.c
@@ -40,8 +40,8 @@ static const char *channel_names[] = {
"T1", "T2", "T3", "T4",
};
-SR_PRIV struct sr_dev_driver center_309_driver_info;
-SR_PRIV struct sr_dev_driver voltcraft_k204_driver_info;
+static struct sr_dev_driver center_309_driver_info;
+static struct sr_dev_driver voltcraft_k204_driver_info;
SR_PRIV const struct center_dev_info center_devs[] = {
{
@@ -209,7 +209,7 @@ static int dev_acquisition_start_##X(const struct sr_dev_inst *sdi \
#define DRV(ID, ID_UPPER, NAME, LONGNAME) \
HW_SCAN(ID_UPPER) \
HW_DEV_ACQUISITION_START(ID_UPPER) \
-SR_PRIV struct sr_dev_driver ID##_driver_info = { \
+static struct sr_dev_driver ID##_driver_info = { \
.name = NAME, \
.longname = LONGNAME, \
.api_version = 1, \
@@ -225,7 +225,8 @@ SR_PRIV struct sr_dev_driver ID##_driver_info = { \
.dev_acquisition_start = dev_acquisition_start_##ID_UPPER, \
.dev_acquisition_stop = dev_acquisition_stop, \
.context = NULL, \
-};
+}; \
+SR_REGISTER_DEV_DRIVER(ID##_driver_info);
DRV(center_309, CENTER_309, "center-309", "Center 309")
DRV(voltcraft_k204, VOLTCRAFT_K204, "voltcraft-k204", "Voltcraft K204")
diff --git a/src/hardware/chronovu-la/api.c b/src/hardware/chronovu-la/api.c
index 329b45b..5c58e4f 100644
--- a/src/hardware/chronovu-la/api.c
+++ b/src/hardware/chronovu-la/api.c
@@ -566,7 +566,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver chronovu_la_driver_info = {
+static struct sr_dev_driver chronovu_la_driver_info = {
.name = "chronovu-la",
.longname = "ChronoVu LA8/LA16",
.api_version = 1,
@@ -584,3 +584,4 @@ SR_PRIV struct sr_dev_driver chronovu_la_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(chronovu_la_driver_info);
diff --git a/src/hardware/colead-slm/api.c b/src/hardware/colead-slm/api.c
index f83ca1c..bbb6a95 100644
--- a/src/hardware/colead-slm/api.c
+++ b/src/hardware/colead-slm/api.c
@@ -152,7 +152,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
sdi->conn, LOG_PREFIX);
}
-SR_PRIV struct sr_dev_driver colead_slm_driver_info = {
+static struct sr_dev_driver colead_slm_driver_info = {
.name = "colead-slm",
.longname = "Colead SLM",
.api_version = 1,
@@ -170,3 +170,4 @@ SR_PRIV struct sr_dev_driver colead_slm_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(colead_slm_driver_info);
diff --git a/src/hardware/conrad-digi-35-cpu/api.c b/src/hardware/conrad-digi-35-cpu/api.c
index 20382fe..63c0e4f 100644
--- a/src/hardware/conrad-digi-35-cpu/api.c
+++ b/src/hardware/conrad-digi-35-cpu/api.c
@@ -181,7 +181,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver conrad_digi_35_cpu_driver_info = {
+static struct sr_dev_driver conrad_digi_35_cpu_driver_info = {
.name = "conrad-digi-35-cpu",
.longname = "Conrad DIGI 35 CPU",
.api_version = 1,
@@ -199,3 +199,4 @@ SR_PRIV struct sr_dev_driver conrad_digi_35_cpu_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(conrad_digi_35_cpu_driver_info);
diff --git a/src/hardware/demo/demo.c b/src/hardware/demo/demo.c
index cf520ca..9fa744b 100644
--- a/src/hardware/demo/demo.c
+++ b/src/hardware/demo/demo.c
@@ -876,7 +876,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver demo_driver_info = {
+static struct sr_dev_driver demo_driver_info = {
.name = "demo",
.longname = "Demo driver and pattern generator",
.api_version = 1,
@@ -894,3 +894,4 @@ SR_PRIV struct sr_dev_driver demo_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(demo_driver_info);
diff --git a/src/hardware/deree-de5000/api.c b/src/hardware/deree-de5000/api.c
index bbdb7b7..675b332 100644
--- a/src/hardware/deree-de5000/api.c
+++ b/src/hardware/deree-de5000/api.c
@@ -54,7 +54,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
return g_slist_append(NULL, sdi);
}
-SR_PRIV struct sr_dev_driver deree_de5000_driver_info = {
+static struct sr_dev_driver deree_de5000_driver_info = {
.name = "deree-de5000",
.longname = "DER EE DE-5000",
.api_version = 1,
@@ -72,3 +72,4 @@ SR_PRIV struct sr_dev_driver deree_de5000_driver_info = {
.dev_acquisition_stop = es51919_serial_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(deree_de5000_driver_info);
diff --git a/src/hardware/driver_list_end.c b/src/hardware/driver_list_end.c
new file mode 100644
index 0000000..31d9716
--- /dev/null
+++ b/src/hardware/driver_list_end.c
@@ -0,0 +1,26 @@
+/*
+ * This file is part of the libsigrok project.
+ *
+ * Copyright (C) 2016 Lars-Peter Clausen <lars@metafoo.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <libsigrok/libsigrok.h>
+#include "libsigrok-internal.h"
+
+/* End of the driver list */
+static struct sr_dev_driver *sr_driver_list_end
+ __attribute__((section (SR_DRIVER_LIST_SECTION), used,
+ aligned(sizeof(struct sr_dev_driver *)))) = NULL;
diff --git a/src/hardware/driver_list_start.c b/src/hardware/driver_list_start.c
new file mode 100644
index 0000000..6cdae6b
--- /dev/null
+++ b/src/hardware/driver_list_start.c
@@ -0,0 +1,26 @@
+/*
+ * This file is part of the libsigrok project.
+ *
+ * Copyright (C) 2016 Lars-Peter Clausen <lars@metafoo.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <libsigrok/libsigrok.h>
+#include "libsigrok-internal.h"
+
+/* Beginning of the driver list */
+const struct sr_dev_driver *sr_driver_list_start
+ __attribute__((section (SR_DRIVER_LIST_SECTION), used,
+ aligned(sizeof(struct sr_dev_driver *)))) = NULL;
diff --git a/src/hardware/fluke-dmm/api.c b/src/hardware/fluke-dmm/api.c
index f047241..de4efcd 100644
--- a/src/hardware/fluke-dmm/api.c
+++ b/src/hardware/fluke-dmm/api.c
@@ -264,7 +264,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
sdi->conn, LOG_PREFIX);
}
-SR_PRIV struct sr_dev_driver flukedmm_driver_info = {
+static struct sr_dev_driver flukedmm_driver_info = {
.name = "fluke-dmm",
.longname = "Fluke 18x/28x series DMMs",
.api_version = 1,
@@ -282,3 +282,4 @@ SR_PRIV struct sr_dev_driver flukedmm_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(flukedmm_driver_info);
diff --git a/src/hardware/ftdi-la/api.c b/src/hardware/ftdi-la/api.c
index ad58c50..34f79bf 100644
--- a/src/hardware/ftdi-la/api.c
+++ b/src/hardware/ftdi-la/api.c
@@ -480,7 +480,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver ftdi_la_driver_info = {
+static struct sr_dev_driver ftdi_la_driver_info = {
.name = "ftdi-la",
.longname = "FTDI LA",
.api_version = 1,
@@ -498,3 +498,4 @@ SR_PRIV struct sr_dev_driver ftdi_la_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(ftdi_la_driver_info);
diff --git a/src/hardware/fx2lafw/api.c b/src/hardware/fx2lafw/api.c
index 7429359..262f3cd 100644
--- a/src/hardware/fx2lafw/api.c
+++ b/src/hardware/fx2lafw/api.c
@@ -1037,7 +1037,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver fx2lafw_driver_info = {
+static struct sr_dev_driver fx2lafw_driver_info = {
.name = "fx2lafw",
.longname = "fx2lafw (generic driver for FX2 based LAs)",
.api_version = 1,
@@ -1055,3 +1055,4 @@ SR_PRIV struct sr_dev_driver fx2lafw_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(fx2lafw_driver_info);
diff --git a/src/hardware/gmc-mh-1x-2x/api.c b/src/hardware/gmc-mh-1x-2x/api.c
index 049907a..629a3f2 100644
--- a/src/hardware/gmc-mh-1x-2x/api.c
+++ b/src/hardware/gmc-mh-1x-2x/api.c
@@ -508,7 +508,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
sdi->conn, LOG_PREFIX);
}
-SR_PRIV struct sr_dev_driver gmc_mh_1x_2x_rs232_driver_info = {
+static struct sr_dev_driver gmc_mh_1x_2x_rs232_driver_info = {
.name = "gmc-mh-1x-2x-rs232",
.longname = "Gossen Metrawatt Metrahit 1x/2x, RS232 interface",
.api_version = 1,
@@ -526,8 +526,9 @@ SR_PRIV struct sr_dev_driver gmc_mh_1x_2x_rs232_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(gmc_mh_1x_2x_rs232_driver_info);
-SR_PRIV struct sr_dev_driver gmc_mh_2x_bd232_driver_info = {
+static struct sr_dev_driver gmc_mh_2x_bd232_driver_info = {
.name = "gmc-mh-2x-bd232",
.longname = "Gossen Metrawatt Metrahit 2x, BD232/SI232-II interface",
.api_version = 1,
@@ -545,3 +546,4 @@ SR_PRIV struct sr_dev_driver gmc_mh_2x_bd232_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(gmc_mh_2x_bd232_driver_info);
diff --git a/src/hardware/gwinstek-gds-800/api.c b/src/hardware/gwinstek-gds-800/api.c
index 45e8615..656b61e 100644
--- a/src/hardware/gwinstek-gds-800/api.c
+++ b/src/hardware/gwinstek-gds-800/api.c
@@ -31,7 +31,7 @@ static const uint32_t devopts[] = {
SR_CONF_SAMPLERATE | SR_CONF_GET,
};
-SR_PRIV struct sr_dev_driver gwinstek_gds_800_driver_info;
+static struct sr_dev_driver gwinstek_gds_800_driver_info;
static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
{
@@ -239,7 +239,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver gwinstek_gds_800_driver_info = {
+static struct sr_dev_driver gwinstek_gds_800_driver_info = {
.name = "gwinstek-gds-800",
.longname = "GW Instek GDS-800 series",
.api_version = 1,
@@ -256,3 +256,4 @@ SR_PRIV struct sr_dev_driver gwinstek_gds_800_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(gwinstek_gds_800_driver_info);
diff --git a/src/hardware/hameg-hmo/api.c b/src/hardware/hameg-hmo/api.c
index 29dbe91..4ed9527 100644
--- a/src/hardware/hameg-hmo/api.c
+++ b/src/hardware/hameg-hmo/api.c
@@ -24,7 +24,7 @@
#define SERIALCOMM "115200/8n1/flow=1"
-SR_PRIV struct sr_dev_driver hameg_hmo_driver_info;
+static struct sr_dev_driver hameg_hmo_driver_info;
static const char *manufacturers[] = {
"HAMEG",
@@ -773,7 +773,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver hameg_hmo_driver_info = {
+static struct sr_dev_driver hameg_hmo_driver_info = {
.name = "hameg-hmo",
.longname = "Hameg HMO",
.api_version = 1,
@@ -791,3 +791,4 @@ SR_PRIV struct sr_dev_driver hameg_hmo_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(hameg_hmo_driver_info);
diff --git a/src/hardware/hantek-6xxx/api.c b/src/hardware/hantek-6xxx/api.c
index 1227e7b..65b5f04 100644
--- a/src/hardware/hantek-6xxx/api.c
+++ b/src/hardware/hantek-6xxx/api.c
@@ -803,7 +803,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver hantek_6xxx_driver_info = {
+static struct sr_dev_driver hantek_6xxx_driver_info = {
.name = "hantek-6xxx",
.longname = "Hantek 6xxx",
.api_version = 1,
@@ -821,3 +821,4 @@ SR_PRIV struct sr_dev_driver hantek_6xxx_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(hantek_6xxx_driver_info);
diff --git a/src/hardware/hantek-dso/api.c b/src/hardware/hantek-dso/api.c
index f8fdc1a..275bbf9 100644
--- a/src/hardware/hantek-dso/api.c
+++ b/src/hardware/hantek-dso/api.c
@@ -994,7 +994,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver hantek_dso_driver_info = {
+static struct sr_dev_driver hantek_dso_driver_info = {
.name = "hantek-dso",
.longname = "Hantek DSO",
.api_version = 1,
@@ -1012,3 +1012,4 @@ SR_PRIV struct sr_dev_driver hantek_dso_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(hantek_dso_driver_info);
diff --git a/src/hardware/hp-3457a/api.c b/src/hardware/hp-3457a/api.c
index f9ea375..16b44a7 100644
--- a/src/hardware/hp-3457a/api.c
+++ b/src/hardware/hp-3457a/api.c
@@ -37,7 +37,7 @@ static const uint32_t devopts[] = {
SR_CONF_ADC_POWERLINE_CYCLES | SR_CONF_SET | SR_CONF_GET,
};
-SR_PRIV struct sr_dev_driver hp_3457a_driver_info;
+static struct sr_dev_driver hp_3457a_driver_info;
static int create_front_channel(struct sr_dev_inst *sdi, int chan_idx)
{
@@ -437,7 +437,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver hp_3457a_driver_info = {
+static struct sr_dev_driver hp_3457a_driver_info = {
.name = "hp-3457a",
.longname = "HP 3457A",
.api_version = 1,
@@ -454,3 +454,4 @@ SR_PRIV struct sr_dev_driver hp_3457a_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(hp_3457a_driver_info);
diff --git a/src/hardware/hung-chang-dso-2100/api.c b/src/hardware/hung-chang-dso-2100/api.c
index dc575e4..039ba38 100644
--- a/src/hardware/hung-chang-dso-2100/api.c
+++ b/src/hardware/hung-chang-dso-2100/api.c
@@ -712,7 +712,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return hung_chang_dso_2100_dev_acquisition_stop(sdi);
}
-SR_PRIV struct sr_dev_driver hung_chang_dso_2100_driver_info = {
+static struct sr_dev_driver hung_chang_dso_2100_driver_info = {
.name = "hung-chang-dso-2100",
.longname = "Hung-Chang DSO-2100",
.api_version = 1,
@@ -732,3 +732,4 @@ SR_PRIV struct sr_dev_driver hung_chang_dso_2100_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(hung_chang_dso_2100_driver_info);
diff --git a/src/hardware/ikalogic-scanalogic2/api.c b/src/hardware/ikalogic-scanalogic2/api.c
index ad98cc9..c30c605 100644
--- a/src/hardware/ikalogic-scanalogic2/api.c
+++ b/src/hardware/ikalogic-scanalogic2/api.c
@@ -456,7 +456,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver ikalogic_scanalogic2_driver_info = {
+static struct sr_dev_driver ikalogic_scanalogic2_driver_info = {
.name = "ikalogic-scanalogic2",
.longname = "IKALOGIC Scanalogic-2",
.api_version = 1,
@@ -474,3 +474,4 @@ SR_PRIV struct sr_dev_driver ikalogic_scanalogic2_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(ikalogic_scanalogic2_driver_info);
diff --git a/src/hardware/ikalogic-scanaplus/api.c b/src/hardware/ikalogic-scanaplus/api.c
index 0454762..9b4af07 100644
--- a/src/hardware/ikalogic-scanaplus/api.c
+++ b/src/hardware/ikalogic-scanaplus/api.c
@@ -376,7 +376,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver ikalogic_scanaplus_driver_info = {
+static struct sr_dev_driver ikalogic_scanaplus_driver_info = {
.name = "ikalogic-scanaplus",
.longname = "IKALOGIC ScanaPLUS",
.api_version = 1,
@@ -394,3 +394,4 @@ SR_PRIV struct sr_dev_driver ikalogic_scanaplus_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(ikalogic_scanaplus_driver_info);
diff --git a/src/hardware/kecheng-kc-330b/api.c b/src/hardware/kecheng-kc-330b/api.c
index 1cc8424..f67d253 100644
--- a/src/hardware/kecheng-kc-330b/api.c
+++ b/src/hardware/kecheng-kc-330b/api.c
@@ -501,7 +501,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver kecheng_kc_330b_driver_info = {
+static struct sr_dev_driver kecheng_kc_330b_driver_info = {
.name = "kecheng-kc-330b",
.longname = "Kecheng KC-330B",
.api_version = 1,
@@ -519,3 +519,4 @@ SR_PRIV struct sr_dev_driver kecheng_kc_330b_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(kecheng_kc_330b_driver_info);
diff --git a/src/hardware/kern-scale/api.c b/src/hardware/kern-scale/api.c
index 6ec40a6..4d1d6bb 100644
--- a/src/hardware/kern-scale/api.c
+++ b/src/hardware/kern-scale/api.c
@@ -186,7 +186,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
#define SCALE(ID, CHIPSET, VENDOR, MODEL, CONN, BAUDRATE, PACKETSIZE, \
VALID, PARSE) \
- &(struct scale_info) { \
+ &((struct scale_info) { \
{ \
.name = ID, \
.longname = VENDOR " " MODEL, \
@@ -206,7 +206,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
}, \
VENDOR, MODEL, CONN, BAUDRATE, PACKETSIZE, \
VALID, PARSE, sizeof(struct CHIPSET##_info) \
- }
+ }).di
/*
* Some scales have (user-configurable) 14-byte or 15-byte packets.
@@ -218,11 +218,10 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
* the user override them via "serialcomm".
*/
-SR_PRIV const struct scale_info *kern_scale_drivers[] = {
+SR_REGISTER_DEV_DRIVER_LIST(kern_scale_drivers,
SCALE(
"kern-ew-6200-2nm", kern,
"KERN", "EW 6200-2NM", "1200/8n2", 1200,
15 /* (or 14) */, sr_kern_packet_valid, sr_kern_parse
- ),
- NULL
-};
+ )
+);
diff --git a/src/hardware/korad-kaxxxxp/api.c b/src/hardware/korad-kaxxxxp/api.c
index 8316690..02abc7c 100644
--- a/src/hardware/korad-kaxxxxp/api.c
+++ b/src/hardware/korad-kaxxxxp/api.c
@@ -378,7 +378,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
std_serial_dev_close, sdi->conn, LOG_PREFIX);
}
-SR_PRIV struct sr_dev_driver korad_kaxxxxp_driver_info = {
+static struct sr_dev_driver korad_kaxxxxp_driver_info = {
.name = "korad-kaxxxxp",
.longname = "Korad KAxxxxP",
.api_version = 1,
@@ -395,3 +395,4 @@ SR_PRIV struct sr_dev_driver korad_kaxxxxp_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(korad_kaxxxxp_driver_info);
diff --git a/src/hardware/lascar-el-usb/api.c b/src/hardware/lascar-el-usb/api.c
index ad2d18b..1fd86b7 100644
--- a/src/hardware/lascar-el-usb/api.c
+++ b/src/hardware/lascar-el-usb/api.c
@@ -427,3 +427,4 @@ SR_PRIV struct sr_dev_driver lascar_el_usb_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(lascar_el_usb_driver_info);
diff --git a/src/hardware/lecroy-logicstudio/api.c b/src/hardware/lecroy-logicstudio/api.c
index ae73738..20ffcf2 100644
--- a/src/hardware/lecroy-logicstudio/api.c
+++ b/src/hardware/lecroy-logicstudio/api.c
@@ -498,7 +498,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return lls_stop_acquisition(sdi);
}
-SR_PRIV struct sr_dev_driver lecroy_logicstudio_driver_info = {
+static struct sr_dev_driver lecroy_logicstudio_driver_info = {
.name = "lecroy-logicstudio",
.longname = "LeCroy LogicStudio",
.api_version = 1,
@@ -516,3 +516,4 @@ SR_PRIV struct sr_dev_driver lecroy_logicstudio_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(lecroy_logicstudio_driver_info);
diff --git a/src/hardware/link-mso19/api.c b/src/hardware/link-mso19/api.c
index f2b372e..d95aaff 100644
--- a/src/hardware/link-mso19/api.c
+++ b/src/hardware/link-mso19/api.c
@@ -447,7 +447,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver link_mso19_driver_info = {
+static struct sr_dev_driver link_mso19_driver_info = {
.name = "link-mso19",
.longname = "Link Instruments MSO-19",
.api_version = 1,
@@ -465,3 +465,4 @@ SR_PRIV struct sr_dev_driver link_mso19_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(link_mso19_driver_info);
diff --git a/src/hardware/manson-hcs-3xxx/api.c b/src/hardware/manson-hcs-3xxx/api.c
index feeef96..52695b0 100644
--- a/src/hardware/manson-hcs-3xxx/api.c
+++ b/src/hardware/manson-hcs-3xxx/api.c
@@ -385,7 +385,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
std_serial_dev_close, sdi->conn, LOG_PREFIX);
}
-SR_PRIV struct sr_dev_driver manson_hcs_3xxx_driver_info = {
+static struct sr_dev_driver manson_hcs_3xxx_driver_info = {
.name = "manson-hcs-3xxx",
.longname = "Manson HCS-3xxx",
.api_version = 1,
@@ -402,3 +402,4 @@ SR_PRIV struct sr_dev_driver manson_hcs_3xxx_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(manson_hcs_3xxx_driver_info);
diff --git a/src/hardware/maynuo-m97/api.c b/src/hardware/maynuo-m97/api.c
index 7bf960d..84e90b5 100644
--- a/src/hardware/maynuo-m97/api.c
+++ b/src/hardware/maynuo-m97/api.c
@@ -109,7 +109,7 @@ static const struct maynuo_m97_model supported_models[] = {
// { 102, "M9812B" , 15, 500, 300 },
};
-SR_PRIV struct sr_dev_driver maynuo_m97_driver_info;
+static struct sr_dev_driver maynuo_m97_driver_info;
static struct sr_dev_inst *probe_device(struct sr_modbus_dev_inst *modbus)
{
@@ -465,7 +465,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver maynuo_m97_driver_info = {
+static struct sr_dev_driver maynuo_m97_driver_info = {
.name = "maynuo-m97",
.longname = "maynuo M97/M98 series",
.api_version = 1,
@@ -482,3 +482,4 @@ SR_PRIV struct sr_dev_driver maynuo_m97_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(maynuo_m97_driver_info);
diff --git a/src/hardware/mic-985xx/api.c b/src/hardware/mic-985xx/api.c
index 0e957fe..329a14b 100644
--- a/src/hardware/mic-985xx/api.c
+++ b/src/hardware/mic-985xx/api.c
@@ -41,8 +41,8 @@ static const uint32_t devopts[] = {
SR_CONF_LIMIT_MSEC | SR_CONF_SET,
};
-SR_PRIV struct sr_dev_driver mic_98581_driver_info;
-SR_PRIV struct sr_dev_driver mic_98583_driver_info;
+static struct sr_dev_driver mic_98581_driver_info;
+static struct sr_dev_driver mic_98583_driver_info;
SR_PRIV const struct mic_dev_info mic_devs[] = {
{
@@ -226,7 +226,7 @@ static int dev_acquisition_start_##X(const struct sr_dev_inst *sdi \
HW_SCAN(ID_UPPER) \
HW_CONFIG_LIST(ID_UPPER) \
HW_DEV_ACQUISITION_START(ID_UPPER) \
-SR_PRIV struct sr_dev_driver ID##_driver_info = { \
+static struct sr_dev_driver ID##_driver_info = { \
.name = NAME, \
.longname = LONGNAME, \
.api_version = 1, \
@@ -242,7 +242,8 @@ SR_PRIV struct sr_dev_driver ID##_driver_info = { \
.dev_acquisition_start = dev_acquisition_start_##ID_UPPER, \
.dev_acquisition_stop = dev_acquisition_stop, \
.context = NULL, \
-};
+}; \
+SR_REGISTER_DEV_DRIVER(ID##_driver_info)
DRV(mic_98581, MIC_98581, "mic-98581", "MIC 98581")
DRV(mic_98583, MIC_98583, "mic-98583", "MIC 98583")
diff --git a/src/hardware/motech-lps-30x/api.c b/src/hardware/motech-lps-30x/api.c
index 7194f31..1c5e387 100644
--- a/src/hardware/motech-lps-30x/api.c
+++ b/src/hardware/motech-lps-30x/api.c
@@ -798,7 +798,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
sdi->conn, LOG_PREFIX);
}
-SR_PRIV struct sr_dev_driver motech_lps_301_driver_info = {
+static struct sr_dev_driver motech_lps_301_driver_info = {
.name = "motech-lps-301",
.longname = "Motech LPS-301",
.api_version = 1,
@@ -816,3 +816,4 @@ SR_PRIV struct sr_dev_driver motech_lps_301_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(motech_lps_301_driver_info);
diff --git a/src/hardware/norma-dmm/api.c b/src/hardware/norma-dmm/api.c
index 7801114..ee1c59c 100644
--- a/src/hardware/norma-dmm/api.c
+++ b/src/hardware/norma-dmm/api.c
@@ -41,8 +41,8 @@ static const uint32_t devopts[] = {
#define SERIALCOMM "4800/8n1/dtr=1/rts=0/flow=1"
-SR_PRIV struct sr_dev_driver norma_dmm_driver_info;
-SR_PRIV struct sr_dev_driver siemens_b102x_driver_info;
+static struct sr_dev_driver norma_dmm_driver_info;
+static struct sr_dev_driver siemens_b102x_driver_info;
static const char *get_brandstr(struct sr_dev_driver *drv)
{
@@ -246,7 +246,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
sdi->conn, LOG_PREFIX);
}
-SR_PRIV struct sr_dev_driver norma_dmm_driver_info = {
+static struct sr_dev_driver norma_dmm_driver_info = {
.name = "norma-dmm",
.longname = "Norma DM9x0 DMMs",
.api_version = 1,
@@ -264,8 +264,9 @@ SR_PRIV struct sr_dev_driver norma_dmm_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(norma_dmm_driver_info);
-SR_PRIV struct sr_dev_driver siemens_b102x_driver_info = {
+static struct sr_dev_driver siemens_b102x_driver_info = {
.name = "siemens-b102x",
.longname = "Siemens B102x DMMs",
.api_version = 1,
@@ -283,3 +284,4 @@ SR_PRIV struct sr_dev_driver siemens_b102x_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(siemens_b102x_driver_info);
diff --git a/src/hardware/openbench-logic-sniffer/api.c b/src/hardware/openbench-logic-sniffer/api.c
index d8f7cc4..56161c5 100644
--- a/src/hardware/openbench-logic-sniffer/api.c
+++ b/src/hardware/openbench-logic-sniffer/api.c
@@ -588,3 +588,4 @@ SR_PRIV struct sr_dev_driver ols_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(ols_driver_info);
diff --git a/src/hardware/pipistrello-ols/api.c b/src/hardware/pipistrello-ols/api.c
index dd81558..eb81c78 100644
--- a/src/hardware/pipistrello-ols/api.c
+++ b/src/hardware/pipistrello-ols/api.c
@@ -718,3 +718,4 @@ SR_PRIV struct sr_dev_driver p_ols_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(p_ols_driver_info);
diff --git a/src/hardware/rigol-ds/api.c b/src/hardware/rigol-ds/api.c
index e743608..6668d9c 100644
--- a/src/hardware/rigol-ds/api.c
+++ b/src/hardware/rigol-ds/api.c
@@ -249,7 +249,7 @@ static const struct rigol_ds_model supported_models[] = {
{SERIES(DS1000Z), "MSO1104Z-S", {5, 1000000000}, 4, true},
};
-SR_PRIV struct sr_dev_driver rigol_ds_driver_info;
+static struct sr_dev_driver rigol_ds_driver_info;
static void clear_helper(void *priv)
{
@@ -1054,7 +1054,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver rigol_ds_driver_info = {
+static struct sr_dev_driver rigol_ds_driver_info = {
.name = "rigol-ds",
.longname = "Rigol DS",
.api_version = 1,
@@ -1072,3 +1072,4 @@ SR_PRIV struct sr_dev_driver rigol_ds_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(rigol_ds_driver_info);
diff --git a/src/hardware/saleae-logic16/api.c b/src/hardware/saleae-logic16/api.c
index 4c120b1..95c9f9e 100644
--- a/src/hardware/saleae-logic16/api.c
+++ b/src/hardware/saleae-logic16/api.c
@@ -785,7 +785,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return ret;
}
-SR_PRIV struct sr_dev_driver saleae_logic16_driver_info = {
+static struct sr_dev_driver saleae_logic16_driver_info = {
.name = "saleae-logic16",
.longname = "Saleae Logic16",
.api_version = 1,
@@ -803,3 +803,4 @@ SR_PRIV struct sr_dev_driver saleae_logic16_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(saleae_logic16_driver_info);
diff --git a/src/hardware/scpi-pps/api.c b/src/hardware/scpi-pps/api.c
index 785deab..c3e5d5d 100644
--- a/src/hardware/scpi-pps/api.c
+++ b/src/hardware/scpi-pps/api.c
@@ -23,7 +23,7 @@
#include "scpi.h"
#include "protocol.h"
-SR_PRIV struct sr_dev_driver scpi_pps_driver_info;
+static struct sr_dev_driver scpi_pps_driver_info;
static const uint32_t scanopts[] = {
SR_CONF_CONN,
@@ -622,7 +622,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver scpi_pps_driver_info = {
+static struct sr_dev_driver scpi_pps_driver_info = {
.name = "scpi-pps",
.longname = "SCPI PPS",
.api_version = 1,
@@ -640,3 +640,4 @@ SR_PRIV struct sr_dev_driver scpi_pps_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(scpi_pps_driver_info);
diff --git a/src/hardware/serial-dmm/api.c b/src/hardware/serial-dmm/api.c
index a272cca..3ccce70 100644
--- a/src/hardware/serial-dmm/api.c
+++ b/src/hardware/serial-dmm/api.c
@@ -207,7 +207,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
#define DMM(ID, CHIPSET, VENDOR, MODEL, CONN, BAUDRATE, PACKETSIZE, TIMEOUT, \
DELAY, REQUEST, VALID, PARSE, DETAILS) \
- &(struct dmm_info) { \
+ &((struct dmm_info) { \
{ \
.name = ID, \
.longname = VENDOR " " MODEL, \
@@ -227,9 +227,9 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
}, \
VENDOR, MODEL, CONN, BAUDRATE, PACKETSIZE, TIMEOUT, DELAY, \
REQUEST, VALID, PARSE, DETAILS, sizeof(struct CHIPSET##_info) \
- }
+ }).di
-SR_PRIV const struct dmm_info *serial_dmm_drivers[] = {
+SR_REGISTER_DEV_DRIVER_LIST(serial_dmm_drivers,
DMM(
"bbcgm-2010", metex14,
"BBC Goertz Metrawatt", "M2110", "1200/7n2", 1200,
@@ -564,5 +564,4 @@ SR_PRIV const struct dmm_info *serial_dmm_drivers[] = {
2400, DTM0660_PACKET_SIZE, 0, 0, NULL,
sr_dtm0660_packet_valid, sr_dtm0660_parse, NULL
),
- NULL
-};
+);
diff --git a/src/hardware/sysclk-lwla/api.c b/src/hardware/sysclk-lwla/api.c
index 99c7328..c66cbeb 100644
--- a/src/hardware/sysclk-lwla/api.c
+++ b/src/hardware/sysclk-lwla/api.c
@@ -774,7 +774,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
/* SysClk LWLA driver descriptor.
*/
-SR_PRIV struct sr_dev_driver sysclk_lwla_driver_info = {
+static struct sr_dev_driver sysclk_lwla_driver_info = {
.name = "sysclk-lwla",
.longname = "SysClk LWLA series",
.api_version = 1,
@@ -794,3 +794,4 @@ SR_PRIV struct sr_dev_driver sysclk_lwla_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(sysclk_lwla_driver_info);
diff --git a/src/hardware/teleinfo/api.c b/src/hardware/teleinfo/api.c
index c9ea8c7..f05db75 100644
--- a/src/hardware/teleinfo/api.c
+++ b/src/hardware/teleinfo/api.c
@@ -190,7 +190,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
std_serial_dev_close, sdi->conn, LOG_PREFIX);
}
-SR_PRIV struct sr_dev_driver teleinfo_driver_info = {
+static struct sr_dev_driver teleinfo_driver_info = {
.name = "teleinfo",
.longname = "Teleinfo",
.api_version = 1,
@@ -208,3 +208,4 @@ SR_PRIV struct sr_dev_driver teleinfo_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(teleinfo_driver_info);
diff --git a/src/hardware/testo/api.c b/src/hardware/testo/api.c
index a2eae04..8e60f6b 100644
--- a/src/hardware/testo/api.c
+++ b/src/hardware/testo/api.c
@@ -422,7 +422,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver testo_driver_info = {
+static struct sr_dev_driver testo_driver_info = {
.name = "testo",
.longname = "Testo",
.api_version = 1,
@@ -439,3 +439,4 @@ SR_PRIV struct sr_dev_driver testo_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(testo_driver_info);
diff --git a/src/hardware/tondaj-sl-814/api.c b/src/hardware/tondaj-sl-814/api.c
index 4caae64..f647b6a 100644
--- a/src/hardware/tondaj-sl-814/api.c
+++ b/src/hardware/tondaj-sl-814/api.c
@@ -164,7 +164,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
sdi->conn, LOG_PREFIX);
}
-SR_PRIV struct sr_dev_driver tondaj_sl_814_driver_info = {
+static struct sr_dev_driver tondaj_sl_814_driver_info = {
.name = "tondaj-sl-814",
.longname = "Tondaj SL-814",
.api_version = 1,
@@ -182,3 +182,4 @@ SR_PRIV struct sr_dev_driver tondaj_sl_814_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(tondaj_sl_814_driver_info);
diff --git a/src/hardware/uni-t-dmm/api.c b/src/hardware/uni-t-dmm/api.c
index 8f1d83c..c708d87 100644
--- a/src/hardware/uni-t-dmm/api.c
+++ b/src/hardware/uni-t-dmm/api.c
@@ -185,7 +185,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
#define DMM(ID, CHIPSET, VENDOR, MODEL, BAUDRATE, PACKETSIZE, \
VALID, PARSE, DETAILS) \
- &(struct dmm_info) { \
+ &((struct dmm_info) { \
{ \
.name = ID, \
.longname = VENDOR " " MODEL, \
@@ -205,9 +205,9 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
}, \
VENDOR, MODEL, BAUDRATE, PACKETSIZE, \
VALID, PARSE, DETAILS, sizeof(struct CHIPSET##_info) \
- }
+ }).di
-SR_PRIV const struct dmm_info *uni_t_dmm_drivers[] = {
+SR_REGISTER_DEV_DRIVER_LIST(uni_t_dmm_drivers,
DMM(
"tecpel-dmm-8061", fs9721,
"Tecpel", "DMM-8061", 2400,
@@ -377,5 +377,4 @@ SR_PRIV const struct dmm_info *uni_t_dmm_drivers[] = {
sr_es519xx_19200_11b_packet_valid, sr_es519xx_19200_11b_parse,
NULL
),
- NULL
-};
+);
diff --git a/src/hardware/uni-t-ut32x/api.c b/src/hardware/uni-t-ut32x/api.c
index aed53aa..789b72d 100644
--- a/src/hardware/uni-t-ut32x/api.c
+++ b/src/hardware/uni-t-ut32x/api.c
@@ -300,7 +300,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver uni_t_ut32x_driver_info = {
+static struct sr_dev_driver uni_t_ut32x_driver_info = {
.name = "uni-t-ut32x",
.longname = "UNI-T UT32x",
.api_version = 1,
@@ -318,3 +318,4 @@ SR_PRIV struct sr_dev_driver uni_t_ut32x_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(uni_t_ut32x_driver_info);
diff --git a/src/hardware/victor-dmm/api.c b/src/hardware/victor-dmm/api.c
index a53d8c5..6a70b14 100644
--- a/src/hardware/victor-dmm/api.c
+++ b/src/hardware/victor-dmm/api.c
@@ -335,7 +335,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver victor_dmm_driver_info = {
+static struct sr_dev_driver victor_dmm_driver_info = {
.name = "victor-dmm",
.longname = "Victor DMMs",
.api_version = 1,
@@ -353,3 +353,4 @@ SR_PRIV struct sr_dev_driver victor_dmm_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(victor_dmm_driver_info);
diff --git a/src/hardware/yokogawa-dlm/api.c b/src/hardware/yokogawa-dlm/api.c
index 1d69a79..103bb03 100644
--- a/src/hardware/yokogawa-dlm/api.c
+++ b/src/hardware/yokogawa-dlm/api.c
@@ -23,7 +23,7 @@
#include "scpi.h"
#include "protocol.h"
-SR_PRIV struct sr_dev_driver yokogawa_dlm_driver_info;
+static struct sr_dev_driver yokogawa_dlm_driver_info;
static const char *MANUFACTURER_ID = "YOKOGAWA";
static const char *MANUFACTURER_NAME = "Yokogawa";
@@ -676,7 +676,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver yokogawa_dlm_driver_info = {
+static struct sr_dev_driver yokogawa_dlm_driver_info = {
.name = "yokogawa-dlm",
.longname = "Yokogawa DL/DLM",
.api_version = 1,
@@ -695,3 +695,4 @@ SR_PRIV struct sr_dev_driver yokogawa_dlm_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(yokogawa_dlm_driver_info);
diff --git a/src/hardware/zeroplus-logic-cube/api.c b/src/hardware/zeroplus-logic-cube/api.c
index dd00149..2cbb5f6 100644
--- a/src/hardware/zeroplus-logic-cube/api.c
+++ b/src/hardware/zeroplus-logic-cube/api.c
@@ -655,7 +655,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
return SR_OK;
}
-SR_PRIV struct sr_dev_driver zeroplus_logic_cube_driver_info = {
+static struct sr_dev_driver zeroplus_logic_cube_driver_info = {
.name = "zeroplus-logic-cube",
.longname = "ZEROPLUS Logic Cube LAP-C series",
.api_version = 1,
@@ -673,3 +673,4 @@ SR_PRIV struct sr_dev_driver zeroplus_logic_cube_driver_info = {
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(zeroplus_logic_cube_driver_info);
diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h
index 588d090..68f0a29 100644
--- a/src/libsigrok-internal.h
+++ b/src/libsigrok-internal.h
@@ -267,6 +267,71 @@ struct zip_stat;
#define ALL_ZERO { 0 }
#endif
+#ifdef __APPLE__
+#define SR_DRIVER_LIST_SECTION "__DATA,__sr_driver_list"
+#else
+#define SR_DRIVER_LIST_SECTION "sr_driver_list"
+#endif
+
+/**
+ * Register a list of hardware drivers.
+ *
+ * This macro can be used to register multiple hardware drivers to the library.
+ * This is useful when a driver supports multiple similar but slightly
+ * different devices that require different sr_dev_driver struct definitions.
+ *
+ * For registering only a single driver see SR_REGISTER_DEV_DRIVER().
+ *
+ * Example:
+ * @code{c}
+ * #define MY_DRIVER(_name) \
+ * &(struct sr_dev_driver){ \
+ * .name = _name, \
+ * ...
+ * };
+ *
+ * SR_REGISTER_DEV_DRIVER_LIST(my_driver_infos,
+ * MY_DRIVER("driver 1"),
+ * MY_DRIVER("driver 2"),
+ * ...
+ * );
+ * @endcode
+ *
+ * @param name Name to use for the driver list identifier.
+ * @param ... Comma separated list of pointers to sr_dev_driver structs.
+ */
+#define SR_REGISTER_DEV_DRIVER_LIST(name, ...) \
+ static const struct sr_dev_driver *name[] \
+ __attribute__((section (SR_DRIVER_LIST_SECTION), used, \
+ aligned(sizeof(struct sr_dev_driver *)))) \
+ = { \
+ __VA_ARGS__ \
+ };
+
+/**
+ * Register a hardware driver.
+ *
+ * This macro is used to register a hardware driver with the library. It has
+ * to be used in order to make the driver accessible to applications using the
+ * library.
+ *
+ * The macro invocation should be placed directly under the struct
+ * sr_dev_driver definition.
+ *
+ * Example:
+ * @code{c}
+ * static struct sr_dev_driver driver_info = {
+ * .name = "driver",
+ * ....
+ * };
+ * SR_REGISTER_DEV_DRIVER(driver_info);
+ * @endcode
+ *
+ * @param name Identifier name of sr_dev_driver struct to register.
+ */
+#define SR_REGISTER_DEV_DRIVER(name) \
+ SR_REGISTER_DEV_DRIVER_LIST(name##_list, &name);
+
struct sr_context {
struct sr_dev_driver **driver_list;
#ifdef HAVE_LIBUSB_1_0
@@ -760,8 +825,6 @@ SR_PRIV void sr_usbtmc_dev_inst_free(struct sr_usbtmc_dev_inst *usbtmc);
/*--- hwdriver.c ------------------------------------------------------------*/
-extern SR_PRIV struct sr_dev_driver **drivers_lists[];
-
SR_PRIV const GVariantType *sr_variant_type_get(int datatype);
SR_PRIV int sr_variant_type_check(uint32_t key, GVariant *data);
SR_PRIV void sr_hw_cleanup_all(const struct sr_context *ctx);