Specifications

System Macros Invoked by Drivers
READ_CSR
READ_CSR
Reads the contents of a device control and status register.
Format
READ_CSR src, dest [,length=LONGWORD] [,error=BUGCHECK]
[,environ=GENERIC] [,vme=pio_reg]
Parameters
src
System virtual address or pseudo CSR address of the register in I/O space.
dest
Location to which the register data is to be returned.
[length=LONGWORD]
Size of the CSR access: BYTE, WORD, or LONGWORD. Default is LONGWORD.
[error=BUGCHECK]
Proper disposition on error. Default is BUGCHECK.
BUGCHECK Register access failure should result in an UNEXPIOINT
bugcheck.
CONTINUE A status indication should be returned in the low bit of R0: set
for success, clear for failure.
[environ=GENERIC]
Specifies how the environment is to be determined. Default is GENERIC.
DRIVER Test for CRAM access to CSRs is based on bit DEV$M_CRAMIO
in location UCB$L_DEVCHAR2. (UCB address must be stored
in R5.) This bit is set when the driver is loaded.
GENERIC Test for CRAM access to CSRs is based on bit ARC$M_CRAMIO
in location EXE$GL_ARCHFLAGS. This bit is set during system
initialization.
SPECIFIC CRAM access to CSRs is assumed.
[vme=pio_reg]
Specifies the number of the programmed I/O (PIO) register. If the targeted device
resides on a VMEbus, this argument is required.
Description
The READ_CSR macro determines what type of I/O is required for the access,
either memory mapped or CRAM (mailbox) I/O, and reads the control register
using the appropriate method.
Example
10$: READ_CSR XMI$L_XDEV(R2), R3
This invocation of the READ_CSR macro reads the XMI device type register and
returns the value in R3. It assumes that R2 contains the system virtual address
or the pseudo CSR address of the base register.
2–51