Skip to content

Commit 9bbaca7

Browse files
committed
fix data width check; remove incomplete documentation
1 parent 336a8c4 commit 9bbaca7

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/gpdma.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -287,13 +287,13 @@ impl<'a, CH: DmaChannel> DmaTransfer<'a, CH> {
287287
S: ReadBuffer<Word: Word>,
288288
D: WriteBuffer<Word: Word>,
289289
{
290-
let src_width = core::mem::size_of::<S>();
291-
let dest_width = core::mem::size_of::<D>();
290+
let src_width = core::mem::size_of::<S::Word>();
291+
let dest_width = core::mem::size_of::<D::Word>();
292292

293293
let (src_ptr, src_words) = unsafe { source.read_buffer() };
294-
let src_size = core::mem::size_of::<S::Word>() * src_words;
294+
let src_size = src_width * src_words;
295295
let (dest_ptr, dest_words) = unsafe { destination.write_buffer() };
296-
let dest_size = core::mem::size_of::<D::Word>() * dest_words;
296+
let dest_size = dest_width * dest_words;
297297

298298
// Size must be aligned with destination width if source width is greater than destination
299299
// width and packing mode is used, therefore the maximum size must be dictated by
@@ -310,8 +310,6 @@ impl<'a, CH: DmaChannel> DmaTransfer<'a, CH> {
310310
src_size
311311
};
312312

313-
// We also need to ensure that the destination
314-
315313
Self::new::<S::Word, D::Word, MemoryToMemory>(
316314
channel, config, src_ptr, dest_ptr, size,
317315
)

0 commit comments

Comments
 (0)