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>
This commit is contained in:
Lars-Peter Clausen 2016-05-12 15:13:47 +02:00 committed by Uwe Hermann
parent e32862ebcc
commit dd5c48a6d5
60 changed files with 260 additions and 463 deletions

View File

@ -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

View File

@ -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);

View File

@ -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 */

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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")

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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
};
)
);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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")

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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
};
);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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
};
);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);