Driver workkkk
This commit is contained in:
parent
cf37eaf086
commit
23b45b1887
6
Cargo.lock
generated
6
Cargo.lock
generated
|
@ -213,12 +213,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#12bb7029b4bafd1edff77ed9a12888374cc7f8be"
|
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#397b2a4b1b7c088f379f32d846e235c1286e17e0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hblang"
|
name = "hblang"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#12bb7029b4bafd1edff77ed9a12888374cc7f8be"
|
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#397b2a4b1b7c088f379f32d846e235c1286e17e0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
"hbbytecode",
|
"hbbytecode",
|
||||||
|
@ -229,7 +229,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#12bb7029b4bafd1edff77ed9a12888374cc7f8be"
|
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#397b2a4b1b7c088f379f32d846e235c1286e17e0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hbbytecode",
|
"hbbytecode",
|
||||||
]
|
]
|
||||||
|
|
|
@ -10,3 +10,4 @@ Anyone who works on this should work to keep this list as small as possible/remo
|
||||||
- Both PS/2 ports being broken doesn't need handling.
|
- Both PS/2 ports being broken doesn't need handling.
|
||||||
- One PS/2 port being broken doesn't need special attention.
|
- One PS/2 port being broken doesn't need special attention.
|
||||||
- PS/2 controller doesn't need to perform a self-check.
|
- PS/2 controller doesn't need to perform a self-check.
|
||||||
|
- Stack overflows aren't a thing
|
|
@ -1,5 +1,5 @@
|
||||||
.{memory, log} := @use("../../../libraries/stn/src/lib.hb");
|
.{memory, log} := @use("../../../libraries/stn/src/lib.hb");
|
||||||
.{bit0, bit5, bit6, bit7} := @use("bits.hb");
|
.{bit0, bit1, bit5, bit6, bit7} := @use("bits.hb");
|
||||||
.{Port, port_at_startup} := @use("port.hb")
|
.{Port, port_at_startup} := @use("port.hb")
|
||||||
|
|
||||||
$disable_port1 := fn(): void memory.outb(0x64, 0xAD)
|
$disable_port1 := fn(): void memory.outb(0x64, 0xAD)
|
||||||
|
@ -29,10 +29,12 @@ get_config_byte := fn(): u8 {
|
||||||
|
|
||||||
Info := struct {d: u8}
|
Info := struct {d: u8}
|
||||||
|
|
||||||
$get_info := fn(): u8 return .(memory.inb(0x64))
|
$get_info := fn(): Info return .(memory.inb(0x64))
|
||||||
$has_input := fn(info: Info): bool return bit0(info.d)
|
//inline when can
|
||||||
$timed_out := fn(info: Info): bool return bit6(info.d)
|
has_input := fn(info: Info): bool return bit0(info.d)
|
||||||
$check_parity := fn(info: Info): bool return bit7(info.d)
|
can_send := fn(info: Info): bool return bit1(info.d) == false
|
||||||
|
timed_out := fn(info: Info): bool return bit6(info.d)
|
||||||
|
check_parity := fn(info: Info): bool return bit7(info.d)
|
||||||
get_port := fn(info: Info): ^Port {
|
get_port := fn(info: Info): ^Port {
|
||||||
if bit5(info.d) {
|
if bit5(info.d) {
|
||||||
return &port2
|
return &port2
|
||||||
|
@ -41,6 +43,14 @@ get_port := fn(info: Info): ^Port {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
send_byte := fn(port: ^Port, byte: u8): void {
|
||||||
|
if port == port2 {
|
||||||
|
memory.outb(0x64, 0xD4)
|
||||||
|
}
|
||||||
|
loop if can_send(get_info()) break
|
||||||
|
memory.outb(0x60, byte)
|
||||||
|
}
|
||||||
|
|
||||||
$get_input := fn(): u8 return memory.inb(0x60)
|
$get_input := fn(): u8 return memory.inb(0x60)
|
||||||
$write_out := fn(data: u8): void memory.outb(0x60, data)
|
$write_out := fn(data: u8): void memory.outb(0x60, data)
|
||||||
|
|
||||||
|
@ -77,11 +87,9 @@ init := fn(): void {
|
||||||
if port1.exists {
|
if port1.exists {
|
||||||
log.info("Port 1 exists.\0")
|
log.info("Port 1 exists.\0")
|
||||||
enable_port1()
|
enable_port1()
|
||||||
port1.commands.length = 1
|
|
||||||
}
|
}
|
||||||
if port2.exists {
|
if port2.exists {
|
||||||
log.info("Port 2 exists.\0")
|
log.info("Port 2 exists.\0")
|
||||||
enable_port2()
|
enable_port2()
|
||||||
port2.commands.length = 1
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,38 @@
|
||||||
.{memory, log, string} := @use("../../../libraries/stn/src/lib.hb")
|
.{memory, log, string} := @use("../../../libraries/stn/src/lib.hb");
|
||||||
|
.{Mouse3Button} := @use("devices.hb")
|
||||||
controller := @use("controller.hb")
|
controller := @use("controller.hb")
|
||||||
format_page := memory.dangling(u8)
|
format_page := memory.dangling(u8)
|
||||||
|
|
||||||
|
info := controller.Info.(0)
|
||||||
|
|
||||||
|
process := fn(port: ^controller.Port): bool {
|
||||||
|
}
|
||||||
|
|
||||||
|
check_complete := fn(port: ^controller.Port): bool {
|
||||||
|
}
|
||||||
|
|
||||||
main := fn(): void {
|
main := fn(): void {
|
||||||
format_page = memory.alloc(u8, 1024)
|
format_page = memory.alloc(u8, 1024)
|
||||||
|
|
||||||
controller.init()
|
controller.init()
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,20 +1,19 @@
|
||||||
.{DeviceID, NoDevice} := @use("devices.hb")
|
.{DeviceID, NoDevice} := @use("devices.hb")
|
||||||
|
|
||||||
State := struct {s: u8}
|
State := struct {s: u8}
|
||||||
$Reboot := State.(0)
|
$Recive := State.(0)
|
||||||
|
$Reboot := State.(1)
|
||||||
CommandQueue := packed struct {queue: [u8; 8], length: u8, current_index: u8}
|
|
||||||
|
|
||||||
Port := packed struct {
|
Port := packed struct {
|
||||||
exists: bool,
|
exists: bool,
|
||||||
device: DeviceID,
|
device: DeviceID,
|
||||||
commands: CommandQueue,
|
packet: [u8; 4],
|
||||||
state: State,
|
packet_length: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
$port_at_startup := Port.(
|
$port_at_startup := Port.(
|
||||||
true,
|
true,
|
||||||
NoDevice,
|
NoDevice,
|
||||||
.(.(0xFF, 0, 0, 0, 0, 0, 0, 0), 1, 0),
|
.(0, 0, 0, 0),
|
||||||
Reboot,
|
0,
|
||||||
)
|
)
|
|
@ -28,8 +28,8 @@ resolution = "1024x768x24"
|
||||||
# [boot.limine.ableos.modules.horizon]
|
# [boot.limine.ableos.modules.horizon]
|
||||||
# path = "boot:///horizon.hbf"
|
# path = "boot:///horizon.hbf"
|
||||||
|
|
||||||
[boot.limine.ableos.modules.ps2_mouse_driver]
|
# [boot.limine.ableos.modules.ps2_mouse_driver]
|
||||||
path = "boot:///ps2_mouse_driver.hbf"
|
# path = "boot:///ps2_mouse_driver.hbf"
|
||||||
|
|
||||||
# [boot.limine.ableos.modules.ps2_keyboard_driver]
|
# [boot.limine.ableos.modules.ps2_keyboard_driver]
|
||||||
# path = "boot:///ps2_keyboard_driver.hbf"
|
# path = "boot:///ps2_keyboard_driver.hbf"
|
||||||
|
|
Loading…
Reference in a new issue