阅读:1107回复:0
请大侠们赐教:为DMA传输所用的PCI3042卡作驱动程序,困惑的多!
为DMA传输所用的PCI3042卡作驱动程序。
基于编程环境:VC++6.0、2000DDK、DriverWorks(DS_2.6_ver),作WDM模式的驱动程序。 借助DriverWorks的驱动向导生成带有DMA和MemoryRange0,卡上有16KB的共享存储器BaseAddressRegistor[0]映射为 MemoryRange0,偏移为0x4000; 我按照DriverWorks的帮助“how to Perform a DMA Transfer”步骤作驱动程序,进行到 “Create an instance of KDmaTransfer.”的“Add a call to member function Initiate.”时候,我不会设置如下参数 KDmaTransfer::InitiateNTSTATUS Initiate( KDevice* pDevice, // pDevice应当指向谁? KDmaAdapter* pAdapter, PMDL Memory, // 如果PMDL Memory指向BaseAddressRegistor[0]+0x4000;应当如何装配PMDL Memory呢? DMA_DIRECTION Dir, DMAREADY_CALLBACK Callback, // 因为DMAREADY_CALLBACK相关帮助说的与向导生成的驱动有所不同!?不知道怎么做? KCommonDmaBuffer* pBuffer = NULL,// pBuffer 不应该为NULL吧?我向设置为m_ComDmaBuffer; PVOID pContext = NULL, // 因为本人才疏学浅,而且时间有限,不知道怎么做? BOOLEAN BusMasterKeepAdapter = FALSE ); 帮助“how to Perform a DMA Transfer”里提到Devices that do DMA typically serialize IRP processing using QueueIrp. Therefore the transfer typically starts in member function StartIo of a KDevice subclass.所以我在向导里添加了 VOID MyDevice::Serial_MY_IOCTL_803_Handler(KIrp I){…}; VOID MyDevice::Serial_MY_IOCTL_804_Handler(KIrp I){…}; 因为DEVMEMBER_DMAREADY帮助里的Example class OmniPort : public KDevice VOID OmniPort::StartIo(KIrp I) 与我的驱动里的 class MyDevice_DriverManagedQueue : public KDriverManagedQueueEx MyDevice_DriverManagedQueue::StartIo(KIrp I)相比相差太远。这使我配置KDmaTransfer::InitiateNTSTATUS Initiate()起来困惑的多。 请大侠们赐教?? |
|