Subversion Repositories Kolibri OS

Rev

Rev 465 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
431 serge 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
351 diamond 7
 
8
format MS COFF
9
 
10
 
11
include 'proc32.inc'
12
include 'imports.inc'
13
 
465 serge 14
API_VERSION     equ 0x01000100
15
 
351 diamond 16
DEBUG	    equ 1
17
 
18
REMAP_IRQ   equ 0
562 serge 19
IRQ_LINE    equ 0
351 diamond 20
 
21
;irq 0,1,2,8,12,13 недоступны
22
;               FEDCBA9876543210
23
VALID_IRQ   equ 1100111011111000b
24
ATTCH_IRQ   equ 0000111010101000b
25
 
26
 
27
CPU_FREQ    equ  2600d
28
 
29
BIT0  EQU 0x00000001
30
BIT1  EQU 0x00000002
31
BIT2  EQU 0x00000004
32
BIT3  EQU 0x00000008
33
BIT4  EQU 0x00000010
34
BIT5  EQU 0x00000020
35
BIT6  EQU 0x00000040
36
BIT7  EQU 0x00000080
37
BIT8  EQU 0x00000100
38
BIT9  EQU 0x00000200
39
BIT10 EQU 0x00000400
40
BIT11 EQU 0x00000800
41
BIT12 EQU 0x00001000
42
BIT13 EQU 0x00002000
43
BIT14 EQU 0x00004000
44
BIT15 EQU 0x00008000
45
BIT16 EQU 0x00010000
46
BIT17 EQU 0x00020000
47
BIT18 EQU 0x00040000
48
BIT19 EQU 0x00080000
49
BIT20 EQU 0x00100000
50
BIT21 EQU 0x00200000
51
BIT22 EQU 0x00400000
52
BIT23 EQU 0x00800000
53
BIT24 EQU 0x00100000
54
BIT25 EQU 0x02000000
55
BIT26 EQU 0x04000000
56
BIT27 EQU 0x08000000
57
BIT28 EQU 0x10000000
58
BIT29 EQU 0x20000000
59
BIT30 EQU 0x40000000
60
BIT31 EQU 0x80000000
61
 
465 serge 62
PCM_4 equ BIT20
63
PCM_6 equ BIT21
64
 
562 serge 65
VID_INTEL         equ 0x8086
66
VID_NVIDIA        equ 0x10DE
351 diamond 67
 
562 serge 68
CTRL_ICH          equ 0x2415
69
CTRL_ICH0         equ 0x2425
70
CTRL_ICH2         equ 0x2435
71
CTRL_ICH3         equ 0x2445
72
CTRL_ICH4         equ 0x24C5
73
CTRL_ICH5         equ 0x24D5
74
CTRL_ICH6         equ 0x266E
75
CTRL_ICH7         equ 0x27DE
351 diamond 76
 
562 serge 77
CTRL_NFORCE       equ 0x01B1
78
CTRL_NFORCE2      equ 0x006A
79
CTRL_NFORCE3      equ 0x00DA
80
CTRL_MCP04        equ 0x003A
81
CTRL_CK804        equ 0x0059
82
CTRL_CK8          equ 0x008A
83
CTRL_CK8S         equ 0x00EA
84
CTRL_MCP51        equ 0x026B
351 diamond 85
 
86
 
562 serge 87
PCM_OUT_BDL       equ  0x10  ; PCM out buffer descriptors list
88
PCM_OUT_CR_REG    equ  0x1b  ; PCM out Control Register
89
PCM_OUT_LVI_REG   equ  0x15  ; PCM last valid index
90
PCM_OUT_SR_REG    equ  0x16  ; PCM out Status register
91
PCM_OUT_PIV_REG   equ  0x1a
92
PCM_OUT_CIV_REG   equ  0x14  ; PCM out current index
351 diamond 93
 
562 serge 94
PCM_IN_CR_REG     equ  0x0b  ; PCM in Control Register
95
MC_IN_CR_REG      equ  0x2b  ; MIC in Control Register
96
RR                equ  BIT1  ; reset registers.  Nukes all regs
351 diamond 97
 
465 serge 98
CODEC_MASTER_VOL_REG         equ 0x02
99
CODEC_AUX_VOL                equ 0x04 ;
100
CODEC_PCM_OUT_REG            equ 0x18 ; PCM output volume
101
CODEC_EXT_AUDIO_REG          equ 0x28 ; extended audio
102
CODEC_EXT_AUDIO_CTRL_REG     equ 0x2a ; extended audio control
103
CODEC_PCM_FRONT_DACRATE_REG  equ 0x2c ; PCM out sample rate
104
CODEC_PCM_SURND_DACRATE_REG  equ 0x2e ; surround sound sample rate
105
CODEC_PCM_LFE_DACRATE_REG    equ 0x30 ; LFE sample rate
351 diamond 106
 
562 serge 107
GLOB_CTRL         equ  0x2C  ;   Global Control
108
CTRL_STAT         equ  0x30  ;   Global Status
109
CTRL_CAS          equ  0x34  ;   Codec Access Semiphore
351 diamond 110
 
562 serge 111
CAS_FLAG          equ  0x01  ;   Codec Access Semiphore Bit
351 diamond 112
 
562 serge 113
CTRL_ST_CREADY    equ  BIT8+BIT9+BIT28 ;   Primary Codec Ready
351 diamond 114
 
562 serge 115
CTRL_ST_RCS       equ  0x00008000  ;   Read Completion Status
351 diamond 116
 
562 serge 117
CTRL_CNT_CRIE     equ  BIT4+BIT5+BIT6  ;   Codecs Resume Interrupt Enable
118
CTRL_CNT_AC_OFF   equ  0x00000008  ;   ACLINK Off
119
CTRL_CNT_WARM     equ  0x00000004  ;   AC97 Warm Reset
120
CTRL_CNT_COLD     equ  0x00000002  ;   AC97 Cold Reset
121
CTRL_CNT_GIE      equ  0x00000001  ;   GPI Interrupt Enable
351 diamond 122
 
123
CODEC_REG_POWERDOWN   equ 0x26
124
CODEC_REG_ST          equ 0x26
125
 
465 serge 126
SRV_GETVERSION        equ  0
351 diamond 127
DEV_PLAY              equ  1
128
DEV_STOP              equ  2
129
DEV_CALLBACK          equ  3
130
DEV_SET_BUFF          equ  4
131
DEV_NOTIFY            equ  5
132
DEV_SET_MASTERVOL     equ  6
133
DEV_GET_MASTERVOL     equ  7
134
DEV_GET_INFO          equ  8
135
 
136
struc AC_CNTRL		    ;AC controller base class
137
{ .bus                dd ?
138
  .devfn              dd ?
139
 
140
  .vendor             dd ?
141
  .dev_id             dd ?
142
  .pci_cmd            dd ?
143
  .pci_stat           dd ?
144
 
145
  .codec_io_base      dd ?
146
  .codec_mem_base     dd ?
147
 
148
  .ctrl_io_base       dd ?
149
  .ctrl_mem_base      dd ?
150
  .cfg_reg            dd ?
151
  .int_line           dd ?
152
 
153
  .vendor_ids         dd ?    ;vendor id string
154
  .ctrl_ids           dd ?    ;hub id string
155
 
156
  .buffer             dd ?
157
 
158
  .notify_pos         dd ?
159
  .notify_task        dd ?
160
 
161
  .lvi_reg            dd ?
162
  .ctrl_setup         dd ?
163
  .user_callback      dd ?
164
  .codec_read16       dd ?
165
  .codec_write16      dd ?
166
 
167
  .ctrl_read8         dd ?
168
  .ctrl_read16        dd ?
169
  .ctrl_read32        dd ?
170
 
171
  .ctrl_write8        dd ?
172
  .ctrl_write16       dd ?
173
  .ctrl_write32       dd ?
174
}
175
 
176
struc CODEC		   ;Audio Chip base class
177
{
178
  .chip_id            dd ?
179
  .flags              dd ?
180
  .status             dd ?
181
 
182
  .ac_vendor_ids      dd ?    ;ac vendor id string
183
  .chip_ids           dd ?    ;chip model string
184
 
185
  .shadow_flag        dd ?
186
                      dd ?
187
 
188
  .regs               dw ?     ; codec registers
189
  .reg_master_vol     dw ?     ;0x02
190
  .reg_aux_out_vol    dw ?     ;0x04
191
  .reg_mone_vol       dw ?     ;0x06
192
  .reg_master_tone    dw ?     ;0x08
193
  .reg_beep_vol       dw ?     ;0x0A
194
  .reg_phone_vol      dw ?     ;0x0C
195
  .reg_mic_vol        dw ?     ;0x0E
196
  .reg_line_in_vol    dw ?     ;0x10
197
  .reg_cd_vol         dw ?     ;0x12
198
  .reg_video_vol      dw ?     ;0x14
199
  .reg_aux_in_vol     dw ?     ;0x16
200
  .reg_pcm_out_vol    dw ?     ;0x18
201
  .reg_rec_select     dw ?     ;0x1A
202
  .reg_rec_gain       dw ?     ;0x1C
203
  .reg_rec_gain_mic   dw ?     ;0x1E
204
  .reg_gen            dw ?     ;0x20
205
  .reg_3d_ctrl        dw ?     ;0X22
206
  .reg_page           dw ?     ;0X24
207
  .reg_powerdown      dw ?     ;0x26
208
  .reg_ext_audio      dw ?     ;0x28
209
  .reg_ext_st         dw ?     ;0x2a
210
  .reg_pcm_front_rate dw ?     ;0x2c
211
  .reg_pcm_surr_rate  dw ?     ;0x2e
212
  .reg_lfe_rate       dw ?     ;0x30
213
  .reg_pcm_in_rate    dw ?     ;0x32
214
                      dw ?     ;0x34
215
  .reg_cent_lfe_vol   dw ?     ;0x36
216
  .reg_surr_vol       dw ?     ;0x38
217
  .reg_spdif_ctrl     dw ?     ;0x3A
218
                      dw ?     ;0x3C
219
                      dw ?     ;0x3E
220
                      dw ?     ;0x40
221
                      dw ?     ;0x42
222
                      dw ?     ;0x44
223
                      dw ?     ;0x46
224
                      dw ?     ;0x48
225
                      dw ?     ;0x4A
226
                      dw ?     ;0x4C
227
                      dw ?     ;0x4E
228
                      dw ?     ;0x50
229
                      dw ?     ;0x52
230
                      dw ?     ;0x54
231
                      dw ?     ;0x56
232
                      dw ?     ;0x58
233
                      dw ?     ;0x5A
234
                      dw ?     ;0x5C
235
                      dw ?     ;0x5E
236
  .reg_page_0         dw ?     ;0x60
237
  .reg_page_1         dw ?     ;0x62
238
  .reg_page_2         dw ?     ;0x64
239
  .reg_page_3         dw ?     ;0x66
240
  .reg_page_4         dw ?     ;0x68
241
  .reg_page_5         dw ?     ;0x6A
242
  .reg_page_6         dw ?     ;0x6C
243
  .reg_page_7         dw ?     ;0x6E
244
                      dw ?     ;0x70
245
                      dw ?     ;0x72
246
                      dw ?     ;0x74
247
                      dw ?     ;0x76
248
                      dw ?     ;0x78
249
                      dw ?     ;0x7A
250
  .reg_vendor_id_1    dw ?     ;0x7C
251
  .reg_vendor_id_2    dw ?     ;0x7E
252
 
253
 
254
  .reset              dd ?    ;virual
255
  .set_master_vol     dd ?
256
}
257
 
258
struc CTRL_INFO
465 serge 259
{   .pci_cmd          dd ?
260
    .irq              dd ?
261
    .glob_cntrl       dd ?
262
    .glob_sta         dd ?
263
    .codec_io_base    dd ?
264
    .ctrl_io_base     dd ?
265
    .codec_mem_base   dd ?
266
    .ctrl_mem_base    dd ?
267
    .codec_id         dd ?
351 diamond 268
}
269
 
270
struc IOCTL
465 serge 271
{  .handle            dd ?
272
   .io_code           dd ?
273
   .input             dd ?
274
   .inp_size          dd ?
275
   .output            dd ?
276
   .out_size          dd ?
351 diamond 277
}
278
 
279
virtual at 0
280
  IOCTL IOCTL
281
end virtual
282
 
283
EVENT_NOTIFY    equ 0x00000200
284
 
285
public START
286
public service_proc
287
public version
288
 
289
section '.flat' code readable align 16
290
 
291
proc START stdcall, state:dword
292
 
293
           cmp [state], 1
294
           jne .stop
295
 
296
     if DEBUG
297
           mov esi, msgInit
298
           call SysMsgBoardStr
299
     end if
300
 
301
           call detect_controller
302
           test eax, eax
303
           jz .fail
304
 
305
     if DEBUG
306
           mov esi,[ctrl.vendor_ids]
307
           call SysMsgBoardStr
308
           mov esi, [ctrl.ctrl_ids]
309
           call SysMsgBoardStr
310
 
311
     end if
312
 
313
           call init_controller
314
           test eax, eax
315
           jz .fail
316
 
562 serge 317
;     if DEBUG
318
;           mov esi, msgInitCodec
319
;           call SysMsgBoardStr
320
;     end if
351 diamond 321
 
322
           call init_codec
323
           test eax, eax
324
           jz .fail
325
 
326
           call reset_controller
327
           call setup_codec
328
 
329
           mov esi, msgPrimBuff
330
           call SysMsgBoardStr
331
 
332
           call create_primary_buff
333
 
334
;     if REMAP_IRQ
335
 
336
;           call get_LPC_bus
337
;           cmp eax, -1
338
;           jz .fail
339
 
340
;           mov [lpc_bus], 0  ;eax
341
;           call remap_irq
342
;     end if
343
 
344
           mov eax, VALID_IRQ
345
           mov ebx, [ctrl.int_line]
346
           mov esi, msgInvIRQ
347
           bt eax, ebx
348
           jnc .fail
349
           mov eax, ATTCH_IRQ
350
           mov esi, msgAttchIRQ
351
           bt eax, ebx
352
           jnc .fail
353
 
354
           stdcall AttachIntHandler, ebx, ac97_irq
465 serge 355
.reg:
351 diamond 356
           stdcall RegService, sz_sound_srv, service_proc
357
           ret
358
.fail:
359
     if DEBUG
360
           mov esi, msgFail
361
           call SysMsgBoardStr
362
     end if
363
           xor eax, eax
364
           ret
365
.stop:
366
           call stop
367
           xor eax, eax
368
           ret
369
endp
370
 
371
handle     equ  IOCTL.handle
372
io_code    equ  IOCTL.io_code
373
input      equ  IOCTL.input
374
inp_size   equ  IOCTL.inp_size
375
output     equ  IOCTL.output
376
out_size   equ  IOCTL.out_size
377
 
378
align 4
379
proc service_proc stdcall, ioctl:dword
380
 
381
           mov edi, [ioctl]
382
           mov eax, [edi+io_code]
465 serge 383
 
384
           cmp eax, SRV_GETVERSION
385
           jne @F
386
 
387
           mov eax, [edi+output]
388
           cmp [edi+out_size], 4
389
           jne .fail
390
 
391
           mov [eax], dword API_VERSION
392
           xor eax, eax
393
           ret
394
@@:
351 diamond 395
           cmp eax, DEV_PLAY
396
           jne @F
397
     if DEBUG
398
           mov esi, msgPlay
399
           call SysMsgBoardStr
400
     end if
401
           call play
402
           ret
403
@@:
404
           cmp eax, DEV_STOP
405
           jne @F
406
     if DEBUG
407
           mov esi, msgStop
408
           call SysMsgBoardStr
409
     end if
410
           call stop
411
           ret
412
@@:
413
           cmp eax, DEV_CALLBACK
414
           jne @F
415
           mov ebx, [edi+input]
416
           stdcall set_callback, [ebx]
417
           ret
418
@@:
419
           cmp eax, DEV_SET_MASTERVOL
420
           jne @F
378 serge 421
           mov eax, [edi+input]
422
           mov eax, [eax]
423
           call set_master_vol      ;eax= vol
351 diamond 424
           ret
425
@@:
426
           cmp eax, DEV_GET_MASTERVOL
427
           jne @F
428
           mov ebx, [edi+output]
429
           stdcall get_master_vol, ebx
430
           ret
378 serge 431
;@@:
432
;           cmp eax, DEV_GET_INFO
433
;           jne @F
434
;           mov ebx, [edi+output]
435
;           stdcall get_dev_info, ebx
436
;           ret
351 diamond 437
@@:
438
.fail:
378 serge 439
           or eax, -1
351 diamond 440
           ret
441
endp
442
 
443
restore   handle
444
restore   io_code
445
restore   input
446
restore   inp_size
447
restore   output
448
restore   out_size
449
 
450
 
451
align 4
452
proc remap_irq                         ;for Intel chipsets ONLY !!!
453
           mov eax, VALID_IRQ
454
           bt eax, IRQ_LINE
455
           jnc .exit
456
 
457
           mov edx, 0x4D0
458
           in ax,dx
459
           bts ax, IRQ_LINE
460
           out dx, aX
461
 
462
           stdcall PciWrite8, dword 0, dword 0xF8, dword 0x61, dword IRQ_LINE
463
           mov [ctrl.int_line], IRQ_LINE
464
 
465
.exit:
466
	   ret
467
endp
468
 
469
align 4
470
proc ac97_irq
471
 
472
;     if DEBUG
473
;           mov esi, msgIRQ
474
;           call SysMsgBoardStr
475
;     end if
476
 
477
           mov edx, PCM_OUT_CR_REG
478
           mov al, 0x10;               0x10
479
           call [ctrl.ctrl_write8]
480
 
481
           mov ax, 0x1c
482
           mov edx, PCM_OUT_SR_REG
483
           call [ctrl.ctrl_write16]
484
 
485
           mov edx, PCM_OUT_CIV_REG
486
           call [ctrl.ctrl_read8]
487
 
488
           and eax, 0x1F
489
           cmp eax, [civ_val]
490
           je .skip
491
 
492
           mov [civ_val], eax
493
           dec eax
494
           and eax, 0x1F
495
           mov [ctrl.lvi_reg], eax
496
 
497
           mov edx, PCM_OUT_LVI_REG
498
           call [ctrl.ctrl_write8]
499
 
500
           mov edx, PCM_OUT_CR_REG
501
           mov ax, 0x11              ;0x1D
502
           call [ctrl.ctrl_write8]
503
 
504
           mov eax, [civ_val]
505
           add eax, 1
506
           and eax, 31
507
           mov ebx, dword [buff_list+eax*4]
508
 
509
           cmp [ctrl.user_callback], 0
510
           je @f
511
 
512
           stdcall [ctrl.user_callback], ebx
513
@@:
514
           ret
515
 
516
.skip:
517
           mov edx, PCM_OUT_CR_REG
518
           mov ax, 0x11               ;0x1D
519
           call [ctrl.ctrl_write8]
520
           ret
521
endp
522
 
523
align 4
524
proc create_primary_buff
525
 
526
           stdcall KernelAlloc, 0x10000
527
           mov [ctrl.buffer], eax
528
 
529
           mov edi, eax
530
           mov ecx, 0x10000/4
531
           xor eax, eax
532
           cld
533
           rep stosd
534
 
535
           mov eax, [ctrl.buffer]
536
           call GetPgAddr
537
 
538
           mov ebx, 0xC0002000
539
           mov ecx, 4
540
           mov edi, pcmout_bdl
541
@@:
542
           mov [edi], eax
543
           mov [edi+4], ebx
544
 
545
           mov [edi+32], eax
546
           mov [edi+4+32], ebx
547
 
548
           mov [edi+64], eax
549
           mov [edi+4+64], ebx
550
 
551
           mov [edi+96], eax
552
           mov [edi+4+96], ebx
553
 
554
           mov [edi+128], eax
555
           mov [edi+4+128], ebx
556
 
557
           mov [edi+160], eax
558
           mov [edi+4+160], ebx
559
 
560
           mov [edi+192], eax
561
           mov [edi+4+192], ebx
562
 
563
           mov [edi+224], eax
564
           mov [edi+4+224], ebx
565
 
566
           add eax, 0x4000
567
           add edi, 8
568
           loop @B
569
 
570
           mov edi, buff_list
571
           mov eax, [ctrl.buffer]
572
           mov ecx, 4
573
@@:
574
           mov [edi], eax
575
           mov [edi+16], eax
576
           mov [edi+32], eax
577
           mov [edi+48], eax
578
           mov [edi+64], eax
579
           mov [edi+80], eax
580
           mov [edi+96], eax
581
           mov [edi+112], eax
582
 
583
           add eax, 0x4000
584
           add edi, 4
585
           loop @B
586
 
587
           mov eax, pcmout_bdl
588
           mov ebx, eax
589
           call GetPgAddr     ;eax
590
           and ebx, 0xFFF
591
           add eax, ebx
592
 
593
           mov edx, PCM_OUT_BDL
594
           call [ctrl.ctrl_write32]
595
 
596
           mov eax, 16
597
           mov [ctrl.lvi_reg], eax
598
           mov edx, PCM_OUT_LVI_REG
599
           call [ctrl.ctrl_write8]
600
           ret
601
endp
602
 
603
align 4
604
proc detect_controller
562 serge 605
           locals
606
             last_bus dd ?
607
             bus      dd ?
608
             devfn    dd ?
609
           endl
351 diamond 610
 
611
           xor eax, eax
612
           mov [bus], eax
613
           inc eax
614
           call PciApi
615
           cmp eax, -1
616
           je .err
617
 
618
           mov [last_bus], eax
619
 
620
.next_bus:
621
           and [devfn], 0
622
.next_dev:
623
           stdcall PciRead32, [bus], [devfn], dword 0
624
           test eax, eax
625
           jz .next
626
           cmp eax, -1
627
           je .next
628
 
629
           mov edi, devices
630
@@:
631
           mov ebx, [edi]
632
           test ebx, ebx
633
           jz .next
634
 
635
           cmp eax, ebx
636
           je .found
637
           add edi, 12
638
           jmp @B
639
 
640
.next:
641
           inc [devfn]
642
           cmp [devfn], 256
643
           jb .next_dev
644
           mov eax, [bus]
645
           inc eax
646
           mov [bus], eax
647
           cmp eax, [last_bus]
648
           jna .next_bus
649
           xor eax, eax
650
           ret
651
.found:
652
           mov ebx, [bus]
653
           mov [ctrl.bus], ebx
654
 
655
           mov ecx, [devfn]
656
           mov [ctrl.devfn], ecx
657
 
658
           mov edx, eax
659
           and edx, 0xFFFF
660
           mov [ctrl.vendor], edx
661
           shr eax, 16
662
           mov [ctrl.dev_id], eax
663
 
664
           mov ebx, [edi+4]
665
           mov [ctrl.ctrl_ids], ebx
666
           mov esi, [edi+8]
667
           mov [ctrl.ctrl_setup], esi
668
 
562 serge 669
           cmp edx, VID_INTEL
351 diamond 670
           jne @F
671
           mov [ctrl.vendor_ids], msg_Intel
672
           ret
673
@@:
562 serge 674
           cmp edx, VID_NVIDIA
351 diamond 675
           jne @F
676
           mov [ctrl.vendor_ids], msg_NVidia
562 serge 677
           ret
351 diamond 678
@@:
679
.err:
680
           xor eax, eax
562 serge 681
           mov [ctrl.vendor_ids], eax     ;something  wrong ?
351 diamond 682
           ret
683
endp
684
 
685
align 4
686
proc get_LPC_bus                ;for Intel chipsets ONLY !!!
687
           locals
688
             last_bus dd ?
689
             bus      dd ?
690
           endl
691
 
692
           xor eax, eax
693
           mov [bus], eax
694
           inc eax
695
           call [PciApi]
696
           cmp eax, -1
697
           je .err
698
 
699
           mov [last_bus], eax
700
.next_bus:
701
           stdcall PciRead32, [bus], dword 0xF8, dword 0
702
           test eax, eax
703
           jz .next
704
           cmp eax, -1
705
           je .next
706
 
707
           cmp eax, 0x24D08086
708
           je .found
709
.next:
710
           mov eax, [bus]
711
           inc eax
712
           cmp eax, [last_bus]
713
           mov [bus], eax
714
           jna .next_bus
715
.err:
716
           xor eax, eax
717
           dec eax
718
           ret
719
.found:
720
           mov eax, [bus]
721
           ret
722
endp
723
 
724
align 4
725
proc init_controller
726
 
727
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 4
728
           mov ebx, eax
729
           and eax, 0xFFFF
730
           mov [ctrl.pci_cmd], eax
731
           shr ebx, 16
732
           mov [ctrl.pci_stat], ebx
733
 
562 serge 734
           mov esi, msgPciCmd
735
           call SysMsgBoardStr
736
           call dword2str
737
           call SysMsgBoardStr
738
 
739
           mov esi, msgPciStat
740
           call SysMsgBoardStr
741
           mov eax, [ctrl.pci_stat]
742
           call dword2str
743
           call SysMsgBoardStr
744
 
745
           mov esi, msgMixIsaIo
746
           call SysMsgBoardStr
747
 
351 diamond 748
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x10
562 serge 749
 
750
           call dword2str
751
           call SysMsgBoardStr
752
 
351 diamond 753
           and eax,0xFFFE
754
           mov [ctrl.codec_io_base], eax
755
 
562 serge 756
           mov esi, msgCtrlIsaIo
757
           call SysMsgBoardStr
758
 
351 diamond 759
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x14
562 serge 760
 
761
           call dword2str
762
           call SysMsgBoardStr
763
 
351 diamond 764
           and eax, 0xFFC0
765
           mov [ctrl.ctrl_io_base], eax
766
 
562 serge 767
           mov esi, msgMixMMIo
768
           call SysMsgBoardStr
769
 
351 diamond 770
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x18
771
           mov [ctrl.codec_mem_base], eax
772
 
562 serge 773
           call dword2str
774
           call SysMsgBoardStr
775
 
776
           mov esi, msgCtrlMMIo
777
           call SysMsgBoardStr
778
 
351 diamond 779
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x1C
780
           mov [ctrl.ctrl_mem_base], eax
781
 
562 serge 782
           call dword2str
783
           call SysMsgBoardStr
784
 
351 diamond 785
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x3C
786
           and eax, 0xFF
787
           mov [ctrl.int_line], eax
788
 
789
           stdcall PciRead8, [ctrl.bus], [ctrl.devfn], dword 0x41
790
           and eax, 0xFF
791
           mov [ctrl.cfg_reg], eax
792
 
793
           call [ctrl.ctrl_setup]
794
           xor eax, eax
795
           inc eax
796
           ret
797
endp
798
 
799
align 4
800
proc set_ICH
801
           mov [ctrl.codec_read16],  codec_io_r16    ;virtual
802
           mov [ctrl.codec_write16], codec_io_w16    ;virtual
803
 
562 serge 804
           mov [ctrl.ctrl_read8 ],  ctrl_io_r8       ;virtual
351 diamond 805
           mov [ctrl.ctrl_read16],  ctrl_io_r16      ;virtual
806
           mov [ctrl.ctrl_read32],  ctrl_io_r32      ;virtual
807
 
562 serge 808
           mov [ctrl.ctrl_write8 ], ctrl_io_w8       ;virtual
351 diamond 809
           mov [ctrl.ctrl_write16], ctrl_io_w16      ;virtual
810
           mov [ctrl.ctrl_write32], ctrl_io_w32      ;virtual
811
           ret
812
endp
813
 
378 serge 814
PG_SW            equ 0x003
815
PG_NOCACHE       equ 0x018
351 diamond 816
 
817
align 4
818
proc set_ICH4
819
           stdcall AllocKernelSpace, dword 0x2000
820
           mov edi, eax
821
           stdcall MapPage, edi,[ctrl.codec_mem_base],PG_SW+PG_NOCACHE
822
           mov [ctrl.codec_mem_base], edi
823
           add edi, 0x1000
824
           stdcall MapPage, edi, [ctrl.ctrl_mem_base],PG_SW+PG_NOCACHE
825
           mov [ctrl.ctrl_mem_base], edi
826
 
827
           mov [ctrl.codec_read16],  codec_mem_r16    ;virtual
828
           mov [ctrl.codec_write16], codec_mem_w16    ;virtual
829
 
830
           mov [ctrl.ctrl_read8 ],  ctrl_mem_r8       ;virtual
831
           mov [ctrl.ctrl_read16],  ctrl_mem_r16      ;virtual
832
           mov [ctrl.ctrl_read32],  ctrl_mem_r32      ;virtual
833
 
834
           mov [ctrl.ctrl_write8 ], ctrl_mem_w8       ;virtual
835
           mov [ctrl.ctrl_write16], ctrl_mem_w16      ;virtual
836
           mov [ctrl.ctrl_write32], ctrl_mem_w32      ;virtual
837
           ret
838
endp
839
 
840
align 4
841
proc reset_controller
842
 
843
           xor eax, eax
844
           mov edx, PCM_IN_CR_REG
845
           call [ctrl.ctrl_write8]
846
 
847
           mov edx, PCM_OUT_CR_REG
848
           call [ctrl.ctrl_write8]
849
 
850
           mov edx, MC_IN_CR_REG
851
           call [ctrl.ctrl_write8]
852
 
853
           mov eax, RR
854
           mov edx, PCM_IN_CR_REG
855
           call [ctrl.ctrl_write8]
856
 
857
           mov edx, PCM_OUT_CR_REG
858
           call [ctrl.ctrl_write8]
859
 
860
           mov edx, MC_IN_CR_REG
861
           call [ctrl.ctrl_write8]
862
           ret
863
endp
864
 
865
align 4
866
proc init_codec
867
           locals
868
             counter dd ?
869
           endl
870
 
871
           mov esi, msgControl
872
           call SysMsgBoardStr
873
 
874
           mov edx, GLOB_CTRL
875
           call [ctrl.ctrl_read32]
876
           call dword2str
877
           call SysMsgBoardStr
878
 
879
           mov esi, msgStatus
880
           call SysMsgBoardStr
881
 
882
           mov edx, CTRL_STAT
883
           call [ctrl.ctrl_read32]
562 serge 884
           push eax
351 diamond 885
           call dword2str
886
           call SysMsgBoardStr
562 serge 887
           pop eax
888
           cmp eax, 0xFFFFFFFF
889
           je .err
351 diamond 890
 
891
           test eax, CTRL_ST_CREADY
892
           jnz .ready
893
 
894
           call reset_codec
562 serge 895
           test eax, eax
351 diamond 896
           jz .err
897
 
562 serge 898
.ready:
351 diamond 899
           xor edx, edx     ;ac_reg_0
900
           call [ctrl.codec_write16]
901
 
902
           xor eax, eax
903
           mov edx, CODEC_REG_POWERDOWN
904
           call [ctrl.codec_write16]
905
 
906
           mov [counter], 200     ; total 200*5 ms = 1s
907
.wait:
562 serge 908
           mov eax, 5000   ; wait 5 ms
909
           call StallExec
910
 
351 diamond 911
           mov edx, CODEC_REG_POWERDOWN
912
           call [ctrl.codec_read16]
913
           and eax, 0x0F
914
           cmp eax, 0x0F
562 serge 915
           jz .done
351 diamond 916
 
917
           sub [counter] , 1
918
           jnz .wait
919
.err:
920
           xor eax, eax        ; timeout error
921
           ret
562 serge 922
.done:
465 serge 923
           mov eax, 2      ;force set 16-bit 2-channel PCM
924
           mov edx, GLOB_CTRL
925
           call [ctrl.ctrl_write32]
926
           mov eax, 5000   ; wait 5 ms
927
           call StallExec
928
 
351 diamond 929
           call detect_codec
930
 
931
           xor eax, eax
932
           inc eax
933
           ret
934
endp
935
 
936
align 4
937
proc reset_codec
938
           mov edx, GLOB_CTRL
939
           call [ctrl.ctrl_read32]
940
 
941
           test eax, 0x02
942
           jz .cold
943
 
944
           call warm_reset
945
           jnc .ok
946
.cold:
947
           call cold_reset
948
           jnc .ok
949
 
950
     if DEBUG
951
           mov esi, msgCFail
952
           call SysMsgBoardStr
953
           end if
954
           xor eax, eax     ; timeout error
955
           ret
956
.ok:
957
     if DEBUG
958
           mov esi, msgResetOk
959
           call SysMsgBoardStr
960
     end if
961
 
962
           xor eax, eax
963
           inc eax
964
           ret
965
endp
966
 
967
align 4
968
proc warm_reset
969
           locals
970
             counter dd ?
971
           endl
972
 
973
           mov eax, 0x06
974
           mov edx, GLOB_CTRL
975
           call [ctrl.ctrl_write32]
976
 
977
     if DEBUG
978
           mov esi, msgWarm
979
           call SysMsgBoardStr
980
     end if
981
 
982
           mov [counter], 10    ; total 10*100 ms = 1s
983
.wait:
984
           mov eax, 100000    ; wait 100 ms
985
           call StallExec
986
 
562 serge 987
           mov edx, CTRL_STAT
351 diamond 988
           call [ctrl.ctrl_read32]
562 serge 989
           test eax, CTRL_ST_CREADY
990
           jnz .ok
991
 
992
           dec [counter]
351 diamond 993
           jnz .wait
994
 
995
     if DEBUG
996
           mov esi, msgWRFail
997
           call SysMsgBoardStr
998
     end if
562 serge 999
.fail:
351 diamond 1000
           stc
1001
           ret
1002
.ok:
1003
           clc
1004
           ret
1005
endp
1006
 
1007
align 4
1008
proc cold_reset
1009
           locals
1010
             counter dd ?
1011
           endl
1012
 
562 serge 1013
           mov eax, 0x02
351 diamond 1014
           mov edx, GLOB_CTRL
1015
           call [ctrl.ctrl_write32]
1016
 
1017
     if DEBUG
1018
           mov esi, msgCold
1019
           call SysMsgBoardStr
1020
     end if
1021
 
562 serge 1022
           mov eax, 400000     ; wait 400 ms
351 diamond 1023
           call StallExec
1024
 
562 serge 1025
           mov [counter], 16    ; total 20*100 ms = 2s
1026
.wait:
351 diamond 1027
 
562 serge 1028
           mov edx, CTRL_STAT
1029
           call [ctrl.ctrl_read32]
1030
           test eax, CTRL_ST_CREADY
1031
           jnz .ok
1032
 
351 diamond 1033
           mov eax, 100000    ; wait 100 ms
1034
           call StallExec
1035
 
562 serge 1036
           dec [counter]
351 diamond 1037
           jnz .wait
1038
 
1039
     if DEBUG
1040
           mov esi, msgCRFail
1041
           call SysMsgBoardStr
1042
     end if
562 serge 1043
 
1044
.fail:
351 diamond 1045
           stc
1046
           ret
1047
.ok:
562 serge 1048
           mov esi, msgControl
1049
           call SysMsgBoardStr
1050
 
1051
           mov edx, GLOB_CTRL
1052
           call [ctrl.ctrl_read32]
1053
           call dword2str
1054
           call SysMsgBoardStr
1055
 
1056
           mov esi, msgStatus
1057
           call SysMsgBoardStr
1058
 
351 diamond 1059
           mov edx, CTRL_STAT
1060
           call [ctrl.ctrl_read32]
562 serge 1061
           push eax
1062
           call dword2str
1063
           call SysMsgBoardStr
1064
           pop eax
1065
 
1066
           test eax, CTRL_ST_CREADY
351 diamond 1067
           jz .fail
1068
           clc
1069
           ret
1070
endp
1071
 
1072
align 4
378 serge 1073
play:
351 diamond 1074
           mov eax, 16
1075
           mov [ctrl.lvi_reg], eax
1076
           mov edx, PCM_OUT_LVI_REG
1077
           call [ctrl.ctrl_write8]
1078
 
1079
           mov edx, PCM_OUT_CR_REG
1080
           mov ax, 0x1D
1081
           call [ctrl.ctrl_write8]
378 serge 1082
           xor eax, eax
351 diamond 1083
           ret
1084
 
1085
align 4
378 serge 1086
stop:
351 diamond 1087
           mov edx, PCM_OUT_CR_REG
1088
           mov ax, 0x0
1089
           call [ctrl.ctrl_write8]
1090
 
1091
           mov ax, 0x1c
1092
           mov edx, PCM_OUT_SR_REG
1093
           call [ctrl.ctrl_write16]
378 serge 1094
           xor eax, eax
351 diamond 1095
           ret
1096
 
1097
align 4
1098
proc get_dev_info stdcall, p_info:dword
1099
           virtual at esi
1100
             CTRL_INFO CTRL_INFO
1101
           end virtual
1102
 
1103
           mov esi, [p_info]
1104
           mov eax, [ctrl.int_line]
1105
           mov ebx, [ctrl.codec_io_base]
1106
           mov ecx, [ctrl.ctrl_io_base]
1107
           mov edx, [ctrl.codec_mem_base]
1108
           mov edi, [ctrl.ctrl_mem_base]
1109
 
1110
           mov [CTRL_INFO.irq], eax
1111
           mov [CTRL_INFO.codec_io_base], ebx
1112
           mov [CTRL_INFO.ctrl_io_base], ecx
1113
           mov [CTRL_INFO.codec_mem_base], edx
1114
           mov [CTRL_INFO.ctrl_mem_base], edi
1115
 
1116
           mov eax, [codec.chip_id]
1117
           mov [CTRL_INFO.codec_id], eax
1118
 
1119
           mov edx, GLOB_CTRL
1120
           call [ctrl.ctrl_read32]
1121
           mov [CTRL_INFO.glob_cntrl], eax
1122
 
1123
           mov edx, CTRL_STAT
1124
           call [ctrl.ctrl_read32]
1125
           mov [CTRL_INFO.glob_sta], eax
1126
 
1127
           mov ebx, [ctrl.pci_cmd]
1128
           mov [CTRL_INFO.pci_cmd], ebx
1129
           ret
1130
endp
1131
 
1132
align 4
1133
proc set_callback stdcall, handler:dword
1134
           mov eax, [handler]
1135
           mov [ctrl.user_callback], eax
1136
           ret
1137
endp
1138
 
1139
align 4
1140
proc codec_read stdcall, ac_reg:dword	   ; reg = edx, reval = eax
1141
 
1142
           mov edx, [ac_reg]
1143
 
1144
           mov ebx, edx
1145
           shr ebx, 1
1146
           bt [codec.shadow_flag], ebx
1147
           jc .use_shadow
1148
 
1149
           call [ctrl.codec_read16]  ;change edx !!!
1150
           mov ecx, eax
1151
 
1152
           mov edx, CTRL_STAT
1153
           call [ctrl.ctrl_read32]
1154
           test eax, CTRL_ST_RCS
1155
           jz .read_ok
1156
 
1157
           mov edx, CTRL_STAT
1158
           call [ctrl.ctrl_write32]
1159
           xor eax,eax
1160
           not eax  ;timeout
1161
           ret
1162
.read_ok:
1163
           mov edx, [ac_reg]
1164
           mov [codec.regs+edx], cx
1165
           bts [codec.shadow_flag], ebx
1166
           mov eax, ecx
1167
           ret
1168
.use_shadow:
1169
           movzx eax, word [codec.regs+edx]
1170
           ret
1171
endp
1172
 
1173
align 4
1174
proc codec_write stdcall, ac_reg:dword
1175
           push eax
1176
           call check_semafore
1177
           and eax, eax
1178
           jz .err
1179
           pop eax
1180
 
1181
           mov esi, [ac_reg]
1182
           mov edx, esi
1183
           call [ctrl.codec_write16]
1184
           mov [codec.regs+esi], ax
1185
           shr esi, 1
1186
           bts [codec.shadow_flag], esi
1187
           ret
1188
.err:
1189
           pop eax
1190
           ret
1191
endp
1192
 
1193
align 4
1194
proc codec_check_ready
1195
 
1196
           mov edx, CTRL_ST
1197
           call [ctrl.ctrl_read32]
1198
           and eax, CTRL_ST_CREADY
1199
           jz .not_ready
1200
 
1201
           xor eax, wax
1202
           inc eax
1203
           ret
1204
.not_ready:
1205
           xor eax, eax
1206
           ret
1207
endp
1208
 
1209
align 4
1210
proc check_semafore
1211
           local counter:DWORD
1212
 
1213
           mov [counter], 100
1214
.l1:
1215
           mov edx, CTRL_CAS
1216
           call [ctrl.ctrl_read8]
1217
           and eax, CAS_FLAG
1218
           jz .ok
1219
 
1220
           mov eax, 1
1221
           call StallExec
1222
           sub [counter], 1
1223
           jnz .l1
1224
           xor eax, eax
1225
           ret
1226
align 4
1227
.ok:
1228
           xor eax,eax
1229
           inc eax
1230
           ret
1231
endp
1232
 
1233
align 4
1234
proc StallExec
1235
           push ecx
1236
           push edx
1237
           push ebx
1238
           push eax
1239
 
1240
           mov ecx, CPU_FREQ
1241
           mul ecx
1242
           mov ebx, eax       ;low
1243
           mov ecx, edx       ;high
1244
           rdtsc
1245
           add ebx, eax
1246
           adc ecx,edx
1247
@@:
1248
           rdtsc
1249
           sub eax, ebx
1250
           sbb edx, ecx
1251
           js @B
1252
 
1253
           pop eax
1254
           pop ebx
1255
           pop edx
1256
           pop ecx
1257
           ret
1258
endp
1259
 
1260
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1261
;          CONTROLLER IO functions
1262
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1263
 
1264
align 4
1265
proc codec_io_r16
1266
           add edx, [ctrl.codec_io_base]
1267
           in  ax, dx
1268
           ret
1269
endp
1270
 
1271
align 4
1272
proc codec_io_w16
1273
           add edx, [ctrl.codec_io_base]
1274
           out dx, ax
1275
           ret
1276
endp
1277
 
1278
align 4
1279
proc ctrl_io_r8
1280
           add edx, [ctrl.ctrl_io_base]
1281
           in  al, dx
1282
           ret
1283
endp
1284
 
1285
align 4
1286
proc ctrl_io_r16
1287
           add edx, [ctrl.ctrl_io_base]
1288
           in  ax, dx
1289
           ret
1290
endp
1291
 
1292
align 4
1293
proc ctrl_io_r32
1294
           add edx, [ctrl.ctrl_io_base]
1295
           in  eax, dx
1296
           ret
1297
endp
1298
 
1299
align 4
1300
proc ctrl_io_w8
1301
           add edx, [ctrl.ctrl_io_base]
1302
           out dx, al
1303
           ret
1304
endp
1305
 
1306
align 4
1307
proc ctrl_io_w16
1308
           add edx, [ctrl.ctrl_io_base]
1309
           out dx, ax
1310
           ret
1311
endp
1312
 
1313
align 4
1314
proc ctrl_io_w32
1315
           add edx, [ctrl.ctrl_io_base]
1316
           out dx, eax
1317
           ret
1318
endp
1319
 
1320
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1321
;         MEMORY MAPPED IO    (os depended)
1322
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1323
 
1324
align 4
1325
proc codec_mem_r16
1326
           add edx, [ctrl.codec_mem_base]
1327
           mov ax, word [edx]
1328
           ret
1329
endp
1330
 
1331
align 4
1332
proc codec_mem_w16
1333
           add edx, [ctrl.codec_mem_base]
1334
           mov word [edx], ax
1335
           ret
1336
endp
1337
 
1338
align 4
1339
proc ctrl_mem_r8
1340
           add edx, [ctrl.ctrl_mem_base]
1341
           mov al, [edx]
1342
           ret
1343
endp
1344
 
1345
align 4
1346
proc ctrl_mem_r16
1347
           add edx, [ctrl.ctrl_mem_base]
1348
           mov ax, [edx]
1349
           ret
1350
endp
1351
 
1352
align 4
1353
proc ctrl_mem_r32
1354
           add edx, [ctrl.ctrl_mem_base]
1355
           mov eax, [edx]
1356
           ret
1357
endp
1358
 
1359
align 4
1360
proc ctrl_mem_w8
1361
           add edx, [ctrl.ctrl_mem_base]
1362
           mov [edx], al
1363
           ret
1364
endp
1365
 
1366
align 4
1367
proc ctrl_mem_w16
1368
           add edx, [ctrl.ctrl_mem_base]
1369
           mov [edx], ax
1370
           ret
1371
endp
1372
 
1373
align 4
1374
proc ctrl_mem_w32
1375
           add edx, [ctrl.ctrl_mem_base]
1376
           mov [edx], eax
1377
           ret
1378
endp
1379
 
1380
align 4
1381
dword2str:
1382
      mov  esi, hex_buff
1383
      mov ecx, -8
1384
@@:
1385
      rol eax, 4
1386
      mov ebx, eax
1387
      and ebx, 0x0F
1388
      mov bl, [ebx+hexletters]
1389
      mov [8+esi+ecx], bl
1390
      inc ecx
1391
      jnz @B
1392
      ret
1393
 
1394
hexletters   db '0123456789ABCDEF'
1395
hex_buff     db 8 dup(0),13,10,0
1396
 
1397
 
1398
include "codec.inc"
1399
 
1400
align 4
1401
devices dd (CTRL_ICH  shl 16)+VID_INTEL,msg_ICH, set_ICH
378 serge 1402
        dd (CTRL_ICH0 shl 16)+VID_INTEL,msg_ICH0,set_ICH
1403
        dd (CTRL_ICH2 shl 16)+VID_INTEL,msg_ICH2,set_ICH
1404
        dd (CTRL_ICH3 shl 16)+VID_INTEL,msg_ICH3,set_ICH
351 diamond 1405
        dd (CTRL_ICH4 shl 16)+VID_INTEL,msg_ICH4,set_ICH4
1406
        dd (CTRL_ICH5 shl 16)+VID_INTEL,msg_ICH5,set_ICH4
1407
        dd (CTRL_ICH6 shl 16)+VID_INTEL,msg_ICH6,set_ICH4
1408
        dd (CTRL_ICH7 shl 16)+VID_INTEL,msg_ICH7,set_ICH4
1409
 
1410
        dd (CTRL_NFORCE  shl 16)+VID_NVIDIA,msg_NForce, set_ICH
1411
        dd (CTRL_NFORCE2 shl 16)+VID_NVIDIA,msg_NForce2,set_ICH
1412
        dd (CTRL_NFORCE3 shl 16)+VID_NVIDIA,msg_NForce3,set_ICH
1413
        dd (CTRL_MCP04   shl 16)+VID_NVIDIA,msg_MCP04,set_ICH
1414
        dd (CTRL_CK804   shl 16)+VID_NVIDIA,msg_CK804,set_ICH
1415
        dd (CTRL_CK8     shl 16)+VID_NVIDIA,msg_CK8,set_ICH
1416
        dd (CTRL_CK8S    shl 16)+VID_NVIDIA,msg_CK8S,set_ICH
1417
        dd (CTRL_MCP51   shl 16)+VID_NVIDIA,msg_MCP51,set_ICH
1418
 
1419
        dd 0    ;terminator
1420
 
1421
 
465 serge 1422
version      dd (5 shl 16) or (API_VERSION and 0xFFFF)
1423
 
562 serge 1424
msg_ICH      db '802801AA (ICH)',  13,10, 0
1425
msg_ICH0     db '802801AB (ICH0)', 13,10, 0
1426
msg_ICH2     db '802801BA (ICH2)', 13,10, 0
1427
msg_ICH3     db '802801CA (ICH3)', 13,10, 0
1428
msg_ICH4     db '802801DB (ICH4)', 13,10, 0
1429
msg_ICH5     db '802801EB (ICH5)', 13,10, 0
1430
msg_ICH6     db '802801FB (ICH6)', 13,10, 0
1431
msg_ICH7     db '802801GB (ICH7)', 13,10, 0
1432
msg_Intel    db 'Intel ', 0
351 diamond 1433
 
1434
msg_NForce   db 'NForce',      13,10, 0
1435
msg_NForce2  db 'NForce 2',    13,10, 0
1436
msg_NForce3  db 'NForce 3',    13,10, 0
1437
msg_MCP04    db 'NForce MCP04',13,10, 0
1438
msg_CK804    db 'NForce CK804',13,10, 0
1439
msg_CK8      db 'NForce CK8',  13,10, 0
1440
msg_CK8S     db 'NForce CK8S', 13,10, 0
1441
msg_MCP51    db 'NForce MCP51',13,10, 0
1442
 
1443
msg_NVidia   db 'NVidia', 0
1444
 
1445
szKernel	    db 'KERNEL', 0
1446
sz_sound_srv	    db 'SOUND',0
1447
 
1448
msgInit      db 'detect hardware...',13,10,0
1449
msgFail      db 'device not found',13,10,0
1450
msgAttchIRQ  db 'IRQ line not supported', 13,10, 0
1451
msgInvIRQ    db 'IRQ line not assigned or invalid', 13,10, 0
1452
msgPlay      db 'start play', 13,10,0
1453
msgStop      db 'stop play',  13,10,0
562 serge 1454
;msgNotify    db 'call notify',13,10,0
1455
;msgIRQ       db 'AC97 IRQ', 13,10,0
351 diamond 1456
msgInitCtrl  db 'init controller',13,10,0
562 serge 1457
;msgInitCodec db 'init codec',13,10,0
351 diamond 1458
msgPrimBuff  db 'create primary buffer',13,10,0
562 serge 1459
;msgReg       db 'set service handler',13,10,0
351 diamond 1460
msgOk        db 'service installed',13,10,0
1461
msgCold      db 'cold reset',13,10,0
1462
msgWarm      db 'warm reset',13,10,0
1463
msgWRFail    db 'warm reset failed',13,10,0
1464
msgCRFail    db 'cold reset failed',13,10,0
1465
msgCFail     db 'codec not ready',13,10,0
1466
msgResetOk   db 'reset complete',13,10,0
1467
msgStatus    db 'global status   ',0
1468
msgControl   db 'global control  ',0
562 serge 1469
msgPciCmd    db 'PCI command     ',0
1470
msgPciStat   db 'PCI status      ',0
1471
msgCtrlIsaIo db 'controller io base   ',0
1472
msgMixIsaIo  db 'codec io base        ',0
1473
msgCtrlMMIo  db 'controller mmio base ',0
1474
msgMixMMIo   db 'codec mmio base      ',0
351 diamond 1475
 
1476
section '.data' data readable writable align 16
1477
 
1478
pcmout_bdl       rq 32
1479
buff_list        rd 32
1480
 
1481
codec CODEC
1482
ctrl AC_CNTRL
1483
 
1484
lpc_bus  rd 1
1485
civ_val  rd 1