2005-04-16 15:20:36 -07:00
/ *
* include/ a s m - a r m / a r c h - l h7 a40 x / 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 L H 7 A 4 0 x 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-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
2006-05-16 11:41:28 +01:00
/ * In o r d e r t o a l l o w t h e r e t o b e s u p p o r t f o r b o t h o f t h e p r o c e s s o r
classes a t t h e s a m e t i m e , w e m a k e a h a c k h e r e t h a t i s n ' t v e r y
pretty. A t s t a r t u p , t h e l i n k p o i n t e d t o w i t h t h e
branch_ i r q _ l h7 a40 0 s y m b o l i s r e p l a c e d w i t h a N O P w h e n t h e C P U i s
detected a s a l h7 a40 4 .
2005-04-16 15:20:36 -07:00
2006-05-16 11:41:28 +01:00
* * * FIXME : we s h o u l d c l e a n t h i s u p s o t h a t t h e r e i s o n l y o n e
implementation f o r e a c h C P U ' s d e s i g n .
* /
# if d e f i n e d ( C O N F I G _ A R C H _ L H 7 A 4 0 0 ) & & d e f i n e d ( C O N F I G _ A R C H _ L H 7 A 4 0 4 )
.macro disable_fiq
.endm
2007-02-16 22:16:32 +01:00
.macro get_ i r q n r _ p r e a m b l e , b a s e , t m p
.endm
.macro arch_ r e t _ t o _ u s e r , t m p1 , t m p2
.endm
2006-05-16 11:41:28 +01: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
branch_irq_lh7a400 : b 1 0 0 0 f
@ Implementation of the LH7A404 get_irqnr_and_base.
mov \ i r q n r , #0 @ VIC1 irq base
mov \ b a s e , #i o _ p 2 v ( 0 x80 0 0 0 0 0 0 ) @ APB registers
add \ b a s e , \ b a s e , #0x8000
ldr \ t m p , [ \ b a s e , #0x0030 ] @ VIC1_VECTADDR
tst \ t m p , #V A _ V E C T O R E D @ D i r e c t v e c t o r e d
bne 1 0 0 2 f
tst \ t m p , #V A _ V I C 1 D E F A U L T @ Default vectored VIC1
ldrne \ i r q s t a t , [ \ b a s e , #0 ] @ VIC1_IRQSTATUS
bne 1 0 0 1 f
add \ b a s e , \ b a s e , #( 0xa000 - 0 x80 0 0 )
ldr \ t m p , [ \ b a s e , #0x0030 ] @ VIC2_VECTADDR
tst \ t m p , #V A _ V E C T O R E D @ D i r e c t v e c t o r e d
bne 1 0 0 2 f
ldr \ i r q s t a t , [ \ b a s e , #0 ] @ VIC2_IRQSTATUS
mov \ i r q n r , #32 @ VIC2 irq base
1001 : movs \ i r q s t a t , \ i r q s t a t , l s r #1 @ Shift into carry
bcs 1 0 0 8 f @ Bit set; irq found
add \ i r q n r , \ i r q n r , #1
bne 1 0 0 1 b @ Until no bits
b 1 0 0 9 f @ Nothing? Hmm.
1002 : and \ i r q n r , \ t m p , #0x3f @ Mask for valid bits
1008 : movs \ i r q s t a t , #1 @ Force !Z
str \ t m p , [ \ b a s e , #0x0030 ] @ Clear vector
b 1 0 0 9 f
@ Implementation of the LH7A400 get_irqnr_and_base.
1000 : mov \ i r q n r , #0
mov \ b a s e , #i o _ p 2 v ( 0 x80 0 0 0 0 0 0 ) @ APB registers
ldr \ i r q s t a t , [ \ b a s e , #0x500 ] @ PIC INTSR
1001 : movs \ i r q s t a t , \ i r q s t a t , l s r #1 @ Shift into carry
bcs 1 0 0 8 f @ Bit set; irq found
add \ i r q n r , \ i r q n r , #1
bne 1 0 0 1 b @ Until no bits
b 1 0 0 9 f @ Nothing? Hmm.
1008 : movs \ i r q s t a t , #1 @ Force !Z
1009 :
.endm
# elif d e f i n e d ( C O N F I G _ A R C H _ L H 7 A 4 0 0 )
2005-04-16 15:20:36 -07:00
.macro disable_fiq
.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
mov \ i r q n r , #0
mov \ b a s e , #i o _ p 2 v ( 0 x80 0 0 0 0 0 0 ) @ APB registers
ldr \ i r q s t a t , [ \ b a s e , #0x500 ] @ PIC INTSR
1001 : movs \ i r q s t a t , \ i r q s t a t , l s r #1 @ Shift into carry
bcs 1 0 0 8 f @ Bit set; irq found
add \ i r q n r , \ i r q n r , #1
bne 1 0 0 1 b @ Until no bits
b 1 0 0 9 f @ Nothing? Hmm.
1008 : movs \ i r q s t a t , #1 @ Force !Z
1009 :
.endm
# elif d e f i n e d ( C O N F I G _ A R C H _ L H 7 A 4 0 4 )
.macro disable_fiq
.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
mov \ i r q n r , #0 @ VIC1 irq base
mov \ b a s e , #i o _ p 2 v ( 0 x80 0 0 0 0 0 0 ) @ APB registers
add \ b a s e , \ b a s e , #0x8000
ldr \ t m p , [ \ b a s e , #0x0030 ] @ VIC1_VECTADDR
tst \ t m p , #V A _ V E C T O R E D @ D i r e c t v e c t o r e d
bne 1 0 0 2 f
tst \ t m p , #V A _ V I C 1 D E F A U L T @ Default vectored VIC1
ldrne \ i r q s t a t , [ \ b a s e , #0 ] @ VIC1_IRQSTATUS
bne 1 0 0 1 f
add \ b a s e , \ b a s e , #( 0xa000 - 0 x80 0 0 )
ldr \ t m p , [ \ b a s e , #0x0030 ] @ VIC2_VECTADDR
tst \ t m p , #V A _ V E C T O R E D @ D i r e c t v e c t o r e d
bne 1 0 0 2 f
ldr \ i r q s t a t , [ \ b a s e , #0 ] @ VIC2_IRQSTATUS
mov \ i r q n r , #32 @ VIC2 irq base
1001 : movs \ i r q s t a t , \ i r q s t a t , l s r #1 @ Shift into carry
bcs 1 0 0 8 f @ Bit set; irq found
add \ i r q n r , \ i r q n r , #1
bne 1 0 0 1 b @ Until no bits
b 1 0 0 9 f @ Nothing? Hmm.
1002 : and \ i r q n r , \ t m p , #0x3f @ Mask for valid bits
1008 : movs \ i r q s t a t , #1 @ Force !Z
str \ t m p , [ \ b a s e , #0x0030 ] @ Clear vector
1009 :
.endm
# endif