Results 1 to 3 of 3

Thread: Writing Port drivers for Windows

  1. #1
    Senior Member Cyborg devpriya's Avatar
    Join Date
    Jul 2005
    Location
    Seattle, WA, USA
    Posts
    275

    Default Writing Port drivers for Windows

    Guys I have faced real bad experiences working with the drivers available on net for port communication on Windows XP and I guess many of you too would have faced the same.

    Although there are many drivers availble there but they somehow don't cater all our needs and are most of the time very complex to use.

    So the idea is why not write a library ourselves which would be very specific to our needs of interfaceing Robotics and Automation related hardwares to the PC.

    Even I am a newbie to this driver writing world but am ready to learn and work on it. If some of you are interested then we can form up a team and start working on it. If someone has some experience on this field then he/she can mentor this group.

    I guess this library would be an asset to our Robotics India group because I can see still many queries regarding Paraller Port interfacing problems, Serial Comm poblems and USB problems !!!!

    Please comment on the idea and in case you like it and want to be a part of the team then you are most welcome.

    If someone has seen some library already existing which is like the one I am planning to make, then please give a pointer to it and if you know, then explain its usage too. May be then we will just use it and write a wrapper on it or customize it to our Robotics needs. In that case we wont be Re-inventing the Wheel :-)
    The only difference between dreams and accomplishments is purely desire!

  2. #2
    Senior Member T-1000 debu's Avatar
    Join Date
    Jun 2007
    Location
    New Delhi, India
    Posts
    338

    Default

    @devpriya: If you are creating a Kernel Mode Driver, there is no shortcut to it. If you need a generic driver, consider using Jungo WinDriver; In which case, you can move the device control code to the application level.

    In any case, If you want the freedom to perform low-level manipulations, you will need to write low level code to handle IRQs and I/O Registers.

    I recommend however, that you get a copy of the Windows DDK (I think its now called the Windows Driver Foundation), and the Microsoft Platform SDK.

    Once you get past the inital confusion and the overwhelming-and-entirely-unecessarily-complex structure of the WinAPI, its quite simple, and the tremendous possibilities are quite exciting.

    If you are familiar with Win32 programming, then writing your first driver should be a snap. Just write the code as below:

    Code:
    #include<ntddk.h>
    #include<afxwin.h>
    #include<afxcmn.h>
    NTSTATUS DriverEntry(PDRIVER_OBJECT pDriverObject, PUNICODE_STRING pRegistryPath)
    {
        this->MessageBox("Hello World!!","Made By Me");
        return STATUS_SUCCESS;
    }
    And its as simple as that!! No doubt, you would have guessed what the driver will do each time it loads. :wink:

    The code above will execute between 0x8000000 and upwords, so its a kernel mode program, make sure you think about that when you make any dynamic define (Infact its best you dont :P ).

    You can include user-mode code too, but that will have to be in WinMain(), and dllMain(), and will make seperate *.EXE, and *.DLL files when compiled, DriverEntry() will create the *.SYS file.

    When you make your target Driver, you will need to replace the code with your own functions to handle the device, and this is where it starts to get a little complicated. You will need to handle the device I/O, IRQs and I/O registers all at the same time. I don't think that this can be explined here, it would require several hundred pages to explain in satisfactory detail about kernel-level I/O.

    Anyways, I guess you would have gotten an idea about how you can create a device driver (in the most basic sense ).

    Regards,

    Debu

  3. #3

    Default

    I find porttalk driver from BeyondLogic easy to use. They also provide driver source code incase you want to extend the functionality.

    http://www.beyondlogic.org/porttalk/porttalk.htm

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •