intel_hda: Convert to PE. Apply source format rules. Some changes to get/set master volume. Enable unsolicited events.

git-svn-id: svn://kolibrios.org@5048 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Asper 2014-08-21 00:30:45 +00:00
parent d3545f769e
commit 2dab47a972
7 changed files with 3476 additions and 3771 deletions

View File

@ -131,7 +131,6 @@ FASM_PROGRAMS:=\
drivers/emu10k1x.obj:DRIVERS/EMU10K1X.OBJ:$(KERNEL)/drivers/emu10k1x.asm \ drivers/emu10k1x.obj:DRIVERS/EMU10K1X.OBJ:$(KERNEL)/drivers/emu10k1x.asm \
drivers/fm801.obj:DRIVERS/FM801.OBJ:$(KERNEL)/drivers/fm801.asm \ drivers/fm801.obj:DRIVERS/FM801.OBJ:$(KERNEL)/drivers/fm801.asm \
drivers/infinity.obj:DRIVERS/INFINITY.OBJ:$(KERNEL)/drivers/infinity.asm \ drivers/infinity.obj:DRIVERS/INFINITY.OBJ:$(KERNEL)/drivers/infinity.asm \
drivers/intel_hda.obj:DRIVERS/intel_hda.obj:$(REPOSITORY)/drivers/audio/intel_hda/intel_hda.asm \
drivers/sb16.obj:DRIVERS/SB16.OBJ:$(KERNEL)/drivers/sb16/sb16.asm \ drivers/sb16.obj:DRIVERS/SB16.OBJ:$(KERNEL)/drivers/sb16/sb16.asm \
drivers/sound.obj:DRIVERS/SOUND.OBJ:$(KERNEL)/drivers/sound.asm \ drivers/sound.obj:DRIVERS/SOUND.OBJ:$(KERNEL)/drivers/sound.asm \
drivers/intelac97.obj:DRIVERS/INTELAC97.OBJ:$(KERNEL)/drivers/intelac97.asm \ drivers/intelac97.obj:DRIVERS/INTELAC97.OBJ:$(KERNEL)/drivers/intelac97.asm \
@ -230,6 +229,7 @@ FASM_PROGRAMS_PESTRIP:=\
drivers/rdc.sys:DRIVERS/RDC.SYS:$(REPOSITORY)/drivers/video/rdc.asm \ drivers/rdc.sys:DRIVERS/RDC.SYS:$(REPOSITORY)/drivers/video/rdc.asm \
drivers/ps2mouse.sys:DRIVERS/PS2MOUSE.SYS:$(REPOSITORY)/drivers/mouse/ps2mouse4d/trunk/ps2mouse.asm \ drivers/ps2mouse.sys:DRIVERS/PS2MOUSE.SYS:$(REPOSITORY)/drivers/mouse/ps2mouse4d/trunk/ps2mouse.asm \
drivers/tmpdisk.sys:DRIVERS/TMPDISK.SYS:$(REPOSITORY)/drivers/disk/tmpdisk.asm \ drivers/tmpdisk.sys:DRIVERS/TMPDISK.SYS:$(REPOSITORY)/drivers/disk/tmpdisk.asm \
drivers/intel_hda.sys:DRIVERS/intel_hda.sys:$(REPOSITORY)/drivers/audio/intel_hda/intel_hda.asm \
# end of list # end of list
# The list of all FASM programs with one main FASM file for CD image. # The list of all FASM programs with one main FASM file for CD image.
# Format of an item is exactly the same as in the previous list. # Format of an item is exactly the same as in the previous list.

View File

@ -24,7 +24,7 @@ proc make_codec_cmd stdcall, nid:dword, direct:dword, verb:dword, parm:dword
or eax, ebx or eax, ebx
pop ebx pop ebx
ret ret
.err: .err:
pop ebx pop ebx
mov eax, -1 mov eax, -1
ret ret
@ -39,41 +39,40 @@ proc codec_exec_verb stdcall, cmd:dword;, res:dword <- returned in eax
pop edx ebx pop edx ebx
mov eax, -1 mov eax, -1
ret ret
@@: @@:
if FDEBUG ;YAHOO if FDEBUG
push eax esi push eax esi
mov esi, msgVerbQuery mov esi, msgVerbQuery
call SysMsgBoardStr invoke SysMsgBoardStr
mov eax, ebx mov eax, ebx
stdcall fdword2str, 2 stdcall fdword2str, 2
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi eax pop esi eax
end if end if
mov edx, -1 mov edx, -1
.again: .again:
; call snd_hda_power_up ;call snd_hda_power_up
stdcall azx_send_cmd, ebx stdcall azx_send_cmd, ebx
mov ebx, eax mov ebx, eax
test ebx, ebx test ebx, ebx
jnz @f jnz @f
call azx_get_response call azx_get_response
mov edx, eax mov edx, eax
if FDEBUG if FDEBUG
test edx, edx test edx, edx
jz .end_debug jz .end_debug
push eax esi push eax esi
mov esi, msgVerbAnswer mov esi, msgVerbAnswer
call SysMsgBoardStr invoke SysMsgBoardStr
mov eax, edx mov eax, edx
stdcall fdword2str, 2 stdcall fdword2str, 2
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi eax pop esi eax
.end_debug: .end_debug:
end if end if
@@:
@@:
;call snd_hda_power_down ;call snd_hda_power_down
cmp edx, -1 cmp edx, -1
jne .l1 jne .l1
@ -85,20 +84,20 @@ proc codec_exec_verb stdcall, cmd:dword;, res:dword <- returned in eax
mov eax, [ctrl.response_reset] mov eax, [ctrl.response_reset]
jz @f jz @f
if DEBUG if DEBUG
push esi push esi
mov esi, emsgBusResetFatalComm mov esi, emsgBusResetFatalComm
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi pop esi
end if end if
call azx_bus_reset call azx_bus_reset
@@: @@:
.l1: .l1:
;; clear reset-flag when the communication gets recovered ;; clear reset-flag when the communication gets recovered
test ebx, ebx test ebx, ebx
jnz @f jnz @f
mov [ctrl.response_reset], 0 mov [ctrl.response_reset], 0
@@: @@:
mov eax, edx mov eax, edx
pop edx ebx pop edx ebx
@ -153,7 +152,7 @@ endp
proc snd_hda_sequence_write stdcall, seq:dword 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]
@ -171,7 +170,7 @@ proc snd_hda_sequence_write stdcall, seq:dword
stdcall snd_hda_codec_write, ecx, 0, ebx, eax stdcall snd_hda_codec_write, ecx, 0, ebx, eax
add esi, 6 add esi, 6
jmp @b jmp @b
.out: .out:
pop esi ecx ebx eax pop esi ecx ebx eax
ret ret
endp endp
@ -197,9 +196,8 @@ proc snd_hda_get_sub_nodes stdcall, nid:dword;, start_id:dword <- returned in
cmp eax, -1 cmp eax, -1
jne @f jne @f
inc eax inc eax
@@: @@:
and eax, 0x7FFF7FFF and eax, 0x7FFF7FFF
ret ret
endp endp
@ -216,7 +214,7 @@ endp
;; Returns the number of connections, or a negative error code. ;; Returns the number of connections, or a negative error code.
;; ;;
proc snd_hda_get_connections stdcall, nid:dword, conn_list:dword, max_conns:dword ;Asper: Complete translation! proc snd_hda_get_connections stdcall, nid:dword, conn_list:dword, max_conns:dword ;Asper: Complete translation!
locals locals
parm dd ? parm dd ?
conn_len dd ? conn_len dd ?
conns dd 0 conns dd 0
@ -225,7 +223,7 @@ proc snd_hda_get_connections stdcall, nid:dword, conn_list:dword, max_conns:dwo
mask dd 0x7F mask dd 0x7F
wcaps dd ? wcaps dd ?
prev_nid dw 1 ;Asper: Hmm.. Probably ALSA bug that it isn't initialized. I suppose to init it with 1. prev_nid dw 1 ;Asper: Hmm.. Probably ALSA bug that it isn't initialized. I suppose to init it with 1.
endl endl
push ebx ecx edx edi esi push ebx ecx edx edi esi
mov edi, [conn_list] mov edi, [conn_list]
@ -244,17 +242,17 @@ proc snd_hda_get_connections stdcall, nid:dword, conn_list:dword, max_conns:dwo
je .conn_list_ok je .conn_list_ok
test ebx, AC_WCAP_CONN_LIST test ebx, AC_WCAP_CONN_LIST
jnz .conn_list_ok jnz .conn_list_ok
if DEBUG if DEBUG
mov esi, emsgConnListNotAvailable mov esi, emsgConnListNotAvailable
call SysMsgBoardStr invoke SysMsgBoardStr
mov eax, [nid] mov eax, [nid]
stdcall fdword2str, 3 stdcall fdword2str, 3
call SysMsgBoardStr invoke SysMsgBoardStr
end if end if
xor eax, eax xor eax, eax
dec eax dec eax
jmp .out jmp .out
.conn_list_ok: .conn_list_ok:
snd_hda_param_read [nid], AC_PAR_CONNLIST_LEN snd_hda_param_read [nid], AC_PAR_CONNLIST_LEN
mov [parm], eax mov [parm], eax
@ -265,7 +263,7 @@ proc snd_hda_get_connections stdcall, nid:dword, conn_list:dword, max_conns:dwo
mov [shift], 16 mov [shift], 16
mov [num_elements], 2 mov [num_elements], 2
mov [mask], 0x7FFF ;Asper+ mov [mask], 0x7FFF ;Asper+
@@: @@:
and eax, AC_CLIST_LENGTH and eax, AC_CLIST_LENGTH
test eax, eax test eax, eax
jz .out ; no connection jz .out ; no connection
@ -283,7 +281,7 @@ proc snd_hda_get_connections stdcall, nid:dword, conn_list:dword, max_conns:dwo
xor eax, eax xor eax, eax
dec eax dec eax
jmp .out jmp .out
@@: @@:
mov eax, [parm] mov eax, [parm]
and eax, [mask] and eax, [mask]
@ -291,19 +289,19 @@ proc snd_hda_get_connections stdcall, nid:dword, conn_list:dword, max_conns:dwo
xor eax, eax xor eax, eax
inc eax inc eax
jmp .out jmp .out
.multi_conns: .multi_conns:
; multi connection ; multi connection
xor ecx, ecx xor ecx, ecx
mov edx, [num_elements] mov edx, [num_elements]
.next_conn: .next_conn:
mov eax, ecx mov eax, ecx
.mod: .mod:
cmp eax, edx cmp eax, edx
jl .mod_counted jl .mod_counted
sub eax, edx sub eax, edx
jmp .mod jmp .mod
.mod_counted: .mod_counted:
test eax, eax test eax, eax
jnz .l1 jnz .l1
@ -314,7 +312,7 @@ proc snd_hda_get_connections stdcall, nid:dword, conn_list:dword, max_conns:dwo
jne .l1 jne .l1
cmp [ctrl.rirb_error], 0 cmp [ctrl.rirb_error], 0
jne .err_out jne .err_out
.l1: .l1:
mov eax, 1 mov eax, 1
push ecx push ecx
@ -330,30 +328,30 @@ proc snd_hda_get_connections stdcall, nid:dword, conn_list:dword, max_conns:dwo
test eax, eax test eax, eax
jnz @f jnz @f
if DEBUG if DEBUG
push eax esi push eax esi
mov esi, emsgInvConnList mov esi, emsgInvConnList
call SysMsgBoardStr invoke SysMsgBoardStr
mov eax, [nid] mov eax, [nid]
stdcall fdword2str, 1 stdcall fdword2str, 1
call SysMsgBoardStr invoke SysMsgBoardStr
mov esi, strSemicolon mov esi, strSemicolon
call SysMsgBoardStr invoke SysMsgBoardStr
mov eax, ecx mov eax, ecx
stdcall fdword2str, 0 stdcall fdword2str, 0
call SysMsgBoardStr invoke SysMsgBoardStr
mov esi, strSemicolon mov esi, strSemicolon
call SysMsgBoardStr invoke SysMsgBoardStr
mov eax, [parm] mov eax, [parm]
stdcall fdword2str, 2 stdcall fdword2str, 2
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi eax pop esi eax
end if end if
xor eax, eax xor eax, eax
jmp .out jmp .out
@@: @@:
push ecx push ecx
mov cl, [shift] mov cl, [shift]
shr [parm], cl shr [parm], cl
@ -367,43 +365,43 @@ proc snd_hda_get_connections stdcall, nid:dword, conn_list:dword, max_conns:dwo
jz .l2 jz .l2
cmp esi, eax cmp esi, eax
jl @f jl @f
.l2: .l2:
if DEBUG if DEBUG
push eax esi push eax esi
push esi push esi
mov esi, emsgInvDepRangeVal mov esi, emsgInvDepRangeVal
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi pop esi
push eax push eax
mov eax, esi mov eax, esi
stdcall fdword2str, 0 stdcall fdword2str, 0
call SysMsgBoardStr invoke SysMsgBoardStr
mov esi, strSemicolon mov esi, strSemicolon
call SysMsgBoardStr invoke SysMsgBoardStr
pop eax pop eax
stdcall fdword2str, 2 stdcall fdword2str, 2
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi eax pop esi eax
end if end if
jmp .continue jmp .continue
@@: @@:
push ecx push ecx
mov ecx, esi mov ecx, esi
inc ecx inc ecx
mov ebx, [conns] mov ebx, [conns]
.next_conn2: .next_conn2:
cmp ebx, [max_conns] cmp ebx, [max_conns]
jl @f jl @f
if DEBUG if DEBUG
push esi push esi
mov esi, emsgTooManyConns mov esi, emsgTooManyConns
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi pop esi
end if end if
pop ecx pop ecx
jmp .err_out jmp .err_out
@@: @@:
shl ebx, 1 shl ebx, 1
push edi push edi
add edi, ebx add edi, ebx
@ -418,19 +416,19 @@ proc snd_hda_get_connections stdcall, nid:dword, conn_list:dword, max_conns:dwo
mov [conns], ebx mov [conns], ebx
pop ecx pop ecx
jmp .end_range_test jmp .end_range_test
.range_zero: .range_zero:
mov ebx, [conns] mov ebx, [conns]
cmp ebx, [max_conns] cmp ebx, [max_conns]
jl @f jl @f
if DEBUG if DEBUG
push esi push esi
mov esi, emsgTooManyConns mov esi, emsgTooManyConns
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi pop esi
end if end if
jmp .err_out jmp .err_out
@@: @@:
shl ebx, 1 shl ebx, 1
push edi push edi
add edi, ebx add edi, ebx
@ -439,18 +437,18 @@ proc snd_hda_get_connections stdcall, nid:dword, conn_list:dword, max_conns:dwo
shr ebx, 1 shr ebx, 1
inc ebx inc ebx
mov [conns], ebx mov [conns], ebx
.end_range_test: .end_range_test:
mov [prev_nid], ax mov [prev_nid], ax
.continue: .continue:
inc ecx inc ecx
cmp ecx, [conn_len] cmp ecx, [conn_len]
jl .next_conn jl .next_conn
mov eax, [conns] mov eax, [conns]
.out: .out:
pop esi edi edx ecx ebx pop esi edi edx ecx ebx
ret ret
.err_out: .err_out:
pop esi edi edx ecx ebx pop esi edi edx ecx ebx
mov eax, -1 mov eax, -1
ret ret
@ -495,7 +493,7 @@ proc snd_hda_codec_init ; We use just one codec (the first found)
cmp eax, -1 cmp eax, -1
jne @f jne @f
snd_hda_param_read AC_NODE_ROOT, AC_PAR_VENDOR_ID snd_hda_param_read AC_NODE_ROOT, AC_PAR_VENDOR_ID
@@: @@:
mov [codec.chip_id], ax mov [codec.chip_id], ax
shr eax, 16 shr eax, 16
mov [codec.vendor_id], ax mov [codec.vendor_id], ax
@ -511,14 +509,13 @@ proc snd_hda_codec_init ; We use just one codec (the first found)
mov eax, [codec.afg] mov eax, [codec.afg]
test eax, eax test eax, eax
jnz @f jnz @f
;Asper+: try to use another codec if possible [ ;Asper+: try to use another codec if possible [
if DEBUG if DEBUG
push esi push esi
mov esi, msgNoAFGFound mov esi, msgNoAFGFound
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi pop esi
end if end if
push ecx push ecx
inc eax inc eax
mov ecx, [codec.addr] mov ecx, [codec.addr]
@ -531,16 +528,16 @@ proc snd_hda_codec_init ; We use just one codec (the first found)
mov eax, [codec.mfg] mov eax, [codec.mfg]
test eax, eax test eax, eax
jnz @f jnz @f
if DEBUG if DEBUG
push esi push esi
mov esi, emsgNoAFGorMFGFound mov esi, emsgNoAFGorMFGFound
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi pop esi
end if end if
.skip_codec: .skip_codec:
mov eax, -1 mov eax, -1
ret ret
@@: @@:
mov ebx, eax mov ebx, eax
push ebx push ebx
@ -548,16 +545,16 @@ proc snd_hda_codec_init ; We use just one codec (the first found)
cmp eax, 0 cmp eax, 0
jge @f jge @f
if DEBUG if DEBUG
push esi push esi
mov esi, emsgNoMem mov esi, emsgNoMem
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi pop esi
end if end if
pop ebx pop ebx
mov eax, -1 mov eax, -1
ret ret
@@: @@:
call read_pin_defaults call read_pin_defaults
@ -566,14 +563,12 @@ proc snd_hda_codec_init ; We use just one codec (the first found)
pop ebx pop ebx
mov eax, -1 mov eax, -1
ret ret
@@: @@:
mov eax, [codec.subsystem_id] mov eax, [codec.subsystem_id]
test eax, eax test eax, eax
jnz @f jnz @f
stdcall snd_hda_codec_read, ebx, 0, AC_VERB_GET_SUBSYSTEM_ID, 0 stdcall snd_hda_codec_read, ebx, 0, AC_VERB_GET_SUBSYSTEM_ID, 0
@@:
@@:
; 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
@ -593,20 +588,20 @@ endp
;; ;;
proc snd_hda_codec_configure proc snd_hda_codec_configure
call get_codec_name call get_codec_name
@@: @@:
; 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!!!
test eax, eax test eax, eax
jz @f jz @f
if DEBUG if DEBUG
push esi push esi
mov esi, emsgNoParserAvailable mov esi, emsgNoParserAvailable
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi pop esi
end if end if
@@: @@:
.out: .out:
ret ret
endp endp
@ -620,7 +615,7 @@ proc get_codec_name
mov ax, [codec.vendor_id] mov ax, [codec.vendor_id]
mov edi, hda_vendor_ids mov edi, hda_vendor_ids
@@: @@:
mov ebx, [edi] mov ebx, [edi]
test ebx, ebx test ebx, ebx
jz .unknown jz .unknown
@ -630,23 +625,23 @@ proc get_codec_name
mov eax, [edi+4] mov eax, [edi+4]
mov [codec.ac_vendor_ids], eax mov [codec.ac_vendor_ids], eax
mov esi, eax mov esi, eax
call SysMsgBoardStr invoke SysMsgBoardStr
.get_chip_name: .get_chip_name:
stdcall detect_chip, [edi+8] stdcall detect_chip, [edi+8]
pop esi edi ebx eax pop esi edi ebx eax
ret ret
.next: .next:
add edi, 12 add edi, 12
jmp @b jmp @b
.unknown: .unknown:
mov [codec.ac_vendor_ids], ac_unknown mov [codec.ac_vendor_ids], ac_unknown
mov [codec.chip_ids], chip_unknown mov [codec.chip_ids], chip_unknown
mov esi, chip_unknown mov esi, chip_unknown
call SysMsgBoardStr invoke SysMsgBoardStr
movzx eax, [codec.chip_id] movzx eax, [codec.chip_id]
stdcall fdword2str, 2 stdcall fdword2str, 2
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi edi ebx eax pop esi edi ebx eax
ret ret
endp endp
@ -654,7 +649,6 @@ endp
align 4 align 4
proc detect_chip stdcall, chip_tab:dword proc detect_chip stdcall, chip_tab:dword
push eax ebx edi esi push eax ebx edi esi
mov ax, [codec.chip_id] mov ax, [codec.chip_id]
@ -669,7 +663,7 @@ proc detect_chip stdcall, chip_tab:dword
mov eax, [edi+4] mov eax, [edi+4]
mov [codec.chip_ids], eax mov [codec.chip_ids], eax
mov esi, eax mov esi, eax
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi edi ebx eax pop esi edi ebx eax
ret ret
.next: .next:
@ -678,10 +672,10 @@ proc detect_chip stdcall, chip_tab:dword
.unknown: .unknown:
mov [codec.chip_ids], chip_unknown mov [codec.chip_ids], chip_unknown
mov esi, chip_unknown mov esi, chip_unknown
call SysMsgBoardStr invoke SysMsgBoardStr
movzx eax, [codec.chip_id] movzx eax, [codec.chip_id]
stdcall fdword2str, 2 stdcall fdword2str, 2
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi edi ebx eax pop esi edi ebx eax
ret ret
endp endp
@ -697,34 +691,34 @@ proc setup_fg_nodes
shr ebx, 16 shr ebx, 16
and ebx, 0x7FFF ; nid and ebx, 0x7FFF ; nid
if DEBUG ;YAHOO if DEBUG
push eax esi push eax esi
mov esi, msgSETUP_FG_NODES mov esi, msgSETUP_FG_NODES
call SysMsgBoardStr invoke SysMsgBoardStr
mov eax, ebx mov eax, ebx
stdcall fdword2str, 1 stdcall fdword2str, 1
call SysMsgBoardStr invoke SysMsgBoardStr
mov esi, strSemicolon mov esi, strSemicolon
call SysMsgBoardStr invoke SysMsgBoardStr
mov eax, ecx mov eax, ecx
stdcall fdword2str, 3 stdcall fdword2str, 3
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi eax pop esi eax
end if end if
.next: .next:
test ecx, ecx test ecx, ecx
jz .l1 jz .l1
snd_hda_param_read ebx, AC_PAR_FUNCTION_TYPE snd_hda_param_read ebx, AC_PAR_FUNCTION_TYPE
and eax, 0xFF and eax, 0xFF
if DEBUG ;YAHOO if DEBUG
push eax esi push eax esi
mov esi, msgFG_TYPE mov esi, msgFG_TYPE
call SysMsgBoardStr invoke SysMsgBoardStr
stdcall fdword2str, 3 stdcall fdword2str, 3
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi eax pop esi eax
end if end if
@ -734,19 +728,19 @@ end if
mov [codec.afg], ebx mov [codec.afg], ebx
mov [codec.function_id], eax mov [codec.function_id], eax
jmp .continue jmp .continue
@@: @@:
cmp eax, AC_GRP_MODEM_FUNCTION cmp eax, AC_GRP_MODEM_FUNCTION
jne @f jne @f
mov [codec.mfg], ebx mov [codec.mfg], ebx
mov [codec.function_id], eax mov [codec.function_id], eax
jmp .continue jmp .continue
@@: @@:
.continue: .continue:
inc ebx inc ebx
dec ecx dec ecx
jnz .next jnz .next
.l1: .l1:
pop ecx ebx eax pop ecx ebx eax
ret ret
endp endp
@ -766,40 +760,40 @@ proc read_widget_caps stdcall, fg_node:dword
and ebx, 0x7FFF ; nid and ebx, 0x7FFF ; nid
mov [codec.start_nid], bx mov [codec.start_nid], bx
if DEBUG ;YAHOO if DEBUG
push eax esi push eax esi
mov esi, msgSETUP_FG_NODES mov esi, msgSETUP_FG_NODES
call SysMsgBoardStr invoke SysMsgBoardStr
mov eax, ebx mov eax, ebx
stdcall fdword2str, 1 stdcall fdword2str, 1
call SysMsgBoardStr invoke SysMsgBoardStr
mov esi, strSemicolon mov esi, strSemicolon
call SysMsgBoardStr invoke SysMsgBoardStr
mov eax, ecx mov eax, ecx
stdcall fdword2str, 3 stdcall fdword2str, 3
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi eax pop esi eax
end if end if
if FDEBUG ;YAHOO if FDEBUG
push esi push esi
mov esi, msgWCaps mov esi, msgWCaps
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi pop esi
end if end if
mov eax, ecx mov eax, ecx
shl eax, 2 shl eax, 2
push ebx ecx push ebx ecx
call Kmalloc invoke Kmalloc
pop ecx ebx pop ecx ebx
test eax, eax test eax, eax
jz .err_out jz .err_out
mov [codec.wcaps], eax mov [codec.wcaps], eax
mov edi, eax mov edi, eax
.next_node: .next_node:
snd_hda_param_read ebx, AC_PAR_AUDIO_WIDGET_CAP snd_hda_param_read ebx, AC_PAR_AUDIO_WIDGET_CAP
stosd stosd
@ -809,7 +803,7 @@ end if
pop edi edx ecx ebx pop edi edx ecx ebx
xor eax, eax xor eax, eax
ret ret
.err_out: .err_out:
pop edi edx ecx ebx pop edi edx ecx ebx
xor eax, eax xor eax, eax
dec eax dec eax
@ -828,7 +822,7 @@ proc read_pin_defaults
mov eax, HDA_PINCFG.sizeof mov eax, HDA_PINCFG.sizeof
mul cl mul cl
push ebx ecx push ebx ecx
call Kmalloc invoke Kmalloc
pop ecx ebx pop ecx ebx
test eax, eax test eax, eax
jz .err_out jz .err_out
@ -840,12 +834,12 @@ proc read_pin_defaults
if FDEBUG if FDEBUG
push eax esi push eax esi
mov esi, msgPinCfgs mov esi, msgPinCfgs
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi eax pop esi eax
end if end if
.next_node: .next_node:
stdcall get_wcaps, ebx stdcall get_wcaps, ebx
and eax, AC_WCAP_TYPE and eax, AC_WCAP_TYPE
shr eax, AC_WCAP_TYPE_SHIFT shr eax, AC_WCAP_TYPE_SHIFT
@ -859,7 +853,7 @@ end if
add edi, HDA_PINCFG.sizeof add edi, HDA_PINCFG.sizeof
inc [codec.num_pins] inc [codec.num_pins]
.continue: .continue:
inc ebx inc ebx
dec ecx dec ecx
jnz .next_node jnz .next_node
@ -867,7 +861,7 @@ end if
pop edi edx ecx ebx pop edi edx ecx ebx
xor eax, eax xor eax, eax
ret ret
.err_out: .err_out:
pop edi edx ecx ebx pop edi edx ecx ebx
xor eax, eax xor eax, eax
dec eax dec eax
@ -882,17 +876,17 @@ proc look_up_pincfg stdcall, array:dword, nid:dword
mov ecx, [codec.num_pins] mov ecx, [codec.num_pins]
mov eax, [array] mov eax, [array]
mov ebx, [nid] mov ebx, [nid]
.next_pin: .next_pin:
mov dx, [eax + HDA_PINCFG.nid] mov dx, [eax + HDA_PINCFG.nid]
cmp dx, bx cmp dx, bx
je .out je .out
.continue: .continue:
add eax, HDA_PINCFG.sizeof add eax, HDA_PINCFG.sizeof
dec ecx dec ecx
jnz .next_pin jnz .next_pin
xor eax, eax xor eax, eax
.out: .out:
pop edx ecx ebx pop edx ecx ebx
ret ret
endp endp
@ -904,14 +898,14 @@ proc set_pincfg stdcall, nid:dword, cfg:dword
xor ebx, ebx xor ebx, ebx
mov edx, AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 mov edx, AC_VERB_SET_CONFIG_DEFAULT_BYTES_0
mov ecx, 4 mov ecx, 4
@@: @@:
mov bl, al mov bl, al
stdcall snd_hda_codec_write, [nid], 0, edx, ebx stdcall snd_hda_codec_write, [nid], 0, edx, ebx
shr eax, 8 shr eax, 8
inc edx inc edx
dec ecx dec ecx
jnz @b jnz @b
.l1: .l1:
pop edx ecx ebx eax pop edx ecx ebx eax
ret ret
endp endp
@ -933,7 +927,7 @@ proc snd_hda_codec_get_pincfg stdcall, nid:dword
jz @f jz @f
mov edi, eax mov edi, eax
mov eax, [edi + HDA_PINCFG.cfg] mov eax, [edi + HDA_PINCFG.cfg]
@@: @@:
pop edi pop edi
ret ret
endp endp
@ -954,33 +948,33 @@ proc hda_codec_setup_stream stdcall, nid:dword, stream_tag:dword, channel_id:dwo
jnz @f jnz @f
pop eax pop eax
ret ret
@@: @@:
if DEBUG if DEBUG
push esi push esi
mov esi, msgHDACodecSetupStream mov esi, msgHDACodecSetupStream
call SysMsgBoardStr invoke SysMsgBoardStr
stdcall fdword2str, 3 stdcall fdword2str, 3
call SysMsgBoardStr invoke SysMsgBoardStr
mov esi, msgStream mov esi, msgStream
call SysMsgBoardStr invoke SysMsgBoardStr
mov eax, [stream_tag] mov eax, [stream_tag]
stdcall fdword2str, 3 stdcall fdword2str, 3
call SysMsgBoardStr invoke SysMsgBoardStr
mov esi, msgChannel mov esi, msgChannel
call SysMsgBoardStr invoke SysMsgBoardStr
mov eax, [channel_id] mov eax, [channel_id]
stdcall fdword2str, 3 stdcall fdword2str, 3
call SysMsgBoardStr invoke SysMsgBoardStr
mov esi, msgFormat mov esi, msgFormat
call SysMsgBoardStr invoke SysMsgBoardStr
mov eax, [format] mov eax, [format]
stdcall fdword2str, 3 stdcall fdword2str, 3
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi pop esi
end if end if
mov eax, [stream_tag] mov eax, [stream_tag]
shl eax, 4 shl eax, 4
or eax, [channel_id] or eax, [channel_id]
@ -1002,21 +996,21 @@ proc snd_hda_codec_cleanup_stream stdcall, nid:dword
jz @f jz @f
pop eax pop eax
ret ret
@@: @@:
if DEBUG if DEBUG
push esi push esi
mov esi, msgHDACodecCleanupStream mov esi, msgHDACodecCleanupStream
call SysMsgBoardStr invoke SysMsgBoardStr
stdcall fdword2str, 3 stdcall fdword2str, 3
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi pop esi
end if end if
stdcall snd_hda_codec_write, [nid], 0, AC_VERB_SET_CHANNEL_STREAMID, 0 stdcall snd_hda_codec_write, [nid], 0, AC_VERB_SET_CHANNEL_STREAMID, 0
if 0 ; keep the format if 0 ; keep the format
mov eax, 1000000 ; wait 100 ms mov eax, 1000000 ; wait 100 ms
call StallExec call StallExec
stdcall snd_hda_codec_write, [nid], 0, AC_VERB_SET_STREAM_FORMAT, 0 stdcall snd_hda_codec_write, [nid], 0, AC_VERB_SET_STREAM_FORMAT, 0
end if end if
pop eax pop eax
ret ret
endp endp
@ -1036,15 +1030,15 @@ proc get_volume_mute stdcall, nid:dword, ch:dword, direction:dword, index:dword
test eax, eax test eax, eax
jz @f jz @f
mov ebx, AC_AMP_GET_RIGHT mov ebx, AC_AMP_GET_RIGHT
@@: @@:
mov eax, [direction] mov eax, [direction]
cmp eax, HDA_OUTPUT cmp eax, HDA_OUTPUT
jne @f jne @f
or ebx, AC_AMP_GET_OUTPUT or ebx, AC_AMP_GET_OUTPUT
jmp .l1 jmp .l1
@@: @@:
or ebx, AC_AMP_GET_INPUT or ebx, AC_AMP_GET_INPUT
.l1: .l1:
or ebx, [index] or ebx, [index]
stdcall snd_hda_codec_read, [nid], 0, AC_VERB_GET_AMP_GAIN_MUTE, ebx stdcall snd_hda_codec_read, [nid], 0, AC_VERB_GET_AMP_GAIN_MUTE, ebx
and eax, 0xFF and eax, 0xFF
@ -1061,15 +1055,15 @@ proc put_volume_mute stdcall, nid:dword, ch:dword, direction:dword, index:dword,
test eax, eax test eax, eax
jz @f jz @f
mov ebx, AC_AMP_SET_RIGHT mov ebx, AC_AMP_SET_RIGHT
@@: @@:
mov eax, [direction] mov eax, [direction]
cmp eax, HDA_OUTPUT cmp eax, HDA_OUTPUT
jne @f jne @f
or ebx, AC_AMP_SET_OUTPUT or ebx, AC_AMP_SET_OUTPUT
jmp .l1 jmp .l1
@@: @@:
or ebx, AC_AMP_SET_INPUT or ebx, AC_AMP_SET_INPUT
.l1: .l1:
mov eax, [index] mov eax, [index]
shl eax, AC_AMP_SET_INDEX_SHIFT shl eax, AC_AMP_SET_INDEX_SHIFT
or ebx, eax or ebx, eax
@ -1133,6 +1127,51 @@ proc snd_hda_codec_amp_stereo stdcall, nid:dword, direction:dword, idx:dword, ma
ret ret
endp endp
; execute pin sense measurement
proc snd_hda_read_pin_sense stdcall, nid:dword, trigger_sense:dword
mov eax, [trigger_sense]
test eax, eax
jz .no_trigger_sense
stdcall read_pin_cap, [nid]
test eax, AC_PINCAP_TRIG_REQ ;need trigger?
jz .no_trigger_sense
stdcall snd_hda_codec_read, [nid], 0, AC_VERB_SET_PIN_SENSE, 0
.no_trigger_sense:
stdcall snd_hda_codec_read, [nid], 0, AC_VERB_GET_PIN_SENSE, 0
ret
endp
proc is_jack_detectable stdcall, nid:dword
stdcall read_pin_cap, [nid]
test eax, AC_PINCAP_PRES_DETECT
jz .no
stdcall get_wcaps, [nid]
test eax, AC_WCAP_UNSOL_CAP
jz .no
.yes:
xor eax, eax
inc eax
ret
.no:
xor eax, eax
ret
endp
proc snd_hda_enable_pin_sense stdcall nid:dword, jacktag:dword
push eax
stdcall is_jack_detectable, [nid]
test eax, eax
jz @f
mov eax, [jacktag]
or eax, AC_USRSP_EN
stdcall snd_hda_codec_write, [nid], 0, AC_VERB_SET_UNSOLICITED_ENABLE, eax
@@:
pop eax
ret
endp
;; set power state of the codec ;; set power state of the codec
proc snd_hda_set_power_state stdcall, fg:dword, power_state:dword proc snd_hda_set_power_state stdcall, fg:dword, power_state:dword
@ -1143,7 +1182,7 @@ proc snd_hda_set_power_state stdcall, fg:dword, power_state:dword
jne @f jne @f
mov eax, 100000 mov eax, 100000
call StallExec call StallExec
@@: @@:
stdcall snd_hda_codec_read, [fg], 0, AC_VERB_SET_POWER_STATE, ebx stdcall snd_hda_codec_read, [fg], 0, AC_VERB_SET_POWER_STATE, ebx
;partial workaround for "azx_get_response timeout" ;partial workaround for "azx_get_response timeout"
cmp ebx, AC_PWRST_D0 cmp ebx, AC_PWRST_D0
@ -1151,14 +1190,13 @@ proc snd_hda_set_power_state stdcall, fg:dword, power_state:dword
mov dx, [codec.vendor_id] mov dx, [codec.vendor_id]
cmp dx, 0x14F1 cmp dx, 0x14F1
jne @f jne @f
mov eax, 10000 mov eax, 10000
call StallExec call StallExec
@@: @@:
movzx ecx, [codec.num_nodes] movzx ecx, [codec.num_nodes]
movzx edx, [codec.start_nid] movzx edx, [codec.start_nid]
.next_nid: .next_nid:
stdcall get_wcaps, edx stdcall get_wcaps, edx
test eax, AC_WCAP_POWER test eax, AC_WCAP_POWER
jz .skip_nid jz .skip_nid
@ -1178,10 +1216,10 @@ proc snd_hda_set_power_state stdcall, fg:dword, power_state:dword
and eax, 0x02 and eax, 0x02
test eax, eax test eax, eax
jnz .skip_nid jnz .skip_nid
.l2: .l2:
.l1: .l1:
stdcall snd_hda_codec_write, edx, 0, AC_VERB_SET_POWER_STATE, ebx stdcall snd_hda_codec_write, edx, 0, AC_VERB_SET_POWER_STATE, ebx
.skip_nid: .skip_nid:
inc edx inc edx
dec ecx dec ecx
jnz .next_nid jnz .next_nid
@ -1190,7 +1228,7 @@ proc snd_hda_set_power_state stdcall, fg:dword, power_state:dword
jne .out jne .out
;wait until codec reaches to D0 ;wait until codec reaches to D0
mov ecx, 500 mov ecx, 500
.wait_D0: .wait_D0:
stdcall snd_hda_codec_read, [fg], 0, AC_VERB_GET_POWER_STATE, 0 stdcall snd_hda_codec_read, [fg], 0, AC_VERB_GET_POWER_STATE, 0
cmp eax, ebx cmp eax, ebx
je .out je .out
@ -1198,7 +1236,7 @@ proc snd_hda_set_power_state stdcall, fg:dword, power_state:dword
call StallExec call StallExec
dec ecx dec ecx
jnz .wait_D0 jnz .wait_D0
.out: .out:
pop edx ecx ebx eax pop edx ecx ebx eax
ret ret
endp endp
@ -1285,7 +1323,6 @@ chips_VIA dd 0xE721, chip_VT1708B_1
dd 0xFF dd 0xFF
chips_IDT dd 0xFF chips_IDT dd 0xFF
chips_LSI dd 0x1039, chip_LSI1039 chips_LSI dd 0x1039, chip_LSI1039
dd 0x1040, chip_LSI1040 dd 0x1040, chip_LSI1040
dd 0x3026, chip_LSI3026 dd 0x3026, chip_LSI3026
@ -1362,3 +1399,4 @@ chip_LSI1039 db '1039 (Agere Systems HDA Modem)',13,10,0
chip_LSI1040 db '1040 (Agere Systems HDA Modem)',13,10,0 chip_LSI1040 db '1040 (Agere Systems HDA Modem)',13,10,0
chip_LSI3026 db '3026 (Agere Systems HDA Modem)',13,10,0 chip_LSI3026 db '3026 (Agere Systems HDA Modem)',13,10,0
chip_LSI3055 db '3055 (Agere Systems HDA Modem)',13,10,0 chip_LSI3055 db '3055 (Agere Systems HDA Modem)',13,10,0

View File

@ -598,7 +598,6 @@ PIN_HP_AMP equ (AC_PINCTL_HP_EN)
; get widget capabilities ; get widget capabilities
;static inline u32 get_wcaps(struct hda_codec *codec, hda_nid_t nid)
proc get_wcaps stdcall, nid:dword proc get_wcaps stdcall, nid:dword
push ebx ecx edx push ebx ecx edx
xor eax, eax xor eax, eax
@ -617,13 +616,12 @@ proc get_wcaps stdcall, nid:dword
shl edx, 2 shl edx, 2
add edx, [codec.wcaps] add edx, [codec.wcaps]
mov eax, [edx] mov eax, [edx]
.out: .out:
pop edx ecx ebx pop edx ecx ebx
ret ret
endp endp
; get the widget type from widget capability bits ; get the widget type from widget capability bits
;#define get_wcaps_type(wcaps) (((wcaps) & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT)
proc get_wcaps_type stdcall, wcaps:dword proc get_wcaps_type stdcall, wcaps:dword
mov eax, [wcaps] mov eax, [wcaps]
and eax, AC_WCAP_TYPE and eax, AC_WCAP_TYPE
@ -633,8 +631,6 @@ endp
;static inline unsigned int get_wcaps_channels(u32 wcaps) ;static inline unsigned int get_wcaps_channels(u32 wcaps)
proc get_wcaps_channels stdcall, wcaps:dword proc get_wcaps_channels stdcall, wcaps:dword
; chans = (wcaps & AC_WCAP_CHAN_CNT_EXT) >> 13;
; chans = ((chans << 1) | 1) + 1;
mov eax, [wcaps] mov eax, [wcaps]
and eax, AC_WCAP_CHAN_CNT_EXT and eax, AC_WCAP_CHAN_CNT_EXT
shr eax, 13 shr eax, 13
@ -644,5 +640,4 @@ proc get_wcaps_channels stdcall, wcaps:dword
ret ret
endp endp
;Asper ] ;Asper ]

View File

@ -1,89 +0,0 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
macro kernel_export [name]{
forward
if used name
if DEBUG
display 'uses: ',`name,#13,#10
end if
extrn name
end if
}
; all exported kernel functions and data
kernel_export \
RegService,\
GetService,\
ServiceHandler,\
AttachIntHandler,\
GetIntHandler,\
FpuSave,\
FpuRestore,\
ReservePortArea,\
Boot_Log,\
\
PciApi,\
PciRead32,\
PciRead16,\
PciRead8,\
PciWrite8,\
PciWrite16,\
PciWrite32,\
\
AllocPage,\
AllocPages,\
FreePage,\
MapPage,\
MapSpace,\
MapIoMem,\
GetPgAddr,\
CommitPages,\
ReleasePages,\
\
AllocKernelSpace,\
FreeKernelSpace,\
KernelAlloc,\
KernelFree,\
UserAlloc,\
UserFree,\
Kmalloc,\
Kfree,\
CreateRingBuffer,\
\
GetPid,\
CreateObject,\
DestroyObject,\
CreateEvent,\
RaiseEvent,\
WaitEvent,\
DestroyEvent,\
ClearEvent,\
\
LoadCursor,\
SelectHwCursor,\
SetHwCursor,\
HwCursorRestore,\
HwCursorCreate,\
\
SysMsgBoardStr,\
SysMsgBoard,\
GetCurrentTask,\
LoadFile,\
SendEvent,\
SetMouseData,\
Sleep,\
GetTimerTicks,\
\
strncat,\
strncpy,\
strncmp,\
strnlen,\
strchr,\
strrchr,\
\
LFBAddress

View File

@ -1,268 +0,0 @@
; Macroinstructions for defining and calling procedures
macro stdcall proc,[arg] ; directly call STDCALL procedure
{ common
if ~ arg eq
reverse
pushd arg
common
end if
call proc }
macro invoke proc,[arg] ; indirectly call STDCALL procedure
{ common
if ~ arg eq
reverse
pushd arg
common
end if
call [proc] }
macro ccall proc,[arg] ; directly call CDECL procedure
{ common
size@ccall = 0
if ~ arg eq
reverse
pushd arg
size@ccall = size@ccall+4
common
end if
call proc
if size@ccall
add esp,size@ccall
end if }
macro cinvoke proc,[arg] ; indirectly call CDECL procedure
{ common
size@ccall = 0
if ~ arg eq
reverse
pushd arg
size@ccall = size@ccall+4
common
end if
call [proc]
if size@ccall
add esp,size@ccall
end if }
macro proc [args] ; define procedure
{ common
match name params, args>
\{ define@proc name,<params \} }
prologue@proc equ prologuedef
macro prologuedef procname,flag,parmbytes,localbytes,reglist
{ if parmbytes | localbytes
push ebp
mov ebp,esp
if localbytes
sub esp,localbytes
end if
end if
irps reg, reglist \{ push reg \} }
epilogue@proc equ epiloguedef
macro epiloguedef procname,flag,parmbytes,localbytes,reglist
{ irps reg, reglist \{ reverse pop reg \}
if parmbytes | localbytes
leave
end if
if flag and 10000b
retn
else
retn parmbytes
end if }
macro define@proc name,statement
{ local params,flag,regs,parmbytes,localbytes,current
if used name
name:
match =stdcall args, statement \{ params equ args
flag = 11b \}
match =stdcall, statement \{ params equ
flag = 11b \}
match =c args, statement \{ params equ args
flag = 10001b \}
match =c, statement \{ params equ
flag = 10001b \}
match =params, params \{ params equ statement
flag = 0 \}
virtual at ebp+8
match =uses reglist=,args, params \{ regs equ reglist
params equ args \}
match =regs =uses reglist, regs params \{ regs equ reglist
params equ \}
match =regs, regs \{ regs equ \}
match =,args, params \{ defargs@proc args \}
match =args@proc args, args@proc params \{ defargs@proc args \}
parmbytes = $ - (ebp+8)
end virtual
name # % = parmbytes/4
all@vars equ
current = 0
match prologue:reglist, prologue@proc:<regs> \{ prologue name,flag,parmbytes,localbytes,reglist \}
macro locals
\{ virtual at ebp-localbytes+current
macro label . \\{ deflocal@proc .,:, \\}
struc db [val] \\{ \common deflocal@proc .,db,val \\}
struc dw [val] \\{ \common deflocal@proc .,dw,val \\}
struc dp [val] \\{ \common deflocal@proc .,dp,val \\}
struc dd [val] \\{ \common deflocal@proc .,dd,val \\}
struc dt [val] \\{ \common deflocal@proc .,dt,val \\}
struc dq [val] \\{ \common deflocal@proc .,dq,val \\}
struc rb cnt \\{ deflocal@proc .,rb cnt, \\}
struc rw cnt \\{ deflocal@proc .,rw cnt, \\}
struc rp cnt \\{ deflocal@proc .,rp cnt, \\}
struc rd cnt \\{ deflocal@proc .,rd cnt, \\}
struc rt cnt \\{ deflocal@proc .,rt cnt, \\}
struc rq cnt \\{ deflocal@proc .,rq cnt, \\} \}
macro endl
\{ purge label
restruc db,dw,dp,dd,dt,dq
restruc rb,rw,rp,rd,rt,rq
restruc byte,word,dword,pword,tword,qword
current = $-(ebp-localbytes)
end virtual \}
macro ret operand
\{ match any, operand \\{ retn operand \\}
match , operand \\{ match epilogue:reglist, epilogue@proc:<regs>
\\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \}
macro finish@proc \{ localbytes = (((current-1) shr 2)+1) shl 2
end if \} }
macro defargs@proc [arg]
{ common
if ~ arg eq
forward
local ..arg,current@arg
match argname:type, arg
\{ current@arg equ argname
label ..arg type
argname equ ..arg
if dqword eq type
dd ?,?,?,?
else if tbyte eq type
dd ?,?,?
else if qword eq type | pword eq type
dd ?,?
else
dd ?
end if \}
match =current@arg,current@arg
\{ current@arg equ arg
arg equ ..arg
..arg dd ? \}
common
args@proc equ current@arg
forward
restore current@arg
common
end if }
macro deflocal@proc name,def,[val]
{ common
match vars, all@vars \{ all@vars equ all@vars, \}
all@vars equ all@vars name
forward
local ..var,..tmp
..var def val
match =?, val \{ ..tmp equ \}
match any =dup (=?), val \{ ..tmp equ \}
match tmp : value, ..tmp : val
\{ tmp: end virtual
initlocal@proc ..var,def value
virtual at tmp\}
common
match first rest, ..var, \{ name equ first \} }
macro initlocal@proc name,def
{ virtual at name
def
size@initlocal = $ - name
end virtual
position@initlocal = 0
while size@initlocal > position@initlocal
virtual at name
def
if size@initlocal - position@initlocal < 2
current@initlocal = 1
load byte@initlocal byte from name+position@initlocal
else if size@initlocal - position@initlocal < 4
current@initlocal = 2
load word@initlocal word from name+position@initlocal
else
current@initlocal = 4
load dword@initlocal dword from name+position@initlocal
end if
end virtual
if current@initlocal = 1
mov byte [name+position@initlocal],byte@initlocal
else if current@initlocal = 2
mov word [name+position@initlocal],word@initlocal
else
mov dword [name+position@initlocal],dword@initlocal
end if
position@initlocal = position@initlocal + current@initlocal
end while }
macro endp
{ purge ret,locals,endl
finish@proc
purge finish@proc
restore regs@proc
match all,args@proc \{ restore all \}
restore args@proc
match all,all@vars \{ restore all \} }
macro local [var]
{ common
locals
forward done@local equ
match varname[count]:vartype, var
\{ match =BYTE, vartype \\{ varname rb count
restore done@local \\}
match =WORD, vartype \\{ varname rw count
restore done@local \\}
match =DWORD, vartype \\{ varname rd count
restore done@local \\}
match =PWORD, vartype \\{ varname rp count
restore done@local \\}
match =QWORD, vartype \\{ varname rq count
restore done@local \\}
match =TBYTE, vartype \\{ varname rt count
restore done@local \\}
match =DQWORD, vartype \\{ label varname dqword
rq count+count
restore done@local \\}
match , done@local \\{ virtual
varname vartype
end virtual
rb count*sizeof.\#vartype
restore done@local \\} \}
match :varname:vartype, done@local:var
\{ match =BYTE, vartype \\{ varname db ?
restore done@local \\}
match =WORD, vartype \\{ varname dw ?
restore done@local \\}
match =DWORD, vartype \\{ varname dd ?
restore done@local \\}
match =PWORD, vartype \\{ varname dp ?
restore done@local \\}
match =QWORD, vartype \\{ varname dq ?
restore done@local \\}
match =TBYTE, vartype \\{ varname dt ?
restore done@local \\}
match =DQWORD, vartype \\{ label varname dqword
dq ?,?
restore done@local \\}
match , done@local \\{ varname vartype
restore done@local \\} \}
match ,done@local
\{ var
restore done@local \}
common
endl }

View File

@ -52,7 +52,6 @@ struc VOLUME_CTL
} }
; retrieve the default device type from the default config value ; retrieve the default device type from the default config value
proc defcfg_type stdcall, node:dword proc defcfg_type stdcall, node:dword
push edx push edx
mov edx, [node] mov edx, [node]
@ -93,7 +92,6 @@ proc defcfg_color stdcall, node:dword
ret ret
endp endp
; destructor ; destructor
proc snd_hda_generic_free proc snd_hda_generic_free
push eax ebx edx edi push eax ebx edx edi
@ -103,7 +101,7 @@ proc snd_hda_generic_free
jz .out jz .out
mov edx, [ebx + HDA_GNODE.next] ;edx = 2nd node address mov edx, [ebx + HDA_GNODE.next] ;edx = 2nd node address
.next: .next:
test edx, edx test edx, edx
jz .free_head jz .free_head
@ -112,22 +110,22 @@ proc snd_hda_generic_free
cmp eax, edi cmp eax, edi
je @f je @f
pusha pusha
call Kfree ;free conn_list invoke Kfree ;free conn_list
popa popa
@@: @@:
mov eax, edx mov eax, edx
mov edx, [edx + HDA_GNODE.next] mov edx, [edx + HDA_GNODE.next]
pusha pusha
call Kfree ;free node invoke Kfree ;free node
popa popa
jmp .next jmp .next
.free_head: .free_head:
mov eax, [spec.nid_list] mov eax, [spec.nid_list]
pusha pusha
call Kfree ;free the very 1st node in the list invoke Kfree ;free the very 1st node in the list
popa popa
mov [spec.nid_list], 0 mov [spec.nid_list], 0
.out: .out:
pop edi edx ebx eax pop edi edx ebx eax
ret ret
endp endp
@ -138,7 +136,7 @@ proc add_new_node stdcall, nid:dword
push ebx ecx edx edi esi push ebx ecx edx edi esi
mov eax, HDA_GNODE.sizeof mov eax, HDA_GNODE.sizeof
call Kmalloc invoke Kmalloc
test eax, eax test eax, eax
jz .err_out ; Not enough memory jz .err_out ; Not enough memory
@ -160,7 +158,7 @@ proc add_new_node stdcall, nid:dword
mov eax, HDA_MAX_CONNECTIONS*2 ;HDA_MAX_CONNECTIONS * sizeof(word) mov eax, HDA_MAX_CONNECTIONS*2 ;HDA_MAX_CONNECTIONS * sizeof(word)
push ebx ecx edx push ebx ecx edx
call Kmalloc ;malloc temporary conn_list invoke Kmalloc ;malloc temporary conn_list
pop edx ecx ebx pop edx ecx ebx
mov edi, eax mov edi, eax
@ -174,25 +172,25 @@ proc add_new_node stdcall, nid:dword
mov eax, edx mov eax, edx
pusha pusha
call Kfree ;free node invoke Kfree ;free node
popa popa
mov eax, ecx mov eax, ecx
jmp .out jmp .out
.no_conn_list: .no_conn_list:
xor ecx, ecx xor ecx, ecx
@@: @@:
cmp ecx, 2 ;nconns <= ARRAY_SIZE(node->slist) ? cmp ecx, 2 ;nconns <= ARRAY_SIZE(node->slist) ?
jg @f jg @f
lea eax, [edx + HDA_GNODE.slist] lea eax, [edx + HDA_GNODE.slist]
mov [edx + HDA_GNODE.conn_list], eax mov [edx + HDA_GNODE.conn_list], eax
jmp .set_conn_list jmp .set_conn_list
@@: @@:
mov eax, ecx mov eax, ecx
shl ecx, 1 shl ecx, 1
push ebx ecx edx edi push ebx ecx edx edi
call Kmalloc ;malloc conn_list invoke Kmalloc ;malloc conn_list
pop edi edx ecx ebx pop edi edx ecx ebx
shr ecx, 1 shr ecx, 1
test eax, eax test eax, eax
@ -200,12 +198,12 @@ proc add_new_node stdcall, nid:dword
mov eax, edi mov eax, edi
pusha pusha
call Kfree ;free temporary conn_list invoke Kfree ;free temporary conn_list
popa popa
jmp .err_out jmp .err_out
@@: @@:
mov [edx + HDA_GNODE.conn_list], eax mov [edx + HDA_GNODE.conn_list], eax
.set_conn_list: .set_conn_list:
mov [edx + HDA_GNODE.nconns], cx mov [edx + HDA_GNODE.nconns], cx
push edi push edi
mov esi, edi mov esi, edi
@ -229,7 +227,7 @@ proc add_new_node stdcall, nid:dword
mov byte [edx + HDA_GNODE.pin_ctl], al mov byte [edx + HDA_GNODE.pin_ctl], al
stdcall snd_hda_codec_get_pincfg, [nid] stdcall snd_hda_codec_get_pincfg, [nid]
mov [edx + HDA_GNODE.def_cfg], eax mov [edx + HDA_GNODE.def_cfg], eax
@@: @@:
xor eax, eax xor eax, eax
test ebx, AC_WCAP_OUT_AMP test ebx, AC_WCAP_OUT_AMP
@ -237,13 +235,13 @@ proc add_new_node stdcall, nid:dword
test ebx, AC_WCAP_AMP_OVRD test ebx, AC_WCAP_AMP_OVRD
jz @f jz @f
snd_hda_param_read [nid], AC_PAR_AMP_OUT_CAP snd_hda_param_read [nid], AC_PAR_AMP_OUT_CAP
@@: @@:
test eax, eax test eax, eax
jnz @f jnz @f
mov eax, [spec.def_amp_out_caps] mov eax, [spec.def_amp_out_caps]
@@: @@:
mov [edx + HDA_GNODE.amp_out_caps], eax mov [edx + HDA_GNODE.amp_out_caps], eax
.no_out_amp: .no_out_amp:
;;Asper+: Beeper [ ;;Asper+: Beeper [
; pusha ; pusha
@ -258,30 +256,30 @@ proc add_new_node stdcall, nid:dword
; jz .no_beeper_amp ; jz .no_beeper_amp
; ;set beep amplifier here ; ;set beep amplifier here
; stdcall unmute_output, edx ; stdcall unmute_output, edx
; .no_beeper_amp: ;.no_beeper_amp:
; ;try to beep here ; ;try to beep here
; stdcall snd_hda_codec_read, [nid], 0, AC_VERB_GET_BEEP_CONTROL, 0 ;eax ; stdcall snd_hda_codec_read, [nid], 0, AC_VERB_GET_BEEP_CONTROL, 0 ;eax
; if DEBUG ;if DEBUG
; push eax esi ; push eax esi
; mov esi, msgBeeperNid ; mov esi, msgBeeperNid
; call SysMsgBoardStr ; invoke SysMsgBoardStr
; push eax ; push eax
; mov eax, [nid] ; mov eax, [nid]
; stdcall fdword2str, 2 ; stdcall fdword2str, 2
; call SysMsgBoardStr ; invoke SysMsgBoardStr
; ;
; mov esi, msgBeeperValue ; mov esi, msgBeeperValue
; call SysMsgBoardStr ; invoke SysMsgBoardStr
; pop eax ; pop eax
; stdcall fdword2str, 2 ; stdcall fdword2str, 2
; call SysMsgBoardStr ; invoke SysMsgBoardStr
; ;
; mov esi, msgBeepNow ; mov esi, msgBeepNow
; call SysMsgBoardStr ; invoke SysMsgBoardStr
; pop esi eax ; pop esi eax
; end if ;end if
; mov ecx, 256*1 ; mov ecx, 256*1
; .next_tone: ;.next_tone:
; dec ecx ; dec ecx
; movzx ebx, [esi + HDA_GNODE.nid] ; movzx ebx, [esi + HDA_GNODE.nid]
; stdcall snd_hda_codec_write, [nid], 0, AC_VERB_SET_BEEP_CONTROL, ecx ; stdcall snd_hda_codec_write, [nid], 0, AC_VERB_SET_BEEP_CONTROL, ecx
@ -289,17 +287,17 @@ proc add_new_node stdcall, nid:dword
; ;stdcall StallExec ; ;stdcall StallExec
; test ecx, ecx ; test ecx, ecx
; jnz .next_tone ; jnz .next_tone
; .end_beep: ;.end_beep:
; stdcall snd_hda_codec_read, [nid], 0, AC_VERB_GET_BEEP_CONTROL, 0 ;eax ; stdcall snd_hda_codec_read, [nid], 0, AC_VERB_GET_BEEP_CONTROL, 0 ;eax
; if DEBUG ;if DEBUG
; ;push eax esi ; ;push eax esi
; mov esi, msgBeeperValue ; mov esi, msgBeeperValue
; call SysMsgBoardStr ; invoke SysMsgBoardStr
; stdcall fdword2str, 2 ; stdcall fdword2str, 2
; call SysMsgBoardStr ; invoke SysMsgBoardStr
; ;pop esi eax ; ;pop esi eax
; end if ;end if
; .not_beeper: ;.not_beeper:
; popa ; popa
;;Asper+: Beeper ] ;;Asper+: Beeper ]
@ -309,26 +307,26 @@ proc add_new_node stdcall, nid:dword
test ebx, AC_WCAP_AMP_OVRD test ebx, AC_WCAP_AMP_OVRD
jz @f jz @f
snd_hda_param_read [nid], AC_PAR_AMP_IN_CAP snd_hda_param_read [nid], AC_PAR_AMP_IN_CAP
@@: @@:
test eax, eax test eax, eax
jnz @f jnz @f
mov eax, [spec.def_amp_in_caps] mov eax, [spec.def_amp_in_caps]
@@: @@:
mov [edx + HDA_GNODE.amp_in_caps], eax mov [edx + HDA_GNODE.amp_in_caps], eax
.no_in_amp: .no_in_amp:
mov esi, [spec.nid_list] mov esi, [spec.nid_list]
test esi, esi test esi, esi
jnz @f jnz @f
mov [spec.nid_list], edx mov [spec.nid_list], edx
jmp .out jmp .out
@@: @@:
;Asper+: Sort pins by DA:Sequence during tree building [ ;Asper+: Sort pins by DA:Sequence during tree building [
mov ecx, esi mov ecx, esi
movzx ebx, byte [edx + HDA_GNODE.def_cfg] movzx ebx, byte [edx + HDA_GNODE.def_cfg]
push edi push edi
.next_node: .next_node:
cmp [esi + HDA_GNODE.type], AC_WID_PIN cmp [esi + HDA_GNODE.type], AC_WID_PIN
jne @f jne @f
cmp [edx + HDA_GNODE.type], AC_WID_PIN cmp [edx + HDA_GNODE.type], AC_WID_PIN
@ -338,45 +336,45 @@ proc add_new_node stdcall, nid:dword
cmp [edi + HDA_GNODE.type], AC_WID_PIN cmp [edi + HDA_GNODE.type], AC_WID_PIN
jne .not_pin jne .not_pin
mov [edx + HDA_GNODE.next], edi mov [edx + HDA_GNODE.next], edi
.head: ;CleverMouse+ .head: ;CleverMouse+
mov [spec.nid_list], edx mov [spec.nid_list], edx
pop edi pop edi
jmp .out jmp .out
.pin: .pin:
movzx edi, byte [esi + HDA_GNODE.def_cfg] movzx edi, byte [esi + HDA_GNODE.def_cfg]
cmp edi, ebx cmp edi, ebx
jle @f jle @f
.not_pin: .not_pin:
mov [edx + HDA_GNODE.next], esi mov [edx + HDA_GNODE.next], esi
cmp esi, [spec.nid_list] ;CleverMouse+ cmp esi, [spec.nid_list] ;CleverMouse+
jz .head ;CleverMouse+ jz .head ;CleverMouse+
mov esi, ecx mov esi, ecx
jmp .insert jmp .insert
@@: @@:
mov eax, [esi + HDA_GNODE.next] mov eax, [esi + HDA_GNODE.next]
test eax, eax test eax, eax
jz .insert jz .insert
mov ecx, esi mov ecx, esi
mov esi, eax mov esi, eax
jmp .next_node jmp .next_node
.insert: .insert:
mov [esi + HDA_GNODE.next], edx mov [esi + HDA_GNODE.next], edx
pop edi pop edi
;Asper+ ] ;Asper+ ]
.out: .out:
mov eax, edi mov eax, edi
pusha pusha
call Kfree ;free temporary conn_list invoke Kfree ;free temporary conn_list
popa popa
xor eax, eax xor eax, eax
pop esi edi edx ecx ebx pop esi edi edx ecx ebx
ret ret
.err_out: .err_out:
mov eax, edx mov eax, edx
pusha pusha
call Kfree ;free node invoke Kfree ;free node
popa popa
xor eax, eax xor eax, eax
dec eax dec eax
@ -407,20 +405,20 @@ proc build_afg_tree
jz @f jz @f
cmp ecx, 0 cmp ecx, 0
jge .nid_ok jge .nid_ok
@@: @@:
if FDEBUG if FDEBUG
push esi push esi
mov esi, emsgInvalidAFGSubtree mov esi, emsgInvalidAFGSubtree
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi pop esi
end if end if
xor eax, eax xor eax, eax
dec eax dec eax
jmp .out jmp .out
.nid_ok: .nid_ok:
; parse all nodes belonging to the AFG ; parse all nodes belonging to the AFG
.next_node: .next_node:
test ecx, ecx test ecx, ecx
jz .build_done jz .build_done
@ -430,13 +428,40 @@ proc build_afg_tree
inc edx inc edx
dec ecx dec ecx
jmp .next_node jmp .next_node
.build_done: .build_done:
xor eax, eax xor eax, eax
.out: .out:
pop edx ecx ebx pop edx ecx ebx
ret ret
endp endp
;Asper+[
proc print_afg_tree_nodes
push eax esi edi
mov esi, msgNodeSeq
invoke SysMsgBoardStr
mov edi, [spec.nid_list]
test edi, edi
jz .out
.next_node:
movzx eax, word [edi + HDA_GNODE.nid]
mov esi, msgNID
invoke SysMsgBoardStr
stdcall fdword2str, 3
invoke SysMsgBoardStr
mov eax, [edi + HDA_GNODE.next]
test eax, eax
jz .out
mov edi, eax
jmp .next_node
.out:
pop edi esi eax
ret
endp
;Asper+]
; look for the node record for the given NID ; look for the node record for the given NID
proc hda_get_node stdcall, nid:dword proc hda_get_node stdcall, nid:dword
@ -446,7 +471,7 @@ proc hda_get_node stdcall, nid:dword
test esi, esi test esi, esi
jz .out jz .out
.next_node: .next_node:
mov edx, [esi + HDA_GNODE.next] mov edx, [esi + HDA_GNODE.next]
test edx, edx ;Asper+ test edx, edx ;Asper+
jz .not_found ;Asper+ jz .not_found ;Asper+
@ -456,9 +481,9 @@ proc hda_get_node stdcall, nid:dword
mov esi, edx mov esi, edx
jmp .next_node jmp .next_node
.not_found: ;Asper+ .not_found: ;Asper+
xor esi, esi xor esi, esi
.out: .out:
mov eax, esi mov eax, esi
pop esi edx ebx pop esi edx ebx
ret ret
@ -477,16 +502,16 @@ proc set_eapd stdcall, node:dword ;nid:dword, on:dword
;or eax, AC_EAPDBTL_EAPD ;or eax, AC_EAPDBTL_EAPD
movzx ebx, [esi + HDA_GNODE.nid] movzx ebx, [esi + HDA_GNODE.nid]
stdcall snd_hda_codec_write, ebx, 0, AC_VERB_SET_EAPD_BTLENABLE, AC_EAPDBTL_EAPD ;eax stdcall snd_hda_codec_write, ebx, 0, AC_VERB_SET_EAPD_BTLENABLE, AC_EAPDBTL_EAPD ;eax
if DEBUG if DEBUG
push eax esi push eax esi
mov esi, msgEnableEAPD mov esi, msgEnableEAPD
call SysMsgBoardStr invoke SysMsgBoardStr
mov eax, ebx mov eax, ebx
stdcall fdword2str, 3 stdcall fdword2str, 3
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi eax pop esi eax
end if end if
.out: .out:
pop esi ebx eax pop esi ebx eax
ret ret
endp endp
@ -494,20 +519,19 @@ endp
; unmute (and set max vol) the output amplifier ; unmute (and set max vol) the output amplifier
proc unmute_output stdcall, node:dword proc unmute_output stdcall, node:dword
push ebx ecx edx esi push ebx ecx edx esi
mov esi, [node] mov esi, [node]
test [esi + HDA_GNODE.wid_caps], AC_WCAP_OUT_AMP test [esi + HDA_GNODE.wid_caps], AC_WCAP_OUT_AMP
jz .out jz .out
movzx eax, word [esi + HDA_GNODE.nid] movzx eax, word [esi + HDA_GNODE.nid]
if DEBUG if DEBUG
push esi push esi
mov esi, msgUnmuteOut mov esi, msgUnmuteOut
call SysMsgBoardStr invoke SysMsgBoardStr
stdcall fdword2str, 3 stdcall fdword2str, 3
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi pop esi
end if end if
stdcall set_eapd, esi ;Asper+: set EAPD if exist stdcall set_eapd, esi ;Asper+: set EAPD if exist
@ -525,31 +549,27 @@ proc unmute_output stdcall, node:dword
test al, al test al, al
jz .out jz .out
if DEBUG if DEBUG
push eax esi push eax esi
mov esi, msgAmpVal mov esi, msgAmpVal
call SysMsgBoardStr invoke SysMsgBoardStr
stdcall fdword2str, 1 stdcall fdword2str, 1
call SysMsgBoardStr invoke SysMsgBoardStr
mov esi, strSemicolon mov esi, strSemicolon
call SysMsgBoardStr invoke SysMsgBoardStr
mov eax, ecx mov eax, ecx
stdcall fdword2str, 3 stdcall fdword2str, 3
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi eax pop esi eax
end if end if
mov [volume.out_amp_node], esi mov [volume.out_amp_node], esi
inc al
mov [volume.num_steps], al mov [volume.num_steps], al
inc cl
mov [volume.step_size], cl mov [volume.step_size], cl
mul cl mul cl
shr eax, 2 imul eax, (100/4)
imul eax, 100
mov [volume.maxDb], eax mov [volume.maxDb], eax
.out:
.out:
xor eax, eax xor eax, eax
pop esi edx ecx ebx pop esi edx ecx ebx
ret ret
@ -563,19 +583,19 @@ proc unmute_input stdcall, node:dword, index:dword
and [index], 0xF ;Asper+ : Ranger and [index], 0xF ;Asper+ : Ranger
mov esi, [node] mov esi, [node]
movzx eax, word [esi + HDA_GNODE.nid] movzx eax, word [esi + HDA_GNODE.nid]
if DEBUG if DEBUG
push eax esi push eax esi
mov esi, msgUnmuteIn mov esi, msgUnmuteIn
call SysMsgBoardStr invoke SysMsgBoardStr
stdcall fdword2str, 3 stdcall fdword2str, 3
call SysMsgBoardStr invoke SysMsgBoardStr
mov esi, msgIdx mov esi, msgIdx
call SysMsgBoardStr invoke SysMsgBoardStr
mov eax, [index] mov eax, [index]
stdcall fdword2str, 3 stdcall fdword2str, 3
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi eax pop esi eax
end if end if
mov edx, [esi + HDA_GNODE.amp_in_caps] mov edx, [esi + HDA_GNODE.amp_in_caps]
mov ecx, edx mov ecx, edx
@ -584,7 +604,7 @@ proc unmute_input stdcall, node:dword, index:dword
shr edx, AC_AMPCAP_NUM_STEPS_SHIFT shr edx, AC_AMPCAP_NUM_STEPS_SHIFT
stdcall snd_hda_codec_amp_stereo, eax, HDA_INPUT, [index], 0xFF, edx stdcall snd_hda_codec_amp_stereo, eax, HDA_INPUT, [index], 0xFF, edx
.out: .out:
xor eax, eax xor eax, eax
pop esi edx ecx pop esi edx ecx
ret ret
@ -597,20 +617,20 @@ proc select_input_connection stdcall, node:dword, index:dword
mov esi, [node] mov esi, [node]
movzx eax, word [esi + HDA_GNODE.nid] movzx eax, word [esi + HDA_GNODE.nid]
mov ebx, [index] mov ebx, [index]
if DEBUG if DEBUG
mov esi, msgConnect mov esi, msgConnect
call SysMsgBoardStr invoke SysMsgBoardStr
stdcall fdword2str, 3 stdcall fdword2str, 3
call SysMsgBoardStr invoke SysMsgBoardStr
mov esi, msgIdx mov esi, msgIdx
call SysMsgBoardStr invoke SysMsgBoardStr
push eax push eax
mov eax, ebx mov eax, ebx
stdcall fdword2str, 3 stdcall fdword2str, 3
call SysMsgBoardStr invoke SysMsgBoardStr
pop eax pop eax
end if end if
stdcall snd_hda_codec_write, eax, 0, AC_VERB_SET_CONNECT_SEL, ebx stdcall snd_hda_codec_write, eax, 0, AC_VERB_SET_CONNECT_SEL, ebx
pop esi ebx pop esi ebx
ret ret
@ -623,15 +643,14 @@ proc clear_check_flags
mov esi, [spec.nid_list] mov esi, [spec.nid_list]
test esi, esi test esi, esi
jz .out jz .out
.next_node: .next_node:
mov byte [esi + HDA_GNODE.checked], 0 mov byte [esi + HDA_GNODE.checked], 0
mov eax, [esi + HDA_GNODE.next] mov eax, [esi + HDA_GNODE.next]
test eax, eax test eax, eax
jz .out jz .out
mov esi, eax mov esi, eax
jmp .next_node jmp .next_node
.out:
.out:
pop esi eax pop esi eax
ret ret
endp endp
@ -658,24 +677,24 @@ proc parse_output_path stdcall, node:dword, dac_idx:dword
mov ebx, [esi + HDA_GNODE.wid_caps] mov ebx, [esi + HDA_GNODE.wid_caps]
test ebx, AC_WCAP_DIGITAL test ebx, AC_WCAP_DIGITAL
jz @f jz @f
if DEBUG if DEBUG
push esi push esi
mov esi, msgSkipDigitalOutNode mov esi, msgSkipDigitalOutNode
call SysMsgBoardStr invoke SysMsgBoardStr
stdcall fdword2str, 3 stdcall fdword2str, 3
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi pop esi
end if end if
jmp .ret_zero jmp .ret_zero
@@: @@:
if DEBUG if DEBUG
push eax esi push eax esi
mov esi, msgAudOutFound mov esi, msgAudOutFound
call SysMsgBoardStr invoke SysMsgBoardStr
stdcall fdword2str, 3 stdcall fdword2str, 3
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi eax pop esi eax
end if end if
push eax push eax
stdcall unmute_output, esi ;Asper+ stdcall unmute_output, esi ;Asper+
@ -691,18 +710,18 @@ proc parse_output_path stdcall, node:dword, dac_idx:dword
cmp eax, [node] cmp eax, [node]
je .ret_one je .ret_one
jmp .ret_zero jmp .ret_zero
@@: @@:
mov ecx, [dac_idx] mov ecx, [dac_idx]
shl ecx, 2 shl ecx, 2
mov [spec.dac_node+ecx], eax mov [spec.dac_node+ecx], eax
jmp .ret_one ;found jmp .ret_one ;found
.not_wid_aud_out: .not_wid_aud_out:
movzx ebx, [esi + HDA_GNODE.nconns] movzx ebx, [esi + HDA_GNODE.nconns]
xor ecx, ecx xor ecx, ecx
mov edx, [esi + HDA_GNODE.conn_list] mov edx, [esi + HDA_GNODE.conn_list]
test ebx, ebx test ebx, ebx
jz .ret_zero jz .ret_zero
.next_node: .next_node:
stdcall hda_get_node, [edx] stdcall hda_get_node, [edx]
test eax, eax test eax, eax
jz .continue jz .continue
@ -712,24 +731,24 @@ proc parse_output_path stdcall, node:dword, dac_idx:dword
cmp [esi + HDA_GNODE.nconns], 1 cmp [esi + HDA_GNODE.nconns], 1
jle @f jle @f
stdcall select_input_connection, esi, ecx stdcall select_input_connection, esi, ecx
@@: @@:
;UNSUPPORTED YET! stdcall unmute_input, esi, ecx ;UNSUPPORTED YET! stdcall unmute_input, esi, ecx
stdcall unmute_output, esi stdcall unmute_output, esi
jmp .ret_one jmp .ret_one
.continue: .continue:
add edx, 2 add edx, 2
inc ecx inc ecx
cmp ecx, ebx cmp ecx, ebx
jl .next_node jl .next_node
.ret_zero: .ret_zero:
xor eax, eax xor eax, eax
pop esi edx ecx ebx pop esi edx ecx ebx
ret ret
.ret_one: .ret_one:
xor eax, eax xor eax, eax
inc eax inc eax
.ret: ;Asper+ .ret: ;Asper+
pop esi edx ecx ebx pop esi edx ecx ebx
ret ret
endp endp
@ -744,7 +763,7 @@ proc parse_output_jack stdcall, jack_type:dword
mov esi, [spec.nid_list] mov esi, [spec.nid_list]
test esi, esi test esi, esi
jz .ret_zero jz .ret_zero
.next_pin: .next_pin:
cmp [esi + HDA_GNODE.type], AC_WID_PIN cmp [esi + HDA_GNODE.type], AC_WID_PIN
jne .continue jne .continue
@ -767,13 +786,17 @@ proc parse_output_jack stdcall, jack_type:dword
test [esi + HDA_GNODE.wid_caps], AC_WCAP_DIGITAL test [esi + HDA_GNODE.wid_caps], AC_WCAP_DIGITAL
jnz .continue ; skip SPDIF jnz .continue ; skip SPDIF
@@: @@:
; output as default? push eax
movzx eax, [esi + HDA_GNODE.nid]
stdcall snd_hda_enable_pin_sense, eax, eax ;Asper+: enable unsolicited events for the output pin
pop eax
if DEBUG if DEBUG
pusha pusha
; push esi ; push esi
; mov esi, msgPin_Nid ; mov esi, msgPin_Nid
; call SysMsgBoardStr ; invoke SysMsgBoardStr
; pop esi ; pop esi
movzx eax, [esi + HDA_GNODE.nid] movzx eax, [esi + HDA_GNODE.nid]
movzx ebx, [esi + HDA_GNODE.pin_ctl] movzx ebx, [esi + HDA_GNODE.pin_ctl]
@ -781,38 +804,42 @@ if DEBUG
mov edx, [esi + HDA_GNODE.def_cfg] mov edx, [esi + HDA_GNODE.def_cfg]
mov edi, [esi + HDA_GNODE.amp_out_caps] mov edi, [esi + HDA_GNODE.amp_out_caps]
mov esi, msgPin_Nid mov esi, msgPin_Nid
call SysMsgBoardStr invoke SysMsgBoardStr
stdcall fdword2str, 3 stdcall fdword2str, 3
call SysMsgBoardStr invoke SysMsgBoardStr
mov esi, msgPin_Ctl mov esi, msgPin_Ctl
call SysMsgBoardStr invoke SysMsgBoardStr
mov eax, ebx mov eax, ebx
stdcall fdword2str, 2 stdcall fdword2str, 2
call SysMsgBoardStr invoke SysMsgBoardStr
mov esi, msgPin_Caps mov esi, msgPin_Caps
call SysMsgBoardStr invoke SysMsgBoardStr
mov eax, ecx mov eax, ecx
stdcall fdword2str, 2 stdcall fdword2str, 2
call SysMsgBoardStr invoke SysMsgBoardStr
mov esi, msgDef_Cfg mov esi, msgDef_Cfg
call SysMsgBoardStr invoke SysMsgBoardStr
mov eax, edx mov eax, edx
stdcall fdword2str, 2 stdcall fdword2str, 2
call SysMsgBoardStr invoke SysMsgBoardStr
mov esi, msgAmp_Out_Caps mov esi, msgAmp_Out_Caps
call SysMsgBoardStr invoke SysMsgBoardStr
mov eax, edi mov eax, edi
stdcall fdword2str, 2 stdcall fdword2str, 2
call SysMsgBoardStr invoke SysMsgBoardStr
popa popa
end if end if
; output as default?
; test [esi + HDA_GNODE.pin_ctl], AC_PINCTL_OUT_EN ; test [esi + HDA_GNODE.pin_ctl], AC_PINCTL_OUT_EN
; jz .continue ; jz .continue
.use_dac0:
cmp [spec.dac_node], 0
jne .use_dac1
stdcall clear_check_flags stdcall clear_check_flags
stdcall parse_output_path, esi, 0 stdcall parse_output_path, esi, 0
@ -821,9 +848,10 @@ end if
mov edx, [spec.out_pin_node] mov edx, [spec.out_pin_node]
test edx, edx test edx, edx
jz @f jz @f
.use_dac1:
stdcall clear_check_flags stdcall clear_check_flags
stdcall parse_output_path, esi, 1 stdcall parse_output_path, esi, 1
@@: @@:
cmp eax, 0 cmp eax, 0
jle .l1 jle .l1
@ -834,22 +862,22 @@ end if
test [esi + HDA_GNODE.pin_caps], AC_PINCAP_HP_DRV test [esi + HDA_GNODE.pin_caps], AC_PINCAP_HP_DRV
jz @f jz @f
mov edx, AC_PINCTL_HP_EN mov edx, AC_PINCTL_HP_EN
@@: @@:
or edx, AC_PINCTL_OUT_EN or edx, AC_PINCTL_OUT_EN
movzx eax, [esi + HDA_GNODE.nid] movzx eax, [esi + HDA_GNODE.nid]
stdcall snd_hda_codec_write, eax, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, edx stdcall snd_hda_codec_write, eax, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, edx
mov eax, esi mov eax, esi
jmp .out jmp .out
.l1: .l1:
.continue: .continue:
mov edx, [esi + HDA_GNODE.next] mov edx, [esi + HDA_GNODE.next]
test edx, edx test edx, edx
jz .ret_zero jz .ret_zero
mov esi, edx mov esi, edx
jmp .next_pin jmp .next_pin
.ret_zero: .ret_zero:
xor eax, eax xor eax, eax
.out: .out:
pop esi edx pop esi edx
ret ret
endp endp
@ -866,13 +894,13 @@ proc parse_output
jz @f jz @f
mov [spec.out_pin_node], eax ; found, remember the PIN node mov [spec.out_pin_node], eax ; found, remember the PIN node
jmp .l1 jmp .l1
@@: @@:
; if no line-out is found, try speaker out ; if no line-out is found, try speaker out
stdcall parse_output_jack, AC_JACK_SPEAKER stdcall parse_output_jack, AC_JACK_SPEAKER
test eax, eax test eax, eax
jz .l1 jz .l1
mov [spec.out_pin_node], eax ; found, remember the PIN node mov [spec.out_pin_node], eax ; found, remember the PIN node
.l1: .l1:
; look for the HP-out pin ; look for the HP-out pin
stdcall parse_output_jack, AC_JACK_HP_OUT stdcall parse_output_jack, AC_JACK_HP_OUT
test eax, eax test eax, eax
@ -883,9 +911,9 @@ proc parse_output
jnz @f jnz @f
mov [spec.out_pin_node], eax mov [spec.out_pin_node], eax
jmp .l2 jmp .l2
@@: @@:
mov [spec.out_pin_node+4], eax mov [spec.out_pin_node+4], eax
.l2: .l2:
mov edx, [spec.out_pin_node] mov edx, [spec.out_pin_node]
test edx, edx test edx, edx
jnz @f jnz @f
@ -896,13 +924,13 @@ proc parse_output
mov [spec.out_pin_node], eax mov [spec.out_pin_node], eax
test eax, eax test eax, eax
jnz @f jnz @f
if DEBUG if DEBUG
push esi push esi
mov esi, emsgNoProperOutputPathFound mov esi, emsgNoProperOutputPathFound
call SysMsgBoardStr invoke SysMsgBoardStr
pop esi pop esi
end if end if
@@: @@:
pop edx pop edx
xor eax, eax xor eax, eax
ret ret
@ -921,11 +949,15 @@ proc snd_hda_parse_generic_codec
cmp eax, 0 cmp eax, 0
jl .error jl .error
if FDEBUG
stdcall print_afg_tree_nodes ;Asper+
end if
stdcall parse_output stdcall parse_output
xor eax, eax xor eax, eax
.out: .out:
ret ret
.error: .error:
stdcall snd_hda_generic_free stdcall snd_hda_generic_free
ret ret
endp endp

File diff suppressed because it is too large Load Diff