From f7f9fece4f8ae764b7d9f24d232280b81da2526a Mon Sep 17 00:00:00 2001 From: peony Date: Sun, 24 Nov 2024 13:31:57 +0100 Subject: [PATCH] Merged once more --- Cargo.lock | 50 ++++++++++++------------- sysdata/programs/ps2_driver/src/main.hb | 26 ++++++++----- 2 files changed, 42 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2f07974b..838bfd42 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -213,12 +213,12 @@ dependencies = [ [[package]] name = "hbbytecode" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#37dd13cab295aa9e74d704b3345685b4428d149a" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#9dfb2eb606e9049bc5d372e674a75e0be2c57ff0" [[package]] name = "hblang" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#37dd13cab295aa9e74d704b3345685b4428d149a" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#9dfb2eb606e9049bc5d372e674a75e0be2c57ff0" dependencies = [ "hashbrown", "hbbytecode", @@ -229,7 +229,7 @@ dependencies = [ [[package]] name = "hbvm" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#37dd13cab295aa9e74d704b3345685b4428d149a" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#9dfb2eb606e9049bc5d372e674a75e0be2c57ff0" dependencies = [ "hbbytecode", ] @@ -424,9 +424,9 @@ checksum = "02034f8f6b3e7bf050f310fbaf6db0018b8e54b75598d0a4c97172054752fede" [[package]] name = "litemap" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" [[package]] name = "lock_api" @@ -503,9 +503,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "proc-macro2" -version = "1.0.89" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -584,9 +584,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.17" +version = "0.23.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f1a745511c54ba6d4465e8d5dfbd81b45791756de28d4981af70d6dca128f1e" +checksum = "9c9cc1d47e243d655ace55ed38201c19ae02c148ae56412ab8750e8f0166ab7f" dependencies = [ "log", "once_cell", @@ -717,9 +717,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.87" +version = "2.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" +checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" dependencies = [ "proc-macro2", "quote", @@ -800,9 +800,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] name = "unicode-xid" @@ -833,9 +833,9 @@ dependencies = [ [[package]] name = "url" -version = "2.5.3" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d157f1b96d14500ffdc1f10ba712e780825526c03d9a49b4d0324b0d9113ada" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", "idna", @@ -876,9 +876,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "webpki-roots" -version = "0.26.6" +version = "0.26.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" +checksum = "5d642ff16b7e79272ae451b7322067cdc17cadf68c23264be9d94a32319efe7e" dependencies = [ "rustls-pki-types", ] @@ -1035,9 +1035,9 @@ dependencies = [ [[package]] name = "yoke" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" dependencies = [ "serde", "stable_deref_trait", @@ -1047,9 +1047,9 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", @@ -1059,18 +1059,18 @@ dependencies = [ [[package]] name = "zerofrom" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" dependencies = [ "zerofrom-derive", ] [[package]] name = "zerofrom-derive" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", diff --git a/sysdata/programs/ps2_driver/src/main.hb b/sysdata/programs/ps2_driver/src/main.hb index d2289c50..edca6d41 100644 --- a/sysdata/programs/ps2_driver/src/main.hb +++ b/sysdata/programs/ps2_driver/src/main.hb @@ -2,15 +2,16 @@ .{MouseEvent} := @use("../../../libraries/intouch/src/lib.hb").events; .{bit0, bit1, bit2, bit3, bit4} := @use("bits.hb") devices := @use("devices.hb") -controller := @use("controller.hb") +controller := @use("controller.hb"); +.{Info, Port} := controller mouse := @use("mouse.hb") format_page := memory.dangling(u8) mouse_buffer := 0 keyboard_buffer := 0 -info := controller.Info.(0) +info := Info.(0) -send_command := fn(port: ^controller.Port, byte: u8): void { +send_command := fn(port: ^Port, byte: u8): void { tries := 3 loop if tries == 0 break else { controller.send_byte(port, byte) @@ -37,6 +38,10 @@ send_command := fn(port: ^controller.Port, byte: u8): void { } } +enable_streaming := fn(port: ^Port): void { + @inline(send_command, port, 0xF4) +} + process := fn(port: ^controller.Port): void { if port.device.value < devices.MOUSE_5_BUTTON.value { event := MouseEvent.(0, 0, false, false, false) @@ -52,7 +57,7 @@ process := fn(port: ^controller.Port): void { } else if port.device == devices.MOUSE_INIT_1 { port.device.value = port.packet[0] if port.device != devices.MOUSE_SCROLLWHEEL { - controller.send_byte(port, 0xF4) + enable_streaming(port) return } port.device = devices.MOUSE_INIT_2 @@ -61,9 +66,11 @@ process := fn(port: ^controller.Port): void { } else if port.device == devices.NO_DEVICE { if port.packet_length == 1 { port.device.value = port.packet[0] + enable_streaming(port) + //TODO: Upgrade mouse. } else { port.device.value = port.packet[1] | port.packet[0] << 8 - send_command(port, 0xF4) + enable_streaming(port) } log.info("Identified device!\0") log.info(string.display_int(port.device.value, format_page, 16)) @@ -107,10 +114,11 @@ main := fn(): void { controller.init() if controller.port1.exists { - controller.send_byte(&controller.port1, 0xF4) + //log.info("Port 1 exists.\0") + controller.send_byte(@bitcast(0), 0xF4) } if controller.port2.exists { - controller.send_byte(&controller.port2, 0xF4) + //controller.send_byte(&controller.port2, 0xF4) } loop { @@ -122,7 +130,7 @@ main := fn(): void { if controller.check_parity(info) { log.error("Parity error! Cannot handle these!\0") } - + /* if controller.has_input(info) { port := controller.get_port(info) if port.packet_length > 0 & check_complete(port) { @@ -139,6 +147,6 @@ main := fn(): void { process(port) port.packet_length = 0 } - } + }*/ } } \ No newline at end of file