static const struct sr_samplerates samplerates = {
SR_HZ(100),
SR_MHZ(200),
- SR_HZ(1),
- //SR_HZ(100),
- //SR_HZ(200),
- //SR_HZ(500),
- //SR_KHZ(1),
- //SR_KHZ(2),
- //SR_KHZ(5),
- //SR_KHZ(10),
- //SR_KHZ(20),
- //SR_KHZ(50),
- //SR_KHZ(100),
- //SR_KHZ(200),
- //SR_KHZ(500),
- //SR_MHZ(1),
- //SR_MHZ(2),
- //SR_MHZ(5),
- //SR_MHZ(10),
- //SR_MHZ(20),
- //SR_MHZ(50),
- //SR_MHZ(100),
- //SR_MHZ(200),
+ SR_HZ(100),
NULL,
};
static int hw_init(struct sr_context *sr_ctx)
{
- printf("Init driver\n");
-
struct drv_context *drvc;
if (!(drvc = g_try_malloc0(sizeof(struct drv_context)))) {
static GSList *hw_scan(GSList *options)
{
- //struct sr_hwopt *opt;
- //struct sr_probe *probe;
- //GPollFD probefd;
- //int ret, i;
- //char buf[8];
- //struct udev *udev;
int i;
(void)options;
GSList *devices = NULL;
-
- sr_info("Checking for link mso19\n");
const char* conn = NULL;
const char* serialcomm = NULL;
char path[32];
snprintf(path, sizeof(path), "/dev/%s", sysname);
+ conn = path;
size_t s = strcspn(iProduct, " ");
char product[32];
sdi->probes = g_slist_append(sdi->probes, probe);
}
-
- printf("Add the context\n");
//Add the driver
struct drv_context *drvc = di->priv;
drvc->instances = g_slist_append(drvc->instances, sdi);
devices = g_slist_append(devices, sdi);
}
-
- printf("Return devices\n");
+
return devices;
}
static GSList *hw_dev_list(void)
{
- printf("Dev list\n");
struct drv_context *drvc;
drvc = di->priv;
static int hw_dev_open(struct sr_dev_inst *sdi)
{
- printf("Dev opewn\n");
struct dev_context *devc;
devc = sdi->priv;
static int hw_cleanup(void)
{
- printf("*Dev clearup\n");
GSList *l;
struct sr_dev_inst *sdi;
struct drv_context *drvc;
{
struct dev_context *devc;
- printf("Get info\n");
-
switch (info_id) {
case SR_DI_HWCAPS:
*data = hwcaps;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR;
- //TODO if (ols_configure_probes(sdi) != SR_OK) {
- //TODO sr_err("Failed to configure probes.");
- //TODO return SR_ERR;
- //TODO }
+ if (mso_configure_probes(sdi) != SR_OK) {
+ sr_err("Failed to configure probes.");
+ return SR_ERR;
+ }
/*
* Enable/disable channel groups in the flag register according to the
/* TODO: This stops acquisition on ALL devices, ignoring dev_index. */
static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
- printf("Accuqstion stop\n");
/* Avoid compiler warnings. */
(void)cb_data;
int ret;
sr_dbg("Requesting trigger state.");
+ printf("Send Controll message\n");
ret = mso_send_control_message(serial, ARRAY_AND_SIZE(ops));
if (info == NULL || ret != SR_OK)
return ret;
+ printf("REad buffer\n");
uint8_t buf = 0;
if (serial_read(serial, &buf, 1) != 1) /* FIXME: Need timeout */
ret = SR_ERR;
uint8_t in[1024];
size_t s = serial_read(devc->serial, in, sizeof(in));
+
if (s <= 0)
return FALSE;
- /* No samples */
+ /* Check if we triggered, then send a command that we are ready
+ * to read the data */
if (devc->trigger_state != MSO_TRIGGER_DATAREADY) {
devc->trigger_state = in[0];
+ printf("Got %c for trigger \n", in[0]);
if (devc->trigger_state == MSO_TRIGGER_DATAREADY) {
+ printf("Trigger is ready %c\n", MSO_TRIGGER_DATAREADY);
mso_read_buffer(sdi);
devc->buffer_n = 0;
} else {
mso_check_trigger(devc->serial, NULL);
}
- return FALSE;
+ return TRUE;
}
/* the hardware always dumps 1024 samples, 24bits each */
devc->buffer_n += s;
}
if (devc->buffer_n < 3072)
- return FALSE;
+ return TRUE;
+ printf("Got samples, write out the data\n");
/* do the conversion */
uint8_t logic_out[1024];
double analog_out[1024];
logic.length = 1024;
logic.unitsize = 1;
logic.data = logic_out;
+ printf("Send Data\n");
sr_session_send(cb_data, &packet);
// Dont bother fixing this yet, keep it "old style"
sr_session_send(ctx->session_dev_id, &packet);
*/
- packet.type = SR_DF_END;
- sr_session_send(devc->session_dev_id, &packet);
+ //printf("Send END\n");
+ //packet.type = SR_DF_END;
+ //sr_session_send(devc->session_dev_id, &packet);
+ // serial_flush(devc->serial);
+ // abort_acquisition(sdi);
+ // serial_close(devc->serial);
+
+ return FALSE;
+ printf("REturn \n");
return TRUE;
}
+
+SR_PRIV int mso_configure_probes(const struct sr_dev_inst *sdi)
+{
+
+ struct dev_context *devc;
+ struct sr_probe *probe;
+ GSList *l;
+ int probe_bit, stage, i;
+ char *tc;
+
+ /*
+ devc = sdi->priv;
+ for (i = 0; i < NUM_TRIGGER_STAGES; i++) {
+ devc->la_trigger_mask[i] = 0;
+ devc->la_trigger[i] = 0;
+ }
+
+ stage = -1;
+ for (l = sdi->probes; l; l = l->next) {
+ probe = (struct sr_probe *)l->data;
+ if (probe->enabled == FALSE)
+ continue;
+
+ //if (probe->index > 7)
+ // devc->sample_wide = TRUE;
+
+ probe_bit = 1 << (probe->index);
+ if (!(probe->trigger))
+ continue;
+
+ //Configure trigger mask and value.
+ stage = 0;
+ for (tc = probe->trigger; *tc; tc++) {
+ devc->trigger_mask[stage] |= probe_bit;
+ if (*tc == '1')
+ devc->trigger_value[stage] |= probe_bit;
+ stage++;
+ if (stage > NUM_TRIGGER_STAGES)
+ return SR_ERR;
+ }
+ }
+
+ */
+
+ //if (stage == -1)
+ // /*
+ // * We didn't configure any triggers, make sure acquisition
+ // * doesn't wait for any.
+ // */
+ // devc->trigger_stage = TRIGGER_FIRED;
+ //else
+ // devc->trigger_stage = 0;
+
+ return SR_OK;
+
+
+}
+
+
+