hardware.h

来自「driver wdk」· C头文件 代码 · 共 75 行

H
75
字号
//++
// File Name:
//		hardware.h
//
// Contents:
//		Hardware-specific stuff for parallel driver
//--
#ifndef _AVE2K_HARDWARE
#define _AVE2K_HARDWARE

//
// Define which types of hardware resources this
// device needs to allocate. Here, the device needs
// ports and interrupt resources, but not memory or
// DMA. If one device uses more than one of the same
// resource, (two disjoint ranges of I/O space, for 
// example) set the symbol equal to the number of
// items it uses.
//
#define	AVE2K_PORT_RESOURCE_ITEMS			1
#define	AVE2K_INTERRUPT_RESOURCE_ITEMS		1
#define	AVE2K_MEMORY_RESOURCE_ITEMS			1
#define	AVE2K_DMA_RESOURCE_ITEMS			0

//
// Define the number of CM_PARTIAL_RESOURCE_DESCRIPTOR
// items needed for each piece of hardware belonging
// to this driver.
//
#define AVE2K_RESOURCE_ITEMS_PER_DEVICE		\
(	(AVE2K_PORT_RESOURCE_ITEMS)			+	\
	(AVE2K_INTERRUPT_RESOURCE_ITEMS)		+	\
	(AVE2K_MEMORY_RESOURCE_ITEMS)			+	\
	(AVE2K_DMA_RESOURCE_ITEMS)					)


//Define constant to describe SAA714A
#define SAA7146A_PCI_DEVICEID 0x7146
#define SAA7146A_PCI_VENDORID 0x1131

//
// Define access macros for registers. Each macro takes
// a pointer to a Device Extension as an argument
//
#define Ave2kReadRegister(pDevExt, regindex)		\
	(READ_REGISTER_ULONG(							\
	 (PULONG)(pDevExt->PortBase + regindex)))

#define Ave2kWriteRegister(pDevExt, regindex, val)		\
	(WRITE_REGISTER_ULONG(							\
	  (PULONG)(pDevExt->PortBase + regindex) , val))

//The direct access register functions are only for debugging
//#ifdef _DEBUG
#define IOCTL_READ_REGISTER CTL_CODE( \
	                FILE_DEVICE_UNKNOWN, \
                    0X801,               \
					METHOD_BUFFERED,     \
					FILE_ANY_ACCESS)

#define IOCTL_WRITE_REGISTER CTL_CODE( \
	                FILE_DEVICE_UNKNOWN, \
                    0X802,               \
					METHOD_BUFFERED,     \
					FILE_ANY_ACCESS)

#define IOCTL_TRANSADDRESS CTL_CODE(\
	                FILE_DEVICE_UNKNOWN, \
                    0X81C,               \
					METHOD_BUFFERED,    \
					FILE_ANY_ACCESS)
//#endif
#endif // _AVE2K_HARDWARE

⌨️ 快捷键说明

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