⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pci.h

📁 高速同步串口芯片PEB20534的驱动程序
💻 H
字号:
//************************************************************
//
//  This file contains the support for the pci interface
//

#ifndef _PCI_H_
#define	_PCI_H_

//  ******************* General macros **********************

#define	TRUE	1
#define	FALSE	0

/****************************************************************************/
/*   PCI Configuration Space Registers                                      */
/****************************************************************************/

#define PCI_CS_VENDOR_ID	0x00
#define PCI_CS_DEVICE_ID	0x02
#define PCI_CS_COMMAND		0x04
#define PCI_CS_STATUS		0x06
#define PCI_CS_REVISION_ID	0x08
#define PCI_CS_CLASS_CODE	0x09
#define PCI_CS_CACHE_LINE_SIZE	0x0c
#define PCI_CS_MASTER_LATENCY	0x0d
#define PCI_CS_HEADER_TYPE	0x0e
#define PCI_CS_BIST		0x0f
#define PCI_CS_BASE_ADDRESS_0	0x10
#define PCI_CS_BASE_ADDRESS_1	0x14
#define PCI_CS_BASE_ADDRESS_2	0x18
#define PCI_CS_BASE_ADDRESS_3	0x1c
#define PCI_CS_BASE_ADDRESS_4	0x20
#define PCI_CS_BASE_ADDRESS_5	0x24
#define PCI_CS_EXPANSION_ROM	0x30
#define PCI_CS_INTERRUPT_LINE	0x3c
#define PCI_CS_INTERRUPT_PIN	0x3d
#define PCI_CS_MIN_GNT		0x3e
#define PCI_CS_MAX_LAT		0x3f

#define  PCI_COMMAND_IO		0x1	/* Enable response in I/O space */
#define  PCI_COMMAND_MEMORY	0x2	/* Enable response in Memory space */
#define  PCI_COMMAND_MASTER	0x4	/* Enable bus mastering */
#define  PCI_COMMAND_SPECIAL	0x8	/* Enable response to special cycles */
#define  PCI_COMMAND_INVALIDATE	0x10	/* Use memory write and invalidate */
#define  PCI_COMMAND_PALETTE	0x20	/* Enable palette snooping */
#define  PCI_COMMAND_PARITY	0x40	/* Enable parity checking */
#define  PCI_COMMAND_WAIT 	0x80	/* Enable address/data stepping */
#define  PCI_COMMAND_SERR	0x100	/* Enable SERR */
#define  PCI_COMMAND_FAST_BACK	0x200	/* Enable back-to-back writes */

//  ******************* Function code *******************

int PCIBiosPresent(void);

int FindPCIDevice(	unsigned int device_id,
			unsigned int vendor_id,
			unsigned int index,
			unsigned char *bus_number,
			unsigned char *device_and_function);

int ReadConfigurationByte(	unsigned char bus_number,
				unsigned char device_and_function,
				unsigned char register_number,
				unsigned char *byte_read);

int ReadConfigurationWord(	unsigned char bus_number,
				unsigned char device_and_function,
				unsigned char register_number,
				unsigned int *word_read);

int ReadConfigurationDword(	unsigned char bus_number,
				unsigned char device_and_function,
				unsigned char register_number,
				unsigned long *dword_read);

int WriteConfigurationByte(	unsigned char bus_number,
				unsigned char device_and_function,
				unsigned char register_number,
				unsigned char byte_to_write);

int WriteConfigurationWord(	unsigned char bus_number,
				unsigned char device_and_function,
				unsigned char register_number,
				unsigned int word_to_write);

int WriteConfigurationDword(	unsigned char bus_number,
				unsigned char device_and_function,
				unsigned char register_number,
				unsigned long dword_to_write);

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -