]> sigrok.org Git - libsigrok.git/commitdiff
fx2lafw: Added support for 100kHz and 50kHz sampling
authorJoel Holdsworth <redacted>
Mon, 7 May 2012 11:40:52 +0000 (12:40 +0100)
committerJoel Holdsworth <redacted>
Thu, 10 May 2012 12:08:09 +0000 (13:08 +0100)
hardware/fx2lafw/command.c
hardware/fx2lafw/command.h
hardware/fx2lafw/fx2lafw.c
hardware/fx2lafw/fx2lafw.h

index bb47d2d183676d6539df9aef4e417e5f453dcf5f..fe16506aefbfc4a373e397fe085dc6edda16f6c5 100644 (file)
@@ -18,6 +18,8 @@
  */
 
 #include <libusb.h>
+
+#include "fx2lafw.h"
 #include "command.h"
 #include "sigrok.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;
        }
 
-       /* Note: sample_delay=0 is treated as sample_delay=256. */
-       if (delay <= 0 || delay > 256) {
+       if (delay <= 0 || delay > MAX_SAMPLE_DELAY) {
                sr_err("fx2lafw: Unable to sample at %" PRIu64 "Hz.",
                       samplerate);
                return SR_ERR;
        }
 
-       cmd.sample_delay = delay;
+       cmd.sample_delay_h = (delay >> 8) & 0x00FF;
+       cmd.sample_delay_l = delay & 0x00FF;
 
        /* Send the control message. */
        ret = libusb_control_transfer(devhdl, LIBUSB_REQUEST_TYPE_VENDOR |
index 0ab3e85e26ce5ba303fd2cb28aebde82172b2fe5..70c4fdaf4e2c82164e39e0d2bb1d071f5e808e63 100644 (file)
@@ -41,7 +41,8 @@ struct version_info {
 
 struct cmd_start_acquisition {
        uint8_t flags;
-       uint8_t sample_delay;
+       uint8_t sample_delay_h;
+       uint8_t sample_delay_l;
 };
 
 #pragma pack(pop)
index 11b43f087bfd1c1d8c043479b4c9175224e51e75..89bb18bf12a0d3c09fe845c61404718a36de9881 100644 (file)
@@ -21,7 +21,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <inttypes.h>
-#include <glib.h>
 #include <libusb.h>
 #include "config.h"
 #include "sigrok.h"
@@ -95,6 +94,8 @@ static const char *probe_names[] = {
 };
 
 static uint64_t supported_samplerates[] = {
+       SR_KHZ(50),
+       SR_KHZ(100),
        SR_KHZ(200),
        SR_KHZ(250),
        SR_KHZ(500),
index b03e86ab6fb94f1261032cc4f459eac240a0150d..15b1e20c31b774a4cac78f97795b13305c63d74b 100644 (file)
@@ -17,6 +17,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <glib.h>
+
 #ifndef LIBSIGROK_HARDWARE_FX2LAFW_FX2LAFW_H
 #define LIBSIGROK_HARDWARE_FX2LAFW_FX2LAFW_H
 
@@ -32,6 +34,7 @@
 #define FX2LAFW_VERSION_MAJOR  1
 #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. */
 #define TRIGGER_FIRED          -1