This commit is contained in:
Claudio Lanconelli 2017-04-29 01:56:50 +02:00
parent 78d7c05bd1
commit d304f3e57a
129 changed files with 2350 additions and 2350 deletions

View File

@ -41,7 +41,7 @@
using namespace Translator; using namespace Translator;
AboutModalDialog::AboutModalDialog(QWidget* bw, const QString title) AboutModalDialog::AboutModalDialog(QWidget *bw, const QString title)
: QDialog(bw) : QDialog(bw)
{ {
qDebug() << "AboutModalDialog::AboutModalDialog()"; qDebug() << "AboutModalDialog::AboutModalDialog()";
@ -61,9 +61,9 @@ AboutModalDialog::AboutModalDialog(QWidget* bw, const QString title)
lblAbout1->setText("Copyright (C) " + COPYRIGHTYEAR + " by <a href=\"" + AUTHORMAIL + "\">" + AUTHORNAME + "</a><br><br>" + lblAbout1->setText("Copyright (C) " + COPYRIGHTYEAR + " by <a href=\"" + AUTHORMAIL + "\">" + AUTHORNAME + "</a><br><br>" +
"Porting to Qt4/Qt5 by <a href=\"" + PORTERMAIL + "\">" + PORTERGQT + "</a><br><br>" + "Porting to Qt4/Qt5 by <a href=\"" + PORTERMAIL + "\">" + PORTERGQT + "</a><br><br>" +
STR_APPDOWNLOAD1 + " " + APPNAME + " " + STR_APPDOWNLOAD2 + "<br>" + STR_APPDOWNLOAD1 + " " + APPNAME + " " + STR_APPDOWNLOAD2 + "<br>" +
"<a href=\"" + AUTHORWEB + "\">" + AUTHORWEB + "</a>" ); "<a href=\"" + AUTHORWEB + "\">" + AUTHORWEB + "</a>");
chkSound->setChecked( E2Profile::GetSkipStartupDialog()); chkSound->setChecked(E2Profile::GetSkipStartupDialog());
chkSound->setText(STR_LBLSKIPMSG); chkSound->setText(STR_LBLSKIPMSG);
pushOk->setText(STR_BTNOK); pushOk->setText(STR_BTNOK);

View File

@ -43,17 +43,17 @@ class e2CmdWindow;
class AboutModalDialog : public QDialog, public Ui::AboutDialog class AboutModalDialog : public QDialog, public Ui::AboutDialog
{ {
Q_OBJECT Q_OBJECT
public: //---------------------------------------- public public: //---------------------------------------- public
AboutModalDialog(QWidget *bw = 0, const QString title = "About"); AboutModalDialog(QWidget *bw = 0, const QString title = "About");
virtual ~AboutModalDialog(); // Destructor virtual ~AboutModalDialog(); // Destructor
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
private slots: private slots:
void onChkStart(bool); void onChkStart(bool);
void onHelp(); void onHelp();
private: //--------------------------------------- private private: //--------------------------------------- private
e2CmdWindow *cmdw; e2CmdWindow *cmdw;
}; };

View File

@ -58,7 +58,7 @@ int At17xxx::WritePage(long addr, int addr_bytes, uint8_t *buf, int len)
for (j = addr_bytes - 1; j >= 0; j--) for (j = addr_bytes - 1; j >= 0; j--)
{ {
rval = GetBus()->WriteByte( (addr >> (j * 8)) & 0xFF, 0 ); rval = GetBus()->WriteByte((addr >> (j * 8)) & 0xFF, 0);
if (rval < 0) if (rval < 0)
{ {
@ -68,7 +68,7 @@ int At17xxx::WritePage(long addr, int addr_bytes, uint8_t *buf, int len)
for (j = 0; j < len; j++) for (j = 0; j < len; j++)
{ {
rval = GetBus()->WriteByte( buf[j], 1 ); rval = GetBus()->WriteByte(buf[j], 1);
if (rval < 0) if (rval < 0)
{ {
@ -92,7 +92,7 @@ int At17xxx::WritePage(long addr, int addr_bytes, uint8_t *buf, int len)
int At17xxx::Write(int probe, int type) int At17xxx::Write(int probe, int type)
{ {
int error = Probe( probe || GetNoOfBank() == 0 ); int error = Probe(probe || GetNoOfBank() == 0);
if (error < 0) if (error < 0)
{ {
@ -132,7 +132,7 @@ int At17xxx::Write(int probe, int type)
break; break;
} }
if ( GetBus()->CheckAbort(j * 100 / size) ) if (GetBus()->CheckAbort(j * 100 / size))
{ {
rval = OP_ABORTED; rval = OP_ABORTED;
break; break;
@ -173,7 +173,7 @@ int At17xxx::ReadPage(long addr, int addr_bytes, uint8_t *buf, int len)
for (j = addr_bytes - 1; j >= 0; j--) for (j = addr_bytes - 1; j >= 0; j--)
{ {
rval = GetBus()->WriteByte( (addr >> (j * 8)) & 0xFF, 0 ); rval = GetBus()->WriteByte((addr >> (j * 8)) & 0xFF, 0);
if (rval < 0) if (rval < 0)
{ {
@ -218,7 +218,7 @@ int At17xxx::ReadPage(long addr, int addr_bytes, uint8_t *buf, int len)
int At17xxx::Read(int probe, int type) int At17xxx::Read(int probe, int type)
{ {
int error = Probe( probe || GetNoOfBank() == 0 ); int error = Probe(probe || GetNoOfBank() == 0);
if (error < 0) if (error < 0)
{ {
@ -259,7 +259,7 @@ int At17xxx::Read(int probe, int type)
break; break;
} }
if ( GetBus()->CheckAbort(k * 100 / size) ) if (GetBus()->CheckAbort(k * 100 / size))
{ {
error = OP_ABORTED; error = OP_ABORTED;
break; break;
@ -329,7 +329,7 @@ int At17xxx::Verify(int type)
break; break;
} }
if ( memcmp(GetBufPtr() + k, localbuf, readpage_size) != 0 ) if (memcmp(GetBufPtr() + k, localbuf, readpage_size) != 0)
{ {
rval = 0; rval = 0;
break; break;
@ -339,7 +339,7 @@ int At17xxx::Verify(int type)
rval = 1; rval = 1;
} }
if ( GetBus()->CheckAbort(k * 100 / size) ) if (GetBus()->CheckAbort(k * 100 / size))
{ {
rval = OP_ABORTED; rval = OP_ABORTED;
break; break;

View File

@ -34,7 +34,7 @@
class At17xxx : public E24xx class At17xxx : public E24xx
{ {
public: //---------------------------------------- public public: //---------------------------------------- public
At17xxx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0); At17xxx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
@ -43,12 +43,12 @@ public: //---------------------------------------- public
int Write(int probe = 1, int type = ALL_TYPE); int Write(int probe = 1, int type = ALL_TYPE);
int Verify(int type = ALL_TYPE); int Verify(int type = ALL_TYPE);
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
int WritePage(long addr, int addr_bytes, uint8_t *buf, int len); int WritePage(long addr, int addr_bytes, uint8_t *buf, int len);
int ReadPage(long addr, int addr_bytes, uint8_t *buf, int len); int ReadPage(long addr, int addr_bytes, uint8_t *buf, int len);
private: //--------------------------------------- private private: //--------------------------------------- private
}; };
#endif #endif

View File

@ -74,7 +74,7 @@ int At250Bus::ReadEEPByte(int addr)
{ {
int rv; int rv;
SendDataByte( ReadData | (((addr >> 8) & 1) << 3) ); SendDataByte(ReadData | (((addr >> 8) & 1) << 3));
SendDataByte(addr); SendDataByte(addr);
WaitUsec(shot_delay); WaitUsec(shot_delay);
@ -88,7 +88,7 @@ int At250Bus::ReadEEPByte(int addr)
void At250Bus::WriteEEPByte(int addr, int data) void At250Bus::WriteEEPByte(int addr, int data)
{ {
SendDataByte( WriteData | (((addr >> 8) & 1) << 3) ); SendDataByte(WriteData | (((addr >> 8) & 1) << 3));
SendDataByte(addr); SendDataByte(addr);
SendDataByte(data); SendDataByte(data);
@ -160,8 +160,8 @@ long At250Bus::Read(int addr, uint8_t *data, long length, int page_size)
{ {
*data++ = (uint8_t)ReadEEPByte(addr++); *data++ = (uint8_t)ReadEEPByte(addr++);
if ( (len % 10) == 0 ) if ((len % 10) == 0)
if ( CheckAbort(len * 100 / length) ) if (CheckAbort(len * 100 / length))
{ {
break; break;
} }
@ -198,8 +198,8 @@ long At250Bus::Write(int addr, uint8_t const *data, long length, int page_size)
return 0; //Must return 0, because > 0 (and != length) means "Abort by user" return 0; //Must return 0, because > 0 (and != length) means "Abort by user"
} }
if ( (len & 1) ) if ((len & 1))
if ( CheckAbort(len * 100 / length) ) if (CheckAbort(len * 100 / length))
{ {
break; break;
} }

View File

@ -34,7 +34,7 @@
class At250Bus : public SPIBus class At250Bus : public SPIBus
{ {
public: //------------------------------- public public: //------------------------------- public
At250Bus(BusInterface *ptr = 0); At250Bus(BusInterface *ptr = 0);
// virtual ~At250Bus(); // virtual ~At250Bus();
@ -43,7 +43,7 @@ public: //------------------------------- public
int Reset(); int Reset();
protected: //------------------------------- protected protected: //------------------------------- protected
virtual int ReadEEPByte(int addr); virtual int ReadEEPByte(int addr);
virtual void WriteEEPByte(int addr, int data); virtual void WriteEEPByte(int addr, int data);
@ -68,7 +68,7 @@ protected: //------------------------------- protected
const int loop_timeout; const int loop_timeout;
private: //------------------------------- private private: //------------------------------- private
void setNCS() void setNCS()
{ {

View File

@ -57,9 +57,9 @@ long At250BigBus::Read(int addr, uint8_t *data, long length, int page_size)
long len; long len;
SendDataByte( ReadData ); SendDataByte(ReadData);
SendDataByte( (addr >> 8) & 0xFF ); //MSB SendDataByte((addr >> 8) & 0xFF); //MSB
SendDataByte( addr & 0xFF ); //LSB SendDataByte(addr & 0xFF); //LSB
WaitUsec(shot_delay); WaitUsec(shot_delay);
@ -67,8 +67,8 @@ long At250BigBus::Read(int addr, uint8_t *data, long length, int page_size)
{ {
*data++ = RecDataByte(); *data++ = RecDataByte();
if ( (len % 10) == 0 ) if ((len % 10) == 0)
if ( CheckAbort(len * 100 / length) ) if (CheckAbort(len * 100 / length))
{ {
break; break;
} }
@ -104,9 +104,9 @@ long At250BigBus::Write(int addr, uint8_t const *data, long length, int page_siz
SendDataByte(WriteEnable); SendDataByte(WriteEnable);
EndCycle(); EndCycle();
SendDataByte( WriteData ); SendDataByte(WriteData);
SendDataByte( (addr >> 8) & 0xFF ); //MSB SendDataByte((addr >> 8) & 0xFF); //MSB
SendDataByte( addr & 0xFF ); //LSB SendDataByte(addr & 0xFF); //LSB
int j; int j;
@ -122,8 +122,8 @@ long At250BigBus::Write(int addr, uint8_t const *data, long length, int page_siz
return 0; //Must return 0, because > 0 (and != length) means "Abort by user" return 0; //Must return 0, because > 0 (and != length) means "Abort by user"
} }
if ( (len & 1) ) if ((len & 1))
if ( CheckAbort(len * 100 / length) ) if (CheckAbort(len * 100 / length))
{ {
break; break;
} }

View File

@ -34,7 +34,7 @@
class At250BigBus: public At250Bus class At250BigBus: public At250Bus
{ {
public: //------------------------------- public public: //------------------------------- public
At250BigBus(BusInterface *ptr = 0); At250BigBus(BusInterface *ptr = 0);
long Read(int addr, uint8_t *data, long length, int page_size = 0); long Read(int addr, uint8_t *data, long length, int page_size = 0);
@ -42,12 +42,12 @@ public: //------------------------------- public
// int Reset(); // int Reset();
protected: //------------------------------- protected protected: //------------------------------- protected
// int ReadEEPByte(int addr); // int ReadEEPByte(int addr);
// void WriteEEPByte(int addr, int data); // void WriteEEPByte(int addr, int data);
private: //------------------------------- private private: //------------------------------- private
//Programming commands //Programming commands
// const uint8_t WriteEnable; // const uint8_t WriteEnable;

View File

@ -153,7 +153,7 @@ int At250xx::Verify(int type)
} }
else else
{ {
rval = ( memcmp(GetBufPtr(), localbuf, size) != 0 ) ? 0 : 1; rval = (memcmp(GetBufPtr(), localbuf, size) != 0) ? 0 : 1;
} }
} }

View File

@ -38,7 +38,7 @@
class At250xx : public Device class At250xx : public Device
{ {
public: //---------------------------------------- public public: //---------------------------------------- public
At250xx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0); At250xx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
virtual ~At250xx(); virtual ~At250xx();
@ -48,14 +48,14 @@ public: //---------------------------------------- public
virtual int Write(int probe = 1, int type = ALL_TYPE); virtual int Write(int probe = 1, int type = ALL_TYPE);
virtual int Verify(int type = ALL_TYPE); virtual int Verify(int type = ALL_TYPE);
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
At250Bus *GetBus() At250Bus *GetBus()
{ {
return (At250Bus *)Device::GetBus(); return (At250Bus *)Device::GetBus();
} }
private: //--------------------------------------- private private: //--------------------------------------- private
}; };
#endif #endif

View File

@ -38,19 +38,19 @@
class At25xxx : public At250xx class At25xxx : public At250xx
{ {
public: //---------------------------------------- public public: //---------------------------------------- public
At25xxx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0); At25xxx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
virtual ~At25xxx(); virtual ~At25xxx();
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
At250BigBus *GetBus() At250BigBus *GetBus()
{ {
return (At250BigBus *)Device::GetBus(); return (At250BigBus *)Device::GetBus();
} }
private: //--------------------------------------- private private: //--------------------------------------- private
}; };
#endif #endif

View File

@ -79,7 +79,7 @@ void At89sBus::SetDelay()
int val = E2Profile::GetSPISpeed(); int val = E2Profile::GetSPISpeed();
int n; int n;
switch(val) switch (val)
{ {
case TURBO: case TURBO:
n = 1; n = 1;
@ -148,7 +148,7 @@ int At89sBus::ReadProgByte(long addr)
{ {
if (oldmode) if (oldmode)
{ {
SendDataByte(OldReadProgMem | ((addr >> 5) & 0xF8) | ((addr >> 11) & 0x04) ); SendDataByte(OldReadProgMem | ((addr >> 5) & 0xF8) | ((addr >> 11) & 0x04));
} }
else else
{ {
@ -317,7 +317,7 @@ int At89sBus::Reset()
} }
SPIBus::Reset(); SPIBus::Reset();
WaitMsec( E2Profile::GetAT89DelayAfterReset() ); // Almeno 20msec dai datasheet AVR atmel WaitMsec(E2Profile::GetAT89DelayAfterReset()); // Almeno 20msec dai datasheet AVR atmel
SendDataByte(EnableProg0); SendDataByte(EnableProg0);
SendDataByte(EnableProg1); SendDataByte(EnableProg1);
@ -518,7 +518,7 @@ long At89sBus::Read(int addr, uint8_t *data, long length, int page_size)
{ {
ReadDataPage(addr, data, page_size); ReadDataPage(addr, data, page_size);
if ( CheckAbort(len * 100 / length) ) if (CheckAbort(len * 100 / length))
{ {
break; break;
} }
@ -530,7 +530,7 @@ long At89sBus::Read(int addr, uint8_t *data, long length, int page_size)
{ {
*data++ = (uint8_t)ReadDataByte(addr++); *data++ = (uint8_t)ReadDataByte(addr++);
if ( CheckAbort(len * 100 / length) ) if (CheckAbort(len * 100 / length))
{ {
break; break;
} }
@ -548,7 +548,7 @@ long At89sBus::Read(int addr, uint8_t *data, long length, int page_size)
{ {
ReadProgPage(addr, data, page_size); ReadProgPage(addr, data, page_size);
if ( CheckAbort(len * 100 / length) ) if (CheckAbort(len * 100 / length))
{ {
break; break;
} }
@ -560,7 +560,7 @@ long At89sBus::Read(int addr, uint8_t *data, long length, int page_size)
{ {
*data++ = (uint8_t)ReadProgByte(addr++); *data++ = (uint8_t)ReadProgByte(addr++);
if ( CheckAbort(len * 100 / length) ) if (CheckAbort(len * 100 / length))
{ {
break; break;
} }
@ -633,7 +633,7 @@ long At89sBus::Write(int addr, uint8_t const *data, long length, int page_size)
return E2ERR_WRITEFAILED; return E2ERR_WRITEFAILED;
} }
if ( CheckAbort(len * 100 / length) ) if (CheckAbort(len * 100 / length))
{ {
break; break;
} }
@ -657,14 +657,14 @@ long At89sBus::Write(int addr, uint8_t const *data, long length, int page_size)
WaitUsec(100); WaitUsec(100);
//Interrupt the writing and exit (device missing?) //Interrupt the writing and exit (device missing?)
if ( WaitReadyAfterWrite(1, addr, *data) != OK ) if (WaitReadyAfterWrite(1, addr, *data) != OK)
{ {
return E2ERR_WRITEFAILED; return E2ERR_WRITEFAILED;
} }
} }
} }
if ( CheckAbort(len * 100 / length) ) if (CheckAbort(len * 100 / length))
{ {
break; break;
} }
@ -681,13 +681,13 @@ long At89sBus::Write(int addr, uint8_t const *data, long length, int page_size)
for (addr = 0, len = 0; len < length; len += page_size, addr += page_size, data += page_size) for (addr = 0, len = 0; len < length; len += page_size, addr += page_size, data += page_size)
{ {
//check for FF's page to skip blank pages //check for FF's page to skip blank pages
if ( !CheckBlankPage(data, page_size) ) if (!CheckBlankPage(data, page_size))
if (WriteProgPage(addr, data, page_size) != OK) if (WriteProgPage(addr, data, page_size) != OK)
{ {
return E2ERR_WRITEFAILED; return E2ERR_WRITEFAILED;
} }
if ( CheckAbort(len * 100 / length) ) if (CheckAbort(len * 100 / length))
{ {
break; break;
} }
@ -711,14 +711,14 @@ long At89sBus::Write(int addr, uint8_t const *data, long length, int page_size)
WaitUsec(100); WaitUsec(100);
//Interrupt the writing and exit (device missing?) //Interrupt the writing and exit (device missing?)
if ( WaitReadyAfterWrite(0, addr, *data) != OK ) if (WaitReadyAfterWrite(0, addr, *data) != OK)
{ {
return E2ERR_WRITEFAILED; return E2ERR_WRITEFAILED;
} }
} }
} }
if ( CheckAbort(len * 100 / length) ) if (CheckAbort(len * 100 / length))
{ {
break; break;
} }

View File

@ -34,7 +34,7 @@
class At89sBus : public SPIBus class At89sBus : public SPIBus
{ {
public: //------------------------------- public public: //------------------------------- public
At89sBus(BusInterface *ptr = 0); At89sBus(BusInterface *ptr = 0);
// virtual ~At89sBus(); // virtual ~At89sBus();
@ -71,7 +71,7 @@ public: //------------------------------- public
oldmode = old; oldmode = old;
} }
protected: //------------------------------- protected protected: //------------------------------- protected
//Programming commands //Programming commands
const uint8_t EnableProg0, EnableProg1; const uint8_t EnableProg0, EnableProg1;
@ -102,7 +102,7 @@ protected: //------------------------------- protected
int WaitReadyAfterWrite(int type, long addr, int data, long timeout = 5000); int WaitReadyAfterWrite(int type, long addr, int data, long timeout = 5000);
bool CheckBlankPage(uint8_t const *data, long length); bool CheckBlankPage(uint8_t const *data, long length);
private: //------------------------------- private private: //------------------------------- private
bool enable_datapage_polling, enable_progpage_polling; bool enable_datapage_polling, enable_progpage_polling;

View File

@ -168,7 +168,7 @@ int At89sxx::Probe(int probe_size)
if (rv == OK) if (rv == OK)
{ {
if ( GetE2PSubType(GetAWInfo()->GetEEPId()) == subtype ) if (GetE2PSubType(GetAWInfo()->GetEEPId()) == subtype)
{ {
rv = GetSize(); rv = GetSize();
} }
@ -217,14 +217,14 @@ int At89sxx::Read(int probe, int type)
// read the fuses // read the fuses
uint32_t f = 0; uint32_t f = 0;
if ( GetBus()->ReadFuseBits(f, GetAWInfo()->GetEEPId()) == OK ) if (GetBus()->ReadFuseBits(f, GetAWInfo()->GetEEPId()) == OK)
{ {
GetAWInfo()->SetFuseBits(f); GetAWInfo()->SetFuseBits(f);
} }
f = 0; f = 0;
if ( GetBus()->ReadLockBits(f, GetAWInfo()->GetEEPId()) == OK ) if (GetBus()->ReadLockBits(f, GetAWInfo()->GetEEPId()) == OK)
{ {
GetAWInfo()->SetLockBits(f); GetAWInfo()->SetLockBits(f);
} }
@ -312,8 +312,8 @@ int At89sxx::Verify(int type)
fret = GetBus()->ReadFuseBits(fval, GetAWInfo()->GetEEPId()); fret = GetBus()->ReadFuseBits(fval, GetAWInfo()->GetEEPId());
lret = GetBus()->ReadLockBits(lval, GetAWInfo()->GetEEPId()); lret = GetBus()->ReadLockBits(lval, GetAWInfo()->GetEEPId());
if ( (lret == NOTSUPPORTED || GetAWInfo()->GetLockBits() == lval) if ((lret == NOTSUPPORTED || GetAWInfo()->GetLockBits() == lval)
&& (fret == NOTSUPPORTED || GetAWInfo()->GetFuseBits() == fval) ) && (fret == NOTSUPPORTED || GetAWInfo()->GetFuseBits() == fval))
{ {
v_config = OK; v_config = OK;
} }

View File

@ -38,7 +38,7 @@
class At89sxx : public Device class At89sxx : public Device
{ {
public: //---------------------------------------- public public: //---------------------------------------- public
At89sxx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0); At89sxx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
// virtual ~At89sxx(); // virtual ~At89sxx();
@ -61,11 +61,11 @@ public: //---------------------------------------- public
return (At89sBus *)Device::GetBus(); return (At89sBus *)Device::GetBus();
} }
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
int QueryType(long &type); int QueryType(long &type);
private: //--------------------------------------- private private: //--------------------------------------- private
}; };
#endif #endif

View File

@ -76,7 +76,7 @@ At90sBus::At90sBus(BusInterface *ptr)
int At90sBus::ReadEEPByte(long addr) int At90sBus::ReadEEPByte(long addr)
{ {
SendDataByte(ReadEEPMem0); SendDataByte(ReadEEPMem0);
SendDataByte(ReadEEPMem1 | ((addr & 0xFFFF) >> 8) ); //19/01/1999 -- the bug is due to an error in the original Atmel datasheet SendDataByte(ReadEEPMem1 | ((addr & 0xFFFF) >> 8)); //19/01/1999 -- the bug is due to an error in the original Atmel datasheet
SendDataByte(addr); SendDataByte(addr);
return RecDataByte(); return RecDataByte();
@ -85,7 +85,7 @@ int At90sBus::ReadEEPByte(long addr)
void At90sBus::WriteEEPByte(long addr, int data) void At90sBus::WriteEEPByte(long addr, int data)
{ {
SendDataByte(WriteEEPMem0); SendDataByte(WriteEEPMem0);
SendDataByte(WriteEEPMem1 | ((addr & 0xFFFF) >> 8) ); //19/01/1999 SendDataByte(WriteEEPMem1 | ((addr & 0xFFFF) >> 8)); //19/01/1999
SendDataByte(addr); SendDataByte(addr);
SendDataByte(data); SendDataByte(data);
} }
@ -162,7 +162,7 @@ int At90sBus::Reset()
{ {
SPIBus::Reset(); SPIBus::Reset();
WaitMsec( E2Profile::GetAVRDelayAfterReset() ); // At least 20msec (AVR datasheets) WaitMsec(E2Profile::GetAVRDelayAfterReset()); // At least 20msec (AVR datasheets)
qDebug() << "Avr1200Bus::Reset() ** SendDataByte"; qDebug() << "Avr1200Bus::Reset() ** SendDataByte";
@ -171,7 +171,7 @@ int At90sBus::Reset()
RecDataByte(); RecDataByte();
SendDataByte(0); SendDataByte(0);
if ( ReadDeviceCode(0) == 0x1E ) if (ReadDeviceCode(0) == 0x1E)
{ {
success_flag = true; success_flag = true;
} }
@ -187,7 +187,7 @@ int At90sBus::Reset()
SPIBus::Reset(); SPIBus::Reset();
WaitMsec( E2Profile::GetAVRDelayAfterReset() ); // At least 20msec (AVR datasheets) WaitMsec(E2Profile::GetAVRDelayAfterReset()); // At least 20msec (AVR datasheets)
int k; int k;
@ -754,7 +754,7 @@ long At90sBus::Read(int addr, uint8_t *data, long length, int page_size)
{ {
*data++ = (uint8_t)ReadEEPByte(addr++); *data++ = (uint8_t)ReadEEPByte(addr++);
if ( CheckAbort(len * 100 / length) ) if (CheckAbort(len * 100 / length))
{ {
break; break;
} }
@ -771,7 +771,7 @@ long At90sBus::Read(int addr, uint8_t *data, long length, int page_size)
{ {
*data++ = (uint8_t)ReadProgByte(addr++); *data++ = (uint8_t)ReadProgByte(addr++);
if ( CheckAbort(len * 100 / length) ) if (CheckAbort(len * 100 / length))
{ {
break; break;
} }
@ -902,13 +902,13 @@ long At90sBus::Write(int addr, uint8_t const *data, long length, int page_size)
WaitUsec(100); WaitUsec(100);
//Interrupt the writing and exit (device missing?) //Interrupt the writing and exit (device missing?)
if ( WaitReadyAfterWrite(1, addr, *data) != OK ) if (WaitReadyAfterWrite(1, addr, *data) != OK)
{ {
return E2ERR_WRITEFAILED; return E2ERR_WRITEFAILED;
} }
} }
if ( CheckAbort(len * 100 / length) ) if (CheckAbort(len * 100 / length))
{ {
break; break;
} }
@ -925,13 +925,13 @@ long At90sBus::Write(int addr, uint8_t const *data, long length, int page_size)
for (addr = 0, len = 0; len < length; addr += page_size, data += page_size, len += page_size) for (addr = 0, len = 0; len < length; addr += page_size, data += page_size, len += page_size)
{ {
//check for FF's page to skip blank pages //check for FF's page to skip blank pages
if ( !CheckBlankPage(data, page_size) ) if (!CheckBlankPage(data, page_size))
if (WriteProgPage(addr, data, page_size) != OK) if (WriteProgPage(addr, data, page_size) != OK)
{ {
return E2ERR_WRITEFAILED; return E2ERR_WRITEFAILED;
} }
if ( CheckAbort(len * 100 / length) ) if (CheckAbort(len * 100 / length))
{ {
break; break;
} }
@ -939,7 +939,7 @@ long At90sBus::Write(int addr, uint8_t const *data, long length, int page_size)
} }
else else
{ {
for(addr = 0, len = 0; len < length; addr++, data++, len++) for (addr = 0, len = 0; len < length; addr++, data++, len++)
{ {
//09/10/98 -- program only locations not equal to FF (erase set all FF) //09/10/98 -- program only locations not equal to FF (erase set all FF)
if (*data != 0xFF) if (*data != 0xFF)
@ -948,13 +948,13 @@ long At90sBus::Write(int addr, uint8_t const *data, long length, int page_size)
WaitUsec(100); WaitUsec(100);
if ( WaitReadyAfterWrite(0, addr, *data, 2000) != OK ) if (WaitReadyAfterWrite(0, addr, *data, 2000) != OK)
{ {
return E2ERR_WRITEFAILED; return E2ERR_WRITEFAILED;
} }
} }
if ( CheckAbort(len * 100 / length) ) if (CheckAbort(len * 100 / length))
{ {
break; break;
} }
@ -1021,7 +1021,7 @@ int At90sBus::WriteProgPage(long addr, uint8_t const *data, long page_size, long
for (k = timeout; k > 0; k--) for (k = timeout; k > 0; k--)
{ {
if ( ReadProgByte(first_loc) != 0xFF ) if (ReadProgByte(first_loc) != 0xFF)
{ {
okflag = true; okflag = true;
break; break;
@ -1031,7 +1031,7 @@ int At90sBus::WriteProgPage(long addr, uint8_t const *data, long page_size, long
else else
{ {
okflag = true; okflag = true;
WaitMsec( E2Profile::GetMegaPageDelay() ); WaitMsec(E2Profile::GetMegaPageDelay());
} }
return okflag ? OK : E2P_TIMEOUT; return okflag ? OK : E2P_TIMEOUT;

View File

@ -34,7 +34,7 @@
class At90sBus : public SPIBus class At90sBus : public SPIBus
{ {
public: //------------------------------- public public: //------------------------------- public
At90sBus(BusInterface *ptr = 0); At90sBus(BusInterface *ptr = 0);
// virtual ~At90sBus(); // virtual ~At90sBus();
@ -58,7 +58,7 @@ public: //------------------------------- public
old1200mode = val; old1200mode = val;
} }
protected: //------------------------------- protected protected: //------------------------------- protected
//Programming commands //Programming commands
const uint8_t EnableProg0, EnableProg1; const uint8_t EnableProg0, EnableProg1;
@ -101,7 +101,7 @@ protected: //------------------------------- protected
bool old1200mode; bool old1200mode;
private: //------------------------------- private private: //------------------------------- private
bool enable_flashpage_polling; bool enable_flashpage_polling;
}; };

View File

@ -60,7 +60,7 @@ int At90sxx::SecurityRead(uint32_t &bits)
if (rv > 0) if (rv > 0)
{ {
bits = GetBus()->ReadLockBits( GetAWInfo()->GetEEPId() ); bits = GetBus()->ReadLockBits(GetAWInfo()->GetEEPId());
rv = OK; rv = OK;
} }
@ -343,7 +343,7 @@ int At90sxx::Probe(int probe_size)
if (rv == OK) if (rv == OK)
{ {
if ( GetE2PSubType(GetAWInfo()->GetEEPId()) == subtype ) if (GetE2PSubType(GetAWInfo()->GetEEPId()) == subtype)
{ {
rv = GetSize(); rv = GetSize();
} }
@ -363,10 +363,10 @@ int At90sxx::Erase(int probe, int type)
{ {
int rv = OK; int rv = OK;
if ( (type & PROG_TYPE) && (type & DATA_TYPE) ) if ((type & PROG_TYPE) && (type & DATA_TYPE))
{ {
GetBus()->Erase(); GetBus()->Erase();
rv = Probe( probe || GetNoOfBank() == 0 ); rv = Probe(probe || GetNoOfBank() == 0);
} }
else else
{ {
@ -378,7 +378,7 @@ int At90sxx::Erase(int probe, int type)
int At90sxx::Read(int probe, int type) int At90sxx::Read(int probe, int type)
{ {
int rv = Probe( probe || GetNoOfBank() == 0 ); int rv = Probe(probe || GetNoOfBank() == 0);
if (rv > 0) if (rv > 0)
{ {
@ -402,10 +402,10 @@ int At90sxx::Read(int probe, int type)
if (type & CONFIG_TYPE) if (type & CONFIG_TYPE)
{ {
// read the fuses // read the fuses
uint32_t f = GetBus()->ReadFuseBits( GetAWInfo()->GetEEPId() ); uint32_t f = GetBus()->ReadFuseBits(GetAWInfo()->GetEEPId());
GetAWInfo()->SetFuseBits(f); GetAWInfo()->SetFuseBits(f);
f = GetBus()->ReadLockBits( GetAWInfo()->GetEEPId() ); f = GetBus()->ReadLockBits(GetAWInfo()->GetEEPId());
GetAWInfo()->SetLockBits(f); GetAWInfo()->SetLockBits(f);
} }
} }
@ -418,12 +418,12 @@ int At90sxx::Read(int probe, int type)
int At90sxx::Write(int probe, int type) int At90sxx::Write(int probe, int type)
{ {
// if ( (type & PROG_TYPE) && (type & DATA_TYPE) ) // if ( (type & PROG_TYPE) && (type & DATA_TYPE) )
if ( (type & PROG_TYPE) ) //Because to write the flash we must erase ALL the device (a msg may alert that doing so the DATA may be erased too) if ((type & PROG_TYPE)) //Because to write the flash we must erase ALL the device (a msg may alert that doing so the DATA may be erased too)
{ {
GetBus()->Erase(); GetBus()->Erase();
} }
int rv = Probe( probe || GetNoOfBank() == 0 ); int rv = Probe(probe || GetNoOfBank() == 0);
if (rv > 0) if (rv > 0)
{ {
@ -446,7 +446,7 @@ int At90sxx::Write(int probe, int type)
{ {
if (type & CONFIG_TYPE) if (type & CONFIG_TYPE)
{ {
if ( GetAWInfo()->GetEEPId() == AT90S4433 || GetAWInfo()->GetEEPId() == AT90S2333 ) if (GetAWInfo()->GetEEPId() == AT90S4433 || GetAWInfo()->GetEEPId() == AT90S2333)
{ {
//write the locks //write the locks
uint32_t f = GetAWInfo()->GetLockBits(); uint32_t f = GetAWInfo()->GetLockBits();
@ -510,10 +510,10 @@ int At90sxx::Verify(int type)
if (type & CONFIG_TYPE) if (type & CONFIG_TYPE)
{ {
// read the fuses & locks // read the fuses & locks
uint32_t f = GetBus()->ReadFuseBits(GetAWInfo()->GetEEPId() ); uint32_t f = GetBus()->ReadFuseBits(GetAWInfo()->GetEEPId());
uint32_t l = GetBus()->ReadLockBits(GetAWInfo()->GetEEPId() ); uint32_t l = GetBus()->ReadLockBits(GetAWInfo()->GetEEPId());
if ( GetAWInfo()->GetLockBits() == l && GetAWInfo()->GetFuseBits() == f ) if (GetAWInfo()->GetLockBits() == l && GetAWInfo()->GetFuseBits() == f)
{ {
v_config = OK; v_config = OK;
} }

View File

@ -38,7 +38,7 @@
class At90sxx : public Device class At90sxx : public Device
{ {
public: //---------------------------------------- public public: //---------------------------------------- public
At90sxx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0); At90sxx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
virtual ~At90sxx(); virtual ~At90sxx();
@ -61,11 +61,11 @@ public: //---------------------------------------- public
return (At90sBus *)Device::GetBus(); return (At90sBus *)Device::GetBus();
} }
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
int QueryType(long &type); int QueryType(long &type);
private: //--------------------------------------- private private: //--------------------------------------- private
}; };
#endif #endif

View File

@ -178,8 +178,8 @@ long At93cBus::Read(int addr, uint8_t *data, long length, int page_size)
*data++ = (uint8_t)(val & 0xFF); *data++ = (uint8_t)(val & 0xFF);
} }
if ( (len % 4) == 0 ) if ((len % 4) == 0)
if ( CheckAbort(len * 100 / length) ) if (CheckAbort(len * 100 / length))
{ {
break; break;
} }
@ -241,7 +241,7 @@ long At93cBus::Write(int addr, uint8_t const *data, long length, int page_size)
#if 1 #if 1
if ( WaitReadyAfterWrite(loop_timeout) ) if (WaitReadyAfterWrite(loop_timeout))
{ {
return 0; //- 07/08/99 a number >0 but != length mean "User abort" return 0; //- 07/08/99 a number >0 but != length mean "User abort"
} }
@ -252,8 +252,8 @@ long At93cBus::Write(int addr, uint8_t const *data, long length, int page_size)
clearCS(); clearCS();
setCS(); setCS();
if ( (curaddr & 1) ) if ((curaddr & 1))
if ( CheckAbort(curaddr * 100 / length) ) if (CheckAbort(curaddr * 100 / length))
{ {
break; break;
} }

View File

@ -34,7 +34,7 @@
class At93cBus : public MicroWireBus class At93cBus : public MicroWireBus
{ {
public: //------------------------------- public public: //------------------------------- public
At93cBus(BusInterface *ptr = 0); At93cBus(BusInterface *ptr = 0);
// virtual ~At93cBus(); // virtual ~At93cBus();
@ -61,14 +61,14 @@ public: //------------------------------- public
} }
protected: //------------------------------- protected protected: //------------------------------- protected
int SendCmdOpcode(int opcode) int SendCmdOpcode(int opcode)
{ {
return SendDataWord(opcode, 3); return SendDataWord(opcode, 3);
} }
private: //------------------------------- private private: //------------------------------- private
//Command Opcode //Command Opcode
const uint8_t ReadCode; const uint8_t ReadCode;

View File

@ -148,7 +148,7 @@ int At93cxx::Verify(int type)
} }
else else
{ {
rval = ( memcmp(GetBufPtr(), localbuf, size) != 0 ) ? 0 : 1; rval = (memcmp(GetBufPtr(), localbuf, size) != 0) ? 0 : 1;
} }
} }

View File

@ -39,7 +39,7 @@
class At93cxx : public Device class At93cxx : public Device
{ {
public: //---------------------------------------- public public: //---------------------------------------- public
At93cxx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0); At93cxx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
virtual ~At93cxx(); virtual ~At93cxx();
@ -49,14 +49,14 @@ public: //---------------------------------------- public
int Write(int probe = 1, int type = ALL_TYPE); int Write(int probe = 1, int type = ALL_TYPE);
int Verify(int type = ALL_TYPE); int Verify(int type = ALL_TYPE);
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
At93cBus *GetBus() At93cBus *GetBus()
{ {
return (At93cBus *)Device::GetBus(); return (At93cBus *)Device::GetBus();
} }
private: //--------------------------------------- private private: //--------------------------------------- private
}; };
#endif #endif

View File

@ -158,7 +158,7 @@ int At93cxx8::Verify(int type)
} }
else else
{ {
rval = ( memcmp(GetBufPtr(), localbuf, size) != 0 ) ? 0 : 1; rval = (memcmp(GetBufPtr(), localbuf, size) != 0) ? 0 : 1;
} }
} }

View File

@ -37,7 +37,7 @@
class At93cxx8 : public Device class At93cxx8 : public Device
{ {
public: //---------------------------------------- public public: //---------------------------------------- public
At93cxx8(e2AppWinInfo *wininfo = 0, BusIO *busp = 0); At93cxx8(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
virtual ~At93cxx8(); virtual ~At93cxx8();
@ -47,14 +47,14 @@ public: //---------------------------------------- public
int Write(int probe = 1, int type = ALL_TYPE); int Write(int probe = 1, int type = ALL_TYPE);
int Verify(int type = ALL_TYPE); int Verify(int type = ALL_TYPE);
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
At93cBus *GetBus() At93cBus *GetBus()
{ {
return (At93cBus *)Device::GetBus(); return (At93cBus *)Device::GetBus();
} }
private: //--------------------------------------- private private: //--------------------------------------- private
}; };
#endif #endif

View File

@ -107,14 +107,14 @@ int binFileBuf::Load(int loadtype, long relocation_offset)
QDataStream datastream(&fh); QDataStream datastream(&fh);
rval = datastream.readRawData( (char*)ptr, fsize); rval = datastream.readRawData((char *)ptr, fsize);
fh.close(); fh.close();
// SetStringID(""); //???? // SetStringID(""); //????
SetComment(""); SetComment("");
SetRollOver(0); //2 (che significa NO) ?? SetRollOver(0); //2 (che significa NO) ??
SetCRC( mcalc_crc(GetBufPtr(), GetBlockSize() * GetNoOfBlock()) ); SetCRC(mcalc_crc(GetBufPtr(), GetBlockSize() * GetNoOfBlock()));
// rval = GetNoOfBlock(); // rval = GetNoOfBlock();
@ -167,7 +167,7 @@ int binFileBuf::Save(int savetype, long relocation_offset)
} }
QDataStream datastream(&fh); QDataStream datastream(&fh);
rval = datastream.writeRawData((const char*) ptr, buf_size); rval = datastream.writeRawData((const char *) ptr, buf_size);
if (rval == 0) if (rval == 0)
{ {

View File

@ -38,7 +38,7 @@
class binFileBuf : public FileBuf class binFileBuf : public FileBuf
{ {
public: //---------------------------------------- public public: //---------------------------------------- public
binFileBuf(e2AppWinInfo *wininfo = 0); binFileBuf(e2AppWinInfo *wininfo = 0);
virtual ~binFileBuf(); virtual ~binFileBuf();
@ -46,9 +46,9 @@ public: //---------------------------------------- public
virtual int Load(int loadtype = ALL_TYPE, long relocation_offset = 0); virtual int Load(int loadtype = ALL_TYPE, long relocation_offset = 0);
virtual int Save(int savetype = ALL_TYPE, long relocation_offset = 0); virtual int Save(int savetype = ALL_TYPE, long relocation_offset = 0);
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
private: //--------------------------------------- private private: //--------------------------------------- private
}; };
#endif #endif

View File

@ -38,7 +38,7 @@
class BusInterface class BusInterface
{ {
public: //------------------------------- public public: //------------------------------- public
BusInterface() BusInterface()
{ {
cmd2cmd_delay = 0; cmd2cmd_delay = 0;
@ -73,14 +73,14 @@ public: //------------------------------- public
qDebug() << "BusInterface::TestSave(" << port << ") IN"; qDebug() << "BusInterface::TestSave(" << port << ") IN";
if ( (old_portno = installed) ) if ((old_portno = installed))
{ {
// old_cpreg = cpreg; // old_cpreg = cpreg;
} }
Close(); Close();
if ( (ret_val = Open(port)) == OK ) if ((ret_val = Open(port)) == OK)
{ {
} }
@ -149,7 +149,7 @@ public: //------------------------------- public
return installed; return installed;
} }
protected: //------------------------------- protected protected: //------------------------------- protected
void Install(int val) void Install(int val)
{ {
installed = val; installed = val;
@ -157,7 +157,7 @@ protected: //------------------------------- protected
int old_portno; // TestSave() save the status here int old_portno; // TestSave() save the status here
private: //------------------------------- private private: //------------------------------- private
int installed; // 0 --> not installed, <> 0 number if the installed port int installed; // 0 --> not installed, <> 0 number if the installed port
int cmd2cmd_delay; // <> 0 if a delay between commands is needed int cmd2cmd_delay; // <> 0 if a delay between commands is needed
}; };

View File

@ -48,8 +48,8 @@ int BusIO::CheckAbort(int progress)
if (!abort) if (!abort)
{ {
if ( (progress == 0 && old_progress != 0) || if ((progress == 0 && old_progress != 0) ||
progress > old_progress + 4 ) progress > old_progress + 4)
{ {
cmdWin->SetProgress(progress); cmdWin->SetProgress(progress);
old_progress = progress; old_progress = progress;

View File

@ -38,7 +38,7 @@
//Formato di bus generico seriale //Formato di bus generico seriale
class BusIO : public Wait class BusIO : public Wait
{ {
public: //------------------------------- public public: //------------------------------- public
BusIO(BusInterface *p = 0); BusIO(BusInterface *p = 0);
// virtual ~BusIO() { } // virtual ~BusIO() { }
@ -152,7 +152,7 @@ public: //------------------------------- public
} }
} }
protected: //------------------------------- protected protected: //------------------------------- protected
int err_no; //error code int err_no; //error code
int last_addr; int last_addr;
@ -161,7 +161,7 @@ protected: //------------------------------- protected
BusInterface *busI; BusInterface *busI;
private: //------------------------------- private private: //------------------------------- private
int old_progress; int old_progress;
long last_programmed_addr; //record last programmed address for verify long last_programmed_addr; //record last programmed address for verify

View File

@ -24,7 +24,7 @@ uint16_t fcalc_crc(QFile &fh, long ini_ofs, long len)
} }
else else
{ {
while (fh.read( &ch, 1) > 0) //while( (ch = getc(fh)) != EOF ) while (fh.read(&ch, 1) > 0) //while( (ch = getc(fh)) != EOF )
{ {
crc16 = updcrcr(crc16, ch); crc16 = updcrcr(crc16, ch);
} }

View File

@ -73,15 +73,15 @@ int csmFileBuf::Load(int loadtype, long relocation_offfset)
case 0: case 0:
//look for header start //look for header start
if ( (s = strchr(riga, '\"')) != NULL ) if ((s = strchr(riga, '\"')) != NULL)
{ {
state++; state++;
if ( (s = strstr(s + 1, "REFERENCE")) != NULL ) if ((s = strstr(s + 1, "REFERENCE")) != NULL)
{ {
state++; state++;
if ( (s = strchr(s + 1, '\"')) != NULL ) if ((s = strchr(s + 1, '\"')) != NULL)
{ {
state++; state++;
} }
@ -93,11 +93,11 @@ int csmFileBuf::Load(int loadtype, long relocation_offfset)
case 1: case 1:
//look for "REFERENCE" //look for "REFERENCE"
if ( (s = strstr(riga, "REFERENCE")) != NULL ) if ((s = strstr(riga, "REFERENCE")) != NULL)
{ {
state++; state++;
if ( (s = strchr(s + 1, '\"')) != NULL ) if ((s = strchr(s + 1, '\"')) != NULL)
{ {
state++; state++;
} }
@ -108,7 +108,7 @@ int csmFileBuf::Load(int loadtype, long relocation_offfset)
case 2: case 2:
//look for header terminator //look for header terminator
if ( (s = strchr(riga, '\"')) != NULL ) if ((s = strchr(riga, '\"')) != NULL)
{ {
state++; state++;
} }
@ -150,7 +150,7 @@ int csmFileBuf::Load(int loadtype, long relocation_offfset)
//carica valore nel buffer //carica valore nel buffer
if (loadtype == ALL_TYPE) if (loadtype == ALL_TYPE)
{ {
if ( addr < FileBuf::GetBufSize() ) if (addr < FileBuf::GetBufSize())
{ {
FileBuf::GetBufPtr()[addr] = (uint8_t)value; FileBuf::GetBufPtr()[addr] = (uint8_t)value;
} }
@ -159,12 +159,12 @@ int csmFileBuf::Load(int loadtype, long relocation_offfset)
{ {
long s = FileBuf::GetSplitted(); long s = FileBuf::GetSplitted();
if ( s <= 0 ) if (s <= 0)
{ {
s = FileBuf::GetBufSize(); s = FileBuf::GetBufSize();
} }
if ( addr < s ) if (addr < s)
{ {
FileBuf::GetBufPtr()[addr] = (uint8_t)value; FileBuf::GetBufPtr()[addr] = (uint8_t)value;
} }
@ -173,12 +173,12 @@ int csmFileBuf::Load(int loadtype, long relocation_offfset)
{ {
long s = FileBuf::GetSplitted(); long s = FileBuf::GetSplitted();
if ( s <= 0 ) if (s <= 0)
{ {
s = 0; s = 0;
} }
if ( addr < FileBuf::GetBufSize() - s ) if (addr < FileBuf::GetBufSize() - s)
{ {
FileBuf::GetBufPtr()[addr + s] = (uint8_t)value; FileBuf::GetBufPtr()[addr + s] = (uint8_t)value;
} }
@ -254,7 +254,7 @@ int csmFileBuf::Save(int savetype, long relocation_offfset)
{ {
QFile fh(FileBuf::GetFileName()); QFile fh(FileBuf::GetFileName());
if (!fh.open(QIODevice::WriteOnly | QIODevice::Text )) if (!fh.open(QIODevice::WriteOnly | QIODevice::Text))
{ {
rval = CREATEERROR; rval = CREATEERROR;
} }

View File

@ -39,7 +39,7 @@
class csmFileBuf : public FileBuf class csmFileBuf : public FileBuf
{ {
public: //---------------------------------------- public public: //---------------------------------------- public
csmFileBuf(e2AppWinInfo *wininfo = 0); csmFileBuf(e2AppWinInfo *wininfo = 0);
// virtual ~csmFileBuf(); // virtual ~csmFileBuf();
@ -47,9 +47,9 @@ public: //---------------------------------------- public
virtual int Load(int loadtype = ALL_TYPE, long relocation_offfset = 0); virtual int Load(int loadtype = ALL_TYPE, long relocation_offfset = 0);
virtual int Save(int savetype = ALL_TYPE, long relocation_offfset = 0); virtual int Save(int savetype = ALL_TYPE, long relocation_offfset = 0);
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
private: //--------------------------------------- private private: //--------------------------------------- private
}; };
#endif #endif

View File

@ -178,7 +178,7 @@ int Device::ReadData()
retval = GetBus()->Read(1, GetBufPtr() + base, size, read_datapage_size); retval = GetBus()->Read(1, GetBufPtr() + base, size, read_datapage_size);
if ( retval != size ) if (retval != size)
{ {
if (retval > 0) if (retval > 0)
{ {
@ -199,7 +199,7 @@ int Device::WriteProg()
GetBus()->ClearLastProgrammedAddress(); GetBus()->ClearLastProgrammedAddress();
rv = GetBus()->Write(0, GetBufPtr() + base, size, write_progpage_size); rv = GetBus()->Write(0, GetBufPtr() + base, size, write_progpage_size);
if ( rv != size ) if (rv != size)
{ {
if (rv > 0) if (rv > 0)
{ {
@ -219,7 +219,7 @@ int Device::WriteData()
rv = GetBus()->Write(1, GetBufPtr() + base, size, write_datapage_size); rv = GetBus()->Write(1, GetBufPtr() + base, size, write_datapage_size);
if ( rv != size ) if (rv != size)
{ {
if (rv > 0) if (rv > 0)
{ {
@ -239,7 +239,7 @@ int Device::VerifyProg(unsigned char *localbuf)
//Verify only programmed bytes (to save time in big devices) //Verify only programmed bytes (to save time in big devices)
long v_len = size; long v_len = size;
if ( GetBus()->GetLastProgrammedAddress() > 0 && GetBus()->GetLastProgrammedAddress() < size ) if (GetBus()->GetLastProgrammedAddress() > 0 && GetBus()->GetLastProgrammedAddress() < size)
{ {
v_len = GetBus()->GetLastProgrammedAddress() + 1; v_len = GetBus()->GetLastProgrammedAddress() + 1;
GetBus()->ClearLastProgrammedAddress(); //reset last_programmed_addr, so next verify not preceeded by write verify all the flash GetBus()->ClearLastProgrammedAddress(); //reset last_programmed_addr, so next verify not preceeded by write verify all the flash
@ -258,7 +258,7 @@ int Device::VerifyProg(unsigned char *localbuf)
rval = GetBus()->Read(0, localbuf, v_len, 0); rval = GetBus()->Read(0, localbuf, v_len, 0);
} }
if ( rval != v_len ) if (rval != v_len)
{ {
if (rval > 0) if (rval > 0)
{ {
@ -282,7 +282,7 @@ int Device::VerifyData(unsigned char *localbuf)
//read current EEPROM content and //read current EEPROM content and
rval = GetBus()->Read(1, localbuf + base, size, read_datapage_size); rval = GetBus()->Read(1, localbuf + base, size, read_datapage_size);
if ( rval != size ) if (rval != size)
{ {
if (rval > 0) if (rval > 0)
{ {

View File

@ -40,7 +40,7 @@ class e2AppWinInfo;
class Device class Device
{ {
public: //---------------------------------------- public public: //---------------------------------------- public
Device(e2AppWinInfo *wininfo = 0, BusIO *busp = 0, int b_size = 0); Device(e2AppWinInfo *wininfo = 0, BusIO *busp = 0, int b_size = 0);
virtual ~Device(); virtual ~Device();
@ -138,7 +138,7 @@ public: //---------------------------------------- public
return detected_signature.toLatin1(); return detected_signature.toLatin1();
} }
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
void SetBankSize(int size) void SetBankSize(int size)
{ {
if (size > 0) if (size > 0)
@ -171,7 +171,7 @@ protected: //--------------------------------------- protected
long detected_type; long detected_type;
QString detected_signature; QString detected_signature;
private: //--------------------------------------- private private: //--------------------------------------- private
e2AppWinInfo *awi; // pointer to container object e2AppWinInfo *awi; // pointer to container object
BusIO *bus; // bus used by the device BusIO *bus; // bus used by the device

View File

@ -114,7 +114,7 @@ int Dt006Interface::Open(int port_no)
if (IsInstalled() != port_no) if (IsInstalled() != port_no)
{ {
if ( InDataPort(port_no) < 0 ) if (InDataPort(port_no) < 0)
{ {
ret_val = E2ERR_OPENFAILED; ret_val = E2ERR_OPENFAILED;
} }

View File

@ -34,7 +34,7 @@
class Dt006Interface : public LptExtInterface class Dt006Interface : public LptExtInterface
{ {
public: //------------------------------- public public: //------------------------------- public
Dt006Interface(bool use_io = false); Dt006Interface(bool use_io = false);
virtual int Open(int port_no); virtual int Open(int port_no);
@ -54,9 +54,9 @@ public: //------------------------------- public
int SetPower(int onoff); int SetPower(int onoff);
void SetControlLine(int res = 1); void SetControlLine(int res = 1);
protected: //------------------------------- protected protected: //------------------------------- protected
private: //------------------------------- private private: //------------------------------- private
// int GetPresence(); // int GetPresence();
}; };

View File

@ -59,7 +59,7 @@ int mE2401::Probe(int probe_size)
{ {
retval = GetBus()->Error(); retval = GetBus()->Error();
if ( retval == IICERR_NOADDRACK ) if (retval == IICERR_NOADDRACK)
{ {
retval = 0; retval = 0;
} }
@ -103,7 +103,7 @@ int mE2401::Read(int probe, int type)
return GetBus()->Error(); return GetBus()->Error();
} }
if ( GetBus()->CheckAbort((k + 1) * 100 / size) ) if (GetBus()->CheckAbort((k + 1) * 100 / size))
{ {
return OP_ABORTED; return OP_ABORTED;
} }
@ -135,7 +135,7 @@ int mE2401::Write(int probe, int type)
for (j = 0; j < size; j += writepage_size) for (j = 0; j < size; j += writepage_size)
{ {
if ( GetBus()->Write(j, GetBufPtr() + j, writepage_size) != writepage_size) if (GetBus()->Write(j, GetBufPtr() + j, writepage_size) != writepage_size)
{ {
return GetBus()->Error(); return GetBus()->Error();
} }
@ -150,7 +150,7 @@ int mE2401::Write(int probe, int type)
return E2P_TIMEOUT; return E2P_TIMEOUT;
} }
if ( GetBus()->CheckAbort((j + 1) * 100 / size) ) if (GetBus()->CheckAbort((j + 1) * 100 / size))
{ {
return OP_ABORTED; return OP_ABORTED;
} }
@ -199,7 +199,7 @@ int mE2401::Verify(int type)
break; break;
} }
if ( GetBus()->CheckAbort((k + 1) * 100 / size) ) if (GetBus()->CheckAbort((k + 1) * 100 / size))
{ {
rval = OP_ABORTED; rval = OP_ABORTED;
break; break;
@ -207,7 +207,7 @@ int mE2401::Verify(int type)
} }
} }
if ( memcmp(GetBufPtr(), localbuf, size) != 0 ) if (memcmp(GetBufPtr(), localbuf, size) != 0)
{ {
rval = 0; rval = 0;
} }

View File

@ -38,7 +38,7 @@
class mE2401 : public Device class mE2401 : public Device
{ {
public: //---------------------------------------- public public: //---------------------------------------- public
mE2401(e2AppWinInfo *wininfo = 0, BusIO *busp = 0, int def_banksize = 128); mE2401(e2AppWinInfo *wininfo = 0, BusIO *busp = 0, int def_banksize = 128);
// virtual ~mE2401(); // virtual ~mE2401();
@ -48,7 +48,7 @@ public: //---------------------------------------- public
int Write(int probe = 1, int type = ALL_TYPE); int Write(int probe = 1, int type = ALL_TYPE);
int Verify(int type = ALL_TYPE); int Verify(int type = ALL_TYPE);
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
int const timeout_loop; //eeprom timeout int const timeout_loop; //eeprom timeout
@ -61,7 +61,7 @@ protected: //--------------------------------------- protected
int sequential_read; //1 --> legge un banco in una volta int sequential_read; //1 --> legge un banco in una volta
int writepage_size; //se > 1 scrive una pagina alla volta int writepage_size; //se > 1 scrive una pagina alla volta
private: //--------------------------------------- private private: //--------------------------------------- private
}; };
#endif #endif

View File

@ -37,7 +37,7 @@
class E24xx1 : public E24xx class E24xx1 : public E24xx
{ {
public: //---------------------------------------- public public: //---------------------------------------- public
E24xx1(e2AppWinInfo *wininfo = 0, BusIO *busp = 0); E24xx1(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
virtual ~E24xx1(); virtual ~E24xx1();
@ -47,9 +47,9 @@ public: //---------------------------------------- public
// int Write(int probe = 1, int type = ALL_TYPE); // int Write(int probe = 1, int type = ALL_TYPE);
// int Verify(int type = ALL_TYPE); // int Verify(int type = ALL_TYPE);
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
private: //--------------------------------------- private private: //--------------------------------------- private
}; };

View File

@ -69,7 +69,7 @@ int E24xx2::Probe(int probe_size)
int E24xx2::Write(int probe, int type) int E24xx2::Write(int probe, int type)
{ {
int error = Probe( probe || GetNoOfBank() == 0 ); int error = Probe(probe || GetNoOfBank() == 0);
if (error < 0) if (error < 0)
{ {
@ -102,9 +102,9 @@ int E24xx2::Write(int probe, int type)
memcpy(localbuf + 2, GetBufPtr() + j, writepage_size); memcpy(localbuf + 2, GetBufPtr() + j, writepage_size);
localbuf[0] = (uint8_t)((j >> 8) & 0xFF); localbuf[0] = (uint8_t)((j >> 8) & 0xFF);
localbuf[1] = (uint8_t)( j & 0xFF ); localbuf[1] = (uint8_t)(j & 0xFF);
if ( GetBus()->Write(eeprom_addr[0], localbuf, 2 + writepage_size) != (2 + writepage_size) ) if (GetBus()->Write(eeprom_addr[0], localbuf, 2 + writepage_size) != (2 + writepage_size))
{ {
rval = GetBus()->Error(); rval = GetBus()->Error();
break; break;
@ -121,7 +121,7 @@ int E24xx2::Write(int probe, int type)
break; break;
} }
if ( GetBus()->CheckAbort(j * 100 / size) ) if (GetBus()->CheckAbort(j * 100 / size))
{ {
rval = OP_ABORTED; rval = OP_ABORTED;
break; break;
@ -145,7 +145,7 @@ int E24xx2::Write(int probe, int type)
int E24xx2::Read(int probe, int type) int E24xx2::Read(int probe, int type)
{ {
int error = Probe( probe || GetNoOfBank() == 0 ); int error = Probe(probe || GetNoOfBank() == 0);
if (error < 0) if (error < 0)
{ {
@ -168,7 +168,7 @@ int E24xx2::Read(int probe, int type)
//Scrive l'indice del sottoindirizzamento //Scrive l'indice del sottoindirizzamento
// partiamo sempre da 0. // partiamo sempre da 0.
index[0] = (uint8_t)((k >> 8) & 0xFF); index[0] = (uint8_t)((k >> 8) & 0xFF);
index[1] = (uint8_t)( k & 0xFF ); index[1] = (uint8_t)(k & 0xFF);
if (GetBus()->StartWrite(eeprom_addr[0], index, 2) != 2) if (GetBus()->StartWrite(eeprom_addr[0], index, 2) != 2)
{ {
@ -182,7 +182,7 @@ int E24xx2::Read(int probe, int type)
break; break;
} }
if ( GetBus()->CheckAbort(k * 100 / size) ) if (GetBus()->CheckAbort(k * 100 / size))
{ {
error = OP_ABORTED; error = OP_ABORTED;
break; break;
@ -234,7 +234,7 @@ int E24xx2::Verify(int type)
//Scrive l'indice del sottoindirizzamento //Scrive l'indice del sottoindirizzamento
// partiamo sempre da 0. // partiamo sempre da 0.
index[0] = (uint8_t)((k >> 8) & 0xFF); index[0] = (uint8_t)((k >> 8) & 0xFF);
index[1] = (uint8_t)( k & 0xFF ); index[1] = (uint8_t)(k & 0xFF);
if (GetBus()->StartWrite(eeprom_addr[0], index, 2) != 2) if (GetBus()->StartWrite(eeprom_addr[0], index, 2) != 2)
{ {
@ -248,13 +248,13 @@ int E24xx2::Verify(int type)
break; break;
} }
if ( memcmp(GetBufPtr() + k, localbuf, readpage_size) != 0 ) if (memcmp(GetBufPtr() + k, localbuf, readpage_size) != 0)
{ {
rval = 0; rval = 0;
break; break;
} }
if ( GetBus()->CheckAbort(k * 100 / size) ) if (GetBus()->CheckAbort(k * 100 / size))
{ {
rval = OP_ABORTED; rval = OP_ABORTED;
break; break;
@ -288,14 +288,14 @@ int E24xx2::SecurityRead(uint32_t &blocks)
int val; int val;
if ( (val = GetBus()->ReadByte(0)) < 0 ) if ((val = GetBus()->ReadByte(0)) < 0)
{ {
return GetBus()->Error(); return GetBus()->Error();
} }
blocks = (val << 4) & 0xF0; blocks = (val << 4) & 0xF0;
if ( (val = GetBus()->ReadByte(1)) < 0 ) if ((val = GetBus()->ReadByte(1)) < 0)
{ {
return GetBus()->Error(); return GetBus()->Error();
} }
@ -363,7 +363,7 @@ int E24xx2::HighEnduranceRead(uint32_t &block_no)
int val; int val;
if ( (val = GetBus()->ReadByte(1)) < 0 ) if ((val = GetBus()->ReadByte(1)) < 0)
{ {
return GetBus()->Error(); return GetBus()->Error();
} }

View File

@ -35,7 +35,7 @@
class E24xx2 : public E24xx class E24xx2 : public E24xx
{ {
public: //---------------------------------------- public public: //---------------------------------------- public
E24xx2(e2AppWinInfo *wininfo = 0, BusIO *busp = 0); E24xx2(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
// virtual ~E24xx2(); // virtual ~E24xx2();
@ -52,9 +52,9 @@ public: //---------------------------------------- public
int HighEnduranceRead(uint32_t &block_no); int HighEnduranceRead(uint32_t &block_no);
int HighEnduranceWrite(uint32_t block_no); int HighEnduranceWrite(uint32_t block_no);
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
private: //--------------------------------------- private private: //--------------------------------------- private
int const SecurityReadCode; int const SecurityReadCode;
int const SecurityWriteCode; int const SecurityWriteCode;

View File

@ -34,7 +34,7 @@
class E24xx5 : public E24xx class E24xx5 : public E24xx
{ {
public: //---------------------------------------- public public: //---------------------------------------- public
E24xx5(e2AppWinInfo *wininfo = 0, BusIO *busp = 0); E24xx5(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
virtual ~E24xx5(); virtual ~E24xx5();
@ -44,12 +44,12 @@ public: //---------------------------------------- public
virtual int Write(int probe = 1, int type = ALL_TYPE); virtual int Write(int probe = 1, int type = ALL_TYPE);
// int Verify(int type = ALL_TYPE); // int Verify(int type = ALL_TYPE);
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
// int bank_out(uint8_t const *copy_buf, int bank_no, long size = -1); // int bank_out(uint8_t const *copy_buf, int bank_no, long size = -1);
// int bank_in(uint8_t *copy_buf, int bank_no, long size = -1); // int bank_in(uint8_t *copy_buf, int bank_no, long size = -1);
private: //--------------------------------------- private private: //--------------------------------------- private
}; };
#endif #endif

View File

@ -82,7 +82,7 @@ int E24xx::Probe(int probe_size)
{ {
if (GetBus()->Read(addr, &ch, 1) != 1) if (GetBus()->Read(addr, &ch, 1) != 1)
{ {
if ( (error = GetBus()->Error()) != IICERR_NOADDRACK ) if ((error = GetBus()->Error()) != IICERR_NOADDRACK)
{ {
// GetBus()->Open(E2Profile::GetPort()); // GetBus()->Open(E2Profile::GetPort());
return error; return error;
@ -107,7 +107,7 @@ int E24xx::Probe(int probe_size)
int E24xx::Read(int probe, int type) int E24xx::Read(int probe, int type)
{ {
int error = Probe( probe || GetNoOfBank() == 0 ); int error = Probe(probe || GetNoOfBank() == 0);
if (error < 0) if (error < 0)
{ {
@ -127,13 +127,13 @@ int E24xx::Read(int probe, int type)
// capacita` correntemente selezionata // capacita` correntemente selezionata
for (k = 0; k < n_bank; k++) for (k = 0; k < n_bank; k++)
{ {
if ( (error = bank_in(GetBufPtr() + k * GetBankSize(), k)) ) if ((error = bank_in(GetBufPtr() + k * GetBankSize(), k)))
{ {
// GetBus()->Open(E2Profile::GetPort()); //ormai obsoleta // GetBus()->Open(E2Profile::GetPort()); //ormai obsoleta
return error; return error;
} }
if ( GetBus()->CheckAbort((k + 1) * 100 / n_bank) ) if (GetBus()->CheckAbort((k + 1) * 100 / n_bank))
{ {
return OP_ABORTED; return OP_ABORTED;
} }
@ -154,7 +154,7 @@ int E24xx::Read(int probe, int type)
int E24xx::Write(int probe, int type) int E24xx::Write(int probe, int type)
{ {
int error = Probe( probe || GetNoOfBank() == 0 ); int error = Probe(probe || GetNoOfBank() == 0);
if (error < 0) if (error < 0)
{ {
@ -170,13 +170,13 @@ int E24xx::Write(int probe, int type)
for (k = 0; k < GetNoOfBank(); k++) for (k = 0; k < GetNoOfBank(); k++)
{ {
if ( (error = bank_out(GetBufPtr() + k * GetBankSize(), k)) ) if ((error = bank_out(GetBufPtr() + k * GetBankSize(), k)))
{ {
// GetBus()->Open(E2Profile::GetPort()); // GetBus()->Open(E2Profile::GetPort());
return error; return error;
} }
if ( GetBus()->CheckAbort((k + 1) * 100 / GetNoOfBank()) ) if (GetBus()->CheckAbort((k + 1) * 100 / GetNoOfBank()))
{ {
return OP_ABORTED; return OP_ABORTED;
} }
@ -217,20 +217,20 @@ int E24xx::Verify(int type)
{ {
int error; int error;
if ( (error = bank_in(localbuf, k)) ) if ((error = bank_in(localbuf, k)))
{ {
// GetBus()->Open(E2Profile::GetPort()); // GetBus()->Open(E2Profile::GetPort());
rval = error; rval = error;
break; break;
} }
if ( memcmp(GetBufPtr() + k * GetBankSize(), localbuf, GetBankSize()) != 0 ) if (memcmp(GetBufPtr() + k * GetBankSize(), localbuf, GetBankSize()) != 0)
{ {
rval = 0; rval = 0;
break; break;
} }
if ( GetBus()->CheckAbort((k + 1) * 100 / GetNoOfBank()) ) if (GetBus()->CheckAbort((k + 1) * 100 / GetNoOfBank()))
{ {
rval = OP_ABORTED; rval = OP_ABORTED;
break; break;
@ -399,12 +399,12 @@ int E24xx::BankRollOverDetect(int force)
#else #else
int error; int error;
if ( (error = bank_in(buf1, 0, CMP_LEN)) ) if ((error = bank_in(buf1, 0, CMP_LEN)))
{ {
return error; return error;
} }
if ( (error = bank_in(buf2, 1, CMP_LEN)) ) if ((error = bank_in(buf2, 1, CMP_LEN)))
{ {
return error; return error;
} }
@ -431,7 +431,7 @@ int E24xx::BankRollOverDetect(int force)
#else #else
if ( (error = bank_in(buf, 0, CMP_LEN + 1, GetBankSize() - 1)) ) if ((error = bank_in(buf, 0, CMP_LEN + 1, GetBankSize() - 1)))
{ {
return error; return error;
} }

View File

@ -46,7 +46,7 @@ class e2AppWinInfo;
class E24xx : public Device class E24xx : public Device
{ {
public: //---------------------------------------- public public: //---------------------------------------- public
E24xx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0, int max_no_of_bank = 8, int def_banksize = BANK_SIZE); E24xx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0, int max_no_of_bank = 8, int def_banksize = BANK_SIZE);
virtual ~E24xx(); virtual ~E24xx();
@ -60,7 +60,7 @@ public: //---------------------------------------- public
int const max_bank; // max number of banks (max eeprom size) int const max_bank; // max number of banks (max eeprom size)
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
int const timeout_loop; //eeprom timeout int const timeout_loop; //eeprom timeout
@ -82,7 +82,7 @@ protected: //--------------------------------------- protected
int sequential_read; //1 --> legge un banco in una volta int sequential_read; //1 --> legge un banco in una volta
int writepage_size; //se > 1 scrive una pagina alla volta int writepage_size; //se > 1 scrive una pagina alla volta
private: //--------------------------------------- private private: //--------------------------------------- private
}; };
#endif #endif

View File

@ -121,7 +121,7 @@ void e2App::initSettings()
// str = ""; // str = "";
sp = getenv("HOME"); sp = getenv("HOME");
if (sp.length() > 0 ) if (sp.length() > 0)
{ {
str = sp + "/"; str = sp + "/";
// strncpy(str, sp, MAXPATH - (strlen(APPNAME) + 5) ); // strncpy(str, sp, MAXPATH - (strlen(APPNAME) + 5) );
@ -148,7 +148,7 @@ void e2App::initSettings()
helpfile = progName + ".html"; helpfile = progName + ".html";
SetFileName(QString (progName + ".ini")); SetFileName(QString(progName + ".ini"));
QString currentAppDir = qApp->applicationDirPath(); QString currentAppDir = qApp->applicationDirPath();
@ -177,9 +177,9 @@ void e2App::initSettings()
{ {
str = sp2; str = sp2;
E2Profile::SetLanguageCode( str.toLatin1() ); E2Profile::SetLanguageCode(str.toLatin1());
if (str == "default" ) if (str == "default")
{ {
sp2 = ""; sp2 = "";
} }
@ -192,7 +192,7 @@ void e2App::initSettings()
sp2 = str; sp2 = str;
} }
setlocale(LC_ALL, sp2.toLatin1() ); setlocale(LC_ALL, sp2.toLatin1());
} }
// Read parameters from INI file // Read parameters from INI file
@ -201,10 +201,10 @@ void e2App::initSettings()
// EK 2017 // EK 2017
// TODO to remove the read/write because of QSettings? // TODO to remove the read/write because of QSettings?
SetInterfaceType( (HInterfaceType) E2Profile::GetParInterfType() ); SetInterfaceType((HInterfaceType) E2Profile::GetParInterfType());
SetPort( E2Profile::GetParPortNo() ); SetPort(E2Profile::GetParPortNo());
E2Profile::GetPowerUpDelay() ; // E2Profile::SetPowerUpDelay( E2Profile::GetPowerUpDelay() ); E2Profile::GetPowerUpDelay() ; // E2Profile::SetPowerUpDelay( E2Profile::GetPowerUpDelay() );
SetPolarity( E2Profile::GetPolarityControl() ); SetPolarity(E2Profile::GetPolarityControl());
E2Profile::GetSPIResetPulse();// E2Profile::SetSPIResetPulse( E2Profile::GetSPIResetPulse() ); E2Profile::GetSPIResetPulse();// E2Profile::SetSPIResetPulse( E2Profile::GetSPIResetPulse() );
E2Profile::GetSPIDelayAfterReset();// E2Profile::SetSPIDelayAfterReset( E2Profile::GetSPIDelayAfterReset() ); E2Profile::GetSPIDelayAfterReset();// E2Profile::SetSPIDelayAfterReset( E2Profile::GetSPIDelayAfterReset() );
E2Profile::GetSPIPageWrite();// E2Profile::SetSPIPageWrite( E2Profile::GetSPIPageWrite() ); E2Profile::GetSPIPageWrite();// E2Profile::SetSPIPageWrite( E2Profile::GetSPIPageWrite() );
@ -306,7 +306,7 @@ int e2App::OpenBus(BusIO *p)
qDebug() << "e2App::OpenBus() ** SetPower"; qDebug() << "e2App::OpenBus() ** SetPower";
//Power up delay //Power up delay
iniBus->WaitMsec( E2Profile::GetPowerUpDelay() ); iniBus->WaitMsec(E2Profile::GetPowerUpDelay());
qDebug() << "e2App::OpenBus() ** Reset"; qDebug() << "e2App::OpenBus() ** Reset";
@ -333,8 +333,8 @@ void e2App::SleepBus()
// TODO to remove this to init function // TODO to remove this to init function
#if 0 #if 0
//=====================>>> e2App::NewAppWin <<<========================== //=====================>>> e2App::NewAppWin <<<==========================
vWindow* e2App::NewAppWin(vWindow* win, char* name, vWindow *e2App::NewAppWin(vWindow *win, char *name,
int w, int h, vAppWinInfo* winInfo) int w, int h, vAppWinInfo *winInfo)
{ {
#ifdef WIN32 // Yes it's a dirty hack here but clean in Windows sense, heha 130406 #ifdef WIN32 // Yes it's a dirty hack here but clean in Windows sense, heha 130406
HKEY key; // But I wouldn't change the very incomplete V-lib source. HKEY key; // But I wouldn't change the very incomplete V-lib source.
@ -360,8 +360,8 @@ vWindow* e2App::NewAppWin(vWindow* win, char* name,
} }
#endif #endif
vWindow* thisWin = win; //local copy to use vWindow *thisWin = win; //local copy to use
vAppWinInfo* awinfo = winInfo; vAppWinInfo *awinfo = winInfo;
char *appname = name; char *appname = name;
if (!*name) if (!*name)
@ -381,7 +381,7 @@ vWindow* e2App::NewAppWin(vWindow* win, char* name,
if (!awinfo) if (!awinfo)
{ {
awinfo = new e2AppWinInfo((vCmdWindow*)thisWin, name, busvetp); awinfo = new e2AppWinInfo((vCmdWindow *)thisWin, name, busvetp);
} }
return vApp::NewAppWin(thisWin, appname, w, h, awinfo); return vApp::NewAppWin(thisWin, appname, w, h, awinfo);
@ -405,7 +405,7 @@ int e2App::Calibration()
#if 0 #if 0
// EK 2017 // EK 2017
//=====================>>> e2App::AppCommand <<<============================== //=====================>>> e2App::AppCommand <<<==============================
void e2App::AppCommand(vWindow* win, ItemVal id, ItemVal val, CmdType cType) void e2App::AppCommand(vWindow *win, ItemVal id, ItemVal val, CmdType cType)
{ {
// Commands not processed by the window will be passed here // Commands not processed by the window will be passed here
@ -417,7 +417,7 @@ void e2App::AppCommand(vWindow* win, ItemVal id, ItemVal val, CmdType cType)
//=========================>>> e2App::KeyIn <<<============================== //=========================>>> e2App::KeyIn <<<==============================
// EK 2017 key event filter // EK 2017 key event filter
#if 0 #if 0
void e2App::KeyIn(vWindow* win, vKey key, unsigned int shift) void e2App::KeyIn(vWindow *win, vKey key, unsigned int shift)
{ {
// Key strokes not processed by the window will be passed here // Key strokes not processed by the window will be passed here
@ -472,7 +472,7 @@ void e2App::SetInterfaceType(HInterfaceType type)
case JDM_API: case JDM_API:
iType = JDM_API; iType = JDM_API;
busIntp = &jdm_apiI; busIntp = &jdm_apiI;
jdm_apiI.SetCmd2CmdDelay( E2Profile::GetJDMCmd2CmdDelay() ); jdm_apiI.SetCmd2CmdDelay(E2Profile::GetJDMCmd2CmdDelay());
break; break;
// case JDM_IO: // case JDM_IO:
@ -566,7 +566,7 @@ void e2App::LookForBogoMips()
sum += ndel[k]; sum += ndel[k];
} }
E2Profile::SetBogoMips( (int)(sum / (500 * N_SAMPLE)) ); E2Profile::SetBogoMips((int)(sum / (500 * N_SAMPLE)));
#endif #endif
#ifdef _WINDOWS #ifdef _WINDOWS
@ -645,8 +645,8 @@ void e2App::LookForBogoMips()
{ {
int nv; int nv;
nv = (DWORD) ((float) GetBogoMips() * (MSLICE / (float)count) + 0.5); nv = (DWORD)((float) GetBogoMips() * (MSLICE / (float)count) + 0.5);
SetBogoMips( nv ); SetBogoMips(nv);
w.SetBogoKips(); w.SetBogoKips();
t0 = GetTickCount(); t0 = GetTickCount();
@ -666,8 +666,8 @@ void e2App::LookForBogoMips()
{ {
int nv; int nv;
nv = (DWORD) ((float) GetBogoMips() * 1.01 + 0.5); nv = (DWORD)((float) GetBogoMips() * 1.01 + 0.5);
SetBogoMips( nv ); SetBogoMips(nv);
w.SetBogoKips(); w.SetBogoKips();
t0 = GetTickCount(); t0 = GetTickCount();

View File

@ -76,7 +76,7 @@ enum AppStatus
class e2App class e2App
{ {
public: //---------------------------------------- public public: //---------------------------------------- public
e2App(); e2App();
virtual ~e2App(); virtual ~e2App();
@ -105,7 +105,7 @@ public: //---------------------------------------- public
iniBus = p; iniBus = p;
} }
} }
BusInterface* GetInterfPtr() BusInterface *GetInterfPtr()
{ {
return busIntp; return busIntp;
} }
@ -166,7 +166,7 @@ public: //---------------------------------------- public
// qDebug() << "SetAWInfo" << awi; // qDebug() << "SetAWInfo" << awi;
awip = awi; awip = awi;
} }
e2AppWinInfo* GetAWInfo() const e2AppWinInfo *GetAWInfo() const
{ {
return awip; return awip;
} }
@ -176,11 +176,11 @@ public: //---------------------------------------- public
QString script_name; QString script_name;
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
// AppWinInfo associated with this window // AppWinInfo associated with this window
e2AppWinInfo* awip; e2AppWinInfo *awip;
private: //--------------------------------------- private private: //--------------------------------------- private
void initSettings(); void initSettings();
void LookForBogoMips(); //should get bogomips void LookForBogoMips(); //should get bogomips

View File

@ -41,7 +41,7 @@
//======================>>> e2AppWinInfo::e2AppWinInfo <<<======================= //======================>>> e2AppWinInfo::e2AppWinInfo <<<=======================
e2AppWinInfo::e2AppWinInfo(e2CmdWindow *p, const QString &name, BusIO** busvptr) : e2AppWinInfo::e2AppWinInfo(e2CmdWindow *p, const QString &name, BusIO **busvptr) :
hex_per_line(16), hex_per_line(16),
buffer_size(BUFFER_SIZE), buffer_size(BUFFER_SIZE),
load_type(ALL_TYPE), load_type(ALL_TYPE),
@ -174,7 +174,7 @@ e2AppWinInfo::e2AppWinInfo(e2CmdWindow *p, const QString &name, BusIO** busvptr)
if (!E2Profile::GetSkipStartupDialog()) if (!E2Profile::GetSkipStartupDialog())
{ {
if ( !cmdWin->scriptMode ) if (!cmdWin->scriptMode)
{ {
cmdWin->About(); cmdWin->About();
} }
@ -184,7 +184,7 @@ e2AppWinInfo::e2AppWinInfo(e2CmdWindow *p, const QString &name, BusIO** busvptr)
if (err != OK) if (err != OK)
{ {
int r = QMessageBox::critical (NULL, "Error", "Load I/O driver failed."); int r = QMessageBox::critical(NULL, "Error", "Load I/O driver failed.");
} }
//imposta il bus iniziale (relativo al tipo di eeprom) //imposta il bus iniziale (relativo al tipo di eeprom)
@ -205,9 +205,9 @@ e2AppWinInfo::e2AppWinInfo(e2CmdWindow *p, const QString &name, BusIO** busvptr)
if (err == E2ERR_ACCESSDENIED) if (err == E2ERR_ACCESSDENIED)
{ {
#ifdef _WINDOWS #ifdef _WINDOWS
int r = QMessageBox::critical (NULL, QString("Error"), QString("I/O access denied. Driver not found, try to install the software again")); int r = QMessageBox::critical(NULL, QString("Error"), QString("I/O access denied. Driver not found, try to install the software again"));
#else #else
int r = QMessageBox::critical (NULL, QString("Error"), QString("I/O access denied. Run as root, or change the interface")); int r = QMessageBox::critical(NULL, QString("Error"), QString("I/O access denied. Run as root, or change the interface"));
#endif #endif
} }
@ -293,7 +293,7 @@ void e2AppWinInfo::SetEEProm(unsigned long id)
// int eep_type = type; // int eep_type = type;
// int eep_subtype = subtype; //0 indica di usare GetNoOfBlock() // int eep_subtype = subtype; //0 indica di usare GetNoOfBlock()
switch(eep_type) switch (eep_type)
{ {
//AutoTag //AutoTag
//Setting the device pointer to selected type //Setting the device pointer to selected type
@ -352,8 +352,8 @@ void e2AppWinInfo::SetEEProm(unsigned long id)
long xtype = GetEEPId(); long xtype = GetEEPId();
eep->SetProgPageSize(GetEEPTypeWPageSize(xtype), false); eep->SetProgPageSize(GetEEPTypeWPageSize(xtype), false);
At90sBus *b = (At90sBus *)eep->GetBus(); At90sBus *b = (At90sBus *)eep->GetBus();
b->SetFlashPagePolling( (xtype != ATmega603) && (xtype != ATmega103) ); b->SetFlashPagePolling((xtype != ATmega603) && (xtype != ATmega103));
b->SetOld1200Mode( (xtype == AT90S1200) ); b->SetOld1200Mode((xtype == AT90S1200));
break; break;
} }
@ -378,10 +378,10 @@ void e2AppWinInfo::SetEEProm(unsigned long id)
} }
At89sBus *b = (At89sBus *)eep->GetBus(); At89sBus *b = (At89sBus *)eep->GetBus();
b->SetCompatibilityMode( (xtype == AT89S8252 || xtype == AT89S53) ); b->SetCompatibilityMode((xtype == AT89S8252 || xtype == AT89S53));
b->SetFallingPhase( (xtype == AT89S8253) && E2Profile::Get8253FallEdge() ); b->SetFallingPhase((xtype == AT89S8253) && E2Profile::Get8253FallEdge());
b->SetPagePolling( true, (xtype == AT89S8253 || xtype == AT89S51 || xtype == AT89S52) ); b->SetPagePolling(true, (xtype == AT89S8253 || xtype == AT89S51 || xtype == AT89S52));
b->SetPagePolling( false, (xtype == AT89S8253) ); b->SetPagePolling(false, (xtype == AT89S8253));
break; break;
} }
@ -517,26 +517,26 @@ void e2AppWinInfo::SetEEProm(unsigned long id)
} }
fuse_ok = false; //invalidate current fuse settings fuse_ok = false; //invalidate current fuse settings
SetSplittedInfo( GetEEPTypeSplit(id) ); SetSplittedInfo(GetEEPTypeSplit(id));
//Imposta la nuova dimensione della memoria in //Imposta la nuova dimensione della memoria in
// base al tipo di eeprom. // base al tipo di eeprom.
SetNoOfBlock( GetEEPTypeSize(id) ); SetNoOfBlock(GetEEPTypeSize(id));
//Imposta la dimensione del banco che dipende //Imposta la dimensione del banco che dipende
// dal tipo di eeprom. // dal tipo di eeprom.
SetBlockSize( eep->GetBankSize() ); SetBlockSize(eep->GetBankSize());
} }
//======================>>> e2AppWinInfo::Read <<<======================= //======================>>> e2AppWinInfo::Read <<<=======================
int e2AppWinInfo::Read(int type, int raise_power, int leave_on) int e2AppWinInfo::Read(int type, int raise_power, int leave_on)
{ {
int probe = !GetE2PSubType( eep_id); int probe = !GetE2PSubType(eep_id);
int rval = OK; int rval = OK;
qDebug() << "e2AppWinInfo::Read(" << type << "," << raise_power << "," << leave_on << ") - IN"; qDebug() << "e2AppWinInfo::Read(" << type << "," << raise_power << "," << leave_on << ") - IN";
if ( E2Profile::GetClearBufBeforeRead() ) if (E2Profile::GetClearBufBeforeRead())
{ {
if (load_type == ALL_TYPE) if (load_type == ALL_TYPE)
{ {
@ -567,7 +567,7 @@ int e2AppWinInfo::Read(int type, int raise_power, int leave_on)
{ {
// CheckEvents(); // CheckEvents();
if ( (rval = eep->Read(probe, type)) > 0 ) if ((rval = eep->Read(probe, type)) > 0)
{ {
qDebug() << "e2AppWinInfo::Read() ** Read = " << rval; qDebug() << "e2AppWinInfo::Read() ** Read = " << rval;
@ -578,12 +578,12 @@ int e2AppWinInfo::Read(int type, int raise_power, int leave_on)
//Aggiunto il 18/03/99 con la determinazione dei numeri di banchi nelle E24xx2, //Aggiunto il 18/03/99 con la determinazione dei numeri di banchi nelle E24xx2,
// affinche` la dimensione rimanga quella impostata bisogna correggere la dimensione // affinche` la dimensione rimanga quella impostata bisogna correggere la dimensione
// del banco. // del banco.
SetBlockSize( eep->GetBankSize() ); SetBlockSize(eep->GetBankSize());
} }
RecalcCRC(); RecalcCRC();
if ( !(rval > 0 && leave_on) ) if (!(rval > 0 && leave_on))
{ {
SleepBus(); SleepBus();
} }
@ -607,19 +607,19 @@ int e2AppWinInfo::Write(int type, int raise_power, int leave_on)
rval = OpenBus(); rval = OpenBus();
} }
if ( rval == OK ) if (rval == OK)
{ {
// CheckEvents(); // CheckEvents();
if ( (rval = eep->Write(probe, type)) > 0 ) if ((rval = eep->Write(probe, type)) > 0)
{ {
//Aggiunto il 18/03/99 con la determinazione dei numeri di banchi nelle E24xx2, //Aggiunto il 18/03/99 con la determinazione dei numeri di banchi nelle E24xx2,
// affinche` la dimensione rimanga quella impostata bisogna correggere la dimensione // affinche` la dimensione rimanga quella impostata bisogna correggere la dimensione
// del banco. // del banco.
SetBlockSize( eep->GetBankSize() ); SetBlockSize(eep->GetBankSize());
} }
if ( !(rval > 0 && leave_on) ) //23/01/1999 if (!(rval > 0 && leave_on)) //23/01/1999
{ {
SleepBus(); SleepBus();
} }
@ -646,7 +646,7 @@ int e2AppWinInfo::Verify(int type, int raise_power, int leave_on)
{ {
rval = eep->Verify(type); rval = eep->Verify(type);
if ( !(rval >= 0 && leave_on) ) if (!(rval >= 0 && leave_on))
{ {
SleepBus(); SleepBus();
} }
@ -673,7 +673,7 @@ int e2AppWinInfo::Erase(int type, int raise_power, int leave_on)
{ {
rval = eep->Erase(1, type); rval = eep->Erase(1, type);
if ( !(rval >= 0 && leave_on) ) if (!(rval >= 0 && leave_on))
{ {
SleepBus(); SleepBus();
} }
@ -687,7 +687,7 @@ int e2AppWinInfo::Erase(int type, int raise_power, int leave_on)
//===================>>> e2AppWinInfo::BankRollOverDetect <<<============= //===================>>> e2AppWinInfo::BankRollOverDetect <<<=============
int e2AppWinInfo::BankRollOverDetect(int force) int e2AppWinInfo::BankRollOverDetect(int force)
{ {
if ( OpenBus() == OK ) if (OpenBus() == OK)
{ {
roll_over = eep->BankRollOverDetect(force); roll_over = eep->BankRollOverDetect(force);
} }
@ -705,33 +705,33 @@ int e2AppWinInfo::Load()
SetFileBuf(E2P); SetFileBuf(E2P);
rval = LoadFile(); rval = LoadFile();
if ( rval <= 0 ) if (rval <= 0)
{ {
SetFileBuf(MOTOS); SetFileBuf(MOTOS);
rval = LoadFile(); rval = LoadFile();
if ( rval <= 0 ) if (rval <= 0)
{ {
SetFileBuf(INTEL); SetFileBuf(INTEL);
rval = LoadFile(); rval = LoadFile();
} }
if ( rval <= 0 ) if (rval <= 0)
{ {
SetFileBuf(CSM); SetFileBuf(CSM);
rval = LoadFile(); rval = LoadFile();
} }
if ( rval <= 0 ) if (rval <= 0)
{ {
SetFileBuf(BIN); SetFileBuf(BIN);
rval = LoadFile(); rval = LoadFile();
} }
if ( rval > 0 ) if (rval > 0)
{ {
if ( GetE2PPriType(GetEEPId()) == PIC16XX || if (GetE2PPriType(GetEEPId()) == PIC16XX ||
GetE2PPriType(GetEEPId()) == PIC168XX ) GetE2PPriType(GetEEPId()) == PIC168XX)
{ {
//It seems a bit tricky... //It seems a bit tricky...
//Relocate the DATA and CONFIG memory with PIC devices //Relocate the DATA and CONFIG memory with PIC devices
@ -742,7 +742,7 @@ int e2AppWinInfo::Load()
if (GetSplittedInfo() > 0 && GetSize() > GetSplittedInfo()) if (GetSplittedInfo() > 0 && GetSize() > GetSplittedInfo())
{ {
//Copy Config memory //Copy Config memory
if ( GetSize() + 16 <= GetBufSize() ) if (GetSize() + 16 <= GetBufSize())
{ {
memcpy(GetBufPtr() + GetSize(), GetBufPtr() + (0x2000 * 2), 16); memcpy(GetBufPtr() + GetSize(), GetBufPtr() + (0x2000 * 2), 16);
} }
@ -766,10 +766,10 @@ int e2AppWinInfo::Load()
SetLockBits(config); SetLockBits(config);
} }
} }
else if ( GetE2PPriType(GetEEPId()) == PIC125XX ) else if (GetE2PPriType(GetEEPId()) == PIC125XX)
{ {
//Copy Config memory //Copy Config memory
if ( GetSize() + 16 <= GetBufSize() ) if (GetSize() + 16 <= GetBufSize())
{ {
memcpy(GetBufPtr() + GetSize() + 14, GetBufPtr() + (0xFFF * 2), 2); memcpy(GetBufPtr() + GetSize() + 14, GetBufPtr() + (0xFFF * 2), 2);
} }
@ -777,7 +777,7 @@ int e2AppWinInfo::Load()
//Set fuse bits so the dialog shows the correct values //Set fuse bits so the dialog shows the correct values
uint8_t *ptr = GetBufPtr() + GetSize() + 14; uint8_t *ptr = GetBufPtr() + GetSize() + 14;
uint16_t config = ptr[0] + ((uint16_t)ptr[1] << 8); //little endian buffer uint16_t config = ptr[0] + ((uint16_t)ptr[1] << 8); //little endian buffer
SetLockBits( ~config & 0x0fff ); SetLockBits(~config & 0x0fff);
} }
} }
} }
@ -835,18 +835,18 @@ int e2AppWinInfo::Save()
} }
//save buffer //save buffer
memcpy( localbuf, GetBufPtr(), GetBufSize() ); memcpy(localbuf, GetBufPtr(), GetBufSize());
memset( localbuf + GetSize(), 0xFF, GetBufSize() - GetSize() ); memset(localbuf + GetSize(), 0xFF, GetBufSize() - GetSize());
/** /**
** NON va qui!!! Va messo in IntelFileBuf::Save(int savetype) ** NON va qui!!! Va messo in IntelFileBuf::Save(int savetype)
** e MotorolaFileBus::Save ** e MotorolaFileBus::Save
**/ **/
if (save_type == ALL_TYPE && if (save_type == ALL_TYPE &&
(GetFileBuf() == INTEL || GetFileBuf() == MOTOS) ) (GetFileBuf() == INTEL || GetFileBuf() == MOTOS))
{ {
if ( GetE2PPriType(GetEEPId()) == PIC16XX || if (GetE2PPriType(GetEEPId()) == PIC16XX ||
GetE2PPriType(GetEEPId()) == PIC168XX ) GetE2PPriType(GetEEPId()) == PIC168XX)
{ {
//It seems a bit tricky... //It seems a bit tricky...
//Relocate the DATA and CONFIG memory with PIC devices //Relocate the DATA and CONFIG memory with PIC devices
@ -854,19 +854,19 @@ int e2AppWinInfo::Save()
//CONFIG at 0x2000 (word address). //CONFIG at 0x2000 (word address).
//We move them after PROGRAM memory //We move them after PROGRAM memory
// PROGRAM MEMORY + DATA MEMORY + CONFIG (8 word) // PROGRAM MEMORY + DATA MEMORY + CONFIG (8 word)
if (GetSplittedInfo() > 0 && GetSize() > GetSplittedInfo() ) if (GetSplittedInfo() > 0 && GetSize() > GetSplittedInfo())
{ {
//Set ALL overbound buffer to 0xFF //Set ALL overbound buffer to 0xFF
memset(GetBufPtr(), 0xFF, GetBufSize()); memset(GetBufPtr(), 0xFF, GetBufSize());
//Set fuse bits so the dialog shows the correct values //Set fuse bits so the dialog shows the correct values
if ( 0x2000 * 2 + 16 <= GetBufSize() ) if (0x2000 * 2 + 16 <= GetBufSize())
{ {
uint16_t config = (uint16_t)GetLockBits(); uint16_t config = (uint16_t)GetLockBits();
if ( GetEEPId() == PIC1683 || if (GetEEPId() == PIC1683 ||
GetEEPId() == PIC1684 || GetEEPId() == PIC1684 ||
GetEEPId() == PIC1684A ) GetEEPId() == PIC1684A)
{ {
if (config & (1 << 4)) if (config & (1 << 4))
{ {
@ -886,13 +886,13 @@ int e2AppWinInfo::Save()
} }
//Copy prog memory //Copy prog memory
if ( GetSplittedInfo() <= GetBufSize() ) if (GetSplittedInfo() <= GetBufSize())
{ {
memcpy( GetBufPtr(), localbuf, GetSplittedInfo() ); memcpy(GetBufPtr(), localbuf, GetSplittedInfo());
} }
//Copy data memory //Copy data memory
if ( 0x2100 * 2 + (GetSize() - GetSplittedInfo()) <= GetBufSize() ) if (0x2100 * 2 + (GetSize() - GetSplittedInfo()) <= GetBufSize())
{ {
//copy only low byte every word //copy only low byte every word
int k; int k;
@ -906,19 +906,19 @@ int e2AppWinInfo::Save()
} }
} }
} }
else if ( GetE2PPriType(GetEEPId()) == PIC125XX ) else if (GetE2PPriType(GetEEPId()) == PIC125XX)
{ {
//Set ALL overbound buffer to 0xFF //Set ALL overbound buffer to 0xFF
memset(GetBufPtr(), 0xFF, GetBufSize()); memset(GetBufPtr(), 0xFF, GetBufSize());
//Copy prog memory //Copy prog memory
if ( GetSplittedInfo() <= GetBufSize() ) if (GetSplittedInfo() <= GetBufSize())
{ {
memcpy( GetBufPtr(), localbuf, GetSize() ); memcpy(GetBufPtr(), localbuf, GetSize());
} }
//Set fuse bits so the dialog shows the correct values //Set fuse bits so the dialog shows the correct values
if ( 0xFFF * 2 + 2 <= GetBufSize() ) if (0xFFF * 2 + 2 <= GetBufSize())
{ {
uint16_t config = (uint16_t)GetLockBits(); uint16_t config = (uint16_t)GetLockBits();
@ -955,7 +955,7 @@ long e2AppWinInfo::GetLoadRelocation() const
//===================>>> e2AppWinInfo::SetLoadRelocation <<<==================== //===================>>> e2AppWinInfo::SetLoadRelocation <<<====================
void e2AppWinInfo::SetLoadRelocation(long val) void e2AppWinInfo::SetLoadRelocation(long val)
{ {
if ( val >= 0 && val < GetBufSize() ) if (val >= 0 && val < GetBufSize())
{ {
load_relocation = val; load_relocation = val;
} }
@ -970,7 +970,7 @@ long e2AppWinInfo::GetSaveRelocation() const
//===================>>> e2AppWinInfo::SetSaveRelocation <<<==================== //===================>>> e2AppWinInfo::SetSaveRelocation <<<====================
void e2AppWinInfo::SetSaveRelocation(long val) void e2AppWinInfo::SetSaveRelocation(long val)
{ {
if ( val >= 0 && val < GetBufSize() ) if (val >= 0 && val < GetBufSize())
{ {
save_relocation = val; save_relocation = val;
} }
@ -1207,13 +1207,13 @@ void e2AppWinInfo::DoubleSize()
if (k) if (k)
{ {
//Non copiarlo su se stesso! //Non copiarlo su se stesso!
memcpy( buffer + k * 2 * GetBlockSize(), memcpy(buffer + k * 2 * GetBlockSize(),
buffer + k * GetBlockSize(), buffer + k * GetBlockSize(),
GetBlockSize() GetBlockSize()
); );
} }
memcpy( buffer + (k * 2 + 1) * GetBlockSize(), memcpy(buffer + (k * 2 + 1) * GetBlockSize(),
buffer + k * GetBlockSize(), buffer + k * GetBlockSize(),
GetBlockSize() GetBlockSize()
); );
@ -1430,12 +1430,12 @@ QString e2AppWinInfo::Dump(int line, int type)
} }
else if (type == 1) else if (type == 1)
{ {
linebuf.sprintf( " %06lX)", idx); linebuf.sprintf(" %06lX)", idx);
// snprintf(linebuf, LINEBUF_SIZE, " %06lX)", idx); // snprintf(linebuf, LINEBUF_SIZE, " %06lX)", idx);
} }
else if (type == 2) else if (type == 2)
{ {
linebuf.sprintf( " %02X %02X %02X %02X %02X %02X %02X %02X - %02X %02X %02X %02X %02X %02X %02X %02X ", linebuf.sprintf(" %02X %02X %02X %02X %02X %02X %02X %02X - %02X %02X %02X %02X %02X %02X %02X %02X ",
// snprintf(linebuf, LINEBUF_SIZE, " %02X %02X %02X %02X %02X %02X %02X %02X - %02X %02X %02X %02X %02X %02X %02X %02X ", // snprintf(linebuf, LINEBUF_SIZE, " %02X %02X %02X %02X %02X %02X %02X %02X - %02X %02X %02X %02X %02X %02X %02X %02X ",
buffer[idx + 0], buffer[idx + 0],
buffer[idx + 1], buffer[idx + 1],

View File

@ -96,9 +96,9 @@ class e2CmdWindow;
class e2AppWinInfo // : public QObject class e2AppWinInfo // : public QObject
{ {
public: //---------------------------------------- public public: //---------------------------------------- public
e2AppWinInfo(e2CmdWindow* p = 0, const QString &name = "", BusIO** busptr = 0); e2AppWinInfo(e2CmdWindow *p = 0, const QString &name = "", BusIO **busptr = 0);
~e2AppWinInfo(); ~e2AppWinInfo();
int Read(int type = ALL_TYPE, int raise_power = true, int leave_on = false); int Read(int type = ALL_TYPE, int raise_power = true, int leave_on = false);
@ -163,7 +163,7 @@ public: //---------------------------------------- public
} }
int GetEEPSubType() const int GetEEPSubType() const
{ {
return eep_subtype ? eep_subtype : GetE2PSubType( GetEEPTypeFromSize(eep_type, GetNoOfBlock()) ); return eep_subtype ? eep_subtype : GetE2PSubType(GetEEPTypeFromSize(eep_type, GetNoOfBlock()));
} //GetNoOfBlock(); } } //GetNoOfBlock(); }
int GetEEPType() const int GetEEPType() const
@ -285,10 +285,10 @@ public: //---------------------------------------- public
return eep ? eep->GetDetectedSignatureStr() : 0; return eep ? eep->GetDetectedSignatureStr() : 0;
} }
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
// e2CmdWindow* cmdWin; // e2CmdWindow* cmdWin;
private: //--------------------------------------- private private: //--------------------------------------- private
int OpenBus(); int OpenBus();
void SleepBus(); void SleepBus();
void SetBlockSize(int blk) void SetBlockSize(int blk)

File diff suppressed because it is too large Load Diff

View File

@ -86,7 +86,7 @@ class e2CmdWindow : public QMainWindow, public e2App, public Ui::MainWindow
{ {
Q_OBJECT Q_OBJECT
public: //---------------------------------------- public public: //---------------------------------------- public
e2CmdWindow(QWidget *parent = 0); e2CmdWindow(QWidget *parent = 0);
virtual ~e2CmdWindow(); virtual ~e2CmdWindow();
// virtual int CloseAppWin(); // virtual int CloseAppWin();
@ -161,7 +161,7 @@ public: //---------------------------------------- public
} }
private slots: private slots:
void onNew(); void onNew();
void onOpen(); // void onOpen(); //
void onSave(); // void onSave(); //
@ -215,34 +215,34 @@ private slots:
void onDevSubType(int i); void onDevSubType(int i);
// EK 2017: slots for signals from group actions // EK 2017: slots for signals from group actions
void onSelectI2C8(QAction* a); void onSelectI2C8(QAction *a);
void onSelectI2C16(QAction* a); void onSelectI2C16(QAction *a);
void onSelectI2CAT17(QAction* a); void onSelectI2CAT17(QAction *a);
void onSelectMW16(QAction* a); void onSelectMW16(QAction *a);
void onSelectMW8(QAction* a); void onSelectMW8(QAction *a);
void onSelectSPI(QAction* a); void onSelectSPI(QAction *a);
void onSelectAVR(QAction* a); void onSelectAVR(QAction *a);
void onSelectAT89S(QAction* a); void onSelectAT89S(QAction *a);
void onSelectPIC16(QAction* a); void onSelectPIC16(QAction *a);
void onSelectPIC12(QAction* a); void onSelectPIC12(QAction *a);
void onSelectImBus(QAction* a); void onSelectImBus(QAction *a);
void onSelectSDE2506(QAction* a); void onSelectSDE2506(QAction *a);
void onSelectX244(QAction* a); void onSelectX244(QAction *a);
void onEndProgress(); void onEndProgress();
void selectFontSize(QAction* mnu); void selectFontSize(QAction *mnu);
// void setOverwriteMode(bool); // void setOverwriteMode(bool);
// void dataChanged(); // void dataChanged();
public: public:
int CmdHelp(); int CmdHelp();
protected: protected:
//void CmdRemoteMode(); //void CmdRemoteMode();
private: private:
//All commands //All commands
int CmdOpen(int type = ALL_TYPE, char *file = 0, long relocation = 0, int clear_buffer = -1); int CmdOpen(int type = ALL_TYPE, char *file = 0, long relocation = 0, int clear_buffer = -1);
int CmdSave(int type = ALL_TYPE, char *file = 0, long relocation = 0); int CmdSave(int type = ALL_TYPE, char *file = 0, long relocation = 0);
@ -293,14 +293,14 @@ private:
int findItemInMenuVector(const QString &n); int findItemInMenuVector(const QString &n);
private: //--------------------------------------- private private: //--------------------------------------- private
void createSignalSlotConnections(); void createSignalSlotConnections();
QString convertFilterListToString(const QStringList &lst); QString convertFilterListToString(const QStringList &lst);
void doProgress(const QString &text); void doProgress(const QString &text);
menuToGroup* searchMenuInDeviceVector( int new_type ); menuToGroup *searchMenuInDeviceVector(int new_type);
void createDeviceMenues(); void createDeviceMenues();
void addI2C8Struct();; void addI2C8Struct();;
@ -350,7 +350,7 @@ private: //--------------------------------------- private
int ScriptError(int line_number, int arg_index, char *arg, const QString msg = ""); int ScriptError(int line_number, int arg_index, char *arg, const QString msg = "");
private: private:
int idxI2Cbus8; int idxI2Cbus8;
int idxI2Cbus16; int idxI2Cbus16;
int idxI2CbusAT17; int idxI2CbusAT17;
@ -374,8 +374,8 @@ private:
QStringList arguments; QStringList arguments;
QString programStyleSheet; QString programStyleSheet;
QComboBox* cbxEEPType; QComboBox *cbxEEPType;
QComboBox* cbxEEPSubType; QComboBox *cbxEEPSubType;
QLabel *lblEEPInfo; QLabel *lblEEPInfo;
QLabel *lblStringID; QLabel *lblStringID;
@ -383,13 +383,13 @@ private:
QLineEdit *txtStringID; QLineEdit *txtStringID;
// QProgressBar *statusProgress; // QProgressBar *statusProgress;
QVector<QAction*> actLangSelect; QVector<QAction *> actLangSelect;
QVector<QAction*> actFSizeSelect; QVector<QAction *> actFSizeSelect;
QActionGroup *fsizeGroup; QActionGroup *fsizeGroup;
// Standard elements // Standard elements
QHexEdit* e2HexEdit; // For the canvas QHexEdit *e2HexEdit; // For the canvas
QProgressDialog *e2Prg; QProgressDialog *e2Prg;

View File

@ -45,7 +45,7 @@ using namespace Translator;
//=========================>>> e2Dialog::e2Dialog <<<==================== //=========================>>> e2Dialog::e2Dialog <<<====================
e2Dialog::e2Dialog(QWidget* bw, const QString title) e2Dialog::e2Dialog(QWidget *bw, const QString title)
: QDialog(bw), : QDialog(bw),
lpt_no(2), lpt_no(2),
com_no(3) com_no(3)
@ -68,10 +68,10 @@ e2Dialog::e2Dialog(QWidget* bw, const QString title)
connect(rdbComPort, SIGNAL(toggled(bool)), this, SLOT(onChangePort(bool))); connect(rdbComPort, SIGNAL(toggled(bool)), this, SLOT(onChangePort(bool)));
connect(rdbLptPort, SIGNAL(toggled(bool)), this, SLOT(onChangePort(bool))); connect(rdbLptPort, SIGNAL(toggled(bool)), this, SLOT(onChangePort(bool)));
connect (cbxInterfCOM, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectCOM(int))); connect(cbxInterfCOM, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectCOM(int)));
connect (cbxInterfLPT, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectLPT(int))); connect(cbxInterfLPT, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectLPT(int)));
connect (cbxInterfNum, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectNum(int))); connect(cbxInterfNum, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectNum(int)));
connect(pushOk, SIGNAL(clicked()), this, SLOT(onOk())); connect(pushOk, SIGNAL(clicked()), this, SLOT(onOk()));
connect(pushCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(pushCancel, SIGNAL(clicked()), this, SLOT(reject()));
@ -117,7 +117,7 @@ void e2Dialog::onSelectNum(int i)
void e2Dialog::onChangePort(bool b) void e2Dialog::onChangePort(bool b)
{ {
QRadioButton *s = static_cast<QRadioButton*>(sender()); QRadioButton *s = static_cast<QRadioButton *>(sender());
// bool state = s->isChecked(); // bool state = s->isChecked();
disconnect(rdbComPort, SIGNAL(toggled(bool)), this, SLOT(onChangePort(bool))); disconnect(rdbComPort, SIGNAL(toggled(bool)), this, SLOT(onChangePort(bool)));
@ -128,10 +128,10 @@ void e2Dialog::onChangePort(bool b)
cbxInterfCOM->setEnabled(b); cbxInterfCOM->setEnabled(b);
cbxInterfLPT->setEnabled(!b); cbxInterfLPT->setEnabled(!b);
disconnect (cbxInterfNum, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectNum(int))); disconnect(cbxInterfNum, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectNum(int)));
cbxInterfNum->clear(); cbxInterfNum->clear();
cbxInterfNum->addItems(usbList); cbxInterfNum->addItems(usbList);
connect (cbxInterfNum, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectNum(int))); connect(cbxInterfNum, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectNum(int)));
cbxInterfNum->setCurrentIndex(com_no); cbxInterfNum->setCurrentIndex(com_no);
} }
@ -140,10 +140,10 @@ void e2Dialog::onChangePort(bool b)
cbxInterfCOM->setEnabled(!b); cbxInterfCOM->setEnabled(!b);
cbxInterfLPT->setEnabled(b); cbxInterfLPT->setEnabled(b);
disconnect (cbxInterfNum, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectNum(int))); disconnect(cbxInterfNum, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectNum(int)));
cbxInterfNum->clear(); cbxInterfNum->clear();
cbxInterfNum->addItems(lptList); cbxInterfNum->addItems(lptList);
connect (cbxInterfNum, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectNum(int))); connect(cbxInterfNum, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectNum(int)));
cbxInterfNum->setCurrentIndex(lpt_no); cbxInterfNum->setCurrentIndex(lpt_no);
} }
@ -183,7 +183,7 @@ void e2Dialog::getSettings()
} }
else else
{ {
cbxInterfLPT->setCurrentIndex(interf_type - 3 ); cbxInterfLPT->setCurrentIndex(interf_type - 3);
cbxInterfCOM->setCurrentIndex(0); cbxInterfCOM->setCurrentIndex(0);
lpt_no = port_no; lpt_no = port_no;
@ -323,7 +323,7 @@ void e2Dialog::onTest()
{ {
int test = Test(); int test = Test();
if ( test ) if (test)
{ {
QMessageBox::critical(this, "Failed", STR_MSGTEST + " " + STR_MSGFAILED); QMessageBox::critical(this, "Failed", STR_MSGTEST + " " + STR_MSGFAILED);
} }

View File

@ -50,13 +50,13 @@ class e2Dialog : public QDialog, public Ui::E2Dialog
{ {
Q_OBJECT Q_OBJECT
public: //---------------------------------------- public public: //---------------------------------------- public
e2Dialog(QWidget* bw, const QString title = STR_MSGINTSETUP); e2Dialog(QWidget *bw, const QString title = STR_MSGINTSETUP);
virtual ~e2Dialog(); // Destructor virtual ~e2Dialog(); // Destructor
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
private slots: private slots:
void onOk(); void onOk();
void onTest(); void onTest();
void onChangePort(bool); void onChangePort(bool);
@ -64,7 +64,7 @@ private slots:
void onSelectCOM(int i); void onSelectCOM(int i);
void onSelectLPT(int i); void onSelectLPT(int i);
private: //--------------------------------------- private private: //--------------------------------------- private
int Test(int p = 0, int open_only = 0) const; int Test(int p = 0, int open_only = 0) const;
void setWidgetsText(); void setWidgetsText();
void getSettings(); void getSettings();

View File

@ -98,8 +98,8 @@ int e2pFileBuf::Load(int loadtype, long relocation_offset)
QDataStream datastream(&fh); QDataStream datastream(&fh);
// Controlla il tipo di file // Controlla il tipo di file
if (datastream.readRawData( (char*)&hdr, sizeof(e2pHeader)) && if (datastream.readRawData((char *)&hdr, sizeof(e2pHeader)) &&
strncmp(hdr.fileID, id_string, E2P_ID_SIZE) == 0 ) strncmp(hdr.fileID, id_string, E2P_ID_SIZE) == 0)
{ {
unsigned char *localbuf; unsigned char *localbuf;
localbuf = new unsigned char[hdr.e2pSize]; localbuf = new unsigned char[hdr.e2pSize];
@ -107,11 +107,11 @@ int e2pFileBuf::Load(int loadtype, long relocation_offset)
if (localbuf) if (localbuf)
{ {
//Controlla il CRC dell'Header //Controlla il CRC dell'Header
if ( mcalc_crc(&hdr, sizeof(hdr) - sizeof(hdr.headCrc)) == hdr.headCrc && if (mcalc_crc(&hdr, sizeof(hdr) - sizeof(hdr.headCrc)) == hdr.headCrc &&
//Check for CRC in memory //Check for CRC in memory
fcalc_crc(fh, sizeof(e2pHeader), 0) == hdr.e2pCrc && fcalc_crc(fh, sizeof(e2pHeader), 0) == hdr.e2pCrc &&
//read buffer //read buffer
datastream.readRawData( (char*)localbuf, hdr.e2pSize) ) datastream.readRawData((char *)localbuf, hdr.e2pSize))
// fread(FileBuf::GetBufPtr(), hdr.e2pSize, 1, fh) ) // fread(FileBuf::GetBufPtr(), hdr.e2pSize, 1, fh) )
{ {
SetEEpromType(hdr.e2pType); //set eeprom device type (and block size too) SetEEpromType(hdr.e2pType); //set eeprom device type (and block size too)
@ -119,17 +119,17 @@ int e2pFileBuf::Load(int loadtype, long relocation_offset)
if (hdr.fversion > 0) if (hdr.fversion > 0)
{ {
SetLockBits( ((uint32_t)hdr.e2pExtLockBits << 8) | hdr.e2pLockBits ); SetLockBits(((uint32_t)hdr.e2pExtLockBits << 8) | hdr.e2pLockBits);
SetFuseBits( ((uint32_t)hdr.e2pExtFuseBits << 8) | hdr.e2pFuseBits ); SetFuseBits(((uint32_t)hdr.e2pExtFuseBits << 8) | hdr.e2pFuseBits);
} }
else else
{ {
//Old file version //Old file version
if (GetE2PPriType(hdr.e2pType) == PIC16XX || if (GetE2PPriType(hdr.e2pType) == PIC16XX ||
GetE2PPriType(hdr.e2pType) == PIC168XX || GetE2PPriType(hdr.e2pType) == PIC168XX ||
GetE2PPriType(hdr.e2pType) == PIC125XX ) GetE2PPriType(hdr.e2pType) == PIC125XX)
{ {
SetLockBits( ((uint32_t)hdr.e2pLockBits << 8) | hdr.e2pFuseBits ); SetLockBits(((uint32_t)hdr.e2pLockBits << 8) | hdr.e2pFuseBits);
} }
else else
{ {
@ -141,7 +141,7 @@ int e2pFileBuf::Load(int loadtype, long relocation_offset)
if (hdr.fversion > 1) if (hdr.fversion > 1)
{ {
SetSplitted( ((uint32_t)hdr.split_size_High << 16) | hdr.split_size_Low ); SetSplitted(((uint32_t)hdr.split_size_High << 16) | hdr.split_size_Low);
} }
else else
{ {
@ -156,7 +156,7 @@ int e2pFileBuf::Load(int loadtype, long relocation_offset)
//Copy the content into the buffer //Copy the content into the buffer
if (loadtype == ALL_TYPE) if (loadtype == ALL_TYPE)
{ {
if ( hdr.e2pSize <= GetBufSize() ) if (hdr.e2pSize <= GetBufSize())
{ {
memcpy(FileBuf::GetBufPtr(), localbuf, hdr.e2pSize); memcpy(FileBuf::GetBufPtr(), localbuf, hdr.e2pSize);
} }
@ -165,13 +165,13 @@ int e2pFileBuf::Load(int loadtype, long relocation_offset)
{ {
long s = GetSplitted(); long s = GetSplitted();
if ( s <= 0 ) if (s <= 0)
{ {
s = hdr.e2pSize; s = hdr.e2pSize;
} }
//if splittedInfo == 0 then copy ALL //if splittedInfo == 0 then copy ALL
if ( s <= hdr.e2pSize && s <= GetBufSize() ) if (s <= hdr.e2pSize && s <= GetBufSize())
{ {
memcpy(FileBuf::GetBufPtr(), localbuf, s); memcpy(FileBuf::GetBufPtr(), localbuf, s);
} }
@ -180,9 +180,9 @@ int e2pFileBuf::Load(int loadtype, long relocation_offset)
{ {
long s = GetSplitted(); long s = GetSplitted();
if ( s >= 0 && if (s >= 0 &&
s < hdr.e2pSize && s < hdr.e2pSize &&
hdr.e2pSize <= GetBufSize() ) hdr.e2pSize <= GetBufSize())
{ {
memcpy(FileBuf::GetBufPtr() + s, localbuf + s, hdr.e2pSize - s); memcpy(FileBuf::GetBufPtr() + s, localbuf + s, hdr.e2pSize - s);
} }
@ -256,11 +256,11 @@ int e2pFileBuf::Save(int savetype, long relocation_offset)
//Initialize local buffer //Initialize local buffer
// if the file already exist read the current content // if the file already exist read the current content
// otherwise set the localbuffer to 0xFF // otherwise set the localbuffer to 0xFF
rv = fh.seek( sizeof(hdr)); rv = fh.seek(sizeof(hdr));
if (rv == 0) if (rv == 0)
{ {
rv = datastream.readRawData( (char*)localbuf, hdr.e2pSize); rv = datastream.readRawData((char *)localbuf, hdr.e2pSize);
} }
else else
{ {
@ -303,7 +303,7 @@ int e2pFileBuf::Save(int savetype, long relocation_offset)
hdr.e2pType = GetEEpromType(); hdr.e2pType = GetEEpromType();
strncpy(hdr.e2pStringID, GetStringID().toLatin1().constData(), 28); strncpy(hdr.e2pStringID, GetStringID().toLatin1().constData(), 28);
strncpy (hdr.e2pComment, GetComment().toLatin1().constData(), 85); strncpy(hdr.e2pComment, GetComment().toLatin1().constData(), 85);
hdr.flags = GetRollOver() & 7; hdr.flags = GetRollOver() & 7;
hdr.split_size_Low = (uint16_t)GetSplitted(); hdr.split_size_Low = (uint16_t)GetSplitted();
hdr.split_size_High = (uint16_t)(GetSplitted() >> 16); hdr.split_size_High = (uint16_t)(GetSplitted() >> 16);
@ -311,8 +311,8 @@ int e2pFileBuf::Save(int savetype, long relocation_offset)
hdr.headCrc = mcalc_crc(&hdr, sizeof(hdr) - sizeof(hdr.headCrc)); hdr.headCrc = mcalc_crc(&hdr, sizeof(hdr) - sizeof(hdr.headCrc));
//Write to file //Write to file
if ( datastream.writeRawData((char*)&hdr, sizeof(hdr)) && //Write the header if (datastream.writeRawData((char *)&hdr, sizeof(hdr)) && //Write the header
datastream.writeRawData((char*)localbuf, hdr.e2pSize) ) //Write the buffer datastream.writeRawData((char *)localbuf, hdr.e2pSize)) //Write the buffer
{ {
rval = GetNoOfBlock(); rval = GetNoOfBlock();
} }

View File

@ -35,7 +35,7 @@
class e2pFileBuf : public FileBuf class e2pFileBuf : public FileBuf
{ {
public: //---------------------------------------- public public: //---------------------------------------- public
e2pFileBuf(e2AppWinInfo *wininfo = 0); e2pFileBuf(e2AppWinInfo *wininfo = 0);
virtual ~e2pFileBuf(); virtual ~e2pFileBuf();
@ -43,9 +43,9 @@ public: //---------------------------------------- public
virtual int Load(int loadtype = ALL_TYPE, long relocation_offfset = 0); virtual int Load(int loadtype = ALL_TYPE, long relocation_offfset = 0);
virtual int Save(int savetype = ALL_TYPE, long relocation_offfset = 0); virtual int Save(int savetype = ALL_TYPE, long relocation_offfset = 0);
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
private: //--------------------------------------- private private: //--------------------------------------- private
// void check_offsets(); // void check_offsets();
}; };
#endif #endif

View File

@ -40,7 +40,7 @@
QString E2Profile::filename = "e2p.ini"; QString E2Profile::filename = "e2p.ini";
QSettings* E2Profile::s = new QSettings("e2p.ini", QSettings::IniFormat); QSettings *E2Profile::s = new QSettings("e2p.ini", QSettings::IniFormat);
@ -85,7 +85,7 @@ int E2Profile::GetBogoMips()
void E2Profile::SetBogoMips(int value) void E2Profile::SetBogoMips(int value)
{ {
// QString str; // QString str;
s->setValue ("BogoMipsX1000", QString::number(value)); s->setValue("BogoMipsX1000", QString::number(value));
// if ( decnum2str(value, str, MAXNUMDIGIT) == OK ) // if ( decnum2str(value, str, MAXNUMDIGIT) == OK )
// { // {
// return s->setValue("BogoMipsX1000", str); // return s->setValue("BogoMipsX1000", str);
@ -163,7 +163,7 @@ int E2Profile::GetParPortNo()
bool ok; bool ok;
rval = sp.toInt(&ok); rval = sp.toInt(&ok);
if (ok == false ) if (ok == false)
{ {
rval = -1; rval = -1;
} }
@ -478,23 +478,23 @@ int E2Profile::GetI2CSpeed()
if (sp.length()) if (sp.length())
{ {
if ( sp == "TURBO") if (sp == "TURBO")
{ {
rval = TURBO; rval = TURBO;
} }
else if ( sp == "FAST") else if (sp == "FAST")
{ {
rval = FAST; rval = FAST;
} }
else if ( sp == "SLOW") else if (sp == "SLOW")
{ {
rval = SLOW; rval = SLOW;
} }
else if ( sp == "VERYSLOW") else if (sp == "VERYSLOW")
{ {
rval = VERYSLOW; rval = VERYSLOW;
} }
else if ( sp == "ULTRASLOW") else if (sp == "ULTRASLOW")
{ {
rval = ULTRASLOW; rval = ULTRASLOW;
} }
@ -632,23 +632,23 @@ int E2Profile::GetSPISpeed()
if (sp.length()) if (sp.length())
{ {
if ( sp == "TURBO") if (sp == "TURBO")
{ {
rval = TURBO; rval = TURBO;
} }
else if ( sp == "FAST") else if (sp == "FAST")
{ {
rval = FAST; rval = FAST;
} }
else if ( sp == "SLOW") else if (sp == "SLOW")
{ {
rval = SLOW; rval = SLOW;
} }
else if ( sp == "VERYSLOW") else if (sp == "VERYSLOW")
{ {
rval = VERYSLOW; rval = VERYSLOW;
} }
else if ( sp == "ULTRASLOW") else if (sp == "ULTRASLOW")
{ {
rval = ULTRASLOW; rval = ULTRASLOW;
} }
@ -717,23 +717,23 @@ int E2Profile::GetMicroWireSpeed()
if (sp.length()) if (sp.length())
{ {
if ( sp == "TURBO") if (sp == "TURBO")
{ {
rval = TURBO; rval = TURBO;
} }
else if ( sp == "FAST") else if (sp == "FAST")
{ {
rval = FAST; rval = FAST;
} }
else if ( sp == "SLOW") else if (sp == "SLOW")
{ {
rval = SLOW; rval = SLOW;
} }
else if ( sp == "VERYSLOW") else if (sp == "VERYSLOW")
{ {
rval = VERYSLOW; rval = VERYSLOW;
} }
else if ( sp == "ULTRASLOW") else if (sp == "ULTRASLOW")
{ {
rval = ULTRASLOW; rval = ULTRASLOW;
} }
@ -779,23 +779,23 @@ int E2Profile::GetPICSpeed()
if (sp.length()) if (sp.length())
{ {
if ( sp == "TURBO") if (sp == "TURBO")
{ {
rval = TURBO; rval = TURBO;
} }
else if ( sp == "FAST") else if (sp == "FAST")
{ {
rval = FAST; rval = FAST;
} }
else if ( sp == "SLOW") else if (sp == "SLOW")
{ {
rval = SLOW; rval = SLOW;
} }
else if ( sp == "VERYSLOW") else if (sp == "VERYSLOW")
{ {
rval = VERYSLOW; rval = VERYSLOW;
} }
else if ( sp == "ULTRASLOW") else if (sp == "ULTRASLOW")
{ {
rval = ULTRASLOW; rval = ULTRASLOW;
} }
@ -841,23 +841,23 @@ int E2Profile::GetSDESpeed()
if (sp.length()) if (sp.length())
{ {
if ( sp == "TURBO") if (sp == "TURBO")
{ {
rval = TURBO; rval = TURBO;
} }
else if ( sp == "FAST") else if (sp == "FAST")
{ {
rval = FAST; rval = FAST;
} }
else if ( sp == "SLOW") else if (sp == "SLOW")
{ {
rval = SLOW; rval = SLOW;
} }
else if ( sp == "VERYSLOW") else if (sp == "VERYSLOW")
{ {
rval = VERYSLOW; rval = VERYSLOW;
} }
else if ( sp == "ULTRASLOW") else if (sp == "ULTRASLOW")
{ {
rval = ULTRASLOW; rval = ULTRASLOW;
} }
@ -903,23 +903,23 @@ int E2Profile::GetIMBusSpeed()
if (sp.length()) if (sp.length())
{ {
if ( sp == "TURBO") if (sp == "TURBO")
{ {
rval = TURBO; rval = TURBO;
} }
else if ( sp == "FAST") else if (sp == "FAST")
{ {
rval = FAST; rval = FAST;
} }
else if ( sp == "SLOW") else if (sp == "SLOW")
{ {
rval = SLOW; rval = SLOW;
} }
else if ( sp == "VERYSLOW") else if (sp == "VERYSLOW")
{ {
rval = VERYSLOW; rval = VERYSLOW;
} }
else if ( sp == "ULTRASLOW") else if (sp == "ULTRASLOW")
{ {
rval = ULTRASLOW; rval = ULTRASLOW;
} }
@ -1121,17 +1121,17 @@ int E2Profile::GetSerialNumAddress(long &start, int &size, bool &mtype)
size = 1; size = 1;
mtype = false; mtype = false;
if ( (sp = s->value("SerialNumberAddr", "0").toString()).length() ) if ((sp = s->value("SerialNumberAddr", "0").toString()).length())
{ {
start = sp.toLong(); start = sp.toLong();
} }
if ( (sp = s->value("SerialNumberSize", "1").toString()).length() ) if ((sp = s->value("SerialNumberSize", "1").toString()).length())
{ {
size = sp.toInt(); size = sp.toInt();
} }
if ( (sp = s->value("SerialNumberType", "PROG").toString()).length() ) if ((sp = s->value("SerialNumberType", "PROG").toString()).length())
{ {
if (sp == "DATA") if (sp == "DATA")
{ {
@ -1163,7 +1163,7 @@ FmtEndian E2Profile::GetSerialNumFormat()
{ {
QString sp = s->value("SerialNumberFormat", "BIGENDIAN").toString(); QString sp = s->value("SerialNumberFormat", "BIGENDIAN").toString();
if ( sp.length() && ("LITTLEENDIAN" == sp)) if (sp.length() && ("LITTLEENDIAN" == sp))
{ {
return FMT_LITTLE_ENDIAN; return FMT_LITTLE_ENDIAN;
} }
@ -1653,17 +1653,17 @@ int E2Profile::GetCalibrationAddress(long &start, int &size, bool &mtype)
size = 1; size = 1;
mtype = false; mtype = false;
if ( (sp = s->value("OscCalibrationAddr", "0").toString()).length() ) if ((sp = s->value("OscCalibrationAddr", "0").toString()).length())
{ {
start = sp.toLong(); start = sp.toLong();
} }
if ( (sp = s->value("OscCalibrationSize", "1").toString()).length() ) if ((sp = s->value("OscCalibrationSize", "1").toString()).length())
{ {
size = sp.toInt(); size = sp.toInt();
} }
if ( (sp = s->value("OscCalibrationMemType", "PROG").toString()).length() ) if ((sp = s->value("OscCalibrationMemType", "PROG").toString()).length())
{ {
if (sp == "DATA") if (sp == "DATA")
{ {
@ -1809,12 +1809,12 @@ void E2Profile::SetCOMAddress(int com1, int com2, int com3, int com4)
} }
else else
{ {
str.sprintf( "%X,%X", com1, com2); str.sprintf("%X,%X", com1, com2);
} }
} }
else else
{ {
str.sprintf( "%X", com1); str.sprintf("%X", com1);
} }
s->setValue("COMPorts", str); s->setValue("COMPorts", str);
@ -1873,23 +1873,23 @@ FileType E2Profile::GetDefaultFileType()
if (sp.length()) if (sp.length())
{ {
if ( sp == "e2p" ) if (sp == "e2p")
{ {
ft = E2P; ft = E2P;
} }
else if ( sp == "bin" ) else if (sp == "bin")
{ {
ft = BIN; ft = BIN;
} }
else if ( sp == "csm" ) else if (sp == "csm")
{ {
ft = CSM; ft = CSM;
} }
else if ( sp == "intel-hex") else if (sp == "intel-hex")
{ {
ft = INTEL; ft = INTEL;
} }
else if ( sp == "mot-srec") else if (sp == "mot-srec")
{ {
ft = MOTOS; ft = MOTOS;
} }

View File

@ -85,7 +85,7 @@ enum
class E2Profile class E2Profile
{ {
public: //---------------------------------------- public public: //---------------------------------------- public
// E2Profile(const QString &nm); // E2Profile(const QString &nm);
// virtual ~E2Profile(); // virtual ~E2Profile();
@ -253,9 +253,9 @@ public: //---------------------------------------- public
static bool GetEditBufferEnabled(); static bool GetEditBufferEnabled();
static void SetEditBufferEnabled(bool enable); static void SetEditBufferEnabled(bool enable);
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
private: //--------------------------------------- private private: //--------------------------------------- private
static QSettings *s; static QSettings *s;
static QString filename; //name of .INI file static QString filename; //name of .INI file
}; };

View File

@ -88,7 +88,7 @@ int EasyI2CInterface::Open(int port_no)
if (IsInstalled() != port_no) if (IsInstalled() != port_no)
{ {
if ( InDataPort(port_no) < 0 ) if (InDataPort(port_no) < 0)
{ {
ret_val = E2ERR_OPENFAILED; ret_val = E2ERR_OPENFAILED;
} }
@ -120,7 +120,7 @@ void EasyI2CInterface::SetDataOut(int sda)
if (IsInstalled()) if (IsInstalled())
{ {
if ( (E2Profile::GetPolarityControl() & DOUTINV) != 0 ) if ((E2Profile::GetPolarityControl() & DOUTINV) != 0)
{ {
sda = !sda; sda = !sda;
} }
@ -136,7 +136,7 @@ void EasyI2CInterface::SetClock(int scl)
if (IsInstalled()) if (IsInstalled())
{ {
if ( (E2Profile::GetPolarityControl() & CLOCKINV) != 0 ) if ((E2Profile::GetPolarityControl() & CLOCKINV) != 0)
{ {
scl = !scl; scl = !scl;
} }

View File

@ -34,7 +34,7 @@
class EasyI2CInterface : public LptExtInterface class EasyI2CInterface : public LptExtInterface
{ {
public: //------------------------------- public public: //------------------------------- public
EasyI2CInterface(bool use_io = false); EasyI2CInterface(bool use_io = false);
virtual int Open(int com_no); virtual int Open(int com_no);
@ -49,9 +49,9 @@ public: //------------------------------- public
virtual int IsClockDataDOWN() ; virtual int IsClockDataDOWN() ;
virtual int TestPort(int port); virtual int TestPort(int port);
protected: //------------------------------- protected protected: //------------------------------- protected
private: //------------------------------- private private: //------------------------------- private
}; };

View File

@ -90,7 +90,7 @@ chipInfo GetChipInfo(QVector<chipInfo> &c, long subtype)
// it's smart pointer to vector // it's smart pointer to vector
static QVector<chipInfo> const GetMap(int pritype) static QVector<chipInfo> const GetMap(int pritype)
{ {
switch(pritype) switch (pritype)
{ {
//AutoTag //AutoTag
//Returns vector //Returns vector
@ -392,7 +392,7 @@ QString GetEEPTypeString(int pritype, int subtype)
{ {
qDebug() << "mp" << mp.count(); qDebug() << "mp" << mp.count();
foreach(chipInfo i, mp) foreach (chipInfo i, mp)
{ {
if ((i.id & 0x07fff) == subtype) if ((i.id & 0x07fff) == subtype)
{ {
@ -414,7 +414,7 @@ QString GetEEPTypeString(unsigned long type)
if (mp.count()) if (mp.count())
{ {
foreach(chipInfo i, mp) foreach (chipInfo i, mp)
{ {
if ((i.id & 0x07fff) == subtype) if ((i.id & 0x07fff) == subtype)
{ {

View File

@ -408,7 +408,7 @@ static QVector<chipInfo> const eepAt89s_map =
static QVector<chipInfo> const eep93x6_map = static QVector<chipInfo> const eep93x6_map =
{ {
// "93XX Auto", E9300 // "93XX Auto", E9300
{"9306", E9306, 16 , -1, -1, 64}, {"9306", E9306, 16, -1, -1, 64},
{"9346", E9346, 64, -1, -1, 64}, {"9346", E9346, 64, -1, -1, 64},
{"9356", E9356, 128, -1, -1, 256}, {"9356", E9356, 128, -1, -1, 256},
{"9357", E9357, 128, -1, -1, 128}, {"9357", E9357, 128, -1, -1, 128},

View File

@ -40,7 +40,7 @@ class e2AppWinInfo;
class FileBuf class FileBuf
{ {
public: //---------------------------------------- public public: //---------------------------------------- public
FileBuf(e2AppWinInfo *wininfo = 0); FileBuf(e2AppWinInfo *wininfo = 0);
virtual ~FileBuf(); virtual ~FileBuf();
@ -87,7 +87,7 @@ public: //---------------------------------------- public
// { return awi->GetCRC(); } // { return awi->GetCRC(); }
void SetCRC(uint16_t c); void SetCRC(uint16_t c);
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
uint8_t *GetBufPtr() const; uint8_t *GetBufPtr() const;
long GetBufSize() const; long GetBufSize() const;
@ -98,7 +98,7 @@ protected: //--------------------------------------- protected
// Informazioni addizionali sull'eeprom che vengono salvate nel file // Informazioni addizionali sull'eeprom che vengono salvate nel file
private: //--------------------------------------- private private: //--------------------------------------- private
e2AppWinInfo *awi; //puntatore alla AppWinInfo che contiene questo FileBuffer e2AppWinInfo *awi; //puntatore alla AppWinInfo che contiene questo FileBuffer
}; };

View File

@ -42,7 +42,7 @@ using namespace Translator;
class e2CmdWindow; class e2CmdWindow;
//=========================>>> FillDialog::FillDialog <<<==================== //=========================>>> FillDialog::FillDialog <<<====================
FillDialog::FillDialog(QWidget* bw, long &cfrom, long &cto, int &cval, long max_addr, const QString title) : FillDialog::FillDialog(QWidget *bw, long &cfrom, long &cto, int &cval, long max_addr, const QString title) :
QDialog(bw) QDialog(bw)
{ {
setupUi(this); setupUi(this);

View File

@ -44,18 +44,18 @@ using namespace Translator;
class FillDialog : public QDialog, public Ui::BlockDialog class FillDialog : public QDialog, public Ui::BlockDialog
{ {
Q_OBJECT Q_OBJECT
public: //---------------------------------------- public public: //---------------------------------------- public
FillDialog(QWidget* bw, long &cfrom, long &cto, int &cval, long max_addr, const QString title = STR_LBLFILLBUF); FillDialog(QWidget *bw, long &cfrom, long &cto, int &cval, long max_addr, const QString title = STR_LBLFILLBUF);
virtual ~FillDialog(); // Destructor virtual ~FillDialog(); // Destructor
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
private slots: private slots:
void onOk(); void onOk();
private: //--------------------------------------- private private: //--------------------------------------- private
long *pFrom, *pTo; long *pFrom, *pTo;
int *pVal; int *pVal;

View File

@ -38,7 +38,7 @@ using namespace Translator;
//======================>>> fuseModalDialog::fuseModalDialog <<<================== //======================>>> fuseModalDialog::fuseModalDialog <<<==================
fuseModalDialog::fuseModalDialog(e2CmdWindow* bw, e2AppWinInfo *p, bool readonly, const QString &msg) : fuseModalDialog::fuseModalDialog(e2CmdWindow *bw, e2AppWinInfo *p, bool readonly, const QString &msg) :
QDialog(bw) QDialog(bw)
{ {
setupUi(this); setupUi(this);
@ -61,13 +61,13 @@ fuseModalDialog::fuseModalDialog(e2CmdWindow* bw, e2AppWinInfo *p, bool readonly
qDebug() << "fuseModalDialog::fuseModalDialog()"; qDebug() << "fuseModalDialog::fuseModalDialog()";
chkFuse = (QVector<QCheckBox*>() << chk0_F0 << chk1_F0 << chk2_F0 << chk3_F0 << chk4_F0 << chk5_F0 << chk6_F0 << chk7_F0 chkFuse = (QVector<QCheckBox *>() << chk0_F0 << chk1_F0 << chk2_F0 << chk3_F0 << chk4_F0 << chk5_F0 << chk6_F0 << chk7_F0
<< chk0_F1 << chk1_F1 << chk2_F1 << chk3_F1 << chk4_F1 << chk5_F1 << chk6_F1 << chk7_F1 << chk0_F1 << chk1_F1 << chk2_F1 << chk3_F1 << chk4_F1 << chk5_F1 << chk6_F1 << chk7_F1
<< chk0_F2 << chk1_F2 << chk2_F2 << chk3_F2 << chk4_F2 << chk5_F2 << chk6_F2 << chk7_F2 << chk0_F2 << chk1_F2 << chk2_F2 << chk3_F2 << chk4_F2 << chk5_F2 << chk6_F2 << chk7_F2
<< chk0_F3 << chk1_F3 << chk2_F3 << chk3_F3 << chk4_F3 << chk5_F3 << chk6_F3 << chk7_F3 << chk0_F3 << chk1_F3 << chk2_F3 << chk3_F3 << chk4_F3 << chk5_F3 << chk6_F3 << chk7_F3
); );
chkLock = (QVector<QCheckBox*>() << chk0_L0 << chk1_L0 << chk2_L0 << chk3_L0 << chk4_L0 << chk5_L0 << chk6_L0 << chk7_L0 chkLock = (QVector<QCheckBox *>() << chk0_L0 << chk1_L0 << chk2_L0 << chk3_L0 << chk4_L0 << chk5_L0 << chk6_L0 << chk7_L0
<< chk0_L1 << chk1_L1 << chk2_L1 << chk3_L1 << chk4_L1 << chk5_L1 << chk6_L1 << chk7_L1 << chk0_L1 << chk1_L1 << chk2_L1 << chk3_L1 << chk4_L1 << chk5_L1 << chk6_L1 << chk7_L1
<< chk0_L2 << chk1_L2 << chk2_L2 << chk3_L2 << chk4_L2 << chk5_L2 << chk6_L2 << chk7_L2 << chk0_L2 << chk1_L2 << chk2_L2 << chk3_L2 << chk4_L2 << chk5_L2 << chk6_L2 << chk7_L2
<< chk0_L3 << chk1_L3 << chk2_L3 << chk3_L3 << chk4_L3 << chk5_L3 << chk6_L3 << chk7_L3 << chk0_L3 << chk1_L3 << chk2_L3 << chk3_L3 << chk4_L3 << chk5_L3 << chk6_L3 << chk7_L3
@ -97,7 +97,7 @@ void fuseModalDialog::setTextWidgets()
{ {
int i = 0; int i = 0;
foreach(QCheckBox* c, chkFuse) foreach (QCheckBox *c, chkFuse)
{ {
c->setText(QString().sprintf(" %d", i)); c->setText(QString().sprintf(" %d", i));
i++; i++;
@ -110,7 +110,7 @@ void fuseModalDialog::setTextWidgets()
i = 0; i = 0;
foreach(QCheckBox* c, chkLock) foreach (QCheckBox *c, chkLock)
{ {
c->setText(QString().sprintf(" %d", i)); c->setText(QString().sprintf(" %d", i));
i++; i++;
@ -151,7 +151,7 @@ void fuseModalDialog::onOk()
if (read == true) if (read == true)
{ {
emit done (2); emit done(2);
} }
else else
{ {
@ -208,38 +208,38 @@ void fuseModalDialog::initWidgets(const QString &msg, long int type, bool readon
{ {
FuseBit fBit = eep_fusebits.at(j); FuseBit fBit = eep_fusebits.at(j);
frmLock0->setHidden( fBit.lockenable3 == 0); frmLock0->setHidden(fBit.lockenable3 == 0);
frmLock1->setHidden( fBit.lockenable2 == 0); frmLock1->setHidden(fBit.lockenable2 == 0);
frmLock2->setHidden( fBit.lockenable1 == 0); frmLock2->setHidden(fBit.lockenable1 == 0);
frmLock3->setHidden( fBit.lockenable0 == 0); frmLock3->setHidden(fBit.lockenable0 == 0);
frmFuses0->setHidden( fBit.fuseenable3 == 0); frmFuses0->setHidden(fBit.fuseenable3 == 0);
frmFuses1->setHidden( fBit.fuseenable2 == 0); frmFuses1->setHidden(fBit.fuseenable2 == 0);
frmFuses2->setHidden( fBit.fuseenable1 == 0); frmFuses2->setHidden(fBit.fuseenable1 == 0);
frmFuses3->setHidden( fBit.fuseenable0 == 0); frmFuses3->setHidden(fBit.fuseenable0 == 0);
if ( fBit.lockenable3 == 0 && if (fBit.lockenable3 == 0 &&
fBit.lockenable2 == 0 && fBit.lockenable2 == 0 &&
fBit.lockenable1 == 0 && fBit.lockenable1 == 0 &&
fBit.lockenable0 == 0 ) fBit.lockenable0 == 0)
{ {
frmLock->setHidden( true); frmLock->setHidden(true);
} }
else else
{ {
frmLock->setHidden( false); frmLock->setHidden(false);
} }
if ( fBit.fuseenable3 == 0 && if (fBit.fuseenable3 == 0 &&
fBit.fuseenable2 == 0 && fBit.fuseenable2 == 0 &&
fBit.fuseenable1 == 0 && fBit.fuseenable1 == 0 &&
fBit.fuseenable0 == 0 ) fBit.fuseenable0 == 0)
{ {
frmFuses->setHidden(true); frmFuses->setHidden(true);
} }
else else
{ {
frmFuses->setHidden( false); frmFuses->setHidden(false);
} }
@ -247,7 +247,7 @@ void fuseModalDialog::initWidgets(const QString &msg, long int type, bool readon
for (int k = 0; k < LOCKPACKSIZE; k++) for (int k = 0; k < LOCKPACKSIZE; k++)
{ {
QString sp; QString sp;
QString def = QString().sprintf( " %d", k); QString def = QString().sprintf(" %d", k);
sp = fBit.locklabel3[k]; sp = fBit.locklabel3[k];
@ -342,7 +342,7 @@ void fuseModalDialog::initWidgets(const QString &msg, long int type, bool readon
//Default (disable all) //Default (disable all)
for (int k = 0; k < LOCKPACKSIZE; k++) for (int k = 0; k < LOCKPACKSIZE; k++)
{ {
QString def = QString().sprintf( " %d", k); QString def = QString().sprintf(" %d", k);
//Label //Label
chkLock.at(0 * 8 + k)->setText(def); chkLock.at(0 * 8 + k)->setText(def);
chkLock.at(1 * 8 + k)->setText(def); chkLock.at(1 * 8 + k)->setText(def);
@ -400,7 +400,7 @@ void fuseModalDialog::initWidgets(const QString &msg, long int type, bool readon
//=========================>>> blockDialog::blockDialog <<<==================== //=========================>>> blockDialog::blockDialog <<<====================
blockDialog::blockDialog(e2CmdWindow* bw, e2AppWinInfo *p, bool readonly, const QString &msg) : blockDialog::blockDialog(e2CmdWindow *bw, e2AppWinInfo *p, bool readonly, const QString &msg) :
QDialog(bw) QDialog(bw)
{ {
setupUi(this); setupUi(this);
@ -426,13 +426,13 @@ blockDialog::blockDialog(e2CmdWindow* bw, e2AppWinInfo *p, bool readonly, const
lblTo->setText(STR_MSGNUMBLOCK); lblTo->setText(STR_MSGNUMBLOCK);
lblVal->setText(STR_MSGHIGHENDBLK); lblVal->setText(STR_MSGHIGHENDBLK);
QString str1 = QString().sprintf( "%d", (int)((lock >> 4) & 0x0F) ); QString str1 = QString().sprintf("%d", (int)((lock >> 4) & 0x0F));
QString str2 = QString().sprintf( "%d", (int)(lock & 0x0F) ); QString str2 = QString().sprintf("%d", (int)(lock & 0x0F));
QString str3 = QString().sprintf( "%d", (int)(fuse & 0x0F) ); QString str3 = QString().sprintf("%d", (int)(fuse & 0x0F));
txiFrom->setText(str1); txiFrom->setText(str1);
txiTo->setText( str2); txiTo->setText(str2);
txiVal->setText( str3); txiVal->setText(str3);
pushOk->setText(STR_BTNOK); pushOk->setText(STR_BTNOK);
pushCancel->setText(STR_BTNCANC); pushCancel->setText(STR_BTNCANC);

View File

@ -73,25 +73,25 @@ typedef struct
class fuseModalDialog : public QDialog, public Ui::FuseDialog class fuseModalDialog : public QDialog, public Ui::FuseDialog
{ {
Q_OBJECT Q_OBJECT
public: //---------------------------------------- public public: //---------------------------------------- public
fuseModalDialog(e2CmdWindow* bw, e2AppWinInfo *p, bool readonly = false, const QString &msg = ""); fuseModalDialog(e2CmdWindow *bw, e2AppWinInfo *p, bool readonly = false, const QString &msg = "");
virtual ~fuseModalDialog(); // Destructor virtual ~fuseModalDialog(); // Destructor
private slots: private slots:
void onOk(); void onOk();
void onRead(); void onRead();
void onProg(); void onProg();
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
private: private:
void setTextWidgets(); void setTextWidgets();
void initWidgets(const QString &msg, long type, bool readonly); void initWidgets(const QString &msg, long type, bool readonly);
int eep_FindFuses(long type); int eep_FindFuses(long type);
private: //--------------------------------------- private private: //--------------------------------------- private
QVector<QCheckBox*> chkFuse; QVector<QCheckBox *> chkFuse;
QVector<QCheckBox*> chkLock; QVector<QCheckBox *> chkLock;
uint32_t lock, fuse; uint32_t lock, fuse;
@ -1120,16 +1120,16 @@ const QVector<FuseBit> eep_fusebits =
class blockDialog : public QDialog, public Ui::BlockDialog class blockDialog : public QDialog, public Ui::BlockDialog
{ {
Q_OBJECT Q_OBJECT
public: //---------------------------------------- public public: //---------------------------------------- public
blockDialog(e2CmdWindow* bw, e2AppWinInfo *p, bool readonly = false, const QString &msg = ""); blockDialog(e2CmdWindow *bw, e2AppWinInfo *p, bool readonly = false, const QString &msg = "");
virtual ~blockDialog(); // Destructor virtual ~blockDialog(); // Destructor
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
private slots: private slots:
void onOk(); void onOk();
private: //--------------------------------------- private private: //--------------------------------------- private
e2AppWinInfo *awip; e2AppWinInfo *awip;
uint32_t lock, fuse; uint32_t lock, fuse;
}; };

View File

@ -93,7 +93,7 @@ int I2CBus::SendStart()
{ {
int k; int k;
for(k = SCLTIMEOUT; getSCL() == 0 && k > 0; k--) for (k = SCLTIMEOUT; getSCL() == 0 && k > 0; k--)
{ {
WaitUsec(1); WaitUsec(1);
} }
@ -108,7 +108,7 @@ int I2CBus::SendStart()
WaitUsec(shot_delay / 2); WaitUsec(shot_delay / 2);
#endif #endif
if ( (err = CheckBusy()) ) if ((err = CheckBusy()))
{ {
return err; return err;
} }
@ -134,7 +134,7 @@ int I2CBus::SendStop()
{ {
int k; int k;
for(k = SCLTIMEOUT; getSCL() == 0 && k > 0; k--) for (k = SCLTIMEOUT; getSCL() == 0 && k > 0; k--)
{ {
WaitUsec(1); WaitUsec(1);
} }
@ -178,7 +178,7 @@ int I2CBus::SendBitMast(int b)
#ifdef SCLTIMEOUT #ifdef SCLTIMEOUT
int k; int k;
for(k = SCLTIMEOUT; getSCL() == 0 && k > 0; k--) for (k = SCLTIMEOUT; getSCL() == 0 && k > 0; k--)
{ {
WaitUsec(1); WaitUsec(1);
} }
@ -221,7 +221,7 @@ int I2CBus::RecBitMast()
#ifdef SCLTIMEOUT #ifdef SCLTIMEOUT
int k; int k;
for(k = SCLTIMEOUT; getSCL() == 0 && k > 0; k--) for (k = SCLTIMEOUT; getSCL() == 0 && k > 0; k--)
{ {
WaitUsec(1); WaitUsec(1);
} }
@ -249,7 +249,7 @@ int I2CBus::SendByteMast(int by)
int lrb, k; int lrb, k;
for (k = 7; k >= 0; k--) for (k = 7; k >= 0; k--)
if ( (lrb = SendBitMast(by & (1 << k))) ) if ((lrb = SendBitMast(by & (1 << k))))
{ {
return lrb; return lrb;
} }
@ -274,7 +274,7 @@ int I2CBus::SendByteMastLSB(int by)
int lrb, k; int lrb, k;
for (k = 0; k < 8; k++) for (k = 0; k < 8; k++)
if ( (lrb = SendBitMast(by & (1 << k))) ) if ((lrb = SendBitMast(by & (1 << k))))
{ {
return lrb; return lrb;
} }
@ -313,7 +313,7 @@ int I2CBus::RecByteMast(int ack)
} }
} }
if ( (k = SendBitMast(ack)) ) // send the ack if ((k = SendBitMast(ack))) // send the ack
{ {
return k; return k;
} }
@ -342,7 +342,7 @@ int I2CBus::RecByteMastLSB(int ack)
} }
} }
if ( (k = SendBitMast(ack)) ) // send the ack if ((k = SendBitMast(ack))) // send the ack
{ {
return k; return k;
} }
@ -357,7 +357,7 @@ void I2CBus::SetDelay()
int val = E2Profile::GetI2CSpeed(); int val = E2Profile::GetI2CSpeed();
int n; int n;
switch(val) switch (val)
{ {
case TURBO: case TURBO:
n = 0; // as fast as your PC can n = 0; // as fast as your PC can
@ -393,11 +393,11 @@ long I2CBus::Read(int slave, uint8_t *data, long length, int page_size)
{ {
long len; long len;
qDebug() << "I2CBus::Read(" << slave << ", " << (void*) data << ", " << length << ") - IN"; qDebug() << "I2CBus::Read(" << slave << ", " << (void *) data << ", " << length << ") - IN";
len = StartRead(slave, data, length); len = StartRead(slave, data, length);
if (len == length) if (len == length)
if ( err_no || Stop() ) if (err_no || Stop())
{ {
len = 0; len = 0;
} }
@ -416,7 +416,7 @@ long I2CBus::Write(int slave, uint8_t const *data, long length, int page_size)
len = StartWrite(slave, data, length); len = StartWrite(slave, data, length);
if (len == length) if (len == length)
if ( err_no || Stop()) if (err_no || Stop())
{ {
len = 0; len = 0;
} }
@ -455,13 +455,13 @@ int I2CBus::Start(uint8_t slave)
int temp; int temp;
// send Start // send Start
if ( (temp = SendStart()) ) if ((temp = SendStart()))
{ {
err_no = temp; err_no = temp;
return err_no; return err_no;
} }
if ( (temp = SendByteMast(slave)) != 0 ) if ((temp = SendByteMast(slave)) != 0)
{ {
err_no = (temp == IICERR_NOTACK) ? IICERR_NOADDRACK : temp; err_no = (temp == IICERR_NOTACK) ? IICERR_NOADDRACK : temp;
last_addr = slave; last_addr = slave;
@ -486,13 +486,13 @@ long I2CBus::StartRead(uint8_t slave, uint8_t *data, long length)
if (len > 0) if (len > 0)
{ {
// send Start // send Start
if ( (temp = SendStart()) ) if ((temp = SendStart()))
{ {
err_no = temp; err_no = temp;
return 0; return 0;
} }
if ( (temp = SendByteMast(slave | 1)) != 0 ) if ((temp = SendByteMast(slave | 1)) != 0)
{ {
err_no = (temp == IICERR_NOTACK) ? IICERR_NOADDRACK : temp; err_no = (temp == IICERR_NOTACK) ? IICERR_NOADDRACK : temp;
last_addr = slave | 1; last_addr = slave | 1;
@ -542,13 +542,13 @@ long I2CBus::StartWrite(uint8_t slave, uint8_t const *data, long length)
return 0; return 0;
} }
if ( (error = SendStart()) ) if ((error = SendStart()))
{ {
err_no = error; err_no = error;
return 0; return 0;
} }
if ( (error = SendByteMast(slave & 0xFE)) ) if ((error = SendByteMast(slave & 0xFE)))
{ {
err_no = (error == IICERR_NOTACK) ? IICERR_NOADDRACK : error; err_no = (error == IICERR_NOTACK) ? IICERR_NOADDRACK : error;
last_addr = slave & 0xFE; last_addr = slave & 0xFE;
@ -557,7 +557,7 @@ long I2CBus::StartWrite(uint8_t slave, uint8_t const *data, long length)
while (len > 0) while (len > 0)
{ {
if ( (error = SendByteMast(*data++)) != 0 ) if ((error = SendByteMast(*data++)) != 0)
{ {
err_no = error; err_no = error;
goto fineW; goto fineW;
@ -616,7 +616,7 @@ int I2CBus::TestPort(int port)
// Send general call address 0x00 // Send general call address 0x00
int err = Start(0x00 | 1); int err = Start(0x00 | 1);
if ( err != OK && err != IICERR_NOADDRACK ) if (err != OK && err != IICERR_NOADDRACK)
{ {
ret_val = err; ret_val = err;
} }

View File

@ -34,7 +34,7 @@
class I2CBus : public BusIO class I2CBus : public BusIO
{ {
public: //------------------------------- public public: //------------------------------- public
I2CBus(BusInterface *ptr = 0); I2CBus(BusInterface *ptr = 0);
virtual ~I2CBus(); virtual ~I2CBus();
@ -55,7 +55,7 @@ public: //------------------------------- public
void SetDelay(); void SetDelay();
protected: //------------------------------- protected protected: //------------------------------- protected
int CheckBusy(); int CheckBusy();
int SendStart(); int SendStart();
@ -67,7 +67,7 @@ protected: //------------------------------- protected
int RecByteMast(int ack); int RecByteMast(int ack);
int RecByteMastLSB(int ack); int RecByteMastLSB(int ack);
private: //------------------------------- private private: //------------------------------- private
void setSCLSDA() void setSCLSDA()

View File

@ -105,7 +105,7 @@ void IMBus::SetDelay()
int val = E2Profile::GetIMBusSpeed(); int val = E2Profile::GetIMBusSpeed();
int n; int n;
switch(val) switch (val)
{ {
case TURBO: case TURBO:
n = 1; // as fast as your PC can n = 1; // as fast as your PC can
@ -216,7 +216,7 @@ int IMBus::RecDataWord(int wlen)
setDI(); setDI();
for (k = 0; k < wlen; k++) for (k = 0; k < wlen; k++)
if ( RecDataBit() ) if (RecDataBit())
{ {
val |= 1 << k; val |= 1 << k;
} }
@ -236,7 +236,7 @@ int IMBus::WaitReadyAfterWrite(int addr, int delay, long timeout)
{ {
uint8_t val = 0xff; uint8_t val = 0xff;
while ( (val & (1 << 1)) && timeout-- ) while ((val & (1 << 1)) && timeout--)
{ {
//Read status location at address 526 //Read status location at address 526
@ -293,8 +293,8 @@ long IMBus::Read(int addr, uint8_t *data, long length, int page_size)
*data++ = (uint8_t)RecDataWord(Data16_mode ? 16 : 8); *data++ = (uint8_t)RecDataWord(Data16_mode ? 16 : 8);
IdentPulse(); IdentPulse();
if ( (len % 4) == 0 ) if ((len % 4) == 0)
if ( CheckAbort(len * 100 / length) ) if (CheckAbort(len * 100 / length))
{ {
break; break;
} }
@ -330,7 +330,7 @@ long IMBus::Write(int addr, uint8_t const *data, long length, int page_size)
SendDataWord(0xffff, Data16_mode ? 16 : 8); SendDataWord(0xffff, Data16_mode ? 16 : 8);
IdentPulse(); IdentPulse();
if ( WaitReadyAfterWrite(addr, ProgDelay) != OK ) if (WaitReadyAfterWrite(addr, ProgDelay) != OK)
{ {
return E2P_TIMEOUT; return E2P_TIMEOUT;
} }
@ -349,7 +349,7 @@ long IMBus::Write(int addr, uint8_t const *data, long length, int page_size)
SendDataWord(*data, Data16_mode ? 16 : 8); SendDataWord(*data, Data16_mode ? 16 : 8);
IdentPulse(); IdentPulse();
if ( WaitReadyAfterWrite(addr, ProgDelay) != OK ) if (WaitReadyAfterWrite(addr, ProgDelay) != OK)
{ {
return E2P_TIMEOUT; return E2P_TIMEOUT;
} }
@ -371,7 +371,7 @@ long IMBus::Write(int addr, uint8_t const *data, long length, int page_size)
return E2ERR_WRITEFAILED; return E2ERR_WRITEFAILED;
} }
if ( CheckAbort(len * 100 / length) ) if (CheckAbort(len * 100 / length))
{ {
break; break;
} }

View File

@ -34,7 +34,7 @@
class IMBus : public BusIO class IMBus : public BusIO
{ {
public: //------------------------------- public public: //------------------------------- public
IMBus(BusInterface *ptr = 0); IMBus(BusInterface *ptr = 0);
virtual ~IMBus(); virtual ~IMBus();
@ -50,7 +50,7 @@ public: //------------------------------- public
void SetDataMode(int val); void SetDataMode(int val);
void SetProgDelay(int val); void SetProgDelay(int val);
protected: //------------------------------- protected protected: //------------------------------- protected
int SendAddrWord(int wo); int SendAddrWord(int wo);
int SendDataWord(long wo, int wlen = 8); int SendDataWord(long wo, int wlen = 8);
@ -68,7 +68,7 @@ protected: //------------------------------- protected
busI->SetControlLine(0); busI->SetControlLine(0);
} }
private: //------------------------------- private private: //------------------------------- private
int StatusLocation; int StatusLocation;
bool SecondaryAddress; bool SecondaryAddress;

View File

@ -45,7 +45,7 @@ class e2CmdWindow;
//======================>>> infoModalDialog::infoModalDialog <<<================== //======================>>> infoModalDialog::infoModalDialog <<<==================
e24xx_infoModalDialog::e24xx_infoModalDialog(QWidget* bw, int rlv, uint16_t crc, long size, const QString title) : e24xx_infoModalDialog::e24xx_infoModalDialog(QWidget *bw, int rlv, uint16_t crc, long size, const QString title) :
QDialog(bw) QDialog(bw)
{ {
setupUi(this); setupUi(this);
@ -110,7 +110,7 @@ void e24xx_infoModalDialog::onOk()
//======================>>> infoModalDialog::infoModalDialog <<<================== //======================>>> infoModalDialog::infoModalDialog <<<==================
other_infoModalDialog::other_infoModalDialog(QWidget* bw, long fsize, long esize, uint16_t crc, const QString title) : other_infoModalDialog::other_infoModalDialog(QWidget *bw, long fsize, long esize, uint16_t crc, const QString title) :
QDialog(bw) QDialog(bw)
{ {
setupUi(this); setupUi(this);
@ -130,15 +130,15 @@ other_infoModalDialog::other_infoModalDialog(QWidget* bw, long fsize, long esize
lblTo->setText(STR_MSGEEPSIZE); // size label lblTo->setText(STR_MSGEEPSIZE); // size label
lblVal->setText(STR_MSGFLASHSIZE); // flash size label lblVal->setText(STR_MSGFLASHSIZE); // flash size label
str = QString().sprintf( "%04Xh", crc); str = QString().sprintf("%04Xh", crc);
txiFrom->setText(str); txiFrom->setText(str);
txiFrom->setReadOnly(true); txiFrom->setReadOnly(true);
str = QString().sprintf( "%ld Byte", fsize); str = QString().sprintf("%ld Byte", fsize);
txiTo->setText(str); txiTo->setText(str);
txiTo->setReadOnly(true); txiTo->setReadOnly(true);
str = QString().sprintf( "%ld Byte", esize); str = QString().sprintf("%ld Byte", esize);
txiVal->setText(str); txiVal->setText(str);
txiVal->setReadOnly(true); txiVal->setReadOnly(true);
@ -163,7 +163,7 @@ void other_infoModalDialog::onOk()
} }
notesModalDialog::notesModalDialog(QWidget* bw, QString &id, QString &cm, const QString title) : notesModalDialog::notesModalDialog(QWidget *bw, QString &id, QString &cm, const QString title) :
QDialog(bw) QDialog(bw)
{ {
setupUi(this); setupUi(this);
@ -219,7 +219,7 @@ void notesModalDialog::onOk()
} }
editModalDialog::editModalDialog(QWidget* bw, int curval, const QString title) : editModalDialog::editModalDialog(QWidget *bw, int curval, const QString title) :
QDialog(bw) QDialog(bw)
{ {
setupUi(this); setupUi(this);
@ -290,7 +290,7 @@ void editModalDialog::onEdit()
int newval; int newval;
bool ok; bool ok;
QLineEdit *l = static_cast<QLineEdit*>(sender()); QLineEdit *l = static_cast<QLineEdit *>(sender());
disconnect(txiFrom, SIGNAL(changed()), this, SLOT(onEdit())); // hex disconnect(txiFrom, SIGNAL(changed()), this, SLOT(onEdit())); // hex
disconnect(txiTo, SIGNAL(changed()), this, SLOT(onEdit())); // dec disconnect(txiTo, SIGNAL(changed()), this, SLOT(onEdit())); // dec
disconnect(txiVal, SIGNAL(changed()), this, SLOT(onEdit())); // char disconnect(txiVal, SIGNAL(changed()), this, SLOT(onEdit())); // char
@ -373,7 +373,7 @@ void editModalDialog::onEdit()
const unsigned int MAXLEN = 80; const unsigned int MAXLEN = 80;
editModalDialog2::editModalDialog2(QWidget* bw, const QString curval, const QString title) : editModalDialog2::editModalDialog2(QWidget *bw, const QString curval, const QString title) :
QDialog(bw) QDialog(bw)
{ {
setupUi(this); setupUi(this);

View File

@ -48,17 +48,17 @@ using namespace Translator;
class e24xx_infoModalDialog : public QDialog, public Ui::EditDialog class e24xx_infoModalDialog : public QDialog, public Ui::EditDialog
{ {
Q_OBJECT Q_OBJECT
public: //---------------------------------------- public public: //---------------------------------------- public
e24xx_infoModalDialog(QWidget* bw, int rlv, uint16_t crc, long size, const QString title = STR_MSGDEVINFO); e24xx_infoModalDialog(QWidget *bw, int rlv, uint16_t crc, long size, const QString title = STR_MSGDEVINFO);
virtual ~e24xx_infoModalDialog(); // Destructor virtual ~e24xx_infoModalDialog(); // Destructor
// virtual int infoAction(char* msg = "Device Info"); // virtual int infoAction(char* msg = "Device Info");
private slots: private slots:
void onOk(); void onOk();
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
private: //--------------------------------------- private private: //--------------------------------------- private
}; };
@ -67,17 +67,17 @@ private: //--------------------------------------- private
class other_infoModalDialog : public QDialog, public Ui::EditDialog class other_infoModalDialog : public QDialog, public Ui::EditDialog
{ {
Q_OBJECT Q_OBJECT
public: //---------------------------------------- public public: //---------------------------------------- public
other_infoModalDialog(QWidget* bw, long fsize, long esize, uint16_t crc, const QString title = STR_MSGDEVINFO); other_infoModalDialog(QWidget *bw, long fsize, long esize, uint16_t crc, const QString title = STR_MSGDEVINFO);
virtual ~other_infoModalDialog(); // Destructor virtual ~other_infoModalDialog(); // Destructor
// virtual int infoAction(char* msg = "Device Info"); // virtual int infoAction(char* msg = "Device Info");
private slots: private slots:
void onOk(); void onOk();
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
private: //--------------------------------------- private private: //--------------------------------------- private
}; };
@ -85,19 +85,19 @@ private: //--------------------------------------- private
class notesModalDialog : public QDialog, public Ui::NotesDialog class notesModalDialog : public QDialog, public Ui::NotesDialog
{ {
Q_OBJECT Q_OBJECT
public: //---------------------------------------- public public: //---------------------------------------- public
notesModalDialog(QWidget* bw, QString &id, QString &cm, const QString title = STR_MSGDEVNOTE); notesModalDialog(QWidget *bw, QString &id, QString &cm, const QString title = STR_MSGDEVNOTE);
virtual ~notesModalDialog(); // Destructor virtual ~notesModalDialog(); // Destructor
// QString GetId(); // QString GetId();
// QString GetComment(); // QString GetComment();
// virtual int notesAction(char* msg = STR_MSGDEVNOTE); // virtual int notesAction(char* msg = STR_MSGDEVNOTE);
private slots: private slots:
void onOk(); void onOk();
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
private: //--------------------------------------- private private: //--------------------------------------- private
QString *id_ptr; QString *id_ptr;
QString *cm_ptr; QString *cm_ptr;
@ -110,19 +110,19 @@ private: //--------------------------------------- private
class editModalDialog : public QDialog, public Ui::EditDialog class editModalDialog : public QDialog, public Ui::EditDialog
{ {
Q_OBJECT Q_OBJECT
public: //---------------------------------------- public public: //---------------------------------------- public
editModalDialog(QWidget* bw, int curval = 0, const QString title = STR_MSGEDITBUG); editModalDialog(QWidget *bw, int curval = 0, const QString title = STR_MSGEDITBUG);
virtual ~editModalDialog(); // Destructor virtual ~editModalDialog(); // Destructor
// virtual int editAction(char* msg, int &retval); // virtual int editAction(char* msg, int &retval);
int GetVal(); int GetVal();
private slots: private slots:
void onOk(); void onOk();
void onEdit(); void onEdit();
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
private: //--------------------------------------- private private: //--------------------------------------- private
int oldval; int oldval;
}; };
@ -130,18 +130,18 @@ private: //--------------------------------------- private
class editModalDialog2 : public QDialog, public Ui::EditDialog class editModalDialog2 : public QDialog, public Ui::EditDialog
{ {
Q_OBJECT Q_OBJECT
public: //---------------------------------------- public public: //---------------------------------------- public
editModalDialog2(QWidget* bw, const QString curval = "", const QString title = STR_MSGEDITBUG); editModalDialog2(QWidget *bw, const QString curval = "", const QString title = STR_MSGEDITBUG);
virtual ~editModalDialog2(); // Destructor virtual ~editModalDialog2(); // Destructor
// virtual int editAction(char* msg, char *text, int len); // virtual int editAction(char* msg, char *text, int len);
QString GetVal(); QString GetVal();
private slots: private slots:
void onOk(); void onOk();
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
private: //--------------------------------------- private private: //--------------------------------------- private
QString val; QString val;
}; };

View File

@ -76,7 +76,7 @@ HInterfaceType NameToInterfType(const QString &name)
v.remove(QChar(' ')); v.remove(QChar(' '));
v.remove(QChar('/')); v.remove(QChar('/'));
if ( v.indexOf( n ) >= 0) if (v.indexOf(n) >= 0)
{ {
return index_interface.at(k).type; return index_interface.at(k).type;
} }

View File

@ -77,7 +77,7 @@ int IntelFileBuf::WriteRecord(QFile &fh, uint8_t *bptr, long curaddr, long recsi
for (j = 0; j < recsize; j++) for (j = 0; j < recsize; j++)
{ {
if ( bptr[curaddr + j] != 0xFF ) if (bptr[curaddr + j] != 0xFF)
{ {
discard = 0; discard = 0;
break; break;
@ -107,12 +107,12 @@ int IntelFileBuf::WriteRecord(QFile &fh, uint8_t *bptr, long curaddr, long recsi
checksum += curaddr & 0xFF; checksum += curaddr & 0xFF;
//record type //record type
out << QString().sprintf( "%02X", fmt & 0xFF); out << QString().sprintf("%02X", fmt & 0xFF);
checksum += fmt & 0xFF; checksum += fmt & 0xFF;
for (j = 0; j < recsize; j++) for (j = 0; j < recsize; j++)
{ {
out << QString().sprintf( "%02X", bptr[curaddr + j]); out << QString().sprintf("%02X", bptr[curaddr + j]);
checksum += bptr[curaddr + j]; checksum += bptr[curaddr + j];
} }
@ -135,16 +135,16 @@ int IntelFileBuf::WriteAddressRecord(QFile &fh, long curaddr, bool linear_addres
int len = 2; int len = 2;
//byte count //byte count
out << QString().sprintf( "%02X", len & 0xFF); out << QString().sprintf("%02X", len & 0xFF);
checksum += len & 0xFF; checksum += len & 0xFF;
//addr field //addr field
out << QString().sprintf( "%04X", 0); out << QString().sprintf("%04X", 0);
if (linear_address) if (linear_address)
{ {
//record type //record type
out << QString().sprintf( "%02X", LIN_ADDR_RECORD & 0xFF); out << QString().sprintf("%02X", LIN_ADDR_RECORD & 0xFF);
checksum += LIN_ADDR_RECORD & 0xFF; checksum += LIN_ADDR_RECORD & 0xFF;
//adjust extended linear address //adjust extended linear address
@ -160,11 +160,11 @@ int IntelFileBuf::WriteAddressRecord(QFile &fh, long curaddr, bool linear_addres
curaddr >>= 4; curaddr >>= 4;
} }
out << QString().sprintf( "%04lX", curaddr & 0xFFFF); out << QString().sprintf("%04lX", curaddr & 0xFFFF);
checksum += (curaddr >> 8) & 0xFF; checksum += (curaddr >> 8) & 0xFF;
checksum += curaddr & 0xFF; checksum += curaddr & 0xFF;
out << QString().sprintf( "%02X\n", (~checksum + 1) & 0xFF); out << QString().sprintf("%02X\n", (~checksum + 1) & 0xFF);
} }
return rval; return rval;
@ -181,7 +181,7 @@ int IntelFileBuf::Save(int savetype, long relocation_offset)
(void)relocation_offset; (void)relocation_offset;
if (!fh.open(QIODevice::WriteOnly | QIODevice::Text )) if (!fh.open(QIODevice::WriteOnly | QIODevice::Text))
{ {
return CREATEERROR; return CREATEERROR;
} }
@ -191,7 +191,7 @@ int IntelFileBuf::Save(int savetype, long relocation_offset)
uint8_t *ptr = FileBuf::GetBufPtr(); uint8_t *ptr = FileBuf::GetBufPtr();
//Remove FF's tail //Remove FF's tail
while ( ptr[size - 1] == 0xFF ) while (ptr[size - 1] == 0xFF)
{ {
size--; size--;
} }
@ -229,16 +229,16 @@ int IntelFileBuf::Save(int savetype, long relocation_offset)
while (curaddr < size) while (curaddr < size)
{ {
//Write extended address record if needed //Write extended address record if needed
if ( (curaddr / 0x10000) > 0 && (curaddr % 0x10000) == 0 ) if ((curaddr / 0x10000) > 0 && (curaddr % 0x10000) == 0)
if ( !WriteAddressRecord(fh, curaddr) ) if (!WriteAddressRecord(fh, curaddr))
{ {
rval = WRITEERROR; rval = WRITEERROR;
break; break;
} }
int recsize = min( (size - curaddr), 16 ); int recsize = min((size - curaddr), 16);
if ( !WriteRecord(fh, ptr, curaddr, recsize, DATA_RECORD) ) if (!WriteRecord(fh, ptr, curaddr, recsize, DATA_RECORD))
{ {
rval = WRITEERROR; rval = WRITEERROR;
break; break;
@ -271,9 +271,9 @@ int IntelFileBuf::Load(int loadtype, long relocation_offset)
uint8_t *endp = GetBufPtr() + GetBufSize(); uint8_t *endp = GetBufPtr() + GetBufSize();
uint8_t *dp = GetBufPtr(); uint8_t *dp = GetBufPtr();
if ( loadtype == DATA_TYPE) if (loadtype == DATA_TYPE)
{ {
if ( GetSplitted() >= 0 && GetSplitted() < GetBufSize() ) if (GetSplitted() >= 0 && GetSplitted() < GetBufSize())
{ {
dp += GetSplitted(); dp += GetSplitted();
} }
@ -297,7 +297,7 @@ int IntelFileBuf::Load(int loadtype, long relocation_offset)
QFile fh(GetFileName()); QFile fh(GetFileName());
if (!fh.open(QIODevice::ReadOnly | QIODevice::Text )) if (!fh.open(QIODevice::ReadOnly | QIODevice::Text))
{ {
return FILENOTFOUND; return FILENOTFOUND;
} }
@ -313,7 +313,7 @@ int IntelFileBuf::Load(int loadtype, long relocation_offset)
char *s; char *s;
int k; int k;
if ( (s = strchr(riga, ':')) == NULL ) if ((s = strchr(riga, ':')) == NULL)
{ {
continue; continue;
} }
@ -325,7 +325,7 @@ int IntelFileBuf::Load(int loadtype, long relocation_offset)
//Byte Count //Byte Count
uint16_t bcount; uint16_t bcount;
if ( ScanHex(&s, 2, bcount) != OK ) if (ScanHex(&s, 2, bcount) != OK)
{ {
rval = BADFILETYPE; rval = BADFILETYPE;
break; break;
@ -336,7 +336,7 @@ int IntelFileBuf::Load(int loadtype, long relocation_offset)
//Address //Address
uint16_t addr; uint16_t addr;
if ( ScanHex(&s, 4, addr) != OK ) if (ScanHex(&s, 4, addr) != OK)
{ {
rval = BADFILETYPE; rval = BADFILETYPE;
break; break;
@ -352,7 +352,7 @@ int IntelFileBuf::Load(int loadtype, long relocation_offset)
//Record Type //Record Type
uint16_t rectype; uint16_t rectype;
if ( ScanHex(&s, 2, rectype) != OK ) if (ScanHex(&s, 2, rectype) != OK)
{ {
rval = BADFILETYPE; rval = BADFILETYPE;
break; break;
@ -377,7 +377,7 @@ int IntelFileBuf::Load(int loadtype, long relocation_offset)
for (k = 0, p = dp + laddr; k < bcount && ok; k++) for (k = 0, p = dp + laddr; k < bcount && ok; k++)
{ {
if ( ScanHex(&s, 2, data) != OK ) if (ScanHex(&s, 2, data) != OK)
{ {
ok = false; ok = false;
} }
@ -406,7 +406,7 @@ int IntelFileBuf::Load(int loadtype, long relocation_offset)
//Address //Address
uint16_t addr; uint16_t addr;
if ( ScanHex(&s, 4, addr) != OK ) if (ScanHex(&s, 4, addr) != OK)
{ {
rval = BADFILETYPE; rval = BADFILETYPE;
break; break;
@ -430,7 +430,7 @@ int IntelFileBuf::Load(int loadtype, long relocation_offset)
//Address //Address
uint16_t addr; uint16_t addr;
if ( ScanHex(&s, 4, addr) != OK ) if (ScanHex(&s, 4, addr) != OK)
{ {
rval = BADFILETYPE; rval = BADFILETYPE;
break; break;
@ -469,7 +469,7 @@ int IntelFileBuf::Load(int loadtype, long relocation_offset)
while (bcount-- && ok) while (bcount-- && ok)
{ {
if ( ScanHex(&s, 2, data) != OK ) if (ScanHex(&s, 2, data) != OK)
{ {
ok = false; ok = false;
} }
@ -484,13 +484,13 @@ int IntelFileBuf::Load(int loadtype, long relocation_offset)
} }
} }
if ( ScanHex(&s, 2, data) != OK ) if (ScanHex(&s, 2, data) != OK)
{ {
rval = BADFILETYPE; rval = BADFILETYPE;
break; break;
} }
if ( (uint8_t)data != (uint8_t)(~checksum + 1) ) if ((uint8_t)data != (uint8_t)(~checksum + 1))
{ {
rval = BADFILETYPE; rval = BADFILETYPE;
break; break;
@ -555,7 +555,7 @@ int IntelFileBuf::ScanHex(char **sp, int len, uint32_t &result)
{ {
cifra[j] = *(*sp)++; cifra[j] = *(*sp)++;
if ( !isxdigit(cifra[j]) ) if (!isxdigit(cifra[j]))
{ {
return -1; return -1;
} }

View File

@ -37,7 +37,7 @@
class IntelFileBuf : public FileBuf class IntelFileBuf : public FileBuf
{ {
public: //---------------------------------------- public public: //---------------------------------------- public
IntelFileBuf(e2AppWinInfo *wininfo = 0); IntelFileBuf(e2AppWinInfo *wininfo = 0);
virtual ~IntelFileBuf(); virtual ~IntelFileBuf();
@ -45,9 +45,9 @@ public: //---------------------------------------- public
virtual int Load(int loadtype = ALL_TYPE, long relocation_offset = 0); virtual int Load(int loadtype = ALL_TYPE, long relocation_offset = 0);
virtual int Save(int savetype = ALL_TYPE, long relocation_offset = 0); virtual int Save(int savetype = ALL_TYPE, long relocation_offset = 0);
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
private: //--------------------------------------- private private: //--------------------------------------- private
int WriteRecord(QFile &fh, uint8_t *bptr, long curaddr, long recsize, int fmt); int WriteRecord(QFile &fh, uint8_t *bptr, long curaddr, long recsize, int fmt);
int WriteAddressRecord(QFile &fh, long curaddr, bool linear_address = false); int WriteAddressRecord(QFile &fh, long curaddr, bool linear_address = false);

View File

@ -195,7 +195,7 @@ int AvrISPInterface::Open(int port_no)
if (IsInstalled() != port_no) if (IsInstalled() != port_no)
{ {
if ( InDataPort(port_no) < 0 ) if (InDataPort(port_no) < 0)
{ {
ret_val = E2ERR_OPENFAILED; ret_val = E2ERR_OPENFAILED;
} }
@ -395,12 +395,12 @@ int AvrISPInterface::TestPort(int port)
OutDataMask(WF_TEST1, 1); OutDataMask(WF_TEST1, 1);
w.WaitMsec(50); w.WaitMsec(50);
if ( (InDataPort() & RF_TEST1) ) if ((InDataPort() & RF_TEST1))
{ {
OutDataMask(WF_TEST1, 0); OutDataMask(WF_TEST1, 0);
w.WaitMsec(50); w.WaitMsec(50);
if ( !(InDataPort() & RF_TEST1) ) if (!(InDataPort() & RF_TEST1))
{ {
test1 = true; test1 = true;
} }
@ -411,18 +411,18 @@ int AvrISPInterface::TestPort(int port)
OutDataMask(WF_TEST2, 0); OutDataMask(WF_TEST2, 0);
w.WaitMsec(50); w.WaitMsec(50);
if ( (InDataPort() & RF_TEST2) ) if ((InDataPort() & RF_TEST2))
{ {
OutDataMask(WF_TEST2, 1); OutDataMask(WF_TEST2, 1);
w.WaitMsec(50); w.WaitMsec(50);
if ( !(InDataPort() & RF_TEST2) ) if (!(InDataPort() & RF_TEST2))
{ {
test2 = true; test2 = true;
} }
} }
ret_val = ( test1 || test2 ) ? ret_val = (test1 || test2) ?
OK : OK :
E2ERR_OPENFAILED; E2ERR_OPENFAILED;
} }

View File

@ -34,7 +34,7 @@
class AvrISPInterface : public LptExtInterface class AvrISPInterface : public LptExtInterface
{ {
public: //------------------------------- public public: //------------------------------- public
AvrISPInterface(bool use_io = false); AvrISPInterface(bool use_io = false);
virtual int Open(int com_no); virtual int Open(int com_no);
@ -54,9 +54,9 @@ public: //------------------------------- public
int SetPower(int onoff); int SetPower(int onoff);
void SetControlLine(int res = 1); void SetControlLine(int res = 1);
protected: //------------------------------- protected protected: //------------------------------- protected
private: //------------------------------- private private: //------------------------------- private
int GetPresence(); int GetPresence();
}; };

View File

@ -34,7 +34,7 @@
class JdmInterface : public SIProgInterface class JdmInterface : public SIProgInterface
{ {
public: //------------------------------- public public: //------------------------------- public
// virtual int Open(int com_no); // virtual int Open(int com_no);
// virtual void Close(); // virtual void Close();
@ -44,9 +44,9 @@ public: //------------------------------- public
SIProgInterface::SetDataOut(sda); SIProgInterface::SetDataOut(sda);
} }
protected: //------------------------------- protected protected: //------------------------------- protected
private: //------------------------------- private private: //------------------------------- private
}; };

View File

@ -150,7 +150,7 @@ static int gpio_open(unsigned int gpio, bool out_dir)
} }
} }
qDebug() << "gpio_open(" << gpio << ", " << (out_dir ? "out" : "in" ) << ") rval = " << rval; qDebug() << "gpio_open(" << gpio << ", " << (out_dir ? "out" : "in") << ") rval = " << rval;
return rval; return rval;
} }
@ -176,7 +176,7 @@ static int gpio_close(unsigned int gpio, int fd)
if (fd < 0) if (fd < 0)
{ {
fprintf (stderr, "Unable to open GPIO unexport interface: %s\n", strerror(errno)); fprintf(stderr, "Unable to open GPIO unexport interface: %s\n", strerror(errno));
rval = -1; rval = -1;
} }
else else
@ -312,7 +312,7 @@ void LinuxSysFsInterface::SetDataOut(int sda)
if (IsInstalled()) if (IsInstalled())
{ {
if ( (E2Profile::GetPolarityControl() & DOUTINV) ) if ((E2Profile::GetPolarityControl() & DOUTINV))
{ {
sda = !sda; sda = !sda;
} }
@ -345,7 +345,7 @@ void LinuxSysFsInterface::SetClock(int scl)
if (IsInstalled()) if (IsInstalled())
{ {
if ( (E2Profile::GetPolarityControl() & CLOCKINV) ) if ((E2Profile::GetPolarityControl() & CLOCKINV))
{ {
scl = !scl; scl = !scl;
} }

View File

@ -35,7 +35,7 @@
class LinuxSysFsInterface : public BusInterface class LinuxSysFsInterface : public BusInterface
{ {
public: //------------------------------- public public: //------------------------------- public
LinuxSysFsInterface(); LinuxSysFsInterface();
virtual ~LinuxSysFsInterface(); virtual ~LinuxSysFsInterface();
@ -56,10 +56,10 @@ public: //------------------------------- public
int SetPower(int onoff); int SetPower(int onoff);
void SetControlLine(int res = 1); void SetControlLine(int res = 1);
protected: //------------------------------- protected protected: //------------------------------- protected
// int GetPresence() const; // int GetPresence() const;
private: //------------------------------- private private: //------------------------------- private
int InitPins(); int InitPins();
void DeInitPins(); void DeInitPins();

View File

@ -36,7 +36,7 @@
class LptExtInterface : public BusInterface class LptExtInterface : public BusInterface
{ {
public: //------------------------------- public public: //------------------------------- public
LptExtInterface(bool use_io = false) LptExtInterface(bool use_io = false)
{ {
io_mode = use_io; io_mode = use_io;
@ -55,7 +55,7 @@ public: //------------------------------- public
io_mode = use_io; io_mode = use_io;
} }
protected: //------------------------------- protected protected: //------------------------------- protected
int InDataPort(int port_no = 0) int InDataPort(int port_no = 0)
{ {
@ -92,7 +92,7 @@ protected: //------------------------------- protected
return io_mode ? lptio.GetLastCtrl() : lpt.GetLastCtrl(); return io_mode ? lptio.GetLastCtrl() : lpt.GetLastCtrl();
} }
private: //------------------------------- private private: //------------------------------- private
static LPTInterface lpt; static LPTInterface lpt;
static LPTIOInterface lptio; static LPTIOInterface lptio;

View File

@ -73,7 +73,7 @@ void LPTIOInterface::SetPort(int port_no)
{ {
qDebug() << "LPTIOInterface::SetPort(" << port_no << ")"; qDebug() << "LPTIOInterface::SetPort(" << port_no << ")";
if ( port_no >= 1 && port_no <= MAX_LPTPORTS ) if (port_no >= 1 && port_no <= MAX_LPTPORTS)
{ {
lpt_port = port_no; lpt_port = port_no;
@ -96,8 +96,8 @@ int LPTIOInterface::InDataPort(int port_no)
int ret_val = OK; int ret_val = OK;
if ( port_no >= 1 && port_no <= MAX_LPTPORTS && if (port_no >= 1 && port_no <= MAX_LPTPORTS &&
port_no != lpt_port ) port_no != lpt_port)
{ {
lpt_port = port_no; lpt_port = port_no;
@ -131,8 +131,8 @@ int LPTIOInterface::OutDataPort(int val, int port_no)
int ret_val = OK; int ret_val = OK;
if ( port_no >= 1 && port_no <= MAX_LPTPORTS && if (port_no >= 1 && port_no <= MAX_LPTPORTS &&
port_no != lpt_port ) port_no != lpt_port)
{ {
lpt_port = port_no; lpt_port = port_no;
@ -169,8 +169,8 @@ int LPTIOInterface::OutControlPort(int val, int port_no)
int ret_val = OK; int ret_val = OK;
if ( port_no >= 1 && port_no <= MAX_LPTPORTS && if (port_no >= 1 && port_no <= MAX_LPTPORTS &&
port_no != lpt_port ) port_no != lpt_port)
{ {
lpt_port = port_no; lpt_port = port_no;

View File

@ -35,7 +35,7 @@
class LPTIOInterface : public PortInterface class LPTIOInterface : public PortInterface
{ {
public: //------------------------------- public public: //------------------------------- public
LPTIOInterface(); LPTIOInterface();
virtual ~LPTIOInterface(); virtual ~LPTIOInterface();
@ -61,9 +61,9 @@ public: //------------------------------- public
return last_ctrl; return last_ctrl;
} }
protected: //------------------------------- protected protected: //------------------------------- protected
private: //------------------------------- private private: //------------------------------- private
int lpt_port; int lpt_port;
uint8_t last_ctrl, last_data; uint8_t last_ctrl, last_data;

View File

@ -139,7 +139,7 @@ void LPTInterface::SetPort(int port_no)
{ {
qDebug() << "LPTInterface::SetPort(" << port_no << ")"; qDebug() << "LPTInterface::SetPort(" << port_no << ")";
if ( port_no >= 1 && port_no <= MAX_LPTPORTS ) if (port_no >= 1 && port_no <= MAX_LPTPORTS)
{ {
lpt_control.LPPort = port_no; lpt_control.LPPort = port_no;
@ -158,7 +158,7 @@ void LPTInterface::SetPort(int port_no)
if (hLpt != INVALID_HANDLE_VALUE) if (hLpt != INVALID_HANDLE_VALUE)
{ {
if ( ioctl(hLpt, PPCLAIM, 0) ) if (ioctl(hLpt, PPCLAIM, 0))
{ {
close(hLpt); close(hLpt);
hLpt = INVALID_HANDLE_VALUE; hLpt = INVALID_HANDLE_VALUE;
@ -185,18 +185,18 @@ int LPTInterface::InDataPort(int port_no)
int ret_val = E2ERR_NOTINSTALLED; int ret_val = E2ERR_NOTINSTALLED;
#ifdef _WINDOWS #ifdef _WINDOWS
if ( hLPTCONVxD != INVALID_HANDLE_VALUE ) if (hLPTCONVxD != INVALID_HANDLE_VALUE)
{ {
if ( port_no >= 1 && port_no <= MAX_LPTPORTS ) if (port_no >= 1 && port_no <= MAX_LPTPORTS)
{ {
lpt_control.LPPort = port_no; lpt_control.LPPort = port_no;
} }
uint8_t value; uint8_t value;
if ( !DeviceIoControl(hLPTCONVxD, LPTCON_READ, if (!DeviceIoControl(hLPTCONVxD, LPTCON_READ,
&lpt_control, sizeof(LPTCONDATA), &lpt_control, sizeof(LPTCONDATA),
&value, sizeof(value), NULL, 0) ) &value, sizeof(value), NULL, 0))
{ {
ret_val = E2ERR_OPENFAILED; ret_val = E2ERR_OPENFAILED;
} }
@ -208,8 +208,8 @@ int LPTInterface::InDataPort(int port_no)
#else #else
if ( port_no >= 1 && port_no <= MAX_LPTPORTS if (port_no >= 1 && port_no <= MAX_LPTPORTS
&& port_no != lpt_control.LPPort ) && port_no != lpt_control.LPPort)
{ {
lpt_control.LPPort = port_no; lpt_control.LPPort = port_no;
@ -226,7 +226,7 @@ int LPTInterface::InDataPort(int port_no)
if (hLpt != INVALID_HANDLE_VALUE) if (hLpt != INVALID_HANDLE_VALUE)
{ {
if ( ioctl(hLpt, PPCLAIM, 0) ) if (ioctl(hLpt, PPCLAIM, 0))
{ {
close(hLpt); close(hLpt);
hLpt = INVALID_HANDLE_VALUE; hLpt = INVALID_HANDLE_VALUE;
@ -236,9 +236,9 @@ int LPTInterface::InDataPort(int port_no)
qDebug() << "LPTInterface::InDataPort() ** hLpt=" << hLpt << ", " << name; qDebug() << "LPTInterface::InDataPort() ** hLpt=" << hLpt << ", " << name;
} }
if ( hLpt != INVALID_HANDLE_VALUE ) if (hLpt != INVALID_HANDLE_VALUE)
{ {
if ( ioctl(hLpt, PPRSTATUS, &lpt_control.LPByte) ) if (ioctl(hLpt, PPRSTATUS, &lpt_control.LPByte))
{ {
ret_val = E2ERR_ACCESSDENIED; ret_val = E2ERR_ACCESSDENIED;
} }
@ -272,9 +272,9 @@ int LPTInterface::OutDataPort(int val, int port_no)
#ifdef _WINDOWS #ifdef _WINDOWS
if ( hLPTCONVxD != INVALID_HANDLE_VALUE ) if (hLPTCONVxD != INVALID_HANDLE_VALUE)
{ {
if ( port_no >= 1 && port_no <= MAX_LPTPORTS ) if (port_no >= 1 && port_no <= MAX_LPTPORTS)
{ {
lpt_control.LPPort = port_no; lpt_control.LPPort = port_no;
} }
@ -288,8 +288,8 @@ int LPTInterface::OutDataPort(int val, int port_no)
#else #else
if ( port_no >= 1 && port_no <= MAX_LPTPORTS if (port_no >= 1 && port_no <= MAX_LPTPORTS
&& port_no != lpt_control.LPPort ) && port_no != lpt_control.LPPort)
{ {
lpt_control.LPPort = port_no; lpt_control.LPPort = port_no;
@ -306,7 +306,7 @@ int LPTInterface::OutDataPort(int val, int port_no)
if (hLpt != INVALID_HANDLE_VALUE) if (hLpt != INVALID_HANDLE_VALUE)
{ {
if ( ioctl(hLpt, PPCLAIM, 0) ) if (ioctl(hLpt, PPCLAIM, 0))
{ {
close(hLpt); close(hLpt);
hLpt = INVALID_HANDLE_VALUE; hLpt = INVALID_HANDLE_VALUE;
@ -314,11 +314,11 @@ int LPTInterface::OutDataPort(int val, int port_no)
} }
} }
if ( hLpt != INVALID_HANDLE_VALUE ) if (hLpt != INVALID_HANDLE_VALUE)
{ {
lpt_control.LPByte = last_data = (uint8_t)val; lpt_control.LPByte = last_data = (uint8_t)val;
if ( ioctl(hLpt, PPWDATA, &lpt_control.LPByte) ) if (ioctl(hLpt, PPWDATA, &lpt_control.LPByte))
{ {
ret_val = E2ERR_ACCESSDENIED; ret_val = E2ERR_ACCESSDENIED;
} }
@ -354,9 +354,9 @@ int LPTInterface::OutControlPort(int val, int port_no)
#ifdef _WINDOWS #ifdef _WINDOWS
if ( hLPTCONVxD != INVALID_HANDLE_VALUE ) if (hLPTCONVxD != INVALID_HANDLE_VALUE)
{ {
if ( port_no >= 1 && port_no <= MAX_LPTPORTS ) if (port_no >= 1 && port_no <= MAX_LPTPORTS)
{ {
lpt_control.LPPort = port_no; lpt_control.LPPort = port_no;
} }
@ -370,8 +370,8 @@ int LPTInterface::OutControlPort(int val, int port_no)
#else #else
if ( port_no >= 1 && port_no <= MAX_LPTPORTS if (port_no >= 1 && port_no <= MAX_LPTPORTS
&& port_no != lpt_control.LPPort ) && port_no != lpt_control.LPPort)
{ {
lpt_control.LPPort = port_no; lpt_control.LPPort = port_no;
@ -388,7 +388,7 @@ int LPTInterface::OutControlPort(int val, int port_no)
if (hLpt != INVALID_HANDLE_VALUE) if (hLpt != INVALID_HANDLE_VALUE)
{ {
if ( ioctl(hLpt, PPCLAIM, 0) ) if (ioctl(hLpt, PPCLAIM, 0))
{ {
close(hLpt); close(hLpt);
hLpt = INVALID_HANDLE_VALUE; hLpt = INVALID_HANDLE_VALUE;
@ -396,11 +396,11 @@ int LPTInterface::OutControlPort(int val, int port_no)
} }
} }
if ( hLpt != INVALID_HANDLE_VALUE ) if (hLpt != INVALID_HANDLE_VALUE)
{ {
lpt_control.LPByte = last_ctrl = (uint8_t)val & 0x0F; lpt_control.LPByte = last_ctrl = (uint8_t)val & 0x0F;
if ( ioctl(hLpt, PPWCONTROL, &lpt_control.LPByte) ) if (ioctl(hLpt, PPWCONTROL, &lpt_control.LPByte))
{ {
ret_val = E2ERR_ACCESSDENIED; ret_val = E2ERR_ACCESSDENIED;
} }
@ -422,9 +422,9 @@ int LPTInterface::OutDataMask(int mask, int val)
#ifdef _WINDOWS #ifdef _WINDOWS
if ( hLPTCONVxD != INVALID_HANDLE_VALUE ) if (hLPTCONVxD != INVALID_HANDLE_VALUE)
#else #else
if ( hLpt != INVALID_HANDLE_VALUE ) if (hLpt != INVALID_HANDLE_VALUE)
#endif #endif
{ {
if (val == 0) if (val == 0)
@ -459,9 +459,9 @@ int LPTInterface::OutControlMask(int mask, int val)
#ifdef _WINDOWS #ifdef _WINDOWS
if ( hLPTCONVxD != INVALID_HANDLE_VALUE ) if (hLPTCONVxD != INVALID_HANDLE_VALUE)
#else #else
if ( hLpt != INVALID_HANDLE_VALUE ) if (hLpt != INVALID_HANDLE_VALUE)
#endif #endif
{ {
if (val == 0) if (val == 0)

View File

@ -51,7 +51,7 @@ typedef struct
class LPTInterface class LPTInterface
{ {
public: //------------------------------- public public: //------------------------------- public
LPTInterface(); LPTInterface();
virtual ~LPTInterface(); virtual ~LPTInterface();
@ -73,9 +73,9 @@ public: //------------------------------- public
return last_ctrl; return last_ctrl;
} }
protected: //------------------------------- protected protected: //------------------------------- protected
private: //------------------------------- private private: //------------------------------- private
#ifdef _WINDOWS #ifdef _WINDOWS
HANDLE hLPTCONVxD; //Will be the handle to our VxD. HANDLE hLPTCONVxD; //Will be the handle to our VxD.
#else #else

View File

@ -72,7 +72,7 @@ void MicroWireBus::SetDelay()
int val = E2Profile::GetMicroWireSpeed(); int val = E2Profile::GetMicroWireSpeed();
int n; int n;
switch(val) switch (val)
{ {
case TURBO: case TURBO:
n = 0; // as fast as your PC can n = 0; // as fast as your PC can
@ -185,7 +185,7 @@ int MicroWireBus::RecDataWord(int wlen, int lsb)
if (lsb) if (lsb)
{ {
for (k = 0; k < wlen; k++) for (k = 0; k < wlen; k++)
if ( RecDataBit() ) if (RecDataBit())
{ {
val |= (1 << k); val |= (1 << k);
} }
@ -193,7 +193,7 @@ int MicroWireBus::RecDataWord(int wlen, int lsb)
else else
{ {
for (k = wlen - 1; k >= 0; k--) for (k = wlen - 1; k >= 0; k--)
if ( RecDataBit() ) if (RecDataBit())
{ {
val |= (1 << k); val |= (1 << k);
} }
@ -218,7 +218,7 @@ int MicroWireBus::RecDataWordShort(int wlen, int lsb)
val = RecDataBitShort() ? 1 : 0; val = RecDataBitShort() ? 1 : 0;
for (k = 1; k < wlen; k++) for (k = 1; k < wlen; k++)
if ( RecDataBit() ) if (RecDataBit())
{ {
val |= (1 << k); val |= (1 << k);
} }
@ -228,7 +228,7 @@ int MicroWireBus::RecDataWordShort(int wlen, int lsb)
val = RecDataBitShort() ? 1 << (wlen - 1) : 0; val = RecDataBitShort() ? 1 << (wlen - 1) : 0;
for (k = wlen - 2; k >= 0; k--) for (k = wlen - 2; k >= 0; k--)
if ( RecDataBit() ) if (RecDataBit())
{ {
val |= (1 << k); val |= (1 << k);
} }
@ -293,7 +293,7 @@ int MicroWireBus::CalcAddressSize(int mem_size, int org) const
int k; int k;
for (k = 15; k > 0; k--) for (k = 15; k > 0; k--)
if ( mem_size & (1 << k) ) if (mem_size & (1 << k))
{ {
break; break;
} }

View File

@ -38,7 +38,7 @@
class MicroWireBus : public BusIO class MicroWireBus : public BusIO
{ {
public: //------------------------------- public public: //------------------------------- public
MicroWireBus(BusInterface *ptr = 0); MicroWireBus(BusInterface *ptr = 0);
virtual ~MicroWireBus(); virtual ~MicroWireBus();
@ -51,7 +51,7 @@ public: //------------------------------- public
void SetDelay(); void SetDelay();
protected: //------------------------------- protected protected: //------------------------------- protected
int SendDataWord(int wo, int wlen, int lsb = 0); int SendDataWord(int wo, int wlen, int lsb = 0);
int RecDataWord(int wlen, int lsb = 0); int RecDataWord(int wlen, int lsb = 0);
@ -72,7 +72,7 @@ protected: //------------------------------- protected
busI->SetControlLine(0); busI->SetControlLine(0);
} }
private: //------------------------------- private private: //------------------------------- private
int SendDataBit(int b); int SendDataBit(int b);
int RecDataBit(); int RecDataBit();

View File

@ -83,7 +83,7 @@ int MotorolaSFileBuf::WriteRecord(QTextStream &outs, uint8_t *bptr, long curaddr
for (j = 0; j < recsize; j++) for (j = 0; j < recsize; j++)
{ {
if ( bptr[curaddr + j] != 0xFF ) if (bptr[curaddr + j] != 0xFF)
{ {
discard = 0; discard = 0;
break; break;
@ -100,7 +100,7 @@ int MotorolaSFileBuf::WriteRecord(QTextStream &outs, uint8_t *bptr, long curaddr
return rval; return rval;
} }
switch(fmt) switch (fmt)
{ {
case START_RECORD: //starting record (optional) case START_RECORD: //starting record (optional)
len = recsize + 2 + 1; //2 byte address + 1 byte checksum len = recsize + 2 + 1; //2 byte address + 1 byte checksum
@ -215,7 +215,7 @@ int MotorolaSFileBuf::Save(int savetype, long relocation_offset)
uint8_t *ptr = FileBuf::GetBufPtr(); uint8_t *ptr = FileBuf::GetBufPtr();
//Remove FF's tail //Remove FF's tail
while ( ptr[size - 1] == 0xFF ) while (ptr[size - 1] == 0xFF)
{ {
size--; size--;
} }
@ -255,7 +255,7 @@ int MotorolaSFileBuf::Save(int savetype, long relocation_offset)
while (curaddr < size) while (curaddr < size)
{ {
int recsize = min( (size - curaddr), 16 ); int recsize = min((size - curaddr), 16);
rectype = DATA_RECORD16; rectype = DATA_RECORD16;
@ -269,7 +269,7 @@ int MotorolaSFileBuf::Save(int savetype, long relocation_offset)
rectype = DATA_RECORD32; rectype = DATA_RECORD32;
} }
if ( !WriteRecord(out, ptr, curaddr, recsize, rectype) ) if (!WriteRecord(out, ptr, curaddr, recsize, rectype))
{ {
rval = WRITEERROR; rval = WRITEERROR;
break; break;
@ -316,7 +316,7 @@ int MotorolaSFileBuf::Load(int loadtype, long relocation_offset)
if (loadtype == DATA_TYPE) if (loadtype == DATA_TYPE)
{ {
if ( GetSplitted() >= 0 && GetSplitted() < GetBufSize() ) if (GetSplitted() >= 0 && GetSplitted() < GetBufSize())
{ {
dp += GetSplitted(); dp += GetSplitted();
} }
@ -356,7 +356,7 @@ int MotorolaSFileBuf::Load(int loadtype, long relocation_offset)
{ {
fh.readLine(riga, MAXLINE); fh.readLine(riga, MAXLINE);
if ( (rval = ParseRecord(riga, dp, endp, 0, nocopy_mode)) != OK ) if ((rval = ParseRecord(riga, dp, endp, 0, nocopy_mode)) != OK)
{ {
if (rval == BUFFEROVERFLOW) if (rval == BUFFEROVERFLOW)
{ {
@ -371,7 +371,7 @@ int MotorolaSFileBuf::Load(int loadtype, long relocation_offset)
if (nocopy_mode) if (nocopy_mode)
{ {
if ( (highestAddr - lowestAddr) > GetBufSize() ) if ((highestAddr - lowestAddr) > GetBufSize())
{ {
rval = BUFFEROVERFLOW; rval = BUFFEROVERFLOW;
} }
@ -390,11 +390,11 @@ int MotorolaSFileBuf::Load(int loadtype, long relocation_offset)
riga[MAXLINE] = '\0'; riga[MAXLINE] = '\0';
while ( !fh.atEnd()) while (!fh.atEnd())
{ {
fh.readLine(riga, MAXLINE); fh.readLine(riga, MAXLINE);
if ( (rval = ParseRecord(riga, dp, endp, l_offset, nocopy_mode)) != OK ) if ((rval = ParseRecord(riga, dp, endp, l_offset, nocopy_mode)) != OK)
{ {
break; break;
} }
@ -456,10 +456,10 @@ int MotorolaSFileBuf::ParseRecord(char *lbufPC, uint8_t *buf_startP, uint8_t *bu
return BADFILETYPE; return BADFILETYPE;
} }
switch( lbufPC[1] ) /* examine 2nd character on the line */ switch (lbufPC[1]) /* examine 2nd character on the line */
{ {
case DATA_RECORD16: /* 16 bit address field */ case DATA_RECORD16: /* 16 bit address field */
if( sscanf(lbufPC, "S1%2X%4lX", &countN, &addrL ) != 2 ) if (sscanf(lbufPC, "S1%2X%4lX", &countN, &addrL) != 2)
{ {
return BADFILETYPE; /* Flag error in S1 record */ return BADFILETYPE; /* Flag error in S1 record */
} }
@ -468,7 +468,7 @@ int MotorolaSFileBuf::ParseRecord(char *lbufPC, uint8_t *buf_startP, uint8_t *bu
break; break;
case DATA_RECORD24: /* 24 bit address field */ case DATA_RECORD24: /* 24 bit address field */
if( sscanf(lbufPC, "S2%2X%6lX", &countN, &addrL ) != 2 ) if (sscanf(lbufPC, "S2%2X%6lX", &countN, &addrL) != 2)
{ {
return BADFILETYPE; /* Flag error in S2 record */ return BADFILETYPE; /* Flag error in S2 record */
} }
@ -477,7 +477,7 @@ int MotorolaSFileBuf::ParseRecord(char *lbufPC, uint8_t *buf_startP, uint8_t *bu
break; break;
case DATA_RECORD32: /* 32 bit address field */ case DATA_RECORD32: /* 32 bit address field */
if( sscanf(lbufPC, "S3%2X%8lX", &countN, &addrL ) != 2 ) if (sscanf(lbufPC, "S3%2X%8lX", &countN, &addrL) != 2)
{ {
return BADFILETYPE; /* Flag error in S3 record */ return BADFILETYPE; /* Flag error in S3 record */
} }
@ -495,7 +495,7 @@ int MotorolaSFileBuf::ParseRecord(char *lbufPC, uint8_t *buf_startP, uint8_t *bu
case END_RECORD16: //ending record for S1 records case END_RECORD16: //ending record for S1 records
//check only for correct checksum //check only for correct checksum
if( sscanf(lbufPC + 2, "%2X", &countN ) != 1 ) if (sscanf(lbufPC + 2, "%2X", &countN) != 1)
{ {
return BADFILETYPE; /* Flag error in SX record */ return BADFILETYPE; /* Flag error in SX record */
} }
@ -512,25 +512,25 @@ int MotorolaSFileBuf::ParseRecord(char *lbufPC, uint8_t *buf_startP, uint8_t *bu
cksmB = 0; cksmB = 0;
countN++; /* Bump counter to read final checksum too */ countN++; /* Bump counter to read final checksum too */
for( i = 1; i <= countN; i++ ) for (i = 1; i <= countN; i++)
{ {
sscanf( lbufPC + i * 2, "%2X", &tvalN ); /* Scan a 2 hex digit byte */ sscanf(lbufPC + i * 2, "%2X", &tvalN); /* Scan a 2 hex digit byte */
cksmB += (uint8_t)tvalN; cksmB += (uint8_t)tvalN;
} }
if( ++cksmB ) if (++cksmB)
{ {
return BADFILETYPE; /* flag checksum error */ return BADFILETYPE; /* flag checksum error */
} }
} }
else else
{ {
if ( addrL > highestAddr) if (addrL > highestAddr)
{ {
highestAddr = addrL; highestAddr = addrL;
} }
if ( addrL < lowestAddr) if (addrL < lowestAddr)
{ {
lowestAddr = addrL; lowestAddr = addrL;
} }
@ -551,12 +551,12 @@ int MotorolaSFileBuf::ParseRecord(char *lbufPC, uint8_t *buf_startP, uint8_t *bu
cksmB = 0; cksmB = 0;
countN++; /* Bump counter to read final checksum too */ countN++; /* Bump counter to read final checksum too */
for( i = 1; i <= countN; i++ ) for (i = 1; i <= countN; i++)
{ {
sscanf( lbufPC + i * 2, "%2X", &tvalN ); /* Scan a 2 hex digit byte */ sscanf(lbufPC + i * 2, "%2X", &tvalN); /* Scan a 2 hex digit byte */
cksmB += (uint8_t)tvalN; cksmB += (uint8_t)tvalN;
if( ( i > oheadN ) && ( i < countN ) ) /* If scanned a data byte */ if ((i > oheadN) && (i < countN)) /* If scanned a data byte */
{ {
if (!nocopy) if (!nocopy)
{ {
@ -571,14 +571,14 @@ int MotorolaSFileBuf::ParseRecord(char *lbufPC, uint8_t *buf_startP, uint8_t *bu
} }
} }
if( ++cksmB ) if (++cksmB)
{ {
return BADFILETYPE; /* flag checksum error */ return BADFILETYPE; /* flag checksum error */
} }
if (!nocopy) if (!nocopy)
{ {
if( (bufPC - 1) > highestPC ) if ((bufPC - 1) > highestPC)
{ {
highestPC = bufPC - 1; /* track highest address loaded */ highestPC = bufPC - 1; /* track highest address loaded */
} }

View File

@ -38,7 +38,7 @@
class MotorolaSFileBuf : public FileBuf class MotorolaSFileBuf : public FileBuf
{ {
public: //---------------------------------------- public public: //---------------------------------------- public
MotorolaSFileBuf(e2AppWinInfo *wininfo = 0); MotorolaSFileBuf(e2AppWinInfo *wininfo = 0);
virtual ~MotorolaSFileBuf(); virtual ~MotorolaSFileBuf();
@ -46,9 +46,9 @@ public: //---------------------------------------- public
virtual int Load(int loadtype = ALL_TYPE, long relocation_offset = 0); virtual int Load(int loadtype = ALL_TYPE, long relocation_offset = 0);
virtual int Save(int savetype = ALL_TYPE, long relocation_offset = 0); virtual int Save(int savetype = ALL_TYPE, long relocation_offset = 0);
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
private: //--------------------------------------- private private: //--------------------------------------- private
int WriteRecord(QTextStream &outs, uint8_t *bptr, long curaddr, long recsize, int fmt); int WriteRecord(QTextStream &outs, uint8_t *bptr, long curaddr, long recsize, int fmt);
int ParseRecord(char *lbufPC, uint8_t *buf_startP, uint8_t *buf_endP, long offset, int nocopy); int ParseRecord(char *lbufPC, uint8_t *buf_startP, uint8_t *buf_endP, long offset, int nocopy);

View File

@ -130,8 +130,8 @@ int Nvm3060::Write(int probe, int type)
if (size > 256) if (size > 256)
{ {
//NVM3060 //NVM3060
E2Profile::SetNVMProgDelay( E2Profile::GetNVMProgDelay() ); E2Profile::SetNVMProgDelay(E2Profile::GetNVMProgDelay());
GetBus()->SetProgDelay( E2Profile::GetNVMProgDelay() ); GetBus()->SetProgDelay(E2Profile::GetNVMProgDelay());
GetBus()->SetDataMode(16); GetBus()->SetDataMode(16);
GetBus()->SetStatusLocation(526); GetBus()->SetStatusLocation(526);
start_addr = 0; start_addr = 0;
@ -139,8 +139,8 @@ int Nvm3060::Write(int probe, int type)
else else
{ {
//MDA2062 //MDA2062
E2Profile::SetMDAProgDelay( E2Profile::GetMDAProgDelay() ); E2Profile::SetMDAProgDelay(E2Profile::GetMDAProgDelay());
GetBus()->SetProgDelay( E2Profile::GetMDAProgDelay() ); GetBus()->SetProgDelay(E2Profile::GetMDAProgDelay());
GetBus()->SetDataMode(8); GetBus()->SetDataMode(8);
GetBus()->SetStatusLocation(14); GetBus()->SetStatusLocation(14);
start_addr = 128; start_addr = 128;
@ -213,7 +213,7 @@ int Nvm3060::Verify(int type)
} }
else else
{ {
rval = ( memcmp(GetBufPtr(), localbuf, size) != 0 ) ? 0 : 1; rval = (memcmp(GetBufPtr(), localbuf, size) != 0) ? 0 : 1;
} }
delete localbuf; delete localbuf;

View File

@ -38,7 +38,7 @@
class Nvm3060 : public Device class Nvm3060 : public Device
{ {
public: //---------------------------------------- public public: //---------------------------------------- public
Nvm3060(e2AppWinInfo *wininfo = 0, BusIO *busp = 0); Nvm3060(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
virtual ~Nvm3060(); virtual ~Nvm3060();
@ -48,14 +48,14 @@ public: //---------------------------------------- public
int Write(int probe = 1, int type = ALL_TYPE); int Write(int probe = 1, int type = ALL_TYPE);
int Verify(int type = ALL_TYPE); int Verify(int type = ALL_TYPE);
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
IMBus *GetBus() IMBus *GetBus()
{ {
return (IMBus *)Device::GetBus(); return (IMBus *)Device::GetBus();
} }
private: //--------------------------------------- private private: //--------------------------------------- private
}; };
#endif #endif

View File

@ -92,7 +92,7 @@ int SIProgInterface::Open(int com_no)
if (IsInstalled() != com_no) if (IsInstalled() != com_no)
{ {
if ( (ret_val = RS232Interface::OpenSerial(com_no)) == OK ) if ((ret_val = RS232Interface::OpenSerial(com_no)) == OK)
{ {
// SetSerialEventMask(0); // SetSerialEventMask(0);
//SetPower(1); //08/02/1998 -- ora diamo alimentazione prima di ogni operazione e la togliamo subito dopo //SetPower(1); //08/02/1998 -- ora diamo alimentazione prima di ogni operazione e la togliamo subito dopo

View File

@ -35,7 +35,7 @@
class SIProgInterface : public BusInterface, public RS232Interface class SIProgInterface : public BusInterface, public RS232Interface
{ {
public: //------------------------------- public public: //------------------------------- public
SIProgInterface(); SIProgInterface();
// virtual ~SIProgInterface(); // virtual ~SIProgInterface();
@ -58,9 +58,9 @@ public: //------------------------------- public
int SetPower(int onoff); int SetPower(int onoff);
void SetControlLine(int res = 1); void SetControlLine(int res = 1);
protected: //------------------------------- protected protected: //------------------------------- protected
private: //------------------------------- private private: //------------------------------- private
}; };

View File

@ -93,11 +93,11 @@ int Pic125xx::Probe(int probe_size)
int Pic125xx::Read(int probe, int type) int Pic125xx::Read(int probe, int type)
{ {
int rv = Probe( probe || GetNoOfBank() == 0 ); int rv = Probe(probe || GetNoOfBank() == 0);
if (rv > 0) if (rv > 0)
{ {
if ( type & CONFIG_TYPE ) if (type & CONFIG_TYPE)
{ {
// read the config locations // read the config locations
// this must be the FIRST operation (just after reset) // this must be the FIRST operation (just after reset)
@ -111,7 +111,7 @@ int Pic125xx::Read(int probe, int type)
GetBus()->IncAddress(1); GetBus()->IncAddress(1);
} }
if ( type & PROG_TYPE ) if (type & PROG_TYPE)
{ {
rv = ReadProg(); rv = ReadProg();
} }
@ -122,18 +122,18 @@ int Pic125xx::Read(int probe, int type)
int Pic125xx::Write(int probe, int type) int Pic125xx::Write(int probe, int type)
{ {
int rv = Probe( probe || GetNoOfBank() == 0 ); int rv = Probe(probe || GetNoOfBank() == 0);
if (rv > 0) if (rv > 0)
{ {
if ( type & PROG_TYPE ) if (type & PROG_TYPE)
{ {
//Skip configuration word //Skip configuration word
GetBus()->IncAddress(1); GetBus()->IncAddress(1);
rv = WriteProg(); rv = WriteProg();
} }
if ( rv > 0 && (type & CONFIG_TYPE) ) if (rv > 0 && (type & CONFIG_TYPE))
{ {
// write the config locations // write the config locations
// this must be the FIRST operation (just after reset) // this must be the FIRST operation (just after reset)
@ -176,7 +176,7 @@ int Pic125xx::Verify(int type)
int v_prog = OK, v_config = OK; int v_prog = OK, v_config = OK;
if ( type & CONFIG_TYPE ) if (type & CONFIG_TYPE)
{ {
uint32_t f; uint32_t f;
SecurityRead(f); SecurityRead(f);
@ -198,7 +198,7 @@ int Pic125xx::Verify(int type)
GetBus()->IncAddress(1); GetBus()->IncAddress(1);
} }
if ( type & PROG_TYPE ) if (type & PROG_TYPE)
{ {
v_prog = VerifyProg(localbuf); v_prog = VerifyProg(localbuf);
} }
@ -221,7 +221,7 @@ int Pic125xx::VerifyProg(unsigned char *localbuf)
// long v_len = size - 2; //Don't verify RC Calibration location // long v_len = size - 2; //Don't verify RC Calibration location
long v_len = size; long v_len = size;
if (GetBus()->GetLastProgrammedAddress() > 0 && GetBus()->GetLastProgrammedAddress() < size - 1 ) if (GetBus()->GetLastProgrammedAddress() > 0 && GetBus()->GetLastProgrammedAddress() < size - 1)
{ {
v_len = GetBus()->GetLastProgrammedAddress() + 2; v_len = GetBus()->GetLastProgrammedAddress() + 2;
GetBus()->ClearLastProgrammedAddress(); //reset last_programmed_addr, so next verify not preceeded by write verify all the flash GetBus()->ClearLastProgrammedAddress(); //reset last_programmed_addr, so next verify not preceeded by write verify all the flash
@ -233,7 +233,7 @@ int Pic125xx::VerifyProg(unsigned char *localbuf)
// read the current flash content and store it in localbuf // read the current flash content and store it in localbuf
rval = GetBus()->Read(0, localbuf, v_len); rval = GetBus()->Read(0, localbuf, v_len);
if ( rval != v_len ) if (rval != v_len)
{ {
if (rval > 0) if (rval > 0)
{ {

View File

@ -38,7 +38,7 @@
class Pic125xx : public Device class Pic125xx : public Device
{ {
public: //---------------------------------------- public public: //---------------------------------------- public
Pic125xx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0); Pic125xx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
virtual ~Pic125xx(); virtual ~Pic125xx();
@ -52,7 +52,7 @@ public: //---------------------------------------- public
int SecurityRead(uint32_t &bits); int SecurityRead(uint32_t &bits);
int SecurityWrite(uint32_t bits); int SecurityWrite(uint32_t bits);
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
Pic12Bus *GetBus() Pic12Bus *GetBus()
{ {
@ -63,7 +63,7 @@ protected: //--------------------------------------- protected
// virtual int WriteProg(); // virtual int WriteProg();
virtual int VerifyProg(unsigned char *localbuf); virtual int VerifyProg(unsigned char *localbuf);
private: //--------------------------------------- private private: //--------------------------------------- private
uint16_t config_word; uint16_t config_word;
}; };

View File

@ -85,7 +85,7 @@ void Pic12Bus::SetDelay()
int val = E2Profile::GetPICSpeed(); int val = E2Profile::GetPICSpeed();
int n; int n;
switch(val) switch (val)
{ {
case TURBO: case TURBO:
n = 1; n = 1;
@ -180,7 +180,7 @@ long Pic12Bus::RecDataWord(int wlen)
//receive lsb first //receive lsb first
for (k = 0; k < wlen; k++) for (k = 0; k < wlen; k++)
if ( RecDataBit() ) if (RecDataBit())
{ {
val |= 1 << k; val |= 1 << k;
} }
@ -294,12 +294,12 @@ long Pic12Bus::BlankCheck(long length)
//Read Program Code //Read Program Code
SendCmdCode(ReadProgCode); SendCmdCode(ReadProgCode);
if ( CompareSingleWord(0xffff, RecvProgCode(), ProgMask) ) if (CompareSingleWord(0xffff, RecvProgCode(), ProgMask))
{ {
break; break;
} }
if ( CheckAbort(len * 100 / length) ) if (CheckAbort(len * 100 / length))
{ {
break; break;
} }
@ -343,7 +343,7 @@ long Pic12Bus::Read(int addr, uint8_t *data, long length, int page_size)
#endif #endif
IncAddress(1); IncAddress(1);
if ( CheckAbort(len * 100 / length) ) if (CheckAbort(len * 100 / length))
{ {
break; break;
} }
@ -385,13 +385,13 @@ long Pic12Bus::Write(int addr, uint8_t const *data, long length, int page_size)
#endif #endif
rv = WriteProgWord(val, length - 1); rv = WriteProgWord(val, length - 1);
if ( rv != OK ) if (rv != OK)
{ {
len = rv; len = rv;
break; break;
} }
if ( CheckAbort(len * 100 / length) ) if (CheckAbort(len * 100 / length))
{ {
break; break;
} }
@ -424,14 +424,14 @@ int Pic12Bus::WriteProgWord(uint16_t val, long rc_addr)
// e il valore da pgrogrammare corrisponde ad una MOVLW xx (0x0Cxx) // e il valore da pgrogrammare corrisponde ad una MOVLW xx (0x0Cxx)
SendCmdCode(ReadProgCode); SendCmdCode(ReadProgCode);
if ( CompareSingleWord(RecvProgCode(), 0xffff, ProgMask) == 0 && if (CompareSingleWord(RecvProgCode(), 0xffff, ProgMask) == 0 &&
CompareSingleWord(val, 0x0C00, (ProgMask & 0xff00)) == 0 ) CompareSingleWord(val, 0x0C00, (ProgMask & 0xff00)) == 0)
{ {
SetLastProgrammedAddress(current_address << 1); SetLastProgrammedAddress(current_address << 1);
for (k = 1; k <= MAX_PROG_PULSES; k++) for (k = 1; k <= MAX_PROG_PULSES; k++)
{ {
if ( ProgramPulse(val, 1) == OK ) if (ProgramPulse(val, 1) == OK)
{ {
break; break;
} }
@ -462,20 +462,20 @@ int Pic12Bus::WriteProgWord(uint16_t val, long rc_addr)
//Check for blank (erased cells) //Check for blank (erased cells)
SendCmdCode(ReadProgCode); SendCmdCode(ReadProgCode);
if ( CompareSingleWord(RecvProgCode(), 0xffff, ProgMask) ) if (CompareSingleWord(RecvProgCode(), 0xffff, ProgMask))
{ {
rval = E2ERR_BLANKCHECKFAILED; rval = E2ERR_BLANKCHECKFAILED;
} }
else else
{ {
//Skip FFF words //Skip FFF words
if ( CompareSingleWord(val, 0xffff, ProgMask) != 0 ) if (CompareSingleWord(val, 0xffff, ProgMask) != 0)
{ {
SetLastProgrammedAddress(current_address << 1); SetLastProgrammedAddress(current_address << 1);
for (k = 1; k <= MAX_PROG_PULSES; k++) for (k = 1; k <= MAX_PROG_PULSES; k++)
{ {
if ( ProgramPulse(val, 1) == OK ) if (ProgramPulse(val, 1) == OK)
{ {
break; break;
} }
@ -557,7 +557,7 @@ int Pic12Bus::CompareMultiWord(uint8_t *data1, uint8_t *data2, long length, int
{ {
int retval = 0; int retval = 0;
if ( data1 == 0 || data2 == 0 || (length & 1) != 0 ) if (data1 == 0 || data2 == 0 || (length & 1) != 0)
{ {
return BADPARAM; return BADPARAM;
} }
@ -584,7 +584,7 @@ int Pic12Bus::CompareMultiWord(uint8_t *data1, uint8_t *data2, long length, int
val2 |= (uint16_t)(*data2++) << 8; val2 |= (uint16_t)(*data2++) << 8;
#endif #endif
if ( (retval = CompareSingleWord(val1, val2, ProgMask)) ) if ((retval = CompareSingleWord(val1, val2, ProgMask)))
{ {
break; //Stop if a difference break; //Stop if a difference
} }

View File

@ -36,7 +36,7 @@
class Pic12Bus : public BusIO class Pic12Bus : public BusIO
{ {
public: //------------------------------- public public: //------------------------------- public
Pic12Bus(BusInterface *ptr = 0); Pic12Bus(BusInterface *ptr = 0);
virtual ~Pic12Bus(); virtual ~Pic12Bus();
@ -60,7 +60,7 @@ public: //------------------------------- public
long BlankCheck(long length); long BlankCheck(long length);
void IncAddress(int n); void IncAddress(int n);
protected: //------------------------------- protected protected: //------------------------------- protected
int SendDataWord(long wo, int wlen = 16); int SendDataWord(long wo, int wlen = 16);
long RecDataWord(int wlen = 16); long RecDataWord(int wlen = 16);
@ -128,7 +128,7 @@ protected: //------------------------------- protected
// const uint8_t BeginProgOnlyCode; // const uint8_t BeginProgOnlyCode;
const uint8_t EndProgCode; const uint8_t EndProgCode;
private: //------------------------------- private private: //------------------------------- private
int SendDataBit(int b); int SendDataBit(int b);
int RecDataBit(); int RecDataBit();

View File

@ -101,7 +101,7 @@ int Pic168xx::QueryType(long &type)
id_locations[6] = 0; id_locations[6] = 0;
if ( GetBus()->ReadConfig(id_locations) == OK ) if (GetBus()->ReadConfig(id_locations) == OK)
{ {
int code = id_locations[6]; int code = id_locations[6];
@ -139,8 +139,8 @@ int Pic168xx::Probe(int probe_size)
{ {
if (rv == OK) if (rv == OK)
{ {
SetNoOfBank( GetEEPTypeSize(type) ); SetNoOfBank(GetEEPTypeSize(type));
SetSplitted( GetEEPTypeSplit(type) ); SetSplitted(GetEEPTypeSplit(type));
rv = GetSize(); rv = GetSize();
} }
} }
@ -154,7 +154,7 @@ int Pic168xx::Probe(int probe_size)
{ {
if (rv == OK) if (rv == OK)
{ {
if ( GetE2PSubType(GetAWInfo()->GetEEPId()) == subtype ) if (GetE2PSubType(GetAWInfo()->GetEEPId()) == subtype)
{ {
rv = GetSize(); rv = GetSize();
} }
@ -171,11 +171,11 @@ int Pic168xx::Probe(int probe_size)
int Pic168xx::Write(int probe, int type) int Pic168xx::Write(int probe, int type)
{ {
int rv = Probe( probe || GetNoOfBank() == 0 ); int rv = Probe(probe || GetNoOfBank() == 0);
if (rv > 0) if (rv > 0)
{ {
if ( (type & PROG_TYPE) && (type & DATA_TYPE) ) if ((type & PROG_TYPE) && (type & DATA_TYPE))
{ {
GetBus()->Erase(ALL_TYPE); GetBus()->Erase(ALL_TYPE);
} }
@ -199,7 +199,7 @@ int Pic168xx::Write(int probe, int type)
} }
} }
if ( rv > 0 && (type & CONFIG_TYPE) ) if (rv > 0 && (type & CONFIG_TYPE))
{ {
// write the config locations // write the config locations
// this must be the LAST operation (to exit from config mode we have to clear Vpp) // this must be the LAST operation (to exit from config mode we have to clear Vpp)

View File

@ -36,7 +36,7 @@
class Pic168xx : public Pic16xx class Pic168xx : public Pic16xx
{ {
public: //---------------------------------------- public public: //---------------------------------------- public
Pic168xx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0); Pic168xx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
virtual ~Pic168xx(); virtual ~Pic168xx();
@ -46,7 +46,7 @@ public: //---------------------------------------- public
int Write(int probe = 1, int type = ALL_TYPE); int Write(int probe = 1, int type = ALL_TYPE);
// int Verify(int type = ALL_TYPE); // int Verify(int type = ALL_TYPE);
protected: //--------------------------------------- protected protected: //--------------------------------------- protected
PicBus *GetBus() PicBus *GetBus()
{ {
@ -56,7 +56,7 @@ protected: //--------------------------------------- protected
int QueryType(long &type); int QueryType(long &type);
int CodeProtectAdjust(uint16_t &config, int read = 0); int CodeProtectAdjust(uint16_t &config, int read = 0);
private: //--------------------------------------- private private: //--------------------------------------- private
}; };
#endif #endif

View File

@ -118,7 +118,7 @@ int Pic16xx::Probe(int probe_size)
int Pic16xx::Read(int probe, int type) int Pic16xx::Read(int probe, int type)
{ {
int rv = Probe( probe || GetNoOfBank() == 0 ); int rv = Probe(probe || GetNoOfBank() == 0);
if (rv > 0) if (rv > 0)
{ {
@ -135,7 +135,7 @@ int Pic16xx::Read(int probe, int type)
} }
} }
if ( rv > 0 && (type & CONFIG_TYPE) ) if (rv > 0 && (type & CONFIG_TYPE))
{ {
// read the config locations // read the config locations
// this must be the LAST operation (to exit from config mode we have to clear Vpp) // this must be the LAST operation (to exit from config mode we have to clear Vpp)
@ -151,11 +151,11 @@ int Pic16xx::Read(int probe, int type)
int Pic16xx::Write(int probe, int type) int Pic16xx::Write(int probe, int type)
{ {
int rv = Probe( probe || GetNoOfBank() == 0 ); int rv = Probe(probe || GetNoOfBank() == 0);
if (rv > 0) if (rv > 0)
{ {
if ( (type & PROG_TYPE) && (type & DATA_TYPE) ) if ((type & PROG_TYPE) && (type & DATA_TYPE))
{ {
GetBus()->Erase(ALL_TYPE); GetBus()->Erase(ALL_TYPE);
} }
@ -179,7 +179,7 @@ int Pic16xx::Write(int probe, int type)
} }
} }
if ( rv > 0 && (type & CONFIG_TYPE) ) if (rv > 0 && (type & CONFIG_TYPE))
{ {
// write the config locations // write the config locations
// this must be the LAST operation (to exit from config mode we have to clear Vpp) // this must be the LAST operation (to exit from config mode we have to clear Vpp)

Some files were not shown because too many files have changed in this diff Show More