fx2lafw: Added a check to limit the sample rate during 16-bit sampling

This commit is contained in:
Joel Holdsworth 2012-05-10 16:34:24 +01:00
parent d1ddc7a9a8
commit f4575b6549
2 changed files with 9 additions and 0 deletions

View File

@ -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;

View File

@ -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)