Re: Physical memory access from C# in WinCE 6.0

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



On Nov 12, 9:24 am, Albert_Knosos
<AlbertKno...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
I am using Windows CE 6.0, Compact Framework 2.0, and I want to access
physical memory from C#.

I have a driver and I can call it from C#, because it is loaded in boot time.

I have tried an IoControl, that does the following:

        case IOCTL_FPGA_MAPPING:
                PHYSICAL_ADDRESS FPGA_addr;
                FPGA_addr.HighPart = 0;
                FPGA_addr.LowPart = 0x110;
                PVOID pFPGA;
                pFPGA = MmMapIoSpace(FPGA_addr,0xA6,FALSE);
                if (pFPGA == NULL) {
                        DEBUGMSG(ZONE_INIT,(L"MMA: MmMap Malament\r\n"));
                } else {
                        DEBUGMSG(ZONE_INIT,(L"MMA: MmMap OK\r\n"));
                }
                pBufOut = (PBYTE)
VirtualAllocCopyEx((HANDLE)GetDirectCallerProcessId(),GetCurrentProcess(),pFPGA,0xA6,PAGE_READWRITE);
                break;

What I pretend to do here is to map from 0x110 to 0x1B5, for the C#
application to use them.

I use the MmMapIoSpace to have a virtual address, and then I do a
VirtualAllocCopyEx to copy the virtual address pointer (pFPGA) to the out
pointer of the IoControl (pBufOut).

Could it work?

Thanks in advance, I am new to drivers in Windows in general and I feel
quite lost...

I don't know if that is still possible at all via Windows CE 6.0
(perhaps someone can comment as to whether it is feasible) but I
wouldn't suggest doing that myself even if it is.

My recommendation is always to have a driver (kernel or user) do the
work on behalf of a user-space library / application. In this case
(without really knowing your system / requirements) I would likely
write a Stream-Driver that would interact with the FPGA on behalf of
the C# Application.

Although this doesn't really answer your question of whether it is
possible, I hope this helps,
Brad.
.



Relevant Pages

  • Physical memory access from C# in WinCE 6.0
    ... I have a driver and I can call it from C#, because it is loaded in boot time. ... PVOID pFPGA; ... VirtualAllocCopyEx to copy the virtual address pointer to the out ... I am new to drivers in Windows in general and I feel ...
    (microsoft.public.windowsce.app.development)
  • Re: Reserved Memory Access Question CE 6.0 vs. 5.0
    ... Good news, the VirtualAllocCopyEx() worked. ... I use MmMapIoSpacein my stream driver to map a reserved section of memory ... I would like to be able to map to the reserved memory region specified ...
    (microsoft.public.windowsce.platbuilder)
  • Re: driver cannot be loaded - code 39
    ... Windows 2k/XP/2k3 Filesystem and Driver Consulting ... i opened my driver with the dependency tool and saw the ... that to be a pointer to the struct i opened my .sys fiel again with the ...
    (microsoft.public.development.device.drivers)
  • problems with the cursor
    ... Which operating system are you running on your computer? ... I remember Windows 98/ME and Windows NT 3.51 giving you ... the option of changing your mouse pointer to a dinosaur (I ... you the option to "uninstall driver". ...
    (microsoft.public.win2000.general)
  • Re: read/write from application in wince 6.0
    ... for register read/write. ... Get base Address from driver through IOCTL (this address should be ... ioctlOutBuf->pMappedPtr = VirtualAllocCopyEx( ...
    (microsoft.public.windowsce.platbuilder)