5,7 → 5,8 |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
format MS COFF |
format PE DLL native 0.05 |
section '.flat' code readable writable executable |
|
DEBUG equ 1 |
FDEBUG equ 0 |
12,25 → 13,21 |
DEBUG_IRQ equ 0 |
|
USE_SINGLE_MODE equ 0 ; 1 = Single mode; 0 = Normal mode. |
USE_UNSOL_EV equ 1 ; 1 = Use unsolicited events; 0 = Do not use unsolicited events. |
|
TEST_VERSION_NUMBER equ '018e' |
TEST_VERSION_NUMBER equ '019' |
|
;Asper+ [ |
SDO_TAG equ 1 ;Asper: Output stream tag id (any number except 0) |
SDO_IDX equ 4 ;Asper: Output stream index |
SDO_TAG equ 1 ;Output stream tag id (any number except 0) |
SDO_IDX equ 4 ;Output stream index |
;According to "Intel® I/O Controller Hub 6 (ICH6) High Definition Audio / AC ’97 Programmer’s Reference Manual (PRM) May 2005 Document" |
;and "Intel® I/O Controller Hub 6 (ICH6) Family Datasheet" SDO0=4, |
;but according to "High Definition Audio Specification Revision 1.0a June 17, 2010" SDO0 depends on the number of SDIs. |
|
SDO_INT equ 1 shl SDO_IDX ;Asper: Output stream interrupt (must be power of 2) |
SDO_OFS equ 0x80+(SDO_IDX*0x20) ;Asper: Output stream offset |
SDO_INT equ 1 shl SDO_IDX ;Output stream interrupt (must be power of 2) |
SDO_OFS equ 0x80+(SDO_IDX*0x20) ;Output stream offset |
;Asper+ ] |
|
include 'PROC32.INC' |
include 'IMPORTS.INC' |
include 'CODEC_H.INC' |
|
|
CURRENT_API equ 0x0100 ;1.00 |
COMPATIBLE_API equ 0x0101 ;1.01 |
API_VERSION equ (COMPATIBLE_API shl 16) or CURRENT_API |
344,7 → 341,8 |
;Asper: Non standard system service. For the tests only! ] |
|
struc AC_CNTRL ;AC controller base class |
{ .bus dd ? |
{ |
.bus dd ? |
.devfn dd ? |
|
.vendor dw ? |
377,7 → 375,6 |
.ctrl_write16 dd ? |
.ctrl_write32 dd ? |
|
;Asper+ [ |
.codec_mask dd ? |
.rb dd ? |
.rirb_rp dw 0 |
394,12 → 391,10 |
.start_wallclk dd ? ; start + minimum wallclk |
.period_wallclk dd ? ; wallclk for period |
.position_fix db ? |
;Asper+ ] |
} |
|
struc CODEC ;Audio Chip base class |
{ |
;Asper+ [ |
.addr dd ? ; codec slot index (codec address) |
.afg dd ? ; AFG node id |
.mfg dd ? ; MFG node id |
419,7 → 414,6 |
.num_pins dd ? ;Asper + : word is enough, but for align... |
.beeper_nid dw ? |
.pad dw ? |
;Asper+ ] |
|
.ac_vendor_ids dd ? ;ac vendor id string |
.chip_ids dd ? ;chip model string |
426,7 → 420,8 |
} |
|
struc CTRL_INFO |
{ .pci_cmd dd ? |
{ |
.pci_cmd dd ? |
.irq dd ? |
.glob_cntrl dd ? |
.glob_sta dd ? |
438,7 → 433,8 |
} |
|
struc IOCTL |
{ .handle dd ? |
{ |
.handle dd ? |
.io_code dd ? |
.input dd ? |
.inp_size dd ? |
446,10 → 442,6 |
.out_size dd ? |
} |
|
virtual at 0 |
IOCTL IOCTL |
end virtual |
|
EVENT_NOTIFY equ 0x00000200 |
|
; Macroses by CleverMouse |
498,23 → 490,37 |
pop ebx eax |
} |
|
public START |
public service_proc |
public version |
data fixups |
end data |
|
section '.flat' code readable align 16 |
include '../../struct.inc' |
include '../../macros.inc' |
include '../../proc32.inc' |
include '../../peimport.inc' |
include 'CODEC_H.INC' |
|
proc START stdcall, state:dword |
entry START |
section '.flat' readable writable executable |
|
cmp [state], 1 |
jne .stop |
;proc START stdcall, state:dword |
proc START c, state:dword, cmdline:dword |
push ebx esi ; save used registers to be stdcall |
virtual at esp |
rd 2 ; saved registers |
dd ? ; return address |
.reason dd ? ; DRV_ENTRY or DRV_EXIT |
.cmdline dd ? ; normally NULL |
end virtual |
; 1. Check the reason for the call, do nothing unless initializing. |
;cmp [.reason], DRV_ENTRY |
;jne .stop |
|
if DEBUG |
mov esi, msgTV |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
|
mov esi, msgInit |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
end if |
|
call detect_controller |
522,9 → 528,9 |
jz .fail |
|
mov esi,[ctrl.vendor_ids] |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
mov esi, [ctrl.ctrl_ids] |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
|
call init_controller |
test eax, eax |
531,7 → 537,6 |
jz .fail |
|
;Asper This part is from "azx_create" proc. [ |
;(...) |
mov [ctrl.position_fix], POS_FIX_LPIB |
cmp [driver_type], AZX_DRIVER_VIA |
je .set_via_patch |
554,10 → 559,10 |
;Asper ] |
|
mov esi, msgPrimBuff |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
call create_primary_buff |
mov esi, msgDone |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
|
if IRQ_REMAP |
pushf |
571,12 → 576,12 |
jz .skip |
bts ax, bx ;mask old line |
.skip |
bts ax, IRQ_LINE ;mask new ine |
bts ax, IRQ_LINE ;mask new line |
out 0x21, al |
mov al, ah |
out 0xA1, al |
;remap IRQ |
stdcall PciWrite8, 0, 0xF8, 0x61, IRQ_LINE |
invoke PciWrite8, 0, 0xF8, 0x61, IRQ_LINE |
|
mov dx, 0x4d0 ;8259 ELCR1 |
in al, dx |
585,11 → 590,11 |
mov [ctrl.int_line], IRQ_LINE |
popf |
mov esi, msgRemap |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
end if |
|
mov ebx, [ctrl.int_line] |
stdcall AttachIntHandler, ebx, hda_irq, dword 0 |
invoke AttachIntHandler, ebx, hda_irq, dword 0 |
|
;Asper This part is from "azx_probe" proc. [ |
call azx_codec_create |
604,12 → 609,12 |
; create PCM streams |
;Asper+ [ |
mov eax, [spec.dac_node] |
if DEBUG |
if DEBUG ;- |
push eax esi |
mov esi, msgVal |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
stdcall fdword2str, 3 |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
pop esi eax |
end if |
|
616,13 → 621,13 |
test eax, eax |
jz .fail |
mov ebx, [spec.dac_node+4] |
if DEBUG |
if DEBUG ;- |
push eax esi |
mov esi, msgVal |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
mov eax, [spec.dac_node+4] |
stdcall fdword2str, 3 |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
pop esi eax |
end if |
|
637,24 → 642,26 |
|
if USE_SINGLE_MODE |
mov esi, msgSingleMode |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
else |
mov esi, msgNormalMode |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
end if |
|
|
.reg: |
stdcall RegService, sz_sound_srv, service_proc |
invoke RegService, sz_sound_srv, service_proc |
pop esi ebx |
ret |
.fail: |
mov esi, msgFail |
.fail_msg: |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
pop esi ebx |
xor eax, eax |
ret |
.stop: |
call stop |
pop esi ebx |
xor eax, eax |
ret |
endp |
686,7 → 693,7 |
jne @F |
if DEBUG |
mov esi, msgPlay |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
end if |
call play |
xor eax, eax |
696,7 → 703,7 |
jne @F |
if DEBUG |
mov esi, msgStop |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
end if |
call stop |
xor eax, eax |
744,7 → 751,7 |
; jne @f |
; if DEBUG |
; mov esi, msgSetChannelVolume |
; call SysMsgBoardStr |
; invoke SysMsgBoardStr |
; end if |
; mov ebx, [edi+input] |
; mov cl, byte [ebx] ; cl=channel |
752,18 → 759,17 |
; if DEBUG |
; push eax esi |
; mov esi, msgYAHOO1 |
; call SysMsgBoardStr |
; invoke SysMsgBoardStr |
; stdcall fdword2str, 1 |
; call SysMsgBoardStr |
; invoke SysMsgBoardStr |
; mov esi, strSemicolon |
; call SysMsgBoardStr |
; invoke SysMsgBoardStr |
; movzx eax, cl |
; stdcall fdword2str, 3 |
; call SysMsgBoardStr |
; invoke SysMsgBoardStr |
; pop esi eax |
; end if |
; |
; call set_channel_volume |
; ; call set_channel_volume |
; xor eax, eax |
; ret |
;@@: |
790,7 → 796,6 |
@@: |
;Asper: Non standard system service. For the tests only! ] |
|
|
.fail: |
or eax, -1 |
ret |
810,10 → 815,10 |
if DEBUG_IRQ |
push eax esi |
;mov esi, msgIRQ |
;call SysMsgBoardStr |
;invoke SysMsgBoardStr |
call GetTimerTicks |
stdcall fdword2str, 2 |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
pop esi eax |
end if |
mov edx, ICH6_REG_INTSTS |
848,9 → 853,7 |
cmp [ctrl.user_callback], 0 |
je @f |
stdcall [ctrl.user_callback], ebx |
|
@@: |
|
; clear rirb int |
mov edx, ICH6_REG_RIRBSTS |
call azx_readb |
865,7 → 868,6 |
mov eax, 80 ; wait 80 us |
call StallExec |
@@: |
|
call azx_update_rirb |
.l2: |
mov al, RIRB_INT_MASK |
894,10 → 896,10 |
align 4 |
proc create_primary_buff |
|
stdcall KernelAlloc, 4096 |
invoke KernelAlloc, 4096 |
mov [ctrl.posbuf], eax |
|
stdcall KernelAlloc, 0x10000 ;0x8000 |
invoke KernelAlloc, 0x10000 ;0x8000 |
mov [ctrl.buffer], eax |
|
mov edi, eax |
906,8 → 908,7 |
cld |
rep stosd |
|
|
stdcall KernelAlloc, 4096 |
invoke KernelAlloc, 4096 |
mov [pcmout_bdl], eax |
|
mov edi, eax |
916,7 → 917,6 |
cld |
rep stosd |
|
|
; reset BDL address |
xor eax, eax |
mov edx, ICH6_REG_SD_BDLPL + SDO_OFS |
928,11 → 928,10 |
; program the initial BDL entries |
mov eax, [ctrl.buffer] |
mov ebx, eax |
call GetPgAddr |
invoke GetPgAddr |
and ebx, 0xFFF |
add eax, ebx |
|
|
mov ebx, 0x4000 ;buffer size |
mov ecx, 8 ;number of periods |
mov edi, [pcmout_bdl] ;pcmout_bdl |
948,7 → 947,6 |
; program the IOC to enable interrupt when buffer completes |
mov dword [edi+12], 0x01 |
|
|
add eax, ebx |
add edi, 16 |
dec ecx |
958,7 → 956,6 |
dec ecx |
jnz .next_period |
|
|
mov edi, buff_list |
mov eax, [ctrl.buffer] |
mov ecx, 4 ;2 |
991,11 → 988,10 |
bus dd ? |
devfn dd ? |
endl |
|
xor eax, eax |
mov [bus], eax |
inc eax |
call PciApi |
invoke PciApi |
cmp eax, -1 |
je .err |
|
1004,7 → 1000,7 |
.next_bus: |
and [devfn], 0 |
.next_dev: |
stdcall PciRead32, [bus], [devfn], dword 0 |
invoke PciRead32, [bus], [devfn], dword 0 |
test eax, eax |
jz .next |
cmp eax, -1 |
1019,7 → 1015,7 |
cmp eax, ebx |
je .found |
add edi, 12 |
jmp @B |
jmp @b |
.next: |
inc [devfn] |
cmp [devfn], 256 |
1048,17 → 1044,17 |
mov [ctrl.ctrl_ids], ebx |
|
cmp edx, VID_INTEL |
jne @F |
jne @f |
mov [ctrl.vendor_ids], msg_Intel |
jmp .ok |
@@: |
cmp edx, VID_NVIDIA |
jne @F |
jne @f |
mov [ctrl.vendor_ids], msg_NVidia |
jmp .ok |
@@: |
cmp edx, VID_ATI |
jne @F |
jne @f |
cmp eax, 0x4383 |
jg .ati_hdmi |
mov [ctrl.vendor_ids], msg_ATI |
1068,42 → 1064,42 |
jmp .ok |
@@: |
cmp edx, VID_AMD |
jne @F |
jne @f |
mov [ctrl.vendor_ids], msg_AMD |
jmp .ok |
@@: |
cmp edx, VID_VIA |
jne @F |
jne @f |
mov [ctrl.vendor_ids], msg_VIA |
jmp .ok |
@@: |
cmp edx, VID_SIS |
jne @F |
jne @f |
mov [ctrl.vendor_ids], msg_SIS |
jmp .ok |
@@: |
cmp edx, VID_ULI |
jne @F |
jne @f |
mov [ctrl.vendor_ids], msg_ULI |
jmp .ok |
@@: |
cmp edx, VID_TERA |
jne @F |
jne @f |
mov [ctrl.vendor_ids], msg_TERA |
jmp .ok |
@@: |
cmp edx, VID_CREATIVE |
jne @F |
jne @f |
mov [ctrl.vendor_ids], msg_CREATIVE |
jmp .ok |
@@: |
cmp edx, VID_RDC |
jne @F |
jne @f |
mov [ctrl.vendor_ids], msg_RDC |
jmp .ok |
@@: |
cmp edx, VID_VMWARE |
jne @F |
jne @f |
mov [ctrl.vendor_ids], msg_VMWARE |
jmp .ok |
@@: |
1121,14 → 1117,13 |
align 4 |
proc init_controller |
|
stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 4 |
invoke PciRead32, [ctrl.bus], [ctrl.devfn], dword 4 |
test eax, 0x4 ; Test Master bit |
jnz @f |
or eax, 0x4 ; Set Master bit |
stdcall PciWrite32, [ctrl.bus], [ctrl.devfn], dword 4, eax |
stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 4 |
invoke PciWrite32, [ctrl.bus], [ctrl.devfn], dword 4, eax |
invoke PciRead32, [ctrl.bus], [ctrl.devfn], dword 4 |
@@: |
|
mov ebx, eax |
and eax, 0xFFFF |
mov [ctrl.pci_cmd], eax |
1136,34 → 1131,34 |
mov [ctrl.pci_stat], ebx |
|
mov esi, msgPciCmd |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
stdcall fdword2str, 2 |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
|
mov esi, msgPciStat |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
mov eax, [ctrl.pci_stat] |
stdcall fdword2str, 2 |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
|
mov esi, msgHDALowMMIo |
call SysMsgBoardStr |
stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x10 |
invoke SysMsgBoardStr |
invoke PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x10 |
stdcall fdword2str, 2 |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
|
and eax, 0xFFFFC000 |
mov [ctrl.ctrl_mem_base], eax |
|
mov esi, msgHDAUpMMIo |
call SysMsgBoardStr |
stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x14 |
invoke SysMsgBoardStr |
invoke PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x14 |
;-mov [ctrl.hda_upper_mem_base], eax |
stdcall fdword2str, 2 |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
|
.default: |
stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x3C |
invoke PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x3C |
and eax, 0xFF |
@@: |
mov [ctrl.int_line], eax |
1176,11 → 1171,10 |
call azx_readw |
if DEBUG |
mov esi, msgGCap |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
stdcall fdword2str, 2 |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
end if |
|
; allocate CORB/RIRB |
call azx_alloc_cmd_io |
|
1198,14 → 1192,12 |
|
|
|
|
PG_SW equ 0x003 |
PG_NOCACHE equ 0x018 |
|
align 4 |
proc set_HDA |
|
stdcall MapIoMem,[ctrl.ctrl_mem_base],0x1000,PG_SW+PG_NOCACHE |
invoke MapIoMem,[ctrl.ctrl_mem_base],0x1000,PG_SW+PG_NOCACHE |
mov [ctrl.ctrl_mem_base], eax |
ret |
endp |
1291,13 → 1283,13 |
|
; Accept unsolicited responses |
if USE_SINGLE_MODE |
else |
else if USE_UNSOL_EV |
;UNSUPPORTED YET! [ |
; mov edx, ICH6_REG_GCTL |
; call azx_readl |
; or eax, ICH6_GCTL_UNSOL |
; mov edx, ICH6_REG_GCTL |
; call azx_writel |
mov edx, ICH6_REG_GCTL |
call azx_readl |
or eax, ICH6_GCTL_UNSOL |
mov edx, ICH6_REG_GCTL |
call azx_writel |
;UNSUPPORTED YET! ] |
end if |
|
1312,9 → 1304,9 |
|
if DEBUG |
mov esi, msgCodecMask |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
stdcall fdword2str, 2 |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
end if |
|
@@: |
1325,7 → 1317,7 |
.fail: |
if DEBUG |
mov esi, msgHDARFail |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
end if |
stc |
ret |
1390,7 → 1382,7 |
ret |
|
;align 4 |
;proc get_dev_info stdcall, p_info:dword |
;proc get_dev_info stdcall, p_info:dword ;deprecated |
; virtual at esi |
; CTRL_INFO CTRL_INFO |
; end virtual |
1438,7 → 1430,7 |
proc azx_alloc_cmd_io |
push eax ecx edx |
; single page (at least 4096 bytes) must suffice for both ringbuffers |
stdcall KernelAlloc, 4096 |
invoke KernelAlloc, 4096 |
mov [ctrl.rb], eax |
|
mov edi, eax |
1457,7 → 1449,7 |
; CORB set up |
mov eax, [ctrl.rb] |
mov ebx, eax |
call GetPgAddr |
invoke GetPgAddr |
and ebx, 0xFFF |
add eax, ebx |
push eax ; save corb address |
1615,7 → 1607,7 |
if DEBUG |
push esi |
mov esi, msgSpuriousResponce |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
pop esi |
end if |
jmp .l1 |
1676,9 → 1668,9 |
if DEBUG |
push eax esi |
mov esi, msgGetResponceTimeout |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
mov esi, msgPollingCodecOnce |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
pop esi eax |
end if |
mov [do_poll], 1 |
1689,9 → 1681,9 |
if DEBUG |
push eax esi |
mov esi, msgGetResponceTimeout |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
mov esi, msgSwitchToPollMode |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
pop esi eax |
end if |
mov [ctrl.polling_mode], 1 |
1706,7 → 1698,6 |
jmp .out |
@@: |
|
|
; a fatal communication error; need either to reset or to fallback |
; to the single_cmd mode |
mov [ctrl.rirb_error], 1 |
1780,11 → 1771,11 |
mov edx, ICH6_REG_IRS |
call azx_readw |
mov esi, msgGetResponceTimeout |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
mov esi, msgIRS |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
stdcall fdword2str, 2 |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
end if |
|
pop esi edx ecx |
1836,14 → 1827,14 |
mov edx, ICH6_REG_IRS |
call azx_readw |
mov esi, msgSendCmdTimeout |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
stdcall fdword2str, 2 |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
mov esi, msgVal |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
mov eax, dword [val] |
stdcall fdword2str, 2 |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
end if |
|
pop esi edx ecx |
2041,7 → 2032,7 |
; program the position buffer |
mov eax, dword [ctrl.posbuf] |
mov ebx, eax |
call GetPgAddr |
invoke GetPgAddr |
and ebx, 0xFFF |
add eax, ebx |
mov edx, ICH6_REG_DPLBASE |
2060,7 → 2051,7 |
; update bits in a PCI register byte |
proc update_pci_byte stdcall, reg:dword, mask:dword, val:dword |
push ax bx |
stdcall PciRead8, [ctrl.bus], [ctrl.devfn], [reg] |
invoke PciRead8, [ctrl.bus], [ctrl.devfn], [reg] |
mov bl, byte [mask] |
mov bh, bl |
xor bl, -1 |
2068,7 → 2059,7 |
shr bx, 8 |
and bl, byte [val] |
or al, bl |
stdcall PciWrite8, [ctrl.bus], [ctrl.devfn], [reg], eax |
invoke PciWrite8, [ctrl.bus], [ctrl.devfn], [reg], eax |
pop bx ax |
ret |
endp |
2102,7 → 2093,7 |
cmp eax, AZX_DRIVER_PCH |
jne @f |
.l1: |
stdcall PciRead16, [ctrl.bus], [ctrl.devfn], dword INTEL_SCH_HDA_DEVC |
invoke PciRead16, [ctrl.bus], [ctrl.devfn], dword INTEL_SCH_HDA_DEVC |
test ax, INTEL_SCH_HDA_DEVC_NOSNOOP |
jz @f |
push ebx |
2110,19 → 2101,19 |
xor ebx, -1 |
and eax, ebx |
pop ebx |
stdcall PciWrite16, [ctrl.bus], [ctrl.devfn], dword INTEL_SCH_HDA_DEVC, eax |
stdcall PciRead16, [ctrl.bus], [ctrl.devfn], dword INTEL_SCH_HDA_DEVC |
invoke PciWrite16, [ctrl.bus], [ctrl.devfn], dword INTEL_SCH_HDA_DEVC, eax |
invoke PciRead16, [ctrl.bus], [ctrl.devfn], dword INTEL_SCH_HDA_DEVC |
|
if DEBUG |
push esi |
mov esi, msgHDASnoopDisabled |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
mov esi, msg_OK |
test ax, INTEL_SCH_HDA_DEVC_NOSNOOP |
jz .snoop_ok |
mov esi, msg_Fail |
.snoop_ok: |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
pop esi |
end if |
@@: |
2223,7 → 2214,7 |
; lower BDL address |
mov eax, [pcmout_bdl] |
mov ebx, eax |
call GetPgAddr |
invoke GetPgAddr |
and ebx, 0xFFF |
add eax, ebx |
mov edx, ICH6_REG_SD_BDLPL + SDO_OFS |
2242,7 → 2233,7 |
jnz @f |
mov eax, dword [ctrl.posbuf] |
mov ebx, eax |
call GetPgAddr |
invoke GetPgAddr |
and ebx, 0xFFF |
add eax, ebx |
or eax, ICH6_DPLBASE_ENABLE |
2249,7 → 2240,6 |
mov edx, ICH6_REG_DPLBASE |
call azx_writel |
@@: |
|
; set the interrupt enable bits in the descriptor control register |
mov edx, ICH6_REG_SD_CTL + SDO_OFS |
call azx_readl |
2281,11 → 2271,11 |
if DEBUG |
push esi |
mov esi, msgCodecOK |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
mov esi, msgCAd |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
stdcall fdword2str, 3 |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
pop esi |
end if |
xor eax, eax |
2319,7 → 2309,7 |
; Some BIOSen give you wrong codec addresses that don't exist |
if DEBUG |
mov esi, msgCodecError |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
end if |
mov ebx, edx |
xor ebx, -1 |
2395,8 → 2385,10 |
; disable interrupts |
call azx_int_disable |
call azx_int_clear |
|
; disable CORB/RIRB |
call azx_free_cmd_io |
|
; disable position buffer |
xor eax, eax |
mov edx, ICH6_REG_DPLBASE |
2403,7 → 2395,6 |
call azx_writel |
mov edx, ICH6_REG_DPUBASE |
call azx_writel |
|
pop edx eax |
ret |
endp |
2436,18 → 2427,18 |
push eax ebx ecx edx |
mov ebx, [volume.maxDb] |
neg eax |
if 0;DEBUG ;YAHOO |
if DEBUG ;- |
push eax esi |
mov esi, msgNewVolume |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
stdcall fdword2str, 2 |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
|
mov esi, msgMaxVolume |
call SysMsgBoardStr |
mov esi, msgMinVolume |
invoke SysMsgBoardStr |
mov eax, ebx |
stdcall fdword2str, 2 |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
pop esi eax |
end if |
test ebx, ebx |
2459,16 → 2450,20 |
jmp .set |
@@: |
cmp eax, ebx |
jl .set |
jng .set |
mov eax, ebx |
.set: |
sub ebx, eax |
mov eax, ebx |
;cdq |
xor edx, edx |
shl eax, 2 |
mov ebx, 100 |
div bx |
mov bl, [volume.step_size] |
div bl |
push eax |
movzx eax, [volume.step_size] |
imul eax, (100/4) |
mov ebx, eax |
pop eax |
xor edx, edx |
idiv ebx |
|
mov edx, [volume.out_amp_node] |
test edx, edx |
2486,10 → 2481,10 |
pop edx ecx ebx eax |
ret |
.err_out: |
if 0;DEBUG ;YAHOO |
if DEBUG ;- |
push esi |
mov esi, emsgNoVolCtrl |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
pop esi |
end if |
jmp .out |
2508,13 → 2503,10 |
jz .out |
movzx ebx, [edx+HDA_GNODE.nid] |
stdcall get_volume_mute, ebx, ecx, HDA_OUTPUT, 0 |
and eax, 0x7F ;get gain |
mov cl, [volume.step_size] |
mul cl |
|
mov cx, 100 |
mul cx |
shr eax, 2 ; *0.25 |
neg eax |
imul eax, (-100/4) |
.out: |
pop edx ecx ebx |
ret |
2616,9 → 2608,14 |
if DEBUG |
push esi |
mov esi, msgUnsolEvent |
call SysMsgBoardStr |
invoke SysMsgBoardStr |
pop esi |
end if |
if USE_UNSOL_EV = 0 |
;Test. Do not make queue, process immediately! |
;stdcall here snd_hda_read_pin_sense stdcall, nid:dword, trigger_sense:dword |
;and then mute/unmute pin based on the results |
end if |
ret |
endp |
;... |
2945,7 → 2942,7 |
|
if DEBUG |
msgYAHOO2 db 'YAHOO2: ',0 |
msgMaxVolume db 'MaxVolume: ',0 |
msgMinVolume db 'MinVolume: ',0 |
msgNewVolume db 'NewVolume: ',0 |
|
msgVerbQuery db 'Q: ',0 |
2960,13 → 2957,13 |
msgBeeperNid db 'Beeper found: NID=',0 |
msgBeeperValue db 'Beeper initial value: ',0 |
msgBeepNow db 'Beep!',13,10,0 |
|
msgNodeSeq db 'Sequence of codec nodes:',13,10,0 |
msgNID db 'NID: 0x',0 |
end if |
|
;] Asper |
|
|
section '.data' data readable writable align 16 |
|
aspinlock dd SPINLOCK_FREE |
|
codec CODEC |