Re: Access to IO port on x86 platform



If that code is in a driver, yes. In an app, no.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--


"gissa" <ghielec@xxxxxxxxxxxxxxxxxx> wrote in message
news:1167153530.737545.233180@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I found this in the group. Can this be used in V6?

PUCHAR MapDeviceIO(INTERFACE_TYPE Bus,ULONG PhysAddress,ULONG len)
{
PHYSICAL_ADDRESS ioPhysicalBase={PhysAddress,0}; // Note: reverse
order of
members...
ULONG inIoSpace=1; // always try for I/O space
PUCHAR retVal=NULL; // start out assuming FAIL


if(HalTranslateBusAddress(
Bus, // [in] Bus Type
0, // [in] Bus Number
ioPhysicalBase, // [in] Physical Address
&inIoSpace, // [inout] flag for iospace
&ioPhysicalBase) // [out] translated physical address
)
{
if (!inIoSpace) // if not in I/O Space it is memory mapped
{
// so now map the address into processes
// virtual address space
retVal = (PUCHAR)MmMapIoSpace(
ioPhysicalBase, // physical address
len, // Length
FALSE); // Non Cached
}
else
retVal = (PUCHAR)ioPhysicalBase.LowPart;
}


return retVal;


}


Steve Maillet (eMVP) wrote:
What is the easiest way to access a port on x86 using CE version 6?

We have a special hardware on IO port x and want to be able to read and
write to it from my application. Do I need driver? Can use some simple
user mode driver?
By port I'm assuming you mean on the I/O bus accessed with the dedicated
x86
IO instructions.

The cleanest and most portable solution is to write a device driver for
the
device. In V5.0 and earlier you could get away with accessing the device
directly but as of V6.0 you cannot.


--
Steve Maillet
EmbeddedFusion
www.EmbeddedFusion.com
smaillet at EmbeddedFusion dot com



.



Relevant Pages

  • Re: Help for Marshalling
    ... I've not used the DSK driver to do this, so I'm not sure if that is how it ... Managed Code in the Embedded World ... memory_location,unsigned char* lpOutBuf) ... // LP to a buffer for output data ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: What is the equivalent of REG32 type in C#?
    ... Paul G. Tobey wrote: ... implement a call back from the IST in the driver to managed code. ... and kernel services IST in the driver. ... For those who have done this kind of stuff, are ISTs ever done at the ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: What is the equivalent of REG32 type in C#?
    ... the point-to-point messsage queue example, ... driver to add or remove an 'interested party'. ... implement a call back from the IST in the driver to managed code. ... For those who have done this kind of stuff, are ISTs ever done at the ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: What is the equivalent of REG32 type in C#?
    ... Paul G. Tobey wrote: ... driver to add or remove an 'interested party'. ... implement a call back from the IST in the driver to managed code. ... For those who have done this kind of stuff, are ISTs ever done at ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Set MAC address ...
    ... Chris Tacke ... Managed Code in the Embedded World ... a registry and whenever a queryInformation of NDIS driver is called, ...
    (microsoft.public.windowsce.embedded)