#include <sigrok.h>
-extern struct input_format input_binary;
+extern struct sr_input_format input_binary;
-struct input_format *input_module_list[] = {
+static struct sr_input_format *input_module_list[] = {
/* This one has to be last, because it will take any input. */
&input_binary,
NULL,
};
-struct input_format **input_list(void)
+struct sr_input_format **sr_input_list(void)
{
return input_module_list;
}
return TRUE;
}
-static int init(struct input *in)
+static int init(struct sr_input *in)
{
int num_probes;
return SR_OK;
}
-static int loadfile(struct input *in, const char *filename)
+static int loadfile(struct sr_input *in, const char *filename)
{
struct datafeed_header header;
struct datafeed_packet packet;
return SR_OK;
}
-struct input_format input_binary = {
+struct sr_input_format input_binary = {
"binary",
"Raw binary",
format_match,
#include <sigrok.h>
-extern struct output_format output_text_bits;
-extern struct output_format output_text_hex;
-extern struct output_format output_text_ascii;
-extern struct output_format output_binary;
-extern struct output_format output_vcd;
-extern struct output_format output_ols;
-extern struct output_format output_gnuplot;
-extern struct output_format output_analog_bits;
-extern struct output_format output_analog_gnuplot;
+extern struct sr_output_format output_text_bits;
+extern struct sr_output_format output_text_hex;
+extern struct sr_output_format output_text_ascii;
+extern struct sr_output_format output_binary;
+extern struct sr_output_format output_vcd;
+extern struct sr_output_format output_ols;
+extern struct sr_output_format output_gnuplot;
+extern struct sr_output_format output_analog_bits;
+extern struct sr_output_format output_analog_gnuplot;
-struct output_format *output_module_list[] = {
+static struct sr_output_format *output_module_list[] = {
&output_text_bits,
&output_text_hex,
&output_text_ascii,
NULL,
};
-struct output_format **output_list(void)
+struct sr_output_format **sr_output_list(void)
{
return output_module_list;
}
memset(ctx->linebuf, 0, i * ctx->linebuf_len);
}
-static int init(struct output *o, int default_spl, enum outputmode mode)
+static int init(struct sr_output *o, int default_spl, enum outputmode mode)
{
struct context *ctx;
struct probe *probe;
return SR_OK;
}
-static int event(struct output *o, int event_type, char **data_out,
+static int event(struct sr_output *o, int event_type, char **data_out,
uint64_t *length_out)
{
struct context *ctx;
return SR_OK;
}
-static int init_bits(struct output *o)
+static int init_bits(struct sr_output *o)
{
return init(o, DEFAULT_BPL_BITS, MODE_BITS);
}
-static int data_bits(struct output *o, char *data_in, uint64_t length_in,
+static int data_bits(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out)
{
struct context *ctx;
return SR_OK;
}
#if 0
-static int init_hex(struct output *o)
+static int init_hex(struct sr_output *o)
{
return init(o, DEFAULT_BPL_HEX, MODE_HEX);
}
-static int data_hex(struct output *o, char *data_in, uint64_t length_in,
+static int data_hex(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out)
{
struct context *ctx;
return SR_OK;
}
-static int init_ascii(struct output *o)
+static int init_ascii(struct sr_output *o)
{
return init(o, DEFAULT_BPL_ASCII, MODE_ASCII);
}
-static int data_ascii(struct output *o, char *data_in, uint64_t length_in,
+static int data_ascii(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out)
{
struct context *ctx;
}
#endif
-struct output_format output_analog_bits = {
+struct sr_output_format output_analog_bits = {
"analog_bits",
"Bits (takes argument, default 64)",
DF_ANALOG,
event,
};
#if 0
-struct output_format output_analog_hex = {
+struct sr_output_format output_analog_hex = {
"analog_hex",
"Hexadecimal (takes argument, default 192)",
DF_ANALOG,
event,
};
-struct output_format output_analog_ascii = {
+struct sr_output_format output_analog_ascii = {
"analog_ascii",
"ASCII (takes argument, default 74)",
DF_ANALOG,
#include "config.h"
-static int data(struct output *o, char *data_in, uint64_t length_in,
+static int data(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out)
{
char *outbuf;
return SR_OK;
}
-struct output_format output_binary = {
+struct sr_output_format output_binary = {
"binary",
"Raw binary",
DF_LOGIC,
const char *gnuplot_header_comment = "\
# Comment: Acquisition with %d/%d probes at %s\n";
-static int init(struct output *o)
+static int init(struct sr_output *o)
{
struct context *ctx;
struct probe *probe;
return 0;
}
-static int event(struct output *o, int event_type, char **data_out,
+static int event(struct sr_output *o, int event_type, char **data_out,
uint64_t *length_out)
{
struct context *ctx;
return SR_OK;
}
-static int data(struct output *o, char *data_in, uint64_t length_in,
+static int data(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out)
{
struct context *ctx;
return SR_OK;
}
-static int analog_init(struct output *o)
+static int analog_init(struct sr_output *o)
{
struct context *ctx;
struct probe *probe;
return 0;
}
-static int analog_data(struct output *o, char *data_in, uint64_t length_in,
+static int analog_data(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out)
{
struct context *ctx;
return SR_OK;
}
-struct output_format output_gnuplot = {
+struct sr_output_format output_gnuplot = {
"gnuplot",
"Gnuplot",
DF_LOGIC,
event,
};
-struct output_format output_analog_gnuplot = {
+struct sr_output_format output_analog_gnuplot = {
"analog_gnuplot",
"Gnuplot analog",
DF_ANALOG,
const char *ols_header_comment = "\
# Comment: Acquisition with %d/%d probes at %s";
-static int init(struct output *o)
+static int init(struct sr_output *o)
{
struct context *ctx;
struct probe *probe;
return 0;
}
-static int event(struct output *o, int event_type, char **data_out,
+static int event(struct sr_output *o, int event_type, char **data_out,
uint64_t *length_out)
{
struct context *ctx;
return SR_OK;
}
-static int data(struct output *o, char *data_in, uint64_t length_in,
+static int data(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out)
{
struct context *ctx;
return SR_OK;
}
-struct output_format output_ols = {
+struct sr_output_format output_ols = {
"ols",
"OpenBench Logic Sniffer",
DF_LOGIC,
#include <stdint.h>
#include <sigrok.h>
-static int init(struct output *o)
+static int init(struct sr_output *o)
{
return 0;
}
-static int data(struct output *o, char *data_in, uint64_t length_in,
+static int data(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out)
{
return SR_OK;
}
-static int event(struct output *o, int event_type, char **data_out,
+static int event(struct sr_output *o, int event_type, char **data_out,
uint64_t *length_out)
{
return SR_OK;
}
-struct output_format output_foo = {
+struct sr_output_format output_foo = {
"foo",
"The foo format",
DF_LOGIC,
const char *vcd_header_comment = "\
$comment\n Acquisition with %d/%d probes at %s\n$end\n";
-static int init(struct output *o)
+static int init(struct sr_output *o)
{
struct context *ctx;
struct probe *probe;
return SR_OK;
}
-static int event(struct output *o, int event_type, char **data_out,
+static int event(struct sr_output *o, int event_type, char **data_out,
uint64_t *length_out)
{
struct context *ctx;
return SR_OK;
}
-static int data(struct output *o, char *data_in, uint64_t length_in,
+static int data(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out)
{
struct context *ctx;
return SR_OK;
}
-struct output_format output_vcd = {
+struct sr_output_format output_vcd = {
"vcd",
"Value Change Dump (VCD)",
DF_LOGIC,
#include "text.h"
-int init_ascii(struct output *o)
+int init_ascii(struct sr_output *o)
{
return init(o, DEFAULT_BPL_ASCII, MODE_ASCII);
}
-int data_ascii(struct output *o, char *data_in, uint64_t length_in,
+int data_ascii(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out)
{
struct context *ctx;
}
-struct output_format output_text_ascii = {
+struct sr_output_format output_text_ascii = {
"ascii",
"ASCII (takes argument, default 74)",
DF_LOGIC,
#include "text.h"
-int init_bits(struct output *o)
+int init_bits(struct sr_output *o)
{
return init(o, DEFAULT_BPL_BITS, MODE_BITS);
}
-int data_bits(struct output *o, char *data_in, uint64_t length_in,
+int data_bits(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out)
{
struct context *ctx;
}
-struct output_format output_text_bits = {
+struct sr_output_format output_text_bits = {
"bits",
"Bits (takes argument, default 64)",
DF_LOGIC,
#include "text.h"
-int init_hex(struct output *o)
+int init_hex(struct sr_output *o)
{
return init(o, DEFAULT_BPL_HEX, MODE_HEX);
}
-int data_hex(struct output *o, char *data_in, uint64_t length_in,
+int data_hex(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out)
{
struct context *ctx;
}
-struct output_format output_text_hex = {
+struct sr_output_format output_text_hex = {
"hex",
"Hexadecimal (takes argument, default 192)",
DF_LOGIC,
memset(ctx->linebuf, 0, i * ctx->linebuf_len);
}
-int init(struct output *o, int default_spl, enum outputmode mode)
+int init(struct sr_output *o, int default_spl, enum outputmode mode)
{
struct context *ctx;
struct probe *probe;
return SR_OK;
}
-int event(struct output *o, int event_type, char **data_out,
+int event(struct sr_output *o, int event_type, char **data_out,
uint64_t *length_out)
{
struct context *ctx;
};
void flush_linebufs(struct context *ctx, char *outbuf);
-int init(struct output *o, int default_spl, enum outputmode mode);
-int event(struct output *o, int event_type, char **data_out,
+int init(struct sr_output *o, int default_spl, enum outputmode mode);
+int event(struct sr_output *o, int event_type, char **data_out,
uint64_t *length_out);
-int init_bits(struct output *o);
-int data_bits(struct output *o, char *data_in, uint64_t length_in,
+int init_bits(struct sr_output *o);
+int data_bits(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out);
-int init_hex(struct output *o);
-int data_hex(struct output *o, char *data_in, uint64_t length_in,
+int init_hex(struct sr_output *o);
+int data_hex(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out);
-int init_ascii(struct output *o);
-int data_ascii(struct output *o, char *data_in, uint64_t length_in,
+int init_ascii(struct sr_output *o);
+int data_ascii(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out);
/*--- input/input.c ---------------------------------------------------------*/
-struct input_format **input_list(void);
+struct sr_input_format **sr_input_list(void);
/*--- output/output.c -------------------------------------------------------*/
-struct output_format **output_list(void);
+struct sr_output_format **sr_output_list(void);
/*--- output/common.c -------------------------------------------------------*/
struct analog_probe probes[];
};
-struct input {
- struct input_format *format;
+struct sr_input {
+ struct sr_input_format *format;
char *param;
struct device *vdevice;
};
-struct input_format {
+struct sr_input_format {
char *extension;
char *description;
int (*format_match) (const char *filename);
- int (*init) (struct input *in);
- int (*loadfile) (struct input *in, const char *filename);
+ int (*init) (struct sr_input *in);
+ int (*loadfile) (struct sr_input *in, const char *filename);
};
-struct output {
- struct output_format *format;
+struct sr_output {
+ struct sr_output_format *format;
struct device *device;
char *param;
void *internal;
};
-struct output_format {
+struct sr_output_format {
char *extension;
char *description;
int df_type;
- int (*init) (struct output *o);
- int (*data) (struct output *o, char *data_in, uint64_t length_in,
+ int (*init) (struct sr_output *o);
+ int (*data) (struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out);
- int (*event) (struct output *o, int event_type, char **data_out,
+ int (*event) (struct sr_output *o, int event_type, char **data_out,
uint64_t *length_out);
};