Direct Memory Access Using the HOLD Operation
4-28
Example 4–1. An Interrupt Service Routine Supporting INT1 and HOLD
.mmregs
;Include c2xx memory–mapped registers.
ICR
.set
0FFECh
;Define interrupt control register in I/O space.
ICRSHDW
.set
060h
;Define ICRSHDW in scratch pad location.
* Interrupt vectors *
reset
B
main
;0 – reset , Branch to main program on reset.
Int1h
B
int1_hold
;1 – external interrupt 1 or HOLD.
.space 40*16
;Fill 0000 between vectors and main program.
main:
SPLK
#0001h,imr
;Enable HOLD/INT1 interrupt line.
CLRC
INTM
wait:
B
wait
*********Interrupt service routine for HOLD logic*****************************
int1_hold:
; Perform any desired context save.
LDP
#0
;Set data–memory page to 0.
IN
ICRSHDW, ICR
;Save the contents of ICR register.
LACL
#010h
;Load accumulator (ACC) with mask for MODE bit.
AND
ICRSHDW
;Filter out all bits except MODE bit.
BCND
int1, neq
;Branch if MODE bit is 1, else in HOLD mode.
LACC
imr, 0
;Load ACC with interrupt mask register.
SPLK
#1, imr
;Mask all interrupts except interrupt1/HOLD.
IDLE
;Enter HOLD mode. Issues HOLDA, and puts
;buses in high impedance. Wait until
;rising edge is seen on HOLD/INT1 pin.
SPLK
#1, ifr
;Clear HOLD/INT1 flag in interrupt flag register
;to prevent re–entering HOLD mode.
SACL
imr
;Restore interrupt mask register.
; Perform necessary context restore.
CLRC
INTM
;Enable all interrupts.
RET
;Return from HOLD interrupt.
int1:
NOP
;Replace these NOPs with desired int1 interrupt
NOP
;service routine.
; Perform necessary context restore.
CLRC
INTM
;Enable all interrupts.
RET
;Return from interrupts.