2010-11-18 10:07:27 +03:00
/ *
2010-12-20 18:40:51 +03:00
* Copyright ( C ) 2 0 1 0 M a g n u s D a m m
2010-11-18 10:07:27 +03:00
* Copyright ( C ) 2 0 0 8 R e n e s a s S o l u t i o n s C o r p .
*
* This p r o g r a m i s f r e e s o f t w a r e ; you can redistribute it and/or modify
* it 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 L i c e n s e a s p u b l i s h e d b y
* the F r e e S o f t w a r e F o u n d a t i o n ; version 2 of the License.
*
* This p r o g r a m i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l ,
* but W I T H O U T A N Y W A R R A N T Y ; without even the implied warranty of
* MERCHANTABILITY o r F I T N E S S F O R A P A R T I C U L A R P U R P O S E . S e e t h e
* GNU G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s .
*
* You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e
* along w i t h t h i s p r o g r a m ; if not, write to the Free Software
* Foundation, I n c . , 5 1 F r a n k l i n S t , F i f t h F l o o r , B o s t o n , M A 0 2 1 1 0 - 1 3 0 1 U S A
* /
# include < m a c h / i r q s . h >
2010-12-20 18:40:51 +03:00
# define I N T C A _ B A S E 0 x e 6 9 8 0 0 0 0
# define I N T F L G A _ O F F S 0 x00 0 0 0 0 1 8 / * a c c e p t p e n d i n g i n t e r r u p t * /
# define I N T E V T A _ O F F S 0 x00 0 0 0 0 2 0 / * v e c t o r n u m b e r o f a c c e p t e d i n t e r r u p t * /
# define I N T L V L A _ O F F S 0 x00 0 0 0 0 3 0 / * p r i o r i t y l e v e l o f a c c e p t e d i n t e r r u p t * /
# define I N T L V L B _ O F F S 0 x00 0 0 0 0 3 4 / * p r e v i o u s p r i o r i t y l e v e l * /
2010-11-18 10:07:27 +03:00
.macro disable_fiq
.endm
.macro get_ i r q n r _ p r e a m b l e , b a s e , t m p
2010-12-20 18:40:51 +03:00
ldr \ b a s e , =INTCA_BASE
2010-11-18 10:07:27 +03:00
.endm
.macro arch_ r e t _ t o _ u s e r , t m p1 , t m p2
.endm
.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
2010-12-20 18:40:51 +03:00
/ * The s i n g l e I N T F L G A r e a d a c c e s s b e l o w r e s u l t s i n t h e f o l l o w i n g :
*
* 1 . INTLVLB i s u p d a t e d w i t h o l d p r i o r i t y v a l u e f r o m I N T L V L A
* 2 . Highest p r i o r i t y i n t e r r u p t i s a c c e p t e d
* 3 . INTLVLA i s u p d a t e d t o c o n t a i n p r i o r i t y o f a c c e p t e d i n t e r r u p t
* 4 . Accepted i n t e r r u p t v e c t o r i s s t o r e d i n I N T F L G A a n d I N T E V T A
* /
ldr \ i r q n r , [ \ b a s e , #I N T F L G A _ O F F S ]
/ * Restore I N T L V L A w i t h t h e v a l u e s a v e d i n I N T L V L B .
* This i s r e q u i r e d t o s u p p o r t i n t e r r u p t p r i o r i t i e s p r o p e r l y .
* /
ldrb \ t m p , [ \ b a s e , #I N T L V L B _ O F F S ]
strb \ t m p , [ \ b a s e , #I N T L V L A _ O F F S ]
/* Handle invalid vector number case */
2010-11-18 10:07:27 +03:00
cmp \ i r q n r , #0
beq 1 0 0 0 f
2010-12-20 18:40:51 +03:00
/* Convert vector to irq number, same as the evt2irq() macro */
2010-11-18 10:07:27 +03:00
lsr \ i r q n r , \ i r q n r , #0x5
subs \ i r q n r , \ i r q n r , #16
1000 :
.endm