Subversion Repositories Kolibri OS

Rev

Rev 431 | 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
19
 
20
;irq 0,1,2,8,12,13 недоступны
21
;               FEDCBA9876543210
22
VALID_IRQ   equ 1100111011111000b
23
ATTCH_IRQ   equ 0000111010101000b
24
 
25
IRQ_LINE    equ 0
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
 
378 serge 65
VID_INTEL        equ 0x8086
66
VID_NVIDIA       equ 0x10DE
351 diamond 67
 
378 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
 
378 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
 
378 serge 87
PCM_OUT_BDL      equ  0x10  ; PCM out buffer descriptors list
351 diamond 88
PCM_OUT_CR_REG	  equ  0x1b	 ; PCM out Control Register
378 serge 89
PCM_OUT_LVI_REG  equ  0x15  ; PCM last valid index
351 diamond 90
PCM_OUT_SR_REG	  equ  0x16	 ; PCM out Status register
378 serge 91
PCM_OUT_PIV_REG  equ  0x1a
92
PCM_OUT_CIV_REG  equ  0x14  ; PCM out current index
351 diamond 93
 
378 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
 
465 serge 107
GLOB_CTRL        equ  0x2C  ;   Global Control
378 serge 108
CTRL_STAT        equ  0x30  ;   Global Status
109
CTRL_CAS         equ  0x34  ;   Codec Access Semiphore
351 diamond 110
 
378 serge 111
CAS_FLAG         equ  0x01  ;   Codec Access Semiphore Bit
351 diamond 112
 
378 serge 113
CTRL_ST_CREADY   equ  BIT8+BIT9+BIT28 ;   Primary Codec Ready
351 diamond 114
 
378 serge 115
CTRL_ST_RCS      equ  0x00008000  ;   Read Completion Status
351 diamond 116
 
378 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
 
465 serge 285
OS_BASE         equ 0x80000000
380 serge 286
SLOT_BASE       equ OS_BASE+0x0080000
351 diamond 287
 
288
public START
289
public service_proc
290
public version
291
 
292
section '.flat' code readable align 16
293
 
294
proc START stdcall, state:dword
295
 
296
           cmp [state], 1
297
           jne .stop
298
 
299
     if DEBUG
300
           mov esi, msgInit
301
           call SysMsgBoardStr
302
     end if
303
 
304
           call detect_controller
305
           test eax, eax
306
           jz .fail
307
 
308
     if DEBUG
309
           mov esi,[ctrl.vendor_ids]
310
           call SysMsgBoardStr
311
           mov esi, [ctrl.ctrl_ids]
312
           call SysMsgBoardStr
313
 
314
     end if
315
 
316
           call init_controller
317
           test eax, eax
318
           jz .fail
319
 
320
     if DEBUG
321
           mov esi, msgInitCodec
322
           call SysMsgBoardStr
323
     end if
324
 
325
           call init_codec
326
           test eax, eax
327
           jz .fail
328
 
329
     if DEBUG
330
           mov esi, [codec.ac_vendor_ids]
331
           call SysMsgBoardStr
332
 
333
           mov esi, [codec.chip_ids]
334
           call SysMsgBoardStr
335
     end if
336
 
337
           call reset_controller
338
           call setup_codec
339
 
340
           mov esi, msgPrimBuff
341
           call SysMsgBoardStr
342
 
343
           call create_primary_buff
344
 
345
;     if REMAP_IRQ
346
 
347
;           call get_LPC_bus
348
;           cmp eax, -1
349
;           jz .fail
350
 
351
;           mov [lpc_bus], 0  ;eax
352
;           call remap_irq
353
;     end if
354
 
355
           mov eax, VALID_IRQ
356
           mov ebx, [ctrl.int_line]
357
           mov esi, msgInvIRQ
358
           bt eax, ebx
359
           jnc .fail
360
           mov eax, ATTCH_IRQ
361
           mov esi, msgAttchIRQ
362
           bt eax, ebx
363
           jnc .fail
364
 
365
           stdcall AttachIntHandler, ebx, ac97_irq
465 serge 366
.reg:
351 diamond 367
           stdcall RegService, sz_sound_srv, service_proc
368
           ret
369
.fail:
370
     if DEBUG
371
           mov esi, msgFail
372
           call SysMsgBoardStr
373
     end if
374
           xor eax, eax
375
           ret
376
.stop:
377
           call stop
378
           xor eax, eax
379
           ret
380
endp
381
 
382
handle     equ  IOCTL.handle
383
io_code    equ  IOCTL.io_code
384
input      equ  IOCTL.input
385
inp_size   equ  IOCTL.inp_size
386
output     equ  IOCTL.output
387
out_size   equ  IOCTL.out_size
388
 
389
align 4
390
proc service_proc stdcall, ioctl:dword
391
 
392
           mov edi, [ioctl]
393
           mov eax, [edi+io_code]
465 serge 394
 
395
           cmp eax, SRV_GETVERSION
396
           jne @F
397
 
398
           mov eax, [edi+output]
399
           cmp [edi+out_size], 4
400
           jne .fail
401
 
402
           mov [eax], dword API_VERSION
403
           xor eax, eax
404
           ret
405
@@:
351 diamond 406
           cmp eax, DEV_PLAY
407
           jne @F
408
     if DEBUG
409
           mov esi, msgPlay
410
           call SysMsgBoardStr
411
     end if
412
           call play
413
           ret
414
@@:
415
           cmp eax, DEV_STOP
416
           jne @F
417
     if DEBUG
418
           mov esi, msgStop
419
           call SysMsgBoardStr
420
     end if
421
           call stop
422
           ret
423
@@:
424
           cmp eax, DEV_CALLBACK
425
           jne @F
426
           mov ebx, [edi+input]
427
           stdcall set_callback, [ebx]
428
           ret
429
@@:
430
           cmp eax, DEV_SET_MASTERVOL
431
           jne @F
378 serge 432
           mov eax, [edi+input]
433
           mov eax, [eax]
434
           call set_master_vol      ;eax= vol
351 diamond 435
           ret
436
@@:
437
           cmp eax, DEV_GET_MASTERVOL
438
           jne @F
439
           mov ebx, [edi+output]
440
           stdcall get_master_vol, ebx
441
           ret
378 serge 442
;@@:
443
;           cmp eax, DEV_GET_INFO
444
;           jne @F
445
;           mov ebx, [edi+output]
446
;           stdcall get_dev_info, ebx
447
;           ret
351 diamond 448
@@:
449
.fail:
378 serge 450
           or eax, -1
351 diamond 451
           ret
452
endp
453
 
454
restore   handle
455
restore   io_code
456
restore   input
457
restore   inp_size
458
restore   output
459
restore   out_size
460
 
461
 
462
align 4
463
proc remap_irq                         ;for Intel chipsets ONLY !!!
464
           mov eax, VALID_IRQ
465
           bt eax, IRQ_LINE
466
           jnc .exit
467
 
468
           mov edx, 0x4D0
469
           in ax,dx
470
           bts ax, IRQ_LINE
471
           out dx, aX
472
 
473
           stdcall PciWrite8, dword 0, dword 0xF8, dword 0x61, dword IRQ_LINE
474
           mov [ctrl.int_line], IRQ_LINE
475
 
476
.exit:
477
	   ret
478
endp
479
 
480
align 4
481
proc ac97_irq
482
 
483
;     if DEBUG
484
;           mov esi, msgIRQ
485
;           call SysMsgBoardStr
486
;     end if
487
 
488
           mov edx, PCM_OUT_CR_REG
489
           mov al, 0x10;               0x10
490
           call [ctrl.ctrl_write8]
491
 
492
           mov ax, 0x1c
493
           mov edx, PCM_OUT_SR_REG
494
           call [ctrl.ctrl_write16]
495
 
496
           mov edx, PCM_OUT_CIV_REG
497
           call [ctrl.ctrl_read8]
498
 
499
           and eax, 0x1F
500
           cmp eax, [civ_val]
501
           je .skip
502
 
503
           mov [civ_val], eax
504
           dec eax
505
           and eax, 0x1F
506
           mov [ctrl.lvi_reg], eax
507
 
508
           mov edx, PCM_OUT_LVI_REG
509
           call [ctrl.ctrl_write8]
510
 
511
           mov edx, PCM_OUT_CR_REG
512
           mov ax, 0x11              ;0x1D
513
           call [ctrl.ctrl_write8]
514
 
515
           mov eax, [civ_val]
516
           add eax, 1
517
           and eax, 31
518
           mov ebx, dword [buff_list+eax*4]
519
 
520
           cmp [ctrl.user_callback], 0
521
           je @f
522
 
523
           stdcall [ctrl.user_callback], ebx
524
@@:
525
           ret
526
 
527
.skip:
528
           mov edx, PCM_OUT_CR_REG
529
           mov ax, 0x11               ;0x1D
530
           call [ctrl.ctrl_write8]
531
           ret
532
endp
533
 
534
align 4
535
proc create_primary_buff
536
 
537
           stdcall KernelAlloc, 0x10000
538
           mov [ctrl.buffer], eax
539
 
540
           mov edi, eax
541
           mov ecx, 0x10000/4
542
           xor eax, eax
543
           cld
544
           rep stosd
545
 
546
           mov eax, [ctrl.buffer]
547
           call GetPgAddr
548
 
549
           mov ebx, 0xC0002000
550
           mov ecx, 4
551
           mov edi, pcmout_bdl
552
@@:
553
           mov [edi], eax
554
           mov [edi+4], ebx
555
 
556
           mov [edi+32], eax
557
           mov [edi+4+32], ebx
558
 
559
           mov [edi+64], eax
560
           mov [edi+4+64], ebx
561
 
562
           mov [edi+96], eax
563
           mov [edi+4+96], ebx
564
 
565
           mov [edi+128], eax
566
           mov [edi+4+128], ebx
567
 
568
           mov [edi+160], eax
569
           mov [edi+4+160], ebx
570
 
571
           mov [edi+192], eax
572
           mov [edi+4+192], ebx
573
 
574
           mov [edi+224], eax
575
           mov [edi+4+224], ebx
576
 
577
           add eax, 0x4000
578
           add edi, 8
579
           loop @B
580
 
581
           mov edi, buff_list
582
           mov eax, [ctrl.buffer]
583
           mov ecx, 4
584
@@:
585
           mov [edi], eax
586
           mov [edi+16], eax
587
           mov [edi+32], eax
588
           mov [edi+48], eax
589
           mov [edi+64], eax
590
           mov [edi+80], eax
591
           mov [edi+96], eax
592
           mov [edi+112], eax
593
 
594
           add eax, 0x4000
595
           add edi, 4
596
           loop @B
597
 
598
           mov eax, pcmout_bdl
599
           mov ebx, eax
600
           call GetPgAddr     ;eax
601
           and ebx, 0xFFF
602
           add eax, ebx
603
 
604
           mov edx, PCM_OUT_BDL
605
           call [ctrl.ctrl_write32]
606
 
607
           mov eax, 16
608
           mov [ctrl.lvi_reg], eax
609
           mov edx, PCM_OUT_LVI_REG
610
           call [ctrl.ctrl_write8]
611
           ret
612
endp
613
 
614
align 4
615
proc detect_controller
616
	   locals
617
	     last_bus dd ?
618
	     bus      dd ?
619
	     devfn    dd ?
620
	   endl
621
 
622
           xor eax, eax
623
           mov [bus], eax
624
           inc eax
625
           call PciApi
626
           cmp eax, -1
627
           je .err
628
 
629
           mov [last_bus], eax
630
 
631
.next_bus:
632
           and [devfn], 0
633
.next_dev:
634
           stdcall PciRead32, [bus], [devfn], dword 0
635
           test eax, eax
636
           jz .next
637
           cmp eax, -1
638
           je .next
639
 
640
           mov edi, devices
641
@@:
642
           mov ebx, [edi]
643
           test ebx, ebx
644
           jz .next
645
 
646
           cmp eax, ebx
647
           je .found
648
           add edi, 12
649
           jmp @B
650
 
651
.next:
652
           inc [devfn]
653
           cmp [devfn], 256
654
           jb .next_dev
655
           mov eax, [bus]
656
           inc eax
657
           mov [bus], eax
658
           cmp eax, [last_bus]
659
           jna .next_bus
660
           xor eax, eax
661
           ret
662
.found:
663
           mov ebx, [bus]
664
           mov [ctrl.bus], ebx
665
 
666
           mov ecx, [devfn]
667
           mov [ctrl.devfn], ecx
668
 
669
           mov edx, eax
670
           and edx, 0xFFFF
671
           mov [ctrl.vendor], edx
672
           shr eax, 16
673
           mov [ctrl.dev_id], eax
674
 
675
           mov ebx, [edi+4]
676
           mov [ctrl.ctrl_ids], ebx
677
           mov esi, [edi+8]
678
           mov [ctrl.ctrl_setup], esi
679
 
680
           cmp ebx, VID_INTEL
681
           jne @F
682
           mov [ctrl.vendor_ids], msg_Intel
683
           ret
684
@@:
685
           cmp ebx, VID_NVIDIA
686
           jne @F
687
           mov [ctrl.vendor_ids], msg_NVidia
688
@@:
689
           mov [ctrl.vendor_ids], 0     ;something  wrong ?
690
           ret
691
.err:
692
           xor eax, eax
693
           ret
694
endp
695
 
696
align 4
697
proc get_LPC_bus                ;for Intel chipsets ONLY !!!
698
           locals
699
             last_bus dd ?
700
             bus      dd ?
701
           endl
702
 
703
           xor eax, eax
704
           mov [bus], eax
705
           inc eax
706
           call [PciApi]
707
           cmp eax, -1
708
           je .err
709
 
710
           mov [last_bus], eax
711
.next_bus:
712
           stdcall PciRead32, [bus], dword 0xF8, dword 0
713
           test eax, eax
714
           jz .next
715
           cmp eax, -1
716
           je .next
717
 
718
           cmp eax, 0x24D08086
719
           je .found
720
.next:
721
           mov eax, [bus]
722
           inc eax
723
           cmp eax, [last_bus]
724
           mov [bus], eax
725
           jna .next_bus
726
.err:
727
           xor eax, eax
728
           dec eax
729
           ret
730
.found:
731
           mov eax, [bus]
732
           ret
733
endp
734
 
735
align 4
736
proc init_controller
737
 
738
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 4
739
           mov ebx, eax
740
           and eax, 0xFFFF
741
           mov [ctrl.pci_cmd], eax
742
           shr ebx, 16
743
           mov [ctrl.pci_stat], ebx
744
 
745
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x10
746
           and eax,0xFFFE
747
           mov [ctrl.codec_io_base], eax
748
 
749
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x14
750
           and eax, 0xFFC0
751
           mov [ctrl.ctrl_io_base], eax
752
 
753
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x18
754
           mov [ctrl.codec_mem_base], eax
755
 
756
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x1C
757
           mov [ctrl.ctrl_mem_base], eax
758
 
759
           stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x3C
760
           and eax, 0xFF
761
           mov [ctrl.int_line], eax
762
 
763
           stdcall PciRead8, [ctrl.bus], [ctrl.devfn], dword 0x41
764
           and eax, 0xFF
765
           mov [ctrl.cfg_reg], eax
766
 
767
           call [ctrl.ctrl_setup]
768
           xor eax, eax
769
           inc eax
770
           ret
771
endp
772
 
773
align 4
774
proc set_ICH
775
           mov [ctrl.codec_read16],  codec_io_r16    ;virtual
776
           mov [ctrl.codec_write16], codec_io_w16    ;virtual
777
 
778
           mov [ctrl.ctrl_read8 ],  ctrl_io_r8      ;virtual
779
           mov [ctrl.ctrl_read16],  ctrl_io_r16      ;virtual
780
           mov [ctrl.ctrl_read32],  ctrl_io_r32      ;virtual
781
 
782
           mov [ctrl.ctrl_write8 ], ctrl_io_w8      ;virtual
783
           mov [ctrl.ctrl_write16], ctrl_io_w16      ;virtual
784
           mov [ctrl.ctrl_write32], ctrl_io_w32      ;virtual
785
           ret
786
endp
787
 
378 serge 788
PG_SW            equ 0x003
789
PG_NOCACHE       equ 0x018
351 diamond 790
 
791
align 4
792
proc set_ICH4
793
           stdcall AllocKernelSpace, dword 0x2000
794
           mov edi, eax
795
           stdcall MapPage, edi,[ctrl.codec_mem_base],PG_SW+PG_NOCACHE
796
           mov [ctrl.codec_mem_base], edi
797
           add edi, 0x1000
798
           stdcall MapPage, edi, [ctrl.ctrl_mem_base],PG_SW+PG_NOCACHE
799
           mov [ctrl.ctrl_mem_base], edi
800
 
801
           mov [ctrl.codec_read16],  codec_mem_r16    ;virtual
802
           mov [ctrl.codec_write16], codec_mem_w16    ;virtual
803
 
804
           mov [ctrl.ctrl_read8 ],  ctrl_mem_r8       ;virtual
805
           mov [ctrl.ctrl_read16],  ctrl_mem_r16      ;virtual
806
           mov [ctrl.ctrl_read32],  ctrl_mem_r32      ;virtual
807
 
808
           mov [ctrl.ctrl_write8 ], ctrl_mem_w8       ;virtual
809
           mov [ctrl.ctrl_write16], ctrl_mem_w16      ;virtual
810
           mov [ctrl.ctrl_write32], ctrl_mem_w32      ;virtual
811
           ret
812
endp
813
 
814
align 4
815
proc reset_controller
816
 
817
           xor eax, eax
818
           mov edx, PCM_IN_CR_REG
819
           call [ctrl.ctrl_write8]
820
 
821
           mov edx, PCM_OUT_CR_REG
822
           call [ctrl.ctrl_write8]
823
 
824
           mov edx, MC_IN_CR_REG
825
           call [ctrl.ctrl_write8]
826
 
827
           mov eax, RR
828
           mov edx, PCM_IN_CR_REG
829
           call [ctrl.ctrl_write8]
830
 
831
           mov edx, PCM_OUT_CR_REG
832
           call [ctrl.ctrl_write8]
833
 
834
           mov edx, MC_IN_CR_REG
835
           call [ctrl.ctrl_write8]
836
           ret
837
endp
838
 
839
align 4
840
proc init_codec
841
           locals
842
             counter dd ?
843
           endl
844
 
845
           mov esi, msgControl
846
           call SysMsgBoardStr
847
 
848
           mov edx, GLOB_CTRL
849
           call [ctrl.ctrl_read32]
850
           call dword2str
851
           call SysMsgBoardStr
852
 
853
           mov esi, msgStatus
854
           call SysMsgBoardStr
855
 
856
           mov edx, CTRL_STAT
857
           call [ctrl.ctrl_read32]
858
 
859
           call dword2str
860
           call SysMsgBoardStr
861
 
862
           test eax, CTRL_ST_CREADY
863
           jnz .ready
864
 
865
           call reset_codec
866
           and eax, eax
867
           jz .err
868
 
869
           xor edx, edx     ;ac_reg_0
870
           call [ctrl.codec_write16]
871
 
872
           xor eax, eax
873
           mov edx, CODEC_REG_POWERDOWN
874
           call [ctrl.codec_write16]
875
 
876
           mov [counter], 200     ; total 200*5 ms = 1s
877
.wait:
878
           mov edx, CODEC_REG_POWERDOWN
879
           call [ctrl.codec_read16]
880
           and eax, 0x0F
881
           cmp eax, 0x0F
882
           jz .ready
883
 
884
           mov eax, 5000   ; wait 5 ms
885
           call StallExec
886
           sub [counter] , 1
887
           jnz .wait
888
.err:
889
           xor eax, eax        ; timeout error
890
           ret
891
.ready:
465 serge 892
           mov eax, 2      ;force set 16-bit 2-channel PCM
893
           mov edx, GLOB_CTRL
894
           call [ctrl.ctrl_write32]
895
           mov eax, 5000   ; wait 5 ms
896
           call StallExec
897
 
351 diamond 898
           call detect_codec
899
 
900
           xor eax, eax
901
           inc eax
902
           ret
903
endp
904
 
905
align 4
906
proc reset_codec
907
           mov edx, GLOB_CTRL
908
           call [ctrl.ctrl_read32]
909
 
910
           test eax, 0x02
911
           jz .cold
912
 
913
           call warm_reset
914
           jnc .ok
915
.cold:
916
           call cold_reset
917
           jnc .ok
918
 
919
     if DEBUG
920
           mov esi, msgCFail
921
           call SysMsgBoardStr
922
           end if
923
           xor eax, eax     ; timeout error
924
           ret
925
.ok:
926
     if DEBUG
927
           mov esi, msgResetOk
928
           call SysMsgBoardStr
929
     end if
930
 
931
           xor eax, eax
932
           inc eax
933
           ret
934
endp
935
 
936
align 4
937
proc warm_reset
938
           locals
939
             counter dd ?
940
           endl
941
 
942
           mov eax, 0x06
943
           mov edx, GLOB_CTRL
944
           call [ctrl.ctrl_write32]
945
 
946
     if DEBUG
947
           mov esi, msgWarm
948
           call SysMsgBoardStr
949
     end if
950
 
951
           mov [counter], 10    ; total 10*100 ms = 1s
952
.wait:
953
           mov eax, 100000    ; wait 100 ms
954
           call StallExec
955
 
956
           mov edx, GLOB_CTRL
957
           call [ctrl.ctrl_read32]
958
           test eax, 4
959
           jz .ok
960
           sub [counter], 1
961
           jnz .wait
962
 
963
     if DEBUG
964
           mov esi, msgWRFail
965
           call SysMsgBoardStr
966
     end if
967
 
968
           stc
969
           ret
970
.ok:
971
           mov edx, CTRL_STAT
972
           call [ctrl.ctrl_read32]
973
           and eax, CTRL_ST_CREADY
974
           jz .fail
975
           clc
976
           ret
977
.fail:
978
           stc
979
	   ret
980
endp
981
 
982
align 4
983
proc cold_reset
984
           locals
985
             counter dd ?
986
           endl
987
 
988
           xor eax, eax
989
           mov edx, GLOB_CTRL
990
           call [ctrl.ctrl_write32]
991
 
992
     if DEBUG
993
           mov esi, msgCold
994
           call SysMsgBoardStr
995
     end if
996
 
997
           mov eax, 1000000    ; wait 1 s
998
           call StallExec
999
 
1000
           mov eax, 2
1001
           mov edx, GLOB_CTRL
1002
           call [ctrl.ctrl_write32]
1003
 
1004
           mov [counter], 10    ; total 10*100 ms = 1s
1005
.wait:
1006
           mov eax, 100000    ; wait 100 ms
1007
           call StallExec
1008
 
1009
           mov edx, GLOB_CTRL
1010
           call [ctrl.ctrl_read32]
1011
           test eax, 4
1012
           jz .ok
1013
           sub [counter], 1
1014
           jnz .wait
1015
 
1016
     if DEBUG
1017
           mov esi, msgCRFail
1018
           call SysMsgBoardStr
1019
     end if
1020
           stc
1021
           ret
1022
.ok:
1023
           mov edx, CTRL_STAT
1024
           call [ctrl.ctrl_read32]
1025
           and eax, CTRL_ST_CREADY
1026
           jz .fail
1027
           clc
1028
           ret
1029
.fail:
1030
           stc
1031
           ret
1032
endp
1033
 
1034
align 4
378 serge 1035
play:
351 diamond 1036
           mov eax, 16
1037
           mov [ctrl.lvi_reg], eax
1038
           mov edx, PCM_OUT_LVI_REG
1039
           call [ctrl.ctrl_write8]
1040
 
1041
           mov edx, PCM_OUT_CR_REG
1042
           mov ax, 0x1D
1043
           call [ctrl.ctrl_write8]
378 serge 1044
           xor eax, eax
351 diamond 1045
           ret
1046
 
1047
align 4
378 serge 1048
stop:
351 diamond 1049
           mov edx, PCM_OUT_CR_REG
1050
           mov ax, 0x0
1051
           call [ctrl.ctrl_write8]
1052
 
1053
           mov ax, 0x1c
1054
           mov edx, PCM_OUT_SR_REG
1055
           call [ctrl.ctrl_write16]
378 serge 1056
           xor eax, eax
351 diamond 1057
           ret
1058
 
1059
align 4
1060
proc get_dev_info stdcall, p_info:dword
1061
           virtual at esi
1062
             CTRL_INFO CTRL_INFO
1063
           end virtual
1064
 
1065
           mov esi, [p_info]
1066
           mov eax, [ctrl.int_line]
1067
           mov ebx, [ctrl.codec_io_base]
1068
           mov ecx, [ctrl.ctrl_io_base]
1069
           mov edx, [ctrl.codec_mem_base]
1070
           mov edi, [ctrl.ctrl_mem_base]
1071
 
1072
           mov [CTRL_INFO.irq], eax
1073
           mov [CTRL_INFO.codec_io_base], ebx
1074
           mov [CTRL_INFO.ctrl_io_base], ecx
1075
           mov [CTRL_INFO.codec_mem_base], edx
1076
           mov [CTRL_INFO.ctrl_mem_base], edi
1077
 
1078
           mov eax, [codec.chip_id]
1079
           mov [CTRL_INFO.codec_id], eax
1080
 
1081
           mov edx, GLOB_CTRL
1082
           call [ctrl.ctrl_read32]
1083
           mov [CTRL_INFO.glob_cntrl], eax
1084
 
1085
           mov edx, CTRL_STAT
1086
           call [ctrl.ctrl_read32]
1087
           mov [CTRL_INFO.glob_sta], eax
1088
 
1089
           mov ebx, [ctrl.pci_cmd]
1090
           mov [CTRL_INFO.pci_cmd], ebx
1091
           ret
1092
endp
1093
 
1094
align 4
1095
proc set_callback stdcall, handler:dword
1096
           mov eax, [handler]
1097
           mov [ctrl.user_callback], eax
1098
           ret
1099
endp
1100
 
1101
align 4
1102
proc codec_read stdcall, ac_reg:dword	   ; reg = edx, reval = eax
1103
 
1104
           mov edx, [ac_reg]
1105
 
1106
           mov ebx, edx
1107
           shr ebx, 1
1108
           bt [codec.shadow_flag], ebx
1109
           jc .use_shadow
1110
 
1111
           call [ctrl.codec_read16]  ;change edx !!!
1112
           mov ecx, eax
1113
 
1114
           mov edx, CTRL_STAT
1115
           call [ctrl.ctrl_read32]
1116
           test eax, CTRL_ST_RCS
1117
           jz .read_ok
1118
 
1119
           mov edx, CTRL_STAT
1120
           call [ctrl.ctrl_write32]
1121
           xor eax,eax
1122
           not eax  ;timeout
1123
           ret
1124
.read_ok:
1125
           mov edx, [ac_reg]
1126
           mov [codec.regs+edx], cx
1127
           bts [codec.shadow_flag], ebx
1128
           mov eax, ecx
1129
           ret
1130
.use_shadow:
1131
           movzx eax, word [codec.regs+edx]
1132
           ret
1133
endp
1134
 
1135
align 4
1136
proc codec_write stdcall, ac_reg:dword
1137
           push eax
1138
           call check_semafore
1139
           and eax, eax
1140
           jz .err
1141
           pop eax
1142
 
1143
           mov esi, [ac_reg]
1144
           mov edx, esi
1145
           call [ctrl.codec_write16]
1146
           mov [codec.regs+esi], ax
1147
           shr esi, 1
1148
           bts [codec.shadow_flag], esi
1149
           ret
1150
.err:
1151
           pop eax
1152
           ret
1153
endp
1154
 
1155
align 4
1156
proc codec_check_ready
1157
 
1158
           mov edx, CTRL_ST
1159
           call [ctrl.ctrl_read32]
1160
           and eax, CTRL_ST_CREADY
1161
           jz .not_ready
1162
 
1163
           xor eax, wax
1164
           inc eax
1165
           ret
1166
.not_ready:
1167
           xor eax, eax
1168
           ret
1169
endp
1170
 
1171
align 4
1172
proc check_semafore
1173
           local counter:DWORD
1174
 
1175
           mov [counter], 100
1176
.l1:
1177
           mov edx, CTRL_CAS
1178
           call [ctrl.ctrl_read8]
1179
           and eax, CAS_FLAG
1180
           jz .ok
1181
 
1182
           mov eax, 1
1183
           call StallExec
1184
           sub [counter], 1
1185
           jnz .l1
1186
           xor eax, eax
1187
           ret
1188
align 4
1189
.ok:
1190
           xor eax,eax
1191
           inc eax
1192
           ret
1193
endp
1194
 
1195
align 4
1196
proc StallExec
1197
           push ecx
1198
           push edx
1199
           push ebx
1200
           push eax
1201
 
1202
           mov ecx, CPU_FREQ
1203
           mul ecx
1204
           mov ebx, eax       ;low
1205
           mov ecx, edx       ;high
1206
           rdtsc
1207
           add ebx, eax
1208
           adc ecx,edx
1209
@@:
1210
           rdtsc
1211
           sub eax, ebx
1212
           sbb edx, ecx
1213
           js @B
1214
 
1215
           pop eax
1216
           pop ebx
1217
           pop edx
1218
           pop ecx
1219
           ret
1220
endp
1221
 
1222
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1223
;          CONTROLLER IO functions
1224
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1225
 
1226
align 4
1227
proc codec_io_r16
1228
           add edx, [ctrl.codec_io_base]
1229
           in  ax, dx
1230
           ret
1231
endp
1232
 
1233
align 4
1234
proc codec_io_w16
1235
           add edx, [ctrl.codec_io_base]
1236
           out dx, ax
1237
           ret
1238
endp
1239
 
1240
align 4
1241
proc ctrl_io_r8
1242
           add edx, [ctrl.ctrl_io_base]
1243
           in  al, dx
1244
           ret
1245
endp
1246
 
1247
align 4
1248
proc ctrl_io_r16
1249
           add edx, [ctrl.ctrl_io_base]
1250
           in  ax, dx
1251
           ret
1252
endp
1253
 
1254
align 4
1255
proc ctrl_io_r32
1256
           add edx, [ctrl.ctrl_io_base]
1257
           in  eax, dx
1258
           ret
1259
endp
1260
 
1261
align 4
1262
proc ctrl_io_w8
1263
           add edx, [ctrl.ctrl_io_base]
1264
           out dx, al
1265
           ret
1266
endp
1267
 
1268
align 4
1269
proc ctrl_io_w16
1270
           add edx, [ctrl.ctrl_io_base]
1271
           out dx, ax
1272
           ret
1273
endp
1274
 
1275
align 4
1276
proc ctrl_io_w32
1277
           add edx, [ctrl.ctrl_io_base]
1278
           out dx, eax
1279
           ret
1280
endp
1281
 
1282
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1283
;         MEMORY MAPPED IO    (os depended)
1284
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1285
 
1286
align 4
1287
proc codec_mem_r16
1288
           add edx, [ctrl.codec_mem_base]
1289
           mov ax, word [edx]
1290
           ret
1291
endp
1292
 
1293
align 4
1294
proc codec_mem_w16
1295
           add edx, [ctrl.codec_mem_base]
1296
           mov word [edx], ax
1297
           ret
1298
endp
1299
 
1300
align 4
1301
proc ctrl_mem_r8
1302
           add edx, [ctrl.ctrl_mem_base]
1303
           mov al, [edx]
1304
           ret
1305
endp
1306
 
1307
align 4
1308
proc ctrl_mem_r16
1309
           add edx, [ctrl.ctrl_mem_base]
1310
           mov ax, [edx]
1311
           ret
1312
endp
1313
 
1314
align 4
1315
proc ctrl_mem_r32
1316
           add edx, [ctrl.ctrl_mem_base]
1317
           mov eax, [edx]
1318
           ret
1319
endp
1320
 
1321
align 4
1322
proc ctrl_mem_w8
1323
           add edx, [ctrl.ctrl_mem_base]
1324
           mov [edx], al
1325
           ret
1326
endp
1327
 
1328
align 4
1329
proc ctrl_mem_w16
1330
           add edx, [ctrl.ctrl_mem_base]
1331
           mov [edx], ax
1332
           ret
1333
endp
1334
 
1335
align 4
1336
proc ctrl_mem_w32
1337
           add edx, [ctrl.ctrl_mem_base]
1338
           mov [edx], eax
1339
           ret
1340
endp
1341
 
1342
align 4
1343
dword2str:
1344
      mov  esi, hex_buff
1345
      mov ecx, -8
1346
@@:
1347
      rol eax, 4
1348
      mov ebx, eax
1349
      and ebx, 0x0F
1350
      mov bl, [ebx+hexletters]
1351
      mov [8+esi+ecx], bl
1352
      inc ecx
1353
      jnz @B
1354
      ret
1355
 
1356
hexletters   db '0123456789ABCDEF'
1357
hex_buff     db 8 dup(0),13,10,0
1358
 
1359
 
1360
include "codec.inc"
1361
 
1362
align 4
1363
devices dd (CTRL_ICH  shl 16)+VID_INTEL,msg_ICH, set_ICH
378 serge 1364
        dd (CTRL_ICH0 shl 16)+VID_INTEL,msg_ICH0,set_ICH
1365
        dd (CTRL_ICH2 shl 16)+VID_INTEL,msg_ICH2,set_ICH
1366
        dd (CTRL_ICH3 shl 16)+VID_INTEL,msg_ICH3,set_ICH
351 diamond 1367
        dd (CTRL_ICH4 shl 16)+VID_INTEL,msg_ICH4,set_ICH4
1368
        dd (CTRL_ICH5 shl 16)+VID_INTEL,msg_ICH5,set_ICH4
1369
        dd (CTRL_ICH6 shl 16)+VID_INTEL,msg_ICH6,set_ICH4
1370
        dd (CTRL_ICH7 shl 16)+VID_INTEL,msg_ICH7,set_ICH4
1371
 
1372
        dd (CTRL_NFORCE  shl 16)+VID_NVIDIA,msg_NForce, set_ICH
1373
        dd (CTRL_NFORCE2 shl 16)+VID_NVIDIA,msg_NForce2,set_ICH
1374
        dd (CTRL_NFORCE3 shl 16)+VID_NVIDIA,msg_NForce3,set_ICH
1375
        dd (CTRL_MCP04   shl 16)+VID_NVIDIA,msg_MCP04,set_ICH
1376
        dd (CTRL_CK804   shl 16)+VID_NVIDIA,msg_CK804,set_ICH
1377
        dd (CTRL_CK8     shl 16)+VID_NVIDIA,msg_CK8,set_ICH
1378
        dd (CTRL_CK8S    shl 16)+VID_NVIDIA,msg_CK8S,set_ICH
1379
        dd (CTRL_MCP51   shl 16)+VID_NVIDIA,msg_MCP51,set_ICH
1380
 
1381
        dd 0    ;terminator
1382
 
1383
 
465 serge 1384
version      dd (5 shl 16) or (API_VERSION and 0xFFFF)
1385
 
351 diamond 1386
msg_ICH      db 'Intel ICH',  13,10, 0
1387
msg_ICH0     db 'Intel ICH0', 13,10, 0
1388
msg_ICH2     db 'Intel ICH2', 13,10, 0
1389
msg_ICH3     db 'Intel ICH3', 13,10, 0
1390
msg_ICH4     db 'Intel ICH4', 13,10, 0
1391
msg_ICH5     db 'Intel ICH5', 13,10, 0
1392
msg_ICH6     db 'Intel ICH6', 13,10, 0
1393
msg_ICH7     db 'Intel ICH7', 13,10, 0
1394
msg_Intel    db 'Intel Corp. ', 0
1395
 
1396
msg_NForce   db 'NForce',      13,10, 0
1397
msg_NForce2  db 'NForce 2',    13,10, 0
1398
msg_NForce3  db 'NForce 3',    13,10, 0
1399
msg_MCP04    db 'NForce MCP04',13,10, 0
1400
msg_CK804    db 'NForce CK804',13,10, 0
1401
msg_CK8      db 'NForce CK8',  13,10, 0
1402
msg_CK8S     db 'NForce CK8S', 13,10, 0
1403
msg_MCP51    db 'NForce MCP51',13,10, 0
1404
 
1405
msg_NVidia   db 'NVidia', 0
1406
 
1407
szKernel	    db 'KERNEL', 0
1408
sz_sound_srv	    db 'SOUND',0
1409
 
1410
msgInit      db 'detect hardware...',13,10,0
1411
msgFail      db 'device not found',13,10,0
1412
msgAttchIRQ  db 'IRQ line not supported', 13,10, 0
1413
msgInvIRQ    db 'IRQ line not assigned or invalid', 13,10, 0
1414
msgPlay      db 'start play', 13,10,0
1415
msgStop      db 'stop play',  13,10,0
1416
msgNotify    db 'call notify',13,10,0
1417
msgIRQ       db 'AC97 IRQ', 13,10,0
1418
msgInitCtrl  db 'init controller',13,10,0
1419
msgInitCodec db 'init codec',13,10,0
1420
msgPrimBuff  db 'create primary buffer',13,10,0
1421
msgReg       db 'set service handler',13,10,0
1422
msgOk        db 'service installed',13,10,0
1423
msgCold      db 'cold reset',13,10,0
1424
msgWarm      db 'warm reset',13,10,0
1425
msgWRFail    db 'warm reset failed',13,10,0
1426
msgCRFail    db 'cold reset failed',13,10,0
1427
msgCFail     db 'codec not ready',13,10,0
1428
msgResetOk   db 'reset complete',13,10,0
1429
msgStatus    db 'global status   ',0
1430
msgControl   db 'global control  ',0
1431
 
1432
section '.data' data readable writable align 16
1433
 
1434
pcmout_bdl       rq 32
1435
buff_list        rd 32
1436
 
1437
codec CODEC
1438
ctrl AC_CNTRL
1439
 
1440
lpc_bus  rd 1
1441
civ_val  rd 1