X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fikalogic-scanaplus%2Fprotocol.c;h=c0e253626a67370b72afa060b6aa025946911bdb;hb=d2f7c417fdd96a13d8fd86350d2fc13db16f626c;hp=3a834f7b444e72d0d7ad7139c0b1c97a2584fdb1;hpb=155b680da482cea2381becb73c51cfb838bff31e;p=libsigrok.git diff --git a/src/hardware/ikalogic-scanaplus/protocol.c b/src/hardware/ikalogic-scanaplus/protocol.c index 3a834f7b..c0e25362 100644 --- a/src/hardware/ikalogic-scanaplus/protocol.c +++ b/src/hardware/ikalogic-scanaplus/protocol.c @@ -14,10 +14,10 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * along with this program; if not, see . */ +#include #include "protocol.h" /* @@ -106,10 +106,13 @@ static void scanaplus_uncompress_block(struct dev_context *devc, } } -static void send_samples(struct dev_context *devc, uint64_t samples_to_send) +static void send_samples(const struct sr_dev_inst *sdi, uint64_t samples_to_send) { struct sr_datafeed_packet packet; struct sr_datafeed_logic logic; + struct dev_context *devc; + + devc = sdi->priv; sr_spew("Sending %" PRIu64 " samples.", samples_to_send); @@ -118,7 +121,7 @@ static void send_samples(struct dev_context *devc, uint64_t samples_to_send) logic.length = samples_to_send * 2; logic.unitsize = 2; /* We need 2 bytes for 9 channels. */ logic.data = devc->sample_buf; - sr_session_send(devc->cb_data, &packet); + sr_session_send(sdi, &packet); devc->samples_sent += samples_to_send; devc->bytes_received -= samples_to_send * 2; @@ -316,7 +319,7 @@ SR_PRIV int scanaplus_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, sdi); + sr_dev_acquisition_stop(sdi); return FALSE; } if (bytes_read == 0) { @@ -353,17 +356,17 @@ SR_PRIV int scanaplus_receive_data(int fd, int revents, void *cb_data) max = (SR_MHZ(100) / 1000) * devc->limit_msec; if (devc->limit_samples && (n >= devc->limit_samples)) { - send_samples(devc, devc->limit_samples - devc->samples_sent); + send_samples(sdi, devc->limit_samples - devc->samples_sent); sr_info("Requested number of samples reached."); - sdi->driver->dev_acquisition_stop(sdi, cb_data); + sr_dev_acquisition_stop(sdi); return TRUE; } else if (devc->limit_msec && (n >= max)) { - send_samples(devc, max - devc->samples_sent); + send_samples(sdi, max - devc->samples_sent); sr_info("Requested time limit reached."); - sdi->driver->dev_acquisition_stop(sdi, cb_data); + sr_dev_acquisition_stop(sdi); return TRUE; } else { - send_samples(devc, devc->bytes_received / 2); + send_samples(sdi, devc->bytes_received / 2); } return TRUE;