2021-11-28 15:46:16 +00:00
|
|
|
#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 15:46:16 +00:00
|
|
|
|
|
|
|
|
2021-11-28 20:07:05 +00:00
|
|
|
uint32_t getAddress( ){
|
2021-11-28 15:46:16 +00:00
|
|
|
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) |
|
2021-11-28 15:46:16 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2021-11-28 15:46:16 +00:00
|
|
|
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;
|
|
|
|
|
2021-11-28 15:46:16 +00:00
|
|
|
int headerType;
|
|
|
|
|
|
|
|
};
|