Change all sigrok_ prefixes to sr_.
This commit is contained in:
parent
f50f3f40d9
commit
a00ba01228
|
@ -20,13 +20,13 @@
|
|||
#include <glib.h>
|
||||
#include <sigrok.h>
|
||||
|
||||
int sigrok_init(void)
|
||||
int sr_init(void)
|
||||
{
|
||||
return load_hwplugins();
|
||||
}
|
||||
|
||||
/* TODO: Should return int to be able to report back error codes. */
|
||||
void sigrok_cleanup(void)
|
||||
void sr_cleanup(void)
|
||||
{
|
||||
device_close_all();
|
||||
}
|
||||
|
|
2
device.c
2
device.c
|
@ -21,7 +21,7 @@
|
|||
#include <glib.h>
|
||||
#include <sigrok.h>
|
||||
|
||||
extern struct sigrok_global *global;
|
||||
extern struct sr_global *global;
|
||||
|
||||
GSList *devices = NULL;
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ struct alsa {
|
|||
|
||||
static int hw_init(char *deviceinfo)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
struct alsa *alsa;
|
||||
|
||||
/* Avoid compiler warnings. */
|
||||
|
@ -58,7 +58,7 @@ static int hw_init(char *deviceinfo)
|
|||
return 0;
|
||||
memset(alsa, 0, sizeof(struct alsa));
|
||||
|
||||
sdi = sigrok_device_instance_new(0, ST_ACTIVE, "alsa", NULL, NULL);
|
||||
sdi = sr_device_instance_new(0, ST_ACTIVE, "alsa", NULL, NULL);
|
||||
if (!sdi)
|
||||
goto free_alsa;
|
||||
|
||||
|
@ -74,11 +74,11 @@ free_alsa:
|
|||
|
||||
static int hw_opendev(int device_index)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
struct alsa *alsa;
|
||||
int err;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return SR_ERR;
|
||||
alsa = sdi->priv;
|
||||
|
||||
|
@ -109,10 +109,10 @@ static int hw_opendev(int device_index)
|
|||
|
||||
static void hw_closedev(int device_index)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
struct alsa *alsa;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return;
|
||||
alsa = sdi->priv;
|
||||
if (!alsa)
|
||||
|
@ -126,22 +126,22 @@ static void hw_closedev(int device_index)
|
|||
|
||||
static void hw_cleanup(void)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, 0)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, 0)))
|
||||
return;
|
||||
|
||||
free(sdi->priv);
|
||||
sigrok_device_instance_free(sdi);
|
||||
sr_device_instance_free(sdi);
|
||||
}
|
||||
|
||||
static void *hw_get_device_info(int device_index, int device_info_id)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
struct alsa *alsa;
|
||||
void *info = NULL;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return NULL;
|
||||
alsa = sdi->priv;
|
||||
|
||||
|
@ -178,10 +178,10 @@ static int *hw_get_capabilities(void)
|
|||
|
||||
static int hw_set_configuration(int device_index, int capability, void *value)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
struct alsa *alsa;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return SR_ERR;
|
||||
alsa = sdi->priv;
|
||||
|
||||
|
@ -201,7 +201,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
|
|||
|
||||
static int receive_data(int fd, int revents, void *user_data)
|
||||
{
|
||||
struct sigrok_device_instance *sdi = user_data;
|
||||
struct sr_device_instance *sdi = user_data;
|
||||
struct alsa *alsa = sdi->priv;
|
||||
struct datafeed_packet packet;
|
||||
struct analog_sample *sample;
|
||||
|
@ -258,7 +258,7 @@ static int receive_data(int fd, int revents, void *user_data)
|
|||
|
||||
static int hw_start_acquisition(int device_index, gpointer session_device_id)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
struct alsa *alsa;
|
||||
struct datafeed_packet packet;
|
||||
struct datafeed_header header;
|
||||
|
@ -266,7 +266,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
|
|||
int count;
|
||||
int err;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return SR_ERR;
|
||||
alsa = sdi->priv;
|
||||
|
||||
|
|
|
@ -387,7 +387,7 @@ static int bin2bitbang(const char *filename,
|
|||
|
||||
static int hw_init(char *deviceinfo)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
struct sigma *sigma = g_malloc(sizeof(struct sigma));
|
||||
|
||||
deviceinfo = deviceinfo;
|
||||
|
@ -411,7 +411,7 @@ static int hw_init(char *deviceinfo)
|
|||
sigma->use_triggers = 0;
|
||||
|
||||
/* Register SIGMA device. */
|
||||
sdi = sigrok_device_instance_new(0, ST_INITIALIZING,
|
||||
sdi = sr_device_instance_new(0, ST_INITIALIZING,
|
||||
USB_VENDOR_NAME, USB_MODEL_NAME, USB_MODEL_VERSION);
|
||||
if (!sdi)
|
||||
goto free;
|
||||
|
@ -522,11 +522,11 @@ static int upload_firmware(int firmware_idx, struct sigma *sigma)
|
|||
|
||||
static int hw_opendev(int device_index)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
struct sigma *sigma;
|
||||
int ret;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return SR_ERR;
|
||||
|
||||
sigma = sdi->priv;
|
||||
|
@ -546,7 +546,7 @@ static int hw_opendev(int device_index)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int set_samplerate(struct sigrok_device_instance *sdi,
|
||||
static int set_samplerate(struct sr_device_instance *sdi,
|
||||
uint64_t samplerate)
|
||||
{
|
||||
int i, ret;
|
||||
|
@ -589,7 +589,7 @@ static int set_samplerate(struct sigrok_device_instance *sdi,
|
|||
* The Sigma supports complex triggers using boolean expressions, but this
|
||||
* has not been implemented yet.
|
||||
*/
|
||||
static int configure_probes(struct sigrok_device_instance *sdi, GSList *probes)
|
||||
static int configure_probes(struct sr_device_instance *sdi, GSList *probes)
|
||||
{
|
||||
struct sigma *sigma = sdi->priv;
|
||||
struct probe *probe;
|
||||
|
@ -666,10 +666,10 @@ static int configure_probes(struct sigrok_device_instance *sdi, GSList *probes)
|
|||
|
||||
static void hw_closedev(int device_index)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
struct sigma *sigma;
|
||||
|
||||
if ((sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if ((sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
{
|
||||
sigma = sdi->priv;
|
||||
if (sdi->status == ST_ACTIVE)
|
||||
|
@ -682,14 +682,14 @@ static void hw_closedev(int device_index)
|
|||
static void hw_cleanup(void)
|
||||
{
|
||||
GSList *l;
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
|
||||
/* Properly close all devices. */
|
||||
for (l = device_instances; l; l = l->next) {
|
||||
sdi = l->data;
|
||||
if (sdi->priv != NULL)
|
||||
free(sdi->priv);
|
||||
sigrok_device_instance_free(sdi);
|
||||
sr_device_instance_free(sdi);
|
||||
}
|
||||
g_slist_free(device_instances);
|
||||
device_instances = NULL;
|
||||
|
@ -697,11 +697,11 @@ static void hw_cleanup(void)
|
|||
|
||||
static void *hw_get_device_info(int device_index, int device_info_id)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
struct sigma *sigma;
|
||||
void *info = NULL;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index))) {
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index))) {
|
||||
fprintf(stderr, "It's NULL.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -731,9 +731,9 @@ static void *hw_get_device_info(int device_index, int device_info_id)
|
|||
|
||||
static int hw_get_status(int device_index)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
|
||||
sdi = get_sigrok_device_instance(device_instances, device_index);
|
||||
sdi = get_sr_device_instance(device_instances, device_index);
|
||||
if (sdi)
|
||||
return sdi->status;
|
||||
else
|
||||
|
@ -747,11 +747,11 @@ static int *hw_get_capabilities(void)
|
|||
|
||||
static int hw_set_configuration(int device_index, int capability, void *value)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
struct sigma *sigma;
|
||||
int ret;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return SR_ERR;
|
||||
|
||||
sigma = sdi->priv;
|
||||
|
@ -823,7 +823,7 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
|
|||
uint16_t *lastsample, int triggerpos,
|
||||
uint16_t limit_chunk, void *user_data)
|
||||
{
|
||||
struct sigrok_device_instance *sdi = user_data;
|
||||
struct sr_device_instance *sdi = user_data;
|
||||
struct sigma *sigma = sdi->priv;
|
||||
uint16_t tsdiff, ts;
|
||||
uint16_t samples[65536 * sigma->samples_per_event];
|
||||
|
@ -952,7 +952,7 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
|
|||
|
||||
static int receive_data(int fd, int revents, void *user_data)
|
||||
{
|
||||
struct sigrok_device_instance *sdi = user_data;
|
||||
struct sr_device_instance *sdi = user_data;
|
||||
struct sigma *sigma = sdi->priv;
|
||||
struct datafeed_packet packet;
|
||||
const int chunks_per_read = 32;
|
||||
|
@ -1198,7 +1198,7 @@ static int build_basic_trigger(struct triggerlut *lut, struct sigma *sigma)
|
|||
|
||||
static int hw_start_acquisition(int device_index, gpointer session_device_id)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
struct sigma *sigma;
|
||||
struct datafeed_packet packet;
|
||||
struct datafeed_header header;
|
||||
|
@ -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_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return SR_ERR;
|
||||
|
||||
sigma = sdi->priv;
|
||||
|
@ -1316,11 +1316,11 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
|
|||
|
||||
static void hw_stop_acquisition(int device_index, gpointer session_device_id)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
struct sigma *sigma;
|
||||
uint8_t modestatus;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return;
|
||||
|
||||
sigma = sdi->priv;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include <libusb.h>
|
||||
#include <sigrok.h>
|
||||
|
||||
int opendev2(int device_index, struct sigrok_device_instance **sdi,
|
||||
int opendev2(int device_index, struct sr_device_instance **sdi,
|
||||
libusb_device *dev, struct libusb_device_descriptor *des,
|
||||
int *skip, uint16_t vid, uint16_t pid, int interface)
|
||||
{
|
||||
|
@ -60,7 +60,7 @@ int opendev2(int device_index, struct sigrok_device_instance **sdi,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int opendev3(struct sigrok_device_instance **sdi, libusb_device *dev,
|
||||
int opendev3(struct sr_device_instance **sdi, libusb_device *dev,
|
||||
struct libusb_device_descriptor *des,
|
||||
uint16_t vid, uint16_t pid, int interface)
|
||||
{
|
||||
|
|
|
@ -78,7 +78,7 @@ static uint8_t genmode_default[] = {
|
|||
0xbe, 0xbe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
/* List of struct sigrok_device_instance, maintained by opendev()/closedev(). */
|
||||
/* List of struct sr_device_instance, maintained by opendev()/closedev(). */
|
||||
static GSList *device_instances = NULL;
|
||||
static uint64_t cur_samplerate = KHZ(200);
|
||||
static uint64_t limit_samples = 0;
|
||||
|
@ -91,12 +91,12 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id);
|
|||
|
||||
static int hw_init(char *deviceinfo)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
|
||||
/* Avoid compiler warnings. */
|
||||
deviceinfo = deviceinfo;
|
||||
|
||||
sdi = sigrok_device_instance_new(0, ST_ACTIVE, DEMONAME, NULL, NULL);
|
||||
sdi = sr_device_instance_new(0, ST_ACTIVE, DEMONAME, NULL, NULL);
|
||||
if (!sdi)
|
||||
return 0;
|
||||
|
||||
|
@ -129,10 +129,10 @@ static void hw_cleanup(void)
|
|||
|
||||
static void *hw_get_device_info(int device_index, int device_info_id)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
void *info = NULL;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return NULL;
|
||||
|
||||
switch (device_info_id) {
|
||||
|
|
|
@ -58,7 +58,7 @@ static struct samplerates samplerates = {
|
|||
|
||||
static GSList *device_instances = NULL;
|
||||
|
||||
static int mso_send_control_message(struct sigrok_device_instance *sdi,
|
||||
static int mso_send_control_message(struct sr_device_instance *sdi,
|
||||
uint16_t payload[], int n)
|
||||
{
|
||||
int fd = sdi->serial->fd;
|
||||
|
@ -98,7 +98,7 @@ ret:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int mso_reset_adc(struct sigrok_device_instance *sdi)
|
||||
static int mso_reset_adc(struct sr_device_instance *sdi)
|
||||
{
|
||||
struct mso *mso = sdi->priv;
|
||||
uint16_t ops[2];
|
||||
|
@ -110,7 +110,7 @@ static int mso_reset_adc(struct sigrok_device_instance *sdi)
|
|||
return mso_send_control_message(sdi, ARRAY_AND_SIZE(ops));
|
||||
}
|
||||
|
||||
static int mso_reset_fsm(struct sigrok_device_instance *sdi)
|
||||
static int mso_reset_fsm(struct sr_device_instance *sdi)
|
||||
{
|
||||
struct mso *mso = sdi->priv;
|
||||
uint16_t ops[1];
|
||||
|
@ -121,7 +121,7 @@ static int mso_reset_fsm(struct sigrok_device_instance *sdi)
|
|||
return mso_send_control_message(sdi, ARRAY_AND_SIZE(ops));
|
||||
}
|
||||
|
||||
static int mso_toggle_led(struct sigrok_device_instance *sdi, int state)
|
||||
static int mso_toggle_led(struct sr_device_instance *sdi, int state)
|
||||
{
|
||||
struct mso *mso = sdi->priv;
|
||||
uint16_t ops[1];
|
||||
|
@ -134,7 +134,7 @@ static int mso_toggle_led(struct sigrok_device_instance *sdi, int state)
|
|||
return mso_send_control_message(sdi, ARRAY_AND_SIZE(ops));
|
||||
}
|
||||
|
||||
static int mso_check_trigger(struct sigrok_device_instance *sdi,
|
||||
static int mso_check_trigger(struct sr_device_instance *sdi,
|
||||
uint8_t *info)
|
||||
{
|
||||
uint16_t ops[] = { mso_trans(REG_TRIGGER, 0) };
|
||||
|
@ -153,14 +153,14 @@ static int mso_check_trigger(struct sigrok_device_instance *sdi,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int mso_read_buffer(struct sigrok_device_instance *sdi)
|
||||
static int mso_read_buffer(struct sr_device_instance *sdi)
|
||||
{
|
||||
uint16_t ops[] = { mso_trans(REG_BUFFER, 0) };
|
||||
|
||||
return mso_send_control_message(sdi, ARRAY_AND_SIZE(ops));
|
||||
}
|
||||
|
||||
static int mso_arm(struct sigrok_device_instance *sdi)
|
||||
static int mso_arm(struct sr_device_instance *sdi)
|
||||
{
|
||||
struct mso *mso = sdi->priv;
|
||||
uint16_t ops[] = {
|
||||
|
@ -172,7 +172,7 @@ static int mso_arm(struct sigrok_device_instance *sdi)
|
|||
return mso_send_control_message(sdi, ARRAY_AND_SIZE(ops));
|
||||
}
|
||||
|
||||
static int mso_force_capture(struct sigrok_device_instance *sdi)
|
||||
static int mso_force_capture(struct sr_device_instance *sdi)
|
||||
{
|
||||
struct mso *mso = sdi->priv;
|
||||
uint16_t ops[] = {
|
||||
|
@ -183,7 +183,7 @@ static int mso_force_capture(struct sigrok_device_instance *sdi)
|
|||
return mso_send_control_message(sdi, ARRAY_AND_SIZE(ops));
|
||||
}
|
||||
|
||||
static int mso_dac_out(struct sigrok_device_instance *sdi, uint16_t val)
|
||||
static int mso_dac_out(struct sr_device_instance *sdi, uint16_t val)
|
||||
{
|
||||
struct mso *mso = sdi->priv;
|
||||
uint16_t ops[] = {
|
||||
|
@ -195,7 +195,7 @@ static int mso_dac_out(struct sigrok_device_instance *sdi, uint16_t val)
|
|||
return mso_send_control_message(sdi, ARRAY_AND_SIZE(ops));
|
||||
}
|
||||
|
||||
static int mso_clkrate_out(struct sigrok_device_instance *sdi, uint16_t val)
|
||||
static int mso_clkrate_out(struct sr_device_instance *sdi, uint16_t val)
|
||||
{
|
||||
uint16_t ops[] = {
|
||||
mso_trans(REG_CLKRATE1, (val >> 8) & 0xff),
|
||||
|
@ -205,7 +205,7 @@ static int mso_clkrate_out(struct sigrok_device_instance *sdi, uint16_t val)
|
|||
return mso_send_control_message(sdi, ARRAY_AND_SIZE(ops));
|
||||
}
|
||||
|
||||
static int mso_configure_rate(struct sigrok_device_instance *sdi,
|
||||
static int mso_configure_rate(struct sr_device_instance *sdi,
|
||||
uint32_t rate)
|
||||
{
|
||||
struct mso *mso = sdi->priv;
|
||||
|
@ -232,7 +232,7 @@ static inline uint16_t mso_calc_raw_from_mv(struct mso *mso)
|
|||
mso->vbit));
|
||||
}
|
||||
|
||||
static int mso_configure_trigger(struct sigrok_device_instance *sdi)
|
||||
static int mso_configure_trigger(struct sr_device_instance *sdi)
|
||||
{
|
||||
struct mso *mso = sdi->priv;
|
||||
uint16_t ops[16];
|
||||
|
@ -302,7 +302,7 @@ static int mso_configure_trigger(struct sigrok_device_instance *sdi)
|
|||
return mso_send_control_message(sdi, ARRAY_AND_SIZE(ops));
|
||||
}
|
||||
|
||||
static int mso_configure_threshold_level(struct sigrok_device_instance *sdi)
|
||||
static int mso_configure_threshold_level(struct sr_device_instance *sdi)
|
||||
{
|
||||
struct mso *mso = sdi->priv;
|
||||
|
||||
|
@ -350,7 +350,7 @@ static int mso_parse_serial(const char *iSerial, const char *iProduct,
|
|||
|
||||
static int hw_init(char *deviceinfo)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
int devcnt = 0;
|
||||
struct udev *udev;
|
||||
struct udev_enumerate *enumerate;
|
||||
|
@ -425,7 +425,7 @@ static int hw_init(char *deviceinfo)
|
|||
/* hardware initial state */
|
||||
mso->ctlbase = 0;
|
||||
|
||||
sdi = sigrok_device_instance_new(devcnt, ST_INITIALIZING,
|
||||
sdi = sr_device_instance_new(devcnt, ST_INITIALIZING,
|
||||
manufacturer, product, hwrev);
|
||||
if (!sdi) {
|
||||
g_warning("Unable to create device instance for %s",
|
||||
|
@ -445,7 +445,7 @@ static int hw_init(char *deviceinfo)
|
|||
continue;
|
||||
|
||||
err_device_instance_free:
|
||||
sigrok_device_instance_free(sdi);
|
||||
sr_device_instance_free(sdi);
|
||||
err_free_mso:
|
||||
free(mso);
|
||||
}
|
||||
|
@ -460,7 +460,7 @@ ret:
|
|||
static void hw_cleanup(void)
|
||||
{
|
||||
GSList *l;
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
|
||||
/* Properly close all devices. */
|
||||
for (l = device_instances; l; l = l->next) {
|
||||
|
@ -469,7 +469,7 @@ static void hw_cleanup(void)
|
|||
serial_close(sdi->serial->fd);
|
||||
if (sdi->priv != NULL)
|
||||
free(sdi->priv);
|
||||
sigrok_device_instance_free(sdi);
|
||||
sr_device_instance_free(sdi);
|
||||
}
|
||||
g_slist_free(device_instances);
|
||||
device_instances = NULL;
|
||||
|
@ -477,11 +477,11 @@ static void hw_cleanup(void)
|
|||
|
||||
static int hw_opendev(int device_index)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
struct mso *mso;
|
||||
int ret = SR_ERR;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return ret;
|
||||
|
||||
mso = sdi->priv;
|
||||
|
@ -517,9 +517,9 @@ static int hw_opendev(int device_index)
|
|||
|
||||
static void hw_closedev(int device_index)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return;
|
||||
|
||||
if (sdi->serial->fd != -1) {
|
||||
|
@ -531,11 +531,11 @@ static void hw_closedev(int device_index)
|
|||
|
||||
static void *hw_get_device_info(int device_index, int device_info_id)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
struct mso *mso;
|
||||
void *info = NULL;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return NULL;
|
||||
mso = sdi->priv;
|
||||
|
||||
|
@ -561,9 +561,9 @@ static void *hw_get_device_info(int device_index, int device_info_id)
|
|||
|
||||
static int hw_get_status(int device_index)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return ST_NOT_FOUND;
|
||||
|
||||
return sdi->status;
|
||||
|
@ -576,9 +576,9 @@ static int *hw_get_capabilities(void)
|
|||
|
||||
static int hw_set_configuration(int device_index, int capability, void *value)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return SR_ERR;
|
||||
|
||||
switch (capability) {
|
||||
|
@ -603,7 +603,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
|
|||
/* FIXME: Pass errors? */
|
||||
static int receive_data(int fd, int revents, void *user_data)
|
||||
{
|
||||
struct sigrok_device_instance *sdi = user_data;
|
||||
struct sr_device_instance *sdi = user_data;
|
||||
struct mso *mso = sdi->priv;
|
||||
struct datafeed_packet packet;
|
||||
uint8_t in[1024], logic_out[1024];
|
||||
|
@ -666,13 +666,13 @@ static int receive_data(int fd, int revents, void *user_data)
|
|||
|
||||
static int hw_start_acquisition(int device_index, gpointer session_device_id)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
struct mso *mso;
|
||||
struct datafeed_packet packet;
|
||||
struct datafeed_header header;
|
||||
int ret = SR_ERR;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return ret;
|
||||
mso = sdi->priv;
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ static uint32_t reverse32(uint32_t in)
|
|||
|
||||
static int hw_init(char *deviceinfo)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
GSList *ports, *l;
|
||||
GPollFD *fds;
|
||||
int devcnt, final_devcnt, num_ports, fd, ret, i;
|
||||
|
@ -286,12 +286,12 @@ static int hw_init(char *deviceinfo)
|
|||
if (!strncmp(buf, "1SLO", 4)
|
||||
|| !strncmp(buf, "1ALS", 4)) {
|
||||
if (!strncmp(buf, "1SLO", 4))
|
||||
sdi = sigrok_device_instance_new
|
||||
sdi = sr_device_instance_new
|
||||
(final_devcnt, ST_INACTIVE,
|
||||
"Openbench",
|
||||
"Logic Sniffer", "v1.0");
|
||||
else
|
||||
sdi = sigrok_device_instance_new
|
||||
sdi = sr_device_instance_new
|
||||
(final_devcnt, ST_INACTIVE,
|
||||
"Openbench", "Logic Sniffer",
|
||||
"v1.0");
|
||||
|
@ -326,9 +326,9 @@ static int hw_init(char *deviceinfo)
|
|||
|
||||
static int hw_opendev(int device_index)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return SR_ERR;
|
||||
|
||||
sdi->serial->fd = serial_open(sdi->serial->port, O_RDWR);
|
||||
|
@ -342,9 +342,9 @@ static int hw_opendev(int device_index)
|
|||
|
||||
static void hw_closedev(int device_index)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return;
|
||||
|
||||
if (sdi->serial->fd != -1) {
|
||||
|
@ -357,14 +357,14 @@ static void hw_closedev(int device_index)
|
|||
static void hw_cleanup(void)
|
||||
{
|
||||
GSList *l;
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
|
||||
/* Properly close all devices. */
|
||||
for (l = device_instances; l; l = l->next) {
|
||||
sdi = l->data;
|
||||
if (sdi->serial->fd != -1)
|
||||
serial_close(sdi->serial->fd);
|
||||
sigrok_device_instance_free(sdi);
|
||||
sr_device_instance_free(sdi);
|
||||
}
|
||||
g_slist_free(device_instances);
|
||||
device_instances = NULL;
|
||||
|
@ -372,10 +372,10 @@ static void hw_cleanup(void)
|
|||
|
||||
static void *hw_get_device_info(int device_index, int device_info_id)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
void *info;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return NULL;
|
||||
|
||||
info = NULL;
|
||||
|
@ -402,9 +402,9 @@ static void *hw_get_device_info(int device_index, int device_info_id)
|
|||
|
||||
static int hw_get_status(int device_index)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return ST_NOT_FOUND;
|
||||
|
||||
return sdi->status;
|
||||
|
@ -415,7 +415,7 @@ static int *hw_get_capabilities(void)
|
|||
return capabilities;
|
||||
}
|
||||
|
||||
static int set_configuration_samplerate(struct sigrok_device_instance *sdi,
|
||||
static int set_configuration_samplerate(struct sr_device_instance *sdi,
|
||||
uint64_t samplerate)
|
||||
{
|
||||
uint32_t divider;
|
||||
|
@ -443,11 +443,11 @@ static int set_configuration_samplerate(struct sigrok_device_instance *sdi,
|
|||
|
||||
static int hw_set_configuration(int device_index, int capability, void *value)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
int ret;
|
||||
uint64_t *tmp_u64;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return SR_ERR;
|
||||
|
||||
if (sdi->status != ST_ACTIVE)
|
||||
|
@ -652,13 +652,13 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
|
|||
int i;
|
||||
struct datafeed_packet *packet;
|
||||
struct datafeed_header *header;
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
uint32_t trigger_config[4];
|
||||
uint32_t data;
|
||||
uint16_t readcount, delaycount;
|
||||
uint8_t changrp_mask;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return SR_ERR;
|
||||
|
||||
if (sdi->status != ST_ACTIVE)
|
||||
|
|
|
@ -59,7 +59,7 @@ static int capabilities[] = {
|
|||
0,
|
||||
};
|
||||
|
||||
/* List of struct sigrok_device_instance, maintained by opendev()/closedev(). */
|
||||
/* List of struct sr_device_instance, maintained by opendev()/closedev(). */
|
||||
static GSList *device_instances = NULL;
|
||||
|
||||
/*
|
||||
|
@ -166,14 +166,14 @@ int check_conf_profile(libusb_device *dev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
struct sigrok_device_instance *sl_open_device(int device_index)
|
||||
struct sr_device_instance *sl_open_device(int device_index)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
libusb_device **devlist;
|
||||
struct libusb_device_descriptor des;
|
||||
int err, skip, i;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return NULL;
|
||||
|
||||
libusb_get_device_list(usb_context, &devlist);
|
||||
|
@ -228,7 +228,7 @@ int upload_firmware(libusb_device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void close_device(struct sigrok_device_instance *sdi)
|
||||
static void close_device(struct sr_device_instance *sdi)
|
||||
{
|
||||
if (sdi->usb->devhdl == NULL)
|
||||
return;
|
||||
|
@ -293,7 +293,7 @@ static int configure_probes(GSList *probes)
|
|||
|
||||
static int hw_init(char *deviceinfo)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
struct libusb_device_descriptor des;
|
||||
libusb_device **devlist;
|
||||
int err, devcnt, i;
|
||||
|
@ -319,7 +319,7 @@ static int hw_init(char *deviceinfo)
|
|||
if (des.idVendor != USB_VENDOR || des.idProduct != USB_PRODUCT)
|
||||
continue; /* Not a Saleae Logic... */
|
||||
|
||||
sdi = sigrok_device_instance_new(devcnt, ST_INITIALIZING,
|
||||
sdi = sr_device_instance_new(devcnt, ST_INITIALIZING,
|
||||
USB_VENDOR_NAME, USB_MODEL_NAME, USB_MODEL_VERSION);
|
||||
if (!sdi)
|
||||
return 0;
|
||||
|
@ -353,7 +353,7 @@ static int hw_init(char *deviceinfo)
|
|||
static int hw_opendev(int device_index)
|
||||
{
|
||||
GTimeVal cur_time;
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
int timediff, err;
|
||||
unsigned int cur, upd;
|
||||
|
||||
|
@ -396,9 +396,9 @@ static int hw_opendev(int device_index)
|
|||
|
||||
static void hw_closedev(int device_index)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
|
||||
if ((sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if ((sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
close_device(sdi);
|
||||
}
|
||||
|
||||
|
@ -408,7 +408,7 @@ static void hw_cleanup(void)
|
|||
|
||||
/* Properly close all devices... */
|
||||
for (l = device_instances; l; l = l->next)
|
||||
close_device((struct sigrok_device_instance *)l->data);
|
||||
close_device((struct sr_device_instance *)l->data);
|
||||
|
||||
/* ...and free all their memory. */
|
||||
for (l = device_instances; l; l = l->next)
|
||||
|
@ -423,10 +423,10 @@ static void hw_cleanup(void)
|
|||
|
||||
static void *hw_get_device_info(int device_index, int device_info_id)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
void *info = NULL;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return NULL;
|
||||
|
||||
switch (device_info_id) {
|
||||
|
@ -452,9 +452,9 @@ static void *hw_get_device_info(int device_index, int device_info_id)
|
|||
|
||||
static int hw_get_status(int device_index)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
|
||||
sdi = get_sigrok_device_instance(device_instances, device_index);
|
||||
sdi = get_sr_device_instance(device_instances, device_index);
|
||||
if (sdi)
|
||||
return sdi->status;
|
||||
else
|
||||
|
@ -466,7 +466,7 @@ static int *hw_get_capabilities(void)
|
|||
return capabilities;
|
||||
}
|
||||
|
||||
static int set_configuration_samplerate(struct sigrok_device_instance *sdi,
|
||||
static int set_configuration_samplerate(struct sr_device_instance *sdi,
|
||||
uint64_t samplerate)
|
||||
{
|
||||
uint8_t divider;
|
||||
|
@ -499,11 +499,11 @@ static int set_configuration_samplerate(struct sigrok_device_instance *sdi,
|
|||
|
||||
static int hw_set_configuration(int device_index, int capability, void *value)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
int ret;
|
||||
uint64_t *tmp_u64;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return SR_ERR;
|
||||
|
||||
if (capability == HWCAP_SAMPLERATE) {
|
||||
|
@ -669,7 +669,7 @@ void receive_transfer(struct libusb_transfer *transfer)
|
|||
|
||||
static int hw_start_acquisition(int device_index, gpointer session_device_id)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
struct datafeed_packet *packet;
|
||||
struct datafeed_header *header;
|
||||
struct libusb_transfer *transfer;
|
||||
|
@ -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_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return SR_ERR;
|
||||
|
||||
packet = g_malloc(sizeof(struct datafeed_packet));
|
||||
|
|
|
@ -72,7 +72,7 @@ static int capabilities[] = {
|
|||
0,
|
||||
};
|
||||
|
||||
/* List of struct sigrok_device_instance, maintained by opendev()/closedev(). */
|
||||
/* List of struct sr_device_instance, maintained by opendev()/closedev(). */
|
||||
static GSList *device_instances = NULL;
|
||||
|
||||
static libusb_context *usb_context = NULL;
|
||||
|
@ -140,7 +140,7 @@ static unsigned int get_memory_size(int type)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int opendev4(struct sigrok_device_instance **sdi, libusb_device *dev,
|
||||
static int opendev4(struct sr_device_instance **sdi, libusb_device *dev,
|
||||
struct libusb_device_descriptor *des)
|
||||
{
|
||||
unsigned int i;
|
||||
|
@ -189,14 +189,14 @@ static int opendev4(struct sigrok_device_instance **sdi, libusb_device *dev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
struct sigrok_device_instance *zp_open_device(int device_index)
|
||||
struct sr_device_instance *zp_open_device(int device_index)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
libusb_device **devlist;
|
||||
struct libusb_device_descriptor des;
|
||||
int err, i;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return NULL;
|
||||
|
||||
libusb_get_device_list(usb_context, &devlist);
|
||||
|
@ -219,7 +219,7 @@ struct sigrok_device_instance *zp_open_device(int device_index)
|
|||
return sdi;
|
||||
}
|
||||
|
||||
static void close_device(struct sigrok_device_instance *sdi)
|
||||
static void close_device(struct sr_device_instance *sdi)
|
||||
{
|
||||
if (!sdi->usb->devhdl)
|
||||
return;
|
||||
|
@ -275,7 +275,7 @@ static int configure_probes(GSList *probes)
|
|||
|
||||
static int hw_init(char *deviceinfo)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
struct libusb_device_descriptor des;
|
||||
libusb_device **devlist;
|
||||
int err, devcnt, i;
|
||||
|
@ -305,7 +305,7 @@ static int hw_init(char *deviceinfo)
|
|||
* TODO: Any way to detect specific model/version in
|
||||
* the zeroplus range?
|
||||
*/
|
||||
sdi = sigrok_device_instance_new(devcnt,
|
||||
sdi = sr_device_instance_new(devcnt,
|
||||
ST_INACTIVE, USB_VENDOR_NAME,
|
||||
USB_MODEL_NAME, USB_MODEL_VERSION);
|
||||
if (!sdi)
|
||||
|
@ -325,7 +325,7 @@ static int hw_init(char *deviceinfo)
|
|||
|
||||
static int hw_opendev(int device_index)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
int err;
|
||||
|
||||
if (!(sdi = zp_open_device(device_index))) {
|
||||
|
@ -370,9 +370,9 @@ static int hw_opendev(int device_index)
|
|||
|
||||
static void hw_closedev(int device_index)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
|
||||
if ((sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if ((sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
close_device(sdi);
|
||||
}
|
||||
|
||||
|
@ -382,7 +382,7 @@ static void hw_cleanup(void)
|
|||
|
||||
/* Properly close all devices... */
|
||||
for (l = device_instances; l; l = l->next)
|
||||
close_device((struct sigrok_device_instance *)l->data);
|
||||
close_device((struct sr_device_instance *)l->data);
|
||||
|
||||
/* ...and free all their memory. */
|
||||
for (l = device_instances; l; l = l->next)
|
||||
|
@ -397,10 +397,10 @@ static void hw_cleanup(void)
|
|||
|
||||
static void *hw_get_device_info(int device_index, int device_info_id)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
void *info = NULL;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return NULL;
|
||||
|
||||
switch (device_info_id) {
|
||||
|
@ -426,9 +426,9 @@ static void *hw_get_device_info(int device_index, int device_info_id)
|
|||
|
||||
static int hw_get_status(int device_index)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
|
||||
sdi = get_sigrok_device_instance(device_instances, device_index);
|
||||
sdi = get_sr_device_instance(device_instances, device_index);
|
||||
if (sdi)
|
||||
return sdi->status;
|
||||
else
|
||||
|
@ -458,10 +458,10 @@ static int set_configuration_samplerate(uint64_t samplerate)
|
|||
|
||||
static int hw_set_configuration(int device_index, int capability, void *value)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
uint64_t *tmp_u64;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return SR_ERR;
|
||||
|
||||
switch (capability) {
|
||||
|
@ -481,14 +481,14 @@ static int hw_set_configuration(int device_index, int capability, void *value)
|
|||
|
||||
static int hw_start_acquisition(int device_index, gpointer session_device_id)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
struct datafeed_packet packet;
|
||||
struct datafeed_header header;
|
||||
int res;
|
||||
unsigned int packet_num;
|
||||
unsigned char *buf;
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return SR_ERR;
|
||||
|
||||
/* push configured settings to device */
|
||||
|
@ -548,12 +548,12 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
|
|||
static void hw_stop_acquisition(int device_index, gpointer session_device_id)
|
||||
{
|
||||
struct datafeed_packet packet;
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
|
||||
packet.type = DF_END;
|
||||
session_bus(session_device_id, &packet);
|
||||
|
||||
if (!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
if (!(sdi = get_sr_device_instance(device_instances, device_index)))
|
||||
return; /* TODO: Cry? */
|
||||
|
||||
analyzer_reset(sdi->usb->devhdl);
|
||||
|
|
14
hwplugin.c
14
hwplugin.c
|
@ -99,12 +99,12 @@ GSList *list_hwplugins(void)
|
|||
return plugins;
|
||||
}
|
||||
|
||||
struct sigrok_device_instance *sigrok_device_instance_new(int index, int status,
|
||||
struct sr_device_instance *sr_device_instance_new(int index, int status,
|
||||
const char *vendor, const char *model, const char *version)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
|
||||
if (!(sdi = malloc(sizeof(struct sigrok_device_instance))))
|
||||
if (!(sdi = malloc(sizeof(struct sr_device_instance))))
|
||||
return NULL;
|
||||
|
||||
sdi->index = index;
|
||||
|
@ -119,14 +119,14 @@ struct sigrok_device_instance *sigrok_device_instance_new(int index, int status,
|
|||
return sdi;
|
||||
}
|
||||
|
||||
struct sigrok_device_instance *get_sigrok_device_instance(
|
||||
struct sr_device_instance *get_sr_device_instance(
|
||||
GSList *device_instances, int device_index)
|
||||
{
|
||||
struct sigrok_device_instance *sdi;
|
||||
struct sr_device_instance *sdi;
|
||||
GSList *l;
|
||||
|
||||
for (l = device_instances; l; l = l->next) {
|
||||
sdi = (struct sigrok_device_instance *)(l->data);
|
||||
sdi = (struct sr_device_instance *)(l->data);
|
||||
if (sdi->index == device_index)
|
||||
return sdi;
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ struct sigrok_device_instance *get_sigrok_device_instance(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void sigrok_device_instance_free(struct sigrok_device_instance *sdi)
|
||||
void sr_device_instance_free(struct sr_device_instance *sdi)
|
||||
{
|
||||
switch (sdi->instance_type) {
|
||||
case USB_INSTANCE:
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
* @return A malloc()ed string representation of the samplerate value,
|
||||
* or NULL upon errors. The caller is responsible to free() the memory.
|
||||
*/
|
||||
char *sigrok_samplerate_string(uint64_t samplerate)
|
||||
char *sr_samplerate_string(uint64_t samplerate)
|
||||
{
|
||||
char *o;
|
||||
int r;
|
||||
|
@ -69,7 +69,7 @@ char *sigrok_samplerate_string(uint64_t samplerate)
|
|||
* @return A malloc()ed string representation of the frequency value,
|
||||
* or NULL upon errors. The caller is responsible to free() the memory.
|
||||
*/
|
||||
char *sigrok_period_string(uint64_t frequency)
|
||||
char *sr_period_string(uint64_t frequency)
|
||||
{
|
||||
char *o;
|
||||
int r;
|
||||
|
|
|
@ -136,7 +136,7 @@ static int init(struct sr_output *o, int default_spl, enum outputmode mode)
|
|||
if (o->device->plugin) {
|
||||
samplerate = *((uint64_t *) o->device->plugin->get_device_info(
|
||||
o->device->plugin_index, DI_CUR_SAMPLERATE));
|
||||
if (!(samplerate_s = sigrok_samplerate_string(samplerate))) {
|
||||
if (!(samplerate_s = sr_samplerate_string(samplerate))) {
|
||||
free(ctx->header);
|
||||
free(ctx);
|
||||
return SR_ERR;
|
||||
|
|
|
@ -82,7 +82,7 @@ static int init(struct sr_output *o)
|
|||
if (o->device->plugin) {
|
||||
samplerate = *((uint64_t *) o->device->plugin->get_device_info(
|
||||
o->device->plugin_index, DI_CUR_SAMPLERATE));
|
||||
if (!(frequency_s = sigrok_samplerate_string(samplerate))) {
|
||||
if (!(frequency_s = sr_samplerate_string(samplerate))) {
|
||||
free(ctx->header);
|
||||
free(ctx);
|
||||
return SR_ERR;
|
||||
|
@ -99,7 +99,7 @@ static int init(struct sr_output *o)
|
|||
sprintf(c, "# %d\t\t%s\n", i + 1, ctx->probelist[i]);
|
||||
}
|
||||
|
||||
if (!(frequency_s = sigrok_period_string(samplerate))) {
|
||||
if (!(frequency_s = sr_period_string(samplerate))) {
|
||||
free(ctx->header);
|
||||
free(ctx);
|
||||
return SR_ERR;
|
||||
|
@ -229,7 +229,7 @@ static int analog_init(struct sr_output *o)
|
|||
if (o->device->plugin) {
|
||||
samplerate = *((uint64_t *) o->device->plugin->get_device_info(
|
||||
o->device->plugin_index, DI_CUR_SAMPLERATE));
|
||||
if (!(frequency_s = sigrok_samplerate_string(samplerate))) {
|
||||
if (!(frequency_s = sr_samplerate_string(samplerate))) {
|
||||
free(ctx->header);
|
||||
free(ctx);
|
||||
return SR_ERR;
|
||||
|
@ -246,7 +246,7 @@ static int analog_init(struct sr_output *o)
|
|||
sprintf(c, "# %d\t\t%s\n", i + 1, ctx->probelist[i]);
|
||||
}
|
||||
|
||||
if (!(frequency_s = sigrok_period_string(samplerate))) {
|
||||
if (!(frequency_s = sr_period_string(samplerate))) {
|
||||
free(ctx->header);
|
||||
free(ctx);
|
||||
return SR_ERR;
|
||||
|
|
|
@ -105,7 +105,7 @@ static int init(struct sr_output *o)
|
|||
if (o->device->plugin) {
|
||||
samplerate = *((uint64_t *) o->device->plugin->get_device_info(
|
||||
o->device->plugin_index, DI_CUR_SAMPLERATE));
|
||||
if (!(frequency_s = sigrok_samplerate_string(samplerate))) {
|
||||
if (!(frequency_s = sr_samplerate_string(samplerate))) {
|
||||
free(ctx->header);
|
||||
free(ctx);
|
||||
return SR_ERR;
|
||||
|
@ -122,7 +122,7 @@ static int init(struct sr_output *o)
|
|||
sprintf(c, "# %d\t\t%s\n", i + 1, ctx->probelist[i]);
|
||||
}
|
||||
|
||||
if (!(frequency_s = sigrok_period_string(samplerate))) {
|
||||
if (!(frequency_s = sr_period_string(samplerate))) {
|
||||
free(ctx->header);
|
||||
free(ctx);
|
||||
return SR_ERR;
|
||||
|
|
|
@ -94,7 +94,7 @@ static int init(struct sr_output *o)
|
|||
if (o->device->plugin) {
|
||||
ctx->samplerate = *((uint64_t *) o->device->plugin->get_device_info(
|
||||
o->device->plugin_index, DI_CUR_SAMPLERATE));
|
||||
if (!((samplerate_s = sigrok_samplerate_string(ctx->samplerate)))) {
|
||||
if (!((samplerate_s = sr_samplerate_string(ctx->samplerate)))) {
|
||||
g_string_free(ctx->header, TRUE);
|
||||
free(ctx);
|
||||
return SR_ERR;
|
||||
|
@ -112,7 +112,7 @@ static int init(struct sr_output *o)
|
|||
ctx->period = MHZ(1);
|
||||
else
|
||||
ctx->period = KHZ(1);
|
||||
if (!(frequency_s = sigrok_period_string(ctx->period))) {
|
||||
if (!(frequency_s = sr_period_string(ctx->period))) {
|
||||
g_string_free(ctx->header, TRUE);
|
||||
free(ctx);
|
||||
return SR_ERR;
|
||||
|
|
|
@ -110,7 +110,7 @@ int init(struct sr_output *o, int default_spl, enum outputmode mode)
|
|||
if (o->device->plugin) {
|
||||
samplerate = *((uint64_t *) o->device->plugin->get_device_info(
|
||||
o->device->plugin_index, DI_CUR_SAMPLERATE));
|
||||
if (!(samplerate_s = sigrok_samplerate_string(samplerate))) {
|
||||
if (!(samplerate_s = sr_samplerate_string(samplerate))) {
|
||||
free(ctx->header);
|
||||
free(ctx);
|
||||
return SR_ERR;
|
||||
|
|
|
@ -42,10 +42,10 @@ int ezusb_upload_firmware(libusb_device *dev, int configuration,
|
|||
|
||||
/*--- hardware/common/misc.c ------------------------------------------------*/
|
||||
|
||||
int opendev2(int device_index, struct sigrok_device_instance **sdi,
|
||||
int opendev2(int device_index, struct sr_device_instance **sdi,
|
||||
libusb_device *dev, struct libusb_device_descriptor *des,
|
||||
int *skip, uint16_t vid, uint16_t pid, int interface);
|
||||
int opendev3(struct sigrok_device_instance **sdi, libusb_device *dev,
|
||||
int opendev3(struct sr_device_instance **sdi, libusb_device *dev,
|
||||
struct libusb_device_descriptor *des,
|
||||
uint16_t vid, uint16_t pid, int interface);
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
/*--- backend.c -------------------------------------------------------------*/
|
||||
|
||||
int sigrok_init(void);
|
||||
void sigrok_cleanup(void);
|
||||
int sr_init(void);
|
||||
void sr_cleanup(void);
|
||||
|
||||
/*--- datastore.c -----------------------------------------------------------*/
|
||||
|
||||
|
@ -63,11 +63,11 @@ int load_hwplugins(void);
|
|||
GSList *list_hwplugins(void);
|
||||
|
||||
/* Generic device instances */
|
||||
struct sigrok_device_instance *sigrok_device_instance_new(int index,
|
||||
struct sr_device_instance *sr_device_instance_new(int index,
|
||||
int status, const char *vendor, const char *model, const char *version);
|
||||
struct sigrok_device_instance *get_sigrok_device_instance(
|
||||
struct sr_device_instance *get_sr_device_instance(
|
||||
GSList *device_instances, int device_index);
|
||||
void sigrok_device_instance_free(struct sigrok_device_instance *sdi);
|
||||
void sr_device_instance_free(struct sr_device_instance *sdi);
|
||||
|
||||
/* USB-specific instances */
|
||||
struct usb_device_instance *usb_device_instance_new(uint8_t bus,
|
||||
|
@ -130,7 +130,7 @@ struct sr_output_format **sr_output_list(void);
|
|||
|
||||
/*--- output/common.c -------------------------------------------------------*/
|
||||
|
||||
char *sigrok_samplerate_string(uint64_t samplerate);
|
||||
char *sigrok_period_string(uint64_t frequency);
|
||||
char *sr_samplerate_string(uint64_t samplerate);
|
||||
char *sr_period_string(uint64_t frequency);
|
||||
|
||||
#endif
|
||||
|
|
6
sigrok.h
6
sigrok.h
|
@ -237,7 +237,7 @@ struct hwcap_option {
|
|||
char *shortname;
|
||||
};
|
||||
|
||||
struct sigrok_device_instance {
|
||||
struct sr_device_instance {
|
||||
int index;
|
||||
int status;
|
||||
int instance_type;
|
||||
|
@ -251,7 +251,7 @@ struct sigrok_device_instance {
|
|||
};
|
||||
};
|
||||
|
||||
/* sigrok_device_instance types */
|
||||
/* sr_device_instance types */
|
||||
enum {
|
||||
USB_INSTANCE,
|
||||
SERIAL_INSTANCE,
|
||||
|
@ -286,7 +286,7 @@ enum {
|
|||
|
||||
/* Device info IDs */
|
||||
enum {
|
||||
/* struct sigrok_device_instance for this specific device */
|
||||
/* struct sr_device_instance for this specific device */
|
||||
DI_INSTANCE,
|
||||
/* The number of probes connected to this device */
|
||||
DI_NUM_PROBES,
|
||||
|
|
Loading…
Reference in New Issue