Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:22:49

0001 /*
0002  * Cirrus EP7312 Intererrupt handler
0003  */
0004 
0005 /*
0006  * Copyright (c) 2002 by Jay Monkman <jtm@smoothsmoothie.com>
0007  *
0008  * Copyright (c) 2002 by Charlie Steader <charlies@poliac.com>
0009  *
0010  *  The license and distribution terms for this file may be
0011  *  found in the file LICENSE in this distribution or at
0012  *  http://www.rtems.org/license/LICENSE.
0013 */
0014 
0015 #define __asm__
0016 #include <bsp.h>
0017 #include <bsp/irq.h>
0018 
0019     .extern edb7312_interrupt_dispatch
0020 
0021 /*
0022  * Function to obtain, execute an IT handler and acknowledge the IT
0023  */
0024 
0025     .globl bsp_interrupt_dispatch
0026 bsp_interrupt_dispatch :
0027 /*
0028  * Look at interrupt status register to determine source.
0029  * From source, determine offset into expanded vector table
0030  * and load handler address into r0.
0031  */
0032 
0033   ldr   r1, =0x80000000 /* close to interrupt status/mask registers 1 */
0034   ldr   r2, =0x80001000 /* close to interrupt status/mask registers 2 */
0035   ldr   r3, =0x80002000 /* close to interrupt status/mask registers 3 */
0036 
0037   stmdb   sp!,{r4, r5, r6}
0038 
0039 /*
0040  * INTSR3
0041  */
0042 check_dai:
0043   ldr   r4, [r3, #0x240]
0044   ldr   r5, [r3, #0x280]
0045   and   r6, r4, r5 /* only look at interrupts which are enabled */
0046   tst   r6, #0x0001
0047   beq   check_extfiq
0048   mov   r0, #BSP_DAIINT
0049   b     get_handler
0050 
0051 /*
0052  * INTSR1
0053  */
0054 check_extfiq:
0055   ldr   r4, [r1, #0x240]
0056   ldr   r5, [r1, #0x280]
0057   and   r6, r4, r5 /* only look at interrupts which are enabled */
0058   tst   r6, #0x0001
0059   beq   check_bl
0060   mov   r0, #BSP_EXTFIQ
0061   b     get_handler
0062 
0063 check_bl:
0064 #if 0
0065 MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
0066   ldr   r4, [r1, #0x240]
0067   ldr   r5, [r1, #0x280]
0068   and   r6, r4, r5 /* only look at interrupts which are enabled */
0069 #endif
0070   tst   r6, #0x0002
0071   beq   check_we
0072   mov   r0, #BSP_BLINT
0073   b     get_handler
0074 
0075 check_we:
0076 #if 0
0077 MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
0078   ldr   r4, [r1, #0x240]
0079   ldr   r5, [r1, #0x280]
0080   and   r6, r4, r5 /* only look at interrupts which are enabled */
0081 #endif
0082   tst   r6, #0x0004
0083   beq   check_mc
0084   mov   r0, #BSP_WEINT
0085   b     get_handler
0086 
0087 check_mc:
0088 #if 0
0089 MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
0090   ldr   r4, [r1, #0x240]
0091   ldr   r5, [r1, #0x280]
0092   and   r6, r4, r5 /* only look at interrupts which are enabled */
0093 #endif
0094   tst   r6, #0x0008
0095   beq   check_cs
0096   mov   r0, #BSP_MCINT
0097   b     get_handler
0098 
0099 check_cs:
0100 #if 0
0101 MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
0102   ldr   r4, [r1, #0x240]
0103   ldr   r5, [r1, #0x280]
0104   and   r6, r4, r5 /* only look at interrupts which are enabled */
0105 #endif
0106   tst   r6, #0x0010
0107   beq   check_e1
0108   mov   r0, #BSP_CSINT
0109   b     get_handler
0110 
0111 check_e1:
0112 #if 0
0113 MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
0114   ldr   r4, [r1, #0x240]
0115   ldr   r5, [r1, #0x280]
0116   and   r6, r4, r5 /* only look at interrupts which are enabled */
0117 #endif
0118   tst   r6, #0x0020
0119   beq   check_e2
0120   mov   r0, #BSP_EINT1
0121   b     get_handler
0122 
0123 check_e2:
0124 #if 0
0125 MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
0126   ldr   r4, [r1, #0x240]
0127   ldr   r5, [r1, #0x280]
0128   and   r6, r4, r5 /* only look at interrupts which are enabled */
0129 #endif
0130   tst   r6, #0x0040
0131   beq   check_e3
0132   mov   r0, #BSP_EINT2
0133   b     get_handler
0134 
0135 check_e3:
0136 #if 0
0137 MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
0138   ldr   r4, [r1, #0x240]
0139   ldr   r5, [r1, #0x280]
0140   and   r6, r4, r5 /* only look at interrupts which are enabled */
0141 #endif
0142   tst   r6, #0x0080
0143   beq   check_tc1
0144   mov   r0, #BSP_EINT3
0145   b     get_handler
0146 
0147 check_tc1:
0148 #if 0
0149 MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
0150   ldr   r4, [r1, #0x240]
0151   ldr   r5, [r1, #0x280]
0152   and   r6, r4, r5 /* only look at interrupts which are enabled */
0153 #endif
0154   tst   r6, #0x0100
0155   beq   check_tc2
0156   mov   r0, #BSP_TC1OI
0157   b     get_handler
0158 
0159 check_tc2:
0160 #if 0
0161 MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
0162   ldr   r4, [r1, #0x240]
0163   ldr   r5, [r1, #0x280]
0164   and   r6, r4, r5 /* only look at interrupts which are enabled */
0165 #endif
0166   tst   r6, #0x0200
0167   beq   check_rtc
0168   mov   r0, #BSP_TC2OI
0169   b     get_handler
0170 
0171 check_rtc:
0172 #if 0
0173 MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
0174   ldr   r4, [r1, #0x240]
0175   ldr   r5, [r1, #0x280]
0176   and   r6, r4, r5 /* only look at interrupts which are enabled */
0177 #endif
0178   tst   r6, #0x0400
0179   beq   check_tick
0180   mov   r0, #BSP_RTCMI
0181   b     get_handler
0182 
0183 check_tick:
0184 #if 0
0185 MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
0186   ldr   r4, [r1, #0x240]
0187   ldr   r5, [r1, #0x280]
0188   and   r6, r4, r5 /* only look at interrupts which are enabled */
0189 #endif
0190   tst   r6, #0x0800
0191   beq   check_utx1
0192   mov   r0, #BSP_TINT
0193   b     get_handler
0194 
0195 check_utx1:
0196 #if 0
0197 MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
0198   ldr   r4, [r1, #0x240]
0199   ldr   r5, [r1, #0x280]
0200   and   r6, r4, r5 /* only look at interrupts which are enabled */
0201 #endif
0202   tst   r6, #0x1000
0203   beq   check_urx1
0204   mov   r0, #BSP_UTXINT1
0205   b     get_handler
0206 
0207 check_urx1:
0208 #if 0
0209 MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
0210   ldr   r4, [r1, #0x240]
0211   ldr   r5, [r1, #0x280]
0212   and   r6, r4, r5 /* only look at interrupts which are enabled */
0213 #endif
0214   tst   r6, #0x2000
0215   beq   check_ums
0216   mov   r0, #BSP_URXINT1
0217   b     get_handler
0218 
0219 check_ums:
0220 #if 0
0221 MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
0222   ldr   r4, [r1, #0x240]
0223   ldr   r5, [r1, #0x280]
0224   and   r6, r4, r5 /* only look at interrupts which are enabled */
0225 #endif
0226   tst   r6, #0x4000
0227   beq   check_sse
0228   mov   r0, #BSP_UMSINT
0229   b     get_handler
0230 
0231 check_sse:
0232 #if 0
0233 MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
0234   ldr   r4, [r1, #0x240]
0235   ldr   r5, [r1, #0x280]
0236   and   r6, r4, r5 /* only look at interrupts which are enabled */
0237 #endif
0238   tst   r6, #0x8000
0239   beq   check_kbd
0240   mov   r0, #BSP_SSEOTI
0241   b     get_handler
0242 
0243 /*
0244  * INTSR2
0245  */
0246 check_kbd:
0247   ldr   r4, [r2, #0x240]
0248   ldr   r5, [r2, #0x280]
0249   and   r6, r4, r5 /* only look at interrupts which are enabled */
0250   tst   r6, #0x0001
0251   beq   check_ss2rx
0252   mov   r0, #BSP_KBDINT
0253   b     get_handler
0254 
0255 check_ss2rx:
0256 #if 0
0257 MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
0258   ldr   r4, [r2, #0x240]
0259   ldr   r5, [r2, #0x280]
0260   and   r6, r4, r5 /* only look at interrupts which are enabled */
0261 #endif
0262   tst   r6, #0x0002
0263   beq   check_ss2tx
0264   mov   r0, #BSP_SS2RX
0265   b     get_handler
0266 
0267 check_ss2tx:
0268 #if 0
0269 MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
0270   ldr   r4, [r2, #0x240]
0271   ldr   r5, [r2, #0x280]
0272   and   r6, r4, r5 /* only look at interrupts which are enabled */
0273 #endif
0274   tst   r6, #0x0004
0275   beq   check_utx2
0276   mov   r0, #BSP_SS2TX
0277   b     get_handler
0278 
0279 check_utx2:
0280 #if 0
0281 MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
0282   ldr   r4, [r2, #0x240]
0283   ldr   r5, [r2, #0x280]
0284   and   r6, r4, r5 /* only look at interrupts which are enabled */
0285 #endif
0286   tst   r6, #0x1000
0287   beq   check_urx2
0288   mov   r0, #BSP_UTXINT2
0289   b     get_handler
0290 
0291 check_urx2:
0292 #if 0
0293 MUST REMEMBER TO UNCOMMENT IF THIS HANDLER MOVES
0294   ldr   r4, [r2, #0x240]
0295   ldr   r5, [r2, #0x280]
0296   and   r6, r4, r5 /* only look at interrupts which are enabled */
0297 #endif
0298   tst   r6, #0x2000
0299   beq   IRQ_NoInterrupt
0300   mov   r0, #BSP_URXINT2
0301   b     get_handler
0302 
0303 get_handler:
0304 
0305   ldmia   sp!,{r4, r5, r6}
0306 
0307   /*
0308    * re-enable interrupts at processor level as the current
0309    * interrupt source is now masked via VEGA logic
0310    */
0311 /*
0312   mrs   r1, cpsr
0313   and   r1, r1, #0xFFFFFF3F
0314   msr   cpsr, r1
0315 */
0316 
0317   stmdb sp!,{lr}
0318   bl    edb7312_interrupt_dispatch
0319   ldmia sp!,{lr}
0320 
0321 IRQ_NoInterrupt:
0322   /* return to the "main" interrupt handler */
0323   mov pc, lr