© Koninklijke Philips Electronics N.V. 2006. All rights reserved.
User manual
Rev. 01 — 12 January 2006
261
Philips Semiconductors
UM10161
Volume 1
Chapter 21: RealMonitor
; /*********************************************************************
; * Setup Vectored Interrupt controller. DCC Rx and Tx interrupts
; * generate Non Vectored IRQ request. rm_init_entry is aware
; * of the VIC and it enables the DBGCommRX and DBGCommTx interrupts.
; * Default vector address register is programmed with the address of
; * Non vectored app_irqDispatch mentioned in this example. User can setup
; * Vectored IRQs or FIQs here.
; *********************************************************************/
VICBaseAddr
EQU 0xFFFFF000 ; VIC Base address
VICDefVectAddrOffset EQU 0x34
LDR r0,
=VICBaseAddr
LDR r1,
=app_irqDispatch
STR r1,
[r0,#VICDefVectAddrOffset]
BL rm_init_entry ;Initialize
RealMonitor
;enable FIQ and IRQ in ARM Processor
MRS r1, CPSR
; get the CPSR
BIC r1, r1, #0xC0
; enable IRQs and FIQs
MSR CPSR_c, r1
; update the CPSR
; /*********************************************************************
; * Get the address of the User entry point.
; *********************************************************************/
LDR lr,
=User_Entry
MOV pc,
lr
; /*********************************************************************
; * Non vectored irq handler (app_irqDispatch)
; *********************************************************************/
AREA app_irqDispatch, CODE
VICVectAddrOffset EQU 0x30
app_irqDispatch
;enable interrupt nesting
STMFD sp!, {r12,r14}
MRS r12, spsr
;Save SPSR in to r12
MSR cpsr_c,0x1F
;Re-enable IRQ, go to system mode
;User should insert code here if non vectored Interrupt sharing is
;required. Each non vectored shared irq handler must return to
;the interrupted instruction by using the following code.
;
MSR cpsr_c, #0x52
;Disable irq, move to IRQ mode
;
MSR spsr, r12
;Restore SPSR from r12
;
STMFD sp!, {r0}
;
LDR r0,
=VICBaseAddr
;
STR r1, [r0,#VICVectAddrOffset]
;Acknowledge Non Vectored irq has finished
;
LDMFD sp!, {r12,r14,r0}
;Restore registers
;
SUBS pc, r14, #4
;Return to the interrupted instruction
;user interrupt did not happen so call rm_irqhandler2. This handler
;is not aware of the VIC interrupt priority hardware so trick
;rm_irqhandler2 to return here