Subversion Repositories Kolibri OS

Rev

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

Rev 1635 Rev 2010
Line 136... Line 136...
136
DEV_SET_BUFF	      equ  4
136
DEV_SET_BUFF	      equ  4
137
DEV_NOTIFY	      equ  5
137
DEV_NOTIFY	      equ  5
138
DEV_SET_MASTERVOL     equ  6
138
DEV_SET_MASTERVOL     equ  6
139
DEV_GET_MASTERVOL     equ  7
139
DEV_GET_MASTERVOL     equ  7
140
DEV_GET_INFO	      equ  8
140
DEV_GET_INFO	      equ  8
-
 
141
DEV_GET_POS           equ  9
Line 141... Line 142...
141
 
142
 
142
struc AC_CNTRL		    ;AC controller base class
143
struc AC_CNTRL		    ;AC controller base class
143
{ .bus		      dd ?
144
{ .bus		      dd ?
Line 331... Line 332...
331
	   call SysMsgBoardStr
332
	   call SysMsgBoardStr
332
	   call create_primary_buff
333
	   call create_primary_buff
333
	   mov esi, msgDone
334
	   mov esi, msgDone
334
	   call SysMsgBoardStr
335
	   call SysMsgBoardStr
Line 335... Line -...
335
 
-
 
336
  if IRQ_REMAP
-
 
337
	   pushf
-
 
338
	   cli
-
 
339
 
-
 
340
	   mov ebx, [ctrl.int_line]
-
 
341
	   in al, 0xA1
-
 
342
	   mov ah, al
-
 
343
	   in al, 0x21
-
 
344
	   test ebx, ebx
-
 
345
	   jz .skip
-
 
346
	   bts ax, bx			   ;mask old line
-
 
347
.skip
-
 
348
	   bts ax, IRQ_LINE		   ;mask new ine
-
 
349
	   out 0x21, al
-
 
350
	   mov al, ah
-
 
351
	   out 0xA1, al
-
 
352
					   ;remap IRQ
-
 
353
	   stdcall PciWrite8, 0, 0xF8, 0x61, IRQ_LINE
-
 
354
 
-
 
355
	   mov dx, 0x4d0		   ;8259 ELCR1
-
 
356
	   in al, dx
-
 
357
	   bts ax, IRQ_LINE
-
 
358
	   out dx, al			   ;set level-triggered mode
-
 
359
	   mov [ctrl.int_line], IRQ_LINE
-
 
360
	   popf
-
 
361
	   mov esi, msgRemap
-
 
362
	   call SysMsgBoardStr
-
 
363
  end if
-
 
364
 
-
 
365
	   mov eax, VALID_IRQ
-
 
366
	   mov ebx, [ctrl.int_line]
-
 
367
	   mov esi, msgInvIRQ
-
 
368
	   bt eax, ebx
-
 
369
	   jnc .fail_msg
-
 
370
	   mov eax, ATTCH_IRQ
-
 
371
	   mov esi, msgAttchIRQ
-
 
372
	   bt eax, ebx
-
 
373
	   jnc .fail_msg
-
 
374
 
336
 
375
	   stdcall AttachIntHandler, ebx, ac97_irq, dword 0
337
	   stdcall AttachIntHandler, 17, ac97_irq, dword 0
376
.reg:
338
.reg:
377
	   stdcall RegService, sz_sound_srv, service_proc
339
	   stdcall RegService, sz_sound_srv, service_proc
378
	   ret
340
	   ret
379
.fail:
341
.fail:
Line 451... Line 413...
451
	   cmp eax, DEV_GET_MASTERVOL
413
	   cmp eax, DEV_GET_MASTERVOL
452
	   jne @F
414
	   jne @F
453
	   mov ebx, [edi+output]
415
	   mov ebx, [edi+output]
454
	   stdcall get_master_vol, ebx
416
	   stdcall get_master_vol, ebx
455
	   ret
417
	   ret
-
 
418
 
-
 
419
@@:
-
 
420
           cmp eax, DEV_GET_POS
-
 
421
           jne @F
-
 
422
 
-
 
423
           mov ebx, 8192
-
 
424
           mov edx, 0x18
-
 
425
           xor eax, eax
-
 
426
           call [ctrl.ctrl_read16]
-
 
427
           sub ebx, eax
-
 
428
           shr ebx, 1
-
 
429
           mov edx, [edi+output]
-
 
430
           mov [edx], ebx
-
 
431
           xor eax, eax
-
 
432
           ret
456
;@@:
433
;@@:
457
;           cmp eax, DEV_GET_INFO
434
;           cmp eax, DEV_GET_INFO
458
;           jne @F
435
;           jne @F
459
;           mov ebx, [edi+output]
436
;           mov ebx, [edi+output]
460
;           stdcall get_dev_info, ebx
437
;           stdcall get_dev_info, ebx
Line 478... Line 455...
478
     if DEBUG_IRQ
455
     if DEBUG_IRQ
479
	   mov esi, msgIRQ
456
	   mov esi, msgIRQ
480
	   call SysMsgBoardStr
457
	   call SysMsgBoardStr
481
     end if
458
     end if
Line -... Line 459...
-
 
459
 
-
 
460
           mov edx, CTRL_STAT
-
 
461
           call [ctrl.ctrl_read32]
-
 
462
 
-
 
463
           push eax
-
 
464
 
-
 
465
           test eax, 0x40
-
 
466
           jnz .do_intr
-
 
467
 
-
 
468
           test eax, eax
-
 
469
           jz .done
-
 
470
 
-
 
471
           mov edx, CTRL_STAT
-
 
472
           call [ctrl.ctrl_write32]
-
 
473
           jmp .done
-
 
474
 
482
 
475
.do_intr:
483
	   mov edx, PCM_OUT_CR_REG
476
	   mov edx, PCM_OUT_CR_REG
484
	   mov al, 0x10;               0x10
477
	   mov al, 0x10;               0x10
Line 485... Line 478...
485
	   call [ctrl.ctrl_write8]
478
	   call [ctrl.ctrl_write8]
Line 511... Line 504...
511
	   add eax, 1
504
	   add eax, 1
512
	   and eax, 31
505
	   and eax, 31
513
	   mov ebx, dword [buff_list+eax*4]
506
	   mov ebx, dword [buff_list+eax*4]
Line 514... Line 507...
514
 
507
 
515
	   cmp [ctrl.user_callback], 0
508
           cmp [ctrl.user_callback], 0
Line 516... Line 509...
516
	   je @f
509
           je .done
517
 
510
 
-
 
511
           stdcall [ctrl.user_callback], ebx
-
 
512
.done:
-
 
513
           pop eax
-
 
514
           and eax, 0x40
518
	   stdcall [ctrl.user_callback], ebx
515
           mov edx, CTRL_STAT
519
@@:
-
 
520
	   ret
516
           call [ctrl.ctrl_write32]
521
 
517
	   ret
522
.skip:
518
.skip:
523
	   mov edx, PCM_OUT_CR_REG
519
	   mov edx, PCM_OUT_CR_REG
524
	   mov ax, 0x11 	      ;0x1D
520
	   mov ax, 0x11 	      ;0x1D
-
 
521
	   call [ctrl.ctrl_write8]
525
	   call [ctrl.ctrl_write8]
522
           jmp .done
Line 526... Line 523...
526
	   ret
523
 
527
endp
524
endp
Line 774... Line 771...
774
 
771
 
775
	   stdcall PciRead8, [ctrl.bus], [ctrl.devfn], dword 0x41
772
	   stdcall PciRead8, [ctrl.bus], [ctrl.devfn], dword 0x41
776
	   and eax, 0xFF
773
	   and eax, 0xFF
Line -... Line 774...
-
 
774
	   mov [ctrl.cfg_reg], eax
-
 
775
 
777
	   mov [ctrl.cfg_reg], eax
776
           mov [ctrl.user_callback], 0
778
 
777
 
779
	   call [ctrl.ctrl_setup]
778
	   call [ctrl.ctrl_setup]
780
	   xor eax, eax
779
	   xor eax, eax
781
	   inc eax
780
	   inc eax