.TITLE GATACC Network acc 1822 driver .NLIST BEX .ENABL LC ; ; Pdp11/dcn network acc 1822 driver ; ; This module is an extension of the network processes. it transmits and ; Receives packets using the associated computer consultants (acc) 1822 ; Dma interface. ; ; Conditional assembly switches ; .IIF NDF,CS.LHD CS.LHD == 0 ;0: mdma/1822 (q-bus), 1: lh/dh (u-bus) ; ; External symbols ; .GLOBL .WAIT,.SKED,.STIM ;supervisor services .GLOBL NETINP,NETOUT ;process initialization ; ; Entry symbols ; .GLOBL ACIPAT ;input process control vector .GLOBL ACOPAT ;output process control vector ; ; System definitions ; .ASECT .MCALL .COM,.PSA,.GAT,.PAT ;dcnlib definitions .MCALL .SETV,.CTIM ;dcnlib macros .COM ;define common data .PSA ;define process stoage areas .GAT ;define gateway/bridge storage areas ; ; Module definitions ; FLPDLY = 500. ;ready-line flap delay RSTDLY = 1000. ;host tardy base delay HSTRDY = 000004 ;close host relay (acrcsr) IMPNRY = 002000 ;imp not ready (acrcsr) INPCMD = 000011 ;start input (acrcsr) OUTCMD = 000005 ;start output (acxcsr) BUSBAK = 000010 ;internal bus-back (acxcsr) .IF EQ,CS.LHD ;conditional assembly for lh/dh RSTCMD = 000200 ;mdma/1822 output reset (acxcsr) .IFF RSTCMD = 000002 ;lh/dh output reset (acxcsr) .ENDC INTENB = 000100 ;interrupt enable (acrcsr/acxcsr) ; ; Process save area extension (imr) ; . = GATENR .BLKW REGEND/2+NTISTK ;process stack IMREND = . ;end of imr extension ; ; Process save area extension (imx) ; . = GATENX .BLKW REGEND/2+NTOSTK ;process stack IMXEND = . ;end of imx extension ; ; Acc 1822 device register block (dev) ; . = 0 ACRCSR: .BLKW 1 ;input status register ACRBUF: .BLKW 1 ;input data buffer (not used) ACRADR: .BLKW 1 ;input current address ACRCNT: .BLKW 1 ;input word count ACXCSR: .BLKW 1 ;output status register ACXBUF: .BLKW 1 ;output data buffer (not used) ACXADR: .BLKW 1 ;output current address ACXCNT: .BLKW 1 ;output word count .PAGE ; ; Procedure segment ; ; Supervisor-state procedure ; Dsects: r2 = dev, r3 = par, r4 = reg, r5 = psa ; ; Note: calling process sets r0 = byte count, r1 = starting address. ; At completion of transfer r0 = byte count. returns c(cc) = 1 ; If 1822 not ready (link reset). record output timeout as hardware error. ; .PSECT $KERI,RO,I ; ; Initialize ; ACIINI: MOV #INT+EXTBAS,R1 ;allocate input vector .SETV JSR PC,.WAIT ;exit to wait state BR ACIASY ; ACOINI: ADD #4,R0 ;allocate output vector MOV #INT+EXTBAS,R1 .SETV JSR PC,.WAIT ;exit to wait state BR ACOASY ; ; Start block transfer input ; ACISIO: ADD #BUFTLR,R0 ;(allow tailing bits) ASR R0 ;establish transfer parameters NEG R0 MOV R0,ACRCNT(R2) MOV R1,ACRADR(R2) BIS #INPCMD+INTENB,ACRCSR(R2) ;start input JMP .WAIT ; ; Device interrupt input ; ACIINT: TSTB PSASTS(R5) ;is process running BMI ACORST ;branch if yes (?! acc breaks rules) MOV ACRCNT(R2),R0 ;recompute ending parameters ASL R0 ADD #BUFTLR,R0 ADD R0,@R4 ACIASY: BIT #IMPNRY,ACRCSR(R2) ;is ready line up BEQ 1$ ;branch if yes BIC #INPCMD+INTENB,ACRCSR(R2) ;no. lie low for awhile BIS #1,REGPS(R4) MOV #FLPDLY/2,R0 JMP .STIM ; 1$: JMP .SKED ;resume process ; ; Reset device ; ACORST: RTS PC ;not this one ; ; Start block transfer output ; ACOSIO: INC R0 ;compute word count ASR R0 NEG R0 MOV R0,ACXCNT(R2) MOV R1,ACXADR(R2) JSR PC,.WAIT ;enter wait state BIS #OUTCMD+INTENB,ACXCSR(R2) ;enable output MOV PARTRY(R3),R0 ;start output timeout ASH #4,R0 ;(16x base) ADD #RSTDLY,R0 SUB R0,RESTIM(R5) JMP .STIM ; ; Timer interrupt (timeout) ; ACOASY: BIC #OUTCMD+INTENB,ACXCSR(R2) ;end operation BIT #HSTRDY,ACRCSR(R2) ;is relay up BNE 1$ ;branch if yes BIS #HSTRDY,ACRCSR(R2) ;no. up relay BIS #1,REGPS(R4) ;indicate error MOV #FLPDLY,R0 JMP .STIM ; 1$: BIT #1,REGPS(R4) ;is this flap BNE 2$ ;branch if no BIC #HSTRDY,ACRCSR(R2) ;yes. down relay BIS #RSTCMD,ACXCSR(R2) ;reset transmitter MOV #FLPDLY,R0 JMP .STIM ; 2$: JMP .SKED ;resume process ; ; Device interrupt output ; ACOINT: BIC #OUTCMD+INTENB,ACXCSR(R2) ;end operation .CTIM ;clear output timeout ADD R0,RESTIM(R5) JMP .SKED ;no. resume process ; ; Data segment ; .PSECT $KERD,RO,D ; ; Process headers ; ACIPAT: .PAT IMREND,NETINP,PRI3,<0,ACIASY,ACIINI,ACISIO,ACIINT> ACOPAT: .PAT IMXEND,NETOUT,PRI3,<0,ACOASY,ACOINI,ACOSIO,ACOINT,ACORST> ; .END