diff options
| -rw-r--r-- | embassy-stm32/src/dma/gpdma.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/embassy-stm32/src/dma/gpdma.rs b/embassy-stm32/src/dma/gpdma.rs index f9d66ca86..792ddc4e8 100644 --- a/embassy-stm32/src/dma/gpdma.rs +++ b/embassy-stm32/src/dma/gpdma.rs | |||
| @@ -216,7 +216,10 @@ impl<'a> Transfer<'a> { | |||
| 216 | data_size: WordSize, | 216 | data_size: WordSize, |
| 217 | _options: TransferOptions, | 217 | _options: TransferOptions, |
| 218 | ) -> Self { | 218 | ) -> Self { |
| 219 | assert!(mem_len > 0 && mem_len <= 0xFFFF); | 219 | // BNDT is specified as bytes, not as number of transfers. |
| 220 | let Ok(bndt) = (mem_len * data_size.bytes()).try_into() else { | ||
| 221 | panic!("DMA transfers may not be larger than 65535 bytes."); | ||
| 222 | }; | ||
| 220 | 223 | ||
| 221 | let info = channel.info(); | 224 | let info = channel.info(); |
| 222 | let ch = info.dma.ch(info.num); | 225 | let ch = info.dma.ch(info.num); |
| @@ -226,9 +229,6 @@ impl<'a> Transfer<'a> { | |||
| 226 | 229 | ||
| 227 | let this = Self { channel }; | 230 | let this = Self { channel }; |
| 228 | 231 | ||
| 229 | #[cfg(dmamux)] | ||
| 230 | super::dmamux::configure_dmamux(&*this.channel, request); | ||
| 231 | |||
| 232 | ch.cr().write(|w| w.set_reset(true)); | 232 | ch.cr().write(|w| w.set_reset(true)); |
| 233 | ch.fcr().write(|w| w.0 = 0xFFFF_FFFF); // clear all irqs | 233 | ch.fcr().write(|w| w.0 = 0xFFFF_FFFF); // clear all irqs |
| 234 | ch.llr().write(|_| {}); // no linked list | 234 | ch.llr().write(|_| {}); // no linked list |
| @@ -245,10 +245,7 @@ impl<'a> Transfer<'a> { | |||
| 245 | }); | 245 | }); |
| 246 | w.set_reqsel(request); | 246 | w.set_reqsel(request); |
| 247 | }); | 247 | }); |
| 248 | ch.br1().write(|w| { | 248 | ch.br1().write(|w| w.set_bndt(bndt)); |
| 249 | // BNDT is specified as bytes, not as number of transfers. | ||
| 250 | w.set_bndt((mem_len * data_size.bytes()) as u16) | ||
| 251 | }); | ||
| 252 | 249 | ||
| 253 | match dir { | 250 | match dir { |
| 254 | Dir::MemoryToPeripheral => { | 251 | Dir::MemoryToPeripheral => { |
