]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/pipistrello-ols/protocol.c
Add sr_dev_acquisition_stop(), factor out SR_ERR_DEV_CLOSED check.
[libsigrok.git] / src / hardware / pipistrello-ols / protocol.c
index d49d0e6ab4d07c0d17cc640a7141e3d64db632ec..8276a9ed46f83aee4fb7ec4231ecc2a671a2e13f 100644 (file)
@@ -20,8 +20,6 @@
 #include <config.h>
 #include "protocol.h"
 
-extern SR_PRIV struct sr_dev_driver p_ols_driver_info;
-
 SR_PRIV int write_shortcommand(struct dev_context *devc, uint8_t command)
 {
        uint8_t buf[1];
@@ -130,7 +128,7 @@ SR_PRIV int p_ols_open(struct dev_context *devc)
                goto err_open_close_ftdic;
        }
        sr_dbg("FTDI chip read data chunk size set successfully.");
-       
+
        return SR_OK;
 
 err_open_close_ftdic:
@@ -227,7 +225,6 @@ SR_PRIV struct sr_dev_inst *p_ols_get_metadata(uint8_t *buf, int bytes_read, str
 
        sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INACTIVE;
-       sdi->driver = &p_ols_driver_info;
        sdi->priv = devc;
 
        devname = g_string_new("");
@@ -427,7 +424,7 @@ SR_PRIV int p_ols_receive_data(int fd, int revents, void *cb_data)
                if (bytes_read < 0) {
                        sr_err("Failed to read FTDI data (%d): %s.",
                               bytes_read, ftdi_get_error_string(devc->ftdic));
-                       sdi->driver->dev_acquisition_stop(sdi);
+                       sr_dev_acquisition_stop(sdi);
                        return FALSE;
                }
                if (bytes_read == 0) {
@@ -446,7 +443,7 @@ SR_PRIV int p_ols_receive_data(int fd, int revents, void *cb_data)
                        sr_spew("Received byte 0x%.2x.", byte);
 
                        if ((devc->flag_reg & FLAG_DEMUX) && (devc->flag_reg & FLAG_RLE)) {
-                               /* RLE in demux mode must be processed differently 
+                               /* RLE in demux mode must be processed differently
                                * since in this case the RLE encoder is operating on pairs of samples.
                                */
                                if (devc->num_bytes == num_channels * 2) {
@@ -502,7 +499,7 @@ SR_PRIV int p_ols_receive_data(int fd, int revents, void *cb_data)
                                                         * sample.
                                                         */
                                                        devc->tmp_sample[i] = devc->sample[j++];
-                                               } 
+                                               }
                                        }
                                        /* Clear out the most significant bit of the sample */
                                        devc->tmp_sample[devc->num_bytes - 1] &= 0x7f;
@@ -520,7 +517,7 @@ SR_PRIV int p_ols_receive_data(int fd, int revents, void *cb_data)
                                                         * sample.
                                                         */
                                                        devc->tmp_sample2[i] = devc->sample[j++];
-                                               } 
+                                               }
                                        }
                                        /* Clear out the most significant bit of the sample */
                                        devc->tmp_sample2[devc->num_bytes - 1] &= 0x7f;
@@ -600,7 +597,7 @@ SR_PRIV int p_ols_receive_data(int fd, int revents, void *cb_data)
                                                                 * sample.
                                                                 */
                                                                devc->tmp_sample[i] = devc->sample[j++];
-                                                       } 
+                                                       }
                                                }
                                                memcpy(devc->sample, devc->tmp_sample, 4);
                                                sr_spew("Expanded sample: 0x%.8x.", sample);
@@ -675,7 +672,7 @@ SR_PRIV int p_ols_receive_data(int fd, int revents, void *cb_data)
                }
                g_free(devc->raw_sample_buf);
 
-               sdi->driver->dev_acquisition_stop(sdi);
+               sr_dev_acquisition_stop(sdi);
        }
 
        return TRUE;