Driver Problems? Questions? Issues?
Put OSR's experience to work for you! Contact us for assistance with:
  • Creating the right design for your requirements
  • Reviewing your existing driver code
  • Analyzing driver reliability/performance issues
  • Custom training mixed with consulting and focused directly on your specific areas of interest/concern.
Check us out. OSR, the Windows driver experts.

Monthly Seminars at OSR Headquarters

East Coast USA
Windows Internals and SW Drivers, Dulles (Sterling) VA, 13 November 2017

Kernel Debugging & Crash Analysis for Windows, Nashua (Amherst) NH, 4 December 2017

Writing WDF Drivers I: Core Concepts, Nashua (Amherst) NH, 8 January 2018

WDF Drivers II: Advanced Implementation Techniques, Nashua (Amherst) NH, 15 January 2018


Go Back   OSR Online Lists > ntdev
Welcome, Guest
You must login to post to this list
  Message 1 of 5  
07 Feb 18 15:19
PK
xxxxxx@gmail.com
Join Date: 23 Jan 2018
Posts To This List: 6
Windows 7 - How to read and write using doorbell interface register

Hello, I want to use the doorbell interface to read and write from the chip. For this the Linux driver has a call /* make sure doorbell is not in use */ if ((readl(&chip->Doorbell) & DOORBELL_USED)) What is the Windows equivalent of the readl() function call? Thanks
  Message 2 of 5  
07 Feb 18 15:29
Tim Roberts
xxxxxx@probo.com
Join Date: 28 Jan 2005
Posts To This List: 11795
Windows 7 - How to read and write using doorbell interface register

xxxxx@gmail.com wrote: > I want to use the doorbell interface to read and write from the chip. > For this the Linux driver has a call > /* make sure doorbell is not in use */ > if ((readl(&chip->Doorbell) & DOORBELL_USED)) > > What is the Windows equivalent of the readl() function call? A few seconds with Google would have answered this question.  "readl" reads a 32-bit value from a memory-mapped register.  The statement above is essentially equivament to     if( *chip->Doorbell & DOORBELL_USED) The Windows equivalent is READ_REGISTER_ULONG. Note that you'll still have to map the registers into memory so you have the board's address to begin with. -- Tim Roberts, xxxxx@probo.com Providenza & Boekelheide, Inc.
  Message 3 of 5  
07 Feb 18 16:24
PK
xxxxxx@gmail.com
Join Date: 23 Jan 2018
Posts To This List: 6
Windows 7 - How to read and write using doorbell interface register

Thanks for your response. I am unclear about a lot of things in the problem I am trying to solve and hence asked the question. From your response, I am kind of confused about how to deal with problem of memory mapping. In my storport miniport driver, I am able to get the base address register using StorPortGetDeviceBase(). This address is set to point to a buffer that is of size and type of the chip's interface register structure. For e.g: typedef interface_t { u32 doorbell; U32 WriteSequence; U32 HostDiagnostic; ..... ...... }SystemInterfaceRegs_t; SystemInterfaceRegs_t registerBase; registerBase = (SystemInterfaceRegs_t )StorPortGetDeviceBase(....); With last parameter = False indicating that the mapped range is in memory space. Now, I want to read registerBase.doorBell which I believe is already memory mapped. Is the implementation I listed above correct ? Where should I be calling in the MmMapIoSpace() call here? Thanks.
  Message 4 of 5  
07 Feb 18 18:35
Mark Roddy
xxxxxx@gmail.com
Join Date: 25 Feb 2000
Posts To This List: 4056
Windows 7 - How to read and write using doorbell interface register

You don't call MmMapIoSpace. StorPortGetDeviceBase returns: "A mapped, logical base address corresponding to the bus-relative address supplied in the IoAddress parameter.". You can then use that returned value directly in a call to the StorPortReadRegister* routines. See the sample driver at https://github.com/Microsoft/Windows-driver-samples/blob/aa6e0b36eb932099fa4eb950 a6f5e289a23b6d6e/storage/miniports/lsi_u3/src/lsi_u3.c Mark Roddy On Wed, Feb 7, 2018 at 4:24 PM, xxxxx@gmail.com <xxxxx@lists.osr.com> wrote: > Thanks for your response. I am unclear about a lot of things in the > problem I am trying to solve and hence asked the question. From your > response, I am kind of confused about how to deal with problem of memory > mapping. > In my storport miniport driver, I am able to get the base address register > using StorPortGetDeviceBase(). This address is set to point to a buffer > that is of size and type of the chip's interface register structure. > For e.g: > typedef interface_t > { <...excess quoted lines suppressed...> --
  Message 5 of 5  
07 Feb 18 18:44
PK
xxxxxx@gmail.com
Join Date: 23 Jan 2018
Posts To This List: 6
Windows 7 - How to read and write using doorbell interface register

Thanks. I will use StorPortReadRegister* with DeviceExtension and register as registerBase.doorBell
Posting Rules  
You may not post new threads
You may not post replies
You may not post attachments
You must login to OSR Online AND be a member of the ntdev list to be able to post.

All times are GMT -5. The time now is 06:47.


Copyright ©2015, OSR Open Systems Resources, Inc.
Based on vBulletin Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Modified under license