Skip to content

Commit

Permalink
drivers: i2s: Add DMA busy function
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
marwaiehm-st committed May 24, 2024
1 parent a420516 commit efa1a06
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions drivers/i2s/i2s_ll_stm32.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,16 @@ struct i2s_stm32_data {
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);
#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_ */

0 comments on commit efa1a06

Please sign in to comment.