From: Frank Stettner Date: Thu, 11 Apr 2019 11:03:11 +0000 (+0200) Subject: scpi: Add enum scpi_transport_layer. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=87aa1e63e367475b8ea49a05427117c836dd2372;p=libsigrok.git scpi: Add enum scpi_transport_layer. --- diff --git a/src/scpi.h b/src/scpi.h index 162c7a36..5d0459ff 100644 --- a/src/scpi.h +++ b/src/scpi.h @@ -65,6 +65,16 @@ enum { SCPI_CMD_GET_DIG_CHAN_NAME, }; +enum scpi_transport_layer { + SCPI_TRANSPORT_LIBGPIB, + SCPI_TRANSPORT_SERIAL, + SCPI_TRANSPORT_RAW_TCP, + SCPI_TRANSPORT_RIGOL_TCP, + SCPI_TRANSPORT_USBTMC, + SCPI_TRANSPORT_VISA, + SCPI_TRANSPORT_VXI, +}; + struct scpi_command { int command; const char *string; @@ -80,6 +90,7 @@ struct sr_scpi_hw_info { struct sr_scpi_dev_inst { const char *name; const char *prefix; + enum scpi_transport_layer transport; int priv_size; GSList *(*scan)(struct drv_context *drvc); int (*dev_inst_new)(void *priv, struct drv_context *drvc, diff --git a/src/scpi/scpi_libgpib.c b/src/scpi/scpi_libgpib.c index 4519a4e7..26fcadac 100644 --- a/src/scpi/scpi_libgpib.c +++ b/src/scpi/scpi_libgpib.c @@ -184,6 +184,7 @@ SR_PRIV int sr_scpi_gpib_spoll(struct sr_scpi_dev_inst *scpi, char *buf) SR_PRIV const struct sr_scpi_dev_inst scpi_libgpib_dev = { .name = "GPIB", .prefix = "libgpib", + .transport = SCPI_TRANSPORT_LIBGPIB, .priv_size = sizeof(struct scpi_gpib), .dev_inst_new = scpi_gpib_dev_inst_new, .open = scpi_gpib_open, diff --git a/src/scpi/scpi_serial.c b/src/scpi/scpi_serial.c index 25541674..96fb70d6 100644 --- a/src/scpi/scpi_serial.c +++ b/src/scpi/scpi_serial.c @@ -199,6 +199,7 @@ static void scpi_serial_free(void *priv) SR_PRIV const struct sr_scpi_dev_inst scpi_serial_dev = { .name = "serial", .prefix = "", + .transport = SCPI_TRANSPORT_SERIAL, .priv_size = sizeof(struct scpi_serial), .scan = scpi_serial_scan, .dev_inst_new = scpi_serial_dev_inst_new, diff --git a/src/scpi/scpi_tcp.c b/src/scpi/scpi_tcp.c index 6477c064..29e7a439 100644 --- a/src/scpi/scpi_tcp.c +++ b/src/scpi/scpi_tcp.c @@ -274,6 +274,7 @@ static void scpi_tcp_free(void *priv) SR_PRIV const struct sr_scpi_dev_inst scpi_tcp_raw_dev = { .name = "RAW TCP", .prefix = "tcp-raw", + .transport = SCPI_TRANSPORT_RAW_TCP, .priv_size = sizeof(struct scpi_tcp), .dev_inst_new = scpi_tcp_dev_inst_new, .open = scpi_tcp_open, @@ -292,6 +293,7 @@ SR_PRIV const struct sr_scpi_dev_inst scpi_tcp_raw_dev = { SR_PRIV const struct sr_scpi_dev_inst scpi_tcp_rigol_dev = { .name = "RIGOL TCP", .prefix = "tcp-rigol", + .transport = SCPI_TRANSPORT_RIGOL_TCP, .priv_size = sizeof(struct scpi_tcp), .dev_inst_new = scpi_tcp_dev_inst_new, .open = scpi_tcp_open, diff --git a/src/scpi/scpi_usbtmc_libusb.c b/src/scpi/scpi_usbtmc_libusb.c index 6b033444..d09b35ff 100644 --- a/src/scpi/scpi_usbtmc_libusb.c +++ b/src/scpi/scpi_usbtmc_libusb.c @@ -670,6 +670,7 @@ static void scpi_usbtmc_libusb_free(void *priv) SR_PRIV const struct sr_scpi_dev_inst scpi_usbtmc_libusb_dev = { .name = "USBTMC", .prefix = "usbtmc", + .transport = SCPI_TRANSPORT_USBTMC, .priv_size = sizeof(struct scpi_usbtmc_libusb), .scan = scpi_usbtmc_libusb_scan, .dev_inst_new = scpi_usbtmc_libusb_dev_inst_new, diff --git a/src/scpi/scpi_visa.c b/src/scpi/scpi_visa.c index a05b58d0..c4f5553a 100644 --- a/src/scpi/scpi_visa.c +++ b/src/scpi/scpi_visa.c @@ -166,6 +166,7 @@ static void scpi_visa_free(void *priv) SR_PRIV const struct sr_scpi_dev_inst scpi_visa_dev = { .name = "VISA", .prefix = "visa", + .transport = SCPI_TRANSPORT_VISA, .priv_size = sizeof(struct scpi_visa), .dev_inst_new = scpi_visa_dev_inst_new, .open = scpi_visa_open, diff --git a/src/scpi/scpi_vxi.c b/src/scpi/scpi_vxi.c index 234219c6..774b8b52 100644 --- a/src/scpi/scpi_vxi.c +++ b/src/scpi/scpi_vxi.c @@ -231,6 +231,7 @@ static void scpi_vxi_free(void *priv) SR_PRIV const struct sr_scpi_dev_inst scpi_vxi_dev = { .name = "VXI", .prefix = "vxi", + .transport = SCPI_TRANSPORT_VXI, .priv_size = sizeof(struct scpi_vxi), .dev_inst_new = scpi_vxi_dev_inst_new, .open = scpi_vxi_open,