]> sigrok.org Git - libsigrok.git/blame - output/text/text.h
split output_text into more manageable pieces
[libsigrok.git] / output / text / text.h
CommitLineData
97554432
BV
1/*
2 * This file is part of the sigrok project.
3 *
4 * Copyright (C) 2011 Bert Vermeulen <bert@biot.com>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20
21#ifndef TEXT_H_
22#define TEXT_H_
23
24#define DEFAULT_BPL_BITS 64
25#define DEFAULT_BPL_HEX 192
26#define DEFAULT_BPL_ASCII 74
27
28enum outputmode {
29 MODE_BITS = 1,
30 MODE_HEX,
31 MODE_ASCII,
32};
33
34struct context {
35 unsigned int num_enabled_probes;
36 int samples_per_line;
37 unsigned int unitsize;
38 int line_offset;
39 int linebuf_len;
40 char *probelist[65];
41 char *linebuf;
42 int spl_cnt;
43 uint8_t *linevalues;
44 char *header;
45 int mark_trigger;
46 uint64_t prevsample;
47 enum outputmode mode;
48};
49
50void flush_linebufs(struct context *ctx, char *outbuf);
51int init(struct output *o, int default_spl, enum outputmode mode);
52int event(struct output *o, int event_type, char **data_out,
53 uint64_t *length_out);
54
55
56int init_bits(struct output *o);
57int data_bits(struct output *o, char *data_in, uint64_t length_in,
58 char **data_out, uint64_t *length_out);
59
60int init_hex(struct output *o);
61int data_hex(struct output *o, char *data_in, uint64_t length_in,
62 char **data_out, uint64_t *length_out);
63
64int init_ascii(struct output *o);
65int data_ascii(struct output *o, char *data_in, uint64_t length_in,
66 char **data_out, uint64_t *length_out);
67
68
69#endif /* TEXT_H_ */