- parameter renamed
- print hex instead of decimal git-svn-id: https://svn.code.sf.net/p/libusbjava/code/trunk@38 94ad28fe-ef68-46b1-9651-e7ae4fcf1c4c
This commit is contained in:
@@ -151,7 +151,7 @@ public class BDI555 {
|
|||||||
DataPacket data = Dispatch.readBDI();
|
DataPacket data = Dispatch.readBDI();
|
||||||
if (data.subtype == STYPE_BDI_UNKNOWN_STYPE) {
|
if (data.subtype == STYPE_BDI_UNKNOWN_STYPE) {
|
||||||
throw new BDIException("unknown subtype: " + data.subtype);
|
throw new BDIException("unknown subtype: " + data.subtype);
|
||||||
}else if (data.subtype == STYPE_BDI_ERROR_TIMEOUT) {
|
} else if (data.subtype == STYPE_BDI_ERROR_TIMEOUT) {
|
||||||
// receive invalid packet
|
// receive invalid packet
|
||||||
Dispatch.readBDI();
|
Dispatch.readBDI();
|
||||||
throw new BDIException("timeout error (DSDO not low)");
|
throw new BDIException("timeout error (DSDO not low)");
|
||||||
@@ -380,32 +380,32 @@ public class BDI555 {
|
|||||||
*
|
*
|
||||||
* @param downloadData
|
* @param downloadData
|
||||||
* Data to be downloaded (32 bit wide)
|
* Data to be downloaded (32 bit wide)
|
||||||
* @param nofWords
|
* @param dataLength
|
||||||
* Number of words
|
* Length of the data to download (words)
|
||||||
* @throws BDIException
|
* @throws BDIException
|
||||||
* @throws DispatchException
|
* @throws DispatchException
|
||||||
* @throws USBException
|
* @throws USBException
|
||||||
*/
|
*/
|
||||||
public static void fastDownload(int[] downloadData, int nofWords)
|
public static void fastDownload(int[] downloadData, int dataLength)
|
||||||
throws BDIException, USBException, DispatchException {
|
throws BDIException, USBException, DispatchException {
|
||||||
|
|
||||||
if (!fastDownloadStarted) {
|
if (!fastDownloadStarted) {
|
||||||
throw new BDIException("start fast download first");
|
throw new BDIException("start fast download first");
|
||||||
}
|
}
|
||||||
// check if data fits into USB-packet
|
// check if data fits into USB-packet
|
||||||
if (nofWords > MAX_NOF_WORDS_FAST_DOWNLOAD) {
|
if (dataLength > MAX_NOF_WORDS_FAST_DOWNLOAD) {
|
||||||
throw new BDIException(
|
throw new BDIException(
|
||||||
"data larger than MAX_NOF_WORDS_FAST_DOWNLOAD");
|
"data larger than MAX_NOF_WORDS_FAST_DOWNLOAD");
|
||||||
}
|
}
|
||||||
int currentIndex = 0;
|
int currentIndex = 0;
|
||||||
initPacket(STYPE_BDI_35FD_DATA, nofWords * BDI_DATA35_LENGTH);
|
initPacket(STYPE_BDI_35FD_DATA, dataLength * BDI_DATA35_LENGTH);
|
||||||
while (currentIndex < nofWords) {
|
while (currentIndex < dataLength) {
|
||||||
fillPacket(false, true, downloadData[currentIndex], currentIndex
|
fillPacket(false, true, downloadData[currentIndex], currentIndex
|
||||||
* BDI_DATA35_LENGTH);
|
* BDI_DATA35_LENGTH);
|
||||||
currentIndex++;
|
currentIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
DataPacket data = transmit(nofWords * BDI_DATA35_LENGTH);
|
DataPacket data = transmit(dataLength * BDI_DATA35_LENGTH);
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
throw new BDIException("no data from device");
|
throw new BDIException("no data from device");
|
||||||
}
|
}
|
||||||
@@ -429,7 +429,7 @@ public class BDI555 {
|
|||||||
|
|
||||||
// stop fast download
|
// stop fast download
|
||||||
int result = transferAndParse35(true, true, 0x86000000);
|
int result = transferAndParse35(true, true, 0x86000000);
|
||||||
System.out.println("stopFastDownload:" + result);
|
System.out.println("stopFastDownload: result: 0x" + Integer.toHexString(result));
|
||||||
// if (result != 0x5F) {
|
// if (result != 0x5F) {
|
||||||
// // TODO: change exception string
|
// // TODO: change exception string
|
||||||
// throw new BDIException("result != 0x5F: " + result);
|
// throw new BDIException("result != 0x5F: " + result);
|
||||||
|
|||||||
Reference in New Issue
Block a user