fx2lafw: Added support for 100kHz and 50kHz sampling
This commit is contained in:
parent
1e94408ae5
commit
897c1a2ee5
|
@ -18,6 +18,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <libusb.h>
|
#include <libusb.h>
|
||||||
|
|
||||||
|
#include "fx2lafw.h"
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
#include "sigrok.h"
|
#include "sigrok.h"
|
||||||
#include "sigrok-internal.h"
|
#include "sigrok-internal.h"
|
||||||
|
@ -71,14 +73,14 @@ SR_PRIV int command_start_acquisition(libusb_device_handle *devhdl,
|
||||||
delay = SR_MHZ(30) / samplerate - 1;
|
delay = SR_MHZ(30) / samplerate - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Note: sample_delay=0 is treated as sample_delay=256. */
|
if (delay <= 0 || delay > MAX_SAMPLE_DELAY) {
|
||||||
if (delay <= 0 || delay > 256) {
|
|
||||||
sr_err("fx2lafw: Unable to sample at %" PRIu64 "Hz.",
|
sr_err("fx2lafw: Unable to sample at %" PRIu64 "Hz.",
|
||||||
samplerate);
|
samplerate);
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.sample_delay = delay;
|
cmd.sample_delay_h = (delay >> 8) & 0x00FF;
|
||||||
|
cmd.sample_delay_l = delay & 0x00FF;
|
||||||
|
|
||||||
/* Send the control message. */
|
/* Send the control message. */
|
||||||
ret = libusb_control_transfer(devhdl, LIBUSB_REQUEST_TYPE_VENDOR |
|
ret = libusb_control_transfer(devhdl, LIBUSB_REQUEST_TYPE_VENDOR |
|
||||||
|
|
|
@ -41,7 +41,8 @@ struct version_info {
|
||||||
|
|
||||||
struct cmd_start_acquisition {
|
struct cmd_start_acquisition {
|
||||||
uint8_t flags;
|
uint8_t flags;
|
||||||
uint8_t sample_delay;
|
uint8_t sample_delay_h;
|
||||||
|
uint8_t sample_delay_l;
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <glib.h>
|
|
||||||
#include <libusb.h>
|
#include <libusb.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "sigrok.h"
|
#include "sigrok.h"
|
||||||
|
@ -95,6 +94,8 @@ static const char *probe_names[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint64_t supported_samplerates[] = {
|
static uint64_t supported_samplerates[] = {
|
||||||
|
SR_KHZ(50),
|
||||||
|
SR_KHZ(100),
|
||||||
SR_KHZ(200),
|
SR_KHZ(200),
|
||||||
SR_KHZ(250),
|
SR_KHZ(250),
|
||||||
SR_KHZ(500),
|
SR_KHZ(500),
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
#ifndef LIBSIGROK_HARDWARE_FX2LAFW_FX2LAFW_H
|
#ifndef LIBSIGROK_HARDWARE_FX2LAFW_FX2LAFW_H
|
||||||
#define LIBSIGROK_HARDWARE_FX2LAFW_FX2LAFW_H
|
#define LIBSIGROK_HARDWARE_FX2LAFW_FX2LAFW_H
|
||||||
|
|
||||||
|
@ -32,6 +34,7 @@
|
||||||
#define FX2LAFW_VERSION_MAJOR 1
|
#define FX2LAFW_VERSION_MAJOR 1
|
||||||
#define FX2LAFW_VERSION_MINOR 0
|
#define FX2LAFW_VERSION_MINOR 0
|
||||||
|
|
||||||
|
#define MAX_SAMPLE_DELAY (6*256) /* 6 delay states of up to 256 clock ticks*/
|
||||||
|
|
||||||
/* Software trigger implementation: positive values indicate trigger stage. */
|
/* Software trigger implementation: positive values indicate trigger stage. */
|
||||||
#define TRIGGER_FIRED -1
|
#define TRIGGER_FIRED -1
|
||||||
|
|
Loading…
Reference in New Issue