source: rtems/c/src/lib/libcpu/arm/lpc22xx/irq/bsp_irq_asm.S @ c499856

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on Mar 20, 2014 at 9:10:47 PM

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/*
2 *  LPC22XX/LPC21xx Intererrupt handler
3 *
4 *  Modified by Ray <rayx.cn@gmail.com> 2006 from Jay Monkman's code
5 *
6 *  The license and distribution terms for this file may be
7 *  found in the file LICENSE in this distribution or at
8 *  http://www.rtems.org/license/LICENSE.
9 */
10#define __asm__
11
12/*
13 * BSP specific interrupt handler for INT or FIQ. In here
14 * you do determine which interrupt happened and call its
15 * handler.
16 * Called from ISR_Handler, It is better to write in C function
17 */
18        .globl bsp_interrupt_dispatch
19bsp_interrupt_dispatch :
20#ifdef __thumb__
21    .code 16
22#endif
23
24/*
25 * Look at interrupt status register to determine source.
26 * From source, determine offset into expanded vector table
27 * and load handler address into r0.
28 */
29
30  ldr   r0, =0xFFFFF030  /* Read the vector number */
31    ldr r0, [r0]
32#ifdef __thumb__
33    push {lr}
34    ldr r2, =IRQ_return         /* prepare the return from handler  */
35    mov lr, r2
36#else
37  stmdb   sp!,{lr}
38  ldr     lr, =IRQ_return         /* prepare the return from handler  */
39#endif
40
41
42    /*C code will be called*/
43    mov pc, r0          /* EXECUTE INT HANDLER */
44
45    /*
46     * C code may come back from Thumb if --thumb-interwork flag is False
47     * Add some veneer to make sure that code back to ARM
48     */
49IRQ_return:
50#ifdef __thumb__
51    pop {r1}
52    bx  r1
53#else
54    ldmia sp!,{r1}
55    mov pc, r1
56#endif
57
Note: See TracBrowser for help on using the repository browser.