Function esp_idf_svc::sys::i2s_channel_preload_data
source ยท pub unsafe extern "C" fn i2s_channel_preload_data(
tx_handle: *mut i2s_channel_obj_t,
src: *const c_void,
size: usize,
bytes_loaded: *mut usize,
) -> i32
Expand description
@brief Preload the data into TX DMA buffer
@note Only allowed to be called when the channel state is READY, (i.e., channel has been initialized, but not started)
@note 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.
@note 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.
@param[in] tx_handle I2S TX channel handler @param[in] src The pointer of the source buffer to be loaded @param[in] size The source buffer size @param[out] bytes_loaded The bytes that successfully been loaded into the TX DMA buffer @return - ESP_OK Load data successful - ESP_ERR_INVALID_ARG NULL pointer or not TX direction - ESP_ERR_INVALID_STATE This channel has not stated