PCI Express Data Writes

I am running into an issue using WRITE_REGISTER_USHORT. It seems to be corrupting the upper or lower 16 bits depending on where I am writing to in the 32 bit word. I modified the code to perform a ULONG write and it worked fine. Is the minimum PCIE data length 4 bytes?

Ex.


unsigned short SCOverTempThreshhold ; // 0x040
unsigned short SCControl ; // 0x042

WRITE_REGISTER_USHORT(&devExt->Regs->SwitchCard2.control_register.SCControl,tempVoltageControl);

I perform the above function properly updates the SCControl variable but corrupts the SCOverTempThreshold variable.

It is probably something very simple. Any thoughts or suggestions? I figured I would ask before I move everything to ULONG writes.

Thanks,
Eric

xxxxx@gdls.com wrote:

I am running into an issue using WRITE_REGISTER_USHORT. It seems to be corrupting the upper or lower 16 bits depending on where I am writing to in the 32 bit word. I modified the code to perform a ULONG write and it worked fine. Is the minimum PCIE data length 4 bytes?

Not at all, but it’s entirely possible that your hardware has such a
limitation Many hardware designers ignore the byte-enables because
it’s hard.

I am amazed at the number of hardware engineers who blithely make
alignment assumptions and then forget to document them. “Oh, didn’t I
tell you? All DMA transfers have to be 32-byte aligned.”


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

+1

I’ve encountered a number of designs where they carefully say “this is a
16-bit value” but then don’t indicate they only work on 32-bit accesses.
When you ask after beating your head against the wall, they state “it should
have been obvious”

Don Burn
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Monday, May 05, 2014 5:47 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] PCI Express Data Writes

xxxxx@gdls.com wrote:

I am running into an issue using WRITE_REGISTER_USHORT. It seems to be
corrupting the upper or lower 16 bits depending on where I am writing to in
the 32 bit word. I modified the code to perform a ULONG write and it worked
fine. Is the minimum PCIE data length 4 bytes?

Not at all, but it’s entirely possible that your hardware has such a
limitation Many hardware designers ignore the byte-enables because
it’s hard.

I am amazed at the number of hardware engineers who blithely make alignment
assumptions and then forget to document them. “Oh, didn’t I tell you? All
DMA transfers have to be 32-byte aligned.”


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


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Thanks for the feedback. I will modify things accordingly and go glare at the hardware guy.

Eric

and

+2

We had a client who wanted to only allow 64-bit read and write operations to their PCIe card.
.
.
.
READ_REGISTER_ULONG64 only exists on 64-bit versions of Windows.

Peter
OSR
@OSRDrivers