summaryrefslogtreecommitdiffstats
path: root/src/progs/psp/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/psp/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/psp/base')
-rw-r--r--src/progs/psp/base/psp.cpp48
-rw-r--r--src/progs/psp/base/psp.h6
-rw-r--r--src/progs/psp/base/psp_data.h6
-rw-r--r--src/progs/psp/base/psp_prog.h7
-rw-r--r--src/progs/psp/base/psp_serial.cpp20
-rw-r--r--src/progs/psp/base/psp_serial.h8
6 files changed, 48 insertions, 47 deletions
diff --git a/src/progs/psp/base/psp.cpp b/src/progs/psp/base/psp.cpp
index 1b76bf5..188fbcb 100644
--- a/src/progs/psp/base/psp.cpp
+++ b/src/progs/psp/base/psp.cpp
@@ -13,9 +13,9 @@
#include "common/common/misc.h"
//-----------------------------------------------------------------------------
-QMemArray<uchar> Psp::createConfigInfo(const Pic::Data &data)
+TQMemArray<uchar> Psp::createConfigInfo(const Pic::Data &data)
{
- QMemArray<uchar> array(33);
+ TQMemArray<uchar> array(33);
array.fill(0x00);
const Pic::Config &config = data.config();
@@ -35,10 +35,10 @@ QMemArray<uchar> Psp::createConfigInfo(const Pic::Data &data)
return array;
}
-QMemArray<uchar> Psp::createDeviceInfo(const Pic::Data &data)
+TQMemArray<uchar> Psp::createDeviceInfo(const Pic::Data &data)
{
- QMemArray<uchar> config = createConfigInfo(data);
- QMemArray<uchar> array(45);
+ TQMemArray<uchar> config = createConfigInfo(data);
+ TQMemArray<uchar> array(45);
array.fill(0x00);
// memory code length
@@ -46,7 +46,7 @@ QMemArray<uchar> Psp::createDeviceInfo(const Pic::Data &data)
array[0] = v.byte(1);
array[1] = v.byte(0);
// address word width
- v = data.mask(Pic::MemoryRangeType::Code);
+ v = data.tqmask(Pic::MemoryRangeType::Code);
array[2] = v.byte(1);
array[3] = v.byte(0);
// data word width
@@ -59,12 +59,12 @@ QMemArray<uchar> Psp::createDeviceInfo(const Pic::Data &data)
if ( data.nbBytesWord(Pic::MemoryRangeType::UserId)==1 ) v += v << 8;
array[6] = v.byte(1);
array[7] = v.byte(0);
- // user id mask
+ // user id tqmask
array[8] = v.byte(1);
array[9] = v.byte(0);
}
- // memory config mask
+ // memory config tqmask
array[10] = config[0];
array[11] = config[1];
array[12] = config[16];
@@ -72,20 +72,20 @@ QMemArray<uchar> Psp::createDeviceInfo(const Pic::Data &data)
if ( data.isReadable(Pic::MemoryRangeType::Eeprom) ) {
// memory eeprom width
- v = data.mask(Pic::MemoryRangeType::Eeprom);
+ v = data.tqmask(Pic::MemoryRangeType::Eeprom);
array[14] = v.byte(1);
array[15] = v.byte(0);
- // memory eeprom mask
+ // memory eeprom tqmask
array[16] = v.byte(1);
array[17] = v.byte(0);
}
if ( data.isReadable(Pic::MemoryRangeType::Cal) ) {
// memory calibration width
- v = data.mask(Pic::MemoryRangeType::Cal);
+ v = data.tqmask(Pic::MemoryRangeType::Cal);
array[18] = v.byte(1);
array[19] = v.byte(0);
- // memory calibration mask
+ // memory calibration tqmask
array[20] = v.byte(1);
array[21] = v.byte(0);
}
@@ -159,8 +159,8 @@ QMemArray<uchar> Psp::createDeviceInfo(const Pic::Data &data)
}
//-----------------------------------------------------------------------------
-Psp::Hardware::Hardware(::Programmer::Base &base, const QString &portDevice)
- : Programmer::PicHardware(base, new SerialPort(portDevice, base), QString::null)
+Psp::Hardware::Hardware(::Programmer::Base &base, const TQString &portDevice)
+ : Programmer::PicHardware(base, new SerialPort(portDevice, base), TQString())
{}
bool Psp::Hardware::internalConnectHardware()
@@ -168,7 +168,7 @@ bool Psp::Hardware::internalConnectHardware()
if ( !port()->open() ) return false;
if ( !port()->reset() ) return false;
// #### TODO: detect Warp13 or JuPic
- QMemArray<uchar> a;
+ TQMemArray<uchar> a;
if ( !port()->command(0x88, 1, a) ) return false;
if ( a[0]!=0xAB ) {
log(Log::LineType::Error, i18n("Wrong programmer connected"));
@@ -179,13 +179,13 @@ bool Psp::Hardware::internalConnectHardware()
bool Psp::Hardware::getFirmwareVersion(VersionData &version)
{
- QMemArray<uchar> a1;
+ TQMemArray<uchar> a1;
if ( !port()->commandAck(0x8D, 2, &a1) ) return false;
if ( a1[1]==0xFF ) {
log(Log::LineType::Warning, i18n("Invalid firmware version"));
version = VersionData(0xFF, 0, 0);
} else {
- QMemArray<uchar> a2;
+ TQMemArray<uchar> a2;
if ( !port()->receive(2, a2) ) return false;
version = VersionData(a1[1], a2[0], a2[1]);
}
@@ -197,7 +197,7 @@ bool Psp::Hardware::setTarget()
log(Log::DebugLevel::Max, "set target");
// load device info
if ( !port()->commandAck(0x81) ) return false;
- QMemArray<uchar> a = createDeviceInfo(device());
+ TQMemArray<uchar> a = createDeviceInfo(device());
if ( !port()->send(a) ) return false;
if ( !port()->receiveEnd() ) return false;
@@ -212,7 +212,7 @@ bool Psp::Hardware::setTarget()
bool Psp::Hardware::setRange(uint start, uint size)
{
- QMemArray<uchar> a(6);
+ TQMemArray<uchar> a(6);
a[0] = 0x8E;
a[1] = start >> 16;
a[2] = (start >> 8) & 0xFF;
@@ -220,7 +220,7 @@ bool Psp::Hardware::setRange(uint start, uint size)
a[4] = size >> 8;
a[5] = size & 0xFF;
if ( !port()->send(a) ) return false;
- QMemArray<uchar> r;
+ TQMemArray<uchar> r;
if ( !port()->receive(6, r) ) return false;
for (uint i=0; i<6; i++) {
if ( r[i]!=a[i] ) {
@@ -269,7 +269,7 @@ char Psp::Hardware::writeCommand(Pic::MemoryRangeType type)
bool Psp::Hardware::readMemory(Pic::MemoryRangeType type, Device::Array &data, const ::Programmer::VerifyData *vdata)
{
- QMemArray<uchar> a;
+ TQMemArray<uchar> a;
uint nbWords = device().nbWords(type);
data.resize(nbWords);
uint nbBytes = nbWords * device().nbBytesWord(type);
@@ -281,8 +281,8 @@ bool Psp::Hardware::readMemory(Pic::MemoryRangeType type, Device::Array &data, c
for (uint i=0; i<data.count(); i++) {
if ( !port()->receive(2, a) ) return false;
data[i] = (a[0] << 8) + a[1];
-// log(Log::DebugLevel::Max, QString("code data %1: %2 (%3, %4)").arg(i).arg(toHexLabel(data[i], 4))
-// .arg(toHexLabel(a[0], 2)).arg(toHexLabel(a[1], 2)));
+// log(Log::DebugLevel::Max, TQString("code data %1: %2 (%3, %4)").tqarg(i).tqarg(toHexLabel(data[i], 4))
+// .tqarg(toHexLabel(a[0], 2)).tqarg(toHexLabel(a[1], 2)));
}
if ( !port()->receiveEnd() ) return false;
break;
@@ -336,7 +336,7 @@ bool Psp::Hardware::writeMemory(Pic::MemoryRangeType type, const Device::Array &
bool Psp::Hardware::eraseAll()
{
- QMemArray<uchar> a;
+ TQMemArray<uchar> a;
if ( !port()->commandAck(0x8F, 2, &a) ) return false;
if ( a[1]!=0x00 ) {
log(Log::LineType::Error, i18n("Erase failed"));
diff --git a/src/progs/psp/base/psp.h b/src/progs/psp/base/psp.h
index ad4a160..087b1aa 100644
--- a/src/progs/psp/base/psp.h
+++ b/src/progs/psp/base/psp.h
@@ -16,14 +16,14 @@
namespace Psp
{
- extern QMemArray<uchar> createConfigInfo(const Pic::Data &data);
- extern QMemArray<uchar> createDeviceInfo(const Pic::Data &data);
+ extern TQMemArray<uchar> createConfigInfo(const Pic::Data &data);
+ extern TQMemArray<uchar> createDeviceInfo(const Pic::Data &data);
//-----------------------------------------------------------------------------
class Hardware : public Programmer::PicHardware
{
public:
- Hardware(::Programmer::Base &base, const QString &portDevice);
+ Hardware(::Programmer::Base &base, const TQString &portDevice);
SerialPort *port() { return static_cast<SerialPort *>(_port); }
virtual bool uploadFirmware(const Pic::Memory &) { return false; }
virtual bool setTarget();
diff --git a/src/progs/psp/base/psp_data.h b/src/progs/psp/base/psp_data.h
index c643961..509ee71 100644
--- a/src/progs/psp/base/psp_data.h
+++ b/src/progs/psp/base/psp_data.h
@@ -9,15 +9,15 @@
#ifndef PSP_DATA_H
#define PSP_DATA_H
-#include <qstring.h>
+#include <tqstring.h>
namespace Psp
{
struct Data {
uint algorithm, overprogram, tries;
};
- 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/psp/base/psp_prog.h b/src/progs/psp/base/psp_prog.h
index ef525cd..02d0c68 100644
--- a/src/progs/psp/base/psp_prog.h
+++ b/src/progs/psp/base/psp_prog.h
@@ -18,6 +18,7 @@ namespace Psp
class Base : public Programmer::PicBase
{
Q_OBJECT
+ TQ_OBJECT
public:
Base(const Programmer::Group &group, const Pic::Data *data)
: Programmer::PicBase(group, data, "psp_programmer_base") {}
@@ -33,9 +34,9 @@ protected:
class Group : public ::Programmer::PicGroup
{
public:
- virtual QString name() const { return "psp"; }
- virtual QString label() const { return i18n("Picstart Plus"); }
- virtual QString xmlName() const { return "psp"; }
+ virtual TQString name() const { return "psp"; }
+ virtual TQString label() const { return i18n("Picstart Plus"); }
+ virtual TQString xmlName() const { return "psp"; }
virtual ::Programmer::Properties properties() const;
virtual ::Programmer::TargetPowerMode targetPowerMode() const { return ::Programmer::TargetExternallyPowered; }
virtual bool isPortSupported(PortType type) const { return ( type==PortType::Serial ); }
diff --git a/src/progs/psp/base/psp_serial.cpp b/src/progs/psp/base/psp_serial.cpp
index 964d604..7da4c00 100644
--- a/src/progs/psp/base/psp_serial.cpp
+++ b/src/progs/psp/base/psp_serial.cpp
@@ -14,7 +14,7 @@
#include "common/common/number.h"
//-----------------------------------------------------------------------------
-Psp::SerialPort::SerialPort(const QString &device, Log::Base &log)
+Psp::SerialPort::SerialPort(const TQString &device, Log::Base &log)
: Port::Serial(device, NeedFlush, log)
{}
@@ -46,9 +46,9 @@ bool Psp::SerialPort::reset()
return flush(0);
}
-bool Psp::SerialPort::command(uchar c, uint nbBytes, QMemArray<uchar> &a)
+bool Psp::SerialPort::command(uchar c, uint nbBytes, TQMemArray<uchar> &a)
{
- log(Log::DebugLevel::Extra, QString("Command %1").arg(toHexLabel(c, 2)));
+ log(Log::DebugLevel::Extra, TQString("Command %1").tqarg(toHexLabel(c, 2)));
if ( !sendChar(c) ) return false;
return receive(nbBytes, a);
}
@@ -57,7 +57,7 @@ bool Psp::SerialPort::checkAck(uchar ec, uchar rc)
{
if ( ec==rc ) return true;
log(Log::LineType::Error, i18n("Incorrect ack: expecting %1, received %2")
- .arg(QString(toHex(ec, 2))).arg(QString(toHex(rc, 2))));
+ .tqarg(TQString(toHex(ec, 2))).tqarg(TQString(toHex(rc, 2))));
return false;
}
@@ -65,14 +65,14 @@ bool Psp::SerialPort::checkEnd(uchar c)
{
if ( c==0 ) return true;
log(Log::LineType::Error, i18n("Incorrect received data end: expecting 00, received %1")
- .arg(QString(toHex(c, 2))));
+ .tqarg(TQString(toHex(c, 2))));
return false;
}
-bool Psp::SerialPort::commandAck(uchar c, uint nbBytes, QMemArray<uchar> *a)
+bool Psp::SerialPort::commandAck(uchar c, uint nbBytes, TQMemArray<uchar> *a)
{
Q_ASSERT( nbBytes>=1 );
- QMemArray<uchar> tmp;
+ TQMemArray<uchar> tmp;
if ( !command(c, nbBytes, tmp) ) return false;
if ( !checkAck(c, tmp[0]) ) return false;
if (a) *a = tmp;
@@ -81,13 +81,13 @@ bool Psp::SerialPort::commandAck(uchar c, uint nbBytes, QMemArray<uchar> *a)
bool Psp::SerialPort::receiveEnd()
{
- QMemArray<uchar> a;
+ TQMemArray<uchar> a;
if ( !receive(1, a) ) return false;
if ( !checkEnd(a[0]) ) return false;
return true;
}
-bool Psp::SerialPort::commandAckEnd(uchar c, uint nbBytes, QMemArray<uchar> &a)
+bool Psp::SerialPort::commandAckEnd(uchar c, uint nbBytes, TQMemArray<uchar> &a)
{
Q_ASSERT( nbBytes>=2 );
if ( !command(c, nbBytes, a) ) return false;
@@ -100,7 +100,7 @@ bool Psp::SerialPort::sendData(uint value, uint nbBytes)
{
Q_ASSERT( nbBytes==1 || nbBytes==2 );
Q_ASSERT( value<uint(1 << 8*nbBytes) );
- QMemArray<uchar> a(nbBytes);
+ TQMemArray<uchar> a(nbBytes);
if ( nbBytes==2 ) {
a[0] = value / 256;
a[1] = value & 0xFF;
diff --git a/src/progs/psp/base/psp_serial.h b/src/progs/psp/base/psp_serial.h
index 6f379dd..a7ebf77 100644
--- a/src/progs/psp/base/psp_serial.h
+++ b/src/progs/psp/base/psp_serial.h
@@ -18,12 +18,12 @@ namespace Psp
class SerialPort : public Port::Serial
{
public:
- SerialPort(const QString &portDevice, Log::Base &log);
+ SerialPort(const TQString &portDevice, Log::Base &log);
bool open();
bool reset();
- bool command(uchar c, uint nbBytes, QMemArray<uchar> &a);
- bool commandAck(uchar c, uint nbBytes = 1, QMemArray<uchar> *a = 0);
- bool commandAckEnd(uchar c, uint nbBytes, QMemArray<uchar> &a);
+ bool command(uchar c, uint nbBytes, TQMemArray<uchar> &a);
+ bool commandAck(uchar c, uint nbBytes = 1, TQMemArray<uchar> *a = 0);
+ bool commandAckEnd(uchar c, uint nbBytes, TQMemArray<uchar> &a);
bool receiveEnd();
bool sendData(uint value, uint nbBytes);