none
BusTransBusAddrToVirtual: Confusing description of AddressSpace RRS feed

  • Question

  • Hello together,

    I'm new to Windows CE driver development, so currently I spend time reading tutorials/howtos and the function description of various commonly used functions at MSDN. However, I don't understand the description of the AddressSpace-parameter of the function BusTransBusAddrToVirtual. I refer to this site: http://msdn.microsoft.com/en-us/library/ee485427.aspx

    There it says:

    "AddressSpace [in, out] Flag to indicate whether what this function maps to is in I/O space or memory space. On input, this is an initialized variable. On output, this is the flag. AddressSpace 0x0 indicates memory and AddressSpace 0x1 indicates I/O space."

    Now what does "On input, this is an initialized variable." mean? Initialized to what? I would be glad if someone could explain this to me in more detail, please.

    Thanks in advance, Wolfgang Wallner

    Edit: Sorry for the strange formatting at the beginning, somehow the post does not get displayed the way I typed it, I have to manually add tags in the post.

    Tuesday, July 20, 2010 8:25 AM

All replies

  • "AddressSpace [in, out] Flag to indicate whether what this function maps to is in I/O space or memory space. On input, this is an initialized variable. On output, this is the flag. AddressSpace 0x0 indicates memory and AddressSpace 0x1 indicates I/O space."

    Now what does "On input, this is an initialized variable." mean? Initialized to what? I would be glad if someone could explain this to me in more detail, please.

    I use the function like this in my XXX_Init method:

     

    DWORD inIoSpace = 0;<br/>
    <br/>
    bRetVal = BusTransBusAddrToVirtual(hBusAccess,
     				  (INTERFACE_TYPE) wi.dwInterfaceType,
    				  wi.dwBusNumber,
    				  PortAddress,
    				  (wi.memWindows[dwMemIndex]).dwLen,
    				  &inIoSpace,<br/>
              &pvRegisters);
    

     

    and then after the function call I check whether inIoSpace is 0 or 1.  I don't think the function cares what value it has coming in.

     

    (Ok, please ignore the html markup in my response, I can't seem to get rid of it.)
    Tuesday, July 20, 2010 3:25 PM
  • I don't think the function cares what value it has coming in.(Ok, please ignore the html markup in my response, I can't seem to get rid of it.)

    Careful, whether the function cares or not depends very much on the BUS, and that BUS may depend on the CPU.

    If you want to really understand the parameters and how they work, take a look at the source code which is avaiable in Public\Common\OAK\Drivers\CEDDK.  But to fully understand, you may also need to understand the BUS that you are working with and maybe the device on the BUS that you are accessing.


    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG http://geekswithblogs.net/bruceeitman

    Eurotech Inc.
    www.Eurotech.com
    Tuesday, July 20, 2010 3:38 PM
    Moderator