Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 3496 → Rev 3482

/drivers/audio/intel_hda/intel_hda.asm
13,7 → 13,7
 
USE_SINGLE_MODE equ 0 ; 1 = Single mode; 0 = Normal mode.
 
TEST_VERSION_NUMBER equ '018d'
TEST_VERSION_NUMBER equ '018b'
 
;Asper+ [
SDO_TAG equ 1 ;Asper: Output stream tag id (any number except 0)
452,52 → 452,6
 
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 service_proc
public version
648,7 → 602,12
stdcall RegService, sz_sound_srv, service_proc
ret
.fail:
if DEBUG
mov esi, msgFail
call SysMsgBoardStr
end if
xor eax, eax
ret
.fail_msg:
call SysMsgBoardStr
xor eax, eax
703,7 → 662,7
ret
@@:
cmp eax, DEV_CALLBACK
jne @f
jne @F
mov ebx, [edi+input]
stdcall set_callback, [ebx]
xor eax, eax
710,7 → 669,7
ret
@@:
cmp eax, DEV_SET_MASTERVOL
jne @f
jne @F
mov eax, [edi+input]
mov eax, [eax]
call set_master_vol
718,7 → 677,7
ret
@@:
cmp eax, DEV_GET_MASTERVOL
jne @f
jne @F
mov ebx, [edi+output]
stdcall get_master_vol, ebx
xor eax, eax
725,7 → 684,7
ret
;@@:
; cmp eax, DEV_GET_INFO
; jne @f
; jne @F
; mov ebx, [edi+output]
; stdcall get_dev_info, ebx
; xor eax, eax
732,7 → 691,7
; ret
@@:
cmp eax, DEV_GET_POS
jne @f
jne @F
stdcall azx_get_position
shr eax, 2
mov ebx, [edi+output]
741,7 → 700,7
ret
@@:
; cmp eax, DEV_SET_CHANNEL_VOLUME
; jne @f
; jne @F
; if DEBUG
; mov esi, msgSetChannelVolume
; call SysMsgBoardStr
768,7 → 727,7
; ret
;@@:
; cmp eax, DEV_GET_CHANNEL_VOLUME
; jne @f
; jne @F
; mov cl, byte [edi+input] ; cl=channel
; call get_channel_volume
; mov ebx, [edi+output]
806,7 → 765,6
 
align 4
proc hda_irq ;+
spin_lock
if DEBUG_IRQ
push eax esi
;mov esi, msgIRQ
820,7 → 778,6
call azx_readl
test eax, eax
jnz @f
spin_unlock
ret
@@:
mov ebx, eax ; status
886,7 → 843,6
@@:
;end if
or eax, 1
spin_unlock
ret
endp
 
979,7 → 935,7
; wallclk has 24Mhz clock source
mov [ctrl.period_wallclk], ((0x4000 * 24000) / 48000) * 1000
 
call azx_stream_reset
;-call azx_stream_reset
call azx_setup_controller
ret
endp
1334,7 → 1290,6
 
align 4
play:
spin_lock
mov edx, ICH6_REG_WALLCLK
call azx_readl
mov [ctrl.start_wallclk], eax
1341,12 → 1296,10
 
call azx_stream_start
xor eax, eax
spin_unlock
ret
 
align 4
stop:
spin_lock
;* call azx_stream_stop ;Asper: Hangs system
;R push ebx ecx edx
;R ; stop DMA
1386,7 → 1339,6
;Asper ]
 
xor eax, eax
spin_unlock
ret
 
;align 4
1452,7 → 1404,6
endp
 
proc azx_init_cmd_io
spin_lock_irq
pusha
; CORB set up
mov eax, [ctrl.rb]
1520,12 → 1471,10
call azx_writeb
 
popa
spin_unlock_irq
ret
endp
 
proc azx_free_cmd_io
spin_lock_irq
push eax edx
; disable ringbuffer DMAs
xor al, al
1534,7 → 1483,6
mov edx, ICH6_REG_CORBCTL
call azx_writeb
pop edx eax
spin_unlock_irq
ret
endp
 
1541,7 → 1489,6
 
; send a command
proc azx_corb_send_cmd stdcall, val:dword
spin_lock_irq
push edx edi
xor eax, eax
; add command to corb
1562,7 → 1509,6
 
pop edi edx
xor eax, eax ;Asper+
spin_unlock_irq
ret
endp
 
1643,9 → 1589,7
test ah, ah
jz @f
.poll:
spin_lock_irq
call azx_update_rirb
spin_unlock_irq
@@:
mov eax, [ctrl.rirb_cmd]
test eax, eax
2540,7 → 2484,10
 
align 4
proc StallExec
push ecx edx ebx eax
push ecx
push edx
push ebx
push eax
 
mov ecx, CPU_FREQ
mul ecx
2555,7 → 2502,10
sbb edx, ecx
js @B
 
pop eax ebx edx ecx
pop eax
pop ebx
pop edx
pop ecx
ret
endp
 
2634,7 → 2584,7
mov bl, [ebx+hexletters]
mov [8+esi+ecx], bl
inc ecx
jnz @b
jnz @B
pop eax
 
mov dword [esi+8], 0
2963,7 → 2913,6
 
section '.data' data readable writable align 16
 
aspinlock dd SPINLOCK_FREE
 
codec CODEC
ctrl AC_CNTRL
/drivers/audio/intel_hda/CODEC.INC
154,24 → 154,13
push eax ebx ecx esi
mov esi, [seq]
@@:
;mov ecx, [esi + hda_verb.nid]
;mov ebx, [esi + hda_verb.verb]
;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
mov ecx, [esi + hda_verb.nid]
mov ebx, [esi + hda_verb.verb]
mov eax, [esi + hda_verb.param]
stdcall snd_hda_codec_write, ecx, 0, ebx, eax
add esi, 6
jmp @b
.out:
add esi, hda_verb.sizeof
test ecx, ecx
jnz @b
pop esi ecx ebx eax
ret
endp
558,7 → 547,7
@@:
 
; 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
ret
578,7 → 567,14
@@:
; call the default 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
jz @f
if DEBUG