Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagecpp
int BufferSize

Itis It is the dimension (in bytes) of the driver buffer (SW) used in data transmission of a single endpoints (EP8 0x08 in this case); the total buffer size is the sum of BufferSize of every endpoint used. BufferSize has a strong influence on DataThroughput. If BufferSize is too small, DataThroughput can be 1/3-1/2 of the maximum value (from a maximum value of 24 Mbyte/s for read transactions to an actual value of 18 Mbyte/s). See 6 TE_USB_FX2_CyAPI.dll: Data Transfer Throughput Optimization.

...

Code Block
languagecpp
int TX_PACKET_LEN = 51200;//102400; 
 int packetlen = TX_PACKET_LEN;
 unsigned int packets = 500;//1200;//1200;
 unsigned int DeviceDriverBufferSize = 131072;//409600;//131072102400;
 unsigned long TIMEOUT= 18200;
 byte * data;
 byte * data_temp = NULL;
 unsigned int total_cnt = 0;
 unsigned int errors = 0; 
 data = new byte [TX_PACKET_LEN*packets]; //allocate memory 
 PI_PipeNumber PipeNo = PI_EP8; 
 //test starts test
 SendFPGAcommand(USBDeviceList,FX22MB_REG0_START_RX); 
 CCyBulkEndPoint *BulkOutEP = NULL; 
 TE_USB_FX2_SetData_InstanceDriverBuffer (USBDeviceList, &BulkOutEP, PipeNo, TIMEOUT, DeviceDriverBufferSize); 
 ElapsedTime.Start(); //StopWatch start
 for (unsigned int i = 0; i < packets; i++)
 {
 	packetlen = TX_PACKET_LEN;
 	data_temp = &data[total_cnt];
 	//cout << "Address &BulkInEP" << &BulkInEP << endl;
 	//cout << "Address BulkInEP" << BulkInEP << endl;
 	//cout << "Address *BulkInEP" << (*BulkInEP) << endl;
 	if (TE_USB_FX2_SetData(&BulkOutEP, data_temp, packetlen)) 
 	{
 		cout << "ERROR read" << endl;
 		errors++;
 		break;
 	}
 	total_cnt += packetlen;
 }
 //DEBUGStopWatch timer StopWatchstops 
 TheElapsedTime = ElapsedTime.Stop(false); 
//test stops
SendFPGAcommand(USBDeviceList,FX22MB_REG0_STOP);