华中科技大学硕士学位论文PXI/PCI总线设备驱动程序设计及应用姓名:詹金勇申请学位级别:硕士专业:模式识别与智能系统指导教师:汪国有2010-01-18IPCIPXIPCIeXtensionforInstrumentationCompactPCIPCI33MHz32132MB/sIPCorePXI/PCIWindows2000/XPPXI/PCIPCIWDMWindowsDriverModelPCIDMAPCIDMAPXIPXI/PCIMICPXIPCI9054DSPPXIDMAMFCDSPPXI/PCIMICFPGAPXI/PCIIPCore32IIIPCorePCI9054PCIMIC/PCIPXIWDMMICIIIABSTRACTPCIbusisahigh-performancesystemlocalbusandthemostwidelyusedinterfaceinpersonalcomputers,PXIbusisamodularinstrumentplatform,whichistailoredforindustrialdataacquisitionandautomationapplications,andistheexpansionofCompactPCIstandard.Exceptforthefactorssuchasmechanical,electrical,andsoon,onthedefinitionofcoresignals,PCIbusandPXIbusarebasicallythesame.PCIbus’sclockfrequencyis33MHz,anditswidthis32-bit,whichcanachieve132MB/stransmissionspeedintheorycircumstances,incommonapplicationssuchasimagedataacquisitionandindustrialcontrol,ithasoutstandingperformance.Ontheotherhand,theaddressbusanddatabususetimemultiplexpatternwhichgreatlyreducestheinterfaceoccupyingspace,inaddition,variousbridgingchipsandbusinterfacelogicIPcorearerelativelymature,whichmakestheapplicationsofPXI/PCIinembeddedsystemsnotcomplicated.InWindows2000/XPflat,wedevelopPXI/PCIbusdevicedrivers,consultingPCIbusnorms,followingMicrosoftWDM(WindowsDriverModel),usingkernelprogramming,andreasonableaccessingPCIdeviceconfigurationspace,ports,memory,DMA,interruptionresources,andsoon,supplyingapplicationsaccessinterfacesindriver,whichfinallyrealizestheapplicationequipmentwithunderlyinghardwarePCIaccessforslow,few(singlecycleaccess)orquick,large(DMA)datatransmission.Inthispaper,devicedriverswereappliedtotwoprojects,oneistheReal-TimeVideoSignalProcessingSystemBasedonPXIBus,andanotheristheMICCommunicationModuleDesignBasedonPXI/PCIBus.IntheReal-TimeVideoSignalProcessingSystemBasedonPXIBusproject,usingPCI9054asbridgingchipwhoselocalisconnectedtothehostinterfaceofDSPchipandtheotherkindisconnectedtoPXIbus,throughdriverprogramming,itofferstheinterfaceforapplicationsaccesstolow-levelhardware.Basedondatatransmission,realizetheunderlyinghardwaresinglecycleread/writeaccessandDMAtransmission.Onthisbasis,basedonMicrosoft’MFC,compilingPCcontrolsoftware,realizedtheDSPprogramIVloading,imageacquisition,algorithmselect,algorithmparametermodification,jointcommissioningetc.function.IntheMICCommunicationModuleDesignBasedonPXI/PCIBusproject,throughFPGAdirectlywithPXI/PCIbusconnections,interfaceusingIPcorelogicwhichisconfiguredto32bitsformmode,andaccordingtotheneedofunderlyinghardwareresources,settingupreasonableIPcoreresourcesparameters.Thedriverprogramming,comparedwithPCI9054driver,modifyPCIdeviceresourcesacquisitionpartcode,andrevisedapplicationscalldriver’sinterface,writetestingsoftware,successfullyimplementationofunderlyinghardwareresourcesaccess.Onthisbasis,programmingthePCcontrolsoftware,realizetheMICcommunicationmodulemodesetting,allkindsofworkmodedatacreationandpreservation,dataaccessofvariousmodes,andfinallyachievethevariousmodesofallapplicabilitycommand/responsecommunicationmeasurement.Keywords:PCIbus,PXIbus,WDMdriver,MICbus?_____?“v”111.1WindowsWindows3XWindows9XVxDVxDVxDWindowsVxDVxDVxDWindows95VxDDLLWindowsNTKMDKMDVxDCPUWindows98KMDWDMWDMPnPWindowsXPWDMCPU2[1]1-1CPU1-1PC/XTISAPCIUSBAGP[2]USBPCIPXIPCI1.2PXI/PCICPUISAPCIPeripheralComponentInterconnect32/643IntelISA5Mb/sPCI32132MB/s[3]1-2PCI1-2PCIPCIPCICPUPCIPCIPCIl32Bits64Bitslll33MHz66MHz528MB/s4lll3.3V5Vl[4]PXICompactPCICompactPeripheralComponentInterconnectCompactPCIPICMG1994PCIPCICompactPCIPICMG2.0[5]PXICompactPCIlIEEE1101.1l2mmIEC1076lllllI/OlEMCESDl(Hotswap)lll[6]1.3PXI/PCICompactPCIPXIPCI5PCIPXIPCIPXIPCI1.3.1PCI1-3PCI[7][8]1-3PCIØAD[31:00]PCIPCIPCIØC/BE[3:0]#PCIPCIPCIC/BE[3:0]#2367IOIOMemoryMemory81632632PCIØPARPCIPARPCIPARØFRAME#PCIØTRDY#PCIPCIPCIPCIØIRDY#PCIPCIPCIØSTOP#PCIØDEVSEL#PCIØIDSELØSERR#ØPERR#ØREQ#PCIPCIØGNT#PCIPCIPCIPCIPCIPCIPCIPCIPCIPCI7ØCLKPCIØRST#PCIPCI1.3.2PCIPCII/OPCIPCIPCIPCI[9][10]2566416PCI4816PCI1921-4PCI81-4PCIüVendorIDDeviceIDIDIDIDPCI-SIGIntel8086PLXTechnology10B5Altera1172PCIIDIDüCommandI/OSERR#9üStatusPCIüHeaderType10h1-4HeaderType00h01hPCI-to-PCI02hCardBusüBaseAddressRegisters[11]PCIüInterruptPinPCI1~4INTA#~INTD#0PCIüInterruptLinePCIPCIIDID1.4PXI/PCIPXI/PCIPLXPCI9054FPGAPCIIPCorePCI1.4.1PXIPCI9054C[12]PCI9054PXIDSPDSPPCI9054PCI10lBAR0BAR1PCI9054DMADMADMAlBAR2PCI9054DSP32MØPCI9054BAR0BAR1ØPCI9054BAR2ØPCI9054BAR2DMADMADMAPCI9054lDSPlDMADSPØDSPDMAØDSPDSPØDSPØFLASH1.4.2PXI/PCIMICPXI/PCIMIC[13]MIC/PCIIPCore[14]PXIPCIAlteraFPGAQuartusMegaCorePCICompilePCIpci_t32PCI11PCIIPCorelBAR0I/O256lBAR1MemoryMIC64KlBAR2MemorySDRAM2MØI/OØMICØSDRAMlPCIIPCorelPCIMIClMICPIMRSMDIMDOMlPCISDRAMlSDRAM32ØI/OMICSDRAMØMICØ32STAT[1:0]RSM/DIM32D[15:0]32ControlBitØ32D[15:0]Ø32DIMD[15:0]32DOMD[31:16]Ø/1.5PXI/PCI12PXI/PCIPXI/PCIPXI/PCIPCIPCIPXI/PCIWindowsPCIWDMPXIPXI/PCIMICMICPCIIPCoreMIC/132WindowsPXI/PCIWindows2000/XP2-1Windows2000[15]2-1Windows2000IOCreateFileCloseHandleReadFileWriteFileDeviceIoControlReadFilea)ReadFileb)Win32KERNEL32.DLLDLLNTDLL.DLLNtReadFilec)14NtReadFiled)I/O[16]IRPI/ORequestPacketIOIRP_