--- Quote Start ---
You have basically the choice between the IORD/WR macros to directly access hardware, or use pointers to the base address.
If possible it's better to use pointers, as this method is probably more futureproof than the macros, especially if you plan to move to a MMU system one day. There is just one thing to be careful about when using pointers to access hardware: you must avoid using the CPU's data cache. For that the best way is to use the alt_remap_uncached() function (see page 14-47 of this document (
http://www.altera.com/literature/hb/nios2/n2sw_nii52010.pdf)) to convert your base address to an uncached pointer.
--- Quote End ---
So..if my custom fifo-ip's address is 0x04000400 to 0x04000401(the span is 2) and the CUSTOM_FIFO_IP_BASE points at 0x04000400, may i program like the following ?
for(counter = 0 ;counter < 255 ;counter++)
{
write_buffer = *(alt_16 *) (CUSTOM_FIFO_IP_BASE) ;
}
Write_buffer stores the data to be sent.