forked from KolibriOS/kolibrios
Fix silent play bug
git-svn-id: svn://kolibrios.org@3496 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
a1dd9086b0
commit
f7a17ff6c5
@ -154,13 +154,24 @@ proc snd_hda_sequence_write stdcall, seq:dword
|
|||||||
push eax ebx ecx esi
|
push eax ebx ecx esi
|
||||||
mov esi, [seq]
|
mov esi, [seq]
|
||||||
@@:
|
@@:
|
||||||
mov ecx, [esi + hda_verb.nid]
|
;mov ecx, [esi + hda_verb.nid]
|
||||||
mov ebx, [esi + hda_verb.verb]
|
;mov ebx, [esi + hda_verb.verb]
|
||||||
mov eax, [esi + hda_verb.param]
|
;mov eax, [esi + hda_verb.param]
|
||||||
|
;stdcall snd_hda_codec_write, ecx, 0, ebx, eax
|
||||||
|
;add esi, hda_verb.sizeof
|
||||||
|
;test ecx, ecx
|
||||||
|
;jnz @b
|
||||||
|
;______________________________________
|
||||||
|
cmp dword [esi], 0
|
||||||
|
je .out
|
||||||
|
movzx ecx, word [esi] ; NID
|
||||||
|
movzx ebx, word [esi+2] ; verb
|
||||||
|
and bx, 0x0FFF
|
||||||
|
movzx eax, word [esi + 4] ; sizeof(param) = 4 bytes
|
||||||
stdcall snd_hda_codec_write, ecx, 0, ebx, eax
|
stdcall snd_hda_codec_write, ecx, 0, ebx, eax
|
||||||
add esi, hda_verb.sizeof
|
add esi, 6
|
||||||
test ecx, ecx
|
jmp @b
|
||||||
jnz @b
|
.out:
|
||||||
pop esi ecx ebx eax
|
pop esi ecx ebx eax
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
@ -547,7 +558,7 @@ proc snd_hda_codec_init ; We use just one codec (the first found)
|
|||||||
@@:
|
@@:
|
||||||
|
|
||||||
; power up all before initialization
|
; power up all before initialization
|
||||||
; stdcall snd_hda_set_power_state, ebx, AC_PWRST_D0
|
stdcall snd_hda_set_power_state, ebx, AC_PWRST_D0
|
||||||
|
|
||||||
pop ebx
|
pop ebx
|
||||||
ret
|
ret
|
||||||
@ -567,14 +578,7 @@ proc snd_hda_codec_configure
|
|||||||
@@:
|
@@:
|
||||||
; call the default parser
|
; call the default parser
|
||||||
stdcall snd_hda_parse_generic_codec ;entry point to generic tree parser!!!
|
stdcall snd_hda_parse_generic_codec ;entry point to generic tree parser!!!
|
||||||
;Asper+:patch for HP Elitebook 8730w [
|
|
||||||
; push eax ebx
|
|
||||||
; mov ebx, [codec.afg]
|
|
||||||
; stdcall snd_hda_codec_write, ebx, 0, AC_VERB_SET_GPIO_MASK, 0x02
|
|
||||||
; stdcall snd_hda_codec_write, ebx, 0, AC_VERB_SET_GPIO_DIRECTION, 0x02
|
|
||||||
; stdcall snd_hda_codec_write, ebx, 0, AC_VERB_SET_GPIO_DATA, 0x02 ; first muted
|
|
||||||
; pop ebx eax
|
|
||||||
;Asper+ ]
|
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz @f
|
jz @f
|
||||||
if DEBUG
|
if DEBUG
|
||||||
|
@ -13,7 +13,7 @@ DEBUG_IRQ equ 0
|
|||||||
|
|
||||||
USE_SINGLE_MODE equ 0 ; 1 = Single mode; 0 = Normal mode.
|
USE_SINGLE_MODE equ 0 ; 1 = Single mode; 0 = Normal mode.
|
||||||
|
|
||||||
TEST_VERSION_NUMBER equ '018b'
|
TEST_VERSION_NUMBER equ '018d'
|
||||||
|
|
||||||
;Asper+ [
|
;Asper+ [
|
||||||
SDO_TAG equ 1 ;Asper: Output stream tag id (any number except 0)
|
SDO_TAG equ 1 ;Asper: Output stream tag id (any number except 0)
|
||||||
@ -452,6 +452,52 @@ end virtual
|
|||||||
|
|
||||||
EVENT_NOTIFY equ 0x00000200
|
EVENT_NOTIFY equ 0x00000200
|
||||||
|
|
||||||
|
; Macroses by CleverMouse
|
||||||
|
; The following macro assume that we are on uniprocessor machine.
|
||||||
|
; Serious work is needed for multiprocessor machines.
|
||||||
|
macro spin_lock_irqsave spinlock
|
||||||
|
{
|
||||||
|
pushf
|
||||||
|
cli
|
||||||
|
}
|
||||||
|
macro spin_unlock_irqrestore spinlock
|
||||||
|
{
|
||||||
|
popf
|
||||||
|
}
|
||||||
|
macro spin_lock_irq spinlock
|
||||||
|
{
|
||||||
|
cli
|
||||||
|
}
|
||||||
|
macro spin_unlock_irq spinlock
|
||||||
|
{
|
||||||
|
sti
|
||||||
|
}
|
||||||
|
|
||||||
|
SPINLOCK_BUSY = 1
|
||||||
|
SPINLOCK_FREE = 0
|
||||||
|
|
||||||
|
macro spin_lock
|
||||||
|
{
|
||||||
|
push eax ebx
|
||||||
|
mov eax, aspinlock
|
||||||
|
mov ebx, SPINLOCK_BUSY
|
||||||
|
@@:
|
||||||
|
lock xchg [eax], ebx
|
||||||
|
cmp ebx, SPINLOCK_FREE
|
||||||
|
jnz @b
|
||||||
|
pop ebx eax
|
||||||
|
}
|
||||||
|
|
||||||
|
macro spin_unlock
|
||||||
|
{
|
||||||
|
push eax ebx
|
||||||
|
mov eax, aspinlock
|
||||||
|
mov eax, aspinlock
|
||||||
|
mov ebx, SPINLOCK_FREE
|
||||||
|
lock xchg [eax], ebx
|
||||||
|
pop ebx eax
|
||||||
|
}
|
||||||
|
|
||||||
public START
|
public START
|
||||||
public service_proc
|
public service_proc
|
||||||
public version
|
public version
|
||||||
@ -602,12 +648,7 @@ proc START stdcall, state:dword
|
|||||||
stdcall RegService, sz_sound_srv, service_proc
|
stdcall RegService, sz_sound_srv, service_proc
|
||||||
ret
|
ret
|
||||||
.fail:
|
.fail:
|
||||||
if DEBUG
|
|
||||||
mov esi, msgFail
|
mov esi, msgFail
|
||||||
call SysMsgBoardStr
|
|
||||||
end if
|
|
||||||
xor eax, eax
|
|
||||||
ret
|
|
||||||
.fail_msg:
|
.fail_msg:
|
||||||
call SysMsgBoardStr
|
call SysMsgBoardStr
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
@ -662,14 +703,14 @@ proc service_proc stdcall, ioctl:dword
|
|||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
cmp eax, DEV_CALLBACK
|
cmp eax, DEV_CALLBACK
|
||||||
jne @F
|
jne @f
|
||||||
mov ebx, [edi+input]
|
mov ebx, [edi+input]
|
||||||
stdcall set_callback, [ebx]
|
stdcall set_callback, [ebx]
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
cmp eax, DEV_SET_MASTERVOL
|
cmp eax, DEV_SET_MASTERVOL
|
||||||
jne @F
|
jne @f
|
||||||
mov eax, [edi+input]
|
mov eax, [edi+input]
|
||||||
mov eax, [eax]
|
mov eax, [eax]
|
||||||
call set_master_vol
|
call set_master_vol
|
||||||
@ -677,21 +718,21 @@ proc service_proc stdcall, ioctl:dword
|
|||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
cmp eax, DEV_GET_MASTERVOL
|
cmp eax, DEV_GET_MASTERVOL
|
||||||
jne @F
|
jne @f
|
||||||
mov ebx, [edi+output]
|
mov ebx, [edi+output]
|
||||||
stdcall get_master_vol, ebx
|
stdcall get_master_vol, ebx
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
;@@:
|
;@@:
|
||||||
; cmp eax, DEV_GET_INFO
|
; cmp eax, DEV_GET_INFO
|
||||||
; jne @F
|
; jne @f
|
||||||
; mov ebx, [edi+output]
|
; mov ebx, [edi+output]
|
||||||
; stdcall get_dev_info, ebx
|
; stdcall get_dev_info, ebx
|
||||||
; xor eax, eax
|
; xor eax, eax
|
||||||
; ret
|
; ret
|
||||||
@@:
|
@@:
|
||||||
cmp eax, DEV_GET_POS
|
cmp eax, DEV_GET_POS
|
||||||
jne @F
|
jne @f
|
||||||
stdcall azx_get_position
|
stdcall azx_get_position
|
||||||
shr eax, 2
|
shr eax, 2
|
||||||
mov ebx, [edi+output]
|
mov ebx, [edi+output]
|
||||||
@ -700,7 +741,7 @@ proc service_proc stdcall, ioctl:dword
|
|||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
; cmp eax, DEV_SET_CHANNEL_VOLUME
|
; cmp eax, DEV_SET_CHANNEL_VOLUME
|
||||||
; jne @F
|
; jne @f
|
||||||
; if DEBUG
|
; if DEBUG
|
||||||
; mov esi, msgSetChannelVolume
|
; mov esi, msgSetChannelVolume
|
||||||
; call SysMsgBoardStr
|
; call SysMsgBoardStr
|
||||||
@ -727,7 +768,7 @@ proc service_proc stdcall, ioctl:dword
|
|||||||
; ret
|
; ret
|
||||||
;@@:
|
;@@:
|
||||||
; cmp eax, DEV_GET_CHANNEL_VOLUME
|
; cmp eax, DEV_GET_CHANNEL_VOLUME
|
||||||
; jne @F
|
; jne @f
|
||||||
; mov cl, byte [edi+input] ; cl=channel
|
; mov cl, byte [edi+input] ; cl=channel
|
||||||
; call get_channel_volume
|
; call get_channel_volume
|
||||||
; mov ebx, [edi+output]
|
; mov ebx, [edi+output]
|
||||||
@ -765,6 +806,7 @@ restore out_size
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc hda_irq ;+
|
proc hda_irq ;+
|
||||||
|
spin_lock
|
||||||
if DEBUG_IRQ
|
if DEBUG_IRQ
|
||||||
push eax esi
|
push eax esi
|
||||||
;mov esi, msgIRQ
|
;mov esi, msgIRQ
|
||||||
@ -778,6 +820,7 @@ proc hda_irq ;+
|
|||||||
call azx_readl
|
call azx_readl
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz @f
|
jnz @f
|
||||||
|
spin_unlock
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
mov ebx, eax ; status
|
mov ebx, eax ; status
|
||||||
@ -843,6 +886,7 @@ proc hda_irq ;+
|
|||||||
@@:
|
@@:
|
||||||
;end if
|
;end if
|
||||||
or eax, 1
|
or eax, 1
|
||||||
|
spin_unlock
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
@ -935,7 +979,7 @@ proc create_primary_buff
|
|||||||
; wallclk has 24Mhz clock source
|
; wallclk has 24Mhz clock source
|
||||||
mov [ctrl.period_wallclk], ((0x4000 * 24000) / 48000) * 1000
|
mov [ctrl.period_wallclk], ((0x4000 * 24000) / 48000) * 1000
|
||||||
|
|
||||||
;-call azx_stream_reset
|
call azx_stream_reset
|
||||||
call azx_setup_controller
|
call azx_setup_controller
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
@ -1290,16 +1334,19 @@ endp
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
play:
|
play:
|
||||||
|
spin_lock
|
||||||
mov edx, ICH6_REG_WALLCLK
|
mov edx, ICH6_REG_WALLCLK
|
||||||
call azx_readl
|
call azx_readl
|
||||||
mov [ctrl.start_wallclk], eax
|
mov [ctrl.start_wallclk], eax
|
||||||
|
|
||||||
call azx_stream_start
|
call azx_stream_start
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
|
spin_unlock
|
||||||
ret
|
ret
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
stop:
|
stop:
|
||||||
|
spin_lock
|
||||||
;* call azx_stream_stop ;Asper: Hangs system
|
;* call azx_stream_stop ;Asper: Hangs system
|
||||||
;R push ebx ecx edx
|
;R push ebx ecx edx
|
||||||
;R ; stop DMA
|
;R ; stop DMA
|
||||||
@ -1339,6 +1386,7 @@ stop:
|
|||||||
;Asper ]
|
;Asper ]
|
||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
|
spin_unlock
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;align 4
|
;align 4
|
||||||
@ -1404,6 +1452,7 @@ proc azx_alloc_cmd_io
|
|||||||
endp
|
endp
|
||||||
|
|
||||||
proc azx_init_cmd_io
|
proc azx_init_cmd_io
|
||||||
|
spin_lock_irq
|
||||||
pusha
|
pusha
|
||||||
; CORB set up
|
; CORB set up
|
||||||
mov eax, [ctrl.rb]
|
mov eax, [ctrl.rb]
|
||||||
@ -1471,10 +1520,12 @@ proc azx_init_cmd_io
|
|||||||
call azx_writeb
|
call azx_writeb
|
||||||
|
|
||||||
popa
|
popa
|
||||||
|
spin_unlock_irq
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
proc azx_free_cmd_io
|
proc azx_free_cmd_io
|
||||||
|
spin_lock_irq
|
||||||
push eax edx
|
push eax edx
|
||||||
; disable ringbuffer DMAs
|
; disable ringbuffer DMAs
|
||||||
xor al, al
|
xor al, al
|
||||||
@ -1483,12 +1534,14 @@ proc azx_free_cmd_io
|
|||||||
mov edx, ICH6_REG_CORBCTL
|
mov edx, ICH6_REG_CORBCTL
|
||||||
call azx_writeb
|
call azx_writeb
|
||||||
pop edx eax
|
pop edx eax
|
||||||
|
spin_unlock_irq
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
|
||||||
; send a command
|
; send a command
|
||||||
proc azx_corb_send_cmd stdcall, val:dword
|
proc azx_corb_send_cmd stdcall, val:dword
|
||||||
|
spin_lock_irq
|
||||||
push edx edi
|
push edx edi
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
; add command to corb
|
; add command to corb
|
||||||
@ -1509,6 +1562,7 @@ proc azx_corb_send_cmd stdcall, val:dword
|
|||||||
|
|
||||||
pop edi edx
|
pop edi edx
|
||||||
xor eax, eax ;Asper+
|
xor eax, eax ;Asper+
|
||||||
|
spin_unlock_irq
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
@ -1589,7 +1643,9 @@ proc azx_rirb_get_response
|
|||||||
test ah, ah
|
test ah, ah
|
||||||
jz @f
|
jz @f
|
||||||
.poll:
|
.poll:
|
||||||
|
spin_lock_irq
|
||||||
call azx_update_rirb
|
call azx_update_rirb
|
||||||
|
spin_unlock_irq
|
||||||
@@:
|
@@:
|
||||||
mov eax, [ctrl.rirb_cmd]
|
mov eax, [ctrl.rirb_cmd]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
@ -2484,10 +2540,7 @@ udelay:
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc StallExec
|
proc StallExec
|
||||||
push ecx
|
push ecx edx ebx eax
|
||||||
push edx
|
|
||||||
push ebx
|
|
||||||
push eax
|
|
||||||
|
|
||||||
mov ecx, CPU_FREQ
|
mov ecx, CPU_FREQ
|
||||||
mul ecx
|
mul ecx
|
||||||
@ -2502,10 +2555,7 @@ proc StallExec
|
|||||||
sbb edx, ecx
|
sbb edx, ecx
|
||||||
js @B
|
js @B
|
||||||
|
|
||||||
pop eax
|
pop eax ebx edx ecx
|
||||||
pop ebx
|
|
||||||
pop edx
|
|
||||||
pop ecx
|
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
@ -2584,7 +2634,7 @@ proc fdword2str stdcall, flags:dword ; bit 0 - skipLeadZeroes; bit 1 - newLine;
|
|||||||
mov bl, [ebx+hexletters]
|
mov bl, [ebx+hexletters]
|
||||||
mov [8+esi+ecx], bl
|
mov [8+esi+ecx], bl
|
||||||
inc ecx
|
inc ecx
|
||||||
jnz @B
|
jnz @b
|
||||||
pop eax
|
pop eax
|
||||||
|
|
||||||
mov dword [esi+8], 0
|
mov dword [esi+8], 0
|
||||||
@ -2913,6 +2963,7 @@ end if
|
|||||||
|
|
||||||
section '.data' data readable writable align 16
|
section '.data' data readable writable align 16
|
||||||
|
|
||||||
|
aspinlock dd SPINLOCK_FREE
|
||||||
|
|
||||||
codec CODEC
|
codec CODEC
|
||||||
ctrl AC_CNTRL
|
ctrl AC_CNTRL
|
||||||
|
Loading…
Reference in New Issue
Block a user