Re: Hardware Access from Application by voidcoder
voidcoder
Wed Oct 31 16:34:12 PDT 2007
AllocPhysMem() does exactly what the name implies,
it allocates a physically contiguous memory region
at some address (simply picks the first unused
contiguous chunk of pages) in system RAM and
returns the physical address of the memory location.
It is definitely not what you want.
I believe the only way to get direct access to the
hardware from the user mode app in 6.0 is to reserve
a range of pages in user mode (VirtualAlloc) and then
pass the address to kernel mode where you can commit
the region of physical pages representing your hardware
memory (VirtualAllocCopyEx) to the reserved region.
--
Oleg
Steve Araiza wrote:
> If I specify the physical address of my hardware on my platform, then won't
> AllocPhysMem() just map the range regardless of if it is truly RAM or
> something else? My hardware is connected directly to the system bus on a
> PXA270.
>
> Am I confused?
>
>
> "Silver" <moc.liamtoh@gnirrevliseht> wrote in message
> news:eO38rX$GIHA.3916@TK2MSFTNGP02.phx.gbl...
>> AllocPhysicalMem is not what you want, it will actually allocate memory
>> space in RAM.
>>
>> Try using MmMapIoSpace, this uses VirtualAlloc/VirtualCopy to give a
>> virtual pointer to the address region desired.
>> You may need to translate the bus address first, HalTranslateBusAddress.
>>
>> Geoff
>> --
>>
>
>