intel_hda: Convert to PE. Apply source format rules. Some changes to get/set master volume. Enable unsolicited events.
git-svn-id: svn://kolibrios.org@5048 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
d3545f769e
commit
2dab47a972
@ -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.
|
||||
|
@ -40,13 +40,13 @@ proc codec_exec_verb stdcall, cmd:dword;, res:dword <- returned in eax
|
||||
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 @@ proc codec_exec_verb stdcall, cmd:dword;, res:dword <- returned in eax
|
||||
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 @@ proc codec_exec_verb stdcall, cmd:dword;, res:dword <- returned in eax
|
||||
if DEBUG
|
||||
push esi
|
||||
mov esi, emsgBusResetFatalComm
|
||||
call SysMsgBoardStr
|
||||
invoke SysMsgBoardStr
|
||||
pop esi
|
||||
end if
|
||||
call azx_bus_reset
|
||||
@ -199,7 +198,6 @@ proc snd_hda_get_sub_nodes stdcall, nid:dword;, start_id:dword <- returned in
|
||||
inc eax
|
||||
@@:
|
||||
and eax, 0x7FFF7FFF
|
||||
|
||||
ret
|
||||
endp
|
||||
|
||||
@ -246,10 +244,10 @@ proc snd_hda_get_connections stdcall, nid:dword, conn_list:dword, max_conns:dwo
|
||||
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 @@ proc snd_hda_get_connections stdcall, nid:dword, conn_list:dword, max_conns:dwo
|
||||
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 @@ proc snd_hda_get_connections stdcall, nid:dword, conn_list:dword, max_conns:dwo
|
||||
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 @@ proc snd_hda_get_connections stdcall, nid:dword, conn_list:dword, max_conns:dwo
|
||||
if DEBUG
|
||||
push esi
|
||||
mov esi, emsgTooManyConns
|
||||
call SysMsgBoardStr
|
||||
invoke SysMsgBoardStr
|
||||
pop esi
|
||||
end if
|
||||
pop ecx
|
||||
@ -426,7 +424,7 @@ proc snd_hda_get_connections stdcall, nid:dword, conn_list:dword, max_conns:dwo
|
||||
if DEBUG
|
||||
push esi
|
||||
mov esi, emsgTooManyConns
|
||||
call SysMsgBoardStr
|
||||
invoke SysMsgBoardStr
|
||||
pop esi
|
||||
end if
|
||||
jmp .err_out
|
||||
@ -511,12 +509,11 @@ proc snd_hda_codec_init ; We use just one codec (the first found)
|
||||
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 @@ proc snd_hda_codec_init ; We use just one codec (the first found)
|
||||
if DEBUG
|
||||
push esi
|
||||
mov esi, emsgNoAFGorMFGFound
|
||||
call SysMsgBoardStr
|
||||
invoke SysMsgBoardStr
|
||||
pop esi
|
||||
end if
|
||||
.skip_codec:
|
||||
@ -551,7 +548,7 @@ proc snd_hda_codec_init ; We use just one codec (the first found)
|
||||
if DEBUG
|
||||
push esi
|
||||
mov esi, emsgNoMem
|
||||
call SysMsgBoardStr
|
||||
invoke SysMsgBoardStr
|
||||
pop esi
|
||||
end if
|
||||
pop ebx
|
||||
@ -571,9 +568,7 @@ proc snd_hda_codec_init ; We use just one codec (the first found)
|
||||
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 @@ proc snd_hda_codec_configure
|
||||
if DEBUG
|
||||
push esi
|
||||
mov esi, emsgNoParserAvailable
|
||||
call SysMsgBoardStr
|
||||
invoke SysMsgBoardStr
|
||||
pop esi
|
||||
end if
|
||||
@@:
|
||||
@ -630,7 +625,7 @@ proc get_codec_name
|
||||
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 @@ proc get_codec_name
|
||||
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 @@ endp
|
||||
|
||||
align 4
|
||||
proc detect_chip stdcall, chip_tab:dword
|
||||
|
||||
push eax ebx edi esi
|
||||
mov ax, [codec.chip_id]
|
||||
|
||||
@ -669,7 +663,7 @@ proc detect_chip stdcall, chip_tab:dword
|
||||
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 @@ proc detect_chip stdcall, chip_tab:dword
|
||||
.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 @@ proc setup_fg_nodes
|
||||
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 @@ end if
|
||||
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,33 +760,33 @@ proc read_widget_caps stdcall, fg_node:dword
|
||||
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
|
||||
|
||||
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 @@ proc read_pin_defaults
|
||||
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 @@ proc read_pin_defaults
|
||||
if FDEBUG
|
||||
push eax esi
|
||||
mov esi, msgPinCfgs
|
||||
call SysMsgBoardStr
|
||||
invoke SysMsgBoardStr
|
||||
pop esi eax
|
||||
end if
|
||||
|
||||
@ -958,27 +952,27 @@ proc hda_codec_setup_stream stdcall, nid:dword, stream_tag:dword, channel_id:dwo
|
||||
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 @@ proc snd_hda_codec_cleanup_stream stdcall, nid:dword
|
||||
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,6 +1127,51 @@ proc snd_hda_codec_amp_stereo stdcall, nid:dword, direction:dword, idx:dword, ma
|
||||
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
|
||||
@ -1151,7 +1190,6 @@ proc snd_hda_set_power_state stdcall, fg:dword, power_state:dword
|
||||
|
||||
mov dx, [codec.vendor_id]
|
||||
cmp dx, 0x14F1
|
||||
|
||||
jne @f
|
||||
mov eax, 10000
|
||||
call StallExec
|
||||
@ -1285,7 +1323,6 @@ chips_VIA dd 0xE721, chip_VT1708B_1
|
||||
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_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
|
||||
|
||||
|
@ -598,7 +598,6 @@ 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
|
||||
@ -623,7 +622,6 @@ proc get_wcaps stdcall, nid:dword
|
||||
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 @@ 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
|
||||
@ -644,5 +640,4 @@ proc get_wcaps_channels stdcall, wcaps:dword
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
;Asper ]
|
||||
|
@ -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
|
@ -1,268 +0,0 @@
|
||||
|
||||
; Macroinstructions for defining and calling procedures
|
||||
|
||||
macro stdcall proc,[arg] ; directly call STDCALL procedure
|
||||
{ common
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
common
|
||||
end if
|
||||
call proc }
|
||||
|
||||
macro invoke proc,[arg] ; indirectly call STDCALL procedure
|
||||
{ common
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
common
|
||||
end if
|
||||
call [proc] }
|
||||
|
||||
macro ccall proc,[arg] ; directly call CDECL procedure
|
||||
{ common
|
||||
size@ccall = 0
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
size@ccall = size@ccall+4
|
||||
common
|
||||
end if
|
||||
call proc
|
||||
if size@ccall
|
||||
add esp,size@ccall
|
||||
end if }
|
||||
|
||||
macro cinvoke proc,[arg] ; indirectly call CDECL procedure
|
||||
{ common
|
||||
size@ccall = 0
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
size@ccall = size@ccall+4
|
||||
common
|
||||
end if
|
||||
call [proc]
|
||||
if size@ccall
|
||||
add esp,size@ccall
|
||||
end if }
|
||||
|
||||
macro proc [args] ; define procedure
|
||||
{ common
|
||||
match name params, args>
|
||||
\{ define@proc name,<params \} }
|
||||
|
||||
prologue@proc equ prologuedef
|
||||
|
||||
macro prologuedef procname,flag,parmbytes,localbytes,reglist
|
||||
{ if parmbytes | localbytes
|
||||
push ebp
|
||||
mov ebp,esp
|
||||
if localbytes
|
||||
sub esp,localbytes
|
||||
end if
|
||||
end if
|
||||
irps reg, reglist \{ push reg \} }
|
||||
|
||||
epilogue@proc equ epiloguedef
|
||||
|
||||
macro epiloguedef procname,flag,parmbytes,localbytes,reglist
|
||||
{ irps reg, reglist \{ reverse pop reg \}
|
||||
if parmbytes | localbytes
|
||||
leave
|
||||
end if
|
||||
if flag and 10000b
|
||||
retn
|
||||
else
|
||||
retn parmbytes
|
||||
end if }
|
||||
|
||||
macro define@proc name,statement
|
||||
{ local params,flag,regs,parmbytes,localbytes,current
|
||||
if used name
|
||||
name:
|
||||
match =stdcall args, statement \{ params equ args
|
||||
flag = 11b \}
|
||||
match =stdcall, statement \{ params equ
|
||||
flag = 11b \}
|
||||
match =c args, statement \{ params equ args
|
||||
flag = 10001b \}
|
||||
match =c, statement \{ params equ
|
||||
flag = 10001b \}
|
||||
match =params, params \{ params equ statement
|
||||
flag = 0 \}
|
||||
virtual at ebp+8
|
||||
match =uses reglist=,args, params \{ regs equ reglist
|
||||
params equ args \}
|
||||
match =regs =uses reglist, regs params \{ regs equ reglist
|
||||
params equ \}
|
||||
match =regs, regs \{ regs equ \}
|
||||
match =,args, params \{ defargs@proc args \}
|
||||
match =args@proc args, args@proc params \{ defargs@proc args \}
|
||||
parmbytes = $ - (ebp+8)
|
||||
end virtual
|
||||
name # % = parmbytes/4
|
||||
all@vars equ
|
||||
current = 0
|
||||
match prologue:reglist, prologue@proc:<regs> \{ prologue name,flag,parmbytes,localbytes,reglist \}
|
||||
macro locals
|
||||
\{ virtual at ebp-localbytes+current
|
||||
macro label . \\{ deflocal@proc .,:, \\}
|
||||
struc db [val] \\{ \common deflocal@proc .,db,val \\}
|
||||
struc dw [val] \\{ \common deflocal@proc .,dw,val \\}
|
||||
struc dp [val] \\{ \common deflocal@proc .,dp,val \\}
|
||||
struc dd [val] \\{ \common deflocal@proc .,dd,val \\}
|
||||
struc dt [val] \\{ \common deflocal@proc .,dt,val \\}
|
||||
struc dq [val] \\{ \common deflocal@proc .,dq,val \\}
|
||||
struc rb cnt \\{ deflocal@proc .,rb cnt, \\}
|
||||
struc rw cnt \\{ deflocal@proc .,rw cnt, \\}
|
||||
struc rp cnt \\{ deflocal@proc .,rp cnt, \\}
|
||||
struc rd cnt \\{ deflocal@proc .,rd cnt, \\}
|
||||
struc rt cnt \\{ deflocal@proc .,rt cnt, \\}
|
||||
struc rq cnt \\{ deflocal@proc .,rq cnt, \\} \}
|
||||
macro endl
|
||||
\{ purge label
|
||||
restruc db,dw,dp,dd,dt,dq
|
||||
restruc rb,rw,rp,rd,rt,rq
|
||||
restruc byte,word,dword,pword,tword,qword
|
||||
current = $-(ebp-localbytes)
|
||||
end virtual \}
|
||||
macro ret operand
|
||||
\{ match any, operand \\{ retn operand \\}
|
||||
match , operand \\{ match epilogue:reglist, epilogue@proc:<regs>
|
||||
\\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \}
|
||||
macro finish@proc \{ localbytes = (((current-1) shr 2)+1) shl 2
|
||||
end if \} }
|
||||
|
||||
macro defargs@proc [arg]
|
||||
{ common
|
||||
if ~ arg eq
|
||||
forward
|
||||
local ..arg,current@arg
|
||||
match argname:type, arg
|
||||
\{ current@arg equ argname
|
||||
label ..arg type
|
||||
argname equ ..arg
|
||||
if dqword eq type
|
||||
dd ?,?,?,?
|
||||
else if tbyte eq type
|
||||
dd ?,?,?
|
||||
else if qword eq type | pword eq type
|
||||
dd ?,?
|
||||
else
|
||||
dd ?
|
||||
end if \}
|
||||
match =current@arg,current@arg
|
||||
\{ current@arg equ arg
|
||||
arg equ ..arg
|
||||
..arg dd ? \}
|
||||
common
|
||||
args@proc equ current@arg
|
||||
forward
|
||||
restore current@arg
|
||||
common
|
||||
end if }
|
||||
|
||||
macro deflocal@proc name,def,[val]
|
||||
{ common
|
||||
match vars, all@vars \{ all@vars equ all@vars, \}
|
||||
all@vars equ all@vars name
|
||||
forward
|
||||
local ..var,..tmp
|
||||
..var def val
|
||||
match =?, val \{ ..tmp equ \}
|
||||
match any =dup (=?), val \{ ..tmp equ \}
|
||||
match tmp : value, ..tmp : val
|
||||
\{ tmp: end virtual
|
||||
initlocal@proc ..var,def value
|
||||
virtual at tmp\}
|
||||
common
|
||||
match first rest, ..var, \{ name equ first \} }
|
||||
|
||||
macro initlocal@proc name,def
|
||||
{ virtual at name
|
||||
def
|
||||
size@initlocal = $ - name
|
||||
end virtual
|
||||
position@initlocal = 0
|
||||
while size@initlocal > position@initlocal
|
||||
virtual at name
|
||||
def
|
||||
if size@initlocal - position@initlocal < 2
|
||||
current@initlocal = 1
|
||||
load byte@initlocal byte from name+position@initlocal
|
||||
else if size@initlocal - position@initlocal < 4
|
||||
current@initlocal = 2
|
||||
load word@initlocal word from name+position@initlocal
|
||||
else
|
||||
current@initlocal = 4
|
||||
load dword@initlocal dword from name+position@initlocal
|
||||
end if
|
||||
end virtual
|
||||
if current@initlocal = 1
|
||||
mov byte [name+position@initlocal],byte@initlocal
|
||||
else if current@initlocal = 2
|
||||
mov word [name+position@initlocal],word@initlocal
|
||||
else
|
||||
mov dword [name+position@initlocal],dword@initlocal
|
||||
end if
|
||||
position@initlocal = position@initlocal + current@initlocal
|
||||
end while }
|
||||
|
||||
macro endp
|
||||
{ purge ret,locals,endl
|
||||
finish@proc
|
||||
purge finish@proc
|
||||
restore regs@proc
|
||||
match all,args@proc \{ restore all \}
|
||||
restore args@proc
|
||||
match all,all@vars \{ restore all \} }
|
||||
|
||||
macro local [var]
|
||||
{ common
|
||||
locals
|
||||
forward done@local equ
|
||||
match varname[count]:vartype, var
|
||||
\{ match =BYTE, vartype \\{ varname rb count
|
||||
restore done@local \\}
|
||||
match =WORD, vartype \\{ varname rw count
|
||||
restore done@local \\}
|
||||
match =DWORD, vartype \\{ varname rd count
|
||||
restore done@local \\}
|
||||
match =PWORD, vartype \\{ varname rp count
|
||||
restore done@local \\}
|
||||
match =QWORD, vartype \\{ varname rq count
|
||||
restore done@local \\}
|
||||
match =TBYTE, vartype \\{ varname rt count
|
||||
restore done@local \\}
|
||||
match =DQWORD, vartype \\{ label varname dqword
|
||||
rq count+count
|
||||
restore done@local \\}
|
||||
match , done@local \\{ virtual
|
||||
varname vartype
|
||||
end virtual
|
||||
rb count*sizeof.\#vartype
|
||||
restore done@local \\} \}
|
||||
match :varname:vartype, done@local:var
|
||||
\{ match =BYTE, vartype \\{ varname db ?
|
||||
restore done@local \\}
|
||||
match =WORD, vartype \\{ varname dw ?
|
||||
restore done@local \\}
|
||||
match =DWORD, vartype \\{ varname dd ?
|
||||
restore done@local \\}
|
||||
match =PWORD, vartype \\{ varname dp ?
|
||||
restore done@local \\}
|
||||
match =QWORD, vartype \\{ varname dq ?
|
||||
restore done@local \\}
|
||||
match =TBYTE, vartype \\{ varname dt ?
|
||||
restore done@local \\}
|
||||
match =DQWORD, vartype \\{ label varname dqword
|
||||
dq ?,?
|
||||
restore done@local \\}
|
||||
match , done@local \\{ varname vartype
|
||||
restore done@local \\} \}
|
||||
match ,done@local
|
||||
\{ var
|
||||
restore done@local \}
|
||||
common
|
||||
endl }
|
@ -52,7 +52,6 @@ struc VOLUME_CTL
|
||||
}
|
||||
|
||||
; 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 @@ proc defcfg_color stdcall, node:dword
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
; destructor
|
||||
proc snd_hda_generic_free
|
||||
push eax ebx edx edi
|
||||
@ -112,19 +110,19 @@ proc snd_hda_generic_free
|
||||
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 @@ proc add_new_node stdcall, nid:dword
|
||||
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 @@ proc add_new_node stdcall, nid:dword
|
||||
|
||||
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 @@ proc add_new_node stdcall, nid:dword
|
||||
|
||||
mov eax, edx
|
||||
pusha
|
||||
call Kfree ;free node
|
||||
invoke Kfree ;free node
|
||||
popa
|
||||
mov eax, ecx
|
||||
jmp .out
|
||||
@ -192,7 +190,7 @@ proc add_new_node stdcall, nid:dword
|
||||
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 @@ proc add_new_node stdcall, nid:dword
|
||||
|
||||
mov eax, edi
|
||||
pusha
|
||||
call Kfree ;free temporary conn_list
|
||||
invoke Kfree ;free temporary conn_list
|
||||
popa
|
||||
jmp .err_out
|
||||
@@:
|
||||
@ -264,20 +262,20 @@ proc add_new_node stdcall, nid:dword
|
||||
;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 @@ proc add_new_node stdcall, nid:dword
|
||||
;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 @@ proc add_new_node stdcall, nid:dword
|
||||
.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 @@ proc add_new_node stdcall, nid:dword
|
||||
.err_out:
|
||||
mov eax, edx
|
||||
pusha
|
||||
call Kfree ;free node
|
||||
invoke Kfree ;free node
|
||||
popa
|
||||
xor eax, eax
|
||||
dec eax
|
||||
@ -411,7 +409,7 @@ proc build_afg_tree
|
||||
if FDEBUG
|
||||
push esi
|
||||
mov esi, emsgInvalidAFGSubtree
|
||||
call SysMsgBoardStr
|
||||
invoke SysMsgBoardStr
|
||||
pop esi
|
||||
end if
|
||||
xor eax, eax
|
||||
@ -437,6 +435,33 @@ proc build_afg_tree
|
||||
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
|
||||
@ -480,10 +505,10 @@ proc set_eapd stdcall, node:dword ;nid:dword, on:dword
|
||||
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 @@ endp
|
||||
|
||||
; 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 @@ proc unmute_output stdcall, node:dword
|
||||
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 @@ proc unmute_output stdcall, node:dword
|
||||
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 @@ proc unmute_input stdcall, node:dword, index:dword
|
||||
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 @@ proc select_input_connection stdcall, node:dword, index:dword
|
||||
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 @@ proc clear_check_flags
|
||||
jz .out
|
||||
mov esi, eax
|
||||
jmp .next_node
|
||||
|
||||
.out:
|
||||
pop esi eax
|
||||
ret
|
||||
@ -661,9 +680,9 @@ proc parse_output_path stdcall, node:dword, dac_idx:dword
|
||||
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 @@ proc parse_output_path stdcall, node:dword, dac_idx:dword
|
||||
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 @@ 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
|
||||
; invoke SysMsgBoardStr
|
||||
; pop esi
|
||||
movzx eax, [esi + HDA_GNODE.nid]
|
||||
movzx ebx, [esi + HDA_GNODE.pin_ctl]
|
||||
@ -781,38 +804,42 @@ if DEBUG
|
||||
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 @@ 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
|
||||
@@:
|
||||
@ -899,7 +927,7 @@ proc parse_output
|
||||
if DEBUG
|
||||
push esi
|
||||
mov esi, emsgNoProperOutputPathFound
|
||||
call SysMsgBoardStr
|
||||
invoke SysMsgBoardStr
|
||||
pop esi
|
||||
end if
|
||||
@@:
|
||||
@ -921,6 +949,10 @@ 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:
|
||||
|
@ -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_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 @@ DEV_EXEC_CODEC_CMD equ 100
|
||||
;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 @@ struc AC_CNTRL ;AC controller base class
|
||||
.ctrl_write16 dd ?
|
||||
.ctrl_write32 dd ?
|
||||
|
||||
;Asper+ [
|
||||
.codec_mask dd ?
|
||||
.rb dd ?
|
||||
.rirb_rp dw 0
|
||||
@ -394,12 +391,10 @@ struc AC_CNTRL ;AC controller base class
|
||||
.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,14 +414,14 @@ struc CODEC ;Audio Chip base class
|
||||
.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
|
||||
}
|
||||
|
||||
struc CTRL_INFO
|
||||
{ .pci_cmd dd ?
|
||||
{
|
||||
.pci_cmd dd ?
|
||||
.irq dd ?
|
||||
.glob_cntrl dd ?
|
||||
.glob_sta dd ?
|
||||
@ -438,7 +433,8 @@ struc CTRL_INFO
|
||||
}
|
||||
|
||||
struc IOCTL
|
||||
{ .handle dd ?
|
||||
{
|
||||
.handle dd ?
|
||||
.io_code dd ?
|
||||
.input dd ?
|
||||
.inp_size dd ?
|
||||
@ -446,10 +442,6 @@ struc IOCTL
|
||||
.out_size dd ?
|
||||
}
|
||||
|
||||
virtual at 0
|
||||
IOCTL IOCTL
|
||||
end virtual
|
||||
|
||||
EVENT_NOTIFY equ 0x00000200
|
||||
|
||||
; Macroses by CleverMouse
|
||||
@ -498,23 +490,37 @@ 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
|
||||
invoke SysMsgBoardStr
|
||||
|
||||
mov esi, msgInit
|
||||
call SysMsgBoardStr
|
||||
invoke SysMsgBoardStr
|
||||
end if
|
||||
|
||||
call detect_controller
|
||||
@ -522,16 +528,15 @@ proc START stdcall, state:dword
|
||||
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
|
||||
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 @@ proc START stdcall, state:dword
|
||||
;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 @@ proc START stdcall, state:dword
|
||||
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 @@ proc START stdcall, state:dword
|
||||
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,25 +609,25 @@ proc START stdcall, state:dword
|
||||
; 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
|
||||
|
||||
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 @@ proc START stdcall, state:dword
|
||||
|
||||
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 @@ proc service_proc stdcall, ioctl:dword
|
||||
jne @F
|
||||
if DEBUG
|
||||
mov esi, msgPlay
|
||||
call SysMsgBoardStr
|
||||
invoke SysMsgBoardStr
|
||||
end if
|
||||
call play
|
||||
xor eax, eax
|
||||
@ -696,7 +703,7 @@ proc service_proc stdcall, ioctl:dword
|
||||
jne @F
|
||||
if DEBUG
|
||||
mov esi, msgStop
|
||||
call SysMsgBoardStr
|
||||
invoke SysMsgBoardStr
|
||||
end if
|
||||
call stop
|
||||
xor eax, eax
|
||||
@ -744,7 +751,7 @@ proc service_proc stdcall, ioctl:dword
|
||||
; 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 @@ proc service_proc stdcall, ioctl:dword
|
||||
;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 @@ proc service_proc stdcall, ioctl:dword
|
||||
@@:
|
||||
;Asper: Non standard system service. For the tests only! ]
|
||||
|
||||
|
||||
.fail:
|
||||
or eax, -1
|
||||
ret
|
||||
@ -810,10 +815,10 @@ proc hda_irq ;+
|
||||
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 @@ proc hda_irq ;+
|
||||
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 @@ proc hda_irq ;+
|
||||
mov eax, 80 ; wait 80 us
|
||||
call StallExec
|
||||
@@:
|
||||
|
||||
call azx_update_rirb
|
||||
.l2:
|
||||
mov al, RIRB_INT_MASK
|
||||
@ -894,10 +896,10 @@ endp
|
||||
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 @@ proc create_primary_buff
|
||||
cld
|
||||
rep stosd
|
||||
|
||||
|
||||
stdcall KernelAlloc, 4096
|
||||
invoke KernelAlloc, 4096
|
||||
mov [pcmout_bdl], eax
|
||||
|
||||
mov edi, eax
|
||||
@ -916,7 +917,6 @@ proc create_primary_buff
|
||||
cld
|
||||
rep stosd
|
||||
|
||||
|
||||
; reset BDL address
|
||||
xor eax, eax
|
||||
mov edx, ICH6_REG_SD_BDLPL + SDO_OFS
|
||||
@ -928,11 +928,10 @@ proc create_primary_buff
|
||||
; 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 @@ proc create_primary_buff
|
||||
; 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 @@ proc create_primary_buff
|
||||
dec ecx
|
||||
jnz .next_period
|
||||
|
||||
|
||||
mov edi, buff_list
|
||||
mov eax, [ctrl.buffer]
|
||||
mov ecx, 4 ;2
|
||||
@ -991,11 +988,10 @@ proc detect_controller
|
||||
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 @@ proc detect_controller
|
||||
.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 @@ proc detect_controller
|
||||
cmp eax, ebx
|
||||
je .found
|
||||
add edi, 12
|
||||
jmp @B
|
||||
jmp @b
|
||||
.next:
|
||||
inc [devfn]
|
||||
cmp [devfn], 256
|
||||
@ -1048,17 +1044,17 @@ proc detect_controller
|
||||
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 @@ proc detect_controller
|
||||
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 @@ endp
|
||||
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 @@ proc init_controller
|
||||
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 @@ proc init_controller
|
||||
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 @@ endp
|
||||
|
||||
|
||||
|
||||
|
||||
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 @@ proc reset_controller
|
||||
|
||||
; 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 @@ proc reset_controller
|
||||
|
||||
if DEBUG
|
||||
mov esi, msgCodecMask
|
||||
call SysMsgBoardStr
|
||||
invoke SysMsgBoardStr
|
||||
stdcall fdword2str, 2
|
||||
call SysMsgBoardStr
|
||||
invoke SysMsgBoardStr
|
||||
end if
|
||||
|
||||
@@:
|
||||
@ -1325,7 +1317,7 @@ proc reset_controller
|
||||
.fail:
|
||||
if DEBUG
|
||||
mov esi, msgHDARFail
|
||||
call SysMsgBoardStr
|
||||
invoke SysMsgBoardStr
|
||||
end if
|
||||
stc
|
||||
ret
|
||||
@ -1390,7 +1382,7 @@ stop:
|
||||
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 @@ endp
|
||||
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 @@ proc azx_init_cmd_io
|
||||
; 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 @@ proc azx_update_rirb
|
||||
if DEBUG
|
||||
push esi
|
||||
mov esi, msgSpuriousResponce
|
||||
call SysMsgBoardStr
|
||||
invoke SysMsgBoardStr
|
||||
pop esi
|
||||
end if
|
||||
jmp .l1
|
||||
@ -1676,9 +1668,9 @@ proc azx_rirb_get_response
|
||||
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 @@ proc azx_rirb_get_response
|
||||
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 @@ proc azx_rirb_get_response
|
||||
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 @@ proc azx_single_wait_for_response
|
||||
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 @@ proc azx_single_send_cmd stdcall, val:dword
|
||||
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 @@ proc azx_init_chip
|
||||
; 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 @@ endp
|
||||
; 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 @@ proc update_pci_byte stdcall, reg:dword, mask:dword, val:dword
|
||||
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 @@ proc azx_init_pci
|
||||
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 @@ proc azx_init_pci
|
||||
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 @@ proc azx_setup_controller
|
||||
; 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,14 +2233,13 @@ proc azx_setup_controller
|
||||
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
|
||||
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 @@ proc probe_codec, addr:dword
|
||||
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 @@ proc azx_codec_create
|
||||
; 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,15 +2385,16 @@ proc azx_stop_chip
|
||||
; 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
|
||||
|
||||
pop edx eax
|
||||
ret
|
||||
endp
|
||||
@ -2436,18 +2427,18 @@ set_channel_volume:
|
||||
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 @@ set_channel_volume:
|
||||
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 @@ set_channel_volume:
|
||||
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 @@ get_channel_volume:
|
||||
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,8 +2608,13 @@ proc snd_hda_queue_unsol_event stdcall, par1:dword, par2:dword
|
||||
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 @@ 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
|
||||
|
Loading…
Reference in New Issue
Block a user