What is the difference between using IOCTL to write/read IO ports vs. modifying IOPM and using _INP/OUTP_ ??

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hello guys.

Brief question for someone who sort of understands the Windows IO
Manager and IO subsystem model. I have a PCI device that operates at
0x300 IO mapped address. To use this card, we used a DLL written in C
and used in VB6 back in Win 98. In WinXP, I now use Userport which
claims it modifys Permission MAP of the Windows Subsystem to let all
user mode programs run at Ring 0.

When I use the C dll to do writes and reads, I achieve a speed of 1.65
uS between writes. Decent speed. But I wonder if I can get any
better/faster then this? So I decided to enter into the realm of
using IOCTL calls such as IOCTL_WRITE_PORT_UCHAR and
IOCTL_READ_PORT_UCHAR provided in the PORTTALK and other IO port
programs. So now I am essentially using a C program, to call the
device driver using IOCTL to access the hardware. The best speed I
got was 8 to 10 uS between consecutive writes or reads. And by
consecutive, I mean doing something like this in the __main() routine:


outportb(0x378, 0xFF);

outportb(0x378, 0xFF);

the function outportb is actually a deviceiocall.

How am I measuring the speed between requests? Simple, in real time
with an oscilloscope. Each time an IO requests is made to the PCI Bus,
my PCI card responds with DEVICE SELECT. I use this signal to trigger
the scope and I'm able to see when the DEVICE asserts and releases
from the bus. This is how I know how much time it takes for the OS to
process my write/read requests.

So my question is, why is it that when going through the kernel mode
driver, the system processes my IO writes/reads slower? Then when I
use UserPort or PortTalk to modify the IOPM (IO Permission Map) of the
Windows XP Subsystem, and then use either assembly code or visual c++
dll commands like inportw( or outpw( to do my writes and reads, I get
much faster speeds?

I would prefer to go through using a kernel mode driver and talking to
it than having to modify the IOPM to let me through as many websites
have said. But why is it so slow when I do that? Is there THAT much
overhead?

.



Relevant Pages