X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=hardware%2Fsaleae-logic%2Fsaleae-logic.c;h=be4892a796cdc0f714235ed0c2914fdf61534f5a;hb=f3163a6c2ee7a1d7ec6865f11cfcf52b07dc31f5;hp=58f31acfaef37c191b8d4d7d4ecba436cff1a3b1;hpb=e6ac9ac808b900287a80ea44d9c661703e3a101c;p=libsigrok.git diff --git a/hardware/saleae-logic/saleae-logic.c b/hardware/saleae-logic/saleae-logic.c index 58f31acf..be4892a7 100644 --- a/hardware/saleae-logic/saleae-logic.c +++ b/hardware/saleae-logic/saleae-logic.c @@ -24,28 +24,29 @@ #include #include #include +#include #include "config.h" -#define USB_VENDOR 0x0925 +#define USB_VENDOR 0x0925 #define USB_PRODUCT 0x3881 -#define USB_VENDOR_NAME "Saleae" -#define USB_MODEL_NAME "Logic" -#define USB_MODEL_VERSION "" +#define USB_VENDOR_NAME "Saleae" +#define USB_MODEL_NAME "Logic" +#define USB_MODEL_VERSION "" -#define USB_INTERFACE 0 -#define USB_CONFIGURATION 1 -#define NUM_PROBES 8 -#define NUM_TRIGGER_STAGES 4 -#define TRIGGER_TYPES "01" -#define FIRMWARE FIRMWARE_DIR "/saleae-logic.fw" +#define USB_INTERFACE 0 +#define USB_CONFIGURATION 1 +#define NUM_PROBES 8 +#define NUM_TRIGGER_STAGES 4 +#define TRIGGER_TYPES "01" +#define FIRMWARE FIRMWARE_DIR "/saleae-logic.fw" /* delay in ms */ -#define FIRMWARE_RENUM_DELAY 2000 -#define NUM_SIMUL_TRANSFERS 10 -#define MAX_EMPTY_TRANSFERS (NUM_SIMUL_TRANSFERS * 2) +#define FIRMWARE_RENUM_DELAY 2000 +#define NUM_SIMUL_TRANSFERS 10 +#define MAX_EMPTY_TRANSFERS (NUM_SIMUL_TRANSFERS * 2) /* Software trigger implementation: positive values indicate trigger stage. */ -#define TRIGGER_FIRED -1 +#define TRIGGER_FIRED -1 /* There is only one model Saleae Logic, and this is what it supports: */ static int capabilities[] = { @@ -54,6 +55,7 @@ static int capabilities[] = { /* These are really implemented in the driver, not the hardware. */ HWCAP_LIMIT_SAMPLES, + HWCAP_CONTINUOUS, 0, }; @@ -296,7 +298,7 @@ static int hw_init(char *deviceinfo) libusb_device **devlist; int err, devcnt, i; - /* QUICK HACK */ + /* Avoid compiler warnings. */ deviceinfo = deviceinfo; if (libusb_init(&usb_context) != 0) { @@ -524,7 +526,7 @@ static int receive_data(int fd, int revents, void *user_data) { struct timeval tv; - /* QUICK HACK */ + /* Avoid compiler warnings. */ fd = fd; revents = revents; user_data = user_data; @@ -613,8 +615,9 @@ void receive_transfer(struct libusb_transfer *transfer) * Send the samples that triggered it, since we're * skipping past them. */ - packet.type = DF_LOGIC8; + packet.type = DF_LOGIC; packet.length = trigger_stage; + packet.unitsize = 1; packet.payload = trigger_buffer; session_bus(user_data, &packet); @@ -645,14 +648,15 @@ void receive_transfer(struct libusb_transfer *transfer) if (trigger_stage == TRIGGER_FIRED) { /* Send the incoming transfer to the session bus. */ - packet.type = DF_LOGIC8; + packet.type = DF_LOGIC; packet.length = cur_buflen - trigger_offset; + packet.unitsize = 1; packet.payload = cur_buf + trigger_offset; session_bus(user_data, &packet); g_free(cur_buf); num_samples += cur_buflen; - if ((unsigned int)num_samples > limit_samples) { + if (limit_samples && (unsigned int) num_samples > limit_samples) { hw_stop_acquisition(-1, user_data); } } else { @@ -711,7 +715,8 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) gettimeofday(&header->starttime, NULL); header->samplerate = cur_samplerate; header->protocol_id = PROTO_RAW; - header->num_probes = NUM_PROBES; + header->num_logic_probes = NUM_PROBES; + header->num_analog_probes = 0; session_bus(session_device_id, packet); g_free(header); g_free(packet); @@ -724,7 +729,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id) { struct datafeed_packet packet; - /* QUICK HACK */ + /* Avoid compiler warnings. */ device_index = device_index; packet.type = DF_END;