I/O Resource Manager
The I/O Resource Manager is an intrinsic part of the Device Manager. The I/O Resource Manager tracks the available system resources initialized from the registry before any devices are loaded. This prevents accidental collisions when two or more device drivers attempt to use the same resources.
Every platform has unique IRQs and I/O space available.
The OAL and the registry usual pre-allocate IRQ and I/O space resources that bus drivers, such as the PCI bus driver and PC Card bus driver, request. The I/O Resource Manager is not, however, limited to managing only I/O and IRQ spaces. The specific set of resources available can include any that you define. Bus drivers, such as the PCI bus driver, request IRQ and I/O space resources from the I/O Resource Manager as it loads device drivers for the devices it finds. The same is true for the PC Card bus driver and I/O resources required by PC Card client drivers. The PC Card bus driver releases resources as users remove PC Cards from the system.
IRQs for built-in and fixed devices should map to interrupt identifiers (SYSINTRs)in the OAL. The IRQs for built-in and fixed device should be excluded from the available resources. IRQs used with the PCI bus are usually shared.
IRQs and I/O space resources are predefined. The HKEY_LOCAL_MACHINE\Drivers\Resources\IRQ and HKEY_LOCAL_MACHINE\Drivers\Resources\IO registry keys provide the initial state of the I/O Resource Manager. The following table shows the subkeys for these registry keys.
Subkey | Example value | Description |
---|---|---|
Identifier | DWORD:1 | Resource identifier. This is a label for a set of numbers and is defined in %_WINCEROOT%\Public\Common\DDK\Inc\Resmgr.h. |
Minimum | DWORD:1 | Smallest numbered resource of this type. |
Space | DWORD:16 | Number of resources in the resource space. |
Ranges | "1, 3-5, 8" | Comma-separated list of initially available resources ranges. The default is none. |
Shared | "4" | Comma-separated list of initially available sharable resources. The default is none. |
Note DWORD entries are interpreted as hexadecimal constants, but the strings are parsed as lists of C-style constants.
The following registry key example shows I/O Resource Manager registry settings.
; Resources available at time of Device.exe initialization.
; Key names are descriptive; resource IDs are definitive.
; System IDs are defined in ddk\inc\resmgr.h.
; HIVE BOOT SECTION
[HKEY_LOCAL_MACHINE\Drivers\Resources\IRQ]
"Identifier"=dword:1
"Minimum"=dword:1
"Space"=dword:F
"Ranges"="1,3-7,9-0xF"
"Shared"="1,3-7,9-0xF"
; I/O ranges are reserved for all drivers listed in this file that are not
; part of an expansion bus (PCI, PCMCIA, etc). If your platform does not
; have one of these peripherals, you may edit this list accordingly. This
; sample configuration assumes that, if you have any COM port, you have all of
; the lower-numbered COM ports as well.
[HKEY_LOCAL_MACHINE\Drivers\Resources\IO]
"Identifier"=dword:2
"Minimum"=dword:0
"Space"=dword:10000
IF BSP_NOSERIAL
"Ranges"="0-0x5F,0x65-0x277,0x284-0x38F,0x392-0x3DF,0x3E2-0xFFFF"
ENDIF ; BSP_NOSERIAL
IF BSP_NOSERIAL !
"Ranges"="0-0x5F,0x65-0x277,0x284-0x2F7,0x300-0x38F,0x392-0x3DF,0x3E2-0xFFFF"
ENDIF ; BSP_NOSERIAL !
IF BSP_SERIAL2
"Ranges"="0-0x5F,0x65-0x277,0x284-0x2F7,0x300-0x38F,0x392-0x3DF,0x3E2-0x3E7,0x3F0-0xFFFF"
ENDIF ; BSP_SERIAL2
IF BSP_SERIAL3
"Ranges"="0-0x5F,0x65-0x277,0x284-0x2E7,0x2F0-0x2F7,0x300-0x38F,0x392-0x3DF,0x3E2-0x3E7,0x3F0-0xFFFF"
ENDIF ; BSP_SERIAL3
If shared resources are available, you can request them at any time. They can only be set if the resource space is less than or equal to 32.
You cannot have a partial allocation or a partial release of resources; therefore, the following APIs return TRUE if the entire allocation or release succeeds, or they return FALSE is the entire allocation or release fails. The following table shows the functions you can use to define your own resources.
Function | Description |
---|---|
ResourceCreateList | Creates a valid set of numbers for use by drivers. |
ResourceRelease | Allows drivers to use operating system resources created by ResourceCreateList. |
ResourceRequest | Allows drivers to use the resources made available by ResourceRelease. |
ResourceCreateList creates a new resource type, but because you can statically initialize extensions, you can easily add these extensions to the registry key. Create a new subkey and specify an identifier between 0x80000 and 0xFFFFF, which are defined as RESMGR_BASE_OEM and RESMGR_MAX_OEM, respectively. You can also find these values in %_WINCEROOT%\Public\Common\DDK\Inc\Resmgr.h.
See Also
ResourceCreateList | ResourceRelease | ResourceRequest
Last updated on Wednesday, April 13, 2005
© 2005 Microsoft Corporation. All rights reserved.