阅读:1479回复:3
NdisMAllocateMapRegisters求救(50)
PhysicalMapRegistersNeeded参数PhysicalMapRegistersNeeded是什么意思啊?map registers又是什么?看了Comments也不知所以然,有没有人用DriverNetWork开发过busmaster DMA NICs,其中的D怎么使用DMA啊?
NdisMAllocateMapRegisters NDIS_STATUS NdisMAllocateMapRegisters( IN NDIS_HANDLE MiniportAdapterHandle, IN UINT DmaChannel, IN BOOLEAN DmaSize, IN ULONG PhysicalMapRegistersNeeded, IN ULONG MaximumPhysicalMapping ); NdisMAllocateMapRegisters reserves system resources during NIC driver initialization for subsequent busmaster DMA operations. Parameters MiniportAdapterHandle Specifies the handle input to MiniportInitialize. DmaChannel Specifies the bus-relative DMA channel for an ISA busmaster NIC. If the NIC is on another type of I/O bus, this parameter must be zero. DmaSize Specifies the address size that the NIC uses for DMA operations as one of the following: NDIS_DMA_24_BITS 24-bit DMA address NDIS_DMA_32_BITS 32-bit DMA address NDIS_DMA_64_BITS 64-bit DMA address When NDIS_DMA_64_BITS is specified on a system that is running the Microsoft Windows? 2000 DataCenter Server operating system with Physical Address Extension (PAE) enabled, the physical addresses of mapped buffers are greater than 32 bits. PhysicalMapRegistersNeeded Specifies the maximum number of map registers, each mapping a discrete physical page or contiguous range within a physical page, that the NIC can use in a DMA operation. Together with MaximumPhysicalMapping, this parameter describes the DMA-transfer capabilities of the NIC. MaximumPhysicalMapping Specifies the maximum number of bytes that the NIC can transfer in a single DMA operation. Specifying more than 0xF000 for this parameter will probably cause NdisMAllocateMapRegisters to fail. If the system is running the Microsoft Windows? 2000 DataCenter Server operating system with Physical Address Extension (PAE) enabled, specifying more than 0xF000 will definitely cause NdisMAllocateMapRegisters to fail. Return Value NdisMAllocateMapRegisters can return one of the following: NDIS_STATUS_SUCCESS The requested number of map registers has been allocated for the NIC and, if DmaChannel was nonzero, the specified channel has been reserved. NDIS_STATUS_RESOURCES Either the caller specified incompatible parameters when MiniportInitialize called NdisMSetAttributesEx or the requested number of map registers could not be allocated due to system resource constraints. Comments Drivers of busmaster DMA NICs call NdisMAllocateMapRegisters from their MiniportInitialize functions. Such a driver's MiniportInitialize function must call NdisMSetAttributes or NdisMSetAttributesEx before it calls NdisMAllocateMapRegisters. It should call NdisQueryMapRegisterCount before calling NdisMAllocateMapRegisters as well. A miniport should not set DmaSize to NDIS_DMA_24_BITSif its NIC is capable of using 32-bit or 64-bit addressing for DMA operations. A PCI NIC, for example, should always set DmaSize to NDIS_DMA_32_BITS or NDIS_DMA_64_BITS.. System memory below 16MB is a scarce resource. Setting DmaSize to NDIS_DMA_24_BITS could therefore cause NdisMAllocateMapRegisters to fail. The given PhysicalMapRegistersNeeded is constrained by one of the following: The number of physical discontiguities backing any specified virtual range for a DMA transfer that the NIC can handle The relative sizes of the NIC's MaximumPhysicalMapping and the memory PAGE_SIZE of the current platform For a busmaster NIC, MaximumPhysicalMapping is the largest number of bytes in any virtual range described by an NDIS_BUFFER-type descriptor that can be passed to NdisMStartBufferPhysicalMapping subsequently. The number of available map registers for the NIC's I/O bus in the current platform Map registers are a limited system resource, so a miniport should never allocate more map registers than its NIC can use in a DMA transfer operation. NdisQueryMapRegisterCount returns the maximum number of map registers that can be allocated on the current platform for the type of I/O bus the NIC uses. MiniportInitialize should pass the minimum of the following values for PhysicalMapRegistersNeeded to NdisMAllocateMapRegisters: The result of (MaximumBytesPerTransferOfNIC / PAGE_SIZE + 1) The number of physical discontiguites per virtual transfer range that the NIC can handle in any DMA transfer operation The map registers allocated with NdisMAllocateMapRegisters are implicitly numbered from zero through (PhysicalMapRegistersNeeded |
|
|
沙发#
发布于:2004-08-03 18:42
PhysicalMapRegistersNeeded是你需要map的Registers个数,map registers就是一组物理内存,用NdisMStartBufferPhysicalMapping来将PNDIS_Buffer的物理地址map到map registers,便于设备读取。
|
|
板凳#
发布于:2004-08-05 08:47
这个问题该如何回答呢,难。
DDK里有一个IRDA的例子,里面用了DMA,也有该函数,而且说明也详细,你可以参考一下。 |
|
地板#
发布于:2004-08-20 10:30
谢谢、各位了
问题虽然不是很明白,但也算解决拉 给分了 asmsys: 再问个问题,你知道在 网络和渤海连接-〉属性-〉本地连接属性中的显示的信息:发送和接受的数字是什么吗?在miniport中是否对应OID_GEN_XMIT_OK和OID_GEN_RCV_OK哪? 而为什么我向网卡发udp包(大小从<100byte到1470byte),属性理显示增加的包数都是实际发包的2倍哪?数据<100byte时不会也分成两个MA包发吧,我调试时没发现什么异常现象。 我另开了贴子,到哪里回答吧 :) |
|
|