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;
AboutModalDialog::AboutModalDialog(QWidget* bw, const QString title)
AboutModalDialog::AboutModalDialog(QWidget *bw, const QString title)
: QDialog(bw)
{
qDebug() << "AboutModalDialog::AboutModalDialog()";
@ -59,11 +59,11 @@ AboutModalDialog::AboutModalDialog(QWidget* bw, const QString title)
lblAbout0->setText(APPNAME + " - " + APPNAME_EXT + "<br>" + STR_MSGVERSION + " " + APPVERSION + " " __DATE__);
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>" +
STR_APPDOWNLOAD1 + " " + APPNAME + " " + STR_APPDOWNLOAD2 + "<br>" +
"<a href=\"" + AUTHORWEB + "\">" + AUTHORWEB + "</a>" );
"Porting to Qt4/Qt5 by <a href=\"" + PORTERMAIL + "\">" + PORTERGQT + "</a><br><br>" +
STR_APPDOWNLOAD1 + " " + APPNAME + " " + STR_APPDOWNLOAD2 + "<br>" +
"<a href=\"" + AUTHORWEB + "\">" + AUTHORWEB + "</a>");
chkSound->setChecked( E2Profile::GetSkipStartupDialog());
chkSound->setChecked(E2Profile::GetSkipStartupDialog());
chkSound->setText(STR_LBLSKIPMSG);
pushOk->setText(STR_BTNOK);

View File

@ -43,17 +43,17 @@ class e2CmdWindow;
class AboutModalDialog : public QDialog, public Ui::AboutDialog
{
Q_OBJECT
public: //---------------------------------------- public
public: //---------------------------------------- public
AboutModalDialog(QWidget *bw = 0, const QString title = "About");
virtual ~AboutModalDialog(); // Destructor
protected: //--------------------------------------- protected
protected: //--------------------------------------- protected
private slots:
private slots:
void onChkStart(bool);
void onHelp();
private: //--------------------------------------- private
private: //--------------------------------------- private
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--)
{
rval = GetBus()->WriteByte( (addr >> (j * 8)) & 0xFF, 0 );
rval = GetBus()->WriteByte((addr >> (j * 8)) & 0xFF, 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++)
{
rval = GetBus()->WriteByte( buf[j], 1 );
rval = GetBus()->WriteByte(buf[j], 1);
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 error = Probe( probe || GetNoOfBank() == 0 );
int error = Probe(probe || GetNoOfBank() == 0);
if (error < 0)
{
@ -132,7 +132,7 @@ int At17xxx::Write(int probe, int type)
break;
}
if ( GetBus()->CheckAbort(j * 100 / size) )
if (GetBus()->CheckAbort(j * 100 / size))
{
rval = OP_ABORTED;
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--)
{
rval = GetBus()->WriteByte( (addr >> (j * 8)) & 0xFF, 0 );
rval = GetBus()->WriteByte((addr >> (j * 8)) & 0xFF, 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 error = Probe( probe || GetNoOfBank() == 0 );
int error = Probe(probe || GetNoOfBank() == 0);
if (error < 0)
{
@ -259,7 +259,7 @@ int At17xxx::Read(int probe, int type)
break;
}
if ( GetBus()->CheckAbort(k * 100 / size) )
if (GetBus()->CheckAbort(k * 100 / size))
{
error = OP_ABORTED;
break;
@ -329,7 +329,7 @@ int At17xxx::Verify(int type)
break;
}
if ( memcmp(GetBufPtr() + k, localbuf, readpage_size) != 0 )
if (memcmp(GetBufPtr() + k, localbuf, readpage_size) != 0)
{
rval = 0;
break;
@ -339,7 +339,7 @@ int At17xxx::Verify(int type)
rval = 1;
}
if ( GetBus()->CheckAbort(k * 100 / size) )
if (GetBus()->CheckAbort(k * 100 / size))
{
rval = OP_ABORTED;
break;

View File

@ -34,7 +34,7 @@
class At17xxx : public E24xx
{
public: //---------------------------------------- public
public: //---------------------------------------- public
At17xxx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
@ -43,12 +43,12 @@ public: //---------------------------------------- public
int Write(int probe = 1, 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 ReadPage(long addr, int addr_bytes, uint8_t *buf, int len);
private: //--------------------------------------- private
private: //--------------------------------------- private
};
#endif

View File

@ -74,7 +74,7 @@ int At250Bus::ReadEEPByte(int addr)
{
int rv;
SendDataByte( ReadData | (((addr >> 8) & 1) << 3) );
SendDataByte(ReadData | (((addr >> 8) & 1) << 3));
SendDataByte(addr);
WaitUsec(shot_delay);
@ -88,7 +88,7 @@ int At250Bus::ReadEEPByte(int addr)
void At250Bus::WriteEEPByte(int addr, int data)
{
SendDataByte( WriteData | (((addr >> 8) & 1) << 3) );
SendDataByte(WriteData | (((addr >> 8) & 1) << 3));
SendDataByte(addr);
SendDataByte(data);
@ -160,8 +160,8 @@ long At250Bus::Read(int addr, uint8_t *data, long length, int page_size)
{
*data++ = (uint8_t)ReadEEPByte(addr++);
if ( (len % 10) == 0 )
if ( CheckAbort(len * 100 / length) )
if ((len % 10) == 0)
if (CheckAbort(len * 100 / length))
{
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"
}
if ( (len & 1) )
if ( CheckAbort(len * 100 / length) )
if ((len & 1))
if (CheckAbort(len * 100 / length))
{
break;
}

View File

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

View File

@ -57,9 +57,9 @@ long At250BigBus::Read(int addr, uint8_t *data, long length, int page_size)
long len;
SendDataByte( ReadData );
SendDataByte( (addr >> 8) & 0xFF ); //MSB
SendDataByte( addr & 0xFF ); //LSB
SendDataByte(ReadData);
SendDataByte((addr >> 8) & 0xFF); //MSB
SendDataByte(addr & 0xFF); //LSB
WaitUsec(shot_delay);
@ -67,8 +67,8 @@ long At250BigBus::Read(int addr, uint8_t *data, long length, int page_size)
{
*data++ = RecDataByte();
if ( (len % 10) == 0 )
if ( CheckAbort(len * 100 / length) )
if ((len % 10) == 0)
if (CheckAbort(len * 100 / length))
{
break;
}
@ -104,9 +104,9 @@ long At250BigBus::Write(int addr, uint8_t const *data, long length, int page_siz
SendDataByte(WriteEnable);
EndCycle();
SendDataByte( WriteData );
SendDataByte( (addr >> 8) & 0xFF ); //MSB
SendDataByte( addr & 0xFF ); //LSB
SendDataByte(WriteData);
SendDataByte((addr >> 8) & 0xFF); //MSB
SendDataByte(addr & 0xFF); //LSB
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"
}
if ( (len & 1) )
if ( CheckAbort(len * 100 / length) )
if ((len & 1))
if (CheckAbort(len * 100 / length))
{
break;
}

View File

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

View File

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

View File

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

View File

@ -79,31 +79,31 @@ void At89sBus::SetDelay()
int val = E2Profile::GetSPISpeed();
int n;
switch(val)
switch (val)
{
case TURBO:
n = 1;
break;
case TURBO:
n = 1;
break;
case FAST:
n = 5;
break;
case FAST:
n = 5;
break;
case SLOW:
n = 30;
break;
case SLOW:
n = 30;
break;
case VERYSLOW:
n = 100;
break;
case VERYSLOW:
n = 100;
break;
case ULTRASLOW:
n = 1000;
break;
case ULTRASLOW:
n = 1000;
break;
default:
n = 15;
break;
default:
n = 15;
break;
}
BusIO::SetDelay(n);
@ -148,7 +148,7 @@ int At89sBus::ReadProgByte(long addr)
{
if (oldmode)
{
SendDataByte(OldReadProgMem | ((addr >> 5) & 0xF8) | ((addr >> 11) & 0x04) );
SendDataByte(OldReadProgMem | ((addr >> 5) & 0xF8) | ((addr >> 11) & 0x04));
}
else
{
@ -317,7 +317,7 @@ int At89sBus::Reset()
}
SPIBus::Reset();
WaitMsec( E2Profile::GetAT89DelayAfterReset() ); // Almeno 20msec dai datasheet AVR atmel
WaitMsec(E2Profile::GetAT89DelayAfterReset()); // Almeno 20msec dai datasheet AVR atmel
SendDataByte(EnableProg0);
SendDataByte(EnableProg1);
@ -340,22 +340,22 @@ int At89sBus::WriteLockBits(uint32_t param, long model)
switch (model)
{
case AT89S8253:
val1 = WriteLockBits0;
val2 = WriteLockBits1 | (~param & 0x07);
break;
case AT89S8253:
val1 = WriteLockBits0;
val2 = WriteLockBits1 | (~param & 0x07);
break;
case AT89S51:
case AT89S52:
//Translate from B1-B2 code to LB1-LB2-LB3
//...
break;
case AT89S51:
case AT89S52:
//Translate from B1-B2 code to LB1-LB2-LB3
//...
break;
default:
val1 = WriteLockBits0;
val2 = OldWriteLockBits1;
val2 |= 0xff & ~param;
break;
default:
val1 = WriteLockBits0;
val2 = OldWriteLockBits1;
val2 |= 0xff & ~param;
break;
}
if (val1 != -1)
@ -389,27 +389,27 @@ int At89sBus::ReadLockBits(uint32_t &res, long model)
switch (model)
{
case AT89S8253:
SendDataByte(ReadLockBits0);
SendDataByte(ReadLockBits1);
SendDataByte(0);
rv1 = RecDataByte();
res = ~rv1 & 0x07;
break;
case AT89S8253:
SendDataByte(ReadLockBits0);
SendDataByte(ReadLockBits1);
SendDataByte(0);
rv1 = RecDataByte();
res = ~rv1 & 0x07;
break;
case AT89S51:
case AT89S52:
//NB.Different polarity from other devices: 1 mean programmed (should update message in the dialog)
SendDataByte(ReadLockBits0);
SendDataByte(ReadLockBits1);
SendDataByte(0);
rv1 = RecDataByte();
res = rv1 & 0x1C;
break;
case AT89S51:
case AT89S52:
//NB.Different polarity from other devices: 1 mean programmed (should update message in the dialog)
SendDataByte(ReadLockBits0);
SendDataByte(ReadLockBits1);
SendDataByte(0);
rv1 = RecDataByte();
res = rv1 & 0x1C;
break;
default:
rval = NOTSUPPORTED;
break;
default:
rval = NOTSUPPORTED;
break;
}
return rval;
@ -424,14 +424,14 @@ int At89sBus::WriteFuseBits(uint32_t param, long model)
switch (model)
{
case AT89S8253:
val1 = WriteUserFuses0;
val2 = WriteUserFuses1 | (~param & 0x0f);
break;
case AT89S8253:
val1 = WriteUserFuses0;
val2 = WriteUserFuses1 | (~param & 0x0f);
break;
default:
//No Fuses
break;
default:
//No Fuses
break;
}
if (val1 != -1)
@ -457,17 +457,17 @@ int At89sBus::ReadFuseBits(uint32_t &res, long model)
switch (model)
{
case AT89S8253:
SendDataByte(ReadUserFuses0);
SendDataByte(ReadUserFuses1);
SendDataByte(0);
rv1 = RecDataByte();
res = ~rv1 & 0x0f;
break;
case AT89S8253:
SendDataByte(ReadUserFuses0);
SendDataByte(ReadUserFuses1);
SendDataByte(0);
rv1 = RecDataByte();
res = ~rv1 & 0x0f;
break;
default: //No Fuses
rval = NOTSUPPORTED;
break;
default: //No Fuses
rval = NOTSUPPORTED;
break;
}
return rval;
@ -518,7 +518,7 @@ long At89sBus::Read(int addr, uint8_t *data, long length, int page_size)
{
ReadDataPage(addr, data, page_size);
if ( CheckAbort(len * 100 / length) )
if (CheckAbort(len * 100 / length))
{
break;
}
@ -530,7 +530,7 @@ long At89sBus::Read(int addr, uint8_t *data, long length, int page_size)
{
*data++ = (uint8_t)ReadDataByte(addr++);
if ( CheckAbort(len * 100 / length) )
if (CheckAbort(len * 100 / length))
{
break;
}
@ -548,7 +548,7 @@ long At89sBus::Read(int addr, uint8_t *data, long length, int page_size)
{
ReadProgPage(addr, data, page_size);
if ( CheckAbort(len * 100 / length) )
if (CheckAbort(len * 100 / length))
{
break;
}
@ -560,7 +560,7 @@ long At89sBus::Read(int addr, uint8_t *data, long length, int page_size)
{
*data++ = (uint8_t)ReadProgByte(addr++);
if ( CheckAbort(len * 100 / length) )
if (CheckAbort(len * 100 / length))
{
break;
}
@ -633,7 +633,7 @@ long At89sBus::Write(int addr, uint8_t const *data, long length, int page_size)
return E2ERR_WRITEFAILED;
}
if ( CheckAbort(len * 100 / length) )
if (CheckAbort(len * 100 / length))
{
break;
}
@ -657,14 +657,14 @@ long At89sBus::Write(int addr, uint8_t const *data, long length, int page_size)
WaitUsec(100);
//Interrupt the writing and exit (device missing?)
if ( WaitReadyAfterWrite(1, addr, *data) != OK )
if (WaitReadyAfterWrite(1, addr, *data) != OK)
{
return E2ERR_WRITEFAILED;
}
}
}
if ( CheckAbort(len * 100 / length) )
if (CheckAbort(len * 100 / length))
{
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)
{
//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)
{
return E2ERR_WRITEFAILED;
}
if ( CheckAbort(len * 100 / length) )
if (CheckAbort(len * 100 / length))
{
break;
}
@ -711,14 +711,14 @@ long At89sBus::Write(int addr, uint8_t const *data, long length, int page_size)
WaitUsec(100);
//Interrupt the writing and exit (device missing?)
if ( WaitReadyAfterWrite(0, addr, *data) != OK )
if (WaitReadyAfterWrite(0, addr, *data) != OK)
{
return E2ERR_WRITEFAILED;
}
}
}
if ( CheckAbort(len * 100 / length) )
if (CheckAbort(len * 100 / length))
{
break;
}

View File

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

View File

@ -123,7 +123,7 @@ int At89sxx::QueryType(long &type)
code[1] = GetBus()->ReadDeviceCode(0x100);
code[2] = GetBus()->ReadDeviceCode(0x200);
qDebug() << "At89sxx::ParseID(100) *** " << (hex) << code[0] << " - " << code[1] << " - " << code[2] << (dec);
qDebug() << "At89sxx::ParseID(100) *** " << (hex) << code[0] << " - " << code[1] << " - " << code[2] << (dec);
if (code[0] == 0x1E && code[1] == 0x51 && code[2] == 0x06)
{
@ -158,9 +158,9 @@ int At89sxx::Probe(int probe_size)
{
switch (GetAWInfo()->GetEEPId())
{
case AT89S51:
case AT89S52:
case AT89S8253:
case AT89S51:
case AT89S52:
case AT89S8253:
{
long type;
rv = QueryType(type);
@ -168,7 +168,7 @@ int At89sxx::Probe(int probe_size)
if (rv == OK)
{
if ( GetE2PSubType(GetAWInfo()->GetEEPId()) == subtype )
if (GetE2PSubType(GetAWInfo()->GetEEPId()) == subtype)
{
rv = GetSize();
}
@ -180,9 +180,9 @@ int At89sxx::Probe(int probe_size)
}
break;
default:
rv = GetSize();
break;
default:
rv = GetSize();
break;
}
}
@ -217,14 +217,14 @@ int At89sxx::Read(int probe, int type)
// read the fuses
uint32_t f = 0;
if ( GetBus()->ReadFuseBits(f, GetAWInfo()->GetEEPId()) == OK )
if (GetBus()->ReadFuseBits(f, GetAWInfo()->GetEEPId()) == OK)
{
GetAWInfo()->SetFuseBits(f);
}
f = 0;
if ( GetBus()->ReadLockBits(f, GetAWInfo()->GetEEPId()) == OK )
if (GetBus()->ReadLockBits(f, GetAWInfo()->GetEEPId()) == OK)
{
GetAWInfo()->SetLockBits(f);
}
@ -312,8 +312,8 @@ int At89sxx::Verify(int type)
fret = GetBus()->ReadFuseBits(fval, GetAWInfo()->GetEEPId());
lret = GetBus()->ReadLockBits(lval, GetAWInfo()->GetEEPId());
if ( (lret == NOTSUPPORTED || GetAWInfo()->GetLockBits() == lval)
&& (fret == NOTSUPPORTED || GetAWInfo()->GetFuseBits() == fval) )
if ((lret == NOTSUPPORTED || GetAWInfo()->GetLockBits() == lval)
&& (fret == NOTSUPPORTED || GetAWInfo()->GetFuseBits() == fval))
{
v_config = OK;
}

View File

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

View File

@ -76,7 +76,7 @@ At90sBus::At90sBus(BusInterface *ptr)
int At90sBus::ReadEEPByte(long addr)
{
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);
return RecDataByte();
@ -85,7 +85,7 @@ int At90sBus::ReadEEPByte(long addr)
void At90sBus::WriteEEPByte(long addr, int data)
{
SendDataByte(WriteEEPMem0);
SendDataByte(WriteEEPMem1 | ((addr & 0xFFFF) >> 8) ); //19/01/1999
SendDataByte(WriteEEPMem1 | ((addr & 0xFFFF) >> 8)); //19/01/1999
SendDataByte(addr);
SendDataByte(data);
}
@ -162,7 +162,7 @@ int At90sBus::Reset()
{
SPIBus::Reset();
WaitMsec( E2Profile::GetAVRDelayAfterReset() ); // At least 20msec (AVR datasheets)
WaitMsec(E2Profile::GetAVRDelayAfterReset()); // At least 20msec (AVR datasheets)
qDebug() << "Avr1200Bus::Reset() ** SendDataByte";
@ -171,7 +171,7 @@ int At90sBus::Reset()
RecDataByte();
SendDataByte(0);
if ( ReadDeviceCode(0) == 0x1E )
if (ReadDeviceCode(0) == 0x1E)
{
success_flag = true;
}
@ -187,7 +187,7 @@ int At90sBus::Reset()
SPIBus::Reset();
WaitMsec( E2Profile::GetAVRDelayAfterReset() ); // At least 20msec (AVR datasheets)
WaitMsec(E2Profile::GetAVRDelayAfterReset()); // At least 20msec (AVR datasheets)
int k;
@ -228,78 +228,78 @@ int At90sBus::WriteLockBits(uint32_t param, long model)
switch (model)
{
case AT90S1200:
case AT90S2313:
case AT90S4414:
case AT90S8515:
case AT90S2323:
case AT90S2343:
case AT90S2333:
case AT90S4433:
case AT90S4434:
case AT90S8535:
case ATmega603:
case ATmega103:
case ATtiny12:
case ATtiny15:
case ATtiny22:
val1 = WriteLock0;
val2 = ~(param & 0x06);
break;
case AT90S1200:
case AT90S2313:
case AT90S4414:
case AT90S8515:
case AT90S2323:
case AT90S2343:
case AT90S2333:
case AT90S4433:
case AT90S4434:
case AT90S8535:
case ATmega603:
case ATmega103:
case ATtiny12:
case ATtiny15:
case ATtiny22:
val1 = WriteLock0;
val2 = ~(param & 0x06);
break;
case ATtiny2313:
case ATtiny26:
case ATtiny13:
case ATtiny25:
case ATtiny45:
case ATtiny85:
case ATtiny261:
case ATtiny461:
case ATtiny861:
val1 = WriteLock0;
val2 = WriteLock1;
//
val4 = ~(param & 0x03);
break;
case ATtiny2313:
case ATtiny26:
case ATtiny13:
case ATtiny25:
case ATtiny45:
case ATtiny85:
case ATtiny261:
case ATtiny461:
case ATtiny861:
val1 = WriteLock0;
val2 = WriteLock1;
//
val4 = ~(param & 0x03);
break;
case ATmega8:
case ATmega16:
case ATmega161:
case ATmega163:
case ATmega323:
case ATmega128:
case ATmega64:
case ATmega32:
case ATmega162:
case ATmega169:
case ATmega8515:
case ATmega8535:
case ATmega48:
case ATmega88:
case ATmega168:
case ATmega328: // new ATmega328 (RG 22.06.2012)
case ATmega164:
case ATmega324:
case ATmega644:
case ATmega640:
case ATmega1280:
case ATmega1281:
case ATmega2560:
case ATmega2561:
case AT90CAN32:
case AT90CAN64:
case AT90CAN128:
val1 = WriteLock0;
val2 = WriteLock1;
//
val4 = ~(param & 0x3F);
break;
case ATmega8:
case ATmega16:
case ATmega161:
case ATmega163:
case ATmega323:
case ATmega128:
case ATmega64:
case ATmega32:
case ATmega162:
case ATmega169:
case ATmega8515:
case ATmega8535:
case ATmega48:
case ATmega88:
case ATmega168:
case ATmega328: // new ATmega328 (RG 22.06.2012)
case ATmega164:
case ATmega324:
case ATmega644:
case ATmega640:
case ATmega1280:
case ATmega1281:
case ATmega2560:
case ATmega2561:
case AT90CAN32:
case AT90CAN64:
case AT90CAN128:
val1 = WriteLock0;
val2 = WriteLock1;
//
val4 = ~(param & 0x3F);
break;
//Only Parallel programming
case AT90S8534:
default:
//No Locks
break;
//Only Parallel programming
case AT90S8534:
default:
//No Locks
break;
}
if (val1 != -1)
@ -342,110 +342,110 @@ int At90sBus::WriteFuseBits(uint32_t param, long model)
switch (model)
{
case AT90S2323:
case AT90S2343:
case AT90S4434:
case AT90S8535:
val1 = WriteFuse0;
val2 = WriteFuse1a & ~(param & 1);
break;
case AT90S2323:
case AT90S2343:
case AT90S4434:
case AT90S8535:
val1 = WriteFuse0;
val2 = WriteFuse1a & ~(param & 1);
break;
case ATmega603:
case ATmega103:
val1 = WriteFuse0;
val2 = WriteFuse1a & ~(param & 0x0B);
break;
case ATmega603:
case ATmega103:
val1 = WriteFuse0;
val2 = WriteFuse1a & ~(param & 0x0B);
break;
case AT90S2333:
case AT90S4433:
val1 = WriteFuse0;
val2 = WriteFuse1a & ~(param & 0x1F);
break;
case AT90S2333:
case AT90S4433:
val1 = WriteFuse0;
val2 = WriteFuse1a & ~(param & 0x1F);
break;
//One byte fuse
case ATtiny12:
case ATtiny15:
case ATmega161:
val1 = WriteFuse0;
val2 = WriteFuse1b;
//
val4 = ~(param & 0xFF);
break;
//One byte fuse
case ATtiny12:
case ATtiny15:
case ATmega161:
val1 = WriteFuse0;
val2 = WriteFuse1b;
//
val4 = ~(param & 0xFF);
break;
//Two byte fuse
case ATtiny13:
case ATtiny26:
case ATmega163:
case ATmega323:
case ATmega8:
case ATmega16:
case ATmega32:
case ATmega8515:
case ATmega8535:
val1 = WriteFuse0;
val2 = WriteFuse1b;
//
val4 = ~(param & 0xFF);
//Two byte fuse
case ATtiny13:
case ATtiny26:
case ATmega163:
case ATmega323:
case ATmega8:
case ATmega16:
case ATmega32:
case ATmega8515:
case ATmega8535:
val1 = WriteFuse0;
val2 = WriteFuse1b;
//
val4 = ~(param & 0xFF);
val5 = WriteFuseHigh0;
val6 = WriteFuseHigh1;
//
val8 = ~((param >> 8) & 0xFF);
break;
val5 = WriteFuseHigh0;
val6 = WriteFuseHigh1;
//
val8 = ~((param >> 8) & 0xFF);
break;
//Three byte fuse
case ATtiny2313:
case ATtiny25:
case ATtiny45:
case ATtiny85:
case ATtiny261:
case ATtiny461:
case ATtiny861:
case ATmega128:
case ATmega64:
case ATmega162:
case ATmega169:
case ATmega48:
case ATmega88:
case ATmega168:
case ATmega328: // new ATmega328 (RG 22.06.2012)
case ATmega164:
case ATmega324:
case ATmega644:
case AT90CAN32:
case AT90CAN64:
case AT90CAN128:
case ATmega640:
case ATmega1280:
case ATmega1281:
case ATmega2560:
case ATmega2561:
val1 = WriteFuse0;
val2 = WriteFuse1b;
//
val4 = ~(param & 0xFF);
//Three byte fuse
case ATtiny2313:
case ATtiny25:
case ATtiny45:
case ATtiny85:
case ATtiny261:
case ATtiny461:
case ATtiny861:
case ATmega128:
case ATmega64:
case ATmega162:
case ATmega169:
case ATmega48:
case ATmega88:
case ATmega168:
case ATmega328: // new ATmega328 (RG 22.06.2012)
case ATmega164:
case ATmega324:
case ATmega644:
case AT90CAN32:
case AT90CAN64:
case AT90CAN128:
case ATmega640:
case ATmega1280:
case ATmega1281:
case ATmega2560:
case ATmega2561:
val1 = WriteFuse0;
val2 = WriteFuse1b;
//
val4 = ~(param & 0xFF);
val5 = WriteFuseHigh0;
val6 = WriteFuseHigh1;
//
val8 = ~((param >> 8) & 0xFF);
val5 = WriteFuseHigh0;
val6 = WriteFuseHigh1;
//
val8 = ~((param >> 8) & 0xFF);
val9 = WriteFuseExt0;
valA = WriteFuseExt1;
//
valC = ~((param >> 16) & 0xFF);
break;
val9 = WriteFuseExt0;
valA = WriteFuseExt1;
//
valC = ~((param >> 16) & 0xFF);
break;
//No fuses
case AT90S1200:
case AT90S2313:
case AT90S4414:
case AT90S8515:
case ATtiny22:
case AT90S8534:
default:
//No Fuses
break;
//No fuses
case AT90S1200:
case AT90S2313:
case AT90S4414:
case AT90S8515:
case ATtiny22:
case AT90S8534:
default:
//No Fuses
break;
}
if (val1 != -1)
@ -488,121 +488,121 @@ uint32_t At90sBus::ReadFuseBits(long model)
switch (model)
{
case ATtiny22:
SendDataByte(ReadLock0); //NB Read LOCK!!
SendDataByte(ReadLock1);
SendDataByte(0);
rv1 = RecDataByte();
retval = ~rv1 & 0x20;
break;
case ATtiny22:
SendDataByte(ReadLock0); //NB Read LOCK!!
SendDataByte(ReadLock1);
SendDataByte(0);
rv1 = RecDataByte();
retval = ~rv1 & 0x20;
break;
case AT90S2323:
case AT90S2343:
case AT90S4434:
case AT90S8535:
SendDataByte(ReadLock0); //NB Read LOCK!!
SendDataByte(ReadLock1);
SendDataByte(0);
rv1 = RecDataByte();
retval = ~rv1 & 0x21;
break;
case AT90S2323:
case AT90S2343:
case AT90S4434:
case AT90S8535:
SendDataByte(ReadLock0); //NB Read LOCK!!
SendDataByte(ReadLock1);
SendDataByte(0);
rv1 = RecDataByte();
retval = ~rv1 & 0x21;
break;
//One byte fuse
case AT90S2333:
case AT90S4433:
case ATmega603:
case ATmega103:
case ATtiny12:
case ATtiny15:
case ATmega161:
SendDataByte(ReadFuse0);
SendDataByte(ReadFuse1);
SendDataByte(0);
rv1 = RecDataByte();
retval = ~rv1 & 0xFF;
break;
//One byte fuse
case AT90S2333:
case AT90S4433:
case ATmega603:
case ATmega103:
case ATtiny12:
case ATtiny15:
case ATmega161:
SendDataByte(ReadFuse0);
SendDataByte(ReadFuse1);
SendDataByte(0);
rv1 = RecDataByte();
retval = ~rv1 & 0xFF;
break;
//Two byte fuse
case ATtiny13:
case ATtiny26:
case ATmega163:
case ATmega323:
case ATmega8:
case ATmega16:
case ATmega32:
case ATmega8515:
case ATmega8535:
SendDataByte(ReadFuse0);
SendDataByte(ReadFuse1);
SendDataByte(0);
rv1 = RecDataByte();
rv1 = ~rv1 & 0xFF;
//Two byte fuse
case ATtiny13:
case ATtiny26:
case ATmega163:
case ATmega323:
case ATmega8:
case ATmega16:
case ATmega32:
case ATmega8515:
case ATmega8535:
SendDataByte(ReadFuse0);
SendDataByte(ReadFuse1);
SendDataByte(0);
rv1 = RecDataByte();
rv1 = ~rv1 & 0xFF;
SendDataByte(ReadFuseHigh0);
SendDataByte(ReadFuseHigh1);
SendDataByte(0);
rv2 = RecDataByte();
rv2 = ~rv2 & 0xFF;
SendDataByte(ReadFuseHigh0);
SendDataByte(ReadFuseHigh1);
SendDataByte(0);
rv2 = RecDataByte();
rv2 = ~rv2 & 0xFF;
retval = (rv2 << 8) | rv1;
break;
retval = (rv2 << 8) | rv1;
break;
//Three byte fuse
case ATtiny2313:
case ATtiny25:
case ATtiny45:
case ATtiny85:
case ATtiny261:
case ATtiny461:
case ATtiny861:
case ATmega128:
case ATmega64:
case ATmega162:
case ATmega169:
case ATmega48:
case ATmega88:
case ATmega168:
case ATmega328: // new ATmega328 (RG 22.06.2012)
case ATmega164:
case ATmega324:
case ATmega644:
case AT90CAN32:
case AT90CAN64:
case AT90CAN128:
case ATmega640:
case ATmega1280:
case ATmega1281:
case ATmega2560:
case ATmega2561:
SendDataByte(ReadFuse0);
SendDataByte(ReadFuse1);
SendDataByte(0);
rv1 = RecDataByte();
rv1 = ~rv1 & 0xFF;
//Three byte fuse
case ATtiny2313:
case ATtiny25:
case ATtiny45:
case ATtiny85:
case ATtiny261:
case ATtiny461:
case ATtiny861:
case ATmega128:
case ATmega64:
case ATmega162:
case ATmega169:
case ATmega48:
case ATmega88:
case ATmega168:
case ATmega328: // new ATmega328 (RG 22.06.2012)
case ATmega164:
case ATmega324:
case ATmega644:
case AT90CAN32:
case AT90CAN64:
case AT90CAN128:
case ATmega640:
case ATmega1280:
case ATmega1281:
case ATmega2560:
case ATmega2561:
SendDataByte(ReadFuse0);
SendDataByte(ReadFuse1);
SendDataByte(0);
rv1 = RecDataByte();
rv1 = ~rv1 & 0xFF;
SendDataByte(ReadFuseHigh0);
SendDataByte(ReadFuseHigh1);
SendDataByte(0);
rv2 = RecDataByte();
rv2 = ~rv2 & 0xFF;
SendDataByte(ReadFuseHigh0);
SendDataByte(ReadFuseHigh1);
SendDataByte(0);
rv2 = RecDataByte();
rv2 = ~rv2 & 0xFF;
SendDataByte(ReadFuseExt0);
SendDataByte(ReadFuseExt1);
SendDataByte(0);
rv3 = RecDataByte();
rv3 = ~rv3 & 0xFF;
SendDataByte(ReadFuseExt0);
SendDataByte(ReadFuseExt1);
SendDataByte(0);
rv3 = RecDataByte();
rv3 = ~rv3 & 0xFF;
retval = (rv3 << 16) | (rv2 << 8) | rv1;
break;
retval = (rv3 << 16) | (rv2 << 8) | rv1;
break;
//No fuses
case AT90S1200:
case AT90S2313:
case AT90S4414:
case AT90S8515:
default:
//No Fuses
break;
//No fuses
case AT90S1200:
case AT90S2313:
case AT90S4414:
case AT90S8515:
default:
//No Fuses
break;
}
return retval;
@ -615,103 +615,103 @@ uint32_t At90sBus::ReadLockBits(long model)
switch (model)
{
case AT90S1200:
case AT90S2313:
case AT90S4414:
case AT90S8515:
//No read locks command
int code[3];
code[0] = ReadDeviceCode(0);
code[1] = ReadDeviceCode(1);
code[2] = ReadDeviceCode(2);
case AT90S1200:
case AT90S2313:
case AT90S4414:
case AT90S8515:
//No read locks command
int code[3];
code[0] = ReadDeviceCode(0);
code[1] = ReadDeviceCode(1);
code[2] = ReadDeviceCode(2);
if (code[0] == 0x00 && code[1] == 0x01 && code[2] == 0x02)
{
retval = 0x06; //both lock bits programmed
}
if (code[0] == 0x00 && code[1] == 0x01 && code[2] == 0x02)
{
retval = 0x06; //both lock bits programmed
}
break;
break;
case ATtiny22:
case AT90S2323:
case AT90S2343:
case AT90S4434:
case AT90S8535:
SendDataByte(ReadLock0);
SendDataByte(ReadLock1);
SendDataByte(0);
rv2 = rv1 = RecDataByte();
rv1 = ~rv1 & 0x80;
rv2 = ~rv2 & 0x40;
retval = (rv1 >> 6) | (rv2 >> 4);
break;
case ATtiny22:
case AT90S2323:
case AT90S2343:
case AT90S4434:
case AT90S8535:
SendDataByte(ReadLock0);
SendDataByte(ReadLock1);
SendDataByte(0);
rv2 = rv1 = RecDataByte();
rv1 = ~rv1 & 0x80;
rv2 = ~rv2 & 0x40;
retval = (rv1 >> 6) | (rv2 >> 4);
break;
case ATtiny12:
case ATtiny15:
case AT90S2333:
case AT90S4433:
case ATmega603:
case ATmega103:
SendDataByte(ReadLock0);
SendDataByte(ReadLock1);
SendDataByte(0);
rv1 = RecDataByte();
retval = ~rv1 & 0x06;
break;
case ATtiny12:
case ATtiny15:
case AT90S2333:
case AT90S4433:
case ATmega603:
case ATmega103:
SendDataByte(ReadLock0);
SendDataByte(ReadLock1);
SendDataByte(0);
rv1 = RecDataByte();
retval = ~rv1 & 0x06;
break;
case ATtiny13:
case ATtiny26:
case ATtiny2313:
case ATtiny25:
case ATtiny45:
case ATtiny85:
case ATtiny261:
case ATtiny461:
case ATtiny861:
SendDataByte(ReadLock0);
SendDataByte(ReadLock1);
SendDataByte(0);
rv1 = RecDataByte();
retval = ~rv1 & 0x03;
break;
case ATtiny13:
case ATtiny26:
case ATtiny2313:
case ATtiny25:
case ATtiny45:
case ATtiny85:
case ATtiny261:
case ATtiny461:
case ATtiny861:
SendDataByte(ReadLock0);
SendDataByte(ReadLock1);
SendDataByte(0);
rv1 = RecDataByte();
retval = ~rv1 & 0x03;
break;
case ATmega8:
case ATmega16:
case ATmega161:
case ATmega163:
case ATmega323:
case ATmega128:
case ATmega64:
case ATmega32:
case ATmega162:
case ATmega169:
case ATmega8515:
case ATmega8535:
case ATmega48:
case ATmega88:
case ATmega168:
case ATmega328: // new ATmega328 (RG 22.06.2012)
case ATmega164:
case ATmega324:
case ATmega644:
case AT90CAN32:
case AT90CAN64:
case AT90CAN128:
case ATmega640:
case ATmega1280:
case ATmega1281:
case ATmega2560:
case ATmega2561:
SendDataByte(ReadLock0);
SendDataByte(ReadLock1);
SendDataByte(0);
rv1 = RecDataByte();
retval = ~rv1 & 0x3F;
break;
case ATmega8:
case ATmega16:
case ATmega161:
case ATmega163:
case ATmega323:
case ATmega128:
case ATmega64:
case ATmega32:
case ATmega162:
case ATmega169:
case ATmega8515:
case ATmega8535:
case ATmega48:
case ATmega88:
case ATmega168:
case ATmega328: // new ATmega328 (RG 22.06.2012)
case ATmega164:
case ATmega324:
case ATmega644:
case AT90CAN32:
case AT90CAN64:
case AT90CAN128:
case ATmega640:
case ATmega1280:
case ATmega1281:
case ATmega2560:
case ATmega2561:
SendDataByte(ReadLock0);
SendDataByte(ReadLock1);
SendDataByte(0);
rv1 = RecDataByte();
retval = ~rv1 & 0x3F;
break;
default:
//No locks
break;
default:
//No locks
break;
}
return retval;
@ -754,7 +754,7 @@ long At90sBus::Read(int addr, uint8_t *data, long length, int page_size)
{
*data++ = (uint8_t)ReadEEPByte(addr++);
if ( CheckAbort(len * 100 / length) )
if (CheckAbort(len * 100 / length))
{
break;
}
@ -771,7 +771,7 @@ long At90sBus::Read(int addr, uint8_t *data, long length, int page_size)
{
*data++ = (uint8_t)ReadProgByte(addr++);
if ( CheckAbort(len * 100 / length) )
if (CheckAbort(len * 100 / length))
{
break;
}
@ -798,7 +798,7 @@ int At90sBus::WaitReadyAfterWrite(int type, long addr, int data, long timeout)
{
//EEprom
if (data == p1_a || data == p2_a ||
data == p1_b || data == p2_b)
data == p1_b || data == p2_b)
{
rval = OK;
WaitMsec(twd_prog);
@ -826,7 +826,7 @@ int At90sBus::WaitReadyAfterWrite(int type, long addr, int data, long timeout)
{
//Flash
if (data == pflash_a ||
data == pflash_b)
data == pflash_b)
{
rval = OK;
WaitMsec(twd_prog);
@ -902,13 +902,13 @@ long At90sBus::Write(int addr, uint8_t const *data, long length, int page_size)
WaitUsec(100);
//Interrupt the writing and exit (device missing?)
if ( WaitReadyAfterWrite(1, addr, *data) != OK )
if (WaitReadyAfterWrite(1, addr, *data) != OK)
{
return E2ERR_WRITEFAILED;
}
}
if ( CheckAbort(len * 100 / length) )
if (CheckAbort(len * 100 / length))
{
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)
{
//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)
{
return E2ERR_WRITEFAILED;
}
if ( CheckAbort(len * 100 / length) )
if (CheckAbort(len * 100 / length))
{
break;
}
@ -939,7 +939,7 @@ long At90sBus::Write(int addr, uint8_t const *data, long length, int page_size)
}
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)
if (*data != 0xFF)
@ -948,13 +948,13 @@ long At90sBus::Write(int addr, uint8_t const *data, long length, int page_size)
WaitUsec(100);
if ( WaitReadyAfterWrite(0, addr, *data, 2000) != OK )
if (WaitReadyAfterWrite(0, addr, *data, 2000) != OK)
{
return E2ERR_WRITEFAILED;
}
}
if ( CheckAbort(len * 100 / length) )
if (CheckAbort(len * 100 / length))
{
break;
}
@ -1021,7 +1021,7 @@ int At90sBus::WriteProgPage(long addr, uint8_t const *data, long page_size, long
for (k = timeout; k > 0; k--)
{
if ( ReadProgByte(first_loc) != 0xFF )
if (ReadProgByte(first_loc) != 0xFF)
{
okflag = true;
break;
@ -1031,7 +1031,7 @@ int At90sBus::WriteProgPage(long addr, uint8_t const *data, long page_size, long
else
{
okflag = true;
WaitMsec( E2Profile::GetMegaPageDelay() );
WaitMsec(E2Profile::GetMegaPageDelay());
}
return okflag ? OK : E2P_TIMEOUT;

View File

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

View File

@ -60,7 +60,7 @@ int At90sxx::SecurityRead(uint32_t &bits)
if (rv > 0)
{
bits = GetBus()->ReadLockBits( GetAWInfo()->GetEEPId() );
bits = GetBus()->ReadLockBits(GetAWInfo()->GetEEPId());
rv = OK;
}
@ -343,7 +343,7 @@ int At90sxx::Probe(int probe_size)
if (rv == OK)
{
if ( GetE2PSubType(GetAWInfo()->GetEEPId()) == subtype )
if (GetE2PSubType(GetAWInfo()->GetEEPId()) == subtype)
{
rv = GetSize();
}
@ -363,10 +363,10 @@ int At90sxx::Erase(int probe, int type)
{
int rv = OK;
if ( (type & PROG_TYPE) && (type & DATA_TYPE) )
if ((type & PROG_TYPE) && (type & DATA_TYPE))
{
GetBus()->Erase();
rv = Probe( probe || GetNoOfBank() == 0 );
rv = Probe(probe || GetNoOfBank() == 0);
}
else
{
@ -378,7 +378,7 @@ int At90sxx::Erase(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)
{
@ -402,10 +402,10 @@ int At90sxx::Read(int probe, int type)
if (type & CONFIG_TYPE)
{
// read the fuses
uint32_t f = GetBus()->ReadFuseBits( GetAWInfo()->GetEEPId() );
uint32_t f = GetBus()->ReadFuseBits(GetAWInfo()->GetEEPId());
GetAWInfo()->SetFuseBits(f);
f = GetBus()->ReadLockBits( GetAWInfo()->GetEEPId() );
f = GetBus()->ReadLockBits(GetAWInfo()->GetEEPId());
GetAWInfo()->SetLockBits(f);
}
}
@ -418,12 +418,12 @@ int At90sxx::Read(int probe, int type)
int At90sxx::Write(int probe, int 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();
}
int rv = Probe( probe || GetNoOfBank() == 0 );
int rv = Probe(probe || GetNoOfBank() == 0);
if (rv > 0)
{
@ -446,7 +446,7 @@ int At90sxx::Write(int probe, int type)
{
if (type & CONFIG_TYPE)
{
if ( GetAWInfo()->GetEEPId() == AT90S4433 || GetAWInfo()->GetEEPId() == AT90S2333 )
if (GetAWInfo()->GetEEPId() == AT90S4433 || GetAWInfo()->GetEEPId() == AT90S2333)
{
//write the locks
uint32_t f = GetAWInfo()->GetLockBits();
@ -510,10 +510,10 @@ int At90sxx::Verify(int type)
if (type & CONFIG_TYPE)
{
// read the fuses & locks
uint32_t f = GetBus()->ReadFuseBits(GetAWInfo()->GetEEPId() );
uint32_t l = GetBus()->ReadLockBits(GetAWInfo()->GetEEPId() );
uint32_t f = GetBus()->ReadFuseBits(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;
}

View File

@ -38,7 +38,7 @@
class At90sxx : public Device
{
public: //---------------------------------------- public
public: //---------------------------------------- public
At90sxx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
virtual ~At90sxx();
@ -61,11 +61,11 @@ public: //---------------------------------------- public
return (At90sBus *)Device::GetBus();
}
protected: //--------------------------------------- protected
protected: //--------------------------------------- protected
int QueryType(long &type);
private: //--------------------------------------- private
private: //--------------------------------------- private
};
#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);
}
if ( (len % 4) == 0 )
if ( CheckAbort(len * 100 / length) )
if ((len % 4) == 0)
if (CheckAbort(len * 100 / length))
{
break;
}
@ -241,7 +241,7 @@ long At93cBus::Write(int addr, uint8_t const *data, long length, int page_size)
#if 1
if ( WaitReadyAfterWrite(loop_timeout) )
if (WaitReadyAfterWrite(loop_timeout))
{
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();
setCS();
if ( (curaddr & 1) )
if ( CheckAbort(curaddr * 100 / length) )
if ((curaddr & 1))
if (CheckAbort(curaddr * 100 / length))
{
break;
}

View File

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

View File

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

View File

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

View File

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

View File

@ -38,7 +38,7 @@
class binFileBuf : public FileBuf
{
public: //---------------------------------------- public
public: //---------------------------------------- public
binFileBuf(e2AppWinInfo *wininfo = 0);
virtual ~binFileBuf();
@ -46,9 +46,9 @@ public: //---------------------------------------- public
virtual int Load(int loadtype = 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

View File

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

View File

@ -31,11 +31,11 @@
BusIO::BusIO(BusInterface *p)
: err_no(0),
last_addr(0),
shot_delay(5),
busI(p),
old_progress(0),
last_programmed_addr(0)
last_addr(0),
shot_delay(5),
busI(p),
old_progress(0),
last_programmed_addr(0)
{
}
@ -48,8 +48,8 @@ int BusIO::CheckAbort(int progress)
if (!abort)
{
if ( (progress == 0 && old_progress != 0) ||
progress > old_progress + 4 )
if ((progress == 0 && old_progress != 0) ||
progress > old_progress + 4)
{
cmdWin->SetProgress(progress);
old_progress = progress;

View File

@ -38,7 +38,7 @@
//Formato di bus generico seriale
class BusIO : public Wait
{
public: //------------------------------- public
public: //------------------------------- public
BusIO(BusInterface *p = 0);
// virtual ~BusIO() { }
@ -152,7 +152,7 @@ public: //------------------------------- public
}
}
protected: //------------------------------- protected
protected: //------------------------------- protected
int err_no; //error code
int last_addr;
@ -161,7 +161,7 @@ protected: //------------------------------- protected
BusInterface *busI;
private: //------------------------------- private
private: //------------------------------- private
int old_progress;
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
{
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);
}

View File

@ -70,50 +70,50 @@ int csmFileBuf::Load(int loadtype, long relocation_offfset)
switch (state)
{
case 0:
case 0:
//look for header start
if ( (s = strchr(riga, '\"')) != NULL )
{
state++;
if ( (s = strstr(s + 1, "REFERENCE")) != NULL )
//look for header start
if ((s = strchr(riga, '\"')) != NULL)
{
state++;
if ( (s = strchr(s + 1, '\"')) != NULL )
if ((s = strstr(s + 1, "REFERENCE")) != NULL)
{
state++;
if ((s = strchr(s + 1, '\"')) != NULL)
{
state++;
}
}
}
break;
case 1:
//look for "REFERENCE"
if ((s = strstr(riga, "REFERENCE")) != NULL)
{
state++;
if ((s = strchr(s + 1, '\"')) != NULL)
{
state++;
}
}
}
break;
break;
case 1:
case 2:
//look for "REFERENCE"
if ( (s = strstr(riga, "REFERENCE")) != NULL )
{
state++;
if ( (s = strchr(s + 1, '\"')) != NULL )
//look for header terminator
if ((s = strchr(riga, '\"')) != NULL)
{
state++;
}
}
break;
case 2:
//look for header terminator
if ( (s = strchr(riga, '\"')) != NULL )
{
state++;
}
break;
break;
}
}
@ -150,7 +150,7 @@ int csmFileBuf::Load(int loadtype, long relocation_offfset)
//carica valore nel buffer
if (loadtype == ALL_TYPE)
{
if ( addr < FileBuf::GetBufSize() )
if (addr < FileBuf::GetBufSize())
{
FileBuf::GetBufPtr()[addr] = (uint8_t)value;
}
@ -159,12 +159,12 @@ int csmFileBuf::Load(int loadtype, long relocation_offfset)
{
long s = FileBuf::GetSplitted();
if ( s <= 0 )
if (s <= 0)
{
s = FileBuf::GetBufSize();
}
if ( addr < s )
if (addr < s)
{
FileBuf::GetBufPtr()[addr] = (uint8_t)value;
}
@ -173,12 +173,12 @@ int csmFileBuf::Load(int loadtype, long relocation_offfset)
{
long s = FileBuf::GetSplitted();
if ( s <= 0 )
if (s <= 0)
{
s = 0;
}
if ( addr < FileBuf::GetBufSize() - s )
if (addr < FileBuf::GetBufSize() - s)
{
FileBuf::GetBufPtr()[addr + s] = (uint8_t)value;
}
@ -203,18 +203,18 @@ int csmFileBuf::Load(int loadtype, long relocation_offfset)
}
static const char header[] =
"REFERENCE = =\n"
"CHASSIS = =\n"
"MODEL = =\n"
"SERIAL = =\n"
"CUSTOMER NAME = =\n"
"DATE = =\n"
"STREET = =\n"
"CITY = =\n"
"STATE = =\n"
"ZIP = =\n"
"PHONE NUMBER = =\n"
"CUSTOMER COMPLAINT = =";
"REFERENCE = =\n"
"CHASSIS = =\n"
"MODEL = =\n"
"SERIAL = =\n"
"CUSTOMER NAME = =\n"
"DATE = =\n"
"STREET = =\n"
"CITY = =\n"
"STATE = =\n"
"ZIP = =\n"
"PHONE NUMBER = =\n"
"CUSTOMER COMPLAINT = =";
//======================>>> csmFileBuf::Save <<<=======================
int csmFileBuf::Save(int savetype, long relocation_offfset)
@ -254,7 +254,7 @@ int csmFileBuf::Save(int savetype, long relocation_offfset)
{
QFile fh(FileBuf::GetFileName());
if (!fh.open(QIODevice::WriteOnly | QIODevice::Text ))
if (!fh.open(QIODevice::WriteOnly | QIODevice::Text))
{
rval = CREATEERROR;
}

View File

@ -39,7 +39,7 @@
class csmFileBuf : public FileBuf
{
public: //---------------------------------------- public
public: //---------------------------------------- public
csmFileBuf(e2AppWinInfo *wininfo = 0);
// virtual ~csmFileBuf();
@ -47,9 +47,9 @@ public: //---------------------------------------- public
virtual int Load(int loadtype = 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

View File

@ -34,13 +34,13 @@
//=====>>> Costruttore <<<======
Device::Device(e2AppWinInfo *wininfo, BusIO *busp, int b_size)
: detected_type(0),
awi(wininfo),
bus(busp),
def_bank_size(b_size),
write_progpage_size(0),
read_progpage_size(0),
write_datapage_size(0),
read_datapage_size(0)
awi(wininfo),
bus(busp),
def_bank_size(b_size),
write_progpage_size(0),
read_progpage_size(0),
write_datapage_size(0),
read_datapage_size(0)
{
detected_signature = "";
DefaultBankSize();
@ -178,7 +178,7 @@ int Device::ReadData()
retval = GetBus()->Read(1, GetBufPtr() + base, size, read_datapage_size);
if ( retval != size )
if (retval != size)
{
if (retval > 0)
{
@ -199,7 +199,7 @@ int Device::WriteProg()
GetBus()->ClearLastProgrammedAddress();
rv = GetBus()->Write(0, GetBufPtr() + base, size, write_progpage_size);
if ( rv != size )
if (rv != size)
{
if (rv > 0)
{
@ -219,7 +219,7 @@ int Device::WriteData()
rv = GetBus()->Write(1, GetBufPtr() + base, size, write_datapage_size);
if ( rv != size )
if (rv != size)
{
if (rv > 0)
{
@ -239,7 +239,7 @@ int Device::VerifyProg(unsigned char *localbuf)
//Verify only programmed bytes (to save time in big devices)
long v_len = size;
if ( GetBus()->GetLastProgrammedAddress() > 0 && GetBus()->GetLastProgrammedAddress() < size )
if (GetBus()->GetLastProgrammedAddress() > 0 && GetBus()->GetLastProgrammedAddress() < size)
{
v_len = GetBus()->GetLastProgrammedAddress() + 1;
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);
}
if ( rval != v_len )
if (rval != v_len)
{
if (rval > 0)
{
@ -282,7 +282,7 @@ int Device::VerifyData(unsigned char *localbuf)
//read current EEPROM content and
rval = GetBus()->Read(1, localbuf + base, size, read_datapage_size);
if ( rval != size )
if (rval != size)
{
if (rval > 0)
{

View File

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

View File

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

View File

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

View File

@ -39,9 +39,9 @@
//=====>>> Costruttore <<<======
mE2401::mE2401(e2AppWinInfo *wininfo, BusIO *busp, int def_banksize)
: Device(wininfo, busp, def_banksize),
timeout_loop(200),
sequential_read(1), // lettura di un banco alla volta
writepage_size(1) // scrittura di un byte alla volta (no page write)
timeout_loop(200),
sequential_read(1), // lettura di un banco alla volta
writepage_size(1) // scrittura di un byte alla volta (no page write)
{
}
@ -59,7 +59,7 @@ int mE2401::Probe(int probe_size)
{
retval = GetBus()->Error();
if ( retval == IICERR_NOADDRACK )
if (retval == IICERR_NOADDRACK)
{
retval = 0;
}
@ -103,7 +103,7 @@ int mE2401::Read(int probe, int type)
return GetBus()->Error();
}
if ( GetBus()->CheckAbort((k + 1) * 100 / size) )
if (GetBus()->CheckAbort((k + 1) * 100 / size))
{
return OP_ABORTED;
}
@ -135,7 +135,7 @@ int mE2401::Write(int probe, int type)
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();
}
@ -150,7 +150,7 @@ int mE2401::Write(int probe, int type)
return E2P_TIMEOUT;
}
if ( GetBus()->CheckAbort((j + 1) * 100 / size) )
if (GetBus()->CheckAbort((j + 1) * 100 / size))
{
return OP_ABORTED;
}
@ -199,7 +199,7 @@ int mE2401::Verify(int type)
break;
}
if ( GetBus()->CheckAbort((k + 1) * 100 / size) )
if (GetBus()->CheckAbort((k + 1) * 100 / size))
{
rval = OP_ABORTED;
break;
@ -207,7 +207,7 @@ int mE2401::Verify(int type)
}
}
if ( memcmp(GetBufPtr(), localbuf, size) != 0 )
if (memcmp(GetBufPtr(), localbuf, size) != 0)
{
rval = 0;
}

View File

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

View File

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

View File

@ -42,10 +42,10 @@
//=====>>> Costruttore <<<======
E24xx2::E24xx2(e2AppWinInfo *wininfo, BusIO *busp)
: E24xx(wininfo, busp),
SecurityReadCode(0xC0),
SecurityWriteCode(0x80),
HEnduranceReadCode(0x40),
HEnduranceWriteCode(0x00)
SecurityReadCode(0xC0),
SecurityWriteCode(0x80),
HEnduranceReadCode(0x40),
HEnduranceWriteCode(0x00)
{
writepage_size = E2Profile::GetI2CPageWrite();
E2Profile::SetI2CPageWrite(writepage_size);
@ -69,7 +69,7 @@ int E24xx2::Probe(int probe_size)
int E24xx2::Write(int probe, int type)
{
int error = Probe( probe || GetNoOfBank() == 0 );
int error = Probe(probe || GetNoOfBank() == 0);
if (error < 0)
{
@ -102,9 +102,9 @@ int E24xx2::Write(int probe, int type)
memcpy(localbuf + 2, GetBufPtr() + j, writepage_size);
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();
break;
@ -121,7 +121,7 @@ int E24xx2::Write(int probe, int type)
break;
}
if ( GetBus()->CheckAbort(j * 100 / size) )
if (GetBus()->CheckAbort(j * 100 / size))
{
rval = OP_ABORTED;
break;
@ -145,7 +145,7 @@ int E24xx2::Write(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)
{
@ -168,7 +168,7 @@ int E24xx2::Read(int probe, int type)
//Scrive l'indice del sottoindirizzamento
// partiamo sempre da 0.
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)
{
@ -182,7 +182,7 @@ int E24xx2::Read(int probe, int type)
break;
}
if ( GetBus()->CheckAbort(k * 100 / size) )
if (GetBus()->CheckAbort(k * 100 / size))
{
error = OP_ABORTED;
break;
@ -234,7 +234,7 @@ int E24xx2::Verify(int type)
//Scrive l'indice del sottoindirizzamento
// partiamo sempre da 0.
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)
{
@ -248,13 +248,13 @@ int E24xx2::Verify(int type)
break;
}
if ( memcmp(GetBufPtr() + k, localbuf, readpage_size) != 0 )
if (memcmp(GetBufPtr() + k, localbuf, readpage_size) != 0)
{
rval = 0;
break;
}
if ( GetBus()->CheckAbort(k * 100 / size) )
if (GetBus()->CheckAbort(k * 100 / size))
{
rval = OP_ABORTED;
break;
@ -288,14 +288,14 @@ int E24xx2::SecurityRead(uint32_t &blocks)
int val;
if ( (val = GetBus()->ReadByte(0)) < 0 )
if ((val = GetBus()->ReadByte(0)) < 0)
{
return GetBus()->Error();
}
blocks = (val << 4) & 0xF0;
if ( (val = GetBus()->ReadByte(1)) < 0 )
if ((val = GetBus()->ReadByte(1)) < 0)
{
return GetBus()->Error();
}
@ -363,7 +363,7 @@ int E24xx2::HighEnduranceRead(uint32_t &block_no)
int val;
if ( (val = GetBus()->ReadByte(1)) < 0 )
if ((val = GetBus()->ReadByte(1)) < 0)
{
return GetBus()->Error();
}

View File

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

View File

@ -34,7 +34,7 @@
class E24xx5 : public E24xx
{
public: //---------------------------------------- public
public: //---------------------------------------- public
E24xx5(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
virtual ~E24xx5();
@ -44,12 +44,12 @@ public: //---------------------------------------- public
virtual int Write(int probe = 1, 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_in(uint8_t *copy_buf, int bank_no, long size = -1);
private: //--------------------------------------- private
private: //--------------------------------------- private
};
#endif

View File

@ -42,11 +42,11 @@
//=====>>> Costruttore <<<======
E24xx::E24xx(e2AppWinInfo *wininfo, BusIO *busp, int max_no_of_bank, int def_banksize)
: Device(wininfo, busp, def_banksize),
max_bank(max_no_of_bank),
timeout_loop(200),
n_bank(0),
sequential_read(1), // lettura di un banco alla volta
writepage_size(1) // scrittura di un byte alla volta (no page write)
max_bank(max_no_of_bank),
timeout_loop(200),
n_bank(0),
sequential_read(1), // lettura di un banco alla volta
writepage_size(1) // scrittura di un byte alla volta (no page write)
{
// qDebug() << "E24xx" << THEAPP;
base_addr = E2Profile::GetI2CBaseAddr();
@ -82,7 +82,7 @@ int E24xx::Probe(int probe_size)
{
if (GetBus()->Read(addr, &ch, 1) != 1)
{
if ( (error = GetBus()->Error()) != IICERR_NOADDRACK )
if ((error = GetBus()->Error()) != IICERR_NOADDRACK)
{
// GetBus()->Open(E2Profile::GetPort());
return error;
@ -107,7 +107,7 @@ int E24xx::Probe(int probe_size)
int E24xx::Read(int probe, int type)
{
int error = Probe( probe || GetNoOfBank() == 0 );
int error = Probe(probe || GetNoOfBank() == 0);
if (error < 0)
{
@ -127,13 +127,13 @@ int E24xx::Read(int probe, int type)
// capacita` correntemente selezionata
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
return error;
}
if ( GetBus()->CheckAbort((k + 1) * 100 / n_bank) )
if (GetBus()->CheckAbort((k + 1) * 100 / n_bank))
{
return OP_ABORTED;
}
@ -154,7 +154,7 @@ int E24xx::Read(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)
{
@ -170,13 +170,13 @@ int E24xx::Write(int probe, int type)
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());
return error;
}
if ( GetBus()->CheckAbort((k + 1) * 100 / GetNoOfBank()) )
if (GetBus()->CheckAbort((k + 1) * 100 / GetNoOfBank()))
{
return OP_ABORTED;
}
@ -217,20 +217,20 @@ int E24xx::Verify(int type)
{
int error;
if ( (error = bank_in(localbuf, k)) )
if ((error = bank_in(localbuf, k)))
{
// GetBus()->Open(E2Profile::GetPort());
rval = error;
break;
}
if ( memcmp(GetBufPtr() + k * GetBankSize(), localbuf, GetBankSize()) != 0 )
if (memcmp(GetBufPtr() + k * GetBankSize(), localbuf, GetBankSize()) != 0)
{
rval = 0;
break;
}
if ( GetBus()->CheckAbort((k + 1) * 100 / GetNoOfBank()) )
if (GetBus()->CheckAbort((k + 1) * 100 / GetNoOfBank()))
{
rval = OP_ABORTED;
break;
@ -399,12 +399,12 @@ int E24xx::BankRollOverDetect(int force)
#else
int error;
if ( (error = bank_in(buf1, 0, CMP_LEN)) )
if ((error = bank_in(buf1, 0, CMP_LEN)))
{
return error;
}
if ( (error = bank_in(buf2, 1, CMP_LEN)) )
if ((error = bank_in(buf2, 1, CMP_LEN)))
{
return error;
}
@ -431,7 +431,7 @@ int E24xx::BankRollOverDetect(int force)
#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;
}

View File

@ -46,7 +46,7 @@ class e2AppWinInfo;
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);
virtual ~E24xx();
@ -60,7 +60,7 @@ public: //---------------------------------------- public
int const max_bank; // max number of banks (max eeprom size)
protected: //--------------------------------------- protected
protected: //--------------------------------------- protected
int const timeout_loop; //eeprom timeout
@ -82,7 +82,7 @@ protected: //--------------------------------------- protected
int sequential_read; //1 --> legge un banco in una volta
int writepage_size; //se > 1 scrive una pagina alla volta
private: //--------------------------------------- private
private: //--------------------------------------- private
};
#endif

View File

@ -121,7 +121,7 @@ void e2App::initSettings()
// str = "";
sp = getenv("HOME");
if (sp.length() > 0 )
if (sp.length() > 0)
{
str = sp + "/";
// strncpy(str, sp, MAXPATH - (strlen(APPNAME) + 5) );
@ -148,7 +148,7 @@ void e2App::initSettings()
helpfile = progName + ".html";
SetFileName(QString (progName + ".ini"));
SetFileName(QString(progName + ".ini"));
QString currentAppDir = qApp->applicationDirPath();
@ -177,9 +177,9 @@ void e2App::initSettings()
{
str = sp2;
E2Profile::SetLanguageCode( str.toLatin1() );
E2Profile::SetLanguageCode(str.toLatin1());
if (str == "default" )
if (str == "default")
{
sp2 = "";
}
@ -192,7 +192,7 @@ void e2App::initSettings()
sp2 = str;
}
setlocale(LC_ALL, sp2.toLatin1() );
setlocale(LC_ALL, sp2.toLatin1());
}
// Read parameters from INI file
@ -201,10 +201,10 @@ void e2App::initSettings()
// EK 2017
// TODO to remove the read/write because of QSettings?
SetInterfaceType( (HInterfaceType) E2Profile::GetParInterfType() );
SetPort( E2Profile::GetParPortNo() );
SetInterfaceType((HInterfaceType) E2Profile::GetParInterfType());
SetPort(E2Profile::GetParPortNo());
E2Profile::GetPowerUpDelay() ; // E2Profile::SetPowerUpDelay( E2Profile::GetPowerUpDelay() );
SetPolarity( E2Profile::GetPolarityControl() );
SetPolarity(E2Profile::GetPolarityControl());
E2Profile::GetSPIResetPulse();// E2Profile::SetSPIResetPulse( E2Profile::GetSPIResetPulse() );
E2Profile::GetSPIDelayAfterReset();// E2Profile::SetSPIDelayAfterReset( E2Profile::GetSPIDelayAfterReset() );
E2Profile::GetSPIPageWrite();// E2Profile::SetSPIPageWrite( E2Profile::GetSPIPageWrite() );
@ -277,8 +277,8 @@ int e2App::TestPort(int port, int open_only)
qDebug() << "e2App::TestPort(port=" << port << ", open_only=" << open_only << ")";
int rv = (open_only) ?
busIntp->TestOpen(port) :
busIntp->TestPort(port);
busIntp->TestOpen(port) :
busIntp->TestPort(port);
qDebug() << "e2App::TestPort() = " << rv;
@ -306,7 +306,7 @@ int e2App::OpenBus(BusIO *p)
qDebug() << "e2App::OpenBus() ** SetPower";
//Power up delay
iniBus->WaitMsec( E2Profile::GetPowerUpDelay() );
iniBus->WaitMsec(E2Profile::GetPowerUpDelay());
qDebug() << "e2App::OpenBus() ** Reset";
@ -333,8 +333,8 @@ void e2App::SleepBus()
// TODO to remove this to init function
#if 0
//=====================>>> e2App::NewAppWin <<<==========================
vWindow* e2App::NewAppWin(vWindow* win, char* name,
int w, int h, vAppWinInfo* winInfo)
vWindow *e2App::NewAppWin(vWindow *win, char *name,
int w, int h, vAppWinInfo *winInfo)
{
#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.
@ -350,7 +350,7 @@ vWindow* e2App::NewAppWin(vWindow* win, char* name,
DWORD size = sizeof wp.rcNormalPosition;
if (!RegQueryValueEx(key, "WinPos", NULL, NULL, (LPBYTE)&wp.rcNormalPosition, &size)
&& size == sizeof wp.rcNormalPosition)
&& size == sizeof wp.rcNormalPosition)
{
SetWindowPlacement(w, &wp);
}
@ -360,8 +360,8 @@ vWindow* e2App::NewAppWin(vWindow* win, char* name,
}
#endif
vWindow* thisWin = win; //local copy to use
vAppWinInfo* awinfo = winInfo;
vWindow *thisWin = win; //local copy to use
vAppWinInfo *awinfo = winInfo;
char *appname = name;
if (!*name)
@ -381,7 +381,7 @@ vWindow* e2App::NewAppWin(vWindow* win, char* name,
if (!awinfo)
{
awinfo = new e2AppWinInfo((vCmdWindow*)thisWin, name, busvetp);
awinfo = new e2AppWinInfo((vCmdWindow *)thisWin, name, busvetp);
}
return vApp::NewAppWin(thisWin, appname, w, h, awinfo);
@ -405,7 +405,7 @@ int e2App::Calibration()
#if 0
// EK 2017
//=====================>>> 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
@ -417,7 +417,7 @@ void e2App::AppCommand(vWindow* win, ItemVal id, ItemVal val, CmdType cType)
//=========================>>> e2App::KeyIn <<<==============================
// EK 2017 key event filter
#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
@ -430,78 +430,78 @@ void e2App::SetInterfaceType(HInterfaceType type)
{
switch (type)
{
//Interface initializers
case SIPROG_API:
iType = SIPROG_API;
busIntp = &siprog_apiI;
break;
//Interface initializers
case SIPROG_API:
iType = SIPROG_API;
busIntp = &siprog_apiI;
break;
case SIPROG_IO:
iType = SIPROG_IO;
busIntp = &siprog_ioI;
break;
case SIPROG_IO:
iType = SIPROG_IO;
busIntp = &siprog_ioI;
break;
case EASYI2C_API:
iType = EASYI2C_API;
busIntp = &easyi2c_apiI;
easyi2c_apiI.SetIOmode(false);
easyi2c_apiI.Close();
break;
case EASYI2C_API:
iType = EASYI2C_API;
busIntp = &easyi2c_apiI;
easyi2c_apiI.SetIOmode(false);
easyi2c_apiI.Close();
break;
case EASYI2C_IO:
iType = EASYI2C_IO;
busIntp = &easyi2c_ioI;
easyi2c_ioI.SetIOmode(true);
easyi2c_ioI.Close();
break;
case EASYI2C_IO:
iType = EASYI2C_IO;
busIntp = &easyi2c_ioI;
easyi2c_ioI.SetIOmode(true);
easyi2c_ioI.Close();
break;
case AVRISP:
iType = AVRISP;
busIntp = &avrisp_apiI;
avrisp_apiI.SetIOmode(false);
avrisp_apiI.Close();
break;
case AVRISP:
iType = AVRISP;
busIntp = &avrisp_apiI;
avrisp_apiI.SetIOmode(false);
avrisp_apiI.Close();
break;
case AVRISP_IO:
iType = AVRISP_IO;
busIntp = &avrisp_ioI;
avrisp_ioI.SetIOmode(true);
avrisp_ioI.Close();
break;
case AVRISP_IO:
iType = AVRISP_IO;
busIntp = &avrisp_ioI;
avrisp_ioI.SetIOmode(true);
avrisp_ioI.Close();
break;
case JDM_API:
iType = JDM_API;
busIntp = &jdm_apiI;
jdm_apiI.SetCmd2CmdDelay( E2Profile::GetJDMCmd2CmdDelay() );
break;
case JDM_API:
iType = JDM_API;
busIntp = &jdm_apiI;
jdm_apiI.SetCmd2CmdDelay(E2Profile::GetJDMCmd2CmdDelay());
break;
// case JDM_IO:
// iType = JDM_IO;
// busIntp = &jdm_ioI;
// break;
case DT006_API:
iType = DT006_API;
busIntp = &dt006_apiI;
dt006_apiI.SetIOmode(false);
dt006_apiI.Close();
break;
// case JDM_IO:
// iType = JDM_IO;
// busIntp = &jdm_ioI;
// break;
case DT006_API:
iType = DT006_API;
busIntp = &dt006_apiI;
dt006_apiI.SetIOmode(false);
dt006_apiI.Close();
break;
case DT006_IO:
iType = DT006_IO;
busIntp = &dt006_ioI;
dt006_ioI.SetIOmode(true);
dt006_ioI.Close();
break;
case DT006_IO:
iType = DT006_IO;
busIntp = &dt006_ioI;
dt006_ioI.SetIOmode(true);
dt006_ioI.Close();
break;
case LINUXSYSFS_IO:
iType = LINUXSYSFS_IO;
busIntp = &linuxsysfs_ioI;
break;
case LINUXSYSFS_IO:
iType = LINUXSYSFS_IO;
busIntp = &linuxsysfs_ioI;
break;
default:
iType = SIPROG_API; //20/07/99 -- to prevent crash
busIntp = &siprog_apiI;
break;
default:
iType = SIPROG_API; //20/07/99 -- to prevent crash
busIntp = &siprog_apiI;
break;
}
int k;
@ -566,7 +566,7 @@ void e2App::LookForBogoMips()
sum += ndel[k];
}
E2Profile::SetBogoMips( (int)(sum / (500 * N_SAMPLE)) );
E2Profile::SetBogoMips((int)(sum / (500 * N_SAMPLE)));
#endif
#ifdef _WINDOWS
@ -645,8 +645,8 @@ void e2App::LookForBogoMips()
{
int nv;
nv = (DWORD) ((float) GetBogoMips() * (MSLICE / (float)count) + 0.5);
SetBogoMips( nv );
nv = (DWORD)((float) GetBogoMips() * (MSLICE / (float)count) + 0.5);
SetBogoMips(nv);
w.SetBogoKips();
t0 = GetTickCount();
@ -666,8 +666,8 @@ void e2App::LookForBogoMips()
{
int nv;
nv = (DWORD) ((float) GetBogoMips() * 1.01 + 0.5);
SetBogoMips( nv );
nv = (DWORD)((float) GetBogoMips() * 1.01 + 0.5);
SetBogoMips(nv);
w.SetBogoKips();
t0 = GetTickCount();

View File

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

View File

@ -41,7 +41,7 @@
//======================>>> e2AppWinInfo::e2AppWinInfo <<<=======================
e2AppWinInfo::e2AppWinInfo(e2CmdWindow *p, const QString &name, BusIO** busvptr) :
e2AppWinInfo::e2AppWinInfo(e2CmdWindow *p, const QString &name, BusIO **busvptr) :
hex_per_line(16),
buffer_size(BUFFER_SIZE),
load_type(ALL_TYPE),
@ -174,7 +174,7 @@ e2AppWinInfo::e2AppWinInfo(e2CmdWindow *p, const QString &name, BusIO** busvptr)
if (!E2Profile::GetSkipStartupDialog())
{
if ( !cmdWin->scriptMode )
if (!cmdWin->scriptMode)
{
cmdWin->About();
}
@ -184,7 +184,7 @@ e2AppWinInfo::e2AppWinInfo(e2CmdWindow *p, const QString &name, BusIO** busvptr)
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)
@ -205,9 +205,9 @@ e2AppWinInfo::e2AppWinInfo(e2CmdWindow *p, const QString &name, BusIO** busvptr)
if (err == E2ERR_ACCESSDENIED)
{
#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
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
}
@ -293,53 +293,53 @@ void e2AppWinInfo::SetEEProm(unsigned long id)
// int eep_type = type;
// int eep_subtype = subtype; //0 indica di usare GetNoOfBlock()
switch(eep_type)
switch (eep_type)
{
//AutoTag
//Setting the device pointer to selected type
case E24XX:
eep = eep24xx;
break;
//AutoTag
//Setting the device pointer to selected type
case E24XX:
eep = eep24xx;
break;
case E24XX1_A:
eep = eep24xx1;
case E24XX1_A:
eep = eep24xx1;
if (eep_subtype == 0)
{
//no autodetect: set a reasonable default
eep_subtype = GetE2PSubType(E2401_A);
}
if (eep_subtype == 0)
{
//no autodetect: set a reasonable default
eep_subtype = GetE2PSubType(E2401_A);
}
break;
break;
case E24XX1_B:
eep = eep2401;
case E24XX1_B:
eep = eep2401;
if (eep_subtype == 0)
{
//no autodetect: set a reasonable default
eep_subtype = GetE2PSubType(E2401_B);
}
if (eep_subtype == 0)
{
//no autodetect: set a reasonable default
eep_subtype = GetE2PSubType(E2401_B);
}
break;
break;
case E24XX2:
eep = eep24xx2;
case E24XX2:
eep = eep24xx2;
if (eep_subtype == 0)
{
//no autodetect: set a reasonable default
eep_subtype = GetE2PSubType(E2432);
}
if (eep_subtype == 0)
{
//no autodetect: set a reasonable default
eep_subtype = GetE2PSubType(E2432);
}
eep->DefaultBankSize();
break;
eep->DefaultBankSize();
break;
case E24XX5:
eep = eep24xx5;
break;
case E24XX5:
eep = eep24xx5;
break;
case AT90SXX:
case AT90SXX:
{
eep = eepAt90s;
@ -352,12 +352,12 @@ void e2AppWinInfo::SetEEProm(unsigned long id)
long xtype = GetEEPId();
eep->SetProgPageSize(GetEEPTypeWPageSize(xtype), false);
At90sBus *b = (At90sBus *)eep->GetBus();
b->SetFlashPagePolling( (xtype != ATmega603) && (xtype != ATmega103) );
b->SetOld1200Mode( (xtype == AT90S1200) );
b->SetFlashPagePolling((xtype != ATmega603) && (xtype != ATmega103));
b->SetOld1200Mode((xtype == AT90S1200));
break;
}
case AT89SXX:
case AT89SXX:
{
eep = eepAt89s;
@ -378,165 +378,165 @@ void e2AppWinInfo::SetEEProm(unsigned long id)
}
At89sBus *b = (At89sBus *)eep->GetBus();
b->SetCompatibilityMode( (xtype == AT89S8252 || xtype == AT89S53) );
b->SetFallingPhase( (xtype == AT89S8253) && E2Profile::Get8253FallEdge() );
b->SetPagePolling( true, (xtype == AT89S8253 || xtype == AT89S51 || xtype == AT89S52) );
b->SetPagePolling( false, (xtype == AT89S8253) );
b->SetCompatibilityMode((xtype == AT89S8252 || xtype == AT89S53));
b->SetFallingPhase((xtype == AT89S8253) && E2Profile::Get8253FallEdge());
b->SetPagePolling(true, (xtype == AT89S8253 || xtype == AT89S51 || xtype == AT89S52));
b->SetPagePolling(false, (xtype == AT89S8253));
break;
}
case E93X6:
eep = eep93xx16;
case E93X6:
eep = eep93xx16;
if (eep_subtype == 0)
{
//no autodetect: set a reasonable default
eep_subtype = GetE2PSubType(E9306);
}
if (eep_subtype == 0)
{
//no autodetect: set a reasonable default
eep_subtype = GetE2PSubType(E9306);
}
break;
break;
case E93XX_8:
eep = eep93xx8;
case E93XX_8:
eep = eep93xx8;
if (eep_subtype == 0)
{
//no autodetect: set a reasonable default
eep_subtype = GetE2PSubType(E9306_8);
}
if (eep_subtype == 0)
{
//no autodetect: set a reasonable default
eep_subtype = GetE2PSubType(E9306_8);
}
break;
break;
case PIC16XX:
eep = eepPic16;
case PIC16XX:
eep = eepPic16;
if (eep_subtype == 0)
{
//no autodetect: set a reasonable default
eep_subtype = GetE2PSubType(PIC1684);
}
if (eep_subtype == 0)
{
//no autodetect: set a reasonable default
eep_subtype = GetE2PSubType(PIC1684);
}
break;
break;
case PIC168XX:
eep = eepPic168xx;
// if (eep_subtype == 0)
// {
// eep_subtype = GetE2PSubType(PIC1684A);
// }
break;
case PIC168XX:
eep = eepPic168xx;
// if (eep_subtype == 0)
// {
// eep_subtype = GetE2PSubType(PIC1684A);
// }
break;
case PIC125XX:
eep = eepPic125xx;
case PIC125XX:
eep = eepPic125xx;
if (eep_subtype == 0)
{
//no autodetect: set a reasonable default
eep_subtype = GetE2PSubType(PIC12508);
}
if (eep_subtype == 0)
{
//no autodetect: set a reasonable default
eep_subtype = GetE2PSubType(PIC12508);
}
break;
break;
case E250XX:
eep = eep250xx;
case E250XX:
eep = eep250xx;
if (eep_subtype == 0)
{
//no autodetect: set a reasonable default
eep_subtype = GetE2PSubType(E25010);
}
if (eep_subtype == 0)
{
//no autodetect: set a reasonable default
eep_subtype = GetE2PSubType(E25010);
}
break;
break;
case E25XXX:
eep = eep25xxx;
case E25XXX:
eep = eep25xxx;
if (eep_subtype == 0)
{
//no autodetect: set a reasonable default
eep_subtype = GetE2PSubType(E25080);
}
if (eep_subtype == 0)
{
//no autodetect: set a reasonable default
eep_subtype = GetE2PSubType(E25080);
}
//eep->SetBus(GetBusVectorPtr()[AT250BIG-1]);
break;
//eep->SetBus(GetBusVectorPtr()[AT250BIG-1]);
break;
case E2506XX:
eep = eep2506;
case E2506XX:
eep = eep2506;
if (eep_subtype == 0)
{
//no autodetect: set a reasonable default
eep_subtype = GetE2PSubType(E2506);
}
if (eep_subtype == 0)
{
//no autodetect: set a reasonable default
eep_subtype = GetE2PSubType(E2506);
}
break;
break;
case ENVMXXX:
eep = eep3060;
case ENVMXXX:
eep = eep3060;
if (eep_subtype == 0)
{
//no autodetect: set a reasonable default
eep_subtype = GetE2PSubType(ENVM3060);
}
if (eep_subtype == 0)
{
//no autodetect: set a reasonable default
eep_subtype = GetE2PSubType(ENVM3060);
}
break;
break;
case AT17XXX:
eep = eep17xxx;
case AT17XXX:
eep = eep17xxx;
if (eep_subtype == 0)
{
//no autodetect: set a reasonable default
eep_subtype = GetE2PSubType(AT1765);
}
if (eep_subtype == 0)
{
//no autodetect: set a reasonable default
eep_subtype = GetE2PSubType(AT1765);
}
break;
break;
case X24C44XX:
if (eep_subtype == 0)
{
//no autodetect: set a reasonable default
eep_subtype = GetE2PSubType(S24H30);
}
case X24C44XX:
if (eep_subtype == 0)
{
//no autodetect: set a reasonable default
eep_subtype = GetE2PSubType(S24H30);
}
if (GetEEPId() == S24H30)
{
eep = eep2430;
}
else
{
eep = eep2444;
}
if (GetEEPId() == S24H30)
{
eep = eep2430;
}
else
{
eep = eep2444;
}
break;
break;
default:
eep = eep24xx; //20/07/99 -- to prevent crash
break;
default:
eep = eep24xx; //20/07/99 -- to prevent crash
break;
}
fuse_ok = false; //invalidate current fuse settings
SetSplittedInfo( GetEEPTypeSplit(id) );
SetSplittedInfo(GetEEPTypeSplit(id));
//Imposta la nuova dimensione della memoria in
// base al tipo di eeprom.
SetNoOfBlock( GetEEPTypeSize(id) );
SetNoOfBlock(GetEEPTypeSize(id));
//Imposta la dimensione del banco che dipende
// dal tipo di eeprom.
SetBlockSize( eep->GetBankSize() );
SetBlockSize(eep->GetBankSize());
}
//======================>>> e2AppWinInfo::Read <<<=======================
int e2AppWinInfo::Read(int type, int raise_power, int leave_on)
{
int probe = !GetE2PSubType( eep_id);
int probe = !GetE2PSubType(eep_id);
int rval = OK;
qDebug() << "e2AppWinInfo::Read(" << type << "," << raise_power << "," << leave_on << ") - IN";
if ( E2Profile::GetClearBufBeforeRead() )
if (E2Profile::GetClearBufBeforeRead())
{
if (load_type == ALL_TYPE)
{
@ -567,7 +567,7 @@ int e2AppWinInfo::Read(int type, int raise_power, int leave_on)
{
// CheckEvents();
if ( (rval = eep->Read(probe, type)) > 0 )
if ((rval = eep->Read(probe, type)) > 0)
{
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,
// affinche` la dimensione rimanga quella impostata bisogna correggere la dimensione
// del banco.
SetBlockSize( eep->GetBankSize() );
SetBlockSize(eep->GetBankSize());
}
RecalcCRC();
if ( !(rval > 0 && leave_on) )
if (!(rval > 0 && leave_on))
{
SleepBus();
}
@ -607,19 +607,19 @@ int e2AppWinInfo::Write(int type, int raise_power, int leave_on)
rval = OpenBus();
}
if ( rval == OK )
if (rval == OK)
{
// 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,
// affinche` la dimensione rimanga quella impostata bisogna correggere la dimensione
// 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();
}
@ -646,7 +646,7 @@ int e2AppWinInfo::Verify(int type, int raise_power, int leave_on)
{
rval = eep->Verify(type);
if ( !(rval >= 0 && leave_on) )
if (!(rval >= 0 && leave_on))
{
SleepBus();
}
@ -673,7 +673,7 @@ int e2AppWinInfo::Erase(int type, int raise_power, int leave_on)
{
rval = eep->Erase(1, type);
if ( !(rval >= 0 && leave_on) )
if (!(rval >= 0 && leave_on))
{
SleepBus();
}
@ -687,7 +687,7 @@ int e2AppWinInfo::Erase(int type, int raise_power, int leave_on)
//===================>>> e2AppWinInfo::BankRollOverDetect <<<=============
int e2AppWinInfo::BankRollOverDetect(int force)
{
if ( OpenBus() == OK )
if (OpenBus() == OK)
{
roll_over = eep->BankRollOverDetect(force);
}
@ -705,33 +705,33 @@ int e2AppWinInfo::Load()
SetFileBuf(E2P);
rval = LoadFile();
if ( rval <= 0 )
if (rval <= 0)
{
SetFileBuf(MOTOS);
rval = LoadFile();
if ( rval <= 0 )
if (rval <= 0)
{
SetFileBuf(INTEL);
rval = LoadFile();
}
if ( rval <= 0 )
if (rval <= 0)
{
SetFileBuf(CSM);
rval = LoadFile();
}
if ( rval <= 0 )
if (rval <= 0)
{
SetFileBuf(BIN);
rval = LoadFile();
}
if ( rval > 0 )
if (rval > 0)
{
if ( GetE2PPriType(GetEEPId()) == PIC16XX ||
GetE2PPriType(GetEEPId()) == PIC168XX )
if (GetE2PPriType(GetEEPId()) == PIC16XX ||
GetE2PPriType(GetEEPId()) == PIC168XX)
{
//It seems a bit tricky...
//Relocate the DATA and CONFIG memory with PIC devices
@ -742,7 +742,7 @@ int e2AppWinInfo::Load()
if (GetSplittedInfo() > 0 && GetSize() > GetSplittedInfo())
{
//Copy Config memory
if ( GetSize() + 16 <= GetBufSize() )
if (GetSize() + 16 <= GetBufSize())
{
memcpy(GetBufPtr() + GetSize(), GetBufPtr() + (0x2000 * 2), 16);
}
@ -766,10 +766,10 @@ int e2AppWinInfo::Load()
SetLockBits(config);
}
}
else if ( GetE2PPriType(GetEEPId()) == PIC125XX )
else if (GetE2PPriType(GetEEPId()) == PIC125XX)
{
//Copy Config memory
if ( GetSize() + 16 <= GetBufSize() )
if (GetSize() + 16 <= GetBufSize())
{
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
uint8_t *ptr = GetBufPtr() + GetSize() + 14;
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
memcpy( localbuf, GetBufPtr(), GetBufSize() );
memset( localbuf + GetSize(), 0xFF, GetBufSize() - GetSize() );
memcpy(localbuf, GetBufPtr(), GetBufSize());
memset(localbuf + GetSize(), 0xFF, GetBufSize() - GetSize());
/**
** NON va qui!!! Va messo in IntelFileBuf::Save(int savetype)
** e MotorolaFileBus::Save
**/
if (save_type == ALL_TYPE &&
(GetFileBuf() == INTEL || GetFileBuf() == MOTOS) )
(GetFileBuf() == INTEL || GetFileBuf() == MOTOS))
{
if ( GetE2PPriType(GetEEPId()) == PIC16XX ||
GetE2PPriType(GetEEPId()) == PIC168XX )
if (GetE2PPriType(GetEEPId()) == PIC16XX ||
GetE2PPriType(GetEEPId()) == PIC168XX)
{
//It seems a bit tricky...
//Relocate the DATA and CONFIG memory with PIC devices
@ -854,19 +854,19 @@ int e2AppWinInfo::Save()
//CONFIG at 0x2000 (word address).
//We move them after PROGRAM memory
// PROGRAM MEMORY + DATA MEMORY + CONFIG (8 word)
if (GetSplittedInfo() > 0 && GetSize() > GetSplittedInfo() )
if (GetSplittedInfo() > 0 && GetSize() > GetSplittedInfo())
{
//Set ALL overbound buffer to 0xFF
memset(GetBufPtr(), 0xFF, GetBufSize());
//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();
if ( GetEEPId() == PIC1683 ||
GetEEPId() == PIC1684 ||
GetEEPId() == PIC1684A )
if (GetEEPId() == PIC1683 ||
GetEEPId() == PIC1684 ||
GetEEPId() == PIC1684A)
{
if (config & (1 << 4))
{
@ -886,13 +886,13 @@ int e2AppWinInfo::Save()
}
//Copy prog memory
if ( GetSplittedInfo() <= GetBufSize() )
if (GetSplittedInfo() <= GetBufSize())
{
memcpy( GetBufPtr(), localbuf, GetSplittedInfo() );
memcpy(GetBufPtr(), localbuf, GetSplittedInfo());
}
//Copy data memory
if ( 0x2100 * 2 + (GetSize() - GetSplittedInfo()) <= GetBufSize() )
if (0x2100 * 2 + (GetSize() - GetSplittedInfo()) <= GetBufSize())
{
//copy only low byte every word
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
memset(GetBufPtr(), 0xFF, GetBufSize());
//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
if ( 0xFFF * 2 + 2 <= GetBufSize() )
if (0xFFF * 2 + 2 <= GetBufSize())
{
uint16_t config = (uint16_t)GetLockBits();
@ -955,7 +955,7 @@ long e2AppWinInfo::GetLoadRelocation() const
//===================>>> e2AppWinInfo::SetLoadRelocation <<<====================
void e2AppWinInfo::SetLoadRelocation(long val)
{
if ( val >= 0 && val < GetBufSize() )
if (val >= 0 && val < GetBufSize())
{
load_relocation = val;
}
@ -970,7 +970,7 @@ long e2AppWinInfo::GetSaveRelocation() const
//===================>>> e2AppWinInfo::SetSaveRelocation <<<====================
void e2AppWinInfo::SetSaveRelocation(long val)
{
if ( val >= 0 && val < GetBufSize() )
if (val >= 0 && val < GetBufSize())
{
save_relocation = val;
}
@ -1207,16 +1207,16 @@ void e2AppWinInfo::DoubleSize()
if (k)
{
//Non copiarlo su se stesso!
memcpy( buffer + k * 2 * GetBlockSize(),
buffer + k * GetBlockSize(),
GetBlockSize()
);
memcpy(buffer + k * 2 * GetBlockSize(),
buffer + k * GetBlockSize(),
GetBlockSize()
);
}
memcpy( buffer + (k * 2 + 1) * GetBlockSize(),
buffer + k * GetBlockSize(),
GetBlockSize()
);
memcpy(buffer + (k * 2 + 1) * GetBlockSize(),
buffer + k * GetBlockSize(),
GetBlockSize()
);
}
RecalcCRC();
@ -1405,56 +1405,56 @@ QString e2AppWinInfo::Dump(int line, int type)
tmpbuf[hex_per_line] = 0;
linebuf.sprintf(" %06lX) %02X %02X %02X %02X %02X %02X %02X %02X - %02X %02X %02X %02X %02X %02X %02X %02X %s\n",
// snprintf(linebuf, LINEBUF_SIZE, " %06lX) %02X %02X %02X %02X %02X %02X %02X %02X - %02X %02X %02X %02X %02X %02X %02X %02X %s\n",
idx,
buffer[idx + 0],
buffer[idx + 1],
buffer[idx + 2],
buffer[idx + 3],
buffer[idx + 4],
buffer[idx + 5],
buffer[idx + 6],
buffer[idx + 7],
// snprintf(linebuf, LINEBUF_SIZE, " %06lX) %02X %02X %02X %02X %02X %02X %02X %02X - %02X %02X %02X %02X %02X %02X %02X %02X %s\n",
idx,
buffer[idx + 0],
buffer[idx + 1],
buffer[idx + 2],
buffer[idx + 3],
buffer[idx + 4],
buffer[idx + 5],
buffer[idx + 6],
buffer[idx + 7],
buffer[idx + 8],
buffer[idx + 9],
buffer[idx + 10],
buffer[idx + 11],
buffer[idx + 12],
buffer[idx + 13],
buffer[idx + 14],
buffer[idx + 15],
buffer[idx + 8],
buffer[idx + 9],
buffer[idx + 10],
buffer[idx + 11],
buffer[idx + 12],
buffer[idx + 13],
buffer[idx + 14],
buffer[idx + 15],
tmpbuf
);
tmpbuf
);
}
else if (type == 1)
{
linebuf.sprintf( " %06lX)", idx);
linebuf.sprintf(" %06lX)", idx);
// snprintf(linebuf, LINEBUF_SIZE, " %06lX)", idx);
}
else if (type == 2)
{
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 ",
buffer[idx + 0],
buffer[idx + 1],
buffer[idx + 2],
buffer[idx + 3],
buffer[idx + 4],
buffer[idx + 5],
buffer[idx + 6],
buffer[idx + 7],
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 ",
buffer[idx + 0],
buffer[idx + 1],
buffer[idx + 2],
buffer[idx + 3],
buffer[idx + 4],
buffer[idx + 5],
buffer[idx + 6],
buffer[idx + 7],
buffer[idx + 8],
buffer[idx + 9],
buffer[idx + 10],
buffer[idx + 11],
buffer[idx + 12],
buffer[idx + 13],
buffer[idx + 14],
buffer[idx + 15]
);
buffer[idx + 8],
buffer[idx + 9],
buffer[idx + 10],
buffer[idx + 11],
buffer[idx + 12],
buffer[idx + 13],
buffer[idx + 14],
buffer[idx + 15]
);
}
else
{

View File

@ -96,9 +96,9 @@ class e2CmdWindow;
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();
int Read(int type = ALL_TYPE, int raise_power = true, int leave_on = false);
@ -163,7 +163,7 @@ public: //---------------------------------------- public
}
int GetEEPSubType() const
{
return eep_subtype ? eep_subtype : GetE2PSubType( GetEEPTypeFromSize(eep_type, GetNoOfBlock()) );
return eep_subtype ? eep_subtype : GetE2PSubType(GetEEPTypeFromSize(eep_type, GetNoOfBlock()));
} //GetNoOfBlock(); }
int GetEEPType() const
@ -285,10 +285,10 @@ public: //---------------------------------------- public
return eep ? eep->GetDetectedSignatureStr() : 0;
}
protected: //--------------------------------------- protected
protected: //--------------------------------------- protected
// e2CmdWindow* cmdWin;
private: //--------------------------------------- private
private: //--------------------------------------- private
int OpenBus();
void SleepBus();
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
public: //---------------------------------------- public
public: //---------------------------------------- public
e2CmdWindow(QWidget *parent = 0);
virtual ~e2CmdWindow();
// virtual int CloseAppWin();
@ -161,7 +161,7 @@ public: //---------------------------------------- public
}
private slots:
private slots:
void onNew();
void onOpen(); //
void onSave(); //
@ -215,34 +215,34 @@ private slots:
void onDevSubType(int i);
// EK 2017: slots for signals from group actions
void onSelectI2C8(QAction* a);
void onSelectI2C16(QAction* a);
void onSelectI2CAT17(QAction* a);
void onSelectMW16(QAction* a);
void onSelectMW8(QAction* a);
void onSelectSPI(QAction* a);
void onSelectAVR(QAction* a);
void onSelectAT89S(QAction* a);
void onSelectPIC16(QAction* a);
void onSelectPIC12(QAction* a);
void onSelectImBus(QAction* a);
void onSelectSDE2506(QAction* a);
void onSelectX244(QAction* a);
void onSelectI2C8(QAction *a);
void onSelectI2C16(QAction *a);
void onSelectI2CAT17(QAction *a);
void onSelectMW16(QAction *a);
void onSelectMW8(QAction *a);
void onSelectSPI(QAction *a);
void onSelectAVR(QAction *a);
void onSelectAT89S(QAction *a);
void onSelectPIC16(QAction *a);
void onSelectPIC12(QAction *a);
void onSelectImBus(QAction *a);
void onSelectSDE2506(QAction *a);
void onSelectX244(QAction *a);
void onEndProgress();
void selectFontSize(QAction* mnu);
void selectFontSize(QAction *mnu);
// void setOverwriteMode(bool);
// void dataChanged();
public:
public:
int CmdHelp();
protected:
protected:
//void CmdRemoteMode();
private:
private:
//All commands
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);
@ -293,14 +293,14 @@ private:
int findItemInMenuVector(const QString &n);
private: //--------------------------------------- private
private: //--------------------------------------- private
void createSignalSlotConnections();
QString convertFilterListToString(const QStringList &lst);
void doProgress(const QString &text);
menuToGroup* searchMenuInDeviceVector( int new_type );
menuToGroup *searchMenuInDeviceVector(int new_type);
void createDeviceMenues();
void addI2C8Struct();;
@ -350,7 +350,7 @@ private: //--------------------------------------- private
int ScriptError(int line_number, int arg_index, char *arg, const QString msg = "");
private:
private:
int idxI2Cbus8;
int idxI2Cbus16;
int idxI2CbusAT17;
@ -374,8 +374,8 @@ private:
QStringList arguments;
QString programStyleSheet;
QComboBox* cbxEEPType;
QComboBox* cbxEEPSubType;
QComboBox *cbxEEPType;
QComboBox *cbxEEPSubType;
QLabel *lblEEPInfo;
QLabel *lblStringID;
@ -383,13 +383,13 @@ private:
QLineEdit *txtStringID;
// QProgressBar *statusProgress;
QVector<QAction*> actLangSelect;
QVector<QAction*> actFSizeSelect;
QVector<QAction *> actLangSelect;
QVector<QAction *> actFSizeSelect;
QActionGroup *fsizeGroup;
// Standard elements
QHexEdit* e2HexEdit; // For the canvas
QHexEdit *e2HexEdit; // For the canvas
QProgressDialog *e2Prg;

View File

@ -45,7 +45,7 @@ using namespace Translator;
//=========================>>> e2Dialog::e2Dialog <<<====================
e2Dialog::e2Dialog(QWidget* bw, const QString title)
e2Dialog::e2Dialog(QWidget *bw, const QString title)
: QDialog(bw),
lpt_no(2),
com_no(3)
@ -68,10 +68,10 @@ e2Dialog::e2Dialog(QWidget* bw, const QString title)
connect(rdbComPort, 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 (cbxInterfLPT, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectLPT(int)));
connect(cbxInterfCOM, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectCOM(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(pushCancel, SIGNAL(clicked()), this, SLOT(reject()));
@ -117,7 +117,7 @@ void e2Dialog::onSelectNum(int i)
void e2Dialog::onChangePort(bool b)
{
QRadioButton *s = static_cast<QRadioButton*>(sender());
QRadioButton *s = static_cast<QRadioButton *>(sender());
// bool state = s->isChecked();
disconnect(rdbComPort, SIGNAL(toggled(bool)), this, SLOT(onChangePort(bool)));
@ -128,10 +128,10 @@ void e2Dialog::onChangePort(bool b)
cbxInterfCOM->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->addItems(usbList);
connect (cbxInterfNum, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectNum(int)));
connect(cbxInterfNum, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectNum(int)));
cbxInterfNum->setCurrentIndex(com_no);
}
@ -140,10 +140,10 @@ void e2Dialog::onChangePort(bool b)
cbxInterfCOM->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->addItems(lptList);
connect (cbxInterfNum, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectNum(int)));
connect(cbxInterfNum, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectNum(int)));
cbxInterfNum->setCurrentIndex(lpt_no);
}
@ -183,7 +183,7 @@ void e2Dialog::getSettings()
}
else
{
cbxInterfLPT->setCurrentIndex(interf_type - 3 );
cbxInterfLPT->setCurrentIndex(interf_type - 3);
cbxInterfCOM->setCurrentIndex(0);
lpt_no = port_no;
@ -275,21 +275,21 @@ void e2Dialog::setWidgetsText()
//Serial interfaces list
QStringList interfListC;
interfListC <<
"SI Prog API" <<
"SI Prog I/O" <<
" JDM API ";
"SI Prog API" <<
"SI Prog I/O" <<
" JDM API ";
cbxInterfCOM->addItems(interfListC);
//Parallel interfaces list
QStringList interfListL;
interfListL <<
"Avr ISP API" <<
"Avr ISP I/O" <<
"DT-006 API " <<
"DT-006 I/O " <<
"EasyI2C API" <<
"EasyI2C I/O" <<
"SysFs GPIO ";
"Avr ISP API" <<
"Avr ISP I/O" <<
"DT-006 API " <<
"DT-006 I/O " <<
"EasyI2C API" <<
"EasyI2C I/O" <<
"SysFs GPIO ";
cbxInterfLPT->addItems(interfListL);
rdbComPort->setText(STR_LBLSERIAL);
@ -323,7 +323,7 @@ void e2Dialog::onTest()
{
int test = Test();
if ( test )
if (test)
{
QMessageBox::critical(this, "Failed", STR_MSGTEST + " " + STR_MSGFAILED);
}

View File

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

View File

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

View File

@ -35,7 +35,7 @@
class e2pFileBuf : public FileBuf
{
public: //---------------------------------------- public
public: //---------------------------------------- public
e2pFileBuf(e2AppWinInfo *wininfo = 0);
virtual ~e2pFileBuf();
@ -43,9 +43,9 @@ public: //---------------------------------------- public
virtual int Load(int loadtype = 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();
};
#endif

View File

@ -40,7 +40,7 @@
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)
{
// QString str;
s->setValue ("BogoMipsX1000", QString::number(value));
s->setValue("BogoMipsX1000", QString::number(value));
// if ( decnum2str(value, str, MAXNUMDIGIT) == OK )
// {
// return s->setValue("BogoMipsX1000", str);
@ -163,7 +163,7 @@ int E2Profile::GetParPortNo()
bool ok;
rval = sp.toInt(&ok);
if (ok == false )
if (ok == false)
{
rval = -1;
}
@ -380,19 +380,19 @@ void E2Profile::SetPolarityControl(uint8_t polarity_control)
if (rval == OK)
s->setValue("ResetPolarity",
(polarity_control & RESETINV) ? "INV" : "TRUE");
(polarity_control & RESETINV) ? "INV" : "TRUE");
if (rval == OK)
s->setValue("ClockPolarity",
(polarity_control & CLOCKINV) ? "INV" : "TRUE");
(polarity_control & CLOCKINV) ? "INV" : "TRUE");
if (rval == OK)
s->setValue("DOutPolarity",
(polarity_control & DOUTINV) ? "INV" : "TRUE");
(polarity_control & DOUTINV) ? "INV" : "TRUE");
if (rval == OK)
s->setValue("DInPolarity",
(polarity_control & DININV) ? "INV" : "TRUE");
(polarity_control & DININV) ? "INV" : "TRUE");
}
@ -478,23 +478,23 @@ int E2Profile::GetI2CSpeed()
if (sp.length())
{
if ( sp == "TURBO")
if (sp == "TURBO")
{
rval = TURBO;
}
else if ( sp == "FAST")
else if (sp == "FAST")
{
rval = FAST;
}
else if ( sp == "SLOW")
else if (sp == "SLOW")
{
rval = SLOW;
}
else if ( sp == "VERYSLOW")
else if (sp == "VERYSLOW")
{
rval = VERYSLOW;
}
else if ( sp == "ULTRASLOW")
else if (sp == "ULTRASLOW")
{
rval = ULTRASLOW;
}
@ -632,23 +632,23 @@ int E2Profile::GetSPISpeed()
if (sp.length())
{
if ( sp == "TURBO")
if (sp == "TURBO")
{
rval = TURBO;
}
else if ( sp == "FAST")
else if (sp == "FAST")
{
rval = FAST;
}
else if ( sp == "SLOW")
else if (sp == "SLOW")
{
rval = SLOW;
}
else if ( sp == "VERYSLOW")
else if (sp == "VERYSLOW")
{
rval = VERYSLOW;
}
else if ( sp == "ULTRASLOW")
else if (sp == "ULTRASLOW")
{
rval = ULTRASLOW;
}
@ -717,23 +717,23 @@ int E2Profile::GetMicroWireSpeed()
if (sp.length())
{
if ( sp == "TURBO")
if (sp == "TURBO")
{
rval = TURBO;
}
else if ( sp == "FAST")
else if (sp == "FAST")
{
rval = FAST;
}
else if ( sp == "SLOW")
else if (sp == "SLOW")
{
rval = SLOW;
}
else if ( sp == "VERYSLOW")
else if (sp == "VERYSLOW")
{
rval = VERYSLOW;
}
else if ( sp == "ULTRASLOW")
else if (sp == "ULTRASLOW")
{
rval = ULTRASLOW;
}
@ -779,23 +779,23 @@ int E2Profile::GetPICSpeed()
if (sp.length())
{
if ( sp == "TURBO")
if (sp == "TURBO")
{
rval = TURBO;
}
else if ( sp == "FAST")
else if (sp == "FAST")
{
rval = FAST;
}
else if ( sp == "SLOW")
else if (sp == "SLOW")
{
rval = SLOW;
}
else if ( sp == "VERYSLOW")
else if (sp == "VERYSLOW")
{
rval = VERYSLOW;
}
else if ( sp == "ULTRASLOW")
else if (sp == "ULTRASLOW")
{
rval = ULTRASLOW;
}
@ -841,23 +841,23 @@ int E2Profile::GetSDESpeed()
if (sp.length())
{
if ( sp == "TURBO")
if (sp == "TURBO")
{
rval = TURBO;
}
else if ( sp == "FAST")
else if (sp == "FAST")
{
rval = FAST;
}
else if ( sp == "SLOW")
else if (sp == "SLOW")
{
rval = SLOW;
}
else if ( sp == "VERYSLOW")
else if (sp == "VERYSLOW")
{
rval = VERYSLOW;
}
else if ( sp == "ULTRASLOW")
else if (sp == "ULTRASLOW")
{
rval = ULTRASLOW;
}
@ -903,23 +903,23 @@ int E2Profile::GetIMBusSpeed()
if (sp.length())
{
if ( sp == "TURBO")
if (sp == "TURBO")
{
rval = TURBO;
}
else if ( sp == "FAST")
else if (sp == "FAST")
{
rval = FAST;
}
else if ( sp == "SLOW")
else if (sp == "SLOW")
{
rval = SLOW;
}
else if ( sp == "VERYSLOW")
else if (sp == "VERYSLOW")
{
rval = VERYSLOW;
}
else if ( sp == "ULTRASLOW")
else if (sp == "ULTRASLOW")
{
rval = ULTRASLOW;
}
@ -1121,17 +1121,17 @@ int E2Profile::GetSerialNumAddress(long &start, int &size, bool &mtype)
size = 1;
mtype = false;
if ( (sp = s->value("SerialNumberAddr", "0").toString()).length() )
if ((sp = s->value("SerialNumberAddr", "0").toString()).length())
{
start = sp.toLong();
}
if ( (sp = s->value("SerialNumberSize", "1").toString()).length() )
if ((sp = s->value("SerialNumberSize", "1").toString()).length())
{
size = sp.toInt();
}
if ( (sp = s->value("SerialNumberType", "PROG").toString()).length() )
if ((sp = s->value("SerialNumberType", "PROG").toString()).length())
{
if (sp == "DATA")
{
@ -1163,7 +1163,7 @@ FmtEndian E2Profile::GetSerialNumFormat()
{
QString sp = s->value("SerialNumberFormat", "BIGENDIAN").toString();
if ( sp.length() && ("LITTLEENDIAN" == sp))
if (sp.length() && ("LITTLEENDIAN" == sp))
{
return FMT_LITTLE_ENDIAN;
}
@ -1308,25 +1308,25 @@ long E2Profile::GetProgramOptions()
void E2Profile::SetProgramOptions(long prog_option)
{
s->setValue("ReloadOption",
(prog_option & RELOAD_YES) ? "YES" : "NO");
(prog_option & RELOAD_YES) ? "YES" : "NO");
s->setValue("ReadFlashOption",
(prog_option & READFLASH_YES) ? "YES" : "NO");
(prog_option & READFLASH_YES) ? "YES" : "NO");
s->setValue("ReadEEpromOption",
(prog_option & READEEP_YES) ? "YES" : "NO");
(prog_option & READEEP_YES) ? "YES" : "NO");
s->setValue("ByteSwapOption",
(prog_option & BYTESWAP_YES) ? "YES" : "NO");
(prog_option & BYTESWAP_YES) ? "YES" : "NO");
s->setValue("SetIDkeyOption",
(prog_option & SETID_YES) ? "YES" : "NO");
(prog_option & SETID_YES) ? "YES" : "NO");
s->setValue("ReadOscCalibration",
(prog_option & READOSCAL_YES) ? "YES" : "NO");
(prog_option & READOSCAL_YES) ? "YES" : "NO");
s->setValue("EraseOption",
(prog_option & ERASE_YES) ? "YES" : "NO");
(prog_option & ERASE_YES) ? "YES" : "NO");
s->setValue("WriteFlashOption",
(prog_option & FLASH_YES) ? "YES" : "NO");
(prog_option & FLASH_YES) ? "YES" : "NO");
s->setValue("WriteEEpromOption",
(prog_option & EEPROM_YES) ? "YES" : "NO");
(prog_option & EEPROM_YES) ? "YES" : "NO");
s->setValue("WriteSecurityOption",
(prog_option & LOCK_YES) ? "YES" : "NO");
(prog_option & LOCK_YES) ? "YES" : "NO");
}
@ -1653,17 +1653,17 @@ int E2Profile::GetCalibrationAddress(long &start, int &size, bool &mtype)
size = 1;
mtype = false;
if ( (sp = s->value("OscCalibrationAddr", "0").toString()).length() )
if ((sp = s->value("OscCalibrationAddr", "0").toString()).length())
{
start = sp.toLong();
}
if ( (sp = s->value("OscCalibrationSize", "1").toString()).length() )
if ((sp = s->value("OscCalibrationSize", "1").toString()).length())
{
size = sp.toInt();
}
if ( (sp = s->value("OscCalibrationMemType", "PROG").toString()).length() )
if ((sp = s->value("OscCalibrationMemType", "PROG").toString()).length())
{
if (sp == "DATA")
{
@ -1809,12 +1809,12 @@ void E2Profile::SetCOMAddress(int com1, int com2, int com3, int com4)
}
else
{
str.sprintf( "%X,%X", com1, com2);
str.sprintf("%X,%X", com1, com2);
}
}
else
{
str.sprintf( "%X", com1);
str.sprintf("%X", com1);
}
s->setValue("COMPorts", str);
@ -1873,23 +1873,23 @@ FileType E2Profile::GetDefaultFileType()
if (sp.length())
{
if ( sp == "e2p" )
if (sp == "e2p")
{
ft = E2P;
}
else if ( sp == "bin" )
else if (sp == "bin")
{
ft = BIN;
}
else if ( sp == "csm" )
else if (sp == "csm")
{
ft = CSM;
}
else if ( sp == "intel-hex")
else if (sp == "intel-hex")
{
ft = INTEL;
}
else if ( sp == "mot-srec")
else if (sp == "mot-srec")
{
ft = MOTOS;
}

View File

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

View File

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

View File

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

View File

@ -90,85 +90,85 @@ chipInfo GetChipInfo(QVector<chipInfo> &c, long subtype)
// it's smart pointer to vector
static QVector<chipInfo> const GetMap(int pritype)
{
switch(pritype)
switch (pritype)
{
//AutoTag
//Returns vector
case E24XX:
return eep24xx_map;
break;
//AutoTag
//Returns vector
case E24XX:
return eep24xx_map;
break;
case E24XX1_A:
return eep24xx1A_map;
break;
case E24XX1_A:
return eep24xx1A_map;
break;
case E24XX1_B:
return eep24xx1B_map;
break;
case E24XX1_B:
return eep24xx1B_map;
break;
case E24XX2:
return eep24xx2_map;
break;
case E24XX2:
return eep24xx2_map;
break;
case E24XX5:
return eep24xx5_map;
break;
case E24XX5:
return eep24xx5_map;
break;
case AT90SXX:
return eepAt90s_map;
break;
case AT90SXX:
return eepAt90s_map;
break;
case AT89SXX:
return eepAt89s_map;
break;
case AT89SXX:
return eepAt89s_map;
break;
case E93X6:
return eep93x6_map;
break;
case E93X6:
return eep93x6_map;
break;
case E93XX_8:
return eep93xx8_map;
break;
case E93XX_8:
return eep93xx8_map;
break;
case PIC16XX:
return eepPic16_map;
break;
case PIC16XX:
return eepPic16_map;
break;
case PIC168XX:
return eepPic168xx_map;
break;
case PIC168XX:
return eepPic168xx_map;
break;
case PIC125XX:
return eepPic125_map;
break;
case PIC125XX:
return eepPic125_map;
break;
case E250XX:
return eep250xx_map;
break;
case E250XX:
return eep250xx_map;
break;
case E25XXX:
return eep25xxx_map;
break;
case E25XXX:
return eep25xxx_map;
break;
case E2506XX:
return eep2506_map;
break;
case E2506XX:
return eep2506_map;
break;
case ENVMXXX:
return eepnvm3060_map;
break;
case ENVMXXX:
return eepnvm3060_map;
break;
case AT17XXX:
return eep17xxx_map;
break;
case AT17XXX:
return eep17xxx_map;
break;
case X24C44XX:
return eep2444_map;
break;
case X24C44XX:
return eep2444_map;
break;
default:
return QVector<chipInfo>();
break;
default:
return QVector<chipInfo>();
break;
}
}
@ -392,7 +392,7 @@ QString GetEEPTypeString(int pritype, int subtype)
{
qDebug() << "mp" << mp.count();
foreach(chipInfo i, mp)
foreach (chipInfo i, mp)
{
if ((i.id & 0x07fff) == subtype)
{
@ -414,7 +414,7 @@ QString GetEEPTypeString(unsigned long type)
if (mp.count())
{
foreach(chipInfo i, mp)
foreach (chipInfo i, mp)
{
if ((i.id & 0x07fff) == subtype)
{

View File

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

View File

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

View File

@ -42,7 +42,7 @@ using namespace Translator;
class e2CmdWindow;
//=========================>>> 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)
{
setupUi(this);

View File

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

View File

@ -38,7 +38,7 @@ using namespace Translator;
//======================>>> 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)
{
setupUi(this);
@ -61,17 +61,17 @@ fuseModalDialog::fuseModalDialog(e2CmdWindow* bw, e2AppWinInfo *p, bool readonly
qDebug() << "fuseModalDialog::fuseModalDialog()";
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_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
);
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_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
);
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_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
);
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_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
);
read = write = false;
@ -97,7 +97,7 @@ void fuseModalDialog::setTextWidgets()
{
int i = 0;
foreach(QCheckBox* c, chkFuse)
foreach (QCheckBox *c, chkFuse)
{
c->setText(QString().sprintf(" %d", i));
i++;
@ -110,7 +110,7 @@ void fuseModalDialog::setTextWidgets()
i = 0;
foreach(QCheckBox* c, chkLock)
foreach (QCheckBox *c, chkLock)
{
c->setText(QString().sprintf(" %d", i));
i++;
@ -151,7 +151,7 @@ void fuseModalDialog::onOk()
if (read == true)
{
emit done (2);
emit done(2);
}
else
{
@ -208,38 +208,38 @@ void fuseModalDialog::initWidgets(const QString &msg, long int type, bool readon
{
FuseBit fBit = eep_fusebits.at(j);
frmLock0->setHidden( fBit.lockenable3 == 0);
frmLock1->setHidden( fBit.lockenable2 == 0);
frmLock2->setHidden( fBit.lockenable1 == 0);
frmLock3->setHidden( fBit.lockenable0 == 0);
frmLock0->setHidden(fBit.lockenable3 == 0);
frmLock1->setHidden(fBit.lockenable2 == 0);
frmLock2->setHidden(fBit.lockenable1 == 0);
frmLock3->setHidden(fBit.lockenable0 == 0);
frmFuses0->setHidden( fBit.fuseenable3 == 0);
frmFuses1->setHidden( fBit.fuseenable2 == 0);
frmFuses2->setHidden( fBit.fuseenable1 == 0);
frmFuses3->setHidden( fBit.fuseenable0 == 0);
frmFuses0->setHidden(fBit.fuseenable3 == 0);
frmFuses1->setHidden(fBit.fuseenable2 == 0);
frmFuses2->setHidden(fBit.fuseenable1 == 0);
frmFuses3->setHidden(fBit.fuseenable0 == 0);
if ( fBit.lockenable3 == 0 &&
fBit.lockenable2 == 0 &&
fBit.lockenable1 == 0 &&
fBit.lockenable0 == 0 )
if (fBit.lockenable3 == 0 &&
fBit.lockenable2 == 0 &&
fBit.lockenable1 == 0 &&
fBit.lockenable0 == 0)
{
frmLock->setHidden( true);
frmLock->setHidden(true);
}
else
{
frmLock->setHidden( false);
frmLock->setHidden(false);
}
if ( fBit.fuseenable3 == 0 &&
fBit.fuseenable2 == 0 &&
fBit.fuseenable1 == 0 &&
fBit.fuseenable0 == 0 )
if (fBit.fuseenable3 == 0 &&
fBit.fuseenable2 == 0 &&
fBit.fuseenable1 == 0 &&
fBit.fuseenable0 == 0)
{
frmFuses->setHidden(true);
}
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++)
{
QString sp;
QString def = QString().sprintf( " %d", k);
QString def = QString().sprintf(" %d", k);
sp = fBit.locklabel3[k];
@ -342,7 +342,7 @@ void fuseModalDialog::initWidgets(const QString &msg, long int type, bool readon
//Default (disable all)
for (int k = 0; k < LOCKPACKSIZE; k++)
{
QString def = QString().sprintf( " %d", k);
QString def = QString().sprintf(" %d", k);
//Label
chkLock.at(0 * 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(e2CmdWindow* bw, e2AppWinInfo *p, bool readonly, const QString &msg) :
blockDialog::blockDialog(e2CmdWindow *bw, e2AppWinInfo *p, bool readonly, const QString &msg) :
QDialog(bw)
{
setupUi(this);
@ -426,13 +426,13 @@ blockDialog::blockDialog(e2CmdWindow* bw, e2AppWinInfo *p, bool readonly, const
lblTo->setText(STR_MSGNUMBLOCK);
lblVal->setText(STR_MSGHIGHENDBLK);
QString str1 = QString().sprintf( "%d", (int)((lock >> 4) & 0x0F) );
QString str2 = QString().sprintf( "%d", (int)(lock & 0x0F) );
QString str3 = QString().sprintf( "%d", (int)(fuse & 0x0F) );
QString str1 = QString().sprintf("%d", (int)((lock >> 4) & 0x0F));
QString str2 = QString().sprintf("%d", (int)(lock & 0x0F));
QString str3 = QString().sprintf("%d", (int)(fuse & 0x0F));
txiFrom->setText(str1);
txiTo->setText( str2);
txiVal->setText( str3);
txiTo->setText(str2);
txiVal->setText(str3);
pushOk->setText(STR_BTNOK);
pushCancel->setText(STR_BTNCANC);

View File

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

View File

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

View File

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

View File

@ -105,31 +105,31 @@ void IMBus::SetDelay()
int val = E2Profile::GetIMBusSpeed();
int n;
switch(val)
switch (val)
{
case TURBO:
n = 1; // as fast as your PC can
break;
case TURBO:
n = 1; // as fast as your PC can
break;
case FAST:
n = 3;
break;
case FAST:
n = 3;
break;
case SLOW:
n = 18;
break;
case SLOW:
n = 18;
break;
case VERYSLOW:
n = 80;
break;
case VERYSLOW:
n = 80;
break;
case ULTRASLOW:
n = 500;
break;
case ULTRASLOW:
n = 500;
break;
default:
n = 5; //Default (< 100KHz)
break;
default:
n = 5; //Default (< 100KHz)
break;
}
BusIO::SetDelay(n);
@ -216,7 +216,7 @@ int IMBus::RecDataWord(int wlen)
setDI();
for (k = 0; k < wlen; k++)
if ( RecDataBit() )
if (RecDataBit())
{
val |= 1 << k;
}
@ -236,7 +236,7 @@ int IMBus::WaitReadyAfterWrite(int addr, int delay, long timeout)
{
uint8_t val = 0xff;
while ( (val & (1 << 1)) && timeout-- )
while ((val & (1 << 1)) && timeout--)
{
//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);
IdentPulse();
if ( (len % 4) == 0 )
if ( CheckAbort(len * 100 / length) )
if ((len % 4) == 0)
if (CheckAbort(len * 100 / length))
{
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);
IdentPulse();
if ( WaitReadyAfterWrite(addr, ProgDelay) != OK )
if (WaitReadyAfterWrite(addr, ProgDelay) != OK)
{
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);
IdentPulse();
if ( WaitReadyAfterWrite(addr, ProgDelay) != OK )
if (WaitReadyAfterWrite(addr, ProgDelay) != OK)
{
return E2P_TIMEOUT;
}
@ -371,7 +371,7 @@ long IMBus::Write(int addr, uint8_t const *data, long length, int page_size)
return E2ERR_WRITEFAILED;
}
if ( CheckAbort(len * 100 / length) )
if (CheckAbort(len * 100 / length))
{
break;
}

View File

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

View File

@ -45,7 +45,7 @@ class e2CmdWindow;
//======================>>> 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)
{
setupUi(this);
@ -110,7 +110,7 @@ void e24xx_infoModalDialog::onOk()
//======================>>> 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)
{
setupUi(this);
@ -130,15 +130,15 @@ other_infoModalDialog::other_infoModalDialog(QWidget* bw, long fsize, long esize
lblTo->setText(STR_MSGEEPSIZE); // size label
lblVal->setText(STR_MSGFLASHSIZE); // flash size label
str = QString().sprintf( "%04Xh", crc);
str = QString().sprintf("%04Xh", crc);
txiFrom->setText(str);
txiFrom->setReadOnly(true);
str = QString().sprintf( "%ld Byte", fsize);
str = QString().sprintf("%ld Byte", fsize);
txiTo->setText(str);
txiTo->setReadOnly(true);
str = QString().sprintf( "%ld Byte", esize);
str = QString().sprintf("%ld Byte", esize);
txiVal->setText(str);
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)
{
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)
{
setupUi(this);
@ -290,7 +290,7 @@ void editModalDialog::onEdit()
int newval;
bool ok;
QLineEdit *l = static_cast<QLineEdit*>(sender());
QLineEdit *l = static_cast<QLineEdit *>(sender());
disconnect(txiFrom, SIGNAL(changed()), this, SLOT(onEdit())); // hex
disconnect(txiTo, SIGNAL(changed()), this, SLOT(onEdit())); // dec
disconnect(txiVal, SIGNAL(changed()), this, SLOT(onEdit())); // char
@ -373,7 +373,7 @@ void editModalDialog::onEdit()
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)
{
setupUi(this);

View File

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

View File

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

View File

@ -37,7 +37,7 @@
class IntelFileBuf : public FileBuf
{
public: //---------------------------------------- public
public: //---------------------------------------- public
IntelFileBuf(e2AppWinInfo *wininfo = 0);
virtual ~IntelFileBuf();
@ -45,9 +45,9 @@ public: //---------------------------------------- public
virtual int Load(int loadtype = 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 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 ( InDataPort(port_no) < 0 )
if (InDataPort(port_no) < 0)
{
ret_val = E2ERR_OPENFAILED;
}
@ -395,12 +395,12 @@ int AvrISPInterface::TestPort(int port)
OutDataMask(WF_TEST1, 1);
w.WaitMsec(50);
if ( (InDataPort() & RF_TEST1) )
if ((InDataPort() & RF_TEST1))
{
OutDataMask(WF_TEST1, 0);
w.WaitMsec(50);
if ( !(InDataPort() & RF_TEST1) )
if (!(InDataPort() & RF_TEST1))
{
test1 = true;
}
@ -411,20 +411,20 @@ int AvrISPInterface::TestPort(int port)
OutDataMask(WF_TEST2, 0);
w.WaitMsec(50);
if ( (InDataPort() & RF_TEST2) )
if ((InDataPort() & RF_TEST2))
{
OutDataMask(WF_TEST2, 1);
w.WaitMsec(50);
if ( !(InDataPort() & RF_TEST2) )
if (!(InDataPort() & RF_TEST2))
{
test2 = true;
}
}
ret_val = ( test1 || test2 ) ?
OK :
E2ERR_OPENFAILED;
ret_val = (test1 || test2) ?
OK :
E2ERR_OPENFAILED;
}
TestRestore();

View File

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

View File

@ -34,7 +34,7 @@
class JdmInterface : public SIProgInterface
{
public: //------------------------------- public
public: //------------------------------- public
// virtual int Open(int com_no);
// virtual void Close();
@ -44,9 +44,9 @@ public: //------------------------------- public
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;
}
@ -176,7 +176,7 @@ static int gpio_close(unsigned int gpio, int fd)
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;
}
else
@ -312,7 +312,7 @@ void LinuxSysFsInterface::SetDataOut(int sda)
if (IsInstalled())
{
if ( (E2Profile::GetPolarityControl() & DOUTINV) )
if ((E2Profile::GetPolarityControl() & DOUTINV))
{
sda = !sda;
}
@ -345,7 +345,7 @@ void LinuxSysFsInterface::SetClock(int scl)
if (IsInstalled())
{
if ( (E2Profile::GetPolarityControl() & CLOCKINV) )
if ((E2Profile::GetPolarityControl() & CLOCKINV))
{
scl = !scl;
}

View File

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

View File

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

View File

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

View File

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

View File

@ -81,8 +81,8 @@ LPTInterface::LPTInterface()
lpt_control.LPPort = 1; //by default use LPT1
hLPTCONVxD = CreateFile("\\\\.\\LPTCON.VXD", 0, 0, NULL, 0,
FILE_FLAG_DELETE_ON_CLOSE | FILE_FLAG_OVERLAPPED,
NULL);
FILE_FLAG_DELETE_ON_CLOSE | FILE_FLAG_OVERLAPPED,
NULL);
#else
lpt_control.LPPort = 0; //no used port
@ -139,7 +139,7 @@ void LPTInterface::SetPort(int 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;
@ -158,7 +158,7 @@ void LPTInterface::SetPort(int port_no)
if (hLpt != INVALID_HANDLE_VALUE)
{
if ( ioctl(hLpt, PPCLAIM, 0) )
if (ioctl(hLpt, PPCLAIM, 0))
{
close(hLpt);
hLpt = INVALID_HANDLE_VALUE;
@ -185,18 +185,18 @@ int LPTInterface::InDataPort(int port_no)
int ret_val = E2ERR_NOTINSTALLED;
#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;
}
uint8_t value;
if ( !DeviceIoControl(hLPTCONVxD, LPTCON_READ,
&lpt_control, sizeof(LPTCONDATA),
&value, sizeof(value), NULL, 0) )
if (!DeviceIoControl(hLPTCONVxD, LPTCON_READ,
&lpt_control, sizeof(LPTCONDATA),
&value, sizeof(value), NULL, 0))
{
ret_val = E2ERR_OPENFAILED;
}
@ -208,8 +208,8 @@ int LPTInterface::InDataPort(int port_no)
#else
if ( port_no >= 1 && port_no <= MAX_LPTPORTS
&& port_no != lpt_control.LPPort )
if (port_no >= 1 && port_no <= MAX_LPTPORTS
&& port_no != lpt_control.LPPort)
{
lpt_control.LPPort = port_no;
@ -226,7 +226,7 @@ int LPTInterface::InDataPort(int port_no)
if (hLpt != INVALID_HANDLE_VALUE)
{
if ( ioctl(hLpt, PPCLAIM, 0) )
if (ioctl(hLpt, PPCLAIM, 0))
{
close(hLpt);
hLpt = INVALID_HANDLE_VALUE;
@ -236,9 +236,9 @@ int LPTInterface::InDataPort(int port_no)
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;
}
@ -272,9 +272,9 @@ int LPTInterface::OutDataPort(int val, int port_no)
#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;
}
@ -282,14 +282,14 @@ int LPTInterface::OutDataPort(int val, int port_no)
lpt_control.LPByte = last_data = (uint8_t)val;
ret_val = DeviceIoControl(hLPTCONVxD, LPTCON_WRITE_DATA,
&lpt_control, sizeof(LPTCONDATA),
NULL, 0, NULL, 0) ? OK : E2ERR_NOTINSTALLED;
&lpt_control, sizeof(LPTCONDATA),
NULL, 0, NULL, 0) ? OK : E2ERR_NOTINSTALLED;
}
#else
if ( port_no >= 1 && port_no <= MAX_LPTPORTS
&& port_no != lpt_control.LPPort )
if (port_no >= 1 && port_no <= MAX_LPTPORTS
&& port_no != lpt_control.LPPort)
{
lpt_control.LPPort = port_no;
@ -306,7 +306,7 @@ int LPTInterface::OutDataPort(int val, int port_no)
if (hLpt != INVALID_HANDLE_VALUE)
{
if ( ioctl(hLpt, PPCLAIM, 0) )
if (ioctl(hLpt, PPCLAIM, 0))
{
close(hLpt);
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;
if ( ioctl(hLpt, PPWDATA, &lpt_control.LPByte) )
if (ioctl(hLpt, PPWDATA, &lpt_control.LPByte))
{
ret_val = E2ERR_ACCESSDENIED;
}
@ -354,9 +354,9 @@ int LPTInterface::OutControlPort(int val, int port_no)
#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;
}
@ -364,14 +364,14 @@ int LPTInterface::OutControlPort(int val, int port_no)
lpt_control.LPByte = last_ctrl = (uint8_t)val & 0x0F;
ret_val = DeviceIoControl(hLPTCONVxD, LPTCON_WRITE_CONTROL,
&lpt_control, sizeof(LPTCONDATA),
NULL, 0, NULL, 0) ? OK : E2ERR_NOTINSTALLED;
&lpt_control, sizeof(LPTCONDATA),
NULL, 0, NULL, 0) ? OK : E2ERR_NOTINSTALLED;
}
#else
if ( port_no >= 1 && port_no <= MAX_LPTPORTS
&& port_no != lpt_control.LPPort )
if (port_no >= 1 && port_no <= MAX_LPTPORTS
&& port_no != lpt_control.LPPort)
{
lpt_control.LPPort = port_no;
@ -388,7 +388,7 @@ int LPTInterface::OutControlPort(int val, int port_no)
if (hLpt != INVALID_HANDLE_VALUE)
{
if ( ioctl(hLpt, PPCLAIM, 0) )
if (ioctl(hLpt, PPCLAIM, 0))
{
close(hLpt);
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;
if ( ioctl(hLpt, PPWCONTROL, &lpt_control.LPByte) )
if (ioctl(hLpt, PPWCONTROL, &lpt_control.LPByte))
{
ret_val = E2ERR_ACCESSDENIED;
}
@ -422,9 +422,9 @@ int LPTInterface::OutDataMask(int mask, int val)
#ifdef _WINDOWS
if ( hLPTCONVxD != INVALID_HANDLE_VALUE )
if (hLPTCONVxD != INVALID_HANDLE_VALUE)
#else
if ( hLpt != INVALID_HANDLE_VALUE )
if (hLpt != INVALID_HANDLE_VALUE)
#endif
{
if (val == 0)
@ -459,9 +459,9 @@ int LPTInterface::OutControlMask(int mask, int val)
#ifdef _WINDOWS
if ( hLPTCONVxD != INVALID_HANDLE_VALUE )
if (hLPTCONVxD != INVALID_HANDLE_VALUE)
#else
if ( hLpt != INVALID_HANDLE_VALUE )
if (hLpt != INVALID_HANDLE_VALUE)
#endif
{
if (val == 0)

View File

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

View File

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

View File

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

View File

@ -83,7 +83,7 @@ int MotorolaSFileBuf::WriteRecord(QTextStream &outs, uint8_t *bptr, long curaddr
for (j = 0; j < recsize; j++)
{
if ( bptr[curaddr + j] != 0xFF )
if (bptr[curaddr + j] != 0xFF)
{
discard = 0;
break;
@ -100,51 +100,51 @@ int MotorolaSFileBuf::WriteRecord(QTextStream &outs, uint8_t *bptr, long curaddr
return rval;
}
switch(fmt)
switch (fmt)
{
case START_RECORD: //starting record (optional)
len = recsize + 2 + 1; //2 byte address + 1 byte checksum
break;
case START_RECORD: //starting record (optional)
len = recsize + 2 + 1; //2 byte address + 1 byte checksum
break;
case DATA_RECORD16: //16 bit address data record
len = recsize + 2 + 1; //2 byte address + 1 byte checksum
break;
case DATA_RECORD16: //16 bit address data record
len = recsize + 2 + 1; //2 byte address + 1 byte checksum
break;
case DATA_RECORD24: //24 bit address data record
len = recsize + 3 + 1; //3 byte address + 1 byte checksum
break;
case DATA_RECORD24: //24 bit address data record
len = recsize + 3 + 1; //3 byte address + 1 byte checksum
break;
case DATA_RECORD32: //32 bit address data record
len = recsize + 4 + 1; //4 byte address + 1 byte checksum
break;
case DATA_RECORD32: //32 bit address data record
len = recsize + 4 + 1; //4 byte address + 1 byte checksum
break;
case SYMBOL_RECORD: //symbol record (LSI extension)
len = recsize + 2 + 1; //2 byte address + 1 byte checksum
break;
case SYMBOL_RECORD: //symbol record (LSI extension)
len = recsize + 2 + 1; //2 byte address + 1 byte checksum
break;
case NBLOCK_RECORD: //number of data records in preceeding block
len = recsize + 2 + 1; //2 byte address + 1 byte checksum
break;
case NBLOCK_RECORD: //number of data records in preceeding block
len = recsize + 2 + 1; //2 byte address + 1 byte checksum
break;
case UNUSED_RECORD: //unused
len = recsize + 2 + 1; //2 byte address + 1 byte checksum
break;
case UNUSED_RECORD: //unused
len = recsize + 2 + 1; //2 byte address + 1 byte checksum
break;
case END_RECORD32: //ending record for S3 records
len = recsize + 4 + 1; //4 byte address + 1 byte checksum
break;
case END_RECORD32: //ending record for S3 records
len = recsize + 4 + 1; //4 byte address + 1 byte checksum
break;
case END_RECORD24: //ending record for S2 records
len = recsize + 3 + 1; //3 byte address + 1 byte checksum
break;
case END_RECORD24: //ending record for S2 records
len = recsize + 3 + 1; //3 byte address + 1 byte checksum
break;
case END_RECORD16: //ending record for S1 records
len = recsize + 2 + 1; //2 byte address + 1 byte checksum
break;
case END_RECORD16: //ending record for S1 records
len = recsize + 2 + 1; //2 byte address + 1 byte checksum
break;
default:
rval = 0;
break;
default:
rval = 0;
break;
}
if (rval)
@ -215,7 +215,7 @@ int MotorolaSFileBuf::Save(int savetype, long relocation_offset)
uint8_t *ptr = FileBuf::GetBufPtr();
//Remove FF's tail
while ( ptr[size - 1] == 0xFF )
while (ptr[size - 1] == 0xFF)
{
size--;
}
@ -255,7 +255,7 @@ int MotorolaSFileBuf::Save(int savetype, long relocation_offset)
while (curaddr < size)
{
int recsize = min( (size - curaddr), 16 );
int recsize = min((size - curaddr), 16);
rectype = DATA_RECORD16;
@ -269,7 +269,7 @@ int MotorolaSFileBuf::Save(int savetype, long relocation_offset)
rectype = DATA_RECORD32;
}
if ( !WriteRecord(out, ptr, curaddr, recsize, rectype) )
if (!WriteRecord(out, ptr, curaddr, recsize, rectype))
{
rval = WRITEERROR;
break;
@ -316,7 +316,7 @@ int MotorolaSFileBuf::Load(int loadtype, long relocation_offset)
if (loadtype == DATA_TYPE)
{
if ( GetSplitted() >= 0 && GetSplitted() < GetBufSize() )
if (GetSplitted() >= 0 && GetSplitted() < GetBufSize())
{
dp += GetSplitted();
}
@ -356,7 +356,7 @@ int MotorolaSFileBuf::Load(int loadtype, long relocation_offset)
{
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)
{
@ -371,7 +371,7 @@ int MotorolaSFileBuf::Load(int loadtype, long relocation_offset)
if (nocopy_mode)
{
if ( (highestAddr - lowestAddr) > GetBufSize() )
if ((highestAddr - lowestAddr) > GetBufSize())
{
rval = BUFFEROVERFLOW;
}
@ -390,11 +390,11 @@ int MotorolaSFileBuf::Load(int loadtype, long relocation_offset)
riga[MAXLINE] = '\0';
while ( !fh.atEnd())
while (!fh.atEnd())
{
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;
}
@ -440,10 +440,10 @@ int MotorolaSFileBuf::ParseRecord(char *lbufPC, uint8_t *buf_startP, uint8_t *bu
{
long addrL;
uint8_t cksmB, // checksum of addr, count, & data length
*bufPC = 0; // Pointer into memory array
*bufPC = 0; // Pointer into memory array
int i, countN, // Number of bytes represented in record
oheadN = 0, // Number of overhead (addr + chksum) bytes
tvalN; // Temp for check checksum
oheadN = 0, // Number of overhead (addr + chksum) bytes
tvalN; // Temp for check checksum
int unknow_rec = 0;
if (lbufPC[0] == '\n' || lbufPC[0] == '\r')
@ -456,55 +456,55 @@ int MotorolaSFileBuf::ParseRecord(char *lbufPC, uint8_t *buf_startP, uint8_t *bu
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 */
if( sscanf(lbufPC, "S1%2X%4lX", &countN, &addrL ) != 2 )
{
return BADFILETYPE; /* Flag error in S1 record */
}
case DATA_RECORD16: /* 16 bit address field */
if (sscanf(lbufPC, "S1%2X%4lX", &countN, &addrL) != 2)
{
return BADFILETYPE; /* Flag error in S1 record */
}
oheadN = 2 + 1; /* 2 address + 1 checksum */
break;
oheadN = 2 + 1; /* 2 address + 1 checksum */
break;
case DATA_RECORD24: /* 24 bit address field */
if( sscanf(lbufPC, "S2%2X%6lX", &countN, &addrL ) != 2 )
{
return BADFILETYPE; /* Flag error in S2 record */
}
case DATA_RECORD24: /* 24 bit address field */
if (sscanf(lbufPC, "S2%2X%6lX", &countN, &addrL) != 2)
{
return BADFILETYPE; /* Flag error in S2 record */
}
oheadN = 3 + 1; /* 3 address + 1 checksum */
break;
oheadN = 3 + 1; /* 3 address + 1 checksum */
break;
case DATA_RECORD32: /* 32 bit address field */
if( sscanf(lbufPC, "S3%2X%8lX", &countN, &addrL ) != 2 )
{
return BADFILETYPE; /* Flag error in S3 record */
}
case DATA_RECORD32: /* 32 bit address field */
if (sscanf(lbufPC, "S3%2X%8lX", &countN, &addrL) != 2)
{
return BADFILETYPE; /* Flag error in S3 record */
}
oheadN = 4 + 1; /* 4 address + 1 checksum */
break;
oheadN = 4 + 1; /* 4 address + 1 checksum */
break;
/* ignore all but S1,2,3 records. */
case START_RECORD: //starting record (optional)
case SYMBOL_RECORD: //symbol record (LSI extension)
case NBLOCK_RECORD: //number of data records in preceeding block
case UNUSED_RECORD: //unused
case END_RECORD32: //ending record for S3 records
case END_RECORD24: //ending record for S2 records
case END_RECORD16: //ending record for S1 records
/* ignore all but S1,2,3 records. */
case START_RECORD: //starting record (optional)
case SYMBOL_RECORD: //symbol record (LSI extension)
case NBLOCK_RECORD: //number of data records in preceeding block
case UNUSED_RECORD: //unused
case END_RECORD32: //ending record for S3 records
case END_RECORD24: //ending record for S2 records
case END_RECORD16: //ending record for S1 records
//check only for correct checksum
if( sscanf(lbufPC + 2, "%2X", &countN ) != 1 )
{
return BADFILETYPE; /* Flag error in SX record */
}
//check only for correct checksum
if (sscanf(lbufPC + 2, "%2X", &countN) != 1)
{
return BADFILETYPE; /* Flag error in SX record */
}
unknow_rec = 1;
break;
unknow_rec = 1;
break;
default: // bad record
return BADFILETYPE;
default: // bad record
return BADFILETYPE;
}
if (unknow_rec)
@ -512,25 +512,25 @@ int MotorolaSFileBuf::ParseRecord(char *lbufPC, uint8_t *buf_startP, uint8_t *bu
cksmB = 0;
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;
}
if( ++cksmB )
if (++cksmB)
{
return BADFILETYPE; /* flag checksum error */
}
}
else
{
if ( addrL > highestAddr)
if (addrL > highestAddr)
{
highestAddr = addrL;
}
if ( addrL < lowestAddr)
if (addrL < lowestAddr)
{
lowestAddr = addrL;
}
@ -551,12 +551,12 @@ int MotorolaSFileBuf::ParseRecord(char *lbufPC, uint8_t *buf_startP, uint8_t *bu
cksmB = 0;
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;
if( ( i > oheadN ) && ( i < countN ) ) /* If scanned a data byte */
if ((i > oheadN) && (i < countN)) /* If scanned a data byte */
{
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 */
}
if (!nocopy)
{
if( (bufPC - 1) > highestPC )
if ((bufPC - 1) > highestPC)
{
highestPC = bufPC - 1; /* track highest address loaded */
}

View File

@ -38,7 +38,7 @@
class MotorolaSFileBuf : public FileBuf
{
public: //---------------------------------------- public
public: //---------------------------------------- public
MotorolaSFileBuf(e2AppWinInfo *wininfo = 0);
virtual ~MotorolaSFileBuf();
@ -46,9 +46,9 @@ public: //---------------------------------------- public
virtual int Load(int loadtype = 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 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)
{
//NVM3060
E2Profile::SetNVMProgDelay( E2Profile::GetNVMProgDelay() );
GetBus()->SetProgDelay( E2Profile::GetNVMProgDelay() );
E2Profile::SetNVMProgDelay(E2Profile::GetNVMProgDelay());
GetBus()->SetProgDelay(E2Profile::GetNVMProgDelay());
GetBus()->SetDataMode(16);
GetBus()->SetStatusLocation(526);
start_addr = 0;
@ -139,8 +139,8 @@ int Nvm3060::Write(int probe, int type)
else
{
//MDA2062
E2Profile::SetMDAProgDelay( E2Profile::GetMDAProgDelay() );
GetBus()->SetProgDelay( E2Profile::GetMDAProgDelay() );
E2Profile::SetMDAProgDelay(E2Profile::GetMDAProgDelay());
GetBus()->SetProgDelay(E2Profile::GetMDAProgDelay());
GetBus()->SetDataMode(8);
GetBus()->SetStatusLocation(14);
start_addr = 128;
@ -213,7 +213,7 @@ int Nvm3060::Verify(int type)
}
else
{
rval = ( memcmp(GetBufPtr(), localbuf, size) != 0 ) ? 0 : 1;
rval = (memcmp(GetBufPtr(), localbuf, size) != 0) ? 0 : 1;
}
delete localbuf;

View File

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

View File

@ -92,7 +92,7 @@ int SIProgInterface::Open(int com_no)
if (IsInstalled() != com_no)
{
if ( (ret_val = RS232Interface::OpenSerial(com_no)) == OK )
if ((ret_val = RS232Interface::OpenSerial(com_no)) == OK)
{
// SetSerialEventMask(0);
//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
{
public: //------------------------------- public
public: //------------------------------- public
SIProgInterface();
// virtual ~SIProgInterface();
@ -58,9 +58,9 @@ public: //------------------------------- public
int SetPower(int onoff);
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 rv = Probe( probe || GetNoOfBank() == 0 );
int rv = Probe(probe || GetNoOfBank() == 0);
if (rv > 0)
{
if ( type & CONFIG_TYPE )
if (type & CONFIG_TYPE)
{
// read the config locations
// this must be the FIRST operation (just after reset)
@ -111,7 +111,7 @@ int Pic125xx::Read(int probe, int type)
GetBus()->IncAddress(1);
}
if ( type & PROG_TYPE )
if (type & PROG_TYPE)
{
rv = ReadProg();
}
@ -122,18 +122,18 @@ int Pic125xx::Read(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 ( type & PROG_TYPE )
if (type & PROG_TYPE)
{
//Skip configuration word
GetBus()->IncAddress(1);
rv = WriteProg();
}
if ( rv > 0 && (type & CONFIG_TYPE) )
if (rv > 0 && (type & CONFIG_TYPE))
{
// write the config locations
// 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;
if ( type & CONFIG_TYPE )
if (type & CONFIG_TYPE)
{
uint32_t f;
SecurityRead(f);
@ -198,7 +198,7 @@ int Pic125xx::Verify(int type)
GetBus()->IncAddress(1);
}
if ( type & PROG_TYPE )
if (type & PROG_TYPE)
{
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;
if (GetBus()->GetLastProgrammedAddress() > 0 && GetBus()->GetLastProgrammedAddress() < size - 1 )
if (GetBus()->GetLastProgrammedAddress() > 0 && GetBus()->GetLastProgrammedAddress() < size - 1)
{
v_len = GetBus()->GetLastProgrammedAddress() + 2;
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
rval = GetBus()->Read(0, localbuf, v_len);
if ( rval != v_len )
if (rval != v_len)
{
if (rval > 0)
{

View File

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

View File

@ -85,31 +85,31 @@ void Pic12Bus::SetDelay()
int val = E2Profile::GetPICSpeed();
int n;
switch(val)
switch (val)
{
case TURBO:
n = 1;
break;
case TURBO:
n = 1;
break;
case FAST:
n = 3;
break;
case FAST:
n = 3;
break;
case SLOW:
n = 20;
break;
case SLOW:
n = 20;
break;
case VERYSLOW:
n = 100;
break;
case VERYSLOW:
n = 100;
break;
case ULTRASLOW:
n = 1000;
break;
case ULTRASLOW:
n = 1000;
break;
default:
n = 8; //Default (< 100KHz)
break;
default:
n = 8; //Default (< 100KHz)
break;
}
BusIO::SetDelay(n);
@ -180,7 +180,7 @@ long Pic12Bus::RecDataWord(int wlen)
//receive lsb first
for (k = 0; k < wlen; k++)
if ( RecDataBit() )
if (RecDataBit())
{
val |= 1 << k;
}
@ -294,12 +294,12 @@ long Pic12Bus::BlankCheck(long length)
//Read Program Code
SendCmdCode(ReadProgCode);
if ( CompareSingleWord(0xffff, RecvProgCode(), ProgMask) )
if (CompareSingleWord(0xffff, RecvProgCode(), ProgMask))
{
break;
}
if ( CheckAbort(len * 100 / length) )
if (CheckAbort(len * 100 / length))
{
break;
}
@ -343,7 +343,7 @@ long Pic12Bus::Read(int addr, uint8_t *data, long length, int page_size)
#endif
IncAddress(1);
if ( CheckAbort(len * 100 / length) )
if (CheckAbort(len * 100 / length))
{
break;
}
@ -385,13 +385,13 @@ long Pic12Bus::Write(int addr, uint8_t const *data, long length, int page_size)
#endif
rv = WriteProgWord(val, length - 1);
if ( rv != OK )
if (rv != OK)
{
len = rv;
break;
}
if ( CheckAbort(len * 100 / length) )
if (CheckAbort(len * 100 / length))
{
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)
SendCmdCode(ReadProgCode);
if ( CompareSingleWord(RecvProgCode(), 0xffff, ProgMask) == 0 &&
CompareSingleWord(val, 0x0C00, (ProgMask & 0xff00)) == 0 )
if (CompareSingleWord(RecvProgCode(), 0xffff, ProgMask) == 0 &&
CompareSingleWord(val, 0x0C00, (ProgMask & 0xff00)) == 0)
{
SetLastProgrammedAddress(current_address << 1);
for (k = 1; k <= MAX_PROG_PULSES; k++)
{
if ( ProgramPulse(val, 1) == OK )
if (ProgramPulse(val, 1) == OK)
{
break;
}
@ -462,20 +462,20 @@ int Pic12Bus::WriteProgWord(uint16_t val, long rc_addr)
//Check for blank (erased cells)
SendCmdCode(ReadProgCode);
if ( CompareSingleWord(RecvProgCode(), 0xffff, ProgMask) )
if (CompareSingleWord(RecvProgCode(), 0xffff, ProgMask))
{
rval = E2ERR_BLANKCHECKFAILED;
}
else
{
//Skip FFF words
if ( CompareSingleWord(val, 0xffff, ProgMask) != 0 )
if (CompareSingleWord(val, 0xffff, ProgMask) != 0)
{
SetLastProgrammedAddress(current_address << 1);
for (k = 1; k <= MAX_PROG_PULSES; k++)
{
if ( ProgramPulse(val, 1) == OK )
if (ProgramPulse(val, 1) == OK)
{
break;
}
@ -557,7 +557,7 @@ int Pic12Bus::CompareMultiWord(uint8_t *data1, uint8_t *data2, long length, int
{
int retval = 0;
if ( data1 == 0 || data2 == 0 || (length & 1) != 0 )
if (data1 == 0 || data2 == 0 || (length & 1) != 0)
{
return BADPARAM;
}
@ -584,7 +584,7 @@ int Pic12Bus::CompareMultiWord(uint8_t *data1, uint8_t *data2, long length, int
val2 |= (uint16_t)(*data2++) << 8;
#endif
if ( (retval = CompareSingleWord(val1, val2, ProgMask)) )
if ((retval = CompareSingleWord(val1, val2, ProgMask)))
{
break; //Stop if a difference
}

View File

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

View File

@ -101,7 +101,7 @@ int Pic168xx::QueryType(long &type)
id_locations[6] = 0;
if ( GetBus()->ReadConfig(id_locations) == OK )
if (GetBus()->ReadConfig(id_locations) == OK)
{
int code = id_locations[6];
@ -139,8 +139,8 @@ int Pic168xx::Probe(int probe_size)
{
if (rv == OK)
{
SetNoOfBank( GetEEPTypeSize(type) );
SetSplitted( GetEEPTypeSplit(type) );
SetNoOfBank(GetEEPTypeSize(type));
SetSplitted(GetEEPTypeSplit(type));
rv = GetSize();
}
}
@ -154,7 +154,7 @@ int Pic168xx::Probe(int probe_size)
{
if (rv == OK)
{
if ( GetE2PSubType(GetAWInfo()->GetEEPId()) == subtype )
if (GetE2PSubType(GetAWInfo()->GetEEPId()) == subtype)
{
rv = GetSize();
}
@ -171,11 +171,11 @@ int Pic168xx::Probe(int probe_size)
int Pic168xx::Write(int probe, int type)
{
int rv = Probe( probe || GetNoOfBank() == 0 );
int rv = Probe(probe || GetNoOfBank() == 0);
if (rv > 0)
{
if ( (type & PROG_TYPE) && (type & DATA_TYPE) )
if ((type & PROG_TYPE) && (type & DATA_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
// 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
{
public: //---------------------------------------- public
public: //---------------------------------------- public
Pic168xx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
virtual ~Pic168xx();
@ -46,7 +46,7 @@ public: //---------------------------------------- public
int Write(int probe = 1, int type = ALL_TYPE);
// int Verify(int type = ALL_TYPE);
protected: //--------------------------------------- protected
protected: //--------------------------------------- protected
PicBus *GetBus()
{
@ -56,7 +56,7 @@ protected: //--------------------------------------- protected
int QueryType(long &type);
int CodeProtectAdjust(uint16_t &config, int read = 0);
private: //--------------------------------------- private
private: //--------------------------------------- private
};
#endif

View File

@ -118,7 +118,7 @@ int Pic16xx::Probe(int probe_size)
int Pic16xx::Read(int probe, int type)
{
int rv = Probe( probe || GetNoOfBank() == 0 );
int rv = Probe(probe || GetNoOfBank() == 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
// 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 rv = Probe( probe || GetNoOfBank() == 0 );
int rv = Probe(probe || GetNoOfBank() == 0);
if (rv > 0)
{
if ( (type & PROG_TYPE) && (type & DATA_TYPE) )
if ((type & PROG_TYPE) && (type & DATA_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
// 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