Search code examples
memory-managementwindows-ce

How can can I port MmMapIoSpace from Windows CE 5.0 to 6.0 or XP Embedded?


We currently have a custom board with a microcontroller on it that speaks to a PC/104 windows CE 5.0 board through a dual port ram. Currently we use MmMapIoSpace to map the dual port ram in windows CE so we can read and write directly to it. We are looking to join the modern era of windows CE 6.0 or even windows XP embedded. A big concern of ours is that according to Microsoft's documentation MmMapIoSpace in windows CE 6.0 and in Windows XP Embedded are now driver level functions not accessible to in a user space program which is how we have been using it.

Before we go out and buy a lot of hardware and possibly a copy of platform builder we have been trying to figure out if it will actually be a problem and if so what we can do about it. None of us have experience writing windows drivers so that seems like a large undertaking however we would literally be writing a driver just to handle this one function.

Is it simple to port MmMapIoSpace from Windows CE 5.0 to Windows CE 6.0 or Windows XP Embedded. (links to Microsoft documentation).

Thanks!


Solution

  • MmMapIoSpace really should only be used by a driver in the first place, so earlier CE versions were simply a bit promiscuous in letting you use it from an app. I'd create a simple stream interface driver that interfaces with the RAM using MmMapIoSpace, and then call that driver from you app either using ReadFile or DeviceIoControl.

    Stream interface drivers in Windows CE are very simple and straightforward. It's just a DLL with some specific entry points defined, and then registry entries to tell device.exe to load it. MSDN has lots of examples, but if you want even easier, there's a wizard on Codeplex that can generate the files for you too.