Specifications

Allocating Map Registers and Other Counted Resources
Note
Code that needs to manage items of a private counted resource can use
the system routines IOC$ALLOC_CRAB and IOC$DEALLOC_CRAB,
described in OpenVMS AXP Device Support: Reference, to create a CRAB
for that resource.
The number of resource items managed by a given CRAB is included in one
of its fields. Resource items must be allocated in a numerically ordered, or
contiguous series. A CRAB contains an array of quadword descriptors that
record the location and length of a set of contiguous resource items that are
free. Another CRAB field contains a value that is applied as a rounding
factor to requests for resources to compute the actual number of items to be
granted. For a detailed description of the CRAB, see OpenVMS AXP Device
Support: Reference.
•Acounted resource context block (CRCTX) that describes a specific
request for a counted resource. The driver and the counted resource allocation
routine exchange information in the CRCTX. A driver allocates a CRCTX
before calling the counted resource allocation routine to obtain a certain
number of items of the resource. For a detailed description of the CRCTX, see
OpenVMS AXP Device Support: Reference.
Despite the new structures and new routines, an OpenVMS AXP device driver
performs most of the same tasks as an OpenVMS VAX device driver when setting
up and completing a direct memory access (DMA) transfer. An OpenVMS AXP
device driver:
1. Calls IOC$ALLOC_CRCTX to obtain a CRCTX that describes a request for
map registers
2. Loads the request count into the CRCTX$L_ITEM_CNT field
3. Calls IOC$ALLOC_CNT_RES to request the map registers
4. Calls IOC$LOAD_MAP to load the map registers granted in the allocation
request
5. Prepares device registers for the transfer and activates the device
6. Calls IOC$DEALLOC_CNT_RES to free the registers for use by other
requesters
7. Calls IOC$DEALLOC_CRCTX to deallocate the CRCTX
The following sections describe these steps.
3.1 Allocating a Counted Resource Context Block
A driver calls IOC$ALLOC_CRCTX to allocate and initialize a counted resource
context block (CRCTX). The CRCTX describes a specific request for a given
counted resource, such as a set of map registers. The driver subsequently uses
the CRCTX as input to IOC$ALLOC_CNT_RES to allocate a set of the items
managed as a counted resource.
IOC$ALLOC_CRCTX requires as input the address of the CRAB that describes
the counted resource. For adapters that provide a counted resource, such as a set
of map registers, ADP$L_CRAB contains this address.
3–2