summaryrefslogtreecommitdiffstats
path: root/src/progs/picdem_bootloader/base
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-30 00:15:53 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-30 00:15:53 +0000
commit0aaa8e3fc8f8a1481333b564f0922277c8d8ad59 (patch)
treeb95c0ca86c4876dd139af376b9f4afd8917cf0cd /src/progs/picdem_bootloader/base
parentb79a2c28534cf09987eeeba3077fff9236df182a (diff)
downloadpiklab-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/picdem_bootloader/base')
-rw-r--r--src/progs/picdem_bootloader/base/picdem_bootloader.cpp36
-rw-r--r--src/progs/picdem_bootloader/base/picdem_bootloader.h8
-rw-r--r--src/progs/picdem_bootloader/base/picdem_bootloader_data.h4
-rw-r--r--src/progs/picdem_bootloader/base/picdem_bootloader_prog.h5
4 files changed, 27 insertions, 26 deletions
diff --git a/src/progs/picdem_bootloader/base/picdem_bootloader.cpp b/src/progs/picdem_bootloader/base/picdem_bootloader.cpp
index f22eecb..90fed61 100644
--- a/src/progs/picdem_bootloader/base/picdem_bootloader.cpp
+++ b/src/progs/picdem_bootloader/base/picdem_bootloader.cpp
@@ -38,29 +38,29 @@ PicdemBootloader::Port::Port(Log::Base &log)
: Port::USB(log, Config::readVendorId(), Config::readProductId(), 1, 0)
{}
-bool PicdemBootloader::Port::receive(uint nb, QMemArray<uchar> &data)
+bool PicdemBootloader::Port::receive(uint nb, TQMemArray<uchar> &data)
{
data.resize(nb);
if ( !read(0x81, (char *)data.data(), nb) ) return false;
- log(Log::DebugLevel::Max, QString("received: \"%1\"").arg(toPrintable(data, PrintEscapeAll)));
+ log(Log::DebugLevel::Max, TQString("received: \"%1\"").tqarg(toPrintable(data, PrintEscapeAll)));
return true;
}
-bool PicdemBootloader::Port::send(const QMemArray<uchar> &cmd)
+bool PicdemBootloader::Port::send(const TQMemArray<uchar> &cmd)
{
- log(Log::DebugLevel::Extra, QString("send: \"%1\"").arg(toPrintable(cmd, PrintEscapeAll)));
+ log(Log::DebugLevel::Extra, TQString("send: \"%1\"").tqarg(toPrintable(cmd, PrintEscapeAll)));
return write(0x01, (const char *)cmd.data(), cmd.count());
}
-bool PicdemBootloader::Port::sendAndReceive(QMemArray<uchar> &data, uint nb)
+bool PicdemBootloader::Port::sendAndReceive(TQMemArray<uchar> &data, uint nb)
{
if ( !send(data) ) return false;
return receive(nb, data);
}
-QMemArray<uchar> PicdemBootloader::Port::command(uchar instruction, uint address, uint len, uint nb) const
+TQMemArray<uchar> PicdemBootloader::Port::command(uchar instruction, uint address, uint len, uint nb) const
{
- QMemArray<uchar> cmd(5+nb);
+ TQMemArray<uchar> cmd(5+nb);
cmd[0] = instruction;
cmd[1] = len;
cmd[2] = address & 0xFF;
@@ -77,11 +77,11 @@ PicdemBootloader::Hardware::Hardware(::Programmer::Base &base)
bool PicdemBootloader::Hardware::internalConnectHardware()
{
if ( !openPort() ) return false;
- QMemArray<uchar> cmd(5);
+ TQMemArray<uchar> cmd(5);
cmd.fill(0);
if ( !port().sendAndReceive(cmd, 4) ) return false;
VersionData version(cmd[3], cmd[2], 0);
- log(Log::LineType::Information, i18n("Bootloader version %1 detected").arg(version.pretty()));
+ log(Log::LineType::Information, i18n("Bootloader version %1 detected").tqarg(version.pretty()));
if ( version.majorNum()!=1 ) {
log(Log::LineType::Error, i18n("Only bootloader version 1.x is supported"));
return false;
@@ -106,9 +106,9 @@ bool PicdemBootloader::Hardware::write(Pic::MemoryRangeType type, const Device::
if ( type==Pic::MemoryRangeType::Code ) { // check that there is nothing in bootloader reserved area
for (uint i=0; i<data.count(); i++) {
if ( i>=0x400 ) continue;
- if ( data[i]==device().mask(Pic::MemoryRangeType::Code) ) continue;
+ if ( data[i]==device().tqmask(Pic::MemoryRangeType::Code) ) continue;
uint address = device().addressIncrement(Pic::MemoryRangeType::Code) * i;
- log(Log::LineType::Warning, " " + i18n("Code is present in bootloader reserved area (at address %1). It will be ignored.").arg(toHexLabel(address, device().nbCharsAddress())));
+ log(Log::LineType::Warning, " " + i18n("Code is present in bootloader reserved area (at address %1). It will be ignored.").tqarg(toHexLabel(address, device().nbCharsAddress())));
break;
}
}
@@ -116,7 +116,7 @@ bool PicdemBootloader::Hardware::write(Pic::MemoryRangeType type, const Device::
uint nbBytes = nbBytesWord * device().nbWords(type);
uint offset = (type==Pic::MemoryRangeType::Code ? 0x0800 : 0x00);
for (; offset<nbBytes; offset+=16) {
- QMemArray<uchar> cmd = port().command(0x02, device().range(type).start.toUInt() + offset, 16, 16);
+ TQMemArray<uchar> cmd = port().command(0x02, device().range(type).start.toUInt() + offset, 16, 16);
for (uint k=0; k<16; k += nbBytesWord) {
uint index = (offset + k) / nbBytesWord;
cmd[5 + k] = data[index].byte(0);
@@ -147,9 +147,9 @@ bool PicdemBootloader::Hardware::read(Pic::MemoryRangeType type, Device::Array &
if (vdata) varray = static_cast<const Pic::Memory &>(vdata->memory).arrayForWriting(type);
uint nbBytesWord = device().nbBytesWord(type);
uint nbBytes = nbBytesWord * device().nbWords(type);
- uint nb = QMIN(uint(16), nbBytes);
+ uint nb = TQMIN(uint(16), nbBytes);
for (uint offset=0; offset<nbBytes; offset+=16) {
- QMemArray<uchar> cmd = port().command(readInstruction(type), device().range(type).start.toUInt() + offset, nb, 0);
+ TQMemArray<uchar> cmd = port().command(readInstruction(type), device().range(type).start.toUInt() + offset, nb, 0);
if ( !port().sendAndReceive(cmd, 5+nb) ) return false;
for (uint k=0; k<nb; k += nbBytesWord) {
uint index = (offset + k) / nbBytesWord;
@@ -157,9 +157,9 @@ bool PicdemBootloader::Hardware::read(Pic::MemoryRangeType type, Device::Array &
if ( nbBytesWord==2 ) data[index] |= (cmd[5 + k+1] << 8);
if ( vdata && index>=0x0800 && data[index]!=varray[index] ) {
log(Log::LineType::Error, i18n("Device memory does not match hex file (at address 0x%2: reading 0x%3 and expecting 0x%4).")
- .arg(QString(toHex(index/2, device().nbCharsAddress())))
- .arg(QString(toHex(data[index], device().nbCharsWord(type))))
- .arg(QString(toHex(varray[index], device().nbCharsWord(type)))));
+ .tqarg(TQString(toHex(index/2, device().nbCharsAddress())))
+ .tqarg(TQString(toHex(data[index], device().nbCharsWord(type))))
+ .tqarg(TQString(toHex(varray[index], device().nbCharsWord(type)))));
return false;
}
}
@@ -177,7 +177,7 @@ bool PicdemBootloader::Hardware::erase(Pic::MemoryRangeType type)
uint nbBytesWord = device().nbBytesWord(type);
uint nbBytes = nbBytesWord * device().nbWords(type);
for (uint offset=0x0800; offset<nbBytes; offset+=64) {
- QMemArray<uchar> cmd = port().command(0x03, device().range(type).start.toUInt() + offset, 1, 0);
+ TQMemArray<uchar> cmd = port().command(0x03, device().range(type).start.toUInt() + offset, 1, 0);
if ( !port().sendAndReceive(cmd, 1) ) return false;
}
return true;
diff --git a/src/progs/picdem_bootloader/base/picdem_bootloader.h b/src/progs/picdem_bootloader/base/picdem_bootloader.h
index 3081382..e0b9cac 100644
--- a/src/progs/picdem_bootloader/base/picdem_bootloader.h
+++ b/src/progs/picdem_bootloader/base/picdem_bootloader.h
@@ -32,10 +32,10 @@ class Port : public ::Port::USB
{
public:
Port(Log::Base &base);
- bool receive(uint nb, QMemArray<uchar> &array);
- bool send(const QMemArray<uchar> &array);
- bool sendAndReceive(QMemArray<uchar> &data, uint nb);
- QMemArray<uchar> command(uchar instruction, uint address, uint len, uint nb) const;
+ bool receive(uint nb, TQMemArray<uchar> &array);
+ bool send(const TQMemArray<uchar> &array);
+ bool sendAndReceive(TQMemArray<uchar> &data, uint nb);
+ TQMemArray<uchar> command(uchar instruction, uint address, uint len, uint nb) const;
};
//-----------------------------------------------------------------------------
diff --git a/src/progs/picdem_bootloader/base/picdem_bootloader_data.h b/src/progs/picdem_bootloader/base/picdem_bootloader_data.h
index bf2a40f..a27dc48 100644
--- a/src/progs/picdem_bootloader/base/picdem_bootloader_data.h
+++ b/src/progs/picdem_bootloader/base/picdem_bootloader_data.h
@@ -12,8 +12,8 @@
namespace PicdemBootloader
{
struct Data {};
- extern bool isSupported(const QString &device);
- extern const Data &data(const QString &device);
+ extern bool isSupported(const TQString &device);
+ extern const Data &data(const TQString &device);
} // namespace
#endif
diff --git a/src/progs/picdem_bootloader/base/picdem_bootloader_prog.h b/src/progs/picdem_bootloader/base/picdem_bootloader_prog.h
index 698d612..cb82da0 100644
--- a/src/progs/picdem_bootloader/base/picdem_bootloader_prog.h
+++ b/src/progs/picdem_bootloader/base/picdem_bootloader_prog.h
@@ -19,6 +19,7 @@ namespace PicdemBootloader
class ProgrammerBase : public Bootloader::ProgrammerBase
{
Q_OBJECT
+ TQ_OBJECT
public:
ProgrammerBase(const Programmer::Group &group, const Pic::Data *data);
};
@@ -27,8 +28,8 @@ public:
class Group : public ::Bootloader::Group
{
public:
- virtual QString name() const { return "picdem_bootloader"; }
- virtual QString label() const { return i18n("Picdem Bootloader"); }
+ virtual TQString name() const { return "picdem_bootloader"; }
+ virtual TQString label() const { return i18n("Picdem Bootloader"); }
virtual ::Programmer::Properties properties() const { return ::Programmer::Programmer | ::Programmer::CanReadMemory; }
virtual ::Programmer::TargetPowerMode targetPowerMode() const { return ::Programmer::TargetSelfPowered; }
virtual bool isPortSupported(PortType type) const { return type==PortType::USB; }