9#ifndef MAX_OS_HARDWARECOMMUNICATION_PCI_H
10#define MAX_OS_HARDWARECOMMUNICATION_PCI_H
21namespace MaxOS::hardwarecommunication {
80 [[nodiscard]]
string get_type()
const;
95 uint32_t read(uint16_t bus, uint16_t device, uint16_t function, uint32_t register_offset);
96 void write(uint16_t bus, uint16_t device, uint16_t function, uint32_t register_offset, uint32_t value);
99 PCIDeviceDescriptor get_device_descriptor(uint16_t bus, uint16_t device, uint16_t function);
100 BaseAddressRegister get_base_address_register(uint16_t bus, uint16_t device, uint16_t function, uint16_t bar);
101 bool device_has_functions(uint16_t bus, uint16_t device);
Event handler for the DriverSelector class, handles the event when a driver is selected.
Selects the drivers to be used.
base class for all drivers, handles the activation, deactivation, initialisation and reset of the dri...
Used to store the Base Address Register (BAR) of a PCI device.
bool pre_fetchable
Reading from this address wont change the state of the device and data can be cached by the CPU.
uint8_t * address
The address of the device (IO port or memory address, can be 32 or 64 bit)
BARType type
Where to access the device.
Handles the selecting and loading of drivers for PCI devices.
static void list_known_device(const PCIDeviceDescriptor &dev)
Print the vednor and device id of known devices, or "Unknown" + their ids if not known.
PCIController()
Construct a new PCI Controller object.
static drivers::Driver * get_driver(PCIDeviceDescriptor dev)
Get the driver for the device.
void select_drivers(drivers::DriverSelectorEventHandler *handler) override
Select the driver for the device.
Stores information about a PCI device.
bool has_memory_base
Whether the device has a memory base address.
bool has_port_base
Whether the device has an IO port base address.
uint16_t device
The device number on the PCI bus.
uint8_t class_id
The class type of the device.
uint32_t interrupt
The interrupt number the device uses to communicate with the CPU.
uint8_t revision
The device version number.
uint32_t memory_base
The memory base address.
uint16_t device_id
The device's unique identifier.
uint32_t port_base
The IO port base address.
uint8_t subclass_id
The subclass type of the device.
uint16_t bus
The PCI bus the device is connected to.
string get_type() const
Get the type of the device.
uint16_t function
The function number of the device.
uint8_t interface_id
The interface type of the device.
uint16_t vendor_id
The company's that made the device unique identifier.
Defines a base Driver class and DriverManager for managing drivers.
Defines a InterruptManager and InterruptHandler for managing hardware and software interrupts.
Defines a MemoryManager class for handling memory allocation and deallocation.
BARType
Determines whether the PCI device communicates via IO ports or memory.
Defines classes for handling hardware communication ports (8, 16, and 32 bit)
Defines a String class for dynamically sized strings with various operations.
Defines a Video Graphics Array (VGA) driver for rendering graphics to the screen.