This function instantiate the driver buffer (host computer buffer) for a single TE USB FX2 module read connection.
Note |
---|
This function has not been included in TE_USB_FX2_GetData() for throughput reasons; if the driver buffer instantiation were repeated at every data reception, the data throughput would be halved. This function shall be used only one time to instantiate the driver buffer; after instantiation, TE_USB_FX2_GetData() can be used repeatedly without re-instantiating the driver buffer. |
This function takes an already initialized USB device list (USBDeviceList previously selected by TE_USB_FX2_Open()) and a not initialized CCyBulkEndPoint double pointer, BulkInEP. This function selects the endpoint to use: you shall choose EP6 (0x86) (endpoints EP4(0x84) or EP2(0x82) are also theoretically possible).
Note |
---|
Currently (April 2012), only endpoint 0x86 is actually implemented in Trenz Electronic USB FPGA modules, so that endpoints EP2 and EP4 cannot be read or , more precisely, they are not even connected to the FPGA. That is why attempting to read them causes a function failure after Timeout expires. |
TE_USB_FX2_GetData_InstanceDriverBuffer() function instantiates the class used by CyAPI to use bulk endpoint (CCyBulkEndPoint, see pages 9 to 11 of CyAPI.pdf (Cypress CyAPI Programmer's Reference)) and initializes the parameters of this class instantiation. The parameters are :
The last parameter force the instantiation of the driver buffer (SW side, on the host computer) for the endpoint 0x86; this buffer has a size in byte given by DeviceDriverBufferSize. This value is of great importance because the data throughput is strongly influenced by this parameter (see Data Transfer Throughput Optimization).
...
int : integer type
This typeThis function returns true (ST_OK=0) if if the selected BulkEndPoint exists in the firmware (it is able to find the module selected by CardNumberinstantiate the driver buffer). If unable to do so, it returns false (ST_ERROR=1).
Code Block | ||
---|---|---|
| ||
enum ST_Status { ST_OK = 0, ST_ERROR = 1 }; |
This function instantiate the driver buffer (host computer buffer) for a single TE USB FX2 module read connection.
Note |
---|
This function has not been included in TE_USB_FX2_GetData() for throughput reasons; if the driver buffer instantiation were repeated at every data reception, the data throughput would be halved. This function shall be used only one time to instantiate the driver buffer; after instantiation, TE_USB_FX2_GetData() can be used repeatedly without re-instantiating the driver buffer. |
This function takes an already initialized USB device list (USBDeviceList previously selected by TE_USB_FX2_Open()) and a not initialized CCyBulkEndPoint double pointer, BulkInEP. This function selects the endpoint to use: you shall choose EP6 (0x86) (endpoints EP4(0x84) or EP2(0x82) are also theoretically possible).
Note |
---|
Currently (April 2012), only endpoint 0x86 is actually implemented in Trenz Electronic USB FPGA modules, so that endpoints EP2 and EP4 cannot be read or , more precisely, they are not even connected to the FPGA. That is why attempting to read them causes a function failure after Timeout expires. |
TE_USB_FX2_GetData_InstanceDriverBuffer() function instantiates the class used by CyAPI to use bulk endpoint (CCyBulkEndPoint, see pages 9 to 11 of CyAPI.pdf (Cypress CyAPI Programmer's Reference)) and initializes the parameters of this class instantiation. The parameters are :
...
...
The last parameter force the instantiation of the driver buffer (SW side, on the host computer) for the endpoint 0x86; this buffer has a size in byte given by DeviceDriverBufferSize. This value is of great importance because the data throughput is strongly influenced by this parameter (see Data Transfer Throughput Optimization).
Code Block | ||
---|---|---|
| ||
int RX_PACKET_LEN = 51200;//102400; int packetlen = RX_PACKET_LEN; unsigned int packets = 500;//1200;//1200; unsigned int DeviceDriverBufferSize = 131072102400;//409600;//131072; unsigned long TIMEOUT= 18200; byte * data; byte * data_temp = NULL; unsigned int total_cnt = 0; unsigned int errors = 0; data = new byte [RX_PACKET_LEN*packets]; //allocate memory PI_PipeNumber PipeNo = PI_EP6; //test starts test SendFPGAcommand(USBDeviceList,FX22MB_REG0_START_TX); CCyBulkEndPoint *BulkInEP = NULL; TE_USB_FX2_GetData_InstanceDriverBuffer (USBDeviceList, &BulkInEP, PipeNo, TIMEOUT, DeviceDriverBufferSize); ElapsedTime.Start(); //StopWatch start for (unsigned int i = 0; i < packets; i++) { packetlen = TX_PACKET_LEN; data_temp = &data[total_cnt]; if (TE_USB_FX2_GetData(&BulkInEP, data_temp, packetlen)) { cout << "ERROR read" << endl; errors++; break; } total_cnt += packetlen; } //StopWatch ends TheElapsedTime = ElapsedTime.Stop(false); //test stops SendFPGAcommand(USBDevicelist,FX22MB_REG0_STOP); |