X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=output%2Foutput_vcd.c;h=6833eec26123da43f44c7d86044bb68d5208566b;hb=f50f3f40d9238b0c50be67e52bc132aadfcf2050;hp=6564fec915f71c3c681d8b2292167c4a38b30526;hpb=b33e7d7058a5a092eea7b8bce18cf95d70e5ff5a;p=libsigrok.git diff --git a/output/output_vcd.c b/output/output_vcd.c index 6564fec9..6833eec2 100644 --- a/output/output_vcd.c +++ b/output/output_vcd.c @@ -49,7 +49,7 @@ $dumpvars\n"; 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; @@ -59,7 +59,7 @@ static int init(struct output *o) time_t t; if (!(ctx = calloc(1, sizeof(struct context)))) - return SIGROK_ERR_MALLOC; + return SR_ERR_MALLOC; o->internal = ctx; ctx->num_enabled_probes = 0; @@ -72,7 +72,7 @@ static int init(struct output *o) } if (ctx->num_enabled_probes > 94) { g_warning("VCD only supports 94 probes."); - return SIGROK_ERR; + return SR_ERR; } ctx->probelist[ctx->num_enabled_probes] = 0; @@ -97,7 +97,7 @@ static int init(struct output *o) if (!((samplerate_s = sigrok_samplerate_string(ctx->samplerate)))) { g_string_free(ctx->header, TRUE); free(ctx); - return SIGROK_ERR; + return SR_ERR; } g_string_append_printf(ctx->header, vcd_header_comment, ctx->num_enabled_probes, num_probes, samplerate_s); @@ -115,7 +115,7 @@ static int init(struct output *o) if (!(frequency_s = sigrok_period_string(ctx->period))) { g_string_free(ctx->header, TRUE); free(ctx); - return SIGROK_ERR; + return SR_ERR; } g_string_append_printf(ctx->header, "$timescale %s $end\n", frequency_s); free(frequency_s); @@ -135,13 +135,13 @@ static int init(struct output *o) if (!(ctx->prevbits = calloc(sizeof(int), num_probes))) { g_string_free(ctx->header, TRUE); free(ctx); - return SIGROK_ERR_MALLOC; + return SR_ERR_MALLOC; } - return SIGROK_OK; + 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; @@ -162,10 +162,10 @@ static int event(struct output *o, int event_type, char **data_out, break; } - return SIGROK_OK; + 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; @@ -208,7 +208,7 @@ static int data(struct output *o, char *data_in, uint64_t length_in, /* Output which signal changed to which value. */ g_string_append_printf(out, "#%" PRIu64 "\n%i%c\n", - (long)(((float)samplecount / ctx->samplerate) + (uint64_t)(((float)samplecount / ctx->samplerate) * ctx->period), curbit, (char)('!' + p)); } @@ -219,10 +219,10 @@ static int data(struct output *o, char *data_in, uint64_t length_in, *length_out = out->len; g_string_free(out, FALSE); - return SIGROK_OK; + return SR_OK; } -struct output_format output_vcd = { +struct sr_output_format output_vcd = { "vcd", "Value Change Dump (VCD)", DF_LOGIC,