Subversion Repositories Kolibri OS

Rev

Rev 381 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 381 Rev 406
Line 3... Line 3...
3
format MS COFF
3
format MS COFF
Line 4... Line 4...
4
 
4
 
-
 
5
 
Line 5... Line 6...
5
 
6
include 'proc32.inc'
Line 6... Line 7...
6
include 'proc32.inc'
7
include 'imports.inc'
Line 50... Line 51...
50
BIT29 EQU 0x20000000
51
BIT29 EQU 0x20000000
51
BIT30 EQU 0x40000000
52
BIT30 EQU 0x40000000
52
BIT31 EQU 0x80000000
53
BIT31 EQU 0x80000000
53
 
54
 
Line 54... Line -...
54
VID_INTEL	  equ 0x8086
-
 
55
VID_NVIDIA        equ 0x10DE
-
 
56
 
-
 
57
CTRL_ICH	  equ 0x2415
-
 
58
CTRL_ICH0	  equ 0x2425
-
 
59
CTRL_ICH2	  equ 0x2435
-
 
60
CTRL_ICH3	  equ 0x2445
-
 
61
CTRL_ICH4	  equ 0x24C5
-
 
62
CTRL_ICH5	  equ 0x24D5
-
 
63
CTRL_ICH6	  equ 0x266E
-
 
64
CTRL_ICH7	  equ 0x27DE
-
 
65
 
-
 
66
CTRL_NFORCE       equ 0x01B1
-
 
67
CTRL_NFORCE2      equ 0x006A
-
 
68
CTRL_NFORCE3      equ 0x00DA
-
 
69
 
-
 
Line 70... Line 55...
70
 
55
 
71
PCM_OUT_BDL	  equ  0x10	 ; PCM out buffer descriptors list
56
PCM_OUT_BDL	  equ  0x10	 ; PCM out buffer descriptors list
72
PCM_OUT_CR_REG	  equ  0x1b	 ; PCM out Control Register
57
PCM_OUT_CR_REG	  equ  0x1b	 ; PCM out Control Register
73
PCM_OUT_LVI_REG   equ  0x15	 ; PCM last valid index
58
PCM_OUT_LVI_REG   equ  0x15	 ; PCM last valid index
Line 264... Line 249...
264
end virtual
249
end virtual
265
 
250
 
Line 266... Line 251...
266
EVENT_NOTIFY	      equ 0x00000200
251
EVENT_NOTIFY	      equ 0x00000200
Line 267... Line 252...
267
 
252
 
268
OS_BASE 	      equ 0;  0x80400000
253
OS_BASE         equ 0;
269
new_app_base	      equ 0x60400000;   0x01000000
254
SLOT_BASE       equ OS_BASE+0x0080000
Line 270... Line 255...
270
PROC_BASE	      equ OS_BASE+0x0080000
255
new_app_base    equ 0x80000000
271
 
-
 
272
public START
256
 
273
public STOP
-
 
274
public service_proc
-
 
275
 
-
 
276
extrn AttachIntHandler
-
 
277
extrn SysMsgBoardStr
-
 
278
extrn PciApi
-
 
279
extrn PciRead32
-
 
280
extrn PciRead8
-
 
281
extrn PciWrite8
-
 
282
extrn AllocKernelSpace
257
public START
283
extrn MapPage
-
 
284
extrn RegService
-
 
285
extrn KernelAlloc
-
 
Line 286... Line 258...
286
extrn GetPgAddr
258
public service_proc
Line -... Line 259...
-
 
259
public version
-
 
260
 
-
 
261
section '.flat' code readable align 16
-
 
262
 
287
extrn GetCurrentTask
263
proc START stdcall, state:dword
288
 
264
 
289
section '.flat' code readable align 16
265
           cmp [state], 1
290
 
266
           jne .stop
291
START:
267
 
Line 292... Line 268...
292
     if DEBUG
268
     if DEBUG
293
	   mov esi, msgInit
269
           mov esi, msgDetect
Line 304... Line 280...
304
	   mov	  esi, [ctrl.ctrl_ids]
280
           mov   esi, [ctrl.ctrl_ids]
305
           call SysMsgBoardStr
281
           call SysMsgBoardStr
306
 
282
 
Line 307... Line 283...
307
     end if
283
     end if
308
 
-
 
309
           call init_controller
284
           call init_controller
310
           test eax, eax
285
           test eax, eax
311
           jz .fail
286
           jz .fail
-
 
287
           jmp .fail          ;force fail
-
 
288
 
Line 312... Line 289...
312
 
289
 
313
     if DEBUG
290
     if DEBUG
314
           mov esi, msgInitCodec
291
           mov esi, msgInitCodec
315
           call SysMsgBoardStr
292
           call SysMsgBoardStr
Line 334... Line 311...
334
           call SysMsgBoardStr
311
           call SysMsgBoardStr
335
 
312
 
Line 336... Line 313...
336
           call create_primary_buff
313
           call create_primary_buff
Line 337... Line -...
337
 
-
 
338
;     if REMAP_IRQ
-
 
339
 
-
 
340
;           call get_LPC_bus
-
 
341
;           cmp eax, -1
-
 
342
;           jz .fail
-
 
343
 
-
 
344
;           mov [lpc_bus], 0  ;eax
-
 
345
;           call remap_irq
-
 
346
;     end if
-
 
347
 
314
 
348
           mov eax, VALID_IRQ
315
           mov eax, VALID_IRQ
349
           mov ebx, [ctrl.int_line]
316
           mov ebx, [ctrl.int_line]
350
           mov esi, msgInvIRQ
317
           mov esi, msgInvIRQ
351
           bt eax, ebx
318
           bt eax, ebx
Line 363... Line 330...
363
	   mov esi, msgFail
330
           mov esi, msgFail
364
           call SysMsgBoardStr
331
           call SysMsgBoardStr
365
     end if
332
     end if
366
	   xor eax, eax
333
           xor eax, eax
367
STOP:
334
           ret
368
           ret
-
 
369
 
335
.stop:
-
 
336
           call stop
-
 
337
           xor eax, eax
-
 
338
           ret
-
 
339
endp
-
 
340
 
Line 370... Line 341...
370
handle     equ  IOCTL.handle
341
handle     equ  IOCTL.handle
371
io_code    equ  IOCTL.io_code
342
io_code    equ  IOCTL.io_code
372
input      equ  IOCTL.input
343
input      equ  IOCTL.input
373
inp_size   equ  IOCTL.inp_size
344
inp_size   equ  IOCTL.inp_size
Line 404... Line 375...
404
	   ret
375
           ret
405
@@:
376
@@:
406
	   cmp eax, DEV_SET_MASTERVOL
377
           cmp eax, DEV_SET_MASTERVOL
407
	   jne @F
378
           jne @F
408
           mov ebx, [edi+input]
379
           mov eax, [edi+input]
409
           stdcall set_master_vol, [ebx]
380
           mov eax, [eax]
-
 
381
           call set_master_vol      ;eax= vol
410
	   ret
382
           ret
411
@@:
383
@@:
412
	   cmp eax, DEV_GET_MASTERVOL
384
           cmp eax, DEV_GET_MASTERVOL
413
	   jne @F
385
           jne @F
414
           mov ebx, [edi+output]
386
           mov ebx, [edi+output]
415
           test ebx, ebx
387
           add ebx, new_app_base
416
           jz .fail
388
           stdcall get_master_vol, ebx
417
 
-
 
418
           stdcall get_master_vol, ebx
-
 
419
	   ret
389
           ret
420
@@:
390
;@@:
421
	   cmp eax, DEV_GET_INFO
391
;           cmp eax, DEV_GET_INFO
422
	   jne @F
392
;           jne @F
423
           mov ebx, [edi+output]
393
;           mov ebx, [edi+output]
424
	   stdcall get_dev_info, ebx
394
;           stdcall get_dev_info, ebx
425
	   ret
395
;           ret
426
@@:
396
@@:
427
.fail:
397
.fail:
428
	   xor eax, eax
398
           or eax, -1
429
	   ret
399
           ret
430
endp
400
endp
431
 
401
 
Line 432... Line 402...
432
restore   handle
402
restore   handle
433
restore   io_code
403
restore   io_code
Line 437... Line 407...
437
restore   out_size
407
restore   out_size
438
 
408
 
Line 439... Line 409...
439
 
409
 
440
align 4
-
 
441
proc remap_irq                         ;for Intel chipsets ONLY !!!
-
 
442
	   mov eax, VALID_IRQ
-
 
443
	   bt eax, IRQ_LINE
-
 
444
	   jnc .exit
-
 
445
 
-
 
446
	   mov edx, 0x4D0
-
 
447
	   in ax,dx
-
 
448
	   bts ax, IRQ_LINE
-
 
449
	   out dx, aX
-
 
450
 
-
 
451
           stdcall PciWrite8, dword 0, dword 0xF8, dword 0x61, dword IRQ_LINE
-
 
452
	   mov [ctrl.int_line], IRQ_LINE
-
 
453
 
-
 
454
.exit:
-
 
455
	   ret
-
 
456
endp
-
 
457
 
-
 
458
align 4
410
align 4
Line 459... Line 411...
459
proc ac97_irq
411
proc ac97_irq
460
 
412
 
461
;     if DEBUG
413
;     if DEBUG
462
;           mov esi, msgIRQ
414
;           mov esi, msgIRQ
Line 463... Line -...
463
;           call SysMsgBoardStr
-
 
464
;     end if
-
 
465
 
-
 
466
	   mov edx, PCM_OUT_CR_REG
-
 
467
	   mov al, 0x14
-
 
468
	   call [ctrl.ctrl_write8]
-
 
469
 
-
 
470
	   mov ax, 0x1c
-
 
471
	   mov edx, PCM_OUT_SR_REG
-
 
472
	   call [ctrl.ctrl_write16]
-
 
473
 
-
 
474
	   mov edx, PCM_OUT_CIV_REG
-
 
475
	   call [ctrl.ctrl_read8]
-
 
476
 
-
 
477
	   and eax, 0x1F
-
 
478
	   cmp eax, [civ_val]
-
 
479
	   je .skip
-
 
480
 
-
 
481
	   mov [civ_val], eax
-
 
482
	   dec eax
-
 
483
	   and eax, 0x1F
-
 
484
	   mov [ctrl.lvi_reg], eax
-
 
485
 
-
 
486
	   mov edx, PCM_OUT_LVI_REG
-
 
487
	   call [ctrl.ctrl_write8]
-
 
488
 
-
 
489
	   mov edx, PCM_OUT_CR_REG
-
 
490
	   mov ax, 0x1D
-
 
491
	   call [ctrl.ctrl_write8]
-
 
492
 
-
 
493
	   mov eax, [civ_val]
-
 
Line 494... Line 415...
494
	   add eax, 2
415
;           call SysMsgBoardStr
495
	   and eax, 31
416
;     end if
Line 496... Line 417...
496
	   mov ebx, dword [buff_list+eax*4]
417
 
497
 
418
 
498
	   cmp [ctrl.user_callback], 0
419
           cmp [ctrl.user_callback], 0
Line 499... Line 420...
499
	   je @f
420
           je @f
500
 
421
 
501
	   stdcall [ctrl.user_callback], ebx
422
           stdcall [ctrl.user_callback], ebx
502
@@:
423
@@:
503
	   ret
424
           ret
504
 
425
 
Line 505... Line 426...
505
.skip:
426
.skip:
Line 520... Line 441...
520
	   xor eax, eax
441
           xor eax, eax
521
           cld
442
           cld
522
	   rep stosd
443
           rep stosd
523
 
444
 
Line 524... Line 445...
524
           stdcall GetPgAddr, [ctrl.buffer]
445
           mov eax, [ctrl.buffer]
-
 
446
           call GetPgAddr
Line 525... Line 447...
525
 
447
 
526
	   mov ebx, 0xC0002000
448
           mov ebx, 0xC0002000
527
	   mov ecx, 4
449
           mov ecx, 4
528
	   mov edi, pcmout_bdl
450
           mov edi, pcmout_bdl
Line 571... Line 493...
571
	   add eax, 0x4000
493
           add eax, 0x4000
572
	   add edi, 4
494
           add edi, 4
573
	   loop @B
495
           loop @B
Line 574... Line 496...
574
 
496
 
-
 
497
           mov eax, pcmout_bdl
575
	   mov ecx, pcmout_bdl
498
           mov ebx, eax
576
           stdcall GetPgAddr, ecx
499
           call GetPgAddr     ;eax
577
	   and ecx, 0xFFF
500
           and ebx, 0xFFF
Line 578... Line 501...
578
	   add eax, ecx
501
           add eax, ebx
579
 
502
 
Line 580... Line 503...
580
	   mov edx, PCM_OUT_BDL
503
           mov edx, PCM_OUT_BDL
581
	   call [ctrl.ctrl_write32]
504
           call [ctrl.ctrl_write32]
582
 
505
 
583
	   mov eax, 16
506
           mov eax, 16
584
	   mov [ctrl.lvi_reg], eax
-
 
585
	   mov edx, PCM_OUT_LVI_REG
507
           mov [ctrl.lvi_reg], eax
586
	   call [ctrl.ctrl_write8]
508
           mov edx, PCM_OUT_LVI_REG
Line 587... Line 509...
587
 
509
           call [ctrl.ctrl_write8]
588
	   ret
510
           ret
Line 600... Line 522...
600
	   mov [bus], eax
522
           mov [bus], eax
601
	   inc eax
523
           inc eax
602
           call PciApi
524
           call PciApi
603
	   cmp eax, -1
525
           cmp eax, -1
604
           je .no_pci
526
           je .err
605
 
527
 
Line 606... Line 528...
606
	   mov [last_bus], eax
528
           mov [last_bus], eax
Line 607... Line 529...
607
 
529
 
608
.next_bus:
530
.next_bus:
Line 624... Line 546...
624
	   je .found
546
           je .found
625
	   add edi, 12
547
           add edi, 12
626
	   jmp @B
548
           jmp @B
627
 
549
 
Line -... Line 550...
-
 
550
.next:
628
.next:	   inc [devfn]
551
           inc [devfn]
629
	   cmp [devfn], 256
552
           cmp [devfn], 256
630
	   jb  .next_dev
553
           jb  .next_dev
631
	   mov eax, [bus]
554
           mov eax, [bus]
632
	   inc eax
555
           inc eax
633
	   mov [bus], eax
556
           mov [bus], eax
Line 652... Line 575...
652
	   mov [ctrl.ctrl_ids], ebx
575
           mov [ctrl.ctrl_ids], ebx
653
	   mov esi, [edi+8]
576
           mov esi, [edi+8]
654
	   mov [ctrl.ctrl_setup], esi
577
           mov [ctrl.ctrl_setup], esi
655
 
578
 
Line 656... Line -...
656
           cmp ebx, VID_INTEL
-
 
657
           jne @F
-
 
658
	   mov [ctrl.vendor_ids], msg_Intel
-
 
659
           ret
-
 
660
@@:
-
 
661
           cmp ebx, VID_NVIDIA
-
 
662
           jne @F
-
 
663
           mov [ctrl.vendor_ids], msg_NVidia
-
 
664
@@:
-
 
665
           cmp ebx, 0x1274
579
           cmp ebx, 0x1274
666
           jne @F
580
           jne @F
667
           mov [ctrl.vendor_ids], msgEnsoniq
581
           mov [ctrl.vendor_ids], msgEnsoniq
668
           ret
582
           ret
669
@@:
583
@@:
670
           mov [ctrl.vendor_ids], 0     ;something  wrong ?
584
           mov [ctrl.vendor_ids], 0     ;something  wrong ?
671
	   ret
585
           ret
672
.no_pci:
-
 
673
           mov esi, msgPCI
-
 
674
           call SysMsgBoardStr
-
 
675
.err:
586
.err:
676
	   xor eax, eax
587
           xor eax, eax
677
	   ret
588
           ret
678
endp
589
endp
Line 679... Line 590...
679
 
590
 
680
align 4
-
 
681
proc get_LPC_bus                ;for Intel chipsets ONLY !!!
-
 
682
	   locals
-
 
683
	     last_bus dd ?
-
 
684
	     bus      dd ?
-
 
685
	   endl
-
 
686
 
-
 
687
	   xor eax, eax
-
 
688
	   mov [bus], eax
-
 
689
	   inc eax
-
 
690
	   call [PciApi]
-
 
691
	   cmp eax, -1
-
 
692
	   je .err
-
 
693
 
-
 
694
	   mov [last_bus], eax
-
 
695
.next_bus:
-
 
696
           stdcall PciRead32, [bus], dword 0xF8, dword 0
-
 
697
	   test eax, eax
-
 
698
	   jz .next
-
 
699
	   cmp eax, -1
-
 
700
	   je .next
-
 
701
 
-
 
702
	   cmp eax, 0x24D08086
-
 
703
	   je .found
-
 
704
.next:
-
 
705
	   mov eax, [bus]
-
 
706
	   inc eax
-
 
707
	   cmp eax, [last_bus]
-
 
708
	   mov [bus], eax
-
 
709
	   jna .next_bus
-
 
710
.err:
-
 
711
	   xor eax, eax
-
 
712
	   dec eax
-
 
713
	   ret
-
 
714
.found:
-
 
715
	   mov eax, [bus]
-
 
716
	   ret
-
 
717
endp
-
 
718
 
-
 
719
align 4
591
align 4
Line -... Line 592...
-
 
592
proc init_controller
-
 
593
 
-
 
594
           mov esi, msgPCIcmd
720
proc init_controller
595
           call SysMsgBoardStr
721
 
596
 
722
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 4
597
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 4
723
	   mov ebx, eax
598
           mov ebx, eax
724
	   and eax, 0xFFFF
599
           and eax, 0xFFFF
725
	   mov [ctrl.pci_cmd], eax
600
           mov [ctrl.pci_cmd], eax
Line -... Line 601...
-
 
601
           shr ebx, 16
-
 
602
           mov [ctrl.pci_stat], ebx
-
 
603
 
-
 
604
           call dword2str
-
 
605
           call SysMsgBoardStr
-
 
606
 
726
	   shr ebx, 16
607
           mov esi, msgIObase
727
	   mov [ctrl.pci_stat], ebx
608
           call SysMsgBoardStr
728
 
609
 
Line 729... Line -...
729
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x10
-
 
730
	   and eax,0xFFFE
610
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x10
731
	   mov [ctrl.codec_io_base], eax
611
           and eax,0xFFFE
732
 
-
 
733
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x14
-
 
734
	   and eax, 0xFFC0
-
 
Line 735... Line 612...
735
	   mov [ctrl.ctrl_io_base], eax
612
           mov [ctrl.codec_io_base], eax
736
 
613
 
Line 737... Line 614...
737
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x18
614
           call dword2str
738
	   mov [ctrl.codec_mem_base], eax
615
           call SysMsgBoardStr
739
 
616
 
Line 740... Line -...
740
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x1C
-
 
741
	   mov [ctrl.ctrl_mem_base], eax
617
           mov esi, msgIntline
742
 
618
           call SysMsgBoardStr
Line 743... Line 619...
743
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x3C
619
 
744
	   and eax, 0xFF
620
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x3C
745
	   mov [ctrl.int_line], eax
621
           and eax, 0xFF
746
 
622
           mov [ctrl.int_line], eax
Line 771... Line 647...
771
 
647
 
Line 772... Line 648...
772
PG_SW                equ 0x003
648
PG_SW                equ 0x003
773
PG_NOCACHE           equ 0x018
649
PG_NOCACHE           equ 0x018
Line 774... Line -...
774
 
-
 
775
align 4
-
 
776
proc set_ICH4
-
 
777
           stdcall AllocKernelSpace, dword 0x2000
-
 
778
	   mov edi, eax
-
 
779
           stdcall MapPage, edi,[ctrl.codec_mem_base],PG_SW+PG_NOCACHE
-
 
780
	   mov [ctrl.codec_mem_base], edi
-
 
781
	   add edi, 0x1000
-
 
782
           stdcall MapPage, edi, [ctrl.ctrl_mem_base],PG_SW+PG_NOCACHE
-
 
783
	   mov [ctrl.ctrl_mem_base], edi
-
 
784
 
-
 
785
	   mov [ctrl.codec_read16],  codec_mem_r16    ;virtual
-
 
786
	   mov [ctrl.codec_write16], codec_mem_w16    ;virtual
-
 
787
 
-
 
788
	   mov [ctrl.ctrl_read8 ],  ctrl_mem_r8       ;virtual
-
 
789
	   mov [ctrl.ctrl_read16],  ctrl_mem_r16      ;virtual
-
 
790
	   mov [ctrl.ctrl_read32],  ctrl_mem_r32      ;virtual
-
 
791
 
-
 
792
	   mov [ctrl.ctrl_write8 ], ctrl_mem_w8       ;virtual
-
 
793
	   mov [ctrl.ctrl_write16], ctrl_mem_w16      ;virtual
-
 
794
	   mov [ctrl.ctrl_write32], ctrl_mem_w32      ;virtual
-
 
795
	   ret
-
 
Line 796... Line 650...
796
endp
650
 
797
 
651
 
Line 798... Line 652...
798
align 4
652
align 4
Line 816... Line 670...
816
	   call [ctrl.ctrl_write8]
670
	   call [ctrl.ctrl_write8]
817
 
671
 
Line 818... Line 672...
818
	   mov	edx, MC_IN_CR_REG
672
	   mov	edx, MC_IN_CR_REG
819
	   call [ctrl.ctrl_write8]
673
	   call [ctrl.ctrl_write8]
820
 
-
 
821
	   ret
674
	   ret
822
endp
675
endp
Line 823... Line 676...
823
 
676
 
824
align 4
677
align 4
825
proc init_codec
678
proc init_codec
826
	   locals
679
	   locals
827
	     counter dd ?
680
	     counter dd ?
Line -... Line 681...
-
 
681
	   endl
-
 
682
 
-
 
683
           mov esi, msgControl
-
 
684
           call SysMsgBoardStr
-
 
685
 
-
 
686
           mov edx, GLOB_CTRL
-
 
687
           call [ctrl.ctrl_read32]
-
 
688
           call dword2str
-
 
689
           call SysMsgBoardStr
-
 
690
 
-
 
691
           mov esi, msgStatus
-
 
692
           call SysMsgBoardStr
-
 
693
 
-
 
694
           mov edx, CTRL_STAT
-
 
695
           call [ctrl.ctrl_read32]
-
 
696
 
-
 
697
           call dword2str
-
 
698
           call SysMsgBoardStr
-
 
699
 
-
 
700
           test eax, CTRL_ST_CREADY
828
	   endl
701
           jnz .ready
829
 
702
 
830
	   call reset_codec
703
	   call reset_codec
Line 831... Line 704...
831
	   and eax, eax
704
	   and eax, eax
Line 990... Line 863...
990
	   ret
863
	   ret
991
endp
864
endp
992
 
865
 
Line 993... Line 866...
993
align 4
866
align 4
994
proc play
867
play:
995
 
-
 
996
	   mov eax, 16
868
	   mov eax, 16
997
	   mov [ctrl.lvi_reg], eax
869
	   mov [ctrl.lvi_reg], eax
998
	   mov edx, PCM_OUT_LVI_REG
870
	   mov edx, PCM_OUT_LVI_REG
999
	   call [ctrl.ctrl_write8]
871
	   call [ctrl.ctrl_write8]
Line 1000... Line 872...
1000
 
872
 
1001
	   mov edx, PCM_OUT_CR_REG
873
	   mov edx, PCM_OUT_CR_REG
1002
	   mov ax, 0x1D
874
	   mov ax, 0x1D
-
 
875
	   call [ctrl.ctrl_write8]
1003
	   call [ctrl.ctrl_write8]
876
           xor eax, eax
1004
	   ret
-
 
Line 1005... Line 877...
1005
endp
877
	   ret
1006
 
878
 
1007
align 4
879
align 4
1008
proc stop
880
stop:
1009
	   mov edx, PCM_OUT_CR_REG
-
 
1010
	   mov ax, 0x14
-
 
1011
	   call [ctrl.ctrl_write8]
-
 
1012
 
-
 
1013
	   mov eax, 16
-
 
1014
	   mov [ctrl.lvi_reg], eax
881
	   mov edx, PCM_OUT_CR_REG
Line -... Line 882...
-
 
882
           mov ax, 0x0
-
 
883
	   call [ctrl.ctrl_write8]
-
 
884
 
-
 
885
           mov ax, 0x1c
1015
	   mov edx, PCM_OUT_LVI_REG
886
           mov edx, PCM_OUT_SR_REG
1016
	   call [ctrl.ctrl_write8]
-
 
Line 1017... Line 887...
1017
 
887
           call [ctrl.ctrl_write16]
1018
	   ret
888
           xor eax, eax
1019
endp
889
	   ret
1020
 
890
 
Line 1049... Line 919...
1049
	   mov [CTRL_INFO.glob_sta], eax
919
	   mov [CTRL_INFO.glob_sta], eax
1050
 
920
 
Line 1051... Line 921...
1051
	   mov ebx, [ctrl.pci_cmd]
921
	   mov ebx, [ctrl.pci_cmd]
1052
	   mov [CTRL_INFO.pci_cmd], ebx
922
	   mov [CTRL_INFO.pci_cmd], ebx
1053
 
-
 
1054
	   ret
923
	   ret
1055
endp
924
endp
Line 1056... Line 925...
1056
 
925
 
1057
align 4
926
align 4
Line 1125... Line 994...
1125
 
994
 
Line 1126... Line 995...
1126
	  xor eax, wax
995
	  xor eax, wax
1127
	  inc eax
996
	  inc eax
1128
	  ret
997
	  ret
1129
 
-
 
1130
align 4
-
 
1131
.not_ready:
998
.not_ready:
1132
	  xor eax, eax
999
	  xor eax, eax
1133
	  ret
1000
	  ret
1134
endp
1001
endp
Line 1174... Line 1041...
1174
@@:
1041
@@:
1175
	   rdtsc
1042
	   rdtsc
1176
	   sub eax, ebx
1043
	   sub eax, ebx
1177
	   sbb edx, ecx
1044
	   sbb edx, ecx
1178
	   jb @B
1045
           js @B
1179
 
1046
 
Line 1180... Line 1047...
1180
	   pop eax
1047
	   pop eax
1181
	   pop ebx
1048
	   pop ebx
1182
	   pop edx
1049
	   pop edx
1183
	   pop ecx
1050
	   pop ecx
Line 1243... Line 1110...
1243
	out dx, eax
1110
           out dx, eax
1244
	ret
1111
           ret
1245
endp
1112
endp
1246
 
1113
 
Line 1247... Line -...
1247
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
1248
;         MEMORY MAPPED IO    (os depended)
-
 
1249
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
Line 1250... Line 1114...
1250
 
1114
 
1251
align 4
-
 
1252
proc codec_mem_r16
-
 
1253
	add edx, [ctrl.codec_mem_base]
-
 
1254
	mov ax, word [edx]
1115
align 4
1255
	ret
-
 
1256
endp
-
 
1257
 
-
 
1258
align 4
1116
dword2str:
1259
proc codec_mem_w16
-
 
1260
	add edx, [ctrl.codec_mem_base]
1117
      mov  esi, hex_buff
1261
	mov word [edx], ax
-
 
1262
	ret
-
 
1263
endp
-
 
1264
 
-
 
1265
align 4
-
 
1266
proc ctrl_mem_r8
-
 
1267
	add edx, [ctrl.ctrl_mem_base]
-
 
1268
	mov al, [edx]
-
 
1269
	ret
1118
      mov ecx, -8
1270
endp
-
 
1271
 
-
 
1272
align 4
1119
@@:
1273
proc ctrl_mem_r16
-
 
1274
	add edx, [ctrl.ctrl_mem_base]
1120
      rol eax, 4
1275
	mov ax, [edx]
-
 
1276
	ret
-
 
1277
endp
-
 
1278
 
-
 
1279
align 4
-
 
1280
proc ctrl_mem_r32
-
 
1281
	add edx, [ctrl.ctrl_mem_base]
1121
      mov ebx, eax
1282
	mov eax, [edx]
-
 
1283
	ret
-
 
1284
endp
-
 
1285
 
-
 
1286
align 4
-
 
1287
proc ctrl_mem_w8
1122
      and ebx, 0x0F
1288
	add edx, [ctrl.ctrl_mem_base]
1123
      mov bl, [ebx+hexletters]
1289
	mov [edx], al
-
 
1290
 
-
 
1291
	ret
-
 
1292
endp
-
 
1293
 
-
 
1294
align 4
1124
      mov [8+esi+ecx], bl
1295
proc ctrl_mem_w16
-
 
1296
	add edx, [ctrl.ctrl_mem_base]
1125
      inc ecx
1297
	mov [edx], ax
1126
      jnz @B
1298
	ret
-
 
Line 1299... Line -...
1299
endp
-
 
1300
 
1127
      ret
1301
align 4
1128
 
1302
proc ctrl_mem_w32
-
 
1303
	add edx, [ctrl.ctrl_mem_base]
-
 
1304
	mov [edx], eax
-
 
Line 1305... Line 1129...
1305
	ret
1129
hexletters   db '0123456789ABCDEF'
Line 1306... Line 1130...
1306
endp
1130
hex_buff     db 8 dup(0),13,10,0
1307
 
1131
 
1308
 
-
 
1309
include "codec.inc"
-
 
1310
 
-
 
1311
align 4
-
 
1312
devices dd (CTRL_ICH  shl 16)+VID_INTEL,msg_ICH, set_ICH
-
 
1313
	dd (CTRL_ICH0 shl 16)+VID_INTEL,msg_ICH0,set_ICH
-
 
1314
	dd (CTRL_ICH2 shl 16)+VID_INTEL,msg_ICH2,set_ICH
-
 
1315
	dd (CTRL_ICH3 shl 16)+VID_INTEL,msg_ICH3,set_ICH
-
 
1316
        dd (CTRL_ICH4 shl 16)+VID_INTEL,msg_ICH4,set_ICH4
-
 
1317
        dd (CTRL_ICH5 shl 16)+VID_INTEL,msg_ICH5,set_ICH4
-
 
1318
        dd (CTRL_ICH6 shl 16)+VID_INTEL,msg_ICH6,set_ICH4
-
 
1319
        dd (CTRL_ICH7 shl 16)+VID_INTEL,msg_ICH7,set_ICH4
1132
 
1320
 
-
 
1321
        dd (CTRL_NFORCE  shl 16)+VID_NVIDIA,msg_NForce, set_ICH
1133
include "codec.inc"
Line 1322... Line -...
1322
        dd (CTRL_NFORCE2 shl 16)+VID_NVIDIA,msg_NForce2,set_ICH
-
 
1323
        dd (CTRL_NFORCE3 shl 16)+VID_NVIDIA,msg_NForce3,set_ICH
-
 
1324
        dd (0x5000 shl 16)+0x1274,msgEnsoniq,set_ICH
-
 
1325
 
-
 
1326
        dd 0    ;terminator
-
 
1327
 
-
 
1328
msg_ICH      db 'Intel ICH',  13,10, 0
-
 
1329
msg_ICH0     db 'Intel ICH0', 13,10, 0
-
 
1330
msg_ICH2     db 'Intel ICH2', 13,10, 0
-
 
1331
msg_ICH3     db 'Intel ICH3', 13,10, 0
-
 
1332
msg_ICH4     db 'Intel ICH4', 13,10, 0
-
 
1333
msg_ICH5     db 'Intel ICH5', 13,10, 0
-
 
1334
msg_ICH6     db 'Intel ICH6', 13,10, 0
-
 
1335
msg_ICH7     db 'Intel ICH7', 13,10, 0
1134
 
Line 1336... Line 1135...
1336
msg_Intel    db 'Intel Corp. ', 0
1135
align 4
-
 
1136
devices      dd (0x5000 shl 16)+0x1274,msgEnsoniq,set_ICH
Line 1337... Line -...
1337
 
-
 
1338
msg_NForce   db 'NForce',   13,10, 0
1137
             dd (0x5880 shl 16)+0x1274,msgVibra128,set_ICH
Line 1339... Line 1138...
1339
msg_NForce2  db 'NForce 2', 13,10, 0
1138
             dd 0    ;terminator
1340
msg_NForce3  db 'NForce 3', 13,10, 0
-
 
1341
msg_NVidia   db 'NVidea', 0
1139
 
1342
 
1140
version      dd 0x00040000
1343
msgEnsoniq   db 'Ensonic 1371',0
1141
 
1344
 
1142
msgEnsoniq   db 'Ensonic 1371',0
1345
szKernel	    db 'KERNEL', 0
1143
msgVibra128  db 'Sound Blaster AudioPCI Vibra 128',0
Line 1364... Line 1162...
1364
msgWRFail    db 'warm reset failed',13,10,0
1162
msgWRFail    db 'warm reset failed',13,10,0
1365
msgCRFail    db 'cold reset failed',13,10,0
1163
msgCRFail    db 'cold reset failed',13,10,0
1366
msgCFail     db 'codec not ready',13,10,0
1164
msgCFail     db 'codec not ready',13,10,0
1367
msgResetOk   db 'reset complete',13,10,0
1165
msgResetOk   db 'reset complete',13,10,0
1368
 
1166
msgStatus    db 'global status   ',0
-
 
1167
msgControl   db 'global control  ',0
-
 
1168
msgPCIcmd    db 'PCI command     ',0
-
 
1169
msgIObase    db 'IO base         ',0
-
 
1170
msgIntline   db 'Interrupt line  ',0
-
 
1171
 
Line 1369... Line 1172...
1369
section '.data' data readable writable align 16
1172
section '.data' data readable writable align 16
Line 1370... Line 1173...
1370
 
1173
 
1371
pcmout_bdl       rq 32
1174
pcmout_bdl       rq 32