ableos/sysdata/programs/svga_driver/src/device.hb
2024-09-17 12:08:19 -05:00

54 lines
1,014 B
Plaintext

stn := @use("../../../libraries/stn/src/lib.hb");
.{string, memory, buffer, log} := stn
pci := @use("../../../libraries/pci/src/lib.hb");
.{PCIAddress} := pci
FIFO := struct {
reserved_size: u32,
using_bounce_buffer: u8,
//bounce_buffer: [u8; 1024 * 1024],
next_fence: u32,
}
new_fifo := fn(): FIFO {
//bounce_buffer := @as([u8; 1024 * 1024], idk)
/*bounce_buffer,*/
return FIFO.(0, 0, 0)
}
IRQ := struct {
pending: u32,
switchContext: u32,
//IntrContext oldContext;
//IntrContext newContext;
count: u32,
}
new_irq := fn(): IRQ {
return IRQ.(0, 0, 0)
}
SVGADevice := struct {
pciAddr: PCIAddress,
ioBase: u32,
fifoMem: ^u32,
fbMem: ^u8,
fifoSize: int,
fbSize: int,
vramSize: int,
deviceVersionId: int,
capabilities: int,
width: int,
height: int,
bpp: int,
pitch: int,
fifo: FIFO,
irq: IRQ,
}
svga_device := fn(): SVGADevice {
pci_addr := PCIAddress.(0, 0, 0)
fifo := new_fifo()
irq := new_irq()
return SVGADevice.(pci_addr, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, fifo, irq)
}