diff options
Diffstat (limited to 'src/piklab-test/checksum/checksum_check.cpp')
-rw-r--r-- | src/piklab-test/checksum/checksum_check.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/src/piklab-test/checksum/checksum_check.cpp b/src/piklab-test/checksum/checksum_check.cpp index fdba104..86877c0 100644 --- a/src/piklab-test/checksum/checksum_check.cpp +++ b/src/piklab-test/checksum/checksum_check.cpp @@ -29,46 +29,46 @@ void ChecksumCheck::cleanup(const Device::Data &) } void ChecksumCheck::setProtection(const Pic::Data &data, const Pic::Checksum::Data &cdata, - const QString &maskName, const QString &valueName) + const TQString &tqmaskName, const TQString &valueName) { const Pic::Protection &protection = data.config().protection(); - if ( !maskName.isEmpty() && !valueName.isEmpty() ) _memory->setConfigValue(maskName, valueName); + if ( !tqmaskName.isEmpty() && !valueName.isEmpty() ) _memory->setConfigValue(tqmaskName, valueName); if ( !valueName.isEmpty() ) _memory->setUserIdToUnprotectedChecksum(); for (uint i=0; i<cdata.protectedMaskNames.count(); i++) { - QString pmName = cdata.protectedMaskNames[i]; - const Pic::Config::Mask *mask = data.config().findMask(pmName, 0); - for (int k=mask->values.count()-1; k>=0; k--) { - if ( mask->values[k].name.isEmpty() ) continue; - if ( protection.isNoneProtectedValueName(mask->values[k].name) ) continue; - _memory->setConfigValue(pmName, mask->values[k].name); + TQString pmName = cdata.protectedMaskNames[i]; + const Pic::Config::Mask *tqmask = data.config().findMask(pmName, 0); + for (int k=tqmask->values.count()-1; k>=0; k--) { + if ( tqmask->values[k].name.isEmpty() ) continue; + if ( protection.isNoneProtectedValueName(tqmask->values[k].name) ) continue; + _memory->setConfigValue(pmName, tqmask->values[k].name); break; } } if ( !cdata.bbsize.isEmpty() ) _memory->setConfigValue(protection.bootSizeMaskName(), cdata.bbsize); } -bool ChecksumCheck::checkChecksum(BitValue checksum, const QString &label) +bool ChecksumCheck::checkChecksum(BitValue checksum, const TQString &label) { BitValue c = _memory->checksum(); - if ( c!=checksum ) TEST_FAILED_RETURN(QString("%1 %2/%3").arg(label).arg(toHexLabel(c, 4)).arg(toHexLabel(checksum, 4))) + if ( c!=checksum ) TEST_FAILED_RETURN(TQString("%1 %2/%3").tqarg(label).tqarg(toHexLabel(c, 4)).tqarg(toHexLabel(checksum, 4))) return true; } -void ChecksumCheck::checkChecksum(const Pic::Data &pdata, const QString &maskName, const QString &valueName, bool &ok) +void ChecksumCheck::checkChecksum(const Pic::Data &pdata, const TQString &tqmaskName, const TQString &valueName, bool &ok) { - if ( !pdata.checksums().contains(valueName) ) { - const Pic::Config::Mask *mask = pdata.config().findMask(maskName); - QString label = valueName + (mask ? "/" + mask->name : QString::null); + if ( !pdata.checksums().tqcontains(valueName) ) { + const Pic::Config::Mask *tqmask = pdata.config().findMask(tqmaskName); + TQString label = valueName + (tqmask ? "/" + tqmask->name : TQString()); printf("Missing checksum for \"%s\"", label.latin1()); return; } const Pic::Checksum::Data &cdata = pdata.checksums()[valueName]; _memory->clear(); - setProtection(pdata, cdata, maskName, valueName); - if ( !checkChecksum(cdata.blankChecksum, maskName + ":" + valueName + "/" + "blank") ) ok = false; + setProtection(pdata, cdata, tqmaskName, valueName); + if ( !checkChecksum(cdata.blankChecksum, tqmaskName + ":" + valueName + "/" + "blank") ) ok = false; _memory->checksumCheckFill(); - setProtection(pdata, cdata, maskName, valueName); - if ( !checkChecksum(cdata.checkChecksum, maskName + ":" + valueName + "/" + "check") ) ok = false; + setProtection(pdata, cdata, tqmaskName, valueName); + if ( !checkChecksum(cdata.checkChecksum, tqmaskName + ":" + valueName + "/" + "check") ) ok = false; } bool ChecksumCheck::execute(const Device::Data &data) @@ -80,16 +80,16 @@ bool ChecksumCheck::execute(const Device::Data &data) const Pic::Protection &protection = pdata.config().protection(); switch ( protection.family() ) { case Pic::Protection::NoProtection: - checkChecksum(pdata, QString::null, QString::null, ok); + checkChecksum(pdata, TQString(), TQString(), ok); break; case Pic::Protection::BasicProtection: { - QString maskName = protection.maskName(Pic::Protection::ProgramProtected, Pic::MemoryRangeType::Code); - const Pic::Config::Mask *mask = pdata.config().findMask(maskName); - Q_ASSERT(mask); - for (uint i=0; i<mask->values.count(); i++) { - QString valueName = mask->values[i].name; + TQString tqmaskName = protection.tqmaskName(Pic::Protection::ProgramProtected, Pic::MemoryRangeType::Code); + const Pic::Config::Mask *tqmask = pdata.config().findMask(tqmaskName); + Q_ASSERT(tqmask); + for (uint i=0; i<tqmask->values.count(); i++) { + TQString valueName = tqmask->values[i].name; if ( valueName.isEmpty() ) continue; // invalid value - checkChecksum(pdata, maskName, valueName, ok); + checkChecksum(pdata, tqmaskName, valueName, ok); } break; } @@ -98,10 +98,10 @@ bool ChecksumCheck::execute(const Device::Data &data) checkChecksum(pdata, "GSSEC", "High Security", ok); break; case Pic::Protection::BlockProtection: { - const QMap<QString, Pic::Checksum::Data> &cmap = pdata.checksums(); - QMap<QString, Pic::Checksum::Data>::const_iterator it; + const TQMap<TQString, Pic::Checksum::Data> &cmap = pdata.checksums(); + TQMap<TQString, Pic::Checksum::Data>::const_iterator it; for (it=cmap.begin(); it!=cmap.end(); ++it) - checkChecksum(pdata, QString::null, it.key(), ok); + checkChecksum(pdata, TQString(), it.key(), ok); break; } case Pic::Protection::Nb_Families: Q_ASSERT(false); break; |