pciSample(2)

2019-08-26 17:36

pDeviceContext->MemLength); pDeviceContext->MemBaseAddress = NULL; } DbgPrint(\ return STATUS_SUCCESS; }

/**---------------------------------------------------------------------------------------------------**/ driver.c

#include \

#ifdef ALLOC_PRAGMA

#pragma alloc_text(INIT, DriverEntry) #endif

NTSTATUS DriverEntry(

IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath ) {

WDF_DRIVER_CONFIG config; NTSTATUS status;

WDF_DRIVER_CONFIG_INIT(&config, PCISample_EvtDeviceAdd);

//

// Create a framework driver object to represent our driver. //

status = WdfDriverCreate( DriverObject, RegistryPath,

WDF_NO_OBJECT_ATTRIBUTES, // Driver Attributes &config, // Driver Config Info WDF_NO_HANDLE // hDriver );

return status; }

/*******************************************************************/ Makefile #

# DO NOT EDIT THIS FILE!!! Edit .\\sources. if you want to add a new source # file to this component. This file merely indirects to the real make file # that is shared by all the driver components of the Windows NT DDK #

!INCLUDE $(NTMAKEENV)\\makefile.def

/****************************************************************************/

Makefile.inc

_LNG=$(LANGUAGE) _INX=.

STAMP=stampinf -f $@ -a $(_BUILDARCH)

$(OBJ_PATH)\\$(O)\\$(INF_NAME).inf: $(_INX)\\$(INF_NAME).inx copy $(_INX)\\$(@B).inx $@ $(STAMP)

/****************************************************************************/ PCISample.INC

;Module Name: ; PCISample.INF ;

;Abstract:

; INF file for installing the Windows Driver Frameworks PCISample Driver ;

;Installation Notes:

; Using Devcon: Type \; ;--*/

[Version]

Signature=\Class=WDFBOOK

ClassGuid={EF1941A7-645B-4668-B05B-287D30169435}

Provider=%ProviderName%

DriverVer=12/28/2008,6.0.6000.16386

; ================= Class section =====================

[ClassInstall32]

Addreg=SampleClassReg

[SampleClassReg]

HKR,,,0,TviceClassName% HKR,,Icon,,-18

;***************************************** ; PCISample Install Section

;*****************************************

[Manufacturer]

%MfgName%=Standard,NTx86

; Following section is meant for Windows 2000 as it ; cannot parse decorated model sections [Standard] ;

; Hw Id is root\\PCISample ;

%PCISample.DeviceDesc%=PCISample_Device,

PCI\\VEN_5858&DEV_0002&SUBSYS_00000000&REV_01

; Decorated model section take precedence over undecorated ; ones on XP and later. [Standard.NTx86]

%PCISample.DeviceDesc%=PCISample_Device,

PCI\\VEN_5858&DEV_0002&SUBSYS_00000000&REV_01

[DestinationDirs]

PCISample_Files_Driver = 12

[PCISample_Device.NT]

CopyFiles=PCISample_Files_Driver

[PCISample_Files_Driver] PCISample.sys

;-------------- Service installation

[PCISample_Device.NT.Services]

AddService = PCISample,0x00000002, PCISample_AddService

; -------------- PCISample driver install sections [PCISample_AddService]

DisplayName = %PCISample.SVCDESC%

ServiceType = 1 ; SERVICE_KERNEL_DRIVER StartType = 3 ; SERVICE_DEMAND_START ErrorControl = 1 ; SERVICE_ERROR_NORMAL ServiceBinary = %\\PCISample.sys ;

;--- WDF Coinstaller installation ---- ;

[DestinationDirs]

CoInstaller_CopyFiles = 11

[PCISample_Device.NT.CoInstallers] CopyFiles=CoInstaller_CopyFiles AddReg=CoInstaller_AddReg

[CoInstaller_CopyFiles] wdfcoinstaller01007.dll

[CoInstaller_AddReg]

HKR,,CoInstallers32,0x00010000, \

[PCISample_Device.NT.Wdf]

KmdfService = PCISample, PCISample_wdfsect

[PCISample_wdfsect] KmdfLibraryVersion = 1.7

[Strings]

ProviderName=\最新WDF设备驱动程序开发\MfgName=\武安河\

DeviceClassName=\范例\

PCISample.DeviceDesc = \

PCISample.SVCDESC = \

/************************************************************/

Private.h

#pragma warning(disable:4200) //

#pragma warning(disable:4201) // nameless struct/union

#pragma warning(disable:4214) // bit field types other than int

#include #include

#include \

#ifndef _H #define _H

//定义CY7C09449内部寄存器的偏移地址,请参阅CY7C09449文档资料 #define DMALBASE 0x04B0 #define DMAHBASE 0x04B4 #define DMASIZE 0x04B8 #define DMACTL 0x04BC #define HINT 0x04E4 #define RAM 0x4000

//MAXNLEN:DMA传输最大字节长度 #define MAXNLEN 0x1000

typedef struct _DEVICE_CONTEXT { WDFINTERRUPT Interrupt;

WDFDMAENABLER DmaEnabler;

WDFDMATRANSACTION DmaTransaction; PVOID MemBaseAddress; ULONG MemLength; } DEVICE_CONTEXT, *PDEVICE_CONTEXT;

WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(DEVICE_CONTEXT, GetDeviceContext)

NTSTATUS DriverEntry(

IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath );

NTSTATUS


pciSample(2).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2号主变铁芯夹件接地故障处理方案

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: