mirror of
https://github.com/preble/libpinproc
synced 2026-02-24 18:25:23 +01:00
Changed VerifyChipID to use SortReturningData instead of just ReadData so it will ignore nonrequested events like DMD events.
This commit is contained in:
@@ -908,23 +908,24 @@ PRResult PRDevice::VerifyChipID()
|
|||||||
rc = RequestData(P_ROC_MANAGER_SELECT, P_ROC_REG_CHIP_ID_ADDR, 4);
|
rc = RequestData(P_ROC_MANAGER_SELECT, P_ROC_REG_CHIP_ID_ADDR, 4);
|
||||||
|
|
||||||
max_count = 0;
|
max_count = 0;
|
||||||
//std::cout << "Waiting for read data ";
|
// Wait for data to return. Give it 10 loops before giving up.
|
||||||
while (num_collected_bytes < (bufferWords*4) && max_count < 10) {
|
while (requestedDataQueue.size() < 5 && max_count++ < 10)
|
||||||
PRSleep(10);
|
{
|
||||||
//std::cout << ". ";
|
PRSleep (10); // 10 milliseconds should be plenty of time.
|
||||||
rc = CollectReadData();
|
SortReturningData();
|
||||||
max_count++;
|
|
||||||
}
|
}
|
||||||
//std::cout << "\n";
|
|
||||||
|
|
||||||
if (max_count != 10) {
|
if (max_count != 11) {
|
||||||
int wordsRead = ReadData(buffer, bufferWords);
|
|
||||||
|
|
||||||
if (wordsRead == 5) {
|
if (requestedDataQueue.size() == 5) {
|
||||||
|
for (i = 0; i < bufferWords; i++) {
|
||||||
|
buffer[i] = requestedDataQueue.front();
|
||||||
|
requestedDataQueue.pop(); // Ignore address word. TODO: Verify the address.
|
||||||
|
}
|
||||||
if (buffer[1] != P_ROC_CHIP_ID)
|
if (buffer[1] != P_ROC_CHIP_ID)
|
||||||
{
|
{
|
||||||
DEBUG(PRLog(kPRLogError, "Error in VerifyID(): Dumping buffer\n"));
|
DEBUG(PRLog(kPRLogError, "Error in VerifyID(): Dumping buffer\n"));
|
||||||
for (i = 0; i < wordsRead; i++)
|
for (i = 0; i < bufferWords; i++)
|
||||||
DEBUG(PRLog(kPRLogError, "buffer[%d]: 0x%x\n", i, buffer[i]));
|
DEBUG(PRLog(kPRLogError, "buffer[%d]: 0x%x\n", i, buffer[i]));
|
||||||
rc = kPRFailure;
|
rc = kPRFailure;
|
||||||
}
|
}
|
||||||
@@ -939,7 +940,8 @@ PRResult PRDevice::VerifyChipID()
|
|||||||
else readMachineType = kPRMachineWPC; // Choose WPC or WPC95, doesn't matter.
|
else readMachineType = kPRMachineWPC; // Choose WPC or WPC95, doesn't matter.
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DEBUG(PRLog(kPRLogError, "Error reading Chip IP and Version. Read %d words instead of 5. The first 2 were: 0x%x and 0x%x.\n", wordsRead, buffer[0], buffer[1]));
|
DEBUG(PRLog(kPRLogError, "Error reading Chip IP and Version. Read %d words instead of 5. The first 2 were: 0x%x and 0x%x.\n", requestedDataQueue.size(), buffer[0], buffer[1]));
|
||||||
|
rc = kPRFailure;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user