This doesn't really make sense - what I want is for DMA to fill a buffer and then notify me so I can process the data with the CPU - waiting with the CPU for the data or copying it to another buffer makes no sense.
So in the new driver you can use
Code: Select all
i2s_event_callbacks_t cbs = {
.on_recv = i2s_rx_callback,
.on_recv_q_ovf = NULL,
.on_sent = NULL,
.on_send_q_ovf = NULL,
};
i2s_channel_register_event_callback(rx_chan, &cbs, NULL)and in the callback I indeed get a pointer to the actual DMA buffer - which is great - however, I noticed that this callback only gets called when I make a call to the blocking i2s_channel_read(). This again defeats the purpose, I shouldn't have to copy the DMA buffer into another buffer using the CPU before processing it if DMA already filled the data into memory for me - and what could I even use the callback for if I have copied the data anyway using i2s_channel_read()?To send or receive data asynchronously, callbacks can be registered by i2s_channel_register_event_callback(). Users are able to access the DMA buffer directly in the callback function instead of transmitting or receiving by the two blocking functions.
This seems to make no sense for me. How can I get a callback whenever a DMA buffer has been filled without having to make a call to i2s_channel_read() and without having to make a copy of the data?