summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/arm/vegaplus/irq/bsp_irq_asm.S
blob: 7436c3d8fe3ad7b12346a923ff9a4b129828153f (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* bsp_irq_asm.S
 *
 *  This file contains the implementation of the IRQ handler
 *  for a specific BSP
 *
 *  CopyRight (C) 2000 Canon Research France SA.
 *  Emmanuel Raguet,  mailto:raguet@crf.canon.fr
 *
 *  The license and distribution terms for this file may be
 *  found in found in the file LICENSE in this distribution or at
 *  http://www.OARcorp.com/rtems/license.html.
 *
 */

#define __asm__
#include  <registers.h>
		
/* 
 * Function to obtain, execute an IT handler and acknowledge the IT 
 */

	.globl ExecuteITHandler
	
ExecuteITHandler :	
  ldr	r0, =INTPHAI3            /* read the vector number */
  ldr	r0, [r0]	
  ldr	r0, [r0]		/* extract the IT handler @ */

  /*
   * re-enable interrupts at processor level as the current
   * interrupt source is now masked via VEGA logic
   */
  mrs	r1, cpsr
  and	r1, r1, #0xFFFFFF3F
  msr	cpsr, r1

  stmdb	  sp!,{lr}
  ldr     lr, =IRQ_return         /* prepare the return from handler  */
  mov     pc, r0			/* EXECUTE INT HANDLER */

IRQ_return:
  ldmia sp!,{lr}
  ldr	r2, =INTSTAT3		/* Ack the interrupt */
  ldr	r2, [r2]
  ldr	r1, =INTACK3
  str	r2, [r1]
  /*
   * disable interrupts_again and switch back to SVC mode
   */
  mrs	r0, cpsr
  orr	r0, r0, #0xc3
  msr	cpsr, r0

  b	ReturnFromHandler	/* return to ISR handler */
	
/* 
 * Function to acknowledge the IT controller 
 */
	.globl AckControler
	
AckControler:	  
  ldr	r0, =INTEOI3
  mov   r1, #EOI
  str	r1, [r0]

  b	ReturnFromAck		/* return to ISR handler */