From: Uwe Hermann Date: Wed, 18 Apr 2018 21:29:28 +0000 (+0200) Subject: input modules: Name chunk size #defines CHUNK_SIZE consistently. X-Git-Url: https://sigrok.org/gitweb/?a=commitdiff_plain;h=8bc2fa6d820d05f88fa003baa9837ebc7663681d;hp=1fb31414f20f54dfeb9bc36256c98e4a19f3ee0a;p=libsigrok.git input modules: Name chunk size #defines CHUNK_SIZE consistently. --- diff --git a/src/input/binary.c b/src/input/binary.c index f0c798fa..995c47d7 100644 --- a/src/input/binary.c +++ b/src/input/binary.c @@ -29,7 +29,7 @@ #define LOG_PREFIX "input/binary" -#define MAX_CHUNK_SIZE (4 * 1024 * 1024) +#define CHUNK_SIZE (4 * 1024 * 1024) #define DEFAULT_NUM_CHANNELS 8 #define DEFAULT_SAMPLERATE 0 @@ -102,7 +102,7 @@ static int process_buffer(struct sr_input *in) for (i = 0; i < chunk_size; i += chunk) { logic.data = in->buf->str + i; - chunk = MIN(MAX_CHUNK_SIZE, chunk_size - i); + chunk = MIN(CHUNK_SIZE, chunk_size - i); logic.length = chunk; sr_session_send(in->sdi, &packet); } diff --git a/src/input/chronovu_la8.c b/src/input/chronovu_la8.c index c654f242..fcafdf5c 100644 --- a/src/input/chronovu_la8.c +++ b/src/input/chronovu_la8.c @@ -29,7 +29,7 @@ #define DEFAULT_NUM_CHANNELS 8 #define DEFAULT_SAMPLERATE SR_MHZ(100) -#define MAX_CHUNK_SIZE (4 * 1024) +#define CHUNK_SIZE (4 * 1024) #define CHRONOVU_LA8_FILESIZE ((8 * 1024 * 1024) + 5) struct context { @@ -110,7 +110,7 @@ static int process_buffer(struct sr_input *in) for (i = 0; i < chunk_size; i += chunk) { logic.data = in->buf->str + i; - chunk = MIN(MAX_CHUNK_SIZE, chunk_size - i); + chunk = MIN(CHUNK_SIZE, chunk_size - i); logic.length = chunk; sr_session_send(in->sdi, &packet); } diff --git a/src/input/csv.c b/src/input/csv.c index fc0e752c..477e6515 100644 --- a/src/input/csv.c +++ b/src/input/csv.c @@ -26,7 +26,7 @@ #define LOG_PREFIX "input/csv" -#define DATAFEED_MAX_SAMPLES (128 * 1024) +#define CHUNK_SIZE (128 * 1024) /* * The CSV input module has the following options: @@ -624,7 +624,7 @@ static int initial_parse(const struct sr_input *in, GString *buf) * to a location within that large buffer. */ inc->sample_unit_size = (inc->num_channels + 7) / 8; - inc->datafeed_buf_size = DATAFEED_MAX_SAMPLES; + inc->datafeed_buf_size = CHUNK_SIZE; inc->datafeed_buf_size *= inc->sample_unit_size; inc->datafeed_buffer = g_malloc(inc->datafeed_buf_size); inc->datafeed_buf_fill = 0; diff --git a/src/input/trace32_ad.c b/src/input/trace32_ad.c index 1a13c44a..cf8ab298 100644 --- a/src/input/trace32_ad.c +++ b/src/input/trace32_ad.c @@ -45,7 +45,7 @@ #define LOG_PREFIX "input/trace32_ad" -#define OUTBUF_FLUSH_SIZE 10240 +#define CHUNK_SIZE 10240 #define MAX_POD_COUNT 12 #define HEADER_SIZE 80 @@ -151,7 +151,7 @@ static int init(struct sr_input *in, GHashTable *options) 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; } @@ -501,7 +501,7 @@ static void process_record_pi(struct sr_input *in, gsize start) 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); } @@ -554,7 +554,7 @@ static void process_record_iprobe(struct sr_input *in, gsize start) 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); } diff --git a/src/input/vcd.c b/src/input/vcd.c index c0312689..5b541430 100644 --- a/src/input/vcd.c +++ b/src/input/vcd.c @@ -67,7 +67,7 @@ #define LOG_PREFIX "input/vcd" -#define CHUNKSIZE (1024 * 1024) +#define CHUNK_SIZE (1024 * 1024) struct context { gboolean started; @@ -319,7 +319,7 @@ static void add_samples(const struct sr_input *in, size_t count) uint8_t *p; inc = in->priv; - samples_per_chunk = CHUNKSIZE / inc->bytes_per_sample; + samples_per_chunk = CHUNK_SIZE / inc->bytes_per_sample; while (count) { space_left = samples_per_chunk - inc->samples_in_buffer; @@ -498,7 +498,7 @@ static int init(struct sr_input *in, GHashTable *options) in->sdi = g_malloc0(sizeof(struct sr_dev_inst)); in->priv = inc; - inc->buffer = g_malloc(CHUNKSIZE); + inc->buffer = g_malloc(CHUNK_SIZE); return SR_OK; }