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

📄 misc.c

📁 用C语言写得PCI8052的WDM结构驱动程序
💻 C
字号:
//  Programmer:桂凯    西安电子科技大学
// 
//  email:wwwguikai@21cn.com
//  All right reserved 

//
//
//
/*
static NTSTATUS 
MainDispatch ( 
    IN PDEVICE_OBJECT DeviceObject, 
    IN PIRP Irp 
    );

*/
#include <ntddk.h>
#include <ndis.h>
#include <pci9052hw.h>
#include <pci9052sw.h>

//-----------------------------------------------------------------------------
NTSTATUS
Detect9052(
    IN PDEVICE_OBJECT DeviceObject
    )
{
    ULONG busNumber = 0;
    ULONG deviceNumber = 0;
    PCI_SLOT_NUMBER slotNumber;
    ULONG length = 0;
    PCI_COMMON_CONFIG  configInfo ;
    ULONG found9052 = 0;
    
//    KdPrint(( "Detect9052 \n"));
    for( busNumber=0; busNumber<MAX_BUS_NUMBER; busNumber++)
    {
      for( deviceNumber=0; deviceNumber<PCI_MAX_DEVICES; deviceNumber++)
      {
    	slotNumber.u.bits.Reserved = 0;
        slotNumber.u.bits.DeviceNumber = deviceNumber;
        slotNumber.u.bits.FunctionNumber = 0;
        slotNumber.u.AsULONG = deviceNumber;
        
        length = HalGetBusData(PCIConfiguration,
                               busNumber,
                               slotNumber.u.AsULONG,
                               &configInfo,
                               sizeof(PCI_COMMON_CONFIG) );

        
            // If there's nothing in this slot, PCI_INVALID_VENDORID is returned
            // as the vendor ID.  If this is the case, just continue running
            // the bus.
            //
         if ( configInfo.VendorID == PCI_INVALID_VENDORID)
             continue;
             
         if ( (configInfo.VendorID == PLX9052ID_VENID)&&(configInfo.DeviceID == PLX9052ID_DEVID) )  
         {
                found9052 = 1;
                break;
         }
       }
    }
    if ( found9052 == 1 )
    {
      return(STATUS_SUCCESS);
    }
    else 
      return(STATUS_NO_SUCH_DEVICE);
    	
}


⌨️ 快捷键说明

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