propellerimage.h
1 #pragma once
2 
3 #include <QByteArray>
4 #include <QDebug>
5 #include <QString>
6 #include <QHash>
7 
55 {
56  enum ImageFormat {
57  _long_clockfrequency = 0,
58  _byte_clockmode = 4,
59  _byte_checksum = 5,
60  _word_code = 6,
61  _word_variables = 8,
62  _word_stackspace = 10,
63  _size_eeprom = 32768
64  };
65 
66 
67 
68 public:
69 
73  enum ImageType {
77  };
78 
79 private:
80 
81  int EEPROM_SIZE;
82  QByteArray _image;
83  QString _filename;
84  ImageType _type;
85  QHash<ImageType, QString> _typenames;
86  QHash<quint8, QString> _clkmodesettings;
87  QHash<quint8, QString> initClockModeSettings();
88 
89 public:
90 
91  PropellerImage( QByteArray image = QByteArray(),
92  QString filename = "");
93 
99  quint8 checksum();
100  bool checksumIsValid();
101  bool isValid();
102  bool recalculateChecksum();
110  QString fileName();
112  QString imageTypeText();
113 
114  quint32 imageSize();
115  quint32 programSize();
116  quint32 variableSize();
117  quint32 stackSize();
118 
119  quint16 startOfCode();
120  quint16 startOfVariables();
121  quint16 startOfStackSpace();
129  QByteArray data();
130  void setData(QByteArray image);
131 
132  quint8 readByte( int pos);
133  quint16 readWord( int pos);
134  quint32 readLong( int pos);
135 
136  void writeByte(int pos, quint8 value);
137  void writeWord(int pos, quint16 value);
138  void writeLong(int pos, quint32 value);
139 
148  quint32 clockFrequency();
149  void setClockFrequency(quint32 frequency);
150 
151  quint8 clockMode();
152  QString clockModeText();
153  QString clockModeText(quint8 value);
154  bool setClockMode(quint8 value);
155 
158 };
quint16 startOfVariables()
Definition: propellerimage.cpp:142
quint8 checksum()
Definition: propellerimage.cpp:23
bool recalculateChecksum()
Definition: propellerimage.cpp:49
void setData(QByteArray image)
Definition: propellerimage.cpp:71
quint16 startOfCode()
Definition: propellerimage.cpp:128
quint8 clockMode()
Definition: propellerimage.cpp:271
QByteArray data()
Definition: propellerimage.cpp:62
QString fileName()
Definition: propellerimage.cpp:342
QString imageTypeText()
Definition: propellerimage.cpp:384
quint32 stackSize()
Definition: propellerimage.cpp:119
quint32 imageSize()
Definition: propellerimage.cpp:90
Not a valid image file.
Definition: propellerimage.h:74
void writeLong(int pos, quint32 value)
Definition: propellerimage.cpp:224
PropellerImage(QByteArray image=QByteArray(), QString filename="")
Definition: propellerimage.cpp:3
quint8 readByte(int pos)
Definition: propellerimage.cpp:162
quint16 readWord(int pos)
Definition: propellerimage.cpp:175
quint32 readLong(int pos)
Definition: propellerimage.cpp:189
void setClockFrequency(quint32 frequency)
Definition: propellerimage.cpp:235
quint32 programSize()
Definition: propellerimage.cpp:101
ImageType
Definition: propellerimage.h:73
Complete EEPROM images (usually have a .eeprom extension)
Definition: propellerimage.h:76
bool isValid()
Definition: propellerimage.cpp:81
quint16 startOfStackSpace()
Definition: propellerimage.cpp:151
quint32 clockFrequency()
Definition: propellerimage.cpp:262
ImageType imageType()
Definition: propellerimage.cpp:351
bool setClockMode(quint8 value)
Definition: propellerimage.cpp:244
void writeWord(int pos, quint16 value)
Definition: propellerimage.cpp:212
Program data-only image files (usually have a .binary extension)
Definition: propellerimage.h:75
QString clockModeText()
Definition: propellerimage.cpp:284
void writeByte(int pos, quint8 value)
Definition: propellerimage.cpp:201
quint32 variableSize()
Definition: propellerimage.cpp:110
bool checksumIsValid()
Definition: propellerimage.cpp:41
The PropellerImage class encapsulates Propeller binary images.
Definition: propellerimage.h:54