BarinkOS/source/kernel/drivers/pci/pciDevice.h

55 lines
1.0 KiB
C
Raw Normal View History

#pragma once
#include <stdint.h>
/*
* PCI devices API
*/
struct PCIBusAddress{
int bus ;
int device ;
2021-11-28 20:07:05 +00:00
int function;
2021-11-28 20:07:05 +00:00
uint32_t getAddress( ){
return ((uint32_t) 1 << 31) |
((uint32_t) bus << 16) |
((uint32_t) device << 11)|
2021-11-28 20:07:05 +00:00
((uint32_t) function << 8) |
0x0000;
};
};
class PCIDevice {
public :
PCIDevice (PCIBusAddress* , int );
~PCIDevice();
PCIBusAddress const PCIAddress();
2021-11-28 20:07:05 +00:00
inline const char* getDeviceString(){
return "Not implemented"; //GetClassCodeName(deviceclass);
}
inline const char* getVendorString(){
return "Not implemented"; // getVendor(VendorID);
}
inline void setVendorID (uint16_t id) {
this->VendorID = id;
}
private:
int bus;
int device;
int function;
2021-11-28 20:07:05 +00:00
uint16_t VendorID;
uint16_t DeviceID;
uint8_t deviceclass;
uint8_t devicesubclass;
int headerType;
};