I am seeking guidance on the correct way to perform memory mapped I/O to control a device in windows. After some cursory searches I haven’t found any good tutorials/articles to get me started. I know “the theory” is to just map the relevant device physical memory address range into virtual memory with MmMapIoSpace and then access accordingly. Using this approach I’ve been able to read vendor information off the device, so I know I am at least performing the mapping correctly. However, reading/writing data registers of the device is not working as described in the specification and I suspect this is because I am lacking some prerequisite knowledge about how memory mapped I/O control of devices is actually performed in windows correctly. If someone could point me to a good introductory article/useful sample code, it would be greatly appreciated.
For better context, I am just experimenting with programming the Broadcom TPM on my laptop and am using the TSS 1.2 specification as a reference manual.
Look at the pci hardware samples in the WDK, for example
src\general\plx9x5x\sys\init.c
You have of course disabled the other function driver for this device, right?
Mark Roddy
On Sun, Jan 23, 2011 at 11:49 AM, wrote:
> I am seeking guidance on the correct way to perform memory mapped I/O to control a device in windows. After some cursory searches I haven’t found any good tutorials/articles to get me started. I know “the theory” is to just map the relevant device physical memory address range into virtual memory with MmMapIoSpace and then access accordingly. Using this approach I’ve been able to read vendor information off the device, so I know I am at least performing the mapping correctly. However, reading/writing data registers of the device is not working as described in the specification and I suspect this is because I am lacking some prerequisite knowledge about how memory mapped I/O control of devices is actually performed in windows correctly. If someone could point me to a good introductory article/useful sample code, it would be greatly appreciated.
>
> For better context, I am just experimenting with programming the Broadcom TPM on my laptop and am using the TSS 1.2 specification as a reference manual.
>
> —
> NTDEV is sponsored by OSR
>
> 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
>
>know “the theory” is to just map the relevant device physical memory address range into virtual
memory with MmMapIoSpace and then access accordingly
Correct caching attributes are important.
Usually, the device registers are MmNonCached, with some special kinds of device memory (like the video memory) being MmWriteCombined.
–
Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com