Hi, Rory,
I suppose that you use the ..._i2s_interrupt_transfer example to have a test, for the example, I think this is the the architecture of the example.
First of all, a handler is declared as static i2s_handle_t s_TxHandle; for i2s transmitter, the s_TxHandle->i2sQueue[handle->queueDriver] is a component with structure i2s_transfer_t, it contains the sample pointer and data size.
The example use interrupt mechanism to transfer sample to I2S transmitter FIFO, so in the ISR void I2S_TxHandleIRQ(I2S_Type *base, i2s_handle_t *handle) is called. NOTE the I2S_TxHandleIRQ() not exact ISR, it is called by real ISR of FC7. when a bunch of data defined in the s_TxHandle->i2sQueue[handle->queueDriver] is completed, the callback function static void TxCallback(I2S_Type *base, i2s_handle_t *handle, status_t completionStatus, void *userData) is called. in the TxCallback() function, you need fill NEW data, the NEW data will update the s_TxHandle->i2sQueue[handle->queueDriver] structure.
In conclusion, you are required to just write the callback function TxCallback(), it is okay.
For your application, this is the pseudo code:
assume the data size is 100
uint8_t sample[100]
uint32_t data_size=100;
static void TxCallback(I2S_Type *base, i2s_handle_t *handle, status_t completionStatus, void *userData)
{
//read data from file
read(filePointer, &sample[0],data_size);
/* Enqueue the same original s_Buffer all over again */
i2s_transfer_t *transfer;
transfer->data=sample
transfer->dataSize=100;
I2S_TxTransferNonBlocking(base, handle, *transfer);
}
Hope it can help you
BR
XiangJun Rong