|
|
@ -33,10 +33,15 @@ const driver = struct {
|
|
|
|
self.lld.initialize(freq);
|
|
|
|
self.lld.initialize(freq);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn ticks(self: driver) u32 {
|
|
|
|
pub fn count(self: driver) u32 {
|
|
|
|
_ = self;
|
|
|
|
_ = self;
|
|
|
|
return @atomicLoad(u32, &ticks_raw, .acquire);
|
|
|
|
return @atomicLoad(u32, &ticks_raw, .acquire);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn delay(self: driver, ticks: u32) void {
|
|
|
|
|
|
|
|
const now = self.count();
|
|
|
|
|
|
|
|
while (self.count() - now < ticks) {}
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
pub const systick = driver { .lld = @ptrFromInt(0xE000E010) };
|
|
|
|
pub const systick = driver { .lld = @ptrFromInt(0xE000E010) };
|
|
|
|