Litrally almost functional PS/2 driver. #19
10
Cargo.lock
generated
10
Cargo.lock
generated
|
@ -228,12 +228,12 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hbbytecode"
|
name = "hbbytecode"
|
||||||
version = "0.1.0"
|
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]]
|
[[package]]
|
||||||
name = "hblang"
|
name = "hblang"
|
||||||
version = "0.1.0"
|
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 = [
|
dependencies = [
|
||||||
"hashbrown 0.15.1",
|
"hashbrown 0.15.1",
|
||||||
"hbbytecode",
|
"hbbytecode",
|
||||||
|
@ -245,7 +245,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hbvm"
|
name = "hbvm"
|
||||||
version = "0.1.0"
|
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 = [
|
dependencies = [
|
||||||
"hbbytecode",
|
"hbbytecode",
|
||||||
]
|
]
|
||||||
|
@ -824,9 +824,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "uart_16550"
|
name = "uart_16550"
|
||||||
version = "0.3.1"
|
version = "0.3.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4922792855b1bce30997fbaa5418597902c278a92d20dfe348e6f062c3bd861d"
|
checksum = "e492212ac378a5e00da953718dafb1340d9fbaf4f27d6f3c5cab03d931d1c049"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.6.0",
|
"bitflags 2.6.0",
|
||||||
"rustversion",
|
"rustversion",
|
||||||
|
|
|
@ -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}
|
DeviceID := struct {value: u16}
|
||||||
|
|
||||||
|
@ -63,11 +64,13 @@ initialize_controller := fn(): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ports[0].exists {
|
if ports[0].exists {
|
||||||
|
log.info("Port 1 exists.\0")
|
||||||
memory.outb(0x64, 0xAE)
|
memory.outb(0x64, 0xAE)
|
||||||
//Enables port 1.
|
//Enables port 1.
|
||||||
ports[0].command_queued = true
|
ports[0].command_queued = true
|
||||||
}
|
}
|
||||||
if ports[1].exists {
|
if ports[1].exists {
|
||||||
|
log.info("Port 2 exists.\0")
|
||||||
memory.outb(0x64, 0xA8)
|
memory.outb(0x64, 0xA8)
|
||||||
//Enables port 2.
|
//Enables port 2.
|
||||||
ports[1].command_queued = true
|
ports[1].command_queued = true
|
||||||
|
@ -75,20 +78,17 @@ initialize_controller := fn(): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
handle_input := fn(port: uint, input: u8): 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 {
|
if input == 0xAA {
|
||||||
log.info("Device rebooted!\0")
|
log.info("Device rebooted!\0")
|
||||||
|
log.info(string.display_int(@intcast(port + 1), format_page, 16))
|
||||||
ports[port].state = Recive
|
ports[port].state = Recive
|
||||||
} else if (ports[port].device.value & 15) == 0 {
|
} else if ports[port].state.value == Recive.value {
|
||||||
ports[port].device.value |= input
|
|
||||||
} else {
|
|
||||||
ports[port].device.value |= input << 4
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
main := fn(): void {
|
main := fn(): void {
|
||||||
|
format_page = memory.alloc(u8, 1024)
|
||||||
|
|
||||||
@inline(initialize_controller)
|
@inline(initialize_controller)
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
|
Loading…
Reference in a new issue