get_sr_device_instance() -> sr_get_device_instance().

This commit is contained in:
Uwe Hermann 2011-01-29 16:57:35 +01:00
parent a00ba01228
commit d32d961d17
9 changed files with 43 additions and 43 deletions

View File

@ -78,7 +78,7 @@ static int hw_opendev(int device_index)
struct alsa *alsa;
int err;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return SR_ERR;
alsa = sdi->priv;
@ -112,7 +112,7 @@ static void hw_closedev(int device_index)
struct sr_device_instance *sdi;
struct alsa *alsa;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return;
alsa = sdi->priv;
if (!alsa)
@ -128,7 +128,7 @@ static void hw_cleanup(void)
{
struct sr_device_instance *sdi;
if (!(sdi = get_sr_device_instance(device_instances, 0)))
if (!(sdi = sr_get_device_instance(device_instances, 0)))
return;
free(sdi->priv);
@ -141,7 +141,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
struct alsa *alsa;
void *info = NULL;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return NULL;
alsa = sdi->priv;
@ -181,7 +181,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
struct sr_device_instance *sdi;
struct alsa *alsa;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return SR_ERR;
alsa = sdi->priv;
@ -266,7 +266,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
int count;
int err;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return SR_ERR;
alsa = sdi->priv;

View File

@ -526,7 +526,7 @@ static int hw_opendev(int device_index)
struct sigma *sigma;
int ret;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return SR_ERR;
sigma = sdi->priv;
@ -669,7 +669,7 @@ static void hw_closedev(int device_index)
struct sr_device_instance *sdi;
struct sigma *sigma;
if ((sdi = get_sr_device_instance(device_instances, device_index)))
if ((sdi = sr_get_device_instance(device_instances, device_index)))
{
sigma = sdi->priv;
if (sdi->status == ST_ACTIVE)
@ -701,7 +701,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
struct sigma *sigma;
void *info = NULL;
if (!(sdi = get_sr_device_instance(device_instances, device_index))) {
if (!(sdi = sr_get_device_instance(device_instances, device_index))) {
fprintf(stderr, "It's NULL.\n");
return NULL;
}
@ -733,7 +733,7 @@ static int hw_get_status(int device_index)
{
struct sr_device_instance *sdi;
sdi = get_sr_device_instance(device_instances, device_index);
sdi = sr_get_device_instance(device_instances, device_index);
if (sdi)
return sdi->status;
else
@ -751,7 +751,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
struct sigma *sigma;
int ret;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return SR_ERR;
sigma = sdi->priv;
@ -1211,7 +1211,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
session_device_id = session_device_id;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return SR_ERR;
sigma = sdi->priv;
@ -1320,7 +1320,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
struct sigma *sigma;
uint8_t modestatus;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return;
sigma = sdi->priv;

View File

@ -132,7 +132,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
struct sr_device_instance *sdi;
void *info = NULL;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return NULL;
switch (device_info_id) {

View File

@ -481,7 +481,7 @@ static int hw_opendev(int device_index)
struct mso *mso;
int ret = SR_ERR;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return ret;
mso = sdi->priv;
@ -519,7 +519,7 @@ static void hw_closedev(int device_index)
{
struct sr_device_instance *sdi;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return;
if (sdi->serial->fd != -1) {
@ -535,7 +535,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
struct mso *mso;
void *info = NULL;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return NULL;
mso = sdi->priv;
@ -563,7 +563,7 @@ static int hw_get_status(int device_index)
{
struct sr_device_instance *sdi;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return ST_NOT_FOUND;
return sdi->status;
@ -578,7 +578,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
{
struct sr_device_instance *sdi;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return SR_ERR;
switch (capability) {
@ -672,7 +672,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
struct datafeed_header header;
int ret = SR_ERR;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return ret;
mso = sdi->priv;

View File

@ -328,7 +328,7 @@ static int hw_opendev(int device_index)
{
struct sr_device_instance *sdi;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return SR_ERR;
sdi->serial->fd = serial_open(sdi->serial->port, O_RDWR);
@ -344,7 +344,7 @@ static void hw_closedev(int device_index)
{
struct sr_device_instance *sdi;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return;
if (sdi->serial->fd != -1) {
@ -375,7 +375,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
struct sr_device_instance *sdi;
void *info;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return NULL;
info = NULL;
@ -404,7 +404,7 @@ static int hw_get_status(int device_index)
{
struct sr_device_instance *sdi;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return ST_NOT_FOUND;
return sdi->status;
@ -447,7 +447,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
int ret;
uint64_t *tmp_u64;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return SR_ERR;
if (sdi->status != ST_ACTIVE)
@ -658,7 +658,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
uint16_t readcount, delaycount;
uint8_t changrp_mask;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return SR_ERR;
if (sdi->status != ST_ACTIVE)

View File

@ -173,7 +173,7 @@ struct sr_device_instance *sl_open_device(int device_index)
struct libusb_device_descriptor des;
int err, skip, i;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return NULL;
libusb_get_device_list(usb_context, &devlist);
@ -398,7 +398,7 @@ static void hw_closedev(int device_index)
{
struct sr_device_instance *sdi;
if ((sdi = get_sr_device_instance(device_instances, device_index)))
if ((sdi = sr_get_device_instance(device_instances, device_index)))
close_device(sdi);
}
@ -426,7 +426,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
struct sr_device_instance *sdi;
void *info = NULL;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return NULL;
switch (device_info_id) {
@ -454,7 +454,7 @@ static int hw_get_status(int device_index)
{
struct sr_device_instance *sdi;
sdi = get_sr_device_instance(device_instances, device_index);
sdi = sr_get_device_instance(device_instances, device_index);
if (sdi)
return sdi->status;
else
@ -503,7 +503,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
int ret;
uint64_t *tmp_u64;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return SR_ERR;
if (capability == HWCAP_SAMPLERATE) {
@ -677,7 +677,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
int size, i;
unsigned char *buf;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return SR_ERR;
packet = g_malloc(sizeof(struct datafeed_packet));

View File

@ -196,7 +196,7 @@ struct sr_device_instance *zp_open_device(int device_index)
struct libusb_device_descriptor des;
int err, i;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return NULL;
libusb_get_device_list(usb_context, &devlist);
@ -372,7 +372,7 @@ static void hw_closedev(int device_index)
{
struct sr_device_instance *sdi;
if ((sdi = get_sr_device_instance(device_instances, device_index)))
if ((sdi = sr_get_device_instance(device_instances, device_index)))
close_device(sdi);
}
@ -400,7 +400,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
struct sr_device_instance *sdi;
void *info = NULL;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return NULL;
switch (device_info_id) {
@ -428,7 +428,7 @@ static int hw_get_status(int device_index)
{
struct sr_device_instance *sdi;
sdi = get_sr_device_instance(device_instances, device_index);
sdi = sr_get_device_instance(device_instances, device_index);
if (sdi)
return sdi->status;
else
@ -461,7 +461,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
struct sr_device_instance *sdi;
uint64_t *tmp_u64;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return SR_ERR;
switch (capability) {
@ -488,7 +488,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
unsigned int packet_num;
unsigned char *buf;
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return SR_ERR;
/* push configured settings to device */
@ -553,7 +553,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
packet.type = DF_END;
session_bus(session_device_id, &packet);
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return; /* TODO: Cry? */
analyzer_reset(sdi->usb->devhdl);

View File

@ -119,8 +119,8 @@ struct sr_device_instance *sr_device_instance_new(int index, int status,
return sdi;
}
struct sr_device_instance *get_sr_device_instance(
GSList *device_instances, int device_index)
struct sr_device_instance *sr_get_device_instance(GSList *device_instances,
int device_index)
{
struct sr_device_instance *sdi;
GSList *l;

View File

@ -65,8 +65,8 @@ GSList *list_hwplugins(void);
/* Generic device instances */
struct sr_device_instance *sr_device_instance_new(int index,
int status, const char *vendor, const char *model, const char *version);
struct sr_device_instance *get_sr_device_instance(
GSList *device_instances, int device_index);
struct sr_device_instance *sr_get_device_instance(GSList *device_instances,
int device_index);
void sr_device_instance_free(struct sr_device_instance *sdi);
/* USB-specific instances */