From: lelazary Date: Tue, 8 Jan 2013 16:27:52 +0000 (-0800) Subject: mso-19: Initial analog probe support (unfinished). X-Git-Tag: dsupstream~259 X-Git-Url: https://sigrok.org/gitweb/?a=commitdiff_plain;h=365f04d61f54908013021be83450d38fff67964f;hp=5952553f569f82b878717b9d97053690014604c9;p=libsigrok.git mso-19: Initial analog probe support (unfinished). - Added the analog probe (unfinished). - Reset trigger to state to 0 before capture, just incase the scope is in the middle of a capture. --- diff --git a/hardware/link-mso19/api.c b/hardware/link-mso19/api.c index 93302655..94ef39fd 100644 --- a/hardware/link-mso19/api.c +++ b/hardware/link-mso19/api.c @@ -22,6 +22,7 @@ #include "protocol.h" static const int hwcaps[] = { + SR_CONF_OSCILLOSCOPE, SR_CONF_LOGIC_ANALYZER, SR_CONF_SAMPLERATE, SR_CONF_TRIGGER_SLOPE, @@ -38,7 +39,8 @@ static const int hwcaps[] = { * See also: http://www.linkinstruments.com/images/mso19_1113.gif */ SR_PRIV const char *mso19_probe_names[NUM_PROBES + 1] = { - "0", "1", "2", "3", "4", "5", "6", "7", NULL + /* Note: DSO needs to be first. */ + "DSO", "0", "1", "2", "3", "4", "5", "6", "7", NULL, }; static const struct sr_samplerates samplerates = { @@ -65,6 +67,7 @@ static GSList *hw_scan(GSList *options) GSList *l; struct sr_config *src; struct udev *udev; + int ptype; (void)options; @@ -183,7 +186,8 @@ static GSList *hw_scan(GSList *options) for (i = 0; i < NUM_PROBES; i++) { struct sr_probe *probe; - if (!(probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE, + ptype = (i == 0) ? SR_PROBE_ANALOG : SR_PROBE_LOGIC; + if (!(probe = sr_probe_new(i, ptype, TRUE, mso19_probe_names[i]))) return 0; sdi->probes = g_slist_append(sdi->probes, probe); @@ -443,9 +447,15 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, if (ret != SR_OK) return ret; + /* Reset trigger state. */ + devc->trigger_state = 0x00; + /* Send header packet to the session bus. */ std_session_send_df_header(cb_data, DRIVER_LOG_DOMAIN); + /* Our first probe is analog, the other 8 are of type 'logic'. */ + /* TODO. */ + sr_source_add(devc->serial->fd, G_IO_IN, -1, mso_receive_data, cb_data); return SR_OK; diff --git a/hardware/link-mso19/protocol.c b/hardware/link-mso19/protocol.c index d41a9e72..ab77a5a1 100644 --- a/hardware/link-mso19/protocol.c +++ b/hardware/link-mso19/protocol.c @@ -333,7 +333,7 @@ SR_PRIV int mso_configure_rate(const struct sr_dev_inst *sdi, uint32_t rate) return ret; } -SR_PRIV int mso_check_trigger(struct sr_serial_dev_inst *serial, uint8_t * info) +SR_PRIV int mso_check_trigger(struct sr_serial_dev_inst *serial, uint8_t *info) { uint16_t ops[] = { mso_trans(REG_TRIGGER, 0) }; int ret; @@ -346,7 +346,8 @@ SR_PRIV int mso_check_trigger(struct sr_serial_dev_inst *serial, uint8_t * info) uint8_t buf = 0; if (serial_read(serial, &buf, 1) != 1) /* FIXME: Need timeout */ ret = SR_ERR; - *info = buf; + if (!info) + *info = buf; sr_dbg("Trigger state is: 0x%x.", *info); return ret; diff --git a/hardware/link-mso19/protocol.h b/hardware/link-mso19/protocol.h index 687e5a09..bf9488dd 100644 --- a/hardware/link-mso19/protocol.h +++ b/hardware/link-mso19/protocol.h @@ -41,7 +41,7 @@ #define USB_VENDOR "3195" #define USB_PRODUCT "f190" -#define NUM_PROBES 8 +#define NUM_PROBES (1 + 8) #define NUM_TRIGGER_STAGES 4 #define TRIGGER_TYPE "01" //the first r/f is used for the whole group #define SERIALCOMM "460800/8n1/flow=2"