Maximum send 255 of 32-bit data (1020 Bytes)

Questions and discussions about the Xillybus IP core and drivers

Maximum send 255 of 32-bit data (1020 Bytes)

Postby mohdamir »

Hi Eli and all,

I modified the file streamwrite.c to be used such that I can have a textfile to be sent, instead of using 1 Byte at a time (from the sample).

It works really well if my textfile is smaller than 1020 Bytes (which is 255 of 32-bit data), send it to SDRAM and read it again. That is great!

But if I have a textfile which is, for example, 100kB, it doesn't send all the data. I tried to modify the function:

Code: Select all
void allwrite(int fd, unsigned char *buf, int len)


and change the int of len into long int like this (to make it big enough to cover the length):

Code: Select all
void allwrite(int fd, unsigned char *buf, long len)


but still I didn't get the result to read all data from the textfile.

Do you have any suggestion or idea to solve this problem? Thanks.

Regards.
mohdamir
 
Posts: 15
Joined:

Re: Maximum send 255 of 32-bit data (1020 Bytes)

Postby support »

Hello,

To begin with, streamwrite.c sends data from standard input to the chosen output file in chunks of 128 bytes each, and not 1 byte at a time. Not top-notch efficiency, but keeps the code simple.

Either way, it copies all data in any case. Why things got messy when the desired data was longer than 1020 bytes I can only guess. Actually, my primary guess is that the logic fetches the data faster than it arrives to the FPGA, and it expects it to arrive continuously. If you're writing to an SDRAM, it's impossible to keep pace with the rate the SDRAM consumes data.

As for "int" vs. "long int": On a 32-bit machine, "int" is a 32-bit signed integer, ranging from -2G to +2G. So changing it to the 64-bit "long int" didn't make any difference, because you weren't remotely near the 2G limit anyhow.

Regards,
Eli
support
 
Posts: 802
Joined:


Return to Xillybus