.INCLUDE /$COMMON.MAC/ ; Get COMMON definitions ; Ethernet .SPEC function definitions .DSECT -4 NI.PHY: .BLKB ;Set new physical address NI.EML: .BLKB ;Enable multicast address(es) NI.XFL: .BLKB ;Transfer line counters NI.LCT: .BLKB ;Gather line counters NI.CNT: .BLKB ;Gather circuit counters NI.XFR: .BLKB ;Transfer circuit counters TITLE ETHER,,01,18-Mar-87,DBM,<01,1> .PSECT ETHERD,RW,LCL,REL,CON BCOUNT::.WORD 0 ;To return the byte count of reads to BP2 .PSECT ETHERM,RO,LCL,REL,CON ;+ ; Routines in this file are: ; ; ENBMUL - Enable multicast address(es) ; CHGPHY - Change physical Ethernet address ; XFRLIN - Transfer line counters to buffer ; XFRCIR - Transfer circuit counters to buffer ; ; Also in this file are two additional routines: ; ; EREAD - Perform a read on a channel with modifiers ; EWRITE - Perform a write on a channel with specified XRBC and XRLEN ; ; These routines are here for two reasons: ; 1) BASIC-PLUS-2 uses the COUNT variable for both XRBC and XRLEN ; 2) BASIC-PLUS-2 V2.3 does not pass the RECORD modifier on GETs ;- ;+ ; CLRXRB - Clear out the XRB ; ; CALL CLRXRB ;- CLRXRB: PUSH ;Save work registers MOV #XRB,R0 ;Point to the XRB MOV #,R1 ;Get length in words 10$: CLR (R0)+ ;Clear a word SOB R1,10$ ;On to the next POP ;Restore work registers RETURN ;Back to caller ;+ ; EREAD - Perform a read with a RECORD modifier ; ; CALL EREAD( CHANNEL, BUFFER, BUFLEN, MODIFIER ) ;- EREAD:: CALL CLRXRB ;Clear out the XRB MOVB @2(R5),XRB+XRCI ;Set the channel number ASLB XRB+XRCI ; * 2 MOV 4(R5),XRB+XRLOC ;Set buffer address MOV @6(R5),XRB+XRLEN ;Set buffer length MOV @10(R5),XRB+XRMOD ;Set RECORD modifier .READ ;Do the I/O MOV XRB+XRBC,BCOUNT ;Copy the number of bytes read MOVB FIRQB,R0 ;Any error? BEQ 10$ ;Nope, good. TRAP 377 ;Let BP2 handle it. 10$: RETURN ;All done ;+ ; EWRITE - Perform a write with variable buffer sizes ; ; CALL EWRITE( CHANNEL, BUFFER, BUFLEN, BUFCNT ) ; ;- EWRITE::CALL CLRXRB ;Clear out the XRB MOVB @2(R5),XRB+XRCI ;Set the channel number ASLB XRB+XRCI ; * 2 MOV 4(R5),XRB+XRLOC ;Set buffer address MOV @6(R5),XRB+XRLEN ;Set buffer length MOV @10(R5),XRB+XRBC ;Set byte count .WRITE ;Do the I/O MOVB FIRQB,R0 ;Any error? BEQ 10$ ;Nope, good. TRAP 377 ;Let BP2 handle it. 10$: RETURN ;All done ;+ ; ENBMUL - Enable multicast addresses on an Ethernet device ; ; CALL ENBMUL( CHANNEL, BUFFER, COUNT ) ;- ENBMUL::CALL CLRXRB ;Clear out the XRB MOVB @2(R5),XRB+XRCI ;Set the channel number ASLB XRB+XRCI ; * 2 MOV 4(R5),XRB+XRLOC ;Set buffer address MOV @6(R5),R1 ;Get number of multicasts MUL #6,R1 ;Compute byte count MOV R1,XRB+XRBC ;Set byte count MOVB #ETHHND,XRB+XRBLKM ;Set device hander MOV #NI.EML,XRB+XRLEN ;Set .SPEC function code .SPEC ;Perform the .SPEC call MOVB FIRQB,R0 ;Any error? BEQ 10$ ;Nope, good. TRAP 377 ;Let BP2 handle it. 10$: RETURN ;All done ;+ ; CHGPHY - Change the physical address of an Ethernet device ; ; CALL CHGPHY( CHANNEL, BUFFER ) ;- CHGPHY::CALL CLRXRB ;Clear out the XRB MOVB @2(R5),XRB+XRCI ;Set the channel number ASLB XRB+XRCI ; * 2 MOV 4(R5),XRB+XRLOC ;Set buffer address MOV #6,XRB+XRBC ;Set byte count (MUST be 6) MOVB #ETHHND,XRB+XRBLKM ;Set device hander MOV #NI.PHY,XRB+XRLEN ;Set .SPEC function code .SPEC ;Perform the .SPEC call MOVB FIRQB,R0 ;Any error? BEQ 10$ ;Nope, good. TRAP 377 ;Let BP2 handle it. 10$: RETURN ;All done ;+ ; XFRLIN - Transfer line counters to buffer ; ; CALL XFRLIN( CHANNEL, BUFFER, BUFLEN, ZERO_FLAG ) ; ; First, we have to gather the counters. Then we ; can transfer them to our buffer. ;- XFRLIN::CALL CLRXRB ;Clear out the XRB MOVB @2(R5),R1 ;Get the channel number ASLB R1 ; * 2 MOVB R1,XRB+XRCI ;Set the channel number MOVB #ETHHND,XRB+XRBLKM ;Set device hander MOV #NI.LCT,XRB+XRLEN ;Set Get Line Counter function code .SPEC ;Perform the .SPEC call MOVB FIRQB,R0 ;Any error? BEQ 10$ ;Nope, good. TRAP 377 ;Let BP2 handle it. 10$: CALL CLRXRB ;Clear out the XRB ; .SLEEP ;Get a fresh time slice to give the ;controller time to get the counters MOVB R1,XRB+XRCI ;Set the channel number MOV 4(R5),XRB+XRLOC ;Set buffer address MOV @6(R5),XRB+XRBC ;Set byte count MOVB @10(R5),XRB+XRBLK ;Set/Clear zero after read flag MOVB #ETHHND,XRB+XRBLKM ;Set device hander MOV #NI.XFL,XRB+XRLEN ;Set XFR Line Counters function code .SPEC ;Perform the .SPEC call MOVB FIRQB,R0 ;Any error? BEQ 20$ ;Nope, good. ; CMP R0,#DATERR ;Still processing the get counters? ; BEQ 10$ ;Yep, wait and try again TRAP 377 ;Let BP2 handle the error. 20$: RETURN ;All done ;+ ; XFRCIR - Transfer circuit counters to buffer ; ; CALL XFRCIR( CHANNEL, BUFFER, BUFLEN, ZERO_FLAG ) ; ; First, we have to gather the counters. Then we ; can transfer them to our buffer. ;- XFRCIR::CALL CLRXRB ;Clear out the XRB MOVB @2(R5),R1 ;Get the channel number ASLB R1 ; * 2 MOVB R1,XRB+XRCI ;Set the channel number MOVB #ETHHND,XRB+XRBLKM ;Set device hander ; MOV #NI.CNT,XRB+XRLEN ;Set Get Circuit Counters function code .ASSUME NI.CNT EQ 0 .SPEC ;Perform the .SPEC call MOVB FIRQB,R0 ;Any error? BEQ 10$ ;Nope, good. TRAP 377 ;Let BP2 handle it. 10$: CALL CLRXRB ;Clear out the XRB ; .SLEEP ;Get a fresh time slice to give the ;controller time to get the counters MOVB R1,XRB+XRCI ;Set the channel number MOV 4(R5),XRB+XRLOC ;Set buffer address MOV @6(R5),XRB+XRBC ;Set byte count MOVB @10(R5),XRB+XRBLK ;Set/Clear zero after read flag MOVB #ETHHND,XRB+XRBLKM ;Set device hander MOV #NI.XFR,XRB+XRLEN ;Set XFR circuit counters function code .SPEC ;Perform the .SPEC call MOVB FIRQB,R0 ;Any error? BEQ 20$ ;Nope, good. ; CMP R0,#DATERR ;Still processing the get counters? ; BEQ 10$ ;Yep, wait and try again TRAP 377 ;Let BP2 handle the error. 20$: RETURN ;All done .END