1 | /* |
---|
2 | * MC9328MXL Intererrupt handler |
---|
3 | * |
---|
4 | * Copyright (c) 2002 by Jay Monkman <jtm@lopingdog.com> |
---|
5 | * |
---|
6 | * The license and distribution terms for this file may be |
---|
7 | * found in the file LICENSE in this distribution or at |
---|
8 | * |
---|
9 | * http://www.rtems.com/license/LICENSE. |
---|
10 | * |
---|
11 | * |
---|
12 | * bsp_irq_asm.S,v 1.1 2002/11/13 17:55:06 joel Exp |
---|
13 | */ |
---|
14 | #define __asm__ |
---|
15 | |
---|
16 | /* |
---|
17 | * BSP specific interrupt handler for INT or FIQ. In here |
---|
18 | * you do determine which interrupt happened and call its |
---|
19 | * handler. |
---|
20 | */ |
---|
21 | .globl ExecuteITHandler |
---|
22 | ExecuteITHandler : |
---|
23 | /* |
---|
24 | * Look at interrupt status register to determine source. |
---|
25 | * From source, determine offset into expanded vector table |
---|
26 | * and load handler address into r0. |
---|
27 | */ |
---|
28 | ldr r0, =0x00223040 /* Read the vector number */ |
---|
29 | ldr r1, [r0] |
---|
30 | mov r1, r1, LSR #16 /* get the NIVECTOR into 16 LSbits */ |
---|
31 | |
---|
32 | /* find the ISR's address based on the vector */ |
---|
33 | ldr r0, =bsp_vector_table |
---|
34 | mov r1, r1, LSL #3 /* Shift vector to get offset into table */ |
---|
35 | add r1, r0, r1 /* r1 has address of vector entry */ |
---|
36 | ldr r0, [r1, #4] /* Get the data pointer */ |
---|
37 | ldr r1, [r1] /* Get the vector */ |
---|
38 | |
---|
39 | stmdb sp!,{lr} |
---|
40 | ldr lr, =IRQ_return /* prepare the return from handler */ |
---|
41 | |
---|
42 | mov pc, r1 /* EXECUTE INT HANDLER */ |
---|
43 | |
---|
44 | IRQ_return: |
---|
45 | ldmia sp!,{lr} |
---|
46 | |
---|
47 | mov pc, lr |
---|