libsigrok
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
text.h
Go to the documentation of this file.
00001 /*
00002  * This file is part of the sigrok project.
00003  *
00004  * Copyright (C) 2010-2012 Bert Vermeulen <bert@biot.com>
00005  *
00006  * This program is free software: you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation, either version 3 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00018  */
00019 
00020 #ifndef LIBSIGROK_OUTPUT_TEXT_TEXT_H
00021 #define LIBSIGROK_OUTPUT_TEXT_TEXT_H
00022 
00023 #define DEFAULT_BPL_BITS 64
00024 #define DEFAULT_BPL_HEX  192
00025 #define DEFAULT_BPL_ASCII 74
00026 
00027 enum outputmode {
00028         MODE_BITS = 1,
00029         MODE_HEX,
00030         MODE_ASCII,
00031 };
00032 
00033 struct context {
00034         unsigned int num_enabled_probes;
00035         int samples_per_line;
00036         unsigned int unitsize;
00037         int line_offset;
00038         int linebuf_len;
00039         char *probelist[SR_MAX_NUM_PROBES + 1];
00040         uint8_t *linebuf;
00041         int spl_cnt;
00042         uint8_t *linevalues;
00043         char *header;
00044         int mark_trigger;
00045         uint64_t prevsample;
00046         enum outputmode mode;
00047 };
00048 
00049 SR_PRIV void flush_linebufs(struct context *ctx, uint8_t *outbuf);
00050 SR_PRIV int init(struct sr_output *o, int default_spl, enum outputmode mode);
00051 SR_PRIV int event(struct sr_output *o, int event_type, uint8_t **data_out,
00052                   uint64_t *length_out);
00053 
00054 SR_PRIV int init_bits(struct sr_output *o);
00055 SR_PRIV int data_bits(struct sr_output *o, const uint8_t *data_in,
00056                       uint64_t length_in, uint8_t **data_out,
00057                       uint64_t *length_out);
00058 
00059 SR_PRIV int init_hex(struct sr_output *o);
00060 SR_PRIV int data_hex(struct sr_output *o, const uint8_t *data_in,
00061                      uint64_t length_in, uint8_t **data_out,
00062                      uint64_t *length_out);
00063 
00064 SR_PRIV int init_ascii(struct sr_output *o);
00065 SR_PRIV int data_ascii(struct sr_output *o, const uint8_t *data_in,
00066                        uint64_t length_in, uint8_t **data_out,
00067                        uint64_t *length_out);
00068 
00069 #endif
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines