diff --git a/data/common/Makefile.main b/data/common/Makefile.main index cd6df29327..6d79e33113 100644 --- a/data/common/Makefile.main +++ b/data/common/Makefile.main @@ -131,7 +131,6 @@ FASM_PROGRAMS:=\ drivers/emu10k1x.obj:DRIVERS/EMU10K1X.OBJ:$(KERNEL)/drivers/emu10k1x.asm \ drivers/fm801.obj:DRIVERS/FM801.OBJ:$(KERNEL)/drivers/fm801.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/sound.obj:DRIVERS/SOUND.OBJ:$(KERNEL)/drivers/sound.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/ps2mouse.sys:DRIVERS/PS2MOUSE.SYS:$(REPOSITORY)/drivers/mouse/ps2mouse4d/trunk/ps2mouse.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 # 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. @@ -876,4 +876,4 @@ $(REPOSITORY)/drivers/ddk/libddk.a: \ $(REPOSITORY)/drivers/include/*/*/*.h \ $(REPOSITORY)/drivers/include/*/*/*/*.h $(REPOSITORY)/drivers/ddk/libcore.a: \ - $(REPOSITORY)/drivers/ddk/core.S \ No newline at end of file + $(REPOSITORY)/drivers/ddk/core.S diff --git a/drivers/audio/intel_hda/CODEC.INC b/drivers/audio/intel_hda/CODEC.INC index 3e8f474ed0..a2917af30c 100644 --- a/drivers/audio/intel_hda/CODEC.INC +++ b/drivers/audio/intel_hda/CODEC.INC @@ -1,108 +1,107 @@ ;; Compose a 32bit command word to be sent to the HD-audio controller proc make_codec_cmd stdcall, nid:dword, direct:dword, verb:dword, parm:dword - push ebx + push ebx - and dword [codec.addr], 0xF - and dword [direct], 1 - and dword [nid], 0x7F - and dword [verb], 0xFFF - and dword [parm], 0xFFFF + and dword [codec.addr], 0xF + and dword [direct], 1 + and dword [nid], 0x7F + and dword [verb], 0xFFF + and dword [parm], 0xFFFF - mov eax, [codec.addr] - shl eax, 28 - mov ebx, [direct] - shl ebx, 27 - or eax, ebx - mov ebx, [nid] - shl ebx, 20 - or eax, ebx - mov ebx, [verb] - shl ebx, 8 - or eax, ebx - mov ebx, [parm] - or eax, ebx - pop ebx - ret - .err: - pop ebx - mov eax, -1 - ret + mov eax, [codec.addr] + shl eax, 28 + mov ebx, [direct] + shl ebx, 27 + or eax, ebx + mov ebx, [nid] + shl ebx, 20 + or eax, ebx + mov ebx, [verb] + shl ebx, 8 + or eax, ebx + mov ebx, [parm] + or eax, ebx + pop ebx + ret +.err: + pop ebx + mov eax, -1 + ret endp ;; Send and receive a verb -proc codec_exec_verb stdcall, cmd:dword;, res:dword <- returned in eax - push ebx edx - mov ebx, [cmd] - cmp ebx, -1 - jne @f - pop edx ebx - mov eax, -1 - ret - @@: - if FDEBUG ;YAHOO - push eax esi - mov esi, msgVerbQuery - call SysMsgBoardStr - mov eax, ebx - stdcall fdword2str, 2 - call SysMsgBoardStr - pop esi eax - end if +proc codec_exec_verb stdcall, cmd:dword;, res:dword <- returned in eax + push ebx edx + mov ebx, [cmd] + cmp ebx, -1 + jne @f + pop edx ebx + mov eax, -1 + ret +@@: +if FDEBUG + push eax esi + mov esi, msgVerbQuery + invoke SysMsgBoardStr + mov eax, ebx + stdcall fdword2str, 2 + invoke SysMsgBoardStr + pop esi eax +end if - mov edx, -1 - .again: - ; call snd_hda_power_up - stdcall azx_send_cmd, ebx - mov ebx, eax - test ebx, ebx - jnz @f - call azx_get_response - mov edx, eax - if FDEBUG - test edx, edx - jz .end_debug - push eax esi - mov esi, msgVerbAnswer - call SysMsgBoardStr - mov eax, edx - stdcall fdword2str, 2 - call SysMsgBoardStr - pop esi eax - .end_debug: - end if + mov edx, -1 +.again: + ;call snd_hda_power_up + stdcall azx_send_cmd, ebx + mov ebx, eax + test ebx, ebx + jnz @f + call azx_get_response + mov edx, eax +if FDEBUG + test edx, edx + jz .end_debug + push eax esi + mov esi, msgVerbAnswer + invoke SysMsgBoardStr + mov eax, edx + stdcall fdword2str, 2 + invoke SysMsgBoardStr + pop esi eax +.end_debug: +end if - @@: +@@: + ;call snd_hda_power_down + cmp edx, -1 + jne .l1 - ;call snd_hda_power_down - cmp edx, -1 - jne .l1 + mov eax, [ctrl.rirb_error] + test eax, eax + jz .l1 - mov eax, [ctrl.rirb_error] - test eax, eax - jz .l1 + mov eax, [ctrl.response_reset] + jz @f - mov eax, [ctrl.response_reset] - jz @f +if DEBUG + push esi + mov esi, emsgBusResetFatalComm + invoke SysMsgBoardStr + pop esi +end if + call azx_bus_reset +@@: +.l1: + ;; clear reset-flag when the communication gets recovered + test ebx, ebx + jnz @f + mov [ctrl.response_reset], 0 +@@: + mov eax, edx - if DEBUG - push esi - mov esi, emsgBusResetFatalComm - call SysMsgBoardStr - pop esi - end if - call azx_bus_reset - @@: - .l1: - ;; clear reset-flag when the communication gets recovered - test ebx, ebx - jnz @f - mov [ctrl.response_reset], 0 - @@: - mov eax, edx - - pop edx ebx - ret + pop edx ebx + ret endp @@ -117,10 +116,10 @@ endp ;; ;; Returns the obtained response value, or -1 for an error. ;; -proc snd_hda_codec_read stdcall, nid:dword, direct:dword, verb:dword, parm:dword - stdcall make_codec_cmd, [nid], [direct], [verb], [parm] - stdcall codec_exec_verb, eax - ret +proc snd_hda_codec_read stdcall, nid:dword, direct:dword, verb:dword, parm:dword + stdcall make_codec_cmd, [nid], [direct], [verb], [parm] + stdcall codec_exec_verb, eax + ret endp @@ -135,11 +134,11 @@ endp ;; ;; Returns 0 if successful, or a negative error code. ;; -proc snd_hda_codec_write stdcall, nid:dword, direct:dword, verb:dword, parm:dword - ; Do we need to support a sync write? - stdcall make_codec_cmd, [nid], [direct], [verb], [parm] - stdcall codec_exec_verb, eax - ret +proc snd_hda_codec_write stdcall, nid:dword, direct:dword, verb:dword, parm:dword + ; Do we need to support a sync write? + stdcall make_codec_cmd, [nid], [direct], [verb], [parm] + stdcall codec_exec_verb, eax + ret endp @@ -150,36 +149,36 @@ endp ;; Send the commands sequentially from the given array. ;; The array must be terminated with NID=0. ;; -proc snd_hda_sequence_write stdcall, seq:dword - 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 - stdcall snd_hda_codec_write, ecx, 0, ebx, eax - add esi, 6 - jmp @b - .out: - pop esi ecx ebx eax - ret +proc snd_hda_sequence_write stdcall, seq:dword + 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 + stdcall snd_hda_codec_write, ecx, 0, ebx, eax + add esi, 6 + jmp @b +.out: + pop esi ecx ebx eax + ret endp -macro snd_hda_param_read nid, param +macro snd_hda_param_read nid, param { - stdcall snd_hda_codec_read, nid, 0, AC_VERB_PARAMETERS, param + stdcall snd_hda_codec_read, nid, 0, AC_VERB_PARAMETERS, param } ;; @@ -191,16 +190,15 @@ macro snd_hda_param_read nid, param ;; Parse the NID and store the start NID of its sub-nodes. ;; Returns the number of sub-nodes. ;; -proc snd_hda_get_sub_nodes stdcall, nid:dword;, start_id:dword <- returned in upper word of eax - snd_hda_param_read [nid], AC_PAR_NODE_COUNT +proc snd_hda_get_sub_nodes stdcall, nid:dword;, start_id:dword <- returned in upper word of eax + snd_hda_param_read [nid], AC_PAR_NODE_COUNT - cmp eax, -1 - jne @f - inc eax - @@: - and eax, 0x7FFF7FFF - - ret + cmp eax, -1 + jne @f + inc eax +@@: + and eax, 0x7FFF7FFF + ret endp ;; @@ -215,259 +213,259 @@ endp ;; ;; 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! - locals - parm dd ? - conn_len dd ? - conns dd 0 - shift db 8 - num_elements dd 4 - mask dd 0x7F - wcaps dd ? - prev_nid dw 1 ;Asper: Hmm.. Probably ALSA bug that it isn't initialized. I suppose to init it with 1. - endl +proc snd_hda_get_connections stdcall, nid:dword, conn_list:dword, max_conns:dword ;Asper: Complete translation! +locals + parm dd ? + conn_len dd ? + conns dd 0 + shift db 8 + num_elements dd 4 + mask dd 0x7F + wcaps dd ? + prev_nid dw 1 ;Asper: Hmm.. Probably ALSA bug that it isn't initialized. I suppose to init it with 1. +endl - push ebx ecx edx edi esi - mov edi, [conn_list] - test edi, edi - jz .err_out - mov ecx, [max_conns] - cmp ecx, 0 - jle .err_out + push ebx ecx edx edi esi + mov edi, [conn_list] + test edi, edi + jz .err_out + mov ecx, [max_conns] + cmp ecx, 0 + jle .err_out - stdcall get_wcaps, [nid] - mov ebx, eax - mov [wcaps], eax - stdcall get_wcaps_type, ebx - cmp eax, AC_WID_VOL_KNB - je .conn_list_ok - test ebx, AC_WCAP_CONN_LIST - jnz .conn_list_ok - if DEBUG - mov esi, emsgConnListNotAvailable - call SysMsgBoardStr - mov eax, [nid] - stdcall fdword2str, 3 - call SysMsgBoardStr - end if - xor eax, eax - dec eax - jmp .out - .conn_list_ok: + stdcall get_wcaps, [nid] + mov ebx, eax + mov [wcaps], eax + stdcall get_wcaps_type, ebx + cmp eax, AC_WID_VOL_KNB + je .conn_list_ok + test ebx, AC_WCAP_CONN_LIST + jnz .conn_list_ok +if DEBUG + mov esi, emsgConnListNotAvailable + invoke SysMsgBoardStr + mov eax, [nid] + stdcall fdword2str, 3 + invoke SysMsgBoardStr +end if + xor eax, eax + dec eax + jmp .out +.conn_list_ok: - snd_hda_param_read [nid], AC_PAR_CONNLIST_LEN - mov [parm], eax + snd_hda_param_read [nid], AC_PAR_CONNLIST_LEN + mov [parm], eax - test eax, AC_CLIST_LONG - jz @f - ; long form - mov [shift], 16 - mov [num_elements], 2 - mov [mask], 0x7FFF ;Asper+ - @@: - and eax, AC_CLIST_LENGTH - test eax, eax - jz .out ; no connection + test eax, AC_CLIST_LONG + jz @f + ; long form + mov [shift], 16 + mov [num_elements], 2 + mov [mask], 0x7FFF ;Asper+ +@@: + and eax, AC_CLIST_LENGTH + test eax, eax + jz .out ; no connection - mov [conn_len], eax - cmp eax, 1 - jne .multi_conns - ; single connection - stdcall snd_hda_codec_read, [nid], 0, AC_VERB_GET_CONNECT_LIST, 0 - mov [parm], eax - cmp [parm], -1 - jne @f - cmp [ctrl.rirb_error], 0 - jne @f - xor eax, eax - dec eax - jmp .out - @@: + mov [conn_len], eax + cmp eax, 1 + jne .multi_conns + ; single connection + stdcall snd_hda_codec_read, [nid], 0, AC_VERB_GET_CONNECT_LIST, 0 + mov [parm], eax + cmp [parm], -1 + jne @f + cmp [ctrl.rirb_error], 0 + jne @f + xor eax, eax + dec eax + jmp .out +@@: - mov eax, [parm] - and eax, [mask] - stosd - xor eax, eax - inc eax - jmp .out - .multi_conns: + mov eax, [parm] + and eax, [mask] + stosd + xor eax, eax + inc eax + jmp .out +.multi_conns: - ; multi connection - xor ecx, ecx - mov edx, [num_elements] - .next_conn: - mov eax, ecx - .mod: - cmp eax, edx - jl .mod_counted - sub eax, edx - jmp .mod - .mod_counted: + ; multi connection + xor ecx, ecx + mov edx, [num_elements] +.next_conn: + mov eax, ecx +.mod: + cmp eax, edx + jl .mod_counted + sub eax, edx + jmp .mod +.mod_counted: - test eax, eax - jnz .l1 - stdcall snd_hda_codec_read, [nid], 0, AC_VERB_GET_CONNECT_LIST, ecx - mov [parm], eax + test eax, eax + jnz .l1 + stdcall snd_hda_codec_read, [nid], 0, AC_VERB_GET_CONNECT_LIST, ecx + mov [parm], eax - cmp eax, -1 - jne .l1 - cmp [ctrl.rirb_error], 0 - jne .err_out - .l1: + cmp eax, -1 + jne .l1 + cmp [ctrl.rirb_error], 0 + jne .err_out +.l1: - mov eax, 1 - push ecx - mov cl, [shift] - dec cl - shl eax, cl - and eax, [parm] - pop ecx - mov ebx, eax ;ranges + mov eax, 1 + push ecx + mov cl, [shift] + dec cl + shl eax, cl + and eax, [parm] + pop ecx + mov ebx, eax ;ranges - mov eax, [parm] - and eax, [mask] ;val + mov eax, [parm] + and eax, [mask] ;val - test eax, eax - jnz @f - if DEBUG - push eax esi - mov esi, emsgInvConnList - call SysMsgBoardStr - mov eax, [nid] - stdcall fdword2str, 1 - call SysMsgBoardStr + test eax, eax + jnz @f +if DEBUG + push eax esi + mov esi, emsgInvConnList + invoke SysMsgBoardStr + mov eax, [nid] + stdcall fdword2str, 1 + invoke SysMsgBoardStr - mov esi, strSemicolon - call SysMsgBoardStr - mov eax, ecx - stdcall fdword2str, 0 - call SysMsgBoardStr + mov esi, strSemicolon + invoke SysMsgBoardStr + mov eax, ecx + stdcall fdword2str, 0 + invoke SysMsgBoardStr - mov esi, strSemicolon - call SysMsgBoardStr - mov eax, [parm] - stdcall fdword2str, 2 - call SysMsgBoardStr - pop esi eax - end if - xor eax, eax - jmp .out - @@: - push ecx - mov cl, [shift] - shr [parm], cl - pop ecx + mov esi, strSemicolon + invoke SysMsgBoardStr + mov eax, [parm] + stdcall fdword2str, 2 + invoke SysMsgBoardStr + pop esi eax +end if + xor eax, eax + jmp .out +@@: + push ecx + mov cl, [shift] + shr [parm], cl + pop ecx - test ebx, ebx - jz .range_zero - ; ranges between the previous and this one - movzx esi, word [prev_nid] - test esi, esi - jz .l2 - cmp esi, eax - jl @f - .l2: - if DEBUG - push eax esi - push esi - mov esi, emsgInvDepRangeVal - call SysMsgBoardStr - pop esi - push eax - mov eax, esi - stdcall fdword2str, 0 - call SysMsgBoardStr + test ebx, ebx + jz .range_zero + ; ranges between the previous and this one + movzx esi, word [prev_nid] + test esi, esi + jz .l2 + cmp esi, eax + jl @f +.l2: +if DEBUG + push eax esi + push esi + mov esi, emsgInvDepRangeVal + invoke SysMsgBoardStr + pop esi + push eax + mov eax, esi + stdcall fdword2str, 0 + invoke SysMsgBoardStr - mov esi, strSemicolon - call SysMsgBoardStr - pop eax - stdcall fdword2str, 2 - call SysMsgBoardStr - pop esi eax - end if - jmp .continue - @@: - push ecx - mov ecx, esi - inc ecx - mov ebx, [conns] - .next_conn2: - cmp ebx, [max_conns] - jl @f - if DEBUG - push esi - mov esi, emsgTooManyConns - call SysMsgBoardStr - pop esi - end if - pop ecx - jmp .err_out - @@: - shl ebx, 1 - push edi - add edi, ebx - mov word [edi], cx - pop edi - shr ebx, 1 - inc ebx - inc ecx - cmp ecx, eax - jle .next_conn2 + mov esi, strSemicolon + invoke SysMsgBoardStr + pop eax + stdcall fdword2str, 2 + invoke SysMsgBoardStr + pop esi eax +end if + jmp .continue +@@: + push ecx + mov ecx, esi + inc ecx + mov ebx, [conns] +.next_conn2: + cmp ebx, [max_conns] + jl @f +if DEBUG + push esi + mov esi, emsgTooManyConns + invoke SysMsgBoardStr + pop esi +end if + pop ecx + jmp .err_out +@@: + shl ebx, 1 + push edi + add edi, ebx + mov word [edi], cx + pop edi + shr ebx, 1 + inc ebx + inc ecx + cmp ecx, eax + jle .next_conn2 - mov [conns], ebx - pop ecx - jmp .end_range_test - .range_zero: + mov [conns], ebx + pop ecx + jmp .end_range_test +.range_zero: - mov ebx, [conns] - cmp ebx, [max_conns] - jl @f - if DEBUG - push esi - mov esi, emsgTooManyConns - call SysMsgBoardStr - pop esi - end if - jmp .err_out - @@: - shl ebx, 1 - push edi - add edi, ebx - mov word [edi], ax - pop edi - shr ebx, 1 - inc ebx - mov [conns], ebx - .end_range_test: - mov [prev_nid], ax - .continue: - inc ecx - cmp ecx, [conn_len] - jl .next_conn + mov ebx, [conns] + cmp ebx, [max_conns] + jl @f +if DEBUG + push esi + mov esi, emsgTooManyConns + invoke SysMsgBoardStr + pop esi +end if + jmp .err_out +@@: + shl ebx, 1 + push edi + add edi, ebx + mov word [edi], ax + pop edi + shr ebx, 1 + inc ebx + mov [conns], ebx +.end_range_test: + mov [prev_nid], ax +.continue: + inc ecx + cmp ecx, [conn_len] + jl .next_conn - mov eax, [conns] - .out: - pop esi edi edx ecx ebx - ret - .err_out: - pop esi edi edx ecx ebx - mov eax, -1 - ret + mov eax, [conns] +.out: + pop esi edi edx ecx ebx + ret +.err_out: + pop esi edi edx ecx ebx + mov eax, -1 + ret endp ; Asper: Have to be realized later, when we will work with such events, but not NOW! -;proc snd_hda_queue_unsol_events stdcall, res:dword, res_ex:dword -; push ebx edi esi -; ... -; pop esi edi ebx -; ret +;proc snd_hda_queue_unsol_events stdcall, res:dword, res_ex:dword +; push ebx edi esi +; ... +; pop esi edi ebx +; ret ;endp ; This functions also will be later realized. -;proc process_unsol_events stdcall, work:dword -;proc init_usol_queue stdcall, bus:dword +;proc process_unsol_events stdcall, work:dword +;proc init_usol_queue stdcall, bus:dword ;; ;; snd_hda_bus_new - create a HDA bus @@ -477,12 +475,12 @@ endp ;; ;; Returns 0 if successful, or a negative error code. ;; -;proc snd_hda_bus_new - ; if we want to support unsolicited events, we have to solve this - ; bus->workq = create_singlethread_workqueue(bus->workq_name); - ; (...) -; xor eax, eax -; ret +;proc snd_hda_bus_new + ; if we want to support unsolicited events, we have to solve this + ; bus->workq = create_singlethread_workqueue(bus->workq_name); + ; (...) +; xor eax, eax +; ret ;endp ;; @@ -490,96 +488,93 @@ endp ;; ;; Returns 0 if successful, or a negative error code. ;; -proc snd_hda_codec_init ; We use just one codec (the first found) - snd_hda_param_read AC_NODE_ROOT, AC_PAR_VENDOR_ID - cmp eax, -1 - jne @f - snd_hda_param_read AC_NODE_ROOT, AC_PAR_VENDOR_ID - @@: - mov [codec.chip_id], ax - shr eax, 16 - mov [codec.vendor_id], ax +proc snd_hda_codec_init ; We use just one codec (the first found) + snd_hda_param_read AC_NODE_ROOT, AC_PAR_VENDOR_ID + cmp eax, -1 + jne @f + snd_hda_param_read AC_NODE_ROOT, AC_PAR_VENDOR_ID +@@: + mov [codec.chip_id], ax + shr eax, 16 + mov [codec.vendor_id], ax - snd_hda_param_read AC_NODE_ROOT, AC_PAR_SUBSYSTEM_ID - mov [codec.subsystem_id], eax + snd_hda_param_read AC_NODE_ROOT, AC_PAR_SUBSYSTEM_ID + mov [codec.subsystem_id], eax - snd_hda_param_read AC_NODE_ROOT, AC_PAR_REV_ID - mov [codec.revision_id], eax + snd_hda_param_read AC_NODE_ROOT, AC_PAR_REV_ID + mov [codec.revision_id], eax - stdcall setup_fg_nodes + stdcall setup_fg_nodes - mov eax, [codec.afg] - test eax, eax - jnz @f + mov eax, [codec.afg] + test eax, eax + jnz @f + ;Asper+: try to use another codec if possible [ +if DEBUG + push esi + mov esi, msgNoAFGFound + invoke SysMsgBoardStr + pop esi +end if + push ecx + inc eax + mov ecx, [codec.addr] + shl eax, cl + pop ecx + cmp eax, [ctrl.codec_mask] + jl .skip_codec + ;Asper+] - ;Asper+: try to use another codec if possible [ - if DEBUG - push esi - mov esi, msgNoAFGFound - call SysMsgBoardStr - pop esi - end if - push ecx - inc eax - mov ecx, [codec.addr] - shl eax, cl - pop ecx - cmp eax, [ctrl.codec_mask] - jl .skip_codec - ;Asper+] + mov eax, [codec.mfg] + test eax, eax + jnz @f +if DEBUG + push esi + mov esi, emsgNoAFGorMFGFound + invoke SysMsgBoardStr + pop esi +end if +.skip_codec: + mov eax, -1 + ret +@@: - mov eax, [codec.mfg] - test eax, eax - jnz @f - if DEBUG - push esi - mov esi, emsgNoAFGorMFGFound - call SysMsgBoardStr - pop esi - end if - .skip_codec: - mov eax, -1 - ret - @@: + mov ebx, eax + push ebx + stdcall read_widget_caps, eax - mov ebx, eax - push ebx - stdcall read_widget_caps, eax + cmp eax, 0 + jge @f +if DEBUG + push esi + mov esi, emsgNoMem + invoke SysMsgBoardStr + pop esi +end if + pop ebx + mov eax, -1 + ret +@@: - cmp eax, 0 - jge @f - if DEBUG - push esi - mov esi, emsgNoMem - call SysMsgBoardStr - pop esi - end if - pop ebx - mov eax, -1 - ret - @@: + call read_pin_defaults - call read_pin_defaults + cmp eax, 0 + jge @f + pop ebx + mov eax, -1 + ret +@@: + mov eax, [codec.subsystem_id] + test eax, eax + jnz @f + stdcall snd_hda_codec_read, ebx, 0, AC_VERB_GET_SUBSYSTEM_ID, 0 +@@: + ; power up all before initialization + stdcall snd_hda_set_power_state, ebx, AC_PWRST_D0 - cmp eax, 0 - jge @f - pop ebx - mov eax, -1 - ret - @@: - mov eax, [codec.subsystem_id] - test eax, eax - jnz @f - stdcall snd_hda_codec_read, ebx, 0, AC_VERB_GET_SUBSYSTEM_ID, 0 - - @@: - - ; power up all before initialization - stdcall snd_hda_set_power_state, ebx, AC_PWRST_D0 - - xor eax, eax - pop ebx - ret + xor eax, eax + pop ebx + ret endp @@ -591,329 +586,328 @@ endp ;; ;; Returns 0 if successful or a negative error code. ;; -proc snd_hda_codec_configure - call get_codec_name - @@: - ; call the default parser - stdcall snd_hda_parse_generic_codec ;entry point to generic tree parser!!! +proc snd_hda_codec_configure + call get_codec_name +@@: + ; call the default parser + stdcall snd_hda_parse_generic_codec ;entry point to generic tree parser!!! - test eax, eax - jz @f - if DEBUG - push esi - mov esi, emsgNoParserAvailable - call SysMsgBoardStr - pop esi - end if - @@: - .out: - ret + test eax, eax + jz @f +if DEBUG + push esi + mov esi, emsgNoParserAvailable + invoke SysMsgBoardStr + pop esi +end if +@@: +.out: + ret endp ; get_codec_name - store the codec name -proc get_codec_name - push eax ebx edi esi - mov eax, [codec.ac_vendor_ids] - test eax, eax - jnz .get_chip_name - mov ax, [codec.vendor_id] - mov edi, hda_vendor_ids +proc get_codec_name + push eax ebx edi esi + mov eax, [codec.ac_vendor_ids] + test eax, eax + jnz .get_chip_name + mov ax, [codec.vendor_id] + mov edi, hda_vendor_ids - @@: - mov ebx, [edi] - test ebx, ebx - jz .unknown +@@: + mov ebx, [edi] + test ebx, ebx + jz .unknown - cmp ax, bx - jne .next - mov eax, [edi+4] - mov [codec.ac_vendor_ids], eax - mov esi, eax - call SysMsgBoardStr - .get_chip_name: - stdcall detect_chip, [edi+8] - pop esi edi ebx eax - ret - .next: - add edi, 12 - jmp @b - .unknown: - mov [codec.ac_vendor_ids], ac_unknown - mov [codec.chip_ids], chip_unknown + cmp ax, bx + jne .next + mov eax, [edi+4] + mov [codec.ac_vendor_ids], eax + mov esi, eax + invoke SysMsgBoardStr +.get_chip_name: + stdcall detect_chip, [edi+8] + pop esi edi ebx eax + ret +.next: + add edi, 12 + jmp @b +.unknown: + mov [codec.ac_vendor_ids], ac_unknown + mov [codec.chip_ids], chip_unknown - mov esi, chip_unknown - call SysMsgBoardStr - movzx eax, [codec.chip_id] - stdcall fdword2str, 2 - call SysMsgBoardStr - pop esi edi ebx eax - ret + mov esi, chip_unknown + invoke SysMsgBoardStr + movzx eax, [codec.chip_id] + stdcall fdword2str, 2 + invoke SysMsgBoardStr + pop esi edi ebx eax + ret endp align 4 proc detect_chip stdcall, chip_tab:dword + push eax ebx edi esi + mov ax, [codec.chip_id] - push eax ebx edi esi - mov ax, [codec.chip_id] - - mov edi, [chip_tab] + mov edi, [chip_tab] @@: - mov ebx, [edi] - cmp ebx, 0xFF - je .unknown + mov ebx, [edi] + cmp ebx, 0xFF + je .unknown - cmp ax, bx - jne .next - mov eax, [edi+4] - mov [codec.chip_ids], eax - mov esi, eax - call SysMsgBoardStr - pop esi edi ebx eax - ret + cmp ax, bx + jne .next + mov eax, [edi+4] + mov [codec.chip_ids], eax + mov esi, eax + invoke SysMsgBoardStr + pop esi edi ebx eax + ret .next: - add edi, 8 - jmp @b + add edi, 8 + jmp @b .unknown: - mov [codec.chip_ids], chip_unknown - mov esi, chip_unknown - call SysMsgBoardStr - movzx eax, [codec.chip_id] - stdcall fdword2str, 2 - call SysMsgBoardStr - pop esi edi ebx eax - ret + mov [codec.chip_ids], chip_unknown + mov esi, chip_unknown + invoke SysMsgBoardStr + movzx eax, [codec.chip_id] + stdcall fdword2str, 2 + invoke SysMsgBoardStr + pop esi edi ebx eax + ret endp ;; look for an AFG and MFG nodes proc setup_fg_nodes - push eax ebx ecx - stdcall snd_hda_get_sub_nodes, AC_NODE_ROOT - mov ecx, eax - and ecx, 0x7FFF ; total_nodes - mov ebx, eax - shr ebx, 16 - and ebx, 0x7FFF ; nid + push eax ebx ecx + stdcall snd_hda_get_sub_nodes, AC_NODE_ROOT + mov ecx, eax + and ecx, 0x7FFF ; total_nodes + mov ebx, eax + shr ebx, 16 + and ebx, 0x7FFF ; nid -if DEBUG ;YAHOO - push eax esi - mov esi, msgSETUP_FG_NODES - call SysMsgBoardStr - mov eax, ebx - stdcall fdword2str, 1 - call SysMsgBoardStr +if DEBUG + push eax esi + mov esi, msgSETUP_FG_NODES + invoke SysMsgBoardStr + mov eax, ebx + stdcall fdword2str, 1 + invoke SysMsgBoardStr - mov esi, strSemicolon - call SysMsgBoardStr - mov eax, ecx - stdcall fdword2str, 3 - call SysMsgBoardStr - pop esi eax + mov esi, strSemicolon + invoke SysMsgBoardStr + mov eax, ecx + stdcall fdword2str, 3 + invoke SysMsgBoardStr + pop esi eax end if - .next: - test ecx, ecx - jz .l1 - snd_hda_param_read ebx, AC_PAR_FUNCTION_TYPE - and eax, 0xFF +.next: + test ecx, ecx + jz .l1 + snd_hda_param_read ebx, AC_PAR_FUNCTION_TYPE + and eax, 0xFF -if DEBUG ;YAHOO - push eax esi - mov esi, msgFG_TYPE - call SysMsgBoardStr - stdcall fdword2str, 3 - call SysMsgBoardStr - pop esi eax +if DEBUG + push eax esi + mov esi, msgFG_TYPE + invoke SysMsgBoardStr + stdcall fdword2str, 3 + invoke SysMsgBoardStr + pop esi eax end if - cmp eax, AC_GRP_AUDIO_FUNCTION - jne @f + cmp eax, AC_GRP_AUDIO_FUNCTION + jne @f - mov [codec.afg], ebx - mov [codec.function_id], eax - jmp .continue - @@: - cmp eax, AC_GRP_MODEM_FUNCTION - jne @f + mov [codec.afg], ebx + mov [codec.function_id], eax + jmp .continue +@@: + cmp eax, AC_GRP_MODEM_FUNCTION + jne @f - mov [codec.mfg], ebx - mov [codec.function_id], eax - jmp .continue - @@: - .continue: - inc ebx - dec ecx - jnz .next - .l1: - pop ecx ebx eax - ret + mov [codec.mfg], ebx + mov [codec.function_id], eax + jmp .continue +@@: +.continue: + inc ebx + dec ecx + jnz .next +.l1: + pop ecx ebx eax + ret endp ;====================================================================================== ; read widget caps for each widget and store in cache -proc read_widget_caps stdcall, fg_node:dword - push ebx ecx edx edi +proc read_widget_caps stdcall, fg_node:dword + push ebx ecx edx edi - stdcall snd_hda_get_sub_nodes, [fg_node] - mov ecx, eax - and ecx, 0x7FFF ; total_nodes - mov [codec.num_nodes], cx - mov ebx, eax - shr ebx, 16 - and ebx, 0x7FFF ; nid - mov [codec.start_nid], bx + stdcall snd_hda_get_sub_nodes, [fg_node] + mov ecx, eax + and ecx, 0x7FFF ; total_nodes + mov [codec.num_nodes], cx + mov ebx, eax + shr ebx, 16 + and ebx, 0x7FFF ; nid + mov [codec.start_nid], bx -if DEBUG ;YAHOO - push eax esi - mov esi, msgSETUP_FG_NODES - call SysMsgBoardStr - mov eax, ebx - stdcall fdword2str, 1 - call SysMsgBoardStr +if DEBUG + push eax esi + mov esi, msgSETUP_FG_NODES + invoke SysMsgBoardStr + mov eax, ebx + stdcall fdword2str, 1 + invoke SysMsgBoardStr - mov esi, strSemicolon - call SysMsgBoardStr - mov eax, ecx - stdcall fdword2str, 3 - call SysMsgBoardStr - pop esi eax + mov esi, strSemicolon + invoke SysMsgBoardStr + mov eax, ecx + stdcall fdword2str, 3 + invoke SysMsgBoardStr + pop esi eax end if -if FDEBUG ;YAHOO - push esi - mov esi, msgWCaps - call SysMsgBoardStr - pop esi +if FDEBUG + push esi + mov esi, msgWCaps + invoke SysMsgBoardStr + pop esi end if - mov eax, ecx - shl eax, 2 - push ebx ecx - call Kmalloc - pop ecx ebx - test eax, eax - jz .err_out - mov [codec.wcaps], eax + mov eax, ecx + shl eax, 2 + push ebx ecx + invoke Kmalloc + pop ecx ebx + test eax, eax + jz .err_out + mov [codec.wcaps], eax - mov edi, eax - .next_node: + mov edi, eax +.next_node: - snd_hda_param_read ebx, AC_PAR_AUDIO_WIDGET_CAP - stosd - inc ebx - dec ecx - jnz .next_node - pop edi edx ecx ebx - xor eax, eax - ret - .err_out: - pop edi edx ecx ebx - xor eax, eax - dec eax - ret + snd_hda_param_read ebx, AC_PAR_AUDIO_WIDGET_CAP + stosd + inc ebx + dec ecx + jnz .next_node + pop edi edx ecx ebx + xor eax, eax + ret +.err_out: + pop edi edx ecx ebx + xor eax, eax + dec eax + ret endp ; read all pin default configurations and save codec->init_pins proc read_pin_defaults - push ebx ecx edx edi + push ebx ecx edx edi - movzx ebx, [codec.start_nid] - movzx ecx, [codec.num_nodes] + movzx ebx, [codec.start_nid] + movzx ecx, [codec.num_nodes] - ;Asper [ - mov eax, HDA_PINCFG.sizeof - mul cl - push ebx ecx - call Kmalloc - pop ecx ebx - test eax, eax - jz .err_out - mov [codec.init_pins], eax - mov [codec.num_pins], 0 - mov edi, eax - ;Asper ] + ;Asper [ + mov eax, HDA_PINCFG.sizeof + mul cl + push ebx ecx + invoke Kmalloc + pop ecx ebx + test eax, eax + jz .err_out + mov [codec.init_pins], eax + mov [codec.num_pins], 0 + mov edi, eax + ;Asper ] if FDEBUG - push eax esi - mov esi, msgPinCfgs - call SysMsgBoardStr - pop esi eax + push eax esi + mov esi, msgPinCfgs + invoke SysMsgBoardStr + pop esi eax end if - .next_node: - stdcall get_wcaps, ebx - and eax, AC_WCAP_TYPE - shr eax, AC_WCAP_TYPE_SHIFT +.next_node: + stdcall get_wcaps, ebx + and eax, AC_WCAP_TYPE + shr eax, AC_WCAP_TYPE_SHIFT - cmp eax, AC_WID_PIN - jne .continue + cmp eax, AC_WID_PIN + jne .continue - mov [edi + HDA_PINCFG.nid], bx - stdcall snd_hda_codec_read, ebx, 0, AC_VERB_GET_CONFIG_DEFAULT, 0 - mov [edi + HDA_PINCFG.cfg], eax - add edi, HDA_PINCFG.sizeof - inc [codec.num_pins] + mov [edi + HDA_PINCFG.nid], bx + stdcall snd_hda_codec_read, ebx, 0, AC_VERB_GET_CONFIG_DEFAULT, 0 + mov [edi + HDA_PINCFG.cfg], eax + add edi, HDA_PINCFG.sizeof + inc [codec.num_pins] - .continue: - inc ebx - dec ecx - jnz .next_node +.continue: + inc ebx + dec ecx + jnz .next_node - pop edi edx ecx ebx - xor eax, eax - ret - .err_out: - pop edi edx ecx ebx - xor eax, eax - dec eax - ret + pop edi edx ecx ebx + xor eax, eax + ret +.err_out: + pop edi edx ecx ebx + xor eax, eax + dec eax + ret endp ; look up the given pin config list and return the item matching with NID -proc look_up_pincfg stdcall, array:dword, nid:dword - push ebx ecx edx - mov ecx, [codec.num_pins] - mov eax, [array] - mov ebx, [nid] - .next_pin: - mov dx, [eax + HDA_PINCFG.nid] - cmp dx, bx - je .out - .continue: - add eax, HDA_PINCFG.sizeof - dec ecx - jnz .next_pin +proc look_up_pincfg stdcall, array:dword, nid:dword + push ebx ecx edx + mov ecx, [codec.num_pins] + mov eax, [array] + mov ebx, [nid] +.next_pin: + mov dx, [eax + HDA_PINCFG.nid] + cmp dx, bx + je .out +.continue: + add eax, HDA_PINCFG.sizeof + dec ecx + jnz .next_pin - xor eax, eax - .out: - pop edx ecx ebx - ret + xor eax, eax +.out: + pop edx ecx ebx + ret endp ; write a config value for the given NID -proc set_pincfg stdcall, nid:dword, cfg:dword - push eax ebx ecx edx - mov eax, [cfg] - xor ebx, ebx - mov edx, AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 - mov ecx, 4 - @@: - mov bl, al - stdcall snd_hda_codec_write, [nid], 0, edx, ebx - shr eax, 8 - inc edx - dec ecx - jnz @b - .l1: - pop edx ecx ebx eax - ret +proc set_pincfg stdcall, nid:dword, cfg:dword + push eax ebx ecx edx + mov eax, [cfg] + xor ebx, ebx + mov edx, AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + mov ecx, 4 +@@: + mov bl, al + stdcall snd_hda_codec_write, [nid], 0, edx, ebx + shr eax, 8 + inc edx + dec ecx + jnz @b +.l1: + pop edx ecx ebx eax + ret endp @@ -926,16 +920,16 @@ endp ;; If the pincfg value is cached or overridden via sysfs or driver, ;; returns the cached value. ;; -proc snd_hda_codec_get_pincfg stdcall, nid:dword - push edi - stdcall look_up_pincfg, [codec.init_pins], [nid] - test eax, eax - jz @f - mov edi, eax - mov eax, [edi + HDA_PINCFG.cfg] - @@: - pop edi - ret +proc snd_hda_codec_get_pincfg stdcall, nid:dword + push edi + stdcall look_up_pincfg, [codec.init_pins], [nid] + test eax, eax + jz @f + mov edi, eax + mov eax, [edi + HDA_PINCFG.cfg] +@@: + pop edi + ret endp ;====================================================================================== @@ -948,135 +942,135 @@ endp ;; @format: stream format. ;; proc hda_codec_setup_stream stdcall, nid:dword, stream_tag:dword, channel_id:dword, format:dword - push eax - mov eax, [nid] - test eax, eax - jnz @f - pop eax - ret - @@: - if DEBUG - push esi - mov esi, msgHDACodecSetupStream - call SysMsgBoardStr - stdcall fdword2str, 3 - call SysMsgBoardStr + push eax + mov eax, [nid] + test eax, eax + jnz @f + pop eax + ret +@@: +if DEBUG + push esi + mov esi, msgHDACodecSetupStream + invoke SysMsgBoardStr + stdcall fdword2str, 3 + invoke SysMsgBoardStr - mov esi, msgStream - call SysMsgBoardStr - mov eax, [stream_tag] - stdcall fdword2str, 3 - call SysMsgBoardStr + mov esi, msgStream + invoke SysMsgBoardStr + mov eax, [stream_tag] + stdcall fdword2str, 3 + invoke SysMsgBoardStr - mov esi, msgChannel - call SysMsgBoardStr - mov eax, [channel_id] - stdcall fdword2str, 3 - call SysMsgBoardStr + mov esi, msgChannel + invoke SysMsgBoardStr + mov eax, [channel_id] + stdcall fdword2str, 3 + invoke SysMsgBoardStr - mov esi, msgFormat - call SysMsgBoardStr - mov eax, [format] - stdcall fdword2str, 3 - call SysMsgBoardStr - pop esi - end if - mov eax, [stream_tag] - shl eax, 4 - or eax, [channel_id] - stdcall snd_hda_codec_write, [nid], 0, AC_VERB_SET_CHANNEL_STREAMID, eax + mov esi, msgFormat + invoke SysMsgBoardStr + mov eax, [format] + stdcall fdword2str, 3 + invoke SysMsgBoardStr + pop esi +end if + mov eax, [stream_tag] + shl eax, 4 + or eax, [channel_id] + stdcall snd_hda_codec_write, [nid], 0, AC_VERB_SET_CHANNEL_STREAMID, eax - mov eax, 1000 ; wait 1 ms - call StallExec + mov eax, 1000 ; wait 1 ms + call StallExec - stdcall snd_hda_codec_write, [nid], 0, AC_VERB_SET_STREAM_FORMAT, [format] - pop eax - ret + stdcall snd_hda_codec_write, [nid], 0, AC_VERB_SET_STREAM_FORMAT, [format] + pop eax + ret endp proc snd_hda_codec_cleanup_stream stdcall, nid:dword - push eax - mov eax, [nid] - test eax, eax - jz @f - pop eax - ret - @@: - if DEBUG - push esi - mov esi, msgHDACodecCleanupStream - call SysMsgBoardStr - stdcall fdword2str, 3 - call SysMsgBoardStr - pop esi - end if - stdcall snd_hda_codec_write, [nid], 0, AC_VERB_SET_CHANNEL_STREAMID, 0 - if 0 ; keep the format - mov eax, 1000000 ; wait 100 ms - call StallExec - stdcall snd_hda_codec_write, [nid], 0, AC_VERB_SET_STREAM_FORMAT, 0 - end if - pop eax - ret + push eax + mov eax, [nid] + test eax, eax + jz @f + pop eax + ret +@@: +if DEBUG + push esi + mov esi, msgHDACodecCleanupStream + invoke SysMsgBoardStr + stdcall fdword2str, 3 + invoke SysMsgBoardStr + pop esi +end if + stdcall snd_hda_codec_write, [nid], 0, AC_VERB_SET_CHANNEL_STREAMID, 0 +if 0 ; keep the format + mov eax, 1000000 ; wait 100 ms + call StallExec + stdcall snd_hda_codec_write, [nid], 0, AC_VERB_SET_STREAM_FORMAT, 0 +end if + pop eax + ret endp -proc read_pin_cap, nid:dword - snd_hda_param_read [nid], AC_PAR_PIN_CAP - ret +proc read_pin_cap, nid:dword + snd_hda_param_read [nid], AC_PAR_PIN_CAP + ret endp ;; read the current volume proc get_volume_mute stdcall, nid:dword, ch:dword, direction:dword, index:dword - push ebx - mov ebx, AC_AMP_GET_LEFT - mov eax, [ch] - test eax, eax - jz @f - mov ebx, AC_AMP_GET_RIGHT - @@: - mov eax, [direction] - cmp eax, HDA_OUTPUT - jne @f - or ebx, AC_AMP_GET_OUTPUT - jmp .l1 - @@: - or ebx, AC_AMP_GET_INPUT - .l1: - or ebx, [index] - stdcall snd_hda_codec_read, [nid], 0, AC_VERB_GET_AMP_GAIN_MUTE, ebx - and eax, 0xFF - pop ebx - ret + push ebx + mov ebx, AC_AMP_GET_LEFT + mov eax, [ch] + test eax, eax + jz @f + mov ebx, AC_AMP_GET_RIGHT +@@: + mov eax, [direction] + cmp eax, HDA_OUTPUT + jne @f + or ebx, AC_AMP_GET_OUTPUT + jmp .l1 +@@: + or ebx, AC_AMP_GET_INPUT +.l1: + or ebx, [index] + stdcall snd_hda_codec_read, [nid], 0, AC_VERB_GET_AMP_GAIN_MUTE, ebx + and eax, 0xFF + pop ebx + ret endp ;; write the current volume in info to the h/w proc put_volume_mute stdcall, nid:dword, ch:dword, direction:dword, index:dword, val:dword - push eax ebx - mov ebx, AC_AMP_SET_LEFT - mov eax, [ch] - test eax, eax - jz @f - mov ebx, AC_AMP_SET_RIGHT - @@: - mov eax, [direction] - cmp eax, HDA_OUTPUT - jne @f - or ebx, AC_AMP_SET_OUTPUT - jmp .l1 - @@: - or ebx, AC_AMP_SET_INPUT - .l1: - mov eax, [index] - shl eax, AC_AMP_SET_INDEX_SHIFT - or ebx, eax - or ebx, [val] - stdcall snd_hda_codec_write, [nid], 0, AC_VERB_SET_AMP_GAIN_MUTE, ebx - pop ebx eax - ret + push eax ebx + mov ebx, AC_AMP_SET_LEFT + mov eax, [ch] + test eax, eax + jz @f + mov ebx, AC_AMP_SET_RIGHT +@@: + mov eax, [direction] + cmp eax, HDA_OUTPUT + jne @f + or ebx, AC_AMP_SET_OUTPUT + jmp .l1 +@@: + or ebx, AC_AMP_SET_INPUT +.l1: + mov eax, [index] + shl eax, AC_AMP_SET_INDEX_SHIFT + or ebx, eax + or ebx, [val] + stdcall snd_hda_codec_write, [nid], 0, AC_VERB_SET_AMP_GAIN_MUTE, ebx + pop ebx eax + ret endp @@ -1093,21 +1087,21 @@ endp ;; Returns 0 if the value is unchanged, 1 if changed. ;; ;-proc snd_hda_codec_amp_update stdcall, nid:dword, ch:dword, direction:dword, idx:dword, mask:dword, val:dword -;- push ebx edx -;- mov eax, [mask] -;- mov ebx, [val] -;- and ebx, eax -;- xor eax, -1 -;- mov edx, eax -;- stdcall get_volume_mute, [nid], [ch], [direction], [idx] -;- and eax, edx -;- or ebx, eax +;- push ebx edx +;- mov eax, [mask] +;- mov ebx, [val] +;- and ebx, eax +;- xor eax, -1 +;- mov edx, eax +;- stdcall get_volume_mute, [nid], [ch], [direction], [idx] +;- and eax, edx +;- or ebx, eax ;- -;- stdcall put_volume_mute, [nid], [ch], [direction], [idx], ebx -;- xor eax, eax -;- inc eax -;- pop edx ebx -;- ret +;- stdcall put_volume_mute, [nid], [ch], [direction], [idx], ebx +;- xor eax, eax +;- inc eax +;- pop edx ebx +;- ret ;-endp @@ -1123,84 +1117,128 @@ endp ;; stereo widget with the same mask and value. ;; proc snd_hda_codec_amp_stereo stdcall, nid:dword, direction:dword, idx:dword, mask:dword, val:dword - push ebx edx - mov ebx, [val] - mov edx, [mask] - and ebx, edx - stdcall put_volume_mute, [nid], 0, [direction], [idx], ebx - stdcall put_volume_mute, [nid], 1, [direction], [idx], ebx - pop edx ebx - ret + push ebx edx + mov ebx, [val] + mov edx, [mask] + and ebx, edx + stdcall put_volume_mute, [nid], 0, [direction], [idx], ebx + stdcall put_volume_mute, [nid], 1, [direction], [idx], ebx + pop edx ebx + ret 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 proc snd_hda_set_power_state stdcall, fg:dword, power_state:dword - push eax ebx ecx edx - ; this delay seems necessary to avoid click noise at power down - mov ebx, [power_state] - cmp ebx, AC_PWRST_D3 - jne @f - mov eax, 100000 - call StallExec - @@: - stdcall snd_hda_codec_read, [fg], 0, AC_VERB_SET_POWER_STATE, ebx - ;partial workaround for "azx_get_response timeout" - cmp ebx, AC_PWRST_D0 - jne @f + push eax ebx ecx edx + ; this delay seems necessary to avoid click noise at power down + mov ebx, [power_state] + cmp ebx, AC_PWRST_D3 + jne @f + mov eax, 100000 + call StallExec +@@: + stdcall snd_hda_codec_read, [fg], 0, AC_VERB_SET_POWER_STATE, ebx + ;partial workaround for "azx_get_response timeout" + cmp ebx, AC_PWRST_D0 + jne @f - mov dx, [codec.vendor_id] - cmp dx, 0x14F1 + mov dx, [codec.vendor_id] + cmp dx, 0x14F1 + jne @f + mov eax, 10000 + call StallExec +@@: + movzx ecx, [codec.num_nodes] + movzx edx, [codec.start_nid] +.next_nid: + stdcall get_wcaps, edx + test eax, AC_WCAP_POWER + jz .skip_nid - jne @f - mov eax, 10000 - call StallExec - @@: - movzx ecx, [codec.num_nodes] - movzx edx, [codec.start_nid] - .next_nid: - stdcall get_wcaps, edx - test eax, AC_WCAP_POWER - jz .skip_nid + stdcall get_wcaps_type, eax + cmp ebx, AC_PWRST_D3 + jne .l1 + cmp eax, AC_WID_PIN + jne .l1 + ;don't power down the widget if it controls + ;eapd and EAPD_BTLENABLE is set. + stdcall read_pin_cap, edx + test eax, AC_PINCAP_EAPD + jz .l2 - stdcall get_wcaps_type, eax - cmp ebx, AC_PWRST_D3 - jne .l1 - cmp eax, AC_WID_PIN - jne .l1 - ;don't power down the widget if it controls - ;eapd and EAPD_BTLENABLE is set. - stdcall read_pin_cap, edx - test eax, AC_PINCAP_EAPD - jz .l2 + stdcall snd_hda_codec_read, edx, 0, AC_VERB_GET_EAPD_BTLENABLE, 0 + and eax, 0x02 + test eax, eax + jnz .skip_nid +.l2: +.l1: + stdcall snd_hda_codec_write, edx, 0, AC_VERB_SET_POWER_STATE, ebx +.skip_nid: + inc edx + dec ecx + jnz .next_nid - stdcall snd_hda_codec_read, edx, 0, AC_VERB_GET_EAPD_BTLENABLE, 0 - and eax, 0x02 - test eax, eax - jnz .skip_nid - .l2: - .l1: - stdcall snd_hda_codec_write, edx, 0, AC_VERB_SET_POWER_STATE, ebx - .skip_nid: - inc edx - dec ecx - jnz .next_nid - - cmp ebx, AC_PWRST_D0 - jne .out - ;wait until codec reaches to D0 - mov ecx, 500 - .wait_D0: - stdcall snd_hda_codec_read, [fg], 0, AC_VERB_GET_POWER_STATE, 0 - cmp eax, ebx - je .out - mov eax, 1000 ; msleep(1); - call StallExec - dec ecx - jnz .wait_D0 - .out: - pop edx ecx ebx eax - ret + cmp ebx, AC_PWRST_D0 + jne .out + ;wait until codec reaches to D0 + mov ecx, 500 +.wait_D0: + stdcall snd_hda_codec_read, [fg], 0, AC_VERB_GET_POWER_STATE, 0 + cmp eax, ebx + je .out + mov eax, 1000 ; msleep(1); + call StallExec + dec ecx + jnz .wait_D0 +.out: + pop edx ecx ebx eax + ret endp @@ -1208,21 +1246,21 @@ endp ; codec vendors align 16 -msg_Cirrus db 'Cirrus Logic ',0 -msg_Motorola db 'Motorola ',0 +msg_Cirrus db 'Cirrus Logic ',0 +msg_Motorola db 'Motorola ',0 msg_SiliconImage db 'Silicon Image ',0 -msg_Realtek db 'Realtek ',0 -msg_Creative db 'Creative ',0 -msg_IDT db 'IDT ',0 -msg_LSI db 'LSI ',0 +msg_Realtek db 'Realtek ',0 +msg_Creative db 'Creative ',0 +msg_IDT db 'IDT ',0 +msg_LSI db 'LSI ',0 msg_AnalogDevices db 'Analog Devices ',0 -msg_CMedia db 'C-Media ',0 -msg_Conexant db 'Conexant ',0 -msg_Chrontel db 'Chrontel ',0 -msg_LG db 'LG ',0 -msg_Wolfson db 'Wolfson Microelectronics ',0 -msg_Qumranet db 'Qumranet ',0 -msg_SigmaTel db 'SigmaTel ',0 +msg_CMedia db 'C-Media ',0 +msg_Conexant db 'Conexant ',0 +msg_Chrontel db 'Chrontel ',0 +msg_LG db 'LG ',0 +msg_Wolfson db 'Wolfson Microelectronics ',0 +msg_Qumranet db 'Qumranet ',0 +msg_SigmaTel db 'SigmaTel ',0 ac_unknown db 'unknown manufacturer ',0 chip_unknown db 'unknown codec id ', 0 @@ -1231,134 +1269,134 @@ chip_unknown db 'unknown codec id ', 0 ; codec vendor labels align 4 hda_vendor_ids: - dd 0x1002, msg_ATI, chips_ATI - dd 0x1013, msg_Cirrus, chips_Cirrus - dd 0x1057, msg_Motorola, chips_Motorola - dd 0x1095, msg_SiliconImage, chips_SiliconImage - dd 0x10de, msg_NVidia, chips_NVidia - dd 0x10ec, msg_Realtek, chips_Realtek - dd 0x1102, msg_Creative, chips_Creative - dd 0x1106, msg_VIA, chips_VIA - dd 0x111d, msg_IDT, chips_IDT - dd 0x11c1, msg_LSI, chips_LSI - dd 0x11d4, msg_AnalogDevices, chips_Analog - dd 0x13f6, msg_CMedia, chips_CMedia - dd 0x14f1, msg_Conexant, chips_Conexant - dd 0x17e8, msg_Chrontel, chips_Chrontel - dd 0x1854, msg_LG, chips_LG - dd 0x1aec, msg_Wolfson, chips_Wolfson - dd 0x1af4, msg_Qumranet, chips_Qumranet ; Qemu 0.14 - dd 0x434d, msg_CMedia, chips_CMedia - dd 0x8086, msg_Intel, chips_Intel - dd 0x8384, msg_SigmaTel, chips_SigmaTel - dd 0 ; terminator + dd 0x1002, msg_ATI, chips_ATI + dd 0x1013, msg_Cirrus, chips_Cirrus + dd 0x1057, msg_Motorola, chips_Motorola + dd 0x1095, msg_SiliconImage, chips_SiliconImage + dd 0x10de, msg_NVidia, chips_NVidia + dd 0x10ec, msg_Realtek, chips_Realtek + dd 0x1102, msg_Creative, chips_Creative + dd 0x1106, msg_VIA, chips_VIA + dd 0x111d, msg_IDT, chips_IDT + dd 0x11c1, msg_LSI, chips_LSI + dd 0x11d4, msg_AnalogDevices, chips_Analog + dd 0x13f6, msg_CMedia, chips_CMedia + dd 0x14f1, msg_Conexant, chips_Conexant + dd 0x17e8, msg_Chrontel, chips_Chrontel + dd 0x1854, msg_LG, chips_LG + dd 0x1aec, msg_Wolfson, chips_Wolfson + dd 0x1af4, msg_Qumranet, chips_Qumranet ; Qemu 0.14 + dd 0x434d, msg_CMedia, chips_CMedia + dd 0x8086, msg_Intel, chips_Intel + dd 0x8384, msg_SigmaTel, chips_SigmaTel + dd 0 ; terminator -align 16 ;known codecs -chips_ATI dd 0xAA01, chip_ATIR6XX - dd 0xFF +align 16 ;known codecs +chips_ATI dd 0xAA01, chip_ATIR6XX + dd 0xFF -chips_Cirrus dd 0xFF -chips_Motorola dd 0xFF +chips_Cirrus dd 0xFF +chips_Motorola dd 0xFF chips_SiliconImage dd 0x1392, chip_SI1392 - dd 0xFF + dd 0xFF -chips_NVidia dd 0x0002, chip_MCP78 - dd 0xFF +chips_NVidia dd 0x0002, chip_MCP78 + dd 0xFF -chips_Realtek dd 0x0262, chip_ALC262 - dd 0x0268, chip_ALC268 - dd 0x0269, chip_ALC269 - dd 0x0272, chip_ALC272 - dd 0x0662, chip_ALC662 - dd 0x0663, chip_ALC663 - dd 0x0883, chip_ALC883 - dd 0x0887, chip_ALC887 - dd 0x0888, chip_ALC888 - dd 0x0889, chip_ALC889 - dd 0xFF +chips_Realtek dd 0x0262, chip_ALC262 + dd 0x0268, chip_ALC268 + dd 0x0269, chip_ALC269 + dd 0x0272, chip_ALC272 + dd 0x0662, chip_ALC662 + dd 0x0663, chip_ALC663 + dd 0x0883, chip_ALC883 + dd 0x0887, chip_ALC887 + dd 0x0888, chip_ALC888 + dd 0x0889, chip_ALC889 + dd 0xFF -chips_Creative dd 0xFF +chips_Creative dd 0xFF -chips_VIA dd 0xE721, chip_VT1708B_1 - dd 0x0397, chip_VT17085_0 - dd 0xFF +chips_VIA dd 0xE721, chip_VT1708B_1 + dd 0x0397, chip_VT17085_0 + dd 0xFF -chips_IDT dd 0xFF +chips_IDT dd 0xFF +chips_LSI dd 0x1039, chip_LSI1039 + dd 0x1040, chip_LSI1040 + dd 0x3026, chip_LSI3026 + dd 0x3055, chip_LSI3055 + dd 0xFF -chips_LSI dd 0x1039, chip_LSI1039 - dd 0x1040, chip_LSI1040 - dd 0x3026, chip_LSI3026 - dd 0x3055, chip_LSI3055 - dd 0xFF +chips_Analog dd 0x1986, chip_AD1986A + dd 0x198B, chip_AD198B + dd 0xFF -chips_Analog dd 0x1986, chip_AD1986A - dd 0x198B, chip_AD198B - dd 0xFF +chips_CMedia dd 0xFF -chips_CMedia dd 0xFF +chips_Conexant dd 0x5045, chip_CX20549 + dd 0x5051, chip_CX20561 + dd 0xFF -chips_Conexant dd 0x5045, chip_CX20549 - dd 0x5051, chip_CX20561 - dd 0xFF +chips_Chrontel dd 0xFF +chips_LG dd 0xFF +chips_Wolfson dd 0xFF +chips_Intel dd 0xFF -chips_Chrontel dd 0xFF -chips_LG dd 0xFF -chips_Wolfson dd 0xFF -chips_Intel dd 0xFF +chips_Qumranet dd 0x0010, chip_HDA_OUTPUT + dd 0x0020, chip_HDA_DUPLEX + dd 0xFF -chips_Qumranet dd 0x0010, chip_HDA_OUTPUT - dd 0x0020, chip_HDA_DUPLEX - dd 0xFF - -chips_SigmaTel dd 0x7680, chip_STAC9221 - dd 0x7682, chip_STAC9221_A2 - dd 0xFF +chips_SigmaTel dd 0x7680, chip_STAC9221 + dd 0x7682, chip_STAC9221_A2 + dd 0xFF align 16 ;AnalogDevices -chip_AD1986A db 'AD1986A',13,10,0 -chip_AD198B db 'AD198B',13,10,0 +chip_AD1986A db 'AD1986A',13,10,0 +chip_AD198B db 'AD198B',13,10,0 ;ATI -chip_ATIR6XX db 'ATIR6XX',13,10,0 +chip_ATIR6XX db 'ATIR6XX',13,10,0 ;Silicon Image -chip_SI1392 db 'SI1392',13,10,0 +chip_SI1392 db 'SI1392',13,10,0 ;NVidia -chip_MCP78 db 'MCP78',13,10,0 +chip_MCP78 db 'MCP78',13,10,0 ;Realtek -chip_ALC262 db 'ALC262',13,10,0 -chip_ALC268 db 'ALC268',13,10,0 -chip_ALC269 db 'ALC269',13,10,0 -chip_ALC272 db 'ALC272',13,10,0 -chip_ALC662 db 'ALC662',13,10,0 -chip_ALC663 db 'ALC663',13,10,0 -chip_ALC883 db 'ALC883',13,10,0 -chip_ALC887 db 'ALC887',13,10,0 -chip_ALC888 db 'ALC888',13,10,0 -chip_ALC889 db 'ALC889',13,10,0 +chip_ALC262 db 'ALC262',13,10,0 +chip_ALC268 db 'ALC268',13,10,0 +chip_ALC269 db 'ALC269',13,10,0 +chip_ALC272 db 'ALC272',13,10,0 +chip_ALC662 db 'ALC662',13,10,0 +chip_ALC663 db 'ALC663',13,10,0 +chip_ALC883 db 'ALC883',13,10,0 +chip_ALC887 db 'ALC887',13,10,0 +chip_ALC888 db 'ALC888',13,10,0 +chip_ALC889 db 'ALC889',13,10,0 ;Sigmatel -chip_STAC9221 db 'STAC9221',13,10,0 +chip_STAC9221 db 'STAC9221',13,10,0 chip_STAC9221_A2 db 'STAC9221_A2',13,10,0 ;VIA -chip_VT1708B_1 db 'VT1708B_1',13,10,0 -chip_VT17085_0 db 'VT17085_0',13,10,0 +chip_VT1708B_1 db 'VT1708B_1',13,10,0 +chip_VT17085_0 db 'VT17085_0',13,10,0 ;Conexant -chip_CX20549 db 'CX20549',13,10,0 -chip_CX20561 db 'CX20561',13,10,0 +chip_CX20549 db 'CX20549',13,10,0 +chip_CX20561 db 'CX20561',13,10,0 ;Qumranet chip_HDA_OUTPUT db 'HDA-OUTPUT',13,10,0 chip_HDA_DUPLEX db 'HDA-DUPLEX',13,10,0 ;LSI -chip_LSI1039 db '1039 (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_LSI3055 db '3055 (Agere Systems HDA Modem)',13,10,0 +chip_LSI1039 db '1039 (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_LSI3055 db '3055 (Agere Systems HDA Modem)',13,10,0 + diff --git a/drivers/audio/intel_hda/CODEC_H.INC b/drivers/audio/intel_hda/CODEC_H.INC index 8a8e68f660..eb3f6f64d5 100644 --- a/drivers/audio/intel_hda/CODEC_H.INC +++ b/drivers/audio/intel_hda/CODEC_H.INC @@ -475,15 +475,15 @@ HDA_MAX_PCMS equ 10 ; Structures ; direction -HDA_INPUT equ 0x0 -HDA_OUTPUT equ 0x1 +HDA_INPUT equ 0x0 +HDA_OUTPUT equ 0x1 struc HDA_VERB { - .nid dw ? - .verb dd ? - .param dd ? + .nid dw ? + .verb dd ? + .param dd ? } virtual at 0 @@ -508,9 +508,9 @@ end virtual ;(...) ; amp value bits -HDA_AMP_MUTE equ 0x80 -HDA_AMP_UNMUTE equ 0x00 -HDA_AMP_VOLMASK equ 0x7F +HDA_AMP_MUTE equ 0x80 +HDA_AMP_UNMUTE equ 0x00 +HDA_AMP_VOLMASK equ 0x7F ;(...) @@ -598,51 +598,46 @@ PIN_HP_AMP equ (AC_PINCTL_HP_EN) ; get widget capabilities -;static inline u32 get_wcaps(struct hda_codec *codec, hda_nid_t nid) proc get_wcaps stdcall, nid:dword - push ebx ecx edx - xor eax, eax - movzx ebx, [codec.start_nid] - movzx ecx, [codec.num_nodes] - mov edx, [nid] + push ebx ecx edx + xor eax, eax + movzx ebx, [codec.start_nid] + movzx ecx, [codec.num_nodes] + mov edx, [nid] - cmp edx, ebx - jl .out + cmp edx, ebx + jl .out - add ecx, ebx - cmp edx, ecx - jge .out + add ecx, ebx + cmp edx, ecx + jge .out - sub edx, ebx - shl edx, 2 - add edx, [codec.wcaps] - mov eax, [edx] - .out: - pop edx ecx ebx - ret + sub edx, ebx + shl edx, 2 + add edx, [codec.wcaps] + mov eax, [edx] +.out: + pop edx ecx ebx + ret endp ; 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 - mov eax, [wcaps] - and eax, AC_WCAP_TYPE - shr eax, AC_WCAP_TYPE_SHIFT - ret + mov eax, [wcaps] + and eax, AC_WCAP_TYPE + shr eax, AC_WCAP_TYPE_SHIFT + ret endp ;static inline unsigned int get_wcaps_channels(u32 wcaps) proc get_wcaps_channels stdcall, wcaps:dword -; chans = (wcaps & AC_WCAP_CHAN_CNT_EXT) >> 13; -; chans = ((chans << 1) | 1) + 1; - mov eax, [wcaps] - and eax, AC_WCAP_CHAN_CNT_EXT - shr eax, 13 - shl eax, 1 - or eax, 1 - inc eax - ret + mov eax, [wcaps] + and eax, AC_WCAP_CHAN_CNT_EXT + shr eax, 13 + shl eax, 1 + or eax, 1 + inc eax + ret endp - ;Asper ] diff --git a/drivers/audio/intel_hda/IMPORTS.INC b/drivers/audio/intel_hda/IMPORTS.INC deleted file mode 100644 index 896b0f9b22..0000000000 --- a/drivers/audio/intel_hda/IMPORTS.INC +++ /dev/null @@ -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 diff --git a/drivers/audio/intel_hda/PROC32.INC b/drivers/audio/intel_hda/PROC32.INC deleted file mode 100644 index 23c56b03c1..0000000000 --- a/drivers/audio/intel_hda/PROC32.INC +++ /dev/null @@ -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, \{ 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: - \\\{ 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 } diff --git a/drivers/audio/intel_hda/hda_generic.inc b/drivers/audio/intel_hda/hda_generic.inc index 2c2f8d6181..ccf1e6b174 100644 --- a/drivers/audio/intel_hda/hda_generic.inc +++ b/drivers/audio/intel_hda/hda_generic.inc @@ -7,610 +7,630 @@ ; widget node for parsing struc HDA_GNODE { - .nid dw ? ;NID of this widget - .nconns dw ? ;number of input connections - .conn_list dd ? - .slist dw ? ;temporary list - dw ? + .nid dw ? ;NID of this widget + .nconns dw ? ;number of input connections + .conn_list dd ? + .slist dw ? ;temporary list + dw ? - .wid_caps dd ? ;widget capabilities - .type db ? ;widget type - .pin_ctl db ? ;pin controls - .checked db ? ;the flag indicates that the node is already parsed - .pin_caps dd ? ;pin widget capabilities - .def_cfg dd ? ;default configuration - .amp_out_caps dd ? ;AMP out capabilities - .amp_in_caps dd ? ;AMP in capabilities - .next dd ? ; struct list_head list - .sizeof: + .wid_caps dd ? ;widget capabilities + .type db ? ;widget type + .pin_ctl db ? ;pin controls + .checked db ? ;the flag indicates that the node is already parsed + .pin_caps dd ? ;pin widget capabilities + .def_cfg dd ? ;default configuration + .amp_out_caps dd ? ;AMP out capabilities + .amp_in_caps dd ? ;AMP in capabilities + .next dd ? ; struct list_head list + .sizeof: } virtual at 0 - HDA_GNODE HDA_GNODE + HDA_GNODE HDA_GNODE end virtual struc HDA_GSPEC { - .dac_node dd ? ;DAC node - dd ? - .out_pin_node dd ? ;Output pin (Line-Out) node - dd ? + .dac_node dd ? ;DAC node + dd ? + .out_pin_node dd ? ;Output pin (Line-Out) node + dd ? - .def_amp_in_caps dd ? - .def_amp_out_caps dd ? + .def_amp_in_caps dd ? + .def_amp_out_caps dd ? -; .pcm_rec dd ? ;PCM information - .nid_list dd 0 ;list of widgets +; .pcm_rec dd ? ;PCM information + .nid_list dd 0 ;list of widgets } struc VOLUME_CTL { - .out_amp_node dd 0 ;Asper+ : To get/set volume - .num_steps db ? ; num_steps=NumSteps+1 - .step_size db ? ; step_size=StepSize+1 - .maxDb dd ? ; Max volume in Db. maxDb=(num_steps*step_size/4*100) + .out_amp_node dd 0 ;Asper+ : To get/set volume + .num_steps db ? ; num_steps=NumSteps+1 + .step_size db ? ; step_size=StepSize+1 + .maxDb dd ? ; Max volume in Db. maxDb=(num_steps*step_size/4*100) } ; retrieve the default device type from the default config value - -proc defcfg_type stdcall, node:dword - push edx - mov edx, [node] - mov eax, [edx + HDA_GNODE.def_cfg] - and eax, AC_DEFCFG_DEVICE - shr eax, AC_DEFCFG_DEVICE_SHIFT - pop edx - ret +proc defcfg_type stdcall, node:dword + push edx + mov edx, [node] + mov eax, [edx + HDA_GNODE.def_cfg] + and eax, AC_DEFCFG_DEVICE + shr eax, AC_DEFCFG_DEVICE_SHIFT + pop edx + ret endp -proc defcfg_location stdcall, node:dword - push edx - mov edx, [node] - mov eax, [edx + HDA_GNODE.def_cfg] - and eax, AC_DEFCFG_LOCATION - shr eax, AC_DEFCFG_LOCATION_SHIFT - pop edx - ret +proc defcfg_location stdcall, node:dword + push edx + mov edx, [node] + mov eax, [edx + HDA_GNODE.def_cfg] + and eax, AC_DEFCFG_LOCATION + shr eax, AC_DEFCFG_LOCATION_SHIFT + pop edx + ret endp -proc defcfg_port_conn stdcall, node:dword - push edx - mov edx, [node] - mov eax, [edx + HDA_GNODE.def_cfg] - and eax, AC_DEFCFG_PORT_CONN - shr eax, AC_DEFCFG_PORT_CONN_SHIFT - pop edx - ret +proc defcfg_port_conn stdcall, node:dword + push edx + mov edx, [node] + mov eax, [edx + HDA_GNODE.def_cfg] + and eax, AC_DEFCFG_PORT_CONN + shr eax, AC_DEFCFG_PORT_CONN_SHIFT + pop edx + ret endp -proc defcfg_color stdcall, node:dword - push edx - mov edx, [node] - mov eax, [edx + HDA_GNODE.def_cfg] - and eax, AC_DEFCFG_COLOR - shr eax, AC_DEFCFG_COLOR_SHIFT - pop edx - ret +proc defcfg_color stdcall, node:dword + push edx + mov edx, [node] + mov eax, [edx + HDA_GNODE.def_cfg] + and eax, AC_DEFCFG_COLOR + shr eax, AC_DEFCFG_COLOR_SHIFT + pop edx + ret endp - ; destructor -proc snd_hda_generic_free - push eax ebx edx edi - ; free all widgets - mov ebx, [spec.nid_list] ; ebx = 1st node address - test ebx, ebx - jz .out - mov edx, [ebx + HDA_GNODE.next] ;edx = 2nd node address +proc snd_hda_generic_free + push eax ebx edx edi + ; free all widgets + mov ebx, [spec.nid_list] ; ebx = 1st node address + test ebx, ebx + jz .out + mov edx, [ebx + HDA_GNODE.next] ;edx = 2nd node address - .next: - test edx, edx - jz .free_head +.next: + test edx, edx + jz .free_head - mov eax, [edx + HDA_GNODE.conn_list] - lea edi, [edx + HDA_GNODE.slist] - cmp eax, edi - je @f - pusha - call Kfree ;free conn_list - popa - @@: - mov eax, edx - mov edx, [edx + HDA_GNODE.next] - pusha - call Kfree ;free node - popa - jmp .next - .free_head: - mov eax, [spec.nid_list] - pusha - call Kfree ;free the very 1st node in the list - popa - mov [spec.nid_list], 0 - .out: - pop edi edx ebx eax - ret + mov eax, [edx + HDA_GNODE.conn_list] + lea edi, [edx + HDA_GNODE.slist] + cmp eax, edi + je @f + pusha + invoke Kfree ;free conn_list + popa +@@: + mov eax, edx + mov edx, [edx + HDA_GNODE.next] + pusha + invoke Kfree ;free node + popa + jmp .next +.free_head: + mov eax, [spec.nid_list] + pusha + invoke Kfree ;free the very 1st node in the list + popa + mov [spec.nid_list], 0 +.out: + pop edi edx ebx eax + ret endp ; add a new widget node and read its attributes -proc add_new_node stdcall, nid:dword - push ebx ecx edx edi esi +proc add_new_node stdcall, nid:dword + push ebx ecx edx edi esi - mov eax, HDA_GNODE.sizeof - call Kmalloc - test eax, eax - jz .err_out ; Not enough memory + mov eax, HDA_GNODE.sizeof + invoke Kmalloc + test eax, eax + jz .err_out ; Not enough memory - mov edx, eax + mov edx, eax ;Asper+ [ - mov edi, edx - xor eax, eax - mov ecx, HDA_GNODE.sizeof - rep stosb + mov edi, edx + xor eax, eax + mov ecx, HDA_GNODE.sizeof + rep stosb ;Asper+ ] - mov eax, [nid] - mov word [edx + HDA_GNODE.nid], ax - stdcall get_wcaps, eax - mov [edx + HDA_GNODE.wid_caps], eax - mov ebx, eax - stdcall get_wcaps_type, eax - mov byte [edx + HDA_GNODE.type], al + mov eax, [nid] + mov word [edx + HDA_GNODE.nid], ax + stdcall get_wcaps, eax + mov [edx + HDA_GNODE.wid_caps], eax + mov ebx, eax + stdcall get_wcaps_type, eax + mov byte [edx + HDA_GNODE.type], al - mov eax, HDA_MAX_CONNECTIONS*2 ;HDA_MAX_CONNECTIONS * sizeof(word) - push ebx ecx edx - call Kmalloc ;malloc temporary conn_list - pop edx ecx ebx - mov edi, eax + mov eax, HDA_MAX_CONNECTIONS*2 ;HDA_MAX_CONNECTIONS * sizeof(word) + push ebx ecx edx + invoke Kmalloc ;malloc temporary conn_list + pop edx ecx ebx + mov edi, eax - test ebx, AC_WCAP_CONN_LIST - jz .no_conn_list + test ebx, AC_WCAP_CONN_LIST + jz .no_conn_list - stdcall snd_hda_get_connections, [nid], edi, HDA_MAX_CONNECTIONS - mov ecx, eax - cmp ecx, 0 - jge @f + stdcall snd_hda_get_connections, [nid], edi, HDA_MAX_CONNECTIONS + mov ecx, eax + cmp ecx, 0 + jge @f - mov eax, edx - pusha - call Kfree ;free node - popa - mov eax, ecx - jmp .out - .no_conn_list: + mov eax, edx + pusha + invoke Kfree ;free node + popa + mov eax, ecx + jmp .out +.no_conn_list: - xor ecx, ecx - @@: - cmp ecx, 2 ;nconns <= ARRAY_SIZE(node->slist) ? - jg @f + xor ecx, ecx +@@: + cmp ecx, 2 ;nconns <= ARRAY_SIZE(node->slist) ? + jg @f - lea eax, [edx + HDA_GNODE.slist] - mov [edx + HDA_GNODE.conn_list], eax - jmp .set_conn_list - @@: - mov eax, ecx - shl ecx, 1 - push ebx ecx edx edi - call Kmalloc ;malloc conn_list - pop edi edx ecx ebx - shr ecx, 1 - test eax, eax - jnz @f + lea eax, [edx + HDA_GNODE.slist] + mov [edx + HDA_GNODE.conn_list], eax + jmp .set_conn_list +@@: + mov eax, ecx + shl ecx, 1 + push ebx ecx edx edi + invoke Kmalloc ;malloc conn_list + pop edi edx ecx ebx + shr ecx, 1 + test eax, eax + jnz @f - mov eax, edi - pusha - call Kfree ;free temporary conn_list - popa - jmp .err_out - @@: - mov [edx + HDA_GNODE.conn_list], eax - .set_conn_list: - mov [edx + HDA_GNODE.nconns], cx - push edi - mov esi, edi - mov edi, eax - rep movsw - pop edi + mov eax, edi + pusha + invoke Kfree ;free temporary conn_list + popa + jmp .err_out +@@: + mov [edx + HDA_GNODE.conn_list], eax +.set_conn_list: + mov [edx + HDA_GNODE.nconns], cx + push edi + mov esi, edi + mov edi, eax + rep movsw + pop edi - mov al, byte [edx + HDA_GNODE.type] - test al, AC_WID_PIN - jz @f + mov al, byte [edx + HDA_GNODE.type] + test al, AC_WID_PIN + jz @f ;Asper+ [ - cmp al, AC_WID_VENDOR - je @f + cmp al, AC_WID_VENDOR + je @f ;Asper+ ] - stdcall read_pin_cap, [nid] - mov [edx + HDA_GNODE.pin_caps], eax - stdcall snd_hda_codec_read, [nid], 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0 - mov byte [edx + HDA_GNODE.pin_ctl], al - stdcall snd_hda_codec_get_pincfg, [nid] - mov [edx + HDA_GNODE.def_cfg], eax - @@: + stdcall read_pin_cap, [nid] + mov [edx + HDA_GNODE.pin_caps], eax + stdcall snd_hda_codec_read, [nid], 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0 + mov byte [edx + HDA_GNODE.pin_ctl], al + stdcall snd_hda_codec_get_pincfg, [nid] + mov [edx + HDA_GNODE.def_cfg], eax +@@: - xor eax, eax - test ebx, AC_WCAP_OUT_AMP - jz .no_out_amp - test ebx, AC_WCAP_AMP_OVRD - jz @f - snd_hda_param_read [nid], AC_PAR_AMP_OUT_CAP - @@: - test eax, eax - jnz @f - mov eax, [spec.def_amp_out_caps] - @@: - mov [edx + HDA_GNODE.amp_out_caps], eax - .no_out_amp: + xor eax, eax + test ebx, AC_WCAP_OUT_AMP + jz .no_out_amp + test ebx, AC_WCAP_AMP_OVRD + jz @f + snd_hda_param_read [nid], AC_PAR_AMP_OUT_CAP +@@: + test eax, eax + jnz @f + mov eax, [spec.def_amp_out_caps] +@@: + mov [edx + HDA_GNODE.amp_out_caps], eax +.no_out_amp: ;;Asper+: Beeper [ -; pusha -; mov bl, byte [edx + HDA_GNODE.type] -; cmp bl, AC_WID_BEEP -; jne .not_beeper +; pusha +; mov bl, byte [edx + HDA_GNODE.type] +; cmp bl, AC_WID_BEEP +; jne .not_beeper ; -; mov ebx, [nid] -; mov [codec.beeper_nid], bx +; mov ebx, [nid] +; mov [codec.beeper_nid], bx ; -; test eax, eax -; jz .no_beeper_amp -; ;set beep amplifier here -; stdcall unmute_output, edx -; .no_beeper_amp: -; ;try to beep here -; stdcall snd_hda_codec_read, [nid], 0, AC_VERB_GET_BEEP_CONTROL, 0 ;eax -; if DEBUG -; push eax esi -; mov esi, msgBeeperNid -; call SysMsgBoardStr -; push eax -; mov eax, [nid] -; stdcall fdword2str, 2 -; call SysMsgBoardStr +; test eax, eax +; jz .no_beeper_amp +; ;set beep amplifier here +; stdcall unmute_output, edx +;.no_beeper_amp: +; ;try to beep here +; stdcall snd_hda_codec_read, [nid], 0, AC_VERB_GET_BEEP_CONTROL, 0 ;eax +;if DEBUG +; push eax esi +; mov esi, msgBeeperNid +; invoke SysMsgBoardStr +; push eax +; mov eax, [nid] +; stdcall fdword2str, 2 +; invoke SysMsgBoardStr ; -; mov esi, msgBeeperValue -; call SysMsgBoardStr -; pop eax -; stdcall fdword2str, 2 -; call SysMsgBoardStr +; mov esi, msgBeeperValue +; invoke SysMsgBoardStr +; pop eax +; stdcall fdword2str, 2 +; invoke SysMsgBoardStr ; -; mov esi, msgBeepNow -; call SysMsgBoardStr -; pop esi eax -; end if -; mov ecx, 256*1 -; .next_tone: -; dec ecx -; movzx ebx, [esi + HDA_GNODE.nid] -; stdcall snd_hda_codec_write, [nid], 0, AC_VERB_SET_BEEP_CONTROL, ecx -; ;mov eax, 0x8000 -; ;stdcall StallExec -; test ecx, ecx -; jnz .next_tone -; .end_beep: -; stdcall snd_hda_codec_read, [nid], 0, AC_VERB_GET_BEEP_CONTROL, 0 ;eax -; if DEBUG -; ;push eax esi -; mov esi, msgBeeperValue -; call SysMsgBoardStr -; stdcall fdword2str, 2 -; call SysMsgBoardStr -; ;pop esi eax -; end if -; .not_beeper: -; popa +; mov esi, msgBeepNow +; invoke SysMsgBoardStr +; pop esi eax +;end if +; mov ecx, 256*1 +;.next_tone: +; dec ecx +; movzx ebx, [esi + HDA_GNODE.nid] +; stdcall snd_hda_codec_write, [nid], 0, AC_VERB_SET_BEEP_CONTROL, ecx +; ;mov eax, 0x8000 +; ;stdcall StallExec +; test ecx, ecx +; jnz .next_tone +;.end_beep: +; stdcall snd_hda_codec_read, [nid], 0, AC_VERB_GET_BEEP_CONTROL, 0 ;eax +;if DEBUG +; ;push eax esi +; mov esi, msgBeeperValue +; invoke SysMsgBoardStr +; stdcall fdword2str, 2 +; invoke SysMsgBoardStr +; ;pop esi eax +;end if +;.not_beeper: +; popa ;;Asper+: Beeper ] - xor eax, eax - test ebx, AC_WCAP_IN_AMP - jz .no_in_amp - test ebx, AC_WCAP_AMP_OVRD - jz @f - snd_hda_param_read [nid], AC_PAR_AMP_IN_CAP - @@: - test eax, eax - jnz @f - mov eax, [spec.def_amp_in_caps] - @@: - mov [edx + HDA_GNODE.amp_in_caps], eax - .no_in_amp: + xor eax, eax + test ebx, AC_WCAP_IN_AMP + jz .no_in_amp + test ebx, AC_WCAP_AMP_OVRD + jz @f + snd_hda_param_read [nid], AC_PAR_AMP_IN_CAP +@@: + test eax, eax + jnz @f + mov eax, [spec.def_amp_in_caps] +@@: + mov [edx + HDA_GNODE.amp_in_caps], eax +.no_in_amp: - mov esi, [spec.nid_list] - test esi, esi - jnz @f - mov [spec.nid_list], edx - jmp .out - @@: + mov esi, [spec.nid_list] + test esi, esi + jnz @f + mov [spec.nid_list], edx + jmp .out +@@: - ;Asper+: Sort pins by DA:Sequence during tree building [ - mov ecx, esi - movzx ebx, byte [edx + HDA_GNODE.def_cfg] - push edi - .next_node: - cmp [esi + HDA_GNODE.type], AC_WID_PIN - jne @f - cmp [edx + HDA_GNODE.type], AC_WID_PIN - je .pin + ;Asper+: Sort pins by DA:Sequence during tree building [ + mov ecx, esi + movzx ebx, byte [edx + HDA_GNODE.def_cfg] + push edi +.next_node: + cmp [esi + HDA_GNODE.type], AC_WID_PIN + jne @f + cmp [edx + HDA_GNODE.type], AC_WID_PIN + je .pin - mov edi, [spec.nid_list] - cmp [edi + HDA_GNODE.type], AC_WID_PIN - jne .not_pin - mov [edx + HDA_GNODE.next], edi - .head: ;CleverMouse+ - mov [spec.nid_list], edx - pop edi - jmp .out - .pin: - movzx edi, byte [esi + HDA_GNODE.def_cfg] - cmp edi, ebx - jle @f - .not_pin: - mov [edx + HDA_GNODE.next], esi - cmp esi, [spec.nid_list] ;CleverMouse+ - jz .head ;CleverMouse+ - mov esi, ecx - jmp .insert - @@: - mov eax, [esi + HDA_GNODE.next] - test eax, eax - jz .insert - mov ecx, esi - mov esi, eax - jmp .next_node - .insert: - mov [esi + HDA_GNODE.next], edx - pop edi - ;Asper+ ] + mov edi, [spec.nid_list] + cmp [edi + HDA_GNODE.type], AC_WID_PIN + jne .not_pin + mov [edx + HDA_GNODE.next], edi +.head: ;CleverMouse+ + mov [spec.nid_list], edx + pop edi + jmp .out +.pin: + movzx edi, byte [esi + HDA_GNODE.def_cfg] + cmp edi, ebx + jle @f +.not_pin: + mov [edx + HDA_GNODE.next], esi + cmp esi, [spec.nid_list] ;CleverMouse+ + jz .head ;CleverMouse+ + mov esi, ecx + jmp .insert +@@: + mov eax, [esi + HDA_GNODE.next] + test eax, eax + jz .insert + mov ecx, esi + mov esi, eax + jmp .next_node +.insert: + mov [esi + HDA_GNODE.next], edx + pop edi + ;Asper+ ] - .out: - mov eax, edi - pusha - call Kfree ;free temporary conn_list - popa - xor eax, eax - pop esi edi edx ecx ebx - ret +.out: + mov eax, edi + pusha + invoke Kfree ;free temporary conn_list + popa + xor eax, eax + pop esi edi edx ecx ebx + ret - .err_out: - mov eax, edx - pusha - call Kfree ;free node - popa - xor eax, eax - dec eax - pop esi edi edx ecx ebx - ret +.err_out: + mov eax, edx + pusha + invoke Kfree ;free node + popa + xor eax, eax + dec eax + pop esi edi edx ecx ebx + ret endp ; build the AFG subtree -proc build_afg_tree - push ebx ecx edx +proc build_afg_tree + push ebx ecx edx - mov ebx, [codec.afg] - snd_hda_param_read ebx, AC_PAR_AMP_OUT_CAP + mov ebx, [codec.afg] + snd_hda_param_read ebx, AC_PAR_AMP_OUT_CAP - mov [spec.def_amp_out_caps], eax - snd_hda_param_read ebx, AC_PAR_AMP_IN_CAP - mov [spec.def_amp_in_caps], eax + mov [spec.def_amp_out_caps], eax + snd_hda_param_read ebx, AC_PAR_AMP_IN_CAP + mov [spec.def_amp_in_caps], eax - stdcall snd_hda_get_sub_nodes, ebx - mov ecx, eax - and ecx, 0xFFFF ;ecx = nodes number - mov edx, eax - shr edx, 16 ;eax = address of the first nid + stdcall snd_hda_get_sub_nodes, ebx + mov ecx, eax + and ecx, 0xFFFF ;ecx = nodes number + mov edx, eax + shr edx, 16 ;eax = address of the first nid - test edx, edx - jz @f - cmp ecx, 0 - jge .nid_ok - @@: - if FDEBUG - push esi - mov esi, emsgInvalidAFGSubtree - call SysMsgBoardStr - pop esi - end if - xor eax, eax - dec eax - jmp .out - .nid_ok: + test edx, edx + jz @f + cmp ecx, 0 + jge .nid_ok +@@: +if FDEBUG + push esi + mov esi, emsgInvalidAFGSubtree + invoke SysMsgBoardStr + pop esi +end if + xor eax, eax + dec eax + jmp .out +.nid_ok: - ; parse all nodes belonging to the AFG - .next_node: - test ecx, ecx - jz .build_done + ; parse all nodes belonging to the AFG +.next_node: + test ecx, ecx + jz .build_done - stdcall add_new_node, edx - test eax, eax - jnz .out - inc edx - dec ecx - jmp .next_node - .build_done: - xor eax, eax - .out: - pop edx ecx ebx - ret -endp - - -; look for the node record for the given NID -proc hda_get_node stdcall, nid:dword - push ebx edx esi - movzx ebx, word [nid] - mov esi, [spec.nid_list] - test esi, esi - jz .out - - .next_node: - mov edx, [esi + HDA_GNODE.next] - test edx, edx ;Asper+ - jz .not_found ;Asper+ - mov ax, word [esi + HDA_GNODE.nid] - cmp ax, bx - je .out - mov esi, edx - jmp .next_node - - .not_found: ;Asper+ - xor esi, esi - .out: - mov eax, esi - pop esi edx ebx - ret + stdcall add_new_node, edx + test eax, eax + jnz .out + inc edx + dec ecx + jmp .next_node +.build_done: + xor eax, eax +.out: + pop edx ecx ebx + ret endp ;Asper+[ -proc set_eapd stdcall, node:dword ;nid:dword, on:dword - push eax ebx esi - mov esi, [node] - cmp [esi + HDA_GNODE.type], AC_WID_PIN - jne .out - ; eapd capable? - test [esi + HDA_GNODE.pin_caps], AC_PINCAP_EAPD - jz .out - ;stdcall snd_hda_codec_read, ebx, 0, AC_VERB_GET_EAPD_BTLENABLE, AC_EAPDBTL_EAPD - ;or eax, AC_EAPDBTL_EAPD - movzx ebx, [esi + HDA_GNODE.nid] - stdcall snd_hda_codec_write, ebx, 0, AC_VERB_SET_EAPD_BTLENABLE, AC_EAPDBTL_EAPD ;eax - if DEBUG - push eax esi - mov esi, msgEnableEAPD - call SysMsgBoardStr - mov eax, ebx - stdcall fdword2str, 3 - call SysMsgBoardStr - pop esi eax - end if - .out: - pop esi ebx eax - ret +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 +proc hda_get_node stdcall, nid:dword + push ebx edx esi + movzx ebx, word [nid] + mov esi, [spec.nid_list] + test esi, esi + jz .out + +.next_node: + mov edx, [esi + HDA_GNODE.next] + test edx, edx ;Asper+ + jz .not_found ;Asper+ + mov ax, word [esi + HDA_GNODE.nid] + cmp ax, bx + je .out + mov esi, edx + jmp .next_node + +.not_found: ;Asper+ + xor esi, esi +.out: + mov eax, esi + pop esi edx ebx + ret +endp + +;Asper+[ +proc set_eapd stdcall, node:dword ;nid:dword, on:dword + push eax ebx esi + mov esi, [node] + cmp [esi + HDA_GNODE.type], AC_WID_PIN + jne .out + ; eapd capable? + test [esi + HDA_GNODE.pin_caps], AC_PINCAP_EAPD + jz .out + ;stdcall snd_hda_codec_read, ebx, 0, AC_VERB_GET_EAPD_BTLENABLE, AC_EAPDBTL_EAPD + ;or eax, AC_EAPDBTL_EAPD + movzx ebx, [esi + HDA_GNODE.nid] + stdcall snd_hda_codec_write, ebx, 0, AC_VERB_SET_EAPD_BTLENABLE, AC_EAPDBTL_EAPD ;eax +if DEBUG + push eax esi + mov esi, msgEnableEAPD + invoke SysMsgBoardStr + mov eax, ebx + stdcall fdword2str, 3 + invoke SysMsgBoardStr + pop esi eax + end if +.out: + pop esi ebx eax + ret endp ;Asper+] ; 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 + mov esi, [node] + test [esi + HDA_GNODE.wid_caps], AC_WCAP_OUT_AMP + jz .out + movzx eax, word [esi + HDA_GNODE.nid] +if DEBUG + push esi + mov esi, msgUnmuteOut + invoke SysMsgBoardStr + stdcall fdword2str, 3 + invoke SysMsgBoardStr + pop esi +end if - push ebx ecx edx esi - mov esi, [node] - test [esi + HDA_GNODE.wid_caps], AC_WCAP_OUT_AMP - jz .out - movzx eax, word [esi + HDA_GNODE.nid] - if DEBUG - push esi - mov esi, msgUnmuteOut - call SysMsgBoardStr - stdcall fdword2str, 3 - call SysMsgBoardStr - pop esi - end if + stdcall set_eapd, esi ;Asper+: set EAPD if exist - stdcall set_eapd, esi ;Asper+: set EAPD if exist + mov ebx, eax + mov eax, [esi + HDA_GNODE.amp_out_caps] + mov ecx, eax - mov ebx, eax - mov eax, [esi + HDA_GNODE.amp_out_caps] - mov ecx, eax + and eax, AC_AMPCAP_NUM_STEPS + shr eax, AC_AMPCAP_NUM_STEPS_SHIFT - and eax, AC_AMPCAP_NUM_STEPS - shr eax, AC_AMPCAP_NUM_STEPS_SHIFT + stdcall snd_hda_codec_amp_stereo, ebx, HDA_OUTPUT, 0, 0xFF, eax - stdcall snd_hda_codec_amp_stereo, ebx, HDA_OUTPUT, 0, 0xFF, eax + and ecx, AC_AMPCAP_STEP_SIZE + shr ecx, AC_AMPCAP_STEP_SIZE_SHIFT - and ecx, AC_AMPCAP_STEP_SIZE - shr ecx, AC_AMPCAP_STEP_SIZE_SHIFT + test al, al + jz .out +if DEBUG + push eax esi + mov esi, msgAmpVal + invoke SysMsgBoardStr + stdcall fdword2str, 1 + invoke SysMsgBoardStr - test al, al - jz .out - if DEBUG - push eax esi - mov esi, msgAmpVal - call SysMsgBoardStr - stdcall fdword2str, 1 - call SysMsgBoardStr - - mov esi, strSemicolon - call SysMsgBoardStr - mov eax, ecx - stdcall fdword2str, 3 - call SysMsgBoardStr - pop esi eax - end if - mov [volume.out_amp_node], esi - inc al - mov [volume.num_steps], al - inc cl - mov [volume.step_size], cl - mul cl - shr eax, 2 - imul eax, 100 - mov [volume.maxDb], eax - - .out: - xor eax, eax - pop esi edx ecx ebx - ret + mov esi, strSemicolon + invoke SysMsgBoardStr + mov eax, ecx + stdcall fdword2str, 3 + invoke SysMsgBoardStr + pop esi eax +end if + mov [volume.out_amp_node], esi + mov [volume.num_steps], al + mov [volume.step_size], cl + mul cl + imul eax, (100/4) + mov [volume.maxDb], eax +.out: + xor eax, eax + pop esi edx ecx ebx + ret endp ; unmute (and set max vol) the input amplifier -proc unmute_input stdcall, node:dword, index:dword - push ecx edx esi - test [esi + HDA_GNODE.wid_caps], AC_WCAP_IN_AMP - jz .out - and [index], 0xF ;Asper+ : Ranger - mov esi, [node] - movzx eax, word [esi + HDA_GNODE.nid] - if DEBUG - push eax esi - mov esi, msgUnmuteIn - call SysMsgBoardStr - stdcall fdword2str, 3 - call SysMsgBoardStr - mov esi, msgIdx - call SysMsgBoardStr - mov eax, [index] - stdcall fdword2str, 3 - call SysMsgBoardStr - pop esi eax - end if +proc unmute_input stdcall, node:dword, index:dword + push ecx edx esi + test [esi + HDA_GNODE.wid_caps], AC_WCAP_IN_AMP + jz .out + and [index], 0xF ;Asper+ : Ranger + mov esi, [node] + movzx eax, word [esi + HDA_GNODE.nid] +if DEBUG + push eax esi + mov esi, msgUnmuteIn + invoke SysMsgBoardStr + stdcall fdword2str, 3 + invoke SysMsgBoardStr + mov esi, msgIdx + invoke SysMsgBoardStr + mov eax, [index] + stdcall fdword2str, 3 + invoke SysMsgBoardStr + pop esi eax +end if - mov edx, [esi + HDA_GNODE.amp_in_caps] - mov ecx, edx + mov edx, [esi + HDA_GNODE.amp_in_caps] + mov ecx, edx - and edx, AC_AMPCAP_NUM_STEPS - shr edx, AC_AMPCAP_NUM_STEPS_SHIFT + and edx, AC_AMPCAP_NUM_STEPS + shr edx, AC_AMPCAP_NUM_STEPS_SHIFT - stdcall snd_hda_codec_amp_stereo, eax, HDA_INPUT, [index], 0xFF, edx - .out: - xor eax, eax - pop esi edx ecx - ret + stdcall snd_hda_codec_amp_stereo, eax, HDA_INPUT, [index], 0xFF, edx +.out: + xor eax, eax + pop esi edx ecx + ret endp ; select the input connection of the given node. -proc select_input_connection stdcall, node:dword, index:dword +proc select_input_connection stdcall, node:dword, index:dword push ebx esi mov esi, [node] movzx eax, word [esi + HDA_GNODE.nid] mov ebx, [index] - if DEBUG +if DEBUG mov esi, msgConnect - call SysMsgBoardStr + invoke SysMsgBoardStr stdcall fdword2str, 3 - call SysMsgBoardStr + invoke SysMsgBoardStr mov esi, msgIdx - call SysMsgBoardStr + invoke SysMsgBoardStr push eax mov eax, ebx stdcall fdword2str, 3 - call SysMsgBoardStr + invoke SysMsgBoardStr pop eax - end if +end if stdcall snd_hda_codec_write, eax, 0, AC_VERB_SET_CONNECT_SEL, ebx pop esi ebx ret @@ -618,22 +638,21 @@ endp ; clear checked flag of each node in the node list -proc clear_check_flags - push eax esi - mov esi, [spec.nid_list] - test esi, esi - jz .out - .next_node: - mov byte [esi + HDA_GNODE.checked], 0 - mov eax, [esi + HDA_GNODE.next] - test eax, eax - jz .out - mov esi, eax - jmp .next_node - - .out: - pop esi eax - ret +proc clear_check_flags + push eax esi + mov esi, [spec.nid_list] + test esi, esi + jz .out +.next_node: + mov byte [esi + HDA_GNODE.checked], 0 + mov eax, [esi + HDA_GNODE.next] + test eax, eax + jz .out + mov esi, eax + jmp .next_node +.out: + pop esi eax + ret endp ; @@ -641,7 +660,7 @@ endp ; ; returns 0 if not found, 1 if found, or a negative error code. ; -proc parse_output_path stdcall, node:dword, dac_idx:dword +proc parse_output_path stdcall, node:dword, dac_idx:dword push ebx ecx edx esi mov esi, [node] mov al, byte [esi + HDA_GNODE.checked] @@ -658,24 +677,24 @@ proc parse_output_path stdcall, node:dword, dac_idx:dword mov ebx, [esi + HDA_GNODE.wid_caps] test ebx, AC_WCAP_DIGITAL jz @f - if DEBUG +if DEBUG push esi mov esi, msgSkipDigitalOutNode - call SysMsgBoardStr + invoke SysMsgBoardStr stdcall fdword2str, 3 - call SysMsgBoardStr + invoke SysMsgBoardStr pop esi - end if +end if jmp .ret_zero - @@: - if DEBUG +@@: +if DEBUG push eax esi mov esi, msgAudOutFound - call SysMsgBoardStr + invoke SysMsgBoardStr stdcall fdword2str, 3 - call SysMsgBoardStr + invoke SysMsgBoardStr pop esi eax - end if +end if push eax stdcall unmute_output, esi ;Asper+ @@ -691,18 +710,18 @@ proc parse_output_path stdcall, node:dword, dac_idx:dword cmp eax, [node] je .ret_one jmp .ret_zero - @@: +@@: mov ecx, [dac_idx] shl ecx, 2 mov [spec.dac_node+ecx], eax jmp .ret_one ;found - .not_wid_aud_out: +.not_wid_aud_out: movzx ebx, [esi + HDA_GNODE.nconns] xor ecx, ecx mov edx, [esi + HDA_GNODE.conn_list] test ebx, ebx jz .ret_zero - .next_node: +.next_node: stdcall hda_get_node, [edx] test eax, eax jz .continue @@ -712,24 +731,24 @@ proc parse_output_path stdcall, node:dword, dac_idx:dword cmp [esi + HDA_GNODE.nconns], 1 jle @f stdcall select_input_connection, esi, ecx - @@: +@@: ;UNSUPPORTED YET! stdcall unmute_input, esi, ecx stdcall unmute_output, esi jmp .ret_one - .continue: +.continue: add edx, 2 inc ecx cmp ecx, ebx jl .next_node - .ret_zero: +.ret_zero: xor eax, eax pop esi edx ecx ebx ret - .ret_one: +.ret_one: xor eax, eax inc eax - .ret: ;Asper+ +.ret: ;Asper+ pop esi edx ecx ebx ret endp @@ -738,13 +757,13 @@ endp ; and parse the output path to that PIN. ; ; Returns the PIN node when the path to DAC is established. -proc parse_output_jack stdcall, jack_type:dword +proc parse_output_jack stdcall, jack_type:dword push edx esi mov esi, [spec.nid_list] test esi, esi jz .ret_zero - .next_pin: +.next_pin: cmp [esi + HDA_GNODE.type], AC_WID_PIN jne .continue @@ -767,52 +786,60 @@ proc parse_output_jack stdcall, jack_type:dword test [esi + HDA_GNODE.wid_caps], AC_WCAP_DIGITAL 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 - pusha -; push esi -; mov esi, msgPin_Nid -; call SysMsgBoardStr -; pop esi - movzx eax, [esi + HDA_GNODE.nid] - movzx ebx, [esi + HDA_GNODE.pin_ctl] - mov ecx, [esi + HDA_GNODE.pin_caps] - mov edx, [esi + HDA_GNODE.def_cfg] - mov edi, [esi + HDA_GNODE.amp_out_caps] - mov esi, msgPin_Nid - call SysMsgBoardStr - stdcall fdword2str, 3 - call SysMsgBoardStr + pusha +; push esi +; mov esi, msgPin_Nid +; invoke SysMsgBoardStr +; pop esi + movzx eax, [esi + HDA_GNODE.nid] + movzx ebx, [esi + HDA_GNODE.pin_ctl] + mov ecx, [esi + HDA_GNODE.pin_caps] + mov edx, [esi + HDA_GNODE.def_cfg] + mov edi, [esi + HDA_GNODE.amp_out_caps] + mov esi, msgPin_Nid + invoke SysMsgBoardStr + stdcall fdword2str, 3 + invoke SysMsgBoardStr - mov esi, msgPin_Ctl - call SysMsgBoardStr - mov eax, ebx - stdcall fdword2str, 2 - call SysMsgBoardStr + mov esi, msgPin_Ctl + invoke SysMsgBoardStr + mov eax, ebx + stdcall fdword2str, 2 + invoke SysMsgBoardStr - mov esi, msgPin_Caps - call SysMsgBoardStr - mov eax, ecx - stdcall fdword2str, 2 - call SysMsgBoardStr + mov esi, msgPin_Caps + invoke SysMsgBoardStr + mov eax, ecx + stdcall fdword2str, 2 + invoke SysMsgBoardStr - mov esi, msgDef_Cfg - call SysMsgBoardStr - mov eax, edx - stdcall fdword2str, 2 - call SysMsgBoardStr + mov esi, msgDef_Cfg + invoke SysMsgBoardStr + mov eax, edx + stdcall fdword2str, 2 + invoke SysMsgBoardStr - mov esi, msgAmp_Out_Caps - call SysMsgBoardStr - mov eax, edi - stdcall fdword2str, 2 - call SysMsgBoardStr - - popa + mov esi, msgAmp_Out_Caps + invoke SysMsgBoardStr + mov eax, edi + stdcall fdword2str, 2 + invoke SysMsgBoardStr + popa end if -; test [esi + HDA_GNODE.pin_ctl], AC_PINCTL_OUT_EN -; jz .continue + ; output as default? +; test [esi + HDA_GNODE.pin_ctl], AC_PINCTL_OUT_EN +; jz .continue +.use_dac0: + cmp [spec.dac_node], 0 + jne .use_dac1 + stdcall clear_check_flags stdcall parse_output_path, esi, 0 @@ -821,9 +848,10 @@ end if mov edx, [spec.out_pin_node] test edx, edx jz @f +.use_dac1: stdcall clear_check_flags stdcall parse_output_path, esi, 1 - @@: +@@: cmp eax, 0 jle .l1 @@ -834,22 +862,22 @@ end if test [esi + HDA_GNODE.pin_caps], AC_PINCAP_HP_DRV jz @f mov edx, AC_PINCTL_HP_EN - @@: +@@: or edx, AC_PINCTL_OUT_EN movzx eax, [esi + HDA_GNODE.nid] stdcall snd_hda_codec_write, eax, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, edx mov eax, esi jmp .out - .l1: - .continue: - mov edx, [esi + HDA_GNODE.next] - test edx, edx - jz .ret_zero - mov esi, edx - jmp .next_pin - .ret_zero: +.l1: +.continue: + mov edx, [esi + HDA_GNODE.next] + test edx, edx + jz .ret_zero + mov esi, edx + jmp .next_pin +.ret_zero: xor eax, eax - .out: +.out: pop esi edx ret endp @@ -866,13 +894,13 @@ proc parse_output jz @f mov [spec.out_pin_node], eax ; found, remember the PIN node jmp .l1 - @@: +@@: ; if no line-out is found, try speaker out stdcall parse_output_jack, AC_JACK_SPEAKER test eax, eax jz .l1 mov [spec.out_pin_node], eax ; found, remember the PIN node - .l1: +.l1: ; look for the HP-out pin stdcall parse_output_jack, AC_JACK_HP_OUT test eax, eax @@ -883,9 +911,9 @@ proc parse_output jnz @f mov [spec.out_pin_node], eax jmp .l2 - @@: +@@: mov [spec.out_pin_node+4], eax - .l2: +.l2: mov edx, [spec.out_pin_node] test edx, edx jnz @f @@ -896,13 +924,13 @@ proc parse_output mov [spec.out_pin_node], eax test eax, eax jnz @f - if DEBUG +if DEBUG push esi mov esi, emsgNoProperOutputPathFound - call SysMsgBoardStr + invoke SysMsgBoardStr pop esi - end if - @@: +end if +@@: pop edx xor eax, eax ret @@ -921,11 +949,15 @@ proc snd_hda_parse_generic_codec cmp eax, 0 jl .error +if FDEBUG + stdcall print_afg_tree_nodes ;Asper+ +end if + stdcall parse_output xor eax, eax - .out: +.out: ret - .error: +.error: stdcall snd_hda_generic_free ret endp diff --git a/drivers/audio/intel_hda/intel_hda.asm b/drivers/audio/intel_hda/intel_hda.asm index 722191b6a3..ec2fd4b388 100644 --- a/drivers/audio/intel_hda/intel_hda.asm +++ b/drivers/audio/intel_hda/intel_hda.asm @@ -5,32 +5,29 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -format MS COFF +format PE DLL native 0.05 +section '.flat' code readable writable executable DEBUG equ 1 FDEBUG equ 0 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. +USE_UNSOL_EV equ 1 ; 1 = Use unsolicited events; 0 = Do not use unsolicited events. -TEST_VERSION_NUMBER equ '018e' +TEST_VERSION_NUMBER equ '019' ;Asper+ [ -SDO_TAG equ 1 ;Asper: Output stream tag id (any number except 0) -SDO_IDX equ 4 ;Asper: Output stream index +SDO_TAG equ 1 ;Output stream tag id (any number except 0) +SDO_IDX equ 4 ;Output stream index ;According to "Intel® I/O Controller Hub 6 (ICH6) High Definition Audio / AC ’97 Programmer’s Reference Manual (PRM) May 2005 Document" ;and "Intel® I/O Controller Hub 6 (ICH6) Family Datasheet" SDO0=4, ;but according to "High Definition Audio Specification Revision 1.0a June 17, 2010" SDO0 depends on the number of SDIs. -SDO_INT equ 1 shl SDO_IDX ;Asper: Output stream interrupt (must be power of 2) -SDO_OFS equ 0x80+(SDO_IDX*0x20) ;Asper: Output stream offset +SDO_INT equ 1 shl SDO_IDX ;Output stream interrupt (must be power of 2) +SDO_OFS equ 0x80+(SDO_IDX*0x20) ;Output stream offset ;Asper+ ] -include 'PROC32.INC' -include 'IMPORTS.INC' -include 'CODEC_H.INC' - - CURRENT_API equ 0x0100 ;1.00 COMPATIBLE_API equ 0x0101 ;1.01 API_VERSION equ (COMPATIBLE_API shl 16) or CURRENT_API @@ -297,11 +294,11 @@ ICH6_MAX_CORB_ENTRIES equ 256 ICH6_MAX_RIRB_ENTRIES equ 256 ; position fix mode - POS_FIX_AUTO equ 0 - POS_FIX_LPIB equ 1 - POS_FIX_POSBUF equ 2 - POS_FIX_VIACOMBO equ 4 - POS_FIX_COMBO equ 8 +POS_FIX_AUTO equ 0 +POS_FIX_LPIB equ 1 +POS_FIX_POSBUF equ 2 +POS_FIX_VIACOMBO equ 4 +POS_FIX_COMBO equ 8 ; Defines for ATI HD Audio support in SB450 south bridge ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR equ 0x42 @@ -344,112 +341,107 @@ DEV_EXEC_CODEC_CMD equ 100 ;Asper: Non standard system service. For the tests only! ] struc AC_CNTRL ;AC controller base class -{ .bus dd ? - .devfn dd ? +{ + .bus dd ? + .devfn dd ? - .vendor dw ? - .dev_id dw ? - .pci_cmd dd ? - .pci_stat dd ? + .vendor dw ? + .dev_id dw ? + .pci_cmd dd ? + .pci_stat dd ? - .ctrl_io_base dd ? - .ctrl_mem_base dd ? - .cfg_reg dd ? - .int_line dd ? + .ctrl_io_base dd ? + .ctrl_mem_base dd ? + .cfg_reg dd ? + .int_line dd ? - .vendor_ids dd ? ;vendor id string - .ctrl_ids dd ? ;hub id string + .vendor_ids dd ? ;vendor id string + .ctrl_ids dd ? ;hub id string - .buffer dd ? + .buffer dd ? - .notify_pos dd ? - .notify_task dd ? + .notify_pos dd ? + .notify_task dd ? - .lvi_reg dd ? - .civ_val dd 1 - .user_callback dd ? + .lvi_reg dd ? + .civ_val dd 1 + .user_callback dd ? - .ctrl_read8 dd ? - .ctrl_read16 dd ? - .ctrl_read32 dd ? + .ctrl_read8 dd ? + .ctrl_read16 dd ? + .ctrl_read32 dd ? - .ctrl_write8 dd ? - .ctrl_write16 dd ? - .ctrl_write32 dd ? + .ctrl_write8 dd ? + .ctrl_write16 dd ? + .ctrl_write32 dd ? -;Asper+ [ - .codec_mask dd ? - .rb dd ? - .rirb_rp dw 0 - .rirb_wp dw 0 - .corb_rp dw 0 - .corb_wp dw 0 - .rirb_cmd dd 0 - .rirb_res dd 0 - .rirb_error dd 0 - .response_reset dd 0 - .polling_mode db 0 - .poll_count db 0 - .posbuf dd ? - .start_wallclk dd ? ; start + minimum wallclk - .period_wallclk dd ? ; wallclk for period - .position_fix db ? -;Asper+ ] + .codec_mask dd ? + .rb dd ? + .rirb_rp dw 0 + .rirb_wp dw 0 + .corb_rp dw 0 + .corb_wp dw 0 + .rirb_cmd dd 0 + .rirb_res dd 0 + .rirb_error dd 0 + .response_reset dd 0 + .polling_mode db 0 + .poll_count db 0 + .posbuf dd ? + .start_wallclk dd ? ; start + minimum wallclk + .period_wallclk dd ? ; wallclk for period + .position_fix db ? } struc CODEC ;Audio Chip base class { -;Asper+ [ - .addr dd ? ; codec slot index (codec address) - .afg dd ? ; AFG node id - .mfg dd ? ; MFG node id + .addr dd ? ; codec slot index (codec address) + .afg dd ? ; AFG node id + .mfg dd ? ; MFG node id - .function_id dd ? - .subsystem_id dd ? - .revision_id dd ? - .chip_id dw ? - .vendor_id dw ? + .function_id dd ? + .subsystem_id dd ? + .revision_id dd ? + .chip_id dw ? + .vendor_id dw ? - ; widget capabilities cache - .num_nodes dw ? - .start_nid dw ? - .wcaps dd ? + ; widget capabilities cache + .num_nodes dw ? + .start_nid dw ? + .wcaps dd ? - .init_pins dd ? ; initial (BIOS) pin configurations - .num_pins dd ? ;Asper + : word is enough, but for align... - .beeper_nid dw ? - .pad dw ? -;Asper+ ] + .init_pins dd ? ; initial (BIOS) pin configurations + .num_pins dd ? ;Asper + : word is enough, but for align... + .beeper_nid dw ? + .pad dw ? - .ac_vendor_ids dd ? ;ac vendor id string - .chip_ids dd ? ;chip model string + .ac_vendor_ids dd ? ;ac vendor id string + .chip_ids dd ? ;chip model string } struc CTRL_INFO -{ .pci_cmd dd ? - .irq dd ? - .glob_cntrl dd ? - .glob_sta dd ? - .codec_io_base dd ? - .ctrl_io_base dd ? - .codec_mem_base dd ? - .ctrl_mem_base dd ? - .codec_id dd ? +{ + .pci_cmd dd ? + .irq dd ? + .glob_cntrl dd ? + .glob_sta dd ? + .codec_io_base dd ? + .ctrl_io_base dd ? + .codec_mem_base dd ? + .ctrl_mem_base dd ? + .codec_id dd ? } struc IOCTL -{ .handle dd ? - .io_code dd ? - .input dd ? - .inp_size dd ? - .output dd ? - .out_size dd ? +{ + .handle dd ? + .io_code dd ? + .input dd ? + .inp_size dd ? + .output dd ? + .out_size dd ? } -virtual at 0 - IOCTL IOCTL -end virtual - EVENT_NOTIFY equ 0x00000200 ; Macroses by CleverMouse @@ -481,7 +473,7 @@ macro spin_lock push eax ebx mov eax, aspinlock mov ebx, SPINLOCK_BUSY - @@: +@@: lock xchg [eax], ebx cmp ebx, SPINLOCK_FREE jnz @b @@ -494,169 +486,184 @@ macro spin_unlock mov eax, aspinlock mov eax, aspinlock mov ebx, SPINLOCK_FREE -lock xchg [eax], ebx + lock xchg [eax], ebx pop ebx eax } -public START -public service_proc -public version +data fixups +end data -section '.flat' code readable align 16 +include '../../struct.inc' +include '../../macros.inc' +include '../../proc32.inc' +include '../../peimport.inc' +include 'CODEC_H.INC' -proc START stdcall, state:dword +entry START +section '.flat' readable writable executable - cmp [state], 1 - jne .stop +;proc START stdcall, state:dword +proc START c, state:dword, cmdline:dword + push ebx esi ; save used registers to be stdcall +virtual at esp + rd 2 ; saved registers + dd ? ; return address +.reason dd ? ; DRV_ENTRY or DRV_EXIT +.cmdline dd ? ; normally NULL +end virtual +; 1. Check the reason for the call, do nothing unless initializing. + ;cmp [.reason], DRV_ENTRY + ;jne .stop - if DEBUG - mov esi, msgTV - call SysMsgBoardStr +if DEBUG + mov esi, msgTV + invoke SysMsgBoardStr - mov esi, msgInit - call SysMsgBoardStr - end if + mov esi, msgInit + invoke SysMsgBoardStr +end if - call detect_controller - test eax, eax - jz .fail + call detect_controller + test eax, eax + jz .fail - mov esi,[ctrl.vendor_ids] - call SysMsgBoardStr - mov esi, [ctrl.ctrl_ids] - call SysMsgBoardStr + mov esi,[ctrl.vendor_ids] + invoke SysMsgBoardStr + mov esi, [ctrl.ctrl_ids] + invoke SysMsgBoardStr - call init_controller - test eax, eax - jz .fail + call init_controller + test eax, eax + jz .fail ;Asper This part is from "azx_create" proc. [ - ;(...) - mov [ctrl.position_fix], POS_FIX_LPIB - cmp [driver_type], AZX_DRIVER_VIA - je .set_via_patch - cmp [driver_type], AZX_DRIVER_ATI - jne .no_via_patch - .set_via_patch: - or [ctrl.position_fix], POS_FIX_VIACOMBO - .no_via_patch: - ; codec detection - mov eax, [ctrl.codec_mask] - test eax, eax - jnz @f - if DEBUG - mov esi, msgNoCodecsFound - jmp .fail_msg - else - jmp .fail - end if - @@: + mov [ctrl.position_fix], POS_FIX_LPIB + cmp [driver_type], AZX_DRIVER_VIA + je .set_via_patch + cmp [driver_type], AZX_DRIVER_ATI + jne .no_via_patch +.set_via_patch: + or [ctrl.position_fix], POS_FIX_VIACOMBO +.no_via_patch: + ; codec detection + mov eax, [ctrl.codec_mask] + test eax, eax + jnz @f +if DEBUG + mov esi, msgNoCodecsFound + jmp .fail_msg +else + jmp .fail +end if +@@: ;Asper ] - mov esi, msgPrimBuff - call SysMsgBoardStr - call create_primary_buff - mov esi, msgDone - call SysMsgBoardStr + mov esi, msgPrimBuff + invoke SysMsgBoardStr + call create_primary_buff + mov esi, msgDone + invoke SysMsgBoardStr - if IRQ_REMAP - pushf - cli +if IRQ_REMAP + pushf + cli - mov ebx, [ctrl.int_line] - in al, 0xA1 - mov ah, al - in al, 0x21 - test ebx, ebx - jz .skip - bts ax, bx ;mask old line + mov ebx, [ctrl.int_line] + in al, 0xA1 + mov ah, al + in al, 0x21 + test ebx, ebx + jz .skip + bts ax, bx ;mask old line .skip - bts ax, IRQ_LINE ;mask new ine - out 0x21, al - mov al, ah - out 0xA1, al + bts ax, IRQ_LINE ;mask new line + out 0x21, al + mov al, ah + out 0xA1, al ;remap IRQ - stdcall PciWrite8, 0, 0xF8, 0x61, IRQ_LINE + invoke PciWrite8, 0, 0xF8, 0x61, IRQ_LINE - mov dx, 0x4d0 ;8259 ELCR1 - in al, dx - bts ax, IRQ_LINE - out dx, al ;set level-triggered mode - mov [ctrl.int_line], IRQ_LINE - popf - mov esi, msgRemap - call SysMsgBoardStr - end if + mov dx, 0x4d0 ;8259 ELCR1 + in al, dx + bts ax, IRQ_LINE + out dx, al ;set level-triggered mode + mov [ctrl.int_line], IRQ_LINE + popf + mov esi, msgRemap + invoke SysMsgBoardStr +end if - mov ebx, [ctrl.int_line] - stdcall AttachIntHandler, ebx, hda_irq, dword 0 + mov ebx, [ctrl.int_line] + invoke AttachIntHandler, ebx, hda_irq, dword 0 ;Asper This part is from "azx_probe" proc. [ - call azx_codec_create - cmp eax, 0 - jl .fail + call azx_codec_create + cmp eax, 0 + jl .fail - call azx_codec_configure - cmp eax, 0 - jl .fail + call azx_codec_configure + cmp eax, 0 + jl .fail ;] Asper - ; create PCM streams + ; create PCM streams ;Asper+ [ - mov eax, [spec.dac_node] - if DEBUG - push eax esi - mov esi, msgVal - call SysMsgBoardStr - stdcall fdword2str, 3 - call SysMsgBoardStr - pop esi eax - end if + mov eax, [spec.dac_node] +if DEBUG ;- + push eax esi + mov esi, msgVal + invoke SysMsgBoardStr + stdcall fdword2str, 3 + invoke SysMsgBoardStr + pop esi eax +end if - test eax, eax - jz .fail - mov ebx, [spec.dac_node+4] - if DEBUG - push eax esi - mov esi, msgVal - call SysMsgBoardStr - mov eax, [spec.dac_node+4] - stdcall fdword2str, 3 - call SysMsgBoardStr - pop esi eax - end if + test eax, eax + jz .fail + mov ebx, [spec.dac_node+4] +if DEBUG ;- + push eax esi + mov esi, msgVal + invoke SysMsgBoardStr + mov eax, [spec.dac_node+4] + stdcall fdword2str, 3 + invoke SysMsgBoardStr + pop esi eax +end if - test ebx, ebx - jz @f - cmp eax, ebx - je @f - stdcall hda_codec_setup_stream, ebx, SDO_TAG, 0, 0x11 ; Left & Right channels (Front panel) - @@: - stdcall hda_codec_setup_stream, eax, SDO_TAG, 0, 0x11 ; Left & Right channels (Back panel) + test ebx, ebx + jz @f + cmp eax, ebx + je @f + stdcall hda_codec_setup_stream, ebx, SDO_TAG, 0, 0x11 ; Left & Right channels (Front panel) +@@: + stdcall hda_codec_setup_stream, eax, SDO_TAG, 0, 0x11 ; Left & Right channels (Back panel) ;Asper+ ] - if USE_SINGLE_MODE - mov esi, msgSingleMode - call SysMsgBoardStr - else - mov esi, msgNormalMode - call SysMsgBoardStr - end if - +if USE_SINGLE_MODE + mov esi, msgSingleMode + invoke SysMsgBoardStr +else + mov esi, msgNormalMode + invoke SysMsgBoardStr +end if .reg: - stdcall RegService, sz_sound_srv, service_proc - ret + invoke RegService, sz_sound_srv, service_proc + pop esi ebx + ret .fail: - mov esi, msgFail + mov esi, msgFail .fail_msg: - call SysMsgBoardStr - xor eax, eax - ret + invoke SysMsgBoardStr + pop esi ebx + xor eax, eax + ret .stop: - call stop - xor eax, eax - ret + call stop + pop esi ebx + xor eax, eax + ret endp handle equ IOCTL.handle @@ -668,546 +675,531 @@ out_size equ IOCTL.out_size align 4 proc service_proc stdcall, ioctl:dword - mov edi, [ioctl] - mov eax, [edi+io_code] + mov edi, [ioctl] + mov eax, [edi+io_code] - cmp eax, SRV_GETVERSION - jne @F + cmp eax, SRV_GETVERSION + jne @F - mov eax, [edi+output] - cmp [edi+out_size], 4 - jne .fail + mov eax, [edi+output] + cmp [edi+out_size], 4 + jne .fail - mov [eax], dword API_VERSION - xor eax, eax - ret + mov [eax], dword API_VERSION + xor eax, eax + ret @@: - cmp eax, DEV_PLAY - jne @F - if DEBUG - mov esi, msgPlay - call SysMsgBoardStr - end if - call play - xor eax, eax - ret + cmp eax, DEV_PLAY + jne @F +if DEBUG + mov esi, msgPlay + invoke SysMsgBoardStr +end if + call play + xor eax, eax + ret @@: - cmp eax, DEV_STOP - jne @F - if DEBUG - mov esi, msgStop - call SysMsgBoardStr - end if - call stop - xor eax, eax - ret + cmp eax, DEV_STOP + jne @F +if DEBUG + mov esi, msgStop + invoke SysMsgBoardStr +end if + call stop + xor eax, eax + ret @@: - cmp eax, DEV_CALLBACK - jne @f - mov ebx, [edi+input] - stdcall set_callback, [ebx] - xor eax, eax - ret + cmp eax, DEV_CALLBACK + jne @f + mov ebx, [edi+input] + stdcall set_callback, [ebx] + xor eax, eax + ret @@: - cmp eax, DEV_SET_MASTERVOL - jne @f - mov eax, [edi+input] - mov eax, [eax] - call set_master_vol - xor eax, eax - ret + cmp eax, DEV_SET_MASTERVOL + jne @f + mov eax, [edi+input] + mov eax, [eax] + call set_master_vol + xor eax, eax + ret @@: - cmp eax, DEV_GET_MASTERVOL - jne @f - mov ebx, [edi+output] - stdcall get_master_vol, ebx - xor eax, eax - ret + cmp eax, DEV_GET_MASTERVOL + jne @f + mov ebx, [edi+output] + stdcall get_master_vol, ebx + xor eax, eax + ret ;@@: -; cmp eax, DEV_GET_INFO -; jne @f -; mov ebx, [edi+output] -; stdcall get_dev_info, ebx -; xor eax, eax -; ret +; cmp eax, DEV_GET_INFO +; jne @f +; mov ebx, [edi+output] +; stdcall get_dev_info, ebx +; xor eax, eax +; ret @@: - cmp eax, DEV_GET_POS - jne @f - stdcall azx_get_position - shr eax, 2 - mov ebx, [edi+output] - mov [ebx], eax - xor eax, eax - ret + cmp eax, DEV_GET_POS + jne @f + stdcall azx_get_position + shr eax, 2 + mov ebx, [edi+output] + mov [ebx], eax + xor eax, eax + ret @@: -; cmp eax, DEV_SET_CHANNEL_VOLUME -; jne @f -; if DEBUG -; mov esi, msgSetChannelVolume -; call SysMsgBoardStr -; end if -; mov ebx, [edi+input] -; mov cl, byte [ebx] ; cl=channel -; mov eax, dword [ebx+1] ; eax=volume in Db -; if DEBUG -; push eax esi -; mov esi, msgYAHOO1 -; call SysMsgBoardStr -; stdcall fdword2str, 1 -; call SysMsgBoardStr -; mov esi, strSemicolon -; call SysMsgBoardStr -; movzx eax, cl -; stdcall fdword2str, 3 -; call SysMsgBoardStr -; pop esi eax -; end if -; -; call set_channel_volume -; xor eax, eax -; ret +; cmp eax, DEV_SET_CHANNEL_VOLUME +; jne @f +;if DEBUG +; mov esi, msgSetChannelVolume +; invoke SysMsgBoardStr +;end if +; mov ebx, [edi+input] +; mov cl, byte [ebx] ; cl=channel +; mov eax, dword [ebx+1] ; eax=volume in Db +;if DEBUG +; push eax esi +; mov esi, msgYAHOO1 +; invoke SysMsgBoardStr +; stdcall fdword2str, 1 +; invoke SysMsgBoardStr +; mov esi, strSemicolon +; invoke SysMsgBoardStr +; movzx eax, cl +; stdcall fdword2str, 3 +; invoke SysMsgBoardStr +; pop esi eax +;end if +; ; call set_channel_volume +; xor eax, eax +; ret ;@@: -; cmp eax, DEV_GET_CHANNEL_VOLUME -; jne @f -; mov cl, byte [edi+input] ; cl=channel -; call get_channel_volume -; mov ebx, [edi+output] -; mov [ebx], eax -; xor eax, eax -; ret +; cmp eax, DEV_GET_CHANNEL_VOLUME +; jne @f +; mov cl, byte [edi+input] ; cl=channel +; call get_channel_volume +; mov ebx, [edi+output] +; mov [ebx], eax +; xor eax, eax +; ret ;@@: ;Asper: Non standard system service. For the tests only! [ @@: - cmp eax, DEV_EXEC_CODEC_CMD - jne @f + cmp eax, DEV_EXEC_CODEC_CMD + jne @f - mov eax, [edi+input] - mov eax, [eax] - stdcall codec_exec_verb, eax - xor eax, eax - ret + mov eax, [edi+input] + mov eax, [eax] + stdcall codec_exec_verb, eax + xor eax, eax + ret @@: ;Asper: Non standard system service. For the tests only! ] - .fail: - or eax, -1 - ret + or eax, -1 + ret endp -restore handle -restore io_code -restore input -restore inp_size -restore output -restore out_size +restore handle +restore io_code +restore input +restore inp_size +restore output +restore out_size align 4 proc hda_irq ;+ - spin_lock - if DEBUG_IRQ - push eax esi - ;mov esi, msgIRQ - ;call SysMsgBoardStr - call GetTimerTicks - stdcall fdword2str, 2 - call SysMsgBoardStr - pop esi eax - end if - mov edx, ICH6_REG_INTSTS - call azx_readl - test eax, eax - jnz @f - spin_unlock - ret - @@: - mov ebx, eax ; status - mov eax, SDO_INT - test ebx, eax - jz @f + spin_lock +if DEBUG_IRQ + push eax esi + ;mov esi, msgIRQ + ;invoke SysMsgBoardStr + call GetTimerTicks + stdcall fdword2str, 2 + invoke SysMsgBoardStr + pop esi eax +end if + mov edx, ICH6_REG_INTSTS + call azx_readl + test eax, eax + jnz @f + spin_unlock + ret +@@: + mov ebx, eax ; status + mov eax, SDO_INT + test ebx, eax + jz @f - mov edx, ICH6_REG_SD_STS + SDO_OFS - call azx_readb - mov bl, al + mov edx, ICH6_REG_SD_STS + SDO_OFS + call azx_readb + mov bl, al - mov al, SD_INT_MASK - mov edx, ICH6_REG_SD_STS + SDO_OFS - call azx_writeb + mov al, SD_INT_MASK + mov edx, ICH6_REG_SD_STS + SDO_OFS + call azx_writeb - test bl, SD_INT_COMPLETE - jz @f + test bl, SD_INT_COMPLETE + jz @f - mov eax, [ctrl.civ_val] - inc eax - and eax, 4-1 ;2-1 - mov [ctrl.civ_val], eax + mov eax, [ctrl.civ_val] + inc eax + and eax, 4-1 ;2-1 + mov [ctrl.civ_val], eax - mov ebx, dword [buff_list+eax*4] - cmp [ctrl.user_callback], 0 - je @f - stdcall [ctrl.user_callback], ebx + mov ebx, dword [buff_list+eax*4] + cmp [ctrl.user_callback], 0 + je @f + stdcall [ctrl.user_callback], ebx +@@: + ; clear rirb int + mov edx, ICH6_REG_RIRBSTS + call azx_readb - @@: + test al, RIRB_INT_MASK + jz .l1 + test al, RIRB_INT_RESPONSE + jz .l2 - ; clear rirb int - mov edx, ICH6_REG_RIRBSTS - call azx_readb - - test al, RIRB_INT_MASK - jz .l1 - test al, RIRB_INT_RESPONSE - jz .l2 - - cmp byte [driver_type], AZX_DRIVER_CTX - jne @f - mov eax, 80 ; wait 80 us - call StallExec - @@: - - call azx_update_rirb - .l2: - mov al, RIRB_INT_MASK - mov edx, ICH6_REG_RIRBSTS - call azx_writeb - .l1: + cmp byte [driver_type], AZX_DRIVER_CTX + jne @f + mov eax, 80 ; wait 80 us + call StallExec +@@: + call azx_update_rirb +.l2: + mov al, RIRB_INT_MASK + mov edx, ICH6_REG_RIRBSTS + call azx_writeb +.l1: ;if 0 ; clear state status int - mov edx, ICH6_REG_STATESTS - call azx_readb - test al, 0x04 - jz @f + mov edx, ICH6_REG_STATESTS + call azx_readb + test al, 0x04 + jz @f - mov al, 0x04 - mov edx, ICH6_REG_STATESTS - call azx_writeb - @@: + mov al, 0x04 + mov edx, ICH6_REG_STATESTS + call azx_writeb +@@: ;end if - or eax, 1 - spin_unlock - ret + or eax, 1 + spin_unlock + ret endp align 4 proc create_primary_buff - stdcall KernelAlloc, 4096 - mov [ctrl.posbuf], eax + invoke KernelAlloc, 4096 + mov [ctrl.posbuf], eax - stdcall KernelAlloc, 0x10000 ;0x8000 - mov [ctrl.buffer], eax + invoke KernelAlloc, 0x10000 ;0x8000 + mov [ctrl.buffer], eax - mov edi, eax - mov ecx, 0x10000/4 ;0x8000/4 - xor eax, eax - cld - rep stosd + mov edi, eax + mov ecx, 0x10000/4 ;0x8000/4 + xor eax, eax + cld + rep stosd + invoke KernelAlloc, 4096 + mov [pcmout_bdl], eax - stdcall KernelAlloc, 4096 - mov [pcmout_bdl], eax + mov edi, eax + mov ecx, 4096/4 + xor eax, eax + cld + rep stosd - mov edi, eax - mov ecx, 4096/4 - xor eax, eax - cld - rep stosd + ; reset BDL address + xor eax, eax + mov edx, ICH6_REG_SD_BDLPL + SDO_OFS + call azx_writel + xor eax, eax + mov edx, ICH6_REG_SD_BDLPU + SDO_OFS + call azx_writel + ; program the initial BDL entries + mov eax, [ctrl.buffer] + mov ebx, eax + invoke GetPgAddr + and ebx, 0xFFF + add eax, ebx - ; reset BDL address - xor eax, eax - mov edx, ICH6_REG_SD_BDLPL + SDO_OFS - call azx_writel - xor eax, eax - mov edx, ICH6_REG_SD_BDLPU + SDO_OFS - call azx_writel + mov ebx, 0x4000 ;buffer size + mov ecx, 8 ;number of periods + mov edi, [pcmout_bdl] ;pcmout_bdl +.next_period: + push eax ecx + mov ecx, 4 ;2 ;number of bdl in a period +.next_bdl: + ; program the address field of the BDL entry + mov dword [edi], eax + mov dword [edi+4], 0 + ; program the size field of the BDL entry + mov dword [edi+8], ebx + ; program the IOC to enable interrupt when buffer completes + mov dword [edi+12], 0x01 - ; program the initial BDL entries - mov eax, [ctrl.buffer] - mov ebx, eax - call GetPgAddr - and ebx, 0xFFF - add eax, ebx + add eax, ebx + add edi, 16 + dec ecx + jnz .next_bdl + pop ecx eax + dec ecx + jnz .next_period - mov ebx, 0x4000 ;buffer size - mov ecx, 8 ;number of periods - mov edi, [pcmout_bdl] ;pcmout_bdl - .next_period: - push eax ecx - mov ecx, 4 ;2 ;number of bdl in a period - .next_bdl: - ; program the address field of the BDL entry - mov dword [edi], eax - mov dword [edi+4], 0 - ; program the size field of the BDL entry - mov dword [edi+8], ebx - ; program the IOC to enable interrupt when buffer completes - mov dword [edi+12], 0x01 - - - add eax, ebx - add edi, 16 - dec ecx - jnz .next_bdl - - pop ecx eax - dec ecx - jnz .next_period - - - mov edi, buff_list - mov eax, [ctrl.buffer] - mov ecx, 4 ;2 + mov edi, buff_list + mov eax, [ctrl.buffer] + mov ecx, 4 ;2 @@: - mov [edi], eax - mov [edi+8], eax - mov [edi+16], eax - mov [edi+24], eax - mov [edi+32], eax - mov [edi+40], eax - mov [edi+48], eax - mov [edi+56], eax + mov [edi], eax + mov [edi+8], eax + mov [edi+16], eax + mov [edi+24], eax + mov [edi+32], eax + mov [edi+40], eax + mov [edi+48], eax + mov [edi+56], eax - add eax, ebx - add edi, 4 - loop @B + add eax, ebx + add edi, 4 + loop @B - ; wallclk has 24Mhz clock source - mov [ctrl.period_wallclk], ((0x4000 * 24000) / 48000) * 1000 + ; wallclk has 24Mhz clock source + mov [ctrl.period_wallclk], ((0x4000 * 24000) / 48000) * 1000 - call azx_stream_reset - call azx_setup_controller - ret + call azx_stream_reset + call azx_setup_controller + ret endp align 4 proc detect_controller - locals - last_bus dd ? - bus dd ? - devfn dd ? - endl +locals + last_bus dd ? + bus dd ? + devfn dd ? +endl + xor eax, eax + mov [bus], eax + inc eax + invoke PciApi + cmp eax, -1 + je .err - xor eax, eax - mov [bus], eax - inc eax - call PciApi - cmp eax, -1 - je .err + mov [last_bus], eax - mov [last_bus], eax +.next_bus: + and [devfn], 0 +.next_dev: + invoke PciRead32, [bus], [devfn], dword 0 + test eax, eax + jz .next + cmp eax, -1 + je .next - .next_bus: - and [devfn], 0 - .next_dev: - stdcall PciRead32, [bus], [devfn], dword 0 - test eax, eax - jz .next - cmp eax, -1 - je .next + mov edi, devices +@@: + mov ebx, [edi] + test ebx, ebx + jz .next - mov edi, devices - @@: - mov ebx, [edi] - test ebx, ebx - jz .next + cmp eax, ebx + je .found + add edi, 12 + jmp @b +.next: + inc [devfn] + cmp [devfn], 256 + jb .next_dev + mov eax, [bus] + inc eax + mov [bus], eax + cmp eax, [last_bus] + jna .next_bus + xor eax, eax + ret +.found: + mov ebx, [bus] + mov [ctrl.bus], ebx - cmp eax, ebx - je .found - add edi, 12 - jmp @B - .next: - inc [devfn] - cmp [devfn], 256 - jb .next_dev - mov eax, [bus] - inc eax - mov [bus], eax - cmp eax, [last_bus] - jna .next_bus - xor eax, eax - ret - .found: - mov ebx, [bus] - mov [ctrl.bus], ebx + mov ecx, [devfn] + mov [ctrl.devfn], ecx - mov ecx, [devfn] - mov [ctrl.devfn], ecx + mov edx, eax + and edx, 0xFFFF + mov [ctrl.vendor], dx + shr eax, 16 + mov [ctrl.dev_id], ax - mov edx, eax - and edx, 0xFFFF - mov [ctrl.vendor], dx - shr eax, 16 - mov [ctrl.dev_id], ax + mov ebx, [edi+4] + mov [ctrl.ctrl_ids], ebx - mov ebx, [edi+4] - mov [ctrl.ctrl_ids], ebx - - cmp edx, VID_INTEL - jne @F - mov [ctrl.vendor_ids], msg_Intel - jmp .ok - @@: - cmp edx, VID_NVIDIA - jne @F - mov [ctrl.vendor_ids], msg_NVidia - jmp .ok - @@: - cmp edx, VID_ATI - jne @F - cmp eax, 0x4383 - jg .ati_hdmi - mov [ctrl.vendor_ids], msg_ATI - jmp .ok - .ati_hdmi: - mov [ctrl.vendor_ids], msg_ATI_HDMI - jmp .ok - @@: - cmp edx, VID_AMD - jne @F - mov [ctrl.vendor_ids], msg_AMD - jmp .ok - @@: - cmp edx, VID_VIA - jne @F - mov [ctrl.vendor_ids], msg_VIA - jmp .ok - @@: - cmp edx, VID_SIS - jne @F - mov [ctrl.vendor_ids], msg_SIS - jmp .ok - @@: - cmp edx, VID_ULI - jne @F - mov [ctrl.vendor_ids], msg_ULI - jmp .ok - @@: - cmp edx, VID_TERA - jne @F - mov [ctrl.vendor_ids], msg_TERA - jmp .ok - @@: - cmp edx, VID_CREATIVE - jne @F - mov [ctrl.vendor_ids], msg_CREATIVE - jmp .ok - @@: - cmp edx, VID_RDC - jne @F - mov [ctrl.vendor_ids], msg_RDC - jmp .ok - @@: - cmp edx, VID_VMWARE - jne @F - mov [ctrl.vendor_ids], msg_VMWARE - jmp .ok - @@: - .err: - xor eax, eax - mov [ctrl.vendor_ids], eax ;something wrong ? - mov [driver_type], -1 - ret - .ok: - mov ebx, [edi+8] - mov [driver_type], ebx - ret + cmp edx, VID_INTEL + jne @f + mov [ctrl.vendor_ids], msg_Intel + jmp .ok +@@: + cmp edx, VID_NVIDIA + jne @f + mov [ctrl.vendor_ids], msg_NVidia + jmp .ok +@@: + cmp edx, VID_ATI + jne @f + cmp eax, 0x4383 + jg .ati_hdmi + mov [ctrl.vendor_ids], msg_ATI + jmp .ok +.ati_hdmi: + mov [ctrl.vendor_ids], msg_ATI_HDMI + jmp .ok +@@: + cmp edx, VID_AMD + jne @f + mov [ctrl.vendor_ids], msg_AMD + jmp .ok +@@: + cmp edx, VID_VIA + jne @f + mov [ctrl.vendor_ids], msg_VIA + jmp .ok +@@: + cmp edx, VID_SIS + jne @f + mov [ctrl.vendor_ids], msg_SIS + jmp .ok +@@: + cmp edx, VID_ULI + jne @f + mov [ctrl.vendor_ids], msg_ULI + jmp .ok +@@: + cmp edx, VID_TERA + jne @f + mov [ctrl.vendor_ids], msg_TERA + jmp .ok +@@: + cmp edx, VID_CREATIVE + jne @f + mov [ctrl.vendor_ids], msg_CREATIVE + jmp .ok +@@: + cmp edx, VID_RDC + jne @f + mov [ctrl.vendor_ids], msg_RDC + jmp .ok +@@: + cmp edx, VID_VMWARE + jne @f + mov [ctrl.vendor_ids], msg_VMWARE + jmp .ok +@@: +.err: + xor eax, eax + mov [ctrl.vendor_ids], eax ;something wrong ? + mov [driver_type], -1 + ret +.ok: + mov ebx, [edi+8] + mov [driver_type], ebx + ret endp align 4 proc init_controller - stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 4 - test eax, 0x4 ; Test Master bit - jnz @f - or eax, 0x4 ; Set Master bit - stdcall PciWrite32, [ctrl.bus], [ctrl.devfn], dword 4, eax - stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 4 - @@: + invoke PciRead32, [ctrl.bus], [ctrl.devfn], dword 4 + test eax, 0x4 ; Test Master bit + jnz @f + or eax, 0x4 ; Set Master bit + invoke PciWrite32, [ctrl.bus], [ctrl.devfn], dword 4, eax + invoke PciRead32, [ctrl.bus], [ctrl.devfn], dword 4 +@@: + mov ebx, eax + and eax, 0xFFFF + mov [ctrl.pci_cmd], eax + shr ebx, 16 + mov [ctrl.pci_stat], ebx - mov ebx, eax - and eax, 0xFFFF - mov [ctrl.pci_cmd], eax - shr ebx, 16 - mov [ctrl.pci_stat], ebx + mov esi, msgPciCmd + invoke SysMsgBoardStr + stdcall fdword2str, 2 + invoke SysMsgBoardStr - mov esi, msgPciCmd - call SysMsgBoardStr - stdcall fdword2str, 2 - call SysMsgBoardStr + mov esi, msgPciStat + invoke SysMsgBoardStr + mov eax, [ctrl.pci_stat] + stdcall fdword2str, 2 + invoke SysMsgBoardStr - mov esi, msgPciStat - call SysMsgBoardStr - mov eax, [ctrl.pci_stat] - stdcall fdword2str, 2 - call SysMsgBoardStr + mov esi, msgHDALowMMIo + invoke SysMsgBoardStr + invoke PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x10 + stdcall fdword2str, 2 + invoke SysMsgBoardStr - mov esi, msgHDALowMMIo - call SysMsgBoardStr - stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x10 - stdcall fdword2str, 2 - call SysMsgBoardStr + and eax, 0xFFFFC000 + mov [ctrl.ctrl_mem_base], eax - and eax, 0xFFFFC000 - mov [ctrl.ctrl_mem_base], eax + mov esi, msgHDAUpMMIo + invoke SysMsgBoardStr + invoke PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x14 + ;-mov [ctrl.hda_upper_mem_base], eax + stdcall fdword2str, 2 + invoke SysMsgBoardStr - mov esi, msgHDAUpMMIo - call SysMsgBoardStr - stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x14 - ;-mov [ctrl.hda_upper_mem_base], eax - stdcall fdword2str, 2 - call SysMsgBoardStr +.default: + invoke PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x3C + and eax, 0xFF +@@: + mov [ctrl.int_line], eax + mov [ctrl.user_callback], 0 - .default: - stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x3C - and eax, 0xFF - @@: - mov [ctrl.int_line], eax - mov [ctrl.user_callback], 0 - - call set_HDA + call set_HDA ;Asper This is from "azx_create" proc. [ - xor eax, eax - mov edx, ICH6_REG_GCAP - call azx_readw - if DEBUG - mov esi, msgGCap - call SysMsgBoardStr - stdcall fdword2str, 2 - call SysMsgBoardStr - end if + xor eax, eax + mov edx, ICH6_REG_GCAP + call azx_readw +if DEBUG + mov esi, msgGCap + invoke SysMsgBoardStr + stdcall fdword2str, 2 + invoke SysMsgBoardStr +end if + ; allocate CORB/RIRB + call azx_alloc_cmd_io - ; allocate CORB/RIRB - call azx_alloc_cmd_io + ; initialize chip + call azx_init_pci - ; initialize chip - call azx_init_pci - - xor eax, eax - call azx_init_chip + xor eax, eax + call azx_init_chip ;] Asper - xor eax, eax - inc eax - ret + xor eax, eax + inc eax + ret endp - -PG_SW equ 0x003 -PG_NOCACHE equ 0x018 +PG_SW equ 0x003 +PG_NOCACHE equ 0x018 align 4 proc set_HDA - - stdcall MapIoMem,[ctrl.ctrl_mem_base],0x1000,PG_SW+PG_NOCACHE - mov [ctrl.ctrl_mem_base], eax - ret + invoke MapIoMem,[ctrl.ctrl_mem_base],0x1000,PG_SW+PG_NOCACHE + mov [ctrl.ctrl_mem_base], eax + ret endp @@ -1216,213 +1208,213 @@ endp ; reset codec link align 4 proc reset_controller - locals - counter dd ? - endl +locals + counter dd ? +endl - test eax, eax - jz .skip + test eax, eax + jz .skip - ; clear STATESTS - mov eax, STATESTS_INT_MASK - mov edx, ICH6_REG_STATESTS - call azx_writeb + ; clear STATESTS + mov eax, STATESTS_INT_MASK + mov edx, ICH6_REG_STATESTS + call azx_writeb - ; reset controller - mov edx, ICH6_REG_GCTL - call azx_readl - mov ebx, ICH6_GCTL_RESET - xor ebx, -1 - and eax, ebx - mov edx, ICH6_REG_GCTL - call azx_writel + ; reset controller + mov edx, ICH6_REG_GCTL + call azx_readl + mov ebx, ICH6_GCTL_RESET + xor ebx, -1 + and eax, ebx + mov edx, ICH6_REG_GCTL + call azx_writel - mov [counter], 50 ; total 50*100 us = 0.5s - .wait0: + mov [counter], 50 ; total 50*100 us = 0.5s +.wait0: - mov edx, ICH6_REG_GCTL - call azx_readb - test eax, eax - jz @f + mov edx, ICH6_REG_GCTL + call azx_readb + test eax, eax + jz @f - mov eax, 100 ; wait 100 us - call StallExec + mov eax, 100 ; wait 100 us + call StallExec - dec [counter] - jnz .wait0 - @@: - ; delay for >= 100us for codec PLL to settle per spec - ; Rev 0.9 section 5.5.1 - mov eax, 100 ; wait 100 us - call StallExec + dec [counter] + jnz .wait0 +@@: + ; delay for >= 100us for codec PLL to settle per spec + ; Rev 0.9 section 5.5.1 + mov eax, 100 ; wait 100 us + call StallExec - ; Bring controller out of reset - mov edx, ICH6_REG_GCTL - call azx_readb - or eax, ICH6_GCTL_RESET - mov edx, ICH6_REG_GCTL - call azx_writeb + ; Bring controller out of reset + mov edx, ICH6_REG_GCTL + call azx_readb + or eax, ICH6_GCTL_RESET + mov edx, ICH6_REG_GCTL + call azx_writeb - mov [counter], 50 ; total 50*100 us = 0.5s - .wait1: + mov [counter], 50 ; total 50*100 us = 0.5s +.wait1: - mov edx, ICH6_REG_GCTL - call azx_readb - test eax, eax - jnz @f + mov edx, ICH6_REG_GCTL + call azx_readb + test eax, eax + jnz @f - mov eax, 100 ; wait 100 us - call StallExec + mov eax, 100 ; wait 100 us + call StallExec - dec [counter] - jnz .wait1 - @@: + dec [counter] + jnz .wait1 +@@: - ; Brent Chartrand said to wait >= 540us for codecs to intialize - mov eax, 540 ; wait 540 us - call StallExec + ; Brent Chartrand said to wait >= 540us for codecs to intialize + mov eax, 540 ; wait 540 us + call StallExec - .skip: - ; check to see if controller is ready - mov edx, ICH6_REG_GCTL - call azx_readb - test eax, eax - jz .fail +.skip: + ; check to see if controller is ready + mov edx, ICH6_REG_GCTL + call azx_readb + test eax, eax + jz .fail - ; Accept unsolicited responses - if USE_SINGLE_MODE - else + ; Accept unsolicited responses +if USE_SINGLE_MODE +else if USE_UNSOL_EV ;UNSUPPORTED YET! [ -; mov edx, ICH6_REG_GCTL -; call azx_readl -; or eax, ICH6_GCTL_UNSOL -; mov edx, ICH6_REG_GCTL -; call azx_writel + mov edx, ICH6_REG_GCTL + call azx_readl + or eax, ICH6_GCTL_UNSOL + mov edx, ICH6_REG_GCTL + call azx_writel ;UNSUPPORTED YET! ] - end if +end if - ; detect codecs - mov eax, [ctrl.codec_mask] - test ax, ax - jnz @f + ; detect codecs + mov eax, [ctrl.codec_mask] + test ax, ax + jnz @f - mov edx, ICH6_REG_STATESTS - call azx_readw - mov [ctrl.codec_mask], eax + mov edx, ICH6_REG_STATESTS + call azx_readw + mov [ctrl.codec_mask], eax - if DEBUG - mov esi, msgCodecMask - call SysMsgBoardStr - stdcall fdword2str, 2 - call SysMsgBoardStr - end if +if DEBUG + mov esi, msgCodecMask + invoke SysMsgBoardStr + stdcall fdword2str, 2 + invoke SysMsgBoardStr +end if - @@: +@@: - .ok: - clc - ret - .fail: - if DEBUG - mov esi, msgHDARFail - call SysMsgBoardStr - end if - stc - ret +.ok: + clc + ret +.fail: +if DEBUG + mov esi, msgHDARFail + invoke SysMsgBoardStr +end if + stc + ret endp align 4 play: - spin_lock_irq - mov edx, ICH6_REG_WALLCLK - call azx_readl - mov [ctrl.start_wallclk], eax + spin_lock_irq + mov edx, ICH6_REG_WALLCLK + call azx_readl + mov [ctrl.start_wallclk], eax - call azx_stream_start - xor eax, eax - spin_unlock_irq - ret + call azx_stream_start + xor eax, eax + spin_unlock_irq + ret align 4 stop: - spin_lock_irq -;* call azx_stream_stop ;Asper: Hangs system -;R push ebx ecx edx -;R ; stop DMA -;R mov edx, ICH6_REG_SD_CTL -;R call azx_sd_readb -;R mov bl, SD_CTL_DMA_START or SD_INT_MASK -;R xor bl, -1 -;R and al, bl -;R mov edx, ICH6_REG_SD_CTL -;R call azx_sd_writeb -;R mov edx, ICH6_REG_SD_STS -;R mov al, SD_INT_MASK -;R call azx_sd_writeb ; to be sure - ; disable SIE -;N mov edx, ICH6_REG_INTCTL -;N call azx_readb -;N mov bl, SDO_INT ;shl azx_dev->index -;N xor bl, -1 -;N and al, bl -;N mov edx, ICH6_REG_INTCTL -;N call azx_writeb + spin_lock_irq +;* call azx_stream_stop ;Asper: Hangs system +;R push ebx ecx edx +;R ; stop DMA +;R mov edx, ICH6_REG_SD_CTL +;R call azx_sd_readb +;R mov bl, SD_CTL_DMA_START or SD_INT_MASK +;R xor bl, -1 +;R and al, bl +;R mov edx, ICH6_REG_SD_CTL +;R call azx_sd_writeb +;R mov edx, ICH6_REG_SD_STS +;R mov al, SD_INT_MASK +;R call azx_sd_writeb ; to be sure + ; disable SIE +;N mov edx, ICH6_REG_INTCTL +;N call azx_readb +;N mov bl, SDO_INT ;shl azx_dev->index +;N xor bl, -1 +;N and al, bl +;N mov edx, ICH6_REG_INTCTL +;N call azx_writeb - ; int timeout = 5000; - ; while (azx_sd_readb(azx_dev, SD_CTL) & SD_CTL_DMA_START && --timeout) ; + ; int timeout = 5000; + ; while (azx_sd_readb(azx_dev, SD_CTL) & SD_CTL_DMA_START && --timeout) ; ;Asper: Hangs system [ -;* mov ecx, 5000 -;* .l1: -;* mov edx, ICH6_REG_SD_CTL -;* call azx_sd_readb -;* test al, SD_CTL_DMA_START -;* jz @f -;* dec ecx -;* jnz .l1 -;* @@: +;* mov ecx, 5000 +;*.l1: +;* mov edx, ICH6_REG_SD_CTL +;* call azx_sd_readb +;* test al, SD_CTL_DMA_START +;* jz @f +;* dec ecx +;* jnz .l1 +;*@@: ;* -;* pop edx ecx ebx +;* pop edx ecx ebx ;Asper ] - xor eax, eax - spin_unlock_irq - ret + xor eax, eax + spin_unlock_irq + ret ;align 4 -;proc get_dev_info stdcall, p_info:dword -; virtual at esi -; CTRL_INFO CTRL_INFO -; end virtual +;proc get_dev_info stdcall, p_info:dword ;deprecated +;virtual at esi +; CTRL_INFO CTRL_INFO +;end virtual ; -; mov esi, [p_info] -; mov eax, [ctrl.int_line] -; mov bx, [ctrl.dev_id] -; shl ebx, 16 -; and bx, [ctrl.vendor] -; mov ecx, [ctrl.pci_cmd] -; mov edx, [ctrl.codec_mem_base] ;[ctrl.hda_lower_mem_base] -; mov edi, [ctrl.ctrl_mem_base] ;[ctrl.hda_upper_mem_base] +; mov esi, [p_info] +; mov eax, [ctrl.int_line] +; mov bx, [ctrl.dev_id] +; shl ebx, 16 +; and bx, [ctrl.vendor] +; mov ecx, [ctrl.pci_cmd] +; mov edx, [ctrl.codec_mem_base] ;[ctrl.hda_lower_mem_base] +; mov edi, [ctrl.ctrl_mem_base] ;[ctrl.hda_upper_mem_base] ; -; mov [CTRL_INFO.irq], eax -; mov [CTRL_INFO.codec_id], ebx -; mov [CTRL_INFO.pci_cmd], ecx -; mov [CTRL_INFO.codec_mem_base], edx -; mov [CTRL_INFO.ctrl_mem_base], edi +; mov [CTRL_INFO.irq], eax +; mov [CTRL_INFO.codec_id], ebx +; mov [CTRL_INFO.pci_cmd], ecx +; mov [CTRL_INFO.codec_mem_base], edx +; mov [CTRL_INFO.ctrl_mem_base], edi ; -; xor eax, eax -; mov [CTRL_INFO.codec_io_base], eax -; mov [CTRL_INFO.ctrl_io_base], eax -; mov [CTRL_INFO.glob_cntrl], eax -; mov [CTRL_INFO.glob_sta], eax -; ret +; xor eax, eax +; mov [CTRL_INFO.codec_io_base], eax +; mov [CTRL_INFO.ctrl_io_base], eax +; mov [CTRL_INFO.glob_cntrl], eax +; mov [CTRL_INFO.glob_sta], eax +; ret ;endp align 4 proc set_callback stdcall, handler:dword - mov eax, [handler] - mov [ctrl.user_callback], eax - ret + mov eax, [handler] + mov [ctrl.user_callback], eax + ret endp @@ -1435,304 +1427,303 @@ endp ;; CORB / RIRB interface ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; -proc azx_alloc_cmd_io - push eax ecx edx - ; single page (at least 4096 bytes) must suffice for both ringbuffers - stdcall KernelAlloc, 4096 - mov [ctrl.rb], eax +proc azx_alloc_cmd_io + push eax ecx edx + ; single page (at least 4096 bytes) must suffice for both ringbuffers + invoke KernelAlloc, 4096 + mov [ctrl.rb], eax - mov edi, eax - mov ecx, 4096/4 - xor eax, eax - cld - rep stosd + mov edi, eax + mov ecx, 4096/4 + xor eax, eax + cld + rep stosd - pop edx ecx eax - ret + pop edx ecx eax + ret endp -proc azx_init_cmd_io - spin_lock_irq - pusha - ; CORB set up - mov eax, [ctrl.rb] - mov ebx, eax - call GetPgAddr - and ebx, 0xFFF - add eax, ebx - push eax ; save corb address - mov edx, ICH6_REG_CORBLBASE - call azx_writel - xor eax, eax - mov edx, ICH6_REG_CORBUBASE - call azx_writel +proc azx_init_cmd_io + spin_lock_irq + pusha + ; CORB set up + mov eax, [ctrl.rb] + mov ebx, eax + invoke GetPgAddr + and ebx, 0xFFF + add eax, ebx + push eax ; save corb address + mov edx, ICH6_REG_CORBLBASE + call azx_writel + xor eax, eax + mov edx, ICH6_REG_CORBUBASE + call azx_writel - ; set the corb size to 256 entries (ULI requires explicitly) - mov al, 0x02 - mov edx, ICH6_REG_CORBSIZE - call azx_writeb - ; set the corb write pointer to 0 - xor ax, ax - mov edx, ICH6_REG_CORBWP - call azx_writew - ; reset the corb hw read pointer - mov ax, ICH6_CORBRP_RST - mov edx, ICH6_REG_CORBRP - call azx_writew - ; enable corb dma - mov al, ICH6_CORBCTL_RUN - mov edx, ICH6_REG_CORBCTL - call azx_writeb + ; set the corb size to 256 entries (ULI requires explicitly) + mov al, 0x02 + mov edx, ICH6_REG_CORBSIZE + call azx_writeb + ; set the corb write pointer to 0 + xor ax, ax + mov edx, ICH6_REG_CORBWP + call azx_writew + ; reset the corb hw read pointer + mov ax, ICH6_CORBRP_RST + mov edx, ICH6_REG_CORBRP + call azx_writew + ; enable corb dma + mov al, ICH6_CORBCTL_RUN + mov edx, ICH6_REG_CORBCTL + call azx_writeb - ; RIRB set up - mov [ctrl.rirb_rp], 0 - mov [ctrl.rirb_wp], 0 - mov [ctrl.rirb_cmd], 0 + ; RIRB set up + mov [ctrl.rirb_rp], 0 + mov [ctrl.rirb_wp], 0 + mov [ctrl.rirb_cmd], 0 - pop eax ; restore corb address - add eax, 2048 - mov edx, ICH6_REG_RIRBLBASE - call azx_writel - xor eax, eax - mov edx, ICH6_REG_RIRBUBASE - call azx_writel + pop eax ; restore corb address + add eax, 2048 + mov edx, ICH6_REG_RIRBLBASE + call azx_writel + xor eax, eax + mov edx, ICH6_REG_RIRBUBASE + call azx_writel - ; set the rirb size to 256 entries (ULI requires explicitly) - mov al, 0x02 - mov edx, ICH6_REG_RIRBSIZE - call azx_writeb - ; reset the rirb hw write pointer - mov ax, ICH6_RIRBWP_RST - mov edx, ICH6_REG_RIRBWP - call azx_writew - ; set N=1, get RIRB response interrupt for new entry - xor ax, ax - cmp byte [driver_type], AZX_DRIVER_CTX - jne @f - mov ax, 0xC0-1 + ; set the rirb size to 256 entries (ULI requires explicitly) + mov al, 0x02 + mov edx, ICH6_REG_RIRBSIZE + call azx_writeb + ; reset the rirb hw write pointer + mov ax, ICH6_RIRBWP_RST + mov edx, ICH6_REG_RIRBWP + call azx_writew + ; set N=1, get RIRB response interrupt for new entry + xor ax, ax + cmp byte [driver_type], AZX_DRIVER_CTX + jne @f + mov ax, 0xC0-1 @@: - inc ax - mov edx, ICH6_REG_RINTCNT - call azx_writew - ; enable rirb dma and response irq - mov al, ICH6_RBCTL_DMA_EN or ICH6_RBCTL_IRQ_EN - mov edx, ICH6_REG_RIRBCTL - call azx_writeb + inc ax + mov edx, ICH6_REG_RINTCNT + call azx_writew + ; enable rirb dma and response irq + mov al, ICH6_RBCTL_DMA_EN or ICH6_RBCTL_IRQ_EN + mov edx, ICH6_REG_RIRBCTL + call azx_writeb - popa - spin_unlock_irq - ret + popa + spin_unlock_irq + ret endp -proc azx_free_cmd_io - spin_lock_irq - push eax edx - ; disable ringbuffer DMAs - xor al, al - mov edx, ICH6_REG_RIRBCTL - call azx_writeb - mov edx, ICH6_REG_CORBCTL - call azx_writeb - pop edx eax - spin_unlock_irq - ret +proc azx_free_cmd_io + spin_lock_irq + push eax edx + ; disable ringbuffer DMAs + xor al, al + mov edx, ICH6_REG_RIRBCTL + call azx_writeb + mov edx, ICH6_REG_CORBCTL + call azx_writeb + pop edx eax + spin_unlock_irq + ret endp ; send a command -proc azx_corb_send_cmd stdcall, val:dword - spin_lock_irq - push edx edi - xor eax, eax - ; add command to corb - mov edx, ICH6_REG_CORBWP - call azx_readb - inc al - inc dword [ctrl.rirb_cmd] - mov edi, dword [ctrl.rb] +proc azx_corb_send_cmd stdcall, val:dword + spin_lock_irq + push edx edi + xor eax, eax + ; add command to corb + mov edx, ICH6_REG_CORBWP + call azx_readb + inc al + inc dword [ctrl.rirb_cmd] + mov edi, dword [ctrl.rb] - push eax - shl eax, 2 ;wp=wp*sizeof(corb entry)=wp*4 - add edi, eax - mov eax, dword [val] - stosd - pop eax - mov edx, ICH6_REG_CORBWP - call azx_writel + push eax + shl eax, 2 ;wp=wp*sizeof(corb entry)=wp*4 + add edi, eax + mov eax, dword [val] + stosd + pop eax + mov edx, ICH6_REG_CORBWP + call azx_writel - pop edi edx - xor eax, eax ;Asper+ - spin_unlock_irq - ret + pop edi edx + xor eax, eax ;Asper+ + spin_unlock_irq + ret endp ; retrieve RIRB entry - called from interrupt handler -proc azx_update_rirb - pusha - xor eax, eax - mov edx, ICH6_REG_RIRBWP - call azx_readb ;call azx_readw +proc azx_update_rirb + pusha + xor eax, eax + mov edx, ICH6_REG_RIRBWP + call azx_readb ;call azx_readw - cmp ax, [ctrl.rirb_wp] - je .done - mov [ctrl.rirb_wp], ax - mov bx, [ctrl.rirb_rp] + cmp ax, [ctrl.rirb_wp] + je .done + mov [ctrl.rirb_wp], ax + mov bx, [ctrl.rirb_rp] - .l1: - cmp bx, [ctrl.rirb_wp] - je .l3 +.l1: + cmp bx, [ctrl.rirb_wp] + je .l3 - inc bl - .l2: - cmp bx, ICH6_MAX_RIRB_ENTRIES - jl @f - sub bx, ICH6_MAX_RIRB_ENTRIES - jmp .l2 - @@: + inc bl +.l2: + cmp bx, ICH6_MAX_RIRB_ENTRIES + jl @f + sub bx, ICH6_MAX_RIRB_ENTRIES + jmp .l2 +@@: - movzx edx, bx - shl edx, 1 + 2 ; an RIRB entry is 8-bytes - mov esi, dword [ctrl.rb] - add esi, 2048 - add esi, edx - lodsd ; res - mov edx, eax - lodsd ; res_ex + movzx edx, bx + shl edx, 1 + 2 ; an RIRB entry is 8-bytes + mov esi, dword [ctrl.rb] + add esi, 2048 + add esi, edx + lodsd ; res + mov edx, eax + lodsd ; res_ex - test eax, ICH6_RIRB_EX_UNSOL_EV - jz @f - stdcall snd_hda_queue_unsol_event, edx, eax - jmp .l1 - @@: - mov ecx, [ctrl.rirb_cmd] - test ecx, ecx - jz @f - mov [ctrl.rirb_res], edx - dec dword [ctrl.rirb_cmd] - jmp .l1 - @@: - if DEBUG - push esi - mov esi, msgSpuriousResponce - call SysMsgBoardStr - pop esi - end if - jmp .l1 - .l3: - mov [ctrl.rirb_rp], bx - .done: - popa - ret + test eax, ICH6_RIRB_EX_UNSOL_EV + jz @f + stdcall snd_hda_queue_unsol_event, edx, eax + jmp .l1 +@@: + mov ecx, [ctrl.rirb_cmd] + test ecx, ecx + jz @f + mov [ctrl.rirb_res], edx + dec dword [ctrl.rirb_cmd] + jmp .l1 +@@: +if DEBUG + push esi + mov esi, msgSpuriousResponce + invoke SysMsgBoardStr + pop esi +end if + jmp .l1 +.l3: + mov [ctrl.rirb_rp], bx +.done: + popa + ret endp ; receive a response -proc azx_rirb_get_response - locals - do_poll db 0 - endl +proc azx_rirb_get_response +locals + do_poll db 0 +endl - push ebx ecx edx - .again: - mov ecx, 1000;+1000 - .next_try: - mov al, [ctrl.polling_mode] - test al, al - jnz .poll - mov ah, [do_poll] - test ah, ah - jz @f - .poll: - spin_lock_irq - call azx_update_rirb - spin_unlock_irq - @@: - mov eax, [ctrl.rirb_cmd] - test eax, eax - jnz .l1 - mov [ctrl.rirb_error], 0 - mov al, [do_poll] - test al, al - jnz @f - mov [ctrl.poll_count], 0 - @@: - mov eax, [ctrl.rirb_res] ; the last value - jmp .out - .l1: - push eax - mov eax, 2000 ; temporary workaround - call StallExec - pop eax - dec ecx - jnz .next_try - .no_next_try: - mov al, [ctrl.polling_mode] - test al, al - jnz .no_poll + push ebx ecx edx +.again: + mov ecx, 1000;+1000 +.next_try: + mov al, [ctrl.polling_mode] + test al, al + jnz .poll + mov ah, [do_poll] + test ah, ah + jz @f +.poll: + spin_lock_irq + call azx_update_rirb + spin_unlock_irq +@@: + mov eax, [ctrl.rirb_cmd] + test eax, eax + jnz .l1 + mov [ctrl.rirb_error], 0 + mov al, [do_poll] + test al, al + jnz @f + mov [ctrl.poll_count], 0 +@@: + mov eax, [ctrl.rirb_res] ; the last value + jmp .out +.l1: + push eax + mov eax, 2000 ; temporary workaround + call StallExec + pop eax + dec ecx + jnz .next_try +.no_next_try: + mov al, [ctrl.polling_mode] + test al, al + jnz .no_poll - mov al, [ctrl.poll_count] - cmp al, 2 - jge .poll_count_overflow - if DEBUG - push eax esi - mov esi, msgGetResponceTimeout - call SysMsgBoardStr - mov esi, msgPollingCodecOnce - call SysMsgBoardStr - pop esi eax - end if - mov [do_poll], 1 - inc [ctrl.poll_count] - jmp .again + mov al, [ctrl.poll_count] + cmp al, 2 + jge .poll_count_overflow +if DEBUG + push eax esi + mov esi, msgGetResponceTimeout + invoke SysMsgBoardStr + mov esi, msgPollingCodecOnce + invoke SysMsgBoardStr + pop esi eax +end if + mov [do_poll], 1 + inc [ctrl.poll_count] + jmp .again - .poll_count_overflow: - if DEBUG - push eax esi - mov esi, msgGetResponceTimeout - call SysMsgBoardStr - mov esi, msgSwitchToPollMode - call SysMsgBoardStr - pop esi eax - end if - mov [ctrl.polling_mode], 1 - jmp .again +.poll_count_overflow: +if DEBUG + push eax esi + mov esi, msgGetResponceTimeout + invoke SysMsgBoardStr + mov esi, msgSwitchToPollMode + invoke SysMsgBoardStr + pop esi eax +end if + mov [ctrl.polling_mode], 1 + jmp .again - .no_poll: +.no_poll: - mov al, [ctrl.polling_mode] - test al, al - jz @f - mov eax, -1 - jmp .out - @@: + mov al, [ctrl.polling_mode] + test al, al + jz @f + mov eax, -1 + jmp .out +@@: + ; a fatal communication error; need either to reset or to fallback + ; to the single_cmd mode + mov [ctrl.rirb_error], 1 + ;Asper~ -? [ + mov [ctrl.response_reset], 1 + mov eax, -1 ; give a chance to retry + jmp .out + ;Asper~ -? ] - ; a fatal communication error; need either to reset or to fallback - ; to the single_cmd mode - mov [ctrl.rirb_error], 1 - ;Asper~ -? [ - mov [ctrl.response_reset], 1 - mov eax, -1 ; give a chance to retry - jmp .out - ;Asper~ -? ] + ;-? mov [ctrl.single_cmd], 1 + mov [ctrl.response_reset], 0 - ;-? mov [ctrl.single_cmd], 1 - mov [ctrl.response_reset], 0 - - ; release CORB/RIRB - call azx_free_cmd_io - ; disable unsolicited responses - mov edx, ICH6_REG_GCTL - call azx_readl - mov ebx, ICH6_GCTL_UNSOL - xor ebx, -1 - and eax, ebx - mov edx, ICH6_REG_GCTL - call azx_writel - mov eax, -1 - .out: - pop edx ecx ebx - ret + ; release CORB/RIRB + call azx_free_cmd_io + ; disable unsolicited responses + mov edx, ICH6_REG_GCTL + call azx_readl + mov ebx, ICH6_GCTL_UNSOL + xor ebx, -1 + and eax, ebx + mov edx, ICH6_REG_GCTL + call azx_writel + mov eax, -1 +.out: + pop edx ecx ebx + ret endp ; @@ -1746,114 +1737,114 @@ endp ; ; receive a response -proc azx_single_wait_for_response - push ecx edx esi +proc azx_single_wait_for_response + push ecx edx esi - mov ecx, 50 - .l1: - test ecx, ecx - jz .timeout + mov ecx, 50 +.l1: + test ecx, ecx + jz .timeout ; check IRV busy bit - mov edx, ICH6_REG_IRS - call azx_readw - test ax, ICH6_IRS_VALID - jz @f + mov edx, ICH6_REG_IRS + call azx_readw + test ax, ICH6_IRS_VALID + jz @f ; reuse rirb.res as the response return value - mov edx, ICH6_REG_IR - call azx_readl - mov [ctrl.rirb_res], eax + mov edx, ICH6_REG_IR + call azx_readl + mov [ctrl.rirb_res], eax - pop esi edx ecx - xor eax, eax + pop esi edx ecx + xor eax, eax ret - @@: - xor eax, eax - inc eax - call StallExec +@@: + xor eax, eax + inc eax + call StallExec - dec ecx - jmp .l1 - .timeout: - if DEBUG - xor eax, eax - mov edx, ICH6_REG_IRS - call azx_readw - mov esi, msgGetResponceTimeout - call SysMsgBoardStr - mov esi, msgIRS - call SysMsgBoardStr - stdcall fdword2str, 2 - call SysMsgBoardStr - end if + dec ecx + jmp .l1 +.timeout: +if DEBUG + xor eax, eax + mov edx, ICH6_REG_IRS + call azx_readw + mov esi, msgGetResponceTimeout + invoke SysMsgBoardStr + mov esi, msgIRS + invoke SysMsgBoardStr + stdcall fdword2str, 2 + invoke SysMsgBoardStr +end if - pop esi edx ecx - mov eax, -1 - mov [ctrl.rirb_res], eax + pop esi edx ecx + mov eax, -1 + mov [ctrl.rirb_res], eax ret endp ; send a command -proc azx_single_send_cmd stdcall, val:dword +proc azx_single_send_cmd stdcall, val:dword push ecx edx esi mov ecx, 50 - .l1: +.l1: test ecx, ecx jz .timeout ; check ICB busy bit - mov edx, ICH6_REG_IRS - call azx_readw - test ax, ICH6_IRS_BUSY - jnz @f + mov edx, ICH6_REG_IRS + call azx_readw + test ax, ICH6_IRS_BUSY + jnz @f ; Clear IRV valid bit - mov edx, ICH6_REG_IRS - call azx_readw - or ax, ICH6_IRS_VALID - mov edx, ICH6_REG_IRS - call azx_writew + mov edx, ICH6_REG_IRS + call azx_readw + or ax, ICH6_IRS_VALID + mov edx, ICH6_REG_IRS + call azx_writew - mov eax, dword [val] - mov edx, ICH6_REG_IC - call azx_writel + mov eax, dword [val] + mov edx, ICH6_REG_IC + call azx_writel - mov edx, ICH6_REG_IRS - call azx_readw - or ax, ICH6_IRS_BUSY - mov edx, ICH6_REG_IRS - call azx_writew + mov edx, ICH6_REG_IRS + call azx_readw + or ax, ICH6_IRS_BUSY + mov edx, ICH6_REG_IRS + call azx_writew stdcall azx_single_wait_for_response - pop esi edx ecx + pop esi edx ecx ret - @@: +@@: dec ecx jmp .l1 - .timeout: - if DEBUG - xor eax, eax - mov edx, ICH6_REG_IRS - call azx_readw - mov esi, msgSendCmdTimeout - call SysMsgBoardStr - stdcall fdword2str, 2 - call SysMsgBoardStr - mov esi, msgVal - call SysMsgBoardStr - mov eax, dword [val] - stdcall fdword2str, 2 - call SysMsgBoardStr - end if +.timeout: +if DEBUG + xor eax, eax + mov edx, ICH6_REG_IRS + call azx_readw + mov esi, msgSendCmdTimeout + invoke SysMsgBoardStr + stdcall fdword2str, 2 + invoke SysMsgBoardStr + mov esi, msgVal + invoke SysMsgBoardStr + mov eax, dword [val] + stdcall fdword2str, 2 + invoke SysMsgBoardStr +end if - pop esi edx ecx - mov eax, -1 + pop esi edx ecx + mov eax, -1 ret endp ; receive a response -proc azx_single_get_response - mov eax, [ctrl.rirb_res] +proc azx_single_get_response + mov eax, [ctrl.rirb_res] ret endp @@ -1865,23 +1856,23 @@ endp ; ; send a command -proc azx_send_cmd stdcall, val:dword - if USE_SINGLE_MODE - stdcall azx_single_send_cmd, [val] - else - stdcall azx_corb_send_cmd, [val] - end if - ret +proc azx_send_cmd stdcall, val:dword +if USE_SINGLE_MODE + stdcall azx_single_send_cmd, [val] +else + stdcall azx_corb_send_cmd, [val] +end if + ret endp ; get a response -proc azx_get_response - if USE_SINGLE_MODE - call azx_single_get_response - else - call azx_rirb_get_response - end if - ret +proc azx_get_response +if USE_SINGLE_MODE + call azx_single_get_response +else + call azx_rirb_get_response +end if + ret endp @@ -1890,375 +1881,374 @@ endp ;;;;;;;;;;;;;;;;;;;;;;;; ; enable interrupts -proc azx_int_enable - push eax edx - ; enable controller CIE and GIE - mov edx, ICH6_REG_INTCTL - call azx_readl - or eax, ICH6_INT_CTRL_EN or ICH6_INT_GLOBAL_EN - mov edx, ICH6_REG_INTCTL - call azx_writel - pop edx eax - ret +proc azx_int_enable + push eax edx + ; enable controller CIE and GIE + mov edx, ICH6_REG_INTCTL + call azx_readl + or eax, ICH6_INT_CTRL_EN or ICH6_INT_GLOBAL_EN + mov edx, ICH6_REG_INTCTL + call azx_writel + pop edx eax + ret endp ; disable interrupts -proc azx_int_disable - push eax ebx edx +proc azx_int_disable + push eax ebx edx - ; disable interrupts in stream descriptor - mov edx, ICH6_REG_SD_CTL + SDO_OFS - call azx_readb - mov bl, SD_INT_MASK - xor bl, -1 - and al, bl - mov edx, ICH6_REG_SD_CTL + SDO_OFS - call azx_writeb + ; disable interrupts in stream descriptor + mov edx, ICH6_REG_SD_CTL + SDO_OFS + call azx_readb + mov bl, SD_INT_MASK + xor bl, -1 + and al, bl + mov edx, ICH6_REG_SD_CTL + SDO_OFS + call azx_writeb - ; disable SIE for all streams - xor al, al - mov edx, ICH6_REG_INTCTL - call azx_writeb + ; disable SIE for all streams + xor al, al + mov edx, ICH6_REG_INTCTL + call azx_writeb - ; disable controller CIE and GIE - mov edx, ICH6_REG_INTCTL - call azx_readl - mov ebx, ICH6_INT_CTRL_EN or ICH6_INT_GLOBAL_EN - xor ebx, -1 - and eax, ebx - call azx_writel - pop edx ebx eax - ret + ; disable controller CIE and GIE + mov edx, ICH6_REG_INTCTL + call azx_readl + mov ebx, ICH6_INT_CTRL_EN or ICH6_INT_GLOBAL_EN + xor ebx, -1 + and eax, ebx + call azx_writel + pop edx ebx eax + ret endp ; clear interrupts -proc azx_int_clear - push eax edx +proc azx_int_clear + push eax edx - ; clear stream status - mov al, SD_INT_MASK - mov edx, ICH6_REG_SD_STS + SDO_OFS - call azx_writeb + ; clear stream status + mov al, SD_INT_MASK + mov edx, ICH6_REG_SD_STS + SDO_OFS + call azx_writeb - ; clear STATESTS - mov al, STATESTS_INT_MASK - mov edx, ICH6_REG_STATESTS - call azx_writeb + ; clear STATESTS + mov al, STATESTS_INT_MASK + mov edx, ICH6_REG_STATESTS + call azx_writeb - ; clear rirb status - mov al, RIRB_INT_MASK - mov edx, ICH6_REG_RIRBSTS - call azx_writeb + ; clear rirb status + mov al, RIRB_INT_MASK + mov edx, ICH6_REG_RIRBSTS + call azx_writeb - ; clear int status - mov eax, ICH6_INT_CTRL_EN or ICH6_INT_ALL_STREAM - mov edx, ICH6_REG_INTSTS - call azx_writel - pop edx eax - ret + ; clear int status + mov eax, ICH6_INT_CTRL_EN or ICH6_INT_ALL_STREAM + mov edx, ICH6_REG_INTSTS + call azx_writel + pop edx eax + ret endp ; start a stream -proc azx_stream_start - push eax edx +proc azx_stream_start + push eax edx - ; enable SIE - mov edx, ICH6_REG_INTCTL - call azx_readl + ; enable SIE + mov edx, ICH6_REG_INTCTL + call azx_readl - or eax, 0xC0000000 ;Asper+ - or eax, SDO_INT ; Asper: output stream interrupt index - mov edx, ICH6_REG_INTCTL - call azx_writel - ; set DMA start and interrupt mask - mov edx, ICH6_REG_SD_CTL + SDO_OFS - call azx_readb + or eax, 0xC0000000 ;Asper+ + or eax, SDO_INT ; Asper: output stream interrupt index + mov edx, ICH6_REG_INTCTL + call azx_writel + ; set DMA start and interrupt mask + mov edx, ICH6_REG_SD_CTL + SDO_OFS + call azx_readb - or al, SD_CTL_DMA_START or SD_INT_MASK + or al, SD_CTL_DMA_START or SD_INT_MASK - mov edx, ICH6_REG_SD_CTL + SDO_OFS - call azx_writeb + mov edx, ICH6_REG_SD_CTL + SDO_OFS + call azx_writeb - pop edx eax - ret + pop edx eax + ret endp ; stop DMA -proc azx_stream_clear - push eax ebx edx - mov edx, ICH6_REG_SD_CTL + SDO_OFS - call azx_readb - mov bl, SD_CTL_DMA_START or SD_INT_MASK - xor bl, -1 - and al, bl - mov edx, ICH6_REG_SD_CTL + SDO_OFS - call azx_writeb - mov al, SD_INT_MASK - mov edx, ICH6_REG_SD_STS + SDO_OFS - call azx_writeb - pop edx ebx eax - ret +proc azx_stream_clear + push eax ebx edx + mov edx, ICH6_REG_SD_CTL + SDO_OFS + call azx_readb + mov bl, SD_CTL_DMA_START or SD_INT_MASK + xor bl, -1 + and al, bl + mov edx, ICH6_REG_SD_CTL + SDO_OFS + call azx_writeb + mov al, SD_INT_MASK + mov edx, ICH6_REG_SD_STS + SDO_OFS + call azx_writeb + pop edx ebx eax + ret endp ; stop a stream -proc azx_stream_stop - push eax ebx edx - call azx_stream_clear - ; disable SIE - mov edx, ICH6_REG_INTCTL - call azx_readl - mov ebx, (SDO_INT) - xor ebx, -1 - and eax, ebx - mov edx, ICH6_REG_INTCTL - call azx_writel - pop edx ebx eax - ret +proc azx_stream_stop + push eax ebx edx + call azx_stream_clear + ; disable SIE + mov edx, ICH6_REG_INTCTL + call azx_readl + mov ebx, (SDO_INT) + xor ebx, -1 + and eax, ebx + mov edx, ICH6_REG_INTCTL + call azx_writel + pop edx ebx eax + ret endp ; ;in: eax = full_reset ; ; initialize the chip -proc azx_init_chip - push eax +proc azx_init_chip + push eax - ; reset controller - mov eax, 1 ;full reset - call reset_controller + ; reset controller + mov eax, 1 ;full reset + call reset_controller - ; initialize interrupts - call azx_int_clear - call azx_int_enable + ; initialize interrupts + call azx_int_clear + call azx_int_enable - ; initialize the codec command I/O - if USE_SINGLE_MODE - else - call azx_init_cmd_io - end if + ; initialize the codec command I/O +if USE_SINGLE_MODE +else + call azx_init_cmd_io +end if - ; program the position buffer - mov eax, dword [ctrl.posbuf] - mov ebx, eax - call GetPgAddr - and ebx, 0xFFF - add eax, ebx - mov edx, ICH6_REG_DPLBASE - call azx_writel - xor eax, eax - mov edx, ICH6_REG_DPUBASE - call azx_writel + ; program the position buffer + mov eax, dword [ctrl.posbuf] + mov ebx, eax + invoke GetPgAddr + and ebx, 0xFFF + add eax, ebx + mov edx, ICH6_REG_DPLBASE + call azx_writel + xor eax, eax + mov edx, ICH6_REG_DPUBASE + call azx_writel - pop eax - ret + pop eax + ret endp ; initialize the PCI registers ; update bits in a PCI register byte -proc update_pci_byte stdcall, reg:dword, mask:dword, val:dword - push ax bx - stdcall PciRead8, [ctrl.bus], [ctrl.devfn], [reg] - mov bl, byte [mask] - mov bh, bl - xor bl, -1 - and al, bl - shr bx, 8 - and bl, byte [val] - or al, bl - stdcall PciWrite8, [ctrl.bus], [ctrl.devfn], [reg], eax - pop bx ax - ret +proc update_pci_byte stdcall, reg:dword, mask:dword, val:dword + push ax bx + invoke PciRead8, [ctrl.bus], [ctrl.devfn], [reg] + mov bl, byte [mask] + mov bh, bl + xor bl, -1 + and al, bl + shr bx, 8 + and bl, byte [val] + or al, bl + invoke PciWrite8, [ctrl.bus], [ctrl.devfn], [reg], eax + pop bx ax + ret endp -proc azx_init_pci - ; Clear bits 0-2 of PCI register TCSEL (at offset 0x44) - ; TCSEL == Traffic Class Select Register, which sets PCI express QOS - ; Ensuring these bits are 0 clears playback static on some HD Audio - ; codecs - push eax - stdcall update_pci_byte, ICH6_PCIREG_TCSEL, 0x07, 0 +proc azx_init_pci + ; Clear bits 0-2 of PCI register TCSEL (at offset 0x44) + ; TCSEL == Traffic Class Select Register, which sets PCI express QOS + ; Ensuring these bits are 0 clears playback static on some HD Audio + ; codecs + push eax + stdcall update_pci_byte, ICH6_PCIREG_TCSEL, 0x07, 0 - mov eax, [driver_type] - cmp eax, AZX_DRIVER_ATI - jne @f - ; For ATI SB450 azalia HD audio, we need to enable snoop - stdcall update_pci_byte, ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, 0x07, ATI_SB450_HDAUDIO_ENABLE_SNOOP - jmp .done - @@: - cmp eax, AZX_DRIVER_NVIDIA - jne @f - ; For NVIDIA HDA, enable snoop - stdcall update_pci_byte, NVIDIA_HDA_TRANSREG_ADDR, 0x0f, NVIDIA_HDA_ENABLE_COHBITS - stdcall update_pci_byte, NVIDIA_HDA_ISTRM_COH, 0x01, NVIDIA_HDA_ENABLE_COHBIT - stdcall update_pci_byte, NVIDIA_HDA_OSTRM_COH, 0x01, NVIDIA_HDA_ENABLE_COHBIT - jmp .done - @@: - cmp eax, AZX_DRIVER_SCH - je .l1 - cmp eax, AZX_DRIVER_PCH - jne @f - .l1: - stdcall PciRead16, [ctrl.bus], [ctrl.devfn], dword INTEL_SCH_HDA_DEVC - test ax, INTEL_SCH_HDA_DEVC_NOSNOOP - jz @f - push ebx - mov ebx, INTEL_SCH_HDA_DEVC_NOSNOOP - xor ebx, -1 - and eax, ebx - pop ebx - stdcall PciWrite16, [ctrl.bus], [ctrl.devfn], dword INTEL_SCH_HDA_DEVC, eax - stdcall PciRead16, [ctrl.bus], [ctrl.devfn], dword INTEL_SCH_HDA_DEVC + mov eax, [driver_type] + cmp eax, AZX_DRIVER_ATI + jne @f + ; For ATI SB450 azalia HD audio, we need to enable snoop + stdcall update_pci_byte, ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, 0x07, ATI_SB450_HDAUDIO_ENABLE_SNOOP + jmp .done +@@: + cmp eax, AZX_DRIVER_NVIDIA + jne @f + ; For NVIDIA HDA, enable snoop + stdcall update_pci_byte, NVIDIA_HDA_TRANSREG_ADDR, 0x0f, NVIDIA_HDA_ENABLE_COHBITS + stdcall update_pci_byte, NVIDIA_HDA_ISTRM_COH, 0x01, NVIDIA_HDA_ENABLE_COHBIT + stdcall update_pci_byte, NVIDIA_HDA_OSTRM_COH, 0x01, NVIDIA_HDA_ENABLE_COHBIT + jmp .done +@@: + cmp eax, AZX_DRIVER_SCH + je .l1 + cmp eax, AZX_DRIVER_PCH + jne @f +.l1: + invoke PciRead16, [ctrl.bus], [ctrl.devfn], dword INTEL_SCH_HDA_DEVC + test ax, INTEL_SCH_HDA_DEVC_NOSNOOP + jz @f + push ebx + mov ebx, INTEL_SCH_HDA_DEVC_NOSNOOP + xor ebx, -1 + and eax, ebx + pop ebx + invoke PciWrite16, [ctrl.bus], [ctrl.devfn], dword INTEL_SCH_HDA_DEVC, eax + invoke PciRead16, [ctrl.bus], [ctrl.devfn], dword INTEL_SCH_HDA_DEVC - if DEBUG - push esi - mov esi, msgHDASnoopDisabled - call SysMsgBoardStr - mov esi, msg_OK - test ax, INTEL_SCH_HDA_DEVC_NOSNOOP - jz .snoop_ok - mov esi, msg_Fail - .snoop_ok: - call SysMsgBoardStr - pop esi - end if - @@: - .done: - pop eax - ret +if DEBUG + push esi + mov esi, msgHDASnoopDisabled + invoke SysMsgBoardStr + mov esi, msg_OK + test ax, INTEL_SCH_HDA_DEVC_NOSNOOP + jz .snoop_ok + mov esi, msg_Fail +.snoop_ok: + invoke SysMsgBoardStr + pop esi +end if +@@: +.done: + pop eax + ret endp ; reset stream -proc azx_stream_reset - push eax ebx ecx edx +proc azx_stream_reset + push eax ebx ecx edx - call azx_stream_clear + call azx_stream_clear - mov edx, ICH6_REG_SD_CTL + SDO_OFS - call azx_readb - or al, SD_CTL_STREAM_RESET - mov edx, ICH6_REG_SD_CTL + SDO_OFS - call azx_writeb + mov edx, ICH6_REG_SD_CTL + SDO_OFS + call azx_readb + or al, SD_CTL_STREAM_RESET + mov edx, ICH6_REG_SD_CTL + SDO_OFS + call azx_writeb - mov eax, 3 - call StallExec + mov eax, 3 + call StallExec - mov ecx, 300 - .l1: - mov edx, ICH6_REG_SD_CTL + SDO_OFS - call azx_readb - test al, SD_CTL_STREAM_RESET - jnz @f - dec ecx - jnz .l1 - @@: - mov bl, SD_CTL_STREAM_RESET - xor bl, -1 - and al, bl - mov edx, ICH6_REG_SD_CTL + SDO_OFS - call azx_writeb + mov ecx, 300 +.l1: + mov edx, ICH6_REG_SD_CTL + SDO_OFS + call azx_readb + test al, SD_CTL_STREAM_RESET + jnz @f + dec ecx + jnz .l1 +@@: + mov bl, SD_CTL_STREAM_RESET + xor bl, -1 + and al, bl + mov edx, ICH6_REG_SD_CTL + SDO_OFS + call azx_writeb - mov eax, 3 - call StallExec + mov eax, 3 + call StallExec - mov ecx, 300 - ; waiting for hardware to report that the stream is out of reset - .l2: - mov edx, ICH6_REG_SD_CTL + SDO_OFS - call azx_readb - test al, SD_CTL_STREAM_RESET - jnz @f - dec ecx - jnz .l2 - @@: - ; reset first position - may not be synced with hw at this time - mov edx, [ctrl.posbuf] - mov dword [edx], 0 - pop edx ecx ebx eax - ret + mov ecx, 300 + ; waiting for hardware to report that the stream is out of reset +.l2: + mov edx, ICH6_REG_SD_CTL + SDO_OFS + call azx_readb + test al, SD_CTL_STREAM_RESET + jnz @f + dec ecx + jnz .l2 +@@: + ; reset first position - may not be synced with hw at this time + mov edx, [ctrl.posbuf] + mov dword [edx], 0 + pop edx ecx ebx eax + ret endp ; set up the SD for streaming proc azx_setup_controller - push eax ebx ecx edx - ; make sure the run bit is zero for SD - call azx_stream_clear + push eax ebx ecx edx + ; make sure the run bit is zero for SD + call azx_stream_clear - ; program the stream_tag - mov edx, ICH6_REG_SD_CTL + SDO_OFS - call azx_readl - mov ecx, SD_CTL_STREAM_TAG_MASK - xor ecx, -1 - and eax, ecx - mov ecx, SDO_TAG - shl ecx, SD_CTL_STREAM_TAG_SHIFT - or eax, ecx - ; Asper stream_tag = SDO_TAG - mov edx, ICH6_REG_SD_CTL + SDO_OFS - call azx_writel + ; program the stream_tag + mov edx, ICH6_REG_SD_CTL + SDO_OFS + call azx_readl + mov ecx, SD_CTL_STREAM_TAG_MASK + xor ecx, -1 + and eax, ecx + mov ecx, SDO_TAG + shl ecx, SD_CTL_STREAM_TAG_SHIFT + or eax, ecx + ; Asper stream_tag = SDO_TAG + mov edx, ICH6_REG_SD_CTL + SDO_OFS + call azx_writel - ; program the length of samples in cyclic buffer - mov eax, 0x4000*32 - mov edx, ICH6_REG_SD_CBL + SDO_OFS - call azx_writel + ; program the length of samples in cyclic buffer + mov eax, 0x4000*32 + mov edx, ICH6_REG_SD_CBL + SDO_OFS + call azx_writel - ; program the stream format - ; this value needs to be the same as the one programmed - mov ax, 0x11 - mov edx, ICH6_REG_SD_FORMAT + SDO_OFS - call azx_writew + ; program the stream format + ; this value needs to be the same as the one programmed + mov ax, 0x11 + mov edx, ICH6_REG_SD_FORMAT + SDO_OFS + call azx_writew - ; program the stream LVI (last valid index) of the BDL - mov eax, 32-1 ;4-1 ;2-1 - mov [ctrl.lvi_reg], eax - mov edx, ICH6_REG_SD_LVI + SDO_OFS - call azx_writew + ; program the stream LVI (last valid index) of the BDL + mov eax, 32-1 ;4-1 ;2-1 + mov [ctrl.lvi_reg], eax + mov edx, ICH6_REG_SD_LVI + SDO_OFS + call azx_writew - ; program the BDL address - ; lower BDL address - mov eax, [pcmout_bdl] - mov ebx, eax - call GetPgAddr - and ebx, 0xFFF - add eax, ebx - mov edx, ICH6_REG_SD_BDLPL + SDO_OFS - call azx_writel - ; upper BDL address - xor eax, eax ;upper_32bit(azx_dev->bdl_addr) - mov edx, ICH6_REG_SD_BDLPU + SDO_OFS - call azx_writel + ; program the BDL address + ; lower BDL address + mov eax, [pcmout_bdl] + mov ebx, eax + invoke GetPgAddr + and ebx, 0xFFF + add eax, ebx + mov edx, ICH6_REG_SD_BDLPL + SDO_OFS + call azx_writel + ; upper BDL address + xor eax, eax ;upper_32bit(azx_dev->bdl_addr) + mov edx, ICH6_REG_SD_BDLPU + SDO_OFS + call azx_writel - ; enable the position buffer - cmp [ctrl.position_fix], POS_FIX_LPIB - jz @f - mov edx, ICH6_REG_DPLBASE - call azx_readl - and eax, ICH6_DPLBASE_ENABLE - jnz @f - mov eax, dword [ctrl.posbuf] - mov ebx, eax - call GetPgAddr - and ebx, 0xFFF - add eax, ebx - or eax, ICH6_DPLBASE_ENABLE - mov edx, ICH6_REG_DPLBASE - call azx_writel - @@: + ; enable the position buffer + cmp [ctrl.position_fix], POS_FIX_LPIB + jz @f + mov edx, ICH6_REG_DPLBASE + call azx_readl + and eax, ICH6_DPLBASE_ENABLE + jnz @f + mov eax, dword [ctrl.posbuf] + mov ebx, eax + invoke GetPgAddr + and ebx, 0xFFF + add eax, ebx + or eax, ICH6_DPLBASE_ENABLE + mov edx, ICH6_REG_DPLBASE + call azx_writel +@@: + ; set the interrupt enable bits in the descriptor control register + mov edx, ICH6_REG_SD_CTL + SDO_OFS + call azx_readl + or eax, SD_INT_MASK + mov edx, ICH6_REG_SD_CTL + SDO_OFS + call azx_writel - ; set the interrupt enable bits in the descriptor control register - mov edx, ICH6_REG_SD_CTL + SDO_OFS - call azx_readl - or eax, SD_INT_MASK - mov edx, ICH6_REG_SD_CTL + SDO_OFS - call azx_writel - - pop edx ecx ebx eax - ret + pop edx ecx ebx eax + ret endp @@ -2266,166 +2256,167 @@ endp ; Probe the given codec address proc probe_codec, addr:dword - push edx - mov eax, [addr] - shl eax, 28 - mov edx, (AC_NODE_ROOT shl 20) or (AC_VERB_PARAMETERS shl 8) or AC_PAR_VENDOR_ID - or eax, edx - stdcall azx_send_cmd, eax - stdcall azx_get_response + push edx + mov eax, [addr] + shl eax, 28 + mov edx, (AC_NODE_ROOT shl 20) or (AC_VERB_PARAMETERS shl 8) or AC_PAR_VENDOR_ID + or eax, edx + stdcall azx_send_cmd, eax + stdcall azx_get_response - cmp eax, -1 - je .out - mov eax, [addr] - mov [codec.addr], eax ;Asper+ - if DEBUG - push esi - mov esi, msgCodecOK - call SysMsgBoardStr - mov esi, msgCAd - call SysMsgBoardStr - stdcall fdword2str, 3 - call SysMsgBoardStr - pop esi - end if - xor eax, eax - .out: - pop edx - ret + cmp eax, -1 + je .out + mov eax, [addr] + mov [codec.addr], eax ;Asper+ +if DEBUG + push esi + mov esi, msgCodecOK + invoke SysMsgBoardStr + mov esi, msgCAd + invoke SysMsgBoardStr + stdcall fdword2str, 3 + invoke SysMsgBoardStr + pop esi +end if + xor eax, eax +.out: + pop edx + ret endp proc azx_bus_reset - call azx_stop_chip - call azx_init_chip + call azx_stop_chip + call azx_init_chip endp ; Codec initialization -proc azx_codec_create - push ebx ecx edx - ;(...) +proc azx_codec_create + push ebx ecx edx + ;(...) ; First try to probe all given codec slots ; Asper: We asume for now that max slots for codecs = 4 - xor ecx, ecx - xor edx, edx - inc edx - .next_slot: - test edx, [ctrl.codec_mask] - jz @f - stdcall probe_codec, ecx - test eax, eax - jz .init ;@f - ; Some BIOSen give you wrong codec addresses that don't exist - if DEBUG - mov esi, msgCodecError - call SysMsgBoardStr - end if - mov ebx, edx - xor ebx, -1 - and [ctrl.codec_mask], ebx + xor ecx, ecx + xor edx, edx + inc edx +.next_slot: + test edx, [ctrl.codec_mask] + jz @f + stdcall probe_codec, ecx + test eax, eax + jz .init ;@f + ; Some BIOSen give you wrong codec addresses that don't exist +if DEBUG + mov esi, msgCodecError + invoke SysMsgBoardStr +end if + mov ebx, edx + xor ebx, -1 + and [ctrl.codec_mask], ebx - ; More badly, accessing to a non-existing - ; codec often screws up the controller chip, - ; and disturbs the further communications. - ; Thus if an error occurs during probing, - ; better to reset the controller chip to - ; get back to the sanity state. - ;call azx_bus_reset - @@: - shl edx, 1 - inc ecx -; if USE_FIRST_CODEC -; cmp ecx, 1 -; else - cmp ecx, 4 -; end if - jl .next_slot - mov eax, -1 - jmp .out - .init: - push ecx edx - stdcall snd_hda_codec_init - pop edx ecx - test eax, eax - jnz @b - .out: - pop edx ecx ebx - ret + ; More badly, accessing to a non-existing + ; codec often screws up the controller chip, + ; and disturbs the further communications. + ; Thus if an error occurs during probing, + ; better to reset the controller chip to + ; get back to the sanity state. + ;call azx_bus_reset +@@: + shl edx, 1 + inc ecx +;if USE_FIRST_CODEC +; cmp ecx, 1 +;else + cmp ecx, 4 +;end if + jl .next_slot + mov eax, -1 + jmp .out +.init: + push ecx edx + stdcall snd_hda_codec_init + pop edx ecx + test eax, eax + jnz @b +.out: + pop edx ecx ebx + ret endp -proc azx_codec_configure - ;(...) - call snd_hda_codec_configure - ret +proc azx_codec_configure + ;(...) + call snd_hda_codec_configure + ret endp -proc azx_get_position - test [ctrl.position_fix], POS_FIX_LPIB - jz @f - ; read LPIB - mov edx, ICH6_REG_SD_LPIB + SDO_OFS - call azx_readl - jmp .out - @@: - test [ctrl.position_fix], POS_FIX_VIACOMBO - jz @f -; call azx_get_via_position -; jmp .out - @@: - ; use the position buffer - push edx - mov edx, dword [ctrl.posbuf] - mov eax, dword [edx] - pop edx - .out: - cmp eax, 0x4000 ; bufsize - jl @f - xor eax, eax - @@: - ret +proc azx_get_position + test [ctrl.position_fix], POS_FIX_LPIB + jz @f + ; read LPIB + mov edx, ICH6_REG_SD_LPIB + SDO_OFS + call azx_readl + jmp .out +@@: + test [ctrl.position_fix], POS_FIX_VIACOMBO + jz @f +; call azx_get_via_position +; jmp .out +@@: + ; use the position buffer + push edx + mov edx, dword [ctrl.posbuf] + mov eax, dword [edx] + pop edx +.out: + cmp eax, 0x4000 ; bufsize + jl @f + xor eax, eax +@@: + ret endp -proc azx_stop_chip - push eax edx +proc azx_stop_chip + push eax edx - ; disable interrupts - call azx_int_disable - call azx_int_clear - ; disable CORB/RIRB - call azx_free_cmd_io - ; disable position buffer - xor eax, eax - mov edx, ICH6_REG_DPLBASE - call azx_writel - mov edx, ICH6_REG_DPUBASE - call azx_writel + ; disable interrupts + call azx_int_disable + call azx_int_clear - pop edx eax - ret + ; disable CORB/RIRB + call azx_free_cmd_io + + ; disable position buffer + xor eax, eax + mov edx, ICH6_REG_DPLBASE + call azx_writel + mov edx, ICH6_REG_DPUBASE + call azx_writel + pop edx eax + ret endp ; in: eax = volume (-10000 - 0) align 4 set_master_vol: - mov ecx, 3 - call set_channel_volume - ret + mov ecx, 3 + call set_channel_volume + ret ; out: [pvol] = volume (-10000 - 0) align 4 proc get_master_vol stdcall, pvol:dword - xor ecx, ecx - call get_channel_volume - mov ebx, [pvol] - mov [ebx], eax - xor eax, eax - ret + xor ecx, ecx + call get_channel_volume + mov ebx, [pvol] + mov [ebx], eax + xor eax, eax + ret endp @@ -2433,91 +2424,92 @@ endp ; eax = volume (-10000 - 0) align 4 set_channel_volume: - push eax ebx ecx edx - mov ebx, [volume.maxDb] - neg eax - if 0;DEBUG ;YAHOO - push eax esi - mov esi, msgNewVolume - call SysMsgBoardStr - stdcall fdword2str, 2 - call SysMsgBoardStr + push eax ebx ecx edx + mov ebx, [volume.maxDb] + neg eax +if DEBUG ;- + push eax esi + mov esi, msgNewVolume + invoke SysMsgBoardStr + stdcall fdword2str, 2 + invoke SysMsgBoardStr - mov esi, msgMaxVolume - call SysMsgBoardStr - mov eax, ebx - stdcall fdword2str, 2 - call SysMsgBoardStr - pop esi eax - end if - test ebx, ebx - jz .err_out + mov esi, msgMinVolume + invoke SysMsgBoardStr + mov eax, ebx + stdcall fdword2str, 2 + invoke SysMsgBoardStr + pop esi eax +end if + test ebx, ebx + jz .err_out - cmp eax, 0 - jg @f - xor eax, eax - jmp .set - @@: - cmp eax, ebx - jl .set - mov eax, ebx - .set: - ;cdq - xor edx, edx - shl eax, 2 - mov ebx, 100 - div bx - mov bl, [volume.step_size] - div bl + cmp eax, 0 + jg @f + xor eax, eax + jmp .set +@@: + cmp eax, ebx + jng .set + mov eax, ebx +.set: + sub ebx, eax + mov eax, ebx + ;cdq + xor edx, edx + push eax + movzx eax, [volume.step_size] + imul eax, (100/4) + mov ebx, eax + pop eax + xor edx, edx + idiv ebx - mov edx, [volume.out_amp_node] - test edx, edx - jz .out - movzx ebx, [edx+HDA_GNODE.nid] + mov edx, [volume.out_amp_node] + test edx, edx + jz .out + movzx ebx, [edx+HDA_GNODE.nid] - test ecx, 1 ; Left channel ? - jz @f - stdcall put_volume_mute, ebx, 0, HDA_OUTPUT, 0, eax - @@: - test ecx, 2 ; Right channel ? - jz .out - stdcall put_volume_mute, ebx, 1, HDA_OUTPUT, 0, eax - .out: - pop edx ecx ebx eax - ret - .err_out: - if 0;DEBUG ;YAHOO - push esi - mov esi, emsgNoVolCtrl - call SysMsgBoardStr - pop esi - end if - jmp .out + test ecx, 1 ; Left channel ? + jz @f + stdcall put_volume_mute, ebx, 0, HDA_OUTPUT, 0, eax +@@: + test ecx, 2 ; Right channel ? + jz .out + stdcall put_volume_mute, ebx, 1, HDA_OUTPUT, 0, eax +.out: + pop edx ecx ebx eax + ret +.err_out: +if DEBUG ;- + push esi + mov esi, emsgNoVolCtrl + invoke SysMsgBoardStr + pop esi +end if + jmp .out ; in: ecx = channel (1 - Left; 2 - Right) ; out: eax = volume (-10000 - 0) align 4 get_channel_volume: - push ebx ecx edx - cmp ecx, 2 - jg .out - dec cl - xor eax, eax - mov edx, [volume.out_amp_node] - test edx, edx - jz .out - movzx ebx, [edx+HDA_GNODE.nid] - stdcall get_volume_mute, ebx, ecx, HDA_OUTPUT, 0 - mov cl, [volume.step_size] - mul cl - - mov cx, 100 - mul cx - shr eax, 2 ; *0.25 - neg eax - .out: - pop edx ecx ebx - ret + push ebx ecx edx + cmp ecx, 2 + jg .out + dec cl + xor eax, eax + mov edx, [volume.out_amp_node] + test edx, edx + jz .out + movzx ebx, [edx+HDA_GNODE.nid] + stdcall get_volume_mute, ebx, ecx, HDA_OUTPUT, 0 + and eax, 0x7F ;get gain + mov cl, [volume.step_size] + mul cl + imul eax, (-100/4) +.out: + pop edx ecx ebx + ret ; in: ecx = delay @@ -2526,14 +2518,14 @@ udelay: test ecx, ecx jnz @f inc ecx - @@: +@@: mov eax, ecx mov cx, 500 mul cl mov ecx, edx shl ecx, 16 or ecx, eax - @@: +@@: xor eax, eax cpuid dec ecx @@ -2552,7 +2544,7 @@ proc StallExec rdtsc add ebx, eax adc ecx,edx - @@: +@@: rdtsc sub eax, ebx sbb edx, ecx @@ -2613,12 +2605,17 @@ endp ;Asper remember to add this functions: proc snd_hda_queue_unsol_event stdcall, par1:dword, par2:dword - if DEBUG +if DEBUG push esi mov esi, msgUnsolEvent - call SysMsgBoardStr + invoke SysMsgBoardStr pop esi - end if +end if +if USE_UNSOL_EV = 0 + ;Test. Do not make queue, process immediately! + ;stdcall here snd_hda_read_pin_sense stdcall, nid:dword, trigger_sense:dword + ;and then mute/unmute pin based on the results +end if ret endp ;... @@ -2630,7 +2627,7 @@ proc fdword2str stdcall, flags:dword ; bit 0 - skipLeadZeroes; bit 1 - newLine; mov esi, hex_buff mov ecx, -8 push eax - @@: +@@: rol eax, 4 mov ebx, eax and ebx, 0x0F @@ -2644,13 +2641,13 @@ proc fdword2str stdcall, flags:dword ; bit 0 - skipLeadZeroes; bit 1 - newLine; test [flags], 0x2 ; new line ? jz .no_newline mov dword [esi+8], 0x00000A0D - .no_newline: +.no_newline: push eax test [flags], 0x1 ; skip zero bits ? jz .no_skipz mov ecx, 8 - @@: +@@: test eax, 0xF0000000 jnz .skipz_done rol eax, 4 @@ -2658,8 +2655,8 @@ proc fdword2str stdcall, flags:dword ; bit 0 - skipLeadZeroes; bit 1 - newLine; dec ecx jnz @b dec esi - .skipz_done: - .no_skipz: +.skipz_done: +.no_skipz: pop eax pop ecx ebx eax @@ -2676,97 +2673,97 @@ include "hda_generic.inc" align 4 devices: ; Intel - dd (CTRL_INTEL_SCH2 shl 16)+VID_INTEL,msg_INTEL_SCH2, AZX_DRIVER_SCH - dd (CTRL_INTEL_HPT shl 16)+VID_INTEL,msg_INTEL_HPT, AZX_DRIVER_SCH - dd (CTRL_INTEL_CPT shl 16)+VID_INTEL,msg_INTEL_CPT, AZX_DRIVER_PCH - dd (CTRL_INTEL_PGB shl 16)+VID_INTEL,msg_INTEL_PGB, AZX_DRIVER_PCH - dd (CTRL_INTEL_PPT1 shl 16)+VID_INTEL,msg_INTEL_PPT1, AZX_DRIVER_PCH - dd (CTRL_INTEL_82801F shl 16)+VID_INTEL,msg_INTEL_82801F, AZX_DRIVER_ICH - dd (CTRL_INTEL_63XXESB shl 16)+VID_INTEL,msg_INTEL_63XXESB, AZX_DRIVER_ICH - dd (CTRL_INTEL_82801G shl 16)+VID_INTEL,msg_INTEL_82801G, AZX_DRIVER_ICH - dd (CTRL_INTEL_82801H shl 16)+VID_INTEL,msg_INTEL_82801H, AZX_DRIVER_ICH - dd (CTRL_INTEL_82801_UNK1 shl 16)+VID_INTEL,msg_INTEL_82801_UNK1, AZX_DRIVER_ICH - dd (CTRL_INTEL_82801I shl 16)+VID_INTEL,msg_INTEL_82801I, AZX_DRIVER_ICH - dd (CTRL_INTEL_82801_UNK2 shl 16)+VID_INTEL,msg_INTEL_82801_UNK2, AZX_DRIVER_ICH - dd (CTRL_INTEL_82801JI shl 16)+VID_INTEL,msg_INTEL_82801JI, AZX_DRIVER_ICH - dd (CTRL_INTEL_82801JD shl 16)+VID_INTEL,msg_INTEL_82801JD, AZX_DRIVER_ICH - dd (CTRL_INTEL_PCH shl 16)+VID_INTEL,msg_INTEL_PCH, AZX_DRIVER_PCH - dd (CTRL_INTEL_PCH2 shl 16)+VID_INTEL,msg_INTEL_PCH2, AZX_DRIVER_PCH - dd (CTRL_INTEL_SCH shl 16)+VID_INTEL,msg_INTEL_SCH, AZX_DRIVER_SCH - dd (CTRL_INTEL_LPT shl 16)+VID_INTEL,msg_INTEL_LPT, AZX_DRIVER_PCH + dd (CTRL_INTEL_SCH2 shl 16)+VID_INTEL,msg_INTEL_SCH2, AZX_DRIVER_SCH + dd (CTRL_INTEL_HPT shl 16)+VID_INTEL,msg_INTEL_HPT, AZX_DRIVER_SCH + dd (CTRL_INTEL_CPT shl 16)+VID_INTEL,msg_INTEL_CPT, AZX_DRIVER_PCH + dd (CTRL_INTEL_PGB shl 16)+VID_INTEL,msg_INTEL_PGB, AZX_DRIVER_PCH + dd (CTRL_INTEL_PPT1 shl 16)+VID_INTEL,msg_INTEL_PPT1, AZX_DRIVER_PCH + dd (CTRL_INTEL_82801F shl 16)+VID_INTEL,msg_INTEL_82801F, AZX_DRIVER_ICH + dd (CTRL_INTEL_63XXESB shl 16)+VID_INTEL,msg_INTEL_63XXESB, AZX_DRIVER_ICH + dd (CTRL_INTEL_82801G shl 16)+VID_INTEL,msg_INTEL_82801G, AZX_DRIVER_ICH + dd (CTRL_INTEL_82801H shl 16)+VID_INTEL,msg_INTEL_82801H, AZX_DRIVER_ICH + dd (CTRL_INTEL_82801_UNK1 shl 16)+VID_INTEL,msg_INTEL_82801_UNK1, AZX_DRIVER_ICH + dd (CTRL_INTEL_82801I shl 16)+VID_INTEL,msg_INTEL_82801I, AZX_DRIVER_ICH + dd (CTRL_INTEL_82801_UNK2 shl 16)+VID_INTEL,msg_INTEL_82801_UNK2, AZX_DRIVER_ICH + dd (CTRL_INTEL_82801JI shl 16)+VID_INTEL,msg_INTEL_82801JI, AZX_DRIVER_ICH + dd (CTRL_INTEL_82801JD shl 16)+VID_INTEL,msg_INTEL_82801JD, AZX_DRIVER_ICH + dd (CTRL_INTEL_PCH shl 16)+VID_INTEL,msg_INTEL_PCH, AZX_DRIVER_PCH + dd (CTRL_INTEL_PCH2 shl 16)+VID_INTEL,msg_INTEL_PCH2, AZX_DRIVER_PCH + dd (CTRL_INTEL_SCH shl 16)+VID_INTEL,msg_INTEL_SCH, AZX_DRIVER_SCH + dd (CTRL_INTEL_LPT shl 16)+VID_INTEL,msg_INTEL_LPT, AZX_DRIVER_PCH ; Nvidia - dd (CTRL_NVIDIA_MCP51 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP51, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_MCP55 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP55, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_MCP61_1 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP61, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_MCP61_2 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP61, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_MCP65_1 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP65, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_MCP65_2 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP65, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_MCP67_1 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP67, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_MCP67_2 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP67, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_MCP73_1 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP73, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_MCP73_2 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP73, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_MCP78_1 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP78, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_MCP78_2 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP78, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_MCP78_3 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP78, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_MCP78_4 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP78, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_MCP79_1 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP79, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_MCP79_2 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP79, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_MCP79_3 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP79, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_MCP79_4 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP79, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_0BE2 shl 16)+VID_NVIDIA,msg_NVIDIA_0BE2, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_0BE3 shl 16)+VID_NVIDIA,msg_NVIDIA_0BE3, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_0BE4 shl 16)+VID_NVIDIA,msg_NVIDIA_0BE4, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_GT100 shl 16)+VID_NVIDIA,msg_NVIDIA_GT100, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_GT106 shl 16)+VID_NVIDIA,msg_NVIDIA_GT106, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_GT108 shl 16)+VID_NVIDIA,msg_NVIDIA_GT108, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_GT104 shl 16)+VID_NVIDIA,msg_NVIDIA_GT104, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_GT116 shl 16)+VID_NVIDIA,msg_NVIDIA_GT116, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_MCP89_1 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP89, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_MCP89_2 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP89, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_MCP89_3 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP89, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_MCP89_4 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP89, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_GF119 shl 16)+VID_NVIDIA,msg_NVIDIA_GF119, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_GF110_1 shl 16)+VID_NVIDIA,msg_NVIDIA_GF110, AZX_DRIVER_NVIDIA - dd (CTRL_NVIDIA_GF110_2 shl 16)+VID_NVIDIA,msg_NVIDIA_GF110, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_MCP51 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP51, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_MCP55 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP55, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_MCP61_1 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP61, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_MCP61_2 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP61, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_MCP65_1 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP65, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_MCP65_2 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP65, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_MCP67_1 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP67, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_MCP67_2 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP67, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_MCP73_1 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP73, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_MCP73_2 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP73, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_MCP78_1 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP78, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_MCP78_2 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP78, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_MCP78_3 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP78, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_MCP78_4 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP78, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_MCP79_1 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP79, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_MCP79_2 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP79, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_MCP79_3 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP79, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_MCP79_4 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP79, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_0BE2 shl 16)+VID_NVIDIA,msg_NVIDIA_0BE2, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_0BE3 shl 16)+VID_NVIDIA,msg_NVIDIA_0BE3, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_0BE4 shl 16)+VID_NVIDIA,msg_NVIDIA_0BE4, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_GT100 shl 16)+VID_NVIDIA,msg_NVIDIA_GT100, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_GT106 shl 16)+VID_NVIDIA,msg_NVIDIA_GT106, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_GT108 shl 16)+VID_NVIDIA,msg_NVIDIA_GT108, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_GT104 shl 16)+VID_NVIDIA,msg_NVIDIA_GT104, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_GT116 shl 16)+VID_NVIDIA,msg_NVIDIA_GT116, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_MCP89_1 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP89, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_MCP89_2 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP89, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_MCP89_3 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP89, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_MCP89_4 shl 16)+VID_NVIDIA,msg_NVIDIA_MCP89, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_GF119 shl 16)+VID_NVIDIA,msg_NVIDIA_GF119, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_GF110_1 shl 16)+VID_NVIDIA,msg_NVIDIA_GF110, AZX_DRIVER_NVIDIA + dd (CTRL_NVIDIA_GF110_2 shl 16)+VID_NVIDIA,msg_NVIDIA_GF110, AZX_DRIVER_NVIDIA ; ATI - dd (CTRL_ATI_SB450 shl 16)+VID_ATI,msg_ATI_SB450, AZX_DRIVER_ATI - dd (CTRL_ATI_SB600 shl 16)+VID_ATI,msg_ATI_SB600, AZX_DRIVER_ATI - dd (CTRL_ATI_RS600 shl 16)+VID_ATI,msg_ATI_RS600, AZX_DRIVER_ATIHDMI - dd (CTRL_ATI_RS690 shl 16)+VID_ATI,msg_ATI_RS690, AZX_DRIVER_ATIHDMI - dd (CTRL_ATI_RS780 shl 16)+VID_ATI,msg_ATI_RS780, AZX_DRIVER_ATIHDMI - dd (CTRL_ATI_RS_UNK1 shl 16)+VID_ATI,msg_ATI_RS_UNK1, AZX_DRIVER_ATIHDMI - dd (CTRL_ATI_R600 shl 16)+VID_ATI,msg_ATI_R600, AZX_DRIVER_ATIHDMI - dd (CTRL_ATI_RV610 shl 16)+VID_ATI,msg_ATI_RV610, AZX_DRIVER_ATIHDMI - dd (CTRL_ATI_RV620 shl 16)+VID_ATI,msg_ATI_RV620, AZX_DRIVER_ATIHDMI - dd (CTRL_ATI_RV630 shl 16)+VID_ATI,msg_ATI_RV630, AZX_DRIVER_ATIHDMI - dd (CTRL_ATI_RV635 shl 16)+VID_ATI,msg_ATI_RV635, AZX_DRIVER_ATIHDMI - dd (CTRL_ATI_RV670 shl 16)+VID_ATI,msg_ATI_RV670, AZX_DRIVER_ATIHDMI - dd (CTRL_ATI_RV710 shl 16)+VID_ATI,msg_ATI_RV710, AZX_DRIVER_ATIHDMI - dd (CTRL_ATI_RV730 shl 16)+VID_ATI,msg_ATI_RV730, AZX_DRIVER_ATIHDMI - dd (CTRL_ATI_RV740 shl 16)+VID_ATI,msg_ATI_RV740, AZX_DRIVER_ATIHDMI - dd (CTRL_ATI_RV770 shl 16)+VID_ATI,msg_ATI_RV770, AZX_DRIVER_ATIHDMI + dd (CTRL_ATI_SB450 shl 16)+VID_ATI,msg_ATI_SB450, AZX_DRIVER_ATI + dd (CTRL_ATI_SB600 shl 16)+VID_ATI,msg_ATI_SB600, AZX_DRIVER_ATI + dd (CTRL_ATI_RS600 shl 16)+VID_ATI,msg_ATI_RS600, AZX_DRIVER_ATIHDMI + dd (CTRL_ATI_RS690 shl 16)+VID_ATI,msg_ATI_RS690, AZX_DRIVER_ATIHDMI + dd (CTRL_ATI_RS780 shl 16)+VID_ATI,msg_ATI_RS780, AZX_DRIVER_ATIHDMI + dd (CTRL_ATI_RS_UNK1 shl 16)+VID_ATI,msg_ATI_RS_UNK1, AZX_DRIVER_ATIHDMI + dd (CTRL_ATI_R600 shl 16)+VID_ATI,msg_ATI_R600, AZX_DRIVER_ATIHDMI + dd (CTRL_ATI_RV610 shl 16)+VID_ATI,msg_ATI_RV610, AZX_DRIVER_ATIHDMI + dd (CTRL_ATI_RV620 shl 16)+VID_ATI,msg_ATI_RV620, AZX_DRIVER_ATIHDMI + dd (CTRL_ATI_RV630 shl 16)+VID_ATI,msg_ATI_RV630, AZX_DRIVER_ATIHDMI + dd (CTRL_ATI_RV635 shl 16)+VID_ATI,msg_ATI_RV635, AZX_DRIVER_ATIHDMI + dd (CTRL_ATI_RV670 shl 16)+VID_ATI,msg_ATI_RV670, AZX_DRIVER_ATIHDMI + dd (CTRL_ATI_RV710 shl 16)+VID_ATI,msg_ATI_RV710, AZX_DRIVER_ATIHDMI + dd (CTRL_ATI_RV730 shl 16)+VID_ATI,msg_ATI_RV730, AZX_DRIVER_ATIHDMI + dd (CTRL_ATI_RV740 shl 16)+VID_ATI,msg_ATI_RV740, AZX_DRIVER_ATIHDMI + dd (CTRL_ATI_RV770 shl 16)+VID_ATI,msg_ATI_RV770, AZX_DRIVER_ATIHDMI ; AMD - dd (CTRL_AMD_HUDSON shl 16)+VID_AMD,msg_AMD_HUDSON, AZX_DRIVER_GENERIC + dd (CTRL_AMD_HUDSON shl 16)+VID_AMD,msg_AMD_HUDSON, AZX_DRIVER_GENERIC ; VIA - dd (CTRL_VIA_VT82XX shl 16)+VID_VIA,msg_VIA_VT82XX, AZX_DRIVER_VIA - dd (CTRL_VIA_VT61XX shl 16)+VID_VIA,msg_VIA_VT61XX, AZX_DRIVER_GENERIC - dd (CTRL_VIA_VT71XX shl 16)+VID_VIA,msg_VIA_VT71XX, AZX_DRIVER_GENERIC + dd (CTRL_VIA_VT82XX shl 16)+VID_VIA,msg_VIA_VT82XX, AZX_DRIVER_VIA + dd (CTRL_VIA_VT61XX shl 16)+VID_VIA,msg_VIA_VT61XX, AZX_DRIVER_GENERIC + dd (CTRL_VIA_VT71XX shl 16)+VID_VIA,msg_VIA_VT71XX, AZX_DRIVER_GENERIC ; SiS - dd (CTRL_SIS_966 shl 16)+VID_SIS,msg_SIS_966, AZX_DRIVER_SIS + dd (CTRL_SIS_966 shl 16)+VID_SIS,msg_SIS_966, AZX_DRIVER_SIS ; ULI - dd (CTRL_ULI_M5461 shl 16)+VID_ULI,msg_ULI_M5461, AZX_DRIVER_ULI + dd (CTRL_ULI_M5461 shl 16)+VID_ULI,msg_ULI_M5461, AZX_DRIVER_ULI ; Teradici - dd (CTRL_TERA_UNK1 shl 16)+VID_ULI,msg_TERA_UNK1, AZX_DRIVER_TERA + dd (CTRL_TERA_UNK1 shl 16)+VID_ULI,msg_TERA_UNK1, AZX_DRIVER_TERA ; Creative - dd (CTRL_CREATIVE_CA0110_IBG shl 16)+VID_CREATIVE,msg_CREATIVE_CA0110_IBG, AZX_DRIVER_CTX - dd (CTRL_CREATIVE_SOUND_CORE3D_1 shl 16)+VID_CREATIVE,msg_CREATIVE_SOUND_CORE3D, AZX_DRIVER_GENERIC - dd (CTRL_CREATIVE_SOUND_CORE3D_2 shl 16)+VID_CREATIVE,msg_CREATIVE_SOUND_CORE3D, AZX_DRIVER_GENERIC + dd (CTRL_CREATIVE_CA0110_IBG shl 16)+VID_CREATIVE,msg_CREATIVE_CA0110_IBG, AZX_DRIVER_CTX + dd (CTRL_CREATIVE_SOUND_CORE3D_1 shl 16)+VID_CREATIVE,msg_CREATIVE_SOUND_CORE3D, AZX_DRIVER_GENERIC + dd (CTRL_CREATIVE_SOUND_CORE3D_2 shl 16)+VID_CREATIVE,msg_CREATIVE_SOUND_CORE3D, AZX_DRIVER_GENERIC ; RDC Semiconductor - dd (CTRL_RDC_R3010 shl 16)+VID_RDC,msg_RDC_R3010, AZX_DRIVER_GENERIC + dd (CTRL_RDC_R3010 shl 16)+VID_RDC,msg_RDC_R3010, AZX_DRIVER_GENERIC ; VMware - dd (CTRL_VMWARE_UNK1 shl 16)+VID_VMWARE,msg_VMWARE_UNK1, AZX_DRIVER_GENERIC + dd (CTRL_VMWARE_UNK1 shl 16)+VID_VMWARE,msg_VMWARE_UNK1, AZX_DRIVER_GENERIC - dd 0 ;terminator + dd 0 ;terminator version dd (5 shl 16) or (API_VERSION and 0xFFFF) @@ -2945,7 +2942,7 @@ end if if DEBUG msgYAHOO2 db 'YAHOO2: ',0 - msgMaxVolume db 'MaxVolume: ',0 + msgMinVolume db 'MinVolume: ',0 msgNewVolume db 'NewVolume: ',0 msgVerbQuery db 'Q: ',0 @@ -2960,13 +2957,13 @@ if DEBUG msgBeeperNid db 'Beeper found: NID=',0 msgBeeperValue db 'Beeper initial value: ',0 msgBeepNow db 'Beep!',13,10,0 + + msgNodeSeq db 'Sequence of codec nodes:',13,10,0 + msgNID db 'NID: 0x',0 end if ;] Asper - -section '.data' data readable writable align 16 - aspinlock dd SPINLOCK_FREE codec CODEC