src/session.c \
src/session_file.c \
src/session_driver.c \
- src/drivers.c \
src/hwdriver.c \
src/trigger.c \
src/soft-trigger.c \
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 \
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
return ret;
}
+extern struct sr_dev_driver *sr_driver_list_start;
+
/**
* Initialize libsigrok.
*
{
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;
/* 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);
+++ /dev/null
-/*
- * 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) {
- ¢er_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 */
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(agdmm_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(appa_55ii_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(arachnid_labs_re_load_pro_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(asix_sigma_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(atten_pps3203_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(baylibre_acme_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(beaglelogic_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(brymen_bm86x_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(brymen_bm857_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(cem_dt_885x_driver_info);
"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[] = {
{
#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, \
.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")
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(chronovu_la_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(colead_slm_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(conrad_digi_35_cpu_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(demo_driver_info);
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,
.dev_acquisition_stop = es51919_serial_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(deree_de5000_driver_info);
--- /dev/null
+/*
+ * 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;
--- /dev/null
+/*
+ * 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;
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(flukedmm_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(ftdi_la_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(fx2lafw_driver_info);
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,
.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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(gmc_mh_2x_bd232_driver_info);
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)
{
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(gwinstek_gds_800_driver_info);
#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",
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(hameg_hmo_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(hantek_6xxx_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(hantek_dso_driver_info);
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)
{
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(hp_3457a_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(hung_chang_dso_2100_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(ikalogic_scanalogic2_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(ikalogic_scanaplus_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(kecheng_kc_330b_driver_info);
#define SCALE(ID, CHIPSET, VENDOR, MODEL, CONN, BAUDRATE, PACKETSIZE, \
VALID, PARSE) \
- &(struct scale_info) { \
+ &((struct scale_info) { \
{ \
.name = ID, \
.longname = VENDOR " " MODEL, \
}, \
VENDOR, MODEL, CONN, BAUDRATE, PACKETSIZE, \
VALID, PARSE, sizeof(struct CHIPSET##_info) \
- }
+ }).di
/*
* Some scales have (user-configurable) 14-byte or 15-byte packets.
* 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
-};
+ )
+);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(korad_kaxxxxp_driver_info);
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(lascar_el_usb_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(lecroy_logicstudio_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(link_mso19_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(manson_hcs_3xxx_driver_info);
// { 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)
{
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(maynuo_m97_driver_info);
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[] = {
{
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, \
.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")
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(motech_lps_301_driver_info);
#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)
{
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,
.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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(siemens_b102x_driver_info);
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(ols_driver_info);
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(p_ols_driver_info);
{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)
{
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(rigol_ds_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(saleae_logic16_driver_info);
#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,
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(scpi_pps_driver_info);
#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, \
}, \
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,
2400, DTM0660_PACKET_SIZE, 0, 0, NULL,
sr_dtm0660_packet_valid, sr_dtm0660_parse, NULL
),
- NULL
-};
+);
/* 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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(sysclk_lwla_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(teleinfo_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(testo_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(tondaj_sl_814_driver_info);
#define DMM(ID, CHIPSET, VENDOR, MODEL, BAUDRATE, PACKETSIZE, \
VALID, PARSE, DETAILS) \
- &(struct dmm_info) { \
+ &((struct dmm_info) { \
{ \
.name = ID, \
.longname = VENDOR " " MODEL, \
}, \
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,
sr_es519xx_19200_11b_packet_valid, sr_es519xx_19200_11b_parse,
NULL
),
- NULL
-};
+);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(uni_t_ut32x_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(victor_dmm_driver_info);
#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";
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(yokogawa_dlm_driver_info);
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,
.dev_acquisition_stop = dev_acquisition_stop,
.context = NULL,
};
+SR_REGISTER_DEV_DRIVER(zeroplus_logic_cube_driver_info);
#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
/*--- 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);