input modules: Name chunk size #defines CHUNK_SIZE consistently.

This commit is contained in:
Uwe Hermann 2018-04-18 23:29:28 +02:00
parent 1fb31414f2
commit 8bc2fa6d82
5 changed files with 13 additions and 13 deletions

View File

@ -29,7 +29,7 @@
#define LOG_PREFIX "input/binary" #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_NUM_CHANNELS 8
#define DEFAULT_SAMPLERATE 0 #define DEFAULT_SAMPLERATE 0
@ -102,7 +102,7 @@ static int process_buffer(struct sr_input *in)
for (i = 0; i < chunk_size; i += chunk) { for (i = 0; i < chunk_size; i += chunk) {
logic.data = in->buf->str + i; logic.data = in->buf->str + i;
chunk = MIN(MAX_CHUNK_SIZE, chunk_size - i); chunk = MIN(CHUNK_SIZE, chunk_size - i);
logic.length = chunk; logic.length = chunk;
sr_session_send(in->sdi, &packet); sr_session_send(in->sdi, &packet);
} }

View File

@ -29,7 +29,7 @@
#define DEFAULT_NUM_CHANNELS 8 #define DEFAULT_NUM_CHANNELS 8
#define DEFAULT_SAMPLERATE SR_MHZ(100) #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) #define CHRONOVU_LA8_FILESIZE ((8 * 1024 * 1024) + 5)
struct context { struct context {
@ -110,7 +110,7 @@ static int process_buffer(struct sr_input *in)
for (i = 0; i < chunk_size; i += chunk) { for (i = 0; i < chunk_size; i += chunk) {
logic.data = in->buf->str + i; logic.data = in->buf->str + i;
chunk = MIN(MAX_CHUNK_SIZE, chunk_size - i); chunk = MIN(CHUNK_SIZE, chunk_size - i);
logic.length = chunk; logic.length = chunk;
sr_session_send(in->sdi, &packet); sr_session_send(in->sdi, &packet);
} }

View File

@ -26,7 +26,7 @@
#define LOG_PREFIX "input/csv" #define LOG_PREFIX "input/csv"
#define DATAFEED_MAX_SAMPLES (128 * 1024) #define CHUNK_SIZE (128 * 1024)
/* /*
* The CSV input module has the following options: * 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. * to a location within that large buffer.
*/ */
inc->sample_unit_size = (inc->num_channels + 7) / 8; 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_buf_size *= inc->sample_unit_size;
inc->datafeed_buffer = g_malloc(inc->datafeed_buf_size); inc->datafeed_buffer = g_malloc(inc->datafeed_buf_size);
inc->datafeed_buf_fill = 0; inc->datafeed_buf_fill = 0;

View File

@ -45,7 +45,7 @@
#define LOG_PREFIX "input/trace32_ad" #define LOG_PREFIX "input/trace32_ad"
#define OUTBUF_FLUSH_SIZE 10240 #define CHUNK_SIZE 10240
#define MAX_POD_COUNT 12 #define MAX_POD_COUNT 12
#define HEADER_SIZE 80 #define HEADER_SIZE 80
@ -151,7 +151,7 @@ static int init(struct sr_input *in, GHashTable *options)
return SR_ERR; 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; 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); 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); 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); 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); flush_output_buffer(in);
} }

View File

@ -67,7 +67,7 @@
#define LOG_PREFIX "input/vcd" #define LOG_PREFIX "input/vcd"
#define CHUNKSIZE (1024 * 1024) #define CHUNK_SIZE (1024 * 1024)
struct context { struct context {
gboolean started; gboolean started;
@ -319,7 +319,7 @@ static void add_samples(const struct sr_input *in, size_t count)
uint8_t *p; uint8_t *p;
inc = in->priv; inc = in->priv;
samples_per_chunk = CHUNKSIZE / inc->bytes_per_sample; samples_per_chunk = CHUNK_SIZE / inc->bytes_per_sample;
while (count) { while (count) {
space_left = samples_per_chunk - inc->samples_in_buffer; 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->sdi = g_malloc0(sizeof(struct sr_dev_inst));
in->priv = inc; in->priv = inc;
inc->buffer = g_malloc(CHUNKSIZE); inc->buffer = g_malloc(CHUNK_SIZE);
return SR_OK; return SR_OK;
} }