forked from AbleOS/ableos
minor sketch work for ata
This commit is contained in:
parent
82b9cb1206
commit
559f25bb4e
|
@ -1,4 +1,6 @@
|
||||||
.{memory, buffer} := @use("../../../libraries/stn/src/lib.hb")
|
.{memory, buffer, log} := @use("../../../libraries/stn/src/lib.hb")
|
||||||
|
|
||||||
|
// Influenced by https://github.com/levex/osdev/blob/master/drivers/ata.c
|
||||||
|
|
||||||
main := fn(): int {
|
main := fn(): int {
|
||||||
// shuts down ableOS
|
// shuts down ableOS
|
||||||
|
@ -7,7 +9,53 @@ main := fn(): int {
|
||||||
a := memory.inb(0x4600)
|
a := memory.inb(0x4600)
|
||||||
b := memory.inb(0x4700)
|
b := memory.inb(0x4700)
|
||||||
|
|
||||||
c := buffer.search("XNumber\0")
|
// c := buffer.search("XNumber\0")
|
||||||
|
ata := ATA.new()
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ATA_PRIMARY := @as(u8, @intcast(0x0))
|
||||||
|
ATA_PRIMARY_IO := @as(u8, @intcast(0x1F0))
|
||||||
|
ATA_REG_HDDEVSEL := @as(u8, @intcast(0x6))
|
||||||
|
|
||||||
|
ATA_MASTER := @as(u8, @intcast(0x0))
|
||||||
|
IDE := struct {}
|
||||||
|
|
||||||
|
ide_select_drive := fn(bus: u8, i: u8): void {
|
||||||
|
if bus == ATA_PRIMARY {
|
||||||
|
if i == ATA_MASTER {
|
||||||
|
// BUG: Causes qemu to crash
|
||||||
|
// memory.outb(ATA_PRIMARY_IO + ATA_REG_HDDEVSEL, 0xA0)
|
||||||
|
} else {
|
||||||
|
// outportb(ATA_PRIMARY_IO + ATA_REG_HDDEVSEL, 0xB0);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if i == ATA_MASTER {
|
||||||
|
// outportb(ATA_SECONDARY_IO + ATA_REG_HDDEVSEL, 0xA0);
|
||||||
|
} else {
|
||||||
|
// outportb(ATA_SECONDARY_IO + ATA_REG_HDDEVSEL, 0xB0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
identify := fn(bus: u8, drive: u8): bool {
|
||||||
|
io := 0
|
||||||
|
|
||||||
|
ide_select_drive(bus, drive)
|
||||||
|
if bus == ATA_PRIMARY {
|
||||||
|
io = ATA_PRIMARY_IO
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
ata_probe := fn(): void {
|
||||||
|
if identify(ATA_PRIMARY, ATA_MASTER) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ATA := struct {
|
||||||
|
new := fn(): void {
|
||||||
|
ata_probe()
|
||||||
|
}
|
||||||
|
}
|
|
@ -25,8 +25,8 @@ resolution = "1024x768x24"
|
||||||
# [boot.limine.ableos.modules.render_example]
|
# [boot.limine.ableos.modules.render_example]
|
||||||
# path = "boot:///render_example.hbf"
|
# path = "boot:///render_example.hbf"
|
||||||
|
|
||||||
# [boot.limine.ableos.modules.horizon]
|
[boot.limine.ableos.modules.diskio_driver]
|
||||||
# path = "boot:///horizon.hbf"
|
path = "boot:///diskio_driver.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"
|
||||||
|
|
Loading…
Reference in a new issue