Max OS 0.3
Loading...
Searching...
No Matches
MaxOS::hardwarecommunication::PCIDeviceDescriptor Class Reference

Stores information about a PCI device. More...

#include <pci.h>

Public Member Functions

string get_type () const
 Get the type of the device.
 

Public Attributes

bool has_port_base = false
 Whether the device has an IO port base address.
 
uint32_t port_base = 0
 The IO port base address.
 
bool has_memory_base = false
 Whether the device has a memory base address.
 
uint32_t memory_base = 0
 The memory base address.
 
uint32_t interrupt = 0
 The interrupt number the device uses to communicate with the CPU.
 
uint16_t bus = 0
 The PCI bus the device is connected to.
 
uint16_t device = 0
 The device number on the PCI bus.
 
uint16_t function = 0
 The function number of the device.
 
uint16_t vendor_id = 0
 The company's that made the device unique identifier.
 
uint16_t device_id = 0
 The device's unique identifier.
 
uint8_t class_id = 0
 The class type of the device.
 
uint8_t subclass_id = 0
 The subclass type of the device.
 
uint8_t interface_id = 0
 The interface type of the device.
 
uint8_t revision = 0
 The device version number.
 

Detailed Description

Stores information about a PCI device.

Todo:
Should be a struct aswell

Definition at line 54 of file pci.h.

Member Function Documentation

◆ get_type()

string PCIDeviceDescriptor::get_type ( ) const

Get the type of the device.

Todo:
See wiki for more types to add
Returns
Type of the device as a string (or Unknown if the type is not known)

Definition at line 37 of file pci.cpp.

37 {
38
39 switch (class_id) {
40 case 0x00:
41 return (subclass_id == 0x01) ? "VGA" : "Legacy";
42 case 0x01:
43 switch (subclass_id) {
44 case 0x01:
45 return "IDE interface";
46 case 0x06:
47 return "SATA controller";
48 default:
49 return "Storage";
50 }
51 case 0x02:
52 return "Network";
53 case 0x03:
54 return "Display";
55 case 0x04:
56 switch (subclass_id) {
57 case 0x00:
58 return "Video";
59 case 0x01:
60 case 0x03:
61 return "Audio";
62 default:
63 return "Multimedia";
64 }
65 case 0x06:
66 switch (subclass_id) {
67 case 0x00:
68 return "Host bridge";
69 case 0x01:
70 return "ISA bridge";
71 case 0x04:
72 return "PCI bridge";
73 default:
74 return "Bridge";
75 }
76 case 0x07:
77 switch (subclass_id) {
78 case 0x00:
79 return "Serial controller";
80 case 0x80:
81 return "Communication controller";
82 }
83 break;
84 case 0x0C:
85 switch (subclass_id) {
86 case 0x03:
87 return "USB";
88 case 0x05:
89 return "System Management Bus";
90 }
91 break;
92 }
93 return "Unknown";
94}
uint8_t class_id
The class type of the device.
Definition pci.h:71
uint8_t subclass_id
The subclass type of the device.
Definition pci.h:72

References class_id, and subclass_id.

Member Data Documentation

◆ bus

uint16_t MaxOS::hardwarecommunication::PCIDeviceDescriptor::bus = 0

The PCI bus the device is connected to.

Definition at line 64 of file pci.h.

◆ class_id

uint8_t MaxOS::hardwarecommunication::PCIDeviceDescriptor::class_id = 0

The class type of the device.

Definition at line 71 of file pci.h.

Referenced by get_type().

◆ device

uint16_t MaxOS::hardwarecommunication::PCIDeviceDescriptor::device = 0

The device number on the PCI bus.

Definition at line 65 of file pci.h.

◆ device_id

uint16_t MaxOS::hardwarecommunication::PCIDeviceDescriptor::device_id = 0

The device's unique identifier.

Definition at line 69 of file pci.h.

◆ function

uint16_t MaxOS::hardwarecommunication::PCIDeviceDescriptor::function = 0

The function number of the device.

Definition at line 66 of file pci.h.

◆ has_memory_base

bool MaxOS::hardwarecommunication::PCIDeviceDescriptor::has_memory_base = false

Whether the device has a memory base address.

Definition at line 59 of file pci.h.

◆ has_port_base

bool MaxOS::hardwarecommunication::PCIDeviceDescriptor::has_port_base = false

Whether the device has an IO port base address.

Definition at line 56 of file pci.h.

◆ interface_id

uint8_t MaxOS::hardwarecommunication::PCIDeviceDescriptor::interface_id = 0

The interface type of the device.

Definition at line 73 of file pci.h.

◆ interrupt

uint32_t MaxOS::hardwarecommunication::PCIDeviceDescriptor::interrupt = 0

The interrupt number the device uses to communicate with the CPU.

Definition at line 62 of file pci.h.

◆ memory_base

uint32_t MaxOS::hardwarecommunication::PCIDeviceDescriptor::memory_base = 0

The memory base address.

Definition at line 60 of file pci.h.

◆ port_base

uint32_t MaxOS::hardwarecommunication::PCIDeviceDescriptor::port_base = 0

The IO port base address.

Definition at line 57 of file pci.h.

◆ revision

uint8_t MaxOS::hardwarecommunication::PCIDeviceDescriptor::revision = 0

The device version number.

Definition at line 75 of file pci.h.

◆ subclass_id

uint8_t MaxOS::hardwarecommunication::PCIDeviceDescriptor::subclass_id = 0

The subclass type of the device.

Definition at line 72 of file pci.h.

Referenced by get_type().

◆ vendor_id

uint16_t MaxOS::hardwarecommunication::PCIDeviceDescriptor::vendor_id = 0

The company's that made the device unique identifier.

Definition at line 68 of file pci.h.


The documentation for this class was generated from the following files: