From: Joel Holdsworth Date: Thu, 10 May 2012 15:34:24 +0000 (+0100) Subject: fx2lafw: Added a check to limit the sample rate during 16-bit sampling X-Git-Tag: dsupstream~929 X-Git-Url: http://sigrok.org/gitweb/?a=commitdiff_plain;h=f4575b6549ded99ec5380b4d6fafa899f5cb65ae;p=libsigrok.git fx2lafw: Added a check to limit the sample rate during 16-bit sampling --- diff --git a/hardware/fx2lafw/command.c b/hardware/fx2lafw/command.c index 5346408d..7053ce42 100644 --- a/hardware/fx2lafw/command.c +++ b/hardware/fx2lafw/command.c @@ -66,6 +66,12 @@ SR_PRIV int command_start_acquisition(libusb_device_handle *devhdl, int delay = 0, ret; /* Compute the sample rate. */ + if(samplewide && samplerate > MAX_16BIT_SAMPLE_RATE) { + sr_err("fx2lafw: Unable to sample at %" PRIu64 "Hz " + "when collecting 16-bit samples.", samplerate); + return SR_ERR; + } + if ((SR_MHZ(48) % samplerate) == 0) { cmd.flags = CMD_START_FLAGS_CLK_48MHZ; delay = SR_MHZ(48) / samplerate - 1; diff --git a/hardware/fx2lafw/fx2lafw.h b/hardware/fx2lafw/fx2lafw.h index 1a726cf6..c8a1d929 100644 --- a/hardware/fx2lafw/fx2lafw.h +++ b/hardware/fx2lafw/fx2lafw.h @@ -35,6 +35,9 @@ #define FX2LAFW_REQUIRED_VERSION_MAJOR 1 +#define MAX_8BIT_SAMPLE_RATE SR_MHZ(24) +#define MAX_16BIT_SAMPLE_RATE SR_MHZ(12) + /* 6 delay states of up to 256 clock ticks */ #define MAX_SAMPLE_DELAY (6 * 256)