srecord: output/file/idt.h Source File

srecord 1.65.0

Loading...
Searching...
No Matches
idt.h
Go to the documentation of this file.
1//
2// srecord - Manipulate EPROM load files
3// Copyright (C) 2011 Peter Miller
4//
5// This program is free software; you can redistribute it and/or modify it
6// under the terms of the GNU Lesser General Public License as published by
7// the Free Software Foundation; either version 3 of the License, or (at your
8// option) any later version.
9//
10// This program is distributed in the hope that it will be useful, but WITHOUT
11// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13// more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with this program. If not, see <http://www.gnu.org/licenses/>.
17//
18
19#ifndef SRECORD_OUTPUT_FILE_IDT_H
20#define SRECORD_OUTPUT_FILE_IDT_H
21
22#include <srecord/output/file.h>
23
24namespace srecord {
25
26/**
27 * The srecord::output_file_idt class is used to represent an output
28 * file which emits Integrated Device Technology (IDT) system
29 * integration module (IDT/sim) binary format.
30 *
31 * @sa
32 * #srecord::output_file_motorola,
33 * #srecord::output_file_wilson,
34 */
35 class output_file_idt:
36 public output_file
37{
38public:
39 /**
40 * The destructor.
41 */
42 virtual ~output_file_idt();
43
44 /**
45 * The create class method is used to create new dynamically
46 * allocated instances of this class.
47 *
48 * @param file_name
49 * The file name to open to write data to. The name "-" is
50 * understood to mean the standard output.
51 */
52 static pointer create(const std::string &file_name);
53
54protected:
55 // See base class for documentation.
56 void write(const record &rec);
57
58 // See base class for documentation.
59 void line_length_set(int);
60
61 // See base class for documentation.
62 void address_length_set(int nbytes);
63
64 // See base class for documentation.
65 int preferred_block_size_get(void) const;
66
67 // See base class for documentation.
68 bool preferred_block_size_set(int nbytes);
69
70 // See base class for documentation.
71 const char *format_name(void) const;
72
73 // See base class for documentation.
74 bool is_binary(void) const;
75
76private:
77 /**
78 * The constructor.
79 *
80 * @param file_name
81 * The file name to open to write data to. The name "-" is
82 * understood to mean the standard output.
83 */
84 output_file_idt(const std::string &file_name);
85
86 /**
87 * The data_count instance variable is used to remember the total
88 * number of ouput data lines have occurred to date. Ths is used
89 * at the end of the file to emit an S5 record.
90 */
91 unsigned long data_count;
92
93 /**
94 * The pref_block_size instance variable is used to remember the
95 * preferred number of data bytes (NOT encoded hex characters) to
96 * be placed in each output line.
97 */
98 int pref_block_size;
99
100 /**
101 * The address_length instance variable is used to remember the
102 * minimum number of address bytes to be emitted into output lines.
103 */
104 int address_length;
105
106 /**
107 * The data_count_written instance variable is used to remember
108 * whether or not we have written out the data count record.
109 * Usually this is done with the start arrdess record, but there
110 * are circumstances where it will be needed when the file is
111 * closed.
112 */
113 bool data_count_written;
114
115 /**
116 * The write_data_count method is used to write out a data count
117 * record, if one is required.
118 */
119 void write_data_count(void);
120
121 /**
122 * The write_inner method is used to write a line of output.
123 *
124 * @param tag
125 * The tag value at the start of the line. For example, and S1
126 * line would have a tag of 1.
127 * @param address
128 * The address of the first byte of data on the line.
129 * @param address_nbytes
130 * The number of bytes of address to emit.
131 * @param data
132 * The palyload of this line.
133 * @param data_nbytes
134 * The number of bytes of payload.
135 */
136 void write_inner(int tag, unsigned long address, unsigned address_nbytes,
137 const unsigned char *data, size_t data_nbytes);
138
139 /**
140 * The default constructor.
141 * Do not use.
142 */
143 output_file_idt();
144
145 /**
146 * The copy constructor.
147 * Do not use.
148 */
149 output_file_idt(const output_file_idt &);
150
151 /**
152 * The assignment operator.
153 * Do not use.
154 */
155 output_file_idt &operator=(const output_file_idt &);
156};
157
158};
159
160// vim: set ts=8 sw=4 et :
161#endif // SRECORD_OUTPUT_FILE_IDT_H
srecord::output_file_idt::format_name
const char * format_name(void) const
The format_name method is used to obtain the name of this output format.
srecord::output_file_idt::write
void write(const record &rec)
The write method is used to write a recordonto an output.
srecord::output_file_idt::is_binary
bool is_binary(void) const
The is_binary method is used to to determine whether or not a file format is binary (true) of text (f...
srecord::output_file_idt::create
static pointer create(const std::string &file_name)
The create class method is used to create new dynamically allocated instances of this class.
srecord::output_file_idt::line_length_set
void line_length_set(int)
The set_line_length method is used to set the maximum length of an output line, for those formats for...
srecord::output_file_idt::~output_file_idt
virtual ~output_file_idt()
The destructor.
srecord::output_file_idt::preferred_block_size_set
bool preferred_block_size_set(int nbytes)
The preferred_block_size_set method is is to set a precific number of bytes for the preferred block s...
srecord::output_file_idt::address_length_set
void address_length_set(int nbytes)
The address_length_set method is used to set the minimum number of bytes to be written for addresses ...
srecord::output_file_idt::preferred_block_size_get
int preferred_block_size_get(void) const
The preferred_block_size_get method is used to get the proferred block size of the output fformat.
srecord::output_file::output_file
output_file()
The default constructor.
srecord::output::pointer
std::shared_ptr< output > pointer
Definition output.h:41
srecord::record
The srecord::record class is used to represent a data record read from a file.
Definition record.h:35
srecord
Definition adler16.h:25
file.h