.title DR-11W DRIVER FOR RSX-11M+ version 3.0 OR LATER
.nhd
.s6
.center DR-11W DRIVER
.S6
.CENTER NORMAN N. RODEWALD
.S2
.CENTER PACIFIC MISSILE TEST CENTER
.S2
.CENTER CODE 1056 (805) 989-8804
.S2
.CENTER POINT MUGU, CALIFORNIA 93042
.PAGE
.hd
.P
This driver is designed to support a DR-11W under RSX-11M+ version 3.0
and later interfaced to an ACROAMATICS 2110 Telemetry data processor
(TDP) system. The design of this driver follows the VAX/VMS XA driver in
direct memory access (DMA)
mode as closely as possible. This was done to ease compatibility
of software access to the telemetry system, and its always nice to
have a structure to follow.
.p
The driver accepts 4 general functions, read logical block, write logical
block, set characteristics, and sense characteristics. In addition, the
read and write accept subfunction codes reset, set function bits, 
and set time out.
The device is flagged as a record structured sequential device in the driver
unit control block (UCB). This
has the side effect of allowing use of read/write virtual, but the 
operating system will convert this to read/write logical and strip off all 
subfunction bits.
.p
The read and write logical functions are used to transfer data via a dma 
channel between the external device and the host PDP-11. The transfers 
can have either a reset or set function subfunction as required, and a
new time out set if required.
The processing of the subfunctions is performed prior to setting
up the DMA channel, which would allow for most hardware handshake
protocols to be fulfilled. The time out processing is performed just
before setting the go bit to start the transfer.
The transfer complete is signalled by an interrupt, which can come from either
a word count register overflow or any of the exception interrupts.
The transfer complete is signalled by placing the number of bytes transferred 
in the second word of the input output status block (IOSB)
and success (is.suc) in the first word of the IOSB. A device 
time out will place
a time out error code (ie.tmo) in the frist word of the IOSB and the CSR
in the second word.
.p
The driver allocates and releases unibus mapping registers (UMR's)
for each data transfer. If a higher speed transfer is required, the 
driver could be modified to accept device allocation and
permanently allocate UMR's at that time. The interface 
to the TDP has a 4K word first in first out (FIFO) buffer which
allows extra processing time between transfers before a data overrun
will occur.
.p
Since is is possible for rogue devices to generate spurious
interrupts, or as in this device's case, to generate a DMA
done interrupt coincident with a frame done interrupt
when the requested transfer count exactly equals a
telemetry frame. In this case, a hardware race will occur in which the 
ATTENTION interrupt and the DMA done interrupt will both be pending.
To assure correct handling of all interrupts, all transfers are
flagged with an interrupt expected in the UCB and the interrupt 
handler clears the flag. If an interrupt occurs
when the flag is clear, the interrupt is dismissed. All access
to the interrupt expected flag is done at hardware priority (PR5)
to assure proper synchronization. All setting of the CSR is also
done at device priority to assure stability.
.p
For non-DMA operations, the sense and set characteristics functions
are available. For a Set characteristic (io.stc) function, the user 
parameter (first word of the I/O parameter block) has all but the lower
three bits cleared, and these bits are then left shifted to the
control bit positions and or'ed into the CSR. For a sense characteristics,
the CSR is merely read. In both cases the entire CSR is returned in the second
word of the IOSB. No interrupt processing is expected with these functions,
and should one occur, it would be dismissed as an unexpected interrupt.
.p
The following code fragments shows a typical MACRO-11 interface to the 
QA driver.
The setting up of the subfunction codes is as follows:
.ls
.le IO.SFT=2	;set function subfunction
.le IO.RES=4	;reset subfunction
.le IO.STO=10	;set time out subfunction
.els
The access to the driver is shown as follows:
.ls
.le Assign logical unit:
.nf
	alun$s 	_#tdplun,_#"QA,0  ;
        bcc	setasn		  ;ok ?
        mov	$dsw,r0		  ;get status return
        return
.f
.le Sense characteristics
.nf
	qiow$s	_#io.sec,_#tdplun,_#tdpflg,,_#driosb,,
        bcc	15$		  ;ok?
        mov	$dsw,r0
	return
15$:    tstb	driosb+1	  ;check i/o
        bpl	20$		  ;if plus, no error
        mov	driosb,r0	  ;and io status
        return
.f
.le Write logical block, set function:
.nf
wrset:  mov	r2,incnt	  ;set character count
	qiow$s	_#io.wlb!io.sft,_#tdplun,_#tdpflg,,_#driosb,,<_#inbuf,incnt,_#wrsetup>
        bcc	10$		  ;ok ?
	mov	$dsw,ro
	return
10$:	tstb	driosb+1	  ;transfer ok?
	bmi	20$		  ;minus, no
	cmp	driosb+2,incnt	  ;how many bytes
.f
.els
.p
The read logical and set characteristics are
are very similar to the write logical and sense characteristic examples.
The use of a new time out would be similar to the set function subfunction,
being or'ed into the function code, and the new time out (in seconds) as
the fourth element of the device dependant parameters.
.p
Two command files (asm.cmd and bld.cmd) are used to assemble and build the
driver. These files assume the source code is in the named directory 
[qadrv]. The driver map is placed in UIC [1,34] and the driver and
symbol table in UIC [1,54]. 
The command file QA.CMD will load the driver at the top of the GEN 
partition and configure online the controller (QAA) and the unit (QA0).


