MC68302 Applications
D-16
MC68302 USER’S MANUAL
MOTOROLA
* The handling of other events, e.g., CTS, CD IDL, BSY, is left to
* the users as desired.
OthrlNT
MOVE.W #$2000,1SR
RTE
CMPI.W
BNE.B
#0,D2
TX_ INT
;If they are set
;Handle Transmitter's interrupt
;Clear SCC1 bit in ISR
***************Receiver portion of SCC1 interrupt routine****************
* This routine handles received (nonempty) BD: set data length = 0,
* clear status bits, set empty =1, and update PRD
* Clear the identified events as soon as possible, so no lost
* events occur during the interrupt handling
RX_INT
MOVE.B
#9,SCCE1
* While Not-Empty continue to process the next Rx BD, Else Exit.
NxtPRD
BTST.B
#EMPTY,ST_BD(A3)
*
BNE.B
EXIT_RX
*
*** Check status in RXBD for erratic events ***
* If status bits are all 0 then continue, else SHUTDOWN the receiving
* process. This in turn shuts down the whole program, since all of
* Rx BDs will soon be unavailable (all BDs Empty = 8). Thus, the
* status of this BD will be saved for examination later.
CMPI.B
#0,SS_BD(A3)
BNE.B
EXIT_RX
* Status bits are all 0
CLR.W
LN_BD(A3)
CLR.B
SS_BD(A3)
BSET.B
#EMPTY,ST_BD(A3)
BTST.B
#WRAP,ST_BD(A3)
BNE.B
Wrap_R
ADDQ.W
#SZ_BD,A3
BRA.B
NxtPRD
Wrap_R
LEA.L
RXBD_01,A3
BRA.B
NxtPRD
EXIT_RX
JMP
CK_TX
;Clear RXF and RXB in SCCE1
;Test PRD -, Empty Bit
;Don't need to process if the
;Rx BD is still empty.
;Check status bits
;data length = 0
;Clear out all status bits
;Empty = 1
;Test Wrap bit
;Increment PRD to next BD
;Back to while loop
;Wrap back to the first Rx BD
;Back to the while loop
;Exit receiver potion of the handler
***************Conflrmer portion of SCC1 Interrupt routine ***************
* This routine handles transmitted (Not-ready) BD: set data length = 0,
* clear status bits, set ready = 1, and update CTD.
* Same as the Rx Interrupt handler, the first thing to do is to
* clear the identified events
TX_INT
MOVE.B
#$1 2,SCCE1 ;Clear TXF and TXB in SCCE1
* While Not-Ready continue to process the next Rx BD, Else Exit.
* The Ready bit should be cleared by the CP
NxtCTD
BTST.B
#READY,ST BD(A1)
BNE.B
EXIT_TX
*
* Check data length, length must be > 0 to continue the confirming process
CMPI.W
#0,LN_BD(A1)
BEQ.B
EXIT_TX
CLR.W
LN_BD(A1)
;Test PRD-> Ready Bit
;Don't need to process if the
;Tx BD is Ready.
;Test CTD –> data length
;data length = 0
***Check status in TXBD for erratic events ***
* If status bits are all 0 then continue, else SHUTDOWN the confirming
* process. This in turn shuts down the whole program, since soon