void datastore_put(struct datastore *ds, void *data, unsigned int length, int in_unitsize, int *probelist)
{
- int capacity, stored, size, num_chunks, chunk_bytes_free, chunk_offset;
+ unsigned int stored;
+ int capacity, size, num_chunks, chunk_bytes_free, chunk_offset;
gpointer chunk;
+ /* QUICK HACK */
+ in_unitsize = in_unitsize;
+ probelist = probelist;
+
if(ds->chunklist == NULL)
chunk = new_chunk(&ds);
else
chunk_offset = 0;
}
- if(length - stored > chunk_bytes_free)
+ if(length - stored > (unsigned int)chunk_bytes_free)
size = chunk_bytes_free;
else
/* last part, won't fill up this chunk */
void device_clear(struct device *device)
{
- int probenum;
+ unsigned int probenum;
/* TODO: plugin-specific clear call? */
void device_destroy(struct device *device)
{
- int probenum;
+ unsigned int probenum;
/* TODO: plugin-specific destroy call, need to decrease refcount in plugin */
void device_trigger_clear(struct device *device)
{
struct probe *p;
- int probenum;
+ unsigned int probenum;
if(device->probes)
for(probenum = 1; probenum <= g_slist_length(device->probes); probenum++)
int filter_probes(int in_unitsize, int out_unitsize, int *probelist,
char *data_in, uint64_t length_in, char **data_out, uint64_t *length_out)
{
- int num_enabled_probes, in_offset, out_offset, out_bit, i;
+ unsigned int in_offset, out_offset;
+ int num_enabled_probes, out_bit, i;
uint64_t sample_in, sample_out;
*data_out = malloc(length_in);
{
glob_t g;
GSList *ports;
- int i, j;
+ unsigned int i, j;
ports = NULL;
for(i = 0; serial_port_glob[i]; i++)
static int receive_data(int fd, int revents, void *user_data)
{
- static int num_transfers = 0;
+ static unsigned int num_transfers = 0;
static int num_bytes = 0;
static char last_sample[4] = {0xff};
static unsigned char sample[4] = {0}, tmp_sample[4];
{
struct datafeed_packet packet;
+ /* QUICK HACK */
+ device_index = device_index;
+
packet.type = DF_END;
packet.length = 0;
session_bus(session_device_id, &packet);
* upgrade -- this is like a global lock. No device will open until a proper
* delay after the last device was upgraded.
*/
-GTimeVal firmware_updated = { 0 };
+GTimeVal firmware_updated = { 0, 0 };
static libusb_context *usb_context = NULL;
return 0;
}
-static int opendev3(int device_index, struct sigrok_device_instance **sdi,
- libusb_device *dev, struct libusb_device_descriptor *des)
+static int opendev3(struct sigrok_device_instance **sdi, libusb_device *dev,
+ struct libusb_device_descriptor *des)
{
int err;
libusb_get_device_list(usb_context, &devlist);
for (i = 0; devlist[i]; i++) {
/* TODO: Error handling. */
- err = opendev3(device_index, &sdi, devlist[i], &des);
+ err = opendev3(&sdi, devlist[i], &des);
}
} else {
/* Status must be ST_ACTIVE, i.e. already in use... */
libusb_device **devlist;
int err, devcnt, i;
+ /* QUICK HACK */
+ deviceinfo = deviceinfo;
+
if (libusb_init(&usb_context) != 0) {
g_warning("Failed to initialize USB.");
return 0;
{
struct timeval tv;
+ /* QUICK HACK */
+ fd = fd;
+ revents = revents;
+ user_data = user_data;
+
tv.tv_sec = tv.tv_usec = 0;
libusb_handle_events_timeout(usb_context, &tv);
return TRUE;
}
-static void trigger_helper(int i, unsigned char *cur_buf, int cur_buflen,
+static void trigger_helper(int i, unsigned char *cur_buf,
struct datafeed_packet *packet, void *user_data,
int *trigger_offset)
{
trigger_offset = 0;
if (trigger_stage >= 0) {
for (i = 0; i < cur_buflen; i++) {
- trigger_helper(i, cur_buf, cur_buflen, &packet,
- user_data, &trigger_offset);
+ trigger_helper(i, cur_buf, &packet, user_data,
+ &trigger_offset);
}
}
g_free(cur_buf);
num_samples += cur_buflen;
- if (num_samples > limit_samples) {
+ if ((unsigned int)num_samples > limit_samples) {
/* End the acquisition. */
packet.type = DF_END;
session_bus(user_data, &packet);
{
struct datafeed_packet packet;
+ /* QUICK HACK */
+ device_index = device_index;
+
packet.type = DF_END;
session_bus(session_device_id, &packet);
struct sigrok_device_instance *sdi;
libusb_device **devlist;
struct libusb_device_descriptor des;
- int err, i, j;
+ unsigned int j;
+ int err, i;
if(!(sdi = get_sigrok_device_instance(device_instances, device_index)))
return NULL;
libusb_device **devlist;
int err, devcnt, i;
+ /* QUICK HACK */
+ deviceinfo = deviceinfo;
+
if(libusb_init(&usb_context) != 0) {
g_warning("Failed to initialize USB.");
return 0;
static int *hw_get_capabilities(void)
{
-
return capabilities;
}
// XXX this will set the same samplerate for all devices
-int set_configuration_samplerate(struct sigrok_device_instance *sdi, uint64_t samplerate)
+static int set_configuration_samplerate(uint64_t samplerate)
{
g_message("%s(%llu)", __FUNCTION__, samplerate);
if (samplerate > MHZ(1))
switch (capability) {
case HWCAP_SAMPLERATE:
tmp_u64 = value;
- return set_configuration_samplerate(sdi, *tmp_u64);
+ return set_configuration_samplerate(*tmp_u64);
case HWCAP_PROBECONFIG:
return configure_probes( (GSList *) value);
struct datafeed_packet packet;
struct datafeed_header header;
int res;
- int packet_num;
+ unsigned int packet_num;
unsigned char *buf;
if( !(sdi = get_sigrok_device_instance(device_instances, device_index)))
void usb_device_instance_free(struct usb_device_instance *usb)
{
+ /* QUICK HACK */
+ usb = usb;
/* nothing to do for this device instance type */
#include "config.h"
struct context {
- int num_enabled_probes;
- int unitsize;
+ unsigned int num_enabled_probes;
+ unsigned int unitsize;
char *probelist[65];
char *header;
};
struct probe *probe;
GSList *l;
uint64_t samplerate;
- int i, b, num_probes;
+ unsigned int i;
+ int b, num_probes;
char *c, *samplerate_s;
char wbuf[1000];
char **data_out, uint64_t *length_out)
{
struct context *ctx;
- int offset, outsize, p, curbit;
+ unsigned int offset, outsize, p, curbit;
uint64_t sample, count = 0;
char *outbuf, *c;
#define DEFAULT_BPL_HEX 256
struct context {
- int num_enabled_probes;
+ unsigned int num_enabled_probes;
int samples_per_line;
- int unitsize;
+ unsigned int unitsize;
int line_offset;
int linebuf_len;
char *probelist[65];
};
-static void flush_linebufs(struct context *ctx, GSList *probes, char *outbuf)
+static void flush_linebufs(struct context *ctx, char *outbuf)
{
static int max_probename_len = 0;
int len, i;
case DF_END:
outsize = ctx->num_enabled_probes * (ctx->samples_per_line + 20) + 512;
outbuf = calloc(1, outsize);
- flush_linebufs(ctx, o->device->probes, outbuf);
+ flush_linebufs(ctx, outbuf);
*data_out = outbuf;
*length_out = strlen(outbuf);
free(o->internal);
static int data_binary(struct output *o, char *data_in, uint64_t length_in, char **data_out, uint64_t *length_out)
{
struct context *ctx;
- int outsize, offset, p;
+ unsigned int outsize, offset, p;
uint64_t sample;
char *outbuf;
/* end of line */
if(ctx->spl_cnt >= ctx->samples_per_line) {
- flush_linebufs(ctx, o->device->probes, outbuf);
+ flush_linebufs(ctx, outbuf);
ctx->line_offset = ctx->spl_cnt = 0;
}
}
static int data_hex(struct output *o, char *data_in, uint64_t length_in, char **data_out, uint64_t *length_out)
{
struct context *ctx;
- int outsize, offset, p;
+ unsigned int outsize, offset, p;
uint64_t sample;
char *outbuf;
/* end of line */
if(ctx->spl_cnt >= ctx->samples_per_line) {
- flush_linebufs(ctx, o->device->probes, outbuf);
+ flush_linebufs(ctx, outbuf);
ctx->line_offset = ctx->spl_cnt = 0;
}
}
char **data_out, uint64_t *length_out)
{
struct context *ctx;
- int offset, outsize, p, curbit, prevbit;
+ unsigned int offset, outsize;
+ int p, curbit, prevbit;
uint64_t sample, prevsample;
char *outbuf, *c;
struct session *session;
-struct session *session_load(char *filename)
+struct session *session_load(const char *filename)
{
struct session *session;
/* TODO: implement */
session = NULL;
+ /* QUICK HACK */
+ filename = filename;
+
return session;
}
};
/* Session setup */
-struct session *session_load(char *filename);
+struct session *session_load(const char *filename);
struct session *session_new(void);
void session_destroy(void);
void session_device_clear(void);