akern-gkgoat-fork/sysdata/programs/ps2_driver/src/main.hb

39 lines
848 B
Plaintext
Raw Normal View History

2024-11-17 10:57:06 -06:00
.{memory, log, string} := @use("../../../libraries/stn/src/lib.hb");
.{Mouse3Button} := @use("devices.hb")
2024-11-17 04:17:32 -06:00
controller := @use("controller.hb")
2024-11-15 13:47:11 -06:00
format_page := memory.dangling(u8)
2024-11-10 14:24:19 -06:00
2024-11-17 10:57:06 -06:00
info := controller.Info.(0)
2024-11-17 12:11:13 -06:00
process := fn(port: ^controller.Port): void {
2024-11-17 10:57:06 -06:00
}
check_complete := fn(port: ^controller.Port): bool {
}
2024-11-10 14:24:19 -06:00
main := fn(): void {
2024-11-15 13:47:11 -06:00
format_page = memory.alloc(u8, 1024)
2024-11-17 04:17:32 -06:00
controller.init()
2024-11-17 10:57:06 -06:00
loop {
info = controller.get_info()
if controller.timed_out(info) {
log.error("Timeout error! Cannot handle these!\0")
}
if controller.check_parity(info) {
log.error("Parity error! Cannot handle these!\0")
}
if controller.has_input(info) {
port := controller.get_port(info)
port.packet[port.packet_length] = controller.get_input()
port.packet_length += 1
if @inline(check_complete, port) {
process(port)
}
}
}
2024-11-10 14:24:19 -06:00
}