RMCreateAdapter

From EDM2
Revision as of 21:31, 23 May 2020 by Ak120 (Talk | contribs)

Jump to: navigation, search

This service is supported by both rminfo.dll and rmcalls.lib. It obtains an adapter handle and allows a driver to register an adapter with the Resource Manager. An adapter handle (HADAPTER) is returned by this service to identify the adapter. Information about the adapter being registered is passed in an ADAPTERSTRUCT.

When an adapter is registered, a list of resource handles representing hardware resources used by this adapter may be optionally passed.

Syntax

RMCreateAdapter(hDriver, hAdapter, AdapterStruct, hParentDevice, ResourceList);

Parameters

hDriver (HDRIVER) - input
Driver handle of the device driver creating this adapter.
hAdapter (PHADAPTER) - output
Pointer to the variable to receive the returned adapter handle.
AdapterStruct (PADAPTERSTRUCT) - output
Pointer to the ADAPTERSTRUCT structure.
hParentDevice (HDEVICE) - input
Indicates the handle of the parent adapter or device for the adapter being created. This field can be set to NULL, in which case the adapter will be assigned to the default system bus. If the system contains multiple buses such as ISA or PCI, the HostBusType field will be used to choose the appropriate bus.
ResourceList (PAHRESOURCE) - output
Pointer to the AHRESOURCE structure containing a count and a list of resource handles to be assigned to this adapter.

Return Code

rc (APIRET) - returns 
On systems where the Resource Manager driver is not installed, the library interface code will return RMRC_SUCCESS and an adapter handle of -1L.
RMRC_IRQ_ENTRY_ILLEGAL
A Resource Manager service was issued at interrupt time. The Resource Manager service request can be issued only at task time or INIT time.
RMRC_NULL_POINTER
A Resource Manager service received a NULL value for a pointer that was expected to contain a valid 16:16 address.
RMRC_NULL_STRINGS
A descriptive text pointer in a DRIVERSTRUCT, ADAPTERSTRUCT, or DEVICESTRUCT datatype was found to be NULL rather than pointing to the expected ASCIIZ text data.
RMRC_BAD_DRIVERHANDLE
The expected Resource Manager handles were not provided because the handle was not a valid Resource Manager handle or the handle did not point to the type of object the service required. :;RMRC_BAD_RESOURCEHANDLE: The expected Resource Manager handles were not provided because the handle was not a valid Resource Manager handle or the handle did not point to the type of object the service required.

Remarks

As an alternative, resources may be added after the adapter is created by using the RMModifyAdapter service. In this case, the ResourceList pointer should be set to NULL.

Example Code

C

#include <os2.h>
#include <rmcalls.h>

HDRIVER           hDriver;
PHADAPTER         hAdapter;
PADAPTERSTRUCT    AdapterStruct;
HDEVICE           hParentDevice;
PAHRESOURCE       ResourceList;
APIRET            rc;

rc = RMCreateAdapter(hDriver, hAdapter, AdapterStruct,
       hParentDevice, ResourceList);