Trk: Bug fixing in the adapter

Unblock COM reading. Ensure process is started only once. Read out
registers. Read gdb memory request properly.
This commit is contained in:
Friedemann Kleint
2009-08-04 16:36:52 +02:00
parent 877450589d
commit ec40996904
4 changed files with 138 additions and 78 deletions

View File

@@ -115,7 +115,7 @@ TrkResult extractResult(QByteArray *buffer)
// FIXME: what happens if the length contains 0xfe?
// Assume for now that it passes unencoded!
QByteArray data = decode7d(buffer->mid(5, len - 2));
*buffer = buffer->mid(4 + len);
*buffer->remove(0, 4 + len);
byte sum = 0;
for (int i = 0; i < data.size(); ++i) // 3 = 2 * 0xfe + sum
@@ -305,5 +305,16 @@ uint swapEndian(uint in)
{
return (in>>24) | ((in<<8) & 0x00FF0000) | ((in>>8) & 0x0000FF00) | (in<<24);
}
int TrkResult::errorCode() const
{
// NAK means always error, else data sized 1 with a non-null element
const bool isNAK = code == 0xff;
if (data.size() != 1 && !isNAK)
return 0;
if (const int errorCode = data.at(0))
return errorCode;
return isNAK ? 0xff : 0;
}
} // namespace trk