Specifications

Accessing Device Interface Registers
2.6 Constructing a Mailbox Command Within a CRAM
2.6 Constructing a Mailbox Command Within a CRAM
Once it has allocated CRAMs for its operations on device registers, an OpenVMS
AXP device driver initializes each CRAM, so that it can use the CRAM in a
transaction to a device interface register.
A driver initializes a CRAM by calls IOC$CRAM_CMD, specifying the cmd_
index, byte_offset, and adp_ptr, and cram_ptr iohandle arguments.
IOC$CRAM_CMD uses the input parameters supplied in the call to generate
values for the command, mask, and I/O bus address fields of the CRAM that are
specific to the bus that is the target of the mailbox operation.
Use the cmd_index argument to indicate the size and type of the register
operation the mailbox describes. Although the cramdef.h system header file
defines the command indices listed in Table 2–2, the actual commands supported
under a given processor–I/O subsystem configuration vary from configuration
to configuration. (Your specification of the adp argument allows IOC$CRAM_
CMD to find the location of the command table that corresponds to a given
I/O interconnect.) If you specify a command index that does not correspond to
a supported command on the current system, IOC$CRAM_CMD returns the
SS$_BADPARAM status.
Table 2–2 Mailbox Command Indices Defined by cramdef.h
Command Index Description
CRAMCMD$K_RDQUAD32 Quadword read in 32-bit space
CRAMCMD$K_RDLONG32 Longword read in 32-bit space
CRAMCMD$K_RDWORD32 Word read in 32-bit space
CRAMCMD$K_RDBYTE32 Byte read in 32-bit space
CRAMCMD$K_WTQUAD32 Quadword write in 32-bit space
CRAMCMD$K_WTLONG32 Longword write in 32-bit space
CRAMCMD$K_WTWORD32 Word write in 32-bit space
CRAMCMD$K_WTBYTE32 Byte write in 32-bit space
CRAMCMD$K_RDQUAD64 Quadword read in 64 bit space
CRAMCMD$K_RDLONG64 Longword read in 64 bit space
CRAMCMD$K_RDWORD64 Word read in 64 bit space
CRAMCMD$K_RDBYTE64 Byte read in 64 bit space
CRAMCMD$K_WTQUAD64 Quadword write in 64 bit space
CRAMCMD$K_WTLONG64 Longword write in 64 bit space
CRAMCMD$K_WTWORD64 Word write in 64 bit space
CRAMCMD$K_WTBYTE64 Byte write in 64 bit space
Use the byte_offset argument to specify the location of the device register that
is the object of the mailbox command. Include the cram argument to identify
the CRAM that contains the hardware I/O mailbox fields IOC$CRAM_CMD is to
initialize.
Before using the hardware I/O mailbox in a write transaction to a device interface
register, the driver must insert the data to be written to the register into
CRAM$Q_WDATA.
2–6