diff options
Diffstat (limited to 'src/devices/pic/base')
-rw-r--r-- | src/devices/pic/base/pic.cpp | 120 | ||||
-rw-r--r-- | src/devices/pic/base/pic.h | 62 | ||||
-rw-r--r-- | src/devices/pic/base/pic_config.cpp | 100 | ||||
-rw-r--r-- | src/devices/pic/base/pic_config.h | 56 | ||||
-rw-r--r-- | src/devices/pic/base/pic_protection.cpp | 94 | ||||
-rw-r--r-- | src/devices/pic/base/pic_protection.h | 30 | ||||
-rw-r--r-- | src/devices/pic/base/pic_register.cpp | 88 | ||||
-rw-r--r-- | src/devices/pic/base/pic_register.h | 48 |
8 files changed, 299 insertions, 299 deletions
diff --git a/src/devices/pic/base/pic.cpp b/src/devices/pic/base/pic.cpp index 8f81540..b58f480 100644 --- a/src/devices/pic/base/pic.cpp +++ b/src/devices/pic/base/pic.cpp @@ -138,9 +138,9 @@ uint Pic::Data::nbAddresses(MemoryRangeType type) const return (range(type).end - range(type).start + 1); } -QString Pic::Data::fname(Device::Special special) const +TQString Pic::Data::fname(Device::Special special) const { - QString s = name(); + TQString s = name(); switch (special.type()) { case Device::Special::Normal: break; case Device::Special::LowPower: @@ -149,11 +149,11 @@ QString Pic::Data::fname(Device::Special special) const break; case Device::Special::LowVoltage: // assume name is of form "NNXN..." - s.replace(2, 1, "LV"); + s.tqreplace(2, 1, "LV"); break; case Device::Special::HighVoltage: // assume name is of form "NNXN..." - s.replace(2, 1, "HV"); + s.tqreplace(2, 1, "HV"); break; case Device::Special::Nb_Types: Q_ASSERT(false); break; } @@ -163,7 +163,7 @@ QString Pic::Data::fname(Device::Special special) const bool Pic::Data::matchId(BitValue rawId, Device::IdData &idata) const { if ( !isPresent(MemoryRangeType::DeviceId) ) return false; - QMap<Device::Special, BitValue>::const_iterator it; + TQMap<Device::Special, BitValue>::const_iterator it; for (it=_ids.begin(); it!=_ids.end(); ++it) { idata.special = it.key(); BitValue nid = 0x0; @@ -175,23 +175,23 @@ bool Pic::Data::matchId(BitValue rawId, Device::IdData &idata) const case Architecture::P18F: case Architecture::P18J: nid = rawId.clearMaskBits(0x1F); - idata.revision = rawId.maskWith(0x1F); + idata.revision = rawId.tqmaskWith(0x1F); break; case Architecture::P24F: - nid = (rawId >> 16).maskWith(0x3FFF); - idata.revision = (rawId >> 6).maskWith(0x7); - idata.minorRevision = rawId.maskWith(0x7); + nid = (rawId >> 16).tqmaskWith(0x3FFF); + idata.revision = (rawId >> 6).tqmaskWith(0x7); + idata.minorRevision = rawId.tqmaskWith(0x7); break; case Architecture::P30F: - nid = (rawId >> 16).maskWith(0xFFFF); - idata.revision = (rawId >> 6).maskWith(0x3F); - idata.minorRevision = rawId.maskWith(0x3F); - idata.process = (rawId >> 12).maskWith(0xF); + nid = (rawId >> 16).tqmaskWith(0xFFFF); + idata.revision = (rawId >> 6).tqmaskWith(0x3F); + idata.minorRevision = rawId.tqmaskWith(0x3F); + idata.process = (rawId >> 12).tqmaskWith(0xF); break; case Architecture::P24H: case Architecture::P33F: - nid = (rawId >> 16).maskWith(0xFFFF); - idata.revision = rawId.maskWith(0xFFFF); // ?? + nid = (rawId >> 16).tqmaskWith(0xFFFF); + idata.revision = rawId.tqmaskWith(0xFFFF); // ?? break; case Architecture::Nb_Types: Q_ASSERT(false); break; } @@ -200,10 +200,10 @@ bool Pic::Data::matchId(BitValue rawId, Device::IdData &idata) const return false; } -QStringList Pic::Data::idNames(const QMap<QString, Device::IdData> &ids) const +TQStringList Pic::Data::idNames(const TQMap<TQString, Device::IdData> &ids) const { - QStringList list; - QMap<QString, Device::IdData>::const_iterator it; + TQStringList list; + TQMap<TQString, Device::IdData>::const_iterator it; for (it=ids.begin(); it!=ids.end(); ++it) { switch (_architecture.type()) { case Architecture::P10X: @@ -212,17 +212,17 @@ QStringList Pic::Data::idNames(const QMap<QString, Device::IdData> &ids) const case Architecture::P18C: case Architecture::P18F: case Architecture::P18J: - list += i18n("%1 (rev. %2)").arg(it.key()).arg(toLabel(it.data().revision)); + list += i18n("%1 (rev. %2)").tqarg(it.key()).tqarg(toLabel(it.data().revision)); break; case Architecture::P24F: - list += i18n("%1 (rev. %2.%3)").arg(it.key()).arg(toLabel(it.data().revision)).arg(toLabel(it.data().minorRevision)); + list += i18n("%1 (rev. %2.%3)").tqarg(it.key()).tqarg(toLabel(it.data().revision)).tqarg(toLabel(it.data().minorRevision)); break; case Architecture::P30F: - list += i18n("%1 (proc. %2; rev. %3.%4)").arg(it.key()).arg(toLabel(it.data().process)).arg(toLabel(it.data().revision)).arg(toLabel(it.data().minorRevision)); + list += i18n("%1 (proc. %2; rev. %3.%4)").tqarg(it.key()).tqarg(toLabel(it.data().process)).tqarg(toLabel(it.data().revision)).tqarg(toLabel(it.data().minorRevision)); break; case Architecture::P24H: case Architecture::P33F: - list += i18n("%1 (rev. %2)").arg(it.key()).arg(toLabel(it.data().revision)); + list += i18n("%1 (rev. %2)").tqarg(it.key()).tqarg(toLabel(it.data().revision)); break; case Architecture::Nb_Types: Q_ASSERT(false); break; } @@ -230,20 +230,20 @@ QStringList Pic::Data::idNames(const QMap<QString, Device::IdData> &ids) const return list; } -bool Pic::Data::checkCalibration(const Device::Array &data, QString *message) const +bool Pic::Data::checkCalibration(const Device::Array &data, TQString *message) const { Q_ASSERT( nbWords(MemoryRangeType::Cal)==data.count() ); for (uint i=0; i<data.count(); i++) { - QString address = toHexLabel(range(MemoryRangeType::Cal).start + i*addressIncrement(MemoryRangeType::Cal), nbCharsAddress()); - if ( data[i]==mask(MemoryRangeType::Cal) ) { - if (message) *message = i18n("Calibration word at address %1 is blank.").arg(address); + TQString address = toHexLabel(range(MemoryRangeType::Cal).start + i*addressIncrement(MemoryRangeType::Cal), nbCharsAddress()); + if ( data[i]==tqmask(MemoryRangeType::Cal) ) { + if (message) *message = i18n("Calibration word at address %1 is blank.").tqarg(address); return false; } } if ( data.count()==1 ) { - if ( data[0].maskWith(_calibration.opcodeMask)!=_calibration.opcode ) { + if ( data[0].tqmaskWith(_calibration.opcodeMask)!=_calibration.opcode ) { if (message) *message = i18n("Calibration word is not a compatible opcode (%2).") - .arg(toHexLabel(_calibration.opcode, nbCharsWord(MemoryRangeType::Code))); + .tqarg(toHexLabel(_calibration.opcode, nbCharsWord(MemoryRangeType::Code))); return false; } } @@ -261,21 +261,21 @@ bool Pic::Data::hasFeature(Feature feature, bool *unknown) const if (unknown) *unknown = !ok; if (!ok) return false; switch (feature.type()) { - case Feature::CCP: return registersData().sfrs.contains("CCP1CON"); - case Feature::ADC: return registersData().sfrs.contains("ADCON0"); - case Feature::SSP: return registersData().sfrs.contains("SSPCON"); - case Feature::LVD: return registersData().sfrs.contains("LVDCON"); - case Feature::USB: return registersData().sfrs.contains("UCON"); + case Feature::CCP: return registersData().sfrs.tqcontains("CCP1CON"); + case Feature::ADC: return registersData().sfrs.tqcontains("ADCON0"); + case Feature::SSP: return registersData().sfrs.tqcontains("SSPCON"); + case Feature::LVD: return registersData().sfrs.tqcontains("LVDCON"); + case Feature::USB: return registersData().sfrs.tqcontains("UCON"); case Feature::USART: - return ( registersData().sfrs.contains("TXSTA") // 16F - || registersData().sfrs.contains("TXSTA1") // 18F - || registersData().sfrs.contains("U1MODE") ); // 30F - case Feature::CAN: return registersData().sfrs.contains("CANCON") && !registersData().sfrs.contains("ECANCON"); - case Feature::ECAN: return registersData().sfrs.contains("ECANCON"); - case Feature::Ethernet: return registersData().sfrs.contains("ETHCON1"); - case Feature::LCD: return registersData().sfrs.contains("LCDCON"); - case Feature::MotorControl: return registersData().sfrs.contains("PWMCON0"); - case Feature::MotionFeedback: return registersData().sfrs.contains("CAP1CON"); + return ( registersData().sfrs.tqcontains("TXSTA") // 16F + || registersData().sfrs.tqcontains("TXSTA1") // 18F + || registersData().sfrs.tqcontains("U1MODE") ); // 30F + case Feature::CAN: return registersData().sfrs.tqcontains("CANCON") && !registersData().sfrs.tqcontains("ECANCON"); + case Feature::ECAN: return registersData().sfrs.tqcontains("ECANCON"); + case Feature::Ethernet: return registersData().sfrs.tqcontains("ETHCON1"); + case Feature::LCD: return registersData().sfrs.tqcontains("LCDCON"); + case Feature::MotorControl: return registersData().sfrs.tqcontains("PWMCON0"); + case Feature::MotionFeedback: return registersData().sfrs.tqcontains("CAP1CON"); case Feature::SelfWrite: return _selfWrite==SelfWrite::Yes; case Feature::Nb_Types: Q_ASSERT(false); break; } @@ -326,16 +326,16 @@ Device::Array Pic::Data::gotoInstruction(Address address, bool withPageSelection bool Pic::Data::isGotoInstruction(BitValue instruction) const { switch (_architecture.type()) { - case Architecture::P10X: return ( instruction.maskWith(0xE00)==0xA00 ); - case Architecture::P16X: return ( instruction.maskWith(0xF800)==0x2800 ); - case Architecture::P17C: return ( instruction.maskWith(0xE000)==0xC000 ); + case Architecture::P10X: return ( instruction.tqmaskWith(0xE00)==0xA00 ); + case Architecture::P16X: return ( instruction.tqmaskWith(0xF800)==0x2800 ); + case Architecture::P17C: return ( instruction.tqmaskWith(0xE000)==0xC000 ); case Architecture::P18C: case Architecture::P18F: - case Architecture::P18J: return ( instruction.maskWith(0xFF00)==0xEF00 ); + case Architecture::P18J: return ( instruction.tqmaskWith(0xFF00)==0xEF00 ); case Architecture::P24F: case Architecture::P24H: case Architecture::P30F: - case Architecture::P33F: return ( instruction.maskWith(0xFF0000)==0x040000 ); + case Architecture::P33F: return ( instruction.tqmaskWith(0xFF0000)==0x040000 ); case Architecture::Nb_Types: Q_ASSERT(false); break; } return false; @@ -344,59 +344,59 @@ bool Pic::Data::isGotoInstruction(BitValue instruction) const uint Pic::Data::nbWordsWriteAlignment(MemoryRangeType type) const { if ( type!=MemoryRangeType::Code ) return 1; - return QMAX(_nbWordsCodeWrite, uint(16)); + return TQMAX(_nbWordsCodeWrite, uint(16)); } //---------------------------------------------------------------------------- -QDataStream &operator <<(QDataStream &s, const Pic::VoltageData &vd) +TQDataStream &operator <<(TQDataStream &s, const Pic::VoltageData &vd) { s << vd.min << vd.max << vd.nominal; return s; } -QDataStream &operator >>(QDataStream &s, Pic::VoltageData &vd) +TQDataStream &operator >>(TQDataStream &s, Pic::VoltageData &vd) { s >> vd.min >> vd.max >> vd.nominal; return s; } -QDataStream &operator <<(QDataStream &s, const Pic::MemoryRangeData &mrd) +TQDataStream &operator <<(TQDataStream &s, const Pic::MemoryRangeData &mrd) { - s << Q_UINT8(mrd.properties) << mrd.start << mrd.end << mrd.hexFileOffset; + s << TQ_UINT8(mrd.properties) << mrd.start << mrd.end << mrd.hexFileOffset; return s; } -QDataStream &operator >>(QDataStream &s, Pic::MemoryRangeData &mrd) +TQDataStream &operator >>(TQDataStream &s, Pic::MemoryRangeData &mrd) { - Q_UINT8 properties; + TQ_UINT8 properties; s >> properties >> mrd.start >> mrd.end >> mrd.hexFileOffset; mrd.properties = Pic::MemoryRangeProperties(properties); return s; } -QDataStream &operator <<(QDataStream &s, const Pic::Checksum::Data &cd) +TQDataStream &operator <<(TQDataStream &s, const Pic::Checksum::Data &cd) { s << cd.constant << cd.bbsize << cd.algorithm << cd.protectedMaskNames; s << cd.blankChecksum << cd.checkChecksum; return s; } -QDataStream &operator >>(QDataStream &s, Pic::Checksum::Data &cd) +TQDataStream &operator >>(TQDataStream &s, Pic::Checksum::Data &cd) { s >> cd.constant >> cd.bbsize >> cd.algorithm >> cd.protectedMaskNames; s >> cd.blankChecksum >> cd.checkChecksum; return s; } -QDataStream &operator <<(QDataStream &s, const Pic::CalibrationData &cd) +TQDataStream &operator <<(TQDataStream &s, const Pic::CalibrationData &cd) { s << cd.opcode << cd.opcodeMask; return s; } -QDataStream &operator >>(QDataStream &s, Pic::CalibrationData &cd) +TQDataStream &operator >>(TQDataStream &s, Pic::CalibrationData &cd) { s >> cd.opcode >> cd.opcodeMask; return s; } -QDataStream &Pic::operator <<(QDataStream &s, const Pic::Data &data) +TQDataStream &Pic::operator <<(TQDataStream &s, const Pic::Data &data) { s << static_cast<const Device::Data &>(data); s << data._architecture << data._ids << data._nbBitsPC; @@ -410,7 +410,7 @@ QDataStream &Pic::operator <<(QDataStream &s, const Pic::Data &data) s << data._selfWrite; return s; } -QDataStream &Pic::operator >>(QDataStream &s, Pic::Data &data) +TQDataStream &Pic::operator >>(TQDataStream &s, Pic::Data &data) { s >> static_cast<Device::Data &>(data); s >> data._architecture >> data._ids >> data._nbBitsPC; diff --git a/src/devices/pic/base/pic.h b/src/devices/pic/base/pic.h index 7b0dfc4..17fb96a 100644 --- a/src/devices/pic/base/pic.h +++ b/src/devices/pic/base/pic.h @@ -9,8 +9,8 @@ #ifndef PIC_H #define PIC_H -#include <qstringlist.h> -#include <qmap.h> +#include <tqstringlist.h> +#include <tqmap.h> #include "common/global/global.h" #include "common/common/bitvalue.h" @@ -38,8 +38,8 @@ struct CalibrationData { }; enum MemoryRangeTypeProperty { ReadOnly = 0, Writable = 1 }; -Q_DECLARE_FLAGS(MemoryRangeTypeProperties, MemoryRangeTypeProperty) -Q_DECLARE_OPERATORS_FOR_FLAGS(MemoryRangeTypeProperties) +TQ_DECLARE_FLAGS(MemoryRangeTypeProperties, MemoryRangeTypeProperty) +TQ_DECLARE_OPERATORS_FOR_FLAGS(MemoryRangeTypeProperties) struct MemoryRangeTypeData { const char *key, *label; MemoryRangeTypeProperties properties; @@ -73,8 +73,8 @@ BEGIN_DECLARE_ENUM(Architecture) END_DECLARE_ENUM(Architecture, ArchitectureData) enum MemoryRangeProperty { NotPresent = 0, Present = 1, Programmable = 2 }; -Q_DECLARE_FLAGS(MemoryRangeProperties, MemoryRangeProperty) -Q_DECLARE_OPERATORS_FOR_FLAGS(MemoryRangeProperties) +TQ_DECLARE_FLAGS(MemoryRangeProperties, MemoryRangeProperty) +TQ_DECLARE_OPERATORS_FOR_FLAGS(MemoryRangeProperties) struct MemoryRangeData { MemoryRangeProperties properties; Address start, end; @@ -90,8 +90,8 @@ namespace Checksum public: BitValue constant; Algorithm algorithm; - QStringList protectedMaskNames; - QString bbsize; + TQStringList protectedMaskNames; + TQString bbsize; BitValue blankChecksum, checkChecksum; }; } // namespace @@ -107,8 +107,8 @@ class Data : public Device::Data public: Data(); virtual ~Data(); - virtual QString fname(Device::Special special) const; - virtual QString listViewGroup() const { return _architecture.label(); } + virtual TQString fname(Device::Special special) const; + virtual TQString listViewGroup() const { return _architecture.label(); } bool isPresent(MemoryRangeType type) const { return (range(type).properties & Present); } bool isReadable(MemoryRangeType type) const; bool isWritable(MemoryRangeType type) const; @@ -121,7 +121,7 @@ public: uint nbBitsWord(MemoryRangeType type) const { return _architecture.data().nbBits[type.type()]; } uint nbBytesWord(MemoryRangeType type) const { return nbBitsToNbBytes(nbBitsWord(type)); } uint nbCharsWord(MemoryRangeType type) const { return nbBitsToNbChars(nbBitsWord(type)); } - BitValue mask(MemoryRangeType type) const { return uint(1 << nbBitsWord(type))-1; } + BitValue tqmask(MemoryRangeType type) const { return uint(1 << nbBitsWord(type))-1; } BitValue userIdRecommendedMask() const { return _userIdRecommendedMask; } const Config &config() const { return *_config; } Architecture architecture() const { return _architecture; } @@ -129,11 +129,11 @@ public: bool is16bitFamily() const { return ( _architecture.data().nbBitsRegister==16 ); } VoltageData voltage(ProgVoltageType type) const { return _voltages[type]; } virtual bool canWriteCalibration() const { return isWritable(MemoryRangeType::Cal); } - bool checkCalibration(const Device::Array &data, QString *message = 0) const; - const QMap<Device::Special, BitValue> ids() const { return _ids; } + bool checkCalibration(const Device::Array &data, TQString *message = 0) const; + const TQMap<Device::Special, BitValue> ids() const { return _ids; } virtual bool matchId(BitValue rawId, Device::IdData &data) const; - QStringList idNames(const QMap<QString, Device::IdData> &ids) const; - const QMap<QString, Checksum::Data> checksums() const { return _checksums; } + TQStringList idNames(const TQMap<TQString, Device::IdData> &ids) const; + const TQMap<TQString, Checksum::Data> checksums() const { return _checksums; } const RegistersData ®istersData() const; const CalibrationData &calibrationData() const { return _calibration; } @@ -144,36 +144,36 @@ public: private: Architecture _architecture; - QMap<Device::Special, BitValue> _ids; + TQMap<Device::Special, BitValue> _ids; uint _nbBitsPC; uint _nbWordsCodeWrite; // #### only for 18F/18J devices [0 for other devices] uint _nbWordsCodeRowErase; // #### only for 18F/18J devices [0 for other devices or if not available] - QMap<ProgVoltageType, VoltageData> _voltages; - QMap<MemoryRangeType, MemoryRangeData> _ranges; + TQMap<ProgVoltageType, VoltageData> _voltages; + TQMap<MemoryRangeType, MemoryRangeData> _ranges; BitValue _userIdRecommendedMask; Config *_config; - QMap<QString, Checksum::Data> _checksums; + TQMap<TQString, Checksum::Data> _checksums; CalibrationData _calibration; SelfWrite _selfWrite; friend class XmlToData; friend class Group; - friend QDataStream &operator <<(QDataStream &s, const Data &data); - friend QDataStream &operator >>(QDataStream &s, Data &data); + friend TQDataStream &operator <<(TQDataStream &s, const Data &data); + friend TQDataStream &operator >>(TQDataStream &s, Data &data); }; -QDataStream &operator <<(QDataStream &s, const Data &data); -QDataStream &operator >>(QDataStream &s, Data &data); +TQDataStream &operator <<(TQDataStream &s, const Data &data); +TQDataStream &operator >>(TQDataStream &s, Data &data); } // namespace -QDataStream &operator <<(QDataStream &s, const Pic::VoltageData &vd); -QDataStream &operator >>(QDataStream &s, Pic::VoltageData &vd); -QDataStream &operator <<(QDataStream &s, const Pic::MemoryRangeData &mrd); -QDataStream &operator >>(QDataStream &s, Pic::MemoryRangeData &mrd); -QDataStream &operator <<(QDataStream &s, const Pic::Checksum::Data &cd); -QDataStream &operator >>(QDataStream &s, Pic::Checksum::Data &cd); -QDataStream &operator <<(QDataStream &s, const Pic::CalibrationData &cd); -QDataStream &operator >>(QDataStream &s, Pic::CalibrationData &cd); +TQDataStream &operator <<(TQDataStream &s, const Pic::VoltageData &vd); +TQDataStream &operator >>(TQDataStream &s, Pic::VoltageData &vd); +TQDataStream &operator <<(TQDataStream &s, const Pic::MemoryRangeData &mrd); +TQDataStream &operator >>(TQDataStream &s, Pic::MemoryRangeData &mrd); +TQDataStream &operator <<(TQDataStream &s, const Pic::Checksum::Data &cd); +TQDataStream &operator >>(TQDataStream &s, Pic::Checksum::Data &cd); +TQDataStream &operator <<(TQDataStream &s, const Pic::CalibrationData &cd); +TQDataStream &operator >>(TQDataStream &s, Pic::CalibrationData &cd); #endif diff --git a/src/devices/pic/base/pic_config.cpp b/src/devices/pic/base/pic_config.cpp index 6672794..811a38e 100644 --- a/src/devices/pic/base/pic_config.cpp +++ b/src/devices/pic/base/pic_config.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ #include "pic_config.h" -#include <qregexp.h> +#include <tqregexp.h> const Pic::ConfigNameType::Data Pic::ConfigNameType::DATA[Nb_Types] = { { "cname", 0 }, @@ -218,8 +218,8 @@ const Pic::Config::Data Pic::Config::DATA[] = { { "20BIT", I18N_NOOP("20-bit external bus") }, { 0, 0 } } }, { { "EASHFT", I18N_NOOP("External address bus shift") }, Toggle, { { 0, 0 } } }, { { "MSSPSEL", I18N_NOOP("MSSP address select bit") }, Fixed, { - { "7BIT", I18N_NOOP("7-bit address mask mode") }, - { "5BIT", I18N_NOOP("5-bit address mask mode") }, { 0, 0 } } }, + { "7BIT", I18N_NOOP("7-bit address tqmask mode") }, + { "5BIT", I18N_NOOP("5-bit address tqmask mode") }, { 0, 0 } } }, { { "PMPMX", I18N_NOOP("PMP pin select bit") }, Fixed, { { "Connected", I18N_NOOP("Connected to EMB") }, { "NotConnected", I18N_NOOP("Not connected to EMB") }, { 0, 0 } } }, @@ -280,60 +280,60 @@ const Pic::Config::Data Pic::Config::DATA[] = { { { 0, 0 }, Fixed, { { 0, 0 } } } }; -QMap<QString, Pic::Config::MapData> *Pic::Config::_masks = 0; -QMap<QString, Pic::Config::MapData> &Pic::Config::masks() +TQMap<TQString, Pic::Config::MapData> *Pic::Config::_tqmasks = 0; +TQMap<TQString, Pic::Config::MapData> &Pic::Config::tqmasks() { - if ( _masks==0 ) { - _masks = new QMap<QString, MapData>; - for (uint i=0; DATA[i].mask.name; i++) { - (*_masks)[DATA[i].mask.name] = MapData(i, -1); + if ( _tqmasks==0 ) { + _tqmasks = new TQMap<TQString, MapData>; + for (uint i=0; DATA[i].tqmask.name; i++) { + (*_tqmasks)[DATA[i].tqmask.name] = MapData(i, -1); if ( DATA[i].type==MemoryRange ) { for (uint k=0; k<Protection::MAX_NB_BLOCKS; k++) - (*_masks)[QString("%1_%2").arg(DATA[i].mask.name).arg(k)] = MapData(i, k); + (*_tqmasks)[TQString("%1_%2").tqarg(DATA[i].tqmask.name).tqarg(k)] = MapData(i, k); } } } - return *_masks; + return *_tqmasks; } -bool Pic::Config::hasMaskName(const QString &mask) +bool Pic::Config::hasMaskName(const TQString &tqmask) { - return masks().contains(mask); + return tqmasks().tqcontains(tqmask); } -QString Pic::Config::maskLabel(const QString &mask) +TQString Pic::Config::tqmaskLabel(const TQString &tqmask) { - const MapData &mp = masks()[mask]; - QString s = i18n(DATA[mp.index].mask.label); - if ( mp.block>=0 ) return i18n("%1 for block %2").arg(s).arg(mp.block); + const MapData &mp = tqmasks()[tqmask]; + TQString s = i18n(DATA[mp.index].tqmask.label); + if ( mp.block>=0 ) return i18n("%1 for block %2").tqarg(s).tqarg(mp.block); return s; } -const Pic::Config::Mask *Pic::Config::findMask(const QString &mask, uint *wordIndex) const +const Pic::Config::Mask *Pic::Config::findMask(const TQString &tqmask, uint *wordIndex) const { for (uint i=0; i<uint(_words.count()); i++) - for (uint k=0; k<uint(_words[i].masks.count()); k++) { - if ( _words[i].masks[k].name==mask ) { + for (uint k=0; k<uint(_words[i].tqmasks.count()); k++) { + if ( _words[i].tqmasks[k].name==tqmask ) { if (wordIndex) *wordIndex = i; - return &_words[i].masks[k]; + return &_words[i].tqmasks[k]; } } return 0; } -const Pic::Config::Value *Pic::Config::findValue(const QString &mask, const QString &value) const +const Pic::Config::Value *Pic::Config::findValue(const TQString &tqmask, const TQString &value) const { - const Mask *cmask = findMask(mask); - if ( cmask==0 ) return 0; - for (uint i=0; i<uint(cmask->values.count()); i++) - if ( cmask->values[i].name==value ) return &cmask->values[i]; + const Mask *ctqmask = findMask(tqmask); + if ( ctqmask==0 ) return 0; + for (uint i=0; i<uint(ctqmask->values.count()); i++) + if ( ctqmask->values[i].name==value ) return &ctqmask->values[i]; return 0; } -bool Pic::Config::checkValueName(const QString &mask, const QString &name) const +bool Pic::Config::checkValueName(const TQString &tqmask, const TQString &name) const { - const Data &data = DATA[masks()[mask].index]; - QString pinRegexp = "[A-Z]+\\d*(/[A-Z]+\\d*)?"; + const Data &data = DATA[tqmasks()[tqmask].index]; + TQString pinRegexp = "[A-Z]+\\d*(/[A-Z]+\\d*)?"; switch (data.type) { case Fixed: break; case ValueDouble: { @@ -349,7 +349,7 @@ bool Pic::Config::checkValueName(const QString &mask, const QString &name) const break; } case Ratio: { - QRegExp regexp("(\\d+):(\\d+)"); + TQRegExp regexp("(\\d+):(\\d+)"); if ( regexp.exactMatch(name) ) { bool ok1, ok2; (void)regexp.cap(1).toUInt(&ok1); @@ -359,17 +359,17 @@ bool Pic::Config::checkValueName(const QString &mask, const QString &name) const break; } case MemoryRange: - return _protection.checkRange(mask, name); + return _protection.checkRange(tqmask, name); case Toggle: if ( name=="On" || name=="Off" ) return true; break; case Pin: { - QRegExp regexp(pinRegexp); + TQRegExp regexp(pinRegexp); if ( regexp.exactMatch(name) ) return true; break; } case Pins: { - QRegExp regexp(pinRegexp + "(, " + pinRegexp + ")+"); + TQRegExp regexp(pinRegexp + "(, " + pinRegexp + ")+"); if ( regexp.exactMatch(name) ) return true; break; } @@ -379,9 +379,9 @@ bool Pic::Config::checkValueName(const QString &mask, const QString &name) const return false; } -QString Pic::Config::valueLabel(const QString &mask, const QString &name) +TQString Pic::Config::valueLabel(const TQString &tqmask, const TQString &name) { - const Data &data = DATA[masks()[mask].index]; + const Data &data = DATA[tqmasks()[tqmask].index]; switch (data.type) { case Fixed: case ValueDouble: @@ -405,51 +405,51 @@ QString Pic::Config::valueLabel(const QString &mask, const QString &name) BitValue Pic::Config::Word::usedMask() const { - BitValue mask = 0x0; - for (uint i=0; i<uint(masks.count()); i++) mask |= masks[i].value; - return mask; + BitValue tqmask = 0x0; + for (uint i=0; i<uint(tqmasks.count()); i++) tqmask |= tqmasks[i].value; + return tqmask; } //----------------------------------------------------------------------------- -QDataStream &Pic::operator <<(QDataStream &s, const Config::Value &value) +TQDataStream &Pic::operator <<(TQDataStream &s, const Config::Value &value) { s << value.name << value.configNames << value.value; return s; } -QDataStream &Pic::operator >>(QDataStream &s, Config::Value &value) +TQDataStream &Pic::operator >>(TQDataStream &s, Config::Value &value) { s >> value.name >> value.configNames >> value.value; return s; } -QDataStream &Pic::operator <<(QDataStream &s, const Config::Mask &mask) +TQDataStream &Pic::operator <<(TQDataStream &s, const Config::Mask &tqmask) { - s << mask.name << mask.value << mask.values; + s << tqmask.name << tqmask.value << tqmask.values; return s; } -QDataStream &Pic::operator >>(QDataStream &s, Config::Mask &mask) +TQDataStream &Pic::operator >>(TQDataStream &s, Config::Mask &tqmask) { - s >> mask.name >> mask.value >> mask.values; + s >> tqmask.name >> tqmask.value >> tqmask.values; return s; } -QDataStream &Pic::operator <<(QDataStream &s, const Config::Word &word) +TQDataStream &Pic::operator <<(TQDataStream &s, const Config::Word &word) { - s << word.name << word.ignoredCNames << word.wmask << word.pmask << word.cmask << word.bvalue << word.masks; + s << word.name << word.ignoredCNames << word.wtqmask << word.ptqmask << word.ctqmask << word.bvalue << word.tqmasks; return s; } -QDataStream &Pic::operator >>(QDataStream &s, Config::Word &word) +TQDataStream &Pic::operator >>(TQDataStream &s, Config::Word &word) { - s >> word.name >> word.ignoredCNames >> word.wmask >> word.pmask >> word.cmask >> word.bvalue >> word.masks; + s >> word.name >> word.ignoredCNames >> word.wtqmask >> word.ptqmask >> word.ctqmask >> word.bvalue >> word.tqmasks; return s; } -QDataStream &Pic::operator <<(QDataStream &s, const Config &config) +TQDataStream &Pic::operator <<(TQDataStream &s, const Config &config) { s << config._words; return s; } -QDataStream &Pic::operator >>(QDataStream &s, Config &config) +TQDataStream &Pic::operator >>(TQDataStream &s, Config &config) { s >> config._words; return s; diff --git a/src/devices/pic/base/pic_config.h b/src/devices/pic/base/pic_config.h index 185a19e..67c0b1c 100644 --- a/src/devices/pic/base/pic_config.h +++ b/src/devices/pic/base/pic_config.h @@ -9,8 +9,8 @@ #ifndef PIC_CONFIG_H #define PIC_CONFIG_H -#include <qmap.h> -#include <qstringlist.h> +#include <tqmap.h> +#include <tqstringlist.h> #include "common/common/bitvalue.h" #include "pic_protection.h" @@ -29,8 +29,8 @@ class Config public: class Value { public: - QString name; - QMap<ConfigNameType, QStringList> configNames; + TQString name; + TQMap<ConfigNameType, TQStringList> configNames; BitValue value; bool operator <(const Value &cv) const { return value<cv.value; } bool isValid() const { return !name.isEmpty(); } @@ -38,33 +38,33 @@ public: class Mask { public: - QString name; + TQString name; BitValue value; - QValueVector<Value> values; // ordered from lower to higher + TQValueVector<Value> values; // ordered from lower to higher bool operator <(const Mask &cm) const { return value<cm.value; } }; class Word { public: - QString name; - QStringList ignoredCNames; - BitValue wmask, pmask, cmask; // write, protected, and checksum bits masks + TQString name; + TQStringList ignoredCNames; + BitValue wtqmask, ptqmask, ctqmask; // write, protected, and checksum bits tqmasks BitValue bvalue; // blank value - QValueVector<Mask> masks; // ordered from lower to higher + TQValueVector<Mask> tqmasks; // ordered from lower to higher BitValue usedMask() const; }; public: Config(const Pic::Data &data) : _data(data), _protection(data, *this) {} - QValueVector<Word> _words; + TQValueVector<Word> _words; const Protection &protection() const { return _protection; } - const Value *findValue(const QString &mask, const QString &value) const; - const Mask *findMask(const QString &mask, uint *wordIndex = 0) const; - static bool hasMaskName(const QString &mask); - static QString maskLabel(const QString &mask); - bool checkValueName(const QString &mask, const QString &name) const; - static QString valueLabel(const QString &mask, const QString &name); + const Value *findValue(const TQString &tqmask, const TQString &value) const; + const Mask *findMask(const TQString &tqmask, uint *wordIndex = 0) const; + static bool hasMaskName(const TQString &tqmask); + static TQString tqmaskLabel(const TQString &tqmask); + bool checkValueName(const TQString &tqmask, const TQString &name) const; + static TQString valueLabel(const TQString &tqmask, const TQString &name); private: class MapData { @@ -73,8 +73,8 @@ private: MapData(int i, int b) : index(i), block(b) {} int index, block; }; - static QMap<QString, MapData> &masks(); - static QMap<QString, MapData> *_masks; // mask name -> index in DATA + static TQMap<TQString, MapData> &tqmasks(); + static TQMap<TQString, MapData> *_tqmasks; // tqmask name -> index in DATA struct NameData { const char *name, *label; @@ -82,7 +82,7 @@ private: enum Type { Fixed, ValueDouble, ValueUInt, Ratio, MemoryRange, Toggle, Pin, Pins }; class Data { public: - const NameData mask; + const NameData tqmask; Type type; const NameData values[50]; }; @@ -93,14 +93,14 @@ private: Protection _protection; }; -QDataStream &operator <<(QDataStream &s, const Config::Value &value); -QDataStream &operator >>(QDataStream &s, Config::Value &value); -QDataStream &operator <<(QDataStream &s, const Config::Mask &mask); -QDataStream &operator >>(QDataStream &s, Config::Mask &mask); -QDataStream &operator <<(QDataStream &s, const Config::Word &word); -QDataStream &operator >>(QDataStream &s, Config::Word &word); -QDataStream &operator <<(QDataStream &s, const Config &config); -QDataStream &operator >>(QDataStream &s, Config &config); +TQDataStream &operator <<(TQDataStream &s, const Config::Value &value); +TQDataStream &operator >>(TQDataStream &s, Config::Value &value); +TQDataStream &operator <<(TQDataStream &s, const Config::Mask &tqmask); +TQDataStream &operator >>(TQDataStream &s, Config::Mask &tqmask); +TQDataStream &operator <<(TQDataStream &s, const Config::Word &word); +TQDataStream &operator >>(TQDataStream &s, Config::Word &word); +TQDataStream &operator <<(TQDataStream &s, const Config &config); +TQDataStream &operator >>(TQDataStream &s, Config &config); } //namespace diff --git a/src/devices/pic/base/pic_protection.cpp b/src/devices/pic/base/pic_protection.cpp index da77881..7af925c 100644 --- a/src/devices/pic/base/pic_protection.cpp +++ b/src/devices/pic/base/pic_protection.cpp @@ -10,16 +10,16 @@ #include "pic_config.h" -#include <qregexp.h> +#include <tqregexp.h> -bool Pic::Protection::isNoneProtectedValueName(const QString &name) const +bool Pic::Protection::isNoneProtectedValueName(const TQString &name) const { if ( name=="Off" ) return true; if ( _data.architecture()==Architecture::P17C ) return !isAllProtectedValueName(name); return false; } -bool Pic::Protection::isAllProtectedValueName(const QString &name) const +bool Pic::Protection::isAllProtectedValueName(const TQString &name) const { if ( name=="All" ) return true; if ( _data.architecture()==Architecture::P17C ) return ( name=="Code-protected microcontroller" ); @@ -29,13 +29,13 @@ bool Pic::Protection::isAllProtectedValueName(const QString &name) const Pic::Protection::Family Pic::Protection::family() const { if ( _config.findMask("WRTBS") ) return CodeGuard; - QString mask = maskName(ProgramProtected, MemoryRangeType::Code); - if ( _config.findMask(QString("%1_%2").arg(mask).arg(0)) ) return BlockProtection; - if ( _config.findMask(mask) ) return BasicProtection; + TQString tqmask = tqmaskName(ProgramProtected, MemoryRangeType::Code); + if ( _config.findMask(TQString("%1_%2").tqarg(tqmask).tqarg(0)) ) return BlockProtection; + if ( _config.findMask(tqmask) ) return BasicProtection; return NoProtection; } -QString Pic::Protection::securityValueName(Type type) const +TQString Pic::Protection::securityValueName(Type type) const { if ( type==StandardSecurity ) return "Standard Security"; if ( type==HighSecurity ) return "High Security"; @@ -43,12 +43,12 @@ QString Pic::Protection::securityValueName(Type type) const return "Off"; } -QString Pic::Protection::bootSizeMaskName() const +TQString Pic::Protection::bootSizeMaskName() const { return (family()==CodeGuard ? "BSSIZ" : "BBSIZ"); } -QString Pic::Protection::bootMaskName(Type type) const +TQString Pic::Protection::bootMaskName(Type type) const { Q_ASSERT( type!=Nb_Types ); if ( family()==CodeGuard ) { @@ -59,10 +59,10 @@ QString Pic::Protection::bootMaskName(Type type) const if ( type==WriteProtected ) return "WRTB"; if ( type==ReadProtected ) return "EBTRB"; } - return QString::null; + return TQString(); } -QString Pic::Protection::blockSizeMaskName(uint block) const +TQString Pic::Protection::blockSizeMaskName(uint block) const { if ( family()==CodeGuard ) { Q_ASSERT( block==0 ); @@ -71,18 +71,18 @@ QString Pic::Protection::blockSizeMaskName(uint block) const return blockMaskName(ProgramProtected, block); } -QString Pic::Protection::blockMaskName(Type type, uint block) const +TQString Pic::Protection::blockMaskName(Type type, uint block) const { Q_ASSERT( type!=Nb_Types ); if ( family()==CodeGuard ) { if ( type==WriteProtected ) return (block==0 ? "WRTSS" : "WRTGS"); if ( type==StandardSecurity || type==HighSecurity ) return (block==0 ? "SSSEC" : "GSSEC"); - return QString::null; + return TQString(); } - return QString("%1_%2").arg(maskName(type, MemoryRangeType::Code)).arg(block); + return TQString("%1_%2").tqarg(tqmaskName(type, MemoryRangeType::Code)).tqarg(block); } -QString Pic::Protection::maskName(Type type, MemoryRangeType mtype) const +TQString Pic::Protection::tqmaskName(Type type, MemoryRangeType mtype) const { Q_ASSERT( type!=Nb_Types ); switch (mtype.type()) { @@ -112,13 +112,13 @@ QString Pic::Protection::maskName(Type type, MemoryRangeType mtype) const case MemoryRangeType::Nb_Types: Q_ASSERT(false); break; default: break; } - return QString::null; + return TQString(); } -bool Pic::Protection::extractRanges(const QString &name, QValueVector<Address> &starts, Address &end, bool &ok) +bool Pic::Protection::extractRanges(const TQString &name, TQValueVector<Address> &starts, Address &end, bool &ok) { ok = false; - QRegExp regexp("([A-F0-9]+)(/[A-F0-9]+)?(/[A-F0-9]+)?:([A-F0-9]+)"); + TQRegExp regexp("([A-F0-9]+)(/[A-F0-9]+)?(/[A-F0-9]+)?:([A-F0-9]+)"); if ( !regexp.exactMatch(name) ) return false; bool ok1; end = fromHex(regexp.cap(regexp.numCaptures()), &ok1); @@ -130,7 +130,7 @@ bool Pic::Protection::extractRanges(const QString &name, QValueVector<Address> & for (int i=1; i<regexp.numCaptures(); i++) { if ( regexp.cap(i).isEmpty() ) break; bool ok1; - QString s = (i==1 ? regexp.cap(i) : regexp.cap(i).mid(1)); + TQString s = (i==1 ? regexp.cap(i) : regexp.cap(i).mid(1)); Address start = fromHex(s, &ok1); if ( !ok1 ) { qDebug("Malformed start address %s", s.latin1()); @@ -146,7 +146,7 @@ bool Pic::Protection::extractRanges(const QString &name, QValueVector<Address> & return true; } -AddressRangeVector Pic::Protection::extractRanges(const QString &name, MemoryRangeType type) const +AddressRangeVector Pic::Protection::extractRanges(const TQString &name, MemoryRangeType type) const { if ( isNoneProtectedValueName(name) ) return AddressRange(); if ( isAllProtectedValueName(name) ) { @@ -154,7 +154,7 @@ AddressRangeVector Pic::Protection::extractRanges(const QString &name, MemoryRan return AddressRange(rdata.start, rdata.end); } bool ok1; - QValueVector<Address> starts; + TQValueVector<Address> starts; Address end; bool ok2 = extractRanges(name, starts, end, ok1); Q_ASSERT(ok1); @@ -165,11 +165,11 @@ AddressRangeVector Pic::Protection::extractRanges(const QString &name, MemoryRan return rv; } -bool Pic::Protection::checkRange(const QString &mask, const QString &name) const +bool Pic::Protection::checkRange(const TQString &tqmask, const TQString &name) const { if ( family()!=CodeGuard ) { bool ok; - (void)extractRange(mask, name, ok); + (void)extractRange(tqmask, name, ok); return ok; } @@ -180,8 +180,8 @@ bool Pic::Protection::checkRange(const QString &mask, const QString &name) const isBootBlock = ( i==0 ); block = i - 1; for (uint k=0; k<Nb_Types; k++) { - QString mname = (isBootBlock ? bootMaskName(Type(k)) : blockMaskName(Type(k), block)); - if ( mask!=mname ) continue; + TQString mname = (isBootBlock ? bootMaskName(Type(k)) : blockMaskName(Type(k), block)); + if ( tqmask!=mname ) continue; ptype = Type(k); break; } @@ -195,15 +195,15 @@ bool Pic::Protection::checkRange(const QString &mask, const QString &name) const return true; } -Pic::Protection::ProtectedRange Pic::Protection::extractRange(const QString &mask, const QString &name, bool &ok) const +Pic::Protection::ProtectedRange Pic::Protection::extractRange(const TQString &tqmask, const TQString &name, bool &ok) const { Q_ASSERT( family()!=CodeGuard ); - //qDebug("extract range %s %s", mask.latin1(), name.latin1()); + //qDebug("extract range %s %s", tqmask.latin1(), name.latin1()); ProtectedRange pr; ok = false; - QRegExp rexp("([A-Z]+)(?:_([0-9])|)"); - if ( !rexp.exactMatch(mask) ) { + TQRegExp rexp("([A-Z]+)(?:_([0-9])|)"); + if ( !rexp.exactMatch(tqmask) ) { qDebug("Malformed block range"); return pr; } @@ -215,7 +215,7 @@ Pic::Protection::ProtectedRange Pic::Protection::extractRange(const QString &mas for (MemoryRangeType type; type<=MemoryRangeType::Nb_Types; ++type) { // #### danger: <= isBootBlock = ( type==MemoryRangeType::Nb_Types ); for (uint k=0; k<Nb_Types; k++) { - QString mname = (isBootBlock ? bootMaskName(Type(k)) : maskName(Type(k), type)); + TQString mname = (isBootBlock ? bootMaskName(Type(k)) : tqmaskName(Type(k), type)); if ( rexp.cap(1)!=mname ) continue; rtype = (isBootBlock ? MemoryRangeType(MemoryRangeType::Code) : type); ptype = Type(k); @@ -239,24 +239,24 @@ Pic::Protection::ProtectedRange Pic::Protection::extractRange(const QString &mas return pr; } - const Config::Mask *bmask = _config.findMask(bootMaskName(ptype)); - const Config::Mask *bsmask = _config.findMask(bootSizeMaskName()); + const Config::Mask *btqmask = _config.findMask(bootMaskName(ptype)); + const Config::Mask *bstqmask = _config.findMask(bootSizeMaskName()); const MemoryRangeData &rdata = _data.range(rtype); if ( isAllProtectedValueName(name) ) { - if ( rtype==MemoryRangeType::Code && !isBootBlock && bmask ) { + if ( rtype==MemoryRangeType::Code && !isBootBlock && btqmask ) { qDebug("Protected range should be explicit with boot block"); return pr; } if (isBootBlock) { - if ( bsmask==0 ) { + if ( bstqmask==0 ) { qDebug("Protected range should be explicit when boot size not present"); return pr; } Address start = _data.range(MemoryRangeType::Code).start; pr.starts.append(start); - for (uint k=0; k<uint(bsmask->values.count()); k++) { + for (uint k=0; k<uint(bstqmask->values.count()); k++) { bool ok1; - uint size = bsmask->values[k].name.toUInt(&ok1); + uint size = bstqmask->values[k].name.toUInt(&ok1); if ( !ok1 ) { qDebug("Could not recognize boot size value"); return pr; @@ -277,7 +277,7 @@ Pic::Protection::ProtectedRange Pic::Protection::extractRange(const QString &mas ok = true; return pr; } - if ( isBootBlock && bsmask ) { + if ( isBootBlock && bstqmask ) { qDebug("Protected range should not be explicit when boot size is present"); return pr; } @@ -294,7 +294,7 @@ Pic::Protection::ProtectedRange Pic::Protection::extractRange(const QString &mas qDebug("End is beyond memory range"); return pr; } - if ( (rtype!=MemoryRangeType::Code || isBootBlock) && (pr.starts.count()>1 || !rexp.cap(2).isEmpty() || bmask==0) ) { + if ( (rtype!=MemoryRangeType::Code || isBootBlock) && (pr.starts.count()>1 || !rexp.cap(2).isEmpty() || btqmask==0) ) { qDebug("Only code with blocks and boot can have multiple protected ranges"); return pr; } @@ -306,14 +306,14 @@ Pic::Protection::ProtectedRange Pic::Protection::extractRange(const QString &mas // check with boot block if ( pr.starts.count()>1 ) { - if ( bmask==0 ) { - qDebug("No boot mask"); + if ( btqmask==0 ) { + qDebug("No boot tqmask"); return pr; } - for (uint i=0; i<uint(bmask->values.count()); i++) { - if ( bmask->values[i].name=="Off" ) continue; + for (uint i=0; i<uint(btqmask->values.count()); i++) { + if ( btqmask->values[i].name=="Off" ) continue; bool ok1; - ProtectedRange bpr = extractRange(bmask->name, bmask->values[i].name, ok1); + ProtectedRange bpr = extractRange(btqmask->name, btqmask->values[i].name, ok1); if ( !ok1 ) return pr; if ( bpr.ends.count()!=pr.starts.count() ) { qDebug("Boot number of ends (%i) should be the same as code number of starts (%i)", int(bpr.ends.count()), int(pr.starts.count())); @@ -341,21 +341,21 @@ uint Pic::Protection::nbBlocks() const { if ( family()==CodeGuard ) return 2; // codeguard : secure segment + general segment for (uint i=0; i<MAX_NB_BLOCKS; i++) - if ( _config.findMask(QString("CP_%1").arg(i))==0 ) return i; + if ( _config.findMask(TQString("CP_%1").tqarg(i))==0 ) return i; return MAX_NB_BLOCKS; } -QString Pic::Protection::bootLabel() const +TQString Pic::Protection::bootLabel() const { if ( family()==CodeGuard ) return i18n("Boot Segment"); return i18n("Boot Block"); } -QString Pic::Protection::blockLabel(uint i) const +TQString Pic::Protection::blockLabel(uint i) const { if ( family()==CodeGuard ) { if ( i==0 ) return i18n("Secure Segment"); return i18n("General Segment"); } - return i18n("Block #%1").arg(i); + return i18n("Block #%1").tqarg(i); } diff --git a/src/devices/pic/base/pic_protection.h b/src/devices/pic/base/pic_protection.h index 67ff667..a10a8a6 100644 --- a/src/devices/pic/base/pic_protection.h +++ b/src/devices/pic/base/pic_protection.h @@ -27,32 +27,32 @@ public: public: Protection(const Pic::Data &data, const Config &config) : _data(data), _config(config) {} Family family() const; - QString securityValueName(Type type) const; + TQString securityValueName(Type type) const; bool hasBootBlock() const; - QString bootSizeMaskName() const; - QString bootMaskName(Type ptype) const; - QString bootLabel() const; + TQString bootSizeMaskName() const; + TQString bootMaskName(Type ptype) const; + TQString bootLabel() const; uint nbBlocks() const; - QString blockSizeMaskName(uint i) const; - QString blockMaskName(Type ptype, uint i) const; - QString blockLabel(uint i) const; - AddressRangeVector extractRanges(const QString &name, MemoryRangeType type) const; - bool checkRange(const QString &mask, const QString &name) const; - QString maskName(Type type, MemoryRangeType mtype) const; - bool isAllProtectedValueName(const QString &valueName) const; - bool isNoneProtectedValueName(const QString &valueName) const; + TQString blockSizeMaskName(uint i) const; + TQString blockMaskName(Type ptype, uint i) const; + TQString blockLabel(uint i) const; + AddressRangeVector extractRanges(const TQString &name, MemoryRangeType type) const; + bool checkRange(const TQString &tqmask, const TQString &name) const; + TQString tqmaskName(Type type, MemoryRangeType mtype) const; + bool isAllProtectedValueName(const TQString &valueName) const; + bool isNoneProtectedValueName(const TQString &valueName) const; private: const Pic::Data &_data; const Config &_config; enum SegmentType { BootSegment = 0, SecureSegment, GeneralSegment, Nb_SegmentTypes }; - static bool extractRanges(const QString &name, QValueVector<Address> &starts, Address &end, bool &ok); + static bool extractRanges(const TQString &name, TQValueVector<Address> &starts, Address &end, bool &ok); class ProtectedRange { public: - QValueVector<Address> starts, ends; + TQValueVector<Address> starts, ends; }; - ProtectedRange extractRange(const QString &mask, const QString &name, bool &ok) const; + ProtectedRange extractRange(const TQString &tqmask, const TQString &name, bool &ok) const; }; } //namespace diff --git a/src/devices/pic/base/pic_register.cpp b/src/devices/pic/base/pic_register.cpp index fcfe5ef..b5dc616 100644 --- a/src/devices/pic/base/pic_register.cpp +++ b/src/devices/pic/base/pic_register.cpp @@ -28,7 +28,7 @@ Address Pic::RegistersData::mirroredAddress(Address address) const } if ( delta==-1 ) continue; for (uint k=0; k<uint(mirrored[i].count()); k++) - mirror = QMIN(mirrored[i][k].start + delta, mirror); + mirror = TQMIN(mirrored[i][k].start + delta, mirror); break; } return mirror; @@ -43,7 +43,7 @@ Device::RegisterProperties Pic::RegistersData::properties(Address address) const case Sfr: { Device::RegisterProperties properties = Device::NotAccessible; RegisterBitProperties rbp = RegisterBitUnused; - QMap<QString, RegisterData>::const_iterator it; + TQMap<TQString, RegisterData>::const_iterator it; for (it=sfrs.begin(); it!=sfrs.end(); ++it) { if ( it.data().address!=address ) continue; for (uint i=0; i<Device::MAX_NB_PORT_BITS; i++) rbp |= it.data().bits[i].properties; @@ -69,29 +69,29 @@ Pic::RegisterType Pic::RegistersData::type(Address address) const return Mirrored; } -QString Pic::RegistersData::label(Address address) const +TQString Pic::RegistersData::label(Address address) const { switch ( type(address) ) { case UnusedRegister: return "---"; - case Mirrored: return i18n("Mirror of %1").arg(toHexLabel(mirroredAddress(address), nbCharsAddress())); + case Mirrored: return i18n("Mirror of %1").tqarg(toHexLabel(mirroredAddress(address), nbCharsAddress())); case Gpr: return "<GPR>"; case Sfr: return sfrNames[address]; } Q_ASSERT(false); - return QString::null; + return TQString(); } bool Pic::RegistersData::hasPort(uint index) const { Q_ASSERT( index<Device::MAX_NB_PORTS ); - if ( sfrs.contains("GPIO") ) return ( index==0 ); - if ( !sfrs.contains(portName(index)) ) return false; + if ( sfrs.tqcontains("GPIO") ) return ( index==0 ); + if ( !sfrs.tqcontains(portName(index)) ) return false; return true; } int Pic::RegistersData::portIndex(Address address) const { - QString name = sfrNames[address]; + TQString name = sfrNames[address]; if ( name.isEmpty() ) return -1; for (uint i=0; i<Device::MAX_NB_PORTS; i++) { if ( !hasPort(i) ) continue; @@ -107,58 +107,58 @@ bool Pic::RegistersData::hasPortBit(uint index, uint bit) const return ( port.bits[bit].properties!=RegisterBitUnused ); } -QString Pic::RegistersData::portName(uint index) const +TQString Pic::RegistersData::portName(uint index) const { - if ( sfrs.contains("GPIO") ) { - if ( index!=0 ) return QString::null; + if ( sfrs.tqcontains("GPIO") ) { + if ( index!=0 ) return TQString(); return "GPIO"; } - return QString("PORT") + char('A' + index); + return TQString("PORT") + char('A' + index); } -QString Pic::RegistersData::trisName(uint index) const +TQString Pic::RegistersData::trisName(uint index) const { - if ( sfrs.contains("GPIO") ) { - if ( index!=0 ) return QString::null; + if ( sfrs.tqcontains("GPIO") ) { + if ( index!=0 ) return TQString(); return "TRISIO"; } if ( _data.architecture()==Architecture::P17C ) { - if ( index==0 ) return QString::null; - return QString("DDR") + char('A' + index); + if ( index==0 ) return TQString(); + return TQString("DDR") + char('A' + index); } - return QString("TRIS") + char('A' + index); + return TQString("TRIS") + char('A' + index); } bool Pic::RegistersData::hasTris(uint index) const { - QString name = trisName(index); + TQString name = trisName(index); if ( name.isEmpty() ) return false; - return sfrs.contains(name); + return sfrs.tqcontains(name); } -QString Pic::RegistersData::latchName(uint index) const +TQString Pic::RegistersData::latchName(uint index) const { if ( _data.architecture()==Architecture::P10X || _data.architecture()==Architecture::P16X || _data.architecture()==Architecture::P17C ) - return QString::null; - return QString("LAT") + char('A' + index); + return TQString(); + return TQString("LAT") + char('A' + index); } bool Pic::RegistersData::hasLatch(uint index) const { - QString name = latchName(index); + TQString name = latchName(index); if ( name.isEmpty() ) return false; - return sfrs.contains(name); + return sfrs.tqcontains(name); } -QString Pic::RegistersData::portBitName(uint index, uint bit) const +TQString Pic::RegistersData::portBitName(uint index, uint bit) const { - if ( sfrs.contains("GPIO") ) return QString("GP") + QString::number(bit); - return QString("R") + char('A' + index) + QString::number(bit); + if ( sfrs.tqcontains("GPIO") ) return TQString("GP") + TQString::number(bit); + return TQString("R") + char('A' + index) + TQString::number(bit); } -QValueList<Register::TypeData> Pic::RegistersData::relatedRegisters(const Register::TypeData &data) const +TQValueList<Register::TypeData> Pic::RegistersData::relatedRegisters(const Register::TypeData &data) const { - QValueList<Register::TypeData> list; + TQValueList<Register::TypeData> list; if ( data.type()==Register::Regular ) { int i = portIndex(data.address()); if ( i==-1 ) list.append(data); @@ -185,7 +185,7 @@ bool Pic::RegistersData::bankHasSfrs(uint i) const if ( i==0 ) return true; if ( (_data.architecture()==Pic::Architecture::P18F || _data.architecture()==Pic::Architecture::P18J) && i==15 ) return true; if ( !isBankUsed(i) ) return false; - QMap<Address, QString>::const_iterator it; + TQMap<Address, TQString>::const_iterator it; for (it=sfrNames.begin(); it!=sfrNames.end(); ++it) if ( bankFromAddress(it.key())==i ) return true; return false; @@ -220,25 +220,25 @@ uint Pic::RegistersData::firstGprIndex() const } //---------------------------------------------------------------------------- -QDataStream &Pic::operator <<(QDataStream &s, const RangeData &rd) +TQDataStream &Pic::operator <<(TQDataStream &s, const RangeData &rd) { s << rd.start << rd.length; return s; } -QDataStream &Pic::operator >>(QDataStream &s, RangeData &rd) +TQDataStream &Pic::operator >>(TQDataStream &s, RangeData &rd) { s >> rd.start >> rd.length; return s; } -QDataStream &Pic::operator <<(QDataStream &s, const RegisterBitData &rbd) +TQDataStream &Pic::operator <<(TQDataStream &s, const RegisterBitData &rbd) { - s << Q_UINT8(rbd.properties) << Q_UINT8(rbd.por) << Q_UINT8(rbd.mclr); + s << TQ_UINT8(rbd.properties) << TQ_UINT8(rbd.por) << TQ_UINT8(rbd.mclr); return s; } -QDataStream &Pic::operator >>(QDataStream &s, RegisterBitData &rbd) +TQDataStream &Pic::operator >>(TQDataStream &s, RegisterBitData &rbd) { - Q_UINT8 properties, por, mclr; + TQ_UINT8 properties, por, mclr; s >> properties >> por >> mclr; rbd.properties = RegisterBitProperties(properties); rbd.por = RegisterBitState(por); @@ -246,42 +246,42 @@ QDataStream &Pic::operator >>(QDataStream &s, RegisterBitData &rbd) return s; } -QDataStream &Pic::operator <<(QDataStream &s, const RegisterData &rd) +TQDataStream &Pic::operator <<(TQDataStream &s, const RegisterData &rd) { s << rd.address; for (int i=0; i<Device::MAX_NB_PORT_BITS; i++) s << rd.bits[i]; return s; } -QDataStream &Pic::operator >>(QDataStream &s, RegisterData &rd) +TQDataStream &Pic::operator >>(TQDataStream &s, RegisterData &rd) { s >> rd.address; for (int i=0; i<Device::MAX_NB_PORT_BITS; i++) s >> rd.bits[i]; return s; } -QDataStream &Pic::operator <<(QDataStream &s, const CombinedData &rd) +TQDataStream &Pic::operator <<(TQDataStream &s, const CombinedData &rd) { s << rd.address << rd.nbChars; return s; } -QDataStream &Pic::operator >>(QDataStream &s, CombinedData &rd) +TQDataStream &Pic::operator >>(TQDataStream &s, CombinedData &rd) { s >> rd.address >> rd.nbChars; return s; } -QDataStream &Pic::operator <<(QDataStream &s, const RegistersData &rd) +TQDataStream &Pic::operator <<(TQDataStream &s, const RegistersData &rd) { s << rd.nbBanks << rd.accessBankSplit << rd.unusedBankMask; s << rd.sfrs << rd.mirrored << rd.unused << rd.combined; return s; } -QDataStream &Pic::operator >>(QDataStream &s, RegistersData &rd) +TQDataStream &Pic::operator >>(TQDataStream &s, RegistersData &rd) { s >> rd.nbBanks >> rd.accessBankSplit >> rd.unusedBankMask; s >> rd.sfrs >> rd.mirrored >> rd.unused >> rd.combined; rd.sfrNames.clear(); - QMap<QString, RegisterData>::const_iterator it; + TQMap<TQString, RegisterData>::const_iterator it; for(it=rd.sfrs.begin(); it!=rd.sfrs.end(); ++it) rd.sfrNames[it.data().address] = it.key(); return s; } diff --git a/src/devices/pic/base/pic_register.h b/src/devices/pic/base/pic_register.h index 41da020..bb12657 100644 --- a/src/devices/pic/base/pic_register.h +++ b/src/devices/pic/base/pic_register.h @@ -9,7 +9,7 @@ #ifndef PIC_REGISTER_H #define PIC_REGISTER_H -#include <qmap.h> +#include <tqmap.h> #include "devices/base/register.h" #include "pic.h" @@ -29,8 +29,8 @@ enum RegisterBitProperty { RegisterBitUnused = 0x0, RegisterBitOnlySoftwareClear = 0x4, RegisterBitOnlySoftwareSet = 0x8, MaxRegisterBitProperty = 0x15 }; -Q_DECLARE_FLAGS(RegisterBitProperties, RegisterBitProperty) -Q_DECLARE_OPERATORS_FOR_FLAGS(RegisterBitProperties) +TQ_DECLARE_FLAGS(RegisterBitProperties, RegisterBitProperty) +TQ_DECLARE_OPERATORS_FOR_FLAGS(RegisterBitProperties) enum RegisterBitState { RegisterBitUnknown = 0, RegisterBitLow, RegisterBitHigh, RegisterBitUnchanged, RegisterBitDepends, RegisterBitDependsConfig, Nb_RegisterBitStates }; @@ -72,26 +72,26 @@ public: uint firstGprIndex() const; // in first bank uint nbBanks, accessBankSplit, unusedBankMask; - QMap<QString, RegisterData> sfrs; - QMap<Address, QString> sfrNames; // address -> name - QValueVector<QValueVector<RangeData> > mirrored; - QValueVector<RangeData> unused; - QMap<QString, CombinedData> combined; + TQMap<TQString, RegisterData> sfrs; + TQMap<Address, TQString> sfrNames; // address -> name + TQValueVector<TQValueVector<RangeData> > mirrored; + TQValueVector<RangeData> unused; + TQMap<TQString, CombinedData> combined; virtual Device::RegisterProperties properties(Address address) const; RegisterType type(Address address) const; - QString label(Address address) const; - virtual QValueList<Register::TypeData> relatedRegisters(const Register::TypeData &data) const; + TQString label(Address address) const; + virtual TQValueList<Register::TypeData> relatedRegisters(const Register::TypeData &data) const; virtual bool hasPort(uint index) const; virtual int portIndex(Address address) const; - virtual QString portName(uint index) const; + virtual TQString portName(uint index) const; bool hasTris(uint index) const; - QString trisName(uint index) const; + TQString trisName(uint index) const; bool hasLatch(uint index) const; - QString latchName(uint index) const; + TQString latchName(uint index) const; virtual bool hasPortBit(uint index, uint bit) const; - virtual QString portBitName(uint index, uint bit) const; + virtual TQString portBitName(uint index, uint bit) const; private: const Data &_data; @@ -99,16 +99,16 @@ private: }; //----------------------------------------------------------------------------- -QDataStream &operator <<(QDataStream &s, const RangeData &rd); -QDataStream &operator >>(QDataStream &s, RangeData &rd); -QDataStream &operator <<(QDataStream &s, const RegisterBitData &rbd); -QDataStream &operator >>(QDataStream &s, RegisterBitData &rbd); -QDataStream &operator <<(QDataStream &s, const RegisterData &rd); -QDataStream &operator >>(QDataStream &s, RegisterData &rd); -QDataStream &operator <<(QDataStream &s, const CombinedData &rd); -QDataStream &operator >>(QDataStream &s, CombinedData &rd); -QDataStream &operator <<(QDataStream &s, const RegistersData &rd); -QDataStream &operator >>(QDataStream &s, RegistersData &rd); +TQDataStream &operator <<(TQDataStream &s, const RangeData &rd); +TQDataStream &operator >>(TQDataStream &s, RangeData &rd); +TQDataStream &operator <<(TQDataStream &s, const RegisterBitData &rbd); +TQDataStream &operator >>(TQDataStream &s, RegisterBitData &rbd); +TQDataStream &operator <<(TQDataStream &s, const RegisterData &rd); +TQDataStream &operator >>(TQDataStream &s, RegisterData &rd); +TQDataStream &operator <<(TQDataStream &s, const CombinedData &rd); +TQDataStream &operator >>(TQDataStream &s, CombinedData &rd); +TQDataStream &operator <<(TQDataStream &s, const RegistersData &rd); +TQDataStream &operator >>(TQDataStream &s, RegistersData &rd); } // namespace |