mirror of
https://github.com/rdmsr/zag.git
synced 2026-10-29 14:38:21 +00:00
feat(pl/pc): add APIC timer support
This commit is contained in:
+16
-4
@@ -1,8 +1,13 @@
|
||||
const std = @import("std");
|
||||
const b = @import("root");
|
||||
const pl = b.pl;
|
||||
const ke = b.ke;
|
||||
const mm = b.mm;
|
||||
const r = @import("root");
|
||||
const pl = r.pl;
|
||||
const ke = r.ke;
|
||||
const mm = r.mm;
|
||||
const amd64 = @import("arch");
|
||||
|
||||
fn callback(_: ?*anyopaque) void {
|
||||
std.log.info("Timer callback called", .{});
|
||||
}
|
||||
|
||||
pub fn init(boot_info: *pl.BootInfo) void {
|
||||
mm.init(boot_info);
|
||||
@@ -10,6 +15,13 @@ pub fn init(boot_info: *pl.BootInfo) void {
|
||||
pl.late_init(boot_info);
|
||||
ke.sched.late_init();
|
||||
|
||||
var timer: ke.Timer = undefined;
|
||||
var dpc: ke.Dpc = .init(callback);
|
||||
|
||||
timer.init();
|
||||
|
||||
ke.timer.set(&timer, std.time.ns_per_ms * 50, &dpc);
|
||||
|
||||
while (true) {
|
||||
std.atomic.spinLoopHint();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user