From a7ff8ed32ba8b80dc131ad2a7fe602704b04b3f1 Mon Sep 17 00:00:00 2001 From: Grazfather Date: Fri, 23 Feb 2024 13:06:28 -0500 Subject: [PATCH] rp2040: Fix DMA not respecting transfer_size_bytes (#176) --- board-support/raspberrypi-rp2040/src/hal/dma.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/board-support/raspberrypi-rp2040/src/hal/dma.zig b/board-support/raspberrypi-rp2040/src/hal/dma.zig index fcbc3d8..b7f9629 100644 --- a/board-support/raspberrypi-rp2040/src/hal/dma.zig +++ b/board-support/raspberrypi-rp2040/src/hal/dma.zig @@ -107,7 +107,12 @@ pub const Channel = enum(u4) { regs.ctrl_trig.modify(.{ .EN = @intFromBool(config.enable), .DATA_SIZE = .{ - .value = .SIZE_BYTE, + .value = switch (config.transfer_size_bytes) { + 1 => @TypeOf(regs.ctrl_trig.read().DATA_SIZE.value).SIZE_BYTE, + 2 => .SIZE_HALFWORD, + 4 => .SIZE_WORD, + else => unreachable, + }, }, .INCR_READ = @intFromBool(config.read_increment), .INCR_WRITE = @intFromBool(config.write_increment),