Reading from On-Chip FIFO does not consumes data
Hello all,
Im trying to read data from On-Chip FIFO. The problem I have is that it seems that the FIFO does not 'advance' whenever I read a new data. What I mean is, I'm able to read the FIFO's level and one value, however after this, the FIFO's level remains the same, and if I read again the same value is returned.
How can I acheive the FIFO to return new data each time I read?
Im using altera_avalon_fifo_init() to initialize as follows:
~~~
altera_avalon_fifo_init( MY_FIFO_CSR_BASE, 0x0, 1, ( MY_FIFO_FIFO_DEPTH-10));
~~~
For reading a value im using:
~~~
int first_in_fifo_data = altera_avalon_fifo_read_fifo( MY_FIFO_CSR_BASE, MY_FIFO_BASE);
~~~
The corresponding FIFO's definitons in system.h are following:
~~~
#define MY_FIFO_AVALONMM_AVALONMM_DATA_WIDTH 32
#define MY_FIFO_AVALONMM_AVALONST_DATA_WIDTH 32
#define MY_FIFO_BASE 0xc0
#define MY_FIFO_BITS_PER_SYMBOL 32
#define MY_FIFO_CHANNEL_WIDTH 0
#define MY_FIFO_ERROR_WIDTH 0
#define MY_FIFO_FIFO_DEPTH 256
#define MY_FIFO_IRQ -1
#define MY_FIFO_IRQ_INTERRUPT_CONTROLLER_ID -1
#define MY_FIFO_NAME "/dev/MY_FIFO"
#define MY_FIFO_SINGLE_CLOCK_MODE 0
#define MY_FIFO_SPAN 8
#define MY_FIFO_SYMBOLS_PER_BEAT 1
#define MY_FIFO_TYPE "altera_avalon_fifo"
#define MY_FIFO_USE_AVALONMM_READ_SLAVE 1
#define MY_FIFO_USE_AVALONMM_WRITE_SLAVE 0
#define MY_FIFO_USE_AVALONST_SINK 1
#define MY_FIFO_USE_AVALONST_SOURCE 0
#define MY_FIFO_USE_BACKPRESSURE 1
#define MY_FIFO_USE_IRQ 0
#define MY_FIFO_USE_PACKET 0
#define MY_FIFO_USE_READ_CONTROL 1
#define MY_FIFO_USE_REGISTER 0
#define MY_FIFO_USE_WRITE_CONTROL 0
~~~
According to this, you've got your addresses swapped in your read command:
The FIFO output (the agent interface) should be listed first and the CSR interface should be listed second.