Forum Discussion
Altera_Forum
Honored Contributor
16 years agoalt_remap_uncached, alt_uncached_malloc?
Hi, I'm writing to off chip DDR2. My question is should I use either of the alt_remap_uncached or the alt_uncached_malloc functions? I saw that they use it in the NEEK demo. But I don't...
Altera_Forum
Honored Contributor
16 years agoYou need to use uncached addresses when the memory area you want to read/write is also accessed by hardware. It is the case for the frame buffer that is read by a DMA. If you don't use the uncached functions, in some cases the CPU can delay the write operation, and the DMA will read the previous contents of the frame buffer instead of what you just wrote.
But if you are writing a lot of data on consecutive words, you can use the CPU cache to speed up things, it will be a lot faster than using the unmapped area. To do that, don't use the unmapped functions and write to the address as usual, and at the end call the flush function. It will ensure that everything is written on the DDR before the hardware reads it. You should also enable the burst transfers from the cache in the Nios II configuration.