chore: contain DMA Controllers in a tuple rather than a struct
This commit is contained in:
@@ -3,25 +3,12 @@ const std = @import("std");
|
||||
const DmaControl = @import("io.zig").DmaControl;
|
||||
const Bus = @import("../Bus.zig");
|
||||
|
||||
pub const DmaTuple = std.meta.Tuple(&[_]type{ DmaController(0), DmaController(1), DmaController(2), DmaController(3) });
|
||||
const log = std.log.scoped(.DmaTransfer);
|
||||
|
||||
pub const DmaControllers = struct {
|
||||
const Self = @This();
|
||||
|
||||
_0: DmaController(0),
|
||||
_1: DmaController(1),
|
||||
_2: DmaController(2),
|
||||
_3: DmaController(3),
|
||||
|
||||
pub fn init() Self {
|
||||
return .{
|
||||
._0 = DmaController(0).init(),
|
||||
._1 = DmaController(1).init(),
|
||||
._2 = DmaController(2).init(),
|
||||
._3 = DmaController(3).init(),
|
||||
};
|
||||
}
|
||||
};
|
||||
pub fn create() DmaTuple {
|
||||
return .{ DmaController(0).init(), DmaController(1).init(), DmaController(2).init(), DmaController(3).init() };
|
||||
}
|
||||
|
||||
/// Function that creates a DMAController. Determines unique DMA Controller behaiour at compile-time
|
||||
fn DmaController(comptime id: u2) type {
|
||||
@@ -228,10 +215,10 @@ fn DmaController(comptime id: u2) type {
|
||||
}
|
||||
|
||||
pub fn pollBlankingDma(bus: *Bus, comptime kind: DmaKind) void {
|
||||
bus.dma._0.pollBlankingDma(kind);
|
||||
bus.dma._1.pollBlankingDma(kind);
|
||||
bus.dma._2.pollBlankingDma(kind);
|
||||
bus.dma._3.pollBlankingDma(kind);
|
||||
bus.dma[0].pollBlankingDma(kind);
|
||||
bus.dma[1].pollBlankingDma(kind);
|
||||
bus.dma[2].pollBlankingDma(kind);
|
||||
bus.dma[3].pollBlankingDma(kind);
|
||||
}
|
||||
|
||||
const Adjustment = enum(u2) {
|
||||
|
Reference in New Issue
Block a user