Hi Tim,
I 100% agree with you on this and that is the path we are following…The GenPort sample is just a proof of concept and to make sure that we are doing everything right to claim the resources and write to the ports. We are going to a write a new driver for doing exactly what you have stated. We will expose a API set from the driver (IOCTLS) and then write a library which issues those IOCTL to the driver. The Library will expose a bunch of API which the user mode application will use to write applications. This way the application does not even need to know the driver interfaces. We are in process of doing this. What we have done is just an initial exercise to make sure we are on the right path to achieve the objectives.
Thanks again for sharing this information.
Appreciate your help.
Ajitabh
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Thursday, July 09, 2015 11:56 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Accessing the LPC interface using Microsoft’s IPMIDrv.sys
Ajitabh Saxena (ajisaxen) wrote:
Just wanted to thank you for your help. The PORTIO driver loads
up correctly and acquires all the three port resources. After about
3-4 years I am back in windows domain and doing some useful work.
Let me give you some food for thought about this.
What you have done here is basically exposed an ISA I/O port to user mode. Your driver is little more than dumb plumbing that forces the user-mode application to think about I/O ports and specific bits within them. That’s not a very good abstraction, nor does it have any future.
Instead, you might think about your interface in a different way.
Instead of just exposing port 0x620, ask yourself “what tasks need to be done?” When the user-mode app wants to talk to the device, what is it doing? What things does it need to know? What options does it need to set? Now, think about having your driver provide those abstract functions as ioctls instead of raw I/O port access.
That way, your driver can provide a little validation to make sure the device can’t be left in an inconsistent state, or be asked to do things in the wrong order, or have undefined bits triggered. Plus, in the next generation, if the interface should happen to move to USB or PCIExpress, you can modify the driver without requiring a rewrite of the application.
Now, if you’re just writing hack-em-up tools for diagnostic use in your design lab, then you can ignore my objections. In that kind of environment, there’s nothing wrong with having the diagnostic tools think in terms of bits and registers. But if this will be released into the wild, you should seriously consider an abstraction.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer