AN2109 Freescale Semiconductor / Motorola, AN2109 Datasheet - Page 30

no-image

AN2109

Manufacturer Part Number
AN2109
Description
MPC555 Interrupts
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
7.3.1.2 Example 1: Exception Service Routine for Interrupt
external_interrupt_exception:
; Omit steps 1, 2- new exceptions during routine are irrecoverable
Epilog:
other_interrupt:
.name "exceptions.s"
.import counter
.section .abs.00000100
.section .abs.00000500
.text
.equ
stwu
stw
stw
stw
mfcr
stw
lis
lhz
andi.
beq
sth
lis
lwz
addi
stw
lwz
mtcrf
lwz
lwz
lwz
addi
rfi
b
r4, counter@ha
other_interrupt
r3, PISCR@l(r4)
r3, 4 (sp)
r4, 12 (sp)
r5, 16 (sp)
b _start
b external_interrupt_exception
sp, -24 (sp)
r3, 8 (sp)
r5, 16 (sp)
r3
r3, 4 (sp)
r5, r3,0x80
r3, counter@l(r4)
r3, r3, 1
0xff, r3
r3, 8 (sp)
Epilog
r4, 12 (sp)
r4, PISCR@ha
r3, PISCR@l(r4)
r3, counter@l(r4)
sp, sp, 24
PISCR, 0x2fc240
Freescale Semiconductor, Inc.
For More Information On This Product,
Rev. 0, 26 July 2001
MPC555 Interrupts
Go to: www.freescale.com
; System reset exception, per crt0 file
; Address of register PISCR
; Start prologue:
; STEP 1:
; STEP 2:
; STEP 3: SAVE OTHER APPROPRIATE CONTEXT
; Create stack frame & store backchain
; Save only gprs used for this exception
; Save CR
; All important registers are now saved
; STEP 4: DETERMINE INTERRUPT SOURCE
; Load high word of Pointer to PISCR
; Load PISCR register value
; Check for Interrupt status of the PIT
; If status was not set, check other IRQs
; STEP 5: BRANCH TO INTERRUPT HANDLER
; Perform PIT service routine right here:
; Negate interrupt request (write a 1)
; Load high word of Pointer to counter
; Load counter value to r3
; Increment counter
; Write back counter value
; STEP 6: RESTORE CONTEXTS
; Start epilog:
; Restore CR
; Mask = 1111 1111, restoring CR fields
; Restore gprs
; Restore SP, which frees up stack
; STEP 7:
; End of Interrupt -- return to program
; Insert code for other interrupts
; Do the epilog of the handler
SAVE "MACHINE CONTEXT"
MAKE MSR[RI] RECOVERABLE
RETURN TO PROGRAM
MOTOROLA
30

Related parts for AN2109