diff --git a/sysdata/libraries/pci/README.md b/sysdata/libraries/pci/README.md new file mode 100644 index 00000000..fadc21bf --- /dev/null +++ b/sysdata/libraries/pci/README.md @@ -0,0 +1 @@ +# pci \ No newline at end of file diff --git a/sysdata/libraries/pci/src/lib.hb b/sysdata/libraries/pci/src/lib.hb new file mode 100644 index 00000000..54fb294b --- /dev/null +++ b/sysdata/libraries/pci/src/lib.hb @@ -0,0 +1,25 @@ +PCIAddress := struct { + bus: u8, + device: u8, + function: u8, +} + +find_device := fn(vendor_id: int, device_id: int, pci_address: PCIAddress): int { + return 1 +} + +scan_bus := fn(): void { +} + +config_read32 := fn(bus: u32, device: u32, func: u32, offset: u32): u32 { + // construct address param + address := bus << 16 | device << 11 | func << 8 | offset & 0xFC | 0x80000000 + + // write address + //Port::new(0xCF8).write(address); + + // read data + //Port::new(0xCFC).read() + + return +} \ No newline at end of file diff --git a/sysdata/programs/horizon_testing_program/src/main.hb b/sysdata/programs/horizon_testing_program/src/main.hb index b04a7fcb..01d57a3c 100644 --- a/sysdata/programs/horizon_testing_program/src/main.hb +++ b/sysdata/programs/horizon_testing_program/src/main.hb @@ -25,7 +25,6 @@ main := fn(): int { instance := ignim.instance.void_instance() - // TODO: recursively follow this https://vulkan-tutorial.com/Drawing_a_triangle/Setup/Instance ret := ignim.instance.create_instance(&create_info, 0, &instance) if ret == errors.IncompatibleDriver { diff --git a/sysdata/programs/svga_driver/README.md b/sysdata/programs/svga_driver/README.md new file mode 100644 index 00000000..0a996d96 --- /dev/null +++ b/sysdata/programs/svga_driver/README.md @@ -0,0 +1 @@ +# svga_driver \ No newline at end of file diff --git a/sysdata/programs/svga_driver/meta.toml b/sysdata/programs/svga_driver/meta.toml new file mode 100644 index 00000000..3748bd50 --- /dev/null +++ b/sysdata/programs/svga_driver/meta.toml @@ -0,0 +1,11 @@ +[package] +name = "svga_driver" +authors = ["able"] + +[dependants.libraries] + +[dependants.binaries] +hblang.version = "1.0.0" + +[build] +command = "hblang src/main.hb" diff --git a/sysdata/programs/svga_driver/src/device.hb b/sysdata/programs/svga_driver/src/device.hb new file mode 100644 index 00000000..dd697e9d --- /dev/null +++ b/sysdata/programs/svga_driver/src/device.hb @@ -0,0 +1,41 @@ +pci := @use("../../../libraries/pci/src/lib.hb"); +.{PCIAddress} := pci + +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, +} + +svga_device := fn(): SVGADevice { + pci_addr := PCIAddress.(0, 0, 0) + + return SVGADevice.(pci_addr, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) +} + +/* + struct { + uint32 reservedSize; + Bool usingBounceBuffer; + uint8 bounceBuffer[1024 * 1024]; + uint32 nextFence; + } fifo; + + volatile struct { + uint32 pending; + uint32 switchContext; + IntrContext oldContext; + IntrContext newContext; + uint32 count; + } irq; +*/ \ No newline at end of file diff --git a/sysdata/programs/svga_driver/src/main.hb b/sysdata/programs/svga_driver/src/main.hb new file mode 100644 index 00000000..34a9f1e8 --- /dev/null +++ b/sysdata/programs/svga_driver/src/main.hb @@ -0,0 +1,28 @@ +device := @use("rel:device.hb") +pci := @use("../../../libraries/pci/src/lib.hb") + +stn := @use("../../../libraries/stn/src/lib.hb"); +.{string, memory, buffer, log} := stn + +PCI_VENDOR_ID_VMWARE := 0x15AD +PCI_DEVICE_ID_VMWARE_SVGA2 := 0x405 + +init := fn(): void { + svga_struct := device.svga_device() + + if pci.find_device(PCI_VENDOR_ID_VMWARE, PCI_DEVICE_ID_VMWARE_SVGA2, svga_struct.pciAddr) { + log.error("No VMware SVGA device found.\0") + } + return +} + +SVGA_Disable := fn(): void { + //SVGA_WriteReg(SVGA_REG_ENABLE, 0); + return +} + +main := fn(): int { + init() + + return 0 +} \ No newline at end of file diff --git a/sysdata/system_config.toml b/sysdata/system_config.toml index d45fe5b1..cee2db58 100644 --- a/sysdata/system_config.toml +++ b/sysdata/system_config.toml @@ -26,20 +26,24 @@ resolution = "1024x768x24" # [boot.limine.ableos.modules.diskio_driver] # path = "boot:///diskio_driver.hbf" -[boot.limine.ableos.modules.fb_driver] -path = "boot:///fb_driver.hbf" +# [boot.limine.ableos.modules.fb_driver] +# path = "boot:///fb_driver.hbf" # [boot.limine.ableos.modules.serial_driver_test] # path = "boot:///serial_driver_test.hbf" -[boot.limine.ableos.modules.horizon] -path = "boot:///horizon.hbf" +# [boot.limine.ableos.modules.horizon] +# path = "boot:///horizon.hbf" -[boot.limine.ableos.modules.horizon_testing_program] -path = "boot:///horizon_testing_program.hbf" +# [boot.limine.ableos.modules.horizon_testing_program] +# path = "boot:///horizon_testing_program.hbf" # [boot.limine.ableos.modules.dt_buffer_test] # path = "boot:///dt_buffer_test.hbf" + + +[boot.limine.ableos.modules.svga_driver] +path = "boot:///svga_driver.hbf"