📄 pci.h
字号:
#include "BASICTYP.h"
#define I_VENDOR_ID 0x00
#define PCI_DEVICE_ID 0x02
#define PCI_CMD_REG 0x04
#define PCI_STATUS_REG 0x06
#define PCI_REV_ID 0x08 /* including the class code */
#define PCI_CACHE_LINE_SIZE 0x0C
#define PCI_LATENCY_TIMER 0x0D
#define PCI_HEAD_TYPE 0x0E
#define PCI_BIST 0x0F
#define PCI_BASE_ADDR_0 0x10
#define PCI_BASE_ADDR_1 0x14
#define PCI_BASE_ADDR_2 0x18
#define PCI_BASE_ADDR_3 0x1C
#define PCI_BASE_ADDR_4 0x20
#define PCI_BASE_ADDR_5 0x24
#define PCI_CIS_POINTER 0x28
#define PCI_SUB_VENDOR_ID 0x2C
#define PCI_SUB_SYSTEM_ID 0x2E
#define PCI_EXP_ROM_BASE 0x30
#define PCI_INTR_LINE 0x3C
#define PCI_INTR_PIN 0x3D
#define PCI_MIN_GNT 0x3E
#define PCI_MAX_LAT 0x3F
#define OFFSET_TO_DW_INDEX(x) ((x) & ~0x3)
#define OFFSET_TO_BYTE_INDEX(x) ((x) & 0x3)
/*---------------------------------------------------------------------*/
/* Ports and the bit patterns used by the Configuration Mechanism One */
/*---------------------------------------------------------------------*/
#define CFG_ADDR_REG 0x0CF8
#define CFG_DATA_REG 0x0CFC
#define CFG_SPACE_ENA 0x80000000
/*---------------------------------------------------------------------*/
/* Ports and the bit patterns used by the Configuration Mechanism Two */
/*---------------------------------------------------------------------*/
#define CFG_ENABLE_REG 0x0CF8
#define CFG_FORWARD_REG 0x0CFA
#define CFG_BASE_REG 0xC000
#define CFG_SPACE_KEY 0xF0
#define SPE_CYC_ENA 0x01
#define MULTI_FUNC_BIT 0x80
#define MAX_PCI_DEVICES 16
#define MAX_BUS_NUM 16 /* the maximum value is 256 */
#define MAX_DEV_NUM 32
#define MAX_FUNC_NUM 8
#define PCI_CFG_MECHANISM_1 1
#define PCI_CFG_MECHANISM_2 2
#define PCI_NO_DEVICE_ID 0xffffffff
typedef struct pci_cfg_info
{
struct pci_cfg_info *next;
USHORT vendor_id;
USHORT dev_id;
USHORT pci_bus_num;
USHORT pci_dev_num;
USHORT pci_func_num;
USHORT rev_id;
USHORT base_class;
USHORT sub_class;
ULONG class_code;
USHORT subsys_vendor_id;
USHORT subsys_id;
ULONG cfg_addr;
} PCI_CFG_INFO;
PCI_CFG_INFO * get_pci_cfg_info_tbl(void);
ULONG pci_cfg_read(ULONG dev_idx, ULONG offset, ULONG bytes);
USHORT pci_cfg_rd_w(ULONG addr, ULONG offset);
UCHAR pci_cfg_rd_b(ULONG addr, ULONG offset);
ULONG pci_cfg_rd_l(ULONG addr, ULONG offset);
BOOLEAN findPCIdev(ULONG classcode, ULONG *puBaseAddress, ULONG *puIntLevel);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -