X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fikalogic-scanaplus%2Fprotocol.c;h=39dcfa2cd46ec7f16c37f908d25942dbfb4d23e1;hb=eac48b34917cf19c2b5ba52ccea85ec94bb5830f;hp=0b81ebde211ece7f2ac01dd2871c787085289117;hpb=6ec6c43b4738dbc7091f4a49a4ec80ea6102cb52;p=libsigrok.git
diff --git a/src/hardware/ikalogic-scanaplus/protocol.c b/src/hardware/ikalogic-scanaplus/protocol.c
index 0b81ebde..39dcfa2c 100644
--- a/src/hardware/ikalogic-scanaplus/protocol.c
+++ b/src/hardware/ikalogic-scanaplus/protocol.c
@@ -14,8 +14,7 @@
* 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
@@ -107,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);
@@ -119,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;
@@ -317,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);
+ sdi->driver->dev_acquisition_stop(sdi);
return FALSE;
}
if (bytes_read == 0) {
@@ -354,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);
+ sdi->driver->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);
+ sdi->driver->dev_acquisition_stop(sdi);
return TRUE;
} else {
- send_samples(devc, devc->bytes_received / 2);
+ send_samples(sdi, devc->bytes_received / 2);
}
return TRUE;