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