2005-04-16 15:20:36 -07:00
/ *
* include/ a s m - a r m / a r c h - s3 c24 1 0 / e n t r y - m a c r o . S
*
* Low- l e v e l I R Q h e l p e r m a c r o s f o r S 3 C 2 4 1 0 - b a s e d p l a t f o r m s
*
* This f i l e i s l i c e n s e d u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c
* License v e r s i o n 2 . T h i s p r o g r a m i s l i c e n s e d " a s i s " w i t h o u t a n y
* warranty o f a n y k i n d , w h e t h e r e x p r e s s o r i m p l i e d .
* Modifications :
* 1 0 - Mar- 2 0 0 5 L C V R C h a n g e d S 3 C 2 4 1 0 _ V A t o S 3 C 2 4 X X _ V A
* /
2006-01-03 17:39:34 +00:00
# include < a s m / h a r d w a r e . h >
# include < a s m / a r c h / i r q s . h >
2005-04-16 15:20:36 -07:00
.macro get_ i r q n r _ a n d _ b a s e , i r q n r , i r q s t a t , b a s e , t m p
mov \ t m p , #S 3 C 2 4 X X _ V A _ I R Q
ldr \ i r q n r , [ \ t m p , #0x14 ] @ get irq no
30000 :
teq \ i r q n r , #4
teqne \ i r q n r , #5
beq 1 0 0 2 f @ external irq reg
@ debug check to see if interrupt reported is the same
@ as the offset....
teq \ i r q n r , #0
beq 2 0 0 0 2 f
ldr \ i r q s t a t , [ \ t m p , #0x10 ] @ INTPND
mov \ i r q s t a t , \ i r q s t a t , l s r \ i r q n r
tst \ i r q s t a t , #1
bne 2 0 0 0 2 f
/ * debug/ w a r n i n g i f w e g e t a n i n v a l u d r e s p o n s e f r o m t h e
* INTOFFSET r e g i s t e r * /
# if 1
stmfd r13 ! , { r0 - r4 , r8 - r12 , r14 }
ldr r1 , [ \ t m p , #0x14 ] @ INTOFFSET
ldr r2 , [ \ t m p , #0x10 ] @ INTPND
ldr r3 , [ \ t m p , #0x00 ] @ SRCPND
adr r0 , 2 0 0 0 3 f
bl p r i n t k
b 2 0 0 0 4 f
20003 :
.ascii " < 7 > irq : err - b a d o f f s e t % d , i n t p n d = % 0 8 x , s r c p n d = % 0 8 x \ n "
.byte 0
.align 4
20004 :
mov r1 , #1
mov \ t m p , #S 3 C 2 4 X X _ V A _ I R Q
ldmfd r13 ! , { r0 - r4 , r8 - r12 , r14 }
# endif
@ try working out interrupt number for ourselves
mov \ i r q n r , #0
ldr \ i r q s t a t , [ \ t m p , #0x10 ] @ INTPND
10021 :
movs \ i r q s t a t , \ i r q s t a t , l s r #1
bcs 3 0 0 0 0 b @ try and re-start the proccess
add \ i r q n r , \ i r q n r , #1
cmp \ i r q n r , #32
ble 1 0 0 2 1 b
@ found no interrupt, set Z flag and leave
movs \ i r q n r , #0
b 1 0 0 1 f
20005 :
20002 : @ exit
@ we base the s3c2410x interrupts at 16 and above to allow
@ isa peripherals to have their standard interrupts, also
@ ensure that Z flag is un-set on exit
@ note, we cannot be sure if we get IRQ_EINT0 (0) that
@ there is simply no interrupt pending, so in all other
@ cases we jump to say we have found something, otherwise
@ we check to see if the interrupt really is assrted
adds \ i r q n r , \ i r q n r , #I R Q _ E I N T 0
teq \ i r q n r , #I R Q _ E I N T 0
bne 1 0 0 1 f @ exit
ldr \ i r q s t a t , [ \ t m p , #0x10 ] @ INTPND
teq \ i r q s t a t , #0
moveq \ i r q n r , #0
b 1 0 0 1 f
@ we get here from no main or external interrupts pending
1002 :
add \ t m p , \ t m p , #S 3 C 2 4 X X _ V A _ G P I O - S 3 C 2 4 X X _ V A _ I R Q
ldr \ i r q s t a t , [ \ t m p , # 0xa8 ] @ EXTINTPEND
ldr \ i r q n r , [ \ t m p , # 0xa4 ] @ EXTINTMASK
bic \ i r q s t a t , \ i r q s t a t , \ i r q n r @ clear masked irqs
mov \ i r q n r , #I R Q _ E I N T 4 @ start extint nos
mov \ i r q s t a t , \ i r q s t a t , l s r #4 @ ignore bottom 4 bits
10021 :
movs \ i r q s t a t , \ i r q s t a t , l s r #1
bcs 1 0 0 4 f
add \ i r q n r , \ i r q n r , #1
cmp \ i r q n r , #I R Q _ E I N T 23
ble 1 0 0 2 1 b
@ found no interrupt, set Z flag and leave
movs \ i r q n r , #0
1004 : @ ensure Z flag clear in case our MOVS shifted out the last bit
teq \ i r q n r , #0
1001 :
@ exit irq routine
.endm
/* currently don't need an disable_fiq macro */
.macro disable_fiq
.endm