Memcpy,RtlCopyMemory and READ_REGISTER_BUFFER_ULONG

Hi,

In my Win2K WDM for a PCI memory mapped FIFO card, I
tried to read a stream of DWORDs from the FIFO using
READ_REGISTER_BUFFER_ULONG(). But there were some
glitches while reading data and some data was lost.
Then I tried to use memcpy and RtlCopyMemory instead
of READ_REGISTER_BUFFER_ULONG() but had the same
problem. Then I read the data using direct assignment,
as in,

while ( Count–)
*(pulBuffer++) = *(pFifoAddress++)//reading from the
FIFO to the buffer.

This worked perfectly. Does anyone know why the other
things failed ?

Thanks for all help
Madhu


Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

>In my Win2K WDM for a PCI memory mapped FIFO card, I

tried to read a stream of DWORDs from the FIFO using
READ_REGISTER_BUFFER_ULONG(). But there were some
glitches while reading data and some data was lost.
Then I tried to use memcpy and RtlCopyMemory instead
of READ_REGISTER_BUFFER_ULONG() but had the same
problem. Then I read the data using direct assignment,
as in,

while ( Count–)
*(pulBuffer++) = *(pFifoAddress++)//reading from the
FIFO to the buffer.

This worked perfectly. Does anyone know why the other
things failed ?

My suggestion is you should look at a PCI bus trace. The block transfer
functions may be eventually getting down to a REP MOVSD instruction, which
“may” be getting the PCI bus to burst. The individual dword accesses in a
loop, are probably not getting the bus to burst. This is suggesting your
hardware corrupts data when it reads bursts bigger than a single DWORD.

The only way to really see what’s happening is to “see what’s happening”,
on a PCI bus analyzer. You might get some clues to confirm this if the
READ_REGISTER_BUFFER_ULONG seem to transfer much faster than the loop.
Record the processor performance counter register before and after the
transfer.

We’ve had some discussions here on burst PCI target reads, so you might
look at back messages. I’d also suggest trying a different
processor/chipset. For example, the Pentium 4 vs. the Pentium 3+440GX
chipset may act quite different on how the express instructions as PCI
transactions. You corruption may only be happening on certain combinations,
which again suggests a hardware issue.

  • Jan

You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com