consistent debug msgs, rename sump to ols

This commit is contained in:
Bert Vermeulen 2010-12-29 00:02:30 +01:00
parent ee5f5e81ad
commit e6ac9ac808
2 changed files with 12 additions and 15 deletions

View File

@ -241,7 +241,7 @@ static int hw_init(char *deviceinfo)
* we do all the sending first, then wait for all of them to * we do all the sending first, then wait for all of them to
* respond with g_poll(). * respond with g_poll().
*/ */
g_message("probing %s...", (char *)l->data); g_message("ols: probing %s...", (char *)l->data);
fd = serial_open(l->data, O_RDWR | O_NONBLOCK); fd = serial_open(l->data, O_RDWR | O_NONBLOCK);
if (fd != -1) { if (fd != -1) {
serial_params[devcnt] = serial_backup_params(fd); serial_params[devcnt] = serial_backup_params(fd);
@ -287,7 +287,7 @@ static int hw_init(char *deviceinfo)
else else
sdi = sigrok_device_instance_new sdi = sigrok_device_instance_new
(final_devcnt, ST_INACTIVE, (final_devcnt, ST_INACTIVE,
"Sump", "Logic Analyzer", "Openbench", "Logic Sniffer",
"v1.0"); "v1.0");
sdi->serial = serial_device_instance_new sdi->serial = serial_device_instance_new
(device_names[i], -1); (device_names[i], -1);
@ -425,7 +425,7 @@ static int set_configuration_samplerate(struct sigrok_device_instance *sdi,
divider = (CLOCK_RATE / samplerate) - 1; divider = (CLOCK_RATE / samplerate) - 1;
} }
g_message("setting samplerate to %" PRIu64 " Hz (divider %u, demux %s)", g_message("ols: setting samplerate to %" PRIu64 " Hz (divider %u, demux %s)",
samplerate, divider, flag_reg & FLAG_DEMUX ? "on" : "off"); samplerate, divider, flag_reg & FLAG_DEMUX ? "on" : "off");
if (send_longcommand(sdi->serial->fd, CMD_SET_DIVIDER, reverse32(divider)) != SIGROK_OK) if (send_longcommand(sdi->serial->fd, CMD_SET_DIVIDER, reverse32(divider)) != SIGROK_OK)
@ -458,6 +458,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
case HWCAP_LIMIT_SAMPLES: case HWCAP_LIMIT_SAMPLES:
tmp_u64 = value; tmp_u64 = value;
limit_samples = *tmp_u64; limit_samples = *tmp_u64;
g_message("ols: sample limit %" PRIu64, limit_samples);
ret = SIGROK_OK; ret = SIGROK_OK;
break; break;
case HWCAP_CAPTURE_RATIO: case HWCAP_CAPTURE_RATIO:
@ -514,9 +515,9 @@ static int receive_data(int fd, int revents, void *user_data)
return FALSE; return FALSE;
sample[num_bytes++] = byte; sample[num_bytes++] = byte;
g_debug("received byte 0x%.2x", byte); g_debug("ols: received byte 0x%.2x", byte);
if (num_bytes == num_channels) { if (num_bytes == num_channels) {
g_debug("received sample 0x%.*x", num_bytes * 2, (int) *sample); g_debug("ols: received sample 0x%.*x", num_bytes * 2, (int) *sample);
/* Got a full sample. */ /* Got a full sample. */
if (flag_reg & FLAG_RLE) { if (flag_reg & FLAG_RLE) {
/* /*
@ -573,7 +574,7 @@ static int receive_data(int fd, int revents, void *user_data)
} }
} }
memcpy(sample, tmp_sample, 4); memcpy(sample, tmp_sample, 4);
g_debug("full sample 0x%.8x", (int) *sample); g_debug("ols: full sample 0x%.8x", (int) *sample);
} }
/* the OLS sends its sample buffer backwards. /* the OLS sends its sample buffer backwards.
@ -659,7 +660,6 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
if (trigger_mask[0]) { if (trigger_mask[0]) {
delaycount = readcount * (1 - capture_ratio / 100.0); delaycount = readcount * (1 - capture_ratio / 100.0);
trigger_at = (readcount - delaycount) * 4 - num_stages; trigger_at = (readcount - delaycount) * 4 - num_stages;
g_message("ta %d", trigger_at);
if (send_longcommand(sdi->serial->fd, CMD_SET_TRIGGER_MASK_0, if (send_longcommand(sdi->serial->fd, CMD_SET_TRIGGER_MASK_0,
reverse32(trigger_mask[0])) != SIGROK_OK) reverse32(trigger_mask[0])) != SIGROK_OK)
@ -730,12 +730,9 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
if (probe_mask & (0xff << (i * 8))) if (probe_mask & (0xff << (i * 8)))
changrp_mask |= (1 << i); changrp_mask |= (1 << i);
} }
g_message("changrp_mask 0x%.2x", changrp_mask);
/* The flag register wants them here, and 1 means "disable channel". */ /* The flag register wants them here, and 1 means "disable channel". */
flag_reg |= ~(changrp_mask << 2) & 0x3c; flag_reg |= ~(changrp_mask << 2) & 0x3c;
g_message("flag_reg 0x%.2x", flag_reg & 0x3c);
flag_reg |= FLAG_FILTER; flag_reg |= FLAG_FILTER;
data = flag_reg << 24; data = flag_reg << 24;
if (send_longcommand(sdi->serial->fd, CMD_SET_FLAGS, data) != SIGROK_OK) if (send_longcommand(sdi->serial->fd, CMD_SET_FLAGS, data) != SIGROK_OK)
@ -781,7 +778,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
} }
struct device_plugin ols_plugin_info = { struct device_plugin ols_plugin_info = {
"sump", "ols",
1, 1,
hw_init, hw_init,
hw_cleanup, hw_cleanup,

View File

@ -231,7 +231,7 @@ static void close_device(struct sigrok_device_instance *sdi)
if (sdi->usb->devhdl == NULL) if (sdi->usb->devhdl == NULL)
return; return;
g_message("closing device %d on %d.%d interface %d", sdi->index, g_message("saleae: closing device %d on %d.%d interface %d", sdi->index,
sdi->usb->bus, sdi->usb->address, USB_INTERFACE); sdi->usb->bus, sdi->usb->address, USB_INTERFACE);
libusb_release_interface(sdi->usb->devhdl, USB_INTERFACE); libusb_release_interface(sdi->usb->devhdl, USB_INTERFACE);
libusb_close(sdi->usb->devhdl); libusb_close(sdi->usb->devhdl);
@ -364,7 +364,7 @@ static int hw_opendev(int device_index)
timediff = cur - upd; timediff = cur - upd;
if (timediff < FIRMWARE_RENUM_DELAY) { if (timediff < FIRMWARE_RENUM_DELAY) {
timediff = FIRMWARE_RENUM_DELAY - timediff; timediff = FIRMWARE_RENUM_DELAY - timediff;
g_message("waiting %d ms for device to reset", g_message("saleae: waiting %d ms for device to reset",
timediff); timediff);
g_usleep(timediff * 1000); g_usleep(timediff * 1000);
firmware_updated.tv_sec = 0; firmware_updated.tv_sec = 0;
@ -480,7 +480,7 @@ static int set_configuration_samplerate(struct sigrok_device_instance *sdi,
divider = (uint8_t) (48 / (samplerate / 1000000.0)) - 1; divider = (uint8_t) (48 / (samplerate / 1000000.0)) - 1;
g_message("setting samplerate to %" PRIu64 " Hz (divider %d)", g_message("saleae: setting samplerate to %" PRIu64 " Hz (divider %d)",
samplerate, divider); samplerate, divider);
buf[0] = 0x01; buf[0] = 0x01;
buf[1] = divider; buf[1] = divider;
@ -558,7 +558,7 @@ void receive_transfer(struct libusb_transfer *transfer)
return; return;
} }
g_message("receive_transfer(): status %d received %d bytes", g_message("saleae: receive_transfer(): status %d received %d bytes",
transfer->status, transfer->actual_length); transfer->status, transfer->actual_length);
/* Save incoming transfer before reusing the transfer struct. */ /* Save incoming transfer before reusing the transfer struct. */