Common buffer start-offset

Hi all,

i have a small problem with the WdfCommonBuffer:

I’ve created it with WdfCommonBufferCreate, got the virtual address and the logical address and tried to write to this buffer from my pci card.
The write works fine, but the start-address of my data in the virtual address-space is different from the start-address of the logical address?!?

My scenario:

  1. I allocated 4MB Buffer
  2. I got the virtual address from “WdfCommonBufferGetAlignedVirtualAddress”
  3. I got the logical address from “WdfCommonBufferGetAlignedLogicalAddress”
  4. I used the logical address (e.g. 0x14690000) to write 1MB of data to the buffer (from pci card, offset 0x0)
  5. I looked in the driver into the buffer (e.g. virtual 0xa7221000) and searched for my pattern in the buffer; found it at offset 0x00174000… ?!?

If i write 4MB to the buffer (size is also 4MB), then the whole buffer is filled with my pattern -> looks like he has writte till the end an startet from offset 0 again…

Whats the Problem?
I still searched this forum for an solution, but didn’t found something.

Greetz,
Andreas

If your device could correctly transfer 4M data but put data in different address which you expected in 1M transfer it is likely hardware problem. Try to debug hardware if it is possible. If debugging the hardware is not possible try to use a PCI bus analyzer to track the addresses of transactions.

Igor Sharovar

Spitzkopf, Andreas wrote:

I’ve created it with WdfCommonBufferCreate, got the virtual address and the logical address and tried to write to this buffer from my pci card.
The write works fine, but the start-address of my data in the virtual address-space is different from the start-address of the logical address?!?

My scenario:

  1. I allocated 4MB Buffer
  2. I got the virtual address from “WdfCommonBufferGetAlignedVirtualAddress”
  3. I got the logical address from “WdfCommonBufferGetAlignedLogicalAddress”
  4. I used the logical address (e.g. 0x14690000) to write 1MB of data to the buffer (from pci card, offset 0x0)
  5. I looked in the driver into the buffer (e.g. virtual 0xa7221000) and searched for my pattern in the buffer; found it at offset 0x00174000… ?!?

If i write 4MB to the buffer (size is also 4MB), then the whole buffer is filled with my pattern -> looks like he has writte till the end an startet from offset 0 again…

Whats the Problem?

I’m with Igor. This has to be a problem with the way you are setting up
the bus mastering. Can you post the code?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.