]> sigrok.org Git - libsigrok.git/blobdiff - output/output_vcd.c
Add sr_ prefix to datafeed_callback typedef.
[libsigrok.git] / output / output_vcd.c
index 06bb7f4578a9da34b087097bc3b3c62232f8ca97..61d27a10ec157a538d338b6bca834536355d6aa7 100644 (file)
@@ -49,10 +49,10 @@ $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;
+       struct sr_probe *probe;
        GSList *l;
        int num_probes, i;
        char *samplerate_s, *frequency_s, *timestamp;
@@ -91,10 +91,10 @@ static int init(struct output *o)
        g_string_append_printf(ctx->header, "$version %s %s $end\n",
                        PACKAGE, PACKAGE_VERSION);
 
-       if (o->device->plugin) {
+       if (o->device->plugin && sr_device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
                ctx->samplerate = *((uint64_t *) o->device->plugin->get_device_info(
-                               o->device->plugin_index, DI_CUR_SAMPLERATE));
-               if (!((samplerate_s = sigrok_samplerate_string(ctx->samplerate)))) {
+                               o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
+               if (!((samplerate_s = sr_samplerate_string(ctx->samplerate)))) {
                        g_string_free(ctx->header, TRUE);
                        free(ctx);
                        return SR_ERR;
@@ -112,7 +112,7 @@ static int init(struct output *o)
                ctx->period = MHZ(1);
        else
                ctx->period = KHZ(1);
-       if (!(frequency_s = sigrok_period_string(ctx->period))) {
+       if (!(frequency_s = sr_period_string(ctx->period))) {
                g_string_free(ctx->header, TRUE);
                free(ctx);
                return SR_ERR;
@@ -141,7 +141,7 @@ static int init(struct output *o)
        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;
@@ -149,7 +149,7 @@ static int event(struct output *o, int event_type, char **data_out,
 
        ctx = o->internal;
        switch (event_type) {
-       case DF_END:
+       case SR_DF_END:
                outbuf = strdup("$dumpoff\n$end\n");
                *data_out = outbuf;
                *length_out = strlen(outbuf);
@@ -165,7 +165,7 @@ static int event(struct output *o, int event_type, char **data_out,
        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;
@@ -222,10 +222,10 @@ static int data(struct output *o, char *data_in, uint64_t length_in,
        return SR_OK;
 }
 
-struct output_format output_vcd = {
+struct sr_output_format output_vcd = {
        "vcd",
        "Value Change Dump (VCD)",
-       DF_LOGIC,
+       SR_DF_LOGIC,
        init,
        data,
        event,