Rev 168 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 168 | Rev 188 | ||
---|---|---|---|
Line 114... | Line 114... | ||
114 | DEV_GET_MASTERVOL equ 7 |
114 | DEV_GET_MASTERVOL equ 7 |
115 | DEV_GET_INFO equ 8 |
115 | DEV_GET_INFO equ 8 |
116 | 116 | ||
Line 117... | Line 117... | ||
117 | struc AC_CNTRL ;AC controller base class |
117 | struc AC_CNTRL ;AC controller base class |
118 | { .bus dd 0 |
118 | { .bus dd ? |
119 | .devfn dd 0 |
119 | .devfn dd ? |
Line 120... | Line 120... | ||
120 | 120 | ||
121 | .vendor dd 0 |
121 | .vendor dd ? |
122 | .dev_id dd 0 |
122 | .dev_id dd ? |
123 | .pci_cmd dd 0 |
123 | .pci_cmd dd ? |
124 | .pci_stat dd 0 |
124 | .pci_stat dd ? |
125 | 125 | ||
126 | .codec_io_base dd 0 |
126 | .codec_io_base dd ? |
127 | .codec_mem_base dd 0 |
127 | .codec_mem_base dd ? |
128 | 128 | ||
129 | .ctrl_io_base dd 0 |
129 | .ctrl_io_base dd ? |
130 | .ctrl_mem_base dd 0 |
130 | .ctrl_mem_base dd ? |
131 | .cfg_reg dd 0 |
131 | .cfg_reg dd ? |
132 | .int_line dd 0 |
132 | .int_line dd ? |
133 | 133 | ||
134 | .vendor_ids dd 0 ;vendor id string |
134 | .vendor_ids dd ? ;vendor id string |
135 | .ctrl_ids dd 0 ;hub id string |
135 | .ctrl_ids dd ? ;hub id string |
136 | 136 | ||
137 | .buffer dd 0 |
137 | .buffer dd ? |
138 | 138 | ||
139 | .notify_pos dd 0 |
139 | .notify_pos dd ? |
140 | .notify_task dd 0 |
140 | .notify_task dd ? |
141 | 141 | ||
142 | .lvi_reg dd 0 |
142 | .lvi_reg dd ? |
143 | .ctrl_setup dd 0 |
143 | .ctrl_setup dd ? |
144 | .user_callback dd 0 |
144 | .user_callback dd ? |
145 | .codec_read16 dd 0 |
145 | .codec_read16 dd ? |
146 | .codec_write16 dd 0 |
146 | .codec_write16 dd ? |
147 | 147 | ||
148 | .ctrl_read8 dd 0 |
148 | .ctrl_read8 dd ? |
149 | .ctrl_read16 dd 0 |
149 | .ctrl_read16 dd ? |
150 | .ctrl_read32 dd 0 |
150 | .ctrl_read32 dd ? |
151 | 151 | ||
152 | .ctrl_write8 dd 0 |
152 | .ctrl_write8 dd ? |
153 | .ctrl_write16 dd 0 |
153 | .ctrl_write16 dd ? |
154 | .ctrl_write32 dd 0 |
154 | .ctrl_write32 dd ? |
Line 155... | Line 155... | ||
155 | } |
155 | } |
156 | 156 | ||
157 | struc CODEC ;Audio Chip base class |
157 | struc CODEC ;Audio Chip base class |
158 | { |
158 | { |
159 | .chip_id dd 0 |
159 | .chip_id dd ? |
160 | .flags dd 0 |
160 | .flags dd ? |
161 | .status dd 0 |
161 | .status dd ? |
162 | 162 | ||
163 | .ac_vendor_ids dd 0 ;ac vendor id string |
163 | .ac_vendor_ids dd ? ;ac vendor id string |
164 | .chip_ids dd 0 ;chip model string |
164 | .chip_ids dd ? ;chip model string |
165 | 165 | ||
166 | .shadow_flag dd 0 |
166 | .shadow_flag dd ? |
167 | dd 0 |
167 | dd ? |
168 | 168 | ||
169 | .regs dw 0 ; codec registers |
169 | .regs dw ? ; codec registers |
170 | .reg_master_vol dw 0 ;0x02 |
170 | .reg_master_vol dw ? ;0x02 |
171 | .reg_aux_out_vol dw 0 ;0x04 |
171 | .reg_aux_out_vol dw ? ;0x04 |
172 | .reg_mone_vol dw 0 ;0x06 |
172 | .reg_mone_vol dw ? ;0x06 |
173 | .reg_master_tone dw 0 ;0x08 |
173 | .reg_master_tone dw ? ;0x08 |
174 | .reg_beep_vol dw 0 ;0x0A |
174 | .reg_beep_vol dw ? ;0x0A |
175 | .reg_phone_vol dw 0 ;0x0C |
175 | .reg_phone_vol dw ? ;0x0C |
176 | .reg_mic_vol dw 0 ;0x0E |
176 | .reg_mic_vol dw ? ;0x0E |
177 | .reg_line_in_vol dw 0 ;0x10 |
177 | .reg_line_in_vol dw ? ;0x10 |
178 | .reg_cd_vol dw 0 ;0x12 |
178 | .reg_cd_vol dw ? ;0x12 |
179 | .reg_video_vol dw 0 ;0x14 |
179 | .reg_video_vol dw ? ;0x14 |
180 | .reg_aux_in_vol dw 0 ;0x16 |
180 | .reg_aux_in_vol dw ? ;0x16 |
181 | .reg_pcm_out_vol dw 0 ;0x18 |
181 | .reg_pcm_out_vol dw ? ;0x18 |
182 | .reg_rec_select dw 0 ;0x1A |
182 | .reg_rec_select dw ? ;0x1A |
183 | .reg_rec_gain dw 0 ;0x1C |
183 | .reg_rec_gain dw ? ;0x1C |
184 | .reg_rec_gain_mic dw 0 ;0x1E |
184 | .reg_rec_gain_mic dw ? ;0x1E |
185 | .reg_gen dw 0 ;0x20 |
185 | .reg_gen dw ? ;0x20 |
186 | .reg_3d_ctrl dw 0 ;0X22 |
186 | .reg_3d_ctrl dw ? ;0X22 |
187 | .reg_page dw 0 ;0X24 |
187 | .reg_page dw ? ;0X24 |
188 | .reg_powerdown dw 0 ;0x26 |
188 | .reg_powerdown dw ? ;0x26 |
189 | .reg_ext_audio dw 0 ;0x28 |
189 | .reg_ext_audio dw ? ;0x28 |
190 | .reg_ext_st dw 0 ;0x2a |
190 | .reg_ext_st dw ? ;0x2a |
191 | .reg_pcm_front_rate dw 0 ;0x2c |
191 | .reg_pcm_front_rate dw ? ;0x2c |
192 | .reg_pcm_surr_rate dw 0 ;0x2e |
192 | .reg_pcm_surr_rate dw ? ;0x2e |
193 | .reg_lfe_rate dw 0 ;0x30 |
193 | .reg_lfe_rate dw ? ;0x30 |
194 | .reg_pcm_in_rate dw 0 ;0x32 |
194 | .reg_pcm_in_rate dw ? ;0x32 |
195 | dw 0 ;0x34 |
195 | dw ? ;0x34 |
196 | .reg_cent_lfe_vol dw 0 ;0x36 |
196 | .reg_cent_lfe_vol dw ? ;0x36 |
197 | .reg_surr_vol dw 0 ;0x38 |
197 | .reg_surr_vol dw ? ;0x38 |
198 | .reg_spdif_ctrl dw 0 ;0x3A |
198 | .reg_spdif_ctrl dw ? ;0x3A |
199 | dw 0 ;0x3C |
199 | dw ? ;0x3C |
200 | dw 0 ;0x3E |
200 | dw ? ;0x3E |
201 | dw 0 ;0x40 |
201 | dw ? ;0x40 |
202 | dw 0 ;0x42 |
202 | dw ? ;0x42 |
203 | dw 0 ;0x44 |
203 | dw ? ;0x44 |
204 | dw 0 ;0x46 |
204 | dw ? ;0x46 |
205 | dw 0 ;0x48 |
205 | dw ? ;0x48 |
206 | dw 0 ;0x4A |
206 | dw ? ;0x4A |
207 | dw 0 ;0x4C |
207 | dw ? ;0x4C |
208 | dw 0 ;0x4E |
208 | dw ? ;0x4E |
209 | dw 0 ;0x50 |
209 | dw ? ;0x50 |
210 | dw 0 ;0x52 |
210 | dw ? ;0x52 |
211 | dw 0 ;0x54 |
211 | dw ? ;0x54 |
212 | dw 0 ;0x56 |
212 | dw ? ;0x56 |
213 | dw 0 ;0x58 |
213 | dw ? ;0x58 |
214 | dw 0 ;0x5A |
214 | dw ? ;0x5A |
215 | dw 0 ;0x5C |
215 | dw ? ;0x5C |
216 | dw 0 ;0x5E |
216 | dw ? ;0x5E |
217 | .reg_page_0 dw 0 ;0x60 |
217 | .reg_page_0 dw ? ;0x60 |
218 | .reg_page_1 dw 0 ;0x62 |
218 | .reg_page_1 dw ? ;0x62 |
219 | .reg_page_2 dw 0 ;0x64 |
219 | .reg_page_2 dw ? ;0x64 |
220 | .reg_page_3 dw 0 ;0x66 |
220 | .reg_page_3 dw ? ;0x66 |
221 | .reg_page_4 dw 0 ;0x68 |
221 | .reg_page_4 dw ? ;0x68 |
222 | .reg_page_5 dw 0 ;0x6A |
222 | .reg_page_5 dw ? ;0x6A |
223 | .reg_page_6 dw 0 ;0x6C |
223 | .reg_page_6 dw ? ;0x6C |
224 | .reg_page_7 dw 0 ;0x6E |
224 | .reg_page_7 dw ? ;0x6E |
225 | dw 0 ;0x70 |
225 | dw ? ;0x70 |
226 | dw 0 ;0x72 |
226 | dw ? ;0x72 |
227 | dw 0 ;0x74 |
227 | dw ? ;0x74 |
228 | dw 0 ;0x76 |
228 | dw ? ;0x76 |
229 | dw 0 ;0x78 |
229 | dw ? ;0x78 |
230 | dw 0 ;0x7A |
230 | dw ? ;0x7A |
Line 231... | Line 231... | ||
231 | .reg_vendor_id_1 dw 0 ;0x7C |
231 | .reg_vendor_id_1 dw ? ;0x7C |
232 | .reg_vendor_id_2 dw 0 ;0x7E |
232 | .reg_vendor_id_2 dw ? ;0x7E |
233 | 233 | ||
Line 234... | Line 234... | ||
234 | 234 | ||
235 | .reset dd 0 ;virual |
235 | .reset dd ? ;virual |
236 | .set_master_vol dd 0 |
236 | .set_master_vol dd ? |
Line 266... | Line 266... | ||
266 | OS_BASE equ 0; 0x80400000 |
266 | OS_BASE equ 0; 0x80400000 |
267 | new_app_base equ 0x60400000; 0x01000000 |
267 | new_app_base equ 0x60400000; 0x01000000 |
268 | PROC_BASE equ OS_BASE+0x0080000 |
268 | PROC_BASE equ OS_BASE+0x0080000 |
Line 269... | Line -... | ||
269 | - | ||
270 | public service_proc |
269 | |
271 | public START |
270 | public START |
- | 271 | public STOP |
|
- | 272 | public service_proc |
|
- | 273 | ||
- | 274 | extrn AttachIntHandler |
|
- | 275 | extrn SysMsgBoardStr |
|
- | 276 | extrn PciApi |
|
- | 277 | extrn PciRead32 |
|
- | 278 | extrn PciRead8 |
|
- | 279 | extrn PciWrite8 |
|
- | 280 | extrn AllocKernelSpace |
|
- | 281 | extrn MapPage |
|
- | 282 | extrn RegService |
|
- | 283 | extrn KernelAlloc |
|
- | 284 | extrn GetPgAddr |
|
Line 272... | Line 285... | ||
272 | public IMPORTS |
285 | extrn GetCurrentTask |
Line 273... | Line 286... | ||
273 | 286 | ||
274 | section '.flat' align 16 |
287 | section '.flat' code readable align 16 |
275 | 288 | ||
276 | START: |
289 | START: |
277 | if DEBUG |
290 | if DEBUG |
Line 278... | Line 291... | ||
278 | mov esi, msgInit |
291 | mov esi, msgInit |
279 | call [SysMsgBoardStr] |
292 | call SysMsgBoardStr |
280 | end if |
293 | end if |
Line 281... | Line 294... | ||
281 | 294 | ||
282 | call detect_controller |
295 | call detect_controller |
283 | test eax, eax |
296 | test eax, eax |
284 | jz .fail |
297 | jz .fail |
285 | 298 | ||
Line 286... | Line 299... | ||
286 | if DEBUG |
299 | if DEBUG |
Line 287... | Line 300... | ||
287 | mov esi,[ctrl.vendor_ids] |
300 | mov esi,[ctrl.vendor_ids] |
288 | call [SysMsgBoardStr] |
301 | call SysMsgBoardStr |
289 | mov esi, [ctrl.ctrl_ids] |
302 | mov esi, [ctrl.ctrl_ids] |
Line 290... | Line 303... | ||
290 | call [SysMsgBoardStr] |
303 | call SysMsgBoardStr |
291 | 304 | ||
292 | end if |
305 | end if |
293 | 306 | ||
Line 294... | Line 307... | ||
294 | call init_controller |
307 | call init_controller |
295 | test eax, eax |
308 | test eax, eax |
296 | jz .fail |
309 | jz .fail |
Line 297... | Line 310... | ||
297 | 310 | ||
298 | if DEBUG |
311 | if DEBUG |
299 | mov esi, msgInitCodec |
312 | mov esi, msgInitCodec |
Line 300... | Line 313... | ||
300 | call [SysMsgBoardStr] |
313 | call SysMsgBoardStr |
301 | end if |
314 | end if |
302 | 315 | ||
Line 303... | Line 316... | ||
303 | call init_codec |
316 | call init_codec |
304 | test eax, eax |
317 | test eax, eax |
Line 305... | Line 318... | ||
305 | jz .fail |
318 | jz .fail |
306 | 319 | ||
Line 307... | Line 320... | ||
307 | if DEBUG |
320 | if DEBUG |
Line 308... | Line 321... | ||
308 | mov esi, [codec.ac_vendor_ids] |
321 | mov esi, [codec.ac_vendor_ids] |
Line 339... | Line 352... | ||
339 | mov esi, msgAttchIRQ |
352 | mov esi, msgAttchIRQ |
340 | bt eax, ebx |
353 | bt eax, ebx |
341 | jnc .fail |
354 | jnc .fail |
342 | 355 | ||
Line 343... | Line 356... | ||
343 | stdcall [AttachIntHandler], ebx, ac97_irq |
356 | stdcall AttachIntHandler, ebx, ac97_irq |
344 | - | ||
345 | stdcall [RegService], sz_sound_srv, service_proc |
357 | stdcall RegService, sz_sound_srv, service_proc |
346 | - | ||
347 | mov esi, msgOk |
- | |
348 | call [SysMsgBoardStr] |
- | |
349 | - | ||
350 | ret |
358 | ret |
351 | - | ||
352 | .fail: |
359 | .fail: |
353 | if DEBUG |
360 | if DEBUG |
354 | mov esi, msgFail |
361 | mov esi, msgFail |
355 | call [SysMsgBoardStr] |
362 | call SysMsgBoardStr |
356 | end if |
363 | end if |
357 | - | ||
358 | xor eax, eax |
364 | xor eax, eax |
- | 365 | STOP: |
|
359 | ret |
366 | ret |
Line 360... | Line 367... | ||
360 | 367 | ||
361 | handle equ IOCTL.handle |
368 | handle equ IOCTL.handle |
362 | io_code equ IOCTL.io_code |
369 | io_code equ IOCTL.io_code |
Line 373... | Line 380... | ||
373 | cmp eax, DEV_PLAY |
380 | cmp eax, DEV_PLAY |
374 | jne @F |
381 | jne @F |
375 | if DEBUG |
382 | if DEBUG |
376 | mov esi, msgPlay |
383 | mov esi, msgPlay |
377 | call [SysMsgBoardStr] |
384 | call SysMsgBoardStr |
378 | end if |
385 | end if |
379 | call play |
386 | call play |
380 | ret |
387 | ret |
381 | @@: |
388 | @@: |
382 | cmp eax, DEV_STOP |
389 | cmp eax, DEV_STOP |
383 | jne @F |
390 | jne @F |
384 | if DEBUG |
391 | if DEBUG |
385 | mov esi, msgStop |
392 | mov esi, msgStop |
386 | call [SysMsgBoardStr] |
393 | call SysMsgBoardStr |
387 | end if |
394 | end if |
388 | call stop |
395 | call stop |
389 | ret |
396 | ret |
390 | @@: |
397 | @@: |
391 | cmp eax, DEV_CALLBACK |
398 | cmp eax, DEV_CALLBACK |
392 | jne @F |
399 | jne @F |
Line 438... | Line 445... | ||
438 | in ax,dx |
445 | in ax,dx |
439 | bts ax, IRQ_LINE |
446 | bts ax, IRQ_LINE |
440 | out dx, aX |
447 | out dx, aX |
441 | 448 | ||
Line 442... | Line 449... | ||
442 | stdcall [PciWrite8], dword 0, dword 0xF8, dword 0x61, dword IRQ_LINE |
449 | stdcall PciWrite8, dword 0, dword 0xF8, dword 0x61, dword IRQ_LINE |
443 | mov [ctrl.int_line], IRQ_LINE |
450 | mov [ctrl.int_line], IRQ_LINE |
Line 444... | Line 451... | ||
444 | 451 | ||
445 | .exit: |
452 | .exit: |
446 | ret |
453 | ret |
Line 450... | Line 457... | ||
450 | proc ac97_irq |
457 | proc ac97_irq |
451 | 458 | ||
Line 452... | Line 459... | ||
452 | ; if DEBUG |
459 | ; if DEBUG |
453 | ; mov esi, msgIRQ |
460 | ; mov esi, msgIRQ |
454 | ; call [SysMsgBoardStr] |
461 | ; call SysMsgBoardStr |
455 | ; end if |
462 | ; end if |
Line 456... | Line 463... | ||
456 | 463 | ||
457 | mov edx, PCM_OUT_CR_REG |
464 | mov edx, PCM_OUT_CR_REG |
458 | mov al, 0x14 |
465 | mov al, 0x14 |
Line 502... | Line 509... | ||
502 | 509 | ||
Line 503... | Line 510... | ||
503 | align 4 |
510 | align 4 |
504 | proc create_primary_buff |
511 | proc create_primary_buff |
Line 505... | Line 512... | ||
505 | 512 | ||
506 | stdcall [KernelAlloc], 0x10000 |
513 | stdcall KernelAlloc, 0x10000 |
Line 507... | Line 514... | ||
507 | mov [ctrl.buffer], eax |
514 | mov [ctrl.buffer], eax |
508 | 515 | ||
509 | mov edi, eax |
516 | mov edi, eax |
510 | mov ecx, 0x10000/4 |
517 | mov ecx, 0x10000/4 |
511 | xor eax, eax |
518 | xor eax, eax |
Line 512... | Line 519... | ||
512 | cld |
519 | cld |
Line 513... | Line 520... | ||
513 | rep stosd |
520 | rep stosd |
514 | 521 | ||
515 | stdcall [GetPgAddr], [ctrl.buffer] |
522 | stdcall GetPgAddr, [ctrl.buffer] |
516 | 523 | ||
Line 563... | Line 570... | ||
563 | add edi, 4 |
570 | add edi, 4 |
564 | loop @B |
571 | loop @B |
565 | 572 | ||
Line 566... | Line 573... | ||
566 | mov ecx, pcmout_bdl |
573 | mov ecx, pcmout_bdl |
567 | stdcall [GetPgAddr], ecx |
574 | stdcall GetPgAddr, ecx |
568 | and ecx, 0xFFF |
575 | and ecx, 0xFFF |
569 | add eax, ecx |
576 | add eax, ecx |
Line 570... | Line 577... | ||
570 | 577 | ||
571 | mov edx, PCM_OUT_BDL |
578 | mov edx, PCM_OUT_BDL |
Line 589... | Line 596... | ||
589 | 596 | ||
Line 590... | Line 597... | ||
590 | xor eax, eax |
597 | xor eax, eax |
591 | mov [bus], eax |
598 | mov [bus], eax |
592 | inc eax |
599 | inc eax |
593 | call [PciApi] |
600 | call PciApi |
594 | cmp eax, -1 |
601 | cmp eax, -1 |
595 | je .err |
602 | je .err |
Line 596... | Line 603... | ||
596 | 603 | ||
Line 597... | Line 604... | ||
597 | mov [last_bus], eax |
604 | mov [last_bus], eax |
598 | 605 | ||
599 | .next_bus: |
606 | .next_bus: |
600 | and [devfn], 0 |
607 | and [devfn], 0 |
601 | .next_dev: |
608 | .next_dev: |
602 | stdcall [PciRead32], [bus], [devfn], dword 0 |
609 | stdcall PciRead32, [bus], [devfn], dword 0 |
603 | test eax, eax |
610 | test eax, eax |
604 | jz .next |
611 | jz .next |
Line 675... | Line 682... | ||
675 | je .err |
682 | je .err |
676 | 683 | ||
Line 677... | Line 684... | ||
677 | mov [last_bus], eax |
684 | mov [last_bus], eax |
678 | .next_bus: |
685 | .next_bus: |
679 | stdcall [PciRead32], [bus], dword 0xF8, dword 0 |
686 | stdcall PciRead32, [bus], dword 0xF8, dword 0 |
680 | test eax, eax |
687 | test eax, eax |
681 | jz .next |
688 | jz .next |
682 | cmp eax, -1 |
689 | cmp eax, -1 |
683 | je .next |
690 | je .next |
Line 701... | Line 708... | ||
701 | 708 | ||
Line 702... | Line 709... | ||
702 | align 4 |
709 | align 4 |
703 | proc init_controller |
710 | proc init_controller |
Line 704... | Line 711... | ||
704 | 711 | ||
705 | stdcall [PciRead32], [ctrl.bus], [ctrl.devfn], dword 4 |
712 | stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 4 |
706 | mov ebx, eax |
713 | mov ebx, eax |
707 | and eax, 0xFFFF |
714 | and eax, 0xFFFF |
708 | mov [ctrl.pci_cmd], eax |
715 | mov [ctrl.pci_cmd], eax |
709 | shr ebx, 16 |
716 | shr ebx, 16 |
Line 710... | Line 717... | ||
710 | mov [ctrl.pci_stat], ebx |
717 | mov [ctrl.pci_stat], ebx |
711 | 718 | ||
712 | stdcall [PciRead32], [ctrl.bus], [ctrl.devfn], dword 0x10 |
719 | stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x10 |
Line 713... | Line 720... | ||
713 | and eax,0xFFFE |
720 | and eax,0xFFFE |
714 | mov [ctrl.codec_io_base], eax |
721 | mov [ctrl.codec_io_base], eax |
715 | 722 | ||
Line 716... | Line 723... | ||
716 | stdcall [PciRead32], [ctrl.bus], [ctrl.devfn], dword 0x14 |
723 | stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x14 |
717 | and eax, 0xFFC0 |
724 | and eax, 0xFFC0 |
Line 718... | Line 725... | ||
718 | mov [ctrl.ctrl_io_base], eax |
725 | mov [ctrl.ctrl_io_base], eax |
719 | 726 | ||
Line 720... | Line 727... | ||
720 | stdcall [PciRead32], [ctrl.bus], [ctrl.devfn], dword 0x18 |
727 | stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x18 |
721 | mov [ctrl.codec_mem_base], eax |
728 | mov [ctrl.codec_mem_base], eax |
722 | 729 | ||
Line 723... | Line 730... | ||
723 | stdcall [PciRead32], [ctrl.bus], [ctrl.devfn], dword 0x1C |
730 | stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x1C |
724 | mov [ctrl.ctrl_mem_base], eax |
731 | mov [ctrl.ctrl_mem_base], eax |
725 | 732 | ||
Line 726... | Line 733... | ||
726 | stdcall [PciRead32], [ctrl.bus], [ctrl.devfn], dword 0x3C |
733 | stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x3C |
727 | and eax, 0xFF |
734 | and eax, 0xFF |
Line 756... | Line 763... | ||
756 | PG_NOCACHE equ 0x018 |
763 | PG_NOCACHE equ 0x018 |
757 | 764 | ||
Line 758... | Line 765... | ||
758 | align 4 |
765 | align 4 |
759 | proc set_ICH4 |
766 | proc set_ICH4 |
760 | stdcall [AllocKernelSpace], dword 0x2000 |
767 | stdcall AllocKernelSpace, dword 0x2000 |
761 | mov edi, eax |
768 | mov edi, eax |
762 | stdcall [MapPage], edi,[ctrl.codec_mem_base],PG_SW+PG_NOCACHE |
769 | stdcall MapPage, edi,[ctrl.codec_mem_base],PG_SW+PG_NOCACHE |
763 | mov [ctrl.codec_mem_base], edi |
770 | mov [ctrl.codec_mem_base], edi |
764 | add edi, 0x1000 |
771 | add edi, 0x1000 |
765 | stdcall [MapPage], edi, [ctrl.ctrl_mem_base],PG_SW+PG_NOCACHE |
772 | stdcall MapPage, edi, [ctrl.ctrl_mem_base],PG_SW+PG_NOCACHE |
766 | mov [ctrl.ctrl_mem_base], edi |
773 | mov [ctrl.ctrl_mem_base], edi |
Line 767... | Line 774... | ||
767 | 774 | ||
768 | mov [ctrl.codec_read16], codec_mem_r16 ;virtual |
775 | mov [ctrl.codec_read16], codec_mem_r16 ;virtual |
Line 859... | Line 866... | ||
859 | jnc .ok |
866 | jnc .ok |
860 | 867 | ||
Line 861... | Line 868... | ||
861 | if DEBUG |
868 | if DEBUG |
862 | mov esi, msgCFail |
869 | mov esi, msgCFail |
863 | call [SysMsgBoardStr] |
870 | call SysMsgBoardStr |
864 | end if |
871 | end if |
865 | xor eax, eax ; timeout error |
872 | xor eax, eax ; timeout error |
866 | ret |
873 | ret |
867 | .ok: |
874 | .ok: |
868 | if DEBUG |
875 | if DEBUG |
869 | mov esi, msgResetOk |
876 | mov esi, msgResetOk |
870 | call [SysMsgBoardStr] |
877 | call SysMsgBoardStr |
871 | end if |
878 | end if |
Line 872... | Line 879... | ||
872 | 879 | ||
873 | xor eax, eax |
880 | xor eax, eax |
874 | inc eax |
881 | inc eax |
Line 886... | Line 893... | ||
886 | call [ctrl.ctrl_write32] |
893 | call [ctrl.ctrl_write32] |
887 | 894 | ||
Line 888... | Line 895... | ||
888 | if DEBUG |
895 | if DEBUG |
889 | mov esi, msgWarm |
896 | mov esi, msgWarm |
890 | call [SysMsgBoardStr] |
897 | call SysMsgBoardStr |
891 | end if |
898 | end if |
Line 892... | Line 899... | ||
892 | 899 | ||
893 | mov [counter], 10 ; total 10*100 ms = 1s |
900 | mov [counter], 10 ; total 10*100 ms = 1s |
894 | .wait: |
901 | .wait: |
Line 903... | Line 910... | ||
903 | jnz .wait |
910 | jnz .wait |
904 | 911 | ||
Line 905... | Line 912... | ||
905 | if DEBUG |
912 | if DEBUG |
906 | mov esi, msgWRFail |
913 | mov esi, msgWRFail |
907 | call [SysMsgBoardStr] |
914 | call SysMsgBoardStr |
908 | end if |
915 | end if |
Line 909... | Line 916... | ||
909 | 916 | ||
910 | stc |
917 | stc |
911 | ret |
918 | ret |
Line 932... | Line 939... | ||
932 | call [ctrl.ctrl_write32] |
939 | call [ctrl.ctrl_write32] |
933 | 940 | ||
Line 934... | Line 941... | ||
934 | if DEBUG |
941 | if DEBUG |
935 | mov esi, msgCold |
942 | mov esi, msgCold |
936 | call [SysMsgBoardStr] |
943 | call SysMsgBoardStr |
937 | end if |
944 | end if |
Line 938... | Line 945... | ||
938 | 945 | ||
939 | mov eax, 1000000 ; wait 1 s |
946 | mov eax, 1000000 ; wait 1 s |
Line 956... | Line 963... | ||
956 | jnz .wait |
963 | jnz .wait |
957 | 964 | ||
Line 958... | Line 965... | ||
958 | if DEBUG |
965 | if DEBUG |
959 | mov esi, msgCRFail |
966 | mov esi, msgCRFail |
960 | call [SysMsgBoardStr] |
967 | call SysMsgBoardStr |
961 | end if |
968 | end if |
962 | stc |
969 | stc |
963 | ret |
970 | ret |
964 | .ok: |
971 | .ok: |
965 | mov edx, CTRL_STAT |
972 | mov edx, CTRL_STAT |
Line 1290... | Line 1297... | ||
1290 | 1297 | ||
Line 1291... | Line 1298... | ||
1291 | 1298 | ||
Line 1292... | Line -... | ||
1292 | include "codec.inc" |
- | |
1293 | 1299 | include "codec.inc" |
|
1294 | - | ||
1295 | align 16 |
- | |
1296 | pcmout_bdl dq 32 dup(0) |
- | |
1297 | buff_list dd 32 dup(0) |
- | |
1298 | - | ||
1299 | align 16 |
- | |
1300 | ctrl AC_CNTRL |
- | |
1301 | - | ||
1302 | align 16 |
- | |
1303 | codec CODEC |
- | |
1304 | - | ||
1305 | lpc_bus dd 0 |
- | |
1306 | civ_val dd 0 |
- | |
1307 | 1300 | ||
1308 | align 16 |
1301 | align 4 |
1309 | devices dd (CTRL_ICH shl 16)+VID_INTEL,msg_ICH, set_ICH |
1302 | devices dd (CTRL_ICH shl 16)+VID_INTEL,msg_ICH, set_ICH |
1310 | dd (CTRL_ICH0 shl 16)+VID_INTEL,msg_ICH0,set_ICH |
1303 | dd (CTRL_ICH0 shl 16)+VID_INTEL,msg_ICH0,set_ICH |
1311 | dd (CTRL_ICH2 shl 16)+VID_INTEL,msg_ICH2,set_ICH |
1304 | dd (CTRL_ICH2 shl 16)+VID_INTEL,msg_ICH2,set_ICH |
Line 1320... | Line 1313... | ||
1320 | dd (CTRL_NFORCE3 shl 16)+VID_NVIDIA,msg_NForce3,set_ICH |
1313 | dd (CTRL_NFORCE3 shl 16)+VID_NVIDIA,msg_NForce3,set_ICH |
1321 | 1314 | ||
Line 1322... | Line 1315... | ||
1322 | dd 0 ;terminator |
1315 | dd 0 ;terminator |
Line 1323... | Line -... | ||
1323 | - | ||
1324 | align 16 |
- | |
1325 | imp_table: |
- | |
1326 | IMPORTS: |
- | |
1327 | - | ||
1328 | AttachIntHandler dd szAttachIntHandler |
- | |
1329 | SysMsgBoardStr dd szSysMsgBoardStr |
- | |
1330 | PciApi dd szPciApi |
- | |
1331 | PciRead32 dd szPciRead32 |
- | |
1332 | PciRead8 dd szPciRead8 |
- | |
1333 | PciWrite8 dd szPciWrite8 |
- | |
1334 | AllocKernelSpace dd szAllocKernelSpace |
- | |
1335 | MapPage dd szMapPage |
- | |
1336 | KernelAlloc dd szKernelAlloc |
- | |
1337 | GetPgAddr dd szGetPgAddr |
- | |
1338 | RegService dd szRegService |
- | |
1339 | GetCurrentTask dd szGetCurrentTask |
- | |
1340 | dd 0 |
- | |
1341 | 1316 | ||
1342 | msg_ICH db 'Intel ICH', 13,10, 0 |
1317 | msg_ICH db 'Intel ICH', 13,10, 0 |
1343 | msg_ICH0 db 'Intel ICH0', 13,10, 0 |
1318 | msg_ICH0 db 'Intel ICH0', 13,10, 0 |
1344 | msg_ICH2 db 'Intel ICH2', 13,10, 0 |
1319 | msg_ICH2 db 'Intel ICH2', 13,10, 0 |
1345 | msg_ICH3 db 'Intel ICH3', 13,10, 0 |
1320 | msg_ICH3 db 'Intel ICH3', 13,10, 0 |
Line 1353... | Line 1328... | ||
1353 | msg_NForce2 db 'NForce 2', 13,10, 0 |
1328 | msg_NForce2 db 'NForce 2', 13,10, 0 |
1354 | msg_NForce3 db 'NForce 3', 13,10, 0 |
1329 | msg_NForce3 db 'NForce 3', 13,10, 0 |
1355 | msg_NVidia db 'NVidea', 0 |
1330 | msg_NVidia db 'NVidea', 0 |
1356 | 1331 | ||
Line 1357... | Line -... | ||
1357 | - | ||
1358 | szKernel db 'KERNEL', 0 |
1332 | szKernel db 'KERNEL', 0 |
1359 | szAttachIntHandler db 'AttachIntHandler',0 |
- | |
1360 | szSysMsgBoardStr db 'SysMsgBoardStr', 0 |
- | |
1361 | szPciApi db 'PciApi', 0 |
- | |
1362 | szPciRead32 db 'PciRead32', 0 |
- | |
1363 | szPciRead8 db 'PciRead8', 0 |
- | |
1364 | szPciWrite8 db 'PciWrite8',0 |
- | |
1365 | szAllocKernelSpace db 'AllocKernelSpace',0 |
- | |
1366 | szMapPage db 'MapPage',0 |
- | |
1367 | szRegService db 'RegService',0 |
- | |
1368 | szKernelAlloc db 'KernelAlloc',0 |
- | |
1369 | szGetPgAddr db 'GetPgAddr',0 |
- | |
1370 | szGetCurrentTask db 'GetCurrentTask ',0 |
- | |
1371 | - | ||
1372 | sz_sound_srv db 'SOUND',0 |
1333 | sz_sound_srv db 'SOUND',0 |
Line 1373... | Line 1334... | ||
1373 | 1334 | ||
1374 | msgInit db 'detect hardware...',13,10,0 |
1335 | msgInit db 'detect hardware...',13,10,0 |
1375 | msgFail db 'device not found',13,10,0 |
1336 | msgFail db 'device not found',13,10,0 |
Line 1390... | Line 1351... | ||
1390 | msgCRFail db 'cold reset failed',13,10,0 |
1351 | msgCRFail db 'cold reset failed',13,10,0 |
1391 | msgCFail db 'codec not ready',13,10,0 |
1352 | msgCFail db 'codec not ready',13,10,0 |
1392 | msgResetOk db 'reset complete',13,10,0 |
1353 | msgResetOk db 'reset complete',13,10,0 |
1393 | 1354 | ||
Line -... | Line 1355... | ||
- | 1355 | section '.data' data readable writable align 16 |
|
- | 1356 | ||
- | 1357 | pcmout_bdl rq 32 |
|
- | 1358 | buff_list rd 32 |
|
- | 1359 | ||
- | 1360 | codec CODEC |
|
- | 1361 | ctrl AC_CNTRL |
|
- | 1362 | ||
- | 1363 | lpc_bus rd 1 |
|
- | 1364 | civ_val rd 1 |
|
- | 1365 | ||
- | 1366 |