From c429641f9864887eb174fd97a86b8a862c0c429a Mon Sep 17 00:00:00 2001 From: peony Date: Sun, 1 Dec 2024 13:10:41 +0100 Subject: [PATCH] Tiny commit. --- Cargo.lock | 61 ++++++++++--------- sysdata/programs/ps2_driver/src/controller.hb | 32 ++++++---- 2 files changed, 51 insertions(+), 42 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index baaf1a605..372dc7d32 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -73,9 +73,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "cc" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" +checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc" dependencies = [ "shlex", ] @@ -201,9 +201,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.1" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" dependencies = [ "allocator-api2", "equivalent", @@ -213,12 +213,12 @@ dependencies = [ [[package]] name = "hbbytecode" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#86ca959ea3eae1cb32298e135a444820583d24a0" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#cf672beb79378fa2af529e12fd955204da443ac8" [[package]] name = "hblang" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#86ca959ea3eae1cb32298e135a444820583d24a0" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#cf672beb79378fa2af529e12fd955204da443ac8" 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#86ca959ea3eae1cb32298e135a444820583d24a0" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#cf672beb79378fa2af529e12fd955204da443ac8" dependencies = [ "hbbytecode", ] @@ -375,9 +375,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "equivalent", "hashbrown", @@ -401,7 +401,7 @@ dependencies = [ "uart_16550", "versioning", "x2apic", - "x86_64 0.15.1", + "x86_64 0.15.2", "xml", ] @@ -421,9 +421,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.164" +version = "0.2.167" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f" +checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" [[package]] name = "limine" @@ -433,9 +433,9 @@ checksum = "02034f8f6b3e7bf050f310fbaf6db0018b8e54b75598d0a4c97172054752fede" [[package]] name = "litemap" -version = "0.7.4" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" +checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" [[package]] name = "lock_api" @@ -593,9 +593,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.18" +version = "0.23.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c9cc1d47e243d655ace55ed38201c19ae02c148ae56412ab8750e8f0166ab7f" +checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" dependencies = [ "log", "once_cell", @@ -726,9 +726,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.89" +version = "2.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" +checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" dependencies = [ "proc-macro2", "quote", @@ -827,17 +827,20 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" -version = "2.10.1" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b74fc6b57825be3373f7054754755f03ac3a8f5d70015ccad699ba2029956f4a" +checksum = "b30e6f97efe1fa43535ee241ee76967d3ff6ff3953ebb430d8d55c5393029e7b" dependencies = [ "base64", + "litemap", "log", "once_cell", "rustls", "rustls-pki-types", "url", "webpki-roots", + "yoke", + "zerofrom", ] [[package]] @@ -996,7 +999,7 @@ dependencies = [ "bitflags 1.3.2", "paste", "raw-cpuid 10.7.0", - "x86_64 0.14.12", + "x86_64 0.14.13", ] [[package]] @@ -1012,9 +1015,9 @@ dependencies = [ [[package]] name = "x86_64" -version = "0.14.12" +version = "0.14.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96cb6fd45bfeab6a5055c5bffdb08768bd0c069f1d946debe585bbb380a7c062" +checksum = "c101112411baafbb4bf8d33e4c4a80ab5b02d74d2612331c61e8192fc9710491" dependencies = [ "bit_field", "bitflags 2.6.0", @@ -1024,9 +1027,9 @@ dependencies = [ [[package]] name = "x86_64" -version = "0.15.1" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bc79523af8abf92fb1a970c3e086c5a343f6bcc1a0eb890f575cbb3b45743df" +checksum = "0f042214de98141e9c8706e8192b73f56494087cc55ebec28ce10f26c5c364ae" dependencies = [ "bit_field", "bitflags 2.6.0", @@ -1044,9 +1047,9 @@ dependencies = [ [[package]] name = "yoke" -version = "0.7.5" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" dependencies = [ "serde", "stable_deref_trait", @@ -1068,9 +1071,9 @@ dependencies = [ [[package]] name = "zerofrom" -version = "0.1.5" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" +checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" dependencies = [ "zerofrom-derive", ] diff --git a/sysdata/programs/ps2_driver/src/controller.hb b/sysdata/programs/ps2_driver/src/controller.hb index 029fdd275..c7767dbe3 100644 --- a/sysdata/programs/ps2_driver/src/controller.hb +++ b/sysdata/programs/ps2_driver/src/controller.hb @@ -5,34 +5,38 @@ port1 := @as(Port, PORT_AT_STARTUP) port2 := @as(Port, PORT_AT_STARTUP) -$disable_port1 := fn(): void memory.outb(0x64, 0xAD) -$enable_port1 := fn(): void memory.outb(0x64, 0xAE) -$disable_port2 := fn(): void memory.outb(0x64, 0xA7) -$enable_port2 := fn(): void memory.outb(0x64, 0xA8) +//wiki.osdev.org/"8042"_PS/2_Controller#PS/2_Controller_IO_Ports +$CONTROLLER_PORT := 0x64 +$DATA_PORT := 0x60n + +$disable_port1 := fn(): void memory.outb(CONTROLLER_PORT, 0xAD) +$enable_port1 := fn(): void memory.outb(CONTROLLER_PORT, 0xAE) +$disable_port2 := fn(): void memory.outb(CONTROLLER_PORT, 0xA7) +$enable_port2 := fn(): void memory.outb(CONTROLLER_PORT, 0xA8) test_port1 := fn(): bool { - memory.outb(0x64, 0xAB) + memory.outb(CONTROLLER_PORT, 0xAB) loop if has_input(get_info()) break input := get_input() return input == 0x0 } test_port2 := fn(): bool { - memory.outb(0x64, 0xA9) + memory.outb(CONTROLLER_PORT, 0xA9) loop if has_input(get_info()) break input := get_input() return input == 0x0 } get_config_byte := fn(): u8 { - memory.outb(0x64, 0x20) + memory.outb(CONTROLLER_PORT, 0x20) loop if has_input(get_info()) break return get_input() } Info := struct {d: u8} -$get_info := fn(): Info return .(memory.inb(0x64)) +$get_info := fn(): Info return .(memory.inb(CONTROLLER_PORT)) //inline when can has_input := fn(info: Info): bool return bit0(info.d) can_send := fn(info: Info): bool return bit1(info.d) == false @@ -46,16 +50,18 @@ get_port := fn(info: Info): ^Port { } } +//T +port2_ptr := &port2 send_byte := fn(port: ^Port, byte: u8): void { - if port == &port2 { - memory.outb(0x64, 0xD4) + if port == port2_ptr { + memory.outb(CONTROLLER_PORT, 0xD4) } loop if can_send(get_info()) break - memory.outb(0x60, byte) + memory.outb(DATA_PORT, byte) } -$get_input := fn(): u8 return memory.inb(0x60) -$write_out := fn(data: u8): void memory.outb(0x60, data) +$get_input := fn(): u8 return memory.inb(DATA_PORT) +$write_out := fn(data: u8): void memory.outb(DATA_PORT, data) flush_input := fn(): void { loop if has_input(get_info()) == false break else get_info()