Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5046 → Rev 5048

/drivers/audio/intel_hda/PROC32.INC
File deleted
/drivers/audio/intel_hda/IMPORTS.INC
File deleted
/drivers/audio/intel_hda/CODEC.INC
40,13 → 40,13
mov eax, -1
ret
@@:
if FDEBUG ;YAHOO
if FDEBUG
push eax esi
mov esi, msgVerbQuery
call SysMsgBoardStr
invoke SysMsgBoardStr
mov eax, ebx
stdcall fdword2str, 2
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi eax
end if
 
64,16 → 64,15
jz .end_debug
push eax esi
mov esi, msgVerbAnswer
call SysMsgBoardStr
invoke SysMsgBoardStr
mov eax, edx
stdcall fdword2str, 2
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi eax
.end_debug:
end if
 
@@:
 
;call snd_hda_power_down
cmp edx, -1
jne .l1
88,7 → 87,7
if DEBUG
push esi
mov esi, emsgBusResetFatalComm
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi
end if
call azx_bus_reset
199,7 → 198,6
inc eax
@@:
and eax, 0x7FFF7FFF
 
ret
endp
 
246,10 → 244,10
jnz .conn_list_ok
if DEBUG
mov esi, emsgConnListNotAvailable
call SysMsgBoardStr
invoke SysMsgBoardStr
mov eax, [nid]
stdcall fdword2str, 3
call SysMsgBoardStr
invoke SysMsgBoardStr
end if
xor eax, eax
dec eax
333,22 → 331,22
if DEBUG
push eax esi
mov esi, emsgInvConnList
call SysMsgBoardStr
invoke SysMsgBoardStr
mov eax, [nid]
stdcall fdword2str, 1
call SysMsgBoardStr
invoke SysMsgBoardStr
 
mov esi, strSemicolon
call SysMsgBoardStr
invoke SysMsgBoardStr
mov eax, ecx
stdcall fdword2str, 0
call SysMsgBoardStr
invoke SysMsgBoardStr
 
mov esi, strSemicolon
call SysMsgBoardStr
invoke SysMsgBoardStr
mov eax, [parm]
stdcall fdword2str, 2
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi eax
end if
xor eax, eax
372,18 → 370,18
push eax esi
push esi
mov esi, emsgInvDepRangeVal
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi
push eax
mov eax, esi
stdcall fdword2str, 0
call SysMsgBoardStr
invoke SysMsgBoardStr
 
mov esi, strSemicolon
call SysMsgBoardStr
invoke SysMsgBoardStr
pop eax
stdcall fdword2str, 2
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi eax
end if
jmp .continue
398,7 → 396,7
if DEBUG
push esi
mov esi, emsgTooManyConns
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi
end if
pop ecx
426,7 → 424,7
if DEBUG
push esi
mov esi, emsgTooManyConns
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi
end if
jmp .err_out
511,12 → 509,11
mov eax, [codec.afg]
test eax, eax
jnz @f
 
;Asper+: try to use another codec if possible [
if DEBUG
push esi
mov esi, msgNoAFGFound
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi
end if
push ecx
534,7 → 531,7
if DEBUG
push esi
mov esi, emsgNoAFGorMFGFound
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi
end if
.skip_codec:
551,7 → 548,7
if DEBUG
push esi
mov esi, emsgNoMem
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi
end if
pop ebx
571,9 → 568,7
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
 
602,7 → 597,7
if DEBUG
push esi
mov esi, emsgNoParserAvailable
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi
end if
@@:
630,7 → 625,7
mov eax, [edi+4]
mov [codec.ac_vendor_ids], eax
mov esi, eax
call SysMsgBoardStr
invoke SysMsgBoardStr
.get_chip_name:
stdcall detect_chip, [edi+8]
pop esi edi ebx eax
643,10 → 638,10
mov [codec.chip_ids], chip_unknown
 
mov esi, chip_unknown
call SysMsgBoardStr
invoke SysMsgBoardStr
movzx eax, [codec.chip_id]
stdcall fdword2str, 2
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi edi ebx eax
ret
endp
654,7 → 649,6
 
align 4
proc detect_chip stdcall, chip_tab:dword
 
push eax ebx edi esi
mov ax, [codec.chip_id]
 
669,7 → 663,7
mov eax, [edi+4]
mov [codec.chip_ids], eax
mov esi, eax
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi edi ebx eax
ret
.next:
678,10 → 672,10
.unknown:
mov [codec.chip_ids], chip_unknown
mov esi, chip_unknown
call SysMsgBoardStr
invoke SysMsgBoardStr
movzx eax, [codec.chip_id]
stdcall fdword2str, 2
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi edi ebx eax
ret
endp
697,19 → 691,19
shr ebx, 16
and ebx, 0x7FFF ; nid
 
if DEBUG ;YAHOO
if DEBUG
push eax esi
mov esi, msgSETUP_FG_NODES
call SysMsgBoardStr
invoke SysMsgBoardStr
mov eax, ebx
stdcall fdword2str, 1
call SysMsgBoardStr
invoke SysMsgBoardStr
 
mov esi, strSemicolon
call SysMsgBoardStr
invoke SysMsgBoardStr
mov eax, ecx
stdcall fdword2str, 3
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi eax
end if
 
719,12 → 713,12
snd_hda_param_read ebx, AC_PAR_FUNCTION_TYPE
and eax, 0xFF
 
if DEBUG ;YAHOO
if DEBUG
push eax esi
mov esi, msgFG_TYPE
call SysMsgBoardStr
invoke SysMsgBoardStr
stdcall fdword2str, 3
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi eax
end if
 
766,26 → 760,26
and ebx, 0x7FFF ; nid
mov [codec.start_nid], bx
 
if DEBUG ;YAHOO
if DEBUG
push eax esi
mov esi, msgSETUP_FG_NODES
call SysMsgBoardStr
invoke SysMsgBoardStr
mov eax, ebx
stdcall fdword2str, 1
call SysMsgBoardStr
invoke SysMsgBoardStr
 
mov esi, strSemicolon
call SysMsgBoardStr
invoke SysMsgBoardStr
mov eax, ecx
stdcall fdword2str, 3
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi eax
end if
 
if FDEBUG ;YAHOO
if FDEBUG
push esi
mov esi, msgWCaps
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi
end if
 
792,7 → 786,7
mov eax, ecx
shl eax, 2
push ebx ecx
call Kmalloc
invoke Kmalloc
pop ecx ebx
test eax, eax
jz .err_out
828,7 → 822,7
mov eax, HDA_PINCFG.sizeof
mul cl
push ebx ecx
call Kmalloc
invoke Kmalloc
pop ecx ebx
test eax, eax
jz .err_out
840,7 → 834,7
if FDEBUG
push eax esi
mov esi, msgPinCfgs
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi eax
end if
 
958,27 → 952,27
if DEBUG
push esi
mov esi, msgHDACodecSetupStream
call SysMsgBoardStr
invoke SysMsgBoardStr
stdcall fdword2str, 3
call SysMsgBoardStr
invoke SysMsgBoardStr
 
mov esi, msgStream
call SysMsgBoardStr
invoke SysMsgBoardStr
mov eax, [stream_tag]
stdcall fdword2str, 3
call SysMsgBoardStr
invoke SysMsgBoardStr
 
mov esi, msgChannel
call SysMsgBoardStr
invoke SysMsgBoardStr
mov eax, [channel_id]
stdcall fdword2str, 3
call SysMsgBoardStr
invoke SysMsgBoardStr
 
mov esi, msgFormat
call SysMsgBoardStr
invoke SysMsgBoardStr
mov eax, [format]
stdcall fdword2str, 3
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi
end if
mov eax, [stream_tag]
1006,9 → 1000,9
if DEBUG
push esi
mov esi, msgHDACodecCleanupStream
call SysMsgBoardStr
invoke SysMsgBoardStr
stdcall fdword2str, 3
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi
end if
stdcall snd_hda_codec_write, [nid], 0, AC_VERB_SET_CHANNEL_STREAMID, 0
1133,7 → 1127,52
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
1151,7 → 1190,6
 
mov dx, [codec.vendor_id]
cmp dx, 0x14F1
 
jne @f
mov eax, 10000
call StallExec
1285,7 → 1323,6
dd 0xFF
 
chips_IDT dd 0xFF
 
chips_LSI dd 0x1039, chip_LSI1039
dd 0x1040, chip_LSI1040
dd 0x3026, chip_LSI3026
1362,3 → 1399,4
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
 
/drivers/audio/intel_hda/CODEC_H.INC
598,7 → 598,6
 
 
; 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
623,7 → 622,6
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
633,8 → 631,6
 
;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
644,5 → 640,4
ret
endp
 
 
;Asper ]
/drivers/audio/intel_hda/hda_generic.inc
52,7 → 52,6
}
 
; retrieve the default device type from the default config value
 
proc defcfg_type stdcall, node:dword
push edx
mov edx, [node]
93,7 → 92,6
ret
endp
 
 
; destructor
proc snd_hda_generic_free
push eax ebx edx edi
112,19 → 110,19
cmp eax, edi
je @f
pusha
call Kfree ;free conn_list
invoke Kfree ;free conn_list
popa
@@:
mov eax, edx
mov edx, [edx + HDA_GNODE.next]
pusha
call Kfree ;free node
invoke Kfree ;free node
popa
jmp .next
.free_head:
mov eax, [spec.nid_list]
pusha
call Kfree ;free the very 1st node in the list
invoke Kfree ;free the very 1st node in the list
popa
mov [spec.nid_list], 0
.out:
138,7 → 136,7
push ebx ecx edx edi esi
 
mov eax, HDA_GNODE.sizeof
call Kmalloc
invoke Kmalloc
test eax, eax
jz .err_out ; Not enough memory
 
160,7 → 158,7
 
mov eax, HDA_MAX_CONNECTIONS*2 ;HDA_MAX_CONNECTIONS * sizeof(word)
push ebx ecx edx
call Kmalloc ;malloc temporary conn_list
invoke Kmalloc ;malloc temporary conn_list
pop edx ecx ebx
mov edi, eax
 
174,7 → 172,7
 
mov eax, edx
pusha
call Kfree ;free node
invoke Kfree ;free node
popa
mov eax, ecx
jmp .out
192,7 → 190,7
mov eax, ecx
shl ecx, 1
push ebx ecx edx edi
call Kmalloc ;malloc conn_list
invoke Kmalloc ;malloc conn_list
pop edi edx ecx ebx
shr ecx, 1
test eax, eax
200,7 → 198,7
 
mov eax, edi
pusha
call Kfree ;free temporary conn_list
invoke Kfree ;free temporary conn_list
popa
jmp .err_out
@@:
264,20 → 262,20
; if DEBUG
; push eax esi
; mov esi, msgBeeperNid
; call SysMsgBoardStr
; invoke SysMsgBoardStr
; push eax
; mov eax, [nid]
; stdcall fdword2str, 2
; call SysMsgBoardStr
; invoke SysMsgBoardStr
;
; mov esi, msgBeeperValue
; call SysMsgBoardStr
; invoke SysMsgBoardStr
; pop eax
; stdcall fdword2str, 2
; call SysMsgBoardStr
; invoke SysMsgBoardStr
;
; mov esi, msgBeepNow
; call SysMsgBoardStr
; invoke SysMsgBoardStr
; pop esi eax
; end if
; mov ecx, 256*1
294,9 → 292,9
; if DEBUG
; ;push eax esi
; mov esi, msgBeeperValue
; call SysMsgBoardStr
; invoke SysMsgBoardStr
; stdcall fdword2str, 2
; call SysMsgBoardStr
; invoke SysMsgBoardStr
; ;pop esi eax
; end if
; .not_beeper:
367,7 → 365,7
.out:
mov eax, edi
pusha
call Kfree ;free temporary conn_list
invoke Kfree ;free temporary conn_list
popa
xor eax, eax
pop esi edi edx ecx ebx
376,7 → 374,7
.err_out:
mov eax, edx
pusha
call Kfree ;free node
invoke Kfree ;free node
popa
xor eax, eax
dec eax
411,7 → 409,7
if FDEBUG
push esi
mov esi, emsgInvalidAFGSubtree
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi
end if
xor eax, eax
437,7 → 435,34
ret
endp
 
;Asper+[
proc print_afg_tree_nodes
push eax esi edi
mov esi, msgNodeSeq
invoke SysMsgBoardStr
 
mov edi, [spec.nid_list]
test edi, edi
jz .out
.next_node:
movzx eax, word [edi + HDA_GNODE.nid]
mov esi, msgNID
invoke SysMsgBoardStr
stdcall fdword2str, 3
invoke SysMsgBoardStr
 
mov eax, [edi + HDA_GNODE.next]
test eax, eax
jz .out
 
mov edi, eax
jmp .next_node
.out:
pop edi esi eax
ret
endp
;Asper+]
 
; look for the node record for the given NID
proc hda_get_node stdcall, nid:dword
push ebx edx esi
480,10 → 505,10
if DEBUG
push eax esi
mov esi, msgEnableEAPD
call SysMsgBoardStr
invoke SysMsgBoardStr
mov eax, ebx
stdcall fdword2str, 3
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi eax
end if
.out:
494,7 → 519,6
 
; unmute (and set max vol) the output amplifier
proc unmute_output stdcall, node:dword
 
push ebx ecx edx esi
mov esi, [node]
test [esi + HDA_GNODE.wid_caps], AC_WCAP_OUT_AMP
503,9 → 527,9
if DEBUG
push esi
mov esi, msgUnmuteOut
call SysMsgBoardStr
invoke SysMsgBoardStr
stdcall fdword2str, 3
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi
end if
 
528,27 → 552,23
if DEBUG
push eax esi
mov esi, msgAmpVal
call SysMsgBoardStr
invoke SysMsgBoardStr
stdcall fdword2str, 1
call SysMsgBoardStr
invoke SysMsgBoardStr
 
mov esi, strSemicolon
call SysMsgBoardStr
invoke SysMsgBoardStr
mov eax, ecx
stdcall fdword2str, 3
call SysMsgBoardStr
invoke 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
imul eax, (100/4)
mov [volume.maxDb], eax
 
.out:
xor eax, eax
pop esi edx ecx ebx
566,14 → 586,14
if DEBUG
push eax esi
mov esi, msgUnmuteIn
call SysMsgBoardStr
invoke SysMsgBoardStr
stdcall fdword2str, 3
call SysMsgBoardStr
invoke SysMsgBoardStr
mov esi, msgIdx
call SysMsgBoardStr
invoke SysMsgBoardStr
mov eax, [index]
stdcall fdword2str, 3
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi eax
end if
 
599,16 → 619,16
mov ebx, [index]
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
stdcall snd_hda_codec_write, eax, 0, AC_VERB_SET_CONNECT_SEL, ebx
630,7 → 650,6
jz .out
mov esi, eax
jmp .next_node
 
.out:
pop esi eax
ret
661,9 → 680,9
if DEBUG
push esi
mov esi, msgSkipDigitalOutNode
call SysMsgBoardStr
invoke SysMsgBoardStr
stdcall fdword2str, 3
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi
end if
jmp .ret_zero
671,9 → 690,9
if DEBUG
push eax esi
mov esi, msgAudOutFound
call SysMsgBoardStr
invoke SysMsgBoardStr
stdcall fdword2str, 3
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi eax
end if
 
768,12 → 787,16
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
; invoke SysMsgBoardStr
; pop esi
movzx eax, [esi + HDA_GNODE.nid]
movzx ebx, [esi + HDA_GNODE.pin_ctl]
781,38 → 804,42
mov edx, [esi + HDA_GNODE.def_cfg]
mov edi, [esi + HDA_GNODE.amp_out_caps]
mov esi, msgPin_Nid
call SysMsgBoardStr
invoke SysMsgBoardStr
stdcall fdword2str, 3
call SysMsgBoardStr
invoke SysMsgBoardStr
 
mov esi, msgPin_Ctl
call SysMsgBoardStr
invoke SysMsgBoardStr
mov eax, ebx
stdcall fdword2str, 2
call SysMsgBoardStr
invoke SysMsgBoardStr
 
mov esi, msgPin_Caps
call SysMsgBoardStr
invoke SysMsgBoardStr
mov eax, ecx
stdcall fdword2str, 2
call SysMsgBoardStr
invoke SysMsgBoardStr
 
mov esi, msgDef_Cfg
call SysMsgBoardStr
invoke SysMsgBoardStr
mov eax, edx
stdcall fdword2str, 2
call SysMsgBoardStr
invoke SysMsgBoardStr
 
mov esi, msgAmp_Out_Caps
call SysMsgBoardStr
invoke SysMsgBoardStr
mov eax, edi
stdcall fdword2str, 2
call SysMsgBoardStr
 
invoke SysMsgBoardStr
popa
end if
; 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,6 → 848,7
mov edx, [spec.out_pin_node]
test edx, edx
jz @f
.use_dac1:
stdcall clear_check_flags
stdcall parse_output_path, esi, 1
@@:
899,7 → 927,7
if DEBUG
push esi
mov esi, emsgNoProperOutputPathFound
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi
end if
@@:
921,6 → 949,10
cmp eax, 0
jl .error
 
if FDEBUG
stdcall print_afg_tree_nodes ;Asper+
end if
 
stdcall parse_output
xor eax, eax
.out:
/drivers/audio/intel_hda/intel_hda.asm
5,7 → 5,8
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
format MS COFF
format PE DLL native 0.05
section '.flat' code readable writable executable
 
DEBUG equ 1
FDEBUG equ 0
12,25 → 13,21
DEBUG_IRQ equ 0
 
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
344,7 → 341,8
;Asper: Non standard system service. For the tests only! ]
 
struc AC_CNTRL ;AC controller base class
{ .bus dd ?
{
.bus dd ?
.devfn dd ?
 
.vendor dw ?
377,7 → 375,6
.ctrl_write16 dd ?
.ctrl_write32 dd ?
 
;Asper+ [
.codec_mask dd ?
.rb dd ?
.rirb_rp dw 0
394,12 → 391,10
.start_wallclk dd ? ; start + minimum wallclk
.period_wallclk dd ? ; wallclk for period
.position_fix db ?
;Asper+ ]
}
 
struc CODEC ;Audio Chip base class
{
;Asper+ [
.addr dd ? ; codec slot index (codec address)
.afg dd ? ; AFG node id
.mfg dd ? ; MFG node id
419,7 → 414,6
.num_pins dd ? ;Asper + : word is enough, but for align...
.beeper_nid dw ?
.pad dw ?
;Asper+ ]
 
.ac_vendor_ids dd ? ;ac vendor id string
.chip_ids dd ? ;chip model string
426,7 → 420,8
}
 
struc CTRL_INFO
{ .pci_cmd dd ?
{
.pci_cmd dd ?
.irq dd ?
.glob_cntrl dd ?
.glob_sta dd ?
438,7 → 433,8
}
 
struc IOCTL
{ .handle dd ?
{
.handle dd ?
.io_code dd ?
.input dd ?
.inp_size dd ?
446,10 → 442,6
.out_size dd ?
}
 
virtual at 0
IOCTL IOCTL
end virtual
 
EVENT_NOTIFY equ 0x00000200
 
; Macroses by CleverMouse
498,23 → 490,37
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
invoke SysMsgBoardStr
 
mov esi, msgInit
call SysMsgBoardStr
invoke SysMsgBoardStr
end if
 
call detect_controller
522,9 → 528,9
jz .fail
 
mov esi,[ctrl.vendor_ids]
call SysMsgBoardStr
invoke SysMsgBoardStr
mov esi, [ctrl.ctrl_ids]
call SysMsgBoardStr
invoke SysMsgBoardStr
 
call init_controller
test eax, eax
531,7 → 537,6
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
554,10 → 559,10
;Asper ]
 
mov esi, msgPrimBuff
call SysMsgBoardStr
invoke SysMsgBoardStr
call create_primary_buff
mov esi, msgDone
call SysMsgBoardStr
invoke SysMsgBoardStr
 
if IRQ_REMAP
pushf
571,12 → 576,12
jz .skip
bts ax, bx ;mask old line
.skip
bts ax, IRQ_LINE ;mask new ine
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
585,11 → 590,11
mov [ctrl.int_line], IRQ_LINE
popf
mov esi, msgRemap
call SysMsgBoardStr
invoke SysMsgBoardStr
end if
 
mov ebx, [ctrl.int_line]
stdcall AttachIntHandler, ebx, hda_irq, dword 0
invoke AttachIntHandler, ebx, hda_irq, dword 0
 
;Asper This part is from "azx_probe" proc. [
call azx_codec_create
604,12 → 609,12
; create PCM streams
;Asper+ [
mov eax, [spec.dac_node]
if DEBUG
if DEBUG ;-
push eax esi
mov esi, msgVal
call SysMsgBoardStr
invoke SysMsgBoardStr
stdcall fdword2str, 3
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi eax
end if
 
616,13 → 621,13
test eax, eax
jz .fail
mov ebx, [spec.dac_node+4]
if DEBUG
if DEBUG ;-
push eax esi
mov esi, msgVal
call SysMsgBoardStr
invoke SysMsgBoardStr
mov eax, [spec.dac_node+4]
stdcall fdword2str, 3
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi eax
end if
 
637,24 → 642,26
 
if USE_SINGLE_MODE
mov esi, msgSingleMode
call SysMsgBoardStr
invoke SysMsgBoardStr
else
mov esi, msgNormalMode
call SysMsgBoardStr
invoke SysMsgBoardStr
end if
 
 
.reg:
stdcall RegService, sz_sound_srv, service_proc
invoke RegService, sz_sound_srv, service_proc
pop esi ebx
ret
.fail:
mov esi, msgFail
.fail_msg:
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi ebx
xor eax, eax
ret
.stop:
call stop
pop esi ebx
xor eax, eax
ret
endp
686,7 → 693,7
jne @F
if DEBUG
mov esi, msgPlay
call SysMsgBoardStr
invoke SysMsgBoardStr
end if
call play
xor eax, eax
696,7 → 703,7
jne @F
if DEBUG
mov esi, msgStop
call SysMsgBoardStr
invoke SysMsgBoardStr
end if
call stop
xor eax, eax
744,7 → 751,7
; jne @f
; if DEBUG
; mov esi, msgSetChannelVolume
; call SysMsgBoardStr
; invoke SysMsgBoardStr
; end if
; mov ebx, [edi+input]
; mov cl, byte [ebx] ; cl=channel
752,18 → 759,17
; if DEBUG
; push eax esi
; mov esi, msgYAHOO1
; call SysMsgBoardStr
; invoke SysMsgBoardStr
; stdcall fdword2str, 1
; call SysMsgBoardStr
; invoke SysMsgBoardStr
; mov esi, strSemicolon
; call SysMsgBoardStr
; invoke SysMsgBoardStr
; movzx eax, cl
; stdcall fdword2str, 3
; call SysMsgBoardStr
; invoke SysMsgBoardStr
; pop esi eax
; end if
;
; call set_channel_volume
; ; call set_channel_volume
; xor eax, eax
; ret
;@@:
790,7 → 796,6
@@:
;Asper: Non standard system service. For the tests only! ]
 
 
.fail:
or eax, -1
ret
810,10 → 815,10
if DEBUG_IRQ
push eax esi
;mov esi, msgIRQ
;call SysMsgBoardStr
;invoke SysMsgBoardStr
call GetTimerTicks
stdcall fdword2str, 2
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi eax
end if
mov edx, ICH6_REG_INTSTS
848,9 → 853,7
cmp [ctrl.user_callback], 0
je @f
stdcall [ctrl.user_callback], ebx
 
@@:
 
; clear rirb int
mov edx, ICH6_REG_RIRBSTS
call azx_readb
865,7 → 868,6
mov eax, 80 ; wait 80 us
call StallExec
@@:
 
call azx_update_rirb
.l2:
mov al, RIRB_INT_MASK
894,10 → 896,10
align 4
proc create_primary_buff
 
stdcall KernelAlloc, 4096
invoke KernelAlloc, 4096
mov [ctrl.posbuf], eax
 
stdcall KernelAlloc, 0x10000 ;0x8000
invoke KernelAlloc, 0x10000 ;0x8000
mov [ctrl.buffer], eax
 
mov edi, eax
906,8 → 908,7
cld
rep stosd
 
 
stdcall KernelAlloc, 4096
invoke KernelAlloc, 4096
mov [pcmout_bdl], eax
 
mov edi, eax
916,7 → 917,6
cld
rep stosd
 
 
; reset BDL address
xor eax, eax
mov edx, ICH6_REG_SD_BDLPL + SDO_OFS
928,11 → 928,10
; program the initial BDL entries
mov eax, [ctrl.buffer]
mov ebx, eax
call GetPgAddr
invoke GetPgAddr
and ebx, 0xFFF
add eax, ebx
 
 
mov ebx, 0x4000 ;buffer size
mov ecx, 8 ;number of periods
mov edi, [pcmout_bdl] ;pcmout_bdl
948,7 → 947,6
; program the IOC to enable interrupt when buffer completes
mov dword [edi+12], 0x01
 
 
add eax, ebx
add edi, 16
dec ecx
958,7 → 956,6
dec ecx
jnz .next_period
 
 
mov edi, buff_list
mov eax, [ctrl.buffer]
mov ecx, 4 ;2
991,11 → 988,10
bus dd ?
devfn dd ?
endl
 
xor eax, eax
mov [bus], eax
inc eax
call PciApi
invoke PciApi
cmp eax, -1
je .err
 
1004,7 → 1000,7
.next_bus:
and [devfn], 0
.next_dev:
stdcall PciRead32, [bus], [devfn], dword 0
invoke PciRead32, [bus], [devfn], dword 0
test eax, eax
jz .next
cmp eax, -1
1019,7 → 1015,7
cmp eax, ebx
je .found
add edi, 12
jmp @B
jmp @b
.next:
inc [devfn]
cmp [devfn], 256
1048,17 → 1044,17
mov [ctrl.ctrl_ids], ebx
 
cmp edx, VID_INTEL
jne @F
jne @f
mov [ctrl.vendor_ids], msg_Intel
jmp .ok
@@:
cmp edx, VID_NVIDIA
jne @F
jne @f
mov [ctrl.vendor_ids], msg_NVidia
jmp .ok
@@:
cmp edx, VID_ATI
jne @F
jne @f
cmp eax, 0x4383
jg .ati_hdmi
mov [ctrl.vendor_ids], msg_ATI
1068,42 → 1064,42
jmp .ok
@@:
cmp edx, VID_AMD
jne @F
jne @f
mov [ctrl.vendor_ids], msg_AMD
jmp .ok
@@:
cmp edx, VID_VIA
jne @F
jne @f
mov [ctrl.vendor_ids], msg_VIA
jmp .ok
@@:
cmp edx, VID_SIS
jne @F
jne @f
mov [ctrl.vendor_ids], msg_SIS
jmp .ok
@@:
cmp edx, VID_ULI
jne @F
jne @f
mov [ctrl.vendor_ids], msg_ULI
jmp .ok
@@:
cmp edx, VID_TERA
jne @F
jne @f
mov [ctrl.vendor_ids], msg_TERA
jmp .ok
@@:
cmp edx, VID_CREATIVE
jne @F
jne @f
mov [ctrl.vendor_ids], msg_CREATIVE
jmp .ok
@@:
cmp edx, VID_RDC
jne @F
jne @f
mov [ctrl.vendor_ids], msg_RDC
jmp .ok
@@:
cmp edx, VID_VMWARE
jne @F
jne @f
mov [ctrl.vendor_ids], msg_VMWARE
jmp .ok
@@:
1121,14 → 1117,13
align 4
proc init_controller
 
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
stdcall PciWrite32, [ctrl.bus], [ctrl.devfn], dword 4, eax
stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 4
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
1136,34 → 1131,34
mov [ctrl.pci_stat], ebx
 
mov esi, msgPciCmd
call SysMsgBoardStr
invoke SysMsgBoardStr
stdcall fdword2str, 2
call SysMsgBoardStr
invoke SysMsgBoardStr
 
mov esi, msgPciStat
call SysMsgBoardStr
invoke SysMsgBoardStr
mov eax, [ctrl.pci_stat]
stdcall fdword2str, 2
call SysMsgBoardStr
invoke SysMsgBoardStr
 
mov esi, msgHDALowMMIo
call SysMsgBoardStr
stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x10
invoke SysMsgBoardStr
invoke PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x10
stdcall fdword2str, 2
call SysMsgBoardStr
invoke SysMsgBoardStr
 
and eax, 0xFFFFC000
mov [ctrl.ctrl_mem_base], eax
 
mov esi, msgHDAUpMMIo
call SysMsgBoardStr
stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x14
invoke SysMsgBoardStr
invoke PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x14
;-mov [ctrl.hda_upper_mem_base], eax
stdcall fdword2str, 2
call SysMsgBoardStr
invoke SysMsgBoardStr
 
.default:
stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x3C
invoke PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x3C
and eax, 0xFF
@@:
mov [ctrl.int_line], eax
1176,11 → 1171,10
call azx_readw
if DEBUG
mov esi, msgGCap
call SysMsgBoardStr
invoke SysMsgBoardStr
stdcall fdword2str, 2
call SysMsgBoardStr
invoke SysMsgBoardStr
end if
 
; allocate CORB/RIRB
call azx_alloc_cmd_io
 
1198,14 → 1192,12
 
 
 
 
PG_SW equ 0x003
PG_NOCACHE equ 0x018
 
align 4
proc set_HDA
 
stdcall MapIoMem,[ctrl.ctrl_mem_base],0x1000,PG_SW+PG_NOCACHE
invoke MapIoMem,[ctrl.ctrl_mem_base],0x1000,PG_SW+PG_NOCACHE
mov [ctrl.ctrl_mem_base], eax
ret
endp
1291,13 → 1283,13
 
; Accept unsolicited responses
if USE_SINGLE_MODE
else
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
 
1312,9 → 1304,9
 
if DEBUG
mov esi, msgCodecMask
call SysMsgBoardStr
invoke SysMsgBoardStr
stdcall fdword2str, 2
call SysMsgBoardStr
invoke SysMsgBoardStr
end if
 
@@:
1325,7 → 1317,7
.fail:
if DEBUG
mov esi, msgHDARFail
call SysMsgBoardStr
invoke SysMsgBoardStr
end if
stc
ret
1390,7 → 1382,7
ret
 
;align 4
;proc get_dev_info stdcall, p_info:dword
;proc get_dev_info stdcall, p_info:dword ;deprecated
; virtual at esi
; CTRL_INFO CTRL_INFO
; end virtual
1438,7 → 1430,7
proc azx_alloc_cmd_io
push eax ecx edx
; single page (at least 4096 bytes) must suffice for both ringbuffers
stdcall KernelAlloc, 4096
invoke KernelAlloc, 4096
mov [ctrl.rb], eax
 
mov edi, eax
1457,7 → 1449,7
; CORB set up
mov eax, [ctrl.rb]
mov ebx, eax
call GetPgAddr
invoke GetPgAddr
and ebx, 0xFFF
add eax, ebx
push eax ; save corb address
1615,7 → 1607,7
if DEBUG
push esi
mov esi, msgSpuriousResponce
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi
end if
jmp .l1
1676,9 → 1668,9
if DEBUG
push eax esi
mov esi, msgGetResponceTimeout
call SysMsgBoardStr
invoke SysMsgBoardStr
mov esi, msgPollingCodecOnce
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi eax
end if
mov [do_poll], 1
1689,9 → 1681,9
if DEBUG
push eax esi
mov esi, msgGetResponceTimeout
call SysMsgBoardStr
invoke SysMsgBoardStr
mov esi, msgSwitchToPollMode
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi eax
end if
mov [ctrl.polling_mode], 1
1706,7 → 1698,6
jmp .out
@@:
 
 
; a fatal communication error; need either to reset or to fallback
; to the single_cmd mode
mov [ctrl.rirb_error], 1
1780,11 → 1771,11
mov edx, ICH6_REG_IRS
call azx_readw
mov esi, msgGetResponceTimeout
call SysMsgBoardStr
invoke SysMsgBoardStr
mov esi, msgIRS
call SysMsgBoardStr
invoke SysMsgBoardStr
stdcall fdword2str, 2
call SysMsgBoardStr
invoke SysMsgBoardStr
end if
 
pop esi edx ecx
1836,14 → 1827,14
mov edx, ICH6_REG_IRS
call azx_readw
mov esi, msgSendCmdTimeout
call SysMsgBoardStr
invoke SysMsgBoardStr
stdcall fdword2str, 2
call SysMsgBoardStr
invoke SysMsgBoardStr
mov esi, msgVal
call SysMsgBoardStr
invoke SysMsgBoardStr
mov eax, dword [val]
stdcall fdword2str, 2
call SysMsgBoardStr
invoke SysMsgBoardStr
end if
 
pop esi edx ecx
2041,7 → 2032,7
; program the position buffer
mov eax, dword [ctrl.posbuf]
mov ebx, eax
call GetPgAddr
invoke GetPgAddr
and ebx, 0xFFF
add eax, ebx
mov edx, ICH6_REG_DPLBASE
2060,7 → 2051,7
; 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]
invoke PciRead8, [ctrl.bus], [ctrl.devfn], [reg]
mov bl, byte [mask]
mov bh, bl
xor bl, -1
2068,7 → 2059,7
shr bx, 8
and bl, byte [val]
or al, bl
stdcall PciWrite8, [ctrl.bus], [ctrl.devfn], [reg], eax
invoke PciWrite8, [ctrl.bus], [ctrl.devfn], [reg], eax
pop bx ax
ret
endp
2102,7 → 2093,7
cmp eax, AZX_DRIVER_PCH
jne @f
.l1:
stdcall PciRead16, [ctrl.bus], [ctrl.devfn], dword INTEL_SCH_HDA_DEVC
invoke PciRead16, [ctrl.bus], [ctrl.devfn], dword INTEL_SCH_HDA_DEVC
test ax, INTEL_SCH_HDA_DEVC_NOSNOOP
jz @f
push ebx
2110,19 → 2101,19
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
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
invoke SysMsgBoardStr
mov esi, msg_OK
test ax, INTEL_SCH_HDA_DEVC_NOSNOOP
jz .snoop_ok
mov esi, msg_Fail
.snoop_ok:
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi
end if
@@:
2223,7 → 2214,7
; lower BDL address
mov eax, [pcmout_bdl]
mov ebx, eax
call GetPgAddr
invoke GetPgAddr
and ebx, 0xFFF
add eax, ebx
mov edx, ICH6_REG_SD_BDLPL + SDO_OFS
2242,7 → 2233,7
jnz @f
mov eax, dword [ctrl.posbuf]
mov ebx, eax
call GetPgAddr
invoke GetPgAddr
and ebx, 0xFFF
add eax, ebx
or eax, ICH6_DPLBASE_ENABLE
2249,7 → 2240,6
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
2281,11 → 2271,11
if DEBUG
push esi
mov esi, msgCodecOK
call SysMsgBoardStr
invoke SysMsgBoardStr
mov esi, msgCAd
call SysMsgBoardStr
invoke SysMsgBoardStr
stdcall fdword2str, 3
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi
end if
xor eax, eax
2319,7 → 2309,7
; Some BIOSen give you wrong codec addresses that don't exist
if DEBUG
mov esi, msgCodecError
call SysMsgBoardStr
invoke SysMsgBoardStr
end if
mov ebx, edx
xor ebx, -1
2395,8 → 2385,10
; 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
2403,7 → 2395,6
call azx_writel
mov edx, ICH6_REG_DPUBASE
call azx_writel
 
pop edx eax
ret
endp
2436,18 → 2427,18
push eax ebx ecx edx
mov ebx, [volume.maxDb]
neg eax
if 0;DEBUG ;YAHOO
if DEBUG ;-
push eax esi
mov esi, msgNewVolume
call SysMsgBoardStr
invoke SysMsgBoardStr
stdcall fdword2str, 2
call SysMsgBoardStr
invoke SysMsgBoardStr
 
mov esi, msgMaxVolume
call SysMsgBoardStr
mov esi, msgMinVolume
invoke SysMsgBoardStr
mov eax, ebx
stdcall fdword2str, 2
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi eax
end if
test ebx, ebx
2459,16 → 2450,20
jmp .set
@@:
cmp eax, ebx
jl .set
jng .set
mov eax, ebx
.set:
sub ebx, eax
mov eax, ebx
;cdq
xor edx, edx
shl eax, 2
mov ebx, 100
div bx
mov bl, [volume.step_size]
div bl
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
2486,10 → 2481,10
pop edx ecx ebx eax
ret
.err_out:
if 0;DEBUG ;YAHOO
if DEBUG ;-
push esi
mov esi, emsgNoVolCtrl
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi
end if
jmp .out
2508,13 → 2503,10
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
 
mov cx, 100
mul cx
shr eax, 2 ; *0.25
neg eax
imul eax, (-100/4)
.out:
pop edx ecx ebx
ret
2616,9 → 2608,14
if DEBUG
push esi
mov esi, msgUnsolEvent
call SysMsgBoardStr
invoke SysMsgBoardStr
pop esi
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
;...
2945,7 → 2942,7
 
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
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