#define LOG_PREFIX "input/trace32_ad"
-#define MAX_CHUNK_SIZE 4096
-#define OUTBUF_FLUSH_SIZE 10240
+#define CHUNK_SIZE (4 * 1024 * 1024)
#define MAX_POD_COUNT 12
#define HEADER_SIZE 80
return SR_ERR;
}
- inc->out_buf = g_string_sized_new(OUTBUF_FLUSH_SIZE);
+ inc->out_buf = g_string_sized_new(CHUNK_SIZE);
return SR_OK;
}
-static int format_match(GHashTable *metadata)
+static int format_match(GHashTable *metadata, unsigned int *confidence)
{
GString *buf;
+ int rc;
buf = g_hash_table_lookup(metadata, GINT_TO_POINTER(SR_INPUT_META_HEADER));
+ rc = process_header(buf, NULL);
- return process_header(buf, NULL);
+ if (rc != SR_OK)
+ return rc;
+ *confidence = 10;
+
+ return SR_OK;
}
static int process_header(GString *buf, struct context *inc)
inc->format = AD_FORMAT_TXTHDR;
g_free(format_name_sig);
g_free(format_name);
- sr_err("This format isn't implemented yet, aborting.");
+ if (inc)
+ sr_err("This format isn't implemented yet, aborting.");
+ else
+ sr_dbg("Not a supported trace32 input file.");
return SR_ERR;
} else {
g_free(format_name_sig);
g_free(format_name);
- sr_err("Don't know this file format, aborting.");
+ if (inc)
+ sr_err("Don't know this file format, aborting.");
+ else
+ sr_dbg("Not a trace32 input file.");
return SR_ERR;
}
continue;
for (channel = 0; channel < 16; channel++) {
- snprintf(name, 8, "%c%d", get_pod_name_from_id(pod), channel);
+ snprintf(name, sizeof(name), "%c%d", get_pod_name_from_id(pod), channel);
inc->channels[pod][channel] =
sr_channel_new(in->sdi, chan_id, SR_CHANNEL_LOGIC, TRUE, name);
chan_id++;
}
- snprintf(name, 8, "CLK%c", get_pod_name_from_id(pod));
+ snprintf(name, sizeof(name), "CLK%c", get_pod_name_from_id(pod));
inc->channels[pod][16] =
sr_channel_new(in->sdi, chan_id, SR_CHANNEL_LOGIC, TRUE, name);
chan_id++;
g_string_append_len(inc->out_buf, single_payload, payload_len);
}
- if (inc->out_buf->len >= OUTBUF_FLUSH_SIZE)
+ if (inc->out_buf->len >= CHUNK_SIZE)
flush_output_buffer(in);
}
g_string_append_len(inc->out_buf, single_payload, payload_len);
}
- if (inc->out_buf->len >= OUTBUF_FLUSH_SIZE)
+ if (inc->out_buf->len >= CHUNK_SIZE)
flush_output_buffer(in);
}
{ "podN", "Import pod N", "Create channels and data for pod N", NULL, NULL },
{ "podO", "Import pod O", "Create channels and data for pod O", NULL, NULL },
- { "samplerate", "Reduced sample rate in MHz", "Reduced sample rate in MHz", NULL, NULL },
+ { "samplerate", "Reduced sample rate (MHz)", "Reduce the original sample rate of 12.8 GHz to the specified sample rate in MHz", NULL, NULL },
ALL_ZERO
};