Versions Compared

Key

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

...

Dewesoft C++ DLL

Trenz Electronic C# DLL

void ReadData(unsigned int handle)
{
static void ReadDataFPGAIntegrity
(CyUSBDevice TE_USB_FX2_USBDevice,
int BUFFER_SIZE, uint TIMEOUT_MS)
{
     if (TE_USB_FX2_USBDevice == null)
    {
        Console.WriteLine("Error,no device is selected");
        return;
    }
    int packetlen = RX_PACKET_LEN;
    unsigned int packets = 1200;
    byte * data;
    data = new byte [RX_PACKET_LEN*packets];
    unsigned int total_cnt = 0;
    unsigned int errors = 0;
    int packetlen = RX_PACKET_LEN;
    int packets = 1200;
    byte[] data = new byte[packetlen*packets];
    byte[] buffer = new byte[packetlen];
    int total_cnt = 0;
    int errors = 0;    
 

     int PI_EP6 = 6;
    bool bResultXfer = false;  
    test_cnt = 0;
    total_cnt = 0;

    ResetFX2FifoStatus(handle);
    //starts test
    SendFPGAcommand(handle,
FX22MB_REG0_START_TX);
    ResetFX2FifoStatus(TE_USB_FX2_USBDevice);
    //starts test
    SendFPGAcommand(ref TE_USB_FX2_USBDevice,
MB_Commands.FX22MB_REG0_START_TX, TIMEOUT_MS);
   //StopWatch start
   ElapsedTime.Start();
     //StopWatch start
    Stopwatch stopWatch = new Stopwatch();
    stopWatch.Start();
   for (unsigned int i = 0; i < packets; i++)
   {
       packetlen = RX_PACKET_LEN;
    for (int i = 0; i < packets; i++)
    {
        packetlen = RX_PACKET_LEN;  

       if (TE0300_GetData(handle, data+total_cnt, &packetlen,
PI_EP6,TIMEOUT_MS))
       {
          



         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;
           errors++;           
           break
;
       }
       total_cnt += packetlen;
   }
   //StopWatch timer
  TheElapsedTime = ElapsedTime.Stop(false);
  
   //stops test

   SendFPGAcommand(handle,FX22MB_REG0_STOP); 
  
   delete
data;

            Console.WriteLine("Error Get Data");
            errors++;
            break;
        }
        total_cnt += packetlen;
     }
     //StopWatch timer
     stopWatch.Stop();
     TimeSpan ts = stopWatch.Elapsed;
      //stops test
      SendFPGAcommand(ref TE_USB_FX2_USBDevice,
MB_Commands
.FX22MB_REG0_STOP, TIMEOUT_MS);
      //Garbage Collector
}
  

Dewesoft C++ DLL

Trenz Electronic C# DLL

void WriteData(unsigned int handle)
{








int packetlen = TX_PACKET_LEN;
unsigned int packets = 1200;
byte * data;

unsigned int total_cnt = 0;
unsigned int errors = 0;
data = new byte [TX_PACKET_LEN*packets];
//allocate memory
//SetData (data);
ResetFX2FifoStatus(handle);
SendFPGAcommand(handle,FX22MB_REG0_START_RX);
//starts test



ElapsedTime.Start();
//StopWatch start

for (unsigned int i = 0; i < packets; i++)
{
packetlen = TX_PACKET_LEN;
if (TE0300_GetData(handle, data+total_cnt, &packetlen, PI_EP8,TIMEOUT_MS))
{








cout << "ERROR" << endl;
errors++;
break;
}
total_cnt += packetlen;
}
TheElapsedTime = ElapsedTime.Stop(false);
//DEBUG StopWatch timer

SendFPGAcommand(handle,FX22MB_REG0_STOP);

//stops test
delete data;
}

static void WriteData(CyUSBDevice TE_USB_FX2_USBDevice, int BUFFER_SIZE, uint TIMEOUT_MS)
{

if (TE_USB_FX2_USBDevice == null)
{
Console.WriteLine("Error,no device is selected");
return;
}

int packetlen = TX_PACKET_LEN;
int packets = 1200;
byte[] data = new byte[packetlen*packets];
byte[] buffer = new byte[packetlen];
int total_cnt = 0;
int errors = 0;
int PI_EP8 = 8;
//SetData (data);
bool bResultXfer = false;
ResetFX2FifoStatus(TE_USB_FX2_USBDevice);
SendFPGAcommand(ref TE_USB_FX2_USBDevice, MB_Commands.FX22MB_REG0_START_RX, TIMEOUT_MS);
//starts test
test_cnt = 0;
total_cnt = 0;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();

for (int i = 0; i < packets; i++)
{
packetlen = TX_PACKET_LEN;
Buffer.BlockCopy(data,total_cnt, buffer, 0, packetlen);
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);




if (bResultXfer == false)
{
Console.WriteLine("Error Get Data");
errors++;
break;
}
total_cnt += packetlen;
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;

SendFPGAcommand(ref TE_USB_FX2_USBDevice, MB_Commands.FX22MB_REG0_STOP, TIMEOUT_MS);
//stops test
}

...