i2s_channel_preload_data() function
Preload the data into TX DMA buffer
Arguments
tx_handle
I2S TX channel handler
src
The pointer of the source buffer to be loaded
size
The source buffer size
bytes_loaded
The bytes that successfully been loaded into the TX DMA buffer
Return value
- ESP_OK Load data successful - ESP_ERR_INVALID_ARG NULL pointer or not TX direction - ESP_ERR_INVALID_STATE This channel has not stated
Notes
Only allowed to be called when the channel state is READY, (i.e., channel has been initialized, but not started) As the initial DMA buffer has no data inside, it will transmit the empty buffer after enabled the channel, this function is used to preload the data into the DMA buffer, so that the valid data can be transmitted immediately after the channel is enabled. This function can be called multiple times before enabling the channel, the buffer that loaded later will be concatenated behind the former loaded buffer. But when all the DMA buffers have been loaded, no more data can be preload then, please check the `bytes_loaded` parameter to see how many bytes are loaded successfully, when the `bytes_loaded` is smaller than the `size`, it means the DMA buffers are full.
i2s_channel_preload_data() calls 4 functions:
![]()
i2s_channel_preload_data()
i2s_channel_preload_data() reads 20 variables and writes 3 variables:
![]()
i2s_channel_preload_data()