I am writing an i2s application for the nRF5340 Audio DK with toolchain and nRF Connect SDK v2.9.0.
During development I noticed that nrfx_i2s_start() does not seem to check if the buffer_size as specified in nrfx_i2s_buffers_t is > 0.
I understand this code should actually check it?
nrfx_err_t nrfx_i2s_start(nrfx_i2s_t const * p_instance,
nrfx_i2s_buffers_t const * p_initial_buffers,
#if !NRFX_API_VER_AT_LEAST(3, 3, 0)
uint16_t buffer_size,
#endif
uint8_t flags)
{
NRFX_ASSERT(p_initial_buffers != NULL);
NRFX_ASSERT(p_initial_buffers->p_rx_buffer != NULL ||
p_initial_buffers->p_tx_buffer != NULL);
NRFX_ASSERT((p_initial_buffers->p_rx_buffer == NULL) ||
(nrfx_is_in_ram(p_initial_buffers->p_rx_buffer) &&
nrfx_is_word_aligned(p_initial_buffers->p_rx_buffer)));
NRFX_ASSERT((p_initial_buffers->p_tx_buffer == NULL) ||
(nrfx_is_in_ram(p_initial_buffers->p_tx_buffer) &&
nrfx_is_word_aligned(p_initial_buffers->p_tx_buffer)));
#if NRFX_API_VER_AT_LEAST(3, 3, 0)
NRFX_ASSERT(p_initial_buffers->buffer_size != 0);
#else
NRFX_ASSERT(buffer_size != 0);
#endif
(void)(flags);
...
...
...
and should assert if buffer_size is 0.
However I am perfectly able to define in my app
nrfx_i2s_buffers_t next_buffers = {
.p_rx_buffer = &i2s_rx_buffer[0],
.p_tx_buffer = &i2s_tx_buffer[0],
};
and use this without error - but encountering very bad bugs due to that ofc which took me 1h to see that they were actually caused because I forgot to specify .buffer_size in the struct to a value > 0.
As far as I can see the API Version that the macro NRFX_API_VER_AT_LEAST checks it against is 3.8.0?