X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fikalogic-scanalogic2%2Fprotocol.h;h=5e7c7b3b40686e9a149681dbf747709f2c1566ed;hb=102f12396660e0784134bccce5cc0679db325751;hp=54a5719ef837221a1ffddc40b5d7482dd82b36b8;hpb=c824eb6323282def1cb7d6cf03b6c00c7a060810;p=libsigrok.git diff --git a/hardware/ikalogic-scanalogic2/protocol.h b/hardware/ikalogic-scanalogic2/protocol.h index 54a5719e..5e7c7b3b 100644 --- a/hardware/ikalogic-scanalogic2/protocol.h +++ b/hardware/ikalogic-scanalogic2/protocol.h @@ -27,14 +27,7 @@ #include "libsigrok.h" #include "libsigrok-internal.h" -/* Message logging helpers with subsystem-specific prefix string. */ -#define LOG_PREFIX "ikalogic-scanalogic2: " -#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args) -#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args) -#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args) -#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args) -#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args) -#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args) +#define LOG_PREFIX "ikalogic-scanalogic2" #define VENDOR_NAME "IKALOGIC" #define MODEL_NAME "Scanalogic-2" @@ -49,13 +42,12 @@ #define USB_REQUEST_TYPE_OUT (LIBUSB_REQUEST_TYPE_CLASS | \ LIBUSB_RECIPIENT_INTERFACE | LIBUSB_ENDPOINT_OUT) +#define USB_HID_GET_REPORT 0x01 #define USB_HID_SET_REPORT 0x09 #define USB_HID_REPORT_TYPE_FEATURE 0x300 #define NUM_SAMPLERATES 11 -#define NUM_PROBES 4 - -#define TRIGGER_TYPES "rfc" +#define NUM_CHANNELS 4 /* * Number of sample bytes and samples the device can acquire. Note that the @@ -157,11 +149,8 @@ struct dev_context { void *cb_data; - /* Array to provide an index based access to all probes. */ - const struct sr_probe *probes[NUM_PROBES]; - - unsigned int num_usbfd; - int *usbfd; + /* Array to provide an index based access to all channels. */ + const struct sr_channel *channels[NUM_CHANNELS]; struct libusb_transfer *xfer_in, *xfer_out; @@ -203,7 +192,7 @@ struct dev_context { * channel except the last one. The samples of the last channel will be * processed directly after they will be received. */ - uint8_t sample_buffer[NUM_PROBES - 1][MAX_DEV_SAMPLE_BYTES]; + uint8_t sample_buffer[NUM_CHANNELS - 1][MAX_DEV_SAMPLE_BYTES]; /* Expected number of sample packets for each channel. */ uint16_t num_sample_packets; @@ -217,39 +206,32 @@ struct dev_context { /* Channel number that is currently processed. */ uint8_t channel; - /* Number of enabled probes. */ - unsigned int num_enabled_probes; + /* Number of enabled channels. */ + unsigned int num_enabled_channels; - /* Array to provide a sequential access to all enabled probe indices. */ - uint8_t probe_map[NUM_PROBES]; + /* Array to provide a sequential access to all enabled channel indices. */ + uint8_t channel_map[NUM_CHANNELS]; /* Indicates whether a transfer failed. */ gboolean transfer_error; }; -SR_PRIV int ikalogic_scanalogic2_receive_data(int fd, int revents, - void *cb_data); -SR_PRIV void ikalogic_scanalogic2_receive_transfer_in( - struct libusb_transfer *transfer); -SR_PRIV void ikalogic_scanalogic2_receive_transfer_out( - struct libusb_transfer *transfer); -SR_PRIV int ikalogic_scanalogic2_set_samplerate(const struct sr_dev_inst *sdi, +SR_PRIV int ikalogic_scanalogic2_receive_data(int fd, int revents, void *cb_data); +SR_PRIV void sl2_receive_transfer_in(struct libusb_transfer *transfer); +SR_PRIV void sl2_receive_transfer_out(struct libusb_transfer *transfer); +SR_PRIV int sl2_set_samplerate(const struct sr_dev_inst *sdi, uint64_t samplerate); -SR_PRIV int ikalogic_scanalogic2_set_limit_samples( - const struct sr_dev_inst *sdi, uint64_t limit_samples); -SR_PRIV void ikalogic_scanalogic2_configure_trigger( - const struct sr_dev_inst *sdi); -SR_PRIV int ikalogic_scanalogic2_set_capture_ratio( - const struct sr_dev_inst *sdi, uint64_t capture_ratio); -SR_PRIV int ikalogic_scanalogic2_set_after_trigger_delay( - const struct sr_dev_inst *sdi, uint64_t after_trigger_delay); -SR_PRIV void ikalogic_scanalogic2_calculate_trigger_samples( - const struct sr_dev_inst *sdi); -SR_PRIV int ikalogic_scanalogic2_get_device_info(struct sr_usb_dev_inst usb, +SR_PRIV int sl2_set_limit_samples(const struct sr_dev_inst *sdi, + uint64_t limit_samples); +SR_PRIV int sl2_convert_trigger(const struct sr_dev_inst *sdi); +SR_PRIV int sl2_set_capture_ratio(const struct sr_dev_inst *sdi, + uint64_t capture_ratio); +SR_PRIV int sl2_set_after_trigger_delay(const struct sr_dev_inst *sdi, + uint64_t after_trigger_delay); +SR_PRIV void sl2_calculate_trigger_samples(const struct sr_dev_inst *sdi); +SR_PRIV int sl2_get_device_info(struct sr_usb_dev_inst usb, struct device_info *dev_info); -SR_PRIV int ikalogic_scanalogic2_transfer_in(libusb_device_handle *dev_handle, - uint8_t *data); -SR_PRIV int ikalogic_scanalogic2_transfer_out(libusb_device_handle *dev_handle, - uint8_t *data); +SR_PRIV int sl2_transfer_in(libusb_device_handle *dev_handle, uint8_t *data); +SR_PRIV int sl2_transfer_out(libusb_device_handle *dev_handle, uint8_t *data); #endif