Litrally almost functional PS/2 driver. #19

Open
peony wants to merge 32 commits from peony/ableos:master into master
2 changed files with 16 additions and 16 deletions
Showing only changes of commit 08099b0877 - Show all commits

10
Cargo.lock generated
View file

@ -228,12 +228,12 @@ dependencies = [
[[package]]
name = "hbbytecode"
version = "0.1.0"
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#0d87bf8f0977fd929af28f6cd8007b603bc974bc"
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#f524013c34ff5868eadc0afdf1168239f31c7ee0"
[[package]]
name = "hblang"
version = "0.1.0"
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#0d87bf8f0977fd929af28f6cd8007b603bc974bc"
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#f524013c34ff5868eadc0afdf1168239f31c7ee0"
dependencies = [
"hashbrown 0.15.1",
"hbbytecode",
@ -245,7 +245,7 @@ dependencies = [
[[package]]
name = "hbvm"
version = "0.1.0"
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#0d87bf8f0977fd929af28f6cd8007b603bc974bc"
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#f524013c34ff5868eadc0afdf1168239f31c7ee0"
dependencies = [
"hbbytecode",
]
@ -824,9 +824,9 @@ dependencies = [
[[package]]
name = "uart_16550"
version = "0.3.1"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4922792855b1bce30997fbaa5418597902c278a92d20dfe348e6f062c3bd861d"
checksum = "e492212ac378a5e00da953718dafb1340d9fbaf4f27d6f3c5cab03d931d1c049"
dependencies = [
"bitflags 2.6.0",
"rustversion",

View file

@ -1,4 +1,5 @@
.{memory, log} := @use("../../../libraries/stn/src/lib.hb")
.{memory, log, string} := @use("../../../libraries/stn/src/lib.hb")
format_page := memory.dangling(u8)
DeviceID := struct {value: u16}
@ -63,11 +64,13 @@ initialize_controller := fn(): void {
}
if ports[0].exists {
log.info("Port 1 exists.\0")
memory.outb(0x64, 0xAE)
//Enables port 1.
ports[0].command_queued = true
}
if ports[1].exists {
log.info("Port 2 exists.\0")
memory.outb(0x64, 0xA8)
//Enables port 2.
ports[1].command_queued = true
@ -75,20 +78,17 @@ initialize_controller := fn(): void {
}
handle_input := fn(port: uint, input: u8): void {
if ports[port].state.value == Recive.value {
} else if ports[port].state.value == Reboot.value {
if input == 0xAA {
log.info("Device rebooted!\0")
ports[port].state = Recive
} else if (ports[port].device.value & 15) == 0 {
ports[port].device.value |= input
} else {
ports[port].device.value |= input << 4
}
if input == 0xAA {
log.info("Device rebooted!\0")
log.info(string.display_int(@intcast(port + 1), format_page, 16))
ports[port].state = Recive
} else if ports[port].state.value == Recive.value {
}
}
main := fn(): void {
format_page = memory.alloc(u8, 1024)
@inline(initialize_controller)
loop {