sr: stop_acquisition callback: Return int.

This commit is contained in:
Uwe Hermann 2012-02-12 13:31:58 +01:00
parent c73d2ea421
commit 3010f21c91
9 changed files with 45 additions and 25 deletions

View File

@ -379,11 +379,13 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
return SR_OK;
}
static void hw_stop_acquisition(int device_index, gpointer session_device_id)
static int hw_stop_acquisition(int device_index, gpointer session_device_id)
{
/* Avoid compiler warnings. */
device_index = device_index;
session_device_id = session_device_id;
return SR_OK;
}
SR_PRIV struct sr_device_plugin alsa_plugin_info = {

View File

@ -118,7 +118,7 @@ static const char *firmware_files[] = {
"asix-sigma-phasor.fw", /* Frequency counter */
};
static void hw_stop_acquisition(int device_index, gpointer session_data);
static int hw_stop_acquisition(int device_index, gpointer session_data);
static int sigma_read(void *buf, size_t size, struct sigma *sigma)
{
@ -1362,20 +1362,25 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
return SR_OK;
}
static void hw_stop_acquisition(int device_index, gpointer session_data)
static int hw_stop_acquisition(int device_index, gpointer session_data)
{
struct sr_device_instance *sdi;
struct sigma *sigma;
uint8_t modestatus;
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return;
sigma = sdi->priv;
/* Avoid compiler warnings. */
(void)session_data;
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
sr_err("asix: %s: sdi was NULL", __func__);
return SR_ERR_BUG;
}
if (!(sigma = sdi->priv)) {
sr_err("asix: %s: sdi->priv was NULL", __func__);
return SR_ERR_BUG;
}
/* Stop acquisition. */
sigma_set_register(WRITE_MODE, 0x11, sigma);
@ -1387,15 +1392,16 @@ static void hw_stop_acquisition(int device_index, gpointer session_data)
/* Check if trigger has fired. */
modestatus = sigma_get_register(READ_MODE, sigma);
if (modestatus & 0x20) {
if (modestatus & 0x20)
sigma->state.triggerchunk = sigma->state.triggerpos / 512;
} else
else
sigma->state.triggerchunk = -1;
sigma->state.chunks_downloaded = 0;
sigma->state.state = SIGMA_DOWNLOAD;
return SR_OK;
}
SR_PRIV struct sr_device_plugin asix_sigma_plugin_info = {

View File

@ -136,7 +136,7 @@ static int capabilities[] = {
/* Function prototypes. */
static int la8_close_usb_reset_sequencer(struct la8 *la8);
static void hw_stop_acquisition(int device_index, gpointer session_data);
static int hw_stop_acquisition(int device_index, gpointer session_data);
static int la8_reset(struct la8 *la8);
static void fill_supported_samplerates_if_needed(void)
@ -1103,7 +1103,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
return SR_OK;
}
static void hw_stop_acquisition(int device_index, gpointer session_data)
static int hw_stop_acquisition(int device_index, gpointer session_data)
{
struct sr_device_instance *sdi;
struct la8 *la8;
@ -1113,18 +1113,20 @@ static void hw_stop_acquisition(int device_index, gpointer session_data)
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
sr_err("la8: %s: sdi was NULL", __func__);
return;
return SR_ERR_BUG;
}
if (!(la8 = sdi->priv)) {
sr_err("la8: %s: sdi->priv was NULL", __func__);
return;
return SR_ERR_BUG;
}
/* Send end packet to the session bus. */
sr_dbg("la8: %s: sending SR_DF_END", __func__);
packet.type = SR_DF_END;
sr_session_bus(session_data, &packet);
return SR_OK;
}
SR_PRIV struct sr_device_plugin chronovu_la8_plugin_info = {

View File

@ -134,7 +134,7 @@ static int default_pattern = PATTERN_SIGROK;
static GThread *my_thread;
static int thread_running;
static void hw_stop_acquisition(int device_index, gpointer session_data);
static int hw_stop_acquisition(int device_index, gpointer session_data);
static int hw_init(const char *deviceinfo)
{
@ -476,7 +476,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
return SR_OK;
}
static void hw_stop_acquisition(int device_index, gpointer session_data)
static int hw_stop_acquisition(int device_index, gpointer session_data)
{
/* Avoid compiler warnings. */
(void)device_index;
@ -484,6 +484,8 @@ static void hw_stop_acquisition(int device_index, gpointer session_data)
/* Stop generate thread. */
thread_running = 0;
return SR_OK;
}
SR_PRIV struct sr_device_plugin demo_plugin_info = {

View File

@ -816,7 +816,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
}
/* FIXME */
static void hw_stop_acquisition(int device_index, gpointer session_device_id)
static int hw_stop_acquisition(int device_index, gpointer session_device_id)
{
struct sr_datafeed_packet packet;
@ -824,6 +824,8 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
packet.type = SR_DF_END;
sr_session_bus(session_device_id, &packet);
return SR_OK;
}
SR_PRIV struct sr_device_plugin link_mso19_plugin_info = {

View File

@ -1010,7 +1010,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
return SR_OK;
}
static void hw_stop_acquisition(int device_index, gpointer session_device_id)
static int hw_stop_acquisition(int device_index, gpointer session_device_id)
{
struct sr_datafeed_packet packet;
@ -1019,6 +1019,8 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
packet.type = SR_DF_END;
sr_session_bus(session_device_id, &packet);
return SR_OK;
}
SR_PRIV struct sr_device_plugin ols_plugin_info = {

View File

@ -94,7 +94,7 @@ static libusb_context *usb_context = NULL;
static int new_saleae_logic_firmware = 0;
static int hw_set_configuration(int device_index, int capability, void *value);
static void hw_stop_acquisition(int device_index, gpointer session_device_id);
static int hw_stop_acquisition(int device_index, gpointer session_device_id);
/**
* Check the USB configuration to determine if this is a Saleae Logic.
@ -856,7 +856,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
}
/* This stops acquisition on ALL devices, ignoring device_index. */
static void hw_stop_acquisition(int device_index, gpointer session_data)
static int hw_stop_acquisition(int device_index, gpointer session_data)
{
struct sr_datafeed_packet packet;
@ -869,6 +869,8 @@ static void hw_stop_acquisition(int device_index, gpointer session_data)
receive_transfer(NULL);
/* TODO: Need to cancel and free any queued up transfers. */
return SR_OK;
}
SR_PRIV struct sr_device_plugin saleae_logic_plugin_info = {

View File

@ -698,7 +698,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
}
/* This stops acquisition on ALL devices, ignoring device_index. */
static void hw_stop_acquisition(int device_index, gpointer session_device_id)
static int hw_stop_acquisition(int device_index, gpointer session_device_id)
{
struct sr_datafeed_packet packet;
struct sr_device_instance *sdi;
@ -709,16 +709,18 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
sr_err("zp: %s: sdi was NULL", __func__);
return; /* FIXME */
return SR_ERR_BUG;
}
if (!(zp = sdi->priv)) {
sr_err("zp: %s: sdi->priv was NULL", __func__);
return; /* FIXME */
return SR_ERR_BUG;
}
analyzer_reset(zp->usb->devhdl);
/* TODO: Need to cancel and free any queued up transfers. */
return SR_OK;
}
SR_PRIV struct sr_device_plugin zeroplus_logic_cube_plugin_info = {

View File

@ -354,7 +354,7 @@ struct sr_device_plugin {
int *(*get_capabilities) (void);
int (*set_configuration) (int device_index, int capability, void *value);
int (*start_acquisition) (int device_index, gpointer session_device_id);
void (*stop_acquisition) (int device_index, gpointer session_device_id);
int (*stop_acquisition) (int device_index, gpointer session_device_id);
};
struct sr_session {