Forum Discussion
Altera_Forum
Honored Contributor
16 years agoIOWR, IOWR_32DIRECT, alt_flash_read... need help to get the bits
I have got a quite simple problem I think, but I am messing around about half a day now with that and don't figure it out. So I would like to ask for your advice. I want to copy data from my EP...
Altera_Forum
Honored Contributor
16 years ago --- Quote Start --- Thanks for your reply BillA. I already tried that, but did not matched the addresses right I think. Does alt_read_flash read Bytes or Bits? So dataSize*8=Bit or dataSize=Bit? --- Quote End --- Bytes. I don't know if there is optimization to write 32-bits at a time to SDRAM but the call is bytes (like C's fread) and the EPCS contents are placed byte for byte in order. --- Quote Start --- I have got a EPCS64 Serial Device and my SDRAM Master Width is 32Bit wide. How would you count? --- Quote End --- Use the following to read 32 bytes at a time. But there's no reason to do this - one call will suffice - dataSize is the bytes to copy. Look at alt_read_flash as if it were memcpy:
while(dataSize>32)
{
ret_code = alt_read_flash(my_epcs, epcsAddr, sdramAddr, 32);
epcsAddr+=32, sdramAddr+=32;
dataSize-=32;
}
if(dataSize>0)
ret_code = alt_read_flash(my_epcs, epcsAddr, sdramAddr, dataSize);
Bill