none
Using Multiple IOConfig Entries RRS feed

  • Question

  • I am modifying a working, Windows 7 64-bit driver, based on the MS PortIO sample.  It currently has the following settings in the INF file:

    [LpcI2c.NT.FactDef]
    ConfigPriority=HARDRECONFIG
    IOConfig=1640-1647(ffff::)
    IOConfig=600-67f(ffff::) ; <--- THIS IS WHAT I'M ADDING
    
    [LpcI2c.LC0]
    ConfigPriority=DESIRED 
    IOConfig=1640-1647
    IOConfig=600-67f	; <--- THIS IS WHAT I'M ADDING

    My question is this:  How do I access the ports if both ranges?  My first thought was that the second range would follow immediately after the first.  Experimenting shows that the last IOConfig range specified is the one at offset 0.  However, when I try to read beyond 67f, I'm getting ERROR_NOACCESS (998).

    Regards,

    -Gene


    • Edited by genewoncook Friday, December 21, 2012 5:41 PM Clarity of title
    Friday, December 21, 2012 5:40 PM

Answers

  • If you want both ranges in one device use

    IoConfig=1640-1647,600-67f

    This will give you both of them for one device, with AddDevice recieving two port ranges.  You will need to modify the driver to support  this.


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr

    Friday, December 21, 2012 6:00 PM

All replies

  • If you want both ranges in one device use

    IoConfig=1640-1647,600-67f

    This will give you both of them for one device, with AddDevice recieving two port ranges.  You will need to modify the driver to support  this.


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr

    Friday, December 21, 2012 6:00 PM
  • I re-ran my test code with the new INF setting and excitedly waited for something to correctly show up after the first 7F ports.  Still got an error 998.  Then realized you said I needed to modify my driver. Doh.

    I didn't realize that AddDevice was going to receive two sets of ranges.  So I'm guessing that I need to keep track of the two sets of base addresses as well.

    NTSTATUS
    PortIOEvtDevicePrepareHardware(
        __in WDFDEVICE  Device,    
        __in WDFCMRESLIST  ResourcesRaw,    
        __in WDFCMRESLIST  ResourcesTranslated  
    {
        <snip>
        for (i=0; i < WdfCmResourceListGetCount(ResourcesRaw); i++) {
        deviceContext[i] -> PortBase = ULongToPtr(descTranslated->u.Port.Start.LowPart);
        deviceContext[i] -> PortCount = descTranslated ->u.Port.Length;
        }
        <snip>
    }

    So when I'm ready to write to one the two ranges, I use the appropriate PortBase address (translated) and offset accordingly.  Right?  And it just happened to be the case that with only 1 range, the PortBase address was zero.


    -Gene

    Friday, December 21, 2012 8:16 PM