阅读:1014回复:0
amcc如何实现双缓冲dma?
用AllocateCommonBuffer会导致死机?
设备扩展中声明: { PULONG AmccBaseRegisterAddress1; // Adapter\'s memory phisycal address for dma PPHYSICAL_ADDRESS AmccDmaPhAddress1; } DevExt是设备扩展,在IRP_MN_START_DEVICE消息到来启动设备时分配内存,运行的时候会导致机器重起: { DevExt->AmccBaseRegisterAddress1 = (unsigned long *) DevExt->ReadAdapter->DmaOperations->AllocateCommonBuffer( DevExt->ReadAdapter, //IN PDMA_ADAPTER DmaAdapter, OSR_PCI_MAX_TXFER, //IN ULONG Length, DevExt->AmccDmaPhAddress1, //OUT PPHYSICAL_ADDRESS LogicalAddress, FALSE//IN BOOLEAN CacheEnabled ); if (DevExt->AmccDmaPhAddress1 == NULL) { return(STATUS_UNSUCCESSFUL); } // // We successfully allocated a contiguous chunk of memory. // It should be page aligned already. // //ASSERT(((ULONG_PTR)DevExt->AmccDmaPhAddress1 & (PAGE_SIZE-1)) == 0); #if DBG DebugPrint(\"OsrStartDevice: 内存资源1 0x%x%x\", DevExt->AmccDmaPhAddress1->HighPart, DevExt->AmccDmaPhAddress1->LowPart); #endif //ASSERT(DevExt->AmccDmaPhAddress1->HighPart == 0); //ASSERT((DevExt->AmccDmaPhAddress1->LowPart & (PAGE_SIZE-1)) == 0); } |
|
|