2005-04-17 02:20:36 +04:00
/ *
* linux/ d r i v e r s / s o u n d / v i d c _ f i l l . S
*
* Copyright ( C ) 1 9 9 7 R u s s e l l K i n g
*
* 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 v e r s i o n 2 a s
* published b y t h e F r e e S o f t w a r e F o u n d a t i o n .
*
* Filler r o u t i n e s f o r D M A b u f f e r s
* /
# include < l i n u x / l i n k a g e . h >
# include < a s m / a s s e m b l e r . h >
2008-08-05 19:14:15 +04:00
# include < m a c h / h a r d w a r e . h >
2005-04-17 02:20:36 +04:00
# include < a s m / h a r d w a r e / i o m d . h >
.text
ENTRY( v i d c _ f i l l _ 1 x8 _ u )
mov i p , #0xff00
1 : cmp r0 , r1
bge v i d c _ c l e a r
ldrb r4 , [ r0 ] , #1
eor r4 , r4 , #0x80
and r4 , i p , r4 , l s l #8
orr r4 , r4 , r4 , l s l #16
str r4 , [ r2 ] , #4
cmp r2 , r3
blt 1 b
mov p c , l r
ENTRY( v i d c _ f i l l _ 2 x8 _ u )
mov i p , #0xff00
1 : cmp r0 , r1
bge v i d c _ c l e a r
ldr r4 , [ r0 ] , #2
and r5 , r4 , i p
and r4 , i p , r4 , l s l #8
orr r4 , r4 , r5 , l s l #16
orr r4 , r4 , r4 , l s r #8
str r4 , [ r2 ] , #4
cmp r2 , r3
blt 1 b
mov p c , l r
ENTRY( v i d c _ f i l l _ 1 x8 _ s )
mov i p , #0xff00
1 : cmp r0 , r1
bge v i d c _ c l e a r
ldrb r4 , [ r0 ] , #1
and r4 , i p , r4 , l s l #8
orr r4 , r4 , r4 , l s l #16
str r4 , [ r2 ] , #4
cmp r2 , r3
blt 1 b
mov p c , l r
ENTRY( v i d c _ f i l l _ 2 x8 _ s )
mov i p , #0xff00
1 : cmp r0 , r1
bge v i d c _ c l e a r
ldr r4 , [ r0 ] , #2
and r5 , r4 , i p
and r4 , i p , r4 , l s l #8
orr r4 , r4 , r5 , l s l #16
orr r4 , r4 , r4 , l s r #8
str r4 , [ r2 ] , #4
cmp r2 , r3
blt 1 b
mov p c , l r
ENTRY( v i d c _ f i l l _ 1 x16 _ s )
mov i p , #0xff00
orr i p , i p , i p , l s r #8
1 : cmp r0 , r1
bge v i d c _ c l e a r
ldr r5 , [ r0 ] , #2
and r4 , r5 , i p
orr r4 , r4 , r4 , l s l #16
str r4 , [ r2 ] , #4
cmp r0 , r1
addlt r0 , r0 , #2
andlt r4 , r5 , i p , l s l #16
orrlt r4 , r4 , r4 , l s r #16
strlt r4 , [ r2 ] , #4
cmp r2 , r3
blt 1 b
mov p c , l r
ENTRY( v i d c _ f i l l _ 2 x16 _ s )
mov i p , #0xff00
orr i p , i p , i p , l s r #8
1 : cmp r0 , r1
bge v i d c _ c l e a r
ldr r4 , [ r0 ] , #4
str r4 , [ r2 ] , #4
cmp r0 , r1
ldrlt r4 , [ r0 ] , #4
strlt r4 , [ r2 ] , #4
cmp r2 , r3
blt 1 b
mov p c , l r
ENTRY( v i d c _ f i l l _ n o a u d i o )
mov r0 , #0
mov r1 , #0
2 : mov r4 , #0
mov r5 , #0
1 : cmp r2 , r3
stmltia r2 ! , { r0 , r1 , r4 , r5 }
blt 1 b
mov p c , l r
ENTRY( v i d c _ c l e a r )
mov r0 , #0
mov r1 , #0
tst r2 , #4
str r0 , [ r2 ] , #4
tst r2 , #8
stmia r2 ! , { r0 , r1 }
b 2 b
/ *
* Call f i l l e r r o u t i n e s w i t h :
* r0 = p h y s a d d r e s s
* r1 = p h y s e n d
* r2 = b u f f e r
* Returns :
* r0 = n e w b u f f e r a d d r e s s
* r2 = n e w b u f f e r f i n i s h
* r4 = c o r r u p t e d
* r5 = c o r r u p t e d
* ip = c o r r u p t e d
* /
ENTRY( v i d c _ s o u n d _ d m a _ i r q )
stmfd s p ! , { r4 - r8 , l r }
ldr r8 , =dma_start
ldmia r8 , { r0 , r1 , r2 , r3 , r4 , r5 }
teq r1 , #0
adreq r4 , v i d c _ f i l l _ n o a u d i o
moveq r7 , #1 < < 3 1
movne r7 , #0
mov i p , #I O M D _ B A S E & 0xff000000
orr i p , i p , #I O M D _ B A S E & 0x00ff0000
ldrb r6 , [ i p , #I O M D _ S D 0 S T ]
tst r6 , #D M A _ S T _ O F L @ C h e c k f o r o v e r r u n
eorne r6 , r6 , #D M A _ S T _ A B
tst r6 , #D M A _ S T _ A B
moveq r2 , r3 @ DMAing A, update B
add r3 , r2 , r5 @ End of DMA buffer
add r1 , r1 , r0 @ End of virtual DMA buffer
mov l r , p c
mov p c , r4 @ Call fill routine (uses r4, ip)
sub r1 , r1 , r0 @ Remaining length
stmia r8 , { r0 , r1 }
mov r0 , #0
tst r2 , #4 @ Round buffer up to 4 words
strne r0 , [ r2 ] , #4
tst r2 , #8
strne r0 , [ r2 ] , #4
strne r0 , [ r2 ] , #4
sub r2 , r2 , #16
mov r2 , r2 , l s l #20
movs r2 , r2 , l s r #20
orreq r2 , r2 , #1 < < 3 0 @ Set L bit
orr r2 , r2 , r7
ldmdb r8 , { r3 , r4 , r5 }
tst r6 , #D M A _ S T _ A B
mov i p , #I O M D _ B A S E & 0xff000000
orr i p , i p , #I O M D _ B A S E & 0x00ff0000
streq r4 , [ i p , #I O M D _ S D 0 C U R B ]
strne r5 , [ i p , #I O M D _ S D 0 C U R A ]
streq r2 , [ i p , #I O M D _ S D 0 E N D B ]
strne r2 , [ i p , #I O M D _ S D 0 E N D A ]
ldr l r , [ i p , #I O M D _ S D 0 S T ]
tst l r , #D M A _ S T _ O F L
bne 1 f
tst r6 , #D M A _ S T _ A B
strne r4 , [ i p , #I O M D _ S D 0 C U R B ]
streq r5 , [ i p , #I O M D _ S D 0 C U R A ]
strne r2 , [ i p , #I O M D _ S D 0 E N D B ]
streq r2 , [ i p , #I O M D _ S D 0 E N D A ]
1 : teq r7 , #0
mov r0 , #0x10
strneb r0 , [ i p , #I O M D _ S D 0 C R ]
ldmfd s p ! , { r4 - r8 , l r }
mov r0 , #1 @ IRQ_HANDLED
teq r1 , #0 @ If we have no more
movne p c , l r
teq r3 , #0
movne p c , r3 @ Call interrupt routine
mov p c , l r
.data
.globl dma_interrupt
dma_interrupt :
.long 0 @ r3
.globl dma_pbuf
dma_pbuf :
.long 0 @ r4
.long 0 @ r5
.globl dma_start
dma_start :
.long 0 @ r0
.globl dma_count
dma_count :
.long 0 @ r1
.globl dma_buf
dma_buf :
.long 0 @ r2
.long 0 @ r3
.globl vidc_filler
vidc_filler :
.long vidc_fill_noaudio @ r4
.globl dma_bufsize
dma_bufsize :
.long 0x1000 @ r5