diff options
Diffstat (limited to 'embassy-imxrt/src')
| -rw-r--r-- | embassy-imxrt/src/dma.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/embassy-imxrt/src/dma.rs b/embassy-imxrt/src/dma.rs index 76c9953c1..eaa09870d 100644 --- a/embassy-imxrt/src/dma.rs +++ b/embassy-imxrt/src/dma.rs | |||
| @@ -71,7 +71,7 @@ pub(crate) unsafe fn init() { | |||
| 71 | /// | 71 | /// |
| 72 | /// SAFETY: Slice must point to a valid location reachable by DMA. | 72 | /// SAFETY: Slice must point to a valid location reachable by DMA. |
| 73 | pub unsafe fn read<'a, C: Channel, W: Word>(ch: Peri<'a, C>, from: *const W, to: *mut [W]) -> Transfer<'a, C> { | 73 | pub unsafe fn read<'a, C: Channel, W: Word>(ch: Peri<'a, C>, from: *const W, to: *mut [W]) -> Transfer<'a, C> { |
| 74 | let count = ((to.len() / W::size() as usize) - 1) as isize; | 74 | let count = (to.len().div_ceil(W::size() as usize) - 1) as isize; |
| 75 | 75 | ||
| 76 | copy_inner( | 76 | copy_inner( |
| 77 | ch, | 77 | ch, |
| @@ -89,7 +89,7 @@ pub unsafe fn read<'a, C: Channel, W: Word>(ch: Peri<'a, C>, from: *const W, to: | |||
| 89 | /// | 89 | /// |
| 90 | /// SAFETY: Slice must point to a valid location reachable by DMA. | 90 | /// SAFETY: Slice must point to a valid location reachable by DMA. |
| 91 | pub unsafe fn write<'a, C: Channel, W: Word>(ch: Peri<'a, C>, from: *const [W], to: *mut W) -> Transfer<'a, C> { | 91 | pub unsafe fn write<'a, C: Channel, W: Word>(ch: Peri<'a, C>, from: *const [W], to: *mut W) -> Transfer<'a, C> { |
| 92 | let count = ((from.len() / W::size() as usize) - 1) as isize; | 92 | let count = (from.len().div_ceil(W::size() as usize) - 1) as isize; |
| 93 | 93 | ||
| 94 | copy_inner( | 94 | copy_inner( |
| 95 | ch, | 95 | ch, |
| @@ -111,7 +111,7 @@ pub unsafe fn copy<'a, C: Channel, W: Word>(ch: Peri<'a, C>, from: &[W], to: &mu | |||
| 111 | let to_len = to.len(); | 111 | let to_len = to.len(); |
| 112 | assert_eq!(from_len, to_len); | 112 | assert_eq!(from_len, to_len); |
| 113 | 113 | ||
| 114 | let count = ((from_len / W::size() as usize) - 1) as isize; | 114 | let count = (from_len.div_ceil(W::size() as usize) - 1) as isize; |
| 115 | 115 | ||
| 116 | copy_inner( | 116 | copy_inner( |
| 117 | ch, | 117 | ch, |
