Add some manual tests with ARYGON APDB2UA33.

This commit is contained in:
Romuald Conty 2011-01-06 14:04:48 +00:00
parent 432eff0f7d
commit 556918b298
2 changed files with 14 additions and 3 deletions

View file

@ -221,6 +221,8 @@ uart_receive (serial_port sp, byte_t * pbtRx, size_t * pszRx)
.tv_usec = uiTimeoutStatic + (uiTimeoutPerByte * iExpectedByteCount),
};
struct timeval tv = tvTimeout;
DBG("Expected bytes count: %d", iExpectedByteCount);
// if(iExpectedByteCount>250) { abort(); };
// Reset the output count
*pszRx = 0;
@ -239,7 +241,7 @@ uart_receive (serial_port sp, byte_t * pbtRx, size_t * pszRx)
if (res == 0) {
if (*pszRx == 0) {
// Error, we received no data
// DBG ("RX time-out (%lu µs), buffer empty.", tvTimeout.tv_usec);
DBG ("RX time-out (%lu µs), buffer empty.", tvTimeout.tv_usec);
return DETIMEOUT;
} else {
// We received some data, but nothing more is available
@ -261,10 +263,12 @@ uart_receive (serial_port sp, byte_t * pbtRx, size_t * pszRx)
}
*pszRx += res;
tv.tv_usec = uiTimeoutPerByte * MIN( iExpectedByteCount, 16 ); // Reload timeout with a low value to prevent from waiting too long on slow devices (16x is enought to took at least 1 byte)
// DBG("Timeout reloaded at: %d µs", tv.tv_usec);
tv.tv_usec = uiTimeoutPerByte * MIN( iExpectedByteCount, 16 );
DBG("Timeout reloaded at: %d µs", tv.tv_usec);
} while (byteCount && (iExpectedByteCount > 0));
DBG("Remaining expected bytes count: %d", iExpectedByteCount);
return 0;
}