/* TODO: Should return int to be able to report back error codes. */
void sr_exit(void)
{
- device_close_all();
+ sr_device_close_all();
}
GSList *devices = NULL;
-void device_scan(void)
+void sr_device_scan(void)
{
GSList *plugins, *l;
struct sr_device_plugin *plugin;
*/
for (l = plugins; l; l = l->next) {
plugin = l->data;
- device_plugin_init(plugin);
+ sr_device_plugin_init(plugin);
}
}
-int device_plugin_init(struct sr_device_plugin *plugin)
+int sr_device_plugin_init(struct sr_device_plugin *plugin)
{
int num_devices, num_probes, i;
num_devices = plugin->init(NULL);
for (i = 0; i < num_devices; i++) {
num_probes = (int)plugin->get_device_info(i, SR_DI_NUM_PROBES);
- device_new(plugin, i, num_probes);
+ sr_device_new(plugin, i, num_probes);
}
return num_devices;
}
-void device_close_all(void)
+void sr_device_close_all(void)
{
struct sr_device *device;
device = devices->data;
if (device->plugin && device->plugin->close)
device->plugin->close(device->plugin_index);
- device_destroy(device);
+ sr_device_destroy(device);
}
}
-GSList *device_list(void)
+GSList *sr_device_list(void)
{
if (!devices)
- device_scan();
+ sr_device_scan();
return devices;
}
-struct sr_device *device_new(struct sr_device_plugin *plugin, int plugin_index,
+struct sr_device *sr_device_new(struct sr_device_plugin *plugin, int plugin_index,
int num_probes)
{
struct sr_device *device;
devices = g_slist_append(devices, device);
for (i = 0; i < num_probes; i++)
- device_probe_add(device, NULL);
+ sr_device_probe_add(device, NULL);
return device;
}
-void device_clear(struct sr_device *device)
+void sr_device_clear(struct sr_device *device)
{
unsigned int pnum;
return;
for (pnum = 1; pnum <= g_slist_length(device->probes); pnum++)
- device_probe_clear(device, pnum);
+ sr_device_probe_clear(device, pnum);
}
-void device_destroy(struct sr_device *device)
+void sr_device_destroy(struct sr_device *device)
{
unsigned int pnum;
devices = g_slist_remove(devices, device);
if (device->probes) {
for (pnum = 1; pnum <= g_slist_length(device->probes); pnum++)
- device_probe_clear(device, pnum);
+ sr_device_probe_clear(device, pnum);
g_slist_free(device->probes);
}
g_free(device);
}
-void device_probe_clear(struct sr_device *device, int probenum)
+void sr_device_probe_clear(struct sr_device *device, int probenum)
{
struct sr_probe *p;
}
}
-void device_probe_add(struct sr_device *device, char *name)
+void sr_device_probe_add(struct sr_device *device, char *name)
{
struct sr_probe *p;
char probename[16];
}
/* TODO: return SIGROK_ERR if probenum not found */
-void device_probe_name(struct sr_device *device, int probenum, char *name)
+void sr_device_probe_name(struct sr_device *device, int probenum, char *name)
{
struct sr_probe *p;
}
/* TODO: return SIGROK_ERR if probenum not found */
-void device_trigger_clear(struct sr_device *device)
+void sr_device_trigger_clear(struct sr_device *device)
{
struct sr_probe *p;
unsigned int pnum;
}
/* TODO: return SIGROK_ERR if probenum not found */
-void device_trigger_set(struct sr_device *device, int probenum, char *trigger)
+void sr_device_trigger_set(struct sr_device *device, int probenum, char *trigger)
{
struct sr_probe *p;
}
-gboolean device_has_hwcap(struct sr_device *device, int hwcap)
+gboolean sr_device_has_hwcap(struct sr_device *device, int hwcap)
{
int *capabilities, i;
num_probes = DEFAULT_NUM_PROBES;
/* create a virtual device */
- in->vdevice = device_new(NULL, 0, num_probes);
+ in->vdevice = sr_device_new(NULL, 0, num_probes);
return SR_OK;
}
snprintf(ctx->header, 511, "%s\n", PACKAGE_STRING);
num_probes = g_slist_length(o->device->probes);
- if (o->device->plugin && device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
+ if (o->device->plugin && sr_device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
samplerate = *((uint64_t *) o->device->plugin->get_device_info(
o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
if (!(samplerate_s = sr_samplerate_string(samplerate))) {
num_probes = g_slist_length(o->device->probes);
comment[0] = '\0';
- if (o->device->plugin && device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
+ if (o->device->plugin && sr_device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
samplerate = *((uint64_t *) o->device->plugin->get_device_info(
o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
if (!(frequency_s = sr_samplerate_string(samplerate))) {
num_probes = g_slist_length(o->device->probes);
comment[0] = '\0';
- if (o->device->plugin && device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
+ if (o->device->plugin && sr_device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
samplerate = *((uint64_t *) o->device->plugin->get_device_info(
o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
if (!(frequency_s = sr_samplerate_string(samplerate))) {
ctx = o->internal;
- if (o->device->plugin && device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE))
+ if (o->device->plugin && sr_device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE))
samplerate = *((uint64_t *) o->device->plugin->get_device_info(
o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
else
g_string_append_printf(ctx->header, "$version %s %s $end\n",
PACKAGE, PACKAGE_VERSION);
- if (o->device->plugin && device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
+ if (o->device->plugin && sr_device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
ctx->samplerate = *((uint64_t *) o->device->plugin->get_device_info(
o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
if (!((samplerate_s = sr_samplerate_string(ctx->samplerate)))) {
snprintf(ctx->header, 511, "%s\n", PACKAGE_STRING);
num_probes = g_slist_length(o->device->probes);
- if (o->device->plugin || device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
+ if (o->device->plugin || sr_device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
samplerate = *((uint64_t *) o->device->plugin->get_device_info(
o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
if (!(samplerate_s = sr_samplerate_string(samplerate))) {
for (j = 0; keys[j]; j++) {
val = g_key_file_get_string(kf, sections[i], keys[j], NULL);
if (!strcmp(keys[j], "capturefile")) {
- device = device_new(&session_driver, devcnt, 0);
+ device = sr_device_new(&session_driver, devcnt, 0);
if (devcnt == 0)
/* first device, init the plugin */
device->plugin->init((char *)filename);
total_probes = strtoull(val, NULL, 10);
device->plugin->set_configuration(devcnt, SR_HWCAP_CAPTURE_NUM_PROBES, &total_probes);
for (p = 1; p <= total_probes; p++)
- device_probe_add(device, NULL);
+ sr_device_probe_add(device, NULL);
} else if (!strncmp(keys[j], "probe", 5)) {
if (!device)
continue;
enabled_probes++;
tmp_u64 = strtoul(keys[j]+5, NULL, 10);
- device_probe_name(device, tmp_u64, val);
+ sr_device_probe_name(device, tmp_u64, val);
} else if (!strncmp(keys[j], "trigger", 7)) {
probenum = strtoul(keys[j]+7, NULL, 10);
- device_trigger_set(device, probenum, val);
+ sr_device_trigger_set(device, probenum, val);
}
}
g_strfreev(keys);
fprintf(meta, "capturefile = logic-%d\n", devcnt);
fprintf(meta, "unitsize = %d\n", ds->ds_unitsize);
fprintf(meta, "total probes = %d\n", g_slist_length(device->probes));
- if (device_has_hwcap(device, SR_HWCAP_SAMPLERATE)) {
+ if (sr_device_has_hwcap(device, SR_HWCAP_SAMPLERATE)) {
samplerate = *((uint64_t *) device->plugin->get_device_info(
device->plugin_index, SR_DI_CUR_SAMPLERATE));
s = sr_samplerate_string(samplerate);
/*--- device.c --------------------------------------------------------------*/
-void device_scan(void);
-int device_plugin_init(struct sr_device_plugin *plugin);
-void device_close_all(void);
-GSList *device_list(void);
-struct sr_device *device_new(struct sr_device_plugin *plugin, int plugin_index,
+void sr_device_scan(void);
+int sr_device_plugin_init(struct sr_device_plugin *plugin);
+void sr_device_close_all(void);
+GSList *sr_device_list(void);
+struct sr_device *sr_device_new(struct sr_device_plugin *plugin, int plugin_index,
int num_probes);
-void device_clear(struct sr_device *device);
-void device_destroy(struct sr_device *dev);
+void sr_device_clear(struct sr_device *device);
+void sr_device_destroy(struct sr_device *dev);
-void device_probe_clear(struct sr_device *device, int probenum);
-void device_probe_add(struct sr_device *device, char *name);
+void sr_device_probe_clear(struct sr_device *device, int probenum);
+void sr_device_probe_add(struct sr_device *device, char *name);
struct sr_probe *probe_find(struct sr_device *device, int probenum);
-void device_probe_name(struct sr_device *device, int probenum, char *name);
+void sr_device_probe_name(struct sr_device *device, int probenum, char *name);
-void device_trigger_clear(struct sr_device *device);
-void device_trigger_set(struct sr_device *device, int probenum, char *trigger);
-gboolean device_has_hwcap(struct sr_device *device, int hwcap);
+void sr_device_trigger_clear(struct sr_device *device);
+void sr_device_trigger_set(struct sr_device *device, int probenum, char *trigger);
+gboolean sr_device_has_hwcap(struct sr_device *device, int hwcap);
/*--- filter.c --------------------------------------------------------------*/