Skip to content

Commit

Permalink
rp2040: Fix DMA not respecting transfer_size_bytes (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
Grazfather authored Feb 23, 2024
1 parent 5742d0e commit a7ff8ed
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion board-support/raspberrypi-rp2040/src/hal/dma.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit a7ff8ed

Please sign in to comment.