...
This function returns true if it is able to receive the data from buffer EP6 within Timeout milliseconds. This function returns false otherwise.
Code Block | ||||
---|---|---|---|---|
| ||||
PACKETLENGTH=100000;
packets=1200;
byte[] data = new byte[packetlen*packets];
byte[] buffer = new byte[packetlen];
//starts test: the FPGA start to write data in the buffer EP6 of FX2 chip
SendFPGAcommand(ref TE_USB_FX2_USBDevice, MB_Commands.FX22MB_REG0_START_TX, TIMEOUT_MS);
test_cnt = 0;
total_cnt = 0;
for (int i = 0; i < packets; i++)
{
//buffer = &data[total_cnt];
packetlen = PACKETLENGTH;
//fixed (byte* buffer = &data[total_cnt])
bResultXfer = TE_USB_FX2.TE_USB_FX2.TE_USB_FX2_GetData(ref TE_USB_FX2_USBDevice, ref buffer, ref packetlen, PI_EP6, TIMEOUT_MS,BUFFER_SIZE);
Buffer.BlockCopy(buffer, 0, data, total_cnt, packetlen);
if (bResultXfer == false)
{
//cout << "ERROR" << endl;
Console.WriteLine("Error Get Data");
SendFPGAcommand(ref TE_USB_FX2_USBDevice, MB_Commands.FX22MB_REG0_STOP, TIMEOUT_MS);
return;
}
total_cnt += packetlen;
}
//stop test: the FPGA start to write data in the buffer EP6 of FX2 chip
SendFPGAcommand(ref TE_USB_FX2_USBDevice,
MB_Commands.FX22MB_REG0_STOP, TIMEOUT_MS) |