diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-30 00:15:53 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-30 00:15:53 +0000 |
commit | 0aaa8e3fc8f8a1481333b564f0922277c8d8ad59 (patch) | |
tree | b95c0ca86c4876dd139af376b9f4afd8917cf0cd /src/progs/pickit2v2/base | |
parent | b79a2c28534cf09987eeeba3077fff9236df182a (diff) | |
download | piklab-0aaa8e3fc8f8a1481333b564f0922277c8d8ad59.tar.gz piklab-0aaa8e3fc8f8a1481333b564f0922277c8d8ad59.zip |
TQt4 port piklab
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/piklab@1238822 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/progs/pickit2v2/base')
-rw-r--r-- | src/progs/pickit2v2/base/pickit2v2.cpp | 40 | ||||
-rw-r--r-- | src/progs/pickit2v2/base/pickit2v2.h | 8 | ||||
-rw-r--r-- | src/progs/pickit2v2/base/pickit2v2_data.cpp | 8 | ||||
-rw-r--r-- | src/progs/pickit2v2/base/pickit2v2_data.h | 4 | ||||
-rw-r--r-- | src/progs/pickit2v2/base/pickit2v2_prog.cpp | 22 | ||||
-rw-r--r-- | src/progs/pickit2v2/base/pickit2v2_prog.h | 5 |
6 files changed, 44 insertions, 43 deletions
diff --git a/src/progs/pickit2v2/base/pickit2v2.cpp b/src/progs/pickit2v2/base/pickit2v2.cpp index 31dd6ca..d813a52 100644 --- a/src/progs/pickit2v2/base/pickit2v2.cpp +++ b/src/progs/pickit2v2/base/pickit2v2.cpp @@ -23,7 +23,7 @@ const Pickit2V2::FamilyData *Pickit2V2::familyData(const Pic::Data &device) //----------------------------------------------------------------------------- Pickit2V2::Hardware::Hardware(::Programmer::Base &base) - : ::Programmer::PicHardware(base, new USBPort(base), QString::null), + : ::Programmer::PicHardware(base, new USBPort(base), TQString()), _scriptBufferChecksum(0), _deviceSet(false) {} @@ -45,9 +45,9 @@ bool Pickit2V2::Hardware::setTarget() return true; } -bool Pickit2V2::Hardware::readStatus(ushort &status) +bool Pickit2V2::Hardware::readtqStatus(ushort &status) { - if ( !port().command(ReadStatus) ) return false; + if ( !port().command(ReadtqStatus) ) return false; Array a; if ( !port().receive(a) ) return false; status = (a[1] << 8) + a[0]; @@ -68,7 +68,7 @@ bool Pickit2V2::Hardware::executeScript(uint i) { Q_ASSERT( i!=0 ); const ScriptData &sdata = SCRIPT_DATA[i-1]; - log(Log::DebugLevel::Extra, QString("execute script #%1: %2").arg(i).arg(sdata.name)); + log(Log::DebugLevel::Extra, TQString("execute script #%1: %2").tqarg(i).tqarg(sdata.name)); return sendScript(sdata.data, sdata.length); } @@ -78,7 +78,7 @@ bool Pickit2V2::Hardware::getScriptBufferChecksum(uint &checksum) Array array; if ( !port().receive(array) ) return false; checksum = (array[0] << 24) + (array[1] << 16) + (array[2] << 8) + array[3]; - log(Log::DebugLevel::Extra, QString("get script buffer checksum: %1").arg(toHexLabel(checksum, 8))); + log(Log::DebugLevel::Extra, TQString("get script buffer checksum: %1").tqarg(toHexLabel(checksum, 8))); return true; } @@ -86,8 +86,8 @@ bool Pickit2V2::Hardware::downloadScript(ScriptType type, uint i) { if (i==0 ) return true; // empty script const ScriptData &sdata = SCRIPT_DATA[i-1]; - log(Log::DebugLevel::Max, QString(" download script #%1 (\"%2\") at position #%3") - .arg(i-1).arg(sdata.name).arg(toHexLabel(type, 2))); + log(Log::DebugLevel::Max, TQString(" download script #%1 (\"%2\") at position #%3") + .tqarg(i-1).tqarg(sdata.name).tqarg(toHexLabel(type, 2))); Array cmd; cmd[0] = DownloadScript; cmd[1] = type; @@ -145,8 +145,8 @@ bool Pickit2V2::Hardware::setTargetReset(Pic::ResetMode mode) bool Pickit2V2::Hardware::setVddVoltage(double value, double threshold) { - ushort v = ushort(qRound(32.0*value + 10.5)) << 6; - uchar vfault = uchar(qRound(256.0 * (threshold * value) / 5.0)); + ushort v = ushort(tqRound(32.0*value + 10.5)) << 6; + uchar vfault = uchar(tqRound(256.0 * (threshold * value) / 5.0)); if ( vfault>210 ) vfault = 210; Array cmd; cmd[0] = SetVdd; @@ -161,14 +161,14 @@ bool Pickit2V2::Hardware::setVppVoltage(double value, double threshold) Array cmd; cmd[0] = SetVpp; cmd[1] = 0x40; - cmd[2] = uchar(qRound(18.61*value)); - cmd[3] = uchar(qRound(18.61*value*threshold)); + cmd[2] = uchar(tqRound(18.61*value)); + cmd[3] = uchar(tqRound(18.61*value*threshold)); return port().command(cmd); } bool Pickit2V2::Hardware::setVddOn(bool on) { - log(Log::DebugLevel::Extra, QString("Vdd set to %1, self powered is %2").arg(on).arg(_base.isTargetSelfPowered())); + log(Log::DebugLevel::Extra, TQString("Vdd set to %1, self powered is %2").tqarg(on).tqarg(_base.isTargetSelfPowered())); ushort script[2]; script[0] = (on ? VddGroundOff : VddOff); if ( _base.isTargetSelfPowered() ) script[1] = (on ? VddOff : VddGroundOff); @@ -215,7 +215,7 @@ bool Pickit2V2::Hardware::readVoltages(VoltagesData &voltagesData) bool Pickit2V2::Hardware::downloadAddress(Address address) { - log(Log::DebugLevel::Max, QString("download address %1").arg(toHexLabel(address, 6))); + log(Log::DebugLevel::Max, TQString("download address %1").tqarg(toHexLabel(address, 6))); Array cmd; cmd[0] = ClearDownloadBuffer; cmd[1] = DownloadData; @@ -228,8 +228,8 @@ bool Pickit2V2::Hardware::downloadAddress(Address address) bool Pickit2V2::Hardware::runScript(ScriptType stype, uint repetitions, uint nbNoLens) { - log(Log::DebugLevel::Max, QString("run script %1: repetitions=%2 nbNoLen=%3") - .arg(toHexLabel(stype, 2)).arg(repetitions).arg(nbNoLens)); + log(Log::DebugLevel::Max, TQString("run script %1: repetitions=%2 nbNoLen=%3") + .tqarg(toHexLabel(stype, 2)).tqarg(repetitions).tqarg(nbNoLens)); #if 0 // ALTERNATE METHOD const Data &d = data(device().name()); for (uint i=0; i<repetitions; i++) @@ -283,7 +283,7 @@ bool Pickit2V2::Hardware::readMemory(Pic::MemoryRangeType otype, Device::Array & { uint nbWords = device().nbWords(otype); data.resize(nbWords); - log(Log::DebugLevel::Max, QString("read %1 nbWords=%2").arg(otype.label()).arg(nbWords)); + log(Log::DebugLevel::Max, TQString("read %1 nbWords=%2").tqarg(otype.label()).tqarg(nbWords)); uint nbBytesWord = device().nbBytesWord(otype); // EEPROM is read like regular program memory in midrange if ( !device().is18Family() && !device().is16bitFamily() && otype==Pic::MemoryRangeType::Eeprom ) nbBytesWord = 2; @@ -297,7 +297,7 @@ bool Pickit2V2::Hardware::readMemory(Pic::MemoryRangeType otype, Device::Array & ScriptType stype = readScript(type); Q_ASSERT( stype!=Nb_ScriptTypes ); const FamilyData *fdata = familyData(device()); - uint nbRunWords = QMIN(UploadBufferNbBytes / nbBytesWord, nbWords); + uint nbRunWords = TQMIN(UploadBufferNbBytes / nbBytesWord, nbWords); uint nbRuns = 1; uint nbReceive = (nbRunWords*nbBytesWord + 63) / 64; switch (type.type()) { @@ -312,7 +312,7 @@ bool Pickit2V2::Hardware::readMemory(Pic::MemoryRangeType otype, Device::Array & setAddress = false; if ( !prepareRead(type, wordOffset + i) ) return false; } - QValueVector<uint> words; + TQValueVector<uint> words; if ( type==Pic::MemoryRangeType::Config || type==Pic::MemoryRangeType::Cal ) { if ( !runScript(stype, 1, 0) ) return false; if ( !port().command(UploadData) ) return false; @@ -322,12 +322,12 @@ bool Pickit2V2::Hardware::readMemory(Pic::MemoryRangeType otype, Device::Array & if ( !runScript(stype, nbRuns, nbReceive) ) return false; if ( !port().receiveWords(nbBytesWord, nbReceive, words) ) return false; } - log(Log::DebugLevel::Max, QString("nbRunWords=%1 readNbWords=%2 index=%3/%4").arg(nbRunWords).arg(words.count()).arg(i).arg(nbWords)); + log(Log::DebugLevel::Max, TQString("nbRunWords=%1 readNbWords=%2 index=%3/%4").tqarg(nbRunWords).tqarg(words.count()).tqarg(i).tqarg(nbWords)); for (uint k=0; k<words.count(); k++) { if ( i>=nbWords ) break; data[i] = words[k]; if (fdata->progMemShift) data[i] >>= 1; - data[i] = data[i].maskWith(device().mask(type)); // ### correct ? + data[i] = data[i].tqmaskWith(device().tqmask(type)); // ### correct ? if ( vdata && !verifyWord(i, data[i], type, *vdata) ) return false; if ( type==Pic::MemoryRangeType::Code && i!=0x0 && i%0x8000==0 ) setAddress = true; i++; diff --git a/src/progs/pickit2v2/base/pickit2v2.h b/src/progs/pickit2v2/base/pickit2v2.h index 7c6f294..d1bd567 100644 --- a/src/progs/pickit2v2/base/pickit2v2.h +++ b/src/progs/pickit2v2/base/pickit2v2.h @@ -18,7 +18,7 @@ namespace Pickit2V2 enum FirmwareCommand { EnterBootloader = 0x42, NoOperation = 0x5A, FirmwareVersion = 0x76, - SetVdd = 0xA0, SetVpp = 0xA1, ReadStatus = 0xA2, ReadVoltages = 0xA3, + SetVdd = 0xA0, SetVpp = 0xA1, ReadtqStatus = 0xA2, ReadVoltages = 0xA3, DownloadScript = 0xA4, RunScript = 0xA5, ExecuteScript = 0xA6, ClearDownloadBuffer = 0xA7, DownloadData = 0xA8, ClearUploadBuffer = 0xA9, UploadData = 0xAA, ClearScriptBuffer = 0xAB, UploadDataNoLen = 0xAC, @@ -74,8 +74,8 @@ enum StatusFlag { ButtonPressed = 0x0040, VppError = 0x0020, VddError = 0x0010, VppIsOn = 0x0008, VppGroundIsOn = 0x0004, VddIsOn = 0x0002, VddGroundIsOn = 0x0001 }; -Q_DECLARE_FLAGS(StatusFlags, StatusFlag) -Q_DECLARE_OPERATORS_FOR_FLAGS(StatusFlags) +TQ_DECLARE_FLAGS(StatusFlags, StatusFlag) +TQ_DECLARE_OPERATORS_FOR_FLAGS(StatusFlags) //----------------------------------------------------------------------------- class Hardware : public ::Programmer::PicHardware @@ -94,7 +94,7 @@ public: bool setTarget(); bool setFastProgramming(bool fast); virtual bool readVoltages(VoltagesData &voltagesData); - bool readStatus(ushort &status); + bool readtqStatus(ushort &status); bool readMemory(Pic::MemoryRangeType type, ::Device::Array &data, const ::Programmer::VerifyData *vdata); bool writeMemory(Pic::MemoryRangeType type, const ::Device::Array &data, bool force); bool eraseAll(); diff --git a/src/progs/pickit2v2/base/pickit2v2_data.cpp b/src/progs/pickit2v2/base/pickit2v2_data.cpp index b93fad4..68a41aa 100644 --- a/src/progs/pickit2v2/base/pickit2v2_data.cpp +++ b/src/progs/pickit2v2/base/pickit2v2_data.cpp @@ -686,17 +686,17 @@ const CData *DATA_LIST[] = { &PIC33FJ64GP708_DATA,&PIC33FJ64GP710_DATA,&PIC33FJ64MC506_DATA,&PIC33FJ64MC508_DATA,&PIC33FJ64MC510_DATA,&PIC33FJ64MC706_DATA,&PIC33FJ64MC710_DATA,0 }; -const CData *cdata(const QString &device) +const CData *cdata(const TQString &device) { for(uint i=0; DATA_LIST[i]; i++) if ( device==DATA_LIST[i]->name ) return DATA_LIST[i]; return 0; } -::Group::Support support(const QString &) +::Group::Support support(const TQString &) { return ::Group::Support::Untested; } -const Data &data(const QString &device) +const Data &data(const TQString &device) { return cdata(device)->data; } @@ -736,7 +736,7 @@ const ScriptData SCRIPT_DATA[] = { { "DBG_BulkWrData.1", 1, 18, { 0xAAF5, 0xAADF, 0xBB04, 0xAAE0, 0xAAE6, 0xBB00, 0x000C, 0xAADE, 0xAADE, 0xAADE, 0xAADE, 0xAADE, 0xAADD, 0xBB01, 0xAAF4, 0xAAE3, 0xAAE0, 0xAAF4 } }, { "DBG_BulkRdData.1", 1, 18, { 0xAAF5, 0xAADF, 0xBB03, 0xAAE0, 0xAAE6, 0xBB00, 0x000C, 0xAADE, 0xAADE, 0xAADE, 0xAADE, 0xAAE0, 0xAADD, 0xBB01, 0xAAF4, 0xAAE3, 0xAAE0, 0xAAF4 } }, { "DBG_SStep.1", 1, 10, { 0xAAF5, 0xAADF, 0xBB1A, 0xAAE0, 0xAAF4, 0xAAE6, 0xBB00, 0xBB04, 0xAAE3, 0xAAE0 } }, - { "DBG_Status.1", 0, 1, { 0xAADC } }, + { "DBG_tqStatus.1", 0, 1, { 0xAADC } }, { "24_ProgEntry.1", 1, 31, { 0xAAFA, 0xAAF7, 0xAAF9, 0xAAF5, 0xAAF3, 0xBB00, 0xAAE8, 0x0014, 0xAAF6, 0xAAFB, 0xAAE7, 0x00EB, 0xAAFA, 0xAAF7, 0xAAE7, 0x002F, 0xAAF2, 0xBBB2, 0xAAF2, 0xBBC2, 0xAAF2, 0xBB12, 0xAAF2, 0xBB8A, 0xAAF6, 0xAAFB, 0xAAE8, 0x0009, 0xAAEE, 0xBB05, 0xBB00 } }, { "24_RdDevID.1", 0, 47, { 0xAAD9, 0xBB00, 0xBB02, 0xBB04, 0xAAD9, 0xBB00, 0xBB02, 0xBB04, 0xAAD8, 0xAAD8, 0xAAD8, 0xAAD9, 0xBB00, 0xBB02, 0xBB04, 0xAAD8, 0xAAD9, 0xBBF0, 0xBB0F, 0xBB20, 0xAAD9, 0xBB90, 0xBB01, 0xBB88, 0xAAD9, 0xBB06, 0xBB00, 0xBB20, 0xAAD8, 0xAAD8, 0xAAD9, 0xBB07, 0xBB00, 0xBB20, 0xAAD9, 0xBBB6, 0xBB0B, 0xBBBA, 0xAAD8, 0xAAD8, 0xAAD9, 0xBB20, 0xBB3C, 0xBB88, 0xAAD8, 0xAAD7, 0xAAD8 } }, { "24_SetAddr.1", 0, 29, { 0xAAD9, 0xBB00, 0xBB02, 0xBB04, 0xAAD9, 0xBB00, 0xBB02, 0xBB04, 0xAAD8, 0xAAD8, 0xAAD8, 0xAAD9, 0xBB00, 0xBB02, 0xBB04, 0xAAD8, 0xAAD4, 0xBB06, 0xAAD3, 0xBB00, 0xAAD9, 0xBB90, 0xBB01, 0xBB88, 0xAAD9, 0xBB47, 0xBB78, 0xBB20, 0xAAD8 } }, diff --git a/src/progs/pickit2v2/base/pickit2v2_data.h b/src/progs/pickit2v2/base/pickit2v2_data.h index 272fe92..582c485 100644 --- a/src/progs/pickit2v2/base/pickit2v2_data.h +++ b/src/progs/pickit2v2/base/pickit2v2_data.h @@ -9,7 +9,7 @@ #ifndef PICKIT2V2_DATA_H #define PICKIT2V2_DATA_H -#include <qstring.h> +#include <tqstring.h> namespace Pickit2V2 { @@ -81,7 +81,7 @@ struct Data { uchar codeMemoryNbWriteWords, eepromMemoryNbWriteWords; uchar scriptIndexes[Nb_ScriptTypes]; }; -extern const Data &data(const QString &device); +extern const Data &data(const TQString &device); struct FamilyData { Pic::Architecture architecture; diff --git a/src/progs/pickit2v2/base/pickit2v2_prog.cpp b/src/progs/pickit2v2/base/pickit2v2_prog.cpp index 3a44bca..b75cc56 100644 --- a/src/progs/pickit2v2/base/pickit2v2_prog.cpp +++ b/src/progs/pickit2v2/base/pickit2v2_prog.cpp @@ -40,7 +40,7 @@ bool Pickit2V2::Base::identifyDevice() if ( !_targetSelfPowered ) { if ( !hardware().setVddVoltage(vdd, 0.85)) return false; } - QString message = i18n("Unknown device"); + TQString message = i18n("Unknown device"); for (uint i=0; FAMILY_DATA[i].architecture!=Pic::Architecture::Nb_Types; i++) { const FamilyData &fdata = FAMILY_DATA[i]; if ( fdata.readDevIdScript==0 ) { @@ -59,8 +59,8 @@ bool Pickit2V2::Base::identifyDevice() if ( !hardware().executeScript(fdata.progExitScript) ) return false; uint rawId = (data[2]<<8) + data[1]; if (fdata.progMemShift) rawId >>= 1; - log(Log::DebugLevel::Normal, QString("Read id for family %1: %2").arg(fdata.architecture.key()).arg(toHexLabelAbs(rawId))); - QMap<QString, Device::IdData> ids; + log(Log::DebugLevel::Normal, TQString("Read id for family %1: %2").tqarg(fdata.architecture.key()).tqarg(toHexLabelAbs(rawId))); + TQMap<TQString, Device::IdData> ids; ::Group::Base::ConstIterator it; for (it=group().begin(); it!=group().end(); ++it) { const Pic::Data *data = static_cast<const Pic::Data *>(it.data().data); @@ -69,9 +69,9 @@ bool Pickit2V2::Base::identifyDevice() if ( data->matchId(rawId, idata) ) ids[it.key()] = idata; } if ( ids.count()!=0 ) { - log(Log::LineType::Information, i18n("Read id: %1").arg(device()->idNames(ids).join("; "))); - if ( ids.contains(device()->name()) ) return true; - message = i18n("Read id does not match the specified device name \"%1\".").arg(device()->name()); + log(Log::LineType::Information, i18n("Read id: %1").tqarg(device()->idNames(ids).join("; "))); + if ( ids.tqcontains(device()->name()) ) return true; + message = i18n("Read id does not match the specified device name \"%1\".").tqarg(device()->name()); break; } } @@ -79,7 +79,7 @@ bool Pickit2V2::Base::identifyDevice() logUserAbort(); return false; } - log(Log::LineType::Information, i18n("Continue with the specified device name: \"%1\"...").arg(device()->name())); + log(Log::LineType::Information, i18n("Continue with the specified device name: \"%1\"...").tqarg(device()->name())); return true; } @@ -92,13 +92,13 @@ bool Pickit2V2::Base::setTarget() bool Pickit2V2::Base::selfTest(bool ask) { ushort status; - if ( !hardware().readStatus(status) ) return false; - QString error; + if ( !hardware().readtqStatus(status) ) return false; + TQString error; if ( status & VppError ) error += i18n("Vpp voltage level error; "); if ( status & VddError ) error += i18n("Vdd voltage level error; "); if ( error.isEmpty() ) return true; - log(Log::LineType::Warning, i18n("Self-test failed: %1").arg(error)); - if ( ask && !askContinue(i18n("Self-test failed (%1). Do you want to continue anyway?").arg(error)) ) { + log(Log::LineType::Warning, i18n("Self-test failed: %1").tqarg(error)); + if ( ask && !askContinue(i18n("Self-test failed (%1). Do you want to continue anyway?").tqarg(error)) ) { logUserAbort(); return false; } diff --git a/src/progs/pickit2v2/base/pickit2v2_prog.h b/src/progs/pickit2v2/base/pickit2v2_prog.h index 3653649..5c9f764 100644 --- a/src/progs/pickit2v2/base/pickit2v2_prog.h +++ b/src/progs/pickit2v2/base/pickit2v2_prog.h @@ -19,6 +19,7 @@ class Hardware; class Base : public Pickit2::Base { Q_OBJECT + TQ_OBJECT public: Base(const Programmer::Group &group, const Pic::Data *data); virtual bool setTarget(); @@ -35,8 +36,8 @@ private: class Group : public Programmer::PicGroup { public: - virtual QString name() const { return "pickit2v2"; } - virtual QString label() const { return i18n("PICkit2 Firmware 2.x"); } + virtual TQString name() const { return "pickit2v2"; } + virtual TQString label() const { return i18n("PICkit2 Firmware 2.x"); } virtual Programmer::Properties properties() const { return ::Programmer::Programmer | ::Programmer::HasFirmware | ::Programmer::CanUploadFirmware | ::Programmer::CanReadMemory | ::Programmer::HasConnectedState; } virtual bool canReadVoltage(Pic::VoltageType type) const { return ( type==Pic::TargetVdd || type==Pic::TargetVpp ); } virtual ::Programmer::TargetPowerMode targetPowerMode() const { return ::Programmer::TargetPowerModeFromConfig; } |