sr/srd: Small fixes, constifications, doc updates.
This commit is contained in:
parent
a4d3985678
commit
8ec95d2282
|
@ -128,16 +128,12 @@ SR_API int sr_datastore_destroy(struct sr_datastore *ds)
|
||||||
* is returned, the value/state of 'ds' is undefined.
|
* is returned, the value/state of 'ds' is undefined.
|
||||||
*/
|
*/
|
||||||
SR_API int sr_datastore_put(struct sr_datastore *ds, void *data,
|
SR_API int sr_datastore_put(struct sr_datastore *ds, void *data,
|
||||||
unsigned int length, int in_unitsize, int *probelist)
|
unsigned int length, int in_unitsize, const int *probelist)
|
||||||
{
|
{
|
||||||
unsigned int stored;
|
unsigned int stored;
|
||||||
int capacity, size, num_chunks, chunk_bytes_free, chunk_offset;
|
int capacity, size, num_chunks, chunk_bytes_free, chunk_offset;
|
||||||
gpointer chunk;
|
gpointer chunk;
|
||||||
|
|
||||||
/* Avoid compiler warnings. */
|
|
||||||
(void)in_unitsize;
|
|
||||||
(void)probelist;
|
|
||||||
|
|
||||||
if (!ds) {
|
if (!ds) {
|
||||||
sr_err("ds: %s: ds was NULL", __func__);
|
sr_err("ds: %s: ds was NULL", __func__);
|
||||||
return SR_ERR_ARG;
|
return SR_ERR_ARG;
|
||||||
|
|
12
device.c
12
device.c
|
@ -357,10 +357,10 @@ SR_API int sr_dev_trigger_set(struct sr_dev *dev, int probenum,
|
||||||
/**
|
/**
|
||||||
* Determine whether the specified device has the specified capability.
|
* Determine whether the specified device has the specified capability.
|
||||||
*
|
*
|
||||||
* TODO: Should return int?
|
|
||||||
*
|
|
||||||
* @param dev Pointer to the device to be checked. Must not be NULL.
|
* @param dev Pointer to the device to be checked. Must not be NULL.
|
||||||
* The device's 'driver' field must not be NULL either.
|
* If the device's 'driver' field is NULL (virtual device), this
|
||||||
|
* function will always return FALSE (virtual devices don't have
|
||||||
|
* a hardware capabilities list).
|
||||||
* @param hwcap The capability that should be checked (whether it's supported
|
* @param hwcap The capability that should be checked (whether it's supported
|
||||||
* by the specified device).
|
* by the specified device).
|
||||||
*
|
*
|
||||||
|
@ -376,7 +376,7 @@ SR_API gboolean sr_dev_has_hwcap(const struct sr_dev *dev, int hwcap)
|
||||||
|
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
sr_err("dev: %s: dev was NULL", __func__);
|
sr_err("dev: %s: dev was NULL", __func__);
|
||||||
return FALSE; /* TODO: SR_ERR_ARG. */
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -386,14 +386,14 @@ SR_API gboolean sr_dev_has_hwcap(const struct sr_dev *dev, int hwcap)
|
||||||
if (!dev->driver) {
|
if (!dev->driver) {
|
||||||
sr_dbg("dev: %s: dev->driver was NULL, this seems to be "
|
sr_dbg("dev: %s: dev->driver was NULL, this seems to be "
|
||||||
"a virtual device without capabilities", __func__);
|
"a virtual device without capabilities", __func__);
|
||||||
return FALSE; /* TODO: SR_ERR_ARG. */
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Sanity check on 'hwcap'. */
|
/* TODO: Sanity check on 'hwcap'. */
|
||||||
|
|
||||||
if (!(hwcaps = dev->driver->hwcap_get_all())) {
|
if (!(hwcaps = dev->driver->hwcap_get_all())) {
|
||||||
sr_err("dev: %s: dev has no capabilities", __func__);
|
sr_err("dev: %s: dev has no capabilities", __func__);
|
||||||
return FALSE; /* TODO: SR_ERR*. */
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; hwcaps[i]; i++) {
|
for (i = 0; hwcaps[i]; i++) {
|
||||||
|
|
|
@ -41,7 +41,7 @@ struct context {
|
||||||
unsigned int unitsize;
|
unsigned int unitsize;
|
||||||
int line_offset;
|
int line_offset;
|
||||||
int linebuf_len;
|
int linebuf_len;
|
||||||
char *probelist[65];
|
char *probelist[SR_MAX_NUM_PROBES + 1];
|
||||||
char *linebuf;
|
char *linebuf;
|
||||||
int spl_cnt;
|
int spl_cnt;
|
||||||
uint8_t *linevalues;
|
uint8_t *linevalues;
|
||||||
|
|
|
@ -36,7 +36,7 @@ struct context {
|
||||||
unsigned int unitsize;
|
unsigned int unitsize;
|
||||||
int line_offset;
|
int line_offset;
|
||||||
int linebuf_len;
|
int linebuf_len;
|
||||||
char *probelist[65];
|
char *probelist[SR_MAX_NUM_PROBES + 1];
|
||||||
char *linebuf;
|
char *linebuf;
|
||||||
int spl_cnt;
|
int spl_cnt;
|
||||||
uint8_t *linevalues;
|
uint8_t *linevalues;
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
struct context {
|
struct context {
|
||||||
int num_enabled_probes;
|
int num_enabled_probes;
|
||||||
int unitsize;
|
int unitsize;
|
||||||
char *probelist[65];
|
char *probelist[SR_MAX_NUM_PROBES + 1];
|
||||||
int *prevbits;
|
int *prevbits;
|
||||||
GString *header;
|
GString *header;
|
||||||
uint64_t prevsample;
|
uint64_t prevsample;
|
||||||
|
|
|
@ -145,7 +145,7 @@ SR_API int sr_session_dev_add(struct sr_dev *dev)
|
||||||
if (!dev->driver->dev_open) {
|
if (!dev->driver->dev_open) {
|
||||||
sr_err("session: %s: dev->driver->dev_open was NULL",
|
sr_err("session: %s: dev->driver->dev_open was NULL",
|
||||||
__func__);
|
__func__);
|
||||||
return SR_ERR_ARG;
|
return SR_ERR_BUG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ret = dev->driver->dev_open(dev->driver_index)) != SR_OK) {
|
if ((ret = dev->driver->dev_open(dev->driver_index)) != SR_OK) {
|
||||||
|
|
|
@ -43,7 +43,7 @@ SR_API int sr_datastore_new(int unitsize, struct sr_datastore **ds);
|
||||||
SR_API int sr_datastore_destroy(struct sr_datastore *ds);
|
SR_API int sr_datastore_destroy(struct sr_datastore *ds);
|
||||||
SR_API int sr_datastore_put(struct sr_datastore *ds, void *data,
|
SR_API int sr_datastore_put(struct sr_datastore *ds, void *data,
|
||||||
unsigned int length, int in_unitsize,
|
unsigned int length, int in_unitsize,
|
||||||
int *probelist);
|
const int *probelist);
|
||||||
|
|
||||||
/*--- device.c --------------------------------------------------------------*/
|
/*--- device.c --------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue