Re: Access to IO port on x86 platform



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: SL811 problem on mach-pxa
    ... bother with a separate physical I/O space, ... oddly enough all current users of this driver are on PXA hardware. ... If your board is wired to support a separate chip reset (maybe ... It's best to ask questions about USB drivers on linux-usb-devel, ...
    (Linux-Kernel)
  • Re: why my stream driver function XXX_Open is called right after X
    ... Hello, Steve Maillet! ... > 2) you have an IClass value indicating the driver is power managed ... > breakpoint in the Open function and use the debugger call stack to determine ... > smaillet at EmbeddedFusion dot com ...
    (microsoft.public.windowsce.platbuilder)
  • Re: How does interrupt machnisum works for serial driver?
    ... Steve Maillet wrote: ... which returns a context to the device manager for that particular device. ... to inform the driver something wants to open a handle to that particular ... What changed to the COM port architecture since CE 4.2? ...
    (microsoft.public.windowsce.platbuilder)
  • Re: How can I respectively load block device driver and mount disk
    ... "Steve Maillet " дÈëÏûÏ¢ ... > It sounds like your driver is serving a dual role. ... > insertions and removals and abstracting the device for ...
    (microsoft.public.windowsce.embedded)
  • Re: Is the WDK example "rtlnwifi" 64 bit compliant?
    ... not seem to use any I/O space. ... came with the "in box" RealTek driver named RTL85n64.sys ... I do hit breakpoints for DriverEntry and MPInitialize but then sadly I ... Has anyone just run rtlnwifi in Vista64? ...
    (microsoft.public.development.device.drivers)