2005-04-17 02:20:36 +04: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 .
2006-04-02 03:09:26 +04:00
* /
/ * We h a v e a p r o b l e m t h a t t h e I N T O F F S E T r e g i s t e r d o e s n o t a l w a y s
* show o n e i n t e r r u p t . O c c a s i o n a l l y w e g e t t w o i n t e r r u p t s t h r o u g h
* the p r i o r i t i s e r , a n d t h i s c a u s e s t h e I N T O F F S E T r e g i s t e r t o s h o w
* what l o o k s l i k e t h e l o g i c a l - o r o f t h e t w o i n t e r r u p t n u m b e r s .
*
* Thanks t o K l a u s , S h a n n o n , e t a l f o r h e l p i n g t o d e b u g t h i s p r o b l e m
* /
# define I N T P N D ( 0 x10 )
# define I N T O F F S E T ( 0 x14 )
2005-04-17 02:20:36 +04:00
2006-01-03 20:39:34 +03: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-17 02:20:36 +04: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
2006-04-02 03:09:26 +04:00
mov \ b a s e , #S 3 C 2 4 X X _ V A _ I R Q
@@ try the interrupt offset register, since it is there
2006-06-25 00:21:37 +04:00
ldr \ i r q s t a t , [ \ b a s e , #I N T P N D ]
teq \ i r q s t a t , #0
beq 1 0 0 2 f
2006-04-02 03:09:26 +04:00
ldr \ i r q n r , [ \ b a s e , #I N T O F F S E T ]
mov \ t m p , #1
tst \ i r q s t a t , \ t m p , l s l \ i r q n r
bne 1 0 0 1 f
@@ the number specified is not a valid irq, so try
@@ and work it out for ourselves
2006-06-25 00:21:37 +04:00
mov \ i r q n r , #0 @@ start here
2006-04-02 03:09:26 +04:00
@@ work out which irq (if any) we got
2006-06-25 00:21:37 +04:00
2006-04-02 03:09:26 +04:00
movs \ t m p , \ i r q s t a t , l s l #16
addeq \ i r q n r , \ i r q n r , #16
moveq \ i r q s t a t , \ i r q s t a t , l s r #16
tst \ i r q s t a t , #0xff
addeq \ i r q n r , \ i r q n r , #8
moveq \ i r q s t a t , \ i r q s t a t , l s r #8
tst \ i r q s t a t , #0xf
addeq \ i r q n r , \ i r q n r , #4
moveq \ i r q s t a t , \ i r q s t a t , l s r #4
tst \ i r q s t a t , #0x3
addeq \ i r q n r , \ i r q n r , #2
moveq \ i r q s t a t , \ i r q s t a t , l s r #2
tst \ i r q s t a t , #0x1
addeq \ i r q n r , \ i r q n r , #1
@@ we have the value
2005-04-17 02:20:36 +04:00
1001 :
2006-06-25 00:21:37 +04:00
adds \ i r q n r , \ i r q n r , #I R Q _ E I N T 0
1002 :
2006-04-02 03:09:26 +04:00
@@ exit here, Z flag unset if IRQ
2005-04-17 02:20:36 +04:00
2006-04-02 03:09:26 +04:00
.endm
2005-04-17 02:20:36 +04:00
/* currently don't need an disable_fiq macro */
.macro disable_fiq
.endm