Compare commits

..

3 Commits

1 changed files with 3 additions and 16 deletions

View File

@ -44,8 +44,6 @@ pub const Bus = struct {
write8: *const fn (ptr: *anyopaque, address: u32, value: u8) void, write8: *const fn (ptr: *anyopaque, address: u32, value: u8) void,
write16: *const fn (ptr: *anyopaque, address: u32, value: u16) void, write16: *const fn (ptr: *anyopaque, address: u32, value: u16) void,
write32: *const fn (ptr: *anyopaque, address: u32, value: u32) void, write32: *const fn (ptr: *anyopaque, address: u32, value: u32) void,
reset: *const fn (ptr: *anyopaque) void,
}; };
pub fn init(obj: anytype) @This() { pub fn init(obj: anytype) @This() {
@ -76,22 +74,17 @@ pub const Bus = struct {
fn write8(ptr: *anyopaque, address: u32, value: u8) void { fn write8(ptr: *anyopaque, address: u32, value: u8) void {
const self = @ptrCast(P, @alignCast(alignment, ptr)); const self = @ptrCast(P, @alignCast(alignment, ptr));
self.write(u8, address, value); return self.write(u8, address, value);
} }
fn write16(ptr: *anyopaque, address: u32, value: u16) void { fn write16(ptr: *anyopaque, address: u32, value: u16) void {
const self = @ptrCast(P, @alignCast(alignment, ptr)); const self = @ptrCast(P, @alignCast(alignment, ptr));
self.write(u16, address, value); return self.write(u16, address, value);
} }
fn write32(ptr: *anyopaque, address: u32, value: u32) void { fn write32(ptr: *anyopaque, address: u32, value: u32) void {
const self = @ptrCast(P, @alignCast(alignment, ptr)); const self = @ptrCast(P, @alignCast(alignment, ptr));
self.write(u32, address, value); return self.write(u32, address, value);
}
fn reset(ptr: *anyopaque) void {
const self = @ptrCast(P, @alignCast(alignment, ptr));
self.reset();
} }
}; };
@ -105,8 +98,6 @@ pub const Bus = struct {
.write8 = impl.write8, .write8 = impl.write8,
.write16 = impl.write16, .write16 = impl.write16,
.write32 = impl.write32, .write32 = impl.write32,
.reset = impl.reset,
}, },
}; };
} }
@ -202,10 +193,6 @@ const ExampleBus = struct {
_ = value; _ = value;
_ = address; _ = address;
} }
pub fn reset(self: *@This()) void {
self._ = 0;
}
}; };
const ExampleScheduler = struct { const ExampleScheduler = struct {