]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/lecroy-logicstudio/protocol.c
output/csv: use intermediate time_t var, silence compiler warning
[libsigrok.git] / src / hardware / lecroy-logicstudio / protocol.c
index 78376a45ef1747c2a5e070edd516c278e803bc1c..b7bf8b593e6606b86e773942156afc13974f3e87 100644 (file)
@@ -310,7 +310,7 @@ static int fetch_samples_async(const struct sr_dev_inst *sdi)
        prep_regw(&cmd[i++], REG_FETCH_SAMPLES, devc->magic_fetch_samples + 0x01);
        prep_regw(&cmd[i++], REG_FETCH_SAMPLES, devc->magic_fetch_samples | 0x02);
 
-       return write_registers_async(sdi, 0x12, 5444, cmd, ARRAY_SIZE(cmd),
+       return write_registers_async(sdi, 0x12, 5444, ARRAY_AND_SIZE(cmd),
                        handle_fetch_samples_done);
 }
 
@@ -522,7 +522,7 @@ static int upload_trigger(const struct sr_dev_inst *sdi,
                        prep_regw(&regs[k++], REG_TRIGGER_CFG, value);
                }
 
-               if (write_registers_sync(sdi, 0x12, 5444, regs, ARRAY_SIZE(regs))) {
+               if (write_registers_sync(sdi, 0x12, 5444, ARRAY_AND_SIZE(regs))) {
                        sr_err("Failed to upload trigger config.");
                        return SR_ERR;
                }
@@ -1003,7 +1003,6 @@ static void LIBUSB_CALL recv_bulk_transfer(struct libusb_transfer *xfer)
        const struct sr_dev_inst *sdi;
        struct dev_context *devc;
        struct drv_context *drvc;
-       struct sr_datafeed_packet packet;
        uint32_t bytes_left, length;
        uint16_t read_offset, trigger_offset;
 
@@ -1069,10 +1068,7 @@ static void LIBUSB_CALL recv_bulk_transfer(struct libusb_transfer *xfer)
        }
 
        /* Here comes the trigger. */
-       packet.type = SR_DF_TRIGGER;
-       packet.payload = NULL;
-
-       sr_session_send(sdi, &packet);
+       std_session_send_df_trigger(sdi);
 
        /* Send post-trigger samples. */
        while (bytes_left > 0) {
@@ -1127,7 +1123,7 @@ SR_PRIV int lls_start_acquisition(const struct sr_dev_inst *sdi)
 
        total_samples = devc->num_thousand_samples * 1000;
 
-       pre_trigger_samples = total_samples * devc->capture_ratio / 100;
+       pre_trigger_samples = (total_samples * devc->capture_ratio) / 100;
        post_trigger_samples = total_samples - pre_trigger_samples;
 
        pre_trigger_tr = transform_sample_count(devc, pre_trigger_samples);
@@ -1162,7 +1158,7 @@ SR_PRIV int lls_start_acquisition(const struct sr_dev_inst *sdi)
        devc->magic_arm_trigger = 0x0c;
        prep_regw(&cmd[i++], REG_ARM_TRIGGER, devc->magic_arm_trigger | 0x01);
 
-       return write_registers_sync(sdi, 0x12, 5444, cmd, ARRAY_SIZE(cmd));
+       return write_registers_sync(sdi, 0x12, 5444, ARRAY_AND_SIZE(cmd));
 }
 
 SR_PRIV int lls_stop_acquisition(const struct sr_dev_inst *sdi)
@@ -1182,5 +1178,5 @@ SR_PRIV int lls_stop_acquisition(const struct sr_dev_inst *sdi)
 
        assert(i == ARRAY_SIZE(cmd));
 
-       return write_registers_sync(sdi, 0x12, 5444, cmd, ARRAY_SIZE(cmd));
+       return write_registers_sync(sdi, 0x12, 5444, ARRAY_AND_SIZE(cmd));
 }