embassy-rs / embassy

Modern embedded framework, using Rust and async.
https://embassy.dev
Apache License 2.0
4.79k stars 650 forks source link

Enables half transfer ir when constructing a ReadableDmaRingBuffer #3093

Open liarokapisv opened 1 week ago

liarokapisv commented 1 week ago

The half transfer irq needs to be enabled in order for the hardware to notify the waker when the transfer is at half. This is needed to ensure no overuns occur when using ReadableDmaRingBuffer's read_exact. Otherwise we are only notified when the DMA has completed its cycle and is on its way to start overwriting the data. The docs in the dma_bdma buf module also seem to imply that the half transfer irq must be enabled for proper operation. The only consumers of the ReadableDmaRingBuffer api are the sai module and the RingBufferedUartRx. The former enables the irq manually when constructing the transfer options while the latter does not. This may also be the cause for #1441.