drivers: i2s: Add DMA busy function

Add the function ll_func_i2s_dma_busy to be able to check the
transmission of all the DMA TX packet.

Signed-off-by: IBEN EL HADJ MESSAOUD Marwa <marwa.ibenelhadjmessaoud-ext@st.com>
This commit is contained in:
IBEN EL HADJ MESSAOUD Marwa 2024-05-23 17:25:32 +02:00 committed by Alberto Escolar
parent 6cef92a908
commit f3004dc671

View file

@ -58,4 +58,16 @@ struct i2s_stm32_data {
struct stream tx; struct stream tx;
}; };
/* checks that DMA Tx packet is fully transmitted over the I2S */
static inline uint32_t ll_func_i2s_dma_busy(SPI_TypeDef *i2s)
{
#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_i2s)
return LL_SPI_IsActiveFlag_TXC(i2s) == 0;
#else
/* the I2S Tx empty and busy flags are needed */
return (LL_SPI_IsActiveFlag_TXE(i2s) &&
!LL_SPI_IsActiveFlag_BSY(i2s));
#endif
}
#endif /* _STM32_I2S_H_ */ #endif /* _STM32_I2S_H_ */