#include <stdlib.h>
#include <string.h>
+#include <math.h>
#include <glib.h>
#include "libsigrok.h"
#include "libsigrok-internal.h"
-#include <math.h>
+
+/* Message logging helpers with driver-specific prefix string. */
+#define DRIVER_LOG_DOMAIN "output/analog: "
+#define sr_log(l, s, args...) sr_log(l, DRIVER_LOG_DOMAIN s, ## args)
+#define sr_spew(s, args...) sr_spew(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_dbg(s, args...) sr_dbg(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_info(s, args...) sr_info(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_warn(s, args...) sr_warn(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_err(s, args...) sr_err(DRIVER_LOG_DOMAIN s, ## args)
struct context {
int num_enabled_probes;
struct sr_probe *probe;
GSList *l;
- sr_spew("output/analog: initializing");
+ sr_spew("Initializing output module.");
+
if (!o || !o->sdi)
return SR_ERR_ARG;
if (!(ctx = g_try_malloc0(sizeof(struct context)))) {
- sr_err("output/analog: Context malloc failed.");
+ sr_err("Output module context malloc failed.");
return SR_ERR_MALLOC;
}
o->internal = ctx;
static void fancyprint(int unit, int mqflags, float value, GString *out)
{
-
switch (unit) {
case SR_UNIT_VOLT:
si_printf(value, out, "V");
else if (mqflags & SR_MQFLAG_DC)
g_string_append_printf(out, " DC");
g_string_append_c(out, '\n');
-
}
static GString *receive(struct sr_output *o, const struct sr_dev_inst *sdi,
return SR_OK;
}
-
SR_PRIV struct sr_output_format output_analog = {
.id = "analog",
.description = "Analog data",
#include "libsigrok.h"
#include "libsigrok-internal.h"
+/* Message logging helpers with driver-specific prefix string. */
+#define DRIVER_LOG_DOMAIN "output/binary: "
+#define sr_log(l, s, args...) sr_log(l, DRIVER_LOG_DOMAIN s, ## args)
+#define sr_spew(s, args...) sr_spew(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_dbg(s, args...) sr_dbg(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_info(s, args...) sr_info(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_warn(s, args...) sr_warn(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_err(s, args...) sr_err(DRIVER_LOG_DOMAIN s, ## args)
+
static int data(struct sr_output *o, const uint8_t *data_in,
uint64_t length_in, uint8_t **data_out, uint64_t *length_out)
{
(void)o;
if (!data_in) {
- sr_err("binary out: %s: data_in was NULL", __func__);
+ sr_err("%s: data_in was NULL", __func__);
return SR_ERR_ARG;
}
if (!length_out) {
- sr_err("binary out: %s: length_out was NULL", __func__);
+ sr_err("%s: length_out was NULL", __func__);
return SR_ERR_ARG;
}
if (length_in == 0) {
- sr_err("binary out: %s: length_in was 0", __func__);
+ sr_err("%s: length_in was 0", __func__);
return SR_ERR_ARG;
}
if (!(outbuf = g_try_malloc0(length_in))) {
- sr_err("binary out: %s: outbuf malloc failed", __func__);
+ sr_err("%s: outbuf malloc failed", __func__);
return SR_ERR_MALLOC;
}
#include "libsigrok.h"
#include "libsigrok-internal.h"
+/* Message logging helpers with driver-specific prefix string. */
+#define DRIVER_LOG_DOMAIN "output/chronovu-la8: "
+#define sr_log(l, s, args...) sr_log(l, DRIVER_LOG_DOMAIN s, ## args)
+#define sr_spew(s, args...) sr_spew(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_dbg(s, args...) sr_dbg(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_info(s, args...) sr_info(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_warn(s, args...) sr_warn(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_err(s, args...) sr_err(DRIVER_LOG_DOMAIN s, ## args)
+
struct context {
unsigned int num_enabled_probes;
unsigned int unitsize;
return 1;
}
- sr_warn("la8 out: %s: invalid samplerate (%" PRIu64 "Hz)",
+ sr_warn("%s: invalid samplerate (%" PRIu64 "Hz)",
__func__, samplerate);
return 0;
static uint8_t samplerate_to_divcount(uint64_t samplerate)
{
if (samplerate == 0) {
- sr_warn("la8 out: %s: samplerate was 0", __func__);
+ sr_warn("%s: samplerate was 0", __func__);
return 0xff;
}
if (!is_valid_samplerate(samplerate)) {
- sr_warn("la8 out: %s: can't get divcount, samplerate invalid",
- __func__);
+ sr_warn("%s: can't get divcount, samplerate invalid", __func__);
return 0xff;
}
uint64_t *samplerate;
if (!o) {
- sr_warn("la8 out: %s: o was NULL", __func__);
+ sr_warn("%s: o was NULL", __func__);
return SR_ERR_ARG;
}
if (!o->sdi) {
- sr_warn("la8 out: %s: o->sdi was NULL", __func__);
+ sr_warn("%s: o->sdi was NULL", __func__);
return SR_ERR_ARG;
}
if (!o->sdi->driver) {
- sr_warn("la8 out: %s: o->sdi->driver was NULL", __func__);
+ sr_warn("%s: o->sdi->driver was NULL", __func__);
return SR_ERR_ARG;
}
if (!(ctx = g_try_malloc0(sizeof(struct context)))) {
- sr_warn("la8 out: %s: ctx malloc failed", __func__);
+ sr_warn("%s: ctx malloc failed", __func__);
return SR_ERR_MALLOC;
}
uint8_t *outbuf;
if (!o) {
- sr_warn("la8 out: %s: o was NULL", __func__);
+ sr_warn("%s: o was NULL", __func__);
return SR_ERR_ARG;
}
if (!(ctx = o->internal)) {
- sr_warn("la8 out: %s: o->internal was NULL", __func__);
+ sr_warn("%s: o->internal was NULL", __func__);
return SR_ERR_ARG;
}
if (!data_out) {
- sr_warn("la8 out: %s: data_out was NULL", __func__);
+ sr_warn("%s: data_out was NULL", __func__);
return SR_ERR_ARG;
}
switch (event_type) {
case SR_DF_TRIGGER:
- sr_dbg("la8 out: %s: SR_DF_TRIGGER event", __func__);
+ sr_dbg("%s: SR_DF_TRIGGER event", __func__);
/* Save the trigger point for later (SR_DF_END). */
ctx->trigger_point = 0; /* TODO: Store _actual_ value. */
break;
case SR_DF_END:
- sr_dbg("la8 out: %s: SR_DF_END event", __func__);
+ sr_dbg("%s: SR_DF_END event", __func__);
if (!(outbuf = g_try_malloc(4 + 1))) {
sr_warn("la8 out: %s: outbuf malloc failed", __func__);
return SR_ERR_MALLOC;
/* One byte for the 'divcount' value. */
outbuf[0] = samplerate_to_divcount(ctx->samplerate);
// if (outbuf[0] == 0xff) {
- // sr_warn("la8 out: %s: invalid divcount", __func__);
+ // sr_warn("%s: invalid divcount", __func__);
// return SR_ERR;
// }
o->internal = NULL;
break;
default:
- sr_warn("la8 out: %s: unsupported event type: %d", __func__,
+ sr_warn("%s: unsupported event type: %d", __func__,
event_type);
*data_out = NULL;
*length_out = 0;
uint8_t *outbuf;
if (!o) {
- sr_warn("la8 out: %s: o was NULL", __func__);
+ sr_warn("%s: o was NULL", __func__);
return SR_ERR_ARG;
}
if (!(ctx = o->internal)) {
- sr_warn("la8 out: %s: o->internal was NULL", __func__);
+ sr_warn("%s: o->internal was NULL", __func__);
return SR_ERR_ARG;
}
if (!data_in) {
- sr_warn("la8 out: %s: data_in was NULL", __func__);
+ sr_warn("%s: data_in was NULL", __func__);
return SR_ERR_ARG;
}
if (!(outbuf = g_try_malloc0(length_in))) {
- sr_warn("la8 out: %s: outbuf malloc failed", __func__);
+ sr_warn("%s: outbuf malloc failed", __func__);
return SR_ERR_MALLOC;
}
#include "libsigrok.h"
#include "libsigrok-internal.h"
+/* Message logging helpers with driver-specific prefix string. */
+#define DRIVER_LOG_DOMAIN "output/csv: "
+#define sr_log(l, s, args...) sr_log(l, DRIVER_LOG_DOMAIN s, ## args)
+#define sr_spew(s, args...) sr_spew(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_dbg(s, args...) sr_dbg(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_info(s, args...) sr_info(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_warn(s, args...) sr_warn(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_err(s, args...) sr_err(DRIVER_LOG_DOMAIN s, ## args)
+
struct context {
unsigned int num_enabled_probes;
unsigned int unitsize;
unsigned int i;
if (!o) {
- sr_err("csv out: %s: o was NULL", __func__);
+ sr_err("%s: o was NULL", __func__);
return SR_ERR_ARG;
}
if (!o->sdi) {
- sr_err("csv out: %s: o->sdi was NULL", __func__);
+ sr_err("%s: o->sdi was NULL", __func__);
return SR_ERR_ARG;
}
if (!o->sdi->driver) {
- sr_err("csv out: %s: o->sdi->driver was NULL", __func__);
+ sr_err("%s: o->sdi->driver was NULL", __func__);
return SR_ERR_ARG;
}
if (!(ctx = g_try_malloc0(sizeof(struct context)))) {
- sr_err("csv out: %s: ctx malloc failed", __func__);
+ sr_err("%s: ctx malloc failed", __func__);
return SR_ERR_MALLOC;
}
struct context *ctx;
if (!o) {
- sr_err("csv out: %s: o was NULL", __func__);
+ sr_err("%s: o was NULL", __func__);
return SR_ERR_ARG;
}
if (!(ctx = o->internal)) {
- sr_err("csv out: %s: o->internal was NULL", __func__);
+ sr_err("%s: o->internal was NULL", __func__);
return SR_ERR_ARG;
}
if (!data_out) {
- sr_err("csv out: %s: data_out was NULL", __func__);
+ sr_err("%s: data_out was NULL", __func__);
return SR_ERR_ARG;
}
switch (event_type) {
case SR_DF_TRIGGER:
- sr_dbg("csv out: %s: SR_DF_TRIGGER event", __func__);
+ sr_dbg("%s: SR_DF_TRIGGER event", __func__);
/* TODO */
*data_out = NULL;
*length_out = 0;
break;
case SR_DF_END:
- sr_dbg("csv out: %s: SR_DF_END event", __func__);
+ sr_dbg("%s: SR_DF_END event", __func__);
/* TODO */
*data_out = NULL;
*length_out = 0;
o->internal = NULL;
break;
default:
- sr_err("csv out: %s: unsupported event type: %d", __func__,
- event_type);
+ sr_err("%s: unsupported event type: %d", __func__, event_type);
*data_out = NULL;
*length_out = 0;
break;
int j;
if (!o) {
- sr_err("csv out: %s: o was NULL", __func__);
+ sr_err("%s: o was NULL", __func__);
return SR_ERR_ARG;
}
if (!(ctx = o->internal)) {
- sr_err("csv out: %s: o->internal was NULL", __func__);
+ sr_err("%s: o->internal was NULL", __func__);
return SR_ERR_ARG;
}
if (!data_in) {
- sr_err("csv out: %s: data_in was NULL", __func__);
+ sr_err("%s: data_in was NULL", __func__);
return SR_ERR_ARG;
}
#include "libsigrok.h"
#include "libsigrok-internal.h"
+/* Message logging helpers with driver-specific prefix string. */
+#define DRIVER_LOG_DOMAIN "output/gnuplot: "
+#define sr_log(l, s, args...) sr_log(l, DRIVER_LOG_DOMAIN s, ## args)
+#define sr_spew(s, args...) sr_spew(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_dbg(s, args...) sr_dbg(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_info(s, args...) sr_info(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_warn(s, args...) sr_warn(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_err(s, args...) sr_err(DRIVER_LOG_DOMAIN s, ## args)
+
struct context {
unsigned int num_enabled_probes;
unsigned int unitsize;
time_t t;
if (!o) {
- sr_err("gnuplot out: %s: o was NULL", __func__);
+ sr_err("%s: o was NULL", __func__);
return SR_ERR_ARG;
}
if (!o->sdi) {
- sr_err("gnuplot out: %s: o->sdi was NULL", __func__);
+ sr_err("%s: o->sdi was NULL", __func__);
return SR_ERR_ARG;
}
if (!o->sdi->driver) {
- sr_err("gnuplot out: %s: o->sdi->driver was NULL", __func__);
+ sr_err("%s: o->sdi->driver was NULL", __func__);
return SR_ERR_ARG;
}
if (!(ctx = g_try_malloc0(sizeof(struct context)))) {
- sr_err("gnuplot out: %s: ctx malloc failed", __func__);
+ sr_err("%s: ctx malloc failed", __func__);
return SR_ERR_MALLOC;
}
if (!(ctx->header = g_try_malloc0(MAX_HEADER_LEN + 1))) {
- sr_err("gnuplot out: %s: ctx->header malloc failed", __func__);
+ sr_err("%s: ctx->header malloc failed", __func__);
g_free(ctx);
return SR_ERR_MALLOC;
}
o->sdi->driver->info_get(SR_DI_CUR_SAMPLERATE,
(const void **)&samplerate, o->sdi);
if (!(frequency_s = sr_samplerate_string(*samplerate))) {
- sr_err("gnuplot out: %s: sr_samplerate_string failed",
- __func__);
+ sr_err("%s: sr_samplerate_string failed", __func__);
g_free(ctx->header);
g_free(ctx);
return SR_ERR;
}
if (!(frequency_s = sr_period_string(*samplerate))) {
- sr_err("gnuplot out: %s: sr_period_string failed", __func__);
+ sr_err("%s: sr_period_string failed", __func__);
g_free(ctx->header);
g_free(ctx);
return SR_ERR;
g_free(frequency_s);
if (b < 0) {
- sr_err("gnuplot out: %s: sprintf failed", __func__);
+ sr_err("%s: sprintf failed", __func__);
g_free(ctx->header);
g_free(ctx);
return SR_ERR;
uint64_t *length_out)
{
if (!o) {
- sr_err("gnuplot out: %s: o was NULL", __func__);
+ sr_err("%s: o was NULL", __func__);
return SR_ERR_ARG;
}
if (!data_out) {
- sr_err("gnuplot out: %s: data_out was NULL", __func__);
+ sr_err("%s: data_out was NULL", __func__);
return SR_ERR_ARG;
}
if (!length_out) {
- sr_err("gnuplot out: %s: length_out was NULL", __func__);
+ sr_err("%s: length_out was NULL", __func__);
return SR_ERR_ARG;
}
o->internal = NULL;
break;
default:
- sr_err("gnuplot out: %s: unsupported event type: %d",
- __func__, event_type);
+ sr_err("%s: unsupported event type: %d", __func__, event_type);
break;
}
uint8_t *outbuf, *c;
if (!o) {
- sr_err("gnuplot out: %s: o was NULL", __func__);
+ sr_err("%s: o was NULL", __func__);
return SR_ERR_ARG;
}
if (!o->internal) {
- sr_err("gnuplot out: %s: o->internal was NULL", __func__);
+ sr_err("%s: o->internal was NULL", __func__);
return SR_ERR_ARG;
}
if (!data_in) {
- sr_err("gnuplot out: %s: data_in was NULL", __func__);
+ sr_err("%s: data_in was NULL", __func__);
return SR_ERR_ARG;
}
if (!data_out) {
- sr_err("gnuplot out: %s: data_out was NULL", __func__);
+ sr_err("%s: data_out was NULL", __func__);
return SR_ERR_ARG;
}
if (!length_out) {
- sr_err("gnuplot out: %s: length_out was NULL", __func__);
+ sr_err("%s: length_out was NULL", __func__);
return SR_ERR_ARG;
}
outsize += strlen(ctx->header);
if (!(outbuf = g_try_malloc0(outsize))) {
- sr_err("gnuplot out: %s: outbuf malloc failed", __func__);
+ sr_err("%s: outbuf malloc failed", __func__);
return SR_ERR_MALLOC;
}
#include "libsigrok.h"
#include "libsigrok-internal.h"
+/* Message logging helpers with driver-specific prefix string. */
+#define DRIVER_LOG_DOMAIN "output/ols: "
+#define sr_log(l, s, args...) sr_log(l, DRIVER_LOG_DOMAIN s, ## args)
+#define sr_spew(s, args...) sr_spew(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_dbg(s, args...) sr_dbg(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_info(s, args...) sr_info(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_warn(s, args...) sr_warn(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_err(s, args...) sr_err(DRIVER_LOG_DOMAIN s, ## args)
+
struct context {
GString *header;
uint64_t num_samples;
int num_enabled_probes;
if (!(ctx = g_try_malloc(sizeof(struct context)))) {
- sr_err("ols out: %s: ctx malloc failed", __func__);
+ sr_err("%s: ctx malloc failed", __func__);
return SR_ERR_MALLOC;
}
o->internal = ctx;
#include "libsigrok-internal.h"
#include "text.h"
+/* Message logging helpers with driver-specific prefix string. */
+#define DRIVER_LOG_DOMAIN "output/ascii: "
+#define sr_log(l, s, args...) sr_log(l, DRIVER_LOG_DOMAIN s, ## args)
+#define sr_spew(s, args...) sr_spew(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_dbg(s, args...) sr_dbg(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_info(s, args...) sr_info(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_warn(s, args...) sr_warn(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_err(s, args...) sr_err(DRIVER_LOG_DOMAIN s, ## args)
+
SR_PRIV int init_ascii(struct sr_output *o)
{
return init(o, DEFAULT_BPL_ASCII, MODE_ASCII);
* (ctx->num_enabled_probes * max_linelen);
if (!(outbuf = g_try_malloc0(outsize + 1))) {
- sr_err("ascii out: %s: outbuf malloc failed", __func__);
+ sr_err("%s: outbuf malloc failed", __func__);
return SR_ERR_MALLOC;
}
ctx->prevsample = sample;
}
} else {
- sr_info("ascii out: short buffer (length_in=%" PRIu64 ")",
- length_in);
+ sr_info("Short buffer (length_in=%" PRIu64 ").", length_in);
}
*data_out = outbuf;
#include "libsigrok-internal.h"
#include "text.h"
+/* Message logging helpers with driver-specific prefix string. */
+#define DRIVER_LOG_DOMAIN "output/bits: "
+#define sr_log(l, s, args...) sr_log(l, DRIVER_LOG_DOMAIN s, ## args)
+#define sr_spew(s, args...) sr_spew(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_dbg(s, args...) sr_dbg(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_info(s, args...) sr_info(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_warn(s, args...) sr_warn(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_err(s, args...) sr_err(DRIVER_LOG_DOMAIN s, ## args)
+
SR_PRIV int init_bits(struct sr_output *o)
{
return init(o, DEFAULT_BPL_BITS, MODE_BITS);
* (ctx->num_enabled_probes * max_linelen);
if (!(outbuf = g_try_malloc0(outsize + 1))) {
- sr_err("bits out: %s: outbuf malloc failed", __func__);
+ sr_err("%s: outbuf malloc failed", __func__);
return SR_ERR_MALLOC;
}
}
}
} else {
- sr_info("bits out: short buffer (length_in=%" PRIu64 ")",
- length_in);
+ sr_info("Short buffer (length_in=%" PRIu64 ").", length_in);
}
*data_out = outbuf;
#include "libsigrok-internal.h"
#include "text.h"
+/* Message logging helpers with driver-specific prefix string. */
+#define DRIVER_LOG_DOMAIN "output/hex: "
+#define sr_log(l, s, args...) sr_log(l, DRIVER_LOG_DOMAIN s, ## args)
+#define sr_spew(s, args...) sr_spew(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_dbg(s, args...) sr_dbg(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_info(s, args...) sr_info(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_warn(s, args...) sr_warn(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_err(s, args...) sr_err(DRIVER_LOG_DOMAIN s, ## args)
+
SR_PRIV int init_hex(struct sr_output *o)
{
return init(o, DEFAULT_BPL_HEX, MODE_HEX);
/ ctx->samples_per_line * max_linelen + 512;
if (!(outbuf = g_try_malloc0(outsize + 1))) {
- sr_err("hex out: %s: outbuf malloc failed", __func__);
+ sr_err("%s: outbuf malloc failed", __func__);
return SR_ERR_MALLOC;
}
#include "libsigrok-internal.h"
#include "text.h"
+/* Message logging helpers with driver-specific prefix string. */
+#define DRIVER_LOG_DOMAIN "output/text: "
+#define sr_log(l, s, args...) sr_log(l, DRIVER_LOG_DOMAIN s, ## args)
+#define sr_spew(s, args...) sr_spew(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_dbg(s, args...) sr_dbg(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_info(s, args...) sr_info(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_warn(s, args...) sr_warn(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_err(s, args...) sr_err(DRIVER_LOG_DOMAIN s, ## args)
+
SR_PRIV void flush_linebufs(struct context *ctx, uint8_t *outbuf)
{
static int max_probename_len = 0;
char *samplerate_s;
if (!(ctx = g_try_malloc0(sizeof(struct context)))) {
- sr_err("text out: %s: ctx malloc failed", __func__);
+ sr_err("%s: ctx malloc failed", __func__);
return SR_ERR_MALLOC;
}
ctx->samples_per_line = default_spl;
if (!(ctx->header = g_try_malloc0(512))) {
- sr_err("text out: %s: ctx->header malloc failed", __func__);
+ sr_err("%s: ctx->header malloc failed", __func__);
ret = SR_ERR_MALLOC;
goto err;
}
ctx->linebuf_len = ctx->samples_per_line * 2 + 4;
if (!(ctx->linebuf = g_try_malloc0(num_probes * ctx->linebuf_len))) {
- sr_err("text out: %s: ctx->linebuf malloc failed", __func__);
+ sr_err("%s: ctx->linebuf malloc failed", __func__);
ret = SR_ERR_MALLOC;
goto err;
}
if (!(ctx->linevalues = g_try_malloc0(num_probes))) {
- sr_err("text out: %s: ctx->linevalues malloc failed", __func__);
+ sr_err("%s: ctx->linevalues malloc failed", __func__);
ret = SR_ERR_MALLOC;
}
outsize = ctx->num_enabled_probes
* (ctx->samples_per_line + 20) + 512;
if (!(outbuf = g_try_malloc0(outsize))) {
- sr_err("text out: %s: outbuf malloc failed", __func__);
+ sr_err("%s: outbuf malloc failed", __func__);
return SR_ERR_MALLOC;
}
flush_linebufs(ctx, outbuf);
#include "libsigrok.h"
#include "libsigrok-internal.h"
+/* Message logging helpers with driver-specific prefix string. */
+#define DRIVER_LOG_DOMAIN "output/vcd: "
+#define sr_log(l, s, args...) sr_log(l, DRIVER_LOG_DOMAIN s, ## args)
+#define sr_spew(s, args...) sr_spew(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_dbg(s, args...) sr_dbg(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_info(s, args...) sr_info(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_warn(s, args...) sr_warn(DRIVER_LOG_DOMAIN s, ## args)
+#define sr_err(s, args...) sr_err(DRIVER_LOG_DOMAIN s, ## args)
+
struct context {
int num_enabled_probes;
int unitsize;
time_t t;
if (!(ctx = g_try_malloc0(sizeof(struct context)))) {
- sr_err("vcd out: %s: ctx malloc failed", __func__);
+ sr_err("%s: ctx malloc failed", __func__);
return SR_ERR_MALLOC;
}
ctx->probelist[ctx->num_enabled_probes++] = probe->name;
}
if (ctx->num_enabled_probes > 94) {
- sr_err("vcd out: VCD only supports 94 probes.");
+ sr_err("VCD only supports 94 probes.");
return SR_ERR;
}
if (!(ctx->prevbits = g_try_malloc0(sizeof(int) * num_probes))) {
g_string_free(ctx->header, TRUE);
g_free(ctx);
- sr_err("vcd out: %s: ctx->prevbits malloc failed", __func__);
+ sr_err("%s: ctx->prevbits malloc failed", __func__);
return SR_ERR_MALLOC;
}