Add sr_ prefix for datastore API functions.
This commit is contained in:
parent
2bf4aca64a
commit
c49111295f
12
datastore.c
12
datastore.c
|
@ -23,9 +23,9 @@
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <sigrok.h>
|
#include <sigrok.h>
|
||||||
|
|
||||||
static gpointer new_chunk(struct datastore **ds);
|
static gpointer new_chunk(struct sr_datastore **ds);
|
||||||
|
|
||||||
int datastore_new(int unitsize, struct datastore **ds)
|
int sr_datastore_new(int unitsize, struct sr_datastore **ds)
|
||||||
{
|
{
|
||||||
if (!ds)
|
if (!ds)
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
@ -33,7 +33,7 @@ int datastore_new(int unitsize, struct datastore **ds)
|
||||||
if (unitsize <= 0)
|
if (unitsize <= 0)
|
||||||
return SR_ERR; /* TODO: Different error? */
|
return SR_ERR; /* TODO: Different error? */
|
||||||
|
|
||||||
if (!(*ds = g_malloc(sizeof(struct datastore))))
|
if (!(*ds = g_malloc(sizeof(struct sr_datastore))))
|
||||||
return SR_ERR_MALLOC;
|
return SR_ERR_MALLOC;
|
||||||
|
|
||||||
(*ds)->ds_unitsize = unitsize;
|
(*ds)->ds_unitsize = unitsize;
|
||||||
|
@ -43,7 +43,7 @@ int datastore_new(int unitsize, struct datastore **ds)
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int datastore_destroy(struct datastore *ds)
|
int sr_datastore_destroy(struct sr_datastore *ds)
|
||||||
{
|
{
|
||||||
GSList *chunk;
|
GSList *chunk;
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ int datastore_destroy(struct datastore *ds)
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void datastore_put(struct datastore *ds, void *data, unsigned int length,
|
void sr_datastore_put(struct sr_datastore *ds, void *data, unsigned int length,
|
||||||
int in_unitsize, int *probelist)
|
int in_unitsize, int *probelist)
|
||||||
{
|
{
|
||||||
unsigned int stored;
|
unsigned int stored;
|
||||||
|
@ -100,7 +100,7 @@ void datastore_put(struct datastore *ds, void *data, unsigned int length,
|
||||||
ds->num_units += stored / ds->ds_unitsize;
|
ds->num_units += stored / ds->ds_unitsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gpointer new_chunk(struct datastore **ds)
|
static gpointer new_chunk(struct sr_datastore **ds)
|
||||||
{
|
{
|
||||||
gpointer chunk;
|
gpointer chunk;
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ int sr_session_save(char *filename)
|
||||||
FILE *meta;
|
FILE *meta;
|
||||||
struct sr_device *device;
|
struct sr_device *device;
|
||||||
struct sr_probe *probe;
|
struct sr_probe *probe;
|
||||||
struct datastore *ds;
|
struct sr_datastore *ds;
|
||||||
struct zip *zipfile;
|
struct zip *zipfile;
|
||||||
struct zip_source *versrc, *metasrc, *logicsrc;
|
struct zip_source *versrc, *metasrc, *logicsrc;
|
||||||
int bufcnt, devcnt, tmpfile, ret, error, probecnt;
|
int bufcnt, devcnt, tmpfile, ret, error, probecnt;
|
||||||
|
|
|
@ -27,9 +27,9 @@ void sr_exit(void);
|
||||||
|
|
||||||
/*--- datastore.c -----------------------------------------------------------*/
|
/*--- datastore.c -----------------------------------------------------------*/
|
||||||
|
|
||||||
int datastore_new(int unitsize, struct datastore **ds);
|
int sr_datastore_new(int unitsize, struct sr_datastore **ds);
|
||||||
int datastore_destroy(struct datastore *ds);
|
int sr_datastore_destroy(struct sr_datastore *ds);
|
||||||
void datastore_put(struct datastore *ds, void *data, unsigned int length,
|
void sr_datastore_put(struct sr_datastore *ds, void *data, unsigned int length,
|
||||||
int in_unitsize, int *probelist);
|
int in_unitsize, int *probelist);
|
||||||
|
|
||||||
/*--- device.c --------------------------------------------------------------*/
|
/*--- device.c --------------------------------------------------------------*/
|
||||||
|
@ -38,8 +38,8 @@ void sr_device_scan(void);
|
||||||
int sr_device_plugin_init(struct sr_device_plugin *plugin);
|
int sr_device_plugin_init(struct sr_device_plugin *plugin);
|
||||||
void sr_device_close_all(void);
|
void sr_device_close_all(void);
|
||||||
GSList *sr_device_list(void);
|
GSList *sr_device_list(void);
|
||||||
struct sr_device *sr_device_new(struct sr_device_plugin *plugin, int plugin_index,
|
struct sr_device *sr_device_new(struct sr_device_plugin *plugin,
|
||||||
int num_probes);
|
int plugin_index, int num_probes);
|
||||||
void sr_device_clear(struct sr_device *device);
|
void sr_device_clear(struct sr_device *device);
|
||||||
void sr_device_destroy(struct sr_device *dev);
|
void sr_device_destroy(struct sr_device *dev);
|
||||||
|
|
||||||
|
@ -49,7 +49,8 @@ struct sr_probe *probe_find(struct sr_device *device, int probenum);
|
||||||
void sr_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 sr_device_trigger_clear(struct sr_device *device);
|
void sr_device_trigger_clear(struct sr_device *device);
|
||||||
void sr_device_trigger_set(struct sr_device *device, int probenum, char *trigger);
|
void sr_device_trigger_set(struct sr_device *device, int probenum,
|
||||||
|
char *trigger);
|
||||||
gboolean sr_device_has_hwcap(struct sr_device *device, int hwcap);
|
gboolean sr_device_has_hwcap(struct sr_device *device, int hwcap);
|
||||||
|
|
||||||
/*--- filter.c --------------------------------------------------------------*/
|
/*--- filter.c --------------------------------------------------------------*/
|
||||||
|
@ -116,7 +117,8 @@ int sr_session_start(void);
|
||||||
void sr_session_run(void);
|
void sr_session_run(void);
|
||||||
void sr_session_halt(void);
|
void sr_session_halt(void);
|
||||||
void sr_session_stop(void);
|
void sr_session_stop(void);
|
||||||
void sr_session_bus(struct sr_device *device, struct sr_datafeed_packet *packet);
|
void sr_session_bus(struct sr_device *device,
|
||||||
|
struct sr_datafeed_packet *packet);
|
||||||
void make_metadata(char *filename);
|
void make_metadata(char *filename);
|
||||||
int sr_session_save(char *filename);
|
int sr_session_save(char *filename);
|
||||||
void sr_session_source_add(int fd, int events, int timeout,
|
void sr_session_source_add(int fd, int events, int timeout,
|
||||||
|
@ -135,7 +137,8 @@ struct sr_output_format **sr_output_list(void);
|
||||||
|
|
||||||
char *sr_samplerate_string(uint64_t samplerate);
|
char *sr_samplerate_string(uint64_t samplerate);
|
||||||
char *sr_period_string(uint64_t frequency);
|
char *sr_period_string(uint64_t frequency);
|
||||||
char **sr_parse_triggerstring(struct sr_device *device, const char *triggerstring);
|
char **sr_parse_triggerstring(struct sr_device *device,
|
||||||
|
const char *triggerstring);
|
||||||
uint64_t sr_parse_sizestring(const char *sizestring);
|
uint64_t sr_parse_sizestring(const char *sizestring);
|
||||||
uint64_t sr_parse_timestring(const char *timestring);
|
uint64_t sr_parse_timestring(const char *timestring);
|
||||||
|
|
||||||
|
|
4
sigrok.h
4
sigrok.h
|
@ -175,7 +175,7 @@ struct analyzer {
|
||||||
/* Size of a chunk in units */
|
/* Size of a chunk in units */
|
||||||
#define DATASTORE_CHUNKSIZE 512000
|
#define DATASTORE_CHUNKSIZE 512000
|
||||||
|
|
||||||
struct datastore {
|
struct sr_datastore {
|
||||||
/* Size in bytes of the number of units stored in this datastore */
|
/* Size in bytes of the number of units stored in this datastore */
|
||||||
int ds_unitsize;
|
int ds_unitsize;
|
||||||
unsigned int num_units; /* TODO: uint64_t */
|
unsigned int num_units; /* TODO: uint64_t */
|
||||||
|
@ -196,7 +196,7 @@ struct sr_device {
|
||||||
/* List of struct sr_probe* */
|
/* List of struct sr_probe* */
|
||||||
GSList *probes;
|
GSList *probes;
|
||||||
/* Data acquired by this device, if any */
|
/* Data acquired by this device, if any */
|
||||||
struct datastore *datastore;
|
struct sr_datastore *datastore;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
Loading…
Reference in New Issue