- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi!
I've build an application in C# wich takes data from a Spartan6 FPGA and put them into a txt file.
I am testing the slave fifo interface (32 bit).
While the Streamer shows a bitrate of 180MB/s, the actual transfer rate is around 8MB/s.
This is the C# code of Streamer that show the bitrate:
public unsafe void XferData(byte[][] cBufs, byte[][] xBufs, byte[][] oLaps, ISO_PKT_INFO[][] pktsInfo)
{
int k = 0;
int len = 0;
Successes = 0;
Failures = 0;
XferBytes = 0;
t1 = DateTime.Now;
for (; bRunning; )
{
// WaitForXfer
fixed (byte* tmpOvlap = oLaps
{
OVERLAPPED* ovLapStatus = (OVERLAPPED*)tmpOvlap;
if (!EndPoint.WaitForXfer(ovLapStatus->hEvent, 500))
{
EndPoint.Abort();
PInvoke.WaitForSingleObject(ovLapStatus->hEvent, 500);
}
}
if (EndPoint.Attributes == 1)
{
CyIsocEndPoint isoc = EndPoint as CyIsocEndPoint;
// FinishDataXfer
if (isoc.FinishDataXfer(ref cBufs
{
ISO_PKT_INFO[] pkts = pktsInfo
for (int j = 0; j < PPX; j++)
{
if (pkts
{
XferBytes += pkts
Successes++;
}
else
Failures++;
pkts
}
}
else
Failures++;
}
else
{
// FinishDataXfer
if (EndPoint.FinishDataXfer(ref cBufs
{
XferBytes += len;
Successes++;
}
else
Failures++;
}
k++;
if (k == QueueSz) // Only update displayed stats once each time through the queue
{
k = 0;
t2 = DateTime.Now;
elapsed = t2 - t1;
xferRate = (long)(XferBytes / elapsed.TotalMilliseconds);
xferRate = xferRate / (int)100 * (int)100;
// Call StatusUpdate() in the main thread
this.Invoke(updateUI);
// For small QueueSz or PPX, the loop is too tight for UI thread to ever get service.
// Without this, app hangs in those scenarios.
Thread.Sleep(1);
}
// Re-submit this buffer into the queue
len = BufSz;
EndPoint.BeginDataXfer(ref cBufs
} // End infinite loop
}
And this is the code that I use to write into file:
public unsafe void WriteToFileThread()
{
int bytes = 16384;
byte[] buffer = new byte[bytes];
bool bXferCompleted = false;
bool IsPkt = false;
CyBulkEndPoint bulkEpt = EndPoint as CyBulkEndPoint;
if (bulkEpt != null)
bXferCompleted = bulkEpt.XferData(ref buffer, ref bytes, IsPkt);
try
{
while(true)
WriteXferData(buffer, bytes, bXferCompleted);
}
catch (NullReferenceException e)
{
e.GetBaseException();
this.Invoke(handleException);
}
}
What is the problem?
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am still debugging it.
For what application do you need it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content