What is the difference between using IOCTL to write/read IO ports vs. modifying IOPM and using _INP/OUTP_ ??
- From: L337 <vern.engineering@xxxxxxxxx>
- Date: Tue, 1 Sep 2009 11:12:10 -0700 (PDT)
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?
.
- Follow-Ups:
- Re: What is the difference between using IOCTL to write/read IO ports vs. modifying IOPM and using _INP/OUTP_ ??
- From: Tim Roberts
- Re: What is the difference between using IOCTL to write/read IO ports vs. modifying IOPM and using _INP/OUTP_ ??
- From: Maxim S. Shatskih
- Re: What is the difference between using IOCTL to write/read IO ports vs. modifying IOPM and using _INP/OUTP_ ??
- From: Don Burn
- Re: What is the difference between using IOCTL to write/read IO ports vs. modifying IOPM and using _INP/OUTP_ ??
- Prev by Date: Problem with WinUsb_ReadPipe
- Next by Date: Re: What is the difference between using IOCTL to write/read IO ports vs. modifying IOPM and using _INP/OUTP_ ??
- Previous by thread: Problem with WinUsb_ReadPipe
- Next by thread: Re: What is the difference between using IOCTL to write/read IO ports vs. modifying IOPM and using _INP/OUTP_ ??
- Index(es):
Relevant Pages
|