Remove the tq in front of these incorrectly TQt4-converted methods/data members:

tqrepaint[...]
tqinvalidate[...]
tqparent[...]
tqmask[...]
tqlayout[...]
tqalignment[...]


git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/piklab@1240522 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 14 years ago
parent 0aaa8e3fc8
commit 704123e815

@ -394,7 +394,7 @@ Coff::Section::Section(const Device::Data &device, const Object &object,
} }
//qDebug(" %s: %s (%s %s)", toHex(address, 4).data(), _data[address].disasm.data(), _data[address].opcode.data(), (nbop==2 ? _data[address+inc].opcode.data() : "")); //qDebug(" %s: %s (%s %s)", toHex(address, 4).data(), _data[address].disasm.data(), _data[address].opcode.data(), (nbop==2 ? _data[address+inc].opcode.data() : ""));
} else if ( _flags & FDataRom ) _instructions[address].opcode = toHex(op, 4); } else if ( _flags & FDataRom ) _instructions[address].opcode = toHex(op, 4);
else if ( _flags & FData ) _instructions[address].opcode = toHex(op.tqmaskWith(0xFF), 2); else if ( _flags & FData ) _instructions[address].opcode = toHex(op.maskWith(0xFF), 2);
} }
} }

@ -125,8 +125,8 @@ TQStringList SourceLine::configNames(Pic::ConfigNameType type, const Pic::Memory
BitValue v = memory.normalizedWord(Pic::MemoryRangeType::Config, word); BitValue v = memory.normalizedWord(Pic::MemoryRangeType::Config, word);
const Pic::Config::Word &cword = config._words[word]; const Pic::Config::Word &cword = config._words[word];
TQStringList cnames; TQStringList cnames;
for (uint k=0; k<uint(cword.tqmasks.count()); k++) { for (uint k=0; k<uint(cword.masks.count()); k++) {
const Pic::Config::Mask &ctqmask = cword.tqmasks[k]; const Pic::Config::Mask &ctqmask = cword.masks[k];
if ( ctqmask.value.isInside(cword.ptqmask) ) continue; // protected bits if ( ctqmask.value.isInside(cword.ptqmask) ) continue; // protected bits
for (int l=ctqmask.values.count()-1; l>=0; l--) { for (int l=ctqmask.values.count()-1; l>=0; l--) {
const Pic::Config::Value &cvalue = ctqmask.values[l]; const Pic::Config::Value &cvalue = ctqmask.values[l];

@ -96,7 +96,7 @@ public:
BitValue XORn(uint n) const; // XOR between groups of n bits inside value BitValue XORn(uint n) const; // XOR between groups of n bits inside value
BitValue XNORn(uint n) const; // XORn then NOT on n bits BitValue XNORn(uint n) const; // XORn then NOT on n bits
BitValue tqmaskWith(BitValue tqmask) const { return _value & tqmask._value; } BitValue maskWith(BitValue tqmask) const { return _value & tqmask._value; }
bool isInside(BitValue v) const { return ( (_value & v._value)==_value ); } bool isInside(BitValue v) const { return ( (_value & v._value)==_value ); }
BitValue complementInMask(BitValue tqmask) const { return tqmask._value & ~_value; } BitValue complementInMask(BitValue tqmask) const { return tqmask._value & ~_value; }
BitValue twoComplement() const { return -_value; } BitValue twoComplement() const { return -_value; }

@ -137,7 +137,7 @@ TQString PURL::Private::findName(const TQString &filepath)
TQString PURL::Private::convertWindowsShortFilepath(const TQString &filepath) TQString PURL::Private::convertWindowsShortFilepath(const TQString &filepath)
{ {
// aptqparently "winepath" cannot do that for us and it is a real pain too... // apparently "winepath" cannot do that for us and it is a real pain too...
// we assume filepath is an absolute unix path // we assume filepath is an absolute unix path
// first see if we know the dirpath // first see if we know the dirpath
TQFileInfo finfo(filepath); TQFileInfo finfo(filepath);

@ -82,7 +82,7 @@ protected:
virtual bool isValid() const { return true; } virtual bool isValid() const { return true; }
virtual BitValue tqmask() const { return maxValue(NumberBase::Hex, _nbChars); } virtual BitValue tqmask() const { return maxValue(NumberBase::Hex, _nbChars); }
virtual BitValue normalizeWord(BitValue value) const { return value.tqmaskWith(tqmask()); } virtual BitValue normalizeWord(BitValue value) const { return value.maskWith(tqmask()); }
virtual BitValue word() const { return _word; } virtual BitValue word() const { return _word; }
virtual void setWord(BitValue value) { _word = value; } virtual void setWord(BitValue value) { _word = value; }
virtual BitValue blankValue() const { return 0; } virtual BitValue blankValue() const { return 0; }

@ -250,8 +250,8 @@ void HexBuffer::load(TQTextStream &stream, Format &format, TQValueList<ErrorData
// however, I don't know if such a situation can occurs // however, I don't know if such a situation can occurs
uint a = addrbase+x >> 1; uint a = addrbase+x >> 1;
BitValue value = (*this)[a]; BitValue value = (*this)[a];
if ( addrbase+x & 1 ) insert(a, value.tqmaskWith(0x00FF) | data << 8); // Odd addr => Hi byte if ( addrbase+x & 1 ) insert(a, value.maskWith(0x00FF) | data << 8); // Odd addr => Hi byte
else insert(a, value.tqmaskWith(0xFF00) | data); // Low byte else insert(a, value.maskWith(0xFF00) | data); // Low byte
//if ( x==0 ) qDebug("fb@%s: %s", toHex(addrbase+x >> 1, 8).data(), toHex(fb[addrbase+x >> 1], 8).data()); //if ( x==0 ) qDebug("fb@%s: %s", toHex(addrbase+x >> 1, 8).data(), toHex(fb[addrbase+x >> 1], 8).data());
cksum += data; cksum += data;
} }

@ -55,7 +55,7 @@ private:
virtual bool isValid() const { return true; } virtual bool isValid() const { return true; }
virtual BitValue tqmask() const { return _tqmask; } virtual BitValue tqmask() const { return _tqmask; }
virtual BitValue normalizeWord(BitValue value) const { return value.tqmaskWith(_tqmask); } virtual BitValue normalizeWord(BitValue value) const { return value.maskWith(_tqmask); }
virtual BitValue word() const { return _word; } virtual BitValue word() const { return _word; }
virtual void setWord(BitValue value) { _word = value; } virtual void setWord(BitValue value) { _word = value; }
virtual BitValue blankValue() const { return BitValue(); } virtual BitValue blankValue() const { return BitValue(); }

@ -34,5 +34,5 @@ BitValue Mem24::HexView::checksum() const
BitValue cs = 0x0000; BitValue cs = 0x0000;
for (uint i=0; i<static_cast<const Data &>(_memory->device()).nbBytes(); i++) for (uint i=0; i<static_cast<const Data &>(_memory->device()).nbBytes(); i++)
cs += static_cast<const Memory *>(_memory)->byte(i); cs += static_cast<const Memory *>(_memory)->byte(i);
return cs.tqmaskWith(0xFFFF); return cs.maskWith(0xFFFF);
} }

@ -34,7 +34,7 @@ void Mem24::Memory::copyFrom(const Device::Memory &memory)
Device::Array Mem24::Memory::arrayForWriting() const Device::Array Mem24::Memory::arrayForWriting() const
{ {
Device::Array data(_data.count()); Device::Array data(_data.count());
for (uint i=0; i<data.count(); i++) data[i] = _data[i].tqmaskWith(0xFF); for (uint i=0; i<data.count(); i++) data[i] = _data[i].maskWith(0xFF);
return data; return data;
} }
@ -55,7 +55,7 @@ BitValue Mem24::Memory::checksum() const
{ {
BitValue cs = 0x0000; BitValue cs = 0x0000;
for (uint i=0; i<_data.count(); i++) cs += _data[i]; for (uint i=0; i<_data.count(); i++) cs += _data[i];
return cs.tqmaskWith(0xFFFF); return cs.maskWith(0xFFFF);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -86,7 +86,7 @@ void Mem24::Memory::fromHexBuffer(const HexBuffer &hb, WarningTypes &result,
warnings += i18n("At least one word (at offset %1) is larger (%2) than the corresponding tqmask (%3).") warnings += i18n("At least one word (at offset %1) is larger (%2) than the corresponding tqmask (%3).")
.tqarg(toHexLabel(k, 8)).tqarg(toHexLabel(_data[k], 8)).tqarg(toHexLabel(tqmask, 8)); .tqarg(toHexLabel(k, 8)).tqarg(toHexLabel(_data[k], 8)).tqarg(toHexLabel(tqmask, 8));
} }
_data[k] = _data[k].tqmaskWith(tqmask); _data[k] = _data[k].maskWith(tqmask);
} }
} }
} }

@ -32,8 +32,8 @@ bool Programmer::Mem24DeviceSpecific::write(const Device::Array &data)
bool Programmer::Mem24DeviceSpecific::verifyByte(uint index, BitValue d, const VerifyData &vdata) bool Programmer::Mem24DeviceSpecific::verifyByte(uint index, BitValue d, const VerifyData &vdata)
{ {
BitValue v = static_cast<const Mem24::Memory &>(vdata.memory).byte(index); BitValue v = static_cast<const Mem24::Memory &>(vdata.memory).byte(index);
v = v.tqmaskWith(0xFF); v = v.maskWith(0xFF);
d = d.tqmaskWith(0xFF); d = d.maskWith(0xFF);
if ( v==d ) return true; if ( v==d ) return true;
Address address = index; Address address = index;
if ( vdata.actions & BlankCheckVerify ) if ( vdata.actions & BlankCheckVerify )

@ -175,23 +175,23 @@ bool Pic::Data::matchId(BitValue rawId, Device::IdData &idata) const
case Architecture::P18F: case Architecture::P18F:
case Architecture::P18J: case Architecture::P18J:
nid = rawId.clearMaskBits(0x1F); nid = rawId.clearMaskBits(0x1F);
idata.revision = rawId.tqmaskWith(0x1F); idata.revision = rawId.maskWith(0x1F);
break; break;
case Architecture::P24F: case Architecture::P24F:
nid = (rawId >> 16).tqmaskWith(0x3FFF); nid = (rawId >> 16).maskWith(0x3FFF);
idata.revision = (rawId >> 6).tqmaskWith(0x7); idata.revision = (rawId >> 6).maskWith(0x7);
idata.minorRevision = rawId.tqmaskWith(0x7); idata.minorRevision = rawId.maskWith(0x7);
break; break;
case Architecture::P30F: case Architecture::P30F:
nid = (rawId >> 16).tqmaskWith(0xFFFF); nid = (rawId >> 16).maskWith(0xFFFF);
idata.revision = (rawId >> 6).tqmaskWith(0x3F); idata.revision = (rawId >> 6).maskWith(0x3F);
idata.minorRevision = rawId.tqmaskWith(0x3F); idata.minorRevision = rawId.maskWith(0x3F);
idata.process = (rawId >> 12).tqmaskWith(0xF); idata.process = (rawId >> 12).maskWith(0xF);
break; break;
case Architecture::P24H: case Architecture::P24H:
case Architecture::P33F: case Architecture::P33F:
nid = (rawId >> 16).tqmaskWith(0xFFFF); nid = (rawId >> 16).maskWith(0xFFFF);
idata.revision = rawId.tqmaskWith(0xFFFF); // ?? idata.revision = rawId.maskWith(0xFFFF); // ??
break; break;
case Architecture::Nb_Types: Q_ASSERT(false); break; case Architecture::Nb_Types: Q_ASSERT(false); break;
} }
@ -241,7 +241,7 @@ bool Pic::Data::checkCalibration(const Device::Array &data, TQString *message) c
} }
} }
if ( data.count()==1 ) { if ( data.count()==1 ) {
if ( data[0].tqmaskWith(_calibration.opcodeMask)!=_calibration.opcode ) { if ( data[0].maskWith(_calibration.opcodeMask)!=_calibration.opcode ) {
if (message) *message = i18n("Calibration word is not a compatible opcode (%2).") if (message) *message = i18n("Calibration word is not a compatible opcode (%2).")
.tqarg(toHexLabel(_calibration.opcode, nbCharsWord(MemoryRangeType::Code))); .tqarg(toHexLabel(_calibration.opcode, nbCharsWord(MemoryRangeType::Code)));
return false; return false;
@ -326,16 +326,16 @@ Device::Array Pic::Data::gotoInstruction(Address address, bool withPageSelection
bool Pic::Data::isGotoInstruction(BitValue instruction) const bool Pic::Data::isGotoInstruction(BitValue instruction) const
{ {
switch (_architecture.type()) { switch (_architecture.type()) {
case Architecture::P10X: return ( instruction.tqmaskWith(0xE00)==0xA00 ); case Architecture::P10X: return ( instruction.maskWith(0xE00)==0xA00 );
case Architecture::P16X: return ( instruction.tqmaskWith(0xF800)==0x2800 ); case Architecture::P16X: return ( instruction.maskWith(0xF800)==0x2800 );
case Architecture::P17C: return ( instruction.tqmaskWith(0xE000)==0xC000 ); case Architecture::P17C: return ( instruction.maskWith(0xE000)==0xC000 );
case Architecture::P18C: case Architecture::P18C:
case Architecture::P18F: case Architecture::P18F:
case Architecture::P18J: return ( instruction.tqmaskWith(0xFF00)==0xEF00 ); case Architecture::P18J: return ( instruction.maskWith(0xFF00)==0xEF00 );
case Architecture::P24F: case Architecture::P24F:
case Architecture::P24H: case Architecture::P24H:
case Architecture::P30F: case Architecture::P30F:
case Architecture::P33F: return ( instruction.tqmaskWith(0xFF0000)==0x040000 ); case Architecture::P33F: return ( instruction.maskWith(0xFF0000)==0x040000 );
case Architecture::Nb_Types: Q_ASSERT(false); break; case Architecture::Nb_Types: Q_ASSERT(false); break;
} }
return false; return false;

@ -280,30 +280,30 @@ const Pic::Config::Data Pic::Config::DATA[] = {
{ { 0, 0 }, Fixed, { { 0, 0 } } } { { 0, 0 }, Fixed, { { 0, 0 } } }
}; };
TQMap<TQString, Pic::Config::MapData> *Pic::Config::_tqmasks = 0; TQMap<TQString, Pic::Config::MapData> *Pic::Config::_masks = 0;
TQMap<TQString, Pic::Config::MapData> &Pic::Config::tqmasks() TQMap<TQString, Pic::Config::MapData> &Pic::Config::masks()
{ {
if ( _tqmasks==0 ) { if ( _masks==0 ) {
_tqmasks = new TQMap<TQString, MapData>; _masks = new TQMap<TQString, MapData>;
for (uint i=0; DATA[i].tqmask.name; i++) { for (uint i=0; DATA[i].tqmask.name; i++) {
(*_tqmasks)[DATA[i].tqmask.name] = MapData(i, -1); (*_masks)[DATA[i].tqmask.name] = MapData(i, -1);
if ( DATA[i].type==MemoryRange ) { if ( DATA[i].type==MemoryRange ) {
for (uint k=0; k<Protection::MAX_NB_BLOCKS; k++) for (uint k=0; k<Protection::MAX_NB_BLOCKS; k++)
(*_tqmasks)[TQString("%1_%2").tqarg(DATA[i].tqmask.name).tqarg(k)] = MapData(i, k); (*_masks)[TQString("%1_%2").tqarg(DATA[i].tqmask.name).tqarg(k)] = MapData(i, k);
} }
} }
} }
return *_tqmasks; return *_masks;
} }
bool Pic::Config::hasMaskName(const TQString &tqmask) bool Pic::Config::hasMaskName(const TQString &tqmask)
{ {
return tqmasks().tqcontains(tqmask); return masks().tqcontains(tqmask);
} }
TQString Pic::Config::tqmaskLabel(const TQString &tqmask) TQString Pic::Config::maskLabel(const TQString &tqmask)
{ {
const MapData &mp = tqmasks()[tqmask]; const MapData &mp = masks()[tqmask];
TQString s = i18n(DATA[mp.index].tqmask.label); TQString s = i18n(DATA[mp.index].tqmask.label);
if ( mp.block>=0 ) return i18n("%1 for block %2").tqarg(s).tqarg(mp.block); if ( mp.block>=0 ) return i18n("%1 for block %2").tqarg(s).tqarg(mp.block);
return s; return s;
@ -312,10 +312,10 @@ TQString Pic::Config::tqmaskLabel(const TQString &tqmask)
const Pic::Config::Mask *Pic::Config::findMask(const TQString &tqmask, 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 i=0; i<uint(_words.count()); i++)
for (uint k=0; k<uint(_words[i].tqmasks.count()); k++) { for (uint k=0; k<uint(_words[i].masks.count()); k++) {
if ( _words[i].tqmasks[k].name==tqmask ) { if ( _words[i].masks[k].name==tqmask ) {
if (wordIndex) *wordIndex = i; if (wordIndex) *wordIndex = i;
return &_words[i].tqmasks[k]; return &_words[i].masks[k];
} }
} }
return 0; return 0;
@ -332,7 +332,7 @@ const Pic::Config::Value *Pic::Config::findValue(const TQString &tqmask, const T
bool Pic::Config::checkValueName(const TQString &tqmask, const TQString &name) const bool Pic::Config::checkValueName(const TQString &tqmask, const TQString &name) const
{ {
const Data &data = DATA[tqmasks()[tqmask].index]; const Data &data = DATA[masks()[tqmask].index];
TQString pinRegexp = "[A-Z]+\\d*(/[A-Z]+\\d*)?"; TQString pinRegexp = "[A-Z]+\\d*(/[A-Z]+\\d*)?";
switch (data.type) { switch (data.type) {
case Fixed: break; case Fixed: break;
@ -381,7 +381,7 @@ bool Pic::Config::checkValueName(const TQString &tqmask, const TQString &name) c
TQString Pic::Config::valueLabel(const TQString &tqmask, const TQString &name) TQString Pic::Config::valueLabel(const TQString &tqmask, const TQString &name)
{ {
const Data &data = DATA[tqmasks()[tqmask].index]; const Data &data = DATA[masks()[tqmask].index];
switch (data.type) { switch (data.type) {
case Fixed: case Fixed:
case ValueDouble: case ValueDouble:
@ -406,7 +406,7 @@ TQString Pic::Config::valueLabel(const TQString &tqmask, const TQString &name)
BitValue Pic::Config::Word::usedMask() const BitValue Pic::Config::Word::usedMask() const
{ {
BitValue tqmask = 0x0; BitValue tqmask = 0x0;
for (uint i=0; i<uint(tqmasks.count()); i++) tqmask |= tqmasks[i].value; for (uint i=0; i<uint(masks.count()); i++) tqmask |= masks[i].value;
return tqmask; return tqmask;
} }
@ -435,12 +435,12 @@ TQDataStream &Pic::operator >>(TQDataStream &s, Config::Mask &tqmask)
TQDataStream &Pic::operator <<(TQDataStream &s, const Config::Word &word) TQDataStream &Pic::operator <<(TQDataStream &s, const Config::Word &word)
{ {
s << word.name << word.ignoredCNames << word.wtqmask << word.ptqmask << word.ctqmask << word.bvalue << word.tqmasks; s << word.name << word.ignoredCNames << word.wtqmask << word.ptqmask << word.ctqmask << word.bvalue << word.masks;
return s; return s;
} }
TQDataStream &Pic::operator >>(TQDataStream &s, Config::Word &word) TQDataStream &Pic::operator >>(TQDataStream &s, Config::Word &word)
{ {
s >> word.name >> word.ignoredCNames >> word.wtqmask >> word.ptqmask >> word.ctqmask >> word.bvalue >> word.tqmasks; s >> word.name >> word.ignoredCNames >> word.wtqmask >> word.ptqmask >> word.ctqmask >> word.bvalue >> word.masks;
return s; return s;
} }

@ -48,9 +48,9 @@ public:
public: public:
TQString name; TQString name;
TQStringList ignoredCNames; TQStringList ignoredCNames;
BitValue wtqmask, ptqmask, ctqmask; // write, protected, and checksum bits tqmasks BitValue wtqmask, ptqmask, ctqmask; // write, protected, and checksum bits masks
BitValue bvalue; // blank value BitValue bvalue; // blank value
TQValueVector<Mask> tqmasks; // ordered from lower to higher TQValueVector<Mask> masks; // ordered from lower to higher
BitValue usedMask() const; BitValue usedMask() const;
}; };
@ -62,7 +62,7 @@ public:
const Value *findValue(const TQString &tqmask, const TQString &value) const; const Value *findValue(const TQString &tqmask, const TQString &value) const;
const Mask *findMask(const TQString &tqmask, uint *wordIndex = 0) const; const Mask *findMask(const TQString &tqmask, uint *wordIndex = 0) const;
static bool hasMaskName(const TQString &tqmask); static bool hasMaskName(const TQString &tqmask);
static TQString tqmaskLabel(const TQString &tqmask); static TQString maskLabel(const TQString &tqmask);
bool checkValueName(const TQString &tqmask, const TQString &name) const; bool checkValueName(const TQString &tqmask, const TQString &name) const;
static TQString valueLabel(const TQString &tqmask, const TQString &name); static TQString valueLabel(const TQString &tqmask, const TQString &name);
@ -73,8 +73,8 @@ private:
MapData(int i, int b) : index(i), block(b) {} MapData(int i, int b) : index(i), block(b) {}
int index, block; int index, block;
}; };
static TQMap<TQString, MapData> &tqmasks(); static TQMap<TQString, MapData> &masks();
static TQMap<TQString, MapData> *_tqmasks; // tqmask name -> index in DATA static TQMap<TQString, MapData> *_masks; // tqmask name -> index in DATA
struct NameData { struct NameData {
const char *name, *label; const char *name, *label;

@ -29,7 +29,7 @@ bool Pic::Protection::isAllProtectedValueName(const TQString &name) const
Pic::Protection::Family Pic::Protection::family() const Pic::Protection::Family Pic::Protection::family() const
{ {
if ( _config.findMask("WRTBS") ) return CodeGuard; if ( _config.findMask("WRTBS") ) return CodeGuard;
TQString tqmask = tqmaskName(ProgramProtected, MemoryRangeType::Code); TQString tqmask = maskName(ProgramProtected, MemoryRangeType::Code);
if ( _config.findMask(TQString("%1_%2").tqarg(tqmask).tqarg(0)) ) return BlockProtection; if ( _config.findMask(TQString("%1_%2").tqarg(tqmask).tqarg(0)) ) return BlockProtection;
if ( _config.findMask(tqmask) ) return BasicProtection; if ( _config.findMask(tqmask) ) return BasicProtection;
return NoProtection; return NoProtection;
@ -79,10 +79,10 @@ TQString Pic::Protection::blockMaskName(Type type, uint block) const
if ( type==StandardSecurity || type==HighSecurity ) return (block==0 ? "SSSEC" : "GSSEC"); if ( type==StandardSecurity || type==HighSecurity ) return (block==0 ? "SSSEC" : "GSSEC");
return TQString(); return TQString();
} }
return TQString("%1_%2").tqarg(tqmaskName(type, MemoryRangeType::Code)).tqarg(block); return TQString("%1_%2").tqarg(maskName(type, MemoryRangeType::Code)).tqarg(block);
} }
TQString Pic::Protection::tqmaskName(Type type, MemoryRangeType mtype) const TQString Pic::Protection::maskName(Type type, MemoryRangeType mtype) const
{ {
Q_ASSERT( type!=Nb_Types ); Q_ASSERT( type!=Nb_Types );
switch (mtype.type()) { switch (mtype.type()) {
@ -215,7 +215,7 @@ Pic::Protection::ProtectedRange Pic::Protection::extractRange(const TQString &tq
for (MemoryRangeType type; type<=MemoryRangeType::Nb_Types; ++type) { // #### danger: <= for (MemoryRangeType type; type<=MemoryRangeType::Nb_Types; ++type) { // #### danger: <=
isBootBlock = ( type==MemoryRangeType::Nb_Types ); isBootBlock = ( type==MemoryRangeType::Nb_Types );
for (uint k=0; k<Nb_Types; k++) { for (uint k=0; k<Nb_Types; k++) {
TQString mname = (isBootBlock ? bootMaskName(Type(k)) : tqmaskName(Type(k), type)); TQString mname = (isBootBlock ? bootMaskName(Type(k)) : maskName(Type(k), type));
if ( rexp.cap(1)!=mname ) continue; if ( rexp.cap(1)!=mname ) continue;
rtype = (isBootBlock ? MemoryRangeType(MemoryRangeType::Code) : type); rtype = (isBootBlock ? MemoryRangeType(MemoryRangeType::Code) : type);
ptype = Type(k); ptype = Type(k);

@ -38,7 +38,7 @@ public:
TQString blockLabel(uint i) const; TQString blockLabel(uint i) const;
AddressRangeVector extractRanges(const TQString &name, MemoryRangeType type) const; AddressRangeVector extractRanges(const TQString &name, MemoryRangeType type) const;
bool checkRange(const TQString &tqmask, const TQString &name) const; bool checkRange(const TQString &tqmask, const TQString &name) const;
TQString tqmaskName(Type type, MemoryRangeType mtype) const; TQString maskName(Type type, MemoryRangeType mtype) const;
bool isAllProtectedValueName(const TQString &valueName) const; bool isAllProtectedValueName(const TQString &valueName) const;
bool isNoneProtectedValueName(const TQString &valueName) const; bool isNoneProtectedValueName(const TQString &valueName) const;

@ -34,8 +34,8 @@ Pic::MemoryConfigEditorWidget::MemoryConfigEditorWidget(Memory &memory, bool wit
for(uint i=0; i<nbWords; ++i) { for(uint i=0; i<nbWords; ++i) {
//qDebug("BinWordsEditor for config word #%i", i); //qDebug("BinWordsEditor for config word #%i", i);
//uint address = device().range(Device::MemoryConfig).start + device().addressIncrement(Device::MemoryConfig) * i; //uint address = device().range(Device::MemoryConfig).start + device().addressIncrement(Device::MemoryConfig) * i;
//qDebug("address: %s %s nb: %i", toHex(address, 8).data(), device().configWord(i).name.latin1(), device().configWord(i).tqmasks.count()); //qDebug("address: %s %s nb: %i", toHex(address, 8).data(), device().configWord(i).name.latin1(), device().configWord(i).masks.count());
if ( device().config()._words[i].tqmasks.count()==0 ) continue; if ( device().config()._words[i].masks.count()==0 ) continue;
TQWidget *page = 0; TQWidget *page = 0;
if ( nbWords>1 ) { if ( nbWords>1 ) {
page = new TQWidget(tabw); page = new TQWidget(tabw);

@ -123,11 +123,11 @@ Pic::ConfigWordEditor::ConfigWordEditor(Memory &memory, uint ci, bool withWordEd
TQGridLayout *grid = new TQGridLayout(_top); TQGridLayout *grid = new TQGridLayout(_top);
grid->setColStretch(2, 1); grid->setColStretch(2, 1);
const Config::Word &cword = device().config()._words[ci]; const Config::Word &cword = device().config()._words[ci];
_combos.resize(cword.tqmasks.count()); _combos.resize(cword.masks.count());
uint nbChars = device().nbCharsWord(MemoryRangeType::Config); uint nbChars = device().nbCharsWord(MemoryRangeType::Config);
for (uint k=0; k<_combos.count(); k++) { for (uint k=0; k<_combos.count(); k++) {
const Config::Mask &ctqmask = cword.tqmasks[k]; const Config::Mask &ctqmask = cword.masks[k];
TQLabel *label = new TQLabel(Config::tqmaskLabel(ctqmask.name) + ":", this); TQLabel *label = new TQLabel(Config::maskLabel(ctqmask.name) + ":", this);
grid->addWidget(label, k, 0); grid->addWidget(label, k, 0);
label = new TQLabel(ctqmask.name, this); label = new TQLabel(ctqmask.name, this);
grid->addWidget(label, k, 1); grid->addWidget(label, k, 1);
@ -148,7 +148,7 @@ void Pic::ConfigWordEditor::setReadOnly(bool readOnly)
if (_mdb) _mdb->setReadOnly(readOnly); if (_mdb) _mdb->setReadOnly(readOnly);
const Config::Word &cword = device().config()._words[_configIndex]; const Config::Word &cword = device().config()._words[_configIndex];
for (uint k=0; k<_combos.count(); k++) { for (uint k=0; k<_combos.count(); k++) {
const Config::Mask &ctqmask = cword.tqmasks[k]; const Config::Mask &ctqmask = cword.masks[k];
_combos[k]->setEnabled(!readOnly && !ctqmask.value.isOverlapping(cword.ptqmask) && ctqmask.values.count()!=1); _combos[k]->setEnabled(!readOnly && !ctqmask.value.isOverlapping(cword.ptqmask) && ctqmask.values.count()!=1);
} }
} }
@ -158,7 +158,7 @@ void Pic::ConfigWordEditor::slotModified()
BitValue v = memory().word(MemoryRangeType::Config, _configIndex); BitValue v = memory().word(MemoryRangeType::Config, _configIndex);
//qDebug("BinWordEditor::slotModified %i: %s", _configIndex, toHex(v, 4).data()); //qDebug("BinWordEditor::slotModified %i: %s", _configIndex, toHex(v, 4).data());
for (uint k=0; k<_combos.count(); k++) { for (uint k=0; k<_combos.count(); k++) {
const Config::Mask &ctqmask = device().config()._words[_configIndex].tqmasks[k]; const Config::Mask &ctqmask = device().config()._words[_configIndex].masks[k];
v = v.clearMaskBits(ctqmask.value); v = v.clearMaskBits(ctqmask.value);
v |= ctqmask.values[_combos[k]->index()].value; // set value v |= ctqmask.values[_combos[k]->index()].value; // set value
} }
@ -174,7 +174,7 @@ void Pic::ConfigWordEditor::updateDisplay()
uint nbChars = device().nbCharsWord(MemoryRangeType::Config); uint nbChars = device().nbCharsWord(MemoryRangeType::Config);
//qDebug("BinWordEditor::updateDisplay %i: %s", _configIndex, toHex(v, 4).data()); //qDebug("BinWordEditor::updateDisplay %i: %s", _configIndex, toHex(v, 4).data());
for (uint k=0; k<_combos.count(); k++) { for (uint k=0; k<_combos.count(); k++) {
const Config::Mask &ctqmask = device().config()._words[_configIndex].tqmasks[k]; const Config::Mask &ctqmask = device().config()._words[_configIndex].masks[k];
for (int i=ctqmask.values.count()-1; i>=0; i--) { for (int i=ctqmask.values.count()-1; i>=0; i--) {
if ( ctqmask.values[i].value.isInside(v) ) { if ( ctqmask.values[i].value.isInside(v) ) {
if ( ctqmask.values[i].isValid() ) _combos[k]->setItem(i); if ( ctqmask.values[i].isValid() ) _combos[k]->setItem(i);

@ -58,7 +58,7 @@ Device::Array Pic::Memory::arrayForWriting(MemoryRangeType type) const
{ {
Device::Array data = _ranges[type]; Device::Array data = _ranges[type];
for (uint i=0; i<data.count(); i++) for (uint i=0; i<data.count(); i++)
data[i] = data[i].tqmaskWith(type==MemoryRangeType::Config ? device().config()._words[i].wtqmask : device().tqmask(type)); data[i] = data[i].maskWith(type==MemoryRangeType::Config ? device().config()._words[i].wtqmask : device().tqmask(type));
return data; return data;
} }
@ -72,10 +72,10 @@ BitValue Pic::Memory::normalizeWord(MemoryRangeType type, uint offset, BitValue
{ {
if ( type==MemoryRangeType::Config) { if ( type==MemoryRangeType::Config) {
const Config::Word &cword = device().config()._words[offset]; const Config::Word &cword = device().config()._words[offset];
return value.tqmaskWith(cword.usedMask()); return value.maskWith(cword.usedMask());
} }
if ( type==MemoryRangeType::UserId ) return value.tqmaskWith(device().userIdRecommendedMask()); if ( type==MemoryRangeType::UserId ) return value.maskWith(device().userIdRecommendedMask());
return value.tqmaskWith(device().tqmask(type)); return value.maskWith(device().tqmask(type));
} }
BitValue Pic::Memory::normalizedWord(MemoryRangeType type, uint offset) const BitValue Pic::Memory::normalizedWord(MemoryRangeType type, uint offset) const
@ -96,13 +96,13 @@ void Pic::Memory::setArray(MemoryRangeType type, const Device::Array &data)
_ranges[type] = data; _ranges[type] = data;
} }
TQString Pic::Memory::findValue(const TQString &tqmaskName) const TQString Pic::Memory::findValue(const TQString &maskName) const
{ {
if ( tqmaskName.isEmpty() ) return TQString(); if ( maskName.isEmpty() ) return TQString();
uint i; uint i;
const Config::Mask *tqmask = device().config().findMask(tqmaskName, &i); const Config::Mask *tqmask = device().config().findMask(maskName, &i);
if ( tqmask==0 ) return TQString(); if ( tqmask==0 ) return TQString();
BitValue v = word(MemoryRangeType::Config, i).tqmaskWith(tqmask->value); BitValue v = word(MemoryRangeType::Config, i).maskWith(tqmask->value);
for (uint k=0; k<uint(tqmask->values.count()); k++) for (uint k=0; k<uint(tqmask->values.count()); k++)
if ( v.isInside(tqmask->values[k].value) ) return tqmask->values[k].name; if ( v.isInside(tqmask->values[k].value) ) return tqmask->values[k].name;
Q_ASSERT(false); Q_ASSERT(false);
@ -122,8 +122,8 @@ AddressRange Pic::Memory::bootRange() const
return AddressRange(start, 2 * size - 1); // instruction words return AddressRange(start, 2 * size - 1); // instruction words
} }
// only CPB // only CPB
TQString tqmaskName = protection.bootMaskName(Protection::ProgramProtected); TQString maskName = protection.bootMaskName(Protection::ProgramProtected);
const Config::Mask *tqmask = device().config().findMask(tqmaskName); const Config::Mask *tqmask = device().config().findMask(maskName);
for (uint k=0; k<uint(tqmask->values.count()); k++) { for (uint k=0; k<uint(tqmask->values.count()); k++) {
AddressRangeVector rv = protection.extractRanges(tqmask->values[k].name, MemoryRangeType::Code); AddressRangeVector rv = protection.extractRanges(tqmask->values[k].name, MemoryRangeType::Code);
if ( !rv.isEmpty() ) return rv[0]; if ( !rv.isEmpty() ) return rv[0];
@ -142,9 +142,9 @@ AddressRange Pic::Memory::blockRange(uint i) const
Address start = (previous.isEmpty() ? device().range(MemoryRangeType::Code).start : previous.end + 1); Address start = (previous.isEmpty() ? device().range(MemoryRangeType::Code).start : previous.end + 1);
return AddressRange(start, device().range(MemoryRangeType::Code).end); return AddressRange(start, device().range(MemoryRangeType::Code).end);
} }
TQString tqmaskName = protection.blockSizeMaskName(i); TQString maskName = protection.blockSizeMaskName(i);
if ( protection.family()==Protection::CodeGuard ) { // secure segment if ( protection.family()==Protection::CodeGuard ) { // secure segment
TQString value = findValue(tqmaskName); TQString value = findValue(maskName);
Q_ASSERT( !value.isEmpty() ); Q_ASSERT( !value.isEmpty() );
uint size = value.toUInt(); uint size = value.toUInt();
if ( size==0 ) return AddressRange(); if ( size==0 ) return AddressRange();
@ -153,7 +153,7 @@ AddressRange Pic::Memory::blockRange(uint i) const
return AddressRange(start, 2 * size - 1); return AddressRange(start, 2 * size - 1);
} }
AddressRange previous = (i==0 ? bootRange() : blockRange(i-1)); AddressRange previous = (i==0 ? bootRange() : blockRange(i-1));
const Config::Mask *tqmask = device().config().findMask(tqmaskName); const Config::Mask *tqmask = device().config().findMask(maskName);
for (uint k=0; k<uint(tqmask->values.count()); k++) { for (uint k=0; k<uint(tqmask->values.count()); k++) {
AddressRangeVector rv = protection.extractRanges(tqmask->values[k].name, MemoryRangeType::Code); AddressRangeVector rv = protection.extractRanges(tqmask->values[k].name, MemoryRangeType::Code);
if ( !rv.isEmpty() ) return AddressRange(previous.end + 1, rv[0].end); if ( !rv.isEmpty() ) return AddressRange(previous.end + 1, rv[0].end);
@ -165,8 +165,8 @@ AddressRange Pic::Memory::blockRange(uint i) const
AddressRange Pic::Memory::bootProtectedRange(Protection::Type ptype) const AddressRange Pic::Memory::bootProtectedRange(Protection::Type ptype) const
{ {
const Protection &protection = device().config().protection(); const Protection &protection = device().config().protection();
TQString tqmaskName = protection.bootMaskName(ptype); TQString maskName = protection.bootMaskName(ptype);
TQString value = findValue(tqmaskName); TQString value = findValue(maskName);
if ( value.isEmpty() ) return AddressRange(); if ( value.isEmpty() ) return AddressRange();
if ( protection.family()!=Protection::CodeGuard ) { if ( protection.family()!=Protection::CodeGuard ) {
if ( protection.extractRanges(value, MemoryRangeType::Code).isEmpty() ) return AddressRange(); if ( protection.extractRanges(value, MemoryRangeType::Code).isEmpty() ) return AddressRange();
@ -179,8 +179,8 @@ AddressRange Pic::Memory::bootProtectedRange(Protection::Type ptype) const
AddressRange Pic::Memory::blockProtectedRange(Protection::Type ptype, uint i) const AddressRange Pic::Memory::blockProtectedRange(Protection::Type ptype, uint i) const
{ {
const Protection &protection = device().config().protection(); const Protection &protection = device().config().protection();
TQString tqmaskName = protection.blockMaskName(ptype, i); TQString maskName = protection.blockMaskName(ptype, i);
TQString value = findValue(tqmaskName); TQString value = findValue(maskName);
if ( value.isEmpty() ) return AddressRange(); if ( value.isEmpty() ) return AddressRange();
if ( protection.family()!=Protection::CodeGuard ) { if ( protection.family()!=Protection::CodeGuard ) {
if ( protection.extractRanges(value, MemoryRangeType::Code).isEmpty() ) return AddressRange(); if ( protection.extractRanges(value, MemoryRangeType::Code).isEmpty() ) return AddressRange();
@ -202,9 +202,9 @@ AddressRangeVector Pic::Memory::protectedRanges(Protection::Type ptype, MemoryRa
} }
} }
if ( protection.family()!=Protection::CodeGuard ) { if ( protection.family()!=Protection::CodeGuard ) {
TQString tqmaskName = protection.tqmaskName(ptype, type); TQString maskName = protection.maskName(ptype, type);
TQString value = findValue(tqmaskName); TQString value = findValue(maskName);
//qDebug("%s %s", tqmaskName.latin1(), value.latin1()); //qDebug("%s %s", maskName.latin1(), value.latin1());
if ( !value.isEmpty() ) { if ( !value.isEmpty() ) {
AddressRangeVector tmp = protection.extractRanges(value, type); AddressRangeVector tmp = protection.extractRanges(value, type);
Q_ASSERT( tmp.count()==1 ); Q_ASSERT( tmp.count()==1 );
@ -216,14 +216,14 @@ AddressRangeVector Pic::Memory::protectedRanges(Protection::Type ptype, MemoryRa
void Pic::Memory::setBootProtection(bool on, Protection::Type ptype) void Pic::Memory::setBootProtection(bool on, Protection::Type ptype)
{ {
TQString tqmaskName = device().config().protection().bootMaskName(ptype); TQString maskName = device().config().protection().bootMaskName(ptype);
setProtection(on, tqmaskName, ptype); setProtection(on, maskName, ptype);
} }
void Pic::Memory::setBlockProtection(bool on, Protection::Type ptype, uint block) void Pic::Memory::setBlockProtection(bool on, Protection::Type ptype, uint block)
{ {
TQString tqmaskName = device().config().protection().blockMaskName(ptype, block); TQString maskName = device().config().protection().blockMaskName(ptype, block);
setProtection(on, tqmaskName, ptype); setProtection(on, maskName, ptype);
} }
void Pic::Memory::setProtection(bool on, Protection::Type ptype, MemoryRangeType type) void Pic::Memory::setProtection(bool on, Protection::Type ptype, MemoryRangeType type)
@ -236,13 +236,13 @@ void Pic::Memory::setProtection(bool on, Protection::Type ptype, MemoryRangeType
return; return;
} }
} }
setProtection(on, protection.tqmaskName(ptype, type), ptype); setProtection(on, protection.maskName(ptype, type), ptype);
} }
void Pic::Memory::setConfigValue(const TQString &tqmaskName, const TQString &valueName) void Pic::Memory::setConfigValue(const TQString &maskName, const TQString &valueName)
{ {
uint i; uint i;
const Config::Mask *tqmask = device().config().findMask(tqmaskName, &i); const Config::Mask *tqmask = device().config().findMask(maskName, &i);
Q_ASSERT(tqmask); Q_ASSERT(tqmask);
BitValue v = word(MemoryRangeType::Config, i); BitValue v = word(MemoryRangeType::Config, i);
v = v.clearMaskBits(tqmask->value); v = v.clearMaskBits(tqmask->value);
@ -254,9 +254,9 @@ void Pic::Memory::setConfigValue(const TQString &tqmaskName, const TQString &val
Q_ASSERT(false); Q_ASSERT(false);
} }
void Pic::Memory::setProtection(bool on, const TQString &tqmaskName, Protection::Type ptype) void Pic::Memory::setProtection(bool on, const TQString &maskName, Protection::Type ptype)
{ {
const Config::Mask *tqmask = device().config().findMask(tqmaskName, 0); const Config::Mask *tqmask = device().config().findMask(maskName, 0);
if( tqmask==0 ) return; if( tqmask==0 ) return;
const Protection &protection = device().config().protection(); const Protection &protection = device().config().protection();
TQString valueName; TQString valueName;
@ -268,25 +268,25 @@ void Pic::Memory::setProtection(bool on, const TQString &tqmaskName, Protection:
|| (!on && protection.isNoneProtectedValueName(tqmask->values[k].name)) ) valueName = tqmask->values[k].name; || (!on && protection.isNoneProtectedValueName(tqmask->values[k].name)) ) valueName = tqmask->values[k].name;
} }
} }
setConfigValue(tqmaskName, valueName); setConfigValue(maskName, valueName);
} }
bool Pic::Memory::hasFlagOn(const TQString &tqmaskName, bool valueIfNotPresent) const bool Pic::Memory::hasFlagOn(const TQString &maskName, bool valueIfNotPresent) const
{ {
const Config::Mask *tqmask = device().config().findMask(tqmaskName, 0); const Config::Mask *tqmask = device().config().findMask(maskName, 0);
if ( tqmask==0 ) return valueIfNotPresent; if ( tqmask==0 ) return valueIfNotPresent;
Q_ASSERT(tqmask); Q_ASSERT(tqmask);
Q_ASSERT( tqmask->values.count()==2 ); Q_ASSERT( tqmask->values.count()==2 );
return ( findValue(tqmaskName)=="On" ); return ( findValue(maskName)=="On" );
} }
void Pic::Memory::setFlagOn(const TQString &tqmaskName, bool on) void Pic::Memory::setFlagOn(const TQString &maskName, bool on)
{ {
const Config::Mask *tqmask = device().config().findMask(tqmaskName, 0); const Config::Mask *tqmask = device().config().findMask(maskName, 0);
Q_UNUSED(tqmask); Q_UNUSED(tqmask);
Q_ASSERT(tqmask); Q_ASSERT(tqmask);
Q_ASSERT( tqmask->values.count()==2 ); Q_ASSERT( tqmask->values.count()==2 );
setConfigValue(tqmaskName, on ? "On" : "Off"); setConfigValue(maskName, on ? "On" : "Off");
} }
void Pic::Memory::checksumCheckFill() void Pic::Memory::checksumCheckFill()
@ -345,8 +345,8 @@ BitValue Pic::Memory::checksum() const
BitValue cs = 0x0000; BitValue cs = 0x0000;
const Protection &protection = device().config().protection(); const Protection &protection = device().config().protection();
if ( protection.family()==Protection::BasicProtection ) { if ( protection.family()==Protection::BasicProtection ) {
TQString tqmaskName = protection.tqmaskName(Protection::ProgramProtected, MemoryRangeType::Code); TQString maskName = protection.maskName(Protection::ProgramProtected, MemoryRangeType::Code);
TQString valueName = findValue(tqmaskName); TQString valueName = findValue(maskName);
const TQMap<TQString, Checksum::Data> &checksums = device().checksums(); const TQMap<TQString, Checksum::Data> &checksums = device().checksums();
if ( checksums.tqcontains(valueName) ) { // #### REMOVE ME !! if ( checksums.tqcontains(valueName) ) { // #### REMOVE ME !!
algorithm = checksums[valueName].algorithm; algorithm = checksums[valueName].algorithm;
@ -357,7 +357,7 @@ BitValue Pic::Memory::checksum() const
//qDebug("algo: %s", Checksum::ALGORITHM_DATA[algorithm].name); //qDebug("algo: %s", Checksum::ALGORITHM_DATA[algorithm].name);
for (uint i=0; i<device().nbWords(MemoryRangeType::Code); i++) { for (uint i=0; i<device().nbWords(MemoryRangeType::Code); i++) {
if ( algorithm==Checksum::Algorithm::Normal && rv.tqcontains(inc*i) ) continue; if ( algorithm==Checksum::Algorithm::Normal && rv.tqcontains(inc*i) ) continue;
BitValue v = word(MemoryRangeType::Code, i).tqmaskWith(tqmask); BitValue v = word(MemoryRangeType::Code, i).maskWith(tqmask);
//if ( i==0 || i==device().nbWords(MemoryRangeType::Code)-1 ) qDebug("%s %s", toHexLabel(i, 4).latin1(), toHexLabel(v, 4).latin1()); //if ( i==0 || i==device().nbWords(MemoryRangeType::Code)-1 ) qDebug("%s %s", toHexLabel(i, 4).latin1(), toHexLabel(v, 4).latin1());
switch (device().architecture().type()) { switch (device().architecture().type()) {
case Architecture::P10X: case Architecture::P10X:
@ -392,7 +392,7 @@ BitValue Pic::Memory::checksum() const
const Config &config = device().config(); const Config &config = device().config();
for (uint i=0; i<uint(config._words.count()); i++) { for (uint i=0; i<uint(config._words.count()); i++) {
const Config::Word &cword = config._words[i]; const Config::Word &cword = config._words[i];
BitValue v = word(MemoryRangeType::Config, i).tqmaskWith(cword.ctqmask); BitValue v = word(MemoryRangeType::Config, i).maskWith(cword.ctqmask);
//uint nbChars = device().nbCharsWord(MemoryRangeType::Config); //uint nbChars = device().nbCharsWord(MemoryRangeType::Config);
// qDebug("%i: %s %s", i, toHex(word(MemoryRangeType::Config, i), nbChars).latin1(), toHex(cword.ctqmask, nbChars).latin1()); // qDebug("%i: %s %s", i, toHex(word(MemoryRangeType::Config, i), nbChars).latin1(), toHex(cword.ctqmask, nbChars).latin1());
if ( ( device().name()=="16C61" || device().name()=="16C71" ) && isProtected ) cs += v | 0x0060; if ( ( device().name()=="16C61" || device().name()=="16C71" ) && isProtected ) cs += v | 0x0060;
@ -405,7 +405,7 @@ BitValue Pic::Memory::checksum() const
BitValue id = 0x0; BitValue id = 0x0;
uint nb = device().nbWords(MemoryRangeType::UserId); uint nb = device().nbWords(MemoryRangeType::UserId);
for (uint i=0; i<nb; i++) { for (uint i=0; i<nb; i++) {
BitValue v = word(MemoryRangeType::UserId, nb-i-1).tqmaskWith(0xF); BitValue v = word(MemoryRangeType::UserId, nb-i-1).maskWith(0xF);
if ( device().is18Family() ) id += v; if ( device().is18Family() ) id += v;
else { else {
// qDebug("id %i (%i): %s %s", i, nbb, toHex(v, 4).latin1(), toHex(v << (nbb*i), 9).latin1()); // qDebug("id %i (%i): %s %s", i, nbb, toHex(v, 4).latin1(), toHex(v << (nbb*i), 9).latin1());
@ -416,7 +416,7 @@ BitValue Pic::Memory::checksum() const
cs += id; cs += id;
} }
//qDebug("checksum: %s %s", toHexLabelAbs(cs).latin1(), toHex(cs & 0xFFFF, 4).latin1()); //qDebug("checksum: %s %s", toHexLabelAbs(cs).latin1(), toHex(cs & 0xFFFF, 4).latin1());
return cs.tqmaskWith(0xFFFF); return cs.maskWith(0xFFFF);
} }
BitValue Pic::Memory::unprotectedChecksum() const BitValue Pic::Memory::unprotectedChecksum() const
@ -474,7 +474,7 @@ void Pic::Memory::toHexBuffer(MemoryRangeType type, HexBuffer &hb) const
//qDebug("%s wnb=%i snb=%i div=%i", MEMORY_RANGE_TYPE_DATA[type].label, wNbBytes, sNbBytes, div); //qDebug("%s wnb=%i snb=%i div=%i", MEMORY_RANGE_TYPE_DATA[type].label, wNbBytes, sNbBytes, div);
for (uint k=0; k<wNbBytes*device().nbWords(type); k++) { for (uint k=0; k<wNbBytes*device().nbWords(type); k++) {
// set byte // set byte
BitValue s = _ranges[type][wOffset].tqmaskWith(tqmask); BitValue s = _ranges[type][wOffset].maskWith(tqmask);
//if ( k<4 ) qDebug("s=%s so=%s sb=%i wo=%i wb=%i", toHex(s, 8).data(), toHex(sOffset, 8).data(), sByte, wOffset, wByte); //if ( k<4 ) qDebug("s=%s so=%s sb=%i wo=%i wb=%i", toHex(s, 8).data(), toHex(sOffset, 8).data(), sByte, wOffset, wByte);
s = s.byte(wByte); s = s.byte(wByte);
if ( (byte%2)==0 ) hb.insert(offset, s); if ( (byte%2)==0 ) hb.insert(offset, s);
@ -540,12 +540,12 @@ void Pic::Memory::fromHexBuffer(MemoryRangeType type, const HexBuffer &hb, Warni
wByte++; wByte++;
if ( (wByte%wNbBytes)==0 ) { if ( (wByte%wNbBytes)==0 ) {
if ( _ranges[type][wOffset].isInitialized() ) { if ( _ranges[type][wOffset].isInitialized() ) {
if ( !(result & ValueTooLarge) && _ranges[type][wOffset].tqmaskWith(tqmask)!=_ranges[type][wOffset] ) { if ( !(result & ValueTooLarge) && _ranges[type][wOffset].maskWith(tqmask)!=_ranges[type][wOffset] ) {
result |= ValueTooLarge; result |= ValueTooLarge;
warnings += i18n("At least one word (at offset %1) is larger (%2) than the corresponding tqmask (%3).") warnings += i18n("At least one word (at offset %1) is larger (%2) than the corresponding tqmask (%3).")
.tqarg(toHexLabel(offset, 8)).tqarg(toHexLabel(_ranges[type][wOffset], 8)).tqarg(toHexLabel(tqmask, 8)); .tqarg(toHexLabel(offset, 8)).tqarg(toHexLabel(_ranges[type][wOffset], 8)).tqarg(toHexLabel(tqmask, 8));
} }
_ranges[type][wOffset] = _ranges[type][wOffset].tqmaskWith(tqmask); _ranges[type][wOffset] = _ranges[type][wOffset].maskWith(tqmask);
} }
wByte = 0; wByte = 0;
wOffset++; wOffset++;

@ -41,7 +41,7 @@ public:
bool isBlockProtected(Protection::Type ptype, uint i) const { return !blockProtectedRange(ptype, i).isEmpty(); } bool isBlockProtected(Protection::Type ptype, uint i) const { return !blockProtectedRange(ptype, i).isEmpty(); }
bool isProtected(Protection::Type ptype, MemoryRangeType type) const { return !protectedRanges(ptype, type).isEmpty(); } bool isProtected(Protection::Type ptype, MemoryRangeType type) const { return !protectedRanges(ptype, type).isEmpty(); }
AddressRangeVector protectedRanges(Protection::Type ptype, MemoryRangeType type) const; AddressRangeVector protectedRanges(Protection::Type ptype, MemoryRangeType type) const;
void setConfigValue(const TQString &tqmaskName, const TQString &valueName); void setConfigValue(const TQString &maskName, const TQString &valueName);
bool hasDebugOn() const { return hasFlagOn("DEBUG", false); } bool hasDebugOn() const { return hasFlagOn("DEBUG", false); }
void setDebugOn(bool on) { setFlagOn("DEBUG", on); } void setDebugOn(bool on) { setFlagOn("DEBUG", on); }
bool hasWatchdogTimerOn() const { return hasFlagOn("WDT", false); } bool hasWatchdogTimerOn() const { return hasFlagOn("WDT", false); }
@ -67,10 +67,10 @@ private:
virtual void savePartial(TQTextStream &stream, HexBuffer::Format format) const; virtual void savePartial(TQTextStream &stream, HexBuffer::Format format) const;
virtual void fromHexBuffer(const HexBuffer &hb, WarningTypes &warningTypes, virtual void fromHexBuffer(const HexBuffer &hb, WarningTypes &warningTypes,
TQStringList &warnings, TQMap<uint, bool> &inRange); TQStringList &warnings, TQMap<uint, bool> &inRange);
TQString findValue(const TQString &tqmaskName) const; TQString findValue(const TQString &maskName) const;
bool hasFlagOn(const TQString &tqmaskName, bool valueIfNotPresent) const; bool hasFlagOn(const TQString &maskName, bool valueIfNotPresent) const;
void setFlagOn(const TQString &tqmaskName, bool on); void setFlagOn(const TQString &maskName, bool on);
void setProtection(bool on, const TQString &tqmaskName, Protection::Type ptype); void setProtection(bool on, const TQString &maskName, Protection::Type ptype);
AddressRange bootProtectedRange(Protection::Type ptype) const; AddressRange bootProtectedRange(Protection::Type ptype) const;
AddressRange blockProtectedRange(Protection::Type ptype, uint block) const; AddressRange blockProtectedRange(Protection::Type ptype, uint block) const;
}; };

@ -375,7 +375,7 @@ bool Programmer::PicBase::restoreBandGapBits()
BitValue ptqmask = device()->config()._words[i].ptqmask; BitValue ptqmask = device()->config()._words[i].ptqmask;
if ( ptqmask==0 ) continue; if ( ptqmask==0 ) continue;
cdata[i] = cdata[i].clearMaskBits(ptqmask); cdata[i] = cdata[i].clearMaskBits(ptqmask);
cdata[i] |= data[i].tqmaskWith(ptqmask); cdata[i] |= data[i].maskWith(ptqmask);
} }
if ( !specific()->canWriteRange(Pic::MemoryRangeType::Config) ) { if ( !specific()->canWriteRange(Pic::MemoryRangeType::Config) ) {
log(Log::LineType::Warning, i18n("Could not restore band gap bits because programmer does not support writing config bits.")); log(Log::LineType::Warning, i18n("Could not restore band gap bits because programmer does not support writing config bits."));

@ -219,13 +219,13 @@ Pic::Config::Word toConfigWord(TQDomElement config)
if ( tqmask.attribute("name").isEmpty() ) qFatal(TQString("Empty tqmask name in config %1").tqarg(cword.name)); if ( tqmask.attribute("name").isEmpty() ) qFatal(TQString("Empty tqmask name in config %1").tqarg(cword.name));
Config::Mask ctqmask = toConfigMask(tqmask, cword.ptqmask); Config::Mask ctqmask = toConfigMask(tqmask, cword.ptqmask);
if ( !ctqmask.value.isInside(gtqmask) ) qFatal(TQString("Mask value not inside tqmask in config %1").tqarg(cword.name)); if ( !ctqmask.value.isInside(gtqmask) ) qFatal(TQString("Mask value not inside tqmask in config %1").tqarg(cword.name));
for (uint i=0; i<uint(cword.tqmasks.count()); i++) { for (uint i=0; i<uint(cword.masks.count()); i++) {
if ( cword.tqmasks[i].name==ctqmask.name ) qFatal(TQString("Duplicated tqmask name %1 in config %2").tqarg(ctqmask.name).tqarg(cword.name)); if ( cword.masks[i].name==ctqmask.name ) qFatal(TQString("Duplicated tqmask name %1 in config %2").tqarg(ctqmask.name).tqarg(cword.name));
if ( ctqmask.value.isOverlapping(cword.tqmasks[i].value) ) qFatal(TQString("Overlapping tqmasks in config %1").tqarg(cword.name)); if ( ctqmask.value.isOverlapping(cword.masks[i].value) ) qFatal(TQString("Overlapping masks in config %1").tqarg(cword.name));
} }
cword.tqmasks.append(ctqmask); cword.masks.append(ctqmask);
} }
qHeapSort(cword.tqmasks); qHeapSort(cword.masks);
BitValue tqmask = (cword.usedMask() | cword.bvalue).clearMaskBits(cword.ptqmask); BitValue tqmask = (cword.usedMask() | cword.bvalue).clearMaskBits(cword.ptqmask);
if ( config.attribute("ctqmask").isEmpty() ) { if ( config.attribute("ctqmask").isEmpty() ) {
if ( data()->_architecture==Pic::Architecture::P30F ) cword.ctqmask = cword.wtqmask; if ( data()->_architecture==Pic::Architecture::P30F ) cword.ctqmask = cword.wtqmask;
@ -443,15 +443,15 @@ virtual void processDevice(TQDomElement device)
if ( cwords[i].name.isNull() ) qFatal(TQString("Config word #%1 not defined").tqarg(i)); if ( cwords[i].name.isNull() ) qFatal(TQString("Config word #%1 not defined").tqarg(i));
data()->_config->_words[i] = cwords[i]; data()->_config->_words[i] = cwords[i];
const Config::Word &word = data()->_config->_words[i]; const Config::Word &word = data()->_config->_words[i];
for (uint j=0; j<uint(word.tqmasks.count()); j++) { for (uint j=0; j<uint(word.masks.count()); j++) {
const Config::Mask &tqmask = word.tqmasks[j]; const Config::Mask &tqmask = word.masks[j];
for (uint k=0; k<uint(tqmask.values.count()); k++) { for (uint k=0; k<uint(tqmask.values.count()); k++) {
const TQStringList &vcnames = tqmask.values[k].configNames[type]; const TQStringList &vcnames = tqmask.values[k].configNames[type];
for (uint l=0; l<uint(vcnames.count()); l++) { for (uint l=0; l<uint(vcnames.count()); l++) {
if ( vcnames[l].startsWith("0x") ) continue; if ( vcnames[l].startsWith("0x") ) continue;
if ( cnames.tqcontains(vcnames[l]) && cnames[vcnames[l]]!=tqmask.name ) if ( cnames.tqcontains(vcnames[l]) && cnames[vcnames[l]]!=tqmask.name )
qFatal(TQString("Duplicated config name for %1/%2").tqarg(tqmask.name).tqarg(tqmask.values[k].name)); qFatal(TQString("Duplicated config name for %1/%2").tqarg(tqmask.name).tqarg(tqmask.values[k].name));
cnames[vcnames[l]] = word.tqmasks[j].name; cnames[vcnames[l]] = word.masks[j].name;
} }
} }
} }
@ -460,8 +460,8 @@ virtual void processDevice(TQDomElement device)
// check validity of value names // check validity of value names
for (uint i=0; i<nbWords; i++) { for (uint i=0; i<nbWords; i++) {
const Config::Word &word = data()->_config->_words[i]; const Config::Word &word = data()->_config->_words[i];
for (uint j=0; j<uint(word.tqmasks.count()); j++) { for (uint j=0; j<uint(word.masks.count()); j++) {
const Config::Mask &tqmask = word.tqmasks[j]; const Config::Mask &tqmask = word.masks[j];
for (uint k=0; k<uint(tqmask.values.count()); k++) { for (uint k=0; k<uint(tqmask.values.count()); k++) {
const Config::Value &value = tqmask.values[k]; const Config::Value &value = tqmask.values[k];
if ( !value.isValid() ) continue; if ( !value.isValid() ) continue;
@ -473,8 +473,8 @@ virtual void processDevice(TQDomElement device)
// check if all values are explicit // check if all values are explicit
for (uint i=0; i<nbWords; i++) { for (uint i=0; i<nbWords; i++) {
const Config::Word &word = data()->_config->_words[i]; const Config::Word &word = data()->_config->_words[i];
for (uint j=0; j<uint(word.tqmasks.count()); j++) { for (uint j=0; j<uint(word.masks.count()); j++) {
const Config::Mask &tqmask = word.tqmasks[j]; const Config::Mask &tqmask = word.masks[j];
BitValue::const_iterator it; BitValue::const_iterator it;
for (it=tqmask.value.begin(); it!=tqmask.value.end(); ++it) for (it=tqmask.value.begin(); it!=tqmask.value.end(); ++it)
if ( !hasValue(tqmask, *it) ) qFatal(TQString("Value %1 not defined in tqmask %2").tqarg(toHexLabel(*it, data()->nbCharsWord(MemoryRangeType::Config))).tqarg(tqmask.name)); if ( !hasValue(tqmask, *it) ) qFatal(TQString("Value %1 not defined in tqmask %2").tqarg(toHexLabel(*it, data()->nbCharsWord(MemoryRangeType::Config))).tqarg(tqmask.name));
@ -489,8 +489,8 @@ virtual void processDevice(TQDomElement device)
TQMap<TQString, bool> valueNames; TQMap<TQString, bool> valueNames;
const Pic::Protection &protection = data()->_config->protection(); const Pic::Protection &protection = data()->_config->protection();
if ( protection.family()==Protection::BasicProtection ) { if ( protection.family()==Protection::BasicProtection ) {
TQString tqmaskName = protection.tqmaskName(Protection::ProgramProtected, MemoryRangeType::Code); TQString maskName = protection.maskName(Protection::ProgramProtected, MemoryRangeType::Code);
const Pic::Config::Mask *tqmask = data()->_config->findMask(tqmaskName); const Pic::Config::Mask *tqmask = data()->_config->findMask(maskName);
Q_ASSERT(tqmask); Q_ASSERT(tqmask);
for (uint i=0; i<uint(tqmask->values.count()); i++) valueNames[tqmask->values[i].name] = false; for (uint i=0; i<uint(tqmask->values.count()); i++) valueNames[tqmask->values[i].name] = false;
} }

@ -159,11 +159,11 @@ CLI::ExitCode CLI::Main::executeCommand(const TQString &command)
bool firstInSecond = true, secondInFirst = true; bool firstInSecond = true, secondInFirst = true;
HexBuffer::const_iterator it; HexBuffer::const_iterator it;
for (it=_source1.begin(); it!=_source1.end(); ++it) { for (it=_source1.begin(); it!=_source1.end(); ++it) {
if ( it.data().tqmaskWith(0xFFFF)==_source2[it.key()].tqmaskWith(0xFFFF) ) continue; if ( it.data().maskWith(0xFFFF)==_source2[it.key()].maskWith(0xFFFF) ) continue;
firstInSecond = false; firstInSecond = false;
} }
for (it=_source2.begin(); it!=_source2.end(); ++it) { for (it=_source2.begin(); it!=_source2.end(); ++it) {
if ( it.data().tqmaskWith(0xFFFF)==_source1[it.key()].tqmaskWith(0xFFFF) ) continue; if ( it.data().maskWith(0xFFFF)==_source1[it.key()].maskWith(0xFFFF) ) continue;
secondInFirst = false; secondInFirst = false;
} }
if ( firstInSecond && secondInFirst ) return okExit(i18n("The two hex files have the same content.")); if ( firstInSecond && secondInFirst ) return okExit(i18n("The two hex files have the same content."));

@ -129,8 +129,8 @@ bool ConfigGeneratorCheck::execute(const Device::Data &data)
bool ok = false; bool ok = false;
for (uint i=0; i<config._words.count(); i++) { for (uint i=0; i<config._words.count(); i++) {
const Pic::Config::Word &cword = config._words[i]; const Pic::Config::Word &cword = config._words[i];
for (uint k=0; k<cword.tqmasks.count(); k++) { for (uint k=0; k<cword.masks.count(); k++) {
const Pic::Config::Mask &ctqmask = cword.tqmasks[k]; const Pic::Config::Mask &ctqmask = cword.masks[k];
if ( l<ctqmask.values.count() ) { if ( l<ctqmask.values.count() ) {
ok = true; ok = true;
if ( !ctqmask.values[l].name.isEmpty() ) _memory2->setConfigValue(ctqmask.name, ctqmask.values[l].name); if ( !ctqmask.values[l].name.isEmpty() ) _memory2->setConfigValue(ctqmask.name, ctqmask.values[l].name);
@ -157,11 +157,11 @@ bool ConfigGeneratorCheck::execute(const Device::Data &data)
BitValue word1 = _memory1->word(Pic::MemoryRangeType::Config, i); BitValue word1 = _memory1->word(Pic::MemoryRangeType::Config, i);
BitValue word2 = _memory2->word(Pic::MemoryRangeType::Config, i); BitValue word2 = _memory2->word(Pic::MemoryRangeType::Config, i);
if ( word1==word2 ) continue; if ( word1==word2 ) continue;
for (uint k=0; k<cword.tqmasks.count(); k++) { for (uint k=0; k<cword.masks.count(); k++) {
const Pic::Config::Mask &ctqmask = cword.tqmasks[k]; const Pic::Config::Mask &ctqmask = cword.masks[k];
if ( ctqmask.value.isInside(cword.ptqmask) ) continue; if ( ctqmask.value.isInside(cword.ptqmask) ) continue;
BitValue value1 = word1.tqmaskWith(ctqmask.value); BitValue value1 = word1.maskWith(ctqmask.value);
BitValue value2 = word2.tqmaskWith(ctqmask.value); BitValue value2 = word2.maskWith(ctqmask.value);
if ( value1==value2 ) continue; if ( value1==value2 ) continue;
TQString name1, name2; TQString name1, name2;
uint l1, l2; uint l1, l2;
@ -173,7 +173,7 @@ bool ConfigGeneratorCheck::execute(const Device::Data &data)
if ( name1==name2 ) continue; if ( name1==name2 ) continue;
TEST_FAILED_RETURN(TQString("Config bits are different in %1: set\"%2\"=(%3) != compiled=%4)") TEST_FAILED_RETURN(TQString("Config bits are different in %1: set\"%2\"=(%3) != compiled=%4)")
.tqarg(ctqmask.name).tqarg(ctqmask.values[l2].name) .tqarg(ctqmask.name).tqarg(ctqmask.values[l2].name)
.tqarg(toHexLabel(word2.tqmaskWith(ctqmask.value), nbChars)).tqarg(toHexLabel(word1.tqmaskWith(ctqmask.value), nbChars))) .tqarg(toHexLabel(word2.maskWith(ctqmask.value), nbChars)).tqarg(toHexLabel(word1.maskWith(ctqmask.value), nbChars)))
} }
} }
} }

@ -29,10 +29,10 @@ void ChecksumCheck::cleanup(const Device::Data &)
} }
void ChecksumCheck::setProtection(const Pic::Data &data, const Pic::Checksum::Data &cdata, void ChecksumCheck::setProtection(const Pic::Data &data, const Pic::Checksum::Data &cdata,
const TQString &tqmaskName, const TQString &valueName) const TQString &maskName, const TQString &valueName)
{ {
const Pic::Protection &protection = data.config().protection(); const Pic::Protection &protection = data.config().protection();
if ( !tqmaskName.isEmpty() && !valueName.isEmpty() ) _memory->setConfigValue(tqmaskName, valueName); if ( !maskName.isEmpty() && !valueName.isEmpty() ) _memory->setConfigValue(maskName, valueName);
if ( !valueName.isEmpty() ) _memory->setUserIdToUnprotectedChecksum(); if ( !valueName.isEmpty() ) _memory->setUserIdToUnprotectedChecksum();
for (uint i=0; i<cdata.protectedMaskNames.count(); i++) { for (uint i=0; i<cdata.protectedMaskNames.count(); i++) {
TQString pmName = cdata.protectedMaskNames[i]; TQString pmName = cdata.protectedMaskNames[i];
@ -54,21 +54,21 @@ bool ChecksumCheck::checkChecksum(BitValue checksum, const TQString &label)
return true; return true;
} }
void ChecksumCheck::checkChecksum(const Pic::Data &pdata, const TQString &tqmaskName, const TQString &valueName, bool &ok) void ChecksumCheck::checkChecksum(const Pic::Data &pdata, const TQString &maskName, const TQString &valueName, bool &ok)
{ {
if ( !pdata.checksums().tqcontains(valueName) ) { if ( !pdata.checksums().tqcontains(valueName) ) {
const Pic::Config::Mask *tqmask = pdata.config().findMask(tqmaskName); const Pic::Config::Mask *tqmask = pdata.config().findMask(maskName);
TQString label = valueName + (tqmask ? "/" + tqmask->name : TQString()); TQString label = valueName + (tqmask ? "/" + tqmask->name : TQString());
printf("Missing checksum for \"%s\"", label.latin1()); printf("Missing checksum for \"%s\"", label.latin1());
return; return;
} }
const Pic::Checksum::Data &cdata = pdata.checksums()[valueName]; const Pic::Checksum::Data &cdata = pdata.checksums()[valueName];
_memory->clear(); _memory->clear();
setProtection(pdata, cdata, tqmaskName, valueName); setProtection(pdata, cdata, maskName, valueName);
if ( !checkChecksum(cdata.blankChecksum, tqmaskName + ":" + valueName + "/" + "blank") ) ok = false; if ( !checkChecksum(cdata.blankChecksum, maskName + ":" + valueName + "/" + "blank") ) ok = false;
_memory->checksumCheckFill(); _memory->checksumCheckFill();
setProtection(pdata, cdata, tqmaskName, valueName); setProtection(pdata, cdata, maskName, valueName);
if ( !checkChecksum(cdata.checkChecksum, tqmaskName + ":" + valueName + "/" + "check") ) ok = false; if ( !checkChecksum(cdata.checkChecksum, maskName + ":" + valueName + "/" + "check") ) ok = false;
} }
bool ChecksumCheck::execute(const Device::Data &data) bool ChecksumCheck::execute(const Device::Data &data)
@ -83,13 +83,13 @@ bool ChecksumCheck::execute(const Device::Data &data)
checkChecksum(pdata, TQString(), TQString(), ok); checkChecksum(pdata, TQString(), TQString(), ok);
break; break;
case Pic::Protection::BasicProtection: { case Pic::Protection::BasicProtection: {
TQString tqmaskName = protection.tqmaskName(Pic::Protection::ProgramProtected, Pic::MemoryRangeType::Code); TQString maskName = protection.maskName(Pic::Protection::ProgramProtected, Pic::MemoryRangeType::Code);
const Pic::Config::Mask *tqmask = pdata.config().findMask(tqmaskName); const Pic::Config::Mask *tqmask = pdata.config().findMask(maskName);
Q_ASSERT(tqmask); Q_ASSERT(tqmask);
for (uint i=0; i<tqmask->values.count(); i++) { for (uint i=0; i<tqmask->values.count(); i++) {
TQString valueName = tqmask->values[i].name; TQString valueName = tqmask->values[i].name;
if ( valueName.isEmpty() ) continue; // invalid value if ( valueName.isEmpty() ) continue; // invalid value
checkChecksum(pdata, tqmaskName, valueName, ok); checkChecksum(pdata, maskName, valueName, ok);
} }
break; break;
} }

@ -27,9 +27,9 @@ private:
Pic::Memory *_memory; Pic::Memory *_memory;
void setProtection(const Pic::Data &data, const Pic::Checksum::Data &cdata, void setProtection(const Pic::Data &data, const Pic::Checksum::Data &cdata,
const TQString &tqmaskName, const TQString &valueName); const TQString &maskName, const TQString &valueName);
bool checkChecksum(BitValue checksum, const TQString &label); bool checkChecksum(BitValue checksum, const TQString &label);
void checkChecksum(const Pic::Data &data, const TQString &tqmaskName, const TQString &valueName, bool &ok); void checkChecksum(const Pic::Data &data, const TQString &maskName, const TQString &valueName, bool &ok);
}; };
#endif #endif

@ -56,7 +56,7 @@ BitValue Direct::pic16::get_word()
hardware().setPin(Clock, High); hardware().setPin(Clock, High);
Port::usleep(1+_clockDelay); Port::usleep(1+_clockDelay);
if ( hardware().readBit() ) ind |= 0x8000; if ( hardware().readBit() ) ind |= 0x8000;
else ind = ind.tqmaskWith(0x7FFF); else ind = ind.maskWith(0x7FFF);
ind >>= 1; ind >>= 1;
hardware().setPin(Clock, Low); hardware().setPin(Clock, Low);
Port::usleep(1+_clockDelay); Port::usleep(1+_clockDelay);
@ -90,7 +90,7 @@ bool Direct::pic16::doRead(Pic::MemoryRangeType type, Device::Array &data, const
BitValue tqmask = device().tqmask(type); BitValue tqmask = device().tqmask(type);
for (uint i = 0; i<nbWords; i++) { for (uint i = 0; i<nbWords; i++) {
if ( !only || data[i]!=tqmask || type!=Pic::MemoryRangeType::Code ) { if ( !only || data[i]!=tqmask || type!=Pic::MemoryRangeType::Code ) {
data[i] = readWord(type).tqmaskWith(tqmask); data[i] = readWord(type).maskWith(tqmask);
if ( vdata && !hardware().verifyWord(i, data[i], type, *vdata) ) return false; if ( vdata && !hardware().verifyWord(i, data[i], type, *vdata) ) return false;
} }
incrementPC(1); incrementPC(1);

@ -20,7 +20,7 @@ class pic16 : public Pic8DeviceSpecific
public: public:
pic16(::Programmer::Base &base) : Pic8DeviceSpecific(base) {} pic16(::Programmer::Base &base) : Pic8DeviceSpecific(base) {}
virtual BitValue get_word(); virtual BitValue get_word();
virtual BitValue get_byte() { return get_word().tqmaskWith(0xFF); } virtual BitValue get_byte() { return get_word().maskWith(0xFF); }
virtual void send_word(BitValue word); virtual void send_word(BitValue word);
virtual void send_bits(BitValue d, uint nbBits); virtual void send_bits(BitValue d, uint nbBits);
virtual void send_cmd(BitValue d) { send_bits(d, 6); } virtual void send_cmd(BitValue d) { send_bits(d, 6); }

@ -91,7 +91,7 @@ bool Direct::P18F::doRead(Pic::MemoryRangeType type, Device::Array &data, const
for (uint i = 0; i<data.count(); i++) { for (uint i = 0; i<data.count(); i++) {
setPointer(type, i); setPointer(type, i);
pulseEngine("k0,X80A6,k0,X50A8,k0,X6EF5,k0,X0000"); pulseEngine("k0,X80A6,k0,X50A8,k0,X6EF5,k0,X0000");
data[i] = pulseEngine("r").tqmaskWith(tqmask); data[i] = pulseEngine("r").maskWith(tqmask);
if ( vdata && !hardware().verifyWord(offset+i, data[i], type, *vdata) ) return false; if ( vdata && !hardware().verifyWord(offset+i, data[i], type, *vdata) ) return false;
} }
_base.progressMonitor().addTaskProgress(data.count()); _base.progressMonitor().addTaskProgress(data.count());
@ -100,7 +100,7 @@ bool Direct::P18F::doRead(Pic::MemoryRangeType type, Device::Array &data, const
setPointer(type, offset); setPointer(type, offset);
//pulseEngine("w1000"); ?? //pulseEngine("w1000"); ??
for (uint i=0; i<nbWords; i++) { for (uint i=0; i<nbWords; i++) {
data[i] = pulseEngine("R").tqmaskWith(tqmask); data[i] = pulseEngine("R").maskWith(tqmask);
if ( vdata && !hardware().verifyWord(offset+i, data[i], type, *vdata) ) return false; if ( vdata && !hardware().verifyWord(offset+i, data[i], type, *vdata) ) return false;
} }
_base.progressMonitor().addTaskProgress(data.count()); _base.progressMonitor().addTaskProgress(data.count());
@ -111,7 +111,7 @@ bool Direct::P18F::doRead(Pic::MemoryRangeType type, Device::Array &data, const
setPointer(type, 0); setPointer(type, 0);
for (uint i = 0; i<data.count(); i+=2) { for (uint i = 0; i<data.count(); i+=2) {
BitValue w = pulseEngine("R"); BitValue w = pulseEngine("R");
data[i] = w.tqmaskWith(tqmask); data[i] = w.maskWith(tqmask);
if ( vdata && !hardware().verifyWord(offset+i, data[i], type, *vdata) ) return false; if ( vdata && !hardware().verifyWord(offset+i, data[i], type, *vdata) ) return false;
data[i+1] = w >> 8; data[i+1] = w >> 8;
if ( vdata && !hardware().verifyWord(offset+i+1, data[i+1], type, *vdata) ) return false; if ( vdata && !hardware().verifyWord(offset+i+1, data[i+1], type, *vdata) ) return false;
@ -249,7 +249,7 @@ void Direct::P18F242::configureSinglePanel()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool Direct::P18F2539::doErase(bool) bool Direct::P18F2539::doErase(bool)
{ {
// aptqparently there is no chip erase... // apparently there is no chip erase...
return ( doEraseRange(Pic::MemoryRangeType::Code) && doEraseRange(Pic::MemoryRangeType::Eeprom) ); return ( doEraseRange(Pic::MemoryRangeType::Code) && doEraseRange(Pic::MemoryRangeType::Eeprom) );
} }

@ -97,14 +97,14 @@ bool Icd2::Debugger::readRegister(const Register::TypeData &data, BitValue &valu
{ {
if ( data.type()==Register::Special ) { if ( data.type()==Register::Special ) {
if ( data.name()=="WREG" ) return hardware()->readRegister(specific()->addressWREG(), value, 1); if ( data.name()=="WREG" ) return hardware()->readRegister(specific()->addressWREG(), value, 1);
if ( data.name()=="PC" ) { value = hardware()->getProgramCounter().tqmaskWith(specific()->tqmaskPC()); return !hasError(); } if ( data.name()=="PC" ) { value = hardware()->getProgramCounter().maskWith(specific()->maskPC()); return !hasError(); }
Q_ASSERT(false); Q_ASSERT(false);
return true; return true;
} }
TQString name = device()->registersData().sfrNames[data.address()]; TQString name = device()->registersData().sfrNames[data.address()];
if ( name=="WREG" ) return hardware()->readRegister(specific()->addressWREG(), value, 1); if ( name=="WREG" ) return hardware()->readRegister(specific()->addressWREG(), value, 1);
if ( name=="PCL" ) { value = hardware()->getProgramCounter().tqmaskWith(specific()->tqmaskPC()).byte(0); return !hasError(); } if ( name=="PCL" ) { value = hardware()->getProgramCounter().maskWith(specific()->maskPC()).byte(0); return !hasError(); }
if ( name=="PCLATH" ) { value = hardware()->getProgramCounter().tqmaskWith(specific()->tqmaskPC()).byte(1); return !hasError(); } if ( name=="PCLATH" ) { value = hardware()->getProgramCounter().maskWith(specific()->maskPC()).byte(1); return !hasError(); }
return hardware()->readRegister(specific()->addressRegister(data.address()), value, 1); return hardware()->readRegister(specific()->addressRegister(data.address()), value, 1);
} }

@ -41,7 +41,7 @@ bool Icd2::P16FDebuggerSpecific::setBreakpoint(Address address)
bool Icd2::P16FDebuggerSpecific::readBreakpoint(BitValue &value) bool Icd2::P16FDebuggerSpecific::readBreakpoint(BitValue &value)
{ {
if ( !hardware()->readRegister(0x18E, value, 2) ) return false; if ( !hardware()->readRegister(0x18E, value, 2) ) return false;
value = value.tqmaskWith(0x1FFF); value = value.maskWith(0x1FFF);
return true; return true;
} }

@ -25,7 +25,7 @@ public:
DebugProgrammer &programmer() { return base().programmer(); } DebugProgrammer &programmer() { return base().programmer(); }
::Debugger::PicSpecific *deviceSpecific() { return base().deviceSpecific(); } ::Debugger::PicSpecific *deviceSpecific() { return base().deviceSpecific(); }
virtual Address addressWREG() const = 0; virtual Address addressWREG() const = 0;
virtual BitValue tqmaskPC() const = 0; virtual BitValue maskPC() const = 0;
virtual Address addressRegister(Address address) const = 0; virtual Address addressRegister(Address address) const = 0;
virtual bool setBreakpoint(Address address) = 0; virtual bool setBreakpoint(Address address) = 0;
virtual bool readBreakpoint(BitValue &value) = 0; virtual bool readBreakpoint(BitValue &value) = 0;
@ -42,7 +42,7 @@ public:
virtual BitValue writeMaskBreakpointRegister() const { return 0x8000; } virtual BitValue writeMaskBreakpointRegister() const { return 0x8000; }
virtual BitValue readMaskBreakpointRegister() const { return 0x1FFF; } virtual BitValue readMaskBreakpointRegister() const { return 0x1FFF; }
virtual Address addressWREG() const; virtual Address addressWREG() const;
virtual BitValue tqmaskPC() const { return 0x1FFF; } virtual BitValue maskPC() const { return 0x1FFF; }
virtual Address addressRegister(Address address) const; virtual Address addressRegister(Address address) const;
virtual bool setBreakpoint(Address address); virtual bool setBreakpoint(Address address);
virtual bool readBreakpoint(BitValue &value); virtual bool readBreakpoint(BitValue &value);
@ -80,7 +80,7 @@ class P18FDebuggerSpecific : public DebuggerSpecific
public: public:
P18FDebuggerSpecific(::Debugger::Base &base); P18FDebuggerSpecific(::Debugger::Base &base);
virtual Address addressWREG() const; virtual Address addressWREG() const;
virtual BitValue tqmaskPC() const { return 0xFFFF; } virtual BitValue maskPC() const { return 0xFFFF; }
virtual Address addressRegister(Address address) const; virtual Address addressRegister(Address address) const;
virtual bool setBreakpoint(Address address); virtual bool setBreakpoint(Address address);
virtual bool readBreakpoint(BitValue &value); virtual bool readBreakpoint(BitValue &value);

@ -327,7 +327,7 @@ bool Pickit2V2::Hardware::readMemory(Pic::MemoryRangeType otype, Device::Array &
if ( i>=nbWords ) break; if ( i>=nbWords ) break;
data[i] = words[k]; data[i] = words[k];
if (fdata->progMemShift) data[i] >>= 1; if (fdata->progMemShift) data[i] >>= 1;
data[i] = data[i].tqmaskWith(device().tqmask(type)); // ### correct ? data[i] = data[i].maskWith(device().tqmask(type)); // ### correct ?
if ( vdata && !verifyWord(i, data[i], type, *vdata) ) return false; if ( vdata && !verifyWord(i, data[i], type, *vdata) ) return false;
if ( type==Pic::MemoryRangeType::Code && i!=0x0 && i%0x8000==0 ) setAddress = true; if ( type==Pic::MemoryRangeType::Code && i!=0x0 && i%0x8000==0 ) setAddress = true;
i++; i++;

Loading…
Cancel
Save