]>
Commit | Line | Data |
---|---|---|
97554432 | 1 | /* |
50985c20 | 2 | * This file is part of the libsigrok project. |
97554432 | 3 | * |
c73d2ea4 | 4 | * Copyright (C) 2010-2012 Bert Vermeulen <bert@biot.com> |
97554432 BV |
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 | ||
0f8522bf UH |
20 | #ifndef LIBSIGROK_OUTPUT_TEXT_TEXT_H |
21 | #define LIBSIGROK_OUTPUT_TEXT_TEXT_H | |
97554432 BV |
22 | |
23 | #define DEFAULT_BPL_BITS 64 | |
24 | #define DEFAULT_BPL_HEX 192 | |
25 | #define DEFAULT_BPL_ASCII 74 | |
26 | ||
27 | enum outputmode { | |
28 | MODE_BITS = 1, | |
29 | MODE_HEX, | |
30 | MODE_ASCII, | |
31 | }; | |
32 | ||
33 | struct context { | |
ba7dd8bb | 34 | unsigned int num_enabled_channels; |
97554432 BV |
35 | int samples_per_line; |
36 | unsigned int unitsize; | |
37 | int line_offset; | |
38 | int linebuf_len; | |
ba7dd8bb | 39 | GSList *channelnames; |
054e6709 | 40 | uint8_t *linebuf; |
97554432 BV |
41 | int spl_cnt; |
42 | uint8_t *linevalues; | |
43 | char *header; | |
44 | int mark_trigger; | |
3a581560 | 45 | uint8_t *prevsample; |
97554432 BV |
46 | enum outputmode mode; |
47 | }; | |
48 | ||
054e6709 | 49 | SR_PRIV void flush_linebufs(struct context *ctx, uint8_t *outbuf); |
7c1d391c | 50 | SR_PRIV int init(struct sr_output *o, int default_spl, enum outputmode mode); |
8c273ac5 | 51 | SR_PRIV int text_cleanup(struct sr_output *o); |
054e6709 | 52 | SR_PRIV int event(struct sr_output *o, int event_type, uint8_t **data_out, |
7c1d391c | 53 | uint64_t *length_out); |
97554432 | 54 | |
7c1d391c | 55 | SR_PRIV int init_bits(struct sr_output *o); |
054e6709 UH |
56 | SR_PRIV int data_bits(struct sr_output *o, const uint8_t *data_in, |
57 | uint64_t length_in, uint8_t **data_out, | |
7c1d391c | 58 | uint64_t *length_out); |
97554432 | 59 | |
7c1d391c | 60 | SR_PRIV int init_hex(struct sr_output *o); |
054e6709 UH |
61 | SR_PRIV int data_hex(struct sr_output *o, const uint8_t *data_in, |
62 | uint64_t length_in, uint8_t **data_out, | |
63 | uint64_t *length_out); | |
97554432 | 64 | |
7c1d391c | 65 | SR_PRIV int init_ascii(struct sr_output *o); |
054e6709 UH |
66 | SR_PRIV int data_ascii(struct sr_output *o, const uint8_t *data_in, |
67 | uint64_t length_in, uint8_t **data_out, | |
7c1d391c | 68 | uint64_t *length_out); |
97554432 | 69 | |
54ac5277 | 70 | #endif |