summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libcpu/arm/at91rm9200/irq/bsp_irq_asm.S
blob: 36a34b1edea2dda019f731610d783be8b4d25a16 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
 * Atmel AT91RM9200 Interrupt handler
 *
 * Copyright (c) 2004 by Jay Monkman <jtm@lopgindog.com>
 *      
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *
 *  http://www.OARcorp.com/rtems/license.html.
 *
 *
 *  $Id$
 */
#define __asm__
        
        .globl ExecuteITHandler
ExecuteITHandler :
/*
 * Look at interrupt status register to determine source.
 * From source, determine offset into expanded vector table
 * and load handler address into r0.
 */
        ldr     r0, =0xFFFFF100   /* AIC_CTL_BASE + AIC_IVR */
        ldr     r1, [r0]                
        str     r1, [r0]          /* write back in case we are using protect */

        stmdb   sp!,{lr}
        ldr     lr, =IRQ_return   /* prepare the return from handler  */

        mov     pc, r1            /* execute handler */

IRQ_return:
        ldr   r2, =0xFFFFF130     /* AIC_CTL_BASE + AIC_EIOCR */
        str   r1, [r2]
       
        ldmia sp!,{lr}

        mov pc, lr